Search Results

Search found 1325 results on 53 pages for 'factor'.

Page 33/53 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • How many instructions to access pointer in C?

    - by Derek
    Hi All, I am trying to figure out how many clock cycles or total instructions it takes to access a pointer in C. I dont think I know how to figure out for example, p-x = d-a + f-b i would assume two loads per pointer, just guessing that there would be a load for the pointer, and a load for the value. So in this operations, the pointer resolution would be a much larger factor than the actual addition, as far as trying to speed this code up, right? This may depend on the compiler and architecture implemented, but am I on the right track? I have seen some code where each value used in say, 3 additions, came from a f2->sum = p1->p2->p3->x + p1->p2->p3->a + p1->p2->p3->m type of structure, and I am trying to define how bad this is

    Read the article

  • R error message about variable lengths

    - by Abraham
    I ran the following code in order to recode the variable. Unfortunately, when I move to run an logit model (using the Zelig package), I get an error message that the variable length differ for this variable. ## Independent Variable - Partisanship (ANES 2004) data04$V043114 part <- data04$V043114 attributes(part) summary(part) partb < part partb[part %in% levels(part)[4]] <- NA partb[part %in% levels(part)[5]] <- NA partb[part %in% levels(part)[6]] <- NA partb[part %in% levels(part)[7]] <- NA partb <- factor(partb) attributes(partb) summary(partb) table(partb) table(part, partb) cbind(part, partb) partisan041 <- partb partisan042 <- as.numeric(partb) summary(partisan041) summary(partisan042) ## Regression Model - ANES 2004 ## anes04one <- zelig(trade041a ~ age042 + education042 + personal042 + economy042 + partisan042 + employment042 + union042 + home042 + market042 + race042 + income042 + gender042, model="logit", data=data04) summary(anes04one) #Error in model.frame.default(formula = trade041a ~ age042 + education042 + : # variable lengths differ (found for 'partisan042')

    Read the article

  • more ruby way of gsub from array

    - by aharon
    My goal is to let there be x so that x("? world. what ? you say...", ['hello', 'do']) returns "hello world. what do you say...". I have something that works, but seems far from the "Ruby way": def x(str, arr, rep='?') i = 0 query.gsub(rep) { i+=1; arr[i-1] } end Is there a more idiomatic way of doing this? (Let me note that speed is the most important factor, of course.)

    Read the article

  • What application domains are CPU bound and will tend to benefit from multi-core technologies?

    - by Glomek
    I hear a lot of people talking about the revolution that is coming in programming due to multi-core processors and parallelism, but I can't shake the feeling that for most of us, CPU cycles aren't the bottleneck. Pretty much all of my programs have been I/O bound in one way or another (database, filesystem, network, user interaction, etc.) for a very long time. Now I can think of a few areas where CPU cycles are a limiting factor, like code breaking, graphics, sound, some forms of simulation (weather, physics, etc.), and some forms of mathematical research, but they all seem like fairly specialized application domains. My general impression is that most programs are still I/O bound and that for most of our industry CPUs have been plenty fast for quite a while now. Am I off my rocker? What other application domains are CPU bound today? Do any of them include a large portion of the programming population? In essence, I'm wondering whether the multi-core CPUs will impact very many of us, and if so, how?

    Read the article

  • Compiler error: Variable or field declared void [closed]

    - by ?? ?
    i get some error when i try to run this, could someone please tell me the mistakes, thank you! [error: C:\Users\Ethan\Desktop\Untitled1.cpp In function `int main()': 25 C:\Users\Ethan\Desktop\Untitled1.cpp variable or field `findfactors' declared void 25 C:\Users\Ethan\Desktop\Untitled1.cpp initializer expression list treated as compound expression] #include<iostream> #include<cmath> using namespace std; void prompt(int&, int&, int&); int gcd(int , int , int );//3 input, 3 output void findfactors(int , int , int, int, int&, int&);//3 input, 2 output void display(int, int, int, int, int);//5 inputs int main() { int a, b, c; //The coefficients of the quadratic polynomial int ag, bg, cg;//value of a, b, c after factor out gcd int f1, f2; //The two factors of a*c which add to be b int g; //The gcd of a, b, c prompt(a, b, c);//Call the prompt function g=gcd(a, b, c);//Calculation of g void findfactors(a, b, c, f1, f2);//Call findFactors on factored polynomial display(g, f1, f2, a, c);//Call display function to display the factored polynomial system("PAUSE"); return 0; } void prompt(int& num1, int& num2, int& num3) //gets 3 ints from the user { cout << "This program factors polynomials of the form ax^2+bx+c."<<endl; while(num1==0) { cout << "Enter a value for a: "; cin >> num1; if(num1==0) { cout<< "a must be non-zero."<<endl; } } while(num2==0 && num3==0) { cout << "Enter a value for b: "; cin >> num2; cout << "Enter a value for c: "; cin >> num3; if(num2==0 && num3==0) { cout<< "b and c cannot both be 0."<<endl; } } } int gcd(int num1, int num2, int num3) { int k=2, gcd=1; while (k<=num1 && k<=num2 && k<=num3) { if (num1%k==0 && num2%k==0 && num3%k==0) gcd=k; k++; } return gcd; } void findFactors(int Ag, int Bg, int Cg,int& F1, int& F2) { int y=Ag*Cg; int z=sqrt(abs(y)); for(int i=-z; i<=z; i++) //from -sqrt(|y|) to sqrt(|y|) { if(i==0)i++; //skips 0 if(y%i==0) //if i is a factor of y { if(i+y/i==Bg) //if i and its partner add to be b F1=i, F2=y/i; else F1=0, F2=0; } } } void display(int G, int factor1, int factor2, int A, int C) { int k=2, gcd1=1; while (k<=A && k<=factor1) { if (A%k==0 && factor1%k==0) gcd1=k; k++; } int t=2, gcd2=1; while (t<=factor2 && t<=C) { if (C%t==0 && factor2%t==0) gcd2=t; t++; } cout<<showpos<<G<<"*("<<gcd1<<"x"<<gcd2<<")("<<A/gcd1<<"x"<<C/gcd2<<")"<<endl; }

    Read the article

  • Creating a new coloumn for date info with specific date format

    - by Ayan
    Dear All I am working with a file which has few years data and I am trying to create an aditional coloumn that reads the year and month info from the date coloumn (e.g. 01/01/1997 12:00) and create a new coloumn with month and year together(e.g. Jan-97). I am not sure how to proceed with this but what I am trying to code is the coloumn with name "new_date" in the following picture: my sample data = > dput(df) structure(list(date = structure(c(1L, 4L, 7L, 2L, 5L, 8L, 3L, 6L, 9L), .Label = c("01/01/1997 12:00", "01/01/1998 15:00", "01/01/1999 18:00", "01/02/1997 13:00", "01/02/1998 16:00", "01/02/1999 19:00", "01/03/1997 14:00", "01/03/1998 17:00", "01/03/1999 19:00"), class = "factor"), value = c(29L, 31L, 42L, 42L, 52L, 61L, 57L, 55L, 56L)), .Names = c("date", "value"), row.names = c(NA, -9L), class = "data.frame") I would really appreciate if you could advise me about how should I proceed with this, Many thanks, Ayan

    Read the article

  • How to save objects using Multi-Threading in Core Data?

    - by Konstantin
    I'm getting some data from the web service and saving it in the core data. This workflow looks like this: get xml feed go over every item in that feed, create a new ManagedObject for every feed item download some big binary data for every item and save it into ManagedObject call [managedObjectContext save:] Now, the problem is of course the performance - everything runs on the main thread. I'd like to re-factor as much as possible to another thread, but I'm not sure where I should start. Is it OK to put everything (1-4) to the separate thread?

    Read the article

  • jquery $(window).width() and $(window).height() return different values when viewport has not been r

    - by Manca Weeks
    I am writing a site using jquery that repeatedly repeatedly calls $(window).width() and $(window).height() to position and size elements based on the viewport size... In troubleshooting I discovered that I am getting slightly different viewport size reports in repeated calls to the above jquery functions when the viewport is not resized... Wondering if there is any special case anyone knows of when this happens, or if this is just the way it is. The difference in sizes reported are 20px or less, it appears. It happens in Safari 4.0.4, Firefox 3.6.2 and Chrome 5.0.342.7 beta on Mac OS X 10.6.2... I didn't test other browsers yet because it doesn't appear to be specific to the browser. I was also unable to figure out what the difference depends upon - if it isn't the viewport size, could there be another factor that makes the results differ? Any insight would be appreciated... Thanks MAnca

    Read the article

  • Flex: client / server messaging question (RPC or socket ?)

    - by Patrick
    hi, I'm building a Flex application, which is going to perform many server requests (let's say, that almost all interactions require an update from server). At the moment I'm using remote procedure calls for it. But I was wondering if using a socket would be better. In other terms, is maybe better to keep the connection alive rather then performing many calls in sequence ? For my demo app I only have 1 client. Is the number of clients connecting to the server a factor for this choice ? thanks

    Read the article

  • for (i in xxx) ggplot problem

    - by Andreas
    This is strange - I think? library(ggplot2) tf <- which(sapply(diamonds, is.factor)) diamonds.tf <- diamonds[,tf] So far so good. But next comes the trouble: pl.f <- ggplot(diamonds.tf, aes(x=diamonds.tf[,i]))+ geom_bar()+ xlab(names(diamonds.tf[i])) for (i in 1:ncol(diamonds.tf)) { ggsave(paste("plot.f",i,".png",sep=""), plot=pl.f, height=3.5, width=5.5) } This saves the plots in my working directory - but with the wrong x-label. I think this is strange since calling ggplot directly produces the right plot: i <- 2 ggplot(diamonds, aes(x=diamonds[,i]))+geom_bar()+xlab(names(diamonds)[i]) I don't really know how to describe this as a fitting title - suggestions as to a more descriptive question-title is most welcome. Thanks in advance

    Read the article

  • Better product to develop for, iPad or Android based tablet in a purely business related application

    - by Caylem
    Hey guys Just wondering what you'd suggest as the best platform for developing a business application for a tablet device. The application needs to be multitouch, have access to a maps API, a database on the device. It will not be going on sale in the app store or Androids market, it is purely for specific business task and not for the general consumer. Obviously the options seem to be iPhone OS and the iPad or Android and an Android tablet device. The form factor for the end product requires something in the region of 8 inch+ screen and enough processing power to provide a good experience for the end user. Any help would be much appreciated. Thanks

    Read the article

  • Cassandra performance slow down with counter column

    - by tubcvt
    I have a cluster (4 node ) and a node have 16 core and 24 gb ram: 192.168.23.114 datacenter1 rack1 Up Normal 44.48 GB 25.00% 192.168.23.115 datacenter1 rack1 Up Normal 44.51 GB 25.00% 192.168.23.116 datacenter1 rack1 Up Normal 44.51 GB 25.00% 192.168.23.117 datacenter1 rack1 Up Normal 44.51 GB 25.00% We use about 10 column family (counter column) to make some system statistic report. Problem on here is that When i set replication_factor of this keyspace from 1 to 2 (contain 10 counter column family ), all cpu of node increase from 10% ( when use replication factor=1) to --- 90%. :( :( who can help me work around that :( . why counter column consume too much cpu time :(. thanks all

    Read the article

  • Whats the difference between Paxos and W+R>=N in Cassandra?

    - by user1128016
    Dynamo-like databases (e.g. Cassandra) provide ability to enforce consistency by means of quorum, i.e. a number of synchronously written replicas (W) and a number of replicas to read (R) should be chosen in such a way that W+RN where N is a replication factor. On the other hand, PAXOS-based systems like Zookeeper are also used as a consistent fault-tolerant storage. What is the difference between these two approaches? Does PAXOS provide guarantees that are not provided by W+RN schema?

    Read the article

  • How do you determine up/down latency of a web app.

    - by Brodie
    I am trying to work out how to calculate the latency of requests through a web-app (Javascript) to a .net webservice. Currently I am essentially trying to sync both client and server time, which when hitting the webservice I can look at the offset (which would accurately show the 'up' latency. The problem is - when you sync the time's, you have to factor in latency for that also. So currently I am timeing the sync request (round trip) and dividing by 2, in an attempt to get the 'up' latency...and then modify the sync accordingly. This works on the assumption that latency is symmetrical, which it isn't. Does anyone know a procedure that would be able to determine specifically the up/down latency of a JS http request to a .net service? If it needs to involve multiple handshakes thats fine, what ever is as accurate as possible. Thanks!!

    Read the article

  • How to save the world from your computer?

    - by Francisco Garcia
    Sometimes I miss the "help other people" factor within computer related careers. Sure that out there I could find many great projects improving society, but that is not common. However there are little things that we all can do to make this a better place beyond trying to erradicate annoynig stuff such as Visual Basic. You could join a cloud computing network such as World Community Grid to fight cancer. Write a charityware application such as Vim, improve an office IT infrastructure to support telecommuting and reduce CO2 emissions, use an ebook reader for saving paper... what else would you? which projects do you think can have an impact?

    Read the article

  • Pass Types as arguments to a function in Haskell?

    - by Charles Peng
    The following two functions are extremely similar. They read from a [String] n elements, either [Int] or [Float]. How can I factor the common code out? I don't know of any mechanism in Haskell that supports passing types as arguments. readInts n stream = foldl next ([], stream) [1..n] where next (lst, x:xs) _ = (lst ++ [v], xs) where v = read x :: Int readFloats n stream = foldl next ([], stream) [1..n] where next (lst, x:xs) _ = (lst ++ [v], xs) where v = read x :: Float I am at a beginner level of Haskell, so any comments on my code are welcome.

    Read the article

  • PHP: Prevent chained method from returning?

    - by Industrial
    Hi, I am having some headaches regarding method chaining for a quite simple PHP class that returns a value, which sometimes need to go through a decryption process: $dataset = new Datacontainer; $key = $dataset->get('key'); $key2 = $dataset->get('key')->decrypt(); The get method is where the return lives. So the call to the decrypt method on the second row isn't going to work in its current state. Can I do something to setup the get method to return only when nothing is chained to it, or what would be the best way to re-factor this code?

    Read the article

  • Need help with shell script

    - by via-point
    I am a total newbie to Shell Scripting so please bear with me. I need to create a shell script called script1 that will calculate and then display letter grade of ABC2345. Read in the following grades from keyboard: Assignments 40% Test1 15% Test2 15% Final exam 30% Calculate and display the number grade using the weight of each factor above Convert the number grade to letter grade using the table below: Number Grade Letter Grade 90 - 100 A+ 85 - 89 A 80 - 84 77 - 79 B+ 73 - 76 B 70 - 72 B- 67 - 69 C+ 63 - 66 C 60 - 62 C- 57 - 59 D+ 53 - 56 D 50 - 52 D- 0 - 49 F Any help would be appreciated :) Thank you!

    Read the article

  • How to use your computer to save the world?

    - by Francisco Garcia
    Sometimes I miss the "help other people" factor within computer-related fields. However, there are little things that we all can do to make this a better place—beyond trying to eradicate annoying stuff such as Visual Basic. You could join a cloud computing network such as World Community Grid to fight cancer, write a charityware application such as Vim, improve office IT infrastructure to support telecommuting and reduce CO2 emissions, use an ebook reader to save paper, ... What else can we do to help others? Which projects can have the biggest impact?

    Read the article

  • Best language to develop medical software

    - by Grace
    I need to write medical program to manage medical practices (patient records, appointments, prescription, etc). Note that this is not for US practices so US EMRs will not work. What is the best platform to develop the software in ie. language and database? Considerations include: - Integration with the web - will need to have Doctors download updates to the software from the web. Will also post reports from the software unto webpages - The software will include a mobile application - probably for Blackberry - Cost is a big factor - need to minimize the license cost to the users - Need tight security on the program

    Read the article

  • How to interpolate rotations?

    - by uhuu
    I have two vectors describing rotations; a start rotation A and a target rotation B. How would I best go about interpolating A by a factor F to approach B? Using a simple lerp on the vectors fails to work when more than one dimension needs to be interpolated (i.e. produces undesirable rotations). Maybe building quaternions from the rotation vectors and using slerp is the way to go. But how, then, could I extract a vector describing the new rotation from the resulting quaternion? Thanks in advance.

    Read the article

  • MS Access vs SQL Server and others ? Is it worth taking a db server when less than 2 Gb and only 20

    - by asksuperuser
    After my experiment with MSAccess vs MySQL which shows MS Access hugely overperforming Mysql odbc insert by a factor 1000% before I would do the same experiment with SQL Server I searched for some other's people and found this one: http://blog.nkadesign.com/2009/access-vs-sql-server-some-stats-part-1/ which says "As a side note, in this particular test, Access offers much better raw performance than SQL Server. In more complex scenarios it’s very likely that Access’ performance would degrade more than SQL Server, but it’s nice to see that Access isn’t a sloth." So is worth bother with some db server when data is less than 2 Gb and users are about 20 (knowing that MS Access theorically supports up to 255 concurrent users though practically it's around a dozen concurrent users only). Are there any real world studies that really compare MS Access with other db in these specific use case ? Because professionaly speaking I keep hearing people systematically recommend DB server from people who have never used Access just because they think DB Server can only perform better in every case which I used to think myself I confess.

    Read the article

  • scaleX scaleY increasing left, top margin, and line spacing

    - by Mark
    If you have Text with a font that is 72 point for example (and scaleX scaleY = 1) you can achieve the same size with a font size of 12 and scaleX,scaleY = 6. For reasons that would take too long to explain I am applying a large scale factor as in the latter example. The problem is, even though the text is the same size, the line spacing and left and top margins have all been increased but I want them to be the same size as well. As far as the line spacing, I discovered that TextFormat.leading was being automatically increased when scaleX, scaleY was greater than 1, so I just had to reset TextFormat.leading back to 0. That leaves the left and top margins, and I have no idea how those are being increased. I tried TextFormat.blockIndent=0 and TextFormat.leftMargin=0 (and also ignorePadding=true) and it had no effect. And have no clue how to reset the top margin either to its orginal size, in case anyone has an idea for all these.

    Read the article

  • SVG Animation in Python? - Any options other than Things! 0.4?

    - by ThantiK
    I recently gave my daughter some time on the computer, and she really likes a program called 'BabySmash!', and I also have another program that came with a keyboard attachment called 'Laugh, Smile & Learn' from playschool I think. I'm not a python guru by any stretch of the imagination and I kind of have it in my head that I want to create some sort of program in the spirit of these two, with vector animation and sounds. Thing is, it doesn't look like there are many options for vector animation in python. I found a library called Things! 0.4, but it's lacking in-depth documentation and seems to be more of an experiment in vector animation rather than a full blown solution. Are there any options that I'm not immediately finding? What other animation-libraries do you recommend? Even if the library isn't vector-based, ease of use is probably the strongest factor in my use.

    Read the article

  • Java equivalent for database schema changes like South for Django?

    - by gerdemb
    I've been working on a Django project using South to track and manage database schema changes. I'm starting a new Java project using Google Web Toolkit and wonder if there is an equivalent tool. For those who don't know, here's what South does: Automatically recognize changes to my Python database models (add/delete columns, tables etc.) Automatically create SQL statements to apply those changes to my database Track the applied schema migrations and apply them in order Allow data migrations using Python code. For example, splitting a name field into a first-name and last-name field using the Python split() function I haven't decided on my Java ORM yet, but Hibernate looks like the most popular. For me, the ability to easily make database schema changes will be an important factor.

    Read the article

< Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >