Search Results

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

Page 80/604 | < Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >

  • How to create reference tables using fluent nhibernate

    - by Akk
    How can i create a 3 table schema from the following model classes. public class Product { public int Id {get; set;} public string Name {get; set;} public IList<Photo> Photos {get; set;} } public class Photo { public int Id {get; set;} public string Path {get; set;} } I want to create the following table structure in the database: Product ------- Id Name ProductPhotos ------------- ProductId (FK Products.Id) PhotoId (FK Photos.Id) Photos ------ Id Path How i can express the above Database Schema using Fluent NHibernate? I could only manage the following the Mapping but this does not get me the 3rd Photo ref table. public class ProductMap : ClassMap<Product> { public CityMap() { Id(x => x.Id); Map(x => x.Name); Table("Products"); HasMany(x => x.Photos).Table("ProductPhotos").KeyColumn("ProductId"); } }

    Read the article

  • Disallow taking pointer/reference to const to a temporary object in C++ (no C++0X)

    - by KRao
    Hi, I am faced with the following issue. Consider the following class: //Will be similar to bost::reference_wrapper template<class T> class Ref { public: explicit Ref(T& t) : m_ptr(&t) {} private: T* m_ptr; }; and this function returning a double double fun() {return 1.0;} If we now have double x = 1.0; const double xc = 1.0; Ref<double> ref1(x); //OK Ref<const double> refc1(cx); //OK good so far, however: //Ref<double> ref2( fun() ); //Fails as I want it to Ref<const double> refc2( fun() ); //Works but I would like it not to Is there a way to modify Ref (the way you prefer) but not the function fun, so that the last line returns a compile-time error? Please notice you can modify the constructor signature (as long as I am able to initialise the Ref as intended). Thank you in advance for your help!

    Read the article

  • Haskell Input & Passing Values to Functions

    - by Pradeep
    putStrLn "Enter the Artist Name" art <- getLine putStrLn "Enter the Number of CD's" num <- getLine let test= buyItem currentStockBase art num printListIO (showcurrentList test) the values i have to pass for buyItem is buyItem currentStockBase "Akon" 20 but i want to send "Akon" to art and for 20 i want to send num it gives me this error ERROR file:.\Project2.hs:126 - Type error in application *** Expression : buyItem currentStockBase art num *** Term : num *** Type : [Char] *** Does not match : Int please help me

    Read the article

  • passing an extra parameter in jobschedule in node.js

    - by Sush
    Is there any possible way to pass any extra parameter instead of date in schedule.scheduleJob(date,function(id)) The below code is not working var id =record.id; var date =record.date; jobsCollection.save({ id: record.id }, { $set: record }, function (err, result) { var j = schedule.scheduleJob(date, function (id) { return function () { console.log("inside----------") console.log(id) }; }(id)); if (!err) { return context.sendJson([], 404);; } }); i want to pass the date along with another data to schedule jobs. so that i can perform other operations based on the date schedule and that id

    Read the article

  • if a JAR is placed on app servers's classpath how do we reference it from JSP

    - by Omnipresent
    On our application we are getting an error saying: PWC6117: File "/struts-tags" not found code in the file thats giving error is: <%@ taglib prefix="s" uri="/struts-tags" %> This file is in struts2-core.jar which is placed on the classpath of the app server (Sun 9.1). The code will work fine and not complain when the jar is actually in WEB-INF/lib of the application, compared to being on classpath of the appserver. But we can not change that. it has to be on appservers classpath. But how should we change our code so that this error goes away? I can create mapping in my web.xml so that tag uri's are change. but what should taglib-location be changed to? so that it references to app servers classpath? <taglib> <taglib-uri>/WEB-INF/struts-tags.tld</taglib-uri> <taglib-location>/WEB-INF/struts-tags.tld</taglib-location> </taglib>

    Read the article

  • Evaluation of (de)reference operators

    - by Micha
    I have an (uncommented...) source file which I'm trying to understand. static const Map *gCurMap; static std::vector<Map> mapVec; then auto e = mapVec.end(); auto i = mapVec.begin(); while(i!=e) { // ... const Map *map = gCurMap = &(*(i++)); // ... } I don't understand what &(*(i++)) does. It does not compile when just using i++, but to me it looks the same, because I'm "incrementing" i, then I'm requesting the value at the given address and then I'm requesting the address of this value?!

    Read the article

  • passing a parameter from an other model on ruby

    - by MAGE
    I'm very newbie in ruby and need your help. I must save a "Topic" and make it like this : @topic = Topic.new(params[:topic]) But I would like to pass an other information to this topic. It has a field "community_id" that link it to a community. The logged user has this information on his table. How can I pass the "community_id" from the logged user to the "community_id" of the "topic" created ? thx for your help

    Read the article

  • Passing trough a datagrid value

    - by Tonz
    I have a datagrid with 2 columns. One databound which display names and the other one is a hyperlink column. Column1 = databound column, Column2 = hyperlink column. column1: column2: --------------------- Name1 Modify Name2 Modify Next when i click on any of the values in Column2 i simply get redirected to a other page. This page contains 2 buttons/hyperlinks with Yes or No. (does not mather wich control, which one would bring the most easy to implement solution atm) When clicked on No it simply redirects back to the orignal page. Now the question is when i press "Yes" how exactly do i acces "Name1" (or Name2 if i press on the second modify)? Meaning if i press Yes i want to use this Name for certain opertions (xml). To put it short if i press on "modify" i want to be able to get that name associated with it (which is already displayed in the first bound column left of it). So the goal is to use that name in Xpath for example so i can make a query towards that node with that certain name. Hopefully this made some sence.

    Read the article

  • passing arg2 of 'listFind' from incompatible pointer type

    - by lego69
    Hello, I've got some problem with my function and don't know how to solve this problem, This is my code: ListResult result=listFind(currentLines, compareBasicLines, &linePrototype); <-here problem compareBasicLines pointer to function int compareBasicLines(ptrLine line1, ptrLine line2){ COMPARE_NUMBER_STRINGS(line1, line2); } COMPARE_NUMBER_STRINGS(line1, line2); defined in another file #define COMPARE_NUMBER_STRINGS(var1, var2) \ if(var1 == NULL || var2 == NULL){ \ return 0; \ } \ return strcmp(var1->strNumber, var2->strNumber); thanks in advance for everyone

    Read the article

  • ASP.NET MVC 2 Form Not Passing Values

    - by Wayne
    Hi, I have a strange problem happening today. I am running the latest version of the MVC V2 framework and have been having no trouble at all - I came in this morning and for some reason values aren't being passed in to actions. To clarify lets say I have something like this: <% using (Html.BeginForm("Register", "Registration", FormMethod.Post)) { %> .... <input type="submit" name="register" id="register" value="Register" /> <% } %> And in my controller I have the following: [HttpPost] public ActionResult Register(RegistrationModel model, string register) { // At this point the register string is null } This has been working fine for a while now and I have not changed anything that I can think of that would cause this to happen. Does that make sense and as anyone any idea what is going on or what I have messed up? Thanks.

    Read the article

  • c Pointer to pointer, or passing list to functions

    - by user361808
    Hi, I am new to c programming. Could anyone please tell me what's wrong with the following program? typedef struct Person_s { int age; char name[40]; } Person_t; int process_list(int *countReturned, Person_t **p_list) { Person_t *rowPtr=0; //the actual program will fethc data from DB int count =1; if(!((*p_list) = (Person_t *) malloc(sizeof(Person_t)))) { return -1; } rowPtr = *p_list; rowPtr[count-1].age =19; strcpy(rowPtr[count-1].name,"Prince Dastan"); *countReturned = count; return 0; } int main(int argc, char *argv[]) { Person_t *tmpPerson=0; Person_t **p_list=0; int *count=0; int i; process_list(count,p_list); tmpPerson = *p_list; for(i=0; i< *count; i++) { printf("Name: %s , age: %d\n",tmpPerson->name,tmpPerson->age); tmpPerson++; } //free(tmpPerson); return 0; }

    Read the article

  • Entity Framework - Store parent reference on child relationship (one -> many)

    - by contactmatt
    I have a setup like this: [Table("tablename...")] public class Branch { public Branch() { Users = new List<User>(); } [Key] public int Id { get; set; } public string Name { get; set; } public List<User> Users { get; set; } } [Table("tablename...")] public class User { [Key] public int Id {get; set; } public string Username { get; set; } public string Password { get; set; } [ForeignKey("ParentBranch")] public int? ParentBranchId { get; set; } // Is this possible? public Branch ParentBranch { get; set; } // ??? } Is it possible for the User to know what parent branch it belongs to? The code above is not working. Entity Framework version 5.0 .NET 4.0 c#

    Read the article

  • Laravel Passing variable not working

    - by Friend
    Hello People here is my code i have used in controller... public function bulk() { return View::make('bulk')->with('message','hii there'); } my route file contains... Route::get('bulk',array('uses'=>'HomeController@bulk'))->before('auth'); In my view Iam testing it by ... @if(Session::has('message')) Present @else not Present @endif The page is making a view with the message 'not Present' why is it?? I even tried return Redirect::to('bulk')->with('message','hii there'); I get an erro mesage on Console mypro/public/bulk net::ERR_TOO_MANY_REDIRECTS What could be the problem?? is there any issues with name?? I tried this method earlier which worked fine for me.... :( Iam using Blade Template..

    Read the article

  • jQuery Reference First Column in HTML Table

    - by Vic
    I have a table where all of the cells are INPUT tags. I have a function which looks for the first input cell and replaces it with it's value. So this: <tr id="row_0" class="datarow"> <td><input class="tabcell" value="Injuries"></td> <td><input class="tabcell" value="01"></td> becomes this: <tr id="row_0" class="datarow"> <td>Injuries</td> <td><input class="tabcell" value="01"></td> Here is the first part of the function: function setRowLabels() { var row = []; $('.dataRow').each(function(i) { row.push($('td input:eq(0)', this).val() + ' - '); $('td input:eq(0)', this).replaceWith($('td input:eq(0)', this).val()); $('td input:gt(0)', this).each(function(e) { etcetera But when the page reloads, the first column is not an input type, so it changes the second column to text too! Can I tell it to only change the first column, no matter what the type is? I tried $('td:eq(0)', this).replaceWith($('td:eq(0)', this).val()); but it does not work. Any suggestions appreciated! Thanks

    Read the article

  • [SOLVED]Django - Passing variables to template based on db

    - by George 'Griffin
    I am trying to add a feature to my app that would allow me to enable/disable the "Call Me" button based on whether or not I am at [home|the office]. I created a model in the database called setting, it looks like this: class setting(models.Model): key = models.CharField(max_length=200) value = models.CharField(max_length=200) Pretty simple. There is currently one row, available, the value of it is the string True. I want to be able to transparently pass variables to the templates like this: {% if available %} <!-- Display button --> {% else %} <!-- Display grayed out button --> {% endif %} Now, I could add logic to every view that would check the database, and pass the variable to the template, but I am trying to stay DRY. What is the best way to do this? UPDATE I created a context processor, and added it's path to the TEMPLATE_CONTEXT_PROCESSORS, but it is not being passed to the template def available(request): available = Setting.objects.get(key="available") if open.value == "True": return {"available":True} else: return {} UPDATE TWO If you are using the shortcut render_to_response, you need to pass an instance of RequestContext to the function. from the django documentation: If you're using Django's render_to_response() shortcut to populate a template with the contents of a dictionary, your template will be passed a Context instance by default (not a RequestContext). To use a RequestContext in your template rendering, pass an optional third argument to render_to_response(): a RequestContext instance. Your code might look like this: def some_view(request): # ... return render_to_response('my_template.html', my_data_dictionary, context_instance=RequestContext(request)) Many thanks for all the help!

    Read the article

  • fancybox - passing 'this' to onClosed function

    - by Phil Jackson
    Hi this is probly really simple but I juast cant seem to figure it out! if( is_logged_out( html ) ) { var throughClick = $(this); $.fancybox( html, { 'autoDimensions' : false, 'width' : 'auto', 'height' : 'auto', 'transitionIn' : 'none', 'transitionOut' : 'none', 'hideOnOverlayClick' : false, 'showCloseButton' : false, 'onClosed' : function( throughClick ) { alert(throughClick.attr('name')); throughClick.trigger('click'); } }); }else{ All i want to do is pass the object of whichever button or link that was clicked, so once the user has logged back in it will process again. Any help is much appreciated.

    Read the article

  • Passing a class ("Country.class") as an argument in Java

    - by Coronatus
    I'm trying to make a method that takes an argument of Country.class, User.class etc, and returns argument.count(). All the possible classes that I would give to this method extend from Model and have the method count(). My code: private static long <T> countModel(Model<T> clazz) { return clazz.count(); } Called by: renderArgs.put("countryCount", countModel(Country.class)); However this just doesn't work at all. How do I do this, please?

    Read the article

  • Codeigniter passing variable to URL

    - by CyberJunkie
    I have a list of posts and an edit link for each. When clicking edit it goes to a page where I can edit the specific post I clicked on. For this I will have to pull from the db the id of the post. Would this be the correct way to do it? <a href="<?php echo site_url("post/edit/$row->id"); ?>">Edit</a> post is my controller, edit is my function, and $row->id should pull the id of the post.

    Read the article

  • Passing arguments to a function?

    - by dfjhdfjhdf
    I need to learn how to pass an associative array to a function so that I could do the following within the function: function someName($argums) { if (gettype($argums) != 'array' || !array_key_exists('myOneKey', $argums) || !array_key_exists('myOtherKey', $argums)) { return false; } /*do other stuff*/ } (That's how I would do in PHP what I am looking for in JavaScript.)

    Read the article

  • Old functions return 'undefined' error once I add a jquery reference

    - by Lapa
    Disregard this question: I've simply confused <script src="..."></script> tag and <script> [some functions] </scipt> tags. I have this function function OnLoad() { ShowHideConfirmAnswers(); return true; } triggered by onload event: <body onload=OnLoad()> It works fine until I add src="jquery-1.4.2.js" to the script element. From this moment I get "OnLoad is not defined" error, and the same happens to every other javascript function.

    Read the article

  • passing id to controller

    - by coure06
    I have 4-5 partial view files (.ascx) like abc.ascx, cde.ascx, fgh.ascx. I want to return different partial views based on the name of the view passed to url parameter like this /someservice/abc will go to action someservice and will return abc.ascx partial view. /someservice/cde will go to action someservice and will return cde.ascx partial view. How can achieve this?

    Read the article

  • Problem with passing array of pointers to struct among functions in C

    - by karatemonkey
    The Code that follows segfaults on the call to strncpy and I can't see what I am doing wrong. I need another set of eyes to look it this. Essentially I am trying to alloc memory for a struct that is pointed to by an element in a array of pointers to struct. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_POLICY_NAME_SIZE 64 #define POLICY_FILES_TO_BE_PROCESSED "SPFPolicyFilesReceivedOffline\0" typedef struct TarPolicyPair { int AppearanceTime; char *IndividualFile; char *FullPolicyFile; } PolicyPair; enum { bwlist = 0, fzacts, atksig, rules, MaxNumberFileTypes }; void SPFCreateIndividualPolicyListing(PolicyPair *IndividualPolicyPairtoCreate ) { IndividualPolicyPairtoCreate = (PolicyPair *) malloc(sizeof(PolicyPair)); IndividualPolicyPairtoCreate->IndividualFile = (char *)malloc((MAX_POLICY_NAME_SIZE * sizeof(char))); IndividualPolicyPairtoCreate->FullPolicyFile = (char *)malloc((MAX_POLICY_NAME_SIZE * sizeof(char))); IndividualPolicyPairtoCreate->AppearanceTime = 0; memset(IndividualPolicyPairtoCreate->IndividualFile, '\0', (MAX_POLICY_NAME_SIZE * sizeof(char))); memset(IndividualPolicyPairtoCreate->FullPolicyFile, '\0', (MAX_POLICY_NAME_SIZE * sizeof(char))); } void SPFCreateFullPolicyListing(SPFPolicyPair **CurrentPolicyPair, char *PolicyName, char *PolicyRename) { int i; for(i = 0; i < MaxNumberFileTypes; i++) { CreateIndividualPolicyListing((CurrentPolicyPair[i])); // segfaults on this call strncpy((*CurrentPolicyPair)[i].IndividualFile, POLICY_FILES_TO_BE_PROCESSED, (SPF_POLICY_NAME_SIZE * sizeof(char))); } } int main() { SPFPolicyPair *CurrentPolicyPair[MaxNumberFileTypes] = {NULL, NULL, NULL, NULL}; int i; CreateFullPolicyListing(&CurrentPolicyPair, POLICY_FILES_TO_BE_PROCESSED, POLICY_FILES_TO_BE_PROCESSED); return 0; }

    Read the article

  • passing a float as a pointer to a matrix

    - by numerical25
    Honestly, I couldnt think of a better title for this issue because I am having 2 problems and I don't know the cause. The first problem I have is this //global declaration float g_posX = 0.0f; ............. //if keydown happens g_posX += 0.03f; &m_mtxView._41 = g_posX; I get this error cannot convert from 'float' to 'float *' So I assume that the matrix only accepts pointers. So i change the varible to this.... //global declaration float *g_posX = 0.0f; ............. //if keydown happens g_posX += 0.03f; &m_mtxView._41 = &g_posX; and I get this error cannot convert from 'float' to 'float *' which is pretty much saying that I can not declare g_posX as a pointer. honestly, I don't know what to do.

    Read the article

  • Passing values between web pages

    - by Khou
    I need to pass a dollar amount from one webpageto another webpage without letting the user modify the values when the values are passed between these pages. ie Page 1 (entry page) to Page 2 (confirmation page) What is the best way to do this?

    Read the article

< Previous Page | 76 77 78 79 80 81 82 83 84 85 86 87  | Next Page >