Questions tagged [user-defined]

253 questions
174
votes
17 answers

Set Locale programmatically

My app supports 3 (soon 4) languages. Since several locales are quite similar I'd like to give the user the option to change locale in my application, for instance an Italian person might prefer Spanish over English. Is there a way for the user to…
Roland
  • 5,328
  • 10
  • 37
  • 55
151
votes
3 answers

How is __eq__ handled in Python and in what order?

Since Python does not provide left/right versions of its comparison operators, how does it decide which function to call? class A(object): def __eq__(self, other): print "A __eq__ called" return self.value == other class…
PyProg
  • 1,525
  • 2
  • 10
  • 4
65
votes
11 answers

Calling a user defined function in jQuery

I am trying to call a user defined function in jQuery: $(document).ready(function() { $('#btnSun').click(function() { myFunction(); }); $.fn.myFunction = function() { alert('hi'); } });
user269867
  • 3,266
  • 9
  • 45
  • 65
54
votes
8 answers

Adding a user-defined language in Notepad++

I'm trying to add the syntax plugin for the Go programming language in Notepad++. There is a repository for such user-defined languages. I downloaded and unzipped the Go files, which contained a README, a userDefinedLang_Go.xml, and go.xml. I…
Brendan Tracey
  • 656
  • 1
  • 5
  • 5
20
votes
6 answers

Failed to set () user defined inspected property on (UIButton)

In a simple ViewController, I added one UIButton. I would like to use "User Defined Runtime Attributes". For now I added the default Bool attribute. The button is an @IBOutlet: @IBOutlet var button:UIButton! The link in the storyboard is done. I…
cmii
  • 3,556
  • 8
  • 38
  • 69
17
votes
1 answer

List all User-defined Variables & Functions in a Notebook in Mathematica

Is there a way to list all the user-defined variables & function in a Notebook ? I would like this for the comfort it brings to a notebook overview as well as to spot potential multiple use of a variable name (thus redefining it accidental)
500
  • 6,509
  • 8
  • 46
  • 80
17
votes
3 answers

Make a user-created function in R

I'm sorry if this has been asked before but I can't find the answer. Let's say I write a small function in R add2<-function(a){ return(a+2) } I save it as add2.R in my home directory (or any directory). How do I get R to find it?? > add2(4) Error:…
stuppie
  • 384
  • 1
  • 8
  • 18
14
votes
3 answers

How to use user-defined class object as a networkx node?

Class point is defined as (there are also some methods, atributes, and stuff in it, but this is minimal part): class point(): def ___init___(self, x, y): self.x = x self.y = y So, I saw this question, but when I tried applying…
Luka Petrović
  • 329
  • 3
  • 9
12
votes
1 answer

User-defined variable in an INSERT query for MySQL

I need to use user-defined variable in an INSERT query for MySQL, see an example bellow: INSERT INTO `posts`(`id`) VALUES(NULL); SET @last_insert_id = LAST_INSERT_ID(); INSERT INTO `comments`(`id`, `post_id`) VALUES(NULL, "@last_insert_id"); This…
Igor Timoshenko
  • 1,001
  • 3
  • 14
  • 27
11
votes
2 answers

How to copy user libraries between workspaces in Eclipse

I was mistaken in thinking that the user libraries I define in one workspace would be available in all and subsequently created workspaces. So I created a new workspace to organize the myriad of projects, but alas my user-defined libraries did not…
Alexx
  • 3,572
  • 6
  • 32
  • 39
11
votes
1 answer

Where To Put User-defined Classes in Rails

I'm trying to to use this class http://robbyonrails.com/articles/2005/05/11/parsing-a-rss-feed but am not sure where to place the file so that it functions like a helper.
Dex
  • 12,527
  • 15
  • 69
  • 90
9
votes
3 answers

Create Error with custom text that prevents compiling in VB.NET (#error in C#)

You can add a preprocessor directive to cause an error at compile time in C# like this: #error This will cause a divide by zero How can I do the same as this in vb.net? or Is there another way to create an error that provides custom helpful…
jth41
  • 3,808
  • 9
  • 59
  • 109
8
votes
1 answer

User-defined infix operators

It is easy to introduce new infix operators in C++ // User-defined infix operator framework template struct LeftHelper { const LeftOperand& leftOperand; const Operation& operation; …
n. m. could be an AI
  • 112,515
  • 14
  • 128
  • 243
7
votes
1 answer

Approaches to preserving object's attributes during extract/replace operations

Recently I encountered the following problem in my R code. In a function, accepting a data frame as an argument, I needed to add (or replace, if it exists) a column with data calculated based on values of the data frame's original column. I wrote…
Aleksandr Blekh
  • 2,462
  • 4
  • 32
  • 64
7
votes
4 answers

Comparison of JSON and User-Defined types in Postgres 9.3

I wonder why there is so much fuss about JSON support in Postgres 9.3. What are advantages of JSON over User-defined types (UDTs)? What are pitfalls in using UDTs? Is access to tables with UDTs inefficient? Is ALTER TYPE ADD attribute slow? How are…
rlib
  • 7,444
  • 3
  • 32
  • 40
1
2 3
16 17