Search Results

Search found 171 results on 7 pages for 'rafael xavier'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • How to create a custom "render :my_format => argument" in rails 2.3(.5)?

    - by Rafael
    Hey! I would like to create a custom render as specified in title. For instance, I have my controller: class MyController < ApplicationController def index respond_to do |format| format.html # index.html.erb format.xml { render :xml => @objs } end end end , but I would like something like this: class MyController < ApplicationController def index respond_to do |format| format.html # index.html.erb format.xml { render :xml => @objs } format.my_format { render :my_format => @objs } end end end Is it possible? What are the steps I need to make it work? Thanks in advance!

    Read the article

  • Convert a List of Options to an Option of List using Scalaz

    - by Rafael de F. Ferreira
    The following function transforms a list of Option[T] into a list of Some[T], in the case where all members are Some's, or None, in the case where there is at least one None member. I guess the code is clearer that this explanation: def lo2ol[T](lo: List[Option[T]]): Option[List[T]] = { lo.foldRight[Option[List[T]]](Some(Nil)){(o, ol) => (o, ol) match { case (Some(x), Some(xs)) => Some(x :: xs); case _ => None : Option[List[T]]; }}} I remember seeing somewhere a similar example, but using Scalaz to simplify the code. How would it look like?

    Read the article

  • What code have you written with #pragma you found useful?

    - by Xavier Ho
    I've never understood the need of #pragma once when #ifndef #define #endif always works. I've seen the usage of #pragma comment to link with other files , but setting up the compiler settings was easier with an IDE. What are some other usages of #pragma that is useful, but not widely known? Edit: I'm not just after a list of #pragma directives. Perhaps I should rephrase this question a bit more: What code have you written with #pragma you found useful?

    Read the article

  • How to 'assign' a value to an output reg in Verilog?

    - by Rafael Almeida
    ( insert really basic question disclaimer here ) More specifically, I have the following declaration: output reg icache_ram_rw And in some point of the code I need to put the zero value in this reg. Here's what I've tried and the outcomes: assign icache_ram_rw = 1'b0; ( declarative lvalue or port sink reg icache_ram_rw must be a wire ) icache_ram_rw <= 1'b0; ( instance gate/name for type "icache_ram_rw" expected - <= read ) How do I do it after all?!

    Read the article

  • ZF1 + Doctrine 2 ODM: Call to undefined method AnnotationReader::setDefaultAnnotationNamespace

    - by Rafael
    I am trying to setup a zf1 + doctrine mongo odm 1.0.0BETA4-DEV project. I am using https://github.com/Bittarman/zf-d2-odm branch but when I update doctrine version from 1.0.0BETA3 to 1.0.0BETA4-DEV, I get the following error: SCREAM: Error suppression ignored for ( ! ) Fatal error: Call to undefined method Doctrine\Common\Annotations\AnnotationReader::setDefaultAnnotationNamespace() in C:\htdocs\zf-d2-odm\library\Lupi\Resource\Odm.php on line 34 Call Stack # Time Memory Function Location 1 0.0007 139368 {main}( ) ..\index.php:0 2 0.0217 659008 Zend_Application->bootstrap( ) ..\index.php:25 3 0.0217 659104 Zend_Application_Bootstrap_BootstrapAbstract->bootstrap( ) ..\Application.php:355 4 0.0217 659120 Zend_Application_Bootstrap_BootstrapAbstract->_bootstrap( ) ..\BootstrapAbstract.php:586 5 0.0314 1127240 Zend_Application_Bootstrap_BootstrapAbstract->_executeResource( ) ..\BootstrapAbstract.php:626 6 0.0314 1127368 Lupi_Resource_Odm->init( ) ..\BootstrapAbstract.php:683

    Read the article

  • Extension method using Reflection to Sort

    - by Xavier
    I implemented an extension "MyExtensionSortMethod" to sort collections (IEnumerate). This allows me to replace code such as 'entities.OrderBy( ... ).ThenByDescending( ...)' by 'entities.MyExtensionSortMethod()' (no parameter as well). Here is a sample of implementation: //test function function Test(IEnumerable<ClassA> entitiesA,IEnumerable<ClassB> entitiesB ) { //Sort entitiesA , based on ClassA MySort method var aSorted = entitiesA.MyExtensionSortMethod(); //Sort entitiesB , based on ClassB MySort method var bSorted = entitiesB.MyExtensionSortMethod(); } //Class A definition public classA: IMySort<classA> { .... public IEnumerable<classA> MySort(IEnumerable<classA> entities) { return entities.OrderBy( ... ).ThenBy( ...); } } public classB: IMySort<classB> { .... public IEnumerable<classB> MySort(IEnumerable<classB> entities) { return entities.OrderByDescending( ... ).ThenBy( ...).ThenBy( ... ); } } //extension method public static IEnumerable<T> MyExtensionSortMethod<T>(this IEnumerable<T> e) where T : IMySort<T>, new() { //the extension should call MySort of T Type t = typeof(T); var methodInfo = t.GetMethod("MySort"); //invoke MySort var result = methodInfo.Invoke(new T(), new object[] {e}); //Return return (IEnumerable < T >)result; } public interface IMySort<TEntity> where TEntity : class { IEnumerable<TEntity> MySort(IEnumerable<TEntity> entities); } However, it seems a bit complicated compared to what it does so I was wondering if they were another way of doing it?

    Read the article

  • ASP Calendar control returns Date type but I need Datetime to insert into SQL Server 2005

    - by rafael
    Hello, I am using a ASP Calendar control to insert a datetime value into a field to be part of an insert to a SQL Server 2005 db table. I get the following error when i submit the form to server and try to insert into table: [ArgumentException: The version of SQL Server in use does not support datatype 'date'.] Seems like Calendar control returns a Date type value. How could i make the Calendar control return a Datetime value instead? I know now that SQL Server 2005 does not support Date type fields.

    Read the article

  • Need Help with wxPython & pyGame

    - by Xavier
    Hi Guys, I'm actually in need of your help and advice here on my assignment that I am working on. First of all, I was task to do a program that runs langton's ant simulation. For that, I've managed to get the source code (from snippets.dzone.com/posts/show/5143) and edited it accordingly to my requirements. This was done and ran in pygame module extension. In addition, my task requires a GUI to interface for users to run and navigate through the screens effectively with the langton's ant program running. I used wxPython with the help of an IDE called BOA constructor to create the frames, buttons, textboxes, etc. Basically, all the stuff needed in the interfaces. However, I've ran into some problems listed below: Found problem integrating pyGame with wxPython. On this note, I've research the internet for answers and tutorials where I found out from website: wiki.wxpython.org/IntegratingPyGame & aspn.activestate.com/ASPN/Mail/Message/wxpython-users/3178042. I understand from the sites that integrating pyGame with wxPython will be a difficult task where it has caused common problems like the inability to placing other controls into the frames as the pyGame application will cover the entire panel. I really hope that you can clarify my doubts on this and advise me on the path that I should take from here. Therefore, I ask the following questions: Is it feasible to integrate pyGame with wxPython? If it is not feasible to integrate pyGame with wxPython, what other alternatives do I have to create a GUI interface integrating pyGame into it. If so how do I go about? If it is possible to go about integrating pyGame with wxPython, how do I go about doing so? Really need you guys opinion on this.

    Read the article

  • How to build an offline web app using Flask?

    - by Rafael Alencar
    I'm prototyping an idea for a website that will use the HTML5 offline application cache for certain purposes. The website will be built with Python and Flask and that's where my main problem comes from: I'm working with those two for the first time, so I'm having a hard time getting the manifest file to work as expected. The issue is that I'm getting 404's from the static files included in the manifest file. The manifest itself seems to be downloaded correctly, but the files that it points to are not. This is what is spit out in the console when loading the page: Creating Application Cache with manifest http://127.0.0.1:5000/static/manifest.appcache offline-app:1 Application Cache Checking event offline-app:1 Application Cache Downloading event offline-app:1 Application Cache Progress event (0 of 2) http://127.0.0.1:5000/style.css offline-app:1 Application Cache Error event: Resource fetch failed (404) http://127.0.0.1:5000/style.css The error is in the last line. When the appcache fails even once, it stops the process completely and the offline cache doesn't work. This is how my files are structured: sandbox offline-app offline-app.py static manifest.appcache script.js style.css templates offline-app.html This is the content of offline-app.py: from flask import Flask, render_template app = Flask(__name__) @app.route('/offline-app') def offline_app(): return render_template('offline-app.html') if __name__ == '__main__': app.run(host='0.0.0.0', debug=True) This is what I have in offline-app.html: <!DOCTYPE html> <html manifest="{{ url_for('static', filename='manifest.appcache') }}"> <head> <title>Offline App Sandbox - main page</title> </head> <body> <h1>Welcome to the main page for the Offline App Sandbox!</h1> <p>Some placeholder text</p> </body> </html> This is my manifest.appcache file: CACHE MANIFEST /style.css /script.js I've tried having the manifest file in all different ways I could think of: CACHE MANIFEST /static/style.css /static/script.js or CACHE MANIFEST /offline-app/static/style.css /offline-app/static/script.js None of these worked. The same error was returned every time. I'm certain the issue here is how the server is serving up the files listed in the manifest. Those files are probably being looked up in the wrong place, I guess. I either should place them somewhere else or I need something different in the cache manifest, but I have no idea what. I couldn't find anything online about having HTML5 offline applications with Flask. Is anyone able to help me out?

    Read the article

  • Can UMDF drivers be packaged/shipped via WiX?

    - by Rafael Rivera
    Howdy Internets: I put together a WiX 3.0 package, utilizing the DIFx extensions, with the intentions to install a Windows 7 Sensor (UMDF driver). During installation, DIFXAPP logged "No matching devices found in INF" and simply threw the driver into storage. I read I'm to populate my INF with an appropriate DriverPackageType, but according to MSDN's enumerated list, nothing fits. Is UMDF driver installation a supported scenario? If not, what's the best practice for using WiX to install such drivers? Disassembling the DIfx extension shows intent to support Co-installer packages, I have yet to try 3.5 beta.

    Read the article

  • strange behavior when changing UINavigationController backItem title

    - by Rafael
    Hi, I'm changing the back button item title in the viewDidAppear of a controller in the following way: self.navigationController.navigationBar.backItem.title = @"Previous"; It changes the tittle properly, but the I'm having a strange behaviour. When I select the "previous" button, it changes the tittle of the controller that is up in the stack (i.e the parent controller now has the title "Previous". Do you now why this happened ??? Thanks in advanced for your help.

    Read the article

  • Using Fzip lib under Adobe Air App

    - by Rafael Oliveira
    I'm currently working on a project for Adobe Air (1.5.3) and I need to unzip a file, copy some of its contents to another file. Then I saw people talking about the Fzip (http://codeazur.com.br/lab/fzip) lib. The problem is that I don't know how to "import" or use this library with Javascript and Adobe Air, since Javascript doesn't have the import directive. How can I manage to do that ?

    Read the article

  • [ipad] Is there a SDK for the photo gallery?

    - by Rafael Steil
    The "Photos.app" in iPad has a gallery that you can browse all photos, including support for slideshow and other things. I'd like to know if this API is available (aka, not private) and which one it is (so I won't need to implement one photo gallery from scratch). I looked at http://github.com/facebook/three20, but I'm not sure if it is the same thing. Thank.

    Read the article

  • Loading velocity template inside a jar file

    - by Rafael
    I have a project where I want to load a velocity template to complete it with parameters. The whole application is packaged as a jar file. What I initially thought of doing was this: VelocityEngine ve = new VelocityEngine(); URL url = this.getClass().getResource("/templates/"); File file = new File(url.getFile()); ve = new VelocityEngine(); ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "file"); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, file.getAbsolutePath()); ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_CACHE, "true"); ve.init(); VelocityContext context = new VelocityContext(); if (properties != null) { stringfyNulls(properties); for (Map.Entry<String, Object> property : properties.entrySet()) { context.put(property.getKey(), property.getValue()); } } final String templatePath = templateName + ".vm"; Template template = ve.getTemplate(templatePath, "UTF-8"); String outFileName = File.createTempFile("p2d_report", ".html").getAbsolutePath(); BufferedWriter writer = new BufferedWriter(new FileWriter(new File(outFileName))); template.merge(context, writer); writer.flush(); writer.close(); And this works fine when I run it in eclipse. However, once I package the program and try to run it using the command line I get an error because the file could not be found. I imagine the problem is in this line: ve.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, file.getAbsolutePath()); Because in a jar the absolute file does not exist, since it's inside a zip, but I couldn't yet find a better way to do it. Anyone has any ideas?

    Read the article

  • Possible to use Javascript to get data from other sites?

    - by Xavier
    Is it possible for a web page using Javascript to get data from another website? In my case I want to get it for calculations and graphing a chart. But I'm not sure if this is possible or not due to security concerns. If it is considered a no no but there is a work around I would appreciate being told the work around. I don't want to have to gather this information on the server side if possible. Any and all help is appreciated.

    Read the article

  • NSMutableArray: count is a method or a property?

    - by Rafael Oliveira
    I want to verify if I'm in the last cell of the UITable. Should I use a NSInteger property in my controller and store the value of the count of the data (it's an NSMutableArray) that populates the table? I'm asking because I don't know if count iterates over all objects of the array to count or if it only gets me a value of a count property. What would be better ? store the value: myCount = [myArray count] use directly: [myArray count] store numberOfRows: myCount = numberOfRowsInSection:[indexPath 0] use numberOfRows directly: numberOfRowsInSection:[indexPath 0]

    Read the article

  • Definition of the job titles involved in a software development process.

    - by Rafael Romão
    I have seen many job titles for people involved in a software development process, but never found a consensus about they mean. I know many of them are equivalent, and found some other questions about that here in SO, but I would like to know your definitions and comments about them. I want not only to know if there is really a consensus, but also to know if what I suppose to be a Software Architect, is really a Software Architect, and so on. The job titles I mean are: Developer; System Analyst; Programmer; Analyst Programmer; Software Engineer; Software Architect; Designer; Software Designer; Business Manager; Business Analyst; Program Manager; Project Manager; Development Manager; Tester; Support Analyst; Please, feel free to add more titles to this list in your answers. It would be very helpful.

    Read the article

  • set / line intersection solution

    - by Xavier
    I have two lists in python and I want to know if they intersect at the same index. Is there a mathematical way of solving this? For example if I have [9,8,7,6,5] and [3,4,5,6,7] I'd like a simple and efficient formula/algorithm that finds that at index 3 they intersect. I know I could do a search just wondering if there is a better way. I know there is a formula to solve two lines in y = mx + b form by subtracting them from each other but my "line" isn't truly a line because its limited to the items in the list and it may have curves. Any help is appreciated.

    Read the article

  • Help creating a ColumnName Convention using FluentNHibernate

    - by Rafael E. Belliard
    I've been trying to specify a custom naming convention for my database table columns. So far, I have been able to setup a convention for the table's name, but not the actual columns. I've seen a few guides on the internet, but they're not working using the latest Fluent NHibernate (1.0.0 RTM). public class CamelCaseSplitNamingConvention : IClassConvention, IComponentConvention { public void Apply(IClassInstance instance) { instance.Table(instance.EntityType.Name.ChangeCamelCaseToUnderscore()); } public void Apply(IComponentInstance instance) { // is this the correct call for columns? If not, which one? } } Please help.

    Read the article

  • ede-proj-regenerate does weird things with my Makefile

    - by Xavier Maillard
    Hi, I have created a really basic project (Make) like this: (ede-proj-project "zrm" :name "zrm" :file "Project.ede" :targets (list (ede-proj-target-makefile-program "zm" :name "zrm" :path "" :source '("zrm.c") ) ) ) When doing M-x ede-proj-regenerate RET and M-x compile RET RET (accepting make -k as my compile command), make keeps bailing with a **missing separator error. When editing my Makefile outside of Emacs (with the darn evil vi) and replacing spaces by tabs, it works. Is there anything special I should pay attention in order to have this work ? Regards

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >