ionic horizontal scroll bar and toggle menu Posted: 04 Jun 2021 08:01 AM PDT I create a horizontal scroll bar it works fine but it stop working when adding a toggle menu i want to use both menu and scroll bar in the same page . how can i handle it? her what i am trying to do: <ion-header [translucent]="true" > <ion-toolbar class="header"> <ion-title class="title"> New AD </ion-title> <ion-buttons slot="start"> <ion-menu-button autoHide="false"></ion-menu-button> </ion-buttons> </ion-toolbar> </ion-header> <ion-content [fullscreen]="true" > <div style="width:100%; height:50px" > <ion-row nowrap class="headerChip"> <div *ngFor="let tabName of product_type; let idx = index" > <ion-chip > <ion-label >{{tabName}}</ion-label> <div></div> </ion-chip> </div> </ion-row> </div> <ion-split-pane > <ion-menu side="start" menuId="first" contentId="main"> <ion-header> <ion-toolbar color="primary"> <ion-title>Start Menu</ion-title> </ion-toolbar> </ion-header> <ion-content> <ion-list> <ion-menu-toggle> <ion-item>Menu Item1</ion-item> </ion-menu-toggle> <ion-menu-toggle> <ion-item>Menu Item2</ion-item> </ion-menu-toggle> </ion-list> </ion-content> </ion-menu> <ion-router-outlet id="main" main></ion-router-outlet> </ion-split-pane> </ion-content> |
Do duplicate values in the JOIN key affect the result returned? Posted: 04 Jun 2021 08:00 AM PDT I have 2 queries that looks like this. QUERY 1 SELECT a.utype, DATE_TRUNC(b.date, DAY) AS date, (b.noofspec) FROM table1 as a JOIN table2 as b ON a.joinkey = b.joinkey GROUP BY 1, 2, 3 ORDER BY 2; QUERY 2 SELECT a.utype, DATE_TRUNC(b.date, DAY) AS date, SUM(b.noofspec) FROM table1 as a JOIN table2 as b ON a.joinkey = b.joinkey GROUP BY 1, 2, 3 ORDER BY 2; I am expecting that (b.noofspec) of QUERY 1 would somehow have a TOTAL with same value as SUM((b.noofspec). However, it returned a completely different value. My table looks like this Table B Table A After the second query, I know that the first one is not correct too. How should I go around it? |
Xarray open_mfdataset is very slow Posted: 04 Jun 2021 08:00 AM PDT Xarray open_mfdataset is a fantastic tool, but I haven't been able to make it work efficiently. I am opening multiple netcdfs each around 2GB for a total of 13GB. I have the data on an SSD, so it should open pretty quickly, however, it takes approx. 791 seconds to open the files. Any suggestions on how to speed this up? I have run several dozen tests with different options and different chunk sizes to try to zero in on the problem with no luck. Below is my code I use to open the data: UKESM_historical = xr.open_mfdataset(folder + r'\ukesm1-0-ll_r1i1p1f2_w5e5_historical_' + variable + '_global_daily_*.nc', concat_dim="time", data_vars='minimal', coords='minimal', compat='override', parallel=True, decode_cf = False, chunks={'time': 365}) # 791 seconds |
MySqlPool quarkus reactive client doesn't autoclose Posted: 04 Jun 2021 08:00 AM PDT I am using quarkus-narayana-jta for transaction management and using reactive MysqlPool to insert into db. MysqlPool class is not Autoclosable so do we need to explicitly call close() method from Pool class to close in case failure occurs or is it fine to just print the error message to the log and let transaction manager rollback the entire transaction in case failure occurs. What will be the impact if in case MySqlPool is not closed explicitly. @Transactional public Uni<String> insertIntoDb(BaseLog baseLog) { LocalDate currentDate = LocalDate.now(); int year = currentDate.getYear(); if (baseLog instanceof RequestLog) { prepareRequestLogData(baseLog, currentDate, year); } if (baseLog instanceof ResponseLog) { prepareResponseLogData(baseLog, currentDate, year); } return mysqlPool.preparedQuery(query).execute().onItem() .transformToUni(id -> mysqlPool .query("SELECT TRAN_ID FROM " + tableName + " ORDER BY TO_DB_TS DESC LIMIT 1").execute()) .onItem().transform(rows -> rows.iterator().next().getString(0)).onFailure().invoke(f -> { LOG.error("Error while inserting data to " + tableName + " table::" + f.getMessage()); }); } |
Convert Binary to decimal predicate Posted: 04 Jun 2021 08:00 AM PDT convertBinToDec(B,D):- atom_number(S,B), atom_length(S,L), sub_atom(S, 0, 1, After,S1), atom_number(S1,N), L1 is L-1, sub_atom(S, 1,L1, After ,S2), atom_number(S2,B2), convertBinToDec(B2,D1), D is D1+((2*N)**L1). convertBinToDec(0,0). convertBinToDec(1,1). The predicate takes B which is Binary number in integer form and should return D its corresponding decimal form ,Sorry I am still new to declarative programming languages but I don't know why my code above is always giving false, I feel there is something wrong with base case Also it is not allowed to use prolog Libraries |
Best Node package for recording/playing back http interactions for cucumber testing? [closed] Posted: 04 Jun 2021 08:00 AM PDT I have a Node/React SPA which makes requests to a rails api to load the data. I wrote cucumber js feature tests for the ui which rely on axios requests made to the api. I'd like to be able to record the http interactions so the tests can be run without having to have an instance of the api running. Basically looking for a node equivalent to the ruby vcr gem. I've looked into projects such as vcr.js, yakbak, node-replay, and nock, but none seem to do what I'm looking for. I need something that doesn't run as a separate service like yakbak, and something that allows you to record the interactions and play them back rather than specifying the expected response like in nock. Node-replay looks to be what I want but it doesn't seem to detect http requests made in the react code. Am I missing something with one of these libraries? Or is there another way of doing this? Any suggestions are greatly appreciated! Thank you! |
how to get output by date Posted: 04 Jun 2021 08:01 AM PDT Newbie to sql: I have the following query that results in an output that has the same date range in multiple rows. I'd like to merge those results into one single row. how can i do this? SELECT (sum(likes + comments + video_views)/ sum(influencer_starting_followers)) as ER, Left(post_date,7) as Date from `public_sponsored_instagram_posts` GROUP BY post_date Chart output ER | Date | 0.04 | 2019-02 | 0.06 | 2019-02 | DESIRED OUTPUT: |
Capture Groups with Multiple Delimiters Posted: 04 Jun 2021 08:00 AM PDT In Javascript, I have ascii text lines, and each line can have multiple groups of $ delimited text, as shown below. Input Text: In the quadratic polynomial $ax^2 + bx + c$, $a$ should not be $0$ I need a performant way of creating an array, which should have either words or the delimited string. For example, after parsing the above line, I need to end up with Desired Result: ["In", "the", "quadratic", "polynomial", "$ax^2+bx+c$", "," "$a$", "should", "not", "be", "$0$] Pattern that is not helping: "\\$(.|\v)*?\\$" Basically, I need to parse the string and pull out words which are space or tab separated, but I have to treat $ delimited text as a single word. But that is really the end of my wits. Please help :-) |
add name instead of id foreign key from table and search by value an input Posted: 04 Jun 2021 08:00 AM PDT i get an error Notice: Undefined index: nomClient in C:\wamp64\www\styleprojet\ajoutcaut.php on line 60 i want to add nameClient in table insted of idClient(foreign key) i have two table caution and client and search by value in input, it works in other fields but not in nameClient $valuetosearch=$_POST['valuetosearch']; $nomClient="select nameClient from caution c join client cl on c.idClient=cl.idClient"; $query="select * from caution where concat (`NumCaution`, `NumAppeloffre`, `dateheurAppeloffre`, `statut`, `dureeCaution`, `Montant`, `DateCaution`, `$nameClient`) like '%".$valuetosearch."%'"; $search_result=filtertable($query); echo"errooor"; }else { $query="select * from `caution`"; $search_result=filtertable($query); echo "good"; } //funtcion search value function filtertable($query){ $connect=mysqli_connect("localhost","root","","axelidb"); $filter_result=mysqli_query($connect,$query); return $filter_result; }``` the code html to add nameClient: ```<?php while($row=mysqli_fetch_array($search_result)): ?> <tr> <td > <?php echo $row['nameClient'];?> </td></tr>``` |
Css fit children elements to parent height Posted: 04 Jun 2021 08:01 AM PDT I want to create a profile-like page. The contents would be like: <profile_entry_name> |<textfield_to_edit_entry>| So I have something like this: <div className="row"> <p>First name</p> <TextField variant="outlined" /> </div> To make everything appear on the same line I did: .row { display: flex; flex-direction: row; height: 20px; } The height: 20px; is key here. It doesn't have to be 20px , I put this value to check if it works properly. The problem is: - even the paragraph doesn't respect its parent
height param - it appears below - the textfield behaves the same way
It looks like this: Can I somehow change this behavior? I want those to be of equal height (specified by the parent), because I will have many rows like this and I want them to look nice. P.S TextField is a MUI component, but it doesn't really matter I guess, I can style it as well, maybe just by using !important on some css props. |
Why my backgroung-image is not displaying in website? Posted: 04 Jun 2021 08:01 AM PDT My HTML CODE: <div class="top__background-1"> <div> <h1>NRRN CONCRETE UDHYOG</h1> </div> </div> MY CSS CODE: /* linear-gradient is displaying but image is not being displaying */ .top__background-1 { color: rgb(0, 0, 0); height: 40rem; background-size: cover; background-image: linear-gradient(#355b7d98, #355b7d93), url(/Images/cover.jpg); } .top__background-1 h1 { position: absolute; top: 20rem; font-size: 5rem; font-weight: bolder; color: white; font-family: 'Oswald', sans-serif; } |
Calculate total price in a view Posted: 04 Jun 2021 08:00 AM PDT I am a newbie to elixir and what I'm trying to do is calculate the total price of items in the user's cart and display it in the cart page. I wrote a function which is a mix of functions I found on the internet. I would appreciate any help! Here is my index.html.eex for shopping cart <h1>Your Cart</h1> <%= if @books do %> <ul> <%= for book <- @books do %> <li> <%= book.title %>: £<%= book.original_price %> <%= link "X", to: Routes.cart_path(@conn, :delete, book_slug: book.slug), method: :delete %> </li> <% end %> </ul> <% else %> <p>No books in your cart</p> <% end %> <%= total_price(@books) %> And the cart_view def total_price(books) do shipping = 5.99 price_with_shipping = Enum.reduce(books, fn book, acc -> %{total_amount: book.original_price + acc.total_amount + shipping} end) |> Map.get(:total_amount) text = "Total amount: #{price_with_shipping}" end In the end, it only displays this part - "Total amount: " without the calculated price with shipping. |
Excel JSON VBA Parsing - Determining if an array is empty Posted: 04 Jun 2021 08:00 AM PDT I am trying to parse a JSON response. I cannot use the VBA-JSON library. I need to check to see if a nested array is empty or null. I keep getting this error: Example JSON: { "gardenAssets": [], "gardenAssetsAlertCount": 0, "gardenAssetsCount": 0, "gardenAssetsErrorCount": 0, "locationsSummaries": [ { "locations": [ { "auditOrder": "102", "code": "POT 102", "name": "POT 102", "type": "ProcessingLocation", "gardenAssets": [ { "annotation": "Pallets", "broker": { "code": "TMTO", "isOwner": null, "name": null, }, "datetimeOfArrivalIngarden": 1622754283.937, "id": "crusaf", "isSealable": true, "load": null, "mastergardenCode": null, "name": null, "owner": { "code": "SUN", "isOwner": null, "name": null, }, } ], }, { "auditOrder": "103", "code": "POT 103", "description": "POT 103", "id": "110746", "name": "POT 103", "type": "ProcessingLocation", "gardenAssets": [], }, { "auditOrder": "104", "code": "POT 104", "name": "POT 104", "gardenAssets": [ { "annotation": "Soil", "broker": { "code": "OTHR", "isOwner": null, "name": null, }, "datetimeOfArrivalIngarden": 1622571699.767, "id": "arserana", "isSealable": true, "load": null, "mastergardenCode": null, "name": null, "owner": { "code": "WTR", "isOwner": null, "name": null, }, } ], }, { "auditOrder": "111", "code": "POT 111", "name": "POT 111", "type": "ProcessingLocation", "gardenAssets": [ { "annotation": null, "broker": { "code": "CLD", "isOwner": null, "name": null, }, "datetimeOfArrivalIngarden": 1622746446.932, "id": "Bacrea", "isSealable": true, "load": null, "mastergardenCode": null, "name": null, "owner": { "code": "ICE", "isOwner": null, "name": null, }, "status": "EMPTY", "type": "JUNK", "unavailable": false, "visitId": "1003768526", } ], }, ], "logingarden": true, "mastergardenCodes": [], "gardenCode": "FUN5" } ], "offsitegardens": [], "gardenAssetsInTransit": []} Code: Option Explicit Dim S as Object, k, Ks as Object Set S = CreateObject("ScriptControl") S.Language = "JScript" S.addcode "function k(a){var k=[];for(var b in a){k.push('[\'' + b + '\']');}return k;}" S.Eval ("var J = " & http.ResponseText) S.Eval ("var L = J.locationsSummaries['0'].locations") Set Ks = S.Eval("J.locationsSummaries['0'].locations") For Each K In Ks If Not IsNull(S.Eval(K.gardenAssets)) = True Then Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1) = "Assets" End If Next K I need to pull different information out of the JSON depending on if there are any gardenAssets. But I can't seem to check to see if the array is empty or not. |
descriptive statistics of multi level categorical data in python Posted: 04 Jun 2021 08:01 AM PDT Below is an example of a df that contains three columns, each with multi-level categorical data. I want to calculate some descriptive statistics across the three columns per level within the column - for instance the number of people per age group in each location and status, including counts, proportions, and standard deviations (which i suppose should actually be a confidence interval here). But I am not sure how to do it in an elegant way. Any advice is really appreciated, thanks so much birth_year = pd.DataFrame(([random.randint(1900,2000) for x in range(50)]), columns = ['year']) from datetime import date def age(df,col): today = date.today() age = today.year - df[col] bins = [18,30,40,50,60,70,120] labs = ['-30','30-39','40-49','50-59','60-69','70+'] group = pd.cut(age, bins, labels = labs) return(group) birth_year.loc[:,'age_bin'] = age(birth_year,'year') location = pd.DataFrame((Rand(1, 6, 50)), columns = ['location']) def label_loc (row): if row['location'] == 1 : return 'england' if row['location'] == 2 : return 'ireland' if row['location'] == 3: return 'scotland' if row['location'] == 4: return 'wales' if row['location'] == 5: return 'jersey' if row['location'] == 6: return 'gurnsey' return 'Other' location = location.apply(lambda row: label_loc(row), axis=1) def Rand(start, end, num): out = [] for x in range(num): out.append(random.randint(start, end)) return out status = pd.DataFrame((Rand(1, 6, 50)), columns = ['status']) def label_stat (row): if row['status'] == 1 : return 'married' if row['status'] == 2 : return 'divorced' if row['status'] == 3: return 'single' if row['status'] == 4: return 'window' return 'Other' status = status.apply(lambda row: label_stat(row), axis=1) df = pd.DataFrame(list(zip(birth_year["age_bin"], status, location)), columns =['year', 'gender', 'ethnicity']) |
Compare 2 lines direction Posted: 04 Jun 2021 08:01 AM PDT I have points of line as line1 = (13.010815620422363, 6.765378475189209), (-9.916780471801758, 12.464008331298828) line2 = (-28.914321899414062, 2.4057865142822266),(13.973191261291504, -8.306382179260254) Basically line1 and line2 are 2 lanes on a road which are traveling in opposite direction, I want to know if its in opposite direction or not programmatically Is there is a way to get the line direction from some formula or code(python)? |
React router blank page for subroutes on apache Posted: 04 Jun 2021 08:02 AM PDT I have an app created with create-react-app that I want to deploy in my apache server. When I tried to access my react app running on my server, i had an error 404 on every routes created with react-router. Then i added a .htaccess file in my app directory with the following rules : Options -MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.html [QSA,L] Now i'm able to reach the simple routes, like http://mywebsite/myroute. But when I try to reach nested routes like http://mywebsite/myroute/subroute I've got a blank page with the following errors : Uncaught SyntaxError: expected expression, got '<' and The stylesheet https://mysite/test/static/css/main.85d72dcf.chunk.css was not loaded because its MIME type, "text / html", is not "text / css" This happen only when i try to reach a subroute, even if the routes are just html without any css. I can't find any clue on the web, so any help would be much appreciated. |
How to call different Flutter functions based on firebase querySnapshot result Posted: 04 Jun 2021 08:00 AM PDT Using Flutter, I would like to search a Firebase collection (Collection X) to find out if a field (Field Y) exists in any document in said collection. If the document containing the field exists I would like to perform a task ( Task A ), If a document containing the field doesn't exist I would like to perform a different task ( Task B). Here's what I've tried: final CollectionReference collectionXRef = FirebaseFirestore.instance.collection("Collection X") collectionXRef.where("Field Y", isEqualTo: Z) .get().then((QuerySnapshot querySnapshot) { if (querySnapshot.docs.length > 0) { Task A } else { Task B } }) The issue I'm having is that no matter what I put in the If statement: (querySnapshot.docs.length > 0) The code keeps performing Task A Here's what I've tried: if (querySnapshot.docs.isEmpty) if (querySnapshot.docs.isNotEmpty) if (querySnapshot.docs.length > 0) if (querySnapshot.docs.length != 0) if (querySnapshot.size > 0) if (querySnapshot.size != 0) if (querySnapshot.size == 0) if (querySnapshot.size >= 1) The problem is: I am trying to perform "Task B" if there is no document In the collection that contains the searched field, however, the function always returns Task A, which work fine if there are results to display, but, If there aren't any results it shows a blank results page instead of performing Task B. |
Hi can anyone help me with this simple task? Posted: 04 Jun 2021 08:00 AM PDT i have the following code in react native , let pub=''; let x= ''; // global variables setInterval(() = { const value = await AsyncStorage.getItem('users');//read data from async storage pub= JSON.parse(value); for (let i = 0; i < pub.length; i++) { x = pub[i].id; console.log('value of id >>', x);} // the value of x is printed every 30 secs,if there are 3 values of x as 1,2,3 // I want 1 to be printed first 30 secs ,2 next 30 sec, 3 to be priint next 30secs and again goback to 1 and so on..how to do ? },30000) i want value of id to be printed every 30 seconds incrementing for example, if x has 1,2,3 i want 1st 30 sec 1 to be printed, i want 2nd 30 sec 2 to be printed , 3rd 30 sec 3 to be printed and repeat the same ... |
Using Vulkan to sample from Android Camera2 hardware buffer - Issue with image formats Posted: 04 Jun 2021 08:01 AM PDT I'm currently working on an app in C++ using the Android ndk, and I need to create a sampler to access the camera output image. I have done this using the AIMAGE_FORMAT_YUV_420_888, and using the VkSamplerYcbcrConversion for accessing the image in the hardware buffer. I do the yuv -> rgb conversion in a shader, and it all looks good on my phone. I have since discovered that this doesn't work on Samsung phones, in my case specifically the Samsung Galaxy S10/S10+. The reason is that when I set up an image reader with the AIMAGE_FORMAT_YUV_420_888 I get a camera error using Samsung. On my OnePlus and on another phone I tried the pipeline worked entirely as expected. I created a very simple test setup to even try to open the camera with that image format in the ImageReader on Samsung S10 and got the error, but when I changed the ImageReader format to AIMAGE_FORMAT_JPEG the error went away and the camera seemed to start as expected. AImageReader* SimpleCamera::CreateJpegReader() { AImageReader* reader = nullptr; // media_status_t status = AImageReader_new(640, 480, AIMAGE_FORMAT_JPEG, //AIMAGE_FORMAT_RGBA_8888 //media_status_t status = AImageReader_new(640, 480, AIMAGE_FORMAT_RGB_565,4, &reader); media_status_t status = AImageReader_newWithUsage(640, 480, //AIMAGE_FORMAT_RGBA_8888, //AIMAGE_FORMAT_RGB_565, //AIMAGE_FORMAT_RGB_888, AIMAGE_FORMAT_JPEG, AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE | AHARDWAREBUFFER_USAGE_CPU_READ_RARELY, 4, &reader); if (status != AMEDIA_OK) { LOGE("Couldn't create new image reader"); return nullptr; } AImageReader_ImageListener listener{ .context = nullptr, .onImageAvailable = imageCallback1, }; AImageReader_setImageListener(reader, &listener); return reader; } None of the other formats are guaranteed to be supported except AIMAGE_FORMAT_JPEG, but this format doesn't seem to work with the VkSamplerYcbcrConversion because the image layout is different. Has anyone come up against this issue before? And if so how did you resolve it? At a high level th goal is: In C++, get the image out of the camera2 api and onto a VkImage. If anyone knows an alternative way of doing that, I'm also all ears. |
Why does C# calculate double and decimal numbers wrongly? Posted: 04 Jun 2021 08:01 AM PDT I'm a beginner in C# and throughout my learning of the basics, I stumbled across a problem in which C# calculates two decimal/double numbers wrong. I'm doing a very basic calculator here. For example, if I want to add 2.1 and 3.1, the result will be 52, as if decimal points don't exist. Console.Write("Enter a number: "); double num1 = Convert.ToDouble(Console.ReadLine()); Console.Write("Enter Operator: "); string op = Console.ReadLine(); Console.Write("Enter a second number: "); double num2 = Convert.ToDouble(Console.ReadLine()); if (op == "+") { Console.Write(num1 + num2); } else if (op == "-") { Console.Write(num1 - num2); } else if (op == "/") { Console.Write(num1 / num2); } else if (op == "*") { Console.Write(num1 * num2); } else { Console.Write("Invalid operator!"); } |
Building a list of IP addresses Posted: 04 Jun 2021 08:01 AM PDT I am trying to build an array of possible IP addresses based on a user's input. i.e. IP address along with a CIDR number. My end goal is to compare this list with a separate list of addresses and find which are is missing. Example user input: 192.168.1.0 /24 I want to build an array for all possible values for the /24 network (i.e. the IP address can be anywhere from 192.168.1.0 - 192.168.1.255) In order for this to work, I think I have to convert the IP address to binary and then find the bits that will be the host part of the network, which I've done here: function ConvertToBinary{ param($ipAddress) [string]$binaryIP = -join ($ipAddress.Split('.') | ForEach-Object {[System.Convert]::ToString($_,2).PadLeft(8,'0')}) return $binaryIP } function FindHost{ param( [string]$binaryIPAddress, [int32]$CIDR ) $hostBits = 32-$CIDR [string]$myHost = $binaryIPAddress.Substring($binaryIPAddress.Length-$hostBits) return $myHost } $myip = ConvertToBinary "192.168.3.1" $myHost = FindHost $myip 8 I'm a little stuck on how to proceed, so if anyone can help me out or point me in the right direction, it would be much appreciated |
What's the difference between Racket's findf and for/first functions? Posted: 04 Jun 2021 08:00 AM PDT Racket has a findf function that allows you to find the first matching element in a list... (findf even? '(1 2 3 4)) However, it also has a for/first function, which seems to do the same, albeit with a more complex syntax... (for/first ([n '(1 2 3 4)] #:when (even? n)) n) What's the difference between the two, and given that findf seems much shorter, why would I use for/first ? Thanks |
How do I calculate the maximum scroll value RichTextBox? Posted: 04 Jun 2021 08:01 AM PDT There is a RichTextBox with scrollbars disabled. Tried to find out the maximum scroll, using: - GetScrollPos - returns 0;
- GetScrollPosInfo - returns 0;
- GetScrollRange - returns 100;
- https://techarks.ru/qa/csharp/poluchit-polosu-prokrutki-q-I4/ - allows you to know only the pitch (px), if you scroll to the end will show the maximum, if you want to know it in the beginning - nothing (requires scrolling to the end);
float heightLine = targetCtrl.Font.GetHeight() / 3; Maximum = (int)Math.Ceiling(targetCtrl.GetPreferredSize(targetCtrl.Size).Height - targetCtrl.Height + heightLine); - at the beginning the maximum is correct, but as you add or change the size of the elements you get a value that is smaller than the real maximum. |
Version 91 of Chrome seems to have cause an issue with rendering the Full Calendar V5 Posted: 04 Jun 2021 08:01 AM PDT FullCalendar V5 was working yesterday, but now my chrome browser has updated to version 91 and cannot render the calender, all i am able to see is the resources/users available. See screenshot attached. enter image description here |
Pypy Pandas not installing Posted: 04 Jun 2021 08:01 AM PDT I'm new to Pypy, I've been working with python for accouple of years and I decided to give pypy a try! But I'm having a problem installing the pandas library. I can't post the full lenght of the error because StackOverflow won't let me... but this is a suppress version that did.... I ran: pypy3 -m pip install pandas And the outcome was: Using cached pandas-1.2.4.tar.gz (5.5 MB) Installing build dependencies ... error ERROR: Command errored out with exit status 1: command: 'C:\Program Files (x86)\pypy3.7\pypy3.exe' 'C:\Program Files (x86)\pypy3.7\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\GONALO~1\AppData\Local\Temp\pip-build-env-f_kp3snm\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"'' cwd: None Complete output (269 lines): Ignoring numpy: markers 'python_version == "3.8" and platform_system != "AIX"' don't match your environment Ignoring numpy: markers 'python_version == "3.7" and platform_system == "AIX"' don't match your environment Ignoring numpy: markers 'python_version == "3.8" and platform_system == "AIX"' don't match your environment Ignoring numpy: markers 'python_version >= "3.9"' don't match your environment Collecting setuptools Using cached setuptools-56.0.0-py3-none-any.whl (784 kB) Collecting wheel Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB) Collecting Cython<3,>=0.29.21 Using cached Cython-0.29.23-py2.py3-none-any.whl (978 kB) Collecting numpy==1.16.5 Using cached numpy-1.16.5.zip (5.1 MB) Using legacy setup.py install for numpy, since package 'wheel' is not installed. Installing collected packages: setuptools, wheel, Cython, numpy Running setup.py install for numpy: started Running setup.py install for numpy: finished with status 'error' ERROR: Command errored out with exit status 1: command: 'C:\Program Files (x86)\pypy3.7\pypy3.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\GONALO~1\\AppData\\Local\\Temp\\pip-install-f70s2rin\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\GONALO~1\\AppData\\Local\\Temp\\pip-install-f70s2rin\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\GONALO~1\AppData\Local\Temp\pip-record-bkj0w_a2\install-record.txt' --single-version-externally-managed --prefix 'C:\Users\GONALO~1\AppData\Local\Temp\pip-build-env-f_kp3snm\overlay' --compile --install-headers 'C:\Users\GONALO~1\AppData\Local\Temp\pip-build-env-f_kp3snm\overlay\include\numpy' cwd: C:\Users\GONALO~1\AppData\Local\Temp\pip-install-f70s2rin\numpy\ UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. self.calc_info() blas_info: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils customize MSVCCompiler libraries blas not found in ['C:\\', 'C:\\Program Files (x86)\\pypy3.7\\libs'] NOT AVAILABLE (..............................) ---------------------------------------- ERROR: Command errored out with exit status 1: 'C:\Program Files (x86)\pypy3.7\pypy3.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\GONALO~1\\AppData\\Local\\Temp\\pip-install-f70s2rin\\numpy\\setup.py'"'"'; __file__='"'"'C:\\Users\\GONALO~1\\AppData\\Local\\Temp\\pip-install-f70s2rin\\numpy\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\GONALO~1\AppData\Local\Temp\pip-record-bkj0w_a2\install-record.txt' --single-version-externally-managed --prefix 'C:\Users\GONALO~1\AppData\Local\Temp\pip-build-env-f_kp3snm\overlay' --compile --install-headers 'C:\Users\GONALO~1\AppData\Local\Temp\pip-build-env-f_kp3snm\overlay\include\numpy' Check the logs for full command output. ---------------------------------------- ERROR: Command errored out with exit status 1: 'C:\Program Files (x86)\pypy3.7\pypy3.exe' 'C:\Program Files (x86)\pypy3.7\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\GONALO~1\AppData\Local\Temp\pip-build-env-f_kp3snm\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel 'Cython>=0.29.21,<3' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system!='"'"'AIX'"'"'' 'numpy==1.16.5; python_version=='"'"'3.7'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"' and platform_system=='"'"'AIX'"'"'' 'numpy; python_version>='"'"'3.9'"'"'' Check the logs for full command output. Can anyone help? I have no idea what i'm doing wrong....Thank you all very much for the attention and help! |
Traefik 2 Dashboard Custom Context Path Posted: 04 Jun 2021 08:00 AM PDT I would like to change the context path for the Traefik dashboard from e.g. https://apps.example.com/ to https://apps.example.com/traefik , as I have Heimdall routed to https://apps.example.com/ . All the examples I could find are for Traefik 1.x. What would be the easiest way to do this? My current config (which doesn't work): traefik.toml: [entryPoints] [entryPoints.web] address = ":80" [entryPoints.web.http.redirections.entryPoint] to = "websecure" scheme = "https" [entryPoints.websecure] address = ":443" [api] dashboard = true insecure = true [log] level = "DEBUG" [certificatesResolvers.cloudflare.acme] email = "email@email.com" storage = "acme.json" [certificatesResolvers.cloudflare.acme.dnsChallenge] provider = "cloudflare" resolvers = ["1.1.1.1:53", "8.8.8.8:53"] [providers.docker] watch = true network = "web" exposedByDefault = false endpoint = "unix:///var/run/docker.sock" [providers.file] filename = "traefik_dynamic.toml" traefik_dynami.toml: [http.routers.api] rule = "Host(`apps.example.com`) && Path(`/traefik`)" entrypoints = ["websecure"] service = "api@internal" [http.routers.api.tls] certResolver = "cloudflare" |
External Script breaks Angular 7 navigation Posted: 04 Jun 2021 08:00 AM PDT I have a standard Angular 7 site with lazy loading in place. The app is in PROD without any issues. Now I'm integrating an external script which loads a chatbot on the site. According to their documentation I only have to add a piece of HTML within the HEAD tag and all should work. The thing is the chat itself works however the angular navigation is broken in terms of having to click twice to an item in the navbar to actual go to the desired route (although when you first click the URL changes). It's weird and I have never come across this before so I was wondering whether Angular exposes any kind of special debugging or something like that for the routing process - note that I have enableTracing set to true and according to those logs the apps works fine but like I said, the view is rendered when you click on the second time as well as the styles applied to things like routerLinkActive etc. Any ideas of what could be going on? I don't know how the JS file could be interacting with the actual Angular routing process. Many thanks in advance! |
Is there a 256-bit integer type? Posted: 04 Jun 2021 08:00 AM PDT OS: Linux (Debian 10) CC: GCC 8.3 CPU: i7-5775C There is a unsigned __int128 /__int128 in GCC, but is there any way to have a uint256_t /int256_t in GCC? I have read of a __m256i which seems to be from Intel. Is there any header that I can include to get it? Is it as usable as a hypothetic unsigned __int256 ? I mean if you can assign from/to it, compare them, bitwise operations, etc. What is its signed equivalent (if any)? EDIT 1: I achieved this: #include <immintrin.h> typedef __m256i uint256_t; and compiled. If I can do some operations with it, I'll update it here. EDIT 2: Issues found: uint256_t m; int l = 5; m = ~((uint256_t)1 << l); ouput: error: can't convert a value of type 'int' to vector type '__vector(4) long long int' which has different size m = ~((uint256_t)1 << l); |
Properly draw text using GraphicsPath Posted: 04 Jun 2021 08:00 AM PDT As you can see in the image below, the text on the PictureBox is different from the one in the TextBox. It is working alright if I use Graphics.DrawString() but when I use the Graphics Path, it truncates and doesn't show the whole text. What do you think is wrong in my code? Here is my code: public LayerClass DrawString(LayerClass.Type _text, string text, RectangleF rect, Font _fontStyle, PaintEventArgs e) { using (StringFormat string_format = new StringFormat()) { rect.Size = e.Graphics.MeasureString(text, _fontStyle); rect.Location = new PointF(Shape.center.X - (rect.Width / 2), Shape.center.Y - (rect.Height / 2)); if(isOutlinedOrSolid) { using (GraphicsPath path = new GraphicsPath()) { path.AddString(text, _fontStyle.FontFamily, (int)_fontStyle.Style, rect.Size.Height, rect, string_format); e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.CompositingQuality = CompositingQuality.HighQuality; e.Graphics.CompositingMode = CompositingMode.SourceOver; e.Graphics.DrawPath(new Pen(Color.Red, 1), path); } } else { e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.CompositingQuality = CompositingQuality.HighQuality; e.Graphics.CompositingMode = CompositingMode.SourceOver; e.Graphics.DrawString(text,_fontStyle,Brushes.Red, rect.Location); } } this._Text = text; this._TextRect = rect; return new LayerClass(_text, this, text, rect); } |
Getting messages in chat history to display in messenger Pubnub Posted: 04 Jun 2021 08:01 AM PDT I have come to post this question after 2 days of torture not being able to understand how I can actually publish the historic messages stored on my pubnub storage account. To try and understand it at its most basic I have made a chat app and used the history function as described in the SDK but still every time I refresh the page the messages are lost. I have tried the backfill and the restore attributes in subscribe with no luck. All I want to do is click refresh on chrome and see the messages still there. <div><input id=input placeholder=you-chat-here /></div> Chat Output <div id=box></div> <script src="https://cdn.pubnub.com/sdk/javascript/pubnub.4.4.0.min.js"></script> <script>(function(){ var pubnub = new PubNub({ publishKey : 'demo', subscribeKey : 'demo' }); function $(id) { return document.getElementById(id); } var box = $('box'), input = $('input'), channel = 'chat'; pubnub.addListener({ message: function(obj) { box.innerHTML = (''+obj.message).replace( /[<>]/g, '' ) + '<br>' + box.innerHTML }}); pubnub.history({ channel: 'chat', reverse: true, // Setting to true will traverse the time line in reverse starting with the oldest message first. count: 100, // how many items to fetch callback : function(msgs) { pubnub.each( msgs[0], chat ); } }, function (status, response) { // handle status, response console.log("messages successfully retreived") }); pubnub.subscribe({channels:[channel], restore: true, backfill: true, ssl: true}); input.addEventListener('keyup', function(e) { if ((e.keyCode || e.charCode) === 13) { pubnub.publish({channel : channel, message : input.value,x : (input.value='')}); } }); })(); </script> </body> |
No comments:
Post a Comment