How can I insert all dates in an year(or more) in a table using sql
My dates table has following structure
dates(date1 date);
Suppose I want to insert dates between "2009-01-01" to "2010-12-31" inclusive.
Is there any sql query for the above?
Assign the following 25 scores to a one dimensional int array called "temp"
34,24,78,65,45,100,90,97,56,89,78,98,74,90,98,24,45,76,89,54,12,20,22,55,66
Move the scores to a 2 dimensional int array called "scores" row wise
-- meaning the first 5 scores go into row 0 etc
Hello, My TeamCity's nightly build produces more than 130Mb java doc as Build Configuration artifact.
I have to share these artifact for other teams(developers), but javadoc every time has another one URL(I know that it's possible to get it like .lastFinished), and get's new place on Build Machine.
Is it possible on each build replace old artifact with new one because I don't need need previous versions? And have independent from build version URL for accessing.
I know the standard Major.Minor.Build.Revision but there's several considerations for us that are somewhat unique
-We do internal releases almost daily, occasionally more than once a day.
-Windows Installer doesn't check Revision so that's almost moot for our purposes.
-Major and Minor numbers ideally are only updated for public releases and should be done manually.
-That leaves the Build # that needs to be automatically updated.
-We want internal releases to be able to be performed from any developer's machine so that leaves out using x.x.* in Visual Studio because different numbers could be generated from different machines and each build isn't guaranteed to be larger than the previous.
-We have about 15 or so projects as part of the product so saving the version numbers in SVN isn't ideal since every release we'd have commit all those files.
Given those criteria I can't really come up with a good versioning scheme. The last 2 criteria could be dropped but meeting all of those seems ideal. A date stamp is insufficient because we might do more than one a day, and given the max size of Uint32 (around 64000) (Actually using WiX it complains about numbers higher than Int32.MaxValue) a date/time won't fit.
Hi guys!
So this is probably programming 101 stuff, but I have a problem: I have 2 numbers which are between 0 and 49. Let's call them x and y. Now I want to get a couple of other numbers which are not x or y, but are also between 0 and 49 (I am using Objective C but this is more of a general theory question I think?).
Method I thought of is:
int a;
int b;
int c;
do {
a = arc4random() % 49;
} while ((a == x) || (a == y));
do {
b = arc4random() % 49;
} while ((b == x) || (b == y) || (b == a));
do {
c = arc4random() % 49;
} while ((c == x) || (c == y) || (c == a) || (c == b));
But it seem kind of bad to me, I don't know, I am just trying to learn to be a better programmer, what would be the most elegant sweet way to do this for best practices?
Thanks!
I want to create a program for generating the series for the given base-n. ,
for example if my input is 2,then series shuould be, 00,01,10,11,etc.,(binary)
if my input is 10,then series shuould be,1,2,3,4,5,etc.,(decimal)
is there any general mechanism to find these numbers so that I can program for base-n.,
I have a variable with the following value
$month = 201002;
the first 4 numbers represent the year, and the last 2 numbers represent the month. I need to get the last 2 numbers in the month string name eg. Feb
My code looks like this
<?php echo date('M',substr($month,4,6)); ?>
I can I go about to obtain the month name
Hi all,
I have this query:
SELECT DISTINCT brand_name FROM masterdata WHERE in_stock = '1' ORDER BY brand_name
It works well, except that I get far too many results. How do I limit this such that rather than just looking for distinct entries, it will only give me distinct entries that exist a minimum of 3 times (for example)?
Basically, if the column had this data...
brand_name
==========
apple
banana
apple
apple
orange
banana
orange
orange
...my current query would return "apple, banana, orange". How do I get it such that it only returns "apple, orange" (ignoring banana because it has less than three occurrences)?
I'm using PHP to build the query, if it matters.
Thanks!
Hi,
In Python if I have 2 lists say:
l1 = ['a', 'b', 'c', 'd']
l2 = ['c', 'd', 'e']
is there a way to find out how many elements they have the same. In the case about it would be 2 (c and d)
I know I could just do a nested loop but is there not a built in function like in php with the array_intersect function
Thanks
Hi All,
I got one problem while doing one TAPI application based project in C#. I'm using ITAPI3.dll
My problem is.. i'm not getting incoming call information. To get the incoming call information, i'm using the getcallinfo function, but it is showing empty message.
Hi,
I am trying to get access to the AssemblyVersion and AssemblyFileVersion numbers in the assembly information using the post build event command line in visual studio 2008. Is there a way to get access to that information similar to how $(TargetName) gets its macro definition from the project title.
I've used boost::gregorian::date a bit now.
I can see that there are the related months & years & weeks duration types.
I can see how to use known durations to advance a given date.
Qu: But how can I get the difference between two dates in months (or years or weeks) ?
I was hoping to find a function like:
template<typename DURATION>
DURATION date_diff<DURATION>(const date& d1,const date& d2);
There would need to be some handling of rounding too.
Hello,
I have an SQL-table holding the last hands received by a player in card game. The hand is represented by an integer (32 bits == 32 cards):
create table pref_hand (
id varchar(32) references pref_users,
hand integer not NULL check (hand > 0),
stamp timestamp default current_timestamp
);
As the players are playing constantly and that data isn't important (just a gimmick to be displayed at player profile pages) and I don't want my database to grow too quickly, I'd like to keep only up to 10 records per player id. So I'm trying to declare this PL/PgSQL procedure:
create or replace function pref_update_game(_id varchar,
_hand integer) returns void as $BODY$
begin
delete from pref_hand offset 10 where id=_id order by stamp;
insert into pref_hand (id, hand) values (_id, _hand);
end;
$BODY$ language plpgsql;
but unfortunately this fails with:
ERROR: syntax error at or near "offset"
because delete doesn't support offset. Does anybody please have a better idea here?
Thank you! Alex
I have written the following program using Parallel Haskell to find the divisors of 1 billion.
import Control.Parallel
parfindDivisors :: Integer->[Integer]
parfindDivisors n = f1 `par` (f2 `par` (f1 ++ f2))
where f1=filter g [1..(quot n 4)]
f2=filter g [(quot n 4)+1..(quot n 2)]
g z = n `rem` z == 0
main = print (parfindDivisors 1000000000)
I've compiled the program with ghc -rtsopts -threaded findDivisors.hs and I run it with:
findDivisors.exe +RTS -s -N2 -RTS
I have found a 50% speedup compared to the simple version which is this:
findDivisors :: Integer->[Integer]
findDivisors n = filter g [1..(quot n 2)]
where g z = n `rem` z == 0
My processor is a dual core 2 duo from Intel.
I was wondering if there can be any improvement in above code. Because in the statistics that program prints says:
Parallel GC work balance: 1.01 (16940708 / 16772868, ideal 2)
and SPARKS: 2 (1 converted, 0 overflowed, 0 dud, 0 GC'd, 1 fizzled)
What are these converted , overflowed , dud, GC'd, fizzled and how can help to improve the time.
Is there a way to set a limit on how many menu items users can add to Primary Links menu? I'm working on a Drupal site and I have a horizontal primary links nav bar. There is only room for no more than 7-8 links in the nav bar. I don't want the future maintainer of the site to add more than 8 items to the menu. Is there a way I can set a limit on that? Some module or override function?
Thanks,
can any one please let me know, i need to set the "Total Price" value to be in two decimal point value like "56.35". Now its showing more fraction values like "56.3566666". I need it to be format it by musql "SELECT" query.
here is the script does what i want but not exactly,
my question is, how can i stop user entering text once it reached the lmit of 255 characters?
var limit = 255;
var txt = $('textarea[id$=txtPurpose]');
$(txt).keyup(function() {
var len = $(this).val().length;
if (len > limit) {
//this.value = this.value.substring(0, 50);
$(this).addClass('goRed');
$('#spn').text(len - limit + " characters exceeded");
return false;
}
else {
$(this).removeClass('goRed');
$('#spn').text(limit - len + " characters left");
}
});
if there is a better way please let me know.
I work in Javascript with integer numbers only (mainly adding numbers and shifting them). I wonder how big they can be without loosing any bits.
For example, how big X can be such that 1 << X will represent 2^X ?
I am trying to figure out how to manage a Datagrid based on an XML object like this:
<matrix rows="5" columns="5">
<column>
<row>0.5</row>
<row>0.21</row>
</column>
<column>
<row>0.6</row>
<row>0.9</row>
</column>
<column>
<row>0.5</row>
<row>0.5</row>
</column>
<column>
<row>0.8</row>
<row>0.4</row>
</column>
</matrix>
I will need to populate the Datagrid column names based on a different XML object and use the above XML to populate each of the column's rows. I currently am able to create the Datagrid and populate its column headers but I am unsure as to how to how to add the rows for each column. The above XML will be update with new row and column elements added and deleted. This, of course, will be bound to the Datagrid to show updates.
Thanks in advanced for your help.
I got to a point where it's very difficult to get answers by debugging and tracing object, so i need some help.
What I'm trying to do:
A history form for my screen capture pet project. The history must list all images as thumbnails (ex: picasa).
What I've done:
I created a HistoryItem:UserControl.
This history item has a few buttons, a check box, a label and a picture box. The buttons are for delete/edit/copy image. The check box is used for selecting one or more images and the label is for some info text. The picture box is getting the image from a public property that is a path and a method creates a proportional thumbnail to display it when the control has been loaded. This user control has two public events. One for deleting the image and one for bubbling the events for mouse enter and mouse leave trough all controls. For this I use EventBroadcastProvider. The bubbling is useful because wherever I move the mouse over the control, the buttons appear. The dispose method has been extended and I manually remove the events.
All images are loaded by looping a xml file that contains the path of all images. For each image in this XML I create a new HitoryItem that is added (after a little coding to sort and limit the amount of images loaded) to a flow layout panel.
The problem:
When I lunch the history form, and the flow layout panel is populated with my HistoryItem custom control, my memory usage increases drastically.From 14Mb to around 100MB with 100 images loaded. By closing the history form and disposing whatever I could dispose and even trying to call GC.Collect() the memory increase remain. I search for any object that could not be disposed properly like an image or event but wherever I used them they are disposed. The problem seams to be from multiple sources. One is that the events for bubbling are not disposing properly, and the other is from the picture box itself. All of this i could see by commenting all the code to a limited version when only the custom control without any image processing and even events is loaded. Without the events the memory consumption is reduced by axiomatically 20%.
So my real question is if this logic, flow layout panels and custom controls with picture boxes, is the best solution for displaying large amounts of images as thumbnails.
Thank you!
I know of an Eclipse feature to show revision information (gradual coloring, more info like revisionnumber, date and author on mouseover) for the last changes in a line in the linenumbers-view.
Does anyone know how to activate this feature for a file, or even better, by default? I accidently hit some shortcut lately which made it show in one file, it does not show up in the others, though.