Search Results

Search found 9611 results on 385 pages for 'low power'.

Page 138/385 | < Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >

  • SQL Server 2008 spatial index and CPU utilization with MapGuide Open Source 2.1

    - by Antonio de la Peña
    I have a SQL Server table with hundreds of thousands of geometry type parcels. I have made indexes on them trying different combinations of density and objects per cell settings. So far I'm settiling for LOW, LOW, MEDIUM, MEDIUM and 16 objects per cell and I made a SP that sets the bounding box according to the extents of the entities in the table. There is an incredible performance boost from queries taking almost minutes without index to less than seconds, it gets faster when the zoom is closer thus less objects are displayed. Yet the CPU utilization gets to 100% when querying for features, even when the queries themselves are fast. I'm worrying this will not fly in a production environment. I am using MapGuide Open Source 2.1 for this project, but I am positive the CPU load is caused by SQL Server. I wonder if my indexes are set properly. I haven't found any clear documentation on how to properly set them up. Every article I've read basically says "it depends..." but nothing specific. Do you have any recommendations for me, including books, articles? Thank you.

    Read the article

  • node.js beginner tutorials?

    - by TreyK
    Hey all, I'm working on creating my first real node.js http server, and I'm sort of drowning in it. As a good teacher of mine always said, "I'll just shove you in the water for now, and then I'll show you how to swim." Fortunately, she wasn't a swimming instructor, but it's a good analogy nonetheless. I feel like I've jumped into node.js and I've only found a ping pong ball to help, that is to say, most of the tutorials I've read stop shortly after the "Hello World" example and I've mostly been trying to make sense of copied and pasted code (or they assume I have knowledge of lower level HTTP and webserver concepts that have been done for me as an Apache/PHP developer). I have experience in both client-side Javascript and PHP, but node seems to be a beast all of its own. I don't quite have the low-level knowledge that seems necessary for creating a node server, and connect, which seems to be a nice module for simplifying things, seems quite sparsely explained, even in the docs on its Git. Where could I find some tutorials to help me in this situation? TL;DR - Are there any tutorials for node.js that go beyond "Hello World" but don't require much low-level knowledge? Or any tutorials that explain lower-level HTTP and webserver concepts that I would need to effectively create a node HTTP server? Thanks for any help. -Trey

    Read the article

  • What do you mean by the expressiveness in programming lanuguage?

    - by prosseek
    I see a lot of the word 'expressiveness' when people want to stress one language is better than the other. But I don't see exactly what they mean by it. Is it the verboseness/succinctness? I mean, if one language can write down something shorter than the other, does that mean expressiveness? Please refer to my other question - http://stackoverflow.com/questions/2411772/article-about-code-density-as-a-measure-of-programming-language-power Is it the power of the language? Paul Graham says that one language is more powerful than the other language in a sense that one language can do that the other language can't do (for example, LISP can do something with macro that the other language can't do). Is it just something that makes life easier? Regular expression can be one of the examples. Is it a different way of solving the same problem: something like SQL to solve the search problem? What do you think about the expressiveness of a programming lanuage? Can you show the expressiveness using some code? What's the relationship with the expressiveness and DSL? Do people come up with DSL to get the expressiveness?

    Read the article

  • Need an Overview of Possibilities for multicolumn programming

    - by Sam
    Hi folks, From source1 and source2 i gather that IE9 will NOT support multi-column css3!! Since it is still the most popular browser (another thing i cannot understand), i am left but no other choice than to use Programming Power to make multi-columns work. Now, I use three divs that float to left, and which are manually filled with text. Please don't laugh i know its stupid! But I would wish to not to have to worry about the columns and just have a one piece of (un-interrupted) text which all goes into only 1 div, and then have a program smart enough to split it up into X equally wide columns. Question: before i start reinvent the wheel, what methods of programming power have you known that tackle this elegantly? Please suggest your best working multi-column layout sources so I can evaluate which option is the best (I will update the below table). Exploring all possibilities 2011 and further, to enable multi column text user experience: Language Author SourceCodeUsage WorksOnAllMajorBrowser? ================================================================================= html manual labour put text manually in separate left-floating divs "Y" // Upside: control! Downside: few changes necessitates to reflow 3 divs manually! CSS3 w3c css3.info/preview/multi-column-layout/ "N" // {-moz-column-count: 3; -webkit-column-count: 3; } Thats all! javascript a list apart will add url soon ? // php ? ? ? //

    Read the article

  • Is there a reason why SSIS significantly slows down after a few minutes?

    - by Mark
    I'm running a fairly substantial SSIS package against SQL 2008 - and I'm getting the same results both in my dev environment (Win7-x64 + SQL-x64-Developer) and the production environment (Server 2008 x64 + SQL Std x64). The symptom is that initial data loading screams at between 50K - 500K records per second, but after a few minutes the speed drops off dramatically and eventually crawls embarrasingly slowly. The database is in Simple recovery model, the target tables are empty, and all of the prerequisites for minimally logged bulk inserts are being met. The data flow is a simple load from a RAW input file to a schema-matched table (i.e. no complex transforms of data, no sorting, no lookups, no SCDs, etc.) The problem has the following qualities and resiliences: Problem persists no matter what the target table is. RAM usage is lowish (45%) - there's plenty of spare RAM available for SSIS buffers or SQL Server to use. Perfmon shows buffers are not spooling, disk response times are normal, disk availability is high. CPU usage is low (hovers around 25% shared between sqlserver.exe and DtsDebugHost.exe) Disk activity primarily on TempDB.mdf, but I/O is very low (< 600 Kb/s) OLE DB destination and SQL Server Destination both exhibit this problem. To sum it up, I expect either disk, CPU or RAM to be exhausted before the package slows down, but instead its as if the SSIS package is taking an afternoon nap. SQL server remains responsive to other queries, and I can't find any performance counters or logged events that betray the cause of the problem. I'll gratefully reward any reasonable answers / suggestions.

    Read the article

  • In SQL can I return a tables with a varying number of columns

    - by Matt
    I have a somewhat more complicated scenario, but I think it should be possible. I have a large SPROC whose result is a set of characteristics for a set of persons. So the Table would look something like this: Property | Client1 Client 2 Client3 ----------------------------------------------------------- Sex | M F M Age | 67 56 67 Income | Low Mid Low It's built using cursors, iterating over different datasets. The problem I am facing is that there is a varying number of Clients and Properties, so an equally valid result over different input sets might be: Property | Client1 Client 2 ------------------------------------------- Sex | M F Age | 67 56 Weight | 122 122 The different number of properties is easy, those are just extra rows. My problem is that I need to declare a temporary table with a varying number of columns. There could be 2 clients or 100. Every client in guaranteed to have every property ultimately listed. What SQL structure would statisfy this and how can I declare it and insert things into it? I can't just flip the columns and rows either because there is a variable number of each.

    Read the article

  • Summing Row in SQL query for time range

    - by user3703334
    I'm trying to group a large amount of data into smaller bundles. Currently the code for my query is as follows SELECT [DateTime] ,[KW] FROM [POWER] WHERE datetime >= '2014-04-14 06:00:00' and datetime < '2014-04-21 06:00:00' ORDER BY datetime which gives me DateTime KW 4/14/2014 6:00:02.0 1947 4/14/2014 6:00:15.0 1946 4/14/2014 6:00:23.0 1947 4/14/2014 6:00:32.0 1011 4/14/2014 6:00:43.0 601 4/14/2014 6:00:52.0 585 4/14/2014 6:01:02.0 582 4/14/2014 6:01:12.0 580 4/14/2014 6:01:21.0 579 4/14/2014 6:01:32.0 579 4/14/2014 6:01:44.0 578 4/14/2014 6:01:53.0 578 4/14/2014 6:02:01.0 577 4/14/2014 6:02:12.0 577 4/14/2014 6:02:22.0 577 4/14/2014 6:02:32.0 576 4/14/2014 6:02:42.0 578 4/14/2014 6:02:52.0 577 4/14/2014 6:03:02.0 577 4/14/2014 6:03:12.0 577 4/14/2014 6:03:22.0 578 . . . . 4/21/2014 5:59:55.0 11 Now there is a reading every 10 seconds from a substation. Now I want to group this data into hourly readings. Thus 00:00-01:00 = sum([KW]] for where datetime >= '^date^ 00:00:00' and datetime < '^date^ 01:00:00' I've tried using a convert to change the datetime into date and time field and then only to add all the time fields together with no success. Can someone please assist me, I'm not sure what is right way of doing this. Thanks ADDED Ok so the spilt between Datetime is working nicely, but as if I add a SUM([KW]) function SQL gives an error. And if I include any of the group functions it also nags. Below is what works, I still need to sum the KW per the grouping of hours. I've tried using Group By Hour and Group by DATEPART(Hour,[DateTime]) Both didn't work. SELECT DATEPART(Hour,[DateTime]) Hour ,DATEPART(Day,[DateTime]) Day ,DATEPART(Month,[DateTime]) Month ,([KVAReal]) ,([KVAr]) ,([KW]) FROM [POWER].[dbo].[IT10t_PAC3200] WHERE datetime >= '2014-04-14 06:00:00' and datetime < '2014-04-21 06:00:00' order by datetime

    Read the article

  • Linq to SQL duplicating entry when referencing FK

    - by Oscar
    Hi! I am still facing some problems when using LINQ-to-SQL. I am also looking for answers by myself, but this problem is so akward that I am having problems to find the right keywords to look for it. I have this code here: public CustomTask SaveTask(string token, CustomTask task) { TrackingDataContext dataConext = new TrackingDataContext(); //Check the token for security if (SessionTokenBase.Instance.ExistsToken(Convert.ToInt32(token)) == null) return null; //Populates the Task - the "real" Linq to SQL object Task t = new Task(); t.Title = task.Title; t.Description = task.Description; //****The next 4 lines are important**** if (task.Severity != null) t.Severity = task.Severity; else t.SeverityID = task.SeverityID; t.StateID = task.StateID; if (task.TeamMember != null) t.TeamMember = task.TeamMember; else t.ReporterID = task.ReporterID; if (task.ReporterTeam != null) t.Team = task.ReporterTeam; else t.ReporterTeamID = task.ReporterTeamID; //Saves/Updates the task dataConext.Tasks.InsertOnSubmit(t); dataConext.SubmitChanges(); task.ID = t.ID; return task; } The problem is that I am sending the ID of the severity, and then, when I get this situation: DB State before calling the method: ID Name 1 high 2 medium 3 low Call the method selecting "medium" as severity DB State after calling the method: ID Name 1 high 2 medium 3 low 4 medium The point is: -It identified that the ID was related to the Medium entry (and for this reason it could populate the "Name" Column correctly), but if duplicated this entry. The problem is: Why?!! Some explanation about the code: CustomTask is almost the same as Task, but I was having problems regarding serialization as can be seen here I don't want to send the Severity property populated because I want my message to be as small as possible. Could anyone clear to my, why it recognize the entry, but creates a new entry in the DB?

    Read the article

  • WinUSB failing on non-development computers

    - by Giawa
    Good afternoon, WinUSB is working well on the development computer that I am using (Win XP SP3). I am able to download new firmware to the Cypress FX2, and then connect to the new USB device once it 'renumerates'. However, if I've tried the same code with the WinUSB driver on a few other computers (Win XP SP3, Win7 x64) and they both returned the error "A device attached to the system is not functioning." when trying to use CreateFile to get a handle to the USB device. The devicePath was found successfully, so I'm not sure why it cannot connect to the device. Furthermore, the device manager states that my device is working properly. I'm curious if I'm missing something when compiling the code? I would guess that my development computer has something installed on it that the other computers do not? Or perhaps it's a power setting and the device is going to sleep (although I've fooled around with the Power Options on each computer to no avail). Does anyone have any ideas? I've compiled under Visual Studio 2008, and have installed the Microsoft C++ 2008 Redistributable Package on the computers that I've tested on. Thanks, Giawa

    Read the article

  • What Are The Ways to Devide Text in Multi-Column? Need an Overview of Possibilities.

    - by Sam
    Hi folks, From source1 and source2 i gather that IE9 will NOT support multi-column css3!! Since it is still the most popular browser (another thing i cannot understand), i am left but no other choice than to use Programming Power to make multi-columns work. Now, I use three divs that float to left, and which are manually filled with text. Please don't laugh i know its stupid! But I would wish to not to have to worry about the columns and just have a one piece of (un-interrupted) text which all goes into only 1 div, and then have a program smart enough to split it up into X equally wide columns. Question: before i start reinvent the wheel, what methods of programming power have you known that tackle this elegantly? Please suggest your best working multi-column layout sources so I can evaluate which option is the best (I will update the below table). Exploring all possibilities 2011 and further, to enable multi column text user experience: Language Author SourceCodeUsage WorksOnAllMajorBrowser? ================================================================================= html manual labour put text manually in separate left-floating divs "Y" // Upside: control! Downside: few changes necessitates to reflow 3 divs manually! CSS3 w3c css3.info/preview/multi-column-layout/ "N" // {-moz-column-count: 3; -webkit-column-count: 3; } Thats all! javascript a list apart will add url soon ? // php ? ? ? //

    Read the article

  • Correct way to switch between UIView with ARC. My way leads to memory leaks :( (iOS)

    - by Andrei Golubev
    i use xcode 4.4 with ARC on.. I have dynamically created UIViews in the ViewController.m: UIView*myviews[10]; Then in the - (void)viewDidLoad function i fill each of it with pictures i need myviews[viewIndex] = [[UIView alloc]initWithFrame:myrec]; UIImage *testImg; UIImageView * testImgView; testImg = [UIImage imageNamed:[NSString stringWithFormat:@"imgarray%d.png", viewIndex]; testImgView.image = testImg; viewindex++; So all seems to be fine, when i want to jump from one view to another i do with two buttons next: [self.view addSubview:views[viewIndex]]; CATransition *animation = [CATransition animation]; [animation setDelegate:self]; [animation setDuration:1.0f]; [animation setType:@"rippleEffect"]; [animation setSubtype:kCATransitionFromTop]; //[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [self.view.layer addAnimation:animation forKey:@"transitionViewAnimation"]; Nothing seems to be bad, but the memory consumption grows with huge speed when i switch between views.. and then i get low memory warning or sometimes application will just crash. I have tried to use UIViewController array and was switching between the controllers: nothing changes, the memory low warning is what i end up with.. Maybe i need to clean the memory somehow? But how? ARC does not allow to use release and so on.. last what i have tried (sorry, maybe not very professional) before to add new subview is this NSArray *viewsToRemove = [self.view subviews]; for (UIView *views in viewsToRemove) { [views removeFromSuperview]; } But this does not help either.. Please don't judge too strong, i am still new to iOS and Objective-c..

    Read the article

  • Facebook dialog appears but always says "An error has occurred"

    - by Conor James
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> ... <head> ... <script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script> </head> <body> <div id="fb-root"></div> <fb:like id="fb-like" href="http://www.example.com" layout="button_count" show_faces="false" width="100"></fb:like> ... myscript.js: FB.ui( { method: 'stream.publish', message: 'getting educated about Facebook Connect', attachment: { name: 'Connect', caption: 'The Facebook Connect JavaScript SDK', description: ( 'A small JavaScript library that allows you to harness ' + 'the power of Facebook, bringing the user\'s identity, ' + 'social graph and distribution power to your site.' ), href: 'http://github.com/facebook/connect-js' }, action_links: [ { text: 'Code', href: 'http://github.com/facebook/connect-js' } ], user_message_prompt: 'Share your thoughts about Connect' }, function(response) { if (response && response.post_id) { alert('Post was published.'); } else { alert('Post was not published.'); } } ); I have Facebook like button on my page which works fine. But when I call the FB.ui method above from my JavaScript source, the Facebook dialog pops up but displays this error message: **An error occurred. Please try again later.** This has happened repeatedly for two days since I started trying to implement it. Not a very helpful error message. Any idea what might cause it or how to narrow down the problem?

    Read the article

  • Creating a network adapter - how hard is it?

    - by Vilx-
    I'm interested in building a little (commercial) device on top of Arduino. I want it to be able to interface with network. Network as in standard Ethernet, Cat5, RJ-45, etc. I know that there is an Ethernet Shield, but it costs even more than the Arduino itself, and it's pretty big. Naturally, I want my device to be as small and as cheap as possible. So I'm thinking about recreating an Ethernet module myself. The problem is - I haven't got any experience with Ethernet, nor do I have a good idea where to start looking. Thus I can't even say if my ideas are feasible. Ultimately I would like the device to have three ports - one for incoming signal, two for outgoing, so the device is essentially a little switch where it is plugged in itself as well. The switching capabilities need not be very fast - the volume of data will be low. 10Mbit is more than enough, can be even slower. If that is not possible, a single port for controlling the device itself will also do. Another possibility I'm considering is power line communications - sending information through power lines. That's another area I've no experience with. What hardware should I be looking at, and where can I find information about the necessary software? So - can anyone tell me if these ideas are feasible, and if yes - where should I start looking?

    Read the article

  • Time complexity of a powerset generating function

    - by Lirik
    I'm trying to figure out the time complexity of a function that I wrote (it generates a power set for a given string): public static HashSet<string> GeneratePowerSet(string input) { HashSet<string> powerSet = new HashSet<string>(); if (string.IsNullOrEmpty(input)) return powerSet; int powSetSize = (int)Math.Pow(2.0, (double)input.Length); // Start at 1 to skip the empty string case for (int i = 1; i < powSetSize; i++) { string str = Convert.ToString(i, 2); string pset = str; for (int k = str.Length; k < input.Length; k++) { pset = "0" + pset; } string set = string.Empty; for (int j = 0; j < pset.Length; j++) { if (pset[j] == '1') { set = string.Concat(set, input[j].ToString()); } } powerSet.Add(set); } return powerSet; } So my attempt is this: let the size of the input string be n in the outer for loop, must iterate 2^n times (because the set size is 2^n). in the inner for loop, we must iterate 2*n times (at worst). 1. So Big-O would be O((2^n)*n) (since we drop the constant 2)... is that correct? And n*(2^n) is worse than n^2. if n = 4 then (4*(2^4)) = 64 (4^2) = 16 if n = 100 then (10*(2^10)) = 10240 (10^2) = 100 2. Is there a faster way to generate a power set, or is this about optimal?

    Read the article

  • Good Hosting Providers With Zend Framework Support

    - by manyxcxi
    I currently use ixwebhosting for my hosting services. They're cheap and work (most of the time). The databases are horribly slow, the servers are horribly slow, and their support (though usually prompt) is tough to deal with. That being said, they're cheap, I've got like 20 domains hosted in my account, none of them are high volume, and they work JUST good enough- until today. This isn't meant to be a condemnation of ixwh though. Their prices are very low for what they do offer and most things work just fine, most of the time. I need to be able to host web apps written with Zend Framework in a fairly easy fashion. The server performance can't be worse than what I've already had (a pretty low hurdle to clear), and I don't want to spend $30/mo. These are not money making websites- they're projects. My requirements are PHP 5.3, ZF support, MySQL databases, multiple domains- not much. Who should I look at, and who should I look out for? Also- I put this on SO instead of SF because of the Zend Framework specific requirement. If I'm wrong, do as you wish.

    Read the article

  • In R, how to get powers of ten in bold font in a plot label?

    - by wfoolhill
    I want to have "10^4 points" in bold as my x-axis label. I know how to make a simple label in bold: plot(1:10, xlab="") mtext(text="10 points", side=1, font=2, line=3) Thanks to this answer, I know how to make a label with a power of ten but nothing is in bold: mtext(text=expression(paste(10^4, " points")), side=1, font=2, line=3) Thanks to this answer, I also know how to make a label with a Greek letter in bold: mtext(text=expression(bold(paste(beta, "=", 10^1, " points"))), side=1, line=3) But still the power of ten is not in bold! It doesn't work either with bquote: mtext(text=bquote(bold(10^1~points)), side=1, line=3) Any idea? Here are some details about my system. Let me know if you need anything else. > sessionInfo() R version 2.15.0 (2012-03-30) Platform: x86_64-redhat-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base

    Read the article

  • Ways to access a 32bit DLL from a 64bit exe

    - by bufferz
    I have a project that must be compiled and run in 64 bit mode. Unfortunately, I am required to call upon a DLL that is only available in 32 bit mode, so there's no way I can house everything in a 1 Visual Studio project. I am working to find the best way to wrap the 32 bit DLL in its own exe/service and issue remote (although on the same machine) calls to that exe/service from my 64 bit app. My OS is Win7 Pro 64 bit. The required calls to this 32 bit process are several dozen per second, but low data volume. This is a realtime image analysis application so response time is critical despite low volume. Lots of sending/receiving single primitives. Ideally, I would host a WCF service to house this DLL, but in a 64 bit OS one cannot force the service to run as x86! Source. That is really unfortunate since I timed function calls to the WCF service to be only 4ms on my machine. I have experimented with named pipes is .net. I found them to be 40-50 times slower than WCF (unusable for me). Any other options or suggestions for the best way to approach my puzzle?

    Read the article

  • How to detect iPhone movement in space using accelerometer ?

    - by super_tomtom
    Hi ! I am trying to make an application that would detect what kind of shape you made with your iPhone using accelerometer. As an example, if you draw a circle with your hand holding the iPhone, the app would be able to redraw it on the screen. This could also work with squares, or even more complicated shapes. The only example of application I've seen doing such a thing is AirPaint (http://vimeo.com/2276713), but it doesn't seems to be able to do it in real time. My first try is to apply a low-pass filter on the X and Y parameters from the accelerometer, and to make a pointer move toward these values, proportionally to the size of the screen. But this is clearly not enought, I have a very low accuracy, and if I shake the device it also makes the pointer move... Any ideas about that ? Do you think accelerometer data is enought to do it ? Or should I consider using other data, such as the compass ? Thanks in advance !

    Read the article

  • Always send certain values with an ajax request/post

    - by DZittersteyn
    I'm building a system that displays a list of user, and on selection of a user requests some form of password. These values are saved in a hidden field on the page, and need to be sent with every request as a form of authentication. (I'm aware of the MITM-vulnerability that lies herein, but it's a very low-key system, so security is not a large concern). Now I need to send these values with each and every request, to auth the currently 'logged in' user. I'd like to automate this, via ajaxSetup, however i'm running into some issues. My first try was: init_user_auth: function(){ $.ajaxSetup({ data: { 'user' : site_user.selected_user_id(), 'passcode': site_user.selected_user_pc(), 'barcode' : site_user.selected_user_bc() } }); }, However, as I should have known, this reads the values once, at the time of the call to ajaxSetup, and never rereads them. What I need is a way to actually call the functions every time an ajax-call is made. I'm currently trying to understand what is happening here: https://groups.google.com/forum/?fromgroups=#!topic/jquery-dev/OBcEfgvTJ9I, however through the flamewar and very low-level stuff going on there, I'm not exactly sure I get what is going on. Is this the way to proceed, or should I just face facts and manually add login-info to each ajax-call?

    Read the article

  • Beginner error in CUDA

    - by Dimitri
    Hi folks, first all i want to wish you a merry christmas. I am writing a small program in CUDA and i have the following errors : contraste.cu(167): error: calling a host function from a __device__/__global__ function is not allowed I don't understand why. Can you please help me and show me my errors. It seems that my program is correct. Here is a the bunch of code causing the problems : __global__ void kernel_contraste(float power, unsigned char tab_in[], unsigned char tab_out[], int nbl, int nbc) { int x = threadIdx.x; printf("I am the thread %d\n", x); } Part of my main program : unsigned char *dimg, *dimg_res; ..... cudaMalloc((void **)dimg, h * w * sizeof(char)); cudaMemcpy(dimg, r.data, h*w*sizeof(char), cudaMemcpyHostToDevice); cudaMalloc((void **)dimg_res, h*w*sizeof(char)); dim3 nbThreadparBloc(256); dim3 numblocs(1); kernel_contraste<<<numblocs, nbThreadparBloc >>>(puissance, dimg, dimg_res, h, w); cudaThreadSynchronize(); ..... cudaFree(dimg); cudaFree(dimg_res); The line 167 is the line where i call the printf in function kernel_contraste. For information, this program takes an image as an input( a sun Rasterfile ) and a power then it calculates the contraste of that image. Thanks !!

    Read the article

  • Project Euler #119 Make Faster

    - by gangqinlaohu
    Trying to solve Project Euler problem 119: The number 512 is interesting because it is equal to the sum of its digits raised to some power: 5 + 1 + 2 = 8, and 8^3 = 512. Another example of a number with this property is 614656 = 28^4. We shall define an to be the nth term of this sequence and insist that a number must contain at least two digits to have a sum. You are given that a2 = 512 and a10 = 614656. Find a30. Question: Is there a more efficient way to find the answer than just checking every number until a30 is found? My Code int currentNum = 0; long value = 0; for (long a = 11; currentNum != 30; a++){ //maybe a++ is inefficient int test = Util.sumDigits(a); if (isPower(a, test)) { currentNum++; value = a; System.out.println(value + ":" + currentNum); } } System.out.println(value); isPower checks if a is a power of test. Util.sumDigits: public static int sumDigits(long n){ int sum = 0; String s = "" + n; while (!s.equals("")){ sum += Integer.parseInt("" + s.charAt(0)); s = s.substring(1); } return sum; } program has been running for about 30 minutes (might be overflow on the long). Output (so far): 81:1 512:2 2401:3 4913:4 5832:5 17576:6 19683:7 234256:8 390625:9 614656:10 1679616:11 17210368:12 34012224:13 52521875:14 60466176:15 205962976:16 612220032:17

    Read the article

  • Android - Turn off display without triggering sleep/lock screen - Turn on with Touchscreen

    - by NebulaSleuth
    I have been trying to find a way to turn off the display, and wake up from the user touching the touch screen. The device is in an embedded environment where the device is a tablet and the user does not have access to anything except the touch screen (no buttons at all). It is connected to power so the battery won't be a problem, but when I detect no activity I want to turn off the screen so it isn't staring them in the face all day and doesn't reduce the life the LCD backlight. I maintain a wakelock permanently and decide when to sleep myself. The problem is that when I turn off the screen using : WindowManager.LayoutParams params = getWindow().getAttributes(); params.screenBrightness = 0; getWindow().setAttributes(params); The activity gets paused and stopped. And the unit does not respond to a touch to wake it up. You need to press the power button. At that point the "slide to unlock" shows up. I want to turn off the display, and then stay running so I can detect a touch screen event and turn the display back on. I also tried turning the display to a brightness of 0.1, which works on some devices, but the device I need it to work on, only "dims" the display. I also tried this: // First Remove my FULL wakelock //then aquire a partial wake lock (which should turn off the display) PowerManager.WakeLock wl = manager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "Your Tag"); wl.acquire(); however this method does not turn off the display.

    Read the article

  • Recomendations for Creating a Picture Slide Show with Super-Smooth Transitions (For Live Presentaito

    - by Nick
    Hi everyone, I'm doing a theatrical performance, and I need a program that can read images from a folder and display them full screen on one of the computer's VGA outputs, in a predetermined order. All it needs to do is start with the first image, and when a key is pressed (space bar, right arrow), smoothly cross-fade to the next image. Sounds just like power-point right? The only reason why I can use power-point/open-office is because the "fade smoothly" transition isn't smooth enough, or configurable enough. It tends to be fast and choppy, where I would like to see a perfectly smooth fade over, say, 30 seconds. So the question is what is the best (cheap and fast) way to accomplish this? Is there a program that already does this well (for cheap or free)? OR should I try to hack at open-office's transition code? Or would it be easier to create this from scratch? Are there frameworks that might make it easier? I have web programming experience (php), but not desktop or real-time rendering. Any suggestions are appreciated!

    Read the article

  • Update all but one result?

    - by Jack M.
    I'm trying to update a table to remove all but the first instance of a group. Basically, I have a table with vehicle data related to an insurance policy. Each policy should only have one power_unit. Everything else should be a towed unit. Unfortunately, a bug has been duplicating power units, and now I need to clean this up. There are ~10k records in the database, and ~4k of them have doubled up power units. The important bits of my table (call it test1 for now) are: +------------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+---------+------+-----+---------+----------------+ | id | int(10) | NO | PRI | NULL | auto_increment | | policy_id | int(10) | NO | | NULL | | | power_unit | int(1) | NO | | 0 | | +------------+---------+------+-----+---------+----------------+ And some sample data: +----+-----------+------------+ | id | policy_id | power_unit | +----+-----------+------------+ | 1 | 1 | 1 | | 2 | 1 | 1 | | 3 | 1 | 1 | | 4 | 2 | 1 | | 5 | 2 | 1 | | 6 | 2 | 1 | | 7 | 4 | 1 | | 8 | 4 | 1 | | 9 | 4 | 1 | | 10 | 5 | 1 | | 11 | 5 | 1 | | 12 | 6 | 1 | +----+-----------+------------+ Basically I'd like to end up where policy_id 1 has only one power_unit=1. Same for policy_id 2, 3, 4, etc. For policy_id 6, nothing should change (there is only one entry, and it is a power_unit already). I don't know if this is possible, but it was an intriguing problem for me, so I thought you guys might find it the same.

    Read the article

  • C non-trivial constants

    - by user525869
    I want to make several constants in C with #define to speed up computation. Two of them are not simply trivial numbers, where one is a right shift, the other is a power. math.h in C gives the function pow() for doubles, whereas I need powers for integers, so I wrote my own function, ipow, so I wouldn't need to be casting everytime. My question is this: One of the #define constants I want to make is a power, say ipow(M, T), where M and T were also #define constants. ipow is a function in the actual code, so this actually seems to slows things down when I run the code (is it running ipow everytime the constant is mentioned?). However, when I ues the built in pow function and just do (int)pow(M,T), the code is sped up. I'm confused as to why this is, since the ipow and pow functions are just as fast. On a more general note, can I define constants using #define using functions inside the actual code? The above example has me confused on whether this speeds things up or actually slows things down.

    Read the article

< Previous Page | 134 135 136 137 138 139 140 141 142 143 144 145  | Next Page >