Daily Archives

Articles indexed Wednesday June 26 2013

Page 8/19 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • OneToMany association updates instead of insert

    - by Shvalb
    I have an entity with one-to-many association to child entity. The child entity has 2 columns as PK and one of the column is FK to the parent table. mapping looks like this: @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER ) @JoinColumn(name="USER_RESULT_SEQUENCES.USER_RESULT_ID", referencedColumnName="USER_RESULT_ID", unique=true, insertable=true, updatable=false) private List<UserResultSequence> sequences; I create an instance of parent and add children instances to list and then try to save it to DB. If child table is empty it inserts all children and it works perfectly. if the child table is not empty it updates existing rows! I don't know why it updates instead of inserts, any ideas why this might happen?? Thank you!

    Read the article

  • ResourceFilterFactory and non-Path annotated Resources

    - by tousdan
    (I'm using Jersey 1.7) I am attempting to add a ResourceFilterFactory in my project to select which filters are used per method using annotations. The ResourceFilterFactory seems to be able to filters on Resources which are annotated with the Path annotation but it would seem that it does not attempt to generate filters for the methods of the SubResourceLocator of the resources that are called. @Path("a") public class A { //sub resource locator? @Path("b") public B getB() { return new B(); } @GET public void doGet() {} } public class B { @GET public void doOtherGet() { } @Path("c") public void doInner() { } } When ran, the Filter factory will only be called for the following: AbstractResourceMethod(A#doGet) AbstractSubResourceLocator(A#getB) When I expected it to be called for every method of the sub resource. I'm currently using the following options in my web.xml; <init-param> <param-name>com.sun.jersey.spi.container.ResourceFilters</param-name> <param-value>com.my.MyResourceFilterFactory</param-value> </init-param> <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>com.my.resources</param-value> </init-param> Is my understanding of the filter factory flawed?

    Read the article

  • Many Associations Leading to Slow Query

    - by Joey Cadle
    I currently have a database that has a lot of many to many associations. I have services which have many variations which have many staff who can perform the variation who then have details on themselves like name, role, etc... At 10 services with 3 variations each and up to 4 out of 20 staff attached to each service even doing something as getting all variations and the staff associated with them takes 4s. Is there a way I can reduce these queries that take a while to process? I've cut down the queries by doing eager loading in my DBM to reduce the problems that arise from 1+N issues, but still 4s is a long query for just a testing stage. Is there a structure out there that would help make such nested many to many associations much quicker to select? Maybe combining everything past the service level into a single table with a 'TYPE' column ?? I'm just not knowledgable enough to know the solution that turns this 4s query into a 300MS query... Any suggestions would be helpful.

    Read the article

  • Why can't I register a custom model binder for a List<int>?

    - by quarksoup
    I have an action that looks like public ActionResult GetUsers(List<int> userIds) {//do stuff} The list of userIds can become quite long, so I want to use Json.Net to deserialize it. To do so I created an IModelBinder implementation, which works fine for other objects, but never gets called for a List. The IModelBind looks like this public class JsonBinder : System.Web.Mvc.IModelBinder { public object BindModel(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext) { //Do model binding stuff using Json.Net } } And I register this model binder with this line ModelBinders.Binders.Add(typeof(List<int>), new JsonBinder()); However the JsonBinder is never called. Why is this? Should I be using a ValueProvider?

    Read the article

  • PHP query for totals of products for last six months

    - by user2260925
    I need to get the figures for the last six months from my orders table. The table has the following fields: qty, product, price, code, The format of the report must be as follows: Month: Jan Feb Mar Apr May June Product1 7 5 4 6 8 9 Product2 8 3 1 4 7 7 Product3 5 4 1 7 7 6 My current code gets the figures for one month only: "SELECT product,building, SUM(qty) AS 'month1' FROM sh_orders WHERE MONTH(order_date) = MONTH(CURDATE()) GROUP BY product"; The code to show it is: echo " <td> ". $row['product']. "</td> <td> ". $row['month1']. "</td>; Any help is greatly appreciated.

    Read the article

  • Episerver Scheduled Job fails (scheduler service)

    - by Igor
    Our scheduled jobs started failing since yesterday with the following error message: CustomUpdate.Execute - System.NullReferenceException: Object reference not set to an instance of an object. at System.Web.Security.Roles.GetRolesForUser(String username) at EPiServer.Security.PrincipalInfo.CreatePrincipal(String username) The scheduled job uses anonymous execution and logs in programmatically using the following call: if (PrincipalInfo.CurrentPrincipal.Identity.Name == string.Empty) { PrincipalInfo.CurrentPrincipal = PrincipalInfo.CreatePrincipal(ApplicationSettings.ScheduledJobUsername); } I have put in some more logging around PrincipalInfo.CreatePrincipal call which is in Episerver.Security and noticed that PrincipalInfo.CreatePrincipal calls System.Web.Security.Roles.GetRolesForUser(username) and Roles.GetRolesForUser(username) returns an empty string array. There were no changes code wise or on the server (updates, etc). I checked that the user name used to run the task is in the database and has roles associated with it. I checked that applicationname is set up correctly and is associated with the user If i run the job manually using the same user it executes with no issues (i know there is a difference between running the job manually and using the scheduler) I also tried creating a new user, that didn’t work either. Has anyone come across the same or similar issue? Any thoughts how to resolve this issue?

    Read the article

  • What is this type of programming called (creating an online network)?

    - by Byron S
    For practice purposes, I am looking to build an application that is capable of connecting multiple devices through the internet. It will be similar to craigslist, but I want to make this as an iOS application. I have very little experience with web services, as the most I've done is pulled an RSS feed onto the screen. How are these things normally done? If it's similar to a message board, is it as simple as having a database in a server/cloud, and giving all users access to it? Or is it more complicated than that? How should I begin to learn more about the backend? What kind of services are usually used in this kind of thing? The only database I've used is Core Data.

    Read the article

  • Only strip commas surrounded by numbers in a string

    - by overlook77
    I am using StreamReader to read each line of a CSV file into a string. As I am processing each line, I need to strip out any commas that ONLY are surrounded by other numbers. For example, if the string was: "textfield1", "textfield2", "100.00", "1,070.00" I would need to only take the comma out of "1,070.00" from this entire string, resulting in: "textfield1", "textfield2", "100.00", "1070.00" Each string read from the CSV file can differ in number of fields, length, etc., so I need to use something (Regular Expressions maybe?) that looks at the entire string without hardcoding a location or blanket removal of all commas. Here is the approach I have been trying: StreamReader sr = new StreamReader(strInputFile); string nextLine = sr.ReadLine(); try { while ((nextLine = sr.ReadLine()) != null) { string rawtext = nextLine.Replace("[0-9]"+","+"[0-9]" , "[0-9]"+"[0-9]"); // ....rest of code } } This obviously doesn't work because I don't understand how to do this :) I am new at C# and inexperienced in Regex, so hopefully this is relatively simple.

    Read the article

  • Android Signal 11 (SIGSEGV)

    - by Naturjoghurt
    I read many posts here and on other sites, but can not find the problem creating my Error: I use an AsyncTask because I want to easily manipulate the UI Thread before and after Execution. In doInBackground I create a ThreadPoolExecutor and execute Runnables. If I only execute 1 Runnable with the Executor, there is no Problem, but if I execute another Runnable I get following Error: 06-26 18:00:42.288: A/libc(25073): Fatal signal 11 (SIGSEGV) at 0x7f486162 (code=1), thread 25106 (pool-1-thread-2) 06-26 18:00:42.304: D/dalvikvm(25073): GC_CONCURRENT freed 119K, 2% free 8908K/9056K, paused 4ms+4ms, total 45ms 06-26 18:00:42.327: I/System.out(25073): In Check All with Prefix: a and Length: 4 06-26 18:00:42.390: I/DEBUG(126): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** 06-26 18:00:42.390: I/DEBUG(126): Build fingerprint: 'google/yakju/maguro:4.2.2/JDQ39/573038:user/release-keys' 06-26 18:00:42.390: I/DEBUG(126): Revision: '9' 06-26 18:00:42.390: I/DEBUG(126): pid: 25073, tid: 25106, name: pool-1-thread-2 >>> de.uni_duesseldorf.cn.distributed_computing2 <<< 06-26 18:00:42.390: I/DEBUG(126): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 7f486162 ... 06-26 18:00:42.538: I/DEBUG(126): memory map around fault addr 7f486162: 06-26 18:00:42.538: I/DEBUG(126): 60292000-60391000 06-26 18:00:42.538: I/DEBUG(126): (no map for address) 06-26 18:00:42.538: I/DEBUG(126): bed14000-bed35000 [stack] I set up the ThreadPoolExecutor like this: // numberOfPackages: Number of Runnables to be executed public void initializeThreadPoolExecutor (int numberOfPackages) { int corePoolSize = Runtime.getRuntime().availableProcessors(); int maxPoolSize = numberOfPackages; long keepAliveTime = 60; final BlockingQueue workingQueue = new LinkedBlockingQueue(); executor = new ThreadPoolExecutor(corePoolSize, maxPoolSize, keepAliveTime, TimeUnit.SECONDS, workingQueue); } I have no clue, why it fails when starting the second Thread. Maybe Memory Leaks? Any Help appreciated. Thanks in Advance

    Read the article

  • Python re module becomes 20 times slower when called on greater than 101 different regex

    - by Wiil
    My problem is about parsing log files and removing variable parts on each lines to be able to group them. For instance: s = re.sub(r'(?i)User [_0-9A-z]+ is ', r"User .. is ", s) s = re.sub(r'(?i)Message rejected because : (.*?) \(.+\)', r'Message rejected because : \1 (...)', s) I have about 120+ matching rules like those above. I have found no performances issues while searching successively on 100 different regex. But a huge slow down comes when applying 101 regex. Exact same behavior happens when replacing my rules set by for a in range(100): s = re.sub(r'(?i)caught here'+str(a)+':.+', r'( ... )', s) Got 20 times slower when putting range(101) instead. # range(100) % ./dashlog.py file.bz2 == Took 2.1 seconds. == # range(101) % ./dashlog.py file.bz2 == Took 47.6 seconds. == Why such thing is happening ? And is there any known workaround ? (Happens on Python 2.6.6/2.7.2 on Linux/Windows.)

    Read the article

  • Update time descriptions every minute using jquery/javascript

    - by Amy Neville
    I have created the following code to update the text contents of all spans like this every minute. There are numerous of these spans on the page which all need to be updated every minute: <span unix="1372263005" class="time_ago">4 minutes ago</span> The code is as follows: window.setInterval(function(){ var unix = $(".time_ago").text(); var now = new Date().getTime(); var amount = 0; var difference = 0; difference = now - parseInt(unix); if (difference < 60) { $(".time_ago").text('<span unix="' + unix + '" class="time_ago">a few seconds ago</span>'); } else if (difference < 120) { $(".time_ago").text('<span unix="' + unix + '" class="time_ago">a minute ago</span>'); } else if (difference < 3600) { amount = floor(difference / 60); $(".time_ago").text('<span unix="' + unix + '" class="time_ago">' + amount + ' minutes ago</span>'); } else if (difference < 7200) { $(".time_ago").text('<span unix="' + unix + '" class="time_ago">an hour ago</span>'); } else if (difference < 86400) { amount = floor(difference / 3600); $(".time_ago").text('<span unix="' + unix + '" class="time_ago">' + amount + ' hours ago</span>'); } else if (difference < 172800) { $(".time_ago").text('<span unix="' + unix + '" class="time_ago">a day ago</span>'); } else if (difference < 2635200) { amount = floor(difference / 86400); $(".time_ago").text('<span unix="' + unix + '" class="time_ago">' + amount + ' days ago</span>'); } else if (difference < 5270400) { $(".time_ago").text('<span unix="' + unix + '" class="time_ago">a month ago</span>'); } else if (difference < 31622400) { amount = floor(difference / 2635200); $(".time_ago").text('<span unix="' + unix + '" class="time_ago">' + amount + ' months ago</span>'); } else if (difference < 63244800) { $(".time_ago").text('<span unix="' + unix + '" class="time_ago">a year ago</span>'); } else (difference >= 63244800) { amount = floor(difference / 31622400); $(".time_ago").text('<span unix="' + unix + '" class="time_ago">' + amount + ' years ago</span>'); } return false; }, 60); EDIT) Ok, now I have made some changes on your advice but it's changing the span texts to 43351 years. Any ideas why it is doing that?

    Read the article

  • Dynamically add rows to listbox

    - by Ivan S
    I have a list box that displays information off of a column of a dataset. I would like the number of rows displayed to be all the rows that are in the dataset (the number of datasets in the rows vary). I'm figuring it has something to do with ListBox.Rows = Dataset.Tables[0].Rows.Count; But it seems to just always default to 4 even when it is only 2. This is what I have in my aspx.cs file. pirateBox.DataTextField = Pirateship.Tables[0].Columns["displayName"].ToString(); pirateBox.DataValueField = pirateship.Tables[0].Columns["PKID"].ToString(); pirateBox.DataSource = pirateship.Tables[0]; pirateBox.DataBind(); pirateBox.Rows = pirateship.Tables[0].Rows.Count; I've been trying a few things and this is what I have so far in .aspx <asp:ListBox ID="pirateBox" runat="server" Rows="1"></asp:ListBox>

    Read the article

  • Using routing (?) to make GET request in Rails so ID doesn't show

    - by ale
    I have a link in one view myapp/locations that goes to myapp/statistics?id=1 (statistics for location with ID 1) which works fine but it doesn't look pretty. I think I've seen people do this sort of thing without needing the ?id=1? I could use a POST but this is not RESTful. Is there a way I can use routing to allow the user to go to myapp/statistics?id=1 but have the user see myapp/statistics? Many thanks.

    Read the article

  • Replace multible data codes in a datafram with names

    - by Shabana
    I have a problem in replacing codes in a dataframe of 3890 observations. My dataframe has a character variable df$IJN which contains values from 1 to 27. I would like to replace these with meaningful data as follow If(1 OR 6 OR 10 OR 14 OR 18 OR 22 OR 26) should be replaced with UL. If(3 OR 7 OR 11 OR 15 OR 19 OR 23 OR 27) should be replaced with LL. If(4 OR 8 OR 12 OR 16 OR 20 OR 24) should be replaced with UR. If(5 OR 9 OR 13 OR 17 OR 21 OR 25) should be replaced with LR. (U,L,R,and L Refer to Upper, Lower, Right, and Left sites in the order) I thought of a for() with if() could not manage with it Also thought of df[which(df=="27")] ="LL" may work one by one not sure! Any help please. R v3.1 - Windows 7 E-H Shabana, Paris.

    Read the article

  • Worklight client-side API to overrideBackButton doesn't work

    - by user2503429
    I want to make something happen when back button is pressed so I put this code in Myhtml.js file : function wlCommonInit(){ /* * Application is started in offline mode as defined by a connectOnStartup property in initOptions.js file. * In order to begin communicating with Worklight Server you need to either: * * 1. Change connectOnStartup property in initOptions.js to true. * This will make Worklight framework automatically attempt to connect to Worklight Server as a part of application start-up. * Keep in mind - this may increase application start-up time. * * 2. Use WL.Client.connect() API once connectivity to a Worklight Server is required. * This API needs to be called only once, before any other WL.Client methods that communicate with the Worklight Server. * Don't forget to specify and implement onSuccess and onFailure callback functions for WL.Client.connect(), e.g: * * WL.Client.connect({ * onSuccess: onConnectSuccess, * onFailure: onConnectFailure * }); * */ // Common initialization code goes here } WL.App.overrideBackButton(backFunc); function backFunc(){ alert('You will back to previous page'); } but after build and deploy the app and I running it, nothing happened after I pressed back button, anybody have the solution ?

    Read the article

  • String generator issue

    - by Andrey
    I want to write a method which returns a string. So far so good. The creation of the string however is quite complicated. I have 3 string lists - the first one has 155 entries, the second one - 9, the third one 21. I want my method if called enough times(155*9*21) to return all the possible combinations of values from the 3 lists (basically this method should keep count on how many times it was called and return only one combination each time). Any ideas how to accomplish that? I have 155*9*22 possible combinations. The first time the method is called it should take List1(0), List2(0), List3(0). After that in the next 21 iterations, the index of the third list is only changed. Once all the elements from the third list have been used increment the index of the second list and so on. Once the method has produced all the possible combinations (155*9*22) I want it to start from the beginning.

    Read the article

  • What does the Facebook Ads API link_click metric indicate in adcampaignstats

    - by Michael Baird
    I would love to get a definitive answer or a glossary that defines the data returned from the Facebook ads api adcampaignstats. Specifically the difference between the actions and inline_actions. Below is the result for a dark post, and I like to know what the "link_click" metric in actions and inline_actions actually counts. i.e. Does this tell me that in total the campaign had 342 links clicked, or does "link_click" in "actions" and "inline_actions" indicate something else? act_{ad_account_id}/adcampaignstats?campaign_ids=[123456] { "is_completed": false, "social_unique_clicks": 0, "topline_id": 0, "unique_impressions": 0, "start_time": null, "campaign_id": 123456, "actions": { "offsite_conversion.registration": 14, "post_like": 2, "like": 5, "photo_view": 1, "link_click": 180 }, "clicks": 301, "inline_actions": { "comment": 0, "video_play": 0, "title_clicks": 0, "like": 10, "rsvp_maybe": 0, "post_like": 13, "photo_view": 0, "rsvp_yes": 0, "link_click": 162, "question_vote": 0 }, }

    Read the article

  • How can I test for an empty Breeze predicate?

    - by Megan
    I'm using Breeze to filter data requested on the client. My code looks a little like this: Client - Creating Filter Predicate var predicates = []; var criteriaPredicate = null; $.each(selectedFilterCriteria(), function (index, item) { criteriaPredicate = (index == 0) ? breeze.Predicate.create('criteriaId', breeze.FilterQueryOp.Equals, item) : criteriaPredicate.or('criteriaId', breeze.FilterQueryOp.Equals, item); if (breeze.Predicate.isPredicate(criteriaPredicate)) { predicates.push(criteriaPredicate); } // Repeat for X Filter Criteria var filter = breeze.Predicate.and(predicates); return context.getAll(filter, data); Client - Context Query function getAll(predicate, dataObservable) { var query = breeze.EntityQuery.from('Data'); if (breeze.Predicate.isPredicate(predicate)) { query = query.where(predicate); } return manager.executeQuery(query).then(success).fail(failure); } Issue I'm having an issue with the request because, if there are no filters set, I apply an "empty" predicate (due to the var filter = breeze.Predicate.and([]) line) resulting in a request like http://mysite/api/app/Data?$filter=. The request is an invalid OData query since the value of the $filter argument cannot be empty. Is there a good way for me to check for an empty predicate? I know I can refactor my client code to not use a predicate unless there is at least one filterable item, but I thought I would check first to see if I overlooked some property or method on the Breeze Predicate.

    Read the article

  • How to process audio in real time?

    - by user1756648
    I am giving some audio input through microphone. I recorded it in Audacity, it looks something like as shown below. I want to process this audio in real time. I mainly want to do this. 1) see real time audio amplitude vs time graph 2) perform some actions based on some thing (like if a specific type of hike is seen in audio, then do something, else do something else) Is there any python module or C library that can allow me to do this ?

    Read the article

  • How long can rails keep Ajax open

    - by Alexey
    My application is suppose to constantly update the page without any user interaction. The criteria is that the page just has to be there, as an extra window on the monitor so the user can see the information get updated real time. I'm using the Ajax in jQuery with Rails, and my question is - how long will the .erb page keep Ajax open? Will there be a point where I have to refresh the page or re-initialize? Or will that won't be a problem at all?

    Read the article

  • How to use jQuery "$.when" method?

    - by Uder Moreira
    I don't understand from jQuery documentation how "$.when" method works. I'm am new in jQuery, so sorry if my question is too simple. I am trying to do something like this: var tableProgress; tableProgress = "<table id='table-progress'><tr><td></td></tr></table>" $.when( $("#send-one").html('done. ' + tableProgress) ).done( function() { $('#table-progress').dataTable(); } ); It does not work, I think it's because .dataTable() pluggin can't find the table so I am trying to use jQuery $.when. What I need is: use .datatable pluggin in a table that is inserted in $("#send-one").html('done. ' + tableProgress) but, using .datatable() directly may not be synchronous to the insertion. I also tryied: $("#send-one").html('done. ' + tableProgress); $('#table-progress').dataTable(); Could you please help me?

    Read the article

  • The Report Application Server failed

    - by huMpty duMpty
    This is relevent to this question about Crystal reports exception: “The Report Application Server failed” I have a report which has a on demand subreport. Id been passed to the subreport from the main report. When I run in crystal report it works fine. But I am running on a application, which display the report using crystal reports viewer.(Winform application developed in vb.net) Most of the times when click on the link whick brings the sub-report it comes up with this message The Report Application Server failed It has no details about what the reason is. Can anyone help? Thanks

    Read the article

  • Data Integration Solution?

    - by Shlomo
    At my company we have a number of data feeds and processing that run on any given day. The number of feeds and processing steps is starting to out-number the ability to manage it ad-hoc as it is managed currently. Is there a good solution that helps with logging and managing/scheduling dependencies? For example: A: When file x is FTP dropped into directory D1, kick off processing step B B: Load flat file into DB1 C: When file y is FTP dropped into directory D2, kick off processing Step D D: Load flat file into DB11 E: When B and D are done, churn through the data, and load new data into DB111. F: When Step E is done, launch application process P G: etc... I want those steps to run at the appropriate times, not to mention if B fails, there's no reason to run steps E & F, but I could still run C & D. When I re-run B successfully, it should trigger just E & F to re-run, not C & D. We're a .NET/C#/Sql Server shop, and I'm already familiar with SSIS. Is that really the best there is? That manages steps well, but not external dependencies, or logging. Open source (.NET) preferred, but not required.

    Read the article

  • Is there a way to get each row's value from a database into an array?

    - by Guyver
    Say I have a query like the one below. What would be the best way to put each value into an array if I don't know how many results there will be? Normally I would do this with a loop, but I have no idea how many results there are. Would I need run another query to count the results first? <CFQUERY name="alllocations" DATASOURCE="#DS#"> SELECT locationID FROM tblProjectLocations WHERE projectID = '#ProjectName#' </CFQUERY>

    Read the article

  • ip6tables TPROXY not working

    - by CookieMunster
    I have a problem, I need to have to run a java program on a port < 1024. authbind and jsvc are no alternatives, it is simply decided not to use. But using ip6tables -t mangle -A PREROUTING -p udp --dport 546 -j TPROXY --on-port 8547 gives me ip6tables v1.4.7: unknown option `--on-port' What did I miss? uname -a Linux vieppetat12 2.6.32-71.el6.x86_64 #1 SMP Wed Sep 1 01:33:01 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >