I am trying to create a program that uses javascript to write a simple textadventure that I can then post on my blog and run on my iphone. I have run into a problem though. I was trying to make it so that my program would save it's state into cookies using JSON to convert it into strings and then post it into a cookie but then I realised...
Hi. I'm using Scilab and I'm trying to make a function like the following:
function p = binary_search(myf,a,b)
The target is to make a binary_search to find such p that: myf(p) = 0 in [a,b].
I want to do someting like this:
root = binary_search("x^3 - 10",1,2)
Where the first string is a definition of a function.
The only way I f...
LS,
Let me first explain what I'm trying to achieve using some pseudo-code (JavaScript).
// Declare our function that takes a callback as as an argument, and calls the callback with true.
B(func) { func(true); }
// Call the function
B(function(bool success) { /* code that uses success */ });
I hope this says it all. If not, please c...
In writing functions my brain always spends a few milliseconds to check which order of parameters would be best for a given function.
should I write:
public Comment AddComment(long userID, string title, string text)
Or probably:
public Comment AddComment(string title, string text, long userID)
Why not:
public Comment ...
Since I've a similar function for 2 different data types:
func GetStatus(value uint8) (string) {...}
func GetStatus(name string) (string) {...}
I would want to use a way more simple like:
func GetStatus(value interface{}) (string) {...}
Is possible to create a generic function using an interface?
The data type could be checked usin...
Hi,
i need a function (c#) or regular expression that makes me a nice URL out of a string. (and replaces invalid characters)
Something like here on stackoverflow..
example:
Short URL or long URL for SEO -> short-url-or-long-url-for-seo
Thanks
...
I don't remember where I heard about it, (I think I was searching up on how selectors worked and it ended up not being exactly the same as a callback function) and I can't confirm it. But more importantly than that, is there a way I could get a list of the function names from another application?
...
I'd like to be able to add a restriction to the query if user_id != None ... for example:
"AND user_id = 5"
but I am not sure how to add this into the below function?
Thank you.
def get(id, user_id=None):
query = """SELECT *
FROM USERS
WHERE text LIKE %s AND
id = %s
...
Can a function return an array?
...
I have a file which is loaded at the top of my document, which is called Videos.php. Inside that file are several functions, such as getYoutubeVideos. On some pages, I need to call upon that function several times (up to 50), and it of course creates major lag on load times. So I have been trying to figure out how to call that function i...
Hi
I have a simple span like so
<span class="action removeAction">Remove</span>
This span is within a table, each row has a remove span.
And then I call a URL using AJAX when that span is clicked. The AJAX event needs to know the ID of the object for that row? What is the best way of getting that ID into the click function?
I thoug...
I'm developing a jquery gallery, and I want to parametrize the highlighter function to support any kind of lightboxes (fancybox for example).
In my defaults I did something like:
$.fn.mygallery.defaults = {
functionHighlighter: null
}
so in the code, creating the item, I'll check this property, and if it's setted to a function, I ...
How do I send a javascript variable to a subsequent jquery function?
Here is my code.
<script type="text/javascript">
$(function() {
var name = $("#name"),
email = $("#email"),
password = $("#password"),
itemid = $("#itemid"),
tips = $(".validateTips");
function updateTips(t) {
tips
...
2 part question here...I have several DIVs that use a simple .click show() function to display content. Is there a way i can combine these to trim my code? I wasnt sure, because they all are displaying DIV with Unique ID's.
$('a#hmo-blue-lnk1').click(function() {
$('#hmo-blue1').show();
return false;
});
$('a#hmo-blue-lnk2'...
function rp_marcadesmarcaFarm(valor) {
FM_log(3, "marcadesmarcaFarm called = "+valor);
for (i = 0; i < farmList.length; i++) {
var arr = farmList[i].split("|");
var xy = arr[0].split(",");
var fvillageId = xy2id(parseInt(xy[0]), parseInt(xy[1]));
GM_setValue("farmAtivada_"+suffix...
There is a question I am stuck on using the following formula for the unipolar transfer function:
f(net)= 1
__________
-net
1 + e
The example has the following:
out = 1
____________ = 0.977
-3.75
1 + e
How do we arrive at 0.977?
What is e?
...
Is it possible to set a default behaviour for custom (non-native) methods/functions in Java?
For example, I would like to change the default "Function" to do a System.out.println("message") whenever called.
So, when a custom method/function is being created:
public String testMethod()
{
//custom code
}
it should execute the newly...
So, I have a project that must add, delete, and print the contents of a vector... the problem is that, when run the program exits before I can type in the string to add to the vector. I commented the function that that portion is in.
Thanks!
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
using namespace std...
General code
Consider this code:
PS> function Test { param($p='default value') $PsBoundParameters }
PS> Test 'some value'
Key Value
--- -----
p some ...
How do I send a variable in jquery to a callback function? function(r){ }
Look at the demo
Whilst on the demo, notice that the form above the menu can be serialised. Also notice that when clicking a folder icon whilst on an item (click a category from the left), and submit the form that way, it cannot be serialised.
I have a variable ...