Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 115/171 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • Variable might not have been initialized error

    - by David
    When i try to compile this: public static Rand searchCount (int[] x) { int a ; int b ; ... for (int l= 0; l<x.length; l++) { if (x[l] == 0) a++ ; else if (x[l] == 1) b++ ; } ... } I get these errors: Rand.java:72: variable a might not have been initialized a++ ; ^ Rand.java:74: variable b might not have been initialized b++ ; ^ 2 errors it seems to me that i initialized them at the top of the method. Whats going wrong?

    Read the article

  • CoreData: Sort and Section on Relationships

    - by David.Chu.ca
    I have two questions about using Core Data. Taking the typical case of Employee and Department as an example. The Employee entity has a relationship field "deparment" as to-one to Department, and the Department entity has a relationship "employee" as to-many to Employee entity. I would like to display all the employees in a TableView in sections of department's names. I think that the NSFetchedResultsController should use Employee as entity. I am not sure how to use Department's name as a sort criteria, since it is in an employee's relationship field department's name. Can you use "DepartmentName" as a sort and add this to Employee entity class as a method which will return department's name for a given employee? The second question is the section name. I would like to use department names as sections. Can I use the above method as sectionKeyPath's value for the NSFethedResultsController? Not sure if I am on the right track.

    Read the article

  • sql rowlock on select statement

    - by David
    I have an ASP.Net webpage where the user selects a row for editing. I want to use the row lock on that row and once the user finishes the editing and updates another user can edit that row i.e. How can I use rowlock so that only one user can edit a row? Thank you

    Read the article

  • Creating huge images

    - by David Rutten
    My program has the feature to export a hi-res image of the working canvas to the disk. Users will frequently try to export images of about 20,000 x 10,000 pixels @ 32bpp which equals about 800MB. Add that to the serious memory consumption already going on in your average 3D CAD program and you'll pretty much guarantee an out-of-memory crash on 32-bit platforms. So now I'm exporting tiles of 1000x1000 pixels which the user has to stitch together afterwards in a pixel editor. Is there a way I can solve this problem without the user doing any work? I figured I could probably write a small exe that gets command-lined into the process and performs the stitching automatically. It would be a separate process and it would thus have 2GB of ram all to itself. Or is there a better way still? I'd like to support jpg, png and bmp so writing the image as a bytestream to the disk is not really possible.

    Read the article

  • Architecture for database analytics

    - by David Cournapeau
    Hi, We have an architecture where we provide each customer Business Intelligence-like services for their website (internet merchant). Now, I need to analyze those data internally (for algorithmic improvement, performance tracking, etc...) and those are potentially quite heavy: we have up to millions of rows / customer / day, and I may want to know how many queries we had in the last month, weekly compared, etc... that is the order of billions entries if not more. The way it is currently done is quite standard: daily scripts which scan the databases, and generate big CSV files. I don't like this solutions for several reasons: as typical with those kinds of scripts, they fall into the write-once and never-touched-again category tracking things in "real-time" is necessary (we have separate toolset to query the last few hours ATM). this is slow and non-"agile" Although I have some experience in dealing with huge datasets for scientific usage, I am a complete beginner as far as traditional RDBM go. It seems that using column-oriented database for analytics could be a solution (the analytics don't need most of the data we have in the app database), but I would like to know what other options are available for this kind of issues.

    Read the article

  • Attaching files to WCF REST service responses

    - by David Seiler
    I have a resource that looks something like this: /users/{id}/summary?format={format} When format is "xml" or "json" I respond with a user summary object that gets automagically encoded by WCF - fine so far. But when format equals "pdf", I want my response to consist of a trivial HTTP response body and a PDF file attachment. How is this done? Hacking on WebOperationContext.Current.OutgoingResponse doesn't seem to work, and wouldn't be the right thing even if it did. Including the bits of the file in a CDATA section or something in the response isn't safe. Should I create a subclass of Message, then provide a custom IDispatchMessageFormatter that responds with it? I went a short distance down that path but ultimately found the documentation opaque. What's the right thing?

    Read the article

  • Good Replacement for User Control?

    - by David Lively
    I found user controls to be incredibly useful when working with ASP.NET webforms. By encapsulating the code required for displaying a control with the markup, creation of reusable components was very straightforward and very, very useful. While MVC provides convenient separation of concerns, this seems to break encapsulation (ie, you can add a control without adding or using its supporting code, leading to runtime errors). Having to modify a controller every time I add a control to a view seems to me to integrate concerns, not separate them. I'd rather break the purist MVC ideology than give up the benefits of reusable, packaged controls. I need to be able to include components similar to webforms user controls throughout a site, but not for the entire site, and not at a level that belongs in a master page. These components should have their own code not just markup (to interact with the business layer), and it would be great if the page controller didn't need to know about the control. Since MVC user controls don't have codebehind, I can't see a good way to do this. I've searched previous SO questions, and have yet to find a good answer. Options so far In an attempt to avoid turning the comments section into a discussion... RenderAction This allows the view to call another controller, which will be responsible for interacting with the BLL and whatever data is necessary to its corresponding view. The calling view needs to be aware of the sub controller. This seems to provide a nice way to encapsulate partial views and controls, without having to modify the calling controller. RenderPartial The calling controller is still responsible for executing whatever code is associated with the partial view, and making sure that the model passed to the partial view contains the data it expects. Effectively, modifying the partial view potentially means modifying the calling controller. Annoying especially if this is used in multiple places. Portable Areas Place each control in its own project/area?

    Read the article

  • Loading non-RJS javascript via ajax in Rails

    - by David Smith
    I've written a rails module that generates some javascript for a google map. As the user makes changes on the webpage, I use observe_field to call back to the server to regenerate the map's javascript (without updating the whole page). I'm having trouble finding a good way to insert the new javascript into the page. I've tried <div id='my_div_1'>div1</div> <%= update_page_tag do |page| page.replace_html 'my_div_1', "<script>alert('hi');</script>" end %> but it seems that replace_html only works for non-script html. It chokes when the content includes the closing < /script tag. Additional information...here is a page that I think is the root of the problem. http://www.wwco.com/~wls/blog/2007/04/25/using-script-in-a-javascript-literal/

    Read the article

  • How did this get 8?

    - by David
    Here's the code: class qual { public static int fibonacci(int n) { if (n == 0 || n == 1) { return 1; } else { return fibonacci(n-1) + fibonacci(n-2); } } public static void main(String[] arg) { System.out.println(fibonacci(5)); } } The output was 8. The output should be 8 but when I look at this I think it should be 7 ((5-1) +(5-2)). Why was the output 8? I think the reasoning behind getting 8 will make recursion maybe stop being confusing for me.

    Read the article

  • How to keep Hibernate mapping use under control as requirements grow

    - by David Plumpton
    I've worked on a number of Java web apps where persistence is via Hibernate, and we start off with some central class (e.g. an insurance application) without any time being spent considering how to break things up into manageable chunks. Over time as features are added we add more mappings (rates, clients, addresses, etc.) and then amount of time spent saving and loading an insurance object and everything it connects to grows. In particular you get close to a go-live date and performance testing with larger amounts of data in each table is starting to demonstrate that it's all too slow. Obviously there are a number of ways that we could attempt to partition things up, e.g. map only the client classes for the client CRUD screens, etc., which would have been better to get in place earlier rather than trying to work it in at the end of the dev cycle. I'm just wondering if there are recommendations about ways to handle/mitigate this.

    Read the article

  • Xcode: view references for a variable?

    - by David.Chu.ca
    I am new to Xcode. I am not sure if there is a way to view a variable's references just like "Find all references" in Visual Studio by right click on a var? For example, in my .h file, I would like to know or view all the references for property isSet: @interface MyInterface { ... BOOL isSet; // view all references to this var? ... }

    Read the article

  • Server.Execute - render .ASP from MVC controller action

    - by David Lively
    I need to render an ASP page to a string from an MVC controller action. I can use Server.Execute() to render a .aspx page, but not a .asp page. Here's what I'm using: public ActionResult Index() { Server.Execute("/default.asp"); return new EmptyResult(); } which returns `No http handler was found for request type 'GET'` Any suggestions? I can do something similar with with a web request, but I'd rather avoid the overhead of a loopback request.

    Read the article

  • Use multiple css files or a single file organised by comments

    - by David
    Hi, what is regarded as the best approach to organising css. At the moment I am using a single link in the head of my xhtml documents as follows: <link rel="stylesheet" type="text/css" href="style/imports.css" /> In this file im importing several different css files i.e. reset.css, structure.css, skin.css I know there is an overhead in doing this as each requires an extra trip to the server but it makes things much more logical and organised in my opinion. Does anyone have an opinion on how best to organise their css. - Would it be better to put all these seperate css funcions into one single file? Also, is it best practice to minify css.

    Read the article

  • Android: Learning the platform, have any app suggestions?

    - by David
    I'm beginning to learn mobile programming on the Android platform. I'm up for working with any particular base SDK. I just want to hear some suggestions from the community about what types of applications I should start with to help learn more advanced interactions with the platform. There are of course the Standard Hello World, calculator, etc. But by now I am bored with all of those. What do you all make when learning a new language?

    Read the article

  • Can Uploadify send e-mail on complete?

    - by David
    Uploadify is a jQuery/Flash plugin for uploading multiple files. It's working great, except I can't figure out how trigger e-mail when all files are complete. If I try to add something like <% SendEmail(); %> to the onAllComplete parameter, it just sends the e-mail when the page loads. Is there a way to do this within the handler recommended here or from this post? Or is there some way to trigger a post in the onAllComplete parameter?

    Read the article

  • How do i know if this is random enough?

    - by David
    I wrote a program in java that rolls a die and records the total number of times each value 1-6 is rolled. I rolled 6 Million times. Here's the distribution: #of 0's: 0 #of 1's: 1000068 #of 2's: 999375 #of 3's: 999525 #of 4's: 1001486 #of 5's: 1000059 #of 6's: 999487 (0 wasn't an option.) Is this distribution consistant with random dice rolls? What objective statistical tests might confirm that the dice rolls are indeed random enough?

    Read the article

  • WPF: Convert memory stream to BitmapImage?

    - by David Veeneman
    I have an image that was originally a PNG that I have converted to a byte[] and saved in a database. Originally, I simply read the PNG into a memory stream and converted the stream into a byte[]. Now I want to read the byte[] back and convert it to a BitmapImage, so that I can bind a WPF Image control to it. I am seeing a lot of contradictory and confusing code online to accomplish the task of converting a byte[] to a BitmapImage. I am not sure whether I need to add any code due to the fact that the image was originally a PNG. Can anyone provide the code to convert the stream to a BitmapImage? Thanks for your help.

    Read the article

  • Visual Studio 2012 won't start

    - by David Aleu
    I installed VS2012 Premium from our MSDN subscription and it was working fine the first couple of days but then I installed a few extensions I can't now start VS2012 and it gives the error: Faulting application name: devenv.exe, version: 11.0.50727.1, time stamp: 0x5011ecaa Faulting module name: ntdll.dll, version: 6.1.7601.17725, time stamp: 0x4ec49b8f Exception code: 0xc0000374 Fault offset: 0x000ce6c3 Faulting process id: 0xee8 Faulting application start time: 0x01cd89bb777fc1dd Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe Faulting module path: C:\Windows\SysWOW64\ntdll.dll I'm running it on Windows 7 64 bit. I've tried to repair, uninstall and install again and nothing. I tried to restore to a previous restore system point but nothing. The extensions I installed I can remember: VS10x Code Map VSCommands Visual SVN Nuget manager (all the above my colleagues have it too and it works fine for them) and: Web Essentials Visual Studio Color Theme Editor SlowCheetah Mobile Ready HTML5 Questions are: Anyone else has had this problem? Is there a way I can uninstall extensions from a command line or software? (I removed the extensions folder but that doesn't do anything) Can I repair the "C:\Windows\SysWOW64\ntdll.dll"? Is it really a problem with this dll? I haven't been able to find any similar issue in other versions and because VS2012 is new doesn't seem to be much information either.

    Read the article

  • Output something other than True or False

    - by David
    Newb to JS. Trying to determain how to to output something other than Question 1 is True and False. If I understand this correctly, the output is the expression of the flag True or False. Trying to change to say Correct and Incorrect. Also trying to express a percentage of correct instead of the for example: Your total score is 10/100 $(function(){ var jQuiz = { answers: { q1: 'd', q2: 'd', }, questionLenght: 2, checkAnswers: function() { var arr = this.answers; var ans = this.userAnswers; var resultArr = [] for (var p in ans) { var x = parseInt(p) + 1; var key = 'q' + x; var flag = false; if (ans[p] == 'q' + x + '-' + arr[key]) { flag = true; g } else { flag = false; } resultArr.push(flag); } return resultArr; }, init: function(){ $("[class=btnNext]").click(function(){ if ($('input[type=radio]:checked:visible').length == 0) { return incorrect ; } $(this).parents('.questionContainer').fadeOut(500, function(){ $(this).next().fadeIn(500); }); var el = $('#progress'); el.width(el.width() + 11 + 'px'); }); $('.btnPrev').click(function(){ $(this).parents('.questionContainer').fadeOut(500, function(){ $(this).prev().fadeIn(500) }); var el = $('#progress'); el.width(el.width() - 11 + 'px'); }) $("[class=btnShowResult]").click(function(){ var arr = $('input[type=radio]:checked'); var ans = jQuiz.userAnswers = []; for (var i = 0, ii = arr.length; i < ii; i++) { ans.push(arr[i].getAttribute('id')) } }) $('.btnShowResult').click(function(){ $('#progress').width(260); $('#progressKeeper').hide(); var results = jQuiz.checkAnswers(); var resultSet = ''; var trueCount = 0; for (var i = 0, ii = results.length; i < ii; i++){ if (results[i] == true) trueCount++; resultSet += '<div> Question ' + (i + 1) + ' is ' + results[i] + '</div>' } resultSet += '<div class="totalScore">Your total score is ' + trueCount * 4 + ' / 100</div>' $('#resultKeeper').html(resultSet).show(); }) } }; jQuiz.init(); })

    Read the article

  • Cross-Origin Resource Sharing (CORS) - am I missing something here?

    - by David Semeria
    I was reading about CORS (https://developer.mozilla.org/en/HTTP_access_control) and I think the implementation is both simple and effective. However, unless I'm missing something, I think there's a big part missing from the spec. As I understand, it's the foreign site that decides, based on the origin of the request (and optionally including credentials), whether to allow access to its resources. This is fine. But what if malicious code on the page wants to POST a user's sensitive information to a foreign site? The foreign site is obviously going to authenticate the request. Hence, again if I'm not missing something, CORS actually makes it easier to steal sensitive information. I think it would have made much more sense if the original site could also supply an immutable list of servers its page is allowed to access. So the expanded sequence would be: 1) Supply a page with list of acceptable CORS servers (abc.com, xyz.com, etc) 2) Page wants to make an XHR request to abc.com - the browser allows this because it's in the allowed list and authentication proceeds as normal 3) Page wants to make an XHR request to malicious.com - request rejected locally (ie by the browser) because the server is not in the list. I know that malicious code could still use JSONP to do its dirty work, but I would have thought that a complete implementation of CORS would imply the closing of the script tag multi-site loophole. I also checked out the official CORS spec (http://www.w3.org/TR/cors) and could not find any mention of this issue.

    Read the article

  • Convert codes to HTML with CSS style

    - by David.Chu.ca
    I normally use VIM to edit my codes and convert them to HTML by using TOhtml command. The only thing I don't like is that the converted HTML does not have css class style definitions. I am not sure if there is tool to convert codes to HTML with css, or I can use additional tool or command to convert HTML HTML with css?

    Read the article

  • Efficient way to maintain a sorted list of access counts in Python

    - by David
    Let's say I have a list of objects. (All together now: "I have a list of objects.") In the web application I'm writing, each time a request comes in, I pick out up to one of these objects according to unspecified criteria and use it to handle the request. Basically like this: def handle_request(req): for h in handlers: if h.handles(req): return h return None Assuming the order of the objects in the list is unimportant, I can cut down on unnecessary iterations by keeping the list sorted such that the most frequently used (or perhaps most recently used) objects are at the front. I know this isn't something to be concerned about - it'll make only a miniscule, undetectable difference in the app's execution time - but debugging the rest of the code is driving me crazy and I need a distraction :) so I'm asking out of curiosity: what is the most efficient way to maintain the list in sorted order, descending, by the number of times each handler is chosen? The obvious solution is to make handlers a list of (count, handler) pairs, and each time a handler is chosen, increment the count and resort the list. def handle_request(req): for h in handlers[:]: if h[1].handles(req): h[0] += 1 handlers.sort(reverse=True) return h[1] return None But since there's only ever going to be at most one element out of order, and I know which one it is, it seems like some sort of optimization should be possible. Is there something in the standard library, perhaps, that is especially well-suited to this task? Or some other data structure? (Even if it's not implemented in Python) Or should/could I be doing something completely different?

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >