Search Results

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

Page 73/604 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • Passing a filepath to a R function?

    - by Philipp
    Hi everybody, I tried to pass a filepath to a function in R, but I failed =/ I hope someone here can help me. >heat <- function(filepath) { chicks <- read.table(file=filepath, dec=",", header=TRUE, sep="\t") ... } When I call the function, nothing happens... >heat("/home/.../file.txt") ... and "chicks" is not found >chicks Error: Object 'chicks' not found What is the correct way to pass a path to a function? Best wishes from Germany, Phil

    Read the article

  • Looking for substantial open source GWT/App-Engine project to use as reference

    - by tempy
    I'm working on GAE-J/GWT app, wherein a desktop app connects to the GAE-J component, and there is also a web-app component whose front-end is written in GWT, and the GAE-J backend supports both the desktop app and the web app. I have a good amount of experience with writing pure server code and desktop code, but not so much on the web-app side of things. So I'm looking to study some good sophisticated open source code to see how other's have done things, but I can't find much open source GWT and/or GAE-J stuff, other than frameworks. Does anyone know of any good projects out there?

    Read the article

  • passing multiple queries to view with codeigniter

    - by LvS
    I am trying to build a forum with Codeigniter. So far i have the forums themselves displayed and the threads displayed, based on the creating dynamic news tutorial. But that is 2 different pages, i need to obviously display them into one page, like this: Forum 1 - thread 1 - thread 2 - thread 3 Forum 2 - thread 1 - thread 2 etc. And then the next step is obviously to display all the posts in a thread. Most likely with some pagination going on. But that is for later. For now i have the forum controller (slimmed version): <?php class Forum extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('forum_model'); $this->lang->load('forum'); $this->lang->load('dutch'); } public function index() { $data['forums'] = $this->forum_model->get_forums(); $data['title'] = $this->lang->line('title'); $data['view'] = $this->lang->line('view'); $this->load->view('templates/header', $data); $this->load->view('forum/index', $data); $this->load->view('templates/footer'); } public function view($slug) { $data['forum_item'] = $this->forum_model->get_forums($slug); if (empty($data['forum_item'])) { show_404(); } $data['title'] = $data['forum_item']['title']; $this->load->view('templates/header', $data); $this->load->view('forum/view', $data); $this->load->view('templates/footer'); } } ?> And the forum_model (also slimmed down) <?php class Forum_model extends CI_Model { public function __construct() { $this->load->database(); } public function get_forums($slug = FALSE) { if ($slug === FALSE) { $query= $this->db->get('forum'); return $query->result_array(); } $query = $this->db->get_where('forum', array('slug' => $slug)); return $query->row_array(); } public function get_threads($forumid, $limit, $offset) { $query = $this->db->get_where('thread', array('forumid', $forumid), $limit, $offset); return $query->result_array(); } } ?> And the view file <?php foreach ($forums as $forum_item): ?> <h2><?=$forum_item['title']?></h2> <div id="main"> <?=$forum_item['description']?> </div> <p><a href="forum/<?php echo $forum_item['slug'] ?>"><?=$view?></a></p> <?php endforeach ?> Now that last one, i would like to have something like this: <?php foreach ($forums as $forum_item): ?> <h2><?=$forum_item['title']?></h2> <div id="main"> <?=$forum_item['description']?> </div> <?php foreach ($threads as $thread_item): ?> <h2><?php echo $thread_item['title'] ?></h2> <p><a href="thread/<?php echo $thread_item['slug'] ?>"><?=$view?></a></p> <?php endforeach ?> <?php endforeach ?> But the question is, how do i get the model to return like a double query to the view, so that it contains both the forums and the threads within each forum. I tried to make a foreach loop in the get_forum function, but when i do this: public function get_forums($slug = FALSE) { if ($slug === FALSE) { $query= $this->db->get('forum'); foreach ($query->row_array() as $forum_item) { $thread_query=$this->get_threads($forum_item->forumid, 50, 0); } return $query->result_array(); } $query = $this->db->get_where('forum', array('slug' => $slug)); return $query->row_array(); } i get the error A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: models/forum_model.php Line Number: 16 I hope anyone has some good tips, thanks! Lenny *EDIT*** Thanks for the feedback. I have been puzzling and this seems to work now :) $query= $this->db->get('forum'); foreach ($query->result() as $forum_item) { $forum[$forum_item->forumid]['title']=$forum_item->title; $thread_query=$this->db->get_where('thread', array('forumid' => $forum_item->forumid), 20, 0); foreach ($thread_query->result() as $thread_item) { $forum[$forum_item->forumid]['thread'][]=$thread_item->title; } } return $forum; } What is now next, is how to display this multidimensional array in the view, with foreach statements.... Any suggestions ? Thanks

    Read the article

  • Passing variables from a thread to another form using C#

    - by kirstom14
    Hi, I am trying to pass 2 variables from a thread, in the MainForm, to another form, but when doing so an error occurs. private void TrackingThread( ) { float targetX = 0; float targetY = 0; while ( true ) { camera1Acquired.WaitOne( ); camera2Acquired.WaitOne( ); lock ( this ) { // stop the thread if it was signaled if ( ( x1 == -1 ) && ( y1 == -1 ) && ( x2 == -1 ) && ( y2 == -1 ) ) { break; } // get middle point targetX = ( x1 + x2 ) / 2; targetY = ( y1 + y2 ) / 2; } if (directionForm != null) { directionForm.RunMotors(targetX, targetY); } } } In the form, directionForm, I am simply displaying the variables targetX and targetY. The code for the directionForm.RunMotors() is the following: public void RunMotors(float x, float y) { label1.Text = "X-ordinate " + x.ToString(); label2.Text = "Y-ordinate " + y.ToString(); } The error happen when I am trying to display the two variables: "InvalidOperationException was unhandled Cross-threading operation not valid: Control label1 accessed from a thread other than . the thread it was created on" What shall I do??? Thanks in advance

    Read the article

  • Drupal Ubercart: error in passing values back to the Content Type after checkout

    - by user512826
    I am trying to set up event registration in a drupal site using Ubercart + the UC Node Checkout Module. I have followed the instructions provided in http://drupaleasy.com/blogs/ultimike/2009/03/event-registration-ubercart. However I seem to be unable to pass the Order ID and Payment Status back to the node. I have created a conditional action that on node checkout executes the following PHP code: I am using the following code to update the node on checkout - but nothing happens: if (isset($order)) { foreach ($order->products as $product) { if (isset($product->data['node_checkout_nid'])) { $node = node_load($product->data['node_checkout_nid']); $node->field_status['0']['value'] = 1; $node->field_orderid['0']['value'] = $order->order_id; node_save($node); } } } I know the conditional action is working because it prints dsm('hello world') messages on node checkout - however when I include a dsm($node) or dsm($product) in the PHP code, they return blank. Also when I go back to my product and click the 'Devel' tab, the 'data' string contains the following characters: a:1:{s:13:"form_build_id";s:37:"form-3ccc03345f4832c69666a89c560de940";} In this link http://www.ubercart.org/forum/support/10951/node_checkout_issue I found someone else with the same issue, but I have been unable to replicate his solution. Can anybody please help? Thanks so much!

    Read the article

  • domain -> subdomain - passing session data

    - by Phil Jackson
    Howdy, having a little trouble here. I have domain.co.uk setting a session. When I click on a link on domain.co.uk to go to sub.domain.co.uk the session is not being read. I have altered session.cookie_domain to .domain.co.uk not still not working. Is there anything else that needs changing? Regards, me.

    Read the article

  • jQuery ajax : error while passing variables in data

    - by Tristan
    Hello, just a quick question : var h = $('#hebergeurJQUERY').val(); var t = $('#typeJQUERY').val(); function requestData() { $.ajax({ type: "GET", url: '12months/months.php', data : "hosting="+h+"&type="+t+"", ...... doesnt work while data : "hosting=Something&type=Something", Works. Any idea to something stupid i did (again ?) ;) Thanks

    Read the article

  • Passing variable string to create arrays (Android)

    - by dweebsonduty
    Hello all, I am a newb to Android and Java and want to write a funtion that will display a list based on a varable that I pass to the function. The function is below and the code below creates an array out of a string called type, but what I want to do is pass it a variable string and have it build a list based on that string. So if I wanted the type list I would say list_it("type") But if I try something like getResources().getStringArray(R.array.thelist); it doesn't work. Can someone point me in the right direction? public void list_it(String thelist){ String[] types = getResources().getStringArray(R.array.type); ArrayAdapter<String> mAdapter = new ArrayAdapter<String>(this, R.layout.list_item1, types); setListAdapter(mAdapter); ListView lv = getListView(); lv.setTextFilterEnabled(true); }

    Read the article

  • DB Design - Linking to a parent without circular reference issues

    - by zSysop
    Hi all, I'm having trouble coming up with a solution for the following issue. Lets say i have a db that looks something like the following: Issue Table Id | Details | CreateDate | ClosedDate Issue Notes Table Id | ObjectId | Notes | NoteDate Issue Assignment Table Id | ObjectId | AssignedToId| AssignedDate I'd like allow the linking of an issue to another issue. I thought about adding a column to the Issue table called ParentIssueId and that would allow me the ability to link issues, but i foresee circular references occurring within the issue table if i go through with this implementation. Is there a better way to go about doing this, and if so, how? Thanks

    Read the article

  • Passing a hostname of over 255 characters to getaddrinfo causes a getaddrinfo failed: memory allocat

    - by darrickc
    I am currently upgrading our software to support ipv6 and in the meantime I'm expanding hostname/ip fields to the max hostname size. In sun documentation it seems like this can be up to 1025 (netdb.h:#define NI_MAXHOST 1025 - this is the recommended hostname allocation define), but when I pass a hostname of over 255 to getaddrinfo I get "getaddrinfo failed: memory allocation failure". I am testing on a Sol10 box. Ideas?

    Read the article

  • Passing data between Castle Windsor's Interceptors

    - by Nhím H? Báo
    I'm adopting Castle Windsor for my WCF project and feel really amazed about this. However, I'm having a scenario that I don't really know if Castle Windsor supports. For example I have the following chained Interceptors Interceptor 1 > Interceptor 2 > Interceptor 3 > Interceptor 4 > Real method Interceptor 1 returns some data and I want that to be available in Interceptor 2 Interceptor 2 in turn does it work and returns the data that I want to make avaialbe in the 3,4, interceptor. The real case scenario is that we're having a WCF service, Interceptor 1 will parse the request header into a Header object(username, password, etc.). The latter interceptors and real method will ultilize this Header object. I know that I can use Session variable to transport data, but is it a built-in, more elegant, more reliable way to handle this?

    Read the article

  • Object pointer value as key into dictionary

    - by Ranking Stackingblocks
    I want to use the object's reference value as a key into a dictionary, as opposed to a copy of value of the object. So, I essentially want to store an object associated with a particular instance of another object in a dictionary and retrieve that value later. Is this possible? Is it completely against the idea of NSDictionary? I can tell that I am probably approaching this the wrong way because the dictionary wants me to implement NSCopying on the object itself, which doesn't really make sense in terms of what I'm doing. I can see that what I should really be doing is wrapping the pointer value, but that seems a little mad. Advice would be appreciated.

    Read the article

  • Passing direct parameters to a Controller#method when testing via RSpec

    - by gmile
    Normally to pass parameters via in RSpec we do: params[:my_key] = my_value get :my_method Where my_method deals with what it received from params. But in my controller I have a method, which takes args directly i.e.: def my_method(*args) ... end How do I call the method with those args from within the test? I've tried get :my_method(args) but Ruby interpreter complains about syntax error.

    Read the article

  • Passing a string when starting a class in PHP

    - by Francesc
    Hi. First I have to say: Happy Christmas to All! I'm starting learning classes in PHP. I coded that: class User { function getFbId($authtoken) { } function getFbFirstName ($authtoken) { } } What I want to do is something like that: $user=new User($authtoken); And pass the $authtoken to the class. It's possible to define that when starting the class. It's possible to retrive that value inside a function of that class?

    Read the article

  • Passing variable from main to Async class

    - by Bigflow
    Somehow, I can't get this done. This is all what I tried till now: Main: private String myState; public String getState() { return myState; } public void setState(String s) { myState = s; } Async: Main appState = ((Main)getApplicationContext()); String state = appState.getState(); Error: No enclosing instance of the type Main is accessible in scope Tried with Helper(Globals) class. public class Globals extends Application{ private String test= "1"; } Main: private Globals mGlobals; mGlobals = new Globals(); mGlobals.test = "2"; //Do Async thing Async: private Globals mGlobals; mGlobals = new Globals(); print mGlobals.test; // (result is 1, should be 2) Also something else, but don't remember good. Tried alot of things (backspace and del buttons are over-used :p ) But I can't get everything working. Async class doesn't have an activity. Code pasted: http://pastebin.com/ikcsdL1p

    Read the article

  • Translating 3-dimensional array reference onto 1-dimensional array

    - by user146780
    If there is an array of ar[5000] then how could I find where element [5][5][4] would be if this was a 3 dimensional array? Thanks I'm mapping pixels: imagine a bimap of [768 * 1024 * 4] where would pixel [5][5][4] be? I want to make this: static GLubyte checkImage[checkImageHeight][checkImageWidth][4]; static GLuint texName; bool itt; void makeCheckImage(void) { Bitmap *b = new Bitmap(L"c:/boo.png"); int i, j, c; Color cul; for (i = 0; i < checkImageHeight; i++) { for (j = 0; j < checkImageWidth; j++) { b->GetPixel(j,i,&cul); checkImage[i][j][0] = (GLubyte) cul.GetR(); checkImage[i][j][1] = (GLubyte) cul.GetG(); checkImage[i][j][2] = (GLubyte) cul.GetB(); checkImage[i][j][3] = (GLubyte) cul.GetA(); } } delete(b); } work without making a multidimensional array. width = 512, height = 1024....

    Read the article

  • Doing a SetLength on an array passed into a proc by reference

    - by csharpdefector
    Hi All, Sure, even I can do this... var testarray : array of string; setlength(testarray, 5); but if I want to get clever and have a procedure into which I pass the array by referance like this I cant do it! procedure DoStuffWithArray(var passedarray : array of string); begin setlength(passedarray, 5); end; compiler says 'incompatible types' on the single line of code in my proc. I can do other stuff on the array like set set element values if i do a setlength before i call the proc, but I cannot do the setlength in my proc, which is what I want to do. Any help much appreciated, thanks all.

    Read the article

  • Is it ok to reference .Net assemblies liberally?

    - by panamack
    I'm building a WPF application and working with the MVVM pattern. I have 4 projects in my solution, 3 class libraries, Data, Model and ViewModel and the WPF executable View. Is there anything wrong with the Model referencing WindowsBase so that I can use ObservableCollection<T> for example or can I just make use of what I intuitively feel I need without worrying about the original purposes of the class in the framework e.g. collection databinding.

    Read the article

  • Passing a pointer to a function that doesn't match the requirements of the formal parameter

    - by Andreas Grech
    int valid (int x, int y) { return x + y; } int invalid (int x) { return x; } int func (int *f (int, int), int x, int y) { //f is a pointer to a function taking 2 ints and returning an int return f(x, y); } int main () { int val = func(valid, 1, 2), inval = func(invalid, 1, 2); // <- 'invalid' does not match the contract printf("Valid: %d\n", val); printf("Invalid: %d\n", inval); /* Output: * Valid: 3 * Invalid: 1 */ } At the line inval = func(invalid, 1, 2);, why am I not getting a compiler error? If func expects a pointer to a function taking 2 ints and I pass a pointer to a function that takes a single int, why isn't the compiler complaining? Also, since this is happening, what happens to the second parameter y in the invalid function?

    Read the article

  • Passing a enum value as a tag attribute in JSP

    - by Jakub
    I have a custom JSP tag which is using a parameter which is an enum. This approach is a consequence of using other classes which need this enumeration. The point is I have no clue how to assign an enum value in the EL: <mytaglib:mytag enumParam="${now what do I type here?}" /> The only workaround which I found so far was to make the enumParam an Integer and convert it to desired values: <mytaglib:mytag enumParam="3" /> I believe there must be a better way to do it. Please help.

    Read the article

  • Using block around a static/singleton resource reference

    - by byte
    This is interesting (to me anyway), and I'd like to see if anyone has a good answer and explanation for this behavior. Say you have a singleton database object (or static database object), and you have it stored in a class Foo. public class Foo { public static SqlConnection DBConn = new SqlConnection(ConfigurationManager.ConnectionStrings["BAR"].ConnectionString); } Then, lets say that you are cognizant of the usefulness of calling and disposing your connection (pretend for this example that its a one-time use for purposes of illustration). So you decide to use a 'using' block to take care of the Dispose() call. using (SqlConnection conn = Foo.DBConn) { conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SP_YOUR_PROC"; cmd.ExecuteNonQuery(); } conn.Close(); } This fails, with an error stating that the "ConnectionString property is not initialized". It's not an issue with pulling the connection string from the app.config/web.config. When you investigate in a debug session you see that Foo.DBConn is not null, but contains empty properties. Why is this?

    Read the article

  • Passing 2D array with variable dimensions as function argument

    - by TheCrazyProgrammer
    I just saw the following code among the successful submissions at codechef. http://www.codechef.com/viewplaintext/1595846 I used to think that float max(int n,int arr[n][n]) {....} is not allowed in C++ (as 'n' is a variable). My CodeBlocks (on windows) with MinGW [gcc 4.4] gives compile time error. that "error: array bound is not an integer constant. Then how can be such a solution be accepted by CodeChef's judge. Is there any special flag that allows us to do that in C++??? EDIT: A link showing status as AC (accepted) : http://www.codechef.com/viewsolution/1595846

    Read the article

  • Passing session between jsf backing bean and model

    - by Rachel
    Background : I am having backing bean which has upload method that listen when file is uploaded. Now I pass this file to parser and in parser am doing validation check for row present in csv file. If validation fails, I have to log information and saving in logging table in database. My end goal : Is to get session information in logging bean so that I can get initialContext and make call to ejb to save data to database. What is happening : In my upload backing bean, am getting session but when i call parser, I do not pass session information as I do not want parser to be dependent on session as I want to unit test parser individually. So in my parser, I do not have session information, from parser am making call to logging bean(just a bean with some ejb methods) but in this logging bean, i need session because i need to get initial context. Question Is there a way in JSF, that I can get the session in my logging bean that I have in my upload backing bean? I tried doing: FacesContext ctx = FacesContext.getCurrentInstance(); HttpSession session = (HttpSession) ctx.getExternalContext().getSession(false); but session value was null, more generic question would be : How can I get session information in model bean or other beans that are referenced from backing beans in which we have session? Do we have generic method in jsf using which we can access session information throughout JSF Application?

    Read the article

  • C++ compilation error when passing a function into remove_if

    - by garsh0p
    So here's a snippet of my code. void RoutingProtocolImpl::removeAllInfinity() { dv.erase(std::remove_if(dv.begin(), dv.end(), hasInfCost), dv.end()); } bool RoutingProtocolImpl::hasInfCost(RoutingProtocolImpl::dv_entry *entry) { if (entry-link_cost == INFINITY_COST) { free(entry); return true; } else { return false; } } I'm getting the following error when compiling: RoutingProtocolImpl.cc:368: error: argument of type bool (RoutingProtocolImpl::)(RoutingProtocolImpl::dv_entry*)' does not matchbool (RoutingProtocolImpl::*)(RoutingProtocolImpl::dv_entry*)' Sorry, I'm kind of a C++ newb.

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >