Posts

Finding datetime difference between lists in python

Image
Clash Royale CLAN TAG #URR8PPP Finding datetime difference between lists in python I'm new to python. I've looked at previous threads like this and this. I have a Series of dates and times that created this way: tp1= for f in files: ### files is the variable that has all the files I need to read in this loop t=f[-19:-5] ### these characters in the filename correspond to the date and time tp1.append(datetime.strptime(t,"%Y%m%d%H%M%S")) time_p1_cr=pd.to_datetime(pd.Series(tp1), format='%Y-%m-%d %H:%M:%S') tp1 looks like: [datetime.datetime(2018, 8, 1, 16, 6, 39), datetime.datetime(2018, 8, 2, 17, 16, 37), datetime.datetime(2018, 8, 3, 10, 53, 46), datetime.datetime(2018, 8, 3, 17, 14, 39), datetime.datetime(2018, 8, 4, 11, 21, 36), datetime.datetime(2018, 8, 4, 17, 27, 54), and so on. time_p1_cr looks like : 0 2018-08-01 16:06:39 1 2018-08-02 17:16:37 2 2018-08-03 10:53:46 3 2018-08-03 17:14:39 and so on. I need to find the successive differences between ...

react-native iOS App receives firebase dynamic links when run in debug scheme but not when run in release scheme

Image
Clash Royale CLAN TAG #URR8PPP react-native iOS App receives firebase dynamic links when run in debug scheme but not when run in release scheme I have integrated the dynamic links sdk using react-native firebase. I tested the deep links by opening the url by tapping on them in a text message which lead to a screen displaying my apps name and the information along with the open button. Tapping the open button took me to the app store's page for my application. I then installed the app using xcode in a debug scheme. The dynamic link was received correctly and everything worked fine. I then did the same process but changed the scheme to release. This time the url received was unfortunately null. I have debugged the native code as well and can see that dynamicLinkFromCustomSchemeURL:url contains the correct deep link in debug scheme but not in release scheme. dynamicLinkFromCustomSchemeURL:url By clicking "Post Your Answer", you acknowledge that you have read our updat...

jQuery .val() return empty string

Image
Clash Royale CLAN TAG #URR8PPP jQuery .val() return empty string I am trying to sum the values of a column table, each time it gets updated. So for that I have this function, that gets executed each time the table inserts or deletes a row, but for now, it's just sending the value to the console: function update_price() $("#table-content tr td:nth-child(3)").each(function() console.log($(this).find("div").val()); ); The HTML code associated with it looks like this: <tbody id="table-content"> <tr class="table-content-line"> <td>9789898818386</td> <td>Fale Menos, Comunique Mais</td> <td> <div class="form-group"> <input type="number" data-number-to-fixed="2" data-number-stepfactor="1" class="auto form-control price" value="12" step=".01"> </div> </td> <td>2</td> <td> <span cl...

Alternative to overflow:hidden doesn't work (calculator display): Javascript

Image
Clash Royale CLAN TAG #URR8PPP Alternative to overflow:hidden doesn't work (calculator display): Javascript I've used a function called scaleFont() in order to make sure that my calculator display never shows more characters than it can hold. Of course I could have used overflow:hidden to achieve that goal, however, that caused the last character to be clipped mid-character, which I wanted to avoid. As such, I've used scaleFont(), to measure the width of the display, the width of the specific characters, and calculate how many characters can be displayed. This works fine whenever I enter a number or an operation sign (+-/*), but this does not work when I push the equation button. Instead, the display will show one character too many (in my case that is 17 characters instead of 16 characters). Does anyone know why that is? let digitsArray = ; let digitsString = ""; let displayOutput = ""; let pressedButtonsArray = ; let pressedButtonsString = ...

How to lose focus with JMenuItem or close JPopupMenu

Image
Clash Royale CLAN TAG #URR8PPP How to lose focus with JMenuItem or close JPopupMenu The following example generates a popup menu. The popup menu contains 2 items. One is a JLabel and the other is a JTextField. When either item is clicked, a simple statement is printed. When the JLabel menu item is clicked, the popup menu goes away. When the JButton menu item is clicked, the popup menu remains. import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.JToggleButton; public class JPopupExample1 public static void main(String argv) throws Exception final JPopupMenu menu = new JPopupMenu(); JFrame frame = new JFrame("PopupSample Example"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JMenuItem item = new JMenuItem("Item Label"); item.addActionListener(new ActionListener() p...

Installing node with homebrew problems mac OS

Image
Clash Royale CLAN TAG #URR8PPP Installing node with homebrew problems mac OS after installing homebrew, after running brew install node brew install node I test with: node --version I get: command not found If I rerun the install command: I get: MacBook-Pro:~ evanloiterman$ brew install node Warning: node 10.9.0 is already installed, it's just not linked You can use brew link node to link this version. MacBook-Pro:~ evanloiterman$ brew link node Linking /usr/local/Cellar/node/10.9.0... Error: Could not symlink include/node/common.gypi Target /usr/local/include/node/common.gypi already exists. You may want to remove it: rm '/usr/local/include/node/common.gypi' brew link node I try brew link node brew link node I get: Error: Could not symlink include/node/common.gypi Target /usr/local/include/node/common.gypi already exists. You may want to remove it: rm '/usr/local/include/node/common.gypi' To force the link and overwrite all conflicting files: br...

How to replace a body in html file

Image
Clash Royale CLAN TAG #URR8PPP How to replace a body in html file I'm using android studio I need to replace the body of an html document with other codes, this is an example that I tried to follow protected void onCreate(Bundle savedInstanceState) super.onCreate(savedInstanceState); setContentView(R.layout.grafico); wv = (WebView) findViewById(R.id.prova); wv.setWebViewClient(new MyWebViewClient()); new BackgroundWorker().execute(); // load links in WebView instead of default browser private class MyWebViewClient extends WebViewClient @Override public boolean shouldOverrideUrlLoading(WebView view, String url) view.loadUrl(url); return false; @RequiresApi(21) @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) view.loadUrl(request.getUrl().toString()); return false; private class BackgroundWorker extends AsyncTask<Void, Void, Void> { @Override protected Void doInBackground(Void... arg0) getDarewod(); return null; ...

CI Build failed at Bitbucket Pipelines CI/CD

Image
Clash Royale CLAN TAG #URR8PPP CI Build failed at Bitbucket Pipelines CI/CD I wanted to add build status badge to my project, just to make it more fancy, I did it with Travis CI in my github repo and works fine (I guess), so I wanted to do the same with a project in Bitbucket using Pipelines integrated addon, but build always fail. This error is the one preventing my to succeed: [ERROR] Failed to execute goal on project pos: Could not resolve dependencies for project com.nubeclick:pos:jar:0.0.1-SNAPSHOT: Could not find artifact javafx:jfxrt:jar:1.8 at specified path /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/ext/jfxrt.jar -> [Help 1] This is the .yml config: image: maven:3.3.9 pipelines: default: - step: caches: - maven script: # Modify the commands below to build your repository. - mvn -B verify # -B batch mode makes Maven less verbose I'm really new into this, one thing led me to another, and now I just want to make this work properly. Pipeline Log Detail I can see ...

How to convert Linq result to Datatable (using datatable not context)

Image
Clash Royale CLAN TAG #URR8PPP How to convert Linq result to Datatable (using datatable not context) How can i convert linq result to data table? Dim result = (From e In dsCart.Tables(0).AsEnumerable() Group e By DistNum = e("DistNum"), DistributorName = e("DistributorName"), SourceID = e("SourceID") Into Group Select New With .DistNum = DistNum, .DistributorName = DistributorName, .TotalOrderAmt = Group.Sum(Function(x) x.Field(Of Decimal)("ExtendedAmt")), .ItemQty = Group.Count(Function(x) x.Field(Of Integer)("ItemQty")) ) I have come across the following method to convert linq var to data table but i am getting error 'The type arguments for method cannot be inferred from the usage' when calling gv.DataSource = ToDataTable(query) private Function ToDataTable(Of T)(collection As IEnumerable(Of T)) As DataTable Dim dt As New DataTable() Dim _t As Type = GetType(T) Dim pia As PropertyInfo() = _t.GetProperties() ...

Is that possible to execute newman collections from jasmine tests

Image
Clash Royale CLAN TAG #URR8PPP Is that possible to execute newman collections from jasmine tests I have written a few api tests using jasmine in node platform. and we have some of the existing api testcases in postman collections. Now we are thinking of executing both the test cases in single execution.. We were able to execute the postman collections through newman commandline tool... So is that possible to execute the newman collections from node platform / from jasmine test cases... Someone please give me some idea on it.. We are badly in need of the combined execution.... Thanks in advance.... We are badly in need of the combined execution.... - why? Looks like XY problem. Even if being possible, wrapping it with Jasmine just provides additional moving parts and impairs efficiency and stability. Usually you don't need test runner for test runner for test runner for test runner... – estus Aug 10 at 21:23 1 Answer 1 You can't use Newman test directly for...

Python class attribute assignment

Image
Clash Royale CLAN TAG #URR8PPP Python class attribute assignment I'm new to Python, and I was wondering why I can't change the attribute for a class instance using a function, if I pass the instance as a function parameter For example, if I had: class sol: def __init__(self): self.val = 0 def fun1(obj, attrib): obj[attrib] = 1 newSol = sol() fun1(newSol, "val") Why can't fun1 change the object attribute? Is there a way to change it, or is the "val" attribute immutable? 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.

ImageView inside ConstraintLayout does not work

Image
Clash Royale CLAN TAG #URR8PPP ImageView inside ConstraintLayout does not work I have a problem with correct display of ImageView. I want to display ImageView inside ConstraintLayout. On preview it looks exactly as i need, but when i'm starting it on device it looks completly dirrerent. This layout is places inside recycle view. What is wrong with this code? <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/promotionRow" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_marginTop="10dp" android:background="#fff" android:layout_marginLeft="10dp" android:layout_marginRight="10dp"> <android.support.constraint.ConstraintLayout android:id="@+id/prom...

Safari adds “localhost” in front of all URLs, why?

Image
Clash Royale CLAN TAG #URR8PPP Safari adds “localhost” in front of all URLs, why? First, a disclaimer: The nature of this problem forces me to publish an affiliate link (to a german fashion shop) here. This is NOT a shady attempt to trick people into using the shop behind, I just need advice in a serious URL breaking problem. The link is classic affiliate, NOT pay-by-click or so. Hope this is clear :) My problem: I'm using affiliate links on a project which I get directly from certain online shops. The links always work fine in all browsers, except safari. Example link: https://partners.webmasterplan.com/click.asp?ref=839072&site=7270&type=text&tnb=74&diurl=//www.mirapodo.de/converse-essentials-winterwool-jogginghose-herren-anthrazit-8519541.html Leads to the correct site in all browsers EXCEPT Safari mobile (iOS 11 and 12) and Safari on macOS High Sierra, which route the browser to: http://localhost//www.mirapodo.de/converse-essentials-winterwool-joggin...

Do stored procedures run in database transaction in Postgres?

Image
Clash Royale CLAN TAG #URR8PPP Do stored procedures run in database transaction in Postgres? If a stored procedure fails in middle, are changes at that point from the beginning of SP rolled back implicitly or do we have to write any explicit code to make sure that SP runs in a database transaction only? possible duplicate of Execute postgreSQL stored procedure as one transaction – Mitch Wheat Jan 31 '15 at 10:05 All covered in the manual. Including the fact that you don't technically have stored procedures in PostgreSQL – Richard Huxton Jan 31 '15 at 12:34 So do you have your answer? – Erwin Brandstetter Aug 10 at 17:05 1 Answer 1 Strictly speaking Postgres does not currently (up to and including version 10) have "stored procedures" as defined in the ANSI standard. Everything is done with "functions" instead, which provide much of the same functionality (and more) as other RDBMS provide with stored procedures. The main differ...

Regex filter is not filtering out network calls/traffic on Charles Proxy when correct regex is used

Image
Clash Royale CLAN TAG #URR8PPP Regex filter is not filtering out network calls/traffic on Charles Proxy when correct regex is used In Charles Proxy, I want to identify all traffic that is not from my test environment so I can easily delete it. When I save my Charles Proxy session, I want it to be as small as possible (and then attach the session file to a JIRA ticket). Currently, JIRA only does not allow files > 30MB and Charles Proxy session files are generally a lot bigger than that. If I copy and paste the 5 network calls listed below into regex101.com and want to find all network calls that do NOT contain the word "charles", the following regex query correctly finds 4 lines: /^((?!charles).)*$/mg 5 sample network calls However, when I enter that same regex query into the filter field on Charles Proxy, it doesn't actually filter out anything. FYI, I have already checked the "Filter uses regex" checkbox in Charles Proxy (via the "Settings" b...

Html Agility Pack Xpath not working

Image
Clash Royale CLAN TAG #URR8PPP Html Agility Pack Xpath not working so when I'm trying to do is parse a HTML document using Html Agility Pack. I load the html doc and it works. The issue lies when I try to parse it using XPath. I get a "System.NullReferenceException: 'Object reference not set to an instance of an object.'" Error. To get my xpath I use the Chrome Development window and highlight the whole table that has the rows which contains the data that I want to parse, right click it and copy Xpath. Here's my code string url = "https://www.ctbiglist.com/index.asp"; string myPara = "LastName=Smith&FirstName=James&PropertyID=&Submit=Search+Properties"; string htmlResult; // Get the raw HTML from the website using (WebClient client = new WebClient()) client.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded"; // Send in the link along with the FirstName, LastName, and Submit POST req...

ASP.NET Boilerplate multiple databases and DbContexts

Image
Clash Royale CLAN TAG #URR8PPP ASP.NET Boilerplate multiple databases and DbContexts I want to connect to two databases at once using ASP.NET Boilerplate. I followed this example: https://github.com/aspnetboilerplate/aspnetboilerplate-samples/tree/master/MultipleDbContextEfCoreDemo The problem is that only the first context will have all the Abp tables on it. The second context is an existing database, which has none of the Abp tables on it. When I start up the web app, I get this: System.Data.SqlClient.SqlException: 'Invalid object name 'AbpLanguages'.' So obviously it is looking for Abp* tables on the second context, but they don't exist there (and they should not). So, what is the correct way to have more than one context, so that it doesn't look for Abp* tables on the second context? Update I have created an example application by modifying a clean ASP.NET Boilerplate project generated from a template. I have tested with a project generated from the ...