Daily Archives

Articles indexed Friday December 24 2010

Page 19/25 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Getting memory leak at NSURL connection in Iphone sdk.

    - by monish
    Hi guys, Here Im getting leak at the NSURL connection in my libxml parser can anyone tell how to resolve it. The code where leak generates is: - (BOOL)parseWithLibXML2Parser { BOOL success = NO; ZohoAppDelegate *appDelegate = (ZohoAppDelegate*) [ [UIApplication sharedApplication] delegate]; NSString* curl; if ([cName length] == 0) { curl = @"https://invoice.zoho.com/api/view/settings/currencies?ticket="; curl = [curl stringByAppendingString:appDelegate.ticket]; curl = [curl stringByAppendingString:@"&apikey="]; curl = [curl stringByAppendingString:appDelegate.apiKey]; curl = [curl stringByReplacingOccurrencesOfString:@"\n" withString:@""]; } NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:curl]]; NSLog(@"the request parserWithLibXml2Parser %@",theRequest); NSURLConnection *con = [[[NSURLConnection alloc] initWithRequest:theRequest delegate:self] autorelease];//Memory leak generated here at this line of code. //self.connection = con; //[con release]; // This creates a context for "push" parsing in which chunks of data that are // not "well balanced" can be passed to the context for streaming parsing. // The handler structure defined above will be used for all the parsing. The // second argument, self, will be passed as user data to each of the SAX // handlers. The last three arguments are left blank to avoid creating a tree // in memory. _xmlParserContext = xmlCreatePushParserCtxt(&simpleSAXHandlerStruct, self, NULL, 0, NULL); if(con != nil) { do { [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; } while (!_done && !self.error); } if(self.error) { //NSLog(@"parsing error"); [self.delegate parser:self encounteredError:nil]; } else { success = YES; } return success; } Anyone's help will be muck appreciated . Thank you, Monish.

    Read the article

  • indentationLevel property doesn't appear to do anything?

    - by JoBu1324
    I'm have a number rows I'm inserting into a table using -insertRowsAtIndexPaths:withRowAnimation, and I would like the rows to be indented from the left to distinguish them from the rest of the cells. The indentationLevel property of UITableViewCell looks like it's exactly what I need, but it doesn't seem to do anything. Here's the code I'm using to set the indentation level (dot syntax doesn't make a difference): [cell setIndentationWidth:10]; [cell setIndentationLevel:1]; Is indentationLevel what I want, or should I be looking elsewhere?

    Read the article

  • C++ Undeclared Identifier (but it is declared?)

    - by Joshua
    I'm pretty sure I've included the qanda class, but when I try to declare a vector that contains it or a class of that type I get an error saying that qanda is undefined. Any idea what the problem might be? bot_manager_item.h #pragma once #include "../bot_packet/bot_packet.h" #include <vector> class bot_manager_item; #include "qanda.h" #include "bot_manager.h" class bot_manager_item { public: bot_manager_item(bot_manager* mngr, const char* name, const char* work_dir); ~bot_manager_item(); bool startup(); void cleanup(); void on_push_event(bot_exchange_format f); bool disable; private: void apply_changes(); bot_manager *_mngr; std::string _name; std::string _work_dir; std::string _message; std::string _message_copy; std::vector<qanda> games; qanda test; char _config_full_path[2600]; }; qanda.h #ifndef Q_AND_A #define Q_AND_A #include "users.h" #include "..\bot_packet\bot_packet.h" #include "bot_manager.h" #include <string> #include <algorithm> #include <map> #include <vector> #include <fstream> class qanda { public: qanda(bot_manager * manager, std::string name, std::string directory); ~qanda(){}; void room_message(std::string username, std::string user_message); void timer_tick(); private: // data members std::string question; std::string answer; std::string directory; std::string command_prefix; std::string name; Users users; std::map <std::string, std::string> questions_and_answers; int time_per_question; // seconds int time_between_questions; // seconds int timer; // milliseconds bool is_delayed; bool is_playing; bot_manager * manager; // functions void new_question(); void send_message(std::string msg); void announce_question(); void load_questions(); }; #endif

    Read the article

  • Ruby on Rails Mongrel web server stuck when MySQL service is running

    - by Marcos Buarque
    Hi, I am a Ruby on Rails newbie and already have a problem. I have started the Mongrel web server and it works fine when MySQL service isn't running. But when MySQL is on, Mongrel stucks. It ceases from serving the pages. So far, I have tested the localhost:3000 URL. When MySQL is off, it serves the page. When I click "about application's environment", I get the messasge (of course) "Can't connect to MySQL server on 'localhost' (10061)". After starting the MySQL service and refreshing, I get no more answer and Mongrel does not serve the webpage. It gets stuck with no answer to the browser. Then I have to stop the webserver and restart it. I have installed mysql2 gem with the command gem install mysql2. I was able to create the _test and _development databases with the command line rake db:create. I have tested with MySQL root user and blank password and also tried with a superuser user I have created. No success. Here is the server log: ======================== Started GET "/rails/info/properties" for 127.0.0.1 at Fri Dec 24 17:41:25 -0200 2010 Mysql2::Error (Can't connect to MySQL server on 'localhost' (10061)): Rendered C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms) Rendered C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (5.0ms) Rendered C:/Ruby187/lib/ruby/gems/1.8/gems/actionpack-3.0.3/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (35.0ms) ================= I am running on a Windows 7 environment with firewall down.

    Read the article

  • Java's PipedReader / PipedWriter equivalents in C#?

    - by devoured elysium
    I have defined a Pipe class in Java, making use of PipedReader and PipedWriter. I am now trying to port this same class to C#. Is it possible to accomplish the same as shown in the following code in C#? public final class Pipe { private final PipedReader pipedReader = new PipedReader(); private final PipedWriter pipedWriter = new PipedWriter(); public Pipe() { pipedWriter.connect(pipedReader); } ... } I am guessing what I'll want to use in C# for PipedReader and PipedWriter will be StreamReader and StreamWriter? Is there something like a connect() method? Thanks

    Read the article

  • javascript JSONP callback function not defined

    - by bitsMix
    ( function restoreURL() { function turnLongURL(data) { window.location = data.url; } var shortUrl = window.location.href; var url = "http://json-longurl.appspot.com/?url=" + shortUrl + "&callback=turnLongURL"; var script = document.createElement('script'); script.setAttribute('src', url); document.getElementsByTagName('head')[0].appendChild(script); })(); code is above, but the firebug told me, turnLongURL is not defined why is that?

    Read the article

  • C++ MPL or_, and_ implementations

    - by KRao
    Hi, I am trying to read the boost headers to figure out how they managed to implement the or_<...> and and_<...> metafunctions so that: 1) They can have an arbitrary number of arguments (ok, say up to 5 arguments) 2) They have short circuit behavior, for example: or_<false_,true_,...> does not instantiate whatever is after true_ (so it can also be declared but not defined) Unfortunately the pre-processor metaprogramming is making my task impossible for me :P Thank you in advance for any help/suggestion.

    Read the article

  • SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

    - by Vikash
    I am using Authlogic-Connect for third party logins. After running appropriate migrations, Twitter/Google/yahoo logins seem to work fine but the facebook login throws exception: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed The dev log shows OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed): app/controllers/users_controller.rb:37:in `update' Please suggest..

    Read the article

  • Heap corruption detected error when attempting to free pointer

    - by AndyGeek
    Hi, I'm pretty new to C++ and have run into a problem which I have not been able to solve. I'm trying to convert a System::String to a wchar_t pointer that I can keep for longer than the scope of the function. Once I'm finished with it, I want to clean it up properly. Here is my code: static wchar_t* g_msg; int TestConvert() { pin_ptr<const wchar_t> wchptr = PtrToStringChars("Test"); g_msg = (wchar_t*)realloc(g_msg, wcslen(wchptr) + 1); wcscpy(g_msg, wchptr); free (g_msg); // Will be called from a different method } When the free is called, I'm getting "HEAP CORRUPTION DETECTED: after Normal block (#137) at 0x02198F90." Why would I be getting this error? Andrew L

    Read the article

  • Getting a substring in Ruby by x number of chars

    - by wotaskd
    I'm trying to produce some Ruby code that will take a string and return a new one, with a number x number of characters removed from its end - these can be actual letters, numbers, spaces etc. Ex: given the following string a_string = "a1wer4zx" I need a simple way to get the same string, minus - say - the 3 last digits. In the case above, that would be "a1wer". The way I'm doing it right now seems very convoluted: an_array = a_string.split(//,(a_string.length-2)) an_array.pop new_string = an_array.join Any ideas?

    Read the article

  • PHP parameter without value using for navigation

    - by somewalri
    Hello, I am trying to set up a navigation system that uses GET parameters with no value, example: http://foo.bar/?mainPage takes the visitor to the main page. So I am using if statements and I am wondering if there is a way I can do this without a bunch of if statements? I don't think switch statements would work for this. This is currently what I have: $mainPage = $_GET['mainPage']; $contact = $_GET['contact']; if(isset($mainPage)) { // go to main page } if(isset($contact)) { // go to contact page } I don't want to have to end up writing a ton of if statements, though. Any ideas? Thanks.

    Read the article

  • Qt - QWebView Problem

    - by user547057
    Hi, I have a PyQt gui script which consists of a QWebView widget. I'm trying to send a GET request, i.e go to a page, fill a form and hit click using the code at the bottom of this question. Since i'm dealing with the documentElement(a QWebElement) of the webview, I need to place all DOM actions in a separate function(which I have named fillForm) and connect the loadFinished() signal into the function. Without connecting the signal, the document will not have loaded and I won't be able to get the elements I want. I'm able to submit the form correctly and get the proper response from the webpage. The problem i'm having is that, the above leads to a sort of infinite loop. This is because the webpage gets reloaded each time a new page is loaded, so the form gets filled each and every single time without stopping. I'd like to know if there's some way of finding out whether the WebView's page has loaded fully, non-asynchronously or maybe pause execution of the script(without freezing the gui) until the whole document has loaded. I'm unable to come up with a satisfactory solution(my idea consisted of keeping a global variable to track clicks) to this problem. I would appreciate it if someone could help me out with a better way to tackle this. Thanks! Here's the code i'm using import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from PyQt4.QtWebKit import * from PyQt4 import QtCore app = QApplication(sys.argv) web = QWebView() web.load(QUrl("http://mywebsite.com")) def fillForm(): doc = web.page().mainFrame().documentElement() searchform = doc.findFirst("input[type=text]") searchform.setAttribute("value", "hello") button = doc.findFirst("input[type=submit]") button.evaluateJavaScript("click()") QtCore.QObject.connect(web, QtCore.SIGNAL("loadFinished"), fillForm) web.show() sys.exit(app.exec_())

    Read the article

  • Convert string to JSON using Python

    - by Luiz Fernando
    Hi, I'm a little bit confused with JSON in Python. To me, it seems like a dictionary, and for that reason I'm trying to do that: json = """{ "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } } """ But when I do print dict(json), it gives an error. How can I transform this string into a structure and then call json["title"] to obtain "example glossary"? Thanks.

    Read the article

  • Returning binomal as a tuple

    - by Mike
    I want to save the results of my function binomal_aux to a tuple but I don't have an idea how to, here is my code I have right now. def binomal (n): i=0 for i in range(n): binomal_aux(n,i) #want this to be in a tuple so, binomal (2) = (1,2,1) return def binomal_aux (n,k): if (k==0): return 1 elif (n==k): return 1 else: return (binomal_aux(n-1,k) + binomal_aux(n-1,k-1))

    Read the article

  • C# Random generation

    - by Betamoo
    I have just passed this article online: C# Corner and C# Corner and his article (a software developer with over 13 years of experience) recommended using System.Random as follows: private int RandomNumber(int min, int max) { Random random = new Random(); return random.Next(min, max); } Isn't that would give him the same number every time ?? Edit: So my question will become: How does Random choose its seed? a constant or current time value? Thanks

    Read the article

  • UIButton not getting touch events inside a custom UITableViewCell

    - by user210504
    Hi! I have designed a custom UItableView Cell in IB. This cell has a UIButton with an associated action. This button is not getting touch events, however the cell itself gets the events when called. What could I be doing wrong here. +--------------------------------+ | +----------+ | Cell | Button | | +----------+ +--------------------------------+ When I tap on the Button tableviewcell gets the events. What could be wrong? EDIT: I just checked, that UIButton is also getting touch events, but so is the UITableViewCell. And at then end of it the action associated with UIButton is not getting called.

    Read the article

  • How do I all the registered users on a day report

    - by Nadal
    I have a table called users where I have two columns: name and created_at. created_at column column is of type datetime and it stores the datetime when this user was created. I need to know the number of users created for a given date range. Let's say I ask give me user report between 1-nov-2010 and 30-nov-2010 . I need something like this 1-nov-2010: 2 2-nov-2010: 5 The problem I am running into is that created_at data has value upto second. How do I check if a created_at date falls within a given date. Any help in solving this problem is appreciated. I am using mysql5.

    Read the article

  • Inserting code to HTML view from a pop up initiated from visual view

    - by objectiveME
    I am trying to insert html into the HTML view.What i have done is to have tinymce advanced(a wordpress plugin) button that throws a popup and in it is all the necessary things to insert the html.The tinymce buttons are however only visible on the visual view. Question 1: Is it a plugin or hack that can allow one to parse html inside the visual view Question 2: Is it possible to insert html code to the html view from a popup initiated from the visual view

    Read the article

  • Pretty-print HTML via PHP without validation?

    - by brianjcohen
    I'd like to automatically pretty-print (indentation, mostly) the HTML output that my PHP scripts generate. I've been messing with Tidy, but have found that in its efforts to validate and clean my code, Tidy is changing way too much. I know Tidy's intentions are good but I'm really just looking for an HTML beautifier. Is there a simpler library out there that can run in PHP and just do the pretty-printing? Or, is there a way to configure Tidy to skip all the validation stuff and just beautify?

    Read the article

  • Retaining Managed objects - more general retaining objects

    - by Luuk D. Jansen
    A quick question regarding Managed Objects. I created an Array with Managed Objects (in Object 1: TableViewConbtroller), and pass one of those objects to another class/object (object 2: TableCell). The original array should still be retained in the original caller class. Then Object 2 is released, does that mean that that particular item in the array is released as well, as the reference to it in Object 2 was released? I am trying to better understand how to work with ManagedObjects as I get 'Object was released' errors. [EDIT] After some experimenting I came across the following scenario: I have the main AppDelegate. In a different class I create an AppDelegate to obtain the ManagedObjectContext. appDelegate = (iDomsAppDelegate *)[[UIApplication sharedApplication] delegate]; [self setContext:[appDelegate managedObjectContext]]; When the class is finished, and I release it, the variable in the class 'appDelegate' is also released. But then the ManagedObjectContext is closed, and obvious any future attempt to use it will cause a crash. So should I leave the appDelegate unreleased? This comes to the same question as the above about when and how to release in those situations where an objects is used from another class. I think a way of putting it is, how to know when you own an object and when not.

    Read the article

  • Return the Largest Span in a given Array -Core Java and Arrays Question

    - by Deepak
    Hi Stack People, Merry Christmas and hope you are in great Spirits,I have a Question in Java-Arrays as shown below.Im stuck up with this struggling to get it rite. Consider the leftmost and righmost appearances of some value in an array. We'll say that the "span" is the number of elements between the two inclusive. A single value has a span of 1. Write a **Java Function** that returns the largest span found in the given array. **Example: maxSpan({1, 2, 1, 1, 3}) ? 4,answer is 4 coz MaxSpan between 1 to 1 is 4 maxSpan({1, 4, 2, 1, 4, 1, 4}) ? 6,answer is 6 coz MaxSpan between 4 to 4 is 6 maxSpan({1, 4, 2, 1, 4, 4, 4}) ? 6,answer is 6 coz Maxspan between 4 to 4 is 6 which is greater than MaxSpan between 1 and 1 which is 4,Hence 64 answer is 6. I have the code which is not working,it includes all the Spans for a given element,im unable to find the MaxSpan for a given element. Please help me out. Results of the above Program are as shown below Expected This Run maxSpan({1, 2, 1, 1, 3}) ? 4 5 X maxSpan({1, 4, 2, 1, 4, 1, 4}) ? 6 8 X maxSpan({1, 4, 2, 1, 4, 4, 4}) ? 6 9 X maxSpan({3, 3, 3}) ? 3 5 X maxSpan({3, 9, 3}) ? 3 3 OK maxSpan({3, 9, 9}) ? 2 3 X maxSpan({3, 9}) ? 1 1 OK maxSpan({3, 3}) ? 2 3 X maxSpan({}) ? 0 1 X maxSpan({1}) ? 1 1 OK ::Code:: public int maxSpan(int[] nums) { int count=1;//keep an intial count of maxspan=1 int maxspan=0;//initialize maxspan=0 for(int i=0;i<nums.length;i++){ for(int j=i+1;j<nums.length;j++){ if(nums[i] == nums[j]){ //check to see if "i" index contents == "j" index contents count++; //increment count maxspan=count; //make maxspan as your final count int number = nums[i]; //number=actual number for maxspan } } } return maxspan+1; //return maxspan }

    Read the article

  • Help debugging Sendmail/Mailman configuration issue

    - by inxilpro
    Hi folks, I'm trying to configure a server with Sendmail and Mailman. I've been getting "Broken pipe" errors for a while, and have slowly been debugging. I fixed some permission issues, and changed the user that Mailman expects to be called from, among other things. Finally, I'd gone through everything I could think of, so I added a new test to see if it's the Mailman script or Sendmail that's causing the problem. Here's the error I'm getting now (stripped of timestamps and identifying information): <-- MAIL FROM:[email protected] Authentication-Warning: xxxxx.org: xxxxxxxxxxxxxx.net [xx.xx.xxx.xxx] didn't use HELO protocol --- 250 2.1.0 [email protected]... Sender ok <-- RCPT TO: [email protected] --- 250 2.1.5 [email protected]... Recipient ok <-- DATA --- 354 Enter mail, end with "." on a line by itself [email protected], size=20, class=0, nrcpts=1, msgid=<[email protected]>, proto=SMTP, relay=xxxxxxxxxxxxxx.net [xx.xx.xxx.xxx] --- 250 2.0.0 o6KMg2xZ025804 Message accepted for delivery alias [email protected] => "|/bin/echo foo" SYSERR(root): putbody: write error: Broken pipe 0: fl=0x0, mode=20660: CHR: dev=0/15, ino=776, nlink=1, u/gid=0/0, size=0 1: fl=0x1, mode=20660: CHR: dev=0/15, ino=776, nlink=1, u/gid=0/0, size=0 2: fl=0x1, mode=20660: CHR: dev=0/15, ino=776, nlink=1, u/gid=0/0, size=0 3: fl=0x2, mode=140777: SOCK localhost->[[UNIX: /dev/log]] 5: fl=0x0, mode=100600: dev=8/3, ino=486765, nlink=1, u/gid=0/51, size=5 6: fl=0x8000, mode=100640: dev=8/3, ino=65501, nlink=1, u/gid=0/0, size=12288 7: fl=0x8000, mode=100640: dev=8/3, ino=65501, nlink=1, u/gid=0/0, size=12288 8: fl=0x8000, mode=100640: dev=8/3, ino=65510, nlink=1, u/gid=0/0, size=12288 9: fl=0x8000, mode=100640: dev=8/3, ino=65510, nlink=1, u/gid=0/0, size=12288 10: fl=0x8000, mode=100640: dev=8/3, ino=64814, nlink=1, u/gid=0/51, size=12288 11: fl=0x8000, mode=100640: dev=8/3, ino=64814, nlink=1, u/gid=0/51, size=12288 12: fl=0x1, mode=100600: dev=8/3, ino=486767, nlink=1, u/gid=0/51, size=754 13: fl=0x1, mode=10600: FIFO: dev=0/5, ino=7649785, nlink=1, u/gid=0/51, size=0 14: fl=0x0, mode=10600: FIFO: dev=0/5, ino=7649786, nlink=1, u/gid=0/51, size=0 MCI@0x0: NULL MCI@0x0: NULL to="|/bin/echo foo", [email protected] (8/0), delay=00:00:08, xdelay=00:00:00, mailer=prog, pri=30476, dsn=5.0.0, stat=Service unavailable o6KMsnxX025948: DSN: Service unavailable done; delay=00:00:08, ntries=1 The alias in /etc/aliases is: cmtest: "|/bin/echo foo" As you can see, even when trying to pipe to /bin/echo I still get the same error. But I can't for the life of me figure out what else to check. Normal aliases work fine. Any ideas? Thanks!

    Read the article

  • What are performance limits of a database?

    - by Tommy
    What are some rough performance limits (read/s, write/s) for a single database server (no master-slave architecture), assuming storage on disk? How many read/s, write/s, depending on the kind of disk? (SSD vs non-SSD) , assuming simple operations (select one row by primary key, update one row, correctly indexed). I assume this limit is dependent on disk seek/write. EDIT: My question is more about getting rough metrics of the number of operations a database supports: to be able to know for example, if a new feature triggering 300 inserts/s can be supported without scaling out with additional servers.

    Read the article

  • FreeNAS: Can't access shares on a windows 7

    - by rzlines
    I have just setup a FreeNAS server. I have formatted and added a second hard drive. And mounted the data partition of the first hard drive. I have enabled CIFS and added both the hard drives to the shares. My workgroup is default WORKGROUP, I can see other computers on my network. I can access freenas through my browser that's how I configured it. Got one more question do I need to mount my second drive, if I do what partition number do I put, as it keeps giving me the error of using the wrong partition. Also my second drive doesn't show up on the home page as available as I can only see my first drive's space there.

    Read the article

  • How to prevent Mac OS X creating .DS_Store files on non Mac (HFS) Volumes?

    - by sudo petruza
    Is there a way to prevent Mac OS X creating .DS_Store and other hidden meta-files on foreign volumes like NTFS and FAT? I share an NTFS partition with data like Thunderird & Firefox's profiles and apache's DocumentRoot, between Mac OS X and Windows, which is very handy. I don't mind if Mac OS X is not capable of indexing or otherwise doing the neat things those metafiles are for. Note: It's not shared over a network, both operating systems and the shared partition coexist on the same disk, on the same machine.

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25  | Next Page >