Search Results

Search found 5586 results on 224 pages for 'global illumination'.

Page 131/224 | < Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >

  • Converting array to Drupal format

    - by theo
    Hi all, This statement gives me the value I want in Drupal (namely the last user role): global $user; return (end($user->roles)); however I need to convert it to this format: return array( 0 => array('value' => value for value), // You'll usually want to stop here. Provide more values // if you want your 'default value' to be multi-valued: 1 => array('value' => value for value), 2 => ... ); and I've got no idea how to (also, is this format a multidimensional array?)... Any ideas? Thanks for any help, Theo.

    Read the article

  • python: subclass a metaclass

    - by Michael Konietzny
    Hello, for putting methods of various classes into a global registry I'm using a decorator with a metaclass. The decorator tags, the metaclass puts the function in the registry: class ExposedMethod (object): def __init__(self, decoratedFunction): self._decoratedFunction = decoratedFunction def __call__(__self,*__args,**__kw): return __self._decoratedFunction(*__args,**__kw) class ExposedMethodDecoratorMetaclass(type): def __new__(mcs, name, bases, dct): for obj_name, obj in dct.iteritems(): if isinstance(obj, ExposedMethod): WorkerFunctionRegistry.addWorkerToWorkerFunction(obj_name, name) return type.__new__(mcs, name, bases, dct) class MyClass (object): __metaclass__ = DiscoveryExposedMethodDecoratorMetaclass @ExposeDiscoveryMethod def myCoolExposedMethod (self): pass I've now came to the point where two function registries are needed. The first thought was to subclass the metaclass and put the other registry in. For that the new method has simply to be rewritten. Since rewriting means redundant code this is not what I really want. So, it would be nice if anyone could name a way how to put an attribute inside of the metaclass which is able to be read when new is executed. With that the right registry could be put in without having to rewrite new. Thanks and Greetings, Michael

    Read the article

  • Ruby IRB - Requires and Scope

    - by tyndall
    Trying to understand this problem I'm running into. I create file welcome.rb. The contents of this file: welcome_message = "hi there" I then launch an irb session. And type require 'welcome'. That works fine. Then I type: puts welcome_message I get the error message undefined local variable or method `welcome_message' for main:Object What is the best way to bring in predefined variables and have initialization work done when you require something into your irb session. Global variables didn't seem like the right path.

    Read the article

  • Feature Activation Error(Cannot Add Dll to GAC)

    - by sbtahir
    Hi.. we have created a feature ,which have got 2 application pages. one is to activate the user control and the other one is for database configuration,for the database configuration the user have to give the .mdf and .ldf files to restore the database. For the restoration of database we have used microsoft.sqlserver.replication.dll, the feature is working fine, but when we deploy it on any other machine, at the time of activation it gives error, and the error is: Error: Cannot add the specified assembly to the global assembly cache: Microsoft.SqlServer.Replication.dll. Does anyone know how to solve this? Thanks SAAD

    Read the article

  • How to create a run loop that only listens to performSelector:onThread: and GUI events?

    - by Paperflyer
    I want to create a separate thread that runs its own window. Frankly, the documentation does not make sense to me. So I create an NSThread with a main function. I start the thread, create an NSAutoreleasePool, and run the run loop: // Global: BOOL shouldKeepRunning = YES; - (void)threadMain { NSAutoreleasePool *pool = [NSAutoreleasePool new]; // Load a nib file, set up its controllers etc. while (shouldKeepRunning) { NSAutoreleasePool *loopPool = [NSAutoreleasePool new]; [[NSRunLoop currentRunLoop] runUntilDate:[NSDate distantFuture]]; [loopPool drain]; } [pool drain]; } But since there is no registered port or observer, runUntilDate: exits immediately and CPU utilization goes to 100%. All thread communication is handled by calls to performSelector:onThread:withObject:waitUntilDone:. Clearly, I am not using the API correctly. So, what am I doing wrong?

    Read the article

  • Grails easygrid plugin, Datatable implementation

    - by Robert Morning
    I'm playing with the datatable implementation in the Easygrid plugin and I have to say i love it but I have a question . If i use datatable directly (ie outside of Easygrid) to decorate a table i get a global search box defined above my table . If i use the Easygrid implementation and define my grid in a controller I get filters added for each column but no search box - it is added but then removed somehow either by easygrid itself or some parameter passed to datatable . How can I restore the search box and is this a bug as i would have thought the default implementation of datatable supplied via easygrid should match the default implementation supplied by the vanilla datatable itself? I'm using Grails 2.3.7 and Easygrid 1.6.2 .. Thanks

    Read the article

  • Is it possible to interop with Thunderbird using C#?

    - by Jurily
    Here's the latest hurdle in my ongoing quest to automate my job: All email in the company goes through 4 different email adresses, switching randomly back and forth (with a note attached in the global share: please set "keep email on server") All logic related to email is contained in a nice big Thunderbird profile, which gets copied back and forth to new machines; this includes sorting invoices into 5 different "folders", the list of VIP adresses to send notifications, and the VIP level of those customers I only need the contents of those folders (the attachments, anyway) The question: is there a way to ask Thunderbird for those attachments and lists from C#? Alternatively, can Outlook be set up to synchronize with Thunderbird? Where do I start reading? Ditching Thunderbird is not an option right now, I need to keep up with changes to the VIP list. P.S. I will set up a real email server right after Monkey saves me enough time to convince people about it.

    Read the article

  • Using a database class in my user class

    - by Josh
    In my project I have a database class that I use to handle all the MySQL stuff. It connects to a database, runs queries, catches errors and closes the connection. Now I need to create a members area on my site, and I was going to build a users class that would handle registration, logging in, password/username changes/resets and logging out. In this users class I need to use MySQL for obvious reasons... which is what my database class was made for. But I'm confused as to how I would use my database class in my users class. Would I want to create a new database object for my user class and then have it close whenever a method in that class is finished? Or do I somehow make a 'global' database class that can be used throughout my entire script (if this is the case I need help with that, no idea what to do there.) Thanks for any feedback you can give me.

    Read the article

  • How do I stop IIS7 from putting out its own 404 before my MVC app gets a chance to handle it?

    - by Gary McGill
    I have an ASP.NET MVC 2 application, which has an Application_Error event handler in global.asax. In this, I'm detecting the case where the Exception type is HttpException and the HTTP code is 404, and redirecting to my own 404-handling page. This works fine on my Cassini development server, but now I'm trying to move it over to my production server which has IIS7. When I request a non-existent URL, IIS7 is showing its own 404 page, and so far as I can tell, my Application_Error method is never called. How do I fix that?

    Read the article

  • What are jQuery best practices regarding Ajax convenience methods and error handling?

    - by JonathanHayward
    Let's suppose, for an example, that I want to partly clone Gmail's interface with jQuery Ajax and implement periodic auto-saving as well as sending. And in particular, let us suppose that I care about error handling, expecting network and other errors, and instead of just being optimistic I want sensible handling of different errors. If I use the "low-level" feature of $.ajax() then it's clear how to specify an error callback, but the convenience methods of $.get(), $.post(), and .load() do not allow an error callback to be specified. What are the best practices for pessimistic error handling? Is it by registering a .ajaxError() with certain wrapped sets, or an introspection-style global error handler in $.ajaxSetup()? What would the relevant portions of code look like to initiate an autosave so that a "could not autosave" type warning is displayed if an attempted autosave fails, and perhaps a message that is customized to the type of error? Thanks,

    Read the article

  • How to add flags to RC.EXE through QMake .pro makefiles

    - by Hernán
    I've the following definition in my .pro file: RC_FILE = app.rc This RC file contains a global include at the top: #include "version_info.h" The version_info.h header is on a common header files directory. Since RC.EXE takes INCLUDE environment variable in consideration, according to MS documentation, my build process batch sets up that accordingly: SET INCLUDE=%PROJECTDIR%\version;%INCLUDE% ... QMAKE project.pro -spec win32-msvc2008 -r CONFIG += release This works perfect as RC seems to read that INCLUDE var so the "version_info.h" file is including on every RC file properly. The problem is when I generate a VS solution (or Import it through the VS Addin). The RC invocation does not contain any /I flag (as I expect) but does not read any INCLUDE variable, even when I've setup through system 'environment variables' dialog in XP. So I'm stuck with this problem, with two alternatives I could not get to work: Make VS RC.exe invocation honour the INCLUDE variable (didn't work either as user or system variable). Force QMAKE to pass /I flag to RC invocation, and get that /I flag imported into the project settings (Resource Compiler properties). Thanks in advance.

    Read the article

  • Trying to understand Java Classloading

    - by Jens
    Hello, I'm currently getting to know Java and OSGi, so I've read a few books. In one particular book the class loading is described. You can download it (free and legal) from the authors page (Neil Bartlett): OSGi Book On page 9 and 10 are this pictures: It seems like there is the possibility that our class "Foo" won't use the class "Bar" of foobar.jar, but instead class "Bar" from naughty.jar. Because of the flat and global structure of the Java classpath this could be, but as far as I know you would define a package from where you want to import a certain class: import foobar.Bar This should prevent loading the wrong class, shouldn't it? Of course assuming that the package is called "foobar".

    Read the article

  • Unable to compare valuesfrom mysql in a prepared statement

    - by Cortopasta
    I can't seem to get this to connect to the database so that I can run my prepared statement. Does anybody have an idea what I've forgotten? private function check_credentials($plain_username, $password) { global $dbcon; $ac = new ac(); $ac->dbconnect(); $userid = $dbcon->prepare('SELECT id FROM users WHERE username = :username AND password = :password LIMIT 1'); $userid->bindParam(':username', $plain_username); $userid->bindParam(':password', $password); $userid->execute(); $id = $userid->fetch(); Return $id; } EDIT: I changed the SQL query from a SELECT FROM query, to an INSERT INTO query and it worked. WHat the heck is going on?

    Read the article

  • Jquery ajax success function returns null?

    - by udaya
    I use the following the jquery statements to call my php controller function, it gets called but my result is not returned to my success function.... function getRecordspage() { $.ajax({ type: "POST", url:"http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount", data: "{}", contentType: "application/json; charset=utf-8", global:false, async: true, dataType: "json", success: function(result) { alert(result); } }); } My controller method, function mainAccount() { $_SESSION['menu'] = 'finance'; $data['account'] = $this->adminmodel->getaccountDetails(); if(empty($data['account'])) { $data['comment'] = 'No record found !'; } $json = json_encode($data); return $json; } I get the alert(1); in my success function but my alert(result); show null... Any suggestion...

    Read the article

  • Lucene numDocs and doqFreq on custom similarity class

    - by David A
    Hi All, im doing an aplication with Lucene (im a noob with it) and im facing some problems. My aplication uses the Lucene 2.4.0 library with a custom similaraty implementation (the jar is imported) In my app im calculating doqFreq and numDocs manually (im adding the values of all indexes and then i calculate a global value in order to use it on every query) and i want to use that values on a custom similarity implementation in order to calculate a new IDF. The problem is that I dont know how to use (or send) the new doqFreq and numDocs values from my app on that new similarty implementation as I dont want to change lucene´s code apart from this extra class. Any suggestions or examples? I read the docs but i dont now how to aproach this :s Thanks

    Read the article

  • AutoMapper and SecurityException in IIS

    - by Felipe
    Hi everybody... I'm developing a asp.net mvc application with nhibernate and I would not like to expose my objects mappings with NHibernate, so I created DTO for each entity and I'm trying to convert my Domain objects to DTO and send it to View. So I have in my sollution: ClassLibrary with my Domain (for NHibernate) and DTO objetcs Class library to make a SessionFactory adn Factories in my Project Asp.Net MVC 2 Application So, I download AutoMapper to transform Domain objects in DTO and add a the code to do this in Application_Start of global.asax. When I run in VisualStudio (by pressing F5) it works fine and my dtos are into the view, So when I publish this in IIS, I get a security exception =( in first line of conversion: Mapper.CreateMap(); <--- this line throw exception Mapper.CreateMap(); System.Security.SecurityException: Failed request for the permission of type 'System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. What can I do to resolve this to work in IIS ? When I will publish it on web server, the error will get too :( Thanks Cheers

    Read the article

  • jQuery .Ajax() function selector , store specific data in variable

    - by user279321
    I am new to jQuery and I have the following problem. My project has say 2 pages, 1.JSP and 2.html. Now I want to pick selected data from 2.html and use it on 1.JSP. Now this was achieved very easily using .load but I want the data to be present in a JavaScript variable rather than put it on the page (div tags, etc.), so that I can work upon that data (modify or add to database). I tried using .ajax and was able to write the following code: var value = (function () { var val = nulll; var filename = " 2.html"; $.ajax ({ 'async': false, 'global': false, 'url': filename, 'success' : function(data) { val = data; } }) return val; })() document.write(value) Where do I put the selector format (say div.id5) so that my variable have only relevant data rather than the full file data?

    Read the article

  • xpcom array can transfer in different xul files ?

    - by jin
    Now I am developing a firefox extension, can I define a global array in a js with the main xul . and I found when I use it in another js with another xul , it could not worked , so I searched the document of Firefox development. I found a common array can not be transfered between two js files with different xul files. and then I difined a xpcom mutablearray in a js: var eleList = Components.classes["@mozilla.org/array;1"] .createInstance(Components.interfaces.nsIMutableArray); but when I want to use it in another js : it still not work , why? Thank you very much!

    Read the article

  • Maintain combobox selected item across TabNavigator Tabs

    - by camcim
    Hi guys, I've just recently started out using Flash Builder and have a question surrounding states. In fact I'm not entirely sure it is related to states but read on and I hope it will become clearer. I currently have a custom component that contains 3 comboboxes. This resides in a TabNavigator component. The TabNavigator consits of 5 pages (Tabs). The custom container holding the comboboxes should display the same selected data across all Tabs. ie. If I am in Tab1 and select an item from one of the comboboxes then click on Tab2 I need to mirror the combobox's selection in Tab2. Can anyone offer me suggestions on how to best tackle this? Di I need to set a global variable?

    Read the article

  • Explain Python extensions multithreading

    - by Checkers
    Python interpreter has a Global Interpreter Lock, and it is my understanding that extensions must acquire it in a multi-threaded environment. But Boost.Python HOWTO page says the extension function must release the GIL and reacquire it on exit. I want to resist temptation to guess here, so I would like to know what should be GIL locking patterns in the following scenarios: Extension is called from python (presumably running in a python thread). And extension's background thread calls back into Py_* functions. And a final question is, why the linked document says the GIL should be released and re-acquired?

    Read the article

  • Pass a variable to a Symfony Form

    - by Juan Besa
    Hi, I am building a web application using Symfony 1.4 and Doctrine for a school and I want to make a very simple form to add a course to a student. The main problem I have is that in the drop down list I only want to show the courses in which the student is currently not enrolled. I already have a function in the model (in Student.class.php) which returns all the courses in which the student is not enrolled but the problem is I don't know how to pass the student to the configure() of the form. I have tried several options like passing it with the constructor of the form to a global variable or a special set method but none of them have worked. Is there any form to pass the student to the configure() method? Thanks!

    Read the article

  • Using a datanase class in my user class?

    - by Josh
    In my project I have a database class that I use to handle all the MySQL stuff. It connects to a database, runs queries, catches errors and closes the connection. Now I need to create a members area on my site, and I was going to build a users class that would handle registration, logging in, password/username changes/resets and logging out. In this users class I need to use MySQL for obvious reasons... which is what my database class was made for. But I'm confused as to how I would use my database class in my users class. Would I want to create a new database object for my user class and then have it close whenever a method in that class is finished? Or do I somehow make a 'global' database class that can be used throughout my entire script (if this is the case I need help with that, no idea what to do there.) Thanks for any feedback you can give me.

    Read the article

  • PHP session starter detect for visitor counting

    - by zapping
    Is there a way to find out on session being started. Like for instance the session start event in the global.ascx file of .net. The requirement is to find the no. of visits the user has done on the site. Instead of checking each time during posts or gets to the server. Is there something in php to find out if the session is a new one. Zen framework is also used for the app.

    Read the article

  • A function's static and dynamic parent

    - by legends2k
    I'm reading Thinking in C++ (vol. 2): Whenever a function is called, information about that function is pushed onto the runtime stack in an activation record instance (ARI), also called a stack frame. A typical stack frame contains (1) the address of the calling function (so execution can return to it), (2) a pointer to the ARI of the function’s static parent (the scope that lexically contains the called function, so variables global to the function can be accessed), and (3) a pointer to the function that called it (its dynamic parent). The path that logically results from repetitively following the dynamic parent links is the dynamic chain, or call chain I'm unable to comprehend what the author means as function's static and dynamic parent. Also am not able to differentiate between item 1, 2 or 3. They all seem to be the same. Can someone please explain this passage to me?

    Read the article

  • Routing with command controller and sub controllers without using areas

    - by user205258
    How can I create a routing structure for a project management application where there are discrete controllers for all the relevant pieces such as TaskController, DocumentController etc and an Over arching controller. I would essentially like a structure like: http://server/Project/123/Task http://server/Project/123/Document I am using mvc1 so I have no access to areas etc. The project section will have a separate master page for project controllers such as task, document etc with a dfferent menu navigaton. I have tried three routes together n Global.asax like: routes.MapRoute( "Task", "Project/{id}/Task/{action}", new { controller = "Task", action = "Index", id = "" } ); routes.MapRoute( "Message", "Project/{id}/Message/{action}", new { controller = "Message", action = "Index", id = "" } ); routes.MapRoute( "Document", "Project/{id}/Document/{action}", new { controller = "Document", action = "Index", id = "" } ); What am I doing wrong here

    Read the article

< Previous Page | 127 128 129 130 131 132 133 134 135 136 137 138  | Next Page >