Daily Archives

Articles indexed Wednesday January 5 2011

Page 25/35 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • rhythmbox plugin code for hot key not working

    - by Bunny Rabbit
    def activate(self,shell): self.shell = shell self.copy_selected() self.action = gtk.Action ('foo','bar','baz',None) self.activate_id = self.action.connect ('activate', self.call_bk_fn,self.shell) self.action_group = gtk.ActionGroup ('hot_key_action_group') self.action_group.add_action_with_accel (self.action, "<control>E") uim = shell.get_ui_manager () uim.insert_action_group (self.action_group, 0) uim.ensure_update () def call_bk_fn(): print('hello world') i am using the above code in a plugin for rhythmbox ,and here i am trying to register the key ctr+e so that the call_bk_fn gets called whenever the key combination is pressed , but its not working why is that so ?

    Read the article

  • SEO one longer page vs. several targeted subpages?

    - by Travis
    We're working on a site and have come to a choice between one long (not too excessive) main page and several subpages. The subpages would have custom metas/titles/h2 tags and the content that corresponds to them. The main page would have all the content and many more inbound links (pagerank) and with longer content encompassing the content we'd put on the shorter pages. Which would be better for seo and traffic in general? Both schemes are very usable to the user although we are a little concerned with duplicate content (the page's header/footer and other elements remain the same)

    Read the article

  • Firefox stalls on rendering when chrome doesn't

    - by amccormack
    I have a webpage that loads quickly 100% of the time in chrome, but only 10% or so of the time in Firefox. Looking at the fiddler capture, Firefox only loads 2 of the 100ish files being pulled before it hangs. The error does not seem to be on the server or network side, however, because Chrome never encounters a problem. How do I find the root of this stall? While I suspect Firefox's javascript execution is what is causing the hang, are there any particular methods to narrow down the search for the bad code?

    Read the article

  • Django - need to split a table across multiple locations [closed]

    - by MikeRand
    Hi all, I have a Django project to track our company's restructuring projects. Here's the very simple model: class Project(models.Model): code = models.CharField(max_length=30) description = models.CharField(max_length=60) class Employee(models.Model): project = models.ForeignKey(Project) employee_id = models.IntegerField() country_code = models.CharField(max_length=3) severance = models.IntegerField() Due to regulations in some European countries, I'm not allowed to keep employee-level severance information in a database that sits on a box outside of that country. In Django, how do I manage the need to have my Employee table split across multiple databases based on an Employee attribute (i.e. country_code) in a way that doesn't impact anything else in the project (e.g. views, templates, admin)? Thanks, Mike

    Read the article

  • Razor View Engine and jQuery

    - by rjovic
    Hi, does anybody know how to force Razor View engine to print exact line which is under foreach loop. Code follows : @section head{ <script type="text/javascript" src="@Url.Content("~/Content/Scripts/jquery-1.4.1.js")"></script> <script type="text/javascript" src="@Url.Content("~/Content/Scripts/jquery.progressbar.min.js")"></script> <script type="text/javascript"> $(document).ready(function() { @foreach(var player in Model) { jQuery("#pb@PlayerID").progressBar(); } }); </script> } I tried using $() and jQuery() but in both case razor don't know what to do. Is there any way to force him to print exact this : jQuery("#pb@PlayerID").progressBar(); . I want to have something like this : $(document).ready(function() { $("#pb1").progressBar(); $("#pb2").progressBar(); $("#pb3").progressBar(); }); Thank you in advance!

    Read the article

  • How to hold payment in paygate for a while?

    - by Fero
    HI all, I have a query regarding holding the payment in PAYGATE PAYMENT GATEWAY. Here is the problem in brief. I am doing a website where the payment should be made only a certain members buy the product. For Example if there is an iPhone in my site, then that particular phone must be buy by certain quantities which given by admin. It may be done one by one user or a single user can buy all the quantities at a single time. In this case as a developer how can i able to hold the payment which received by user? Because i don't want to receive the payments until the certain quantities bought. Because if certain quantities were not buy i need to refund the money to their account. We don't like to do this process. That's why we are looking for holding the payment. Is it possible or what is the best way to solve this problem? Please let me know what is you professional opinion? thanks in advance... Please let me know what is you professional opinion?

    Read the article

  • Indexing affects only the WHERE clause?

    - by andre matos
    If I have something like: CREATE INDEX idx_myTable_field_x ON myTable USING btree (field_x); SELECT COUNT(field_x), field_x FROM myTable GROUP BY field_x ORDER BY field_x; Imagine myTable with around 500,000 rows and most of field_x values being unique. Since I don't use any WHERE clause, will the created index have any effect at all in my query? Edit: I'm asking this question because I don't get any relevant difference between query-times before and after creating the index; They always take about 8 seconds (which, of course is too much time!). Is this behaviour expected?

    Read the article

  • Possibly simple PHP/MYSQL issue with retrieving and showing data

    - by envoys
    I have been racking my brains over this for a while now. Here is the data i have in the sql data base as an example: ID | TYPE | DATA 1 | TXT | TEST 2 | PHP | php 3 | JS | JAVASCRIPT That is just an example, there are multiple listing for TXT, PHP and JS throughout the table. What I want to do is retrive all the data and display it all into separate drop down/select boxes. Meaning, select box one would list all data with type TXT, select box two would list all data with type PHP and select box 3 would list all data with type JS. The only way I have came about doing this is doing individual sql queries for each different type. I know there is a way to do it all in 1 query and then display it the way I want to but I just can't seem to figure out how and I know its going to drive me nuts when someone helps and I see just how they did it. Thanks for the input.

    Read the article

  • JavaScript, transform object into array

    - by Šime Vidas
    I've got an object: var obj = { "Mike": 24, "Peter": 23, "Simon": 33, "Tom": 12, "Frank": 31 }; I want to create an array that holds the values of the object. The keys (key names) can be disregarded: [24, 23, 33, 12, 31] The order of the values is NOT important! One solution (obviously) would be do have a function that takes the values and puts them into an array: var arr = valuesToArray(obj); I will accept such a function as the answer. However, I would be more pleased if there would be an API function (ECMAScript, jQuery, browser-specific, ...) that could do this. Is there such a thing?

    Read the article

  • PHP Image content type problem

    - by Mirko
    Hi everybody, I have a specific problem, and cant get over it. For my latest project I need a simple PHP script that display an image according to its ID sent through URL. Here's the code: header("Content-type: image/jpeg"); $img = $_GET["img"]; echo file_get_contents("http://www.somesite.hr/images/$img"); The problem is that the image doesn't show although the browser recognizes it (i can see it in the page title), instead I get the image URL printed out. It doesn't work neither on a server with remote access allowed nor with one without. Also, nothing is printed or echoed before the header. I wonder if it is a content type error, or something else. Thanks in advance.

    Read the article

  • Display selectedAnnotation info

    - by elife_iPhone
    When I use this: - (void)mapView:(MKMapView *)myMapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control { NSLog(@"SelectedAnnotations is %@", myMapView.selectedAnnotations); } It Displays this in the log. "<Annotation: 0x586cdb0>" Now this is a weird question, but how do I get the info from this Annotation? I have lost my mind. This is what is in the annotation. myAnnotation = [[Annotation alloc] init]; myAnnotation.dealName=[NSString stringWithFormat:@"%@",[tempValue objectForKey:@"name"]]; myAnnotation.subName=[NSString stringWithFormat:@"Price: $%@",[tempValue objectForKey:@"price"]]; myAnnotation.latitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLatitude"] doubleValue]]; myAnnotation.longitude = [NSNumber numberWithDouble:[[tempValue objectForKey:@"dealLongitude"] doubleValue]]; myAnnotation.dealId = [NSNumber numberWithInt:[ [tempValue objectForKey:@"dId"] intValue ]]; Thanks for your help.

    Read the article

  • GWT: how to have different styles for splitters in different SplitLayoutPanels?

    - by user26270
    I know you can change the styles of the splitters with the defaults styles listed in the docs: .gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-HDragger { horizontal dragger } .gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-VDragger { vertical dragger } and we've done that in earlier development. However, now I'm developing new stuff and would like to use a different style for the splitters in a new SplitLayoutPanel. Unfortunately, we haven't or can't split the app into different modules, which might make this easier. I tried creating a new style and applying it to my new SplitLayoutPanel, but it didn't appear to have any effect on the splitters. I thought there might be a method to get a handle on the splitters in order to apply the new style to only them, but I didn't find any such method.

    Read the article

  • How can I align the left edge of HTML form elements using CSS?

    - by Naor
    I want to do the following: aa: ________ bbbb: ________ ccc: ________ So I wrote: <span>aa:</span><input type="text" /><br/> <span>bbbb:</span><input type="text" /><br/> <span>cc:</span><input type="text" /> And I get: aa:________ bbbb:________ ccc:________ I know I can arrange it easy with table. How do I do it without tables with as few css as I can. Thanks.

    Read the article

  • Converting a selected date from a datetimepicker into my query, along with subtracting a day

    - by MyHeadHurts
    I am currently using this to get yesterdays date, however i need to do something similar where the user will use a javascript datetimepicker in my asp.net page and i will then use the date they select instead of just yesterdays date Declare @dayselection int set @dayselection = CONVERT(int,DateAdd(year, @YearToGet - Year(getdate() + 1), DateAdd(day, DateDiff(day, 1, @dayToGet), 1) , DateAdd(month, DateDiff(month, 0, @monthToGet), 0) ) but it isnt working i keep getting syntax errors I want the day and year functions to stay the same i just need help with the month part. I need to convert the selected date into an int

    Read the article

  • Help me clean up this crazy lambda with the out keyword

    - by Sarah Vessels
    My code looks ugly, and I know there's got to be a better way of doing what I'm doing: private delegate string doStuff( PasswordEncrypter encrypter, RSAPublicKey publicKey, string privateKey, out string salt ); private bool tryEncryptPassword( doStuff encryptPassword, out string errorMessage ) { ...get some variables... string encryptedPassword = encryptPassword(encrypter, publicKey, privateKey, out salt); ... } This stuff so far doesn't bother me. It's how I'm calling tryEncryptPassword that looks so ugly, and has duplication because I call it from two methods: public bool method1(out string errorMessage) { string rawPassword = "foo"; return tryEncryptPassword( (PasswordEncrypter encrypter, RSAPublicKey publicKey, string privateKey, out string salt) => encrypter.EncryptPasswordAndDoStuff( // Overload 1 rawPassword, publicKey, privateKey, out salt ), out errorMessage ); } public bool method2(SecureString unencryptedPassword, out string errorMessage) { return tryEncryptPassword( (PasswordEncrypter encrypter, RSAPublicKey publicKey, string privateKey, out string salt) => encrypter.EncryptPasswordAndDoStuff( // Overload 2 unencryptedPassword, publicKey, privateKey, out salt ), out errorMessage ); } Two parts to the ugliness: I have to explicitly list all the parameter types in the lambda expression because of the single out parameter. The two overloads of EncryptPasswordAndDoStuff take all the same parameters except for the first parameter, which can either be a string or a SecureString. So method1 and method2 are pretty much identical, they just call different overloads of EncryptPasswordAndDoStuff. Any suggestions? Edit: if I apply Jeff's suggestions, I do the following call in method1: return tryEncryptPassword( (encrypter, publicKey, privateKey) => { var result = new EncryptionResult(); string salt; result.EncryptedValue = encrypter.EncryptPasswordAndDoStuff( rawPassword, publicKey, privateKey, out salt ); result.Salt = salt; return result; }, out errorMessage ); Much the same call is made in method2, just with a different first value to EncryptPasswordAndDoStuff. This is an improvement, but it still seems like a lot of duplicated code.

    Read the article

  • ndarray field names for both row and column?

    - by Graham Mitchell
    I'm a computer science teacher trying to create a little gradebook for myself using NumPy. But I think it would make my code easier to write if I could create an ndarray that uses field names for both the rows and columns. Here's what I've got so far: import numpy as np num_stud = 23 num_assign = 2 grades = np.zeros(num_stud, dtype=[('assign 1','i2'), ('assign 2','i2')]) #etc gv = grades.view(dtype='i2').reshape(num_stud,num_assign) So, if my first student gets a 97 on 'assign 1', I can write either of: grades[0]['assign 1'] = 97 gv[0][0] = 97 Also, I can do the following: np.mean( grades['assign 1'] ) # class average for assignment 1 np.sum( gv[0] ) # total points for student 1 This all works. But what I can't figure out how to do is use a student id number to refer to a particular student (assume that two of my students have student ids as shown): grades['123456']['assign 2'] = 95 grades['314159']['assign 2'] = 83 ...or maybe create a second view with the different field names? np.sum( gview2['314159'] ) # total points for the student with the given id I know that I could create a dict mapping student ids to indices, but that seems fragile and crufty, and I'm hoping there's a better way than: id2i = { '123456': 0, '314159': 1 } np.sum( gv[ id2i['314159'] ] ) I'm also willing to re-architect things if there's a cleaner design. I'm new to NumPy, and I haven't written much code yet, so starting over isn't out of the question if I'm Doing It Wrong. I am going to be needing to sum all the assignment points for over a hundred students once a day, as well as run standard deviations and other stats. Plus, I'll be waiting on the results, so I'd like it to run in only a couple of seconds. Thanks in advance for any suggestions.

    Read the article

  • Mysql search design

    - by neil
    I'm designing a mysql database, and i'd like some input on an efficient way to store blog/article data for searching. Right now, I've made a separate column that stores the content to be searched - no duplicate words, no words shorter than four letters, and no words that are too common. So, essentially, it's a list of keywords from the original article. Also searched would be a list of tags, and the title field. I'm not quite sure how mysql indexes fulltext columns, so would storing the data like that be ineffective, or redundant somehow? A lot of the articles are on the same topic, so would the score be hurt by so many of the rows having similar keywords? Also, for this project, solutions like sphinx, lucene or google custom seach can't be used -- only php & mysql. Thanks!

    Read the article

  • rb plugin the hot key not working

    - by Bunny Rabbit
    def activate(self,shell): self.shell = shell self.action = gtk.Action ('foo','bar','baz',None) self.activate_id = self.action.connect ('activate', self.call_bk_fn,self.shell) self.action_group = gtk.ActionGroup ('hot_key_action_group') self.action_group.add_action_with_accel (self.action, "<control>E") uim = shell.get_ui_manager () uim.insert_action_group (self.action_group, 0) uim.ensure_update () def call_bk_fn(self,shell): print('hello world') i am using the above code in a plugin for rhythmbox ,and here i am trying to register the key ctr+e so that the call_bk_fn gets called whenever the key combination is pressed , but its not working why is that so ?

    Read the article

  • NHibernate 3 and MySQL setup tutorial

    - by ryanzec
    Since I have given up on using the entity framework 4 as my ORM (getting it to work with MySQL and mapping table/field names like this_table/this_field to object naming like ThisTable/ThisField is POCO) I am now looking at NHibernate as it seems the the next big well know ORM for C# that probably with not die off any time soon. I am trying to lookup some tutorials and a lot of them in the configuration section have 2-2 in it and was wondering if those configuration would work with NHibernate 3? I am just curious if the 2-2 refers to the version of NHibernate or something different.

    Read the article

  • Combining 2 Mysql update statments(same col, different values, different conditions)

    - by Paul Atkins
    Hi guys, I have been doing some searching but have not been able to find an answer for this so thought I would ask here as the people here know everything :) I am trying to combine these 2 update queries into one query. UPDATE addresses SET is_default='0' WHERE id!='1' UPDATE addresses SET is_default='1' WHERE id='1' I assume this should be too hard to accomplish but i cant seem to work it out :( Thanks Paul

    Read the article

  • Jquery append input for 2 different input-sections

    - by Email
    Hi i use the following simple jquery script to append input. Source http://muiomuio.com/web-design/add-remove-items-with-jquery <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Add and Remove - jQuery tutorial</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { var i = $('input').size() + 1; $('a.add').click(function() { $('<p><input type="text" value="input ' + i + '" name="input_field'+ i +'" /></p>').animate({ opacity: "show" }, "slow").appendTo('#inputs'); i++; }); $('a.remove').click(function() { if(i > 2) { $('input:last').animate({opacity:"hide"}, "slow").remove(); i--; } }); $('a.reset').click(function() { while(i > 2) { $('input:last').remove(); i--; } }); }); </script> </head> <body> <h1>Add / remove text fields from webform</h1> <a href="#" class="add"><img src="add.png" width="24" height="24" alt="add" title="add input" /></a> <a href="#" class="remove"><img src="remove.png" width="24" height="24" alt="remove input" /></a> <a href="#" class="reset"><img src="reset.png" width="24" height="24" alt="reset" /></a> <div id="inputs"> <p> <input type="text" value="input 1" name="input_field1"> </p> </div> </div> </body> </html> I know want to add more input fields so i add this html <div id="outputs"> <p> <input type="text" value="output 1" name="output_field1"> </p> how can i achieve that the var i = $('input').size() + 1; will be individually for every input section? EDITED: the full script is the following. copy and paste will get you a full clone of mine. Problem still exists <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Add and Remove - jQuery tutorial</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { var i = $('input').size() + 1; $('a.add').click(function() { $('<p><input type="text" value="input ' + i + '" name="input_field'+ i +'" /></p>').animate({ opacity: "show" }, "slow").appendTo('#inputs'); i++; }); $('a.remove').click(function() { if(i > 2) { $('input:last').animate({opacity:"hide"}, "slow").remove(); i--; } }); $('a.reset').click(function() { while(i > 2) { $('input:last').remove(); i--; } }); $('a.add_o').click(function() { $('<p><input type="text" value="output ' + i + '" name="input_field'+ i +'" /></p>').animate({ opacity: "show" }, "slow").appendTo('#outputs'); i++; }); $('a.remove_o').click(function() { if(i > 2) { $('input:last').animate({opacity:"hide"}, "slow").remove(); i--; } }); $('a.reset_o').click(function() { while(i > 2) { $('input:last').remove(); i--; } }); }); </script> <style rel="stylesheet" type="text/css"> h1 { font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;} .hide {visibility:hidden;} img {border:none;} input { width:500px; height:20px; padding:10px; background:#f7f7f7; border:1px solid #f0f0f0; color:#333; font-size:20px; text-align:center; line-height:120px; margin:0; -moz-border-radius:5px; -webkit-border-radius:5px; } #inputs { width:520px; padding:0px 20px; border:1px solid #f0f0f0; -moz-border-radius:20px; -webkit-border-radius:20px; } </style> </head> <body> <h1>Add / remove text fields from webform</h1> <a href="#" class="add"><img src="http://muiomuio.com/tutorials/jquery/add-remove/add.png" width="24" height="24" alt="add" title="add input" /></a> <a href="#" class="remove"><img src="http://muiomuio.com/tutorials/jquery/add-remove/remove.png" width="24" height="24" alt="remove input" /></a> <a href="#" class="reset"><img src="http://muiomuio.com/tutorials/jquery/add-remove/reset.png" width="24" height="24" alt="reset" /></a> <div id="inputs"> <p> <input type="text" value="input 1" name="input_field1"> </p> </div> <a href="#" class="add_o"><img src="http://muiomuio.com/tutorials/jquery/add-remove/add.png" width="24" height="24" alt="add" title="add input" /></a> <a href="#" class="remove_o"><img src="http://muiomuio.com/tutorials/jquery/add-remove/remove.png" width="24" height="24" alt="remove input" /></a> <a href="#" class="reset_o"><img src="http://muiomuio.com/tutorials/jquery/add-remove/reset.png" width="24" height="24" alt="reset" /></a> <div id="outputs"> <p> <input type="text" value="output 1" name="output_field1"> </p> </div> </body> </html>

    Read the article

  • algorithm to generate maximum number of character 'A' using keystrokes 'A', CTRL + 'A', CTRL + 'C' and CTRL + 'V'

    - by munda
    This is an interview question from google. I am not able to solve it by myself. Can somebody throw some light? The question goes like this. Write a program to print the sequence of keystrokes such that it generates the maximum number of character 'A's. You are allowed to use only 4 keys: 'A', CTRL + 'A', CTRL + 'C' and CTRL + 'V'. Only N keystrokes are allowed. All CTRL+ characters are considered as one keystroke, so CTRL+A is one keystroke. e.g.: A, ctrl+A, ctrl+C, ctrl+V generates two As in 4 keystrokes. Edit: CTRL + A is Select All CTRL + C is copy CTRL + V is paste I did some mathematics. For any N, using x numbers of A's , one CTRL+A, one CTRL+C and y CTRL+V, we can generate max ((N-1)/2)^2 numbers of A's. But for some N M, it is better to use as many ^A, ^C and ^V as it doubles the number of As. Edit 2: ^A, ^V and ^C will not overwrite on the existing selection but it will append the copied selection to selected one.

    Read the article

  • Client Side pagination with jQuery

    - by TheNone
    I have tried to write a script for pagination contents of an element with jQuery: <script type="text/javascript"> $(document).ready(function(){ var per_page = 2; var num_item = $('#en1').children().size(); var num_page = Math.ceil(num_item/per_page); $('#current_page').val(0); $('#per_page').val(per_page); var navigation_html = ''; var current = 0; while(num_page > current){ navigation_html += '<a class="page_link" href="javascript:paginate(' + current +')" longdesc="' + current +'">'+ (current + 1) +'</a>'; current++; } $('#page_navigation').html(navigation_html); $('#page_navigation .page_link:first').addClass('active_page'); $('#en1').children().css('display', 'none'); $('#en1').children().slice(0, per_page).css('display', 'block'); }); function paginate(page_num){ var per_page = parseInt($('#per_page').val()); start = page_num * per_page; finish= start + per_page; $('#en1').children().css('display', 'none').slice(start, finish).css('display', 'block'); $('.page_link[longdesc=' + page_num +']').addClass('active_page').siblings('.active_page').removeClass('active_page'); $('#current_page').val(page_num); } </script> http://jsfiddle.net/kqfyL/9/ This script paginate the contents of element by id "en1". I want to paginate 4-5 element (en2, en3, ...). When I insert code inside o document ready in a function, pagination doesnt work: function init(myId){ var ID = document.getElementById("myId"); var per_page = 6; var num_item = $(ID).children().size(); var num_page = Math.ceil(num_item/per_page); $('#current_page').val(0); $('#per_page').val(per_page); var navigation_html = ''; var current = 0; while(num_page > current){ navigation_html += '<a class="page_link" href="javascript:paginate(' + current +')" longdesc="' + current +'">'+ (current + 1) +'</a>'; current++; } $('#page_navigation').html(navigation_html); $('#page_navigation .page_link:first').addClass('active_page'); $('#ID').children().css('display', 'none'); $('#ID').children().slice(0, per_page).css('display', 'block'); } init(en1); What is wrong in init function? Thanks in advance

    Read the article

  • Member function overloading/template specialization issue

    - by Ferruccio
    I've been trying to call the overloaded table::scan_index(std::string, ...) member function without success. For the sake of clarity, I have stripped out all non-relevant code. I have a class called table which has an overloaded/templated member function named scan_index() in order to handle strings as a special case. class table : boost::noncopyable { public: template <typename T> void scan_index(T val, std::function<bool (uint recno, T val)> callback) { // code } void scan_index(std::string val, std::function<bool (uint recno, std::string val)> callback) { // code } }; Then there is a hitlist class which has a number of templated member functions which call table::scan_index(T, ...) class hitlist { public: template <typename T> void eq(uint fieldno, T value) { table* index_table = db.get_index_table(fieldno); // code index_table->scan_index<T>(value, [&](uint recno, T n)->bool { // code }); } }; And, finally, the code which kicks it all off: hitlist hl; // code hl.eq<std::string>(*fieldno, p1.to_string()); The problem is that instead of calling table::scan_index(std::string, ...), it calls the templated version. I have tried using both overloading (as shown above) and a specialized function template (below), but nothing seems to work. After staring at this code for a few hours, I feel like I'm missing something obvious. Any ideas? template <> void scan_index<std::string>(std::string val, std::function<bool (uint recno, std::string val)> callback) { // code }

    Read the article

  • Javascript inheritance: call super-constructor or use prototype chain?

    - by Jeremy S.
    Hi folks, quite recently I read about javascript call usage in MDC https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/call one linke of the example shown below, I still don't understand. Why are they using inheritance here like this Prod_dept.prototype = new Product(); is this necessary? Because there is a call to the super-constructor in Prod_dept() anyway, like this Product.call is this just out of common behaviour? When is it better to use call for the super-constructor or use the prototype chain? function Product(name, value){ this.name = name; if(value >= 1000) this.value = 999; else this.value = value; } function Prod_dept(name, value, dept){ this.dept = dept; Product.call(this, name, value); } Prod_dept.prototype = new Product(); // since 5 is less than 1000, value is set cheese = new Prod_dept("feta", 5, "food"); // since 5000 is above 1000, value will be 999 car = new Prod_dept("honda", 5000, "auto"); Thanks for making things clearer

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >