Search Results

Search found 8286 results on 332 pages for 'defined'.

Page 167/332 | < Previous Page | 163 164 165 166 167 168 169 170 171 172 173 174  | Next Page >

  • Polymorphic functions with parameters from a class hierarchy

    - by myahya
    Let's say I have the following class hierarchy in C++: class Base; class Derived1 : public Base; class Derived2 : public Base; class ParamType; class DerivedParamType1 : public ParamType; class DerivedParamType2 : public ParamType; And I want a polymorphic function, func(ParamType), defined in Base to take a parameter of type DerivedParamType1 for Derived1 and a parameter of type DerivedParamType2 for Derived2. How would this be done without pointers, if possible?

    Read the article

  • Is it possible to call a user-space callback function from kernel space in Linux (ioctl)?

    - by Makis
    Is it possible to expand the ioctl interface in Linux so that the user-space application can send a pointer to a function to the kernel space driver? I'm in particular thinking of ways to handle the stream in user-controllable way but doing it in the kernel. Those operations could be attached to the kernel module but this would make development a lot easier as I wouldn't need to mess with the kernel during development. More specifically, this would be the process: Data is read by the driver to a buffer. Data is handled by these user-defined functions in place. Some more handling is done, possibly with some HW blocks. Data is used by a user-space application.

    Read the article

  • jquery dialog button

    - by Nishima
    Hi All, Can anyone tell em how can call a function with parameters on a dialog and call that same function from somwhere else also. function showEditDialog(TagDivId, id, type, bFlag) { try { stickyinfo = new Array(); jQuery('#'+TagDivId).dialog({ autoOpen: false, height : 535, width:320, modal: true, resizable:false, //closeOnEscape:false, buttons: { Cancel: function() { jQuery(this).dialog('close'); }, 'OK': function showEditDialogOkFunc(id) { //stickyinfo.clear(); //Register Collaboba Tag with the Server. var color = jQuery('#' + id).css('background-color'); var tagid = document.getElementById(id); if(tagid != null) { GetTagInformation(id, stickyinfo); } else { return false; } } } catch(e) { alert(e); } } Is it ok the way i m calling showEditDialogOkFunc(id) and can i call this function from anywhere else.Since it's a dialog function will it get all the properies of the dialog defined above the ok function.And if i call the OK function from anuwhere else will it get all the properties of the dialog o not. Thanks

    Read the article

  • serving files using django - is this a security vulnerability

    - by Tom Tom
    I'm using the following code to serve uploaded files from a login secured view in a django app. Do you think that there is a security vulnerability in this code? I'm a bit concerned about that the user could place arbitrary strings in the url after the upload/ and this is directly mapped to the local filesystem. Actually I don't think that it is a vulnerability issue, since the access to the filesystem is restricted to the files in the folder defined with the UPLOAD_LOCATION setting. UPLOAD_LOCATION = is set to a not publicly available folder on the webserver url(r'^upload/(?P<file_url>[/,.,\s,_,\-,\w]+)', 'aeon_infrastructure.views.serve_upload_files', name='project_detail'), @login_required def serve_upload_files(request, file_url): import os.path import mimetypes mimetypes.init() try: file_path = settings.UPLOAD_LOCATION + '/' + file_url fsock = open(file_path,"r") file_name = os.path.basename(file_path) file_size = os.path.getsize(file_path) print "file size is: " + str(file_size) mime_type_guess = mimetypes.guess_type(file_name) if mime_type_guess is not None: response = HttpResponse(fsock, mimetype=mime_type_guess[0]) response['Content-Disposition'] = 'attachment; filename=' + file_name #response.write(file) except IOError: response = HttpResponseNotFound() return response

    Read the article

  • Gtk+ vs Qt language bindings

    - by Adam Smith
    Put shortly: For those familiar with language bindings in Qt and Gtk+. E.g. python and ruby. Are there any quality or capability difference? More background: I know C++ and Qt very well. Minimal experience with Gtk+. I know C++ is not ideal for language bindings due to the lack of a well defined ABI (application binary interface). I also read that Gtk+ was designed to be bound to other languages. So I wonder how this manifets itself in practice. Are the Gtk+ bindings better maintained or work better in some way than their Qt counterparts? I am presently quite interested in the Go language, and they have started developing Gtk+ bindings. However C++ bindings is far away. It makes me wonder whether learning Gtk+ is worth it.

    Read the article

  • Design Help! How can design Extended properties for Entity with simple and complex data in extended

    - by mmtemporary
    I have design question. I have entity such as "Person". Person has properties such as: FirstName, LastName, Gender, BirthDate, .... End user when create a person in application may be need to define another property that is not defined in database table schema (or class person). for example: end user nead to define "property1" that its a string property. or nead define "proerty2" that its a image, or need define "property3" that its complex type. please separate your design solution in tow level: 1-database table design 2-class design thank u.

    Read the article

  • When to use a module, and when to use a class

    - by Matt Briggs
    I am currently working through the Gregory Brown Ruby Best Practices book. Early on, he is talking about refactoring some functionality from helper methods on a related class, to some methods on module, then had the module extend self. Hadn't seen that before, after a quick google, found out that extend self on a module lets methods defined on the module see each other, which makes sense. Now, my question is when would you do something like this module StyleParser extend self def process(text) ... end def style_tag?(text) ... end end and then refer to it in tests with @parser = Prawn::Document::Text::StyleParser as opposed to just using a class with some class methods on it? is it so that you can use it as a mixin? or are there other reasons I'm not seeing?

    Read the article

  • elisp newbie question: Can't find 'filename' function definition in org.el?

    - by Dave Paroulek
    I really love org-mode in emacs and want to customize a few things. While reading thru org.el, I'm finding several references to filename but can't find filename using describe-function? I'm sure there's a simple answer, but I'm just learning elisp and it's not obvious. Any insight into where filename is defined? And/or if it's not a function, what is it? For example, filename on line 25502: (filename (if to-buffer (expand-file-name (concat (file-name-sans-extension (or (and subtree-p (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) (file-name-nondirectory buffer-file-name))) "." html-extension) (file-name-as-directory (or pub-dir (org-export-directory :html opt-plist))))))

    Read the article

  • Can a DataTemplate be a Page?

    - by dthrasher
    I'm using the MVVM pattern to create a WPF standalone application. My program compiles in Visual Studio 2008, but I frequently get warnings in the editor for my DataTemplates. In my MainWindow.xaml, I've defined the following DataTemplate: <DataTemplate DataType="{x:Type ViewModels:TagViewModel}"> <Views:TagView /> </DataTemplate> Where "TagView" is derived from a Page, rather than an ordinary UserControl. This causes the following message to appear every time I reload the designer in Visual Studio: "Could not create an instance of type 'TagView'. Yet the solution compiles fine and the program seems to work properly. Is this a bug in the Visual Studio 2008 editor? Or am I doing something wrong?

    Read the article

  • var keyword without 'using someNamespace'

    - by RichK
    How does Visual Studio/intellisense know what to do with a variable declared as var even if you don't include the necessary using declaration at the top? For example, I have class MyDomainObject defined in a different namespace If I don't declare using TheOtherNameSpace; in the file the following code won't compile: private void Foo() { MyDomainObject myObj = new MyDomainObject(); // Doesn't know what this class is } But if I use var var myObj = new MyDomainObject(); This will compile, and intellisense knows exactly what I can with it. So how the heck does it know what the type is without the using? (And as an aside, if it knows without the using, why do we need usings at all?!)

    Read the article

  • ASP.NET HTTPHandler not throwing exception when one is expected

    - by josephj1989
    I have an HttpHandler class (implements IHttphandler) where the path defined for the handler in web.config is *.jpg. I am requesting a Jpg image in my page. Within the HTTP Handler I am writing to a file in the filesystem. By mistake I was trying to write to a non existant directory. This should have thrown an exception but the execution simply proceeds.Ofcourse no file is written. But if I give a proper directory the file is written correctly.Is there anything special about HttpHandler Exceptions. See part of the code public void ProcessRequest(HttpContext context){ File.WriteAllLines(context.Request.ApplicationPath+@"\"+"resul.log",new string[]{"Entered JPG Handler"}); If I put a breakpoint on the File.WriteAllLines statement and then step over it I can see an exception occurring.

    Read the article

  • 500 error on function call in Codeigniter

    - by Ilia Lev
    I am using just installed CI 2.1.3 Following phpacademy tutorial I wrote in the routes.php: $route['default_controller'] = "site"; (instead of: $route['default_controller'] = "welcome";) and in controllers/site.php: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Site extends CI_Controller { public function index() { echo "default function started.<br/>"; } public function hello(){ echo "hello function started.<br/>"; } } After uploading it to the server and going to the [www.mydomain.ext] it works ok (writes: "default function started.") BUT if I add 'this-hello();' to the index() function it throws a 500 error. Why does it happen and how can I resolve this? Thank you in advance.

    Read the article

  • Python and Plone help

    - by Grenko
    Im using the plone cms and am having trouble with a python script. I get a name error "the global name 'open' is not defined". When i put the code in a seperate python script it works fine and the information is being passed to the python script becuase i can print the query. Code is below: #Import a standard function, and get the HTML request and response objects. from Products.PythonScripts.standard import html_quote request = container.REQUEST RESPONSE = request.RESPONSE # Insert data that was passed from the form query=request.query #print query f = open("blast_query.txt","w") for i in query: f.write(i) return printed I also have a second question, can i tell python to open a file in in a certain directory for example, If the script is in a certain loaction i.e. home folder, but i want the script to open a file at home/some_directory/some_directory can it be done?

    Read the article

  • Default enum visibility in C++

    - by Benjamin Borden
    I have a class that looks like this: namespace R { class R_Class { enum R_Enum { R_val1, R_val2, R_val3 } private: // some private stuff public: // some public stuff } } I'm performing unit testing using an automated test tool (LDRA). The compiler (GHS) claims that my test harness cannot access the type R::R_Class::R_Enum. I have no trouble accessing the values within a similar class that is defined as such: namespace S { class S_Class { public: enum S_Enum { S_val1, S_val2, S_val3 } } private: // some private stuff public: // some public stuff } Do enums in C++ need to be given explicit visibility directives? If not given any, do they default to private? protected?

    Read the article

  • SQL Server 2008 - Conditional Range

    - by user208662
    Hello, I have a database that has two tables. These two tables are defined as: Movie ----- ID (int) Title (nvchar) MovieReview ----------- ID (int) MovieID (int) StoryRating (decimal) HumorRating (decimal) ActingRating (decimal) I have a stored procedure that allows the user to query movies based on other user's reviews. Currently, I have a temporary table that is populated with the following query: SELECT m.*, (SELECT COUNT(ID) FROM MovieReivew r WHERE r.MovieID=m.ID) as 'TotalReviews', (SELECT AVG((r.StoryRating + r.HumorRating + r.ActingRating) / 3) FROM MovieReview r WHERE r.MovieID=m.ID) as 'AverageRating' FROM Movie m In a later query in my procedure, I basically want to say: SELECT * FROM MyTempTable t WHERE t.AverageRating >= @lowestRating AND t.AverageRating <= @highestRating My problem is, sometimes AverageRating is zero. Because of this, I'm not sure what to do. How do I handle this scenario in SQL?

    Read the article

  • iPhone: Turning latitude/longitude into "major cross-streets"

    - by Gloria
    Using the MKReverseGeocoder or GoogleAPI or MapKit... Is there a simple way to turn a latitude/longitude into "nearest major cross-streets"? A user might not have any idea where "12345 Pineapple" is located... so I want to show something like "Pineapple and Main"... or (larger, major roads) like "US-140 and Hwy 76". I don't really care what "major" is defined as... perhaps any road with higher speed limits... or more than 3 lanes... etc. I don't really care what "close by" is defines as... perhaps within 0-10 miles... or just "closest found".

    Read the article

  • Rails 3.o MYSQL connection problem

    - by palani
    Hi I have installed RVM in my ubunut linux box and configured the Rails 3 app in that ... i can able to start app server... my problem is when i invoke http://localhost:3000 . i getting the follwing error Mysql::Error (Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)): I checked mysqld service is running well. I checked my database.yml file .... the defined well development: adapter: mysql encoding: utf8 reconnect: false database: test_development username: root password: admin socket: /var/run/mysqld/mysqld.sock my installed mysql gem version is 2.8.1.... I really don't know what is the problem here....

    Read the article

  • Sharing beans from contextListener -- dispatcher servlet

    - by Ernest
    Hello! ok, i have another question now. I have a bunch of beans loaded succesfully in applicationContext.xml, which loads from web.xml: contextConfigLocation applicationContext.xml org.springframework.web.context.ContextLoaderListener Here are is the bean defined in applicationContext.xml that i want to share: it loads other beans (DAOs) which are initialized with hibernet. I need to acces catalogFacadeTarget from the dispatcherServlet, declared in web.xml: dispatcher org.springframework.web.servlet.DispatcherServlet 1 <servlet-mapping> <servlet-name>dispatcher</servlet-name> <url-pattern>*.htm</url-pattern> </servlet-mapping> and configured dispatcher-servlet.xml like this: welcome There! in the property called catalogFacadeImpl. If you need the entire applicationCOntext.xml, web.xml, and dispatcher-servlet.xml please let me know. From what i read, i should be able to share beans if i declared them in the contextConfigLocation configuration file. Thank you very much in advance.

    Read the article

  • Running Script before/after Variables declared?

    - by Sam
    Hi folks. As i understand javascript .js files are best to put all the way at the bottom of html pages, to speed up loading of rest of page. Advised by Yslow(Yahoo) and Page Speed(google). Now, when in the middle of page some thing RUNS a javascript script, in Internet Explorer, i see a small warning message saying that the element is: Uncaught ReferenceError: SWFObject is not defined When i put my all.js file in the had, the error goes away but page load slows doen. What to do? Actually, i remember it was the same with php variables. If i RUN php but the variable comes later, then it just doesnt work. must define the variable first, for it to run. How to make this workflow better, in case of php scripts? and in case of javsscripts? Thanks!

    Read the article

  • Extra blank page when converting HTML to PDF using abcPDF

    - by ProfK
    I have an HTML report, with each print page contained by a <div class="page">. The page class is defined as width: 180mm; height: 250mm; page-break-after: always; background-position: centre top; background-image: url(Images/MainBanner.png); background-repeat: no-repeat; padding-top: 30mm; After making a few changes to my report content, when I call abcPDF to convert the report to PDF, suddenly I'm getting a blank page inserted after every real report page. I don't want to roll back the changes I've just made to remove this problem, so I'm hoping someone may know why the extra pages are being inserted.

    Read the article

  • Unicode identifiers in Python?

    - by viksit
    Hi all, I want to build a Python function that calculates, and would like to name my summation function S. In a similar fashion, would like to use ? for product, and so on. I was wondering if there was a way to name a python function in this fashion? def S (..): .. .. That is, does Python support unicode identifiers, and if so, could someone provide an example for it? Thanks! Original motivation for this was a piece of Clojure code I saw today that looks like, (defn entropy [X] (* -1 (S [i X] (* (p i) (log (p i)))))) where S is a macro defined as, (defmacro S ... ) and I thought that was pretty cool.

    Read the article

  • Cast an instance of a class to a @protocol in Objective-C

    - by Ford
    I have an object (a UIViewController) which may or may not conform to a protocol I've defined. I know I can determine if the object conforms to the protocol, then safely call the method: if([self.myViewController conformsToProtocol:@protocol(MyProtocol)]) { [self.myViewController protocolMethod]; // <-- warning here } However, XCode shows a warning: warning 'UIViewController' may not respond to '-protocolMethod' What's the right way to prevent this warning? I can't seem to cast self.myViewController as a MyProtocol class. Update Andy's answer below is close, but includes an unneccesary '*'. The following works: [(id<MyProtocol>)self.myViewController protocolMethod];

    Read the article

  • Qt - arguments in signal-slots

    - by bullettime
    I have a QPushButton, QDateEdit and another custom object. I want to connect the button to the date edit object in a way that when I click the button, the date edit object will change its set date to a date defined on the custom object. Kinda like this: connect(pushbutton,SIGNAL(clicked()),dateedit,SLOT(setDate(custom_object.getDate()))); but I can't do that. Apparently, the connect statement doesn't specify what's the information being passed from the signal to the slot, only the type of the information being passed. Is there a way to do this without having to create a new class?

    Read the article

  • Using Interfaces in JNI

    - by lhw
    I am trying to use (*env)->RegisterNatives to add methods to a defined class which I then add to a callback list. The callback sender of course expects my class to implement a certain interface which I do not. And is failing on execution. If I add the keyword "implements Listener" to my class in Java the javac expects to have the methods definition in Java or with native keyword which I try to avoid here, as I'd like to register the methods within the JNI_OnLoad and execute one of them afterwards. The question now is: Can I implement the interface in JNI or avoid the error message in Java?

    Read the article

  • Fast word count function in Vim

    - by Greg Sexton
    I am trying to display a live word count in the vim statusline. I do this by setting my status line in my .vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the status line. This should work nicely as the statusline is updated at just about every possible opportunity so the count will always remain 'live'. The problem is that the function I have currently defined is slow and so vim is obviously sluggish when it is used for all but the smallest files; due to this function being executed so frequently. In summary, does anyone have a clever trick for producing a function that is blazingly fast at calculating the number of words in the current buffer and returning the result?

    Read the article

< Previous Page | 163 164 165 166 167 168 169 170 171 172 173 174  | Next Page >