Search Results

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

Page 150/224 | < Previous Page | 146 147 148 149 150 151 152 153 154 155 156 157  | Next Page >

  • how to avoid storing several times a repeated field of a Symfony form?

    - by user454760
    Hello everybody, I am working with Symfony 1.4 and Doctrine. I have a model A with an email field. The form of A displays an input in which the user should insert the email correctly. But as everybody knows, sometimes they don't do it. To fix this I have inserted an extra field in the model (and in the form), called *repeat_email* to prevent the misspellings. Then, in the validation process, after validating all the fields, i use a global validator to compare the data of the two fields. This works, but I don't want to have the email stored two times in the database (I don't want the *repeat_email*). Is there any mechanism to use it in the validation process, but not to store it in the database? Thanks,

    Read the article

  • Is there a "concise" way to do namespacing in JavaScript?

    - by olliej
    I've frequently encountered sites that put all of their javascript inside a "namespace" structure along the lines of namespaces = { com : { example: { example.com's data} } But setting this up safely with respect to other namespaced frameworks seems to require a relatively hefty amount of code (defined as 2 lines). I was wondering whether anyone knows of a concise way to do this? and whether there's a relatively standard/consistent way to structure it? eg. is the "com" namespace directly attached to the global object, or is it attached through a namespace object? [Edit: whoops, obviously {com = { ... } } wouldn't accomplish anything close to what i intended, thanks to Shog9 for pointing that out. :D]

    Read the article

  • Problem using a costum server control in a aspx

    - by gre3ns0ul
    Hi guys, i am having a issue. I already developed one class (my custom gridview) and i want use it on a .aspx That class is defined in app_code and compiled to the dll of the project. namespace MyCostumControls{  public class DropDownPagingGridView : GridView{ ... I already registered the control on the aspx page using <%@ Register Namespace="MyCostumControls" TagPrefix="ctrl" % and i can use in the page and works ok.. But i'm watching one problem. That class contains methods defined by me, than when i try to call them in code-behind sayd to me than they're not defined. In designed i don't see the reference to MyCostumControls, and when i try declare one field using protected global::MyCostumControls.MyCostumControls ddl_gv_errors, i cannot access to MyCostumControls namespace, Is because he's compiled to the project dll? I can access to all namespaces than are not contained in app_code. Solutions? Apreciate. Thanks

    Read the article

  • Why use threading data race will occur, but will not use gevent

    - by onlytiancai
    My test code is as follows, using threading, count is not 5,000,000 , so there has been data race, but using gevent, count is 5,000,000, there was no data race . Is not gevent coroutine execution will atom "count + = 1", rather than split into a one CPU instruction to execute? # -*- coding: utf-8 -*- import threading use_gevent = True use_debug = False cycles_count = 100*10000 if use_gevent: from gevent import monkey monkey.patch_thread() count = 0 class Counter(threading.Thread): def __init__(self, name): self.thread_name = name super(Counter, self).__init__(name=name) def run(self): global count for i in xrange(cycles_count): if use_debug: print '%s:%s' % (self.thread_name, count) count = count + 1 counters = [Counter('thread:%s' % i) for i in range(5)] for counter in counters: counter.start() for counter in counters: counter.join() print 'count=%s' % count

    Read the article

  • Shared memory of same DLL in different 32 bit processes is sometimes different in a terminal session

    - by KBrusing
    We have an 32 bit application consisting of some processes. They communicate with shared memory of a DLL used by every process. Shared memory is build with global variables in C++ by "#pragma data_seg ("Shared")". When running this application sometime during starting a new process in addition to an existing (first) process we observe that the shared memory of both processes is not the same. All new started processes cannot communicate with the first process. After stopping all of our processes and restarting the application (with some processes) everything works fine. But sometime or other after successfully starting and finishing new processes the problem occurs again. Running on all other Windows versions or terminal sessions on Windows server 2003 our application never got this problem. Is there any new "feature" on Windows server 2008 that might disturb the hamony of our application?

    Read the article

  • What is the best place to store globals in Rails app?

    - by Nick Gorbikoff
    Hello. I was wondering if there is the best practice on where to store global settings in a rails app. What I mean by that is i.e: I have a few globals defined that may change, but not likely and it seems inappropriate to store them in DB since they are used so much. For instance I have SYSTEM_EMAIL & SYSTEM_EMAIL_SIGNATURE & SYSTEM_STORAGE_ROOT. Right now I keep them in environment.rb, but I'm not sure if this is the right palce to store them. Thank you

    Read the article

  • providing a java servlet with information

    - by tom
    Hi, i am new to servlets. I made a simple hello world programme that prints those famous 2 words to the screen when i access the page via a browser using http://localhost:8080/mypath/path... My question is now, how do i provide a servlet with information? Specifically considering the fact that my c# programme calculates a lookup value for a global system, then the "java" servlet processes that and returns a set of results. I have done the reverse thanks to help on here, regarding calling a returned string from the java servlet in c#. However i am not sure how i go about providing the servlet information. Do i pass it via the url? Thank you

    Read the article

  • Can't use method return value in write context; Not sure where to go from here

    - by Morgan Green
    This is my source for the variable. <?php if ($admin->get_permissions()=3) echo 'Welcome to the Admin Panel'; else echo 'Sorry, You do not have access to this page'; ?> And the code that I'm actually trying to call with the if statement is: public function get_permissions() { $username = $_SESSION['admin_login']; global $db; $info = $db->get_row("SELECT `permissions` FROM `user` WHERE `username` = '" . $db->escape($username) . "'"); if(is_object($info)) return $info->permissions; else return ''; } This should be a simple way to call my pages that the user is authorized for by using an else if statement. Or So I thought

    Read the article

  • pthread_exit return value

    - by Manty
    This is surprising for me. void * thread_func(void *arg) { pthread_exit(&ret); } int main(void) { pthread_t thr; int *exit_status; pthread_create(&thr, NULL, thread_func, NULL); sleep(2); pthread_join(thr, (void **)&exit_status); printf("value of exit status - %d\n", *exit_status); ret = 20; pthread_join(thr, (void **)&exit_status); printf("value of exit status - %d\n", *exit_status); return 0; } The output is value of exit status - 50 value of exit status - 20 I was expecting both the times the exit_status would be the actual exit value(50 in my case) of the thread. Instead it is just returning the value of the global variable which I used for pthread_exit. Is it not a bug?

    Read the article

  • Get selected items from explorer using C# .NET 3.5

    - by ghawkes
    I am writing a .NET 3.5 WPF application in C#. This application needs to be able to get the selected items out of Windows explorer when it is in the foreground. I already have the code working that handles a global Windows hotkey and then checks to see if the foreground IntPtr is from explorer. If so, I am able to obtain the System.Diagnostics.Process object that maps to explorer. At this point, I would like to obtain the list of selected items from explorer. Perhaps there is a Windows API function that I could pinvoke to do this? Thank you, G

    Read the article

  • javascript / jQuery variable problem (possibly caching issue)

    - by waitinforatrain
    Standard AJAX query with jQuery: var globalTitle = ""; var pages = ["a", "b", "c"]; for (var i = 0; i < pages.length; i++) { createpage(pages[i]); } function createpage(title) { globalTitle=title; console.log (globalTitle); //All looks good here $.ajax({ url: "createpage.php?id=" + title, context: document.body, success: success }); } The success() function uses globaltitle which is why I had to declare it global. In the success() function though console.log (globalTitle); constantly gives me "a". It's like the variable is assigned but is then cached every time success() is called. Happens in FF 4 and Chrome 8. Any thoughts?

    Read the article

  • One application instance for two domain name

    - by dervlap
    Hello, I have two web applications in ASP.NET which are quite the same (same business logic, same DAL, same DB scheme but different instance). The only thing that I need to change is the design (logo, color,...) and the text (global and local resource) to adress two separate business sector. We cannot "subdomain" the application because we need the two app "seems to be" independant. Is it a good idea to run only one instance for the 2 web applications. For example : I will have 2 hostnames : mycompagny.com and mycompagny2.com and I will put an HTTP Module which will set a string which will be propagated in my application like 'company' and 'company2'. I will instanciate the dal only once but the connection string will change depending on the string 'company' or 'company2'. Any pros and cons ? Any other alternatives ?

    Read the article

  • How to change word recognition in vim spell?

    - by David
    I like that vim 7.0 supports spell checking via :set spell, and I like that it by default only checks comments and text strings in my C code. But I wanted to find a way to change the behavior so that vim will know that when I write words containing underscores, I don't want that word spell checked. The problem is that I often will refer to variable or function names in my comments, and so right now vim thinks that each piece of text that isn't a complete correct word is a spelling error. Eg. /* The variable proj_abc_ptr is used in function do_func_stuff' */ Most of the time, the pieces seperated by underscores are complete words, but other times they are abbreviations that I would prefer not to add to a word list. Is there any global way to tell vim to include _'s as part of the word when spell checking?

    Read the article

  • Block call in Ruby on Rails

    - by Mattias
    Hi, I'm trying to clean up my code and get rid of a lot of ugly hashes. In my views I define several actions like this: @actions = { :interest => {'Show interest', link_to(..), :disabled => true}, :follow => {'Follow this case', link_to(..)} ... } As these hashes grow, the maintainability decreases. I want to convert the above format to something like: actions do item :interest, 'Show interest', link_to(..), :disabled => true item :follow, 'Follow', link_to(..) ... end How do I structure my helper methods to allow this? Preferably the 'item'-method should only be available in the 'actions' block and not in the global scope. Thanks!

    Read the article

  • How can i check if user entering correct form of email

    - by deerox
    Well i am not using email verification so i am facing problem in checking correct form of email address suppose if user enter support or support@ it accept it as well. So i atleast want them to enter there email or at least they enter email form correctly Here is my code: <?php require_once 'global.php'; if (!isset($_SESSION['logged_in'])) { header("Location: login.php"); } $user = unserialize($_SESSION['user']); $email = $user->email; $message = ""; if (isset($_POST['submit-settings'])) { $email = $_POST['email']; $user->email = $email; $user->save(); $msg = "Done!<br/>"; } ?>

    Read the article

  • How to handle uncaught Exceptions in javascript without a try/catch-block?

    - by user344238
    What i try to accomplish is to register a global handler to catch all uncaught exceptions. Searching the web i only managed to find people pointing out window.onerror but this doesn't do the trick for me. Apparently window.onerror only gets called upon errors and not upon exceptions. Assume the following code: function windowError(message, url, line) { alert(message, url, line); } window.onerror=windowError; throw("uncaught"); The obviously uncaught exception won't trigger the windowError handler. (Using Firefox 3.6.3) Any suggestions?

    Read the article

  • Guidance for Php for a beginner

    - by luckyluke
    I've just started to learn PHP. I found the $_POST variable is not working and posted the same at the below link $_POST[] not working in php and as per the advise i installed XAMPP. But still the proble of $_POST variable is not solved. Now i've a doubt whether i need to configure any global variable to make $_POST work. I'm totally lost on this and dont know how to proceed. Any help on this is verryy much appreciated. Thanks.

    Read the article

  • Reading another packages symbol table in Perl

    - by justintime
    I am trying to read a global symbol from another package. I have the package name as a string. I am using qualify_to_ref from Symbol module my $ref = qualify_to_ref ( 'myarray', 'Mypackage' ) ; my @array = @$ref ; gives me Not an ARRAY reference at ...... I presume I am getting the format of the dereference wrong. Here is a complete example program. use strict; use Symbol ; package Mypackage ; our @myarray = qw/a b/ ; package main ; my $ref = qualify_to_ref ( 'myarray', 'Mypackage' ) ; my @array = @$ref ;

    Read the article

  • What is the best way to programmatically run javascript when an ASP.net page loads?

    - by Rising Star
    In my global.asax file for my ASP.net project, I am checking for certain conditions. When those conditions are met, I want to automatically execute javascript code when the page runs. This is my code: if condition Then Response.Write("") Response.Write(" // Javascript code to do stuff ") Response.Write("") End If While this appears to work to execute the Javascript code, I don't think it's a best practice because this code will preceed all of the HTML of the page that gets loaded. What is the best way of programmatically tacking on some extra Javascript code to be run when my page loads?

    Read the article

  • rbenv not changing ruby version

    - by user1443338
    So i installed rbenv according to the github directions. I am running OSX but i have tried this on a Ubuntu 12.04 VM and got the same results. The following is what i get in my terminal when i try to change ruby versions: rbenv versions * 1.9.3-p0 (set by /Users/user/.rbenv/version) 1.9.3-p125 rbenv global 1.9.3-p0 rbenv rehash ruby -v ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0] which ruby /usr/bin/ruby Anyone have any ideas as to why rbenv isnt actually switching the ruby version like it thinks it is? Aslo there is no .rbenv file in the local directory that would be causing the ruby version to default to 1.8.7 rbenv local rbenv: no local version configured for this directory

    Read the article

  • c# performance- create font

    - by user85917
    I have performance issues in this code segment which I think is caused by the "new Font". Will it be faster if fonts are static/global ? if (row.StartsWith(TILD_BEGIN)) { rtbTrace.SelectionColor = Color.Maroon; rtbTrace.SelectionFont = new Font(myFont, (float)8.25, FontStyle.Regular); if (row.StartsWith(BEGIN) ) rtbTrace.AppendText(Environment.NewLine + row + Environment.NewLine); else rtbTrace.AppendText(Environment.NewLine + row.Substring(1) + Environment.NewLine); continue; } if (row.StartsWith(EXCL_BEGIN)) { -- similar block } if (row.StartsWith(DLR_BEGIN)) { -- similar block } . . .

    Read the article

  • Java - Count words in two documents

    - by user552961
    Good Morning - it is school assignment, I am not asking for any source code (if you can provide any pesudo code it would be awesome). Here is the problem :( I have to create a term frequency table. It is not pure TF, I just need to count the words and write down. I know basic steps to do it 1 - extract all terms (I can do it with file reader) 2 - remove repeating terms (I can do it with TreeMap) The output of 2nd step would be Niga, ponga, dinga, bitlo, etc. 3 - Now I have to see if there is any word in current file from above terms or not, if yes then I will count. Now this is my problem, I stucked on step 3 :( I have some idea how to count words with TreeMap (treemap.containskey etc.) but it would be global count not local count for each file :( Any pseudo code?

    Read the article

  • How do you like to define your module-wide variables in drupal 6?

    - by sprugman
    I'm in my module file. I want to define some complex variables for use throughout the module. For simple things, I'm doing this: function mymodule_init() { define('SOME_CONSTANT', 'foo bar'); } But that won't work for more complex structures. Here are some ideas that I've thought of: global: function mymodule_init() { $GLOBALS['mymodule_var'] = array('foo' => 'bar'); } variable_set: function mymodule_init() { variable_set('mymodule_var', array('foo' => 'bar')); } property of a module class: class MyModule { static $var = array('foo' => 'bar'); } Variable_set/_get seems like the most "drupal" way, but I'm drawn toward the class setup. Are there any drawbacks to that? Any other approaches out there?

    Read the article

  • get function address from name [.debug_info ??]

    - by user361190
    Hi, I was trying to write a small debug utility and for this I need to get the function/global variable address given its name. This is built-in debug utility, which means that the debug utility will run from within the code to be debugged or in plain words I cannot parse the executable file. Now is there a well-known way to do that ? The plan I have is to make the .debug_* sections to to be loaded into to memory [which I plan to do by a cheap trick like this in ld script] .data { *(.data) __sym_start = .; (debug_); __sym_end = .; } Now I have to parse the section to get the information I need, but I am not sure this is doable or is there issues with this - this is all just theory. But it also seems like too much of work :-) is there a simple way. Or if someone can tell upfront why my scheme will not work, it ill also be helpful. Thanks in Advance, Alex.

    Read the article

  • How can i add Active Directory security groups to a SharePoint site to control permissions, rather than individual user accounts

    - by user574811
    SharePoint does integrate active directory accounts, of course, but how about security groups? Have a few sites where I'm fairly confident access is going through an existing Active Directory (AD) security groups (i.e. only an AD security group has been granted permissions through the 'People and Groups') In another situation, where I created the AD group and granted it permissions to a site, the customers were not able to access immediately. Eventually had to fast-track it and add the individuals to the People and Groups to keep the project going, but hoping not to have to maintain it that way. Any specific requirements of the security group in AD? Universal, Global, or domain local? Is there any time delay between modifying group members in AD and having that take effect in SharePoint?

    Read the article

< Previous Page | 146 147 148 149 150 151 152 153 154 155 156 157  | Next Page >