Search Results

Search found 1058 results on 43 pages for 'compute'.

Page 4/43 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Compute bounding quad of a sphere with vertex shader

    - by Ben Jones
    I'm trying to implement an algorithm from a graphics paper and part of the algorithm is rendering spheres of known radius to a buffer. They say that they render the spheres by computing the location and size in a vertex shader and then doing appropriate shading in a fragment shader. Any guesses as to how they actually did this? The position and radius are known in world coordinates and the projection is perspective. Does that mean that the sphere will be projected as a circle? Thanks!

    Read the article

  • Compute average distance from point to line segment and line segment to line segment

    - by Fred
    Hi everyone, I'm searching for an algorithm to calculate the average distance between a point and a line segment in 3D. So given two points A(x1, y1, z1) and B(x2, y2, z2) that represent line segment AB, and a third point C(x3, y3, z3), what is the average distance between each point on AB to point C? I'm also interested in the average distance between two line segments. So given segment AB and CD, what is the average distance from each point on AB to the closest point on CD? I haven't had any luck with the web searches I've tried, so any suggestions would be appreciated. Thanks.

    Read the article

  • Fastest way to compute a "Visual" checksum of an image

    - by ensnare
    I'm looking to create an ID system for cataloging images. I can't use md5() since that will change if I alter the EXIF tags of the image. I am currently using the SHA1 checksum computed by imagemagick. It works perfectly, but it's really, really slow on larger images (~15 seconds on a quad-core xeon for a 21 megapixel JPG). Are there any other "visual" methods of uniquely identifying an image that would be faster? Thank you.

    Read the article

  • Compute weighted averages for large numbers

    - by Travis
    I'm trying to get the weighted average of a few numbers. Basically I have: Price - 134.42 Quantity - 15236545 There can be as few as one or two or as many as fifty or sixty pairs of prices and quantities. I need to figure out the weighted average of the price. Basically, the weighted average should give very little weight to pairs like Price - 100000000.00 Quantity - 3 and more to the pair above. The formula I currently have is: ((price)(quantity) + (price)(quantity) + ...)/totalQuantity So far I have this done: double optimalPrice = 0; int totalQuantity = 0; double rolling = 0; System.out.println(rolling); Iterator it = orders.entrySet().iterator(); while(it.hasNext()) { System.out.println("inside"); Map.Entry order = (Map.Entry)it.next(); double price = (Double)order.getKey(); int quantity = (Integer)order.getValue(); System.out.println(price + " " + quantity); rolling += price * quantity; totalQuantity += quantity; System.out.println(rolling); } System.out.println(rolling); return totalQuantity / rolling; The problem is I very quickly max out the "rolling" variable. How can I actually get my weighted average? Thanks!

    Read the article

  • Compute divergence of vector field using python

    - by nyvltak
    Is there a function that could be used for calculation of the divergence of the vectorial field? (in matlab http://www.mathworks.ch/help/techdoc/ref/divergence.html) I would expect it exists in numpy/scipy but I can not find it using google :(. # I need to calculate div[A * grad(F)], where F = np.array([[1,2,3,4],[5,6,7,8]]) (2D numpy ndarray) A = np.array([[1,2,3,4],[1,2,3,4]]) (2D numpy ndarray) so grad(F) is a set of 2D ndarrays # I know, I can calculate divergence like this: http://en.wikipedia.org/wiki/Divergence#Application_in_Cartesian_coordinates but do not want to reinvent the wheel. (and also I expent there is some optimized function)

    Read the article

  • How to Compute a Database Column in .NET

    - by Michael
    I have a Database named CarsType.accdb there are four fields in the data base Item_Name, Item_Num, Item_Qty, Item_Cost. I am able to get the database to display my data in VisualBasic but I am not sure how to get the total cost to appear in my label (lblTotalCost). I prefer doing it in VB versus writing in my access program. All I am wanting to do it multiply item_qty * Item_Cost How would I go about doing that?

    Read the article

  • CUDA - multiple kernels to compute a single value

    - by Roger
    Hey, I'm trying to write a kernel to essentially do the following in C float sum = 0.0; for(int i = 0; i < N; i++){ sum += valueArray[i]*valueArray[i]; } sum += sum / N; At the moment I have this inside my kernel, but it is not giving correct values. int i0 = blockIdx.x * blockDim.x + threadIdx.x; for(int i=i0; i<N; i += blockDim.x*gridDim.x){ *d_sum += d_valueArray[i]*d_valueArray[i]; } *d_sum= __fdividef(*d_sum, N); The code used to call the kernel is kernelName<<<64,128>>>(N, d_valueArray, d_sum); cudaMemcpy(&sum, d_sum, sizeof(float) , cudaMemcpyDeviceToHost); I think that each kernel is calculating a partial sum, but the final divide statement is not taking into account the accumulated value from each of the threads. Every kernel is producing it's own final value for d_sum? Does anyone know how could I go about doing this in an efficient way? Maybe using shared memory between threads? I'm very new to GPU programming. Cheers

    Read the article

  • Compute jvm heap size to host web application

    - by Enrique
    Hello, I want to host a web application on a private JVM they offer 32, 64, 128, 256 MB plans. My web application uses Spring. And I store some objects for every logged in user session. My question is: How can I profile my web app to see how much heap size it needs so I can choose a plan?, How can I simulate hundreds of users logged in at the same time? I'm developing the application using Netbeans 6.7 Java 1.6 Tomcat 6.0.18 Thank you.

    Read the article

  • Compute column widths in a HTML-like manner (based on cell contents)

    - by cipak
    Hi, I have a grid of data that I want to export to RTF, PDF etc. using various (and not perfect) PHP converters/generators. What I am missing most is the HTML table automatic adjustment of column widths based on the lengths of strings in the cells (strings contain line breaks which complicate things a bit, as they should be preserved). I need an algorithm that, given the contents of the cells (plain text), a total width of the table and an average width of a character, would return a width for each column. I wouldn't want to reinvent the wheel if something is already available. Of course it can't be perfect if the font is variable width, but an approximation would do just fine. Or maybe it could have a configurable table with widths for each character. Any hint would be appreciated. Thank you.

    Read the article

  • Cannot compute equation, always gives zero

    - by user1738391
    Did i miss something? The variable percentage_ always equals 0. I've checked nTimes and winnings, they give the correct values as what is being input. Even when I test out a simple equation like, percentage_=1+1, percentage_ will give 0. Can someone help? #pragma once #include <iostream> #include <string> #include <cstdlib> #include <iomanip> using namespace std; class GuessMachine { private: int nTimes; int winnings; string nM[6]; public: GuessMachine(); void displayPrizes(); void displayMenu(); int getInput(); void checkNumber(); void checkPrize(); }; void GuessMachine::checkPrize() { MagicNumber mn; int prize_=mn.generateNumber(); float percentage_; percentage_ = float (winnings/nTimes*100); //<--On this line percentage is always 0 no matter what winnings and nTimes are cout<<"Percentage is "<<percentage_<<endl; if(percentage_ >= 50) { cout<<"You have scored "<<percentage_<<"% and won "<<nM[prize_]; } else { cout<<"You have scored "<<percentage_<<"%. You lose!!"; } cin.ignore(); cin.ignore(); }

    Read the article

  • how to deploy web application directly from git master branch

    - by mobile.linkr
    For educational purpose, I am writing a server instance in GCE(google compute engine) to serve a few web apps mostly (to be) written in Dart and Polymer. My workflow is, when my students log-in the server above, they will automatically fork those web apps into their own registries in their own server instances for further development. My issues are, How to serve web applications(they are git registries as well) in GCE like Github Pages? Is it possible to manipulate Github Pages to serve web apps mostly using Dart and Polymer packages? Thanks in advance.

    Read the article

  • Visual basic 6.0 - ComputeHash invalid procedure call or argument error

    - by Mohan Babu Vijaya Gopal
    I am getting the error "invalid procedure call or arguments" at the step computeHash(). Any help highly appreciated. Private Sub Form_Load() Dim rngcsp As New RNGCryptoServiceProvider '= new RNGCryptoServiceProvider() Dim u8 As Encoding 'u8 = Encoding.UTF8 Dim minSaltSize As Integer Dim maxSaltSize As Integer Dim saltSize As Integer minSaltSize = 4 maxSaltSize = 8 Dim randm As Random Set randm = New Random Dim saltBytes() As Byte ReDim saltBytes(saltSize) Set rngcsp = New RNGCryptoServiceProvider rngcsp.GetNonZeroBytes (saltBytes) Dim plainTextBytes() As Byte plainTextBytes() = ConvertStringToUtf8Bytes("Mohan") Dim plainTextBytesLen As Long plainTextBytesLen = UBound(plainTextBytes) - LBound(plainTextBytes) + 1 Dim saltBytesLen As Long saltBytesLen = UBound(saltBytes) - LBound(saltBytes) + 1 Dim plainTextWithSaltBytes() As Byte ReDim plainTextWithSaltBytes(plainTextBytesLen + saltBytesLen) For i = 0 To plainTextBytesLen - 1 plainTextWithSaltBytes(i) = plainTextBytes(i) Next For i = 0 To saltBytesLen - 1 plainTextWithSaltBytes(i) = saltBytes(i) Next 'Dim hash As HashAlgorithm = New MD5CryptoServiceProvider() Dim hash12 As New SHA256Managed 'SHA256Managed Dim totLen As Integer totLen = plainTextBytesLen + saltBytesLen Dim str As String Dim hashBytes() As Byte 'With hashBytes = hash12.computeHash(plainTextWithSaltBytes) ', 0, totLen) 'End With End Sub

    Read the article

  • AS3 computeSpectrum fft true

    - by cr1ms0n3cho
    I am just trying to understand what the values sent back from computeSpectrum(bytes,true,0) mean. I have values ranging from 0 to 1 for each float i read from the byte array but does each value represent a range of Hz Thanks!

    Read the article

  • Windows Azure HPC Scheduler Architecture

    - by Churianov Roman
    So far I've found very little information on the scheduling policy, resource management policy of Azure HPC Scheduler. I would appreciate any kind of information regarding some of these questions: What scheduling policy does a Head Node use to scatter jobs to Compute Nodes? Does Azure Scheduler use prior information about the jobs (compute time, memory demands ...) ? If 'yes', how it gets this information? Does Azure Scheduler split a job into several parallel jobs on one Compute node? Does it have any protection from Compute Node failures? (what it does when a compute node stops responding) Does it support addition/subtraction of Compute nodes? Is it possible to cancel a job? P.S. I'm aware of the MSDN resource Windows Azure HPC Scheduler. I found only information of how to use this Scheduler but almost nothing about how it works inside.

    Read the article

  • Do you know of a C macro to compute Unix time and date?

    - by Alexis Wilke
    I'm wondering if someone knows/has a C macro to compute a static Unix time from a hard coded date and time as in: time_t t = UNIX_TIMESTAMP(2012, 5, 10, 9, 26, 13); I'm looking into that because I want to have a numeric static timestamp. This will be done hundred of times throughout the software, each time with a different date, and I want to make sure it is fast because it will run hundreds of times every second. Converting dates that many times would definitively slow down things (i.e. calling mktime() is slower than having a static number compiled in place, right?) [made an update to try to render this paragraph clearer, Nov 23, 2012] Update I want to clarify the question with more information about the process being used. As my server receives requests, for each request, it starts a new process. That process is constantly updated with new plugins and quite often such updates require a database update. Those must be run only once. To know whether an update is necessary, I want to use a Unix date (which is better than using a counter because a counter is much more likely to break once in a while.) The plugins will thus receive an update signal and have their on_update() function called. There I want to do something like this: void some_plugin::on_update(time_t last_update) { if(last_update < UNIX_TIMESTAMP(2010, 3, 22, 20, 9, 26)) { ...run update... } if(last_update < UNIX_TIMESTAMP(2012, 5, 10, 9, 26, 13)) { ...run update... } // as many test as required... } As you can see, if I have to compute the unix timestamp each time, this could represent thousands of calls per process and if you receive 100 hits a second x 1000 calls, you wasted 100,000 calls when you could have had the compiler compute those numbers once at compile time. Putting the value in a static variable is of no interest because this code will run once per process run. Note that the last_update variable changes depending on the website being hit (it comes from the database.) Code Okay, I got the code now: // helper (Days in February) #define _SNAP_UNIX_TIMESTAMP_FDAY(year) \ (((year) % 400) == 0 ? 29LL : \ (((year) % 100) == 0 ? 28LL : \ (((year) % 4) == 0 ? 29LL : \ 28LL))) // helper (Days in the year) #define _SNAP_UNIX_TIMESTAMP_YDAY(year, month, day) \ ( \ /* January */ static_cast<qint64>(day) \ /* February */ + ((month) >= 2 ? 31LL : 0LL) \ /* March */ + ((month) >= 3 ? _SNAP_UNIX_TIMESTAMP_FDAY(year) : 0LL) \ /* April */ + ((month) >= 4 ? 31LL : 0LL) \ /* May */ + ((month) >= 5 ? 30LL : 0LL) \ /* June */ + ((month) >= 6 ? 31LL : 0LL) \ /* July */ + ((month) >= 7 ? 30LL : 0LL) \ /* August */ + ((month) >= 8 ? 31LL : 0LL) \ /* September */+ ((month) >= 9 ? 31LL : 0LL) \ /* October */ + ((month) >= 10 ? 30LL : 0LL) \ /* November */ + ((month) >= 11 ? 31LL : 0LL) \ /* December */ + ((month) >= 12 ? 30LL : 0LL) \ ) #define SNAP_UNIX_TIMESTAMP(year, month, day, hour, minute, second) \ ( /* time */ static_cast<qint64>(second) \ + static_cast<qint64>(minute) * 60LL \ + static_cast<qint64>(hour) * 3600LL \ + /* year day (month + day) */ (_SNAP_UNIX_TIMESTAMP_YDAY(year, month, day) - 1) * 86400LL \ + /* year */ (static_cast<qint64>(year) - 1970LL) * 31536000LL \ + ((static_cast<qint64>(year) - 1969LL) / 4LL) * 86400LL \ - ((static_cast<qint64>(year) - 1901LL) / 100LL) * 86400LL \ + ((static_cast<qint64>(year) - 1601LL) / 400LL) * 86400LL ) WARNING: Do not use these macros to dynamically compute a date. It is SLOWER than mktime(). This being said, if you have a hard coded date, then the compiler will compute the time_t value at compile time. Slower to compile, but faster to execute over and over again.

    Read the article

  • How does Minecraft compute lighting for it's non-block objects?

    - by Darestium
    I was wondering how the creator of Minecraft went about lighting the objects (player and pickaxe) based on the lighting level around the player. I have implemented the ability to light the blocks around the player but I can't really think of anyway to implement with objects. Also, when I the player moves and the lighting values change will I have to rebuild it's vertexbuffers? Or is there some other way? Any ideas?

    Read the article

  • Compute the AES-encryption key given the plaintext and its ciphertext?

    - by Null Pointers etc.
    I'm tasked with creating database tables in Oracle which contain encrypted strings (i.e., the columns are RAW). The strings are encrypted by the application (using AES, 128-bit key) and stored in Oracle, then later retrieved from Oracle and decrypted (i.e., Oracle itself never sees the unencrypted strings). I've come across this one column that will be one of two strings. I'm worried that someone will notice and presumably figure out what those two values to figure out the AES key. For example, if someone sees that the column is either Ciphertext #1 or #2: Ciphertext #1: BF,4F,8B,FE, 60,D8,33,56, 1B,F2,35,72, 49,20,DE,C6. Ciphertext #2: BC,E8,54,BD, F4,B3,36,3B, DD,70,76,45, 29,28,50,07. and knows the corresponding Plaintexts: Plaintext #1 ("Detroit"): 44,00,65,00, 74,00,72,00, 6F,00,69,00, 74,00,00,00. Plaintext #2 ("Chicago"): 43,00,68,00, 69,00,63,00, 61,00,67,00, 6F,00,00,00. can he deduce that the encryption key is "Buffalo"? 42,00,75,00, 66,00,66,00, 61,00,6C,00, 6F,00,00,00. I'm thinking that there should be only one 128-bit key that could convert Plaintext #1 to Ciphertext #1. Does this mean I should go to a 192-bit or 256-bit key instead, or find some other solution? (As an aside, here are two other ciphertexts for the same plaintexts but with a different key.) Ciphertext #1 A ("Detroit"): E4,28,29,E3, 6E,C2,64,FA, A1,F4,F4,96, FC,18,4A,C5. Ciphertext #2 A ("Chicago"): EA,87,30,F0, AC,44,5D,ED, FD,EB,A8,79, 83,59,53,B7.

    Read the article

  • How can I compute the Big-O notation for a given piece of code?

    - by TheNew Rob Mullins
    So I just took a data structure midterm today and I was asked to determine the run time, in Big O notation, of the following nested loop: for (int i = 0; i < n-1; i++) { for(int j = 0; j < i; j++2) { //1 Statement } } I'm having trouble understanding the formula behind determining the run time. I thought that since the inner loop has 1 statement, and using the series equation of: (n * (n - 1)) / 2, I figured it to be: 1n * (n-1) / 2. Thus equaling (n^2 - 1) / 2. And so I generalized the runtime to be O(n^2 / 2). I'm not sure this is right though haha, was I supposed to divide my answer again by 2 since j is being upped in intervals of 2? Or is my answer completely off?

    Read the article

  • Rackspace Cloud Sites: Compute Cycles exploding. Very expensive.

    - by Jaap
    Hi All, Since last week my compute cycles (CC) went through the roof (Rackspace Cloud Sites). Normally I stay under the 10,000 cycles per month . Now this month I already have more than 75,000 compute cycles. I don't have more visitors and I did not change anything in the code. I looked in the raw log files, that didn't help either... This explosion of CC already costs me more than 750 USD right now. And still counting. Anyone know what to do? I have contacted Rackspace last week. But still no solution/answer.... Looks like Rackspace is liking the money! Help! Thanks.

    Read the article

  • Confused about nova-network

    - by neo0
    I'm so sorry because this question doesn't related to Ubuntu. I asked in Openstack forum but this forum is not very active. So I think if someone have experience with Openstack Nova can help me with my problem. I've read some explanations about nova-network and how to configure it like this one from wiki: http://wiki.openstack.org/UnderstandingFlatNetworking I'm confusing about a detail. If every traffic from the instances must go through nova controller node, then why we still need the public interface for nova-compute node? Is it necessary? What happen when a request from outside to an instance. For example I have a controller node and a nova-compute node. In nova-compute node I run an instance with a Wordpress website. Then someone connect to the public IP of this instance. So the request go directly from router to the nova-compute node or from router to controller node then nova-compute node? Thank you!

    Read the article

  • Juju instances in aganet-state: down after turning them off (and back on) on EC2

    - by Tyler McAdams
    I turned my Juju instances off on EC2 for a while and after bringing them back online they seem to be in an odd state: [code] claude-vm@claude-vm-fusion:~/Documents/Shell Scripts$ juju status 2012-11-17 17:06:44,094 INFO Connecting to environment... 2012-11-17 17:06:45,590 INFO Connected to environment. machines: 0: agent-state: not-started dns-name: ec2-54-242-142-196.compute-1.amazonaws.com instance-id: i-b0996fcf instance-state: running 1: agent-state: down dns-name: ec2-50-19-186-245.compute-1.amazonaws.com instance-id: i-8c8375f3 instance-state: running 2: agent-state: down dns-name: ec2-54-242-255-238.compute-1.amazonaws.com instance-id: i-56807629 instance-state: running services: wordpress: charm: cs:precise/wordpress-9 exposed: true relations: db: - wordpress-db loadbalancer: - wordpress units: wordpress/0: agent-state: down machine: 2 open-ports: - 80/tcp public-address: ec2-54-242-227-57.compute-1.amazonaws.com wordpress-db: charm: cs:precise/mysql-10 relations: db: - wordpress units: wordpress-db/0: agent-state: down machine: 1 public-address: ec2-54-242-212-177.compute-1.amazonaws.com 2012-11-17 17:06:47,274 INFO 'status' command finished successfully [/code] Can I not take my instances down for a while? Or is this something else?

    Read the article

  • Will an optimizing compiler remove calls to a method whose result will be multiplied by zero?

    - by Tim R.
    Suppose you have a computationally expensive method, Compute(p), which returns some float, and another method, Falloff(p), which returns another float from zero to one. If you compute Falloff(p) * Compute(p), will Compute(p) still run when Falloff(p) returns zero? Or would you need to write a special case to prevent Compute(p) from running unnecessarily? Theoretically, an optimizing compiler could determine that omitting Compute when Falloff returns zero would have no effect on the program. However, this is kind of hard to test, since if you have Compute output some debug data to determine whether it is running, the compiler would know not to omit it because of that debug info, resulting in sort of a Schrodinger's cat situation. I know the safe solution to this problem is just to add the special case, but I'm just curious.

    Read the article

  • Azure eBook Update #1 &ndash; 16 authors so far!

    - by Eric Nelson
    I just wanted to share with folks where we are up to with the Windows Azure eBook (Check out the original post for full details) I have had lots of great submissions from folks with some awesome stuff to share on Azure. Currently we have 16 authors and 25 proposed articles. There is still a couple of days left to submit your proposal if you would like to get involved (see the original post ) and some topic suggestions below for which we don’t currently have authors. It is official – I’m excited! :-) Article Area Accepted Wikipedia Explorer: A case study how we did it and why. CaseSetudy Optional Patterns for the Windows Azure Platform (picking up 1 or 2 patterns that seem to be evolving) Architecture Optional Azure and cost-oriented architecture. Architecture Yes Code walkthrough of a comprehensive application submitted to newCloudApp contest CaseSetudy Yes Principles of highly scalable apps on Azure Compute Optional Auto-Scaling Azure Compute Yes Implementing a distributed cache using memcached with worker roles Interop Yes Building a content-based router service to direct requests to internal HTTP endpoints Compute Optional How to debug an Azure app by with a custom TraceListener & the AppFabric Service Bus AppFabric Yes How to host Java apps in Azure Interop Yes Bing Maps Tile Servers using Azure Blog Storage Interop Yes Tricks for storing time and date fields in Table Storage Storage Yes Service Runtime in Windows Azure Compute Yes Azure Drive Storage Optional Queries in Azure Table Storage Optional Getting RubyOnRails running on Azure Interop Yes Consuming Azure services within Windows Phone Interop Yes De-risking Your First Azure Project Architecture Yes Designing for failure Architecture Optional Connecting to SQL Azure In x Minutes SQLAzure Yes Using Azure Table Service as a NoSQL store via the REST API Storage Yes Azure Table Service REST API Storage Optional Threading, Scalability and Reliability in the Cloud Compute Yes Azure Diagnostics Compute Yes 5 steps to getting started with Windows Azure Introduction Yes The best tools for working with Windows Azure Tools Author Needed Understanding how SQL Azure works SQLAzure Author Needed Getting started with AppFabric Control Services AppFabric Author Needed Using the Microsoft Sync Framework with SQL Azure SQLAzure Author Needed Dallas - just a TV show or something more? Dallas Author Needed Comparing Azure to other cloud offerings Interop Author Needed Hybrid solutions using Azure and on-premise Interop Author Needed

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >