Search Results

Search found 148 results on 6 pages for 'marcos cesar vargas magana'.

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

  • How to inject JPA EntityManager using spring

    - by marcos
    Hello all! I have a few questions about jpa + spring integration running on tomcat, i've been looking fo some time and couldn't find any concrete answer, so here it goes: Is it possible to have spring to inject the JPA entityManager object into my DAO class without extending JpaDaoSupport? if yes, does spring manage the transaction in this case? I'm trying to keep spring configuration as simple as possible: <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="em"/> </bean> <bean id="em" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean"> <property name="persistenceUnitName" value="myPU"/> </bean> EDIT: that was very helpfull, thank you all!

    Read the article

  • Application crash when using an NSTimer and pushViewController

    - by Cesar
    I'm using an NSTimer to implement a 3 seconds splash screen. If a don't use a timer the view it's correctly pushed but if I use the timer for adding a little delay the application crash with a EXC_BAD_ACCESS. I'm pretty sure the answer contains "memory management" but I can't get the point... @interface RootViewController : UIViewController { NSTimer *timer; } -(void)changeView:(NSTimer*)theTimer; @property(nonatomic,retain) NSTimer *timer; ... @implementation RootViewController @synthesize timer; - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[self navigationController] setNavigationBarHidden:YES]; timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(changeView:) userInfo:nil repeats:NO]; } -(void)changeView:(NSTimer*)theTimer { NSLog(@"timer fired"); //Crash here, but only if called using a timer [[self navigationController] pushViewController:list animated:YES]; }

    Read the article

  • Create a new project type in netbeans module

    - by marcos
    Hi Let's say i need to develop a plugin for a given technology not suported by netbeans, how do i register a new project type for this technology? The user would want to create a new project using the project wizzard, i've maneged to create a project template, but this requires the template to be based on an existing project type.

    Read the article

  • File size and mime-type before upload

    - by Marcos Placona
    Hi, I've scavenged on every single topic on this forum to try and find an answer before I posted this. Most people say you should simply use SWFUpload, some others mention Activex, and it keeps going. I know this is do-able, as Google does it with gMail when you try to upload a file that's bigger than 25mb, or executable. My question is, how can I determine the file size and mime-type before the file actually hits my server. I primarily thought it was an impossible task, but Google proves me wrong. Could anyone give me a definitive answer on how to accomplish such task? Thanks

    Read the article

  • LibreOffice UNO Java API: how to open a document, execute a macro and close it?

    - by MarcoS
    I'm working on LibreOffice server-side: on the server I run soffice --accept=... Then I use Java LibreOffice client API's to apply a macro on a document (calc or writer). The java execution does not give any error, but I do not get the job done (macro code is executed, but it's effects are not in the output file). More, after macro script is invoked, the Basic debugger window appears, apparently stopped on the first line of my macro; F5 does not restart it... This is the relevant code I'm using: try { XComponentContext xLocalContext = Bootstrap.createInitialComponentContext(null); System.out.println("xLocalContext"); XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager(); System.out.println("xLocalServiceManager"); Object urlResolver = xLocalServiceManager.createInstanceWithContext( "com.sun.star.bridge.UnoUrlResolver", xLocalContext); System.out.println("urlResolver"); XUnoUrlResolver xUrlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, urlResolver); System.out.println("xUrlResolve"); try { String uno = "uno:" + unoMode + ",host=" + unoHost + ",port=" + unoPort + ";" + unoProtocol + ";" + unoObjectName; Object rInitialObject = xUrlResolver.resolve(uno); System.out.println("rInitialObject"); if (null != rInitialObject) { XMultiComponentFactory xOfficeFactory = (XMultiComponentFactory) UnoRuntime.queryInterface( XMultiComponentFactory.class, rInitialObject); System.out.println("xOfficeFactory"); Object desktop = xOfficeFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xLocalContext); System.out.println("desktop"); XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface( XComponentLoader.class, desktop); System.out.println("xComponentLoader"); PropertyValue[] loadProps = new PropertyValue[3]; loadProps[0] = new PropertyValue(); loadProps[0].Name = "Hidden"; loadProps[0].Value = Boolean.TRUE; loadProps[1] = new PropertyValue(); loadProps[1].Name = "ReadOnly"; loadProps[1].Value = Boolean.FALSE; loadProps[2] = new PropertyValue(); loadProps[2].Name = "MacroExecutionMode"; loadProps[2].Value = new Short(com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN); try { XComponent xComponent = xComponentLoader.loadComponentFromURL("file:///" + inputFile, "_blank", 0, loadProps); System.out.println("xComponent from " + inputFile); String macroName = "Standard.Module1.MYMACRONAME?language=Basic&location=application"; Object[] aParams = null; XScriptProviderSupplier xScriptPS = (XScriptProviderSupplier) UnoRuntime.queryInterface(XScriptProviderSupplier.class, xComponent); XScriptProvider xScriptProvider = xScriptPS.getScriptProvider(); XScript xScript = xScriptProvider.getScript("vnd.sun.star.script:"+macroName); short[][] aOutParamIndex = new short[1][1]; Object[][] aOutParam = new Object[1][1]; @SuppressWarnings("unused") Object result = xScript.invoke(aParams, aOutParamIndex, aOutParam); System.out.println("xScript invoke macro" + macroName); XStorable xStore = (XStorable)UnoRuntime.queryInterface(XStorable.class, xComponent); System.out.println("xStore"); if (outputFileType.equalsIgnoreCase("pdf")) { System.out.println("writer_pdf_Export"); loadProps[0].Name = "FilterName"; loadProps[0].Value = "writer_pdf_Export"; } xStore.storeToURL("file:///" + outputFile, loadProps); System.out.println("storeToURL to file " + outputFile); xComponent.dispose(); xComponentLoader = null; rInitialObject = null; System.out.println("done."); System.exit(0); } catch(IllegalArgumentException e) { System.err.println("Error: Can't load component from url " + inputFile); } } else { System.err.println("Error: Unknown initial object name at server side"); } } catch(NoConnectException e) { System.err.println("Error: Server Connection refused: check server is listening..."); } } catch(java.lang.Exception e) { System.err.println("Error: Java exception:"); e.printStackTrace(); }

    Read the article

  • How to properly test Hibernate length restriction?

    - by Cesar
    I have a POJO mapped with Hibernate for persistence. In my mapping I specify the following: <class name="ExpertiseArea"> <id name="id" type="string"> <generator class="assigned" /> </id> <version name="version" column="VERSION" unsaved-value="null" /> <property name="name" type="string" unique="true" not-null="true" length="100" /> ... </class> And I want to test that if I set a name longer than 100 characters, the change won't be persisted. I have a DAO where I save the entity with the following code: public T makePersistent(T entity){ transaction = getSession().beginTransaction(); transaction.begin(); try{ getSession().saveOrUpdate(entity); transaction.commit(); }catch(HibernateException e){ logger.debug(e.getMessage()); transaction.rollback(); } return entity; } Actually the code above is from a GenericDAO which all my DAOs inherit from. Then I created the following test: public void testNameLengthMustBe100orLess(){ ExpertiseArea ea = new ExpertiseArea( "1234567890" + "1234567890" + "1234567890" + "1234567890" + "1234567890" + "1234567890" + "1234567890" + "1234567890" + "1234567890" + "1234567890"); assertTrue("Name should be 100 characters long", ea.getName().length() == 100); ead.makePersistent(ea); List<ExpertiseArea> result = ead.findAll(); assertEquals("Size must be 1", result.size(),1); ea.setName(ea.getName()+"1234567890"); ead.makePersistent(ea); ExpertiseArea retrieved = ead.findById(ea.getId(), false); assertTrue("Both objects should be equal", retrieved.equals(ea)); assertTrue("Name should be 100 characters long", (retrieved.getName().length() == 100)); } The object is persisted ok. Then I set a name longer than 100 characters and try to save the changes, which fails: 14:12:14,608 INFO StringType:162 - could not bind value '12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890' to parameter: 2; data exception: string data, right truncation 14:12:14,611 WARN JDBCExceptionReporter:100 - SQL Error: -3401, SQLState: 22001 14:12:14,611 ERROR JDBCExceptionReporter:101 - data exception: string data, right truncation 14:12:14,614 ERROR AbstractFlushingEventListener:324 - Could not synchronize database state with session org.hibernate.exception.DataException: could not update: [com.exp.model.ExpertiseArea#33BA7E09-3A79-4C9D-888B-4263314076AF] //Stack trace 14:12:14,615 DEBUG GenericDAO:87 - could not update: [com.exp.model.ExpertiseArea#33BA7E09-3A79-4C9D-888B-4263314076AF] 14:12:14,616 DEBUG JDBCTransaction:186 - rollback 14:12:14,616 DEBUG JDBCTransaction:197 - rolled back JDBC Connection That's expected behavior. However when I retrieve the persisted object to check if its name is still 100 characters long, the test fails. The way I see it, the retrieved object should have a name that is 100 characters long, given that the attempted update failed. The last assertion fails because the name is 110 characters long now, as if the ea instance was indeed updated. What am I doing wrong here?

    Read the article

  • Problems using 2 simplemodal osx calls

    - by Marcos
    I´m developing a webpage that contains two <p> tags (program and events), that shows two different contents. When I click the program button (it´s a <p> tag), it´s ok, it shows the table on the div´s. But, when I click the events button, again it shows the program <p> tag contents, and I want to show the events table content. I´ve read de solution for this question on this site, but not happens, when I change my JS file, the content of both <p> tags disapears. Can somebody help me?

    Read the article

  • Help to understand and recode javascript function to deal with special characters.

    - by Cesar Lopez
    Hi all, I am trying to rewrite a javascript function since I was told this function its a bit nasty peace of code and it could be nicely written by a very kind user from here. I have been trying to understand what the function does, therefore I could rewrite it properly, but since I dont fully understand how it works its a very difficult task. Therefore I am looking for help and directions (NOT THE SOLUTION AS I WANT TO LEARN MYSELF) to understand and rewrite this function in a nicer way. The function its been made for dealing with special characters, and I know that it loops through the string sent to it, search for special characters, and add what it needs to the string to make it a valid string. I have been trying to use value.replace(/"/gi,"/""), but surely I am doing it wrong as it crashes. Could anybody tell me where to start to recode function? Any help would be appreciated. My comments on the function are in capital letters. Code <script type="text/javascript"> function convertString(value){ for(var z=0; z <= value.length -1; z++) { //if current character is a backslash||WHY IS IT CHECKING FOR \\,\\r\\n,and \\n? if(value.substring(z, z + 1)=="\\" && (value.substring(z, z + 4)!="\\r\\n" && value.substring(z, z + 2)!="\\n")) {//WHY IS IT ADDING \\\\ TO THE STRING? value = value.substring(0, z) + "\\\\" + value.substring(z + 1, value.length); z++; } if(value.substring(z, z + 1)=="\\" && value.substring(z, z + 4)=="\\r\\n") {//WHY IS IT ADDING 4 TO Z IN THIS CASE? z = z+4; } if(value.substring(z, z + 1)=="\\" && value.substring(z, z + 2)=="\\n") {//WHY IS IT ADDING 2 TO Z IN THIS CASE? z = z+2; } } //replace " with \" //loop through each character for(var x = 0; x <= value.length -1; x++){ //if current character is a quote if(value.substring(x, x + 1)=="\""){//THIS IS TO FIND \, BUT HAVENT THIS BEEN DONE BEFFORE? //concatenate: value up to the quote + \" + value AFTER the quote||WHY IS IT ADDING \\ BEFORE \"? value = value.substring(0, x) + "\\\"" + value.substring(x + 1, value.length); //account for extra character x++; } } //return the modified string return(value); } <script> Comments within the code on capital letters are my questions about the function as I mention above. I would appreciate any help, orientation, advise, BUT NOT THE SOLUTION PLEASE AS I DO WANT TO LEARN.

    Read the article

  • Jquery DateJs, is there validation for full date?

    - by Cesar Lopez
    Hi all, I just find out about the power of date js, And its great!!! As I am a newbie I was wondering if there is any kind of general validitation for different types of full dates. eg. var d1 = Date.parse('2000-10-18, 10:06 AM'); alert(d1.toString('HH:mm')); If date is ('200-10-18, 10:06 AM'), of course it doesn't like it. So my question is if there is any quick way to validate the full date, rather than having to validate one by one. Thanks.

    Read the article

  • Css attribute selector for input type="button" not working on IE7

    - by Cesar Lopez
    Hi all, I am working on a big form and it contains a lot of buttons all over the form, therefore I am trying to get working input[type="button"] in my main css file so it would catch all buttons with out having to add a class to every single one, for some reason this is not working on IE7, after checking on the web it says that IE7 should be supporting this. Also it has to be type="button" and not type="submit" as not all buttons will submit the form. Could anybody give a hint what am I doing wrong? input[type="button"]{ text-align:center; } I have also tried input[type=button] Any help would be very much apreciated.

    Read the article

  • wait after presentModalViewController

    - by Cesar
    I need to wait (don't execute the code) after the presentModalViewController until the modal view it's dismissed, it's possible or it's a conceptual error ? -(NSDictionary *)authRequired { [self presentModalViewController:loginRegView animated:YES]; //This view write the settings when dismissed. NSMutableDictionary *ret=[[NSMutableDictionary alloc] init]; [ret setObject:[app.settings get:@"user"] forKey:@"user"]; [ret setObject:[app.settings get:@"pass"] forKey:@"pass"]; return ret; }

    Read the article

  • Hi There!! Problems using 2 simplemodal osx calls

    - by Marcos
    Well, i´m developing a webpage that contains two tags (program and events), that shows two different contents. When I click the program button(it´s a tag), it´s ok, it´s shows the table on the div´s. But, when I click the events button, again it´s shows the program tag contents, and I want to show the events table content. I´ve read de solution for this question on this site, but not happens, when i change my JS file, the content of both tags disapears. Please, somebody help me!...Thank´s

    Read the article

  • XSLT: a variation on the pagination problem

    - by MarcoS
    I must transform some XML data into a paginated list of fields. Here is an example. Input XML: <?xml version="1.0" encoding="UTF-8"?> <data> <books> <book title="t0"/> <book title="t1"/> <book title="t2"/> <book title="t3"/> <book title="t4"/> </books> <library name="my library"/> </data> Desired output: <?xml version="1.0" encoding="UTF-8"?> <pages> <page number="1"> <field name="library_name" value="my library"/> <field name="book_1" value="t0"/> <field name="book_2" value="t1"/> </page> <page number="2"> <field name="book_1" value="t2"/> <field name="book_2" value="t3"/> </page> <page number="3"> <field name="book_1" value="t4"/> </page> </pages> In the above example I assume that I want at most 2 fields named book_n (with n ranging between 1 and 2) per page. Tags <page> must have an attribute number. Finally, the field named library_name must appear only the first <page>. Here is my current solution using XSLT: <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" exclude-result-prefixes="trx xs"> <xsl:output method="xml" indent="yes" omit-xml-declaration="no" /> <xsl:variable name="max" select="2"/> <xsl:template match="//books"> <xsl:for-each-group select="book" group-ending-with="*[position() mod $max = 0]"> <xsl:variable name="pageNum" select="position()"/> <page number="{$pageNum}"> <xsl:for-each select="current-group()"> <xsl:variable name="idx" select="if (position() mod $max = 0) then $max else position() mod $max"/> <field value="{@title}"> <xsl:attribute name="name">book_<xsl:value-of select="$idx"/> </xsl:attribute> </field> </xsl:for-each> <xsl:if test="$pageNum = 1"> <xsl:call-template name="templateFor_library"/> </xsl:if> </page> </xsl:for-each-group> </xsl:template> <xsl:template name="templateFor_library"> <xsl:for-each select="//library"> <field name="library_name" value="{@name}" /> </xsl:for-each> </xsl:template> </xsl:stylesheet> Is there a better/simpler way to perform this transformation?

    Read the article

  • Predefined column names in SQL Server pivot table

    - by Marcos Buarque
    Hi, the other day I opened a topic here in StackOverflow (stackoverflow.com/questions/4663698/how-can-i-display-a-consolidated-version-of-my-sql-server-table). At that time I needed help on how to show data on a pivot table. From the help I got here in the forum, my research led me to this page about dynamic SQL: www.sommarskog.se/dynamic_sql.html. And then it led me to this awesome SQL script by Itzik Ben-Gan that will create a stored procedure that outputs a pivot table exactly the way I want: sommarskog.se/pivot_sp.sp. Well, almost. I need one change in this stored procedure. Instead of having dynamic column names pulled from the @on_cols variable in the SPROC, I need the output table to hold generic column names in simple ASC order. Could be, for example, col1, col2, col3, col4 ... The dynamic column names are a problem for me. So I need them named by their index in the order they appear. I have tried all sorts of things changing this great SQL script, but it won't work. I did not paste the code from the author because it is too long, but the link above will get us there. Any help appreciated. Thank you very much

    Read the article

  • Drupal Views how to filter items overlapping a date range

    - by Marcos Buarque
    Hi, in Drupal I have used CCK to add a datetime field to my custom data type. It inserts start date and end date fields. That is what I want. Now, I want Views to filter and show only the items that have the daterange (start date and end date) overlapping today's date. Any ideas on how to set it up on Views? What I think is strange is that the date fields of my custom content type don't seem to appear on the Views list when I am trying to add a filter. Thanks.

    Read the article

  • How to order actions in menus in Eclipse RCP

    - by Marcos Scriven
    If I add action within an extension point thus: <action class="com.mycompany.MyAction" id="mycompany.myaction.MyAction" menubarPath="actions" /> How can I control its ordering programatically? It looks like they are simply ordered alphabetically according to their ID. I don't want to have to give them names such as '001-z', '002-a', just to get 'z' to appear before 'a'. It would also be a nightmare re-ordering them later.

    Read the article

  • OpenGL, problems with GL_MODELVIEW GL_PROJECTION...

    - by Marcos Roriz
    Guys, I'm trying to finish up my homework but I'm having some problems here on these models on openGL... any Idea why is my draw not happening? One thing that strange is that if I change to gluPerspective it works.. #include <GL/glut.h> #include <stdlib.h> #include <stdio.h> static int shoulder = 0; static int elbow = 0; void init(void) { glClearColor(1.0, 1.0, 1.0, 0.0); } void display(void) { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); /* BASE */ glRotatef((GLfloat) shoulder, 0.0, 0.0, 1.0); glTranslatef(1.0, 0.0, 0.0); glPushMatrix(); //glScalef(2.0, 0.4, 1.0); glBegin(GL_QUADS); glColor3f(0, 0, 0); glVertex2f(0.0, 0.0); glVertex2f(0.0, 10.0); glVertex2f(10.0, 10.0); glVertex2f(10.0, 0.0); glEnd(); glPopMatrix(); glPopMatrix(); glutSwapBuffers(); } void reshape(int w, int h) { glViewport(0, 0, (GLsizei) w, (GLsizei) h); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho((GLfloat)-w/2, (GLfloat)w/2, (GLfloat)-h/2, (GLfloat)h/2, -1.0, 1.0); // modo de projecao ortogonal glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glTranslatef(0.0, 0.0, -5.0); } void keyboard(unsigned char key, int x, int y) { switch (key) { case 's': shoulder = (shoulder + 5) % 360; glutPostRedisplay(); break; case 'S': shoulder = (shoulder - 5) % 360; glutPostRedisplay(); break; case 'e': elbow = (elbow + 5) % 360; glutPostRedisplay(); break; case 'E': elbow = (elbow - 5) % 360; glutPostRedisplay(); break; case 27: exit(0); break; default: break; } } int main(int argc, char** argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(800, 400); glutInitWindowPosition(100, 100); glutCreateWindow(argv[0]); init(); glutDisplayFunc(display); glutReshapeFunc(reshape); glutKeyboardFunc(keyboard); glutMainLoop(); return 0; }

    Read the article

  • Create Menu with css and li elements compatible for all browsers.

    - by Cesar Lopez
    Hi all, I am trying to create a simple menu using li elements, but it only works on IE7, in FF and Chrome, the alignment get weird. Also the :hover and :Active only works on IE7. Could anybody give me a hit on this? I would really appreciate it. CSS: #heading{ width: 700px; height:auto; margin: 0 auto; background-color:#FFFFFF; margin-top:5px; margin-bottom:5px; display:block; } #imglogo{ float:left; } #barDescription{ float:right; } #navigation{ text-align: right; margin-top: 70px; } #navigation li{ float: right; display: block; text-align: center; list-style-type: none; } #navigation li a{ color:#A08019; background-image: url('Images/Menu1.png'); background-repeat:repeat-x; background-position: center center; text-decoration:none; font-weight:bold; display: block; height:25px; vertical-align:middle; padding-right:10px; padding-left:10px; } HTML: <div id="heading" > <div id="imglogo"> <img id="logo" src="Images/logo.png" alt="logo" /> </div> <div id="barDescription"> <h4>Especialidad en tapas,vinos y menus</h4> <h5>Restaurante de cocina creativa tradicional. Vinos y tapas</h5> </div> <ul id="navigation"> <li><a href="#">Contacto</a></li> <li><a href="#">Ubicacion</a></li> <li><a href="#">Reservas</a></li> <li><a href="#">Menus</a></li> <li><a href="#">Local</a></li> </ul> </div>

    Read the article

  • Ruby on Rails Mongrel web server stuck when MySQL service is running

    - by Marcos Buarque
    Hi, I am a Ruby on Rails newbie and already have a problem. I have started the Mongrel web server and it works fine when MySQL service isn't running. But when MySQL is on, Mongrel stucks. It ceases from serving the pages. So far, I have tested the localhost:3000 URL. When MySQL is off, it serves the page. When I click "about application's environment", I get the messasge (of course) "Can't connect to MySQL server on 'localhost' (10061)". After starting the MySQL service and refreshing, I get no more answer and Mongrel does not serve the webpage. It gets stuck with no answer to the browser. Then I have to stop the webserver and restart it. I have installed mysql2 gem with the command gem install mysql2. I was able to create the _test and _development databases with the command line rake db:create. I have tested with MySQL root user and blank password and also tried with a superuser user I have created. No success. Here is the server log: ======================== Started GET "/rails/info/properties" for 127.0.0.1 at Fri Dec 24 17:41:25 -0200 2010 Mysql2::Error (Can't connect to MySQL server on 'localhost' (10061)): Rendered C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms) Rendered C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.0ms) Rendered C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (35.0ms) ================= I am running on a Windows 7 environment with firewall down.

    Read the article

  • XPath filter not empty attribute

    - by Marcos Buarque
    Hi, I need to filter a XPath expression to grab only a certain attribute as not empty. I tried this: <xsl:template match="DocumentElement/QueryResults[string(@FileName)]"> and this: <xsl:template match="DocumentElement/QueryResults[string-length(@FileName)>0]"> but it did not work. I need the same kind of data returning from the folloing XPath expression... <xsl:template match="DocumentElement/QueryResults"> ... but filtered to avoid items with empty attribute @FileName. Thanks!

    Read the article

  • Need some clarification with Patterns (DAO x Gateway)

    - by Marcos Placona
    Me and my colleagues got into this discussion early this morning, and our opinions started to clash a bit, so I decided to get some impartial advice here. One of my colleagues reckons that the DAO should return an object (populated bean). I think it's completely fine when you're returning a recordset with only one line, but think it's overkill if you have to return 10 lines, and create 10 separate objects. I on the other see that the difference between DAO and Gateway pattern is that the gateway pattern will allow you to return a recordset to your business class, which will therefore deal with the recordset data and do whatever it needs to do. My questions here are: Which assumptions are correct? What should the return type be for a DAO (i.e. getContact() - for one record) Should getContacts() (for multiple records) even be on the DAO, if so, what's it's returntype? We seem to be having some sort of confusion about DAO and Gateway Patterns. Should they be used together? Thanks in advance

    Read the article

  • STORED PROCEDURE working in my local test machine cannot be created in production environment.

    - by Marcos Buarque
    Hi, I have an SQL CREATE PROCEDURE statement that runs perfectly in my local SQL Server, but cannot be recreated in production environment. The error message I get in production is Msg 102, Level 15, State 1, Incorrect syntax near '='. It is a pretty big query and I don't want to annoy StackOverflow users, but I simply can't find a solution. If only you could point me out what settings I could check in the production server in order to enable running the code... I must be using some kind of syntax or something that is conflicting with some setting in production. This PROCEDURE was already registered in production before, but when I ran a DROP - CREATE PROCEDURE today, the server was able to drop the procedure, but not to recreate it. I will paste the code below. Thank you! =============== USE [Enorway] GO /****** Object: StoredProcedure [dbo].[Spel_CM_ChartsUsersTotals] Script Date: 03/17/2010 11:59:57 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROC [dbo].[Spel_CM_ChartsUsersTotals] @IdGroup int, @IdAssessment int, @UserId int AS SET NOCOUNT ON DECLARE @RequiredColor varchar(6) SET @RequiredColor = '3333cc' DECLARE @ManagersColor varchar(6) SET @ManagersColor = '993300' DECLARE @GroupColor varchar(6) SET @GroupColor = 'ff0000' DECLARE @SelfColor varchar(6) SET @SelfColor = '336600' DECLARE @TeamColor varchar(6) SET @TeamColor = '993399' DECLARE @intMyCounter tinyint DECLARE @intManagersPosition tinyint DECLARE @intGroupPosition tinyint DECLARE @intSelfPosition tinyint DECLARE @intTeamPosition tinyint SET @intMyCounter = 1 -- Table that will hold the subtotals... DECLARE @tblTotalsSource table ( IdCompetency int, CompetencyName nvarchar(200), FunctionRequiredLevel float, ManagersAverageAssessment float, SelfAssessment float, GroupAverageAssessment float, TeamAverageAssessment float ) INSERT INTO @tblTotalsSource ( IdCompetency, CompetencyName, FunctionRequiredLevel, ManagersAverageAssessment, SelfAssessment, GroupAverageAssessment, TeamAverageAssessment ) SELECT e.[IdCompetency], dbo.replaceAccentChar(e.[Name]) AS CompetencyName, (i.[LevelNumber]) AS FunctionRequiredLevel, ( SELECT ROUND(avg(CAST(ac.[LevelNumber] AS float)),0) FROM Spel_CM_AssessmentsData aa INNER JOIN Spel_CM_CompetenciesLevels ab ON aa.[IdCompetencyLevel] = ab.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels ac ON ab.[IdLevel] = ac.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents ad ON aa.[IdAssessmentEvent] = ad.[IdAssessmentEvent] WHERE aa.[EvaluatedUserId] = @UserId AND aa.[AssessmentType] = 't' AND aa.[IdGroup] = @IdGroup AND ab.[IdCompetency] = e.[IdCompetency] AND ad.[IdAssessment] = @IdAssessment ) AS ManagersAverageAssessment, ( SELECT bc.[LevelNumber] FROM Spel_CM_AssessmentsData ba INNER JOIN Spel_CM_CompetenciesLevels bb ON ba.[IdCompetencyLevel] = bb.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels bc ON bb.[IdLevel] = bc.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents bd ON ba.[IdAssessmentEvent] = bd.[IdAssessmentEvent] WHERE ba.[EvaluatedUserId] = @UserId AND ba.[AssessmentType] = 's' AND ba.[IdGroup] = @IdGroup AND bb.[IdCompetency] = e.[IdCompetency] AND bd.[IdAssessment] = @IdAssessment ) AS SelfAssessment, ( SELECT ROUND(avg(CAST(cc.[LevelNumber] AS float)),0) FROM Spel_CM_AssessmentsData ca INNER JOIN Spel_CM_CompetenciesLevels cb ON ca.[IdCompetencyLevel] = cb.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels cc ON cb.[IdLevel] = cc.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents cd ON ca.[IdAssessmentEvent] = cd.[IdAssessmentEvent] WHERE ca.[EvaluatedUserId] = @UserId AND ca.[AssessmentType] = 'g' AND ca.[IdGroup] = @IdGroup AND cb.[IdCompetency] = e.[IdCompetency] AND cd.[IdAssessment] = @IdAssessment ) AS GroupAverageAssessment, ( SELECT ROUND(avg(CAST(dc.[LevelNumber] AS float)),0) FROM Spel_CM_AssessmentsData da INNER JOIN Spel_CM_CompetenciesLevels db ON da.[IdCompetencyLevel] = db.[IdCompetencyLevel] INNER JOIN Spel_CM_Levels dc ON db.[IdLevel] = dc.[IdLevel] INNER JOIN Spel_CM_AssessmentsEvents dd ON da.[IdAssessmentEvent] = dd.[IdAssessmentEvent] WHERE da.[EvaluatedUserId] = @UserId AND da.[AssessmentType] = 'm' AND da.[IdGroup] = @IdGroup AND db.[IdCompetency] = e.[IdCompetency] AND dd.[IdAssessment] = @IdAssessment ) AS TeamAverageAssessment FROM Spel_CM_AssessmentsData a INNER JOIN Spel_CM_AssessmentsEvents c ON a.[IdAssessmentEvent] = c.[IdAssessmentEvent] INNER JOIN Spel_CM_CompetenciesLevels d ON a.[IdCompetencyLevel] = d.[IdCompetencyLevel] INNER JOIN Spel_CM_Competencies e ON d.[IdCompetency] = e.[IdCompetency] INNER JOIN Spel_CM_Levels f ON d.[IdLevel] = f.[IdLevel] -- This will link with user's assigned functions INNER JOIN Spel_CM_FunctionsCompetenciesLevels g ON a.[IdFunction] = g.[IdFunction] INNER JOIN Spel_CM_CompetenciesLevels h ON g.[IdCompetencyLevel] = h.[IdCompetencyLevel] AND e.[IdCompetency] = h.[IdCompetency] INNER JOIN Spel_CM_Levels i ON h.[IdLevel] = i.[IdLevel] WHERE (NOT c.[EndDate] IS NULL) AND a.[EvaluatedUserId] = @UserId AND c.[IdAssessment] = @IdAssessment AND a.[IdGroup] = @IdGroup GROUP BY e.[IdCompetency], e.[Name], i.[LevelNumber] ORDER BY e.[Name] ASC -- This will define the position of each element (managers, group, self and team) SELECT @intManagersPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT ManagersAverageAssessment IS NULL IF IsNumeric(@intManagersPosition) = 1 BEGIN SELECT @intMyCounter += 1 END SELECT @intGroupPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT GroupAverageAssessment IS NULL IF IsNumeric(@intGroupPosition) = 1 BEGIN SELECT @intMyCounter += 1 END SELECT @intSelfPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT SelfAssessment IS NULL IF IsNumeric(@intSelfPosition) = 1 BEGIN SELECT @intMyCounter += 1 END SELECT @intTeamPosition = @intMyCounter FROM @tblTotalsSource WHERE NOT TeamAverageAssessment IS NULL -- This will render the final table for the end user. The tabe will flatten some of the numbers to allow them to be prepared for Google Graphics. SELECT SUBSTRING( ( SELECT ( '|' + REPLACE(ma.[CompetencyName],' ','+')) FROM @tblTotalsSource ma ORDER BY ma.[CompetencyName] DESC FOR XML PATH('') ), 2, 1000) AS 'CompetenciesNames', SUBSTRING( ( SELECT ( ',' + REPLACE(ra.[FunctionRequiredLevel]*10,' ','+')) FROM @tblTotalsSource ra FOR XML PATH('') ), 2, 1000) AS 'FunctionRequiredLevel', SUBSTRING( ( SELECT ( ',' + CAST(na.[ManagersAverageAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource na FOR XML PATH('') ), 2, 1000) AS 'ManagersAverageAssessment', SUBSTRING( ( SELECT ( ',' + CAST(oa.[GroupAverageAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource oa FOR XML PATH('') ), 2, 1000) AS 'GroupAverageAssessment', SUBSTRING( ( SELECT ( ',' + CAST(pa.[SelfAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource pa FOR XML PATH('') ), 2, 1000) AS 'SelfAssessment', SUBSTRING( ( SELECT ( ',' + CAST(qa.[TeamAverageAssessment]*10 AS nvarchar(10))) FROM @tblTotalsSource qa FOR XML PATH('') ), 2, 1000) AS 'TeamAverageAssessment', SUBSTRING( ( SELECT ( '|t++' + CAST([FunctionRequiredLevel] AS varchar(10)) + ',' + @RequiredColor + ',0,' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'FunctionRequiredAverageLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([ManagersAverageAssessment] AS varchar(10)) + ',' + @ManagersColor + ',' + CAST(@intManagersPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'ManagersLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([GroupAverageAssessment] AS varchar(10)) + ',' + @GroupColor + ',' + CAST(@intGroupPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'GroupLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([SelfAssessment] AS varchar(10)) + ',' + @SelfColor + ',' + CAST(@intSelfPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',9') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'SelfLabel', SUBSTRING( ( SELECT ( '|t++' + CAST([TeamAverageAssessment] AS varchar(10)) + ',' + @TeamColor + ',' + CAST(@intTeamPosition AS varchar(2)) + ',' + CAST(ROW_NUMBER() OVER(ORDER BY CompetencyName) - 1 AS varchar(2)) + ',10') FROM @tblTotalsSource FOR XML PATH('') ), 2, 1000) AS 'TeamLabel', (Count(src.[IdCompetency]) * 30) + 100 AS 'ControlHeight' FROM @tblTotalsSource src SET NOCOUNT OFF GO

    Read the article

  • Regular expression problem (PHP)

    - by Marcos
    Hello all. I have a little problem with my regular expression, that I use in PHP. My code identify all tags of my content and add a link in this image. My code is working when I use dinamycally, without any defined image. When I try with a imapge path, the code does not work. How can I solve this problem? Working code: $content = preg_replace('/(<img .*?src="(.+?)".*?>)/','<a class="nyromodal foto" href="'.$imagem_wordpress.'">\1</a>', $content); Problem code: $content = preg_replace('/(<img .*?src="ttp://mysite.com/files/2010/04/bac-gallery-site-matters-saline-project1.jpg".*?>)/','<a class="nyromodal foto" href="'.$imagem_wordpress.'">\1</a>', $content);

    Read the article

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