Search Results

Search found 5817 results on 233 pages for 'multi threading'.

Page 55/233 | < Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >

  • multi-valued property query in GAE

    - by Tim
    class Person{ @Persistent private List tags = ArrayList() } I want to let the user query a person based on his/her tag, so I had my query filter like this: tags.contains(tagValue1) and if the user want to search for multiple tags, I would just add to the filter so if the user is searching for 3 tags, then the query would be tags.contains(tagValue1) && tags.contains(tagValue2) && tags.contains(tagValue3) I think this approach is wrong, because the datastore then needs to have an index that have the tags property three times... and if the user search for more than 3 tags at a time then it will be broken. What's the proper way to do this? Do you guys have any suggestions?

    Read the article

  • Lookups in Multi-Tenant Database

    - by Huthaifa Afanah
    I am developing a SaaS application and I am looking for the best way to design lookup tables, taking in consideration: The look-up tables will have predefined data shared among all the tenants Each tenant must have the ability to extend the look-up table with his own data e.g adding a car class not defined I am thinking about adding TenantID column to each lookup and add the predefined data with setting that column to some value which represents the "Super Tenant" that belongs to the system itself

    Read the article

  • .htaccess trickery multi-language website

    - by user1658741
    I have a website right now that uses two languages (french and english) The way it works right now is that if someone goes to mysite.com/folder/file.php for example, file.php is simply a script that figures out which language to use, get's it's own path and filename(file.php) and serves up mysite.com/en/folder/file.php (if the language is english). However what shows up in the URL is still mysite.com/folder/file.php. For any folder and any file the same script is used. If I want to add a new file I have to add the file to the folder the user types into the browser as well to the en and fr folders. Could I do some .htaccess trickery so that whatever URL is typed, one .php file gets open that checks the language and what folder/file was requested and then serves up the correct language file? here's the php file that is served up for any files in the URL. <?php // Get current document path which is mirrored in the language folders $docpath = $_SERVER['PHP_SELF']; // Get current document name (Used when switching languages so that the same current page is shown when language is changed) $docname = GetDocName(); //call up lang.php which handles display of appropriate language webpage. //lang.php uses $docpath and $docname to give out the proper $langfile. //$docpath/$docname is mirrored in the /lang/en and /lang/fr folders $langfile = GetDocRoot()."/lang/lang.php"; include("$langfile"); //Call up the proper language file to display function GetDocRoot() { $temp = getenv("SCRIPT_NAME"); $localpath=realpath(basename(getenv("SCRIPT_NAME"))); $localpath=str_replace("\\","/",$localpath); $docroot=substr($localpath,0, strpos($localpath,$temp)); return $docroot; } function GetDocName() { $currentFile = $_SERVER["SCRIPT_NAME"]; $parts = Explode('/', $currentFile); $dn = $parts[count($parts) - 1]; return $dn; } ?>

    Read the article

  • Elegant way to aggregate multi-dimensional array by index key

    - by Stephen J. Fuhry
    How can I recursively find the total value of all children of an array that looks something like this? [0] => Array ( [value] => ? // 8590.25 + 200.5 + 22.4 [children] => Array ( [0] => Array ( [value] => ? // 8590.25 + 200.5 [children] => Array ( [0] => Array ( [value] => 8590.25 // leaf node ) [1] => Array ( [value] => 200.05 // leaf node ) ) ) [1] => Array ( [value] => 22.4 // leaf node ) ) )

    Read the article

  • Build system for multi-language project

    - by Epcylon
    I am getting ready to embark on a project mainly for experimenting with languages, but also with a hint of usefulness. It will consist of a server-application, written in Erlang, and client-libraries in a number of languages. Initially I will want to write clients in Java, Ruby and Python. The actual protocol for communication will be Thrift. I'm looking for a build system that will allow me to build the server and all the client libraries in one go, running unit-tests in each language, then packaging up a releasable artifact of some sort in whatever way is the "standard" for each language. That means a Jar for Java, a RubyGem and a distribute/setuptools tarball for Python. Erlang probably has something too, but I'm not yet familiar with that. It should also be able to run the Thrift compiler to generate the various Thrift-stubs in each language. On the pad at the start is Maven. I'm fairly certain Maven can do all I need, but I fear it's too Java-centric, and leaves me with a ton of work for every new language I need to add.

    Read the article

  • How to implement a multi-threaded asynchronous operation?

    - by drowneath
    Here's how my current approach looks like: // Somewhere in a UI class // Called when a button called "Start" clicked MyWindow::OnStartClicked(Event &sender) { _thread = new boost::thread(boost::bind(&MyWindow::WorkToDo, this)); } MyWindow::WorkToDo() { for(int i = 1; i < 10000000; i++) { int percentage = (int)((float)i / 100000000.f); _progressBar->SetValue(percentage); _statusText->SetText("Working... %d%%", percentage); printf("Pretend to do something useful...\n"); } } // Called on every frame MyWindow::OnUpdate() { if(_thread != 0 && _thread->timed_join(boost::posix_time::seconds(0)) { _progressBar->SetValue(100); _statusText->SetText("Completed!"); delete _thread; _thread = 0; } } But I'm afraid this is far from safe since I keep getting unhandled exception at the end of the program execution. I basically want to separate a heavy task into another thread without blocking the GUI part.

    Read the article

  • Passing Data to Multi Threads

    - by alaamh
    I study this code from some book: #include <pthread.h> #include <stdio.h> /* Parameters to print_function. */ struct char_print_parms { /* The character to print. */ char character; /* The number of times to print it. */ int count; }; /* Prints a number of characters to stderr, as given by PARAMETERS, which is a pointer to a struct char_print_parms. */ void* char_print(void* parameters) { /* Cast the cookie pointer to the right type. */ struct char_print_parms* p = (struct char_print_parms*) parameters; int i; for (i = 0; i < p->count; ++i) fputc(p->character, stderr); return NULL; } /* The main program. */ int main() { pthread_t thread1_id; pthread_t thread2_id; struct char_print_parms thread1_args; struct char_print_parms thread2_args; /* Create a new thread to print 30,000 ’x’s. */ thread1_args.character = 'x'; thread1_args.count = 30000; pthread_create(&thread1_id, NULL, &char_print, &thread1_args); /* Create a new thread to print 20,000 o’s. */ thread2_args.character = 'o'; thread2_args.count = 20000; pthread_create(&thread2_id, NULL, &char_print, &thread2_args); usleep(20); return 0; } after running this code, I see different result each time. and some time corrupted result. what is wrong and what the correct way to do that?

    Read the article

  • Passing a multi-line string as an argument to a script in Windows

    - by Zack Mulgrew
    I have a simple python script like so: import sys lines = sys.argv[1] for line in lines.splitlines(): print line I want to call it from the command line (or a .bat file) but the first argument may (and probably will) be a string with multiple lines in it. How does one do this? Of course, this works: import sys lines = """This is a string It has multiple lines there are three total""" for line in lines.splitlines(): print line But I need to be able to process an argument line-by-line. EDIT: This is probably more of a Windows command-line problem than a Python problem. EDIT 2: Thanks for all of the good suggestions. It doesn't look like it's possible. I can't use another shell because I'm actually trying to invoke the script from another program which seems to use the Windows command-line behind the scenes.

    Read the article

  • Elegant way to aggregate multi-demensional array by index key

    - by Stephen J. Fuhry
    How can I recursively find the total value of all children of an array that looks something like this? [0] => Array ( [value] => ? // 8590.25 + 200.5 + 22.4 [children] => Array ( [0] => Array ( [value] => ? // 8590.25 + 200.5 [children] => Array ( [0] => Array ( [value] => 8590.25 // leaf node ) [1] => Array ( [value] => 200.05 // leaf node ) ) ) [1] => Array ( [value] => 22.4 // leaf node ) ) )

    Read the article

  • Multi-model form problem

    - by raphael_turtle
    (I'm just learning rails so....) I have a photo model and a gallery model, habtm associations and a join table. I'm making a photo gallery. The gallery page has a title field and description field. User creates gallery title, then goes to the photo page and checkboxes each image they want in that gallery. I get the error "undefined method `to_i' for ["1", {"title"="1"}]:Array" when trying to save/update a photo with a gallery title(with the checkbox) <% form_for @photo, :html => {:multipart => true } do |f| %> <%= f.error_messages %> <p> <%= f.label :title %> <%= f.text_field :title %> </p> <p> <%= f.label :description %> <%= f.text_area :description %> </p> <p> <%= f.label :image %> <%= f.file_field :image %> </p> <% for gallery in @photo.galleries %> <% fields_for "painting[gallery_attributes][]", gallery do |g| %> <div> <%= g.check_box :title %> <%= gallery.title %> </div> <% end %> <% end %> <p><%= submit_tag 'Update' %></p> <% end %> How much of this is horribly wrong? Can someone point me in the right direction?, I can't find any tutorials relating to this for 2.3 and above.

    Read the article

  • How to multi-thread this?

    - by WilliamKF
    I wish to have two threads. The first thread1 occasionally calls the following pseudo function: void waitForThread2() { if (thread2 is not idle) { return; } notifyThread2IamReady(); while (thread2IsExclusive) { } } The second thread2 is forever in the following pseudo loop: for (;;) { Notify thread1 I am idle. while (!thread1IsReady()) { } Notify thread1 I am exclusive. Do some work while thread1 is blocked. Notify thread1 I am busy. Do some work in parallel with thread1. } What is the best way to write this such that both thread1 and thread2 are kept as busy as possible on a machine with multiple cores. I would like to avoid long delays between notification in one thread and detection by the other. I tried using pthread condition variables but found the delay between thread2 doing 'notify thread1 I am busy' and the loop in waitForThread2() on thear2IsExclusive() can be up to almost one second delay. I then tried using a volatile sig_atomic_t shared variable to control the same, but something is going wrong, so I must not be doing it correctly.

    Read the article

  • OpenCV (c++) multi channel element access

    - by Vic
    I'm trying to use the "new" 2.0 c++ version of OpenCV, but everything is else like in simple C version. I have some problem with changing the values in image. The image is CV_8UC3. for (int i=0; i<image.rows; i++) { for (int j=0; j<image.cols; j++) { if (someArray[i][j] == 0) { image.at<Vec3i>(i,j)[0] = 0; image.at<Vec3i>(i,j)[1] = 0; image.at<Vec3i>(i,j)[2] = 0; } } } It's not working. What am I doing wrong??? Thank you!

    Read the article

  • touch multi UIViews

    - by user262325
    Hello everyone There are a series UIViews arranaged very close. I hope when my finger touchs some of them, my app can detect which UIView touched. Maybe one or two or three.(because the displayed parts of each UIView are too thin). I hope to get the middle x value of the touch, then spread the UIView where the middle x value locates and the UIViews near it. Welcome any comment Thanks interdev

    Read the article

  • Problem with multi-table MySQL query

    - by mahle
    I have 3 tables. Here is the relevant information needed for each. items prod_id order_id item_qty orders order_id order_date order_status acct_id accounts acct_id is_wholesale items is linked to order by the order_id and orders is linked to accounts via acct_id I need to sum item_qty for all items where prod_id=464 and the order stats is not 5 and where the is_wholesale is 0 and the order_date is between two dates. Im struggling with this and would appreciate any help. Here is what I have but it's not working correctly: SELECT SUM(items.item_qty) as qty FROM items LEFT JOIN orders ON orders.order_id = items.order_id LEFT JOIN accounts on orders.acct_id = accounts.acct_id WHERE items.prod_id =451 AND orders.order_date >= '$from_date' AND orders.order_date <= '$to_date' AND orders.order_status <>5 AND accounts.is_wholesale=0; Again, any help would be greatly appreciated!

    Read the article

  • Creating a multi-row "table" as part of a SELECT

    - by Chad Birch
    I'm not really sure how to describe my question (thus the awful title), but it's related to this recent question. The problem would be easily solved if there was some way for me to create a "table" with 4 rows as part of my SELECT (to use with NOT IN or MINUS). What I mean is, I can do this: SELECT 1, 2, 3, 4; And will receive one row from the database: | 1 | 2 | 3 | 4 | But is there any way to receive the following (without using UNION, I don't really want a query that's potentially thousands of lines long with a long list)? | 1 | | 2 | | 3 | | 4 |

    Read the article

  • session_set_cookie_params on multi-domain sites

    - by nillls
    Hi! I'm currently developing for an application (www.domain.se, .eu) where we're experiencing problems with sessions not propagating across domains. Internet Explorer is the root cause of this, as it will differentiate sessions depending on whether we're typing in "domain.se" or "www.domain.se". Due to some unfortunate redirecting, we're not able to keep the user on the same address the user typed in, instead we're always redirecting to www.domain.se on login. Needless to say, IE users can not login when typing "domain.se". To make this error go away, we implemented a function to try and set the session to be valid across all possible domains by doing the following: if($_SERVER['HTTP_HOST'] == "domain.se") { session_set_cookie_params(3600, '/', '.domain.se', true); } There are basically a few if:s that we go through depending on what address the user typed in, but the third argument stays the same. This, however, results in no-one being able to log in, regardless of domain. I've tried reading up on how session_set_cookie_params() works but to no avail. Any help is greatly appreciated!

    Read the article

  • Multi-Dimensional Array and ArrayIndexOutOfBoundsException

    - by notset
    Hello, I have a strange problem which I can't fix: A field: private boolean[][][] gaps; Constructor (1st line): gaps = new boolean[NOBARRICADES][WIDTH][HEIGHT]; Constructor (2nd line): for (int i = 0; i < NOBARRICADES; i++) { JAVA throws an error for the 2nd line, saying: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException Does it have anything to do with JAVA syntax (the mistake is in these lines of code) or I should look for the problem somewhere else?

    Read the article

  • C++ Multi Monitor - Find All Visible/Open Windows

    - by Paul
    I'm trying to find all the windows of ANY kind that are open (and have a taskbar 'button'). I have no problems finding the list processes/hWnd's, and then cycling through those, but how do I determine if a process/hwnd has a window open? (even if minimized). I've tried doing different combinations of the window parameters (such as WS_POPUP etc) but none of the parameters (or combinations of parameters) that I could find would give me all the open windows without some sort of false positives. As an example of a false positive was the fact that it gives me two 'windows' for google talk (even though one was open). Another false positive is considering the start menu as an open window. Any ideas? Solutions? I've been working on this for a while and its been driving me a bit insane. Note: I'm doing this for windows 7 (at this point). I'm not sure if there's any difference between how you would do this between XP and 7, but I thought it might be relevant.

    Read the article

  • Dynamically Generate Multi-Dimensional Array in Ruby

    - by user335729
    Hi, I'm trying to build a multidimensional array dynamically. What I want is basically this (written out for simplicity): b = 0 test = [[]] test[b] << ["a", "b", "c"] b += 1 test[b] << ["d", "e", "f"] b += 1 test[b] << ["g", "h", "i"] This gives me the error: NoMethodError: undefined method `<<' for nil:NilClass. I can make it work by setting up the array like test = [[], [], []] and it works fine, but in my actual usage, I won't know how many arrays will be needed beforehand. Is there a better way to do this? Thanks

    Read the article

  • How to Use Multi Spinner to Store Each Table from Database

    - by stephenborey
    Dear Sir, I'm having problem in the method how to add each of the database table to many spinners. The data from one table must use one spinner to store. In my form has 3 spinner which require data from 3 table in database. Please show me some sample or the familiar one, because I have just started in this program. Thank You in Advance!

    Read the article

  • PHP multi-post issue.

    - by user1887185
    When I have two or more comments on a post, it show the post again and the next comment underneath it. How do I make it so it shows only the post once and the comments underneath it if there are multiple comments? $sql_posts = mysql_query("SELECT * FROM posts ORDER BY post_date DESC "); $postDisplayList = ""; while($row = mysql_fetch_array($sql_posts)){ $postid = $row["id"]; $uid = $row["user_id"]; $the_post = $row["post"]; $post_date = $row["post_date"]; $sql_mem_data = mysql_query("SELECT id, username, firstname, lastname FROM users WHERE id='$uid' LIMIT 1"); while($row = mysql_fetch_array($sql_mem_data)){ $uid = $row["id"]; $username = $row["username"]; $firstname = $row["firstname"]; $lastname = $row["lastname"]; } $sql_com_data = mysql_query("SELECT * FROM comments WHERE post_id='$postid' "); while($row = mysql_fetch_assoc($sql_com_data)){ $uid1 = $row["user_id"]; $comment = $row["comment"]; $whencomment = $row["comment_date"]; $sql_com_data_user = mysql_query("SELECT * FROM users WHERE id='$uid1' "); while($row = mysql_fetch_array($sql_com_data_user)){ $username1 = $row["username"]; $firstname1 = $row["firstname"]; $lastname1 = $row["lastname"]; } $postDisplayList .= ' <table width="100%" align="center" cellpadding="6" style="background-color:#F2F2F2; "> <tr> <td width="93%" bgcolor="#F2F2F2" style="line-height:1.5em;" valign="top"> <span class="liteGreyColor textsize9"> ' . $post_date . ' <a href="profile.php?id=' . $uid . '"><strong>' . $username . '</strong></a></span><br /> <span class="textsize14"> ' . $the_post . '</span> </td> </tr> <tr> <td width="93%" bgcolor="#F2F2F2" style="line-height:1.5em;" valign="top"> <span class="liteGreyColor textsize9"> ' . $whencomment . ' <a href="profile.php?id=' . $uid1 . '"><strong>' . $username1 . '</strong></a></span><br /> <span class="textsize14"> ' . $comment . '</span> </td> </tr> </table>';

    Read the article

  • Ask the Readers: Are You A Second Screen Multi-tasker?

    - by Jason Fitzpatrick
    Television watchers are no longer keeping their eyes continuously glued to the screen–increasingly smartphone, tablet, and laptop users have merged their mobile device and television time. Are you one of the second screen multi-taskers? Image courtesy of Umani, a TV-companion application for iPad. According to Nielsen user surveys, at least 80% of mobile device owners have used their device while watching television in the past month–27% said they use their mobile device alongside the television multiple times a day. What the survey results are light on, however, is an in depth look at what the users are doing with their second screen. This week we want to hear about whether or not you’re one of the second screen multi-taskers and what you use your mobile device for during your television/movie time. Sound off in the comments and then check back in on Friday for the What You Said roundup. How to Get Pro Features in Windows Home Versions with Third Party Tools HTG Explains: Is ReadyBoost Worth Using? HTG Explains: What The Windows Event Viewer Is and How You Can Use It

    Read the article

  • How Do You Calculate Processor Speed on Multi-core Processors?

    - by Jason Fitzpatrick
    The advent of economical consumer grade multi-core processors raises the question for many users: how do you effectively calculate the real speed of a multi-core system? Is a 4-core 3Ghz system really 12Ghz? Read on as we investigate. Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-drive grouping of Q&A web sites. 6 Start Menu Replacements for Windows 8 What Is the Purpose of the “Do Not Cover This Hole” Hole on Hard Drives? How To Log Into The Desktop, Add a Start Menu, and Disable Hot Corners in Windows 8

    Read the article

  • Is there a difference between multi-tasking and time-sharing?

    - by Dummy Derp
    Just going over my school notes, my teacher identifies multi-tasking OS, and time-sharing OS as two different things. I really don't see a difference between the two. MULTI-TASKING: You load a number of programs in the memory and execute them. You execute another program if the time quantum allocated to the current program expires OR if it goes on to do I/O and leaves the CPU OR if it finishes execution. TIME-SHARING: the same,again. The same applies in case of serial processing and batch processing. Although they are the same, I guess the only difference would be the way in which control information is passed to the CPU. Maybe, and again MAYBE, in serial processing you need to provide the punch cards with all the processes while in batch, the entire batch uses the same set of control information. Like all the print jobs would have the same control information.

    Read the article

< Previous Page | 51 52 53 54 55 56 57 58 59 60 61 62  | Next Page >