Search Results

Search found 25579 results on 1024 pages for 'complex event processing'.

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

  • NSFetchedResultsController not processing certain section driven moves

    - by JK
    I utilize a NSFetchedResultsController (frc) with a Core Data store. I implement all the frc delegate methods. The table is sporadically updated by background threads. All the inserts, deletes and updates work fine, with the exception that updates to the frc's index key for rows toward to the bottom of the table (50 rows), do not result in a section move. e.g. if "name" is the index key and the name "Victor" is changed to "Alex", the victor row now shows the name Alex, but is not moved to the top of the table alongside all other names starting with A. As I noted, this is only for rows towards the bottom of the table. If a row like "Andy" is changed to "Ben", the move is indeed processed correctly by the frc. Any suggestions to fix this would be appreciated. I do not use a frc cache. Thanks

    Read the article

  • Event feed implementation - will it scale?

    - by SlappyTheFish
    Situation: I am currently designing a feed system for a social website whereby each user has a feed of their friends' activities. I have two possible methods how to generate the feeds and I would like to ask which is best in terms of ability to scale. Events from all users are collected in one central database table, event_log. Users are paired as friends in the table friends. The RDBMS we are using is MySQL. Standard method: When a user requests their feed page, the system generates the feed by inner joining event_log with friends. The result is then cached and set to timeout after 5 minutes. Scaling is achieved by varying this timeout. Hypothesised method: A task runs in the background and for each new, unprocessed item in event_log, it creates entries in the database table user_feed pairing that event with all of the users who are friends with the user who initiated the event. One table row pairs one event with one user. The problems with the standard method are well known – what if a lot of people's caches expire at the same time? The solution also does not scale well – the brief is for feeds to update as close to real-time as possible The hypothesised solution in my eyes seems much better; all processing is done offline so no user waits for a page to generate and there are no joins so database tables can be sharded across physical machines. However, if a user has 100,000 friends and creates 20 events in one session, then that results in inserting 2,000,000 rows into the database. Question: The question boils down to two points: Is this worst-case scenario mentioned above problematic, i.e. does table size have an impact on MySQL performance and are there any issues with this mass inserting of data for each event? Is there anything else I have missed?

    Read the article

  • How to bind to another event after ajax call in jquery

    - by robert
    Hi, I'm creating a graph using flot javascript library. I have enabled clickable event and the div is binded to plotclick event. So, when a datapoint is clicked, an ajax call is made and the result is used to replace the current div. After this i need to bind the div to a new event. I tried to call bind, but it is still bound to old callback. When i call unbind and bind, the new callback is not called. var handleTeacherClick = function( event, pos, item ) { if( typeof item != "undefined" && item ) { var user_id = jQuery( 'input[name="id' + item.datapoint[0] + '"]' ).val(); jQuery.ajax({ type: 'POST', url: BASEPATH + 'index.php/ajax/home/latest', data: { "user_id": user_id }, dataType: 'json', success: function ( result ) { jQuery.plot(jQuery('#stats_prog'), result.progress_data, result.progress_options); jQuery.plot(jQuery('#stats_perf'), result.performance_data, result.performance_options); jQuery('.stats_title'). html('<span class="stats_title">'+ ' >> Chapter '+Math.ceil(item.datapoint[0])+'</span>'); jQuery('#stats_prog')./*unbind("plotclick").*/ bind('plotclick', statClickHandler ); jQuery('#stats_perf')./*unbind("plotclick"). */ bind( 'plotclick', statClickHandler ); }, }); } }

    Read the article

  • Boost multiindex complex struct

    - by StrifeLow
    In boost multiindex example complex_structs, it use one key in the car_manufacturer struct for car_table. If car_manufacturer have been modify to have 2 ID struct car_manufacturer { std::string name; int cm_code; car_manufacturer(const std::string& name_, const int& cm_code_):name(name_), cm_code(cm_code_){} }; What will be the key_from_key struct looks like? Have try to add another KeyExtractor or use composite index inside key_from_key, but still cannot compile. Please help on this. Thanks.

    Read the article

  • PHP form processing - how to capture text from field that has variable Name/ID

    - by user80151
    I have a form that has a field pulled from the database as a dropdown. I need to get the text selected in the dropdown but I don't know in advance what the field ID will be. This is basically just a form that has already been generated. I don't need to pull anything from the database, it's already on this page. All I need to do is get the form information and email it, no writing to the database. I know how to do the _Request for the other fields based on the ID but I'm not sure how to do this one. The ID changes. It can be ID=1, ID-2, etc. I need to do something like: _REQUEST form element where ID is LIKE "ID[*]" or something similar. Any suggestions or links to tutorials? Here are a couple samples of what the dropdown renders on the page: <div class="wrapperAttribsOptions"> <h4 class="optionName back"><label class="attribsSelect" for="attrib- 1">Model</label></h4> <div class="back"> <select name="id[1]" id="attrib-1"> <option value="45">VC3-4C</option> <option value="1">VC3-4PG</option> <option value="3">VC3-4SG</option> <div class="wrapperAttribsOptions"> <h4 class="optionName back"><label class="attribsSelect" for="attrib-14">SPK Model</label></h4> <div class="back"> <select name="id[14]" id="attrib-14"> <option value="43">SPK-4</option> <option value="44">SPK-8</option> </select> TIA

    Read the article

  • Dynamically loading modules in Python (+ multi processing question)

    - by morpheous
    I am writing a Python package which reads the list of modules (along with ancillary data) from a configuration file. I then want to iterate through each of the dynamically loaded modules and invoke a do_work() function in it which will spawn a new process, so that the code runs ASYNCHRONOUSLY in a separate process. At the moment, I am importing the list of all known modules at the beginning of my main script - this is a nasty hack I feel, and is not very flexible, as well as being a maintenance pain. This is the function that spawns the processes. I will like to modify it to dynamically load the module when it is encountered. The key in the dictionary is the name of the module containing the code: def do_work(work_info): for (worker, dataset) in work_info.items(): #import the module defined by variable worker here... # [Edit] NOT using threads anymore, want to spawn processes asynchronously here... #t = threading.Thread(target=worker.do_work, args=[dataset]) # I'll NOT dameonize since spawned children need to clean up on shutdown # Since the threads will be holding resources #t.daemon = True #t.start() Question 1 When I call the function in my script (as written above), I get the following error: AttributeError: 'str' object has no attribute 'do_work' Which makes sense, since the dictionary key is a string (name of the module to be imported). When I add the statement: import worker before spawning the thread, I get the error: ImportError: No module named worker This is strange, since the variable name rather than the value it holds are being used - when I print the variable, I get the value (as I expect) whats going on? Question 2 As I mentioned in the comments section, I realize that the do_work() function written in the spawned children needs to cleanup after itself. My understanding is to write a clean_up function that is called when do_work() has completed successfully, or an unhandled exception is caught - is there anything more I need to do to ensure resources don't leak or leave the OS in an unstable state? Question 3 If I comment out the t.daemon flag statement, will the code stil run ASYNCHRONOUSLY?. The work carried out by the spawned children are pretty intensive, and I don't want to have to be waiting for one child to finish before spawning another child. BTW, I am aware that threading in Python is in reality, a kind of time sharing/slicing - thats ok Lastly is there a better (more Pythonic) way of doing what I'm trying to do? [Edit] After reading a little more about Pythons GIL and the threading (ahem - hack) in Python, I think its best to use separate processes instead (at least IIUC, the script can take advantage of multiple processes if they are available), so I will be spawning new processes instead of threads. I have some sample code for spawning processes, but it is a bit trivial (using lambad functions). I would like to know how to expand it, so that it can deal with running functions in a loaded module (like I am doing above). This is a snippet of what I have: def do_mp_bench(): q = mp.Queue() # Not only thread safe, but "process safe" p1 = mp.Process(target=lambda: q.put(sum(range(10000000)))) p2 = mp.Process(target=lambda: q.put(sum(range(10000000)))) p1.start() p2.start() r1 = q.get() r2 = q.get() return r1 + r2 How may I modify this to process a dictionary of modules and run a do_work() function in each loaded module in a new process?

    Read the article

  • c# multi threaded file processing

    - by user177883
    There is a folder that contains 1000 of small text files. I aim to parse and process all of them while more files are being populated in to the folder. My intention is to multithread this operation as the single threaded prototype took 6 minutes to process 1000 files. I like to have reader and writer thread(s) as following : while the reader thread(s) are reading the files, I d like to have writer thread(s) to process them. Once the reader is started reading a file, I d like to mark it as being processed, such as by renaming it, once it s read, rename it to completed. How to approach such multithreaded application ? Is it better to use a distributed hash table or a queue? Which data structure to use that would avoid locks? Would you have a better approach to this scheme that you like to share?

    Read the article

  • Django Asynchronous Processing

    - by freyrs
    Hello all, I have a bunch of Django requests which executes some mathematical computations ( written in C and executed via a Cython module ) which may take an indeterminate amount ( on the order of 1 second ) of time to execute. Also the requests don't need to access the database. Right now everything is synchronous ( using Gunicorn with sync worker types ) but I'd like to make this asynchronous and nonblocking. I am very new to asynchronous Django, and so my question is what is the best stack for doing this. Is this sort of process something a task queue is well suited for? Would anyone recommend Tornado + Celery + RabbitMQ, or perhaps something else? Thanks in advance!

    Read the article

  • Handle window scroll event in greasemonkey script

    - by Akim Khalilov
    Hi. I need some advice. I have a web page and want to extend it's functionality with greasemonkey script and firefox. When page has loaded I need run custom function during user's page scrolling (with mouse whell or scrollbar). I want show some div block when user scrolling down and hide it when he scrolling to the top. But I met some problem - I couldn't assign event handler to the onscroll event. I use next part of the code: function showFixedBlock(){ ... } function onScrollStart(){ ... showFixedBlock(); ... } window.onscroll = onScrollStart; I test this piece of code on my test html page and it works, but when I copy it into greasemonkey, script doesn't work. Should I assign onscroll event handler during page loading? As I know greasemonkey execute it's scripts when page has loaded? Is it the reason of the problem? Is there some additional requirments to handle 'onscroll' event? How can I do that? Thanks.

    Read the article

  • Showing errors in updatepanel after processing a CSV file

    - by Younes
    I have a csv importroutine which imports my CSV values into Sitecore. After this proces is done i want to show the errors in an asp:literal. This is not working, and I think this is because i need an updatepanel for this in order to be able to update text after the first postback (the csv upload / import). I made this: <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /> </ContentTemplate> </asp:UpdatePanel> and coded this: string melding = string.Format("Er zijn {0} objecten geïmporteerd.{1}", nrOfItemsImported, errors); ViewState["Melding"] = melding; And i have a button. On the onclick of this button I have: Literal literal = new Literal(); literal.Text = (string)ViewState["Melding"]; literal.ID = DateTime.Now.Ticks.ToString(); UpdatePanel1.ContentTemplateContainer.Controls.Add(literal); PlaceHolder1.Controls.Add(literal); When i now press the button i want to update the panel so that it will show my Literal with the errormsg on it. This however isn't happening. How can this be? I'm guessing it has something to do with my viewstate, i don't see keys on the viewstate after I press the button...

    Read the article

  • processing json objects in jsp

    - by user98534
    i have a JSON object sent from the browser to the jsp page. how do i receive that object and process it in jsp. do i need any specific parsers? i have used the following piece of code. but it wouldnt work. essentially i should read the contents of the object and print them in the jsp. <%@page language="java" import="jso.JSONObject"%> <% JSONObject inp=request.getParameter("param1"); %> <% for(int i=0;i<inp.size();i++) {%> <%=inp.getString(i)%> <% } %>

    Read the article

  • Jaxb doesn't generate Interface for element of complex type

    - by user275886
    I have an xsd (for basecamp xml) that contains <xsd:complexType name="ProjectType"> <xsd:sequence> <xsd:element name="announcement" type="TypedNilableStringElementType" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="created-on" type="TypedDateElementType" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="id" type="TypedIntegerElementType" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="last-changed-on" type="TypedDateTimeElementType" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="name" type="xsd:string" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="show-announcement" type="TypedBooleanElementType" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="show-writeboards" type="TypedBooleanElementType" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="start-page" type="xsd:string" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="status" type="xsd:string" maxOccurs="1" minOccurs="1"> </xsd:element> <xsd:element name="company" type="SimpleCompanyType" maxOccurs="1" minOccurs="1"> </xsd:element> </xsd:sequence> </xsd:complexType> and <xsd:element name="project" type="ProjectType"> </xsd:element> I'm looking at http://java.sun.com/javaee/5/docs/tutorial/doc/bnbah.html and can't understand what I'm doing different from the sample schema in Table 17-13 where there is an element named purchaseOrder of type PurchaseOrderType. According to the tutorial, running xjc on the schema, one will get PurchaseOrder.java interface and PurchaseOrderType.java interface. When I run xjc on my schema I only get a ProjectType.java class, and when the xml actually consist of a single element, this won't parse, because there are no Project.java class/interface to match.

    Read the article

  • How to draw complex shape from code behind for custom control in resource dictionary

    - by HopelessCoder
    Hi I am new to wpf and am having a problem which may or may not be trivial. I have defined a custom control as follows in the resource dictionary: <ResourceDictionary x:Class="SyringeSlider.Themes.Generic" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:SyringeSlider"> <Style TargetType="{x:Type local:CustomControl1}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:CustomControl1}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"> <Canvas Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Name="syringeCanvas"> </Canvas> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </ResourceDictionary> Unfortunately I cannot go beyond this because I would like to draw a geometry onto the canvas consisting of a set of multiple line geometries whose dimensions are calculated as a function of the space available in the canvas. I believe that I need a code behind method to do this, but have not been able to determine how to link the xaml definition to a code behind method. Note that I have set up a class x:Class="SyringeSlider.Themes.Generic" for specifically this purpose, but can't figure out which Canvas property to link the drawing method to. My drawing method looks like this private void CalculateSyringe() { int adjHeight = (int) Height - 1; int adjWidth = (int) Width - 1; // Calculate some very useful values based on the chart above. int borderOffset = (int)Math.Floor(m_borderWidth / 2.0f); int flangeLength = (int)(adjHeight * .05f); int barrelLeftCol = (int)(adjWidth * .10f); int barrelLength = (int)(adjHeight * .80); int barrelRightCol = adjWidth - barrelLeftCol; int coneLength = (int)(adjHeight * .10); int tipLeftCol = (int)(adjWidth * .45); int tipRightCol = adjWidth - tipLeftCol; int tipBotCol = adjWidth - borderOffset; Path mySyringePath = new Path(); PathGeometry mySyringeGeometry = new PathGeometry(); PathFigure mySyringeFigure = new PathFigure(); mySyringeFigure.StartPoint = new Point(0, 0); Point pointA = new Point(0, flangeLength); mySyringeFigure.Segments.Add(new LineSegment(pointA, true)); Point pointB = new Point(); pointB.Y = pointA.Y + barrelLength; pointB.X = 0; mySyringeFigure.Segments.Add(new LineSegment(pointB, true)); // You get the idea....Add more points in this way mySyringeGeometry.Figures.Add(mySyringeFigure); mySyringePath.Data = mySyringeGeometry; } SO my question is: 1) Does what I am trying to do make any sense? 2) Can a use a canvas for this purpose? If not, what are my other options? Thanks!

    Read the article

  • SQLAlchemy & Complex Queries

    - by user356594
    I have to implement ACL for an existing application. So I added the a user, group and groupmembers table to the database. I defined a ManyToMany relationship between user and group via the association table groupmembers. In order to protect some ressources of the app (i..e item) I added a additional association table auth_items which should be used as an association table for the ManyToMany relationship between groups/users and the specific item. item has following columns: user_id -- user table group_id -- group table item_id -- item table at least on of user_id and group_id columns are set. So it's possible to define access for a group or for a user to a specific item. I have used the AssociationProxy to define the relationship between users/groups and items. I now want to display all items which the user has access to and I have a really hard time doing that. Following criteria are used: All items which are owned by the user should be shown (item.owner_id = user.id) All public items should be shown (item.access = public) All items which the user has access to should be shown (auth_item.user_id = user.id) All items which the group of the user has access to should be shown. The first two criteria are quite straightforward, but I have a hard time doing the 3rd one. Here is my approach: clause = and_(item.access == 'public') if user is not None: clause = or_(clause,item.owner == user,item.users.contains(user),item.groups.contains(group for group in user.groups)) The third criteria produces an error. item.groups.contains(group for group in user.groups) I am actually not sure if this is a good approach at all. What is the best approach when filtering manytomany relationships? How I can filter a manytomany relationship based on another list/relationship? Btw I am using the latest sqlalchemy (6.0) and elixir version Thanks for any insights.

    Read the article

  • Running code when all threads are finished processing.

    - by rich97
    Quick note: Java and Android noob here, I'm open to you telling me I'm stupid (as long as you tell me why.) I have an android application which requires me start multiple threads originating from various classes and only advance to the next activity once all threads have done their job. I also want to add a "failsafe" timeout in case one the the threads takes too long (HTTP request taking too long or something.) I searched Stack Overflow and found a post saying that I should create a class to keep a running total of open threads and then use a timer to poll for when all the threads are completed. I think I've created a working class to do this for me, it's untested as of yet but has no errors showing in eclipse. Is this a correct implementation? Are there any APIs that I should be made aware of (such as classes in the Java or Android APIs that could be used in place of the abstract classes at the bottom of the class?) package com.dmp.geofix.libs; import java.util.ArrayList; import java.util.Iterator; import java.util.Timer; import java.util.TimerTask; public class ThreadMonitor { private Timer timer = null; private TimerTask timerTask = null; private OnSuccess onSuccess = null; private OnError onError = null; private static ArrayList<Thread> threads; private final int POLL_OPEN_THREADS = 100; private final int TIMEOUT = 10000; public ThreadMonitor() { timerTask = new PollThreadsTask(); } public ThreadMonitor(OnSuccess s) { timerTask = new PollThreadsTask(); onSuccess = s; } public ThreadMonitor(OnError e) { timerTask = new PollThreadsTask(); onError = e; } public ThreadMonitor(OnSuccess s, OnError e) { timerTask = new PollThreadsTask(); onSuccess = s; onError = e; } public void start() { Iterator<Thread> i = threads.iterator(); while (i.hasNext()) { i.next().start(); } timer = new Timer(); timer.schedule(timerTask, 0, POLL_OPEN_THREADS); } public void finish() { Iterator<Thread> i = threads.iterator(); while (i.hasNext()) { i.next().interrupt(); } threads.clear(); timer.cancel(); } public void addThread(Thread t) { threads.add(t); } public void removeThread(Thread t) { threads.remove(t); t.interrupt(); } class PollThreadsTask extends TimerTask { private int timeElapsed = 0; @Override public void run() { timeElapsed += POLL_OPEN_THREADS; if (timeElapsed <= TIMEOUT) { if (threads.isEmpty() == false) { if (onSuccess != null) { onSuccess.run(); } } } else { if (onError != null) { onError.run(); } finish(); } } } public abstract class OnSuccess { public abstract void run(); } public abstract class OnError { public abstract void run(); } }

    Read the article

  • Processing an Integer Retrieved from a String in XSL

    - by justkt
    I have a stored time value which is of the format H:mm:ss. The hours may be any value from 0 up through several days. This data is sent in an XML tag and processed by XSL to be displayed. The display that I want is of the format: D days, HH:mm:ss (hours/minutes) Where the last tag shows hours if HH is greater than 0, minutes if it is 0. Given the original HH, which may be more than 24, I know I need the floor of HH / 24 to get the days value. Then the original HH % 24 gives me the leftover hours. I have also handled the minutes and hours question using xsl:when and xsl:if. It's getting days and hours from the hours value that has me stumped.

    Read the article

  • Hadoop: Processing large serialized objects

    - by restrictedinfinity
    I am working on development of an application to process (and merge) several large java serialized objects (size of order GBs) using Hadoop framework. Hadoop stores distributes blocks of a file on different hosts. But as deserialization will require the all the blocks to be present on single host, its gonna hit the performance drastically. How can I deal this situation where different blocks have to cant be individually processed, unlike text files ?

    Read the article

  • "SpeechHypothesized event not raised"

    - by Jankhana
    Hi all, I need to detect the user voice when they pick-up the reciever on the other end. Because Modems usually start playing files (playback terminal) when the first ring goes there. So I planned to use speech recognition when they say "hello", it can start playing the file until wait for playing file. Or even any noise interference it can start speak. I accomplished this with few settings. I found few common words that my engine detects when we speak and the words that comes when it's ringing. It works fine as a stand alone application but if I try to integrate this with my application it just does not raises "SpeechHypothesized" event. I cant understand why this happens. If i see using a break point, the engine is having the delegate assign and invocation property also is initialized properly but than to is doesn't call the event. For calling I'm using C4F tapi manager and for speech recognition i'm using System.Speech library of .Net 3.5. The code for events is as follows : engine.SpeechDetected += new EventHandler<SpeechDetectedEventArgs>(engine_SpeechDetected); engine.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(engine_SpeechRecognized); engine.SpeechHypothesized+=new EventHandler<SpeechHypothesizedEventArgs> (engine_SpeechHypothesized); engine.SpeechRecognitionRejected += new EventHandler<SpeechRecognitionRejectedEventArgs>(engine_SpeechRecognitionRejected); All event's are raised except the speechhypothesized event. Any idea why this happens ????

    Read the article

  • Observer Design Pattern - multiple event types

    - by David
    I'm currently implementing the Observer design pattern and using it to handle adding items to the session, create error logs and write messages out to the user giving feedback on their actions (e.g. You've just logged out!). I began with a single method on the subject called addEvent() but as I added more Observers I found that the parameters required to detail all the information I needed for each listener began to grow. I now have 3 methods called addMessage(), addStorage() and addLog(). These add data into an events array that has a key related to the event type (e.g. log, message, storage) but I'm starting to feel that now the subject needs to know too much about the listeners that are attached. My alternative thought is to go back to addEvent() and pass an event type (e.g. USER_LOGOUT) along with the data associated and each Observer maintains it's own list of event handles it is looking for (possibly in a switch statement), but this feels cumbersome. Also, I'd need to check that sufficient data had also been passed along with the event type. What is the correct way of doing this? Please let me know if I can explain any parts of this further. I hope you can help and see the problem I'm battling with.

    Read the article

  • Complex Calculations

    - by mson
    What are the best tools (most efficient) available in .NET (C#) for calculating: integrals partial derivatives other non-trivial math Can people please comment on Mathematica and Matlab and their integration into C#?

    Read the article

  • complex URL remapping with friendly_id

    - by DerNalia
    I have the URL http://acme.example.com/view/view_container_content/15?javascript_disabled=true&container=aoeu but I want it to look like http://acme.example.com/view/container_name/content_name/ with friendly_id, I've seen how to do URL mapping with one object... but I haven't seen an example with two... ideas?

    Read the article

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