Search Results

Search found 77 results on 4 pages for 'claudiu'.

Page 2/4 | < Previous Page | 1 2 3 4  | Next Page >

  • HTML element that contains no formatting

    - by Claudiu
    I'm constantly modifying some text on a web page with JavaScript. I want the text to be in-line with other elements, like texts, inputs, etc. What HTML element should I use? Both <div> and <p> create new-lines and other things. <b> kind of does what I want, but it bolds all the text. What's the correct alternative?

    Read the article

  • Relation between [[Prototype]] and prototype in JavaScript

    - by Claudiu
    From http://www.jibbering.com/faq/faq_notes/closures.html : Note: ECMAScript defines an internal [[prototype]] property of the internal Object type. This property is not directly accessible with scripts, but it is the chain of objects referred to with the internal [[prototype]] property that is used in property accessor resolution; the object's prototype chain. A public prototype property exists to allow the assignment, definition and manipulation of prototypes in association with the internal [[prototype]] property. The details of the relationship between to two are described in ECMA 262 (3rd edition) and are beyond the scope of this discussion. What are the details of the relationship between the two? I've browsed through ECMA 262 and all I've read there is stuff like: The constructor’s associated prototype can be referenced by the program expression constructor.prototype, Native ECMAScript objects have an internal property called [[Prototype]]. The value of this property is either null or an object and is used for implementing inheritance. Every built-in function and every built-in constructor has the Function prototype object, which is the initial value of the expression Function.prototype Every built-in prototype object has the Object prototype object, which is the initial value of the expression Object.prototype (15.3.2.1), as the value of its internal [[Prototype]] property, except the Object prototype object itself. From this all I gather is that the [[Prototype]] property is equivalent to the prototype property for pretty much any object. Am I mistaken?

    Read the article

  • Database with "Open Schema" - Good or Bad Idea?

    - by Claudiu
    The co-founder of Reddit gave a presentation on issues they had while scaling to millions of users. A summary is available here. What surprised me is point 3: Instead, they keep a Thing Table and a Data Table. Everything in Reddit is a Thing: users, links, comments, subreddits, awards, etc. Things keep common attribute like up/down votes, a type, and creation date. The Data table has three columns: thing id, key, value. There’s a row for every attribute. There’s a row for title, url, author, spam votes, etc. When they add new features they didn’t have to worry about the database anymore. They didn’t have to add new tables for new things or worry about upgrades. This seems like a terrible idea to me, but it seems to have worked out for Reddit. Is it a good idea in general, though? Or is it a peculiarity of Reddit that happened to work out for them?

    Read the article

  • Skip List vs. Binary Tree

    - by Claudiu
    I recently came across the data structure known as a Skip list. They seem to have very similar behavior to a binary search tree... my question is - why would you ever want to use a skip list over a binary search tree?

    Read the article

  • Code Golf - Banner Generation

    - by Claudiu
    When thanking someone, you don't want to just send them an e-mail saying "Thanks!", you want to have something FLASHY: Input: THANKS!! Output: TTT H H AAA N N K K SSS !!! !!! T H H A A NNN K K S !!! !!! T HHH AAA NNN KK SSS !!! !!! T H H A A N N K K S T H H A A N N K K SSS !!! !!! Write a program to generate a banner. You only have to generate upper-case A-Z along with spaces and exclamation points (what is a banner without an exclamation point?). All characters are made up of a 3x5 grid of the same character (so the S is a 3x5 grid made of S). All output should be on one row (so no newlines). Here are all the letters you need: Input: ABCDEFGHIJKL Output: AAA BBB CCC DD EEE FFF GGG H H III JJJ K K L A A B B C D D E F G H H I J K K L AAA BBB C D D EE FF G G HHH I J KK L A A B B C D D E F G G H H I J J K K L A A BBB CCC DD EEE F GGG H H III JJJ K K LLL Input: MNOPQRSTUVWX Output: M M N N OOO PPP QQQ RR SSS TTT U U V V W W X X MMM NNN O O P P Q Q R R S T U U V V W W X M M NNN O O PPP Q Q RR SSS T U U V V WWW X M M N N O O P QQQ R R S T U U V V WWW X M M N N OOO P QQQ R R SSS T UUU V WWW X X Input: YZ! Output: Y Y ZZZ !!! Y Y Z !!! YYY Z !!! Y Z YYY ZZZ !!! The winner is the shortest source code. Source code should read input from stdin, output to stdout. You can assume input will only contain [A-Z! ]. If you insult the user on incorrect input, you get a 10 character discount =P. I was going to require these exact 27 characters, but to make it more interesting, you can choose how you want them to look - whatever makes your code shorter! To prove that your letters do look like normal letters, show the output of the last three runs.

    Read the article

  • HTML Slider element?

    - by Claudiu
    I'm coding an app (temporarily up here), and I want to make its parameters modifiable. I feel the best way to do this would be with your standard GUI slider elements (a la this, but not so ugly). I just noticed that the DOM doesn't provide these, however... What's the best way to introduce sliders to a webpage? Is there a standard library that everybody uses? Should I just roll my own? Or should is there a different element I can use? Should I embed them in the canvas element somehow?

    Read the article

  • Palindrome Golf

    - by Claudiu
    The goal: Any language. The smallest function which will return whether a string is a palindrome. Here is mine in Python: R=lambda s:all(a==b for a,b in zip(s,reversed(s))) 50 characters. The accepted answer will be the current smallest one - this will change as smaller ones are found. Please specify the language your code is in.

    Read the article

  • Javascript comma operator

    - by Claudiu
    When combining assignment with comma (something that you shouldn't do, probably), how does javascript determine which value is assigned? Consider these two snippets: function nl(x) { document.write(x + "<br>"); } var i = 0; nl(i+=1, i+=1, i+=1, i+=1); nl(i); And: function nl(x) { document.write(x + "<br>"); } var i = 0; nl((i+=1, i+=1, i+=1, i+=1)); nl(i); The first outputs 1 4 while the second outputs 4 4 What are the parentheses doing here?

    Read the article

  • What language is used in Google Desktop gadgets?

    - by Claudiu
    The language Google Desktop gadgets use resembles JavaScript, but it's different in subtle ways. For example, I saw this line in a gadget: options(HISTORY_OPTIONS_NAME) = items_.join("|"); which looks like it's assigning to a function call. That's just not OK in JavaScript... what language is this? And what exactly is that line doing?

    Read the article

  • Problem making local copy of a webpage

    - by Claudiu
    I want to run this chrome experiment locally. I copied the .html and .js files, along with the two .jpgs that the demo uses. However, when I run it off my local drive, Chrome gives this error: light.js:89 - Uncaught Error: SECURITY_ERR: DOM Exception 18 Line 89 returns the image data from the canvas after drawing the image to it. What's causing this security exception? It seems to not be Chrome-specific, as Firefox gives the same error.

    Read the article

  • Derivative of a Higher-Order Function

    - by Claudiu
    This is in the context of Automatic Differentiation - what would such a system do with a function like map, or filter - or even one of the SKI Combinators? Example: I have the following function: def func(x): return sum(map(lambda a: a**x, range(20))) What would its derivative be? What will an AD system yield as a result? (This function is well-defined on real-number inputs).

    Read the article

  • In C, do braces act as a stack frame?

    - by Claudiu
    If I create a variable within a new set of curly braces, is that variable popped off the stack on the closing brace, or does it hang out until the end of the function? For example: void foo() { int c[100]; { int d[200]; } //code that takes a while return; } Will d be taking up memory during the code that takes a while section?

    Read the article

  • Python + PostgreSQL + strange ascii = UTF8 encoding error

    - by Claudiu
    I have ascii strings which contain the character "\x80" to represent the euro symbol: >>> print "\x80" € When inserting string data containing this character into my database, I get: psycopg2.DataError: invalid byte sequence for encoding "UTF8": 0x80 HINT: This error can also happen if the byte sequence does not match the encodi ng expected by the server, which is controlled by "client_encoding". I'm a unicode newbie. How can I convert my strings containing "\x80" to valid UTF-8 containing that same euro symbol? I've tried calling .encode and .decode on various strings, but run into errors: >>> "\x80".encode("utf-8") Traceback (most recent call last): File "<pyshell#14>", line 1, in <module> "\x80".encode("utf-8") UnicodeDecodeError: 'ascii' codec can't decode byte 0x80 in position 0: ordinal not in range(128)

    Read the article

  • in-memory database in Python

    - by Claudiu
    I'm doing some queries in Python on a large database to get some stats out of the database. I want these stats to be in-memory so other programs can use them without going to a database. I was thinking of how to structure them, and after trying to set up some complicated nested dictionaries, I realized that a good representation would be an SQL table. I don't want to store the data back into the persistent database, though. Are there any in-memory implementations of an SQL database that supports querying the data with SQL syntax?

    Read the article

  • pyparsing ambiguity

    - by Claudiu
    I'm trying to parse some text using PyParser. The problem is that I have names that can contain white spaces. So my input might look like this: Joe Bob Jimmy Foo Joe decides to eat. Bob decides to not eat. Jimmy Foo decides to eat. How can I create a parser for the decides to eat line? If I create my name parser naively, meaning with alphabetic characters plus space characters, then it will match the entire line.

    Read the article

  • Fibonacci Code Golf

    - by Claudiu
    Generate the Fibonacci sequence in the fewest amount of characters possible. Any language is OK, except for one that you define with one operator, f, which prints the Fibonacci numbers. Starting point: 25 characters in Haskell: f=0:1:zipWith(+)f(tail f)

    Read the article

< Previous Page | 1 2 3 4  | Next Page >