I've seen this issue in php and javascript. I have this number: float 0.699
if I do this:
0.699 x 100 = 69.89999999999999
why?
edit
round(0.699 x 10, 2): float 69.90000000000001
see this example:
int *array = malloc (10 * sizeof(int))
Then free only the first 3 blocks?
Or make equal java, have an array with negative index, or an index that not began with 0.
Thanks a lot.
I know how to do it mathematically, but i want it now to do it in c++ using some easy algorithm. Is is possible?
The question is that i need some methods/ideas for writing a number N in base M, for example 1410 in base 3: (14)10 = 2*(3^0) + 1*(3^1) + 1*(3^2) = (112)3 etc.
I'm using :
$(window).scroll(function () {
if ($(window).scrollTop() + 10 >= ($(document).height() - $(window).height())) {
loadContent();
}
}
It works fine with Chrome, IE, Firefox but except in Safari. In function loadContent, I used JSON to load data, as this tutorial. But while I test in Safari, It takes the content twice from JSON. If the other takes 9 items, then Safari takes 18 items.
Does anyone know how to solve this problem?
Thanks.
I have a webapplication linked to a mysql database with the following fields:
field 1:trip_id
field 2:trip_destination
field 3:trip_description
field 4:trip_duration
In the webapplication I have a listbox based on the following:
ListBox value =1: trip duration 1 - 5 days
ListBox value =2: trip duration 6 - 10 days
Listbox value =3: trip duration 11 -20 days
ListBox value =4: trip duration over 20 days
How do I put this in the sql select statement?
I was wondering if there is a 'smooth way' of redeploying a Java WAR to a production server (no cluster, no OSGi)?
All I can come up with is stop server, update file, restart server. And 10 minutes beforehand I need to display a maintenance warning on the site.
What's your approach?
Hey, take this as a challange, my informatics professor made it in less than 10 rows, it work perfectly and its very efficient. I'd like to "surprise" him giving a better/shorted version of it. Ofcourse i wouldn't take the credits, hah, u can trust in me.
It's a simple anagras finder! If you can.. write it in c++! thanks!
In an app I'm profiling, I found that in some scenarios this function is able to take over 10% of total execution time.
MSVC++ 2008 compiler is being used, for reference... I don't recall if modf maps to a single instruction or if there is likely any way to make it faster.
see also here for similar question on sqrt function
Rails is setting and returning a remember_token cookie like this:
= cookies[:remember_token]
= value6c69b17681d2bf316f8eexpiresThu Jun 10 14:55:00 -0400 2010
In other words, when I'm calling the cookie I don't just get the value. Why is this?
I am setting the cookie as follows:
cookies[:remember_token] = { :value => @user.remember_me, :expires => 1.year.from_now}
What's going on here?
I'm working on a python class that is being shared between two products. 90% of the functionality applies to both products. For the 10% that's different the code is littered with this kind of thing:
#Start of file
project = 'B'
#Some line of code
if project == 'A':
import moduleA
elif project == 'B':
import moduleB
#Many lines of code
if project == 'A':
print moduleA.doA(2)
elif project == 'B':
print moduleB.doB(2)
This doesn't seem very elegant or very readable, has anyone encountered this sort of thing before? Are there better ways of doing it?
Free as in beer. I can live without the source code.
About 10 years ago I saw a commercial product. Is there anything free now?
I found Gispf on SourceFOrge, but there are no downloads. Otherwise I Can't find a thing.
Edit: I'd prefer something approaching the whole system, but could manage to live with the editor
Edit" TSI is "the old Time-Sharing Option on IBM mainframes"
Camarades,
My Visual Studio is in trouble in keyboard. I am working normally, when suddenly my keyboard loses its configuration, so where is the "" becomes "/".
Someone can tell me what would be a possible solution? (Yes, I know something is hazy).
Or has left some Pachter fix for problems like this.
Grateful for any help.
Success for all.
Microsoft Visual Studio 2010
Version 10.0.30319.1 RTMRel
If I have:
std::size_t bagCapacity_ = 10;
std::size_t bagSize = 0;
A** bag = new A*[bagCapacity_];
while (capacity--)
{
bag[capacity] = new A(bagSize++);//**here I'm loading this array from the end is it ok?**
}
And also can I delete those object from starting at the end of the array?
while(capacity--)
{
delete bag[capacity];
}
Question in a code.
I have two database say DB_A and DB_B. In DB_A database, table having huge data (few tables are having 2 to 10 million data). I want to move the all table data from DB_A to DB_B database. Please help me on writing stored procedures to move efficiently (fast) the data from one database to another.
I am unable to open a Visual Studio 2005 solution under vss. The solution contains an Asp.net web site and around 10 more projects. I have already taken the latest source code from vss client. I have also made everything writeable. All I want to do is to see if the latest from Vss compiles in my machine.
Is there anything I am missing here?
in R , when i use "print", i can see all the values, but how can i save this as a vector
for example, in for loop,
for (i in 1:10), i want the value of A , when i= 1,2,3,4..... but if i use the x=A, it only have the final value of A which is the value when i = 10. so , how can i save the vaule in print(A)
I have setup OpenVPN on my server, and I am able to connect to it just fine, and browse the web, etc, from the client box.
If I set the following option in the client config, I can no longer browse the web via domain name:
redirect-gateway def1
On the server, I have run the following command:
iptables -t nat -s 10.8.0.0/24 -A POSTROUTING -j SNAT --to myserver'sIP
but that hasn't changed anything.
Can anyone help suggest something?
I'm running mysql5 on Mac os x 10.5.8 and got this error.
How do I solve this?
The DB worked fine but stopped working after system update.
I think its something related to the socket file which is /tmp/mysql.sock
do I need to give it special permissions and owner?
Thanks
Hello,
Googling nor binging "VC++ What's new C++0x" gives me nothing that tells me what is new.Is there an official page at msdn or something similiar that contains the information for VC++ 10? I've seen such for C#,there must be one for what I'd enjoy to read.
If not, please list the new features available in Visual Studio 2010 for VC++.
Content of X.c:
int i;
main ()
{
fun ();
}
Content of Y.c:
int i;
fun ()
{
}
Why does these two files compile with no error ? (using GCC)
But if i use int i = 10; it prints a multiple definition error.
I really wish that Google was better at searching for syntax:
decades :: (RealFrac a) => a -> a -> [a] -> Array Int Int
decades a b = hist (0,9) . map decade
where decade x = floor ((x - a) * s)
s = 10 / (b - a)
Hey, I'm having trouble with a relative positioned footer. I'm using a clearfooter div to keep the footer at the bottom of each of my pages. This works fine for all resolutions except for 1440x900, any ideas why this resolution would make the header raise up 10 or so pixels off the bottom?
CODE: http://pastie.org/929802
How do I randomly select a value for an enum type in C++?
I would like to do something like this.
enum my_type(A,B,C,D,E,F,G,h,J,V);
my_type test(rand() % 10);
But this is illegal... there is not an implicit conversion from int to an enum type.