Search Results

Search found 7418 results on 297 pages for 'argument passing'.

Page 15/297 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • Designing a frontend/backend architecture

    - by wrp
    What are some good information sources on designing programs with a client/server architecture? This is for development of a desktop application, not a Web service. The only books I have found on client/server apps deal with the case of a thin client connecting to a remote database. Two good examples of what I mean are Mathematica and SuperCollider. I'm looking for platform- and language-agnostic discussion of the issues in developing a frontend/backend system. Especially useful topics would be allocation of responsibilities and options for message passing.

    Read the article

  • Passing multiple aruments to a UNIX shell script

    - by Waffles
    Hello all, I have the following (bash) shell script, that I would ideally use to kill multiple processes by name. #!/bin/bash kill `ps -A | grep $* | awk '{ print $1 }'` However, while this script works is one argument is passed: end chrome (the name of the script is end) it does not work if more than one argument is passed: $end chrome firefox grep: firefox: No such file or directory What is going on here? I thought the $* passes multiple arguments to the shell script in sequence. I'm not mistyping anything in my input - and I the programs I wan to kill (chrome and firefox) are open. Any help is appreciated.

    Read the article

  • how to get http get request params in jsf 2.0 bakcing bean?

    - by Marko
    Hi all, I having trouble with passing http get parameters to jsf 2.0 backing bean. User will invoke URl with some params containing id of some entity, which is later used to persist some other entity in db. whole process can be summarized by fallowing: 1. user open page http://www.somhost.com/JsfApp/step-one.xhtml?sid=1 2. user fills some data and goes to next page 3. user fills some more data and then entity is saved to db with sid param from step one. I have session scoped backing bean that hold data from all the pages (steps), but I cant pass param to bean property.. any ideas?

    Read the article

  • Passing dependent objects to a parent constructor in Scala

    - by Nick Johnson
    Suppose I have the following class heirarchy: class A() class B(a:A) class C(b:B) class BaseClass(b:B, c:C) Now I want to implement a subclass of BaseClass, which is given an instance of A, and constructs instances of B and C, which it passes to its superclass constructor. If I could use arbitrary expressions, I'd do something like this: b = new B(a) c = new C(b) super(b, c) Because the second argument to the parent constructor depends on the value of the first argument, though, I can't see any way to do this, without using a factory function, or a gratuitous hack, such as : class IntermediateSubclass(b:B) extends BaseClass(b, new C(b)) class RealSubclass(a:A) extends IntermediateSubclass(new B(a)) Is there clean way to do this?

    Read the article

  • Faking a Single Address Space

    - by dsimcha
    I have a large scientific computing task that parallelizes very well with SMP, but at too fine grained a level to be easily parallelized via explicit message passing. I'd like to parallelize it across address spaces and physical machines. Is it feasible to create a scheduler that would parallelize already multithreaded code across multiple physical computers under the following conditions: The code is already multithreaded and can scale pretty well on SMP configurations. The fact that not all of the threads are running in the same address space or on the same physical machine must be transparent to the program, even if this comes at a significant performance penalty in some use cases. You may assume that all of the physical machines involved are running operating systems and CPU architectures that are binary compatible. Things like locks and atomic operations may be slow (having network latency to deal with and all) but must "just work".

    Read the article

  • How can I pass more than one command line argument via c#

    - by user293392
    I need to pass more than one command line argument via c# for a process called handle.exe: http://www.google.com.mt/search?sourceid=chrome&ie=UTF-8&q=handle.exe First, I need to run the executable file via ADMINISTRATOR permissions. This post has helped me achieve just that: http://stackoverflow.com/questions/667381/programatically-run-cmd-exe-as-adminstrator-in-vista-c But then comes the next problem of calling the actual line arguments such as "-p explore" How can I specify the command line arguments together, or maybe consecutively? Current code is as follows: Process p = new Process(); ProcessStartInfo processStartInfo = new ProcessStartInfo("filePath"); processStartInfo.CreateNoWindow = true; processStartInfo.UseShellExecute = false; processStartInfo.RedirectStandardOutput = true; processStartInfo.RedirectStandardInput = true; processStartInfo.Verb = "runas"; processStartInfo.Arguments = "/env /user:" + "Administrator" + " cmd"; p.StartInfo = processStartInfo; p.Start(); string output = p.StandardOutput.ReadToEnd(); p.WaitForExit(); Console.WriteLine(output); Thanks

    Read the article

  • sendto: Invalid Argument

    - by Sylvain
    Hi, I have a list<struct sockaddr_in> _peers I'd like to use for sendto() the list is filled this way struct hostent *hp; hp = gethostbyname(hostname); sockaddr_in sin; bzero(&sin, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = htons(port); sin.sin_addr.s_addr = *(in_addr_t *)hp->h_addr; _peers.push_front(sin); and here's how I try to send: for (list<struct sockaddr_in>::iterator it = _peers.begin(); it != _peers.end(); ++it) { if (sendto(_s, "PING", 5, 0, (struct sockaddr *)&(*it), sizeof(struct sockaddr_in)) < 0) perror("sendto"); } outputs: sendto: Invalid argument If I create the struct sockaddr_in right before sendto(), everything works fine, so I guess I fail at using the list properly ... I also tested using &_peers.front() directly and still get the same error ... what am I doing wrong? Thanks in advance,

    Read the article

  • Django "login() takes exactly 1 argument (2 given)" error

    - by Oleksandr Bolotov
    I'm trying to store the user's ID in the session using django.contrib.auth.login . But it is not working not as expected. I'm getting error login() takes exactly 1 argument (2 given) With login(user) I'm getting AttributeError at /login/ User' object has no attribute 'method' I'm using slightly modifyed example form http://docs.djangoproject.com/en/dev/topics/auth/ : from django.shortcuts import render_to_response from django.contrib.auth import authenticate, login def login(request): msg = [] if request.method == 'POST': username = request.POST['u'] password = request.POST['p'] user = authenticate(username=username, password=password) if user is not None: if user.is_active: login(request, user) msg.append("login successful") else: msg.append("disabled account") else: msg.append("invalid login") return render_to_response('login.html', {'errors': msg}) there's nothing special about login.html: <html> <head> <title></title> </head> <body> <form action="/login/" method="post"> Login:&nbsp; <input type="text" name="u"> <br/> Password:&nbsp; <input type="password" name="p"> <input type="submit" value="Login"> </form> {% if errors %} <ul> {% for error in errors %} <li>{{ error }}</li> {% endfor %} </ul> {% endif %} </body> </html> Does anybody have idea how to make login() work.

    Read the article

  • "RewriteBase: argument is not a valid URL" error

    - by user305434
    hi, I'm trying to configure .htaccess of my website. http://213.175.210.49/~incisozl/ is the temporary url to the root(~/public_html/). when I try to rewrite the url at .htaccess i get an /home/incisozl/public_html/.htaccess: RewriteBase: argument is not a valid URL, referer: ht tp://213.175.210.49/~incisozl/inci-sozluk/somestring error. my rewrite rule is; RewriteEngine On RewriteBase / RewriteRule ^/?$ /index.php [L] RewriteRule ^inci-sozluk/([^.\?/]+)/([0-9]+)/?$ /seo.php?process=word&q=$1&sayfa=$2 [L] RewriteRule ^inci-sozluk/([^.\?/]+)?$ /seo.php?process=word&q=$1 [L] RewriteRule ^inci-sozluk/([^.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=word&q=$1&sayfa=$2&gid=$3 [L] RewriteRule ^inci-sozluktest/([^.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=wordtest&q=$1&sayfa=$2&gid=$3 [L] RewriteRule ^inci-sozluk-bugun/([^.\?/]+)/([0-9]+)/?$ /seo.php?process=wordbg&q=$1&sayfa=$2 [L] RewriteRule ^inci-sozluk-bugun/([^.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=wordbg&q=$1&sayfa=$2&gid=$3 [L] RewriteRule ^inci-sozluk-dun/([^.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=worddn&q=$1&sayfa=$2&gid=$3 [L] RewriteRule ^inci-sozluk-dun/([^.\?/]+)/([0-9]+)/?$ /seo.php?process=worddn&q=$1&sayfa=$2 [L] RewriteRule ^inci-sozluk-ters/([^.\?/]+)/([0-9]+)/?$ /seo.php?process=wordts&q=$1&sayfa=$2 [L] RewriteRule ^inci-sozluk-ters/([^.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=wordts&q=$1&sayfa=$2&gid=$3 [L] RewriteRule ^inci-sozluk-cvpters/([^.\?/]+)/([0-9]+)/?$ /seo.php?process=cvpwordts&q=$1&sayfa=$2 [L] RewriteRule ^inci-sozluk-cvpters/([^.\?/]+)/([0-9]+)/([0-9]+)/?$ /seo.php?process=cvpwordts&q=$1&sayfa=$2&gid=$3 [L] RewriteRule ^inci-sozluk-ileti/([0-9]+)/?$ /seo.php?process=eid&eid=$1 [L] RewriteRule ^inci-sozluk-ileticvp/([0-9]+)/?$ /seo.php?process=cvpeid&eid=$1 [L] btw. it works fine when i use it with www.incisozluk.org pointed domain

    Read the article

  • Django tests failing on invalid keyword argument

    - by Darwin Tech
    I have a models.py like so: from django.db import models from django.contrib.auth.models import User from datetime import datetime class UserProfile(models.Model): user = models.OneToOneField(User) def __unicode__(self): return self.user.username class Project(models.Model): user = models.ForeignKey(UserProfile) created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) product = models.ForeignKey('tool.product') module = models.ForeignKey('tool.module') model = models.ForeignKey('tool.model') zipcode = models.IntegerField(max_length=5) def __unicode__(self): return unicode(self.id) And my tests.py: from django.test import TestCase, Client # --- import app models from django.contrib.auth.models import User from tool.models import Module, Model, Product from user_profile.models import Project, UserProfile # --- unit tests --- # class UserProjectTests(TestCase): fixtures = ['admin_user.json'] def setUp(self): self.product1 = Product.objects.create( name='bar', ) self.module1 = Module.objects.create( name='foo', enable=True ) self.model1 = Model.objects.create( module=self.module1, name='baz', enable=True ) self.user1 = User.objects.get(pk=1) ... def test_can_create_project(self): self.project1 = Model.objects.create( user=self.user1, product=self.product1, module=self.module1, model=self.model1, zipcode=90210 ) self.assertEquals(self.project1.zipcode, 90210) But I get a TypeError: 'product' is an invalid keyword argument for this function error. I'm not sure what is failing but I'm guessing something to do with the FK relationships... Any help would be much appreciated.

    Read the article

  • Populate struct values with function argument

    - by adohertyd
    I am working on a program and part of it requires me to create a struct called DETAILS with the fields name, age, and height. I want to populate the record with data using a function argument. When I run my code I get compiler errors. I have put the errors in comment form beside the lines it is returned for but I can't fix them. Really could do with some help here guys thanks so much. Here is my code: #include <cstdlib> #include <iostream> #include <iomanip> using namespace std; const int LEN=100; struct DETAILS { char name[LEN]; int age; double height; }; person fillperson(struct DETAILS, char[LEN], int, double); int main() { struct person David; fillperson(David, "David Greene", 38, 180.0); //deprecated conversion from string constant to char * [-Wwrite-Strings] } person fillperson(struct DETAILS, char[LEN] name, int age, double height) //expected , or ... before 'name' { cin>>David.name>>name; cin>>David.age>>age; cin>>David.height>>height; cout<<"Done"<<endl; }

    Read the article

  • Getting Argument Names In Ruby Reflection

    - by Joe Soul-bringer
    I would like to do some fairly heavy-duty reflection in the Ruby programming language. I would like to create a function which would return the names of the arguments of various calling functions higher up the call stack (just one higher would be enough but why stop there?). I could use Kernel.caller go to the file and parse the argument list but that would be ugly and unreliable. The function that I would like would work in the following way: module A def method1( tuti, fruity) foo end def method2(bim, bam, boom) foo end def foo print caller_args[1].join(",") #the "1" mean one step up the call stack end end A.method1 #prints "tuti,fruity" A.method2 #prints "bim, bam, boom" I would not mind using ParseTree or some similar tool for this task but looking at Parsetree, it is not obvious how to use it for this purpose. Creating a C extension like this is another possibility but it would be nice if someone had already done it for me. Edit2: I can see that I'll probably need some kind of C extension. I suppose that means my question is what combination of C extension would work most easily. I don't think caller+ParseTree would be enough by themselves. As far as why I would like to do this goes, rather than saying "automatic debugging", perhaps I should say that I would like to use this functionality to do automatic checking of the calling and return conditions of functions. Say def add x, y check_positive return x + y end Where check_positive would throw an exception if x and y weren't positive (obviously, there would be more to it than that but hopefully this gives enough motivation)

    Read the article

  • Django generic relation field reports that all() is getting unexpected keyword argument when no args

    - by Joshua
    I have a model which can be attached to to other models. class Attachable(models.Model): content_type = models.ForeignKey(ContentType) object_pk = models.TextField() content_object = generic.GenericForeignKey(ct_field="content_type", fk_field="object_pk") class Meta: abstract = True class Flag(Attachable): user = models.ForeignKey(User) flag = models.SlugField() timestamp = models.DateTimeField() I'm creating a generic relationship to this model in another model. flags = generic.GenericRelation(Flag) I try to get objects from this generic relation like so: self.flags.all() This results in the following exception: >>> obj.flags.all() Traceback (most recent call last): File "<console>", line 1, in <module> File "/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py", line 105, in all return self.get_query_set() File "/usr/local/lib/python2.6/dist-packages/django/contrib/contenttypes/generic.py", line 252, in get_query_set return superclass.get_query_set(self).filter(**query) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 498, in filter return self._filter_or_exclude(False, *args, **kwargs) File "/usr/local/lib/python2.6/dist-packages/django/db/models/query.py", line 516, in _filter_or_exclude clone.query.add_q(Q(*args, **kwargs)) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1675, in add_q can_reuse=used_aliases) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1569, in add_filter negate=negate, process_extras=process_extras) File "/usr/local/lib/python2.6/dist-packages/django/db/models/sql/query.py", line 1737, in setup_joins "Choices are: %s" % (name, ", ".join(names))) FieldError: Cannot resolve keyword 'object_id' into field. Choices are: content_type, flag, id, nestablecomment, object_pk, timestamp, user >>> obj.flags.all(object_pk=obj.pk) Traceback (most recent call last): File "<console>", line 1, in <module> TypeError: all() got an unexpected keyword argument 'object_pk' What have I done wrong?

    Read the article

  • error: invalid type argument of '->' (have 'struct node')

    - by Roshan S.A
    Why cant i access the pointer "Cells" like an array ? i have allocated the appropriate memory why wont it act like an array here? it works like an array for a pointer of basic data types. #include<stdio.h> #include<stdlib.h> #include<ctype.h> #define MAX 10 struct node { int e; struct node *next; }; typedef struct node *List; typedef struct node *Position; struct Hashtable { int Tablesize; List Cells; }; typedef struct Hashtable *HashT; HashT Initialize(int SIZE,HashT H) { int i; H=(HashT)malloc(sizeof(struct Hashtable)); if(H!=NULL) { H->Tablesize=SIZE; printf("\n\t%d",H->Tablesize); H->Cells=(List)malloc(sizeof(struct node)* H->Tablesize); should it not act like an array from here on? if(H->Cells!=NULL) { for(i=0;i<H->Tablesize;i++) the following lines are the ones that throw the error { H->Cells[i]->next=NULL; H->Cells[i]->e=i; printf("\n %d",H->Cells[i]->e); } } } else printf("\nError!Out of Space"); } int main() { HashT H; H=Initialize(10,H); return 0; } The error I get is as in the title-error: invalid type argument of '->' (have 'struct node').

    Read the article

  • How do you pass a generic delegate argument to a method in .NET 2.0 - UPDATED

    - by Seth Spearman
    Hello, I have a class with a delegate declaration as follows... Public Class MyClass Public Delegate Function Getter(Of TResult)() As TResult ''#the following code works. Public Shared Sub MyMethod(ByVal g As Getter(Of Boolean)) ''#do stuff End Sub End Class However, I do not want to explicitly type the Getter delegate in the Method call. Why can I not declare the parameter as follows... ... (ByVal g As Getter(Of TResult)) Is there a way to do it? My end goal was to be able to set a delegate for property setters and getters in the called class. But my reading indicates you can't do that. So I put setter and getter methods in that class and then I want the calling class to set the delegate argument and then invoke. Is there a best practice for doing this. I realize in the above example that I can set set the delegate variable from the calling class...but I am trying to create a singleton with tight encapsulation. For the record, I can't use any of the new delegate types declared in .net35. Answers in C# are welcome. Any thoughts? Seth

    Read the article

  • recvfrom returns invalid argument when *from* is passed

    - by Aditya Sehgal
    I am currently writing a small UDP server program in linux. The UDP server will receive packets from two different peers and will perform different operations based on from which peer it received the packet. I am trying to determine the source from where I receive the packet. However, when select returns and recvfrom is called, it returns with an error of Invalid Argument. If I pass NULL as the second last arguments, recvfrom succeeds. I have tried declaring fromAddr as struct sockaddr_storage, struct sockaddr_in, struct sockaddr without any success. Is their something wrong with this code? Is this the correct way to determine the source of the packet? The code snippet follows. ` /*TODO : update for TCP. use recv */ if((pkInfo->rcvLen=recvfrom(psInfo->sockFd, pkInfo->buffer, MAX_PKTSZ, 0, /* (struct sockaddr*)&fromAddr,*/ NULL, &(addrLen) )) < 0) { perror("RecvFrom failed\n"); } else { /*Apply Filter */ #if 0 struct sockaddr_in* tmpAddr; tmpAddr = (struct sockaddr_in* )&fromAddr; printf("Received Msg From %s\n",inet_ntoa(tmpAddr->sin_addr)); #endif printf("Packet Received of len = %d\n",pkInfo->rcvLen); } `

    Read the article

  • Getting ellipses function parameters without an initial argument

    - by Tox1k
    So I've been making a custom parser for a scripting language, and I wanted to be able to pass only ellipses arguments. I don't need or want an initial variable, however Microsoft and C seem to want something else. FYI, see bottom for info. I've looked at the va_* definitions #define _crt_va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v) ) #define _crt_va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) ) #define _crt_va_end(ap) ( ap = (va_list)0 ) and the part I don't want is the v in va_start. As a little background I'm competent in goasm and I know how the stack works so I know what's happening here. I was wondering if there is a way to get the function stack base without having to use inline assembly. Ideas I've had: #define im_va_start(ap) (__asm { mov [ap], ebp }) and etc... but really I feel like that's messy and I'm doing it wrong. struct function_table { const char* fname; (void)(*fptr)(...); unsigned char maxArgs; }; function_table mytable[] = { { "MessageBox", &tMessageBoxA, 4 } }; ... some function that sorts through a const char* passed to it to find the matching function in mytable and calls tMessageBoxA with the params. Also, the maxArgs argument is just so I can check that a valid number of parameters is being sent. I have personal reasons for not wanting to send it in the function, but in the meantime we can just say it's because I'm curious. This is just an example; custom libraries are what I would be implementing so it wouldn't just be calling WinAPI stuff. void tMessageBoxA(...) { // stuff to load args passed MessageBoxA(arg1, arg2, arg3, arg4); } I'm using the __cdecl calling convention and I've looked up ways to reliably get a pointer to the base of the stack (not the top) but I can't seem to find any. Also, I'm not worried about function security or typechecking.

    Read the article

  • JQuery Bind click event to appended element with an argument

    - by Gabor Szauer
    Hi guys, I'm trying to populate a ul list with some li elements and give each li element a link that calls the same function with a different argument. However it doesn't seem to work, i've attached the code below, CheckForNewMail is called on document load. Can anyone please help me out? function CheckForNewMail() { ////////////////////////////////////////////////////////////////// // This will be dynamic MailInInbox[0] = new Array("0", "Mail One"); MailInInbox[1] = new Array("12", "Mail Two"); MailInInbox[2] = new Array("32", "Mail Three"); MailInInbox[3] = new Array("5", "Mail Four"); ////////////////////////////////////////////////////////////////////// $('#mail-in-inbox').children().remove(); size = 4; element = $('#mail-in-inbox'); for(i = 0; i < size; ++i) { var link = $('<a href="#" class="inbox-link">'+ MailInInbox[i][1] +'</a>'); link.live('click', function() { LoadMailById(i); }); li = $('<li></li>'); li.append(link); element.append(li); } } function LoadMailById(id) { alert("Button "+ id +" clicked!"); }

    Read the article

  • Incompatible type for argument 1 of 'setBounds'

    - by Brandon
    I am trying to do my own custom classes and learn C and Objective C. I'm recieving the error that there is an incompatible type for argument 1. I've defined a struct and class like this: typedef enum { kRedColor, kGreenColor, kBlueColor } ShapeColor; typedef struct { int x, y, width, height; } ShapeRect; @interface Shape : NSObject { ShapeColor fillColor; ShapeRect bounds; } - (void) setFillColor: (ShapeColor) fillColor; - (void) setBounds: (ShapeRect) bounds; - (void) draw; @end // Shape Then I import the Shape.h file(code above) and try and create a shape like this: id shapes[4]; // I'm different! ShapeRect rect0 = { 0, 0, 10, 30 }; shapes[0] = [Shape new]; [shapes[0] setBounds: rect0]; I get the error that setBounds is incompatible. For some reason it isn't looking at the Shape.h class for the setBounds method and it is instead looking at the default setBounds method? Is there something I'm doing wrong? Thanks!

    Read the article

  • Unknown Argument Error "-p" when deploying to heroku.

    - by user3312278
    We are deploying a rails app to Heroku. The app should be making a youtube api call, using the Trollop Gem as a command line parser. We keep getting this error back. 2014-07-30T23:17:57.526014+00:00 app[web.1]: Error: unknown argument '-p'. 2014-07-30T23:17:57.526020+00:00 app[web.1]: Try --help for help. 2014-07-30T23:17:57.526541+00:00 app[web.1]: Completed 500 Internal Server Error in 7466ms This is what our Trollop code looks like. def self.youtube_search(query) p ENV["YOUTUBE_DEVELOPER_KEY"] p query p "point of no return" p "*"*25 youtube_service_api_name = "youtube" youtube_api_version = "v3" # opts = HTTParty.get("https://www.youtube.com/results?search_query=russia") opts = Trollop::options do opt :q, 'Search term', :source => String, :default => query opt :maxResults, 'Max results', :source => :int, :default => 25 end What's much stranger is that it was working an hour ago and now it's not. Does anyone have any ideas? This doesn't seem to be documented anywhere.

    Read the article

  • How do you pass a generic delegate argument to a method in .NET 2.0

    - by Seth Spearman
    Hello, I have a class with a delegate declaration as follows... Public Class MyClass Public Delegate Function Getter(Of TResult)() As TResult 'the following code works. Public Shared Sub MyMethod(ByVal g As Getter(Of Boolean)) 'do stuff End Sub End Class However, I do not want to explicitly type the Getter delegate in the Method call. Why can I not declare the parameter as follows... ... (ByVal g As Getter(Of TResult)) Is there a way to do it? My end goal was to be able to set a delegate for property setters and getters in the called class. But my reading indicates you can't do that. So I put setter and getter methods in that class and then I want the calling class to set the delegate argument and then invoke. Is there a best practice for doing this. I realize in the above example that I can set set the delegate variable from the calling class...but I am trying to create a singleton with tight encapsulation. For the record, I can't use any of the new delegate types declared in .net35. Answers in C# are welcome. Any thoughts? Seth

    Read the article

  • supplied argument is not a valid MySQL result

    - by jasmine
    I have written a function: function selectWithPaging($where){ $pg = (int) (!isset($_GET["pg"]) ? 1 : $_GET["pg"]); $pg = ($pg == 0 ? 1 : $pg); $perpage = 10;//limit in each page $startpoint = ($pg * $perpage) - $perpage; $result = mysql_query("SELECT * FROM $where ORDER BY id ASC LIMIT $startpoint,$perpage"); return $result; } but when inserting in this function : function categories() { selectWithPaging('category') $text .='<h2 class="mainH">Categories</h2>'; $text .= '<table><tr class="cn"><td>ID</td><td class="name">Category</td> <td>Durum</td>'; while ($row = mysql_fetch_array($result)) { $home = $row['home']; $publish = $row['published']; $ID = $row['id']; $src = '<img src="'.ADMIN_IMG.'homec.png">'; ------------- } there is this error: supplied argument is not a valid MySQL result What is wrong in my first function? Thanks in advance

    Read the article

  • Fortran pointer as an argument to interface procedure

    - by icarusthecow
    Im trying to use interfaces to call different subroutines with different types, however, it doesnt seem to work when i use the pointer attribute. for example, take this sample code MODULE ptr_types TYPE, abstract :: parent INTEGER :: q END TYPE TYPE, extends(parent) :: child INTEGER :: m END TYPE INTERFACE ptr_interface MODULE PROCEDURE do_something END INTERFACE CONTAINS SUBROUTINE do_something(atype) CLASS(parent), POINTER :: atype ! code determines that this allocation is correct from input ALLOCATE(child::atype) WRITE (*,*) atype%q END SUBROUTINE END MODULE PROGRAM testpass USE ptr_types CLASS(child), POINTER :: ctype CALL ptr_interface(ctype) END PROGRAM This gives error Error: There is no specific subroutine for the generic 'ptr_interface' at (1) however if i remove the pointer attribute in the subroutine it compiles fine. Now, normally this wouldnt be a problem, but for my use case i need to be able to treat that argument as a pointer, mainly so i can allocate it if necessary. Any suggestions? Mind you I'm new to fortran so I may have missed something edit: forgot to put the allocation in the parents subroutine, the initial input is unallocated EDIT 2 this is my second attempt, with caller side casting MODULE ptr_types TYPE, abstract :: parent INTEGER :: q END TYPE TYPE, extends(parent) :: child INTEGER :: m END TYPE TYPE, extends(parent) :: second INTEGER :: meow END TYPE CONTAINS SUBROUTINE do_something(this, type_num) CLASS(parent), POINTER :: this INTEGER type_num IF (type_num == 0) THEN ALLOCATE (child::this) ELSE IF (type_num == 1) THEN ALLOCATE (second::this) ENDIF END SUBROUTINE END MODULE PROGRAM testpass USE ptr_types CLASS(child), POINTER :: ctype SELECT TYPE(ctype) CLASS is (parent) CALL do_something(ctype, 0) END SELECT WRITE (*,*) ctype%q END PROGRAM however this still fails. in the select statement it complains that parent must extend child. Im sure this is due to restrictions when dealing with the pointer attribute, for type safety, however, im looking for a way to convert a pointer into its parent type for generic allocation. Rather than have to write separate allocation functions for every type and hope they dont collide in an interface or something. hopefully this example will illustrate a little more clearly what im trying to achieve, if you know a better way let me know

    Read the article

  • Javascript ( jQuery ) Error: SyntaxError: missing ) after argument list

    - by Obmerk Kronen
    I have the simplest function : jQuery(document).ajaxSuccess(function(e, xhr, settings) { var widget_id_base = '099_cf_samurai_widget'; if(settings.data.search('action=save-widget') != -1 && settings.data.search('id_base=' + widget_id_base) != -1) { // alert(\'yay!'\); my_function_chosen_099(); } }); function my_function_chosen_099(){ jQuery(".chzn-select").chosen(); } which works just fine , but When I add the width Parameter like so : function my_function_chosen_k99(){ jQuery(".chzn-select").chosen(width:'95%'); } it gives me an error of: Error: SyntaxError: missing ) after argument list Source File: http://localhost/my-path/js/o99.chosen.init.js?ver=k99 Line: 20, Column: 41 Source Code: jQuery(".chzn-select").chosen(width:"95%"); .............................................| I have tried escaping: jQuery(".chzn-select").chosen(width:\"95%"\); and even double jQuery(".chzn-select").chosen(width:\\"95%"\\); and in my desperation, even jQuery(".chzn-select").chosen( width:"95%" ); I checked and rechecked the closing of brackets , and also tried with single quotes ' - but nothing . There appear to be a lot of similar questions here , but all I saw was escaping problems, ANd I have tried all that I know .. What is wrong here ?? I assume it is not a simple syntax error - or is it ? ( one which I can not find .. )

    Read the article

  • warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’

    - by pyz
    code: #include <stdio.h> #include <stdlib.h> #include <netdb.h> #include <sys/socket.h> int main(int argc, char **argv) { char *ptr, **pptr; struct hostent *hptr; char str[32]; //ptr = argv[1]; ptr = "www.google.com"; if ((hptr = gethostbyname(ptr)) == NULL) { printf("gethostbyname error for host:%s\n", ptr); } printf("official hostname:%s\n", hptr->h_name); for (pptr = hptr->h_aliases; *pptr != NULL; pptr++) printf(" alias:%s\n", *pptr); switch (hptr->h_addrtype) { case AF_INET: case AF_INET6: pptr = hptr->h_addr_list; for (; *pptr != NULL; pptr++) printf(" address:%s\n", inet_ntop(hptr->h_addrtype, *pptr, str, sizeof(str))); break; default: printf("unknown address type\n"); break; } return 0; } compiler output below: zhumatoMacBook:CProjects zhu$ gcc gethostbynamedemo.c gethostbynamedemo.c: In function ‘main’: gethostbynamedemo.c:31: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >