search

Search results in XML put into array with jQuery

烂漫一生 提交于 2019-12-25 16:49:20
问题 I asked another question earlier and managed to get help with some code that would take an XML file from a YouTube search query. Then, using jQuery, get the information needed from the XML file (the video ID) and put it into a javascript variable. This worked fine, but I would like (if possible) for our site to have not 1 but 3 of the latest videos from this channel. I was suggested to change the search to get 3 results instead of one, and put the jQuery .find() results into an array. Problem

How to display the searched data on the jgrid

我的未来我决定 提交于 2019-12-25 15:55:49
问题 this is related to my previous question about jqgrid. im doing now a search button that would search my inputed text from the server and display those data (if there is) in the jqgrid. Now, what i did is i create a global variable that stores the filters. Here's my javascript code for my searching and displaying: filter = ''; //this is my global variable for storing filters $('#btnsearchCode').click(function(){ var row_data = ''; var par = { "SessionID": $.cookie("ID"), "dataType": "data",

How to fix undefined method `form_with' in my search bar when building out Global Autocomplete Search?

£可爱£侵袭症+ 提交于 2019-12-25 15:55:31
问题 I get a strange error when trying to run a global autocomplete search across multiple models in my rails App and leveraging the easy-autocomplete jquery library along with the ransack gem for search. Specifically, I believe the error is in my navbar page as I get this error when I try to run a query- undefined method form_with for #<#<class:0x007f875a6f8b58>:0x007f87600e0aa8> I decided to hack away and switch form_with for form_tag but then I get an error on the line immediately below

Optimizing an SQL search using a column for keywords and a variable as the text to be searched

醉酒当歌 提交于 2019-12-25 14:04:23
问题 Here's my quandary. I have a variable that contains a paragraph of text, and I have a column full of keywords. I want to search each of the keywords contained in the column against the entirety of the text contained within my variable. The only way that I know how to do this is to select each row of the column one at a time, and then use the LIKE operator with wildcards on each side to see if the keyword from the column is found anywhere in the text within the variable. Every way that I try

Optimizing an SQL search using a column for keywords and a variable as the text to be searched

吃可爱长大的小学妹 提交于 2019-12-25 14:02:52
问题 Here's my quandary. I have a variable that contains a paragraph of text, and I have a column full of keywords. I want to search each of the keywords contained in the column against the entirety of the text contained within my variable. The only way that I know how to do this is to select each row of the column one at a time, and then use the LIKE operator with wildcards on each side to see if the keyword from the column is found anywhere in the text within the variable. Every way that I try

If window.location ends with html execute javascript

空扰寡人 提交于 2019-12-25 12:45:57
问题 Execute javascript if current location contains html in in. I have tried the below but it doesn't work var winloc = window.location; //for e.g http://mysite.com/home.html var ishtml = winloc.match(/html/$); var dothtml = "html"; if(dothtml==ishtml){ //execute javascript here } 回答1: var isHTML = "html" === window.location.pathname.split(".").pop().toLowerCase(); if ( isHTML ) { //execute javascript here } See Amaan answer using regexp: https://stackoverflow.com/a/8619635/887539 回答2: var winloc

find words before and after a keyword in PHP

China☆狼群 提交于 2019-12-25 12:24:08
问题 What i'm trying to do is search for a word (or couple of words) and then return a string of 5 words before, and 5 words after the keyword. My PHP code is like this: function getPreview($keyWord, $searchArea) { preg_match("/(\w+)? ?(\w+)? ?(\w+)? ?(\w+)? ?(\w+)? ?$keyWord ?(\w+)? ?(\w+)? ?(\w+)? ?(\w+)? ?(\w+)?/i", $searchArea, $result); foreach ($result as $res) { return preg_replace("/$keyWord/", "<B>$keyWord</B>", $res); break; } } The only problem is, when there aren't 5 words before, or

Binary Interpolation Searching - Cant make it work

ε祈祈猫儿з 提交于 2019-12-25 09:45:28
问题 I got an exercise in the university to make the Binary Interpolation Searching Program . But i cant make it work as it should. Sometimes is works and some other not...They gave us the basic program but it was not correct.. #include <iostream> #include <math.h> using namespace std; void bin(int mat_size, double *mat, int key){ int left = 0; int right = mat_size; int mid; mid = (mat_size * (key - mat[left]) / (mat[right] - mat[left])) + 1; while(key != mat[mid]){ int i = 0; mat_size = right -

Pagination in code igniter

China☆狼群 提交于 2019-12-25 09:30:14
问题 I am do pagination in code igniter ,join two tables for Search purpose my Models's public function main_search_count($term) { if ($term == "NIL") $term = ""; $this->db->select('*'); $this->db->from('tbl_doctor'); $this->db->join("tbl_specialisation", "tbl_specialisation.spec_id = tbl_doctor.spec_id",'left'); $this->db->where("(tbl_doctor.dr_name LIKE '%".$term."%' OR tbl_doctor.district LIKE '%".$term."%' OR tbl_specialisation.spec_specialise LIKE '%".$term."%')"); $query= $this->db->get();

Find value in array and get ID in PHP

痞子三分冷 提交于 2019-12-25 09:14:12
问题 I've 2 arrays with different structures (dimension), i need to find values (post_name) of $first in $second and then get ID from $second in order to create a unique array with post_name of $first and corresponding ID founded in $second. i hope i'm clear enough... I need to keep the same order of first Thanks $first= Array ( [0] => 'lundi-5', [1] => 'mardi-5', [2] => 'lundi-1', [3] => 'mardi-1', ); $second=Array ( [0] => WP_Post Object ( [ID] => 2878 [post_name] => lundi-1 ) [1] => WP_Post