Search Results

Search found 170 results on 7 pages for 'juan ruiz'.

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

  • Updating records with their subordinates via CTE or subquery

    - by Mike Jolley
    Let's say I have a table with the following columns: Employees Table employeeID int employeeName varchar(50) managerID int totalOrganization int managerID is referential to employeeID. totalOrganization is currently 0 for all records. I'd like to update totalOrganization on each row to the total number of employees under them. So with the following records: employeeID employeeName managerID totalOrganization 1 John Cruz NULL 0 2 Mark Russell 1 0 3 Alice Johnson 1 0 4 Juan Valdez 3 0 The query should update the totalOrganizations to: employeeID employeeName managerID totalOrganization 1 John Cruz NULL 3 2 Mark Russell 1 0 3 Alice Johnson 1 1 4 Juan Valdez 3 0 I know I can get somewhat of an org. chart using the following CTE: WITH OrgChart (employeeID, employeeName,managerID,level) AS ( SELECT employeeID,employeeName,0 as managerID,0 AS Level FROM Employees WHERE managerID IS NULL UNION ALL SELECT Employees.employeeID,Employees.employeeName,Employees.managerID,Level + 1 FROM Employees INNER JOIN OrgChart ON Employees.managerID = OrgChart.employeeID ) SELECT employeeID,employeeName,managerID, level FROM OrgChart; Is there any way to update the Employees table using a stored procedure rather than building some routine outside of SQL to parse through the data?

    Read the article

  • Proper reconstitution of Aggregate objects in the Repository?

    - by Jebb
    Assuming that no ORM (e.g. Doctrine) is used inside the Repository, my question is what is the proper way of instantiating the Aggregate objects? Is it instantiating the child objects directly inside the Repository and just assign it to the Aggregate Root through its setters or the Aggregate Root is responsible of constructing its child entities/objects? Example 1: class UserRepository { // Create user domain entity. $user = new User(); $user->setName('Juan'); // Create child object orders entity. $orders = new Orders($orders); $user->setOrders($orders); } Example 2: class UserRepository { // Create user domain entity. $user = new User(); $user->setName('Juan'); // Get orders. $orders = $ordersDao->findByUser(1); $user->setOrders($orders); } whereas in example 2, instantiation of orders are taken care inside the user entity.

    Read the article

  • Bad value for type timestamp on production server

    - by Juan Javaloyes
    I'm working with: seam 2.2.2 + hibernate + richfaces + jboss 5.1 + postgres I have an module which needs to load some data from the database. Easy. The problem is, on development it works fine, 100%, but when I deploy on my production server and try to get the data, an error rise: could not read column value from result set: fechahor9_504_; Bad value for type timestamp : [C@122e5cf SQL Error: 0, SQLState: 22007 Bad value for type timestamp : [C@122e5cf javax.persistence.PersistenceException: org.hibernate.exception.DataException: could not execute query [more errors] Caused by: org.postgresql.util.PSQLException: Bad value for type timestamp : [C@122e5cf at org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:232) [more errors] Caused by: java.lang.NumberFormatException: Trailing junk on timestamp: '' at org.postgresql.jdbc2.TimestampUtils.loadCalendar(TimestampUtils.java:226) I can't understand why it works on my machine (development) and why not on production. Any clues? Anyone gone through the same problem? Is exactly the same compilation

    Read the article

  • Initial selected Item in an UITabBar without a UITabBarController

    - by juan.xavier
    Hello, How do I set the default selected UITabBarItem in an UITabBar that is within an UIView, not an UITabBarController? Just to clarify, the UIView does implement the protocol and the didSelectItem method works. At run-time, the tabbar works and the tabbaritems selected when the user touches them. My problem is setting the default selected item. If i use [myTabbar setSelectedItem] within the didSelectItem method it works. But outside of it, it doesn't (for example, in the viewDidLoad method of my UIView). Thanks!

    Read the article

  • How to set the mechanize page encoding?

    - by Juan Medín
    Hi, I'm trying to get a page with an ISO-8859-1 encoding clicking on a link, so the code is similar to this: page_result = page.link_with( :text => 'link_text' ).click So far I get the result with a wrong encoding, so I see characters like: 'T?tulo:' instead of 'Título:' I've tried several approaches, including: Stating the encoding in the first request using the agent like: @page_search = @agent.get( :url => 'http://www.server.com', :headers => { 'Accept-Charset' => 'ISO-8859-1' } ) Stating the encoding for the page itself page_result.encoding = 'ISO-8859-1' But I must be doing something wrong: a simple puts always show the wrong characters. Do you know how to state the encoding? Thanks in advance, Added: Executable example: require 'rubygems' require 'mechanize' WWW::Mechanize::Util::CODE_DIC[:SJIS] = "ISO-8859-1" @agent = WWW::Mechanize.new @page = @agent.get( :url => 'http://www.mcu.es/webISBN/tituloSimpleFilter.do?cache=init&layout=busquedaisbn&language=es', :headers => { 'Accept-Charset' => 'utf-8' } ) puts @page.body

    Read the article

  • any good free C DSP library?

    - by Juan
    Hi everybody I am developing an application to process geophysical signals; Right now I have done everything in octave and its digital signal processing toolbox, speed is not bad, however the application specifications say I need to port to the final algorithm to C; I am doing lots of filtering, re-sampling and signal manipulation/characterization with FFTs and cepstrums. do you know a good free C library for DSP packaged with filter design, resampling, fft, etc? Thanks a lot for any suggestion

    Read the article

  • Best way to manipulate XML in .NET

    - by Juan Manuel Formoso
    I need to manipulate an existing XML document, and create a new one from it, removing a few nodes and attributes, and perhaps adding new ones, what would be the best group of classes to accomplish this? There are a lot of .NET classes for XML manipulation, and I'm not sure what would be the optimal way to do it.

    Read the article

  • Why doesn't genstrings convert NSLocalizedStringFromTable entries to table.strings?

    - by juan tendero
    In my source code I have some lines like NSLocalizedStringFromTable(@"Info", @"en", @"Title of this view"). When I subsequently call genstrings -o en.lproj ./Classes/*.m I would not get the expected file en.strings but Localized.strings, although I've read in the genstrings-manpage that it would generate a table.strings file from NSLocalizedStringFromTable(a, table, c) function. Am I wrong? How would I create a table.strings file then?

    Read the article

  • How to avoid this very heavy query that slows down the application?

    - by Juan Paredes
    Hi, We have a web application running in a production enviroment and at some point the client complained about how slow the application got. When we checked what was going on with the application and the database we discover this "precious" query that was being executed by several users at the same time (thus inflicting an extremely high load on the database server): SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o WHERE o.owner LIKE :1 ESCAPE :"SYS_B_0" AND o.object_name LIKE :2 ESCAPE :"SYS_B_1" AND o.object_type IN(:"SYS_B_2", :"SYS_B_3") ORDER BY table_type, table_schem, table_name Our application does not execute this query, I believe it is an Hibernate internal query. I've found little information on why Hibernate does this extremely heavy query, so any help in how to avoid it very much appreciated! The production enviroment information: Red Hat Enterprise Linux 5.3 (Tikanga), JDK 1.5, web container OC4J (whitin Oracle Application Server), Oracle Database 10.1.0.4, JDBC Driver for JDK 1.2 and 1.3, Hibernate version 3.2.6.ga, connection pool library C3P0 version 0.9.1. Thank you.

    Read the article

  • Pass a variable to a Symfony Form

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

    Read the article

  • Android fragments problems different layouts

    - by juan
    I have two layouts: one for portait with one container and another for landscape with two containers. In the first layout I show a fragment and when the user select one element, I replace the fragment with another (with FragmentTransation.Replace). <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/container1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" /> </RelativeLayout> In the second layout I want to show the two fragments at one time, one in the first container and the second in the second container. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <LinearLayout android:id="@+id/container1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="3" android:orientation="vertical" /> <LinearLayout android:id="@+id/container2" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="7" android:orientation="vertical" /> </LinearLayout> But I can't make this works with configuration changes. I try use different names for containers, try add fragments when only bundle is null,... Someone have a working code of this case?

    Read the article

  • How to resolve this very heavy query that slows down the application?

    - by Juan Paredes
    Hi, We have a web application running in a production enviroment and at some point the client complained about how slow the application got. When we checked what was going on with the application and the database we discover this "precious" query that was being executed by several users at the same time (thus inflicting a extremely high load on the database server): SELECT NULL AS table_cat, o.owner AS table_schem, o.object_name AS table_name, o.object_type AS table_type, NULL AS remarks FROM all_objects o WHERE o.owner LIKE :1 ESCAPE :"SYS_B_0" AND o.object_name LIKE :2 ESCAPE :"SYS_B_1" AND o.object_type IN(:"SYS_B_2", :"SYS_B_3") ORDER BY table_type, table_schem, table_name Our application does not execute this query, I believe it is an Hibernate internal query. I've found little information on why Hibernate does this extremely heavy query, so any help is very much appreciated! The production enviroment information: Red Hat Enterprise Linux 5.3 (Tikanga), JDK 1.5, web container OC4J (whitin Oracle Application Server), Oracle Database 10g Release 10.0.0.1, JDBC Driver for JDK 1.2 and 1.3, Hibernate version 3.2.6.ga. Thank you.

    Read the article

  • How can I pause a BackgroundWorker? Or something similar...

    - by juan
    I was using a BackgroundWorker to download some web sites by calling WebClient.DownloadString inside a loop. I wanted the option for the user to cancel in the middle of downloading stuff, so I called CancelAsync whenever I found that CancellationPending was on in the middle of the loop. But now I noticed that the function DownloadString kinda freezes sometimes, so I decided to use DownloadStringAsync instead (all this inside the other thread created with BackgroundWorker). An since and don't want to rewrite my whole code by having to exit the loop and the function after calling DownloadStringAsync, I made a while loop right after calling it that does nothing but checks for a variable bool Stop that I turn true either when the DownloadStringCompleted event handler is called or when the user request to cancel the operation. Now, the weird thing is that it works fine on the debug version, but on the release one, the program freezes in the while loop like if it were the main thread.

    Read the article

  • C#, finding the largest prime factor of a number

    - by Juan
    Hello! I am new at programming and I am practicing my C# programming skills. My application is meant to find the largest prime factor of a number entered by the user. But my application is not returning the right answer and I dont really know where the problem is. Can you please help me? using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Console.WriteLine("Calcular máximo factor primo de n. De 60 es 5."); Console.Write("Escriba un numero: "); long num = Convert.ToInt64(Console.ReadLine()); long mfp = maxfactor(num); Console.WriteLine("El maximo factor primo es: " + num); Console.Read(); } static private long maxfactor (long n) { long m=1 ; bool en= false; for (long k = n / 2; !en && k > 1; k--) { if (n % k == 0 && primo(k)) { m = k; en = true; } } return m; } static private bool primo(long x) { bool sp = true; for (long i = 2; i <= x / 2; i++) { if (x % i == 0) sp = false; } return sp; } } }

    Read the article

  • boost graph adjacency_list, retrieving a node's parents

    - by Juan
    I want to find in an adjacency graph from the bgl how give a Vertexdescriptor and get the set of nodes that are parents of this given node. i would like to do this in directed graph, it seems you could use a bidirectional graph but i want to be able to restrict it so that there are no cycles.

    Read the article

  • How to allow multiple inputs from user using R?

    - by Juan
    For example, if I need that the user specifies the number of rows and columns of a matrix: PROMPT: Number of rows?: USER INPUT: [a number] I need that R 'waits' for the input. Then save [a number] into a variable v1. Next, PROMPT: Number of columns?: USER INPUT: [another number] Also save [another number] into a variable v2. At the end, I will have two variables (v1, v2) that will be used in the rest of the code. "readline" only works for one input at a time. I can't run the two lines together v1 <- readline("Number of rows?: ") v2 <- readline("Number of columns?: ") Any ideas or suggestions? Thank you in advance

    Read the article

  • In an ASP.NET Web Site Project, what is the best option to manage modular widgets

    - by Juan Sagasti
    We are creating a modular Web Site Project and all the UI is based on simple html pages with javascript widgets. These widgets obtain the data from a WCF class located in the app_code folder. Each widget has 3 files [ js, css , cs] and an image directory: , and we want all these files to be located under the same directory, say: /widgets/mywidget/ The problem is that the .cs file needs to be in the app_code folder to be compiled dynamically and that would break our widget modularity forcing the installator to distribute the widget code in two places. One of the options is use compiled assemblies instead of .cs files and use Assembly.Load() or smthg similar to load them when needed. What other options do you see?

    Read the article

  • What is the compatibility on .NET 4.0?

    - by Juan Manuel Formoso
    We have several .NET applications developed in .NET 3.5 (Windows services, web applications, and WCF services) in different servers. I'd like to migrate to .NET 4.0 and use VS.NET 2010. Does VS.NET 2010 compiles to .NET 3.5 to avoid full simultaneous migration, being able to stop using VS.NET 2008 but maintaining some applications in the previous version? Can I uninstall the .NET < 4.0 runtime and have only .NET 4.0 in my servers? Does it run applications compiled to previous framework versions?

    Read the article

  • Disposing underlying object from finalizer in an immutable object

    - by Juan Luis Soldi
    I'm trying to wrap around Awesomium and make it look to the rest of my code as close as possible to NET's WebBrowser since this is for an existing application that already uses the WebBrowser. In this library, there is a class called JSObject which represents a javascript object. You can get one of this, for instance, by calling the ExecuteJavascriptWithResult method of the WebView class. If you'd call it like myWebView.ExecuteJavascriptWithResult("document", string.Empty).ToObject(), then you'd get a JSObject that represents the document. I'm writing an immutable class (it's only field is a readonly JSObject object) called JSObjectWrap that wraps around JSObject which I want to use as base class for other classes that would emulate .NET classes such as HtmlElement and HtmlDocument. Now, these classes don't implement Dispose, but JSObject does. What I first thought was to call the underlying JSObject's Dispose method in my JSObjectWrap's finalizer (instead of having JSObjectWrap implement Dispose) so that the rest of my code can stay the way it is (instead of having to add using's everywhere and make sure every JSObjectWrap is being properly disposed). But I just realized if more than two JSObjectWrap's have the same underlying JSObject and one of them gets finalized this will mess up the other JSObjectWrap. So now I'm thinking maybe I should keep a static Dictionary of JSObjects and keep count of how many of each of them are being referenced by a JSObjectWrap but this sounds messy and I think could cause major performance issues. Since this sounds to me like a common pattern I wonder if anyone else has a better idea.

    Read the article

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