I'm using inflector Pluralize and Singularize functions.
I want to know if there is a ready library that know to decide if a word needs to be Pluralize or Singularize based on a number.
Like:
0 articles
1 article
2 articles
I am working on a project that stores multiple versions in the same svn repo but in different directories. For ease of reference for the coders working on the project I'd like to be able to add a commented tag similarly to
# $Revision: 144 $
However, instead of the file revision it should contain a simple version number like so:
# $Version: 1.63 $
# $Version: 1.64 $
# $Version: 2.0 $
Is there a way to get subversion to do this automatically for a specific directory and all sub-directories as well as for any new files added to those?
Input : {5, 13, 6, 5, 13, 7, 8, 6, 5}
Output : {5, 5, 5, 13, 13, 6, 6, 7, 8}
Question is to arrange the numbers in the array in decreasing order of their frequency preserving the order of their occurrence.
If their is a tie, for example, here 13 and 6 then the number occurring first in input array would come first in output array.
Hi,
I need to define an appender for log4net in a way that I get one log file for each day, but the total number of files are limited to, let's say, 30. That is I want to keep only the logs not older then 30 days, delete the older ones.
I've tried doing it with RollingFileAppender, but it seems that specifying a limit of files to keep is not supported. Do you know of an alternative solution that I could use?
let's say I have this query:
select * from table1 r where r.x = 5
do the speed of this query depends on the number of rows that are present in table1 ?
Hello
I would like to create, in a function, a boucle to create a data.frame with a variable number of columns.
WIth something like :
a = c("a","b")
b = c(list(1,2,3), list(4,5,6))
data.frame(a,b)
I would like to get a data-frame like :
a 1 2 3
b 4 5 6
Instead of I obtain :
a 1 2 3 4 5 6
b 1 2 3 4 5 6
Thank you !
PS : I also try with rbind, but it's doesn't work...
I have a site that is mainly showing a paged list of content (articles, data element's, etc.), and I'm wondering about returning HTTP 404 when user navigates outside of the available list range.
Some sites just display "No results/Page number out of range" and some return additionally return HTTP 404 status.
What's your take on that, and why?
UPDATE
It's not and api response. This question is in regard to user viewed pages that among other things show a list/table in the main area.
How to count the number of right children in a binary tree?
This means that I only want the children marked as right.
Ex. (Left | Right)
F(Root)
G | H
T U | I J
The right children would be U,H,and J.
What would be the algorithm to find these.
Hi all, my app is an e-commerce application. During the checkout process, I have "recipient" and "credit card" screens. In the recipient screen, there are number of fields for address entry, which makes it very clumsy. Same in the case of the credit card screen, where the user is asked to enter their credit card info and billing address.
Can anyone suggest how to design these two pages?
What's the fastest way to count the number of keys/properties of an object? It it possible to do this without iterating over the object? i.e. without doing
var count = 0;
for (k in myobj) if (myobj.hasOwnProperty(k)) count++;
Firefox provides a magic __count__ property, but this isn't available in other implementations.
if ([tempArray containsObject: [sectionInfo indexTitle]])
{
return nil;
}else
{
[tempArray addObject: [sectionInfo indexTitle]];
return [sectionInfo indexTitle];
}
return [sectionInfo indexTitle];
The code above groups the cells in alphabetical order but displays a blank header instead of the appropriate title. Could this possibly be because I did not specify the number of headers? This would naturally be a single header for every letter in the alphabet.
Take the following code in C/C++, for example:
int foo[] = {0, 0, 0, 0};
No magic numbers, right?
Now, the Python "equivalent" of that would be:
foo = [0, 0, 0, 0]
Still no magic numbers.
However, in Python, that same thing can be written like this:
foo = [0] * 4
And now we DO have a magic number. Or do we?
I'm guessing this and other similar things are present on these and other languages.
df <- data.frame(var1=c('a', 'b', 'c'), var2=c('d', 'e', 'f'), freq=1:3)
What is the simplest way to expand the first two columns of the data.frame above, so that
each row appears the number of times specified in the column 'freq'?
In other words, go from this:
>df
var1 var2 freq
1 a d 1
2 b e 2
3 c f 3
To this:
>df.expanded
var1 var2
1 a d
2 b e
3 b e
4 c f
5 c f
6 c f
I have a scores table that has two fields:
user_id
score
I'm fetching specific rows that match a list of user_id's. How can I determine a rank for each row relative to the total number of rows, based on score? The rows in the result set are not necessarily sequential (the scores will vary widely from one row to the next). I'm not sure if this matters, but user_id is a unique field.
When a cell in a spreadsheet contains a simple date (mm/dd/yyyy) the poi API flags the cell-type as 'numeric'. This is probably because spreadsheets ( IMO ) historically recognize only strings and real numbers.
It is possible to hard-code the cell-index, and use it conditionally to call 'getDateCellValue'. But this feels like a hack.
What other ways are there in the poi API to determine whether the content in a cell is a Date rather than a real number?
I'm looking to convert single digit numbers to two-digit numbers like so:
9 ==> 09
5 ==> 05
12 == 12
4 ==> 04
I figure I could put a bunch of if-else statements (if number is under 10, then do a gsub) but figure that's horrible coding. I know Rails has number_with_precision but I see that it only applies to decimal numbers. Any ideas on how to convert single-digits to two-digits?
I'm coming up with a web app which will want me to store more than 80 Lakh (8 million) rows. Will it be fine to handle those many number of rows with MySQL without having any performance degradation?
Assume my RAM to be 4 GB and Infinity GB Harddisk space. Also, the main fields have been indexed.