Search Results

Search found 13889 results on 556 pages for 'results'.

Page 162/556 | < Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >

  • Fortran severe (40) Error... Help?!

    - by Taka
    I can compile but when I run I get this error "forrtl: severe (40): recursive I/O operation, unit -1, file unknown" if I set n = 29 or more... Can anyone help with where I might have gone wrong? Thanks. PROGRAM SOLUTION IMPLICIT NONE ! Variable Declaration INTEGER :: i REAL :: dt DOUBLE PRECISION :: st(0:9) DOUBLE PRECISION :: stmean(0:9) DOUBLE PRECISION :: first_argument DOUBLE PRECISION :: second_argument DOUBLE PRECISION :: lci, uci, mean REAL :: exp1, n REAL :: r, segma ! Get inputs WRITE(*,*) 'Please enter number of trials: ' READ(*,*) n WRITE(*,*) dt=1.0 segma=0.2 r=0.1 ! For n Trials st(0)=35.0 stmean(0)=35.0 mean = stmean(0) PRINT *, 'For ', n ,' Trials' PRINT *,' 1 ',st(0) ! Calculate results DO i=0, n-2 first_argument = r-(1/2*(segma*segma))*dt exp1 = -(1/2)*(i*i) second_argument = segma*sqrt(dt)*((1/sqrt(2*3.1416))*exp(exp1)) st(i+1) = st(i) * exp(first_argument+second_argument) IF(st(i+1)<=20) THEN stmean(i+1) = 0.0 st(i+1) = st(i) else stmean(i+1) = st(i+1) ENDIF PRINT *,i+2,' ',stmean(i+1) mean = mean+stmean(i+1) END DO ! Output results uci = mean+(1.96*(segma/sqrt(n))) lci = mean-(1.96*(segma/sqrt(n))) PRINT *,'95% Confidence Interval for ', n, ' trials is between ', lci, ' and ', uci PRINT *,'' END PROGRAM SOLUTION

    Read the article

  • servlet connection to DB

    - by underW
    Initially, after reading books on the subject, I firmly believed that the algorithm for working with a database from a servlet is as follows: create a connection - connect to the database - form a request - send the request to the database - get the query results - process them - close connection - OK. Now, with a better understanding of the practical side, I realized that nobody does it that way, and everything happens through a connection pool according to the following algorithm: initialize the servlet - create a connection pool - a request comes from a user - take a free connection from the pool - form a request - send the request to the database - get the query results - process them - return the connection back to the pool - ok. Now I have this problem: We have 100 users, they are divided into 10 groups, each group has it's own username and password to connect to the database. Moreover, each group may have different rights to the database. How am I supposed to use a connection pool in this situation? If I understand correctly, a pool is nothing more than just a group of similar connections with a single login and password. And here I have 10 pairs of username / password. It looks like I cannot use the pool in this situation. What should I do?

    Read the article

  • Looping through covariates in regression using R

    - by Kyle Peyton
    I'm trying to run 96 regressions and save the results as 96 different objects. To complicate things, I want the subscript on one of the covariates in the model to also change 96 times. I've almost solved the problem but I've unfortunately hit a wall. The code so far is, for(i in 1:96){ assign(paste("z.out", i,sep=""), lm(rMonExp_EGM~ TE_i+ Month2+Month3+Month4+Month5+Month6+Month7+Month8+Month9+ Month10+Month11+Month12+Yrs_minus_2004 + as.factor(LGA),data=Pokies)) } This works on the object creation side (e.g. I have z.out1 - z.out96) but I can't seem to get the subscript on the covariate to change as well. I have 96 variables called TE_1, TE_2 ... TE_96 in the dataset. As such, the subscript on TE_, the "i" needs to change to correspond to each of the objects I create. That is, z.out1 should hold the results from this model: z.out1 <- lm(rMonExp_EGM~ TE_1 + Month2+Month3+Month4+Month5+Month6+Month7+Month8+Month9+ Month10+Month11+Month12+Yrs_minus_2004 + as.factor(LGA),data=Pokies) And z.out96 should be: z.out96 <- lm(rMonExp_EGM~ TE_96+ Month2+Month3+Month4+Month5+Month6+Month7+Month8+Month9+ Month10+Month11+Month12+Yrs_minus_2004 + as.factor(LGA),data=Pokies) Hopefully this makes sense. I'm grateful for any tips/advice. cheers, kyle

    Read the article

  • Ajax return string links not working

    - by Andreas Lympouras
    I have this ajax function: function getSearchResults(e) { var searchString = e.value; /*var x = e.keyCode; var searchString = String.fromCharCode(x);*/ if (searchString == "") { document.getElementById("results").innerHTML = ""; return; } var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp = new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("results").innerHTML = xmlhttp.responseText; } } xmlhttp.open("GET", "<%=Page.ResolveUrl("~/template/searchHelper.aspx?searchString=")%>"+searchString, true); xmlhttp.setRequestHeader("If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT"); //solve any AJAX caching problem(not refreshing) xmlhttp.send(); } and here is when I call it: <input class="text-input" value="SEARCH" id="searchbox" onkeyup="javascript:getSearchResults(this);" maxlength="50" runat="server" /> and all my links in the searchHelper.aspx file(which retruns them as a string) are like this: <a class="item" href='../src/actors.aspx?id=77&name=dasdassss&type=a' > <span class="item">dasdassss</span></a> When I click this link I want my website to go to ../src/actors.aspx?id=77&name=dasdassss&type=a but nothing happens. When I hover over the link, it also shows me where the link is about to redirect! any help?

    Read the article

  • What's the best way to access a MS Access database using PHP?

    - by Jack Roscoe
    Hi, I need to access some data from an MS Access database and retrieve some data from it using PHP. I've looked around the web, and found the following line which seems to correctly connect to the database: $conn->Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=C:\wamp\www\data\MYDB.mdb"); However, I have tried to retrieve some data in the following way: $query = "SELECT pageid FROM pages_table"; $result = mysqli_query($conn, $query); $amount_of_pages = 0; if(mysqli_num_rows($result) <= 0) echo "No results found."; else while($row = mysqli_fetch_array($result, MYSQL_ASSOC)) $amount_of_pages++; And was presented with the following errors: Warning: mysqli_query() expects parameter 1 to be mysqli, object given in C:\wamp\www\data\index.php on line 19 Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, null given in C:\wamp\www\data\index.php on line 23 No results found. I don't really understand the connection to the Access database, is there something I should be doing differently? Thanks in advance for any help.

    Read the article

  • iPhone and iPad : Doing a "select * from something" query in a SQLite database

    - by Abramodj
    Hi folks, i'm trying to use the SQLite data base in my iPad app, and here's my function to make a query: - (void)executeQuery:(char*)query { NSString *file = [self getWritableDBPath]; NSFileManager *fileManager = [NSFileManager defaultManager]; BOOL success = [fileManager fileExistsAtPath:file]; // If its not a local copy set it to the bundle copy if(!success) { //file = [[NSBundle mainBundle] pathForResource:DATABASE_TITLE ofType:@"db"]; [self createEditableCopyOfDatabaseIfNeeded]; } dataArray = NULL; dataArray = [NSMutableArray array]; sqlite3 *database = NULL; if (sqlite3_open([file UTF8String], &database) == SQLITE_OK) { sqlite3_exec(database, query, loadTimesCallback, dataArray, NULL); } sqlite3_close(database); [self logResults]; } if I call [self executeQuery:"select name from table1"]; everything is working fine. But if i call [self executeQuery:"select * from cars"]; the app crashes telling me that the NSMutableArray dataArray is not the right kind of variable where to set the query results. So, how can i do a "select * form table1" query, and store the results? Thanks! EDIT: Here's my loadTimesCallback method: static int loadTimesCallback(void *context, int count, char **values, char **columns) { NSMutableArray *times = (NSMutableArray *)context; for (int i=0; i < count; i++) { const char *nameCString = values[i]; [times addObject:[NSString stringWithUTF8String:nameCString]]; } return SQLITE_OK; }

    Read the article

  • twitter streaming api instead of search api

    - by user1711576
    I am using twitters search API to view all the tweets that use a particular hashtag I want to view. However, I want to use the stream function, so, I only get recent ones, and so, I can then store them. <?php global $total, $hashtag; $hashtag = $_POST['hash']; $total = 0; function getTweets($hash_tag, $page) { global $total, $hashtag; $url = 'http://search.twitter.com/search.json?q='.urlencode($hash_tag).'&'; $url .= 'page='.$page; $ch = curl_init($url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, TRUE); $json = curl_exec ($ch); curl_close ($ch); echo "<pre>"; $json_decode = json_decode($json); print_r($json_decode->results); $json_decode = json_decode($json); $total += count($json_decode->results); if($json_decode->next_page){ $temp = explode("&",$json_decode->next_page); $p = explode("=",$temp[0]); getTweets($hashtag,$p[1]); } } getTweets($hashtag,1); echo $total; ?> The above code is what I have been using to search for the tweets I want. What do I need to do to change it so I can stream the tweets instead? I know I would have to use the stream url https://api.twitter.com/1.1/search/tweets.json , but what do I need to change after that is where I don't know what to do. Obviously, I know I'll need to write the database sql but I want to just capture the stream first and view it. How would I do this? Is the code I have been using not any good for just capturing the stream?

    Read the article

  • EGODatabase does not retain inserted record

    - by user135775
    Hi Guy! I'm using EGODatabase to process my data. When I tried to insert data into the database which I created with Base and attached to the project, the data that was inserted programmatically will not show up when I restart my app.However the data inserted manually using Base will show up just fine. Following is the code for inserting data into the database: NSString *path = [[NSBundle mainBundle] pathForResource:@"Database" ofType:@"db"]; db = [EGODatabase databaseWithPath:path]; if ([db open]) { NSLog(@"Database is opened successfully!"); } else { NSLog(@"Database is failed to open!"); } NSArray *params = [NSArray arrayWithObjects:[aFeed feedID], [aFeed title], nil]; [db executeUpdate:@"Insert INTO Feed (FeedID, Title) VALUES (?, ?)" parameters:params]; EGODatabaseResult *results = [db executeQuery:@"SELECT * FROM Feed"]; for ( EGODatabaseRow * row in results) { NSLog(@"ID: %@ Title: %@", [row stringForColumn:@"FeedID"], [row stringForColumn:@"Title"]); } I appreciate if anyone can share me a working sample code for EGODatabase. I'm using EGODatabase because I might have multi-threading code that write to the database. Thank in advance.

    Read the article

  • SQL Standard Regarding Left Outer Join and Where Conditions

    - by Ryan
    I am getting different results based on a filter condition in a query based on where I place the filter condition. My questions are: Is there a technical difference between these queries? Is there anything in the SQL standard that explains the different resultsets in the queries? Given the simplified scenario: --Table: Parent Columns: ID, Name, Description --Table: Child Columns: ID, ParentID, Name, Description --Query 1 SELECT p.ID, p.Name, p.Description, c.ID, c.Name, c.Description FROM Parent p LEFT OUTER JOIN Child c ON (p.ID = c.ParentID) WHERE c.ID IS NULL OR c.Description = 'FilterCondition' --Query 2 SELECT p.ID, p.Name, p.Description, c.ID, c.Name, c.Description FROM Parent p LEFT OUTER JOIN Child c ON (p.ID = c.ParentID AND c.Description = 'FilterCondition') I assumed the queries would return the same resultsets and I was surprised when they didn't. I am using MS SQL2005 and in the actual queries, query 1 returned ~700 rows and query 2 returned ~1100 rows and I couldn't detect a pattern on which rows were returned and which rows were excluded. There were still many rows in query 1 with child rows with data and NULL data. I prefer the style of query 2 (and I think it is more optimal), but I thought the queries would return the same results.

    Read the article

  • How would i stop this foreach loop after 3 iterations?

    - by Tapha
    Here is the loop. foreach($results->results as $result){ echo '<div id="twitter_status">'; echo '<img src="'.$result->profile_image_url.'" class="twitter_image">'; $text_n = $result->text; echo "<div id='text_twit'>".$text_n."</div>"; echo '<div id="twitter_small">'; echo "<span id='link_user'".'<a href="http://www.twitter.com/'.$result->from_user.'">'.$result->from_user.'</a></span>'; $date = $result->created_at; $dateFormat = new DateIntervalFormat(); $time = strtotime($result->created_at); echo "<div class='time'>"; print sprintf('Submitted %s ago', $dateFormat->getInterval($time)); echo '</div>'; echo "</div>"; echo "</div>"; Thanks!!!! alot.

    Read the article

  • iFrame in a Content Editor Web Part

    - by Music Magi
    Hi - I'm creating a page with two web parts: one with a search UI and another that displays the results. I'm using Content Editor Web Parts for both, but no matter how hard I try I can't seem to display more than a fraction of the results page in the content editor web part with the iFrame. The width seems to set fine, but no matter how I set the height (I've tried in-line, using CSS and using Javascript/JQuery), I cannot change the height of what is displayed. If I make the height something ridiculous like 3000px, I can see the empty space below, but it still only shows a small amount of the resulting page at the top of this iframe section. I've observed the HTML and the iFrame takes up all the space it's supposed to, but only shows that small sliver of the actual page the iFrame is displaying. I've tried numerous approaches from numerous articles but have come up short (pun intended). Does anyone have any experience with this or have indication as to why it would display this way or what I have to do to make this iFrame fill up the entire web part space? Thanks in advance

    Read the article

  • Cordova polluted logs with persistent.js add()

    - by slaver113
    I am using the latest phonegap/cordova version 2.1. and my log in Eclipse logcat get polluted with code when i do var allItems = Item.all(); allItems.list(null, function (results) { results.forEach(function (r) { console.log(r.id+ " " + r.lat + " " + r.long + " " + r.state); }); }); I get a output like (for 100s of lines) 10-29 10:56:13.270: I/Web Console(5961): } function (value) { 10-29 10:56:13.270: I/Web Console(5961): if (value === undefined) { 10-29 10:56:13.270: I/Web Console(5961): return getterCallback(); 10-29 10:56:13.270: I/Web Console(5961): } else { 10-29 10:56:13.270: I/Web Console(5961): setterCallback(value); 10-29 10:56:13.270: I/Web Console(5961): return scope; 10-29 10:56:13.270: I/Web Console(5961): } 10-29 10:56:13.270: I/Web Console(5961): } function (value) { 10-29 10:56:13.270: I/Web Console(5961): if (value === undefined) { 10-29 10:56:13.270: I/Web Console(5961): return getterCallback(); 10-29 10:56:13.270: I/Web Console(5961): } else { 10-29 10:56:13.270: I/Web Console(5961): setterCallback(value); 10-29 10:56:13.270: I/Web Console(5961): return scope; 10-29 10:56:13.270: I/Web Console(5961): } 10-29 10:56:13.270: I/Web Console(5961): } function (value) { 10-29 10:56:13.270: I/Web Console(5961): if (value === undefined) { 10-29 10:56:13.270: I/Web Console(5961): return getterCallback(); 10-29 10:56:13.270: I/Web Console(5961): } else { 10-29 10:56:13.270: I/Web Console(5961): setterCallback(value); 10-29 10:56:13.270: I/Web Console(5961): return scope; 10-29 10:56:13.270: I/Web Console(5961): } 10-29 10:56:13.270: I/Web Console(5961): } at :1149822901

    Read the article

  • Having trouble with php and ajax search function

    - by Andy
    I am still quite new to php/ajax/mysql. In anycase, I'm creating a search function which is returning properly the data I'm looking for. In brief, I have a mysql database set up. A php website that has a search function. I'm now trying to add a link to a mysql database search rather than just showing the results. In my search.php, the echo line is working fine but the $string .= is not returning anything. I'm just trying to get the same as the echo but with the link to the mysql php record. Am I missing something simple? //echo $query; $result = mysqli_query($link, $query); $string = ''; if($result) { if(mysqli_affected_rows($link)!=0) { while($row = mysqli_fetch_array($result,MYSQLI_ASSOC)) { echo '<p> <b>'.$row['title'].'</b> '.$row['post_ID'].'</p>'; $string .= "<p><a href='set-detail.php?recordID=".$row->post_ID."'>".$row->title."</a></p>"; } } else { echo 'No Results for :"'.$_GET['keyword'].'"'; }

    Read the article

  • I can't seem to get my grand Total to calculate correctly

    - by Kenny
    When I run this query below, SELECT clientid, CASE WHEN D.ccode = '-1' Then 'Did Not Show' ELSE D.ccode End ccode, ca, ot, bw, cshT, dc, dte, approv FROM dbo.emC D WHERE year(dte) = year(getdate()) I get the correct results. It is correct result because ccode shows 'Did Not Show' when the value on the db is '-1' However, when I do a UNION ALL so I can get total for each column, I get the results but then 'Did Not Show' is no longer visible when valye for ccode is '-1'. There are over 1000 records with valuye of '-1'. Can someone please help? Here is the entire code with UNION. SELECT clientid, CASE WHEN D.ccode = '-1' Then 'Did Not Show' ELSE D.ccode End ccode, ca, ot, bw, cshT, dc, dte, approv FROM dbo.emC D WhERE year(dte) = year(getdate()) UNION ALL SELECT 'Total', '', SUM(D.ca), SUM(D.ot), SUM(D.bw), SUM(D.cshT), '', '', '' FROM emC D WHERE YEAR(dte)='2011' I also tried using ROLLUP but the real issue here is that I can't get the 'Did Not Show' text to display when ccode value is -1 ClientID CCODE ot ca bw cshT 019692 CF001 0.00 0.00 1.00 0.00 0.00 019692 CH503 0.00 0.00 1.00 0.00 0.00 010487 AC407 0.00 0.00 1.00 0.00 0.00 028108 CH540 0.00 0.00 1.00 0.00 0.00 028108 GS925 0.00 0.00 1.00 0.00 0.00 001038 AC428 0.00 0.00 3.00 0.00 0.00 028561 Did Not Show 0.00 0.00 0.00 0.00 0.00 016884 Did Not Show 0.00 0.00 0.00 0.00 0.00 05184 CF001 0.00 0.00 4.50 0.00 0.00

    Read the article

  • jQuery: responding to click event of element added to document after page load

    - by morpheous
    I am writing a page which uses a lot of in situ editing and updating using jQuery for AJAX. I have come accross a problem which can best be summarised by the workflow described below: Clicking on 'element1' on the page results in a jQuery AJAX POST Data is received in json format The data received in json format The received data is used to update an existing element 'results' in the page The received data is actual an HTML form I want jQuery to be responsible for POSTing the form when the form button is clicked The problem arises at point 6 above. I have code in my main page which looks like this: $(document).ready(function(){ $('img#inserted_form_btn').click(function(){ $.ajax({'type: 'POST', 'url': 'www.example.com', function($data){ $(data.id).html($data.frm); }), 'dataType': 'json'} }); }); However, the event is not being triggered. I think this is because when the document is first loaded, the img#inserted_form_btn element does not exist on the page (it is inserted into the DOM as the result of an element being clicked on the page (not shown in the code above - to keep the question short) My question therefore is: how can I get jQuery to be able to respond to events occuring in elements that were added to the DOM AFTER the page has loaded?

    Read the article

  • Need help with Django tutorial

    - by Nai
    I'm doing the Django tutorial here: http://docs.djangoproject.com/en/1.2/intro/tutorial03/ My TEMPLATE_DIRS in the settings.py looks like this: TEMPLATE_DIRS = ( "/webapp2/templates/" "/webapp2/templates/polls" # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) My urls.py looks like this: from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', (r'^polls/$', 'polls.views.index'), (r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'), (r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'), (r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'), (r'^admin/', include(admin.site.urls)), ) My views.py looks like this: from django.template import Context, loader from polls.models import Poll from django.http import HttpResponse def index(request): latest_poll_list = Poll.objects.all().order_by('-pub_date')[:5] t = loader.get_template('c:/webapp2/templates/polls/index.html') c = Context({ 'latest_poll_list': latest_poll_list, }) return HttpResponse(t.render(c)) I think I am getting the path of my template wrong because when I simplify the views.py code to something like this, I am able to load the page. from django.http import HttpResponse def index(request): return HttpResponse("Hello, world. You're at the poll index.") My index template file is located at C:/webapp2/templates/polls/index.html. What am I doing wrong?

    Read the article

  • Difference between two PHP times as years, months and days for PHP version 5.2

    - by Dominor Novus
    Forward: I've scanned through the existing questions/answers on this matter. This is not a duplicitous question; I cannot find a working solution from the accepted answers. The main questions/answers I've reviewed can be found here: How to calculate the difference between two dates using PHP? What I need: A calucalation of the difference between two dates expressed as years, months and days that works with PHP version: 5.2. <?php $current_date = date('d-M-Y'); $future_date = '2012-11-01'; ?> What I've tried: Most answers I find online don't seem to exact in that they don't factor in leap years. This highly rated answer won't work because DateTime-diff() is php 5.3+. This accepted answer results in (i.e. the second block of code aimed at PHP 5.2) results in the following being parsed: Array ( [y] = 25 [m] = 11 [d] = 7 [h] = 3 [i] = 15 [s] = 19 [invert] = 0 [days] = 9473 ) Array ( [y] = 25 [m] = 11 [d] = 7 [h] = 3 [i] = 15 [s] = 19 [invert] = 1 [days] = 9473 ) I can't tell if I've incorrectly applied the code or it's simply a case of me not knowing how to manipulate the array.

    Read the article

  • SQL code to display counts() of value retrieved from another column

    - by Doctor Trout
    I have three tables (these are the relevant columns): Table1 bookingid, person, role Table2 bookingid, projectid Table3 projectid, project, numberofrole1, numberofrole2 Table1.role can take two values: "role1" or "role2". What I want to do is to show which projects don't have the correct number of roles in Table1. The number of roles there there should be for each role is in Table3. For example, if Table1 contains these three rows: bookingid, person, role 7, Tim, role1 7, Bob, role1, 7, Charles, role2 and Table2 bookingid, projectid 7, 1 and Table3 projectid, project, numberofrole1, numberofrole2 1, Test1, 2, 2 I would like the results to show that there are not the correct number of role2s for project Test1. To be honest, something like this is a bit beyond my ability, so I'm open to suggestions on the best way to do this. I'm using sqlite and php (it's only a small project). I suppose I could do something with the php at the end once I've got my results, but I wondered if there was a better way to do it with sqlite. I started by doing something like this: SELECT project, COUNT(numberofrole1) as "Role" FROM Table1 JOIN Table2 USING (projectid) JOIN Table3 USING (bookingid) WHERE role="role1" GROUP BY project But I can't work out how to compare the value returned as "Role" with the value got from numberofrole1 Any help is gratefully received.

    Read the article

  • Using MPI_Type_Vector and MPI_Gather, in C.

    - by Goloneg
    Hi, I am trying to multiply square matrices in parallele with MPI. I use a MPI_Type_vector to send square submatrixes (arrays of float) to the processes, so they can calculate subproducts. Then, for the next iterations, these submatrices are send to neighbours processes as MPI_Type_contiguous (the whole submatrix is sent). This part is working as expected, and local results are corrects. Then, I use MPI_Gather with the contiguous types to send all local results back to the root process. The problem is, the final matrix is build (obviously, by this method) line by line instead of submatrix by submatrix. I wrote an ugly procedure rearranging the final matrix, but I would like to know if there is a direct way of performing the "inverse" operation of sending MPI_Type_vectors (i.e., sending an array of values and directly arranging it in a subarray form in the receiving array). An example, to try and clarify my long text : A[16] and B[16] are 4x4 matrices to be multiplied ; C[16] will contain the result ; 4 processes are used (Pi with i from 0 to 3) : Pi gets two 2x2 submatrices : subAi[4] and subBi[4] ; their product is stored locally in subCi[4]. For instance, P0 gets : subA0[4] containing A[0], A[1], A[4] and A[5] ; subB0[4] containing B[0], B[1], B[4] and B[5]. After everything is calculed, root process gathers all subCi[4]. Then C[16] contains : [ subC0[0], subC0[1], subC0[2], subC0[3], subC1[0], subC1[1], subC1[2], subC1[3], subC2[0], subC2[1], subC2[2], subC2[3], subC3[0], subC3[1], subC3[2], subC3[3]] and I would like it to be : [ subC0[0], subC0[1], subC1[0], subC1[1], subC0[2], subC0[3], subC1[2], subC1[3], subC2[0], subC2[1], subC3[0], subC3[1], subC2[2], subC2[3], subC3[2], subC3[3]] without further operation. Does someone know a way ? Thanks for your advices.

    Read the article

  • Peculiar JRE behaviour running RMI server under load, should I worry?

    - by darri
    I've been developing a minimalistic Java rich client CRUD application framework for the past few years, mostly as a hobby but also actively using it to write applications for my current employer. The framework provides database access to clients either via a local JDBC based connection or a lightweight RMI server. Last night I started a load testing application, which ran 100 headless clients, bombarding the server with requests, each client waiting only 1 - 2 seconds between running simple use cases, consisting of selecting records along with associated detail records from a simple e-store database (Chinook). This morning when I looked at the telemetry results from the server profiling session I noticed something which to me seemed strange (and made me keep the setup running for the remainder of the day), I don't really know what conclusions to draw from it. Here are the results: Memory GC activity Threads CPU load Interesting, right? So the question is, is this normal or erratic? Is this simply the JRE (1.6.0_03 on Windows XP) doing it's thing (perhaps related to the JRE configuration) or is my framework design somehow causing this? Running the server against MySQL as opposed to an embedded H2 database does not affect the pattern. I am leaving out the details of my server design, but I'll be happy to elaborate if this behaviour is deemed erratic.

    Read the article

  • Can a Java HashMap's size() be out of sync with its actual entries' size ?

    - by trix
    I have a Java HashMap called statusCountMap. Calling size() results in 30. But if I count the entries manually, it's 31 This is in one of my TestNG unit tests. These results below are from Eclipse's Display window (type code - highlight - hit Display Result of Evaluating Selected Text). statusCountMap.size() (int) 30 statusCountMap.keySet().size() (int) 30 statusCountMap.values().size() (int) 30 statusCountMap (java.util.HashMap) {40534-INACTIVE=2, 40526-INACTIVE=1, 40528-INACTIVE=1, 40492-INACTIVE=3, 40492-TOTAL=4, 40513-TOTAL=6, 40532-DRAFT=4, 40524-TOTAL=7, 40526-DRAFT=2, 40528-ACTIVE=1, 40524-DRAFT=2, 40515-ACTIVE=1, 40513-DRAFT=4, 40534-DRAFT=1, 40514-TOTAL=3, 40529-DRAFT=4, 40515-TOTAL=3, 40492-ACTIVE=1, 40528-TOTAL=4, 40514-DRAFT=2, 40526-TOTAL=3, 40524-INACTIVE=2, 40515-DRAFT=2, 40514-ACTIVE=1, 40534-TOTAL=3, 40513-ACTIVE=2, 40528-DRAFT=2, 40532-TOTAL=4, 40524-ACTIVE=3, 40529-ACTIVE=1, 40529-TOTAL=5} statusCountMap.entrySet().size() (int) 30 What gives ? Anyone has experienced this ? I'm pretty sure statusCountMap is not being modified at this point. There are 2 methods (lets call them methodA and methodB) that modify statusCountMap concurrently, by repeatedly calling incrementCountInMap. private void incrementCountInMap(Map map, Long id, String qualifier) { String key = id + "-" + qualifier; if (map.get(key) == null) { map.put(key, 0); } synchronized (map) { map.put(key, map.get(key).intValue() + 1); } } methodD is where I'm getting the issue. methodD has a TestNG @dependsOnMethods = { "methodA", "methodB" } so when methodD is executing, statusCountMap is pretty much static already. I'm mentioning this because it might be a bug in TestNG. I'm using Sun JDK 1.6.0_24. TestNG is testng-5.9-jdk15.jar Hmmm ... after rereading my post, could it be because of concurrent execution of outside-of-synchronized-block map.get(key) == null & map.put(key,0) that's causing this issue ?

    Read the article

  • Loading specific files from arbitrary directories?

    - by Haydn V. Harach
    I want to load foo.txt. foo.txt might exist in the data/bar/ directory, or it might exist in the data/New Folder/ directory. There might be a different foo.txt in both of these directories, in which case I would want to either load one and ignore the other according to some order that I've sorted the directories by (perhaps manually, perhaps by date of creation), or else load them both and combine the results somehow. The latter (combining the results of both/all foo.txt files) is circumstantial and beyond the scope of this question, but something I want to be able to do in the future. I'm using SDL and boost::filesystem. I want to keep my list of dependencies as small as possible, and as cross-platform as possible. I'm guessing that my best bet would be to get a list of every directory (within the data/ folder), sort/filter this list, then when I go to load foo.txt, I search for it in each potential directory? This sounds like it would be very inefficient, if I have dozens of potential directories to search through every time. What's the best way to go about accomplishing this? Bonus: What if I want some of the directories to be archives? ie. considering both data/foo/ and data/bar.zip to both be valid, and pull foobar.txt from either one without caring.

    Read the article

  • How can I pass an array resulting from a Perl method by reference?

    - by arareko
    Some XML::LibXML methods return arrays instead of references to arrays. Instead of doing this: $self->process_items($xml->findnodes('items/item')); I want to do something like: $self->process_items(\$xml->findnodes('items/item')); So that in process_items() I can dereference the original array instead of creating a copy: sub process_items { my ($self, $items) = @_; foreach my $item (@$items) { # do something... } } I can always store the results of findnodes() into an array and then pass the array reference to my own method, but let's say I want to try a reduced version of my code. Is that the correct syntax for passing the method results or should I use something different? Thanks! EDIT: Now suppose I want to change process_items() to process_item() so I can do stuff on a single element of the referenced array inside a loop. Something like: $self->process_item($_) for ([ $xml->findnodes('items/item') ]); This doesn't work as process_item() is executed only once because a single value is passed to the for loop (the reference to the array from findnodes()). What's the proper way of using $_ in this case?

    Read the article

  • help me to parse JSON value using JSONTouch

    - by EquinoX
    I have the following json: http://www.adityaherlambang.me/webservice.php?user=2&num=10&format=json I would like to get all the name in this data by the following code, but it gives an error. How can I fix it? NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; NSDictionary *results = [responseString JSONValue]; NSDictionary *users = [results objectForKey:@"users"] objectForKey:@"user"]; for (NSDictionary *user in users){ //NSLog(@"key:%@, value:%@", user, [user objectForKey:user]); NSString *title = [users objectForKey:@"NAME"]; NSLog(@"%@", title); } Error: 2011-01-29 00:18:50.386 NeighborMe[7763:207] -[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0xb618840 2011-01-29 00:18:50.388 NeighborMe[7763:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayM objectForKey:]: unrecognized selector sent to instance 0xb618840' *** Call stack at first throw: ( 0 CoreFoundation 0x027d9b99 __exceptionPreprocess + 185 1 libobjc.A.dylib 0x0292940e objc_exception_throw + 47 2 CoreFoundation 0x027db6ab -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 3 CoreFoundation 0x0274b2b6 ___forwarding___ + 966 4 CoreFoundation 0x0274ae72 _CF_forwarding_prep_0 + 50 5 NeighborMe 0x0000bd75 -[NeighborListViewController connectionDidFinishLoading:] + 226 6 Foundation 0x0007cb96 -[NSURLConnection(NSURLConnectionReallyInternal) sendDidFinishLoading] + 108 7 Foundation 0x0007caef _NSURLConnectionDidFinishLoading + 133 8 CFNetwork 0x02d8d72f _ZN19URLConnectionClient23_clientDidFinishLoadingEPNS_26ClientConnectionEventQueueE + 285 9 CFNetwork 0x02e58fcf _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 389 10 CFNetwork 0x02e5944b _ZN19URLConnectionClient26ClientConnectionEventQueue33processAllEventsAndConsumePayloadEP20XConnectionEventInfoI12XClientEvent18XClientEventParamsEl + 1537 11 CFNetwork 0x02d82968 _ZN19URLConnectionClient13processEventsEv + 100 12 CFNetwork 0x02d827e5 _ZN17MultiplexerSource7performEv + 251 13 CoreFoundation 0x027bafaf __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 14 CoreFoundation 0x0271939b __CFRunLoopDoSources0 + 571 15 CoreFoundation 0x02718896 __CFRunLoopRun + 470 16 CoreFoundation 0x02718350 CFRunLoopRunSpecific + 208 17 CoreFoundation 0x02718271 CFRunLoopRunInMode + 97 18 GraphicsServices 0x030b800c GSEventRunModal + 217 19 GraphicsServices 0x030b80d1 GSEventRun + 115 20 UIKit 0x002e9af2 UIApplicationMain + 1160 21 NeighborMe 0x00001c34 main + 102 22 NeighborMe 0x00001bc5 start + 53 23 ??? 0x00000001 0x0 + 1 ) terminate called after throwing an instance of 'NSException' I really just wanted to be able to iterate through the names

    Read the article

  • Creating a function to grab data from an Oracle database (array by ID)

    - by Nick
    I'm trying to create a function that will simply allow me to pass an SQL statement into it, and it will generate an array based on a unique ID I pass it: function oracleGetGata($query, $id="id") { global $conn; $sql = OCI_Parse($conn, $query); OCI_Execute($sql); OCI_Fetch_All($sql, $results, null, null, OCI_FETCHSTATEMENT_BY_ROW); return $results; }   For example I'd like this query $array = oracleGetData('select * from table') to return something like: [1] => Array ( [Title] => Title 1 [Description] => Description 1 ) [2] => Array ( [Title] => Title 2 [Description] => Description 2 ) [3] => Array ( [Title] => Title 3 [Description] => Description 3 )   Rather than what it's returning at the moment: [0] => Array ( [ID] => 3 [TITLE] => Title 3 [DESCRIPTION] => Description 3 ) [1] => Array ( [ID] => 1 [TITLE] => Title 1 [DESCRIPTION] => Description 1 ) [2] => Array ( [ID] => 2 [TITLE] => Title 2 [DESCRIPTION] => Description 2 )   I'd really appreciate any help with this, as the function would save me lots of time! Thank you.

    Read the article

< Previous Page | 158 159 160 161 162 163 164 165 166 167 168 169  | Next Page >