Search Results

Search found 1405 results on 57 pages for 'prototype'.

Page 22/57 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Why is Magento 1.4 including javascript files by filesystem path?

    - by Josh
    I am in the process of testing a Magento 1.3 site using Magento 1.4. I am seeing very weird and inconsistent behavior. Instead of including the URL of my javascript files, Magento is creating tags with the full filesystem path of the js files, as so: <script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototype.js"></script> I believe this is related to the new "Themes JavaScript and CSS files combined to one file" function. In fact, when I log into the admin and click "Flush JavaScript/CSS Cache", then the first page load is successful, and I see a single JS include similar to: <script type="text/javascript" src="/media/js/5b8cfac152fcb2a5f93ef9571d338c54.js"></script> But subsequent age loads load every single JS file, with the full path names. Which obviously isn't going to work. Anyone have any ideas on what could be wrong or how to fix this issue?

    Read the article

  • constructors and inheritance in JS

    - by nandinga
    Hi all, This is about "inheritance" in JavaScript. Supose I create a constructor Bird(), and another called Parrot() which I make to "inherit" the props of Bird by asigning an instance of it to Parrot's prototype, like the following code shows: function Bird() { this.fly = function(){}; } function Parrot() { this.talk = function(){ alert("praa!!"); }; } Parrot.prototype = new Bird(); var p = new Parrot(); p.talk(); // Alerts "praa!!" alert(p.constructor); // Alerts the Bird function!?!?! After I've created an instance of Parrot, how comes that the .constructor property of it is Bird(), and not Parrot(), which is the constructor I've used to create the object? Thanks!!

    Read the article

  • How do I change JAVASCRIPT_DEFAULT_SOURCES for my application?

    - by Adam Lassek
    When you call javascript_include_tag :defaults you usually get: prototype.js, effects.js, dragdrop.js, and controls.js. These are stored in a constant in ActionView::Helpers::AssetTagHelper called 'JAVASCRIPT_DEFAULT_SOURCES`. My application uses jQuery, so I want to replace the Prototype references with something more useful. I added an initializer with these lines, based on the source code from jRails: ActionView::Helpers::AssetTagHelper::JAVASCRIPT_DEFAULT_SOURCES = %w{ jquery-1.4.min jquery-ui jquery.cookie } ActionView::Helpers::AssetTagHelper::reset_javascript_include_default But when I do this, I get: warning: already initialized constant JAVASCRIPT_DEFAULT_SOURCES during startup. What's the correct way of changing this value? In the source code it checks for the constant before setting it, but apparently that happens before it runs the initializer scripts. The Rails 3.0 release will provide much greater flexibility with choice of JS libraries, so I guess this is a problem with an expiration date.

    Read the article

  • To see javascript object properties and functions with intellisense in VS.NET 2008

    - by uzay95
    I am creating classes in external files.And adding them with <script src='../js/clsClassName.js' type='text/javascript'></script> tags. When i created an object from this class I can't access its props, and functions with intellisense. Is there any way to achieve this? Sample javascript class: // clsClassName.js function ClassName(_param1, _param2, _param3) { this.Prop1 = _param1; this.Prop1 = _param2; this.Prop3 = _param3; } ClassName.prototype.f_Add = function(fBefore, fSuccess, fComplete, fError) { } ClassName.prototype.f_Delete = function(fBefore, fSuccess, fComplete, fError) { } Any help would be greatly appreciated...

    Read the article

  • How can I easily maintain a cross-file JavaScript Library Development Environment

    - by John
    I have been developing a new JavaScript application which is rapidly growing in size. My entire JavaScript Application has been encapsulated inside a single function, in a single file, in a way like this: (function(){ var uniqueApplication = window.uniqueApplication = function(opts){ if (opts.featureOne) { this.featureOne = new featureOne(opts.featureOne); } if (opts.featureTwo) { this.featureTwo = new featureTwo(opts.featureTwo); } if (opts.featureThree) { this.featureThree = new featureThree(opts.featureThree); } }; var featureOne = function(options) { this.options = options; }; featureOne.prototype.myFeatureBehavior = function() { //Lots of Behaviors }; var featureTwo = function(options) { this.options = options; }; featureTwo.prototype.myFeatureBehavior = function() { //Lots of Behaviors }; var featureThree = function(options) { this.options = options; }; featureThree.prototype.myFeatureBehavior = function() { //Lots of Behaviors }; })(); In the same file after the anonymous function and execution I do something like this: (function(){ var instanceOfApplication = new uniqueApplication({ featureOne:"dataSource", featureTwo:"drawingCanvas", featureThree:3540 }); })(); Before uploading this software online I pass my JavaScript file, and all it's dependencies, into Google Closure Compiler, using just the default Compression, and then I have one nice JavaScript file ready to go online for production. This technique has worked marvelously for me - as it has created only one global footprint in the DOM and has given me a very flexible framework to grow each additional feature of the application. However - I am reaching the point where I'd really rather not keep this entire application inside one JavaScript file. I'd like to move from having one large uniqueApplication.js file during development to having a separate file for each feature in the application, featureOne.js - featureTwo.js - featureThree.js Once I have completed offline development testing, I would then like to use something, perhaps Google Closure Compiler, to combine all of these files together - however I want these files to all be compiled inside of that scope, as they are when I have them inside one file - and I would like for them to remain in the same scope during offline testing too. I see that Google Closure Compiler supports an argument for passing in modules but I haven't really been able to find a whole lot of information on doing something like this. Anybody have any idea how this could be accomplished - or any suggestions on a development practice for writing a single JavaScript Library across multiple files that still only leaves one footprint on the DOM?

    Read the article

  • Shortest way of attaching multiple DOM elements to one event handler using Jquery?

    - by Camsoft
    I need to attach a single event handler to multiple DOM elements using jQuery. I'm currently achieving this using jQuery's each() method. See below: $([elm1, elm2, elm3]).each(function() { this.click(eventHandler); }); I was wondering if there is a way to do this without using the each method and closure. I thought I would be able to do something like: $(elm1, elm2, elm3).click(eventHandler); This kind of statement works using Prototype.js but not in jQuery.The reason I ask the question is because after using both Prototype.js and jQuery I have found that jQuery requires simpler statements to achieve the same tasks in almost every area so I assume there must be a better way of doing this?

    Read the article

  • Which C# / .NET free or standard bits and pieces do I need to make a simple Windows desktop app back

    - by jjujuma
    I'm coming from a Java / web background with no C# experience and I want to write a prototype C# / .NET desktop app to run against my existing DB2 database. The idea is that the prototype should use libraries and tools which are suitable for scaling up to full production and should be standard and free. Of the top of my head, the two biggest things I need are: an IDE a GUI toolkit / set of components a JDBC equivalent and/or possibly a full blown ORM system What are my options? Note I don't mind paying for full blown Visual Studio in the long run, but for now everything needs to be free, including the IDE.

    Read the article

  • Is there a better way to create an object-oriented class with jquery?

    - by Devon
    I use the jquery extend function to extend a class prototype. For example: MyWidget = function(name_var) { this.init(name_var); } $.extend(MyWidget.prototype, { // object variables widget_name: '', init: function(widget_name) { // do initialization here this.widget_name = widget_name; }, doSomething: function() { // an example object method alert('my name is '+this.widget_name); } }); // example of using the class built above var widget1 = new MyWidget('widget one'); widget1.doSomething(); Is there a better way to do this? Is there a cleaner way to create the class above with only one statement instead of two?

    Read the article

  • infoWindow on MarkerClusterer

    - by vishwanath
    I need infoWindow to be opened instead of zooming in map, when clicking on the ClusterMarker. I am using Gmaps util library MarkerClusterer for creating cluster of markers. I tried changing following line in markerclusterer.js ClusterMarker_.prototype = new GOverlay(); with ClusterMarker_.prototype = new GMarker(); so that I can get the openInfoWindow() function in the clustermarker, but that didnt worked out. Got some error. If possible, Please suggest solution so that this can be done with MarkerClusterer. Or else any other library which will be able to do this. Any help will be appreciated.

    Read the article

  • How to center map on marker and open marker's InfoWindow in one method

    - by sMariusz
    I'm using Google Map APIv2. On my webpage I've a sidebar containing a list of markers with onclick event executing showDetails method, that looks like: GMarker.prototype.showDetails=function() { map.panTo(this.getLatLng()); this.openInfoWindowHtml(this.details); }; The problem is that i cannot both panTo and openInfoWindowHtml in one method, it pans but won't open tooltip and when i change method to: GMarker.prototype.showDetails=function() { this.openInfoWindowHtml(this.details); map.panTo(this.getLatLng()); }; it opens tooltip but won't center map to the marker's anchor coordinates. Even using wait function doesn't solve my problem. What am I doing wrong?

    Read the article

  • variable names in function definition, call and declaration

    - by yCalleecharan
    Hi, I see C books that use the same variable names in the function definition, calling function and declaration. Others use the same variable names in the calling function and in the declaration/prototype but a different one in the definition as in: void blabla(int something); //prototype blabla(something) // calling function inside main after something has been initialized to int void blabla(int something_else) //definition I have two questions: What convention is best to use in C?; Does the convention apply regardless whether a value is being passed "by-value" or if it's being passed by a pointer? Thanks a lot...

    Read the article

  • To see javascript object properties and functions with intellisense in VS.NET

    - by uzay95
    I am creating classes in external files.And adding them with <script src='../js/clsClassName.js' type='text/javascript'></script> tags. When i created an object from this class I can't access its props, and functions with intellisense. Is there any way to achieve this? // clsClassName.js function ClassName(_param1, _param2, _param3) { this.Prop1 = _param1; this.Prop1 = _param2; this.Prop3 = _param3; } ClassName.prototype.f_Add = function(fBefore, fSuccess, fComplete, fError) { } ClassName.prototype.f_Delete = function(fBefore, fSuccess, fComplete, fError) { } Any help would be greatly appreciated...

    Read the article

  • getnameinfo specifies socklen_t

    - by bobby
    The 2nd arg for the getnameinfo prototype asks for a socklen_t type but sizeof uses size_t. So how can I get socklen_t ? Prototype: int getnameinfo(const struct sockaddr *restrict sa, socklen_t salen, char *restrict node, socklen_t nodelen, char *restrict service, socklen_t servicelen, int flags); Example: struct sockaddr_in SIN; memset(&SIN, 0, sizeof(SIN)); // This should also be socklen_t ? SIN.sin_family = AF_INET; SIN.sin_addr.s_addr = inet_addr(IP); SIN.sin_port = 0; getnameinfo((struct sockaddr *)&SIN, sizeof(SIN) /* socklen_t */, BUFFER, NI_MAXHOST, NULL, 0, 0);

    Read the article

  • Can I add custom methods/attributes to built-in Python types?

    - by sfjedi
    For example—say I want to add a helloWorld() method to Python's dict type. Can I do this? JavaScript has a prototype object that behaves this way. Maybe it's bad design and I should subclass the dict object, but then it only works on the subclasses and I want it to work on any and all future dictionaries. Here's how it would go down in JavaScript: String.prototype.hello = function() { alert("Hello, " + this + "!"); } "Jed".hello() //alerts "Hello, Jed!" Here's a useful link with more examples— http://www.javascriptkit.com/javatutors/proto3.shtml

    Read the article

  • Twitter's Bootstrap 2.x popover callback can't focus on element

    - by mozgras
    I've modified bootstrap's popover function to include a callback which works great. But in the callback I cannot programmatically focus on the first form field. Strange, because I can manipulate other elements in the callback function as well as focus on the element at other points. Here's the code to add a callback which I got from another SO question (http://stackoverflow.com/a/14727204/1596547): var tmp = $.fn.popover.Constructor.prototype.show; $.fn.popover.Constructor.prototype.show = function () { tmp.call(this); if (this.options.callback) { this.options.callback(); } } Here's the popover code: $('#a-editor-btn').popover({ html: true, placement: 'bottom', callback: function(){ $('#a-form-point').focus(); //nothing happens console.log('hello'); // works . . }, content: $('#a-form').html() }).parent().delegate('button#insert-point-btn', 'click', function() { insertPoint(); }).delegate('.a-form','keypress', function(e) { if ( e.which == 13 ) { insertPoint(); } });

    Read the article

  • How can I call a method on a custom object created in JavaScript using C#?

    - by just in case
    I have a WebBrowser control. I have added some JavaScript into the head tag and I can see it is working as expected by adding an alert. Inside of this js I am creating a function and adding some members to it's prototype like so: function test() { } test.prototype.run = function() { alert('success!') } function createTest() { return new test() } Then back inside of C# I am doing: dynamic test = this.browser.InvokeScript("createTest"); test.run(); I can see that the test object is some ComObject but when I call run() nothing happens. I get no error but nothing happens. Does anyone know how to call this type of custom object? Also suppose I wanted to get rid of the createTest() method, how can I create a new instance of test from C#? Also, for bonus points, is there anything special I need to know about attaching events to this custom object (on say a 'complete' member) such that it will callback into my C# code?

    Read the article

  • Inherit all methods of object (including "constructor"), but modify some of them.

    - by Kirzilla
    Hello, Let's imagine that we have object Animal $.Animal = function(options) { this.defaults = { name : null } this.options = $.extend(this.defaults, options); } $.Animal.prototype.saySomething = function() { alert("I'm animal!"); } Now I'd like to create Cat object. It is absolutely similar to $.Annimal, but method saySomething() will look like this one... $.Cat.prototype.saySomething = function() { alert("I'm cat!"); } How can I inherit from Animal to create new object Cat and redefine saySomething() method? Thank you.

    Read the article

  • Cannot seem to communicate between views

    - by devnet247
    Hi all I have written a MVVM prototype as a learning exercise and I am struggling to understand how I can communicate between views.Let me explain I have a treeview on the left (leftSideView) ListView on the right (rightSideView) MainWindow (includes the 2 views mentioned above and a splitter) What I have implemented does not work and I would like you if you can point out where I am going wrong or if there is a better way of doing it. you can download the quick prototype from here http://cid-9db5ae91a2948485.skydrive.live.com/self.aspx/.Public/WpfCommunicationBetweenViews.zip For sure I am doing something wrong with the bindind. Also it would be nice to learn how you do it. EG ListBox on left (one view) ListView On the right (another view) how u communicate between the two. Thanks a lot of any suggestions

    Read the article

  • jQuery: extend plugin question

    - by Fuxi
    hi all, i'm having this simple plugin code: (function ($) { $.fn.tWeb = function () { var me = this; me.var1 = "foo"; this.done = function() { return this; } return this.done(); }; })(jQuery); var web = new jQuery.fn.tWeb(); alert(web.var1); works nice - alert(web.var1) is giving me "foo". my question: would it be possible extending this plugin by simply including another .js which has more code? eg. that i could ask for web.var2 i previously used a prototype function and could "extend" it by simply adding another js-include which refered to it eg. like tWeb.prototype.newfunction = function() how could this be done with jQuery? thx

    Read the article

  • Initializing new instances of a class in a loop, how can I persist an assignment to an event handler

    - by Pydroid
    This is a follow on question from http://stackoverflow.com/questions/3020960/why-is-my-prototype-function-not-returning-the-property-of-the-instance $.getJSON(myjson, function(data) { var json = data; for (i in json) { juuvies[i] = new Juuvy(i,json[i], font, keyfontsize, valfontsize, orbcol, orbkeycol, orbvalcol, paper); juuvies[i].juuv_it(); var mykey = juuvies[i].init_nodes(); juuvies[i].orb.node.onmouseover = function() { console.log(mykey);}; } }); And my init_nodes function, Juuvy.prototype.init_nodes = function() { return this.key; } At this point of time, I get only the last key in the loop, instead of a unique pass each time. Is there a way I can persist the assignment for the event handler?

    Read the article

  • Multiple Timers with setTimeInterval

    - by visibleinvisibly
    I am facing a problem with setInterval being used in a loop. I have a function subscribeFeed( ) which takes an array of urls as input. It loops through the url array and subscribes each url to getFeedAutomatically() using a setInterval function. so if three URL's are there in the array, then 3 setInterval's will be called. The problem is 1)how to distinguish which setInterval is called for which URL. 2)it is causing Runtime exception in setInterval( i guess because of closure problem in javascript) //constructor function myfeed(){ this.feedArray = []; } myfeed.prototype.constructor= myfeed; myfeed.prototype.subscribeFeed =function(feedUrl){ var i=0; var url; var count = 0; var _this = this; var feedInfo = { url : [], status : "" }; var urlinfo = []; feedUrl = (feedUrl instanceof Array) ? feedUrl : [feedUrl]; //notifyInterval = (notifyInterval instanceof Array) ? notifyInterval: [notifyInterval]; for (i = 0; i < feedUrl.length; i++) { urlinfo[i] = { url:'', notifyInterval:5000,// Default Notify/Refresh interval for the feed isenable:true, // true allows the feed to be fetched from the URL timerID: null, //default ID is null called : false, position : 0, getFeedAutomatically : function(url){ _this.getFeedUpdate(url); }, }; urlinfo[i].url = feedUrl[i].URL; //overide the default notify interval if(feedUrl[i].NotifyInterval /*&& (feedUrl[i] !=undefined)*/){ urlinfo[i].notifyInterval = feedUrl[i].NotifyInterval; } // Trigger the Feed registered event with the info about URL and status feedInfo.url[i] = feedUrl[i].URL; //Set the interval to get the feed. urlinfo[i].timerID = setInterval(function(){ urlinfo[i].getFeedAutomatically(urlinfo[i].url); }, urlinfo[i].notifyInterval); this.feedArray.push(urlinfo[i]); } } // The getFeedUpate function will make an Ajax request and coninue myfeed.prototype.getFeedUpdate = function( ){ } I am posting the same on jsfiddle http://jsfiddle.net/visibleinvisibly/S37Rj/ Thanking you in advance

    Read the article

  • Add code to html pages automatically

    - by piede
    I need to add some code to the of several html contained in a folder on my desktop. How can i do that? I am using a prototyping tool (Axure) on Mac and I want to add some html meta tags to the generated pages. These pages can be overwritten every time I generate the prototype. What I need is a sort of script that I can launch after re-generating the prototype, to reinsert the code. There is something for windows but it doesn't work on Mac: http://joshuamorse.com/2009/01/14/axure-protonotes-an-alternative-to-protoshare/ thanks

    Read the article

  • Is there any way to retrieve a float from a varargs function's parameters?

    - by Jared P
    If the function was defined with a prototype which explicitly stated the types of the parameters, eg. void somefunc(int arg1, float arg2); but is implemented as void somefunc(int arg1, ...) { ... } is it possible to use va_arg to retrieve a float? It's normally prevented from doing this because varargs functions have implicit type promotions, like float to double, so trying to retrieve an unpromoted type is unsupported, even though the function is being called with the unpromoted type do to the more specific function prototype. The reason for this is to retrieve arguments of different types at runtime, as part of an obj-c interpreter, where one function will be reused for all different types of methods. This would be best as architecture independent (so that if nothing else the same code works on simulator and on device), although if there is no way to do this then device specific fixes will be accepted.

    Read the article

  • Why does document.QuerySelectorAll return a StaticNodeList rather than a real Array?

    - by Kev
    It bugs me that I can't just do document.QuerySelectorAll(...).map(...) even in Firefox 3.6, and I still can't find an answer, so I thought I'd cross-post on SO the question from this blog: http://blowery.org/2008/08/29/yay-for-queryselectorall-boo-for-staticnodelist/ Does anyone know of a technical reason why you don't get an Array? Or why an SNL doesn't inherit from an Array in such a way that you could use map, concat, etc? (BTW if it's just one function you want, you can do something like NodeList.prototype.map = Array.prototype.map;...but again, why is this functionality (intentionally?) blocked in the first place?)

    Read the article

  • What is the best way to expose a callback API - C++

    - by rursw1
    Hi, I have a C++ library that should expose some system\ resource calls as callbacks from the linked application. For example: the interfacing application (which uses this library) can send socket management callback functions - send, receive, open, close etc., and the library will use this implementation in stead of the library's implementation. (This way enables the application to manage the sockets by itself, can be useful). This library has to expose also more callbacks, like, for example, a password validation, so I wonder if there is a preferred method to expose the callback sending option in one API. Something like: int AddCallbackFunc (int functionCallbackType, <generic function prototype>, <generic way to pass some additional arguments>) Then within my library I will assign the callback to the appropriate function pointer according to the functionCallbackType parameter. Is there any way to implement it in a generic way which will fit ANY function prototype and ANY additional arguments? Your help will be more than appreciated... Thanks!

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >