Posts

Featured post

algorithm - Graph cut with python: How to set up the graph correctly? -

Image
I want to use graph cut algorithm on images in my project, I use Python 2.7 I found, but the documentation does not seem so obvious. I'm making an example, this is my 5 * 5 matrix: gt; & Gt; An array ([[0, 1, 2, 3, 4], [5, 6, 7, 8, 9], [10, 11, 12, 13, 14], [15, 16, 17, 18, 1] 9 virtual terminal node, S (source) and T , [20, 21, 22, 23, 24]] (sync) matrix The infinite weight for all pixels of the lowest columns on the left and right should be linked to the arcs. Here's what I want to get: This is my code to get it, but it does not work left_most = concatenate ((1, ashp [0]), N.P. Ranges (ashp [0]). Reshape (1, ashp [0])). Unstable (npuit 64 ) left_most = np.ravel_multi_index (Bayan_ most, Asp) right_most = concatenate ((np. that ((1, Asp [0])) size (A, 1) - 1, NP Krenj (Asp [0]). The new size to (1, Ashaip [0])). volatile (Np.uint64) right_most = np.ravel_multi_index (right_most, A.shape) g.add_grid_tedges (Bayan_ most, Anpikons (Bayan_ most. Shaip) *...

regex - PatternSyntaxException: while using String.ReplaceAll function in java? -

When I'm trying to do a string, I get a patterninetex exception. ReplaceAll Below is my string Number of testcases: 39? Test case execution: testCreateDAta? Class has completed its performance: test.com.myspace.service.ejb.session.MyTest? Execution of test case ended: testCreateDAta? Test case execution: testUpdate? What I was trying to do: junitReportString.replaceAll ("?", "\ N"); The above code brought me an exception to: java.util.regex.PatternSyntaxException: Dangling meta character '?' After this I tried again with the code below: junitReportString.replaceAll ("\\?", "\ N"); The code above received me the same string as I mentioned above. My complete code: string junitReportString = new string (); MyApp = New URL ("http: // localhost: port / testWeb / TestJunit.jsp"); URL connection yc = myApp.openConnection (); Yc.connect (); JunitReportString = yc.getHeaderField ("finalJUNITR...

php - String Replace Date & Time -

A line of my XML looks like this: $ ob_time = $ xml- & gt; Observation_time_rfc 822; Echo $ ob_time; Output looks like this: Thursday, 09 October 2014 22:59:16 +0200 But what should I look like 2014-10-09 + 22 % 3A 59 % 3a 16 I think it can do the place of the string, someone can help me find me! Thanks! edit : use a ghost solution, it must be correctly Handles offset timezone First you need to reformat your date. You do this by parsing it with strtotime and formatting it with the date function. They are "URL instead of the funny% 3A" actually are URL-encoded characters: $ date = date ('y-m-d h: i: s', strotom ($ ob_time)); $ Date = urlencode ($ date); // 2014-10-09 + 20% 3A 59% 3A 16

data binding - Set isActive in view model then checkbox is checked -

I need a true or false set for each in the model of the view, check box is checked in the client table or Not checked. I can not apply data-bind with changes. Disabled value Typecript View Model: Class ModelViewModel {products: KnockoutObservableArray & lt; Products & gt ;; Manufacturer () {products = ko.observableArray & lt; Product [] & gt; (); }} Typuscript Model: Product of the Category {Name: Knockout Observe & lt; String & gt; IActive: Knockout Observeable & lt; Boolean & gt ;; } Constructor () {this.name = ko.observable & lt; String & gt; (); This.isActive = ko.observable & lt; Boolean & gt; (); } HTML: & lt; Table class = "table-table-range" & gt; & Lt; Tbody data-bind = "foreach: vm.products" & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "checkbox" id = "chekBx" data-bind = "value: active" & gt; & Lt; / Td> ...

objective c - how Set autolayout for multiple dynamic buttons and labells in iOS? -

I am creating 83 dynamic buttons in my app and setting the label for it. Now, I want to set auto layout for that. How can I set up the automatic layout for this? This is the code that I have implemented to create buttons and labels dynamically: - (void ) Dynamic Button {// Reading data from database NSMutableArray * objectName = [[NSMutableArray alloc] in this]; NSArray * docPaths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString * documentDir = [docPathsObjectAttex: 0]; Self.databasePath = [documentDir stringbappingSpaceContent: @ "SMS.sqlite"]; FMDatabase * Database = [FMDatabase database path: self.databasePath]; [Database logs error: TRUE]; [Database open]; // FMResultSet * Result = [Database Execution: @ "Select from SMS Card"]; NSString * anQuery = [[NSString alloc] initWithFormat: @ "SELECT * FROM SMSCategory"]; FMResultSet * Result = [Database Execution: anQuery]; While ([result next]) {SMSCat1...

simple html dom - Issue in Passing Url in PHP -

I am doing some operations in the URL below. $ paginationPages = array (); $ ProductCount = intval ($ htmlProductPage- & gt; Search ('div.paging span.itemcount', 0) -> plain text); If ($ ProductCount / 16 & gt; 1) {$ pagecount = ceil ($ ProductCount / 16); For ($ i = 2; $ i & lt; = $ PageCount; $ i ++) {$ urlSplitArray = Explosion ('.', $ ProductUrl); $ UrlSplitCount = Count ($ urlSplitArray); $ UrlSplitArray [$ urlSplitCount-2] = "[" $ i .. "]". $ Endorsement page [] = intestine ('.', $ UrlSplitArray). "& Lt; br & gt;"; } #print_r ($ paging page); } and I'm getting all the links in the foreach to proceed foreach ($ paginationPages page $ next URL) {# $ nextUrl = " Http: //www.100percent.co.nz/kitchen-and-cooking/ovens/freestanding[2].htm "; $ HtmlProductPage = file_get_html ($ nextUrl); Foreach ($ htmlProductPage- & gt; Find ("div.Item") as $ element) {// error is here...

graphics - Conditional Background of a plot in R -

Image
I want to know how to make such a conditional background background This time this can be calculated by series or any other For example, for example, I have two series when the value of the first is positive, the background value on the second plot is green, otherwise it is red. Here's a way to do this. x