Search Results

Search found 13889 results on 556 pages for 'results'.

Page 65/556 | < Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >

  • Building html tables from query data... faster?

    - by Andrew Heath
    With my limited experience/knowledge I am using the following structure to generate HTML tables on the fly from MySQL queries: $c = 0; $t = count($results); $table = '<table>'; while ($c < $t) { $table .= "<tr><td>$results[0]</td><td>$results[1]</td> (etc etc) </tr>"; ++$c; } $table .= '</table>'; this works, obviously. But for tables with 300+ rows there is a noticeable delay in pageload while the script builds the table. Currently the maximum results list is only about 1,100 rows, and the wait isn't long, but there's clearly a wait. Are there other methods for outputting an HTML table that are faster than my WHILE loop? (PHP only please...)

    Read the article

  • how to number t-rows ,when table generated using nested forloop in django templates

    - by stackover
    Hi, This part is from views.py results=[(A,[stuObj1,stuObj2,stuObj3]),(B,[stuObj4,stuObj5,stuObj6]),(C,[stuObj7,stuObj8])] for tup in results: total = tot+len(tup[1]) render_to_response(url,{'results':res , 'total':str(tot),}) this is template code: <th class="name">Name</th> <th class="id">Student ID</th> <th class="grade">Grade</th> {% for tup in results %} {% for student in tup|last %} {% with forloop.parentloop.counter as parentid%} {% with forloop.counter as centerid%} <tbody class="results-body"> <tr> <td>{{student.fname|lower|capfirst}} {{student.lname|lower|capfirst}}</td> <td>{{student.id}}</td> <td>{{tup|first}}</td> </tr> {% endfor %} {% endfor %} Now the problems am having are 1. numbering the rows. Here my problem is am not sure if i can do things like total=total-1 in the templates to get the numbered rows like <td>{{total}}</td> 2.applying css to tr:ever or odd. Whats happening in this case is everytime the loop is running the odd/even ordering is lost. these seems related problems. Any ideas would be great :)

    Read the article

  • Compiling code at runtime, loading into current appdomain.

    - by Richard Friend
    Hi Im compiling some code at runtime then loading the assembly into the current appdomain, however when i then try to do Type.GetType it cant find the type... Here is how i compile the code... public static Assembly CompileCode(string code) { Microsoft.CSharp.CSharpCodeProvider provider = new CSharpCodeProvider(); ICodeCompiler compiler = provider.CreateCompiler(); CompilerParameters compilerparams = new CompilerParameters(); compilerparams.GenerateExecutable = false; compilerparams.GenerateInMemory = false; foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { try { string location = assembly.Location; if (!String.IsNullOrEmpty(location)) { compilerparams.ReferencedAssemblies.Add(location); } } catch (NotSupportedException) { // this happens for dynamic assemblies, so just ignore it. } } CompilerResults results = compiler.CompileAssemblyFromSource(compilerparams, code); if (results.Errors.HasErrors) { StringBuilder errors = new StringBuilder("Compiler Errors :\r\n"); foreach (CompilerError error in results.Errors) { errors.AppendFormat("Line {0},{1}\t: {2}\n", error.Line, error.Column, error.ErrorText); } throw new Exception(errors.ToString()); } else { AppDomain.CurrentDomain.Load(results.CompiledAssembly.GetName()); return results.CompiledAssembly; } } This bit fails after getting the type from the compiled assembly just fine, it does not seem to be able to find it using Type.GetType.... Assembly assem = RuntimeCodeCompiler.CompileCode(code); string typeName = String.Format("Peverel.AppFramework.Web.GenCode.ObjectDataSourceProxy_{0}", safeTypeName); Type t = assem.GetType(typeName); //This works just fine.. Type doesntWork = Type.GetType(t.AssemblyQualifiedName); Type doesntWork2 = Type.GetType(t.Name); ....

    Read the article

  • Simplest way to flatten document to a view in RavenDB

    - by degorolls
    Given the following classes: public class Lookup { public string Code { get; set; } public string Name { get; set; } } public class DocA { public string Id { get; set; } public string Name { get; set; } public Lookup Currency { get; set; } } public class ViewA // Simply a flattened version of the doc { public string Id { get; set; } public string Name { get; set; } public string CurrencyName { get; set; } // View just gets the name of the currency } I can create an index that allows client to query the view as follows: public class A_View : AbstractIndexCreationTask<DocA, ViewA> { public A_View() { Map = docs => from doc in docs select new ViewA { Id = doc.Id, Name = doc.Name, CurrencyName = doc.Currency.Name }; Reduce = results => from result in results group on new ViewA { Id = result.Id, Name = result.Name, CurrencyName = result.CurrencyName } into g select new ViewA { Id = g.Key.Id, Name = g.Key.Name, CurrencyName = g.Key.CurrencyName }; } } This certainly works and produces the desired result of a view with the data transformed to the structure required at the client application. However, it is unworkably verbose, will be a maintenance nightmare and is probably fairly inefficient with all the redundant object construction. Is there a simpler way of creating an index with the required structure (ViewA) given a collection of documents (DocA)? FURTHER INFORMATION The issue appears to be that in order to have the index hold the data in the transformed structure (ViewA), we have to do a Reduce. It appears that a Reduce must have both a GROUP ON and a SELECT in order to work as expected so the following are not valid: INVALID REDUCE CLAUSE 1: Reduce = results => from result in results group on new ViewA { Id = result.Id, Name = result.Name, CurrencyName = result.CurrencyName } into g select g.Key; This produces: System.InvalidOperationException: Variable initializer select must have a lambda expression with an object create expression Clearly we need to have the 'select new'. INVALID REDUCE CLAUSE 2: Reduce = results => from result in results select new ViewA { Id = result.Id, Name = result.Name, CurrencyName = result.CurrencyName }; This prduces: System.InvalidCastException: Unable to cast object of type 'ICSharpCode.NRefactory.Ast.IdentifierExpression' to type 'ICSharpCode.NRefactory.Ast.InvocationExpression'. Clearly, we also need to have the 'group on new'. Thanks for any assistance you can provide. (Note: removing the type (ViewA) from the constructor calls has no effect on the above)

    Read the article

  • node.js with SQL Server Native Client 11 scope_identity not being returned

    - by binderbound
    I'm having trouble with inserting a value into a database through node.js. Here is the offending code: sql.query(conn_str ,"INSERT INTO Login(email, hash, salt, firstName, lastName) VALUES(?, ?, ?, ?, ?); SELECT SCOPE_IDENTITY() AS 'Identity';" , [email, hash, salt, firstName, lastName], function(err, results){ console.log(results) } Unfortunately, the console is just echoing [], meaning results is an empty array, I suppose. Does anyone know why the identity is not being returned? Even if it was null, why isn't results then [{Identity: null }] ? Database is on Azure, which does have a "Scope_Identity" function, and the native client also recognises this function. Using node package "msnodesql" Please Help

    Read the article

  • Duplicate an AppEngine Query object to create variations of a filter without affecting the base quer

    - by Steve Mayne
    In my AppEngine project I have a need to use a certain filter as a base then apply various different extra filters to the end, retrieving the different result sets separately. e.g.: base_query = MyModel.all().filter('mainfilter', 123) Then I need to use the results of various sub queries separately: subquery1 = basequery.filter('subfilter1', 'xyz') #Do something with subquery1 results here subquery2 = basequery.filter('subfilter2', 'abc') #Do something with subquery2 results here Unfortunately 'filter()' affects the state of the basequery Query instance, rather than just returning a modified version. Is there any way to duplicate the Query object and use it as a base? Is there perhaps a standard Python way of duping an object that could be used? The extra filters are actually applied by the results of different forms dynamically within a wizard, and they use the 'running total' of the query in their branch to assess whether to ask further questions. Obviously I could pass around a rudimentary stack of filter criteria, but I'd rather use the Query itself if possible, as it adds simplicity and elegance to the solution.

    Read the article

  • (Pathinfo vs fnmatch part 2) Speed benchmark reversed on Windows and Mac

    - by zaf
    On a previous question the pathinfo and fnmatch functions were benchmarked and the answers all came out opposite to my benchmark results. You can read the different results with the benchmark code here: http://stackoverflow.com/questions/2693428/pathinfo-vs-fnmatch I couldn't work it out until I ran the same code on a machine running vista. The results then matched the other users. My main machine is a mac. So, my questions are: Why do we get these two different results? Could this apply to other functions?

    Read the article

  • How to invert rows and columns using a T-SQL Pivot Table

    - by Jeff Stock
    I have a query that returns one row. However, I want to invert the rows and columns, meaning show the rows as columns and columns as rows. I think the best way to do this is to use a pivot table, which I am no expert in. Here is my simple query: SELECT Period1, Period2, Period3 FROM GL.Actuals WHERE Year = 2009 AND Account = '001-4000-50031' Results (with headers): Period1, Period2, Period3 612.58, 681.36, 676.42 I would like for the results to look like this: Desired Results: Period, Amount Period1, 612.58 Period2, 681.36 Period3, 676.42 This is a simple example, but what I'm really after is a bit more comlex than this. I realize I could produce theses results by using several SELECT commands instead. I'm just hoping someone can shine some light on how to accomplish this with a Pivot Table or if there is yet a better way.

    Read the article

  • jQuery pagination without all the rows of data before hand

    - by Aaron Mc Adam
    Hi guys, I'm trying to find a solution for paginating my search results. I have a built the links and everything works without jQuery. I've also got AJAX working for the links, but I just need a way of tidying up the list of links, as some search results return up to 60 pages and the links spread to two rows in my template. I am searching the Amazon API, and can only return 10 results at a time. Upon clicking the pagination links, the next 10 results are returned. I have access to the total results number from the XML, but not all the data at once, so I can't put all the data into a "hiddenResults" div that the jQuery Pagination plugin needs. Here is the jQuery I have for the pagination: var $pagination = $("#pagination ul"); $pagination.delegate('.pagenumbers', 'click', function() { var $$this = $(this); $$this.closest('li').addClass('cached'); $pagination.find("#currentPage").removeAttr('id').wrapInner($('<a>', {'class':'pagenumbers', 'href':'book_data.php?keywords='+keywords})); $$this.closest('li').attr('id','currentPage').html( $$this.text() ); $.ajax({ type : "GET", cache : false, url : "book_data.php", data : { keywords : keywords, page : $$this.text() }, success : show_results }); return false; }); function show_results(res) { $("#searchResults").replaceWith($(res).find('#searchResults')).find('table.sortable tbody tr:odd').addClass('odd'); detailPage(); selectForm(); if ( ! ( $pagination.find('li').hasClass('cached') ) ) { $.get("book_data.php", { keywords : keywords, page : ( $pagination.find("#currentPage").text() + 1 ) } ); } }

    Read the article

  • SEO Help with Pages Indexed by Google

    - by Joe Majewski
    I'm working on optimizing my site for Google's search engine, and lately I've noticed that when doing a "site:www.joemajewski.com" query, I get results for pages that shouldn't be indexed at all. Let's take a look at this page, for example: http://www.joemajewski.com/wow/profile.php?id=3 I created my own CMS, and this is simply a breakdown of user id #3's statistics, which I noticed is indexed by Google, although it shouldn't be. I understand that it takes some time before Google's results reflect accurately on my site's content, but this has been improperly indexed for nearly six months now. Here are the precautions that I have taken: My robots.txt file has a line like this: Disallow: /wow/profile.php* When running the url through Google Webmaster Tools, it indicates that I did, indeed, correctly create the disallow command. It did state, however, that a page that doesn't get crawled may still get displayed in the search results if it's being linked to. Thus, I took one more precaution. In the source code I included the following meta data: <meta name="robots" content="noindex,follow" /> I am assuming that follow means to use the page when calculating PageRank, etc, and the noindex tells Google to not display the page in the search results. This page, profile.php, is used to take the $_GET['id'] and find the corresponding registered user. It displays a bit of information about that user, but is in no way relevant enough to warrant a display in the search results, so that is why I am trying to stop Google from indexing it. This is not the only page Google is indexing that I would like removed. I also have a WordPress blog, and there are many category pages, tag pages, and archive pages that I would like removed, and am doing the same procedures to attempt to remove them. Can someone explain how to get pages removed from Google's search results, and possibly some criteria that should help determine what types of pages that I don't want indexed. In terms of my WordPress blog, the only pages that I truly want indexed are my articles. Everything else I have tried to block, with little luck from Google. Can someone also explain why it's bad to have pages indexed that don't provide any new or relevant content, such as pages for WordPress tags or categories, which are clearly never going to receive traffic from Google. Thanks!

    Read the article

  • ASP.NET MVC URL Routing problem

    - by Sadegh
    hi, i have defined a route as below: context.MapRoute("SearchEngineWebSearch", "search/web/{query}/{index}/{size}", new { controller = "search", action = "web", query = "", index = 0, size = 5 }); and action method to handle request match with that: public System.Web.Mvc.ActionResult Web(string query = "", int index = 0, int size = 5) { if (string.IsNullOrEmpty(query)) return RedirectToRoute("SearchEngineBasicSearch"); var search = new Search(); var results = search.PerformSearch(query, index, size); ViewData["Query"] = query; if (results != null && results.Count() > 0) { ViewData["Results"]= results; return View("Web"); } else return View("Not-Found"); } and form to sent parameter to action method: <% using (Html.BeginForm("Web", "Search", FormMethod.Post)) { %> <input name="query" type="text" value="<%: ViewData["Query"]%>" class="search-field" /> <input type="submit" value="Search" class="search-button" /> <input type="hidden" name="index" value="2" /> <input type="hidden" name="size" value="2" /> <%} %> now after click on submit and sending value to action method all route values updated but url values still is equals to first time of sending parameter. for example if i sent for first time request such as http://localhost/search/web/google and for next time http://localhost/search/web/yahoo, query parameter which passed to action method is yahoo but url after postback is http://localhost/search/web/google still! can anybody help me plz? ;)

    Read the article

  • Retrieving models from form with ModelMultipleChoiceField

    - by colinjameswebb
    I am having difficulties with forms, specifically ModelMultipleChoiceField. I've pieced together this code from various examples, but it sadly doesn't work. I would like to be able to: Search for some Works on work_search.html Display the results of the search, with checkboxes next to each result Select the Works I want, via the checkboxes After pressing Add, display which works were selected. I believe everything is okay except the last part. The page simply displays "works" :( Here is the code - sorry about the length. Models.py class Work(models.Model): title = models.CharField(max_length=200) artist = models.CharField(max_length=200) writers = models.CharField(max_length=200) def __unicode__(self): return self.title + ' - ' + self.artist forms.py class WorkSelectForm(forms.Form): def __init__(self, queryset, *args, **kwargs): super(WorkSelectForm, self).__init__(*args, **kwargs) self.fields['works'] = forms.ModelMultipleChoiceField(queryset=queryset, widget=forms.CheckboxSelectMultiple()) views.py def work_search(request): query = request.GET.get('q', '') if query: qset = ( Q(title__icontains=query) | Q(artist__icontains=query) | Q(writers__icontains=query) ) results = Work.objects.filter(qset).distinct() form = WorkSelectForm(results) return render_to_response("work_search.html", {"form": form, "query": query }) else: results = [] return render_to_response("work_search.html", {"query": query }) def add_works(request): #if request.method == POST: form = WorkSelectForm(request.POST) #if form.isvalid(): items = form.fields['works'].queryset return render_to_response("add_works.html", {"items":items}) work_search.html {% extends "base.html" %} {% block content %} <h1>Search</h1> <form action="." method="GET"> <label for="q">Search: </label> <input type="text" name="q" value="{{ query|escape }}"> <input type="submit" value="Search"> </form> {% if query %} <h2>Results for "{{ query|escape }}":</h2> <form action="add_works" method="post"> <ul> {% if form %} {{ form.as_ul }} {% endif %} </ul> <input type="submit" value="Add"> </form> {% endif %} {% endblock %} add_works.html {% extends "base.html" %} {% block content %} {% if items %} {% for item in items %} {{ item }} {% endfor %} {% else %} <p>Nothing selected</p> {% endif %} {% endblock %}

    Read the article

  • Can't get values from Sqlite DB using query

    - by Sana Joseph
    I used sqlite to populate a DB with some Tables in it. I made a function at another javascript page that executes the database & selects some values from the table. Javascript: function GetSubjectsFromDB() { tx.executeSql('SELECT * FROM Subjects', [], queryNSuccess, errorCB); } function queryNSuccess(tx, results) { alert("Query Success"); console.log("Returned rows = " + results.rows.length); if (!results.rowsAffected) { console.log('No rows affected!'); return false; } console.log("Last inserted row ID = " + results.insertId); } function errorCB(err) { alert("Error processing SQL: "+err.code); } Is there some problem with this line ? tx.executeSql('SELECT * FROM Subjects', [], queryNSuccess, errorCB); The queryNSuccess isn't called, neither is the errorCB so I don't know what's wrong.

    Read the article

  • Difference between float and double

    - by VaioIsBorn
    I know, i've read about the difference between double precision and single precision etc. But they should give the same results on most cases right ? I was solving a problem on a programming contest and there were calculations with floating point numbers that were not really big so i decided to use float instead of double, and i checked it - i was getting the correct results. But when i send the solution, it said only 1 of 10 tests was correct. I checked again and again, until i found that using float is not the same using double. I put double for the calculations and double for the output, and the program gave the SAME results, but this time it passed all the 10 tests correctly. I repeat, the output was the SAME, the results were the SAME, but putting float didn't work - only double. The values were not so big too, and the program gave the same results on the same tests both with float and double, but the online judge accepted only the double-provided solution. Why ? What is the difference ?

    Read the article

  • Preventing Race Conditions

    - by Qua
    I'm using the built-in ajax functionality of MVC2. Basically the user types a search query, and on every key press a set of results for the query is shown. This works fine in almost all cases, but sometimes the server is a bit slow with a single response, and thus the result for the next key stroke is returned before the previous. When the previous key stroke result set is finally returned to the client it will overwrite the results for the newer search query that should actually have been shown. My code follows more or less along these lines: <% using (Ajax.BeginForm("SearchUser", null, new AjaxOptions() { UpdateTargetId = "findUserResults" }, new { id = "findUserAjaxForm" })) {%> Every keystroke submits this form and thus outputs the results in the 'findUserResults' element. How can I prevent older results from being displayed while still making use of the built-in functions provided in MVC2?

    Read the article

  • jQuery .getJSON() Not Parsing All Objects

    - by Brad
    I'm using jQuery's .getJSON function to parse a set of search results from a Google Search Appliance. The search appliance has an xslt stylesheet that returns the results as JSON data, which I validated with both JSONLint and Curious Concept's JSON Formatter. According to FireBug, the full result set is returned from the XMLHTTPRequest, but I tried dumping the data (with jquery.dump.js) and it only ever parses back the first result. It does successfully get all the Google Search Protocol stuff, but it only ever sees one "R" object (or individual result). Has anybody had a similar problem with jQuery's .getJSON? I know it likes to fail silently if the JSON is not valid, but like I said, I validated the results with several validators and it should be good to go. Edit: Clicking this link will show you the JSON results returned for a search for the word "google": http://bigbird.uww.edu/search?client=json_frontend&proxystylesheet=json_frontend&proxyrefresh=1&output=xml_no_dtd&q=google jQuery only retrieves the first "R" object, even though all "R" objects are siblings.

    Read the article

  • figuring out which field to look for a value in with SQL and perl

    - by Micah
    I'm not too good with SQL and I know there's probably a much more efficient way to accomplish what I'm doing here, so any help would be much appreciated. Thanks in advance for your input! I'm writing a short program for the local school high school. At this school, juniors and seniors who have driver's licenses and cars can opt to drive to school rather than ride the bus. Each driver is assigned exactly one space, and their DLN is used as the primary key of the driver's table. Makes, models, and colors of cars are stored in a separate cars table, related to the drivers table by the License plate number field. My idea is to have a single search box on the main GUI of the program where the school secretary can type in who/what she's looking for and pull up a list of results. Thing is, she could be typing a license plate number, a car color, make, and model, someone driver's name, some student driver's DLN, or a space number. As the programmer, I don't know what exactly she's looking for, so a couple of options come to mind for me to build to be certain I check everywhere for a match: 1) preform a couple of SELECT * FROM [tablename] SQL statements, one per table and cram the results into arrays in my program, then search across the arrays one element at a time with regex, looking for a matched pattern similar to the search term, and if I find one, add the entire record that had a match in it to a results array to display on screen at the end of the search. 2) take whatever she's looking for into the program as a scaler and prepare multiple select statements around it, such as SELECT * FROM DRIVERS WHERE DLN = $Search_Variable SELECT * FROM DRIVERS WHERE First_Name = $Search_Variable SELECT * FROM CARS WHERE LICENSE = $Search_Variable and so on for each attribute of each table, sticking the results into a results array to show on screen when the search is done. Is there a cleaner way to go about this lookup without having to make her specify exactly what she's looking for? Possibly some kind of SQL statement I've never seen before?

    Read the article

  • Another floating point question

    - by jeffmax329
    I have read most of the posts on here regarding floating point, and I understand the basic underlying issue that using IEEE 754 (and just by the nature of storing numbers in binary) certain fractions cannot be represented. I am trying to figure out the following: If both Python and JavaScript use the IEEE 754 standard, why is it that executing the following in Python .1 + .1 Results in 0.20000000000000001 (which is to be expected) Where as in Javascript (in at least Chrome and Firefox) the answer is .2 However performing .1 + .2 In both languages results in 0.30000000000000004 In addition, executing var a = 0.3; in JavaScript and printing a results in 0.3 Where as doing a = 0.3 in Python results in 0.29999999999999999 I would like to understand the reason for this difference in behavior. In addition, many of the posts on OS link to a JavaScript port of Java's BigDecimal, but the link is dead. Does anyone have a copy?

    Read the article

  • Google local search API - callback never called

    - by Laurent Luce
    Hello, I am trying to retrieve some local restaurants using the LocalSearch Google API. I am initializing the search objects in the OnLoad function and I am calling the searchControl execute function when the user clicks on a search button. The problem is that my function attached to setSearchCompleteCallback never get called. Please let me know what I am doing wrong here. <script src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('maps' , '2'); google.load('search' , '1'); var searcher, searchControl; function OnLoad() { searchControl = new google.search.SearchControl(); searcher = new google.search.LocalSearch(); // create the object // Add the searcher to the SearchControl searchControl.addSearcher(searcher); searchControl.setSearchCompleteCallback(searcher , function() { var results = searcher.results; // Grab the results array // We loop through to get the points for (var i = 0; i < results.length; i++) { var result = results[i]; } }); $('#user_search_address').live('click', function() { g_searchControl.execute('pizza san francisco'); }); } google.setOnLoadCallback(OnLoad); </script>

    Read the article

  • How to find why NSMutableData is invalid

    - by 4thSpace
    I access a RESTFUL url and get back results. The results are in JSON. I turn the response into a string via: - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSString *json = [[NSString alloc] initWithBytes:[self.receivedData mutableBytes] length:[self.receivedData length] encoding:NSUTF8StringEncoding]; The json variable has a value of 0x0. When I mouse over it, I see <Invalid CFStringRef. How can I debug this to tell why it is invalid? I render the JSON given back through the browser in A JSON parser. That checks out fine. Results are given back by entering an ID in the URL. Other IDs return results without issue. The result set is fairly large.

    Read the article

  • open current page in new window including query string

    - by Hatch
    First of all, I am a total dud at all things related to web developement, so please bear with me here. I suspect this question is laughable for the web guys, but unfortunately I can't figure this out. Here goes: I have an application, that does some processing, writes some result files and then displays the results in an embedded IE browser control. This is done by navigating the browser control to a local html file together with a query string containing the generated result files to display it all. The link target would look something like: c:\SomeFolder\results.htm?results=file%201.xml;file%202.xml;file%203.xml So far, everything's fine. However, in the html page is a href that is suppossed to open up the exact same just in a normal browser window. What I thought would work is: <a href="#" target="_blank">Show in browser</a> Since it is a link in an html page displayed in an IE control, the link will open up in IE no matter what the default browser might be. This works for IE7 and 8, but not for IE6. With IE6 the query string gets cut off and the browser opens file://c:/results/results.htm# without the query string. I am sure there must be a much better way to do this without the # and which would work in all IEs. How would the pros solve this?

    Read the article

  • Zend_Table_Db and Zend_Paginator num rows

    - by Uffo
    I have the following query: $this->select() ->where("`name` LIKE ?",'%'.mysql_escape_string($name).'%') Now I have the Zend_Paginator code: $paginator = new Zend_Paginator( // $d is an instance of Zend_Db_Select new Zend_Paginator_Adapter_DbSelect($d) ); $paginator->getAdapter()->setRowCount(200); $paginator->setItemCountPerPage(15) ->setPageRange(10) ->setCurrentPageNumber($pag); $this->view->data = $paginator; As you see I'm passing the data to the view using $this->view->data = $paginator Before I didn't had $paginator->getAdapter()->setRowCount(200);I could determinate If I have any data or not, what I mean with data, if the query has some results, so If the query has some results I show the to the user, if not, I need to show them a message(No results!) But in this moment I don't know how can I determinate this, since count($paginator) doesn't work anymore because of $paginator->getAdapter()->setRowCount(200);and I'm using this because it taks about 7 sec for Zend_Paginator to count the page numbers. So how can I find If my query has any results?

    Read the article

  • jQuery autosuggest example

    - by RUtt
    I need to implement an "autosuggest" feature on our site but it needs to re-query the on every keystroke after a certain number of keys (like every character after 2 it would need to query again). So the result isn't a limiting search. For example, the autocomplete plugins I've seen work like the following: [looking for a county] 1. customer types 'CA' and the first result would return 'Canada', 'Cambodia', and 'Camaroon' 2. customer continues to type and hits 'M' the new results would query within the only the existing 3 results (producing results of just 'Cambodia' and 'Camaroon') I need a solution that would be the equivalent of querying my datasource on each keystroke. I already have the ajax call that will return my results based on the "typed" params. For example (in the above example), it would need to make an ajax call passing 'ca' first and if the customer kept typing passing 'can' on the 3 character and so forth. Thanks.

    Read the article

  • Error with connection in my database servlet

    - by Zerobu
    Hello, I am writing a Database servlet, all seems well except that there seems to be an error in my connection import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import javax.servlet.RequestDispatcher; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class DBServlet3 extends HttpServlet { private static final long serialVersionUID = 1L; @Override public void init() throws ServletException { super.init(); try { String jdbcDriverClass= getServletContext().getInitParameter( "jdbcDriverClass" ); if (jdbcDriverClass == null) throw new ServletException( "Could not find jdbcDriverClass initialization parameter" ); Class.forName( jdbcDriverClass ); } catch (ClassNotFoundException e) { throw new ServletException( "Could not load JDBC driver class", e ); } } @Override protected void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { RequestDispatcher dispatcher= request.getRequestDispatcher( "/db.jsp" ); ServletContext application= getServletContext(); ArrayList<String> names= new ArrayList<String>(); try { Connection connection= null; Statement statement= null; ResultSet results= null; try { String jdbcUrl= application.getInitParameter( "jdbcUrl" ); String jdbcUser= application.getInitParameter( "jdbcUser" ); String jdbcPassword= application.getInitParameter( "jdbcPassword" ); connection= DriverManager.getConnection( jdbcUrl, jdbcUser, jdbcPassword ); statement= connection.createStatement(); results= statement.executeQuery( "SELECT * FROM students" ); while (results.next()) { String name= results.getString( "name" ); names.add( name ); } } finally { if (results != null) results.close(); if (statement != null) statement.close(); if (connection != null) connection.close(); } } catch (SQLException e) { throw new ServletException( e ); } request.setAttribute( "names", names ); dispatcher.forward( request, response ); } @Override protected void doPost( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException { String sql= "INSERT INTO students VALUES (" + request.getParameter( "id" ) + ", '" + request.getParameter( "name" ) + "')"; sql= "INSERT INTO students VALUES (?, ?, ?, ?)"; PreparedStatement statement= connection.prepareStatement( sql ); //error on this line statement.setString( 1, request.getParameter( "id" ) ); statement.setString( 2, request.getParameter( "name" ) ); } }

    Read the article

< Previous Page | 61 62 63 64 65 66 67 68 69 70 71 72  | Next Page >