w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Two functions don't work together, but no errors
The problem is not in the jQuery code you've posted here. It is in the HTML. In your fiddle you have: <tr onMouseOver="this.className='highlight'" onMouseOut="this.className='normal'" class="s_grp_2d_ttl_asset" style="display: none;"> Once the row is visible, as soon as the mouse moves over it, the s_grp_2d_ttl_asset class is replaced by the highlight class, which makes your click event stop at the first element. If you used the addClass, removeClass, or toggleClass functions instead, you could make the change without completely removing the original class.

Categories : Javascript

how work around remainder functions?
Well if I understand well you want to determine parameters a and c in your recurrent relation. But you only have one solution of the equation. Your system is underdetermined, you need 3 values Xn+2, Xn+1 and Xn. (http://en.wikipedia.org/wiki/Underdetermined_system) If you know c, then this is obvious : You need to solve a linear equation.

Categories : Algorithm

Why the chain of functions does not work in PHP?
In your "one-line-solution", when you valorize $model->album_photocover that you use to compose the save path? CUploadedFile::getInstance($model, 'album_photocover') ->saveAs($path . '/' . $model->album_photocover); //____________________________^++++++++++++++++++++++^ ADD I seen now @Telvin Nguyen comment, yep, that's the problem!

Categories : PHP

Javascript : External Functions won't work
check this: function pageStart() { var image_on = 0; var imgArray = new Array(); alert("boo"); /* Used to check the script will run */ } HTML <head> <link rel="stylesheet" href="main.css" type="text/css" /> <title>Grandpa Pixel</title> <script type="text/javascript" src="main_script.js"></script> </head> <body onload="pageStart();">

Categories : Javascript

Getting locale functions to work in glibc
Try to use the strace to find out where the glibc tries to read the locales from. I suspect that since you set the prefix glibc tries to find them in ~/Desktop/bglibc/share/locale/ or something similar. And certainly UTF-16 will not work with 8 bit string types...

Categories : C

Any ideas on why these two max/min value functions don't work for a BST in python?
The following: self.maxVal(root.right) should read return self.maxVal(root.right) Otherwise you're ignoring the return value from the recursive call. The same goes for minValue(). P.S. Since neither method needs self, you might want to consider turning them into static methods.

Categories : Python

Some functions don't work when using two databases in Wordpress
Ok so after hours of investigation it seems that WP caches all the available taxonomies on initialization, so when switching DB it will not re-check available taxonomies. It does however select data from the correct DB so that was not the issue. The solution I came up with was simply adding the missing taxonomies to the new DB (temporarily), and after the migration I'll just remove them.

Categories : Wordpress

Some functions don't work in portrait layout
Actually, the img is resized correcty. The problem in your case is the #ulBack. The #ulBack hides your img in portrait mode because you don't apply display:none to it. You have a css file for each display mode: <link href="css/gallery_port.css" rel="stylesheet" media="screen and (orientation:portrait)"/> <link href="css/gallery_land.css" rel="stylesheet" media="screen and (orientation:landscape)"/> You apply display:none to #ulBack in gallery_land.css but not in gallery_port.css. I tested it by removing the display:none in gallery_land.css and I got the same problem in landscape mode.

Categories : Jquery

How do i work with objects in Self-Executing Anonymous Functions?
In your code, init is not available to be called externally. I believe you're looking for something like this: (function (document,window) { var shelf = window.shelf = function (foo) { this.init = function () { console.log("in init" + foo); }; alert("in shelf.js "+ foo + "type" + typeof this.init); }; })(document, window); var api = new shelf("1234"); api.init();

Categories : Javascript

Dropdown Functions Work in 2010 but not in 2007
When a user opens the file using 2007, no dropdown appears. In Excel 2007 we had to create a range-name in order to use DataValidation with a List from another sheet, entering =TheRangeName in the Source box. In Excel 2010 this is not essential and, when defining the source, we can just highlight a range in another sheet. I suspect that this may be the issue. You will need to correct the Data Validation settings to use =TheRangeName, instead of =Sheet1!A1:A4. On the Home tab click the Find & Select button and choose Data Validation. This will select all the cells on the current sheet that have Data Validation. Alternatively, click in a cell that you know has Data Validation and choose Go To Special from the Find & Select list; from here you can select all cells that contain t

Categories : Excel

WHY don't aggregate functions work, unless using GROUP BY statement?
Why should I always use GROUP BY? SUM() and others are Aggregate Functions. Their very nature requires that they be used in combination with GROUP BY. What is lost without it? From the documentation: If you use a group function in a statement containing no GROUP BY clause, it is equivalent to grouping on all rows. In the end, there is nothing to remember, as these are GROUP BY aggregate functions. You will quickly tell from the result that you have forgotten GROUP BY when the result includes the entire result set (incorrectly), instead of your grouped subsets.

Categories : Mysql

javascript functions and objects using keyword 'this' does not work
1. Functions are constructors for new objects When you call new FuncName, the function acts as a constructor, and the value of this inside points to the object being constructed (not the function itself). When you remove new, this becomes undefined, falling back to the global object (unless you're in strict mode). 2. Functions are also objects Every function is an instance of Function, so the functions themselves are objects and can have have their own properties. Those properties cannot be accessed with this.propName inside the function body, only with funcName.propName. That's because this inside a function is never the function object itself (unless you forced it to be, with bind, call, or apply). I hope both topics above help you understand how functions work. As for your final q

Categories : Javascript

Trying to get higher order functions to work in powershell
The dollar underbar variable is an automatic variable that is only populated in certain scenarios; in this case, when there is an incoming object from the pipeline. In order to give the $_ the value of 1, which appears to be your intent, you'll have to pipe the number to each and also execute the scriptblock. The easiest way to do this is to pass it directly as an argument to % (foreach-object) which accepts a scriptblock: PS> { $_ + $_ }, { $_ + 1}, {$_ - 1} | % { 1 | % $_ } 2 2 0 Look at it until it makes sense :) If it doesn't click, comment back here and I'll explain in more detail. If you're interested in functional tinkering in powershell, you might enjoy this function I wrote for partial application: http://www.nivot.org/blog/post/2010/03/11/PowerShell20PartialApplicationOfF

Categories : Powershell

PHP recursive functions work differently in different versions?
I have tweaked your code a little bit. Apparently when you pass the $simpsons array reference as a parameter to your recursive function, it works in all versions. $simpsons = array(); $simpsons[0] = array("name"=>"Abe","parent"=>-1); $simpsons[1] = array("name"=>"Homer","parent"=>0); // Homer's parent is Abe $simpsons[2] = array("name"=>"Bart","parent"=>1); // Bart's parent is Homer $simpsons[3] = array("name"=>"Lisa","parent"=>1); // Lisa's parent is Homer $simpsons[4] = array("name"=>"Maggie","parent"=>1); // Maggie's parent is Homer function get_children($simpsons, $parent) { foreach ($simpsons as $index=>$onesimpson) { if ($onesimpson["parent"]==$parent) { echo "$onesimpson[name] is a child of ".$simpsons[$parent]["name"].".<br />

Categories : PHP

Wrapping D3 functions inside objects doesn't work. Why?
It's clear that the function returned by d3 is maintaining some sort of state when calling it. However, you are recreating it each time you call it when assigned to your obj Because no state is maintained it can't calculate the appropriate results. If you are trying to call directly to the instance of your function, this might be a better approach: var obj = { returnResult: d3.scale.ordinal() .domain([0, 2]) .rangePoints([0, 1024]) } This would allow you to do what you are doing now without recreating the object each time.

Categories : Javascript

How can I make type inference work with partial functions
Your could do: abstract class HandlesNothing { def respond: Respond = Map.empty // the empty response. Handles nothing protected def c(supPf: Respond)(pf: Respond) = pf orElse supPf } class HandlesA extends HandlesNothing { override def respond = c(super.respond) { case "a" => "The letter A" } } It's admittedly ugly, but saves you typing. Interesting detail found during exploration: Impossible to bind to super of this. That would have been really cool.

Categories : Scala

Why doesn't bash history expansion work in functions?
This question has been asked here: use "!" to execute commands with same parameter in a script but in brief you need to set -o history set -o histexpand in your script to enable history expansion.

Categories : Linux

Make animation functions work when executing $.ajax call
See the documentation: As of jQuery 1.8, the .ajaxStart() method should only be attached to document. $(document).ajaxStart(animationStart).ajaxStop(animationStop);

Categories : Javascript

I need C compiler to work with gotoxy(), wherex(), wherey() functions in windows7 64 bit OS
You need to link with the conio library. Add -lconio to the linker parameters under Project Options. If that doesn't work, make sure you have actually downloaded the conio library and put it in the right directory (you'll need the conio2.h file as well as the libconio.a file, which is the library itself).

Categories : Misc

Windows Powershell - Returning and supplying variables to functions does not work
In your do-while look, $MyReport is just passed to the print everything method. But, it will not be in scope at that point as you are just assigning to $MyReport within the functions. Try using $MyReport as $script:MyReport everywhere, so that it will be in script scope. This is not the ideal solution, but should be good enough to get you started. Also, you might want to read up on pipeline / function output in powershell. You are using it wrong - http://stacktoheap.com/blog/2013/06/15/things-that-trip-newbies-in-powershell-pipeline-output/

Categories : Function

functions doesnt work on dynamically added form fields
You have to change $("#test, #test2").keyup(function () { to $("body").on('keyup', '#test, #test2', function () { Also this won't work var width = parseInt($("#test").val()); var height = parseInt($("#test2").val()); because it will return value of first matched element - if you clone #test and #test2 you will have more than one, but you read the value of only first element, not element you write into, so change to this: var width = parseInt($(this).parent().children('#test').val()); var height = parseInt($(this).parent().children('#test2').val()); Also you shouldn't clone elements with same id, so changed to classes instead of ids. Complete code with changes here: http://jsfiddle.net/mattydsw/xzGXF/1/

Categories : Jquery

Can stl functions that work on each member of a container accept external parameters?
Here is an example that uses for_each to update each element in abc: std::for_each(abc.begin(), // Start of range abc.end(), // End of range [=](int &value) // The operation to apply { value=(value-min)/(max-min); }); Changing the sequence being iterated over by for_each is often frowned upon, despite the fact that for_each guarantees the order of traversal as well as how many invocations occur per element. However, to appease the naysayers, you may want to use transform instead which has no such guarantees (neither of the order of traversal nor of the number of calls of the predicate other than via a complexity guarantee {Note: the complexity has been modified to a guarantee of the number of calls in C+

Categories : C++

how to make jquery functions work with dynamically changing elements
Using .on() like you do apply direct event, which are faster but DOESN'T apply to dynamic elements. You need to use .on() like that for dynamic elements : $(document).on("mouseenter", '#playerImg',function () { console.log("works"); }); document should be the closest static element for performance gain. Side note, id's must be unique, change it for class. The code above may not work because it use an id. If it's the case and you don't want to change for whatever reason, use this : $(document).on("mouseenter", 'img#playerImg',function () { console.log("works"); });

Categories : Javascript

Workarounds for / alternatives for EF4 that work with Oracle PL/SQL procedures and record types as functions?
Please consider this answer only if no other is available. I'm not an adept at MVC yet, so I can't advise there, but on the Oracle end you can make things palatable to MVC by using wrapper procedures that accept data types MVC understands. Note that I don't have the ability to test a CREATE PACKAGE right now so the following is from memory. I won't vouch for the syntax but hopefully the general idea is apparent. CREATE OR REPLACE PACKAGE pck_wrap_search IS PROCEDURE PerformQuickSearch( p_cursor in out sys_refcursor, -- If MVC doesn't like pls_integer you could make these NUMBER values search_id pls_integer, search_database pls_integer, search_mode pls_integer, result_mode pls_integer, wild_card pls_integer); END PerformQuickSearch; EN

Categories : C#

How does Ember data's generic shouldSave and RESTAdapter's shouldSave functions work?
Question 1: Does anyone know what return !reference.parent means here for the RESTAdapter? After reading trough the source the line return !reference.parent basically means that reference is the record that is being currently handled and parent would point to it's parent in the case the record is a child of a parent model having hasMany / belongsTo relationships. Example: App.Post = DS.Model.extend({ comments: DS.hasMany('App.Comment') }); App.Comment = DS.Model.extend({ post: DS.belongsTo('App.Post') }); In the example a record of type App.Comment has as it's parent App.Post. So this line makes perfect sense return !reference.parent which would return false is the reference does not have a parent a thus not being part of any relationship. Question 2: What does the Ember.

Categories : Ember Js

How to allow templated functor work on both member and non-member functions
You will definitely need some kind of default implementation for a class. But the good news is that this can be foreseen by the logger class itself. Just replace template<typename RetType, typename Arg1Type, typename Class> with template<typename RetType, typename Arg1Type, typename Class=DefaultDummyClass> of course the DefaultDummyClass has to be foreseen, but it no longer has to be provided by somebody who wants to use the logger class.

Categories : C++

Accessing properties of a function inside different levels of its "prototype" functions -- and -- recursive functions
1. A) pass a variable to evenDeeper.Bar; B) use evenDeeper.bar.apply(new FooBar(args)) to access FooBar prototype using 'this'; C) assign evenDeeper.annoy the FooBar.annoy variable (not recommended because booleans are passed by value and it won't reflect changes to it) 2. A) use this.Bar() from within evenDeeper.Bar() and it should refer to itself unless you have changed the 'this' variable. B) pass this.Bar as a callback to this.Bar() and execute it within itself C) declare this.Bar() in a function context so it can refer to itself as simply Bar(), example follows: FooBar.prototype.evenDeeper = (function () { function Bar() { if (this.annoy) { alert('are you annoyed yet?'); } Bar.apply(this); } return { Bar: Bar, anotherOn

Categories : Javascript

What is the proper way to declare javascript prototype functions calling helper functions
I prefer method 3, declaring it as a property of the constructor: function HeavilyInstantiated() {} HeavilyInstantiated.helper = function(param) { return compute(param); } HeavilyInstantiated.prototype.computeHard = function(params) { var someResult = HeavilyInstantiated.helper(params.prop1); return someResult; } You still have only one instance of the helper method, but it doesn't pollute the global namespace or the instances of HeavilyInstantiated (it is not on their prototype chain).

Categories : Javascript

How One can make a variable right to access from ONLY two functions that a file consists of total five functions
You can't in C; the file is the compilation unit that defines the boundaries for static variables of that sort, since anyone who can edit or view that file could work with all of the functions in it. If you really need to separate visibility, you have to split the functions into multiple files.

Categories : C

Why do generic programming designs prefer free functions over member functions?
Free functions are less tightly coupled to a particular implementation (since they rely only on the public interface of the container). This allows for greater flexibility and ease of maintenance. You'll note that when a particular implementation matters (for example std::map::find) the standard library uses member functions. Scott Meyers has a set of rules that work pretty well for deciding how to create your functions: http://cpptips.com/nmemfunc_encap

Categories : C++

Fast way to generate code functions from header functions in Visual Studio?
Visual Assist has a generator for this. I'm sure there are a lot of plugins that have the same functionality, but you might have to part with some cash for them. Visual Assist is well worth the money though, as it gives you a lot of functionality which I find invaluable. My killer features are the better function and method info, better auto complete and find file in projects (one key combination and you get a list of all files in all projects and can search for a particular file without knowing where in the hierarchy it lives).

Categories : C++

Memory overhead of anonymous functions vs named functions when used as Jquery callbacks
By design, the observer pattern only keeps one instance of the observer. The event handler then calls this observer multiple times, with other instances of an event object, which holds the event parameters: which element fired the event, what is the context,... etc So the handler is not duplicated, but referenced in each subject's 'listeners store'. Note: Kemal Dag also notes that anonymous functions by definition offer less performance then named function, I don't know if it is true, but if it is, the difference is negligible. Especially for a language as JavaScript, that uses anon functions so extensively, it can not afford a performance impact on it.

Categories : Javascript

Shouldn't the begin() and end() functions be member functions of the template class Vector?
If it is not an array or a container with .begin() and .end() it will look up by Argument dependent name. It is said here : Keep in mind these facts about range-based for: Automatically recognizes arrays. Recognizes containers that have .begin() and .end(). Uses argument-dependent lookup begin() and end() for anything else.

Categories : C++

Does object literal notation containing functions execute faster than (global scope) plain functions (dereferencing)?
As T.J. Crowder states in his comment to the question "JavaScript Object Literal notation vs plain functions and performance implications?": Perf questions in JS are tricky, because the engines vary so much. But if you mean the two options in the question, the answer is almost certainly no. Once the engine has the function reference, doing the call will be the same in both cases, so we have to look at how the engine gets the function reference. In the first example, to call foo the engine has to look up foo on the binding object of the execution context. In the second example, it has to look up Baz the same way, then look up foo on Baz, which is more steps. But I bet it doesn't make a real difference.

Categories : Javascript

Is using C functions instead of static methods for making pure functions a bad design?
I don't think it is bad design, no, but there are certain circumstances where one may be considered more appropriate than the other. The key questions are: Does this method belong to a class? Is this method worth adding to a class? A class is something that is self-contained and reusable. For the method in your example, I would be tempted to answer "Yes, it does/is," because it is something specific to NSString and is a method you (presumably) want to use fairly often. Its parameters are also of type NSString. I would therefore use the message form in a class extension and #import the extension when you need it. There are two situations (off the top of my head) where this is not really appropriate. Firstly is the situation where the method interacts specifically with other entities ou

Categories : Objective C

Calling functions inside functions when the inner function's arguments will always be the same as the outer's
I honestly think your first technique is the best way to go and perfectly idiomatic. Still, here's another option: def outer_method(word) inner_lambda = lambda do puts "I really love " + word + "!" end inner_lambda.call puts word + " tastes like candy." end outer_method("onions") lambda creates a lexical closure, which means it captures the surrounding environment, including the reference to word.

Categories : Ruby

Defining Functions In Relation To Other Functions Without Considering Implementation Details
In addition to the other options, and to help you understand what's going on, recognize that if you use a tuple for your oddOf arguments, it will work. let oddOf (value, list) = ... let evenOf = not . oddOf This is because oddOf is now a function that returns a Bool. With untupled arguments, then it's a function that returns a function that returns a Bool, which is different. So now not oddOf still doesn't work because we're not partially applying here--not is Bool -> Bool; there is no partial application possible there. Instead we're going back to the old mathematical function composition—f(g(x)) -> (f.g)(x). Here g is oddOf and f is not. Then the Haskell representation is as above. The basic premise of your problem all comes down to my second paragraph—you've got a functi

Categories : Haskell

2 jquery .click functions for one button . fire functions one after another
Try this, <script> var clientId=<%=Button1.ClientID%>; $(document).ready(function () { $("#"+clientId).click(function () { var con1 = confirm("message"); return con1; }); }); </script>

Categories : Javascript

R Snowfall - Difficulty in implementing functions that call other functions
I do not know the specifics of the snowfall package, but I do know that when doing parallel computing in R, you need to assume that each core you pass information to is a brand-new R instance. Meaning, regardless of what you pass through your host prior to registering clusters, there is just the vanilla instance of R on your clones. It looks like there is a call sfExportAll() which will put all of your global variables onto the clone instances. I would try it out, but I can't run snowfall on my Windows machine.

Categories : R

Are functions inside GUI code or Level-2 S-functions nested?
According to the documentation on functions: You can declare multiple local functions within the same file, or nest functions. If any function in a file contains a nested function, all functions in the file must use the end keyword to indicate the end of the function. Otherwise, the end keyword is optional. I believe the same applies for GUIs and S-functions. I find nested functions particularly useful for GUIs as a nested function can access the data (workspace) of its parent function without having to pass the variables as arguments.

Categories : Matlab

© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.