Search Results

Search found 125 results on 5 pages for 'alvin wong'.

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

  • Django custom SQL returning single row of results when query returns 2?

    - by Alvin
    I have a custom SQL call that is returning different results to the template than I get when I run the same query against the database directly, 1 row vs 2 Query - copied from Django Debug Toolbar: SELECT ((Sum(new_recruit_interviews) / Sum(opportunities_offered)) * 100) as avg_recruit, ((Sum(inspections) / Sum(presentations)) * 100) as avg_inspect, ((Sum(contracts_signed) / Sum(roof_approvals)) * 100) as avg_contracts, ((Sum(adjusters) / Sum(contracts_signed)) * 100) as avg_adjusters, ((Sum(roof_approvals) / Sum(adjusters)) *100) as roof_approval_avg, ((Sum(roof_turned_in) / Sum(adjusters)) * 100) as roof_jobs_avg, Sum(roof_turned_in) as roof_jobs_total, ((Sum(siding_approvals) / Sum(adjusters)) *100) as siding_approval_avg, ((Sum(siding_turned_in) / Sum(adjusters)) * 100) as siding_jobs_avg, Sum(siding_turned_in) as siding_jobs_total, ((Sum(gutter_approvals) / Sum(adjusters)) *100) as gutter_approval_avg, ((Sum(gutter_turned_in) / Sum(adjusters)) * 100) as gutter_jobs_avg, Sum(gutter_turned_in) as gutter_jobs_total, ((Sum(window_approvals) / Sum(adjusters)) *100) as window_approval_avg, ((Sum(window_turned_in) / Sum(adjusters)) * 100) as window_jobs_avg, Sum(window_turned_in) as window_jobs_total, (Sum(roof_turned_in) + Sum(siding_turned_in) + Sum(gutter_turned_in) + Sum(window_turned_in)) as total_jobs, (((Sum(collections_jobs_new) + Sum(collections_jobs_previous)) / (Sum(roof_turned_in) + Sum(siding_turned_in) + Sum(gutter_turned_in) + Sum(window_turned_in))) * 100) as total_collections, sales_report_salesmen.location_id as detail_id, business_unit_location.title as title FROM sales_report_salesmen Inner Join auth_user ON sales_report_salesmen.user_id = auth_user.id Inner Join business_unit_location ON sales_report_salesmen.location_id = business_unit_location.id GROUP BY location_id Results from direct query running the above query: INSERT INTO `` (`avg_recruit`, `avg_inspect`, `avg_contracts`, `avg_adjusters`, `roof_approval_avg`, `roof_jobs_avg`, `roof_jobs_total`, `siding_approval_avg`, `siding_jobs_avg`, `siding_jobs_total`, `gutter_approval_avg`, `gutter_jobs_avg`, `gutter_jobs_total`, `window_approval_avg`, `window_jobs_avg`, `window_jobs_total`, `total_jobs`, `total_collections`, `detail_id`, `title`) VALUES (95.3968, 92.8178, 106.9622, 90.2928, 103.5420, 103.5670, 4152, 100.2494, 106.8845, 4285, 120.1297, 86.2559, 3458, 92.9658, 106.1611, 4256, 16151, 4.281469, 12, 'St Paul, MN'); VALUES (90.2982, 73.3723, 97.8474, 104.5433, 97.7585, 86.1848, 1884, 109.9268, 109.3321, 2390, 81.0156, 96.4318, 2108, 91.7200, 123.8792, 2708, 9090, 4.531573, 13, 'Denver, CO'); Results from template: {'roof_jobs_total': Decimal('4152'), 'gutter_jobs_total': Decimal('3458'), 'avg_adjusters': Decimal('90.2928'), 'title': u'St Paul, MN', 'window_approval_avg': Decimal('92.9658'), 'total_collections': Decimal('4.281469'), 'gutter_approval_avg': Decimal('120.1297'), 'avg_recruit': Decimal('95.3968'), 'siding_approval_avg': Decimal('100.2494'), 'window_jobs_total': Decimal('4256'), 'detail_id': 12L, 'siding_jobs_avg': Decimal('106.8845'), 'avg_inspect': Decimal('92.8178'), 'roof_approval_avg': Decimal('103.5420'), 'roof_jobs_avg': Decimal('103.5670'), 'total_jobs': Decimal('16151'), 'window_jobs_avg': Decimal('106.1611'), 'avg_contracts': Decimal('106.9622'), 'gutter_jobs_avg': Decimal('86.2559'), 'siding_jobs_total': Decimal('4285')} Tried tweaking it a few ways and running the results through various for loops, keep getting the same result where my results are a single row through the Django template and the expected results (through console) have 2 rows The row that is coming back is the same as the first row returned through the console query so I'm thinking that it is running correctly just a matter of passing the results through... for good measure this is the code I'm using to generate the query (yes it's a bit ugly, been playing with it) def sql_grouped(table, fields, group_by=False, where=False): from django.db import connection query = 'SELECT %s FROM %s' % (fields, table) if where: query = query + ' WHERE %s' % (where) if group_by: query = query + ' GROUP BY %s' % (group_by) cursor = connection.cursor() cursor.execute(query) desc = cursor.description data = [dict(zip([col[0] for col in desc], row)) for row in cursor.fetchall()] return data[0] any feedback is greatly appreciated - been tinkering with this since I realized I could skip a few steps by generating my averages directly within the SQL rather than post-process

    Read the article

  • For "draggable" div tags that are NOT nested: JQuery/JavaScript div tag “containment” approach/algor

    - by Pete Alvin
    Background: I've created an online circuit design application where .draggable() div tags are containers that contain smaller div containers and so forth. Question: For any particular div tag I need to quickly identify if it contains other div tags (that may in turn contain other div tags). -- Since the div tags are draggable, in the DOM they are NOT nested inside each other but I think are absolutely positioned. So I think that a "hit testing" approach is the only way to determine containment, unless there is some "secret" routine built-in somewhere that could help with this. I've searched JQuery and I don't see any built-in routine for this. Does anyone know of an algorithm that's quicker than O(n^2)? Seems like I have to walk the list of div tags in an outer loop (n) and have an inner loop (another n) to compare against all other div tags and do a "containment test" (position, width, height), building a list of contained div tags. That's n-squared. Then I have to build a list of all nested div tags by concatenating contained lists. So the total would be O(n^2)+n. There must be a better way?

    Read the article

  • Is Lucern.net good choice for website search of 1M item product database? (giving up on SQL Server

    - by Pete Alvin
    We currently have in production SQL Server 2005 and we use it's full text search for a eCommerce site search of a million product database. I've optimized it as much as possible (I think) and we're still seeing search times of five seconds. (We don't need site scrawl or PDF (etc.) document indexing features... JUST "Google" speed for site search.) I was going to buy dtSearch but now I realize I can just use Lucerne.net and save the $2,500 for two server license. I read on a post that Lucerne.Net is not good for website searches. Has anyone else used Lucerne.Net from ASP.Net? Does it take a lot of memory? Any problems? Any comments?

    Read the article

  • HTTP method GET is not supported by this URL

    - by Alvin
    Hi, I'm calling servlets which has implemented CometProcessor interface, and whenever I try to call the servlets with get request, I'm getting the above error. May I know the reason? public class ChatServlets extends HttpServlet implements CometProcessor { public void event(CometEvent event) throws IOException, ServletException { HttpServletRequest request = event.getHttpServletRequest(); HttpServletResponse response = event.getHttpServletResponse(); if (event.getEventType() == CometEvent.EventType.BEGIN) { response.getWriter().println("Welcome "); } else if (event.getEventType() == CometEvent.EventType.READ) { response.getWriter().println("Bye"); } } }

    Read the article

  • how good is java's UUID.randomUUID?

    - by Alvin
    I know randomized UUID have very very very low probability for collision in theory, but I am wondering, in practice, how good is java 5's randonUUID in terms of not having collision? Does anybody have any experience to share?

    Read the article

  • SAML Authentication Portal

    - by Alvin Jones
    I'd like to develop a portal similar to what a company like OneLogin (http://www.onelogin.com/) has: The user would login with their login credentials then have links to the web resources that their account is associated with. When they see their resources all they need to do is click on them and they'll be automatically login in (SAML authentication). Are there any open source projects out there that have started on this effort? It would be great if there was something that we could use as a base to build on top of with a friendly license (e.g. MIT). Thanks

    Read the article

  • SDL Tridion Schema Field "List of Links" Options

    - by Alvin Reyes
    I'm looking to create an SDL Tridion schema with a list of repeatable links while avoiding multiple fields per link. Hyperlink In a rich text field I have the following options for creating a hyperlink:* Component Anchor http:// mailto: Other When content authors create one of these hyperlinks, they have the option to select linked (visible) text as well as title and target attributes that function like typical HTML hyperlinks. "Richtext" means a Text field with Height of the Text Area = at least 2 rows with Allow Rich Text Formatting selected. Single Schema Field Link When creating a single schema field, I see these options: External Link (author options will include http://, mailto, Other) Multimedia Link Component Link (which can allow Multimedia Values) Current Ideas The best out-of-the-box (OOTB) setups I've found for this "list of links" is either offering: a single 2-line RTF with instructions to create a hyperlink (of any type) in that field separate fields for each type as well as additional fields for display name, target, and title (where the fields are assembled through template code), authors fill in only one of the fields (component link or external) Question Is there a way in the schema form designer, by updating the schema source, or through code to offer the same (RTF) hyperlink drop-down options, but in a single field? I could be missing something, but recognize this scenario isn't supported OOTB.

    Read the article

  • drupal form textfield #default_value not working

    - by alvin.ng
    I am working on a custom module with multi-page form on drupal 6. I found that #default_value is not working when my '#type' = 'textfield'. However, when '#type'='textarea', it displays correctly with the '#default_value' specified. Basically, I wrote a FormFactory to return different form definition ($form) based on the post parameter received. Initially, it returns the display of directories list, user then selects from radio buttos until a specific directory contains a xml file, it will become edit form. The edit form will have text fields display the data (#default_value) inside the xml file, however the type 'textarea' works here rather than 'textfield'. How can I make my '#default_value' work in this case? Below is the non-working field definition: $form['pageset']['newsTitle'] = array( '#type' => 'textfield', '#title' => 'News Title', '#default_value' => "{$element->newsTitle}", '#rows' => 1, '#required' => TRUE, ); Then I changed it to textarea as shown below to make it work: $form['pageset']['newsTitle'] = array( '#type' => 'textarea', '#title' => 'News Title', '#default_value' => "{$element->newsTitle}", '#rows' => 1, '#required' => TRUE, );

    Read the article

  • HTML5: Can't drag on-the-fly created <div> tag even though draggable='true' Do I need to "BLESS"

    - by Pete Alvin
    After creating a div on the fly with this markup: $('.circuit').prepend("<div class='component' draggable='true'>TRANSISTOR</div>"); It is NOT draggable itself :( Is jQuery prepend() the correct way to create "live" tags in the DOM? Do I need to somehow bless it a different way to make draggable=true really work? How to I wire it up so that on-the-fly divs can be draggable? AFTER NOTE: I added a static div and that is draggable. INTERESTING: I view both the static and dynamic using FireFox F12 Firebug and they are identical. But one is draggable and one is not!!!

    Read the article

  • Flash uploader that can handle >2GB files?

    - by Alvin SMith
    Is there an open source Flash uploader that can handle files larger than 2 GB? ASP.net implementations like SlickUpload are not an option, and SWFUpload (and others that I've seen) do not handle files larger than 2 GB. Nor is requiring the user to have Java installed to run applets. This would be for both IE and Firefox. I've seen a couple "large file transfer" sites that have a Flash uploader and claim to go past the 2GB limit (which is the limit for http uploads for most browsers) so I know it is technically possible.

    Read the article

  • awk can and perl cannot

    - by alvin
    somewhere i read about one specific feature present in awk which is absent in perl. failed in locating it again. would appreciate it, if anyone of you could remember. (yep, this might be a useless trivia.) but still curious.

    Read the article

  • How to create new account using servlets

    - by Alvin
    I want to know how can I create new account using servlets in post method? I'm currently following MVC design pattern, and I want to know if I pass the required data to register new account from JSP page, then how can I get that data in post method? As request.getParameter() method returning me null. How can I know that post method is calling to create new account? How can I pass all the relevant user information from servlets to model class for registering data to the database table?

    Read the article

  • JQuery/JavaScript div tag "containment" approach/algorithm?

    - by Pete Alvin
    Background: I've created an online circuit design application where div tags are containers that contain smaller div containers and so forth. Question: For any particular div tag I need to quickly identify if it contains other div tags (that may in turn contain other div tags). I've searched JQuery and I don't see any built-in routine for this. Does anyone know of an algorithm that's quicker than O(n^2)? Seems like I have to walk the list of div tags in an outer loop (n) and have an inner loop (another n) to compare against all other div tags and do a "containment test" (position, width, height), building a list of contained div tags. That's n-squared. Then I have to build a list of all nested div tags by concatenating contained lists. So the total would be O(n^2)+n. There must be a better way?

    Read the article

  • HTML5: dragover(), drop(): how get current x,y coordinates?

    - by Pete Alvin
    How does one determine the (x,y) coordinates while dragging "dragover" and after the drop ("drop") in HTML5 DnD? I found a webpage that describes x,y for dragover (look at e.offsetX and e.layerX to see if set for various browsers but for the life of me they ARE NOT set). What do you use for the drop(e) function to find out WHERE in the current drop target it was actually dropped? I'm writing an online circuit design app and my drop target is large. Do I need to drop down to mouse-level to find out x,y or does HTML5 provided a higher level abstraction?

    Read the article

  • Difference between library and native library

    - by Alvin
    Could anyone tell me the difference between library and native library in terms of java? I found the word "native library" in the following line: Type 1 - drivers that implement the JDBC API as a mapping to another data access API, such as ODBC. Drivers of this type are generally dependent on a native library, which limits their portability. The JDBC-ODBC Bridge driver is an example of a Type 1 driver. which you can found here

    Read the article

  • Is J2SE a framework?

    - by Alvin
    Hello, I want to know is this legitimate to say J2SE a framework? If J2SE is a framework, then why there is a collection framework? Isn't collection framework inside J2SE? Please help me!

    Read the article

  • JAXB, how to marshal without a namespace

    - by Alvin
    I have a fairly large repetitive XML to create using JAXB. Storing the whole object in the memory then do the marshaling takes too much memory. Essentially, my XML looks like this: <Store> <item /> <item /> <item /> ..... </Store> Currently my solution to the problem is to "hard code" the root tag to an output stream, and marshal each of the repetitive element one by one: aOutputStream.write("<?xml version="1.0"?>") aOutputStream.write("<Store>") foreach items as item aMarshaller.marshall(item, aOutputStream) end aOutputStream.write("</Store>") aOutputStream.close() Somehow the JAXB generate the XML like this <Store xmlns="http://stackoverflow.com"> <item xmlns="http://stackoverflow.com"/> <item xmlns="http://stackoverflow.com"/> <item xmlns="http://stackoverflow.com"/> ..... </Store> Although this is a valid XML, but it just look ugly, so I'm wonder is there any way to tell the marshaller not to put namespace for the item elements? Or is there better way to use JAXB to serialize to XML chunk by chunk?

    Read the article

  • load balancing in Tomcat

    - by Alvin
    Hi All, I want to implement the load balancing in tomcat 6.0 so that we can create more than one instance of a tomcat and when any of the instance is down then other instance will run our application. so that our application will never be down even when the large number of concurrent request comes. But i have no idea to implement it. Please give your precious suggestions.

    Read the article

  • Problem in getting response from server in jquery

    - by Alvin
    Hello, I'm using $.ajax(options) method to pass the request to server based on username and password, but whenever I try to print the response by XMLHttpRequest object when response gets successful, I'm getting an empty value. $(document).ready(function(){ $("#form").submit(function(){ $.ajax({url:"Chat.jsp",type:"POST",data:$("#form").serialize(),success:function(request) { alert(request.responseText); //This is displaying nothing },error:function(){document.write("YOU can't");}}); }); }); This is what I'm doing in my servlets code after executing query: try { String user = request.getParameter("j_username"); String password = request.getParameter("j_password"); if(user != null && password != null) { String query = "Select * from users where user_name="+"\'"+user+"\'"+"&& user_pass="+"\""+password+"\""; DBCheck db= new DBCheck(); boolean b = db.doExecuteQuery(con.createStatement(),query); response.setHeader("Cache-Control", "no-cache"); if(b) { response.getWriter().println("Username already exits"); } else { response.getWriter().println("Username doesn't exit"); } } } catch(SQLException ex) { ex.printStackTrace(); } } May I know the problem, and how can I fix it?

    Read the article

  • Plastic SCM vs. Mercurial? Need Source Control for Visual Studio 2005 on Windows 7

    - by Pete Alvin
    1) Has anyone used Plastic SCM? Is it reliable? 2) How does it compare with Mercurial? (It seems like this is a good candidate for DVCS on Windows. I tried Git and really didn't like it.) 3) I really like TortoiseSVN. I like a central model because of the piece of mind that if it's in the respository it's "safe" and tracked. Here is the question: Is the excitement over distributed version control (DVCS) worth the hype? My environment: Windows 7 Windows development (Dev. Studio 2005, SQL Server 2003); integration would be nice Two developers sharing same code push code to production servers almost daily

    Read the article

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