Search Results

Search found 2672 results on 107 pages for 'michael cereda'.

Page 74/107 | < Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >

  • I want to use contents of String or Array in an IF ELSE statement for iphone

    - by Michael Robinson
    I want to check to see if an array is empty to activate a shipping method. Here is the code for returning the array. NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *fullFileName = [NSString stringWithFormat:@"%@/arraySaveFile", documentsDirectory]; NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:fullFileName]; I want to write something like: if NSString *fullFileName ="" ; [nnNEP EnableShipping]; else [nnNEP DisableShipping]; OR if array contents ="" ; [nnNEP EnableShipping]; else [nnNEP DisableShipping]; I just can't find the right or description on how to do this properly. Thanks,

    Read the article

  • Crosstab with multiple items

    - by Michael Wexler
    In SPSS, it is (relatively) easy to create a cross tab with multiple variables using the factors as the table heading. So, something like the following (made up data, etc.). Q1, Q2, and Q3 each have either a 1, a 2, or a 3 for each person. 1 (very Often) 2 (Rarely) 3 (Never) Q1. Likes it 12 15 13 Q2. Recommends it 22 11 10 Q3. Used it 22 12 9 In SPSS, one can even request row, column, or total percentages. I've tried table(), ftable(), xtab(), CrossTable() from gmodels, and CrossTable() from descr, and none of these can handle (afaik) multiple variables; they mostly seem to handle 1 variable crossed with another variable, and the 3rd creates layers. Is there a package with some good cross tabbing/table examples that I could use to figure this out? I'm sure I'm missing something simple, so I appreciate you pointing out what I missed. Perhaps I have to generate each row as a separate list and then make a dataframe and print the dataframe?

    Read the article

  • Why do some people prefer "T const&" over "const T&"?

    - by Michael Aaron Safyan
    So, I realize that const T& and T const& are identical and both mean a reference to a const T. In both cases, the reference is also constant (references cannot be reassigned, unlike pointers). I've observed, in my somewhat limited experience, that most C++ programmers use const T&, but I have come across a few people who use T const&. Is this just a personal preference? Why is one chosen over the other?

    Read the article

  • php preg_replace, regexp

    - by Michael
    I'm trying to extract the postal codes from yell.com using php and preg_replace. I successfully extracted the postal code but only along with the address. Here is an example $URL = "http://www.yell.com/ucs/UcsSearchAction.do?scrambleSeed=17824062&keywords=shop&layout=&companyName=&location=London&searchType=advance&broaderLocation=&clarifyIndex=0&clarifyOptions=CLOTHES+SHOPS|CLOTHES+SHOPS+-+LADIES|&ooa=&M=&ssm=1&lCOption32=RES|CLOTHES+SHOPS+-+LADIES&bandedclarifyResults=1"; //get yell.com page in a string $htmlContent = $baseClass-getContent($URL); //get postal code along with the address $result2 = preg_match_all("/(.*)/", $htmlContent, $matches); print_r($matches); The above code ouputs something like Array ( [0] = Array ( [0] = 7, Royal Parade, Chislehurst, Kent BR7 6NR [1] = 55, Monmouth St, London, WC2H 9DG .... the problem that I have is that I don't know how to extract the the postal code because it doesn't have an exact number of digits (sometimes it has 6 digits and sometimes has only 5 times). Basically I should extract the lasted 2 words from each array . Thank you in advance for any help !

    Read the article

  • Should uni provide "correct answer" after programming assignment is due?

    - by Michael Mao
    Hi all: This is my very first subjective question. And I think it is programming related - the assignment is to be written in a programming language. I am not for "getting the full marks out of a subject". I am actually not for a "correct answer", but for a "better solution", so that I can compare, and can improve. I reckon it is good that I practice programming first and check the solution later to pick up the things I've done wrong/bad. Without a "benchmark" to against, this would be much harder. Unfortunately as far as I know, not all programming subjects taught in uni would kindly provide the students with a "correct answer" in the end, after the assignment is due. One bad metaphor for this is like someone asks you a question which they don't have a clear answer themselves and hope to take advantage of your answer as the basis for their answer. Personally, I feel having a assignment solution provided by the academic staff is essential to students. I do appreciate this, and I feel I might not be the only one. I am a very proactive student in uni. I learn more, I practice more, an assignment for me is more like a challenge to achieve "the best solution I can come up with", not something "I have to pass"... The cause of this question is that for the past few days I have crafted 500+ lines of Perl code, for a tiny assignment. I feel pain when I look at my solution(not finished yet) and I feel like I am an idiot doing some crap code. I know there must be a much better solution. And I reckon it is better for the lecturer in this subject to get me one, rather than asking for an answer here, even I would shamelessly add the link to my solution apart from the assignment requirements. I know in SO, there are a lot of tutors/lecturers for programming subjects/courses. I'd like to hear your words on this question.

    Read the article

  • Where is the taglib definition of PrimeFaces 4?

    - by Michael Wölm
    I am looking around how to define custom components in JSF. According to the Java EE tutorial, any custom component needs to be described in a taglib. When I take a look into the PrimeFaces source, I cannot find any taglib file or any hint where the namespace is bound and the available components are defined. I am adding primefaces jar to my dependencies, adding xmlns:p="http://primefaces.org/ui to the xml namespace, defining some primfaces components on my page and it works... Ok, but neither I can find the related taglib in the source or binary package nor my IDE (IntelliJ) is able to find where "xmlns:p="http://primefaces.org/ui" is pointing to. Therefore, code completion is also not possible. (all other mojarra taglibs are found.) Is it possible that PrimeFaces is defining the taglib via annotations directly in Java classes or is it generating it during runtime? I can easily find the UIComponents, primefaces defines in its source, but the configuration of the taglib seems to be missing. I am sure I just don't know how PrimeFaces is doing it, but the javaeetutorial is not describing any other opportunity than defining a ...-taglib.xml

    Read the article

  • Animation of UINavigationController's UIToolbar

    - by Michael Waterfall
    When presenting a view controller that has toolbar items, is it possible for the toolbar to slide in with the view controller (i.e. slide in from the right) as opposed to it sliding from the bottom? In the view controller that is being presented, I've got the toolbar being shown within the -viewWillAppear: method, but the toolbar is being slid up from the bottom of the screen as opposed to it looking like it belongs to the view controller. - (void)viewWillAppear:(BOOL)animated { [self.navigationController setToolbarHidden:NO animated:YES]; ... }

    Read the article

  • Using beautifulsoup to extract text between line breaks (e.g. <br /> tags)

    - by Michael Altman
    I have the following HTML that is within a larger document <br /> Important Text 1 <br /> <br /> Not Important Text <br /> Important Text 2 <br /> Important Text 3 <br /> <br /> Non Important Text <br /> Important Text 4 <br /> I'm currently using BeautifulSoup to obtain other elements within the HTML, but I have not been able to find a way to get the important lines of text between <br /> tags. I can isolate and navigate to each of the <br /> elements, but can't find a way to get the text in between. Any help would be greatly appreciated. Thanks.

    Read the article

  • jQuery Validation Custom Message Before Listing Errors

    - by Michael
    I am looking to add a custom message before listing my errors for a login page: "Oops, you forgot to enter the following:" + "Username", "Password" (if both not entered) or "Oops, you forgot to enter the following:" + "Username" (if just username not entered) $(document).ready(function(){ $("#loginForm").validate({ errorLabelContainer: $('#RegisterErrors'), messages: { username: "Username", password: "Password" } }); }); With this in my HTML <div id="RegisterErrors">

    Read the article

  • jQuery Validation - Highlighting Radio Labels

    - by Michael
    I'm trying to use jQuery validation to highlight the labels for my radio buttons only, and not the labels for my other inputs. I have a label for my radio button set called 'type'. I can't seem to get it to work! $(document).ready(function(){ $("#healthForm").validate({ highlight: function(element, errorClass) { $(element).addClass(errorClass) $(element.form).find("label[for='type']") .addClass("radioerror"); }, unhighlight: function(element, errorClass) { $(element).removeClass(errorClass) $(element.form).find("label[for='type']") .removeClass("radioerror"); }, errorPlacement: function(error, element) { } }); });

    Read the article

  • Capistrano + Git + DreamHost

    - by Michael Sync
    Hello, I'm trying to deploy my rails application by using Passenger and Capistrano on Dreamhost. I'm using Git as a version control and we bought an account from GitHub. I have installed all required gems, Passenger and Capistrano in my local machine and I have cloned the repository of my project from GitHub in my local machine as wel. According to Dreamhost support, they have Passenger, Ruby, Rails and etc on their server as well. I'm currently following this article http://github.com/guides/deploying-with-capistrano for my deployment. The following is my deploy.rb. default_run_options[:pty] = true ssh_options[:forward_agent] = true # be sure to change these set :user, 'gituser' set :domain, 'github.com' set :application, 'MyProjectOnGit' #[email protected]:MyProjectOnGit.git # the rest should be good set :repository, "[email protected]:MyProjectOnGit.git" set :deploy_to, "/ruby.michaelsync.net/" set :deploy_via, :remote_cache set :scm, 'git' set :branch, 'master' set :git_shallow_clone, 1 set :scm_verbose, true set :use_sudo, false set :git_enable_submodules, 1 server domain, :app, :web role :db, domain, :primary => true set :ssh_options, { :forward_agent => true } namespace :deploy do task :restart do run "touch #{current_path}/tmp/restart.txt" end end When I run "cap deploy", I'm getting the error below. [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: github.com (Net::SSH::AuthenticationFailed: gituser) connection failed for: github.com (Net::SSH::AuthenticationFailed: gituser) Thanks in advance..

    Read the article

  • How do I upload a files to google app engine app when field name is not known

    - by Michael Neale
    I have tried a few options, none of which seem to work (if I have a simple multipart form with a named field, it works well, but when I don't know the name I can't just grab all files in the request...). I have looked at http://stackoverflow.com/questions/81451/upload-files-in-google-app-engine and it doesn't seem suitable (or to actually work, as someone mentioned the code snipped it untested).

    Read the article

  • How make decides to build target

    - by Michael
    One sign is that target does not exist, understand this. Another is by comparing modification timestamp of target and prerequisites. How it works in more details? What is the logic of comparing target and prerequisite timestamps and how it works when there are multiple prerequisites?

    Read the article

  • Why does instanceof seem to work in a static generic function sometimes?

    - by michael
    Greetings. This is my first post in this site. I thought that because of type erasure, one could not expect the following code to compile, and indeed, it did not compile on an earlier version of Eclipse. My understanding was that instanceof was a run-time operator and could not know about the generic type which would be, by run-time, compiled away: public static <E extends Comparable<? super E>> void SampleForQuestion(E e) { if ( !(e instanceof String) ) System.out.println("I am not a String"); else System.out.println("I am a String"); } However, I was surprised to see that one of your threads actually included some code like this in an answer, and my latest Eclipse (Galileo on Windows with JVM 1.6 rev 20) is perfectly happy with it -- and it works, too. (I did notice that someone said it worked on Eclipse but not in another IDE/JDK in that thread, but don't remember the specifics.) Can someone explain why it works, and more importantly, because I have to guide my students, whether it should be expected to work in the future. Thank you. (I hope the code formatting comes through correctly - it looks indented correctly from my perspective and there are no tabs.)

    Read the article

  • CSS Hidden DIV Form Submit

    - by Michael
    Using CSS, when a link is clicked it brings up a hidden DIV that contains a form. The user will then enter information and then submit the form. I'd like the hidden DIV to remain visisble, and a 'success message' to be displayed after submission. Then the user will have the option of closing the DIV. I can't get it to work without reloading the page, which causes the DIV to become hidden again. Any ideas? <body> <a href="javascript:showDiv()" style="color: #fff;">Click Me</a> <!--POPUP--> <div id="hideshow" style="visibility:hidden;"> <div id="fade"></div> <div class="popup_block"> <div class="popup"> <a href="javascript:hideDiv()"> <img src="images/icon_close.png" class="cntrl" title="Close" /> </a> <h3>Remove Camper</h3> <form method="post" onsubmit="email.php"> <p><input name="Name" type="text" /></p> <p><input name="Submit" type="submit" value="submit" /></p> </form> <div id="status" style="display:none;">success</div> </div> </div> </div> <!--END POPUP--> <script language=javascript type='text/javascript'> function hideDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'hidden'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'hidden'; } else { // IE 4 document.all.hideshow.style.visibility = 'hidden'; } } } function showDiv() { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById('hideshow').style.visibility = 'visible'; } else { if (document.layers) { // Netscape 4 document.hideshow.visibility = 'visible'; } else { // IE 4 document.all.hideshow.style.visibility = 'visible'; } } } </script> </body>

    Read the article

  • Incorrect emacs indentation in a C++ class with DLL export specification

    - by Michael Daum
    I often write classes with a DLL export/import specification, but this seems to confuse emacs' syntax parser. I end up with something like: class myDllSpec Foo { public: Foo( void ); }; Notice that the "public:" access spec is indented incorrectly, as well as everything that follows it. When I ask emacs to describe the syntax at the beginning of the line containing public, I get a return of: ((label 352)) If I remove the myDllSpec, the indentation is correct, and emacs tells me that the syntax there is: ((inclass 352) (access-label 352)) Which seems correct and reasonable. So I conclude that the syntax parser is not able to handle the DLL export spec, and that this is what's causing my indentation trouble. Unfortunately, I don't know how to teach the parser about my labels. Seems that this is pretty common practice, so I'm hoping there's a way around it.

    Read the article

  • How can I move all my modification to a branch

    - by michael
    Hi, I create a working repository in HG. And I have modified some files. How can i move my all my modification to a branch (a branch that I have not created)? (kind of 'git stash' and the move the stash away change to a branch. Actually, I am not sure how I can do that in git either. If you know, I appreciate if you can tell me in git as well) Thank you.

    Read the article

  • MonoDevelop seems to hang (not unresponsive) when building csprojs

    - by Michael Shimmins
    Building a solution from Visual Studio in mono develop seems to have some issues. I'm hoping someone else has experienced this and has some suggestions. The actual dcms process goes pretty quickly, but in between projects it hangs after printing: Building: XXX.YYY.ZZZ (Debug) After a few minutes (been 10 so far on this current run), it jumps to: Performing main compilation... /Library/Frameworks/Mono.framework/Versions/2.10.1/bin/dmcs /noconfig "/... Build complete -- 0 errors, 0 warnings Building: XXX.YYY.ZZZ (Debug) Then hangs again for another few minutes. This is a sln file with 29 csproj projects in it that was originally created in Visual Studio 2010. I'm wondering if there is a better way to set this up - potentially a native MD file format?

    Read the article

  • ASP MVC dynamic fields in editor

    - by Michael Pardo
    I have a form which will include some optional questions that need to asked of the user. In my model it may look like pubic Dictionary<String, String> Questions { get; set; } where the key is the label and value is the text box. How can I create and populate controls for this? I'm new to ASP MVC, but it makes sense that something like this would be built in. Is there a built in way to do this, or do I have to implement it myself? It seems like there should be a helper for it, since you don't really want to put this kind of code in the view. I've tried Html.EditorFor(model => model.Questions); but it just spits out "[key, value]" to the view.

    Read the article

  • Improving HTML scrapper efficiency with pcntl_fork()

    - by Michael Pasqualone
    With the help from two previous questions, I now have a working HTML scrapper that feeds product information into a database. What I am now trying to do is improve efficiently by wrapping my brain around with getting my scrapper working with pcntl_fork. If I split my php5-cli script into 10 separate chunks, I improve total runtime by a large factor so I know I am not i/o or cpu bound but just limited by the linear nature of my scraping functions. Using code I've cobbled together from multiple sources, I have this working test: <?php libxml_use_internal_errors(true); ini_set('max_execution_time', 0); ini_set('max_input_time', 0); set_time_limit(0); $hrefArray = array("http://slashdot.org", "http://slashdot.org", "http://slashdot.org", "http://slashdot.org"); function doDomStuff($singleHref,$childPid) { $html = new DOMDocument(); $html->loadHtmlFile($singleHref); $xPath = new DOMXPath($html); $domQuery = '//div[@id="slogan"]/h2'; $domReturn = $xPath->query($domQuery); foreach($domReturn as $return) { $slogan = $return->nodeValue; echo "Child PID #" . $childPid . " says: " . $slogan . "\n"; } } $pids = array(); foreach ($hrefArray as $singleHref) { $pid = pcntl_fork(); if ($pid == -1) { die("Couldn't fork, error!"); } elseif ($pid > 0) { // We are the parent $pids[] = $pid; } else { // We are the child $childPid = posix_getpid(); doDomStuff($singleHref,$childPid); exit(0); } } foreach ($pids as $pid) { pcntl_waitpid($pid, $status); } // Clear the libxml buffer so it doesn't fill up libxml_clear_errors(); Which raises the following questions: 1) Given my hrefArray contains 4 urls - if the array was to contain say 1,000 product urls this code would spawn 1,000 child processes? If so, what is the best way to limit the amount of processes to say 10, and again 1,000 urls as an example split the child work load to 100 products per child (10 x 100). 2) I've learn that pcntl_fork creates a copy of the process and all variables, classes, etc. What I would like to do is replace my hrefArray variable with a DOMDocument query that builds the list of products to scrape, and then feeds them off to child processes to do the processing - so spreading the load across 10 child workers. My brain is telling I need to do something like the following (obviously this doesn't work, so don't run it): <?php libxml_use_internal_errors(true); ini_set('max_execution_time', 0); ini_set('max_input_time', 0); set_time_limit(0); $maxChildWorkers = 10; $html = new DOMDocument(); $html->loadHtmlFile('http://xxxx'); $xPath = new DOMXPath($html); $domQuery = '//div[@id=productDetail]/a'; $domReturn = $xPath->query($domQuery); $hrefsArray[] = $domReturn->getAttribute('href'); function doDomStuff($singleHref) { // Do stuff here with each product } // To figure out: Split href array into $maxChilderWorks # of workArray1, workArray2 ... workArray10. $pids = array(); foreach ($workArray(1,2,3 ... 10) as $singleHref) { $pid = pcntl_fork(); if ($pid == -1) { die("Couldn't fork, error!"); } elseif ($pid > 0) { // We are the parent $pids[] = $pid; } else { // We are the child $childPid = posix_getpid(); doDomStuff($singleHref); exit(0); } } foreach ($pids as $pid) { pcntl_waitpid($pid, $status); } // Clear the libxml buffer so it doesn't fill up libxml_clear_errors(); But what I can't figure out is how to build my hrefsArray[] in the master/parent process only and feed it off to the child process. Currently everything I've tried causes loops in the child processes. I.e. my hrefsArray gets built in the master, and in each subsequent child process. I am sure I am going about this all totally wrong, so would greatly appreciate just general nudge in the right direction.

    Read the article

  • How to set maxLines and ellipsesize of a TextView at the same time.

    - by michael
    I want to limit my text view to have maximum of 6 lines, so I did: <TextView android:id="@+id/toptext" android:layout_width="fill_parent" android:layout_height="wrap_content" android:maxLines="6"/> But when I try to configure it to add '...' when the text is truncated, I add android:ellipsize="end". I do see the ... but then my TextView only has a max line of 2, instead of 6. Can you please how can I make the text view of maximum line of 6 and add '...' when it get truncated? Thank you.

    Read the article

  • SEO for Computer Software Engineering Topics

    - by Michael Aaron Safyan
    I'm currently trying to SEO my development and coding search custom search engine as well my website that has a variety of coding and development resources. I would like to increase the number of links to my website, but I don't want to simply generate spam. What are some places that I should submit my website, where the content would be considered relevant rather than just spam? Thanks.

    Read the article

< Previous Page | 70 71 72 73 74 75 76 77 78 79 80 81  | Next Page >