Search Results

Search found 2593 results on 104 pages for 'meta knight'.

Page 12/104 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • C++. How to define template parameter of type T for class A when class T needs a type A template parameter?

    - by jaybny
    Executor class has template of type P and it takes a P object in constructor. Algo class has a template E and also has a static variable of type E. Processor class has template T and a collection of Ts. Question how can I define Executor< Processor<Algo> > and Algo<Executor> ? Is this possible? I see no way to defining this, its kind of an "infinite recursive template argument" See code. template <class T> class Processor { map<string,T> ts; void Process(string str, int i) { ts[str].Do(i); } } template <class P> class Executor { Proc &p; Executor(P &p) : Proc(p) {} void Foo(string str, int i) { p.Process(str,i); } Execute(string str) { } } template <class E> class Algo { static E e; void Do(int i) {} void Foo() { e.Execute("xxx"); } } main () { typedef Processor<Algo> PALGO; // invalid typedef Executor<PALGO> EPALGO; typedef Algo<EPALGO> AEPALGO; Executor<PALGO> executor(PALGO()); AEPALGO::E = executor; }

    Read the article

  • How to remove Custom Field section from Wordpress?

    - by terrani
    Hi, I am trying to remove custom fields section from Wordpress backend. I think I found a function that display custom fields. The function is located in wp-admin/edit-page-form.php line 181. do_meta_boxes('page','normal',$post) when I remove the function, Wordpress does not display other boxes as well. How do I remove a particular box from Wordpress backend?

    Read the article

  • Efficiently get the size of a parameter pack up to a certain index

    - by NmdMystery
    I want to be able to determine the number of bytes that are in a subset of a parameter pack from 0 to a given index. Right now I'm using a non-constexpr way of doing this. Below is my code: template <size_t index, typename... args> struct pack_size_index; template <size_t index, typename type_t, typename... args> struct pack_size_index <index, type_t, args...> { static const size_t index_v = index; static const size_t value(void) { if (index_v > 0) { return sizeof(type_t) + pack_size_index<index - 1, args...>::value(); } return 0; } }; template <size_t index> struct pack_size_index <index> { static const size_t index_v = index; static const size_t value(void) { return 0; } }; Usage: //output: 5 (equal to 1 + 4) std::cout << pack_size_index<2, bool, float, int, double>::value() << std::endl; //output: 20 (equal to 8 + 8 + 4) std::cout << pack_size_index<3, double, double, float, int>::value() << std::endl; This gets the job done, but this uses runtime comparison and the resulting executable increases in size rapidly whenever this is used. What's a less expensive way of doing this?

    Read the article

  • What's the relationship between meta-circular interpreters, virtual machines and increased performance?

    - by Gomi
    I've read about meta-circular interpreters on the web (including SICP) and I've looked into the code of some implementations (such as PyPy and Narcissus). I've read quite a bit about two languages which made great use of metacircular evaluation, Lisp and Smalltalk. As far as I understood Lisp was the first self-hosting compiler and Smalltalk had the first "true" JIT implementation. One thing I've not fully understood is how can those interpreters/compilers achieve so good performance or, in other words, why is PyPy faster than CPython? Is it because of reflection? And also, my Smalltalk research led me to believe that there's a relationship between JIT, virtual machines and reflection. Virtual Machines such as the JVM and CLR allow a great deal of type introspection and I believe they make great use it in Just-in-Time (and AOT, I suppose?) compilation. But as far as I know, Virtual Machines are kind of like CPUs, in that they have a basic instruction set. Are Virtual Machines efficient because they include type and reference information, which would allow language-agnostic reflection? I ask this because many both interpreted and compiled languages are now using bytecode as a target (LLVM, Parrot, YARV, CPython) and traditional VMs like JVM and CLR have gained incredible boosts in performance. I've been told that it's about JIT, but as far as I know JIT is nothing new since Smalltalk and Sun's own Self have been doing it before Java. I don't remember VMs performing particularly well in the past, there weren't many non-academic ones outside of JVM and .NET and their performance was definitely not as good as it is now (I wish I could source this claim but I speak from personal experience). Then all of a sudden, in the late 2000s something changed and a lot of VMs started to pop up even for established languages, and with very good performance. Was something discovered about the JIT implementation that allowed pretty much every modern VM to skyrocket in performance? A paper or a book maybe?

    Read the article

  • using empty on inaccessible object with __isset and __get

    - by David
    <?php class Magic_Methods { protected $meta; public function __construct() { $this->meta = (object) array( 'test' => 1 ); } public function __isset($name) { echo "pass isset {$name} \n"; return isset($this->$name); } public function __get($name) { echo "pass get {$name} \n"; return $this->$name; } } $mm = new Magic_Methods(); $meta = empty($mm->meta->notExisting); var_dump($meta); echo "||\n"; $meta = empty($mm->meta); var_dump($meta); The snippet above does not work as expected for me. Why would the first empty() ommit the __isset? I get this: pass get meta bool(true) || pass isset meta pass get meta bool(false) I would expected identical results or another pass at the __isset, but not a direct call to __get. Or am I missing something here?

    Read the article

  • ASP.NET MVC localization DisplayNameAttribute alternatives: a better way

    - by Brian Schroer
    In my last post, I talked bout creating a custom class inheriting from System.ComponentModel.DisplayNameAttribute to retrieve display names from resource files: [LocalizedDisplayName("RememberMe")] public bool RememberMe { get; set; } That’s a lot of work to put an attribute on all of my model properties though. It would be nice if I could intercept the ASP.NET MVC code that analyzes the model metadata to retrieve display names to make it automatically get localized text from my resource files. That way, I could just set up resource file entries where the keys are the property names, and not have to put attributes on all of my properties. That’s done by creating a custom class inheriting from System.Web.Mvc.DataAnnotationsModelMetadataProvider: 1: public class LocalizedDataAnnotationsModelMetadataProvider : 2: DataAnnotationsModelMetadataProvider 3: { 4: protected override ModelMetadata CreateMetadata( 5: IEnumerable<Attribute> attributes, 6: Type containerType, 7: Func<object> modelAccessor, 8: Type modelType, 9: string propertyName) 10: { 11: var meta = base.CreateMetadata 12: (attributes, containerType, modelAccessor, modelType, propertyName); 13:   14: if (string.IsNullOrEmpty(propertyName)) 15: return meta; 16:   17: if (meta.DisplayName == null) 18: GetLocalizedDisplayName(meta, propertyName); 19:   20: if (string.IsNullOrEmpty(meta.DisplayName)) 21: meta.DisplayName = string.Format("[[{0}]]", propertyName); 22:   23: return meta; 24: } 25:   26: private static void GetLocalizedDisplayName(ModelMetadata meta, string propertyName) 27: { 28: ResourceManager resourceManager = MyResource.ResourceManager; 29: CultureInfo culture = Thread.CurrentThread.CurrentUICulture; 30:   31: meta.DisplayName = resourceManager.GetString(propertyName, culture); 32: } 33: } Line 11 calls the base CreateMetadata method. Line 17 checks whether the metadata DisplayName property has already been populated by a DisplayNameAttribute (or my LocalizedDisplayNameAttribute). If so, it respects that and doesn’t use my custom localized text lookup. The GetLocalizedDisplayName method checks for the property name as a resource file key. If found, it uses the localized text from the resource files. If the key is not found in the resource file, as with my LocalizedDisplayNameAttribute, I return a formatted string containing the property name (e.g. “[[RememberMe]]”) so I can tell by looking at my web pages which resource keys I haven’t defined yet. It’s hooked up with this code in the Application_Start method of Global.asax: ModelMetadataProviders.Current = new LocalizedDataAnnotationsModelMetadataProvider();

    Read the article

  • facebook og:image not working [closed]

    - by zeinab
    When I try to post a comment (share link) on an article from my page which is actually a page I am using as an application in Facebook: https://apps.facebook.com/ids_newsletter/, Facebook chooses the feed thumbnail image of the post feed randomly from my page. I tried using below to put a custom image for the post but nothing affected the post thumbnail. So what should I do? <meta property="og:title" content="IDS June Newsletter" /> <meta property="og:description" content="Check this out" /> <meta property="og:image" content="MYSITEURL/Images/logobig.png" /> <meta property="og:image:type" content="image/png" /> <meta property="og:image:width" content="200" /> <meta property="og:image:height" content="200" />

    Read the article

  • [Wordpress] How do I return values from custom created meta box?

    - by Steven
    I've just followed this example from Wordpress and I have successfully added an extra Meta Box in Post interface, and the value is stored in DB. Now my question is, how can I retrieve and display the content of this meta box? I'm trying the following code: $intro = get_post_meta($post->ID, 'post_intro', true); echo $intro; But I get nada. What am I doing wrong? And while I'm here, does anybody know if I can place this extra meta box above the default text box in Wordpress post page?

    Read the article

  • Facebook Share doesn't pick up title / description meta tags that are changed after page load.

    - by Memo
    Apparently Facebook Share doesn't pick up the title / description meta tags that are changed (via JavaScript) after the page load. It basically use the meta tags that are available upon load. This is a simple example. The link will change the title / description meta tags upon click. You can confirm that using Firebug. Click the f|Share button: Facebook still always shows "A title that is available upon page load." and "A description that is available upon page load." Anybody knows how to fix this?

    Read the article

  • Nginix upstream with socket seems filter some meta contents?

    - by Cheng
    I have a Rails3 app in the backend, served by ruby server Thin. If I run and map thin as a socket server unix:/tmp/thin.draft.sock; Some meta data in the HTML will be missing. <script src="/javascripts/application.js?1269808943" type="text/javascript"></script> </head> But it should be <script src="/javascripts/application.js?1269808943" type="text/javascript"></script> <meta name="csrf-param" content="authenticity_token"/> <meta name="csrf-token" content="TPEA0Xa92wnPWnRLf+iUTk..."/> </head> If I run and map Thin at some port, it's all correct. server 127.0.0.1:3000; Wired problem. I'm going to check with Thin and Nginx. Any ideas?

    Read the article

  • Meta package / quick reference for command line string manipulation tools?

    - by Dylan McCall
    The latest version of the Scribes text editor lets us select some text, hit Alt+X, and then run an arbitrary command. For example, I can run the sort command and the selected text is replaced appropriately. This is quite useful but I am also not very well-versed in awk and the like. Is there something I can grab that will provide more of these commands like sort? Maybe a package with a whole bunch of handy, task-specific string manipulation commands?

    Read the article

  • Is it a good idea to add robots "noindex" meta tags to deep low content pages, e.g. product model data

    - by Cognize
    I'm considering adding robots "noindex, follow" tags to the very numerous product data pages that are linked from the product style pages in our online store. For example, each product style has a page with full text content on the product: http://www.shop.example/Product/Category/Style/SOME-STYLE-CODE Then many data pages with technical data for each model code is linked from the product style page. http://www.shop.example/Product/Category/Style/SOME-STYLE-CODE-1 http://www.shop.example/Product/Category/Style/SOME-STYLE-CODE-2 http://www.shop.example/Product/Category/Style/SOME-STYLE-CODE-3 It is these technical data pages that I intend to add the no index code to, as I imagine that this might stop these pages from cannibalizing keyword authority for more important content rich pages on the site. Any advice appreciated.

    Read the article

  • Is it good practise to use meta refresh tags for redirects instead of header() function in php?

    - by Kent
    I have to use redirects a lot in my scripts, for example after a user logs in I need to redirect them to the admin area, etc. But I find it inconvenient to always have to have the header function at the very top. So if I use the meta refresh tags for my redirects, is that something that would be frowned upon according to best practices or is it acceptable? function redirect($location) { echo "<meta http-equiv='refresh' content='0; url=$location' />"; }

    Read the article

  • How to do IIS SSL server redirects correctly? Is meta refresh needed?

    - by Jesse
    Hi all! I think our backend programmer/server admin is handling our SSL redirects pretty wonky - see it in action here: www.mchenry.edu/parentorientation First off, see how it redirects to index2.asp? Is this necessary? Can't she easily redirect to the original index.asp but have it be https:// instead? Also, she is using a meta refresh on the original index.asp page to redirect to index2.asp as well, and she says this is for backup, in case the server configs change and the server can't handle the redirect so then the webpage would take over. Finally, she said she tried using the server redirect solely but that it kept looping on itself- what did she do wrong? Is this even possible? Is she giving us a snow job or what? I want a better understanding of what is happening here so I can talk to my boss about it, because this is driving me up the wall. Thanks for any info you can provide.

    Read the article

  • Moose and error messages, the sun and the moon [closed]

    - by xxxxxxx
    So again using Moose I write a role like this: package My::Role; use Moose::Role; use Some::Class::Consuming::My::Role; With the note that Some::Class::Consuming::My::Role consumes the role My::Role; And what do I get ? I get an error message like this: A role generator is required to generate roles at /usr/local/share/perl/5.10.0/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm line 79 MooseX::Role::Parameterized::Meta::Role::Parameterizable::generate_role('MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...', 'consumer', 'Moose::Meta::Class=HASH(0x894e540)', 'parameters', 'HASH(0x86fc1e0)') called at /usr/local/share/perl/5.10.0/MooseX/Role/Parameterized/Meta/Role/Parameterizable.pm line 116 MooseX::Role::Parameterized::Meta::Role::Parameterizable::apply('MooseX::Role::Parameterized::Meta::Role::Parameterizable=HASH...', 'Moose::Meta::Class=HASH(0x894e540)', 'element_type', 'Tuple') called at /usr/local/lib/perl/5.10.0/Moose/Util.pm line 132 Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x894e540)', undef, 'Stuff', 'HASH(0x894e1d0)') called at /usr/local/lib/perl/5.10.0/Moose/Util.pm line 86 Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x894e540)', 'Stuff', 'HASH(0x894e1d0)') called at /usr/local/lib/perl/5.10.0/Moose.pm line 57 Moose::with('Moose::Meta::Class=HASH(0x894e540)', 'Group', 'HASH(0x894e1d0)') called at /usr/local/lib/perl/5.10.0/Moose/Exporter.pm line 293 Moose::with('Group', 'HASH(0x894e1d0)') called at Some_path_on_disk line 6 require Some_other_path_on_disk called at Some_path_on_disk line 9 Group::BEGIN() called at Yet_another_path_on_disk line 0 eval {...} called at Yet_another_path_on_disk line 0 Compilation failed in require at some_path_on_disk line 9. BEGIN failed--compilation aborted at some_path_on_disk line 9. What am I to make of this ? As Dijkstra would concisely describe, this looks like "just a meaningless concatenation of words"(which is exactly what it is). Would a more appropriate error message be "You cannot use a class consuming the role that you are currently defining " ? What does the error message try to convey ? Can the author make the error message meaningful ? Will he ever make it so ? maybe this can be planned for version 3.14159265358979323846 ? In actuality I get one and a half pages of error which is completely unreadable and devoid of any logic or sense of respect for the user that is using Moose (in terms of intuitive error messages) just like the one above. What's to be done in this case ? I mean I get on my screen these error messages that are sometimes completely unrelated to the problem that I'm having (which I can assess after solving the problems that probably caused them, I say probably becuase I have no idea where these error messages came from because they look like they fell from the sky as they have no relation to the actual situation). Is this: the inexplicable dramatic destiny of the Perl programmer using Moose ? someone being extremely lazy and sloppy at writing error messages ? maybe on heavy drugs ? me not understanding basic english ? Gentlemen, when writing software, please please please, take care of the poor programmer that will use it and respect him by writing relevant error messages. (Except for error messages Moose is a pretty good piece of software)

    Read the article

  • jqGrid Sort or Search does not work with columns having json dot notation

    - by rsmoorthy
    I have this jqGrid: $("#report").jqGrid( { url: '/py/db?coll=report', datatype: 'json', height: 250, colNames: ['ACN', 'Status', 'Amount'], colModel: [ {name:'acn', sortable:true}, {name:'meta.status', sortable:true}, {name:amount} ], caption: 'Show Report', rownumbers: true, gridview: true, rowNum: 10, rowList: [10,20,30], pager: '#report_pager', viewrecords: true, sortname: 'acn', sortorder: "desc", altRows: true, loadonce: true, mtype: "GET", rowTotal: 1000, jsonReader: { root: "rows", page: "page", total: "total", records: "records", repeatitems: false, id: "acn" } }); Notice that the column 'meta.status' is in JSON dot notation and accordingly the data sent from the server is like this: {"page": "1", "total": "1", "records": "5", "rows": [ {"acn":1,"meta": {"status":"Confirmed"}, "amount": 50}, {"acn":2,"meta": {"status":"Started"}, "amount": 51}, {"acn":3,"meta": {"status":"Stopped"}, "amount": 52}, {"acn":4,"meta": {"status":"Working"}, "amount": 53}, {"acn":5,"meta": {"status":"Started"}, "amount": 54} ] } The problems are of two fold: Sorting does not work on columns with dot notation, here "meta.status". It does not even show the sortable icons on the column header, and nothing happens even if the header is clicked. Sorting does not work, whether loadonce is true or false. If I try Searching (after setting loadonce to true) for the column meta.status (other columns without dot notation is okay), then it throws up a javascript error like this. Any help? Thanks Moorthy

    Read the article

  • Facebook like button issue.

    - by Ross Hale
    Hello community, We're having some trouble getting our like button to work. It seemed to work last week but suddenly it's stopped working. Basically when clicking "Like", we get an error saying: You failed to provide a valid list of administators. You need to supply the administors using either a "fb:app_id" meta tag, or using a "fb:admins" meta tag to specify a comma-delimited list of Facebook users. Our section looks like this: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/" xmlns:fb="http://www.facebook.com/2008/fbml" xml:lang="en" lang="en"> <head> <meta property="fb:app_id" content="number"/> <meta property="fb:admins" content="number"/> <meta property="og:title" content="title"/> <meta property="og:type" content="website"/> <meta property="og:url" content="url with trailing slash"/> <meta property="og:image" content="url to image"/> <meta property="og:site_name" content="Site Name"/> </head> Help?

    Read the article

  • Sub routing in a SPA site

    - by Anders
    I have a SPA site that I'm working on, I have a requirement that you can have subroutes for a page view model. Im currently using this 'pattern' for the site MyApp.FooViewModel = MyApp.define({ meta: { query: MyApp.Core.Contracts.Queries.FooQuery, title: "Foo" }, init: function (queryResult) { }, prototype: { } }); In the master view model I have a route table this.navigation(new MyApp.RoutesViewModel({ Home: { model: MyApp.HomeViewModel, route: String.empty }, Foo: { model: MyApp.FooViewModel } })); The meta object defines which query should populate the top level view model when its invoked through sammyjs, this is all fine but it does not support sub routing My plan is to change the meta object so that it can (optional offcourse) look like this meta: { query: MyApp.Core.Contracts.Queries.FooQuery, title: "Foo", route: { barId: MyApp.BarViewModel } } When sammyjs detects a barId in the query string the Barmodel will be executed and populated through its own meta object. Is this a good design?

    Read the article

  • OpenGraph tags and HTML5 validity

    - by netmano
    I have a HTML5 based page, and I inculded the OpenGraph tags according to it's documentation. Also I checked with Facebook Debug, and it can parse the metadata. But when I use W3C Validator, it reports the OG tags as error: Attribute content not allowed on element meta at this point. <meta property="fb:admins" content="...." /> Attribute content not allowed on element meta at this point. <meta property="og:url" content="http://www...."> They are all in the <head>. I would need my page be "valid" HTML5 and OG tags, as well. Could you help me giving a hint how can it be achieved? UPDATE: The name version also invalid: <meta name='fb:admins' content=''>

    Read the article

  • Mobile detection - Meta tag and max-device-width vs. php user agent?

    - by nimmbl
    Which form of mobile detection should I use and why? <meta name="viewport" content="width=320,initial-scale=1,maximum-scale=1.0,user-scalable=no" /> <link media="only screen and (max-device-width: 480px) and (min-device-width: 320px)" href="css/mobile.css" type= "text/css" rel="stylesheet"> <link media="handheld, only screen and (max-device-width: 319px)" href="css/mobile_simple.css" type="text/css" rel="stylesheet" /> Or include('mobile_device_detect.php'); $mobile = mobile_device_detect(); And why on earth would this: <?php if(strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== false) { ?> <meta name="viewport" content="width=320,initial-scale=1,maximum-scale=1.0,user-scalable=no" /> <link media="screen" href="css/mobile.css" type= "text/css" rel="stylesheet"> <?php } else { ?> <link media="screen" href="css/mobile_simple.css" type= "text/css" rel="stylesheet"> <?php } ?> ignore this css? body { background: -webkit-gradient(linear, left top, left bottom, from(#555), to(#000)); }

    Read the article

  • getting last insert id .sqlalchemy orm

    - by gummmibear
    Hi i use sqlalchemy, i need some help. import hashlib import sqlalchemy as sa from sqlalchemy import orm from allsun.model import meta t_user = sa.Table("users",meta.metadata,autoload=True) class Duplicat(Exception): pass class LoginExistsException(Exception): pass class EmailExistsException(Exception): pass class User(object): """ def __setattr__(self, key, value): if key=='password' : value=unicode(hashlib.sha512(value).hexdigset()) object.__setattr__(self,key,value) """ def loginExists(self): try: meta.Session.query(User).filter(User.login==self.login).one() except orm.exc.NoResultFound: pass else: raise LoginExistsException() def emailExists(self): try: meta.Session.query(User).filter(User.email==self.email).one() except orm.exc.NoResultFound: pass else: raise EmailExistsException() def save(self): meta.Session.begin() meta.Session.save(self) try: meta.Session.commit() except sa.exc.IntegrityError: raise Duplicat() How can i get inserted id when i call? user = User() user.login = request.params['login'] user.password = hashlib.sha512(request.params['password']).hexdigest() user.email = request.params['email'] user.save()

    Read the article

  • How to read a file with variable multi-row data in Python

    - by dr.bunsen
    I have a file that is about 100Mb that looks like this: #meta data 1 skadjflaskdjfasljdfalskdjfl sdkfjhasdlkgjhsdlkjghlaskdj asdhfk #meta data 2 jflaksdjflaksjdflkjasdlfjas ldaksjflkdsajlkdfj #meta data 3 alsdkjflasdjkfglalaskdjf This file contains one row of meta data that corresponds to several, variable length data containing only alpha-numeric characters. What is the best way to read this data into a simple list like this: data = [[#meta data 1, skadjflaskdjfasljdfalskdjflsdkfjhasdlkgjhsdlkjghlaskdjasdhfk], [#meta data 2, jflaksdjflaksjdflkjasdlfjasldaksjflkdsajlkdfj], [#meta data 3, alsdkjflasdjkfglalaskdjf]] My initial idea was to use the read() method to read the whole file into memory and then use regular expressions to parse the data into the desired format. Is there a better more pythonic way? All metadata lines start with an octothorpe and all data lines are all alpha-numeric. Thanks!

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >