Search Results

Search found 2030 results on 82 pages for 'params'.

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

  • Spring Dependency Injecting an annotated Aspect

    Using Spring I've had some issues with doing a dependency injection on an annotated Aspect class. CacheService is injected upon the Spring context's startup, but when the weaving takes place, it says that the cacheService is null. So I am forced to relook up the spring context manually and get the bean from there. Is there another way of going about it? Here is an example of my Aspect: import org.apache.log4j.Logger; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import com.mzgubin.application.cache.CacheService; @Aspect public class CachingAdvice { private static Logger log = Logger.getLogger(CachingAdvice.class); private CacheService cacheService; @Around("execution(public *com.mzgubin.application.callMethod(..)) &&" + "args(params)") public Object addCachingToCreateXMLFromSite(ProceedingJoinPoint pjp, InterestingParams params) throws Throwable { log.debug("Weaving a method call to see if we should return something from the cache or create it from scratch by letting control flow move on"); Object result = null; if (getCacheService().objectExists(params))}{ result = getCacheService().getObject(params); } else { result = pjp.proceed(pjp.getArgs()); getCacheService().storeObject(params, result); } return result; } public CacheService getCacheService(){ return cacheService; } public void setCacheService(CacheService cacheService){ this.cacheService = cacheService; } }

    Read the article

  • Search by ID, no keyword. Tried using :conditions but no result ouput.

    - by Victor
    Using Thinking Sphinx, Rails 2.3.8. I don't have a keyword to search, but I wanna search by shop_id which is indexed. Here's my code: @country = Country.search '', { :with => {:shop_id => params[:shop_id]}, :group_by => 'trip_id', :group_function => :attr, :page => params[:page] } The one above works. But I thought the '' is rather redundant. So I replaced it with :conditions resulting as: @country = Country.search :conditions => { :with => {:shop_id => params[:shop_id]}, :group_by => 'trip_id', :group_function => :attr, :page => params[:page] } But then it gives 0 result. What is the correct code? Thanks.

    Read the article

  • Refactor the following two C++ methods to move out duplicate code

    - by ossandcad
    I have the following two methods that (as you can see) are similar in most of its statements except for one (see below for details) unsigned int CSWX::getLineParameters(const SURFACE & surface, vector<double> & params) { VARIANT varParams; surface->getPlaneParams(varParams); // this is the line of code that is different SafeDoubleArray sdParams(varParams); for( int i = 0 ; i < sdParams.getSize() ; ++i ) { params.push_back(sdParams[i]); } if( params.size() > 0 ) return 0; return 1; } unsigned int CSWX::getPlaneParameters(const CURVE & curve, vector<double> & params) { VARIANT varParams; curve->get_LineParams(varParams); // this is the line of code that is different SafeDoubleArray sdParams(varParams); for( int i = 0 ; i < sdParams.getSize() ; ++i ) { params.push_back(sdParams[i]); } if( params.size() > 0 ) return 0; return 1; } Is there any technique that I can use to move the common lines of code of the two methods out to a separate method, that could be called from the two variations - OR - possibly combine the two methods to a single method? The following are the restrictions: The classes SURFACE and CURVE are from 3rd party libraries and hence unmodifiable. (If it helps they are both derived from IDispatch) There are even more similar classes (e.g. FACE) that could fit into this "template" (not C++ template, just the flow of lines of code) I know the following could (possibly?) be implemented as solutions but am really hoping there is a better solution: I could add a 3rd parameter to the 2 methods - e.g. an enum - that identifies the 1st parameter (e.g. enum::input_type_surface, enum::input_type_curve) I could pass in an IDispatch and try dynamic_cast< and test which cast is NON_NULL and do an if-else to call the right method (e.g. getPlaneParams() vs. get_LineParams()) The following is not a restriction but would be a requirement because of my teammates resistance: Not implement a new class that inherits from SURFACE/CURVE etc. (They would much prefer to solve it using the enum solution I stated above)

    Read the article

  • ruby on rails implement search with auto complete

    - by user429400
    I've implemented a search box that searches the "Illnesses" table and the "symptoms" table in my DB. Now I want to add auto-complete to the search box. I've created a new controller called "auto_complete_controller" which returns the auto complete data. I'm just not sure how to combine the search functionality and the auto complete functionality: I want the "index" action in my search controller to return the search results, and the "index" action in my auto_complete controller to return the auto_complete data. Please guide me how to fix my html syntax and what to write in the js.coffee file. I'm using rails 3.x with the jquery UI for auto-complete, I prefer a server side solution, and this is my current code: main_page/index.html.erb: <p> <b>Syptoms / Illnesses</b> <%= form_tag search_path, :method => 'get' do %> <p> <%= text_field_tag :search, params[:search] %> <br/> <%= submit_tag "Search", :name => nil %> </p> <% end %> </p> auto_complete_controller.rb: class AutoCompleteController < ApplicationController def index @results = Illness.order(:name).where("name like ?", "%#{params[:term]}%") + Symptom.order(:name).where("name like ?", "%#{params[:term]}%") render json: @results.map(&:name) end end search_controller.rb: class SearchController < ApplicationController def index @results = Illness.search(params[:search]) + Symptom.search(params[:search]) respond_to do |format| format.html # index.html.erb format.json { render json: @results } end end end Thanks, Li

    Read the article

  • HELP Retrieving the url parameter from a JSON store from a EXTJS ComboBox

    - by Newbie
    I am having a problem retrieving the parameters from the url section of a json store for a combobox in EXTJS from my code behind page in c#. The following is the code in the store: var ColorStore = new Ext.data.JsonStore( { autoLoad: true, url: '/proxies/ReturnJSON.aspx?view=rm_colour_view', root: 'Rows', fields: ['company', 'raw_mat_col_code', 'raw_mat_col_desc'] }); And the following code is in my code behind page: protected void Page_Load(object sender, EventArgs e) { string jSonString = ""; connectionClass.connClass func = new connectionClass.connClass(); DataTable dt = func.getDataTable("sELECT * from rm_colour_view"); //Response.Write(Request.QueryString["view"]); string w = Request.Params.Get("url"); string z = Request.Params.Get("view"); string x = Request.Params.Get("view="); string c = Request.Params.Get("?view"); string s = Request.QueryString.Get("view"); string d = Request.Params["?view="]; string f = Request.Form["ColorStore"]; jSonString = Serialize(dt); Response.Write(jSonString); } The string w has gives the following output: /proxies/ReturnJSON.aspx but all the others strings return null... How can rm_colour_view from the datastore then be retrived??? Any help would be appreciated! Thanks

    Read the article

  • Fill business object from database by calling stored procedurs?

    - by grady
    Hello, I have several stored procedures in my database, some of them have params, some have no params. I tried to fill a business object by calling the stored procedures, but failed so far. How could I do that dynamically? Later, I want to use this object as a datasource for a report...but thats the next step. The important facts are: different stored procs return different amount of columns stored procs can have params, but its not required How could I achieve that? Thanks :)

    Read the article

  • How to evaluate the string in ruby if the string contains ruby command?

    - by Arun
    In my case, I was storing the sql query in my database as text. I am showing you one record which is present in my database Query.all :id => 1, :sql => "select * from user where id = #{params[:id]}" str = Query.first Now 'str' has value "select * from user where id = #{params[:id]}" Here, I want to parsed the string like If my params[:id] is 1 then "select * from user where id = 1" I used eval(str). Is this correct?

    Read the article

  • Rails SQL injection?

    - by yuval
    In Rails, when I want to find by a user given value and avoid SQL injection (escape apostrophes and the like) I can do something like this: Post.all(:conditions => ['title = ?', params[:title]]) I know that an unsafe way of doing this (possible SQL injection) is this: Post.all(:conditions => "title = #{params[:title]}") My question is, does the following method prevent SQL injection or not? Post.all(:conditions => {:title => params[:title]})

    Read the article

  • Adding items to dictionary if condition is true, else dont - python

    - by CodeTalk
    I'm trying to take an existing process: if self.path_object is not None: dictpath = {} for path in self.path_object: self.params = path.pathval.split("?")[0] self.params = path.pathval.split("&", 2) if path.pathval.contains(self.params): out = list(map(lambda v: v.split("=")[0] +"=" + str(self.fuzz_vectors), self.params)) else: pass dictpath[path] = out print dictpath I added the sub-if/else block in, but it is failing, stating: AttributeError: 'unicode' object has no attribute 'contains' on the if block . How can I fix it? I'm simply trying to do: if the path.pathval has either ? or & in it: add to dictionary else: pass #forget about it. Thanks!

    Read the article

  • PHP OOP problem

    - by Isis
    Hello <?php class Templater { var $params = array(); public static function assign($name, $value) { $this->params[] = array($name => $value); } public static dunction draw() { return $this->params; } } <?php $test = Templater::assign('key', 'value')->draw(); print_r($test); I need to function "assign" was static, but $params was common for the whole class.. BUt this code is not working(( Fatal error: Using $this when not in object context Any ideas?

    Read the article

  • Is it possible to have variable find conditions for both the key and value?

    - by DarrenD
    I'm trying to pass in both the field and the value in a find call: @employee = Employee.find(:all, :conditions => [ '? = ?', params[:key], params[:value].to_i) The output is SELECT * FROM `employees` WHERE ('is_manager' = 1) Which returns no results, however when I try this directly in mysqsl using the same call without the '' around is_manager, it works fine. How do I convert my params[:key] value to a symbol so that the resulting SQL call looks like: SELECT * FROM `employees` WHERE (is_manager = 1) Thanks, D

    Read the article

  • having problems using Zend_Db_Table_Abstract::createRow()

    - by Gootik
    Hey, I have built a model that extends Zend_Db_Table_Abstract and I can't figure out why I can't use createRow(); here is my code: class Model_User extends Zend_Db_Table_Abstract { public function createUser() { $row = $this->createRow(); $row->name = 'test'; $row->save(); } } and in a controller I use: $userModel = new Model_User(); $userModel->createUser(); which when run displays an error An error occurred Application error here is my setup in application.ini resources.db.adapter = "pdo_mysql" resources.db.params.host = "localhost" resources.db.params.username = "root" resources.db.params.password = "pass" resources.db.params.dbname = "app_db" resources.db.isDefaultTableAdapter = true I am sure that my user/pass/dbname is correct. I would appreciate it if you point me in the right direction.

    Read the article

  • Help me with query string parameters (Rails)

    - by Martin Petrov
    Hi, I'm creating a newsletter. Each email contains a link for editing your subscription: <%= edit_user_url(@user, :secret => @user.created_at.to_i) %> :secret = @user.created_at.to_i prevents users from editing each others profiles. def edit @user = user.find(params[:id]) if params[:secret] == @user.created_at.to_i render 'edit' else redirect_to root_path end end It doesn't work - you're always redirected to root_path. It works if I modify it like this: def edit @user = user.find(params[:id]) if params[:secret] == "1293894219" ... 1293894219 is the "created_at.to_i" for a particular user. Do you have any ideas why?

    Read the article

  • how to center layout to vertical in android through java code?

    - by UMMA
    friends, i want to set android:layout_centerVertical="true" property of layout through java code of an image. can any one guide me how to achieve this. here is my code. RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); params.height = (int)totalHeight; img.setLayoutParams(params); i have tried using setScaleType(ScaleType.FIT_CENTER) but no use. any help would be appriciated.

    Read the article

  • Adding image to html markup

    - by user1491991
    Hello guys i'm having a problem appending a image to my html markup which is generated when a button is clicked... wondering if i could some dirction __--------------------------SCRIPT----------------------------------------------------------- (function($){ $.confirm = function(params){ if($('#confirmOverlay').length){ // A confirm is already shown on the page: return false; } var buttonHTML = ''; $.each(params.buttons,function(name,obj){ // Generating the markup for the buttons: buttonHTML += '<a href="#" class="button '+obj['class']+'">'+name+'<span></span></a>'; if(!obj.action){ obj.action = function(){}; } }); var closetext= 'close'; var markup = [ '<div id="confirmOverlay">', '<div id ="model">','<div id="confirmBox">', '<div id="header">','<div id ="title">',params.title,'</div>', '<div id="close">','<ol id = "olclose">','<li id = "liclose">','<a id="close" href = "#">',closetext,'</a></li>', '<li id = "liclose">','<a id="close" href = "#">','<img src="../modal-close.gif"/>','</a></li>','</ol></div></div>', '<div id ="textbox">','<p>',params.message,'<br>','<br>' ,buttonHTML,'</p>', '</div>', '</div></div></div></div>' ].join(''); $(markup).hide().appendTo('body').fadeIn(); var buttons = $('#confirmBox .button'), i = 0; $.each(params.buttons,function(name,obj){ buttons.eq(i++).click(function(){ // Calling the action attribute when a // click occurs, and hiding the confirm. obj.action(); $.confirm.hide(); return false; }); }); } $.confirm.hide = function(){ $('#confirmOverlay').fadeOut(function(){ $(this).remove(); }); } })(jQuery); i've used firebug to check and its unable to fetch the image here

    Read the article

  • Creating collection with no code (almost)

    - by Sean Feldman
    When doing testing, I tend to create an object mother for the items generated multiple times for specifications. Quite often these objects need to be a part of a collection. A neat way to do so is to leverage .NET params mechanism: public static IEnumerable<T> CreateCollection<T>(params T[] items) { return items; } And usage is the following: private static IEnumerable<IPAddress> addresses = CreateCollection(new IPAddress(123456789), new IPAddress(987654321));

    Read the article

  • Server error 500: Undefinable problem with my Zend Framework based site

    - by sanders
    Hello everyone, Lately I had to reinstall my development site on my ubuntu machine since my system crashed after an os update. 4 days later my site is still not running as it should. Whenever i do an action which has in it an action on a database, it stops working. For example when Registring a new user, i get the following error: [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/user/register [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/css/main.css My Bootstrap class looks like this: <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{ /** * * @var unknown_type */ public $frontcontroller; /** * * @var unknown_type */ protected $_logger; /** * * @var unknown_type */ protected $_acl; /** * * @var unknown_type */ protected $_auth; /** * Setup the logging */ protected function _initLogging() { $this->bootstrap('frontController'); $logger = new Zend_Log(); $writer = 'production' == $this->getEnvironment() ? new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/logs/app.log') : new Zend_Log_Writer_Firebug(); $logger->addWriter($writer); if ('production' == $this->getEnvironment()) { $filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT); $logger->addFilter($filter); } $this->_logger = $logger; Zend_Registry::set('log', $logger); } protected function _initDefaultModuleAutoloader(){ $this->_logger->info('Bootstrap '. __METHOD__); $this->_resourceLoader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'EventManager', 'basePath' => APPLICATION_PATH . '/modules/eventManager', )); $this->_resourceLoader->addResourceTypes(array( 'modelResource' => array( 'path' => 'models/resources', 'namespace' => 'Resource', ), 'service' => array( 'path' => 'services', 'namespace' => 'Service' ), )); } // @todo develop this function protected function _initDbProfiler(){ $this->_logger->info('Bootstrap ' . __METHOD__); if ('production' !== $this->getEnvironment()) { $this->bootstrap('db'); $profiler = new Zend_Db_Profiler_Firebug('All DB Queries'); $profiler->setEnabled(true); $this->getPluginResource('db')->getDbAdapter()->setProfiler($profiler); } } /** * Add Controller Action Helpers */ protected function _initActionHelpers() { $this->_logger->info('Bootstrap ' . __METHOD__); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Acl()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_RedirectCommon()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Service()); } /** * * @return unknown_type */ protected function _initRoutes(){ $this->_logger->info('Initialize Routes '. __METHOD__); $this->bootstrap('frontController'); $router = $this->frontController->getRouter(); $route = new Zend_Controller_Router_route( 'register', array( 'controller' => 'user', 'action' => 'register' ) ); $router->addRoute('register',$route); $route = new Zend_Controller_Router_route( 'login', array( 'controller' => 'user', 'action' => 'login' ) ); $router->addRoute('login',$route); $route = new Zend_Controller_Router_route( 'logout', array( 'controller' => 'user', 'action' => 'logout' ) ); $router->addRoute('logout',$route); } /** * * @return void */ protected function _initLocale(){ $this->_logger->info('Bootstrap '.__METHOD__); $locale = new Zend_Locale('nl_NL'); Zend_Registry::set('Zend_Locale', $locale); } protected function _initAcl(){ $this->_acl = new EventManager_Service_Acl(); } /** * * @return void */ protected function _initViewSettings(){ $this->_logger->info('Bootstrap '.__METHOD__); $this->bootstrap('view'); $this->bootstrap('Acl'); $this->_view = $this->getResource('view'); //set encoding and doctype $this->_view->setEncoding('UTF-8'); $this->_view->doctype('XHTML1_STRICT'); $this->_view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8'); $this->_view->headMeta()->appendHttpEquiv('Content-Language', 'en-US'); //@todo op een later moment moeten hier nog de stylesheets worden toegevoegd $this->_view->headLink()->appendStylesheet('/css/main.css'); //$this->_view->headTitle('Event Manager'); /* Set the head style. $this->_view->headTitle->headStyle(); */ $this->_view->headTitle()->setSeparator(' - '); $this->_auth = Zend_Auth::getInstance(); $navigation = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml','nav'); $navContainer = new Zend_Navigation($navigation); $this->_view->navigation($navContainer)->setAcl($this->_acl)->setRole($this->_auth->getStorage()->read()->usr_role); //THIS IS LINE 169!!!!!!!!! } /** * Add graceful error handling to the dispatch, this will handle * errors during Front Controller dispatch. */ public function run() { $errorHandling = $this->getOption('errorhandling'); try { parent::run(); } catch(Exception $e) { if (true == (bool) $errorHandling['graceful']) { $this->__handleErrors($e, $errorHandling['email']); } else { throw $e; } } } /** * Handle errors gracefully, this will work as long as the views, * and the Zend classes are available * * @param Exception $e * @param string $email */ protected function __handleErrors(Exception $e, $email) { header('HTTP/1.1 500 Internal Server Error'); $view = new Zend_View(); $view->addScriptPath(dirname(__FILE__) . '/../views/scripts'); echo $view->render('fatalError.phtml'); if ('' != $email) { $mail = new Zend_Mail(); $mail->setSubject('Fatal error in application Storefront'); $mail->addTo($email); $mail->setBodyText( $e->getFile() . "\n" . $e->getMessage() . "\n" . $e->getTraceAsString() . "\n" ); @$mail->send(); } } } I have tried to debug my code, but everyting goes well until I do somethign with the db. But I don't know what goes wrong with the db. I don't get any clear error messages. Can someone help me? Some more possible interesting data: [bootstrap] resources.db.adapter = "PDO_MYSQL" resources.db.isdefaulttableadapter = true resources.db.params.dbname = "ladosa" resources.db.params.username = "root" resources.db.params.password = "root" resources.db.params.hostname = "localhost" resources.db.params.charset = "UTF8" resources.db.params.profiler.enabled = true resources.db.params.profiler.class = Zend_Db_Profiler_Firebug Autoloadernamespaces[] = "Zend_" Autoloadernamespaces[] = "SF_" phpsettings.display_errors = 0 phpsettings.error_reporting = 8191 phpSettings.date.timezone = "Europe/Amsterdam" bootstrap.path = APPLICATION_PATH"/bootstrap/Bootstrap.php" pluginPaths.resource_ = APPLICATION_PATH"/resources" resources.frontcontroller.moduledirectory = APPLICATION_PATH"/modules" resources.frontcontroller.defaultmodule = "eventManager" resources.frontcontroller.params.prefixDefaultModule = true resources.frontcontroller.exceptions = false resources.view[] = "" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.view.encoding = "UTF-8" resources.view.title = Rode kruis Vrijwilligers applicatie ;resources.view.helperPath.Default_View_Helper = APPLICATION_PATH "/modules/eventManager/views/helpers" resources.layout.layout = "main" [production:bootstrap] [development:bootstrap] ;resources.frontController.throwExceptions = 1 ;phpSettings.display_startup_errors=1 ;phpSettings.display_errors = 1 ;resources.frontcontroller.throwerrors = [test:production] btw. I CAN login to my database command line with the given username and password. Update: today i decided to investigate on my http request and i came to an error 500. My apache logs don't give any related information, I think. I posted the logs above. Any idea's?

    Read the article

  • Server error 500: Undefinable problem with my Zend Framework based site

    - by sanders
    Lately I had to reinstall my development site on my ubuntu machine since my system crashed after an os update. 4 days later my site is still not running as it should. Whenever i do an action which has in it an action on a database, it stops working. For example when Registring a new user, i get the following error: [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/user/register [Sun Jul 25 20:07:20 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/user/register [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Notice: Trying to get property of non-object in /var/www/nrka2/application/bootstrap/Bootstrap.php on line 169, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP Stack trace:, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 1. {main}() /var/www/nrka2/public/index.php:0, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 2. require() /var/www/nrka2/public/index.php:2, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 3. Zend_Application->bootstrap() /var/www/nrka2/application/application.php:23, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 4. Zend_Application_Bootstrap_BootstrapAbstract->bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application.php:355, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 5. Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:583, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 6. Zend_Application_Bootstrap_BootstrapAbstract->_executeResource() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:619, referer: http://nrka2/css/main.css [Sun Jul 25 20:07:22 2010] [error] [client 127.0.0.1] PHP 7. Bootstrap->_initViewSettings() /var/www/Zend/ZendFramework-1.10.6/library/Zend/Application/Bootstrap/BootstrapAbstract.php:666, referer: http://nrka2/css/main.css My Bootstrap class looks like this: <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{ /** * * @var unknown_type */ public $frontcontroller; /** * * @var unknown_type */ protected $_logger; /** * * @var unknown_type */ protected $_acl; /** * * @var unknown_type */ protected $_auth; /** * Setup the logging */ protected function _initLogging() { $this->bootstrap('frontController'); $logger = new Zend_Log(); $writer = 'production' == $this->getEnvironment() ? new Zend_Log_Writer_Stream(APPLICATION_PATH . '/../data/logs/app.log') : new Zend_Log_Writer_Firebug(); $logger->addWriter($writer); if ('production' == $this->getEnvironment()) { $filter = new Zend_Log_Filter_Priority(Zend_Log::CRIT); $logger->addFilter($filter); } $this->_logger = $logger; Zend_Registry::set('log', $logger); } protected function _initDefaultModuleAutoloader(){ $this->_logger->info('Bootstrap '. __METHOD__); $this->_resourceLoader = new Zend_Application_Module_Autoloader(array( 'namespace' => 'EventManager', 'basePath' => APPLICATION_PATH . '/modules/eventManager', )); $this->_resourceLoader->addResourceTypes(array( 'modelResource' => array( 'path' => 'models/resources', 'namespace' => 'Resource', ), 'service' => array( 'path' => 'services', 'namespace' => 'Service' ), )); } // @todo develop this function protected function _initDbProfiler(){ $this->_logger->info('Bootstrap ' . __METHOD__); if ('production' !== $this->getEnvironment()) { $this->bootstrap('db'); $profiler = new Zend_Db_Profiler_Firebug('All DB Queries'); $profiler->setEnabled(true); $this->getPluginResource('db')->getDbAdapter()->setProfiler($profiler); } } /** * Add Controller Action Helpers */ protected function _initActionHelpers() { $this->_logger->info('Bootstrap ' . __METHOD__); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Acl()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_RedirectCommon()); Zend_Controller_Action_HelperBroker::addHelper(new SF_Controller_Helper_Service()); } /** * * @return unknown_type */ protected function _initRoutes(){ $this->_logger->info('Initialize Routes '. __METHOD__); $this->bootstrap('frontController'); $router = $this->frontController->getRouter(); $route = new Zend_Controller_Router_route( 'register', array( 'controller' => 'user', 'action' => 'register' ) ); $router->addRoute('register',$route); $route = new Zend_Controller_Router_route( 'login', array( 'controller' => 'user', 'action' => 'login' ) ); $router->addRoute('login',$route); $route = new Zend_Controller_Router_route( 'logout', array( 'controller' => 'user', 'action' => 'logout' ) ); $router->addRoute('logout',$route); } /** * * @return void */ protected function _initLocale(){ $this->_logger->info('Bootstrap '.__METHOD__); $locale = new Zend_Locale('nl_NL'); Zend_Registry::set('Zend_Locale', $locale); } protected function _initAcl(){ $this->_acl = new EventManager_Service_Acl(); } /** * * @return void */ protected function _initViewSettings(){ $this->_logger->info('Bootstrap '.__METHOD__); $this->bootstrap('view'); $this->bootstrap('Acl'); $this->_view = $this->getResource('view'); //set encoding and doctype $this->_view->setEncoding('UTF-8'); $this->_view->doctype('XHTML1_STRICT'); $this->_view->headMeta()->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8'); $this->_view->headMeta()->appendHttpEquiv('Content-Language', 'en-US'); //@todo op een later moment moeten hier nog de stylesheets worden toegevoegd $this->_view->headLink()->appendStylesheet('/css/main.css'); //$this->_view->headTitle('Event Manager'); /* Set the head style. $this->_view->headTitle->headStyle(); */ $this->_view->headTitle()->setSeparator(' - '); $this->_auth = Zend_Auth::getInstance(); $navigation = new Zend_Config_Xml(APPLICATION_PATH.'/configs/navigation.xml','nav'); $navContainer = new Zend_Navigation($navigation); $this->_view->navigation($navContainer)->setAcl($this->_acl)->setRole($this->_auth->getStorage()->read()->usr_role); //THIS IS LINE 169!!!!!!!!! } /** * Add graceful error handling to the dispatch, this will handle * errors during Front Controller dispatch. */ public function run() { $errorHandling = $this->getOption('errorhandling'); try { parent::run(); } catch(Exception $e) { if (true == (bool) $errorHandling['graceful']) { $this->__handleErrors($e, $errorHandling['email']); } else { throw $e; } } } /** * Handle errors gracefully, this will work as long as the views, * and the Zend classes are available * * @param Exception $e * @param string $email */ protected function __handleErrors(Exception $e, $email) { header('HTTP/1.1 500 Internal Server Error'); $view = new Zend_View(); $view->addScriptPath(dirname(__FILE__) . '/../views/scripts'); echo $view->render('fatalError.phtml'); if ('' != $email) { $mail = new Zend_Mail(); $mail->setSubject('Fatal error in application Storefront'); $mail->addTo($email); $mail->setBodyText( $e->getFile() . "\n" . $e->getMessage() . "\n" . $e->getTraceAsString() . "\n" ); @$mail->send(); } } } I have tried to debug my code, but everyting goes well until I do somethign with the db. But I don't know what goes wrong with the db. I don't get any clear error messages. Can someone help me? Some more possible interesting data: [bootstrap] resources.db.adapter = "PDO_MYSQL" resources.db.isdefaulttableadapter = true resources.db.params.dbname = "ladosa" resources.db.params.username = "root" resources.db.params.password = "root" resources.db.params.hostname = "localhost" resources.db.params.charset = "UTF8" resources.db.params.profiler.enabled = true resources.db.params.profiler.class = Zend_Db_Profiler_Firebug Autoloadernamespaces[] = "Zend_" Autoloadernamespaces[] = "SF_" phpsettings.display_errors = 0 phpsettings.error_reporting = 8191 phpSettings.date.timezone = "Europe/Amsterdam" bootstrap.path = APPLICATION_PATH"/bootstrap/Bootstrap.php" pluginPaths.resource_ = APPLICATION_PATH"/resources" resources.frontcontroller.moduledirectory = APPLICATION_PATH"/modules" resources.frontcontroller.defaultmodule = "eventManager" resources.frontcontroller.params.prefixDefaultModule = true resources.frontcontroller.exceptions = false resources.view[] = "" resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" resources.view.encoding = "UTF-8" resources.view.title = Rode kruis Vrijwilligers applicatie ;resources.view.helperPath.Default_View_Helper = APPLICATION_PATH "/modules/eventManager/views/helpers" resources.layout.layout = "main" [production:bootstrap] [development:bootstrap] ;resources.frontController.throwExceptions = 1 ;phpSettings.display_startup_errors=1 ;phpSettings.display_errors = 1 ;resources.frontcontroller.throwerrors = [test:production] btw. I CAN login to my database command line with the given username and password. Update: today i decided to investigate on my http request and i came to an error 500. My apache logs don't give any related information, I think. I posted the logs above. Any idea's?

    Read the article

  • Rails User-Profile model challenges

    - by Craig
    I am attempting to create an enrollment process similar to SO's: route to an OpenID provider provider returns the user's information to the UsersController (a guess) UsersController creates user, then routes to the ProfilesController's new or edit action. For now, I'm simply trying to create the user, then route to the ProfilesController's new or edit action (not sure which I should be using). Here's what I have thus far: Models: class User < ActiveRecord::Base has_one :profile end class Profile < ActiveRecord::Base belongs_to :user end Routes: map.resources :users do |user| user.resource :profile end new_user_profile GET /users/:user_id/profile/new(.:format) {:controller=>"profiles", :action=>"new"} edit_user_profile GET /users/:user_id/profile/edit(.:format) {:controller=>"profiles", :action=>"edit"} user_profile GET /users/:user_id/profile(.:format) {:controller=>"profiles", :action=>"show"} PUT /users/:user_id/profile(.:format) {:controller=>"profiles", :action=>"update"} DELETE /users/:user_id/profile(.:format) {:controller=>"profiles", :action=>"destroy"} POST /users/:user_id/profile(.:format) {:controller=>"profiles", :action=>"create"} users GET /users(.:format) {:controller=>"users", :action=>"index"} POST /users(.:format) {:controller=>"users", :action=>"create"} new_user GET /users/new(.:format) {:controller=>"users", :action=>"new"} edit_user GET /users/:id/edit(.:format) {:controller=>"users", :action=>"edit"} user GET /users/:id(.:format) {:controller=>"users", :action=>"show"} PUT /users/:id(.:format) {:controller=>"users", :action=>"update"} DELETE /users/:id(.:format) {:controller=>"users", :action=>"destroy"} Controllers: class UsersController < ApplicationController # generate new-user form def new @user = User.new end # process new-user-form post def create @user = User.new(params[:user]) if @user.save redirect_to new_user_profile_path(@user) ... end end # generate edit-user form def edit @user = User.find(params[:id]) end # process edit-user-form post def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' format.html { redirect_to(users_path) } format.xml { head :ok } ... end end end class ProfilesController < ApplicationController before_filter :get_user def get_user @user = User.find(params[:user_id]) end # generate new-profile form def new @user.profile = Profile.new @profile = @user.profile end # process new-profile-form post def create @user.profile = Profile.new(params[:profile]) @profile = @user.profile respond_to do |format| if @profile.save flash[:notice] = 'Profile was successfully created.' format.html { redirect_to(@profile) } format.xml { render :xml => @profile, :status => :created, :location => @profile } ... end end end # generate edit-profile form def edit @profile = @user.profile end # generate edit-profile-form post def update @profile = @user.profile respond_to do |format| if @profile.update_attributes(params[:profile]) flash[:notice] = 'Profile was successfully updated.' # format.html { redirect_to(@profile) } format.html { redirect_to(user_profile(@user)) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @profile.errors, :status => :unprocessable_entity } end end end Edit-User View: ... <% form_for(@user) do |f| %> ... New-Profile View: ... <% form_for([@user,@profile]) do |f| %> .. I'm having two problems: When saving an edit to the User model, the UsersController attempts to route to http://localhost:3000/users/1/profile.%23%3Cprofile:0x10438e3e8%3E, instead of http://localhost:3000/users/1/profile When the new-profile form is being rendered, it throws an error that reads: undefined method `user_profiles_path' for # Is it better to create a blank profile when the user is created (in the UsersController), then edit it OR follow the rest-ful convention of creating the profile in the ProfilesController (as I have done)? What am I missing? I did review Associating Two Models in Rails (user and profile), but it didn't address my needs. Thanks for your time.

    Read the article

  • Ruby on Rails: Routing error

    - by JamesMcL13
    I am having trouble deleting and showing user records. Here is my routes.rb FinalApp::Application.routes.draw do resources :admin devise_for :users, :controllers => { :registrations => 'admin' } resources :projects match "search" => "projects#search", :as => :search root :to => 'projects#index' end Here is my admin controller: class AdminController < ApplicationController def index @users = User.all respond_to do |format| format.html # index.html.erb format.json { render :json => @users } end end def create @user = User.new(params[:user]) respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'User was successfully created.' } format.json { render json: @user, status: :created, location: @user } else format.html { render action: "new" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end # GET /users/1 # GET /users/1.json def show @user = User.find(params[:id]) @user_user_id = params[:id] respond_to do |format| format.html # show.html.erb format.json { render json: @user } end end # GET /users/new # GET /users/new.json def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render json: @user } end end # GET /users/1/edit def edit @user = User.find(params[:id]) end # POST /users # POST /users.json # PUT /users/1 # PUT /users/1.json def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end # DELETE /users/1 # DELETE /users/1.json def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } end end end Here is my view: <%= stylesheet_link_tag "admin" %> <body> <div id ="title1">Admin</div> <div class ="menu"></div> <div id ="section3"> <table id = "mytable"> <table border = "1"> <tr> <th>Username </th> <th>Email</th> <th>First Name</th> <th>Last Name</th> <th>Admin?</th> <th></th> <th></th> <th></th> </tr> <%= link_to "New User", admin_new_path %><br /> <% @users.each do |t| %> <tr> <td><%= t.username %></td> <td><%= t.email %></td> <td><%= t.firstname %></td> <td><%= t.lastname %></td> <td><%= t.admin %></td> <td><%= link_to 'Show', t %></td> <td> <%= button_to "Delete", t, method: :delete, data: { confirm: 'Are you sure?' } %></td> </tr> <% end %> </table></br> </body> </html> I can display the User database, but when I go to delete a record. I get this error No route matches [DELETE] "/users/11". I am new to rails so please remember this when trying to help. Thanks in advance. Edit: here are my routes = admin_index GET /admin(.:format) admin#index POST /admin(.:format) admin#create new_admin GET /admin/new(.:format) admin#new edit_admin GET /admin/:id/edit(.:format) admin#edit admin GET /admin/:id(.:format) admin#show PUT /admin/:id(.:format) admin#update DELETE /admin/:id(.:format) admin#destroy new_user_session GET /users/sign_in(.:format) devise/sessions#new user_session POST /users/sign_in(.:format) devise/sessions#create destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy user_password POST /users/password(.:format) devise/passwords#create new_user_password GET /users/password/new(.:format) devise/passwords#new edit_user_password GET /users/password/edit(.:format) devise/passwords#edit PUT /users/password(.:format) devise/passwords#update cancel_user_registration GET /users/cancel(.:format) admin#cancel user_registration POST /users(.:format) admin#create new_user_registration GET /users/sign_up(.:format) admin#new edit_user_registration GET /users/edit(.:format) admin#edit PUT /users(.:format) admin#update DELETE /users(.:format) admin#destroy projects GET /projects(.:format) projects#index POST /projects(.:format) projects#create new_project GET /projects/new(.:format) projects#new edit_project GET /projects/:id/edit(.:format) projects#edit project GET /projects/:id(.:format) projects#show PUT /projects/:id(.:format) projects#update DELETE /projects/:id(.:format) projects#destroy search /search(.:format) projects#search root / projects#index

    Read the article

  • C# and Metadata File Errors

    - by j-t-s
    Hi All I've created my own little c# compiler using the tutorial on MSDN, and it's not working properly. I get a few errors, then I fix them, then I get new, different errors, then I fix them, etc etc. The latest error is really confusing me. --------------------------- --------------------------- Line number: 0, Error number: CS0006, 'Metadata file 'System.Linq.dll' could not be found; --------------------------- OK --------------------------- I do not know what this means. Can somebody please explain what's going on here? Here is my code. MY SAMPLE C# COMPILER CODE: using System; namespace JTM { public class CSCompiler { protected string ot, rt, ss, es; protected bool rg, cg; public string Compile(String se, String fe, String[] rdas, String[] fs, Boolean rn) { System.CodeDom.Compiler.CodeDomProvider CODEPROV = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("CSharp"); ot = fe; System.CodeDom.Compiler.CompilerParameters PARAMS = new System.CodeDom.Compiler.CompilerParameters(); // Ensure the compiler generates an EXE file, not a DLL. PARAMS.GenerateExecutable = true; PARAMS.OutputAssembly = ot; foreach (String ay in rdas) { if (ay.Contains(".dll")) PARAMS.ReferencedAssemblies.Add(ay); else { string refd = ay; refd = refd + ".dll"; PARAMS.ReferencedAssemblies.Add(refd); } } System.CodeDom.Compiler.CompilerResults rs = CODEPROV.CompileAssemblyFromFile(PARAMS, fs); if (rs.Errors.Count > 0) { foreach (System.CodeDom.Compiler.CompilerError COMERR in rs.Errors) { es = es + "Line number: " + COMERR.Line + ", Error number: " + COMERR.ErrorNumber + ", '" + COMERR.ErrorText + ";" + Environment.NewLine + Environment.NewLine; } } else { // Compilation succeeded. es = "Compilation Succeeded."; if (rn) System.Diagnostics.Process.Start(ot); } return es; } } } ... And here is the app that passes the code to the above class: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { string[] f = { "Form1.cs", "Form1.Designer.cs", "Program.cs" }; string[] ra = { "System.dll", "System.Windows.Forms.dll", "System.Data.dll", "System.Drawing.dll", "System.Deployment.dll", "System.Xml.dll", "System.Linq.dll" }; JTS.CSCompiler CSC = new JTS.CSCompiler(); MessageBox.Show(CSC.Compile( textBox1.Text, @"Test Application.exe", ra, f, false)); } } } So, as you can see, all the using directives are there. I don't know what this error means. Any help at all is much appreciated. Thank you

    Read the article

  • [Closed] Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLExce

    - by gauravkarnatak
    Oracle JDBC connection with Weblogic 10 datasource mapping, giving problem java.sql.SQLException: Closed Connection I am using weblogic 10 JNDI datasource to create JDBC connections, below is my config <?xml version="1.0" encoding="UTF-8"?> <jdbc-data-source xmlns="http://www.bea.com/ns/weblogic/90" xmlns:sec="http://www.bea.com/ns/weblogic/90/security" xmlns:wls="http://www.bea.com/ns/weblogic/90/security/wls" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/920 http://www.bea.com/ns/weblogic/920.xsd"> <name>XL-Reference-DS</name> <jdbc-driver-params> <url>jdbc:oracle:oci:@abc.XL.COM</url> <driver-name>oracle.jdbc.driver.OracleDriver</driver-name> <properties> <property> <name>user</name> <value>DEV_260908</value> </property> <property> <name>password</name> <value>password</value> </property> <property> <name>dll</name> <value>ocijdbc10</value> </property> <property> <name>protocol</name> <value>oci</value> </property> <property> <name>oracle.jdbc.V8Compatible</name> <value>true</value> </property> <property> <name>baseDriverClass</name> <value>oracle.jdbc.driver.OracleDriver</value> </property> </properties> </jdbc-driver-params> <jdbc-connection-pool-params> <initial-capacity>1</initial-capacity> <max-capacity>100</max-capacity> <capacity-increment>1</capacity-increment> <test-connections-on-reserve>true</test-connections-on-reserve> <test-table-name>SQL SELECT 1 FROM DUAL</test-table-name> </jdbc-connection-pool-params> <jdbc-data-source-params> <jndi-name>ReferenceData</jndi-name> <global-transactions-protocol>OnePhaseCommit</global-transactions-protocol> </jdbc-data-source-params> </jdbc-data-source> When I run a bulk task where there are lots of connections made and closed, sometimes it gives connection closed exception for any of the task in the bulk task. Below is detailed exception' java.sql.SQLException: Closed Connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:111) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:207) at oracle.jdbc.driver.OracleStatement.ensureOpen(OracleStatement.java:3512) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3265) at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3367) Any ideas?

    Read the article

  • How do I use accepts_nested_attributes_for?

    - by Angela
    Editing my question for conciseness and to update what I've done: How do I model having multiple Addresses for a Company and assign a single Address to a Contact, and be able to assign them when creating or editing a Contact? I want to use nested attributes to be able to add an address at the time of creating a new contact. That address exists as its own model because I may want the option to drop-down from existing addresses rather than entering from scratch. I can't seem to get it to work. I get a undefined method `build' for nil:NilClass error Here is my model for Contacts: class Contact < ActiveRecord::Base attr_accessible :first_name, :last_name, :title, :phone, :fax, :email, :company, :date_entered, :campaign_id, :company_name, :address_id, :address_attributes belongs_to :company belongs_to :address accepts_nested_attributes_for :address end Here is my model for Address: class Address < ActiveRecord::Base attr_accessible :street1, :street2, :city, :state, :zip has_many :contacts end I would like, when creating an new contact, access all the Addresses that belong to the other Contacts that belong to the Company. So here is how I represent Company: class Company < ActiveRecord::Base attr_accessible :name, :phone, :addresses has_many :contacts has_many :addresses, :through => :contacts end Here is how I am trying to create a field in the View for _form for Contact so that, when someone creates a new Contact, they pass the address to the Address model and associate that address to the Contact: <% f.fields_for :address, @contact.address do |builder| %> <p> <%= builder.label :street1, "Street 1" %> </br> <%= builder.text_field :street1 %> <p> <% end %> When I try to Edit, the field for Street 1 is blank. And I don't know how to display the value from show.html.erb. At the bottom is my error console -- can't seem to create values in the address table: My Contacts controller is as follows: def new @contact = Contact.new @contact.address.build # Iundefined method `build' for nil:NilClass @contact.date_entered = Date.today @campaigns = Campaign.find(:all, :order => "name") if params[:campaign_id].blank? else @campaign = Campaign.find(params[:campaign_id]) @contact.campaign_id = @campaign.id end if params[:company_id].blank? else @company = Company.find(params[:company_id]) @contact.company_name = @company.name end end def create @contact = Contact.new(params[:contact]) if @contact.save flash[:notice] = "Successfully created contact." redirect_to @contact else render :action => 'new' end end def edit @contact = Contact.find(params[:id]) @campaigns = Campaign.find(:all, :order => "name") end Here is a snippet of my error console: I am POSTING the attribute, but it is not CREATING in the Address table.... Processing ContactsController#create (for 127.0.0.1 at 2010-05-12 21:16:17) [POST] Parameters: {"commit"="Submit", "authenticity_token"="d8/gx0zy0Vgg6ghfcbAYL0YtGjYIUC2b1aG+dDKjuSs=", "contact"={"company_name"="Allyforce", "title"="", "campaign_id"="2", "address_attributes"={"street1"="abc"}, "fax"="", "phone"="", "last_name"="", "date_entered"="2010-05-12", "email"="", "first_name"="abc"}} Company Load (0.0ms)[0m [0mSELECT * FROM "companies" WHERE ("companies"."name" = 'Allyforce') LIMIT 1[0m Address Create (16.0ms)[0m [0;1mINSERT INTO "addresses" ("city", "zip", "created_at", "street1", "updated_at", "street2", "state") VALUES(NULL, NULL, '2010-05-13 04:16:18', NULL, '2010-05-13 04:16:18', NULL, NULL)[0m Contact Create (0.0ms)[0m [0mINSERT INTO "contacts" ("company", "created_at", "title", "updated_at", "campaign_id", "address_id", "last_name", "phone", "fax", "company_id", "date_entered", "first_name", "email") VALUES(NULL, '2010-05-13 04:16:18', '', '2010-05-13 04:16:18', 2, 2, '', '', '', 5, '2010-05-12', 'abc', '')[0m

    Read the article

  • COM port read - Thread remains alive after timeout occurs

    - by Sna
    Hello to all. I have a dll which includes a function called ReadPort that reads data from serial COM port, written in c/c++. This function is called within an extra thread from another WINAPI function using the _beginthreadex. When COM port has data to be read, the worker thread returns the data, ends normaly, the calling thread closes the worker's thread handle and the dll works fine. However, if ReadPort is called without data pending on the COM port, when timeout occurs then WaitForSingleObject returns WAIT_TIMEOUT but the worker thread never ends. As a result, virtual memory grows at about 1 MB every time, physical memory grows some KBs and the application that calls the dll becomes unstable. I also tryied to use TerminateThread() but i got the same results. I have to admit that although i have enough developing experience, i am not familiar with c/c++. I did a lot of research before posting but unfortunately i didn't manage to solve my problem. Does anyone have a clue on how could i solve this problem? However, I really want to stick to this kind of solution. Also, i want to mention that i think i can't use any global variables to use some kind of extra events, because each dll's functions may be called many times for every COM port. I post some parts of my code below: The Worker Thread: unsigned int __stdcall ReadPort(void* readstr){ DWORD dwError; int rres;DWORD dwCommModemStatus, dwBytesTransferred; int ret; char szBuff[64] = ""; ReadParams* params = (ReadParams*)readstr; ret = SetCommMask(params->param2, EV_RXCHAR | EV_CTS | EV_DSR | EV_RLSD | EV_RING); if (ret == 0) { _endthreadex(0); return -1; } ret = WaitCommEvent(params->param2, &dwCommModemStatus, 0); if (ret == 0) { _endthreadex(0); return -2; } ret = SetCommMask(params->param2, EV_RXCHAR | EV_CTS | EV_DSR | EV_RLSD| EV_RING); if (ret == 0) { _endthreadex(0); return -3; } if (dwCommModemStatus & EV_RXCHAR||dwCommModemStatus & EV_RLSD) { rres = ReadFile(params->param2, szBuff, 64, &dwBytesTransferred,NULL); if (rres == 0) { switch (dwError = GetLastError()) { case ERROR_HANDLE_EOF: _endthreadex(0); return -4; } _endthreadex(0); return -5; } else { strcpy(params->param1,szBuff); _endthreadex(0); return 0; } } else { _endthreadex(0); return 0; } _endthreadex(0); return 0;} The Calling Thread: int WINAPI StartReadThread(HANDLE porthandle, HWND windowhandle){ HANDLE hThread; unsigned threadID; ReadParams readstr; DWORD ret, ret2; readstr.param2 = porthandle; hThread = (HANDLE)_beginthreadex( NULL, 0, ReadPort, &readstr, 0, &threadID ); ret = WaitForSingleObject(hThread, 500); if (ret == WAIT_OBJECT_0) { CloseHandle(hThread); if (readstr.param1 != NULL) // Send message to GUI return 0; } else if (ret == WAIT_TIMEOUT) { ret2 = CloseHandle(hThread); return -1; } else { ret2 = CloseHandle(hThread); if (ret2 == 0) return -2; }} Thank you in advance, Sna.

    Read the article

  • How to have other divs with a flash liquid layout that fits to the page?

    - by brybam
    Basically the majority of my content is flash based. I designed it using Flash Builder (Flex) and Its in a liquid layout, (everything is in percents) and if im JUST embedding the flash content it scales to the page fine, and i have the flash content set to have a padding of 50 px. I put a header div in fine with no problems, but I have 2 problems, the first being the footer div seems to cover up the buttom of the flash content in IE, but it looks just fine in chrome. How can I solve this? I'm using the stock embed code that Flex provides, I tried to edit the css style for the div which I think is #flashContent and give it a min width and min height but it didnt seem to work, actually anything I did to #flashContent didn't seem to do anything, maybe its not the div i need to be adding that attribute to... And my other problem is I dont even know where to start when it comes to placing a div thats 280width by 600height colum to the right side of the flash content. If i could specify a size for the flash content, and the float it left, and float the colum right, and clear it with the container div id be just fine....But remember the flash content is set to 100% Scale (well techically 100%x80% because it looked better that way). Does anyone know how I can start to deal with creating a more complex scaleable flash layouts that includes other divs? ALL WELL MAINTAINING IE SUPPORT? IE is ruining my life. Here's the code I'm using: (or if it will help you visualize what im trying to do here's the page where im working on setting this up http://apumpkinpatch.com/textmashnew/) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>TextMixup</title> <meta name="google" value="notranslate"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="css.css" rel="stylesheet" type="text/css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script> <script src="../appassets/scripts/jquery.titlealert.js"></script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-19768131-2']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); function tabNotification() { $.titleAlert('New Message!', {interval:200,requireBlur:true,stopOnFocus:true}); } function joinNotification() { $.titleAlert('Joined Chat!', {interval:200,requireBlur:true,stopOnFocus:true}); } </script> <!-- BEGIN Browser History required section --> <link rel="stylesheet" type="text/css" href="history/history.css" /> <script type="text/javascript" src="history/history.js"></script> <!-- END Browser History required section --> <script type="text/javascript" src="swfobject.js"></script> <script type="text/javascript"> var swfVersionStr = "10.2.0"; var xiSwfUrlStr = "playerProductInstall.swf"; var flashvars = {}; var params = {}; params.quality = "high"; params.bgcolor = "#ffffff"; params.allowscriptaccess = "sameDomain"; params.allowfullscreen = "true"; var attributes = {}; attributes.id = "TextMixup"; attributes.name = "TextMixup"; attributes.align = "middle"; swfobject.embedSWF( "TextMixup.swf", "flashContent", "100%", "80%", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes); swfobject.createCSS("#flashContent", "display:block;text-align:left;"); </script> </head> <body> <div id="homebar"><a href="http://apumpkinpatch.com"><img src="../appassets/images/logo/logoHor_130_30.png" alt="APumpkinPatch HOME" width="130" height="30" hspace="10" vspace="3" border="0"/></a> </div> <div id="topad"> <script type="text/javascript"><!-- google_ad_client = "pub-5824388356626461"; /* 728x90, textmash */ google_ad_slot = "1114351240"; google_ad_width = 728; google_ad_height = 90; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> </div> <div id="mainContainer"> <div id="flashContent"> <p> To view this page ensure that Adobe Flash Player version 10.2.0 or greater is installed. </p> <script type="text/javascript"> var pageHost = ((document.location.protocol == "https:") ? "https://" : "http://"); document.write("<a href='http://www.adobe.com/go/getflashplayer'><img src='" + pageHost + "www.adobe.com/images/shared/download_buttons/get_flash_player.gif' alt='Get Adobe Flash player' /></a>" ); </script> </div> <noscript> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="80%" id="TextMixup"> <param name="movie" value="TextMixup.swf" /> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="true" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="TextMixup.swf" width="100%" height="80%"> <param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /> <param name="allowScriptAccess" value="sameDomain" /> <param name="allowFullScreen" value="true" /> <!--<![endif]--> <!--[if gte IE 6]>--> <p> Either scripts and active content are not permitted to run or Adobe Flash Player version 10.2.0 or greater is not installed. </p> <!--<![endif]--> <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash Player" /> </a> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </noscript> <div id="convosPreview">This is a div I would want to appear as a colum to the right of the flash content that can scale</div> <!---End mainContainer --> </div> <div id="footer"> <a href="../apps.html"><img src="../appassets/images/apps.png" hspace="5" vspace="5" alt="random chat app apumpkinpatch" width="228" height="40" border="0" /></a><a href="https://chrome.google.com/webstore/detail/hjmnobclpbhnjcpdnpdnkbgdkbfifbao?hl=en-US#"><img src="../appassets/images/chromeapp.png" alt="chrome app random video chat apumpkinpatch" width="115" height="40" vspace="5" border="0" /></a><br /><br /> <a href="http://spacebarup.com" target="_blank">©2011 Space Bar</a> | <a href="../tos.html">TOS & Privacy Policy</a> | <a href="../help.html">FAQ & Help</a> | <a href="../tips.html">Important online safety tips</a> | <a href="http://www.facebook.com/pages/APumpkinPatchcom/164279206963001?sk=app_2373072738" target="_blank">Discussion Boards</a><br /> <p>You must be at least 18 years of age to access this web site.<br />APumpkinPatch.com is not responsible for the actions of any visitors of this site.<br />APumpkinPatch.com does not endorse or claim ownership to any of the content that is broadcast through this site. </p><h2>A Pumpkin Patch is BRAND NEW and will be developed a lot over the next few months adding video chat games, chat rooms, and more! Check back often it's going to be a lot of fun!</h2> </div> </body> </html> myCSS: html, body { height:100%; } body { text-align:center; font-family: Helvetica, Arial, sans-serif; margin:0; padding:0; overflow:auto; text-align:center; background-color: #ffffff; } object:focus { outline:none; } #homebar { clear:both; text-align: left; width: 100%; height: 40px; background-color:#333333; color:#CCC; overflow:hidden; box-shadow: 0px 0px 14px rgba(0, 0, 0, 0.65); -moz-box-shadow: 0px 0px 14px rgba(0, 0, 0, 0.65); -webkit-box-shadow: 0px 0px 14px rgba(0, 0, 0, 0.65); margin-bottom: 10px; } #mainContainer { height:auto; width:auto; clear:both; } #flashContent { display:none; height:auto; float:left; min-height: 500px; min-width: 340px; } /**this is the div i want to appear as a column net to the scaleable flash content **/ #convosPreview { float:right; width:280px; height:600px; }

    Read the article

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