Posts

Angularjs: ng-model setting value from controller

Angularjs: ng-model setting value from controller how to set value of ng-model with dot from controller? <input type=text" ng-model="user.latitude"> this doesn't work: $scope.user.latitude = myLat; use $scope.user = {latitude: myLat}; in your controller – guru Jun 4 '14 at 15:24 3 Answers 3 You need to create user object first: user $scope.user = {}; $scope.user.latitude = myLat; or shorter: $scope.user = {latitude: myLat}; yes, but this will clear other values of user, for example 'ng-model="user.name"', how to edit only 'user.latitude'? – user1824542 Jun 4 '14 at 15:35 ...

How to produce metrics of URI correctly in spring boot 2 + webflux

How to produce metrics of URI correctly in spring boot 2 + webflux I have a problem using spring boot 2.0.3 + spring webflux (functional endpoints) + metrics. According to the official doc: The generated metrics of uri should be the request’s URI template prior to variable substitution Which means instead of /api/person/123, the generated metrics of URI should be something like /api/person/{id}. However, when I query those metrics on my spring boot app with this link http://localhost:8080/actuator/metrics/http.server.requests, I got these URIs: /api/person/2 /api/person/33 /api/person/12 To reproduce this issue, I put a sample code here: https://gitlab.com/itsleon/demo Can someone please shed some light on this issue? Thanks in advance! 1 Answer 1 There's an open issue for that in Spring Boot. Currently, Spring WebFlux fn doesn't provide the information about the URI pattern that matched fo...

C# EPPLUS: Autosizing columns to the max autosize not working

C# EPPLUS: Autosizing columns to the max autosize not working I'm generating a number of excel documents with EPPlus and I'm running into some difficulties with the formatting. I have used xlWorkSheet.Cells.AutoFitColumns(); and this seems to work for the data, but does not autosize for the column names. For instance I will open up the file and I can see the column names bunched up. I can also click on the border of a column and it will expand the column more. In fact I can do this about 5 times before it seems to reach its maximum for autosizing. Essentially I want to programmatically set each column so that it's at this maximum (I've even tried applying AutoFitColumns multiple times, however this made no difference). Is there a way to do this? Note that I can't just hardcode the column widths as I'm trying to reuse the same code for multiple files. EDIT: Here's my code generalised private void GeneralTest() { var ReportName = "myReport" i...

PHP register check for user in database [closed]

PHP register check for user in database [closed] I created a function that checks for user in database but when I type the email that exists, it returns the message, and then, on second try can't proceed to register function, can't get rid of error, here is my try: if(!filter_var($email, FILTER_VALIDATE_EMAIL)) { $email_error = "Invalid email format"; } else if($user->doesUserExist($email) > 0) { $email_error = "Email is already taken"; } else { $email_error = ""; } if(empty($error) && empty($email_error) && empty($confirm_password_error)) { $user->register($username, $name, $email, $password); } It's not problem with register function. Here are the class functions: public function doesUserExist($email) { $query = "SELECT count(*) FROM users WHERE email = :email"; $stmt = $this->connection->prepare($query); $stmt...

How to force to do when button clicked from other activity

How to force to do when button clicked from other activity I want to toDo() work App.class (AllActivity) when button clicked from other example.class.(Activity) public class Otherclass extend AppCompatActivity{ Button example = (Button)findViewById(R.id.option_language); example.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { example.isChecked(); } }); } public class App extends Application { @Override public void onCreate() { super.onCreate(); ToDo(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); toDo(); } public void toDo() { if(new OtherClass().example.isChecked()) { // To do something. } } } } I wanted to do it. But, I got java.lang.NullPointerException: .isChecked()' on a nu...

how to save two plots simultaneously in gnuplot

how to save two plots simultaneously in gnuplot Hiii... I havebeen trying to plot two curves simultaneously in a single plot to compare them. ie, by the command: plot "1.txt" w l, "2.txt" w l now I want to save it, but the usual command for saving is: set out "1.txt" but in this case how can I save them together in a same plot? Please click edit under your question and prefix lines of code with 4 spaces. Or select multiple lines of code with the mouse and click the {} formatting button. Welcome to SO. – Mark Setchell Jul 2 at 10:16 edit {} 1 Answer 1 For saving a plot as a file on your disk, you need to setup two things: a terminal and an output . Suppose you have configured your plot interactively in a command-line gnupl...

blocking Step vs Block this step until steps finish in Pentaho transformation

blocking Step vs Block this step until steps finish in Pentaho transformation What is the use case of blocking step in Pentaho Transformations ? In which scenarios we will be using this step in Pentaho transformations. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Slick slider different autoplay for each slide

Slick slider different autoplay for each slide I have a slick carousel with both an image and a video, I have it so when it reaches the video it autoplays and when it finishes it goes to the image. What I would like is to have autoplay and autoplay speed only for the image and not for the slide with the video as when the video finishes it's waiting for the autoplay speed to finish and then move to the image which doesn't look right. Is there a way to set the autoplay speed to 0 for the video slide...You can see the carousel in action here: http://foley13.webfactional.com/grid-website/carousel-test/ Here is my javascript for the slider: jQuery(function($){ var slider = $('.homeslider').slick({ slidesToShow: 1, slidesToScroll: 1, arrows: false, fade: true, autoplay: true, autoplaySpeed: 1000, initialSlide: 1, }); slider.on('afterChange', function(event, slick, currentSlide) { var vid...

WCF - Store and restore UTC DateTime

WCF - Store and restore UTC DateTime We expose to our customer a WCF webservice allowing them to store DateTime in SQL Server databases. Extract of the WSDL : <xs:complexType name="TimePeriod"> <xs:sequence> <xs:element minOccurs="0" name="endDateTime" nillable="true" type="xs:dateTime"/> <xs:element minOccurs="0" name="startDateTime" nillable="true" type="xs:dateTime"/> </xs:sequence> For exemple, my customer send me UTC Datetime : <af:effectivePeriod> <af:startDateTime>2018-01-16T10:32:28Z</af:startDateTime> </af:effectivePeriod> This is stored in a SQL Server database in a datetime field. datetime But in the output of the read service, I don't have the UTC indicator : <af:effectivePeriod> <af:startDateTime>2018-01-16T10:32:28</af:startDateTime> </af:effectivePeriod> "Z" is kind of a unique...

Xcode Download? [closed]

Xcode Download? [closed] I just upgraded to OS X Mavericks, and I am very excited to be able to use all the new Mavericks technologies. I have just one problem: Where can I download Xcode? It is not listed in either the updates page in the Mac App Store, or at Apple’s developer website. Please tell me that I do not have to be a paid developer-program subscriber to download this update! The real problem is not with Xcode itself, but rather with the 10.9 SDK. Without the header files in the SDK, I cannot tell what the APIs are. As I do not know what the APIs are, I cannot use any developer tool (even those not based on Objective-C). I also noticed that Apple has not yet updated the Mac Dev Center with info for Mavericks, despite its public release. It is entirely probable that Apple is simply lagging behind with updating the developer website following today’s announcement. This question appears to be off-topic. The users who voted to close gave this specific reason: ...

Creating folder in python [duplicate]

Creating folder in python [duplicate] This question already has an answer here: I want to create a folder after an hour of the current time in python. I know how to get the current time and date and to create a folder. But how to create a folder at a time specified by me. Any help would be appreciated. from datetime import datetime from datetime import timedelta import os while True: now = datetime.now () #print(now.strftime("%H:%M:%S")) y = datetime.now () + timedelta (hours = 1) #print(y.strftime("%H:%M:%S")) if now== y: os.makedirs (y.strftime ("%H/%M/%S")) will this work? EDIT :- I have to run the code continuously i.e. creating folders at every instant of time This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. If you plan on doing something else in the mean while (I guess you do) you will need some thread to...

PostgreSQL: Which Datatype should be used for Currency?

PostgreSQL: Which Datatype should be used for Currency? Seems like Money type is discouraged as described here Money My application needs to store currency, which datatype shall I be using? Numeric, Money or FLOAT? If you have read the whole thread, Numeric is the way to go. – razpeitia Mar 31 '13 at 5:10 5 Answers 5 Numeric with forced 2 units precision. Never use float or float like datatype to represent currency because if you do, people are going to be unhappy when the financial report's bottom line figure is incorrect by + or - a few dollars. The money type is just left in for historical reasons as far as I can tell. That's not why you avoid floating point. Even Numeric will have rounding errors if you divi...

Check if two lines (each with start-end positions) overlap in python

Check if two lines (each with start-end positions) overlap in python I have the following two sets of position each correspond to the start and end position: line T: t1-t2 (t1 = start_pos, t2 = end_pos) line S: s1-s2 (s1 = start_pos, t2 = end_pos) I want to write the algorithm in Python to check if T intersect with S. Example 1: t1-t2=55-122 and s1-s2=58-97 s1------------s2 t1-----------------t2 This should return True Example 2: t1-t2=4-66 / t1-t2=143-166 and s1-s2=80-141 s1----s2 t1--t2 t1---t2 Both instances of T should return False But why this code failed: def is_overlap(pos, dompos): """docstring for is_overlap""" t1,t2 = [int(x) for x in pos.split("-")] s1,s2 = [int(x) for x in dompos.split("-")] # Here we define the instance of overlapness if (t1 >= s1 and t2 >= s2) or (t1 >= s1 and t2 <= s2) or (t1 <= s1 and t2 >= s2) or ...

Northwind database | SQL query that returns employees and who they report to

Northwind database | SQL query that returns employees and who they report to I am trying to write a query for the Northwind database that lists the employees and their manager's names, without including employees who have no one to report to. Here is what I have so far: SELECT employees.firstname, employees.lastname, superior.firstname, superior.lastname FROM employees LEFT OUTER JOIN employees superior ON employees.reportsto = superior.employeeID WHERE employees.reportsto <> null; This query runs, but nothing appears. Sorry about the checking and unchecking the answer buttons for you guys repeatedly! I thought that I could pick more than one answer. 😥 – Help pls Apr 17 '17 at 13:47 Tip of today: Declare table aliases for both employees instances, to make the code clearer. – jar...

Standard JSON format for PHP

Standard JSON format for PHP I am storing data in JSON files with array of JSON objects. Right Now I am doing like [{"key1":"value1","key2":"value2"}] Is this universally accepted. ? If so which Tech Lead company supports this format . JSON is universal data format. So it is supported. In your case, however, json is incorrect as it uses single quotes. Correct json uses double quotes. More info on json.org. – u_mulder Jul 2 at 10:09 Okay ... let me correct that .. And thanks for opening the eyes of beginner – Manjunath Jidagi Jul 2 at 10:12 1 Answer 1 ...

Selenium search by tag name option

Image
Selenium search by tag name option I'm trying to get all data from a website called Correios, in this website, I need to handle some dropdowns wich i'm having some issues like: It's returning a list with a bunch of empty strings. That's my code: chrome_path = r"C:\Users\Gustavo\Desktop\geckodriver\chromedriver.exe" driver = webdriver.Chrome(chrome_path) lista_x = driver.get("http://www2.correios.com.br/sistemas/agencias/") driver.maximize_window() dropdownEstados = driver.find_elements_by_xpath("""//*[@id="estadoAgencia"]""") optEstados = driver.find_elements_by_tag_name("option") for valores in optEstados: print(valores.text.encode()) And what i get from that is: b'' b'ACRE' b'ALAGOAS' b'AMAPxc3x81' b'AMAZONAS' b'BAHIA' b'CEARxc3x81' b'DISTRITO FEDERAL' b'ESPxc3x8dRITO SANTO' b'GOIxc3x81S' b'MARANHxc3x83O' b...