Search Results

Search found 4473 results on 179 pages for 'mark fish'.

Page 88/179 | < Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >

  • Why does the order of the loops affect performance when iterating over a 2D array? [closed]

    - by Mark
    Possible Duplicate: Which of these two for loops is more efficient in terms of time and cache performance Below are two programs that are almost identical except that I switched the i and j variables around. They both run in different amounts of time. Could someone explain why this happens? Version 1 #include <stdio.h> #include <stdlib.h> main () { int i,j; static int x[4000][4000]; for (i = 0; i < 4000; i++) { for (j = 0; j < 4000; j++) { x[j][i] = i + j; } } } Version 2 #include <stdio.h> #include <stdlib.h> main () { int i,j; static int x[4000][4000]; for (j = 0; j < 4000; j++) { for (i = 0; i < 4000; i++) { x[j][i] = i + j; } } }

    Read the article

  • onPerformSync() is not triggered after ContentResolver.requestSync() call

    - by mark
    I am trying to implement sync adaptor, I have followed This guide. But onPerformSync() is not triggered after ContentResolver.requestSync() call . I have also tried some other tutorials and tried to run their code, but still same issue. Please tell me does I need to do some extra configuration for this. My code of triggering sync operation is as folows : Account newAccount = new Account(GlobalInfo.ACCOUNT, GlobalInfo.ACCOUNT_TYPE); AccountManager accountManager = (AccountManager) this.getSystemService(ACCOUNT_SERVICE); accountManager.addAccountExplicitly(newAccount, null, null); ContentResolver.requestSync(newAccount,GlobalInfo.AUTHORITY, Bundle.EMPTY); Please guide me to solve this issue. EDIT : Accounted created (in Settings - Accounts and Sync settings) by above code showing sync is off

    Read the article

  • How do I "think in AngularJS" if I have a jQuery background?

    - by Mark Rajcok
    How do I “think in AngularJS” if I have a jQuery background? Suppose I'm familiar with developing client-side applications in jQuery, but now I'd like to start using AngularJS. Can you describe the paradigm shift that is necessary? Here are a few questions that might help you frame an answer: How do I architect and design client-side web applications differently? What is the biggest difference? What should I stop doing/using; what should I start doing/using instead? Are there any server-side considerations/restrictions? I'm not looking for a detailed comparison between jQuery and AngularJS.

    Read the article

  • JQuery validation based on class?

    - by Mark Kadlec
    I have a form that will have dynamically created elements, one of those will be of date type. There can also be many fields of this type on my form, all which must be validated. I am using a strongly typed view in Asp MVC, so the name will change based on various factors. What I would like to do is validate based on a class name instead, since that will be constant for that type of field. Ie: <%= Html.TextBox("questionAnswers[" + index + "].AnswerValue", qa.AnswerValue, new { @class = "DateTypeClass" })%> So then I would need JQuery validation based on the classname DateTypeClass versus the Name. Any ideas?

    Read the article

  • Div smart width

    - by Mark
    see fiddle html <div class="e" style="left:5px;top:5px;">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbbbbbbbb</div> <div class="e" style="left:5px;top:100px;">aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa</div>? css .e { font-size: 10px; font-family: arial; background-color: yellow; position: absolute; max-width: 300px; } you will notice the 2nd div fits the size of the content exactly, but on the first div there's a bunch of empty space to the right of the a's and b's. This is because the div hit its max width of 300px and then wrapped the b's to a 2nd line. The wrapping is good, but then I would expect the div to then shrink back down to the width of the a's so that there's no empty space to the right. Is it possible to get it to do this? Tested in Chrome and FF.

    Read the article

  • php values of one array to key of another array

    - by mark
    I have 2 arrays $arr1 = Array ( [0] => 12 [1] => 4 [2] => 8 [3] => xx [4] => 1 [5] => 1year [6] => 7 ) $arr2 = Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 ) I want to create a new array with the values of a2 as keys in $arr1. My resultant array should be like this $arr3 = Array ( [1] => 12 [2] => 4 [3] => 8 [4] => xx [5] => 1 [6] => 1year [7] => 7 )

    Read the article

  • Python: Parsing a colon delimited file with various counts of fields

    - by Mark
    I'm trying to parse a a few files with the following format in 'clientname'.txt hostname:comp1 time: Fri Jan 28 20:00:02 GMT 2011 ip:xxx.xxx.xx.xx fs:good:45 memory:bad:78 swap:good:34 Mail:good Each section is delimited by a : but where lines 0,2,6 have 2 fields... lines 1,3-5 have 3 or more fields. (A big issue I've had trouble with is the time: line, since 20:00:02 is really a time and not 3 separate fields. I have several files like this that I need to parse. There are many more lines in some of these files with multiple fields. ... for i in clients: if os.path.isfile(rpt_path + i + rpt_ext): # if the rpt exists then do this rpt = rpt_path + i + rpt_ext l_count = 0 for line in open(rpt, "r"): s_line = line.rstrip() part = s_line.split(':') print part l_count = l_count + 1 else: # else break break First I'm checking if the file exists first, if it does then open the file and parse it (eventually) As of now I'm just printing the output (print part) to make sure it's parsing right. Honestly, the only trouble I'm having at this point is the time: field. How can I treat that line specifically different than all the others? The time field is ALWAYS the 2nd line in all of my report files.

    Read the article

  • Find multiple patterns with a single preg_match_all in PHP

    - by Mark
    Using PHP and preg_match_all I'm trying to get all the HTML content between the following tags (and the tags also): <p>paragraph text</p> don't take this <ul><li>item 1</li><li>item 2</li></ul> don't take this <table><tr><td>table content</td></tr></table> I can get one of them just fine: preg_match_all("(<p>(.*)</p>)siU", $content, $matches, PREG_SET_ORDER); Is there a way to get all the <p></p> <ul></ul> <table></table> content with a single preg_match_all? I need them to come out in the order they were found so I can echo the content and it will make sense. So if I did a preg_match_all on the above content then iterated through the $matches array it would echo: <p>paragraph text</p> <ul><li>item 1</li><li>item 2</li></ul> <table><tr><td>table content</td></tr></table>

    Read the article

  • How to pass in password to pg_dump?

    - by Mark
    I'm trying to create a cronjob to back up my database every night before something catastrophic happens. It looks like this command should meet my needs: pg_dump dbname | gzip > $(date +%Y-%m-%d).psql.gz Except after running that, it expects me to type in a password. I can't do that if I run it from cron. How can I pass one in automatically?

    Read the article

  • quick java question

    - by mark
    hi, im currently learning stacks in java and have a quick question. what will the following code display if the stack is empty? my guess would be "true"? System.out.println(st.isEmpty());

    Read the article

  • Birthday effect - clarification needed plz.

    - by Mark
    Please help interpret the Birthday effect as described in Wikipedia: A birthday attack works as follows: 1) Pick any message m and compute h(m). 2) Update list L. Check if h(m) is in the list L. 3) if (h(m),m) is already in L, a colliding message pair has been found. else save the pair (h(m),m) in the list L and go back to step 1. From the birthday paradox we know that we can expect to find a matching entry, after performing about 2^(n/2) hash evaluations. Does the above mean 2^(n/2) iterations through the above entire loop (i.e. 2^(n/2) returns to step 1), OR does it mean 2^(n/2) comparisons to individual items already in L.

    Read the article

  • How to display two QuerySets in one table?

    - by Mark
    I have two different QuerySets which both return a list of Users (with different fields). How can I display them both in one HTML table? One Query will always be a subset of the other; I just want to fill in the missing data with 0s. How can I do this?

    Read the article

  • Order a foreach, by the value of a calculation of values in the array

    - by Mark
    I have an array as follows: $players = array( $player = array( 'name' => 'playername', 'speed' => '10', 'agility' => '10', 'influence' => '10' ) etc Then I calculate a $score, based on the sum of speed, agility and influence. $score = $p['speed'] + $p['agility'] + $p['influence']; How can I loop through my array, but order the results from highest to lowest $score? PS- http://pastebin.com/eUEQ5y4u

    Read the article

  • R programming function without ()

    - by Mark Kennedy
    So, I Have the following very simple map.r file. I'm trying to have the user type "click" in interactive mode and then have the function . Since it's a function, the user has to type "click()" how can I make it so that they only have to the word (w/o parentheses), and then have that function do something with the img. So the user types: mydist("image.pnm") click //And then the function click does what it's supposed to mydist <- function(mapfile) { img <- read.pnm(mapfile) plot(img) } click <- function() { //Prompt user to click on img }

    Read the article

  • Best method for creating absolute path in PHP? (See 3 methods listed inside)

    - by mark
    I can create paths with no problem, but I want to know which of these 3 methods is the most rock solid and reliable and will work on the most servers. Right now I am using method 1 in my script and some users are having path issues. I just want the method that will work on any version of php and almost any server config. 1. <?php echo $_SERVER['DOCUMENT_ROOT']; ?> 2. <?php echo getcwd(); ?> 3. <?php echo dirname(__FILE__); ?> Thank you so much for any expertise you can provide about this!

    Read the article

  • Can someone please clarify the Birthday Effect for me?

    - by Mark
    Please help interpret the Birthday effect as described in Wikipedia: A birthday attack works as follows: Pick any message m and compute h(m). Update list L. Check if h(m) is in the list L. if (h(m),m) is already in L, a colliding message pair has been found. else save the pair (h(m),m) in the list L and go back to step 1. From the birthday paradox we know that we can expect to find a matching entry, after performing about 2^(n/2) hash evaluations. Does the above mean 2^(n/2) iterations through the above entire loop (i.e. 2^(n/2) returns to step 1), OR does it mean 2^(n/2) comparisons to individual items already in L.

    Read the article

  • Avoiding instanceof in Java

    - by Mark Lutton
    Having a chain of "instanceof" operations is considered a "code smell". The standard answer is "use polymorphism". How would I do it in this case? There are a number of subclasses of a base class; none of them are under my control. An analogous situation would be with the Java classes Integer, Double, BigDecimal etc. if (obj instanceof Integer) {NumberStuff.handle((Integer)obj);} else if (obj instanceof BigDecimal) {BigDecimalStuff.handle((BigDecimal)obj);} else if (obj instanceof Double) {DoubleStuff.handle((Double)obj);} I do have control over NumberStuff and so on. I don't want to use many lines of code where a few lines would do. (Sometimes I make a HashMap mapping Integer.class to an instance of IntegerStuff, BigDecimal.class to an instance of BigDecimalStuff etc. But today I want something simpler.) I'd like something as simple as this: public static handle(Integer num) { ... } public static handle(BigDecimal num) { ... } But Java just doesn't work that way. I'd like to use static methods when formatting. The things I'm formatting are composite, where a Thing1 can contain an array Thing2s and a Thing2 can contain an array of Thing1s. I had a problem when I implemented my formatters like this: class Thing1Formatter { private static Thing2Formatter thing2Formatter = new Thing2Formatter(); public format(Thing thing) { thing2Formatter.format(thing.innerThing2); } } class Thing2Formatter { private static Thing1Formatter thing1Formatter = new Thing1Formatter(); public format(Thing2 thing) { thing1Formatter.format(thing.innerThing1); } } Yes, I know the HashMap and a bit more code can fix that too. But the "instanceof" seems so readable and maintainable by comparison. Is there anything simple but not smelly?

    Read the article

  • Getting screen height before first display?

    - by Mark
    Hi, I have a ListView. I populate it with 8 items, that's all that fits vertically on the G1. Some of my users are saying the Droid has a taller screen height, and so I can probably add one or two more items to the ListView to take up the additional space provided. How could I measure the available height the screen offers at startup, before the UI is displayed? If I see the height can fit more than 8 items, I'd like to add one or two more rows, Thanks

    Read the article

  • Can you /should you learn SEO techniques

    - by Mark
    I know very little about Search engine optimization however from discussions with other I am now unsure where to start. Are there any books or do these date so quickly that they are obsolete? Do all website give you mis-information or are there any reliable sources? Is it just a case of trial and error and in turn experience? Is it event worth learning the techniques as search engines change their algorithms so regularly? I wonder if it just better to spend the time to ensure you have a regularly updated will written web site with quality content, site map, quality links etc..

    Read the article

< Previous Page | 84 85 86 87 88 89 90 91 92 93 94 95  | Next Page >