0
votes
1answer
43 views

Box(x,y,X,Y), box(x,X,y,Y), box(x,w,y,h), box(x,y,w,h) or box(fromPos,toPos)?

Say you are representing a box, or creating a function that slices a 2d array, or whatever. How do you represent it?
2
votes
1answer
75 views

Most efficient way to insert into ordered sequence

I have a dashboard like interface, that can have many tabs. There can be as many or as few tabs as the user likes, with the user being allowed to re order them as they wish. Exactly like browsers do. ...
0
votes
1answer
53 views

Turning multiple PHP arrays into one array ready for conversion to Javascript

I am creating a multiple choice quiz game with PHP and Javascript. Questions can have 2 to 6 answers. I have been using the PHP queries in the code below to get arrays of the questions of a quiz, and ...
3
votes
1answer
71 views

Better Javascript to find unique values in an array

My objective is to make an array of unique keys from a list of objects. Example: Input: var input = [{"a":1, "b":2}, {"a":3, "c":4}, {"a":5}] Output: [ "a", "b", "c" ] Current approach: var ...
2
votes
1answer
64 views

Implement numbering scheme like A,B,C… AA,AB,… AAA…, similar to converting a number to radix26

I want to implement numbering scheme like Microsoft Word uses for numbering. first one gets = A,next is B, next is C, .... then AA, then AB,....and so on. as shown below A B C . . AA ...
3
votes
1answer
130 views

C# Array Mutator Methods to mimic JavaScript Array Mutator Methods

Between .NET's built-in collection libraries and LINQ extension methods, I never have to use arrays. An unfortunate consequence of this is that I am probably less competent in working with this very ...
0
votes
2answers
171 views

Improve speed of object-to-html transform in javascript?

I have a rather large javascript array of objects that I am transforming into an HTML table. Each object in the array looks like: { name:'Document Title', url:'/path/to/document.html', ...
1
vote
1answer
79 views

Shortening a webshop page

I am making a simple webshop page where I need to add a couple of products (and their prices). The shop consists of less than 10 products so therefore I decided to build my own solution since it is ...
2
votes
1answer
129 views

User data storage

I am writing my own website where users sign up. It then saves that data in an array. I want to know if this is effective or if there are better ways to do it. var isLoggedOn = false; var ...
1
vote
1answer
23 views

Find the object that contains title1-2

I use jQuery and underscore.js, I have title1-2 and I would like to have the action corresponding. this.items = { menuItems: [ { title: 'title1', data: [ { ...
1
vote
2answers
100 views

Help me condense a series of lengthy javascript conditional arrays

I'm not too used to working with arrays in javascript, so was wondering if there is a good way to condense this down. Any pointers much appreciated! you can see it in action @ ...
1
vote
3answers
291 views

Optimize Array.indexOf

How can I optimize checking a value in recursion before operating on it? I'm using Array.indexOf (this is Javascript) var nums = [], lengths = []; function findNumLength(n) { //preliminary check ...
1
vote
1answer
543 views

Change URL on select change

I've made a method, which inserts a new query parameter, when the value of a select changes, then reloads the page. I've had enough of URL jQuery hax, so I figured it would be a great idea to put the ...
0
votes
1answer
205 views

PSEUDO Query (jQuery extension)

I just invented PSEUDO Query! var objects = $.pquery([ '##pquery##', // Initialize as PSEUDO Query Object [document.body, 'css', [{'background-color':'#f00'}], 'append', ...
4
votes
1answer
511 views

Rearrange elements in two-dimensional array spiral order

Recently I was asked to write algorithm to rearrange elements in two-dimensional array in spiral order. Input array: Output array: [ 1, 2, 3, 4] [ 1, 2, 3, 4 ] [ ...

1 2
15 30 50 per page