Search Results

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

Page 30/164 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Trouble using the ref keyword. Very newbie question!

    - by Sergio Tapia
    Here's my class: public class UserInformation { public string Username { get; set; } public string ComputerName { get; set; } public string Workgroup { get; set; } public string OperatingSystem { get; set; } public string Processor { get; set; } public string RAM { get; set; } public string IPAddress { get; set; } public UserInformation GetUserInformation() { var CompleteInformation = new UserInformation(); GetPersonalDetails(ref CompleteInformation); GetMachineDetails(ref CompleteInformation); return CompleteInformation; } private void GetPersonalDetails(ref UserInformation CompleteInformation) { } private void GetMachineDetails(ref UserInformation CompleteInformation) { } } I'm under the impression that the ref keyword tells the computer to use the same variable and not create a new one. Am I using it correctly? Do I have to use ref on both the calling code line and the actual method implementation?

    Read the article

  • How to use keyword this in a mouse wrapper in right context in Javascript?

    - by MartyIX
    Hi, I'm trying to write a simple wrapper for mouse behaviour. This is my current code: function MouseWrapper() { this.mouseDown = 0; this.OnMouseDownEvent = null; this.OnMouseUpEvent = null; document.body.onmousedown = this.OnMouseDown; document.body.onmouseup = this.OnMouseUp; } MouseWrapper.prototype.Subscribe = function (eventName, fn) { // Subscribe a function to the event if (eventName == 'MouseDown') { this.OnMouseDownEvent = fn; } else if (eventName == 'MouseUp') { this.OnMouseUpEvent = fn; } else { alert('Subscribe: Unknown event.'); } } MouseWrapper.prototype.OnMouseDown = function () { this.mouseDown = 1; // Fire event $.dump(this.OnMouseDownEvent); if (this.OnMouseDownEvent != null) { alert('test'); this.OnMouseDownEvent(); } } MouseWrapper.prototype.OnMouseUp = function () { this.mouseDown = 0; // Fire event if (this.OnMouseUpEvent != null) { this.OnMouseUpEvent(); } } From what I gathered it seems that in MouseWrapper.prototype.OnMouseUp and MouseWrapper.prototype.OnMouseDown the keyword "this" doesn't mean current instance of MouseWrapper but something else. And it makes sense that it doesn't point to my instance but how to solve the problem? I want to solve the problem properly I don't want to use something dirty. My thinking: * use a singleton pattern (mouse is only one after all) * pass somehow my instance to OnMouseDown/Up - how? Thank you for help!

    Read the article

  • Sorting and Pagination does not work after I build a custom keyword search that is build using relat

    - by Roland
    I recently started to build a custom keyword search using Yii 1.1.x The search works 100%. But as soon as I sort the columns and use pagination in the admin view the search gets lost and all results are shown. So with otherwords it's not filtering so that only the search results show. Somehow it resets it. In my controller my code looks as follows $builder=Messages::model()->getCommandBuilder(); //Table1 Columns $columns1=array('0'=>'id','1'=>'to','2'=>'from','3'=>'message','4'=>'error_code','5'=>'date_send'); //Table 2 Columns $columns2=array('0'=>'username'); //building the Keywords $keywords = explode(' ',$_REQUEST['search']); $count=0; foreach($keywords as $key){ $kw[$count]=$key; ++$count; } $keywords=$kw; $condition1=$builder->createSearchCondition(Messages::model()->tableName(),$columns1,$keywords,$prefix='t.'); $condition2=$builder->createSearchCondition(Users::model()->tableName(),$columns2,$keywords); $condition = substr($condition1,0,-1) . " OR ".substr($condition2,1); $condition = str_replace('AND','OR',$condition); $dataProvider=new CActiveDataProvider('Messages', array( 'pagination'=>array( 'pageSize'=>self::PAGE_SIZE, ), 'criteria'=>array( 'with'=>'users', 'together'=>true, 'joinType'=>'LEFT JOIN', 'condition'=>$condition, ), 'sort'=>$sort, )); $this->render('admin',array( 'dataProvider'=>$dataProvider,'keywords'=>implode(' ',$keywords),'sort'=>$sort )); and my view looks like this $this->widget('zii.widgets.grid.CGridView', array( 'dataProvider'=>$dataProvider, 'columns'=>array( 'id', array( 'name'=>'user_id', 'value'=>'CHtml::encode(Users::model()->getReseller($data->user_id))', 'visible'=>Yii::app()->user->checkAccess('poweradministrator') ), 'to', 'from', 'message', /* 'date_send', */ array( 'name'=>'error_code', 'value'=>'CHtml::encode($data->status($data->error_code))', ), array( 'class'=>'CButtonColumn', 'template'=>'{view} {delete}', ), ), )); I really do not know what do do anymore since I'm terribly lost, any help will be hihsly appreciated

    Read the article

  • 3 SEO Secrets to Rocket Above the Competition in Just 10 Days!

    Correct Title Tags - That's right, the original and best way to outrank the website above you is to tweak the title tags on every single page on your website, and make sure they 100% different! Another great tip - don't just use one keyword, but: 'Keyword 1 & Keyword 2' on each of the pages, and note the pipe separator in the middle, not the comma or dots.

    Read the article

  • Google ranking, page crawl

    - by Nawaf Mubarak
    please don't mind me for asking this newbie question about Google ranking. I know that in order to get ranked the page has to be crawled by Google bots, I have had a page example of which I will get a better understanding of how the system works with Google. I have made a page on my website last month, it got indexed pretty quickly, then I found that it's in Google's page 15 on my keyword as a start, next day it made it to page 13, then after a week it was jumping back and forth in page 17/18 up to 20. Now a month passed by, when and it isn't listed in any position of that 'keyword' sometimes I will find it in page 30, but later I won't find it anywhere, keep happening this way these days. Even if it isn't listed in any page for my keyword if I do a search for "site:thepageadress" it will be listed which means I'm not penalized and my page is there for google to see, but it isn't in the search result for my keyword. But when I write "site:thepage_adress" and I hit "search tools" option and click on "Past day" or "past week" it isn't listed, it is only listed when I click on "Past month" which I think means that Google indexed the page, looked at it once when I published it, and never looked at it again, is this a fair statement? So two questions that comes to mind here. 1- Should Google keep looking at a page even if I haven't changed any info for it? and is this an indication for me that my page is doing fine? or is it normal that Google see's it once and thats it? 2- Why and how to fix the fact that my page keeps jumping back and forth in the ranking result for keyword, and sometimes it isn't even listed, what does that mean? Sorry for the long msg, I hope to god that somebody help me with this. Thank you!

    Read the article

  • How to determine the amount to spend per phrase on Adwords research?

    - by Anonymous -
    My company would like to start a PPC advertising campaign. Whilst I understand the concept and how to set everything up from a technical point of view, this is something I've never done before. Logically, we'd like to test out a wide range of keywords that we think would lead to conversions, which we've put together through brainstorming and with some help from Google's External Keyword Tool. Sub-question whilst I remember - am I correct in thinking that in Google's keyword tool, keywords that we think will perform well that have a low competition yet high monthly searches are good since there will be less advertisers, meaning our bid per click will be less? Is there a common benchmark or process of doing a round of tests with keywords? Should we wait for 100 clicks on each keyword, see which ones have lead to the most sales (or rather, sales that are sustainable with the cost per click of that keyword), then drop the ones which aren't converting and put that budget onto the converting keywords? We realistically have a few hundred keywords/phrases we would like to test, but spending $100 per keyword/phrase is going to work out as quite an expensive test. It would be nice to be able to spend $5-10 per phrase, but I don't think the sample size would be great enough to determine anything usefully reliable. Another approach might be to setup all the keywords, and those that bring the most sales within x hours/days would be the ones we use. What is the common procedure with things like this? I know there are a plethora of companies that specialize in exactly this, but this is something we anticipate doing a lot in the future, so it would make sense to do it in house if at all possible.

    Read the article

  • 5 of the MOST Powerful Search Engine Ranking Tips

    If you want to rank high you need multiple things, here are some search engine ranking tips that will improve the position of your page rank for at least 4 pages. Make sure you spend the extra 15 minutes on optimizing your page for keyword that you have selected. That means, get the keyword density of around 2%, get the keyword mentioned in the first paragraph and the last one.

    Read the article

  • What is the annoying/lacking feature in C#, in your opinion?

    - by Vimvq1987
    To be honest, I'm working with C# everyday, and I can say that I love its elegant syntax. But no language is perfect, so does C#. In my opinion, these two features are missing: Full-featured enum. I was pretty happy with enum in C#, until I know about enum in Java. Of course, we can "simulate" a full-featured enum in C# by class, but it's much better if Microsoft simplify this. Immutable keyword. We are told to let a class/struct immutable whenever possible. But to do that, we have to add readonly keyword to every field, and then if we add setter by a mistake, our class will be mutable, and nobody knows. By immutable keyword, every field will be automatically readonly, and any setter will be prohibited (error when compile). It's like static keyword added to class in C# 2.0 well. what's is your annoying/lacking feature in C#?

    Read the article

  • The Best Internet Marketing Tool is a Search Engine

    Two of the best internet marketing tools that you can get a hold of today is a keyword tool, and a search engine. Thankfully, both are free. A keyword tool that you might like to use is the excellent Google keyword tool which the search engine giant provides to anyone who wants to use it.

    Read the article

  • Can't mass-assign protected attributes -- unsolved issue

    - by nfriend21
    I have read about 10 different posts here about this problem, and I have tried every single one and the error will not go away. So here goes: I am trying to have a nested form on my users/new page, where it accepts user-attributes and also company-attributes. When you submit the form: Here's what my error message reads: ActiveModel::MassAssignmentSecurity::Error in UsersController#create Can't mass-assign protected attributes: companies app/controllers/users_controller.rb:12:in `create' Here's the code for my form: <%= form_for @user do |f| %> <%= render 'shared/error_messages', object: f.object %> <%= f.fields_for :companies do |c| %> <%= c.label :name, "Company Name"%> <%= c.text_field :name %> <% end %> <%= f.label :name %> <%= f.text_field :name %> <%= f.label :email %> <%= f.text_field :email %> <%= f.label :password %> <%= f.password_field :password %> <%= f.label :password_confirmation %> <%= f.password_field :password_confirmation %> <br> <% if current_page?(signup_path) %> <%= f.submit "Sign Up", class: "btn btn-large btn-primary" %> Or, <%= link_to "Login", login_path %> <% else %> <%= f.submit "Update User", class: "btn btn-large btn-primary" %> <% end %> <% end %> Users Controller: class UsersController < ApplicationController def index @user = User.all end def new @user = User.new end def create @user = User.create(params[:user]) if @user.save session[:user_id] = @user.id #once user account has been created, a session is not automatically created. This fixes that by setting their session id. This could be put into Controller action to clean up duplication. flash[:success] = "Your account has been created!" redirect_to tasks_path else render 'new' end end def show @user = User.find(params[:id]) @tasks = @user.tasks end def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) if @user.update_attributes(params[:user]) flash[:success] = @user.name.possessive + " profile has been updated" redirect_to @user else render 'edit' end #if @task.update_attributes params[:task] #redirect_to users_path #flash[:success] = "User was successfully updated." #end end def destroy @user = User.find(params[:id]) unless current_user == @user @user.destroy flash[:success] = "The User has been deleted." end redirect_to users_path flash[:error] = "Error. You can't delete yourself!" end end Company Controller class CompaniesController < ApplicationController def index @companies = Company.all end def new @company = Company.new end def edit @company = Company.find(params[:id]) end def create @company = Company.create(params[:company]) #if @company.save #session[:user_id] = @user.id #once user account has been created, a session is not automatically created. This fixes that by setting their session id. This could be put into Controller action to clean up duplication. #flash[:success] = "Your account has been created!" #redirect_to tasks_path #else #render 'new' #end end def show @comnpany = Company.find(params[:id]) end end User model class User < ActiveRecord::Base has_secure_password attr_accessible :name, :email, :password, :password_confirmation has_many :tasks, dependent: :destroy belongs_to :company accepts_nested_attributes_for :company validates :name, presence: true, length: { maximum: 50 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, format: { with: VALID_EMAIL_REGEX }, uniqueness: { case_sensitive: false } validates :password, length: { minimum: 6 } #below not needed anymore, due to has_secure_password #validates :password_confirmation, presence: true end Company Model class Company < ActiveRecord::Base attr_accessible :name has_and_belongs_to_many :users end Thanks for your help!!

    Read the article

  • Trying to create an image list based on what is defined as the order, and loosing

    - by user1691463
    I have a custom created module for Joomla 2.5 and within the params of the module, and have a loop that is not outputting as expected. I have the following parameters (fields) int he module: Order Thumb image Image Title Full-size image Now there are 10 sets of these group of 4 params. What I am trying to do is loop through each of the object sets, 10 of them, and on each iteration, build an HTML image list structure. The if statement is building the HTML structure for the sets that have an order value that is greater than 0, and the else is creating the html for those sets that do not have a value greater that 0. The goal is to create two variables and then concatenate the the strings together; the leading set are the sets that have an order defined. This is not happening and every thrid loop seems like it is missing. Here is the order as it is set in the 10 sets Set 1 = 0 Set 2 = 4 Set 3 = 1 Set 4 = 0 Set 5 = 5 Set 6 = 0 Set 7 = 0 Set 8 = 6 Set 9 = 3 Set 10 = 9 However, the outcomes is: 9 5 1 4 6 7 10 Instead of the expected: 3 9 2 5 8 1 (below here are those sets that were not greater than 0 in order of appearance) 4 6 7 whats wrong here that I can not see <?php for ($i = 1; $i <= 10; $i++) { $order = $params->get('order'.$i);#get order for main loop of 10 $active = ""; if ($order > 0) {#Check if greater than 0 for ($n = 1; $n <= 10; $n++) {#loop through all order fields looking and build html lowest to highest; $ordercheck =$params->get('order'.$n); if ($ordercheck == $i) { $img = $params->get('image'.$n); $fimage = $params->get('image'.$n.'fullimage'); $title = $params->get('image'.$n.'alttext'); $active = ""; $active = $active . '<li>'; $active = $active . '<a href="'.$fimage.'" rel="prettyPhoto[gallery1]" title="'.$title.'">'; $active = $active . '<img src="'.$img.'" alt="'.$title.'" />'; $active = $active . '</a>'; $active = $active . '</li>'; $leading = $leading . $active; } } } else { #if the itteration $order was not greater than 0, build in order of accourance $img = $params->get('image'.$i); $fimage = $params->get('image'.$i.'fullimage'); $title = $params->get('image'.$i.'alttext'); $active = $active . '<li>'; $active = $active . '<a href="'.$fimage.'" rel="prettyPhoto[gallery1]" title="'.$title.'">'; $active = $active . '<img src="'.$img.'" alt="'.$title.'" />'; $active = $active . '</a></li>'; $unordered = $unordered . $active; } $imagesList = $leading . $unordered; } ?>

    Read the article

  • How do I make java wait for boolean to run funciton

    - by TWeeKeD
    I'm sure this is pretty simple but I can't figure out and it sucks I'm up on suck on (what should be) an easy step. ok. I have a method that runs one function that give a response. this method actually handles the uploading of the file so o it takes a second to give a response. I need this response in the following method. sendPicMsg needs to complete and then forward it's response to sendMessage. Please help. b1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { if(!uploadMsgPic.equalsIgnoreCase("")){ Log.v("response","Pic in storage"); sendPicMsg(); sendMessage(); }else{ sendMessage(); } 1st Method public void sendPicMsg(){ Log.v("response", "sendPicMsg Loaded"); if(!uploadMsgPic.equalsIgnoreCase("")){ final SharedPreferences preferences = this.getActivity().getSharedPreferences("MyPreferences", getActivity().MODE_PRIVATE); AsyncHttpClient client3 = new AsyncHttpClient(); RequestParams params3 = new RequestParams(); File file = new File(uploadMsgPic); try { File f = new File(uploadMsgPic.replace(".", "1.")); f.createNewFile(); //Convert bitmap to byte array Bitmap bitmap = decodeFile(file,400); ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0 /*ignored for PNG*/, bos); byte[] bitmapdata = bos.toByteArray(); //write the bytes in file FileOutputStream fos = new FileOutputStream(f); fos.write(bitmapdata); params3.put("file", f); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } params3.put("email", preferences.getString("loggedin_user", "")); params3.put("webversion", "1"); client3.post("http://peekatu.com/apiweb/msgPic_upload.php",params3, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { Log.v("response", "Upload Complete"); refreshChat(); //responseString = response; Log.v("response","msgPic has been uploaded"+response); //parseChatMessages(response); response=picurl; uploadMsgPic = ""; if(picurl!=null){ Log.v("response","picurl is set"); } if(picurl==null){ Log.v("response", "picurl no ready"); }; } }); sendMessage(); } } 2nd Method public void sendMessage(){ final SharedPreferences preferences = this.getActivity().getSharedPreferences("MyPreferences", getActivity().MODE_PRIVATE); if(preferences.getString("Username", "").length()<=0){ editText1.setText(""); Toast.makeText(this.getActivity(), "Please Login to send messages.", 2); return; } AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); if(type.equalsIgnoreCase("3")){ params.put("toid",user); params.put("action", "sendprivate"); }else{ params.put("room", preferences.getString("selected_room", "Adult Lobby")); params.put("action", "insert"); } Log.v("response", "Sending message "+editText1.getText().toString()); params.put("message",editText1.getText().toString() ); params.put("media", picurl); params.put("email", preferences.getString("loggedin_user", "")); params.put("webversion", "1"); client.post("http://peekatu.com/apiweb/messagetest.php",params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { refreshChat(); //responseString = response; Log.v("response", response); //parseChatMessages(response); if(picurl!=null) Log.v("response", picurl); } }); editText1.setText(""); lv.setSelection(adapter.getCount() - 1); }

    Read the article

  • Is x a reserved keyword in Javascript FF/Safari not in IE?

    - by Marco Demaio
    A web page of a web application was showing a strange error. I regressively removed all the HTML/CSS/JS code and arrived to the basic and simple code below. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html><head> <title>test</title> <script type="text/javascript"> var TestObj = { foo: function() {} } alert(x); //ok displays "undefined" var x = TestObj.foo; var z = TestObj.foo; </script> </head><body> <p onclick='alert(x);'>Click shows function foo!</p> <img onclick='alert(x);' alt='CRAZY click displays a number in FF/Safari not function foo' src='' style='display: block; width: 100px; height: 100px; border: 1px solid #00ff00;'> <p onclick='alert(x);'>Click shows function foo!</p> </body></html> It's crazy: when clicking on P elements the string "function(){}" is displaied as expected. But when clicking on IMG element it shows a number as if x function got in some way removed from memory or deinstantiated (it does not even show x as "undefined" but as a number). To let you test it quickly I placed the working test above also here. This can be reproduced on both Firefox 3.6 and Safari 4.0.4. Everything works properly only on IE7+. I'm really clueless, I was wondering if x is maybe a reserved keyword in JS Firefox/Safari. Thanks to anyone who could help! FYI: if you repalce x() with z() everything work prefectly in all browsers (this is even more crazy to me) adding a real image in src attribute does not fix the problem removing style in img does not fix the problem (i gave style to image only to help you clicking on image thus you can see the imnage border)

    Read the article

  • Extjs Dynamic Grid

    - by rkenshin
    Hi, I'm trying to create a dynamic grid using Extjs. The grid is built and displayed when a click event is fired then an ajax request is sent to the server to fetch the columns, records and records definition a.k.a Store Fields. Each node could have different grid structure and that depends on the level of the node in the tree. The only way i came up with so far is function showGrid(response, request) { var jsonData = Ext.util.JSON.decode(response.responseText); var grid = Ext.getCmp('contentGrid'+request.params.owner); if(grid) { grid.destroy(); } var store = new Ext.data.ArrayStore({ id : 'arrayStore', fields : jsonData.recordFields, autoDestroy : true }); grid = new Ext.grid.GridPanel({ defaults: {sortable:true}, id:'contentGrid'+request.params.owner, store: store, columns: jsonData.columns, //width:540, //height:200, loadMask: true }); store.loadData(jsonData.records); if(Ext.getCmp('tab-'+request.params.owner)) { Ext.getCmp('tab-'+request.params.owner).show(); } else { grid.render('grid-div'); Ext.getCmp('card-tabs-panel').add({ id:'tab-'+request.params.owner, title: request.params.text, iconCls:'silk-tab', html:Ext.getDom('grid-div').innerHTML, closable:true }).show(); } } The function above is called when a click event is fired 'click': function(node) { Ext.Ajax.request({ url: 'showCtn', success: function(response, request) { alert('Success'); showGrid(response,request); }, failure: function(results, request) { alert('Error'); }, params: Ext.urlDecode(node.attributes.options); } The problem i'm getting with this code is that a new grid is displayed each time the showGrid function is called. The end user sees the old grids and the new one. To mitigate this problem, I tried destroying the grid and also removing the grid element on each request, and that seems to solve the problem only that records never get displayed this time. if(grid) { grid.destroy(true); } The behavior i'm looking for is to display the result of a grid within a tab and if that tab exists replaced the old grid. Any help is appreciated. Thank you

    Read the article

  • DBExpress connecting SQL 2008 at runtime with Delphi 2009

    - by Pascal
    Hi, I'm trying to connect at runtime with SQL Server 2008 with Delphi 2009 using DBExpress, it it's not working. When I set all the properties at design time, it works great, but at RunTime, I'm getting "unknown driver: mssql". Below is the code: scnConexao := TSQLConnection.Create(nil); scnConexao.DriverName := 'MSSQL'; scnConexao.ConnectionName := 'MSSQLConnection'; scnConexao.GetDriverFunc := 'getSQLDriverMSSQL'; scnConexao.LibraryName := 'dbxmss.dll'; scnConexao.VendorLib := 'oledb'; scnConexao.LoginPrompt := False; scnConexao.Params.Add('SchemaOverride=sa.dbo'); scnConexao.Params.Add('HostName=DESKTOP'); scnConexao.Params.Add('DataBase=DBNAME'); scnConexao.Params.Add('OS Authentication=False'); scnConexao.Params.Add('User_Name=UserName'); scnConexao.Params.Add('Password=Password'); scnConexao.Params.Add('MSSQL TransIsolation=ReadCommited'); scnConexao.Open; I have included the dbxmss.dll in the same directory as my app, but to no avail. Any help would be greatly appreciated. Tks

    Read the article

  • How to use Java varargs with the GWT Javascript Native Interface? (aka, "GWT has no printf()")

    - by markerikson
    I'm trying to quickly learn GWT as part of a new project. I found out that GWT doesn't implement Java's String.format() function, so there's no printf()-like functionality. I knew that some printf() implementations exist for Javascript, so I figured I could paste one of those in as a GWT Javascript Native Interface function. I ran into problems, and decided I'd better make sure that the varargs values were being passed in correctly. That's where things got ugly. First, some example code: // From Java, call the JSNI function: test("sourceString", "params1", "params2", "params3"); .... public static native void test(Object... params) /*-{ // PROBLEM: this kills GWT! // alert(params.length); // returns "function" alert(typeof(params)); // returns "[Ljava.lang.Object;@b97ff1" alert(params); }-*/; The GWT docs state that "calling a varargs JavaScript method from Java will result in the callee receiving the arguments in an array". I figured that meant I could at least check params.length, but accessing that throws a JavascriptException wrapped in an UmbrellaException, with no real information. When I do "typeof(params)", it returns "function". As if that weren't odd enough, if I check the string value of params, it returns what appears to be a string version of a Java reference. So, I guess I'm asking a few different questions here: 1) How do GWT/JSNI varargs actually work, and do I need to do something special to pass in values? 2) What is actually going on here? 3) Is there any easier way to get printf()-style formatting in a GWT application?

    Read the article

  • Javascript: Whitespace Characters being Removed in Chrome (but not Firefox)

    - by Matrym
    Why would the below eliminate the whitespace around matched keyword text when replacing it with an anchor link? Note, this error only occurs in Chrome, and not firefox. For complete context, the file is located at: http://seox.org/lbp/lb-core.js To view the code in action (no errors found yet), the demo page is at http://seox.org/test.html. Copy/Pasting the first paragraph into a rich text editor (ie: dreamweaver, or gmail with rich text editor turned on) will reveal the problem, with words bunched together. Pasting it into a plain text editor will not. // Find page text (not in links) -> doxdesk.com function findPlainTextExceptInLinks(element, substring, callback) { for (var childi= element.childNodes.length; childi-->0;) { var child= element.childNodes[childi]; if (child.nodeType===1) { if (child.tagName.toLowerCase()!=='a') findPlainTextExceptInLinks(child, substring, callback); } else if (child.nodeType===3) { var index= child.data.length; while (true) { index= child.data.lastIndexOf(substring, index); if (index===-1 || limit.indexOf(substring.toLowerCase()) !== -1) break; // don't match an alphanumeric char var dontMatch =/\w/; if(child.nodeValue.charAt(index - 1).match(dontMatch) || child.nodeValue.charAt(index+keyword.length).match(dontMatch)) break; // alert(child.nodeValue.charAt(index+keyword.length + 1)); callback.call(window, child, index) } } } } // Linkup function, call with various type cases (below) function linkup(node, index) { node.splitText(index+keyword.length); var a= document.createElement('a'); a.href= linkUrl; a.appendChild(node.splitText(index)); node.parentNode.insertBefore(a, node.nextSibling); limit.push(keyword.toLowerCase()); // Add the keyword to memory urlMemory.push(linkUrl); // Add the url to memory } // lower case (already applied) findPlainTextExceptInLinks(lbp.vrs.holder, keyword, linkup); Thanks in advance for your help. I'm nearly ready to launch the script, and will gladly comment in kudos to you for your assistance.

    Read the article

  • java oracle syntax error?

    - by murali
    hi, i am using the following code for the uploading keywords & count to the excel file. i am having the keyword_id as primary key for that one i had written sentence...i am having the twocolumns in the excel file..1.keyword 2.count my code is: while (rs.next()) { System.out.println("inside "); String keyword = rs.getString(1); int count = rs.getInt(2); System.out.println("insert into SEARCHABLE_KEYWORDS values ('"+ keyword+"','"+count+"')"); stmtdb.execute("insert into SEARCHABLE_KEYWORDS (keyword_id,keyword,count) values ('"+ "select Searchable_Keywords_sequence.nextval from dual"+ "','"+keyword+"','"+count+"')"); System.out.println(keyword + " " + keyword+" count "+count); } but I am getting the following error: java.sql.SQLException: [Microsoft][ODBC Excel Driver] Too few parameters. Expected 1. at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6998) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7155) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3151) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:378) at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:284) at keywordsreader.main(keywordsreader.java:42) please help to slove this problem...

    Read the article

  • PHP 5.3 and interface \ArrayAccess

    - by Jakub Lédl
    I'm now working on a project and I have one class that implements the ArrayAccess interface. Howewer, I'm getting an error that says that my implementation: must be compatible with that of ArrayAccess::offsetSet(). My implementation looks like this: public function offsetSet($offset, $value) { if (!is_string($offset)) { throw new \LogicException("..."); } $this->params[$offset] = $value; } So, to me it looks like my implementation is correct. Any idea what is wrong? Thanks very much! The class look like this: class HttpRequest implements \ArrayAccess { // tons of private variables, methods for working // with current http request etc. Really nothing that // could interfere with that interface. // ArrayAccess implementation public function offsetExists($offset) { return isset ($this->params[$offset]); } public function offsetGet($offset) { return isset ($this->params[$offset]) ? $this->params[$offset] : NULL; } public function offsetSet($offset, $value) { if (!is_string($offset)) { throw new \LogicException("You can only assing to params using specified key."); } $this->params[$offset] = $value; } public function offsetUnset($offset) { unset ($this->params[$offset]); } }

    Read the article

  • Chache problem running two consecutive HTTP GET requests from an APP1 to an APP2

    - by user502052
    I use Ruby on Rails 3 and I have 2 applications (APP1 and APP2) working on two subdomains: app1.domain.local app2.domain.local and I am tryng to run two consecutive HTTP GET requests from APP1 to APP2 like this: Code in APP1 (request): response1 = Net::HTTP.get( URI.parse("http://app2.domain.local?test=first&id=1") ) response2 = Net::HTTP.get( URI.parse("http://app2.domain.local/test=second&id=1") ) Code in APP2 (response): respond_to do |format| if <model_name>.find(params[:id]).<field_name> == "first" <model_name>.find(params[:id]).update_attribute ( <field_name>, <field_value> ) format.xml { render :xml => <model_name>.find(params[:id]).<field_name> } elsif <model_name>.find(params[:id]).<field_name> == "second" format.xml { render :xml => <model_name>.find(params[:id]).<field_name> } end end After the first request I get the correct XML (response1 is what I expect), but on the second it isn't (response2 isn't what I expect). Doing some tests I found that the second time that <model_name>.find(params[:id]).<field_name> run (for the elsif statements) it returns always a blank value so that the code in the elseif statement is never run. Is it possible that the problem is related on caching <model_name>.find(params[:id]).<field_name>? P.S.: I read about eTag and Conditional GET, but I am not sure that I must use that approach. I would like to keep all simple.

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >