Daily Archives

Articles indexed Tuesday June 15 2010

Page 8/118 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How can I stop cURL from outputting the contents of the page it loads into the browser?

    - by Rob
    I currently use curl_multi_* to connect to a few sites. Its only sending a few $_GET variables to start a script, but it outputs the html from the sites to the browser. I want to stop this. I already use a short timeout, but sometimes the scripts start fast, and I don't want to set the timeout any lower, in case it causes it not to connect. So how can I stop the output to the browser from cURL?

    Read the article

  • DrawRect on the iPhone vs. the Mac

    - by Joe Cannatti
    I am an experienced iPhone dev beginning to work on my first Mac app. One thing that is really throwing me off is the differences between UIView and NSView. It seems that I cannot set the background color of a NSView via interface builder as I can with a UIView. It also seems that I cannot do it by simply sending a setBackgroundColor: message to it. All the examples I have seen are overriding drawRect: in a subclass of NSView. Is that really the only way to do it? What is the conceptual difference here, and why is it this way? NOTE: I am only trying to set the background color to the default grey.

    Read the article

  • NSButton blue highlight

    - by Remizorrr
    Hi. i want to make on/off gradient NSButton but with blue highlight like NSTabView select buttons. Is it possible to make this easy way? Or i should draw this manually? if i should draw this manually what is the best way to do this? (CIFilter or just NSGradient) thanks.

    Read the article

  • How can I get all the checked items from a submitted form with sinatra's params?

    - by 102405176597896213397
    I'm running Sinatra 1.0 with HAML, my form has a number of checkboxes, for example books I like, and you would select all the books you want. The checkbox name is "books". In sinatra params['books'] there should be an array of all the books that were checked, but it only has the last item that was checked, not an array. How can I get all the checked items? HAML: %form{:action => "/test", :method => 'post'} %input{:name=>'check',:type=>'checkbox',:value=>'item1'} item 1 %input{:name=>'check',:type=>'checkbox',:value=>'item2'} item 2 %input{:name=>'check',:type=>'checkbox',:value=>'item3'} item 3 %input{:type => "submit", :value => "send", :class => "button"} Sinatra get method post '/test' do puts params['check'] #should be an array but is last item checked end

    Read the article

  • fgets in c doesn't return a portion of an string

    - by Marc
    Hi! I'm totally new in C, and I'm trying to do a little application that searches a string into a file, my problem is that I need to open a big file (more than 1GB) with just one line inside and fgets return me the entire file (I'm doing test with a 10KB file). actually this is my code: #include <stdio.h> #include <string.h> int main(int argc, char *argv[]) { char *search = argv[argc-1]; int retro = strlen(search); int pun = 0; int sortida; int limit = 10; char ara[20]; FILE *fp; if ((fp = fopen ("SEARCHFILE", "r")) == NULL){ sortida = -1; exit (1); } while(!feof(fp)){ if (fgets(ara, 20, fp) == NULL){ break; } //this must be a 20 bytes line, but it gets the entyre 10Kb file printf("%s",ara); } sortida = 1; if(fclose(fp) != 0){ sortida = -2; exit (1); } return 0; } What can I do to find an string into a file? I'v tried with GREP but it don't helps, because it returns the position:ENTIRE_STRING. I'm open to ideas. Thanks in advance!

    Read the article

  • Want to save data field from form into two columns of two models.

    - by vette982
    I have a Profile model with a hasOne relationship to a Detail model. I have a registration form that saves data into both model's tables, but I want the username field from the profile model to be copied over to the usernamefield in the details model so that each has the same username. function new_account() { if(!empty($this->data)) { $this->Profile->modified = date("Y-m-d H:i:s"); if($this->Profile->save($this->data)) { $this->data['Detail']['profile_id'] = $this->Profile->id; $this->data['Detail']['username'] = $this->Profile->username; $this->Profile->Detail->save($this->data); $this->Session->setFlash('Your registration was successful.'); $this->redirect(array('action'=>'index')); } } } This code in my Profile controller gives me the error: Undefined property: Profile::$username Any ideas?

    Read the article

  • Bad Sectors on Hard Drive

    - by RHPT
    I run check disk pretty regularly on my hard drive, and lately it's been saying that I have some bad sectores (66, to be exact). I've run smartctl and HD Tune. Both tell me that I have bad sectors and the drive is in "pre-fail" stage. The drive is only a couple of years old. How worried should I be? My drive is a FUJITSU MHW2160BJ FFS G2

    Read the article

  • WPF + visual studio 2010 premium - frequent crashes.

    - by Sonic Soul
    using it on 3 different machines, and only my work machine experiences these crashes.. it is running: win 7 Enterprise xeon X5355 2.66Ghz, 2660 Mhz, 4Core, 4Logical 8 gig ram (available phys memory: 3.52 gb) nvidia quardo nvs 285, nvdidia quadro nvs 290 4 monitors visual studio 2010 premium 4.0.30319 RTMRel the crashes usually just make me restart vs, however, on some occasions they freeze the machine completely and require hard boot. not seeing much in event viewer looking for some troubleshooting ideas to narrow this down..

    Read the article

  • symlink and sudo executable

    - by CodeMedic
    If I have the below sudoers entry usera ALL=(userb) NOPASSWD: /home/userc/bin/executable-file usera ALL=(userb) NOPASSWD: /home/userc/bin/link-to-another-executable-file When I log-on as usera and try running the below commands, it works sudo -u userb /home/userc/bin/executable-file but NOT the one below. sudo -u userb /home/userc/bin/link-to-another-executable-file Sorry, user usera is not allowed to execute '/home/userc/bin/link-to-another-executable-file' as userb on hostname. Any ideas?

    Read the article

  • Determining what files are considered open in Mac OSX

    - by Doug
    Hi all; Apologies if this has been discussed previously... I did a stack overflow and google search but probably didn't use the right keywords. Anyway, is there an easy way to determine what files are open on Mac OS X? I had an issue in which I could not unmount a firewire HD until I closed all running apps. Turns out keychain access had a reference to a file on the HD, but it begged the question: how to find out what files are open and what app (or apps) has the file open? Thanks in advance and again apologies if this has been covered previously. Doug.

    Read the article

  • NSThread vs. NSOperationQueue vs. ??? on the iPhone

    - by kubi
    Currently I'm using NSThread to cache images in another thread. [NSThread detachNewThreadSelector:@selector(cacheImage:) toTarget:self withObject:image]; Alternatively: [self performSelectorInBackground:@selector(cacheImage:) withObject:image]; Alternatively, I can use an NSOperationQueue NSInvocationOperation *invOperation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(cacheImage:) object:image]; NSOperationQueue *opQueue = [[NSOperationQueue alloc] init]; [opQueue addOperation:invOperation]; Is there any reason to switch away from NSThread? GCD is a 4th option when it's released for the iPhone, but unless there's a significant performance gain, I'd rather stick with methods that work in most platforms.

    Read the article

  • How do I get User.message_set messages to show up for the built in test client?

    - by Conley Owens
    I'm aware that the old Django messages framework is deprecated, but I still would like to know the answer to this. When I go to a certain url to my broswer, a message is created, I am redirected to a different page, and I see the message correctly displayed by my template. When the test client goes to the same url, the message is created, it gets a redirect, and after following the redirect there are no messages. However, no messages appear in the response (the response gotten from following the redirect). Why not?

    Read the article

  • structDelete doesn't effect the shallow copy?

    - by Travis
    I was playing around onError so I tried to create an error using a large xml document object. <cfset variables.XMLByRef = variables.parsedXML.XMLRootElement.XMLChildElement> <cfset structDelete(variables.parsedXML, "XMLRootElement")> <cfset variables.startXMLShortLoop = getTickCount()> <cfloop from = "1" to = "#arrayLen(variables.XMLByRef)#" index = "variables.i"> <cfoutput>#variables.XMLByRef[variables.i].id.xmltext#</cfoutput><br /> </cfloop> <cfset variables.stopXMLShortLoop = getTickCount()> I expected to get an error because I deleted the structure I was referencing. From LiveDocs: Variable Assignment - Creates an additional reference, or alias, to the structure. Any change to the data using one variable name changes the structure that you access using the other variable name. This technique is useful when you want to add a local variable to another scope or otherwise change a variable's scope without deleting the variable from the original scope. instead I got 580df1de-3362-ca9b-b287-47795b6cdc17 25a00498-0f68-6f04-a981-56853c0844ed ... ... ... db49ed8a-0ba6-8644-124a-6d6ebda3aa52 57e57e28-e044-6119-afe2-aebffb549342 Looped 12805 times in 297 milliseconds <cfdump var = "#variables#"> Shows there's nothing in the structure, just parsedXML.xmlRoot.xmlName with the value of XMLRootElement. I also tried <cfset structDelete(variables.parsedXML.XMLRootElement, "XMLChildElement")> as well as structClear for both. More information on deleting from the xml document object. http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec22c24-78e3.html Can someone please explain my faulty logic? Thanks.

    Read the article

  • Proper way to build a data Repository

    - by rockinthesixstring
    I'm working on using the Repository methodology in my App and I have a very fundamental question. When I build my Model, I have a Data.dbml file and then I'm putting my Repositories in the same folder with it.... IE: Data.dbml IUserRepository.cs UserRepository.cs My question is simple. Is it better to build the folder structure like that above, or is it ok to simply put my Interface in with the UserRepository.cs? Data.dbml UserRepository.cs              which contains both the interface and the class

    Read the article

  • javascript replace commas with spaces from json array

    - by Alex
    I have a looping function creating: <li id="id1" name="Tag1,Tag2,Tag3"> <li id="id2" name="Tag1,Tag2,Tag3"> $.each(data.posts, function(i, post){ $('<li >', {id: this.id , name: post.tags}) }); How do I replace the commas between the tags with spaces. Also is there a way I can send the tags to a "class" attribute instead of "name". It seems to not work in Safari.

    Read the article

  • boost::bind breaks strict-aliasing rules?

    - by Kyle
    Using Boost 1.43 and GCC 4.4.3, the following code boost::bind(&SomeObject::memberFunc, this, _1)); Generates the following warning boost/function/function_base.hpp:321: warning: dereferencing type-punned pointer will break strict-aliasing rules What's the correct way to eliminate these warnings without setting -fno-strict-aliasing?

    Read the article

  • MYSQL JOIN WHERE ISSUES - need some kind of if condition

    - by Breezer
    Hi Well this will be hard to explain but ill do my best The thing is i have 4 tables all with a specific column to relate to eachother. 1 table with users(agent_users) , 1 with working hours(agent_pers), 1 with sold items(agent_stat),1 with project(agent_pro) the user and the project table is irrelevant in the issue at hand but to give you a better understanding why certain tables is included in my query i decided to still mention them =) The thing is that I use 2 pages to insert data to the working hour and the sold items during that time tables, then i have a third page to summarize everything for current month, the query for that is as following: SELECT *, SUM(sv_p_kom),SUM(sv_p_gick),SUM(sv_p_lunch) FROM (( agent_users LEFT JOIN agent_pers ON agent_users.sv_aid = agent_pers.sv_p_uid) LEFT JOIN agent_stat ON agent_pers.sv_p_uid = agent_stat.sv_s_uid) LEFT JOIN agent_pro ON agent_pers.sv_p_pid=agent_pro.p_id WHERE MONTH(agent_pers.sv_p_datum) =7 GROUP BY sv_aname so the problem is now that i dont want sold items from previous months to get included in the data received, i know i could solve that by simple adding in the WHERE part MONTH(agent_stat.sv_s_datum) =7 but then if no items been sold that month no data at all will show up not the time or anything. Any aid on how i could solve this is greatly appreciated. if there's something that's not so clear dont hesitate to ask and ill try my best to answer. after all my english isn't the best out there :P regards breezer

    Read the article

  • Configuring web.xml for webservices and servlet.

    - by Win Man
    Hi, I am new to Restlets. Trying to configure the web.xml (on JBoss). I have 2 entries, one for a servlet (got nothing to do with webservices) other for webservices, using Restlet. Here are the entries.. <servlet> <servlet-name>AuthenticationServlet</servlet-name> <servlet-class>com.safeid.web.server.api.servlet.AuthenticationServlet</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>AuthenticationServlet</servlet-name> <url-pattern>/authenticate/*</url-pattern> </servlet-mapping> <!-- Start of Entries for the REST Web Services. --> <context-param> <param-name>org.restlet.application</param-name> <param-value>com.safeid.web.server.SafeIDRouterApplication</param-value> </context-param> <servlet> <servlet-name>RestletServlet</servlet-name> <servlet-class>com.noelios.restlet.ext.servlet.ServerServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>RestletServlet</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> <!-- END of Entries for the REST Web Services.--> Both don't work together. In the above setup the Restlet works. However when I change the RestletServlet /* to something like <servlet-mapping> <servlet-name>RestletServlet</servlet-name> <url-pattern>/credential/*</url-pattern> </servlet-mapping> the Restlet stop working and the AuthenticationServlet works fine. What am I missing here?

    Read the article

  • Babel Django Off By 1 Cent

    - by Dave
    I ran into a problem today while using BabelDjango and thought I would ask if anyone has ran into anything similar. I was using the tags in my templates, {% load babel %} and then {{amount_owed|currencyfmt:"USD"}} which returned the amount_owed minus one-cent. I thought maybe the returned value was 9.949999 which should still be $9.95 but when I returned the raw value it returned "9.95". However when I formatted it using the babel tags the rsult was off by one-cent. My 9.95 returned "$9.94" Anyone have any advice where to look to troubleshoot this problem? Thanks in advance for your help.

    Read the article

  • Trigger events from Firefox browser extension?

    - by Alex
    Hello, I want to trigger events from a firefox extension, specifically click events. I've tried jQuery's .click() as well as the whole: var evt = document.createEvent("HTMLEvents"); evt.initEvent("click", true, false ); toClick[0].dispatchEvent(evt); This is not working for me, and I was wondering if this is even possible? (to trigger events from a firefox extension)? If so, how does one do it?

    Read the article

  • Managing resource closure in a servlet container

    - by Steven Schlansker
    I'm using Tomcat as a servlet container, and have many WARs deployed. Many of the WARs share common base classes, which are replicated in each context due to the different classloaders, etc. How can I ensure resource cleanup on context destruction, without hooking each and every web.xml file to add context listeners? Ideally, I'd like something along the lines of class MyResourceHolder implements SomeListenerInterface { private SomeResource resource; { SomeContextThingie.registerDestructionListener(this); } public void onDestroy() { resource.close(); } } I could put something in each web.xml, but since there are potentially many WARs and only ones that actually initialize the resource need to clean it up, it seems more natural to register for cleanup when the resource is initialized rather than duplicating a lot of XML configuration and then maybe cleaning up. (In this particular case, I'm initiating an orderly shutdown of a SQL connection pool. But I see this being useful in many other situations as well...) I'm sure there's some blisteringly obvious solution out there, but my Google-fu is failing me right now. Thanks!

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >