Search Results

Search found 4088 results on 164 pages for 'params keyword'.

Page 37/164 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • Is it common practice to put keywords in html markup for SEO?

    - by Joel
    Though it's on the edge of programming questions, I think this is still relevant here, as only those of us actually doing the coding for a site would be considering this. I've been reading more about keyword placement, and it seems to me like a good place to do keyword placement would be in the class and id names chosen for the elements they are representing. I'm not talking about any kind of black-hat keyword stuffing thing but real legitimate use of descriptive keywords for elements. Is this something that is actively done for SEO?

    Read the article

  • simple form validation in dancer/perl

    - by devnull
    I am trying to do a simple form validation in perl dancer but I was wondering what would be the best way to validate simple parameters (e.g. field cannot be empty, validity of the email, minimum length of a field) in dancer/perl without any extra plugin or CPAN module here is the code so far post '/register' => sub { my $db = connect_db(); my $sql = 'insert into users (username, email, password, motivation) values (?, ?, ? ,?)'; my $sth = $db->prepare($sql) or die $db->errstr; $sth->execute(params->{'username'}, params->{'email'},params->{'password'}, params->{'motivation'}) or die $sth->errstr; set_flash('Hey you signed up !'); redirect '/thanks'; }; I did google it and I found several ways to do validation using CPAN modules like Form::Foo but how do it without that ?

    Read the article

  • Write XML File from a flex application back to a rails Server

    - by Markus
    Hi everybody, I have a XML-file, which I want to send to a rails server. To do so I use the following code: <mx:HTTPService id="dataService" result="resultHandler(event)" resultFormat="e4x"/> In a Function triggered by a save button, I do the following: var params:Object = {}; params["xml_file"] = xmlDoc; dataService.method = "POST"; dataService.url = "http://localhost:3000/containers"; dataService.send(params); Unfortunately there is always the Problem (see below) appearing. If I remove the params var, it runs a GET Request... [RPC Fault faultString="HTTP request error" faultCode="Server.Error.Request" faultDetail="Error: [IOErrorEvent type="ioError" bubbles=false cancelable=false eventPhase=2 text="Error #2032: Stream-Fehler. URL: http://localhost:3000/containers"]. URL: http://localhost:3000/containers"] what could be the problem? Thanks for any hints! Markus

    Read the article

  • Permutation on Rails Routes

    - by Kevin Sylvestre
    I currently have an application that for a set of parameters (location, category, budget, ...) a user can enter a "pretty" URL like: /location/canada/ontario /category/primary /budget/small Resulting in the respective parameters: params[:country] == 'canada' and params[:region] == 'ontario' params[:category] == 'primary' params[:budget] == 'small' I want to allow users to perform searches on multiple parameters at once (with each parameter optional). For example: /location/canada/ontario/category/primary/budget/small I understand that this can be achieved using URL parameters, but for SEO reasons I prefer to add the "pretty" parameters. Is this at all possible without listing all possible combination of routes (I have a large number of search-able fields)? I understand that route "globbing" maybe play a roll, but I am not sure how. Thanks.

    Read the article

  • Parsing a comma-separated list

    - by alex
    I have a comma-separated list of values, for example: strins s = "param1=true;param2=4;param3=2.0f;param4=sometext;"; I need a functions: public bool ExtractBool(string parameterName, string @params); public int ExtractInt(string parameterName, string @params); public float ExtractFloat(string parameterName, string @params); public string ExtractString(string parameterName, string @params); Is there a special functions in .net that can help me with csl ? PS: parameter names are equal within a list.

    Read the article

  • Python required variable style

    - by Adam Nelson
    What is the best style for a Python method that requires the keyword argument 'required_arg': def test_method(required_arg, *args, **kwargs: def test_method(*args, **kwargs): required_arg = kwargs.pop('required_arg') if kwargs: raise ValueError('Unexpected keyword arguments: %s' % kwargs) Or something else? I want to use this for all my methods in the future so I'm kind of looking for the best practices way to deal with required keyword arguments in Python methods.

    Read the article

  • iPhone internationalization: falling back to a default language

    - by MihaiD
    Consider the following situation: We have two Localizable.string files, one in en.lproj and one in it.lproj When the user switches to English or Italian, the proper localized string is loaded using NSLocalizedString(@"keyword", nil) If one of the files is missing the keyword, the string is not retrieved Is there any way to make this macro load the string from a specific language if it's keyword is not found in the current locale's Localizable.string?

    Read the article

  • Spring Dependency Injecting an annotated Aspect

    Using Spring I've had some issues with doing a dependency injection on an annotated Aspect class. CacheService is injected upon the Spring context's startup, but when the weaving takes place, it says that the cacheService is null. So I am forced to relook up the spring context manually and get the bean from there. Is there another way of going about it? Here is an example of my Aspect: import org.apache.log4j.Logger; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Aspect; import com.mzgubin.application.cache.CacheService; @Aspect public class CachingAdvice { private static Logger log = Logger.getLogger(CachingAdvice.class); private CacheService cacheService; @Around("execution(public *com.mzgubin.application.callMethod(..)) &&" + "args(params)") public Object addCachingToCreateXMLFromSite(ProceedingJoinPoint pjp, InterestingParams params) throws Throwable { log.debug("Weaving a method call to see if we should return something from the cache or create it from scratch by letting control flow move on"); Object result = null; if (getCacheService().objectExists(params))}{ result = getCacheService().getObject(params); } else { result = pjp.proceed(pjp.getArgs()); getCacheService().storeObject(params, result); } return result; } public CacheService getCacheService(){ return cacheService; } public void setCacheService(CacheService cacheService){ this.cacheService = cacheService; } }

    Read the article

  • Login or Register (Ruby on rails)

    - by DanielZ
    Hello stackoverflow, I'm working on an Ruby on Rails application (2.3.x) and i want to make a form that lets the user login or register. I want to do this in the same form. I have a JS function that replaces the form elements like this: Login form: <% form_for @user do |f| %> <div id="form"> <%= f.label :email, "E-mail" %> <%= f.text_field :email %> <%= f.label :password, "Password" %> <%= f.password_field :password %> <%= link_to "I don't have an account, "#", :id => "changeForm"%> <%= f.submit "Login" %> </div> <% end %> The id "changeForm" triggers a JS function that changes the form elements. So if you press the url the html looks like this: <% form_for @user do |f| %> <div id="form"> <%= f.label :name, "Name" %> <%= f.text_field :name %> <%= f.label :email, "E-mail" %> <%= f.text_field :email %> <%= f.label :password, "Password" %> <%= f.password_field :password %> <%= f.label :password_confirmation, "Password confirmation" %> <%= f.password_field :password_confirmation %> <%= link_to "I do have an account, "#", :id => "changeForm"%> <%= f.submit "Register" %> </div> <% end %> I added the neccesary validations to my user model: class User < ActiveRecord::Base attr_reader :password validates_presence_of :name, :email, :password validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i validates_confirmation_of :password But what happens when you fill in the email / password you get the errors that the name is missing and that the password fields aren't confirmed. So i could do some nasty programming in my user model like this: #if password_conf or the name are present the user has tried to register... if params[:user][:password_confirmation].present? || params[:user][:name].present? #so we'll try to save the user if @user.save #if the user is saved authenticate the user current_session.user = User.authenticate(params[:user]) #if the user is logged in? if current_session.user.present? flash[:notice] = "succesvully logged redirect_to some_routes_path else #not logged in... flash[:notice] = "Not logged in" render :action => "new" end else #user not saved render :action => "new" end else #So if the params[:user][:password_confirmation] or [:user][:name] weren't present we geuss the user wants to login... current_session.user = User.authenticate(params[:user]) #are we logged_in? if current_session.user.present? flash[:notice] = "Succesvully logged in" redirect_to some_routes_path else #errors toevoegen @user.errors.add(:email, "The combination of email/password isn't valid") @user.errors.add(:password," ") render :action => "new" end end end Without validations this (imho dirty code and should not be in the controller) works. But i want to use the validates_presence_of methods and i don't want to slap the "conventions over configurations" in the face. So another thing i have tried is adding a hidden field to the form: #login form <%= f.hidden_field :login, :value => true %> # and ofcourse set it to false if we want to register. And then i wanted to use the method: before_validation before_validation_on_create do |user| if params[:user].login == true #throws an error i know... validates_presence_of :email, :password validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i else validates_presence_of :name, :email, :password validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i validates_confirmation_of :password end end But this doesn't work because i can't access the params. And login isn't a attribute for the user object. But i thought that in this way i could validate the email and password params if the user wants to login. And all the other attrs if the user want to register. So all i could think of doesn't work how i want it to work. So my main goal is this: 1 form for login/register with the use of the validation methods in the user model. So if we want to login but don't fill in any information = give validation errors. And if the user wants to login but the email/password combination doens't match give the "@user.errors.add(:email, "the combination wasn't found in the db...")". And the same goes for user register... Thanks in advance!

    Read the article

  • how to update multiple tables in oracle DB?

    - by murali
    hi, i am using two tables in my oracle 10g. the first table having the keyword,count,id(primary key) and my second table having id, timestamp.. but i am doing any chages in the first table(keyword,count) it will reflect on the my second table timestamp.. i am using id as reference for both the tables... table1: CREATE TABLE Searchable_Keywords (KEYWORD_ID NUMBER(18) PRIMARY KEY, KEYWORD VARCHAR2(255) NOT NULL, COUNT NUMBER(18) NOT NULL, CONSTRAINT Searchable_Keywords_unique UNIQUE(KEYWORD) ); table2: CREATE TABLE Keywords_Tracking_Report (KEYWORD_ID NUMBER(18), PROCESS_TIMESTAMP TIMESTAMP(8) ); how can update one table with reference of another table.. help me plz...

    Read the article

  • pluralize and singularize for spanish language

    - by el_quick
    Hello, sorry for my english... I have a rails application developed to spain, therefore, all content is in spanish, so, I have a search box to search in a mysql database, all rows are in spanish, I'd like to improve my search to allow to users to search keywords in singular or plural form, for example: keyword: patatas found: patata keyword: veces found: vez keyword: vez found: veces keyword: actividades found: actividad In english, this could be relatively easy with help of singularize and pluralize methods ... where `searching_field` like '%singularized_keyword%' or `searching_field` like '%pluralized_keyword%' But, for spanish.... Some help? Thanks!

    Read the article

  • ruby on rails implement search with auto complete

    - by user429400
    I've implemented a search box that searches the "Illnesses" table and the "symptoms" table in my DB. Now I want to add auto-complete to the search box. I've created a new controller called "auto_complete_controller" which returns the auto complete data. I'm just not sure how to combine the search functionality and the auto complete functionality: I want the "index" action in my search controller to return the search results, and the "index" action in my auto_complete controller to return the auto_complete data. Please guide me how to fix my html syntax and what to write in the js.coffee file. I'm using rails 3.x with the jquery UI for auto-complete, I prefer a server side solution, and this is my current code: main_page/index.html.erb: <p> <b>Syptoms / Illnesses</b> <%= form_tag search_path, :method => 'get' do %> <p> <%= text_field_tag :search, params[:search] %> <br/> <%= submit_tag "Search", :name => nil %> </p> <% end %> </p> auto_complete_controller.rb: class AutoCompleteController < ApplicationController def index @results = Illness.order(:name).where("name like ?", "%#{params[:term]}%") + Symptom.order(:name).where("name like ?", "%#{params[:term]}%") render json: @results.map(&:name) end end search_controller.rb: class SearchController < ApplicationController def index @results = Illness.search(params[:search]) + Symptom.search(params[:search]) respond_to do |format| format.html # index.html.erb format.json { render json: @results } end end end Thanks, Li

    Read the article

  • HELP Retrieving the url parameter from a JSON store from a EXTJS ComboBox

    - by Newbie
    I am having a problem retrieving the parameters from the url section of a json store for a combobox in EXTJS from my code behind page in c#. The following is the code in the store: var ColorStore = new Ext.data.JsonStore( { autoLoad: true, url: '/proxies/ReturnJSON.aspx?view=rm_colour_view', root: 'Rows', fields: ['company', 'raw_mat_col_code', 'raw_mat_col_desc'] }); And the following code is in my code behind page: protected void Page_Load(object sender, EventArgs e) { string jSonString = ""; connectionClass.connClass func = new connectionClass.connClass(); DataTable dt = func.getDataTable("sELECT * from rm_colour_view"); //Response.Write(Request.QueryString["view"]); string w = Request.Params.Get("url"); string z = Request.Params.Get("view"); string x = Request.Params.Get("view="); string c = Request.Params.Get("?view"); string s = Request.QueryString.Get("view"); string d = Request.Params["?view="]; string f = Request.Form["ColorStore"]; jSonString = Serialize(dt); Response.Write(jSonString); } The string w has gives the following output: /proxies/ReturnJSON.aspx but all the others strings return null... How can rm_colour_view from the datastore then be retrived??? Any help would be appreciated! Thanks

    Read the article

  • codeigniter differentiate field names in JOINed tables

    - by Patrick
    Hi, I need to retrieve data from two tables. the first is a list of events, the second is a list of venues. I have a fields with the same name in both tables: events.venue (which is an ID) and venues.venue is the name of the place, say "blues bar". The tables can be joined on events.venue = venues.id. Snippet of my model: $this->db->select('events.*, venues.*'); $this->db->join('venues', 'events.venue = venues.id'); if ($date != 'all') { $this->db->where('date', $date); } if ($keyword) { $this->db->like('description', $keyword); $this->db->or_like('band', $keyword); $this->db->or_like('venue', $keyword); $this->db->or_like('genre', $keyword); } $Q = $this->db->get('events'); if ($Q->num_rows() > 0) { foreach ($Q->result() as $row) { $data[] = $row; } } $Q->free_result(); return $data; Snippet of the View: foreach ($events as $row) { echo "<p>{$row->band} ({$row->genre})<br />"; echo "Playing at: {$row->venue}<br /></p>"; // echoes "blues bar" //more here... } 2 Questions: 1) Why does $row-venue echo venues.venue, instead of events.venue? B) how can I differentiate them? eg. What if I want to echo both events.venue and venues.venue? I can probably do something like "SELECT venues.venue as name_of_the_venue", but how can I do this when I've already selected *?

    Read the article

  • Refactor the following two C++ methods to move out duplicate code

    - by ossandcad
    I have the following two methods that (as you can see) are similar in most of its statements except for one (see below for details) unsigned int CSWX::getLineParameters(const SURFACE & surface, vector<double> & params) { VARIANT varParams; surface->getPlaneParams(varParams); // this is the line of code that is different SafeDoubleArray sdParams(varParams); for( int i = 0 ; i < sdParams.getSize() ; ++i ) { params.push_back(sdParams[i]); } if( params.size() > 0 ) return 0; return 1; } unsigned int CSWX::getPlaneParameters(const CURVE & curve, vector<double> & params) { VARIANT varParams; curve->get_LineParams(varParams); // this is the line of code that is different SafeDoubleArray sdParams(varParams); for( int i = 0 ; i < sdParams.getSize() ; ++i ) { params.push_back(sdParams[i]); } if( params.size() > 0 ) return 0; return 1; } Is there any technique that I can use to move the common lines of code of the two methods out to a separate method, that could be called from the two variations - OR - possibly combine the two methods to a single method? The following are the restrictions: The classes SURFACE and CURVE are from 3rd party libraries and hence unmodifiable. (If it helps they are both derived from IDispatch) There are even more similar classes (e.g. FACE) that could fit into this "template" (not C++ template, just the flow of lines of code) I know the following could (possibly?) be implemented as solutions but am really hoping there is a better solution: I could add a 3rd parameter to the 2 methods - e.g. an enum - that identifies the 1st parameter (e.g. enum::input_type_surface, enum::input_type_curve) I could pass in an IDispatch and try dynamic_cast< and test which cast is NON_NULL and do an if-else to call the right method (e.g. getPlaneParams() vs. get_LineParams()) The following is not a restriction but would be a requirement because of my teammates resistance: Not implement a new class that inherits from SURFACE/CURVE etc. (They would much prefer to solve it using the enum solution I stated above)

    Read the article

  • How to evaluate the string in ruby if the string contains ruby command?

    - by Arun
    In my case, I was storing the sql query in my database as text. I am showing you one record which is present in my database Query.all :id => 1, :sql => "select * from user where id = #{params[:id]}" str = Query.first Now 'str' has value "select * from user where id = #{params[:id]}" Here, I want to parsed the string like If my params[:id] is 1 then "select * from user where id = 1" I used eval(str). Is this correct?

    Read the article

  • FULLTEXT Irrelevant results

    - by Imran Omar Bukhsh
    Just came across this issue using the fulltext search of mysql. I have like 250 records ( long articles like stuff ) and am using the fulltext MATCH AGAINST IN BOOLEAN MODE. Now if I search for a keyword e.g. 'Samsung' and if this keyword is present in ALL the records then it returns all the 250 records which it should ( of course without `IN BOOLEAN MODE it would return nothing as the keyword is present in more than 50% of the records ). Now the problem is that in some articles the keyword 'Samsung' occurs once and in others a couple of times, but MYSQL is giving a score of 1 to all the records returned, even those which have 'Samsung' like 15 times in them.

    Read the article

  • C++ privately contructed class

    - by Nona Urbiz
    How can I call a function and keep my constructor private? If I make the class static, I need to declare an object name which the compiler uses to call the constructor, which it cannot if the constructor is private (also the object would be extraneous). Here is the code I am attempting to use (it is not compilable): I want to keep the constructor private because I will later be doing a lot of checks before adding an object, modifying previous objects when all submitted variables are not unique rather than creating new objects. #include <iostream> #include <fstream> #include <regex> #include <string> #include <list> #include <map> using namespace std; using namespace tr1; class Referral { public: string url; map<string, int> keywords; static bool submit(string url, string keyword, int occurrences) { //if(Referrals.all.size == 0){ // Referral(url, keyword, occurrences); //} } private: list<string> urls; Referral(string url, string keyword, int occurrences) { url = url; keywords[keyword] = occurrences; Referrals.all.push_back(this); } }; struct All { list<Referral> all; }Referrals; int main() { Referral.submit("url", "keyword", 1); }

    Read the article

  • Fill business object from database by calling stored procedurs?

    - by grady
    Hello, I have several stored procedures in my database, some of them have params, some have no params. I tried to fill a business object by calling the stored procedures, but failed so far. How could I do that dynamically? Later, I want to use this object as a datasource for a report...but thats the next step. The important facts are: different stored procs return different amount of columns stored procs can have params, but its not required How could I achieve that? Thanks :)

    Read the article

  • Adding items to dictionary if condition is true, else dont - python

    - by CodeTalk
    I'm trying to take an existing process: if self.path_object is not None: dictpath = {} for path in self.path_object: self.params = path.pathval.split("?")[0] self.params = path.pathval.split("&", 2) if path.pathval.contains(self.params): out = list(map(lambda v: v.split("=")[0] +"=" + str(self.fuzz_vectors), self.params)) else: pass dictpath[path] = out print dictpath I added the sub-if/else block in, but it is failing, stating: AttributeError: 'unicode' object has no attribute 'contains' on the if block . How can I fix it? I'm simply trying to do: if the path.pathval has either ? or & in it: add to dictionary else: pass #forget about it. Thanks!

    Read the article

  • Rails SQL injection?

    - by yuval
    In Rails, when I want to find by a user given value and avoid SQL injection (escape apostrophes and the like) I can do something like this: Post.all(:conditions => ['title = ?', params[:title]]) I know that an unsafe way of doing this (possible SQL injection) is this: Post.all(:conditions => "title = #{params[:title]}") My question is, does the following method prevent SQL injection or not? Post.all(:conditions => {:title => params[:title]})

    Read the article

  • Selecting from a Large Table SQL 2005

    - by Eugene
    I have a SQL table it has more than 1000000 rows, and I need to select with the query as you can see below: SELECT DISTINCT TOP (200) COUNT(1) AS COUNT, KEYWORD FROM QUERIES WITH(NOLOCK) WHERE KEYWORD LIKE '%Something%' GROUP BY KEYWORD ORDER BY 'COUNT' DESC Could you please tell me how can I optimize it to speed up the execution process? Thank you for useful answers.

    Read the article

  • Query Mongo Db and filter by associative array key

    - by Failpunk
    How can I search for results in Mongo DB documents using an associative array key. Something like: SELECT * FROM table WHERE keyword like '%searchterm%'; Here is the basic document structure [id] => 31605 [keywords] => Array ( [keyword1] => Array ( [name] => KeyWord1 ) [keyword2] => Array ( [name] => KeyWord2 ) ... ) I would like to do a search within the keywords array on the associative array key [keyword1, keyword2]. The issue is that the name key holds the case-sensitive version of the keyword and the array key is the lower-case keyword name. I could store the lowercase keyword twice, but that seems silly.

    Read the article

  • PHP OOP problem

    - by Isis
    Hello <?php class Templater { var $params = array(); public static function assign($name, $value) { $this->params[] = array($name => $value); } public static dunction draw() { return $this->params; } } <?php $test = Templater::assign('key', 'value')->draw(); print_r($test); I need to function "assign" was static, but $params was common for the whole class.. BUt this code is not working(( Fatal error: Using $this when not in object context Any ideas?

    Read the article

  • Is it possible to have variable find conditions for both the key and value?

    - by DarrenD
    I'm trying to pass in both the field and the value in a find call: @employee = Employee.find(:all, :conditions => [ '? = ?', params[:key], params[:value].to_i) The output is SELECT * FROM `employees` WHERE ('is_manager' = 1) Which returns no results, however when I try this directly in mysqsl using the same call without the '' around is_manager, it works fine. How do I convert my params[:key] value to a symbol so that the resulting SQL call looks like: SELECT * FROM `employees` WHERE (is_manager = 1) Thanks, D

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >