Daily Archives

Articles indexed Wednesday June 9 2010

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

  • iPhone - database reading method and memory leaks

    - by Do8821
    Hi, in my application, a RSS reader, I get memory leaks that I can't fix because I can't understand from where they come from. Here is the code pointed out by Instruments. -(void) readArticlesFromDatabase { [self setDatabaseInfo]; sqlite3 *database; articles = [[NSMutableArray alloc] init]; if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { const char *sqlStatement = "select * from articles"; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { while(sqlite3_step(compiledStatement) == SQLITE_ROW) { NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)]; NSString *aDate = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)]; NSString *aUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)]; NSString *aCategory = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 4)]; NSString *aAuthor = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 5)]; NSString *aSummary = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 6)]; NSMutableString *aContent = [NSMutableString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 7)]; NSString *aNbrComments = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 8)]; NSString *aCommentsLink = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 9)]; NSString *aPermalink = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 11)]; [aContent replaceCharactersInRange: [aContent rangeOfString: @"http://www.mywebsite.com/img/action-on.gif"] withString: @"hellocoton-action-on.gif"]; [aContent replaceCharactersInRange: [aContent rangeOfString: @"hhttp://www.mywebsite.com/img/action-on-h.gif"] withString: @"hellocoton-action-on-h.gif"]; [aContent replaceCharactersInRange: [aContent rangeOfString: @"hthttp://www.mywebsite.com/img/hellocoton.gif"] withString: @"hellocoton-hellocoton.gif"]; NSString *imageURLBrut = [self parseArticleForImages:aContent]; NSString *imageURLCache = [imageURLBrut stringByReplacingOccurrencesOfString:@":" withString:@"_"]; imageURLCache = [imageURLCache stringByReplacingOccurrencesOfString:@"/" withString:@"_"]; imageURLCache = [imageURLCache stringByReplacingOccurrencesOfString:@" " withString:@"_"]; NSString *uniquePath = [tmp stringByAppendingPathComponent: imageURLCache]; if([[NSFileManager defaultManager] fileExistsAtPath: uniquePath]) { imageURLCache = [@"../tmp/" stringByAppendingString: imageURLCache]; [aContent replaceCharactersInRange: [aContent rangeOfString: imageURLBrut ] withString: imageURLCache]; } Article *article = [[Article alloc] initWithName:aName date:aDate url:aUrl category:aCategory author:aAuthor summary:aSummary content:aContent commentsNbr:aNbrComments commentsLink:aCommentsLink commentsRSS:@"" enclosure:aPermalink enclosure2:@"" enclosure3:@""]; [articles addObject:article]; article = nil; [article release]; } } sqlite3_finalize(compiledStatement); } sqlite3_close(database); } ` I have a lot of "Article" leaked and NSString matching with these using : [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, X)]; I tried a lot of different code I always have these leaks. Anyone has got an idea to help me?

    Read the article

  • Rebol Multitasking with Async: why do I get Invalid port spec

    - by Rebol Tutorial
    I tried http://www.mail-archive.com/[email protected]/msg19437.html (I just changed to www.reboltutorial.com) : do http://www.rebol.it/giesse/async-protocol.r handler: func [port [port!] state [word! error!] /local tmp cmd] [ if error? :state [print mold disarm state return true] switch state [ connect [ ; do HTTP request insert port {GET /files/2009/10/word.png HTTP/1.0^M^JHost: www.reboltutorial.com^M^J^M^J} false ] read [false] write [false] close [ ; get data data: copy port close port ;print copy/part data find data "^M^J^M^J" data: to binary! find/tail data "^M^J^M^J" other/image: attempt [load data] other/text: "" show other false ] ] ] port: open async://www.reboltutorial.com:80 port/awake: :handler view layout [ across me: box 100x100 random 255.255.255 0:00:00.5 feel [ engage: func [f a e] [ if a = 'time [ me/color: random 255.255.255 show me ] ] ] other: box 100x100 255.255.255 "Downloading image..." Return Area 208x100 "You can type here while downloading." ] ] But I'm getting this error: >> port: open async://reboltutorial.com:80 ** Access Error: Invalid port spec: async://reboltutorial.com:80 ** Near: port: open async://reboltutorial.com:80 >> port/awake: :handler ** Script Error: port has no value ** Near: port/awake: :handler

    Read the article

  • The HTTP request was forbidden with client authentication scheme 'Anonymous'

    - by dudia
    I am trying to configure a WCF server\client to work with SSL I get the following exception: The HTTP request was forbidden with client authentication scheme 'Anonymous' I have a self hosted WCF server. I have run hhtpcfg both my client and server certificates are stored under Personal and Trusted People on the Local Machine Here is the server code: binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; binding.Security.Mode = WebHttpSecurityMode.Transport; _host.Credentials.ClientCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.PeerOrChainTrust; _host.Credentials.ClientCertificate.Authentication.RevocationMode = X509RevocationMode.NoCheck; _host.Credentials.ClientCertificate.Authentication.TrustedStoreLocation = StoreLocation.LocalMachine; _host.Credentials.ServiceCertificate.SetCertificate("cn=ServerSide", StoreLocation.LocalMachine, StoreName.My); Client Code: binding.Security.Mode = WebHttpSecurityMode.Transport; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Certificate; WebChannelFactory<ITestClientForServer> cf = new WebChannelFactory<ITestClientForServer>(binding, url2Bind); cf.Credentials.ClientCertificate.SetCertificate("cn=ClientSide", StoreLocation.LocalMachine, StoreName.My); ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidate; Looking at web_tracelog.svclog and trace.log reveals that the server cannot autheticate the client certificate My certificate are not signed by an Authorized CA but this is why I added them to the Trusted People.... What Am I missing? What am I missing?

    Read the article

  • Win32_PageFileUsage WMI call returning 0 for CurrentUsage

    - by Ryan Duffield
    I am querying for the current page file usage on Windows-based systems. This is meant to run on the .NET Framework, version 2.0 SP1 and has been tested (and works!) on Windows Vista, Windows 7, Windows Server 2003 R2 and Windows Server 2008. On Windows Server 2003 SP2 (original release, not R2) it appears to return 0: using (var query = new ManagementObjectSearcher("SELECT CurrentUsage FROM Win32_PageFileUsage")) { foreach (ManagementBaseObject obj in query.Get()) { uint used = (uint)obj.GetPropertyValue("CurrentUsage"); return used; } } This is simply returning the results from the first row returned for the WMI call. Even when a page file is being used, it returns 0. What causes the result to be 0 when it should be returning a larger value? It may be something specific to the machine in question, and could have nothing to do with the operating system version. I've also tried this with and without elevated privileges with the same results.

    Read the article

  • Choosing a Java IDE for homework assignments

    - by Andrew
    Can anyone recommend a light Java IDE that doesn't require you to make new projects each time you want to compile and run a program? I just want to be able to open java files and compile and run them. I have already tried Eclipse and NetBeans but both require you to make a new project each time you want to compile and run a program. Making a new project is fine for large scale projects but for small school assignments this just makes the process more tedious. Thanks

    Read the article

  • Getting the date object to work in IE6 (w/ YYYY-MM-DD param)?

    - by J. LaRosee
    I just got IE6 sprung on me for a project that is going out into the wild soon, which means it's time to go back and comb through all of the CSS and JS. I've gotten hung up on the date object, however: $.validator.addMethod("dateRange", function() { var today = new Date(); var event_date_raw = $('#event_date').val(); var event_date_parts = event_date_raw.split("-"); var event_date = new Date( event_date_parts[2]+","+event_date_parts[1]+","+event_date_parts[0] ); if( event_date.getTime() >= today.getTime() ) return true; return false; }, "Please specify a correct date:"); event_date.getTime() is returning "NaN" in IE6 so the validation fails. The event_raw_date is in the YYYY-MM-DD format, which date doesn't seem to mind in every other browser... Thoughts?

    Read the article

  • Render an SSRS report with a Map as an image map without actually having a ReportViewer on the page

    - by Erica Merchant
    I have a report that has a Map with spatial data. Clicking an object on that map sends you to other pages on the site. I have tried a few different ways of displaying the report: If I put a ReportViewer on the actual page, the page sometimes takes 10+ seconds to load, but the report viewer creates a fully operable image map. If I create a ReportViewer in the code behind, I can use the Render method to to format the report as HTML4.0 and get the streamids from which I can extract the image (painfully). This is pretty fast (1-2 seconds), but only gives me an image, no image map. I can get a very similar functionality as the above example by using rendering extensions on the report URL to create an image and then set an image's source to this url. This is the fastest method, but still does not create an image map. So is there a way to create an image map from the report without having to use the ReportViewer? Or a way to substantially speed up the Report Viewer?

    Read the article

  • Why am I getting "ArgumentError: wrong number of arguments (1 for 0)" when running my rails function

    - by Hisham
    I'm stumped on what's causing this. I get this error and stack trace in all my functional tests where I call 'post'. Here is the full stack trace: 7) Error: test_should_validate(UsersControllerTest): ArgumentError: wrong number of arguments (1 for 0) /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:48:in `to_query' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:48:in `build_query_string' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:46:in `each' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:46:in `build_query_string' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:233:in `append_query_string' generated code (/Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route.rb:154):3:in `generate' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:365:in `__send__' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:365:in `generate' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:364:in `each' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:364:in `generate' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:208:in `rewrite_path' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:187:in `rewrite_url' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/url_rewriter.rb:165:in `rewrite' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/test_process.rb:450:in `build_request_uri' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/test_process.rb:406:in `process' /Users/hisham/src/rails/ftuBackend/vendor/rails/actionpack/lib/action_controller/test_process.rb:376:in `post' functional/users_controller_test.rb:57:in `test_should_validate' /Users/hisham/src/rails/ftuBackend/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `__send__' /Users/hisham/src/rails/ftuBackend/vendor/rails/activesupport/lib/active_support/testing/setup_and_teardown.rb:60:in `run' This is the test I'm running: def test_should_validate post :validate, :user => { :email => '[email protected]', :password => 'quire', :password_confirmation => 'quire', :agreed_to_terms => "true" } assert assigns(:user).errors.empty? assert_response :success end

    Read the article

  • How can I create masking like this in AS3?

    - by Ólafur Waage
    I've worked a little bit with masks in AS3 but I'm not sure how I can do this with masks. I have two swf files that I have imported onto the Library as MC's with class names. One of the files is the start image and the other is the end image. The transition is a slide transition from the start image to the end image. You can think of the transition like in this example. But is it possible to do a slide transition like this using two swf's and "slide transitioning" between them?

    Read the article

  • how to jquery event bind to function

    - by sunglim
    $(function(){ $("#btnExcelRead").click(CheckValidation); }); var CheckValidation = function() { if ($("#excelUpload").val() === "") { alert("Select file"); return false; } if ($("$txtStartDate").val() === "") { alert("Check the start date!"); return false; } if ($("$txtEndDate").val() === "") { alert("Check the end date!"); return false; } } here i made simple jquery code. I want to bind function when btnExcelRead button click. is this originally wrong way?

    Read the article

  • Entering Complex Data into Access

    - by DataMakesMeCrazy
    Fairly new to Access and trying to do something that seems simple, but may be very complex. I want to create a database of projects, each project has several phases (ie proposal, marketing, etc) and that will allow for multiple employees to work on a single project. Ie Bob and John are working on project number 102. From here, i would like to enter the forecasted start and end dates for each phase of the project, and enter the forecasted number our hours each employee will be allowed to work on that phase of that project ie. Project - Employee - Phase - Start - End - (list weeks) 102 - Bob - Marketing - 12-May-10 - 21-May-10 - 3 - 5 (3 hours first week, 5 hours the second) and so on Basically would all this data be on one table, or several? And can access dynamically show the weeks between the start and end date so that i can input the hours? I feel this database will become severely complicated :S Thanks, J

    Read the article

  • C++ - Basic WinAPI question

    - by HardCoder1986
    Hello! I am now working on a some sort of a game engine and I had an idea to put everything engine-related into a static library and then link it to my actual problem. Right now I achieved it and actually link that library and every functions seem to work fine, except those, which are windows-related. I have a chunk of code in my library that looks like this: hWnd = CreateWindow(className, "Name", WS_OVERLAPPED | WS_CAPTION | WS_EX_TOPMOST, 0, 0, 800, 600, NULL, NULL, GetModuleHandle(NULL), this); if (hWnd) { ShowWindow(hWnd, SW_NORMAL); UpdateWindow(hWnd); } else { MessageBox(NULL, "Internal program error", "Error", MB_OK | MB_ICONERROR); return; } When this code was not in the library, but in the actual project, it worked fine, created the window and everything was ok. Right now (when I'm linking to my library that contains this code) CreateWindow(...) call returns NULL and GetLastError() returns "Operation succesfully completed" (wtf?). Could anybody help me with this? Is it possible to create a window and display it using a static library call and why could my code fail? Thank you.

    Read the article

  • Push Trunk or Push Branch to Production

    - by coffeeaddict
    I'd like to get an idea of some processes on build process with Tortoise SVN. Primarily I'm wondering do you push: The Mainline Trunk A branch after QA has grabbed it into a working copy locally and tested the branch and then some build pushes that branch The problem I have is I work at a craphole (hey, it is what it is and I'm venting on stackoverflow, you better believe it..good way to relieve stress due to complete utter chaos) and we have no formal process for pushing anything. In fact even worse my boss directly codes against production. When I have changes, he pushes the mainline trunk. The problem becomes when I make database changes on our Dev database for lets say Branch A. Well...that breaks Branch B and C. I have like 4 projects going on at once! Why? Well, I will not get into that (chaos). So consequently I rename a table field, or add a field or whatever in SQL Server and walla, now my other branches have stale code pointing to previous field names. So what happens? I have to merge certain changes to this branch, to that branch, etc. It feels like a war zone. Finally, what happens is I try to only merge the minimum. Lets say I made DB changes for Branch A's code but now I had to jump back on Branch B's project. Well I need to merge "some" of A's changes over for those database changes so that B's code is not going to bomb out and is able to work with the new table changes. Finally boss pushes the mainline trunk to production. Now I get an email "you forgot to remove the hyperlink for this". That hyperlink was actually a feature I added in Branch A. But what he's talking about here is he just pushed the mainline trunk to production which now has my merged changes from Branch B and any database scripts for Branch A because remember I had some DB changes and if he pushes code, it's got to reflect those changes thus some partial database changes must also be pushed even if it's not related to this project. Well...I missed the hyperlink, so kill me. Maybe that's why we need a build process boss? (sorry, it's been a nightmare working here which is why this thread is getting so detailed). Anyway, obviously this is a nightmare. And he dictates almost everything. The only reason we have source control is because I've worked on hard core teams and that's the first thing you setup. Well there was none here. Problem is I can't dictate the structure..he does but he's never really used source control!! My God. So we have no QA. This is an e-commerce website. That's another huge issue. So consequently I'm expected to be perfect. That means mainline trunk needs to be perfect for whatever we're pushing, whatever branch feature. Is this luda? wtf do I do? I could go off on him after tying so many times tactfully to explain that we need a freakin build process (not just copy local mainline trunk to production!) but I've tried to push before and got yelled at. So I gave up on that. So it will help me tremendously to know how others are pushing their source from Tortoise to production. I was not the person pushing when I was on previous teams so really I'm not too versed in build processes. We are a fairly good size e-commerce site and get a couple millions hits a month.

    Read the article

  • Are there any Simple and Clean Methods to implement Maps (Google or otherwise) in RoR 3?

    - by Port3M5
    I'm looking into building a group work app for my final year project next year. One of the core parts is organising group meetings. I plan to make this as powerful as possible and adding a map can help get rid of excuses such as "I didn't know where it was". I have been unable to find any simple solutions to embed maps into my Rails apps so far. An important issue is I need Rails 3 Compatibility. What are your suggestions? Gems, plugins or even something totally different?

    Read the article

  • Verifying compiler optimizations in gcc/g++ by analyzing assembly listings

    - by Victor Liu
    I just asked a question related to how the compiler optimizes certain C++ code, and I was looking around SO for any questions about how to verify that the compiler has performed certain optimizations. I was trying to look at the assembly listing generated with g++ (g++ -c -g -O2 -Wa,-ahl=file.s file.c) to possibly see what is going on under the hood, but the output is too cryptic to me. What techniques do people use to tackle this problem, and are there any good references on how to interpret the assembly listings of optimized code or articles specific to the GCC toolchain that talk about this problem?

    Read the article

  • Design suggestions for creating document management structure using hidden shares.

    - by focus.nz
    I need to add some document management functionality into my software. Documents will be grouped by company name and project name. The folders need to be accessed by the application using the id numbers of clients/projects, but also easily browsed by the end user using windows explorer. Clients and Projects will be stored in a database. I am thinking of having the software create the folders using the friendly name and then using a hidden share with the id number for the software to access the files. The folder structure would be something like this --Company 1 (Company-1234$) -- Project 101 (Project-101$) -- Project 102 (Project-102$) -- Project 103 (Project-103$) -- Company 2 (Company-5678$) -- Project 201 (Project-201$) -- Project 202 (Project-202$) -- Project 203 (Project-203$) So in the example above there would be a company called "Company 1" with a ID of "1234". When browsing the folders using windows explorer the user would see \\ServerName\Documents\Company1 and you could also access the same folder from \\ServerName\Documents\Company-1234$ By using the hidden share, if the company name changes or its renamed for some reason it doesn't break the link in the application because its using the hidden shared based on the ID that never changes. Will having hundreds (maybe thousands) or hidden shares on a server provide a huge performance hit? Does any one have any suggestions or alternatives to provide this feature?

    Read the article

  • How to decode Google spreadsheet's Json respose as a Php Array

    - by Mohammad
    My google Docs Spreadsheet call returns this response in the json format (I only need everything after "rows") please look at the formatted response here : ) I use php's json_decode function to parse the data and use it (Yes, I am awful at php) This code returns NULL, and according to the documentation, NULL is returned "if the json cannot be decoded". $json = file_get_contents($jsonurl); $json_output = json_decode($json); var_dump ($json_output); // Returns NULL Basically, what i want to accomplish is to make a simple array from the first row values of the Json response. like this $array = {'john','John Handcock','[email protected]','2929292','blanc'} You guys are genius, I would appreciate your insight and help on this very much! Answer as "sberry2A" mentions bellow, the response is not valid Json, google offers the Zend Json library for this purpose, tho I decided to parse the tsv-excel version instead :)

    Read the article

  • Ant build script executing <sql> task using java code

    - by Jay
    Any idea, why none of the debugging comments are printed once after executing the ANT build script's SQL task via java code? The java class to execute the sql in build scirpt is public class AntRunnerTest { private Project project; public void executeTask(String taskName) { try { project = new Project(); project.init(); project.setBasedir(new String(".")); ProjectHelper helper = ProjectHelper.getProjectHelper(); project.addReference("ant.projectHelper", helper); helper.parse(project, new File("build-copy.xml")); System.out.println("Before"); project.executeTarget(taskName); System.out.println("After"); } catch(Exception ex) { System.out.println(ex.getMessage()); } } public static void main(String args[]) { try { AntRunnerTest newInst = new AntRunnerTest(); newInst.executeTask("sql"); } catch(Exception e) { System.out.println(""+e); } } } I dont see the debug String "After" getting printed in the console. I noticed this issue only when i try to execute a sql task using java code. The ant script has the following simple transaction tag in it. <transaction> <![CDATA[ select now() ]]> </transaction> Any thoughts? Thanks in advance.

    Read the article

  • Setting up Netbeans/Eclipse for Linux Kernel Development

    - by red.october
    Hi: I'm doing some Linux kernel development, and I'm trying to use Netbeans. Despite declared support for Make-based C projects, I cannot create a fully functional Netbeans project. This is despite compiling having Netbeans analyze a kernel binary that was compiled with full debugging information. Problems include: files are wrongly excluded: Some files are incorrectly greyed out in the project, which means Netbeans does not believe they should be included in the project, when in fact they are compiled into the kernel. The main problem is that Netbeans will miss any definitions that exist in these files, such as data structures and functions, but also miss macro definitions. cannot find definitions: Pretty self-explanatory - often times, Netbeans cannot find the definition of something. This is partly a result of the above problem. can't find header files: self-explanatory I'm wondering if anyone has had success with setting up Netbeans for Linux kernel development, and if so, what settings they used. Ultimately, I'm looking for Netbeans to be able to either parse the Makefile (preferred) or extract the debug information from the binary (less desirable, since this can significantly slow down compilation), and automatically determine which files are actually compiled and which macros are actually defined. Then, based on this, I would like to be able to find the definitions of any data structure, variable, function, etc. and have complete auto-completion. Let me preface this question with some points: I'm not interested in solutions involving Vim/Emacs. I know some people like them, but I'm not one of them. As the title suggest, I would be also happy to know how to set-up Eclipse to do what I need While I would prefer perfect coverage, something that only misses one in a million definitions is obviously fine SO's useful "Related Questions" feature has informed me that the following question is related: http://stackoverflow.com/questions/149321/what-ide-would-be-good-for-linux-kernel-driver-development. Upon reading it, the question is more of a comparison between IDE's, whereas I'm looking for how to set-up a particular IDE. Even so, the user Wade Mealing seems to have some expertise in working with Eclipse on this kind of development, so I would certainly appreciate his (and of course all of your) answers. Cheers

    Read the article

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