disabled adjustable size on window.open() Posted: 05 Aug 2021 09:11 AM PDT 1 ) i have created a custom windows.open() page which will open up a new window, but i was wondering if i could disable user from trying to stretch the window when they hover at the edge of the webpage as shown in circle in the image below . Is this possible with css/javascript ? In the image shown below , can we change the text that is showing "about:blank" to e.g "DownloadDialog" ? I declared new window with window.open("","DownloadDialog","height:430;width:300") |
Iterate through each element in a particular column of a dynamic table using cypress Posted: 05 Aug 2021 09:11 AM PDT I have a dynamic table displayed based on a value selected from a radio button in my project. The radio button field "Doctor Name" field has different choices like "Frank", "Michael", "Josh", "Jessica". When I select the "Frank" value, it displays a dynamic table with the list of appointments for "Frank", The first column in the table is "Doctor Name". When I select "Frank" from the radio button, I have to validate if all the appointments listed are for "Frank". So I have to write coding in cypress to check if all the first column cell values are "Frank". How can I achieve this? |
Why some of my images are being ignored in Tenserflow when i have images not being ignored in the same folders? Posted: 05 Aug 2021 09:11 AM PDT I have data inside 2 folders (Training with 10000 images and Validation with 1000 images) and in each of these folders I have 10 folders (the respective classes). I put all this data into a dataframe to use later. It turns out that some images in certain folders at the moment I use "flow_from_dataframe" in tenserflow are assumed to have invalid names and are therefore ignored. And I try to access any image outside tenserflow, for example by simply making the image open and I still can't access certain files when the path is completely correct from PIL import Image im = Image.open("D:\Ensino Superior\ISCTE-IUL\Mestrado em Engenharia Informatica\Tese\Testagem\TomatoLeafDisease\data\Train\Tomato___Tomato_mosaic_virus\Tomato___Tomato_mosaic_virus_original_f16eeb0f-5219-4a81-9941-351b3d9ba5fc___PSU_CG 2089.JPG_a88e521f-cec2-4755-871f-782de8192056.JPG") im.show() Output when trying to acess an image outside tenserflow code The dataframe I have researched and seen that using abs path could help and make it work however even then some images are being ignored, what can I do so that no image is ignored ? Code before the output with the error: def create_gen(): train_generator = tf.keras.preprocessing.image.ImageDataGenerator( preprocessing_function=tf.keras.applications.mobilenet_v2.preprocess_input, validation_split=0.2 ) test_generator = tf.keras.preprocessing.image.ImageDataGenerator( preprocessing_function=tf.keras.applications.mobilenet_v2.preprocess_input ) train_images = train_generator.flow_from_dataframe( dataframe=train_df, x_col='Filepath', y_col='Class', target_size=(224, 224), color_mode='rgb', class_mode='categorical', batch_size=32, shuffle=True, seed=0, subset='training', rotation_range=30, # Uncomment to use data augmentation zoom_range=0.15, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.15, horizontal_flip=True, fill_mode="nearest" ) val_images = train_generator.flow_from_dataframe( dataframe=train_df, x_col='Filepath', y_col='Class', target_size=(224, 224), color_mode='rgb', class_mode='categorical', batch_size=32, shuffle=True, seed=0, subset='validation', rotation_range=30, # Uncomment to use data augmentation zoom_range=0.15, width_shift_range=0.2, height_shift_range=0.2, shear_range=0.15, horizontal_flip=True, fill_mode="nearest" ) test_images = test_generator.flow_from_dataframe( dataframe=validation_df, x_col='Filepath', y_col='Class', target_size=(224, 224), color_mode='rgb', class_mode='categorical', batch_size=32, shuffle=False ) return train_generator,test_generator,train_images pretrained_model = tf.keras.applications.MobileNetV2( input_shape=(224, 224, 3), include_top=False, weights='imagenet', pooling='avg' train_generator,test_generator,train_images,val_images,test_images = create_gen() Output after using "flow_from_data_frame" with tenserflow |
How to get a row by condition using group by? Posted: 05 Aug 2021 09:11 AM PDT I need to get amounts for each currency that user has. There're 3 different tables that contain all the data about users money transactions: money_incomes , money_outcomes and withdrawal_requests . So I want to get the result like: currency_id: amount(money_incomes - (money_outcomes + withdrawal_requests)) But for the first time I'm trying to get amounts from each table that will group by currency_id : SELECT coalesce(max(money_income.amount), 0) money_income, coalesce(max(money_outcome.amount), 0) money_outcome, coalesce(max(withdrawal_request.amount), 0) withdrawal_request, currencies.code currency FROM (SELECT max(user_id) user_id, sum(amount) amount, currency_id FROM money_incomes GROUP BY currency_id) money_income FULL JOIN (SELECT max(user_id) user_id, sum(amount) amount, currency_id FROM money_outcomes GROUP BY currency_id) money_outcome ON money_income.user_id = money_outcome.user_id FULL JOIN (SELECT max(user_id) user_id, sum(amount) amount, currency_id FROM withdrawal_requests GROUP BY currency_id) withdrawal_request ON money_income.user_id = withdrawal_request.user_id LEFT JOIN users ON users.id = money_income.user_id LEFT JOIN currencies ON currencies.id = money_income.currency_id GROUP BY currency; I'm expecting the following result: currency_id | money_income | money_outcome | withdrawal_request It works well for money_incomes table, but I have to use aggregate functions in SELECT and that's the point why I could not get correct result, so full joins in this case return the same structure because of grouping. So I need something not to use aggregate functions in SELECT, but to get needed row from JOINs results. |
bundle.js and bundle.js.map keep duplicating on component re-render Posted: 05 Aug 2021 09:10 AM PDT Here is my code: import React, { useEffect } from 'react'; import axios from 'axios'; import { createChart } from 'lightweight-charts'; import dJSON from 'dirty-json'; import { connect } from 'react-redux'; let chartProperties = { width: 1000, height: 500, timeScale: { timeVisible: true, secondsVisible: false } } let lightweightChart = createChart(document.getElementById('chart')); const Chart = (props) => { console.log(props.chartAlive) useEffect(() => { fetchData() }, [lightweightChart.remove(), lightweightChart = createChart(document.getElementById('chart'), chartProperties)]) const stream = `wss://stream.binance.com:9443/ws/${props.chartData.ticker.toLowerCase()}@kline_${props.chartData.timeframe}`; const series = lightweightChart.addCandlestickSeries(); const fetchData = () => { axios.get(`https://api.binance.com/api/v3/klines?symbol=${props.chartData.ticker.toUpperCase()}&interval=${props.chartData.timeframe}&limit=1000`) .then(response => response.data) .then(data => { const chartValues = data.map(d => { return { time: d[0] / 1000, open: parseFloat(d[1]), high: parseFloat(d[2]), low: parseFloat(d[3]), close: parseFloat(d[4]) } }); series.setData(chartValues); }).catch(error => console.log(error)) } const ws = new WebSocket(stream); ws.onmessage = (response) => { const apiJSONData = dJSON.parse(response.data) const formedApiJSONData = JSON.stringify(apiJSONData); const outerJSONData = JSON.parse(formedApiJSONData); const nestedJSONData = JSON.stringify(outerJSONData.k); const currencyDetails = JSON.parse(nestedJSONData) const updatedValues = { time: currencyDetails.T / 1000, open: currencyDetails.o, high: currencyDetails.h, low: currencyDetails.l, close: currencyDetails.c } series.update(updatedValues); }; return ( <div> </div> ); } const mapStateToProps = (state) => { return { chartData: state.chartOptionsReducer, chartAlive: state.chartReducer } } export default connect(mapStateToProps)(Chart); Whenever this component does a re-render (through changing chart options like ticker symbol or timeframe), the bundle.js and bundle.js.map continually get fetched every few seconds which builds up the resources used by the page and therefore starts lagging the page. If I remove lightweightChart.remove() from the useEffect the problem doesn't occur but the chart component duplcates. If I keep lightweightChart.remove() and remove the ws.onmessage() block, again the problem doesn't occur but of course now the chart doesn't update with real-time data. I have no idea why this issue is happening and what bundle.js or bundle.js.map even are. I've been struggling for weeks can anybody help? |
How to set and get cookies in next.js? Posted: 05 Aug 2021 09:10 AM PDT I am developing a frontend for a blog app. JWT token received from the server which is developed using Golang is able to store as a cookie but the get cookie function is not working. |
Access issues to Power BI report. User identity is different Posted: 05 Aug 2021 09:10 AM PDT Access issues to Power BI report. User identity is different. The one that says "Invitation accepted" can not access reports. The one that doesn't have that but says "Manage B2B collaboration" can view reports. What is the difference in these and has one been invited incorrectly? How do i fix? |
How to run a linear model on a certain group of respondents? Posted: 05 Aug 2021 09:10 AM PDT I am trying to run a linear model, but only on a certain group of respondents. I found sample code online that said to use the gapminder function to isolate the group of respondents. Here, I only want to include respondents who have a value of 1 in the party column. I followed the sample code I found online, library("tidyverse") library("gapminder") dems <- filter(gapminder, + dfp_clean$party == 1) dem_model <- lm(scale_masc_index ~ ice, data = dems) summary(dem_model) but I keep getting this error Error: Problem with `filter()` input `..1`. x Input `..1` must be of size 1704 or 1, not size 17723. ℹ Input `..1` is `+dfp_clean$party == 1`. I tried running rlang::last_error() to see where the error occurred, but it said the same thing as before. |
Training a decoder with a discriminator instead of an encoder Posted: 05 Aug 2021 09:11 AM PDT This question is more of the concept, since I'm struggling to get my head around how I would train an autoencoder decoder with a discriminator of a GAN rather than the encoder. I wanted to use the AE-GAN architecture, where the encoder encodes an images and then the decoder decodes the image it's trying to trick the discriminator. Could anyone explain how I would work around coding the problem, and if there's issues with the idea I have could you also correct that? |
How to control objects in Qt Design Studio with C++ code? Posted: 05 Aug 2021 09:10 AM PDT I have a personal project where I need to dynamically plot values on a time axis, sort of like an oscilloscope. I have recently discovered Qt Design Studio, which seems to provide the tools I need. My idea is to use a simple dot and shift it vertically relative to the incoming data. I want to read the data from a sensor using the GPIO port of a Raspberry Pi. I want to do this in C/C++, because this is what I know best. When I look at the tutorials for Qt Designer Studio though, I only see Javascript and Python to choose as backend. I am sorry if this is a trivial question, but is it possible to control the graphical objects via C? I am also open for other ideas to tackle this problem. |
Extracting JavaScript object from file and serializing it to JSON Posted: 05 Aug 2021 09:10 AM PDT I have a file that stores some JavaScript object. This is not a JSON object, its fields are not marked with quotation marks. A regular JavaScript object like { field1: 'value1', field2: 2 } . Despite the fact that it is a JavaScript object, its structure is simple, and it can be converted to JSON. And all I want is to know how is it posible. Because JSON.parse wouldn't work. I know I can use eval and add brackets eval("({ field1: 'value1', field2: 2 })") , but this solution looks unsafe. The file looks like this: // ... callSomeFunc({ /* object I need to take */}) // ... callSomeFunc({ /* other object I need to take */}) // ... callSomeFunc({ /* other object I need to take */}) |
Seperate key:value object into arrays Posted: 05 Aug 2021 09:10 AM PDT I'm making an ionic project on where I got an incoming array made of key:value object like: is possible to separate those values in 3 different arrays: date[] speed[] and altitude[]? |
Get the sum of a column in SQL - column is not directly from a table but has been calc'd Posted: 05 Aug 2021 09:10 AM PDT I'm building a table in SQL and have a column called 'DMA_FEE' which is the result of multiplying 2 other columns I brought in from existing tables. Any syntax I see about summing all the value in a column all have a 'from table' piece to them e.g. SELECT SUM( column_name ) FROM table; Considering I have calc'd this column in question, it doesn't come from a table so I can not use this syntax and can't see any other solutions. Here is my code for columns so far and the last one is where I get my DMA_FEE calc. SELECT A.*, A.TRANSACTION_ID, B.AMOUNT, B.CHARGE_ID, C.CHARGE_TYPE_ID, D.CHARGE_GROUP, E.ACCOUNT_NAME, F.SIG_ENTITY_LABEL, E.TRADING_USERID, E.EXCHANGE_ID, E.TRADEABLE_INSTR_NAME, G.INSTR_SUBTYPE_LABEL, G.UNDERLYING_SYM_BLOOMBERG, G.FUT_EXPIRATION_DATE, E.TRADE_DATE, timestamp_table.timeformated, A.RATE * A.BASIS_VALUE DMA_FEE FROM REPLDOADM.IRE_ESTIMATE_TRANS_MAP A LEFT JOIN REPLDOADM.IRE_CHARGES_ESTIMATE B ON A.ESTIMATE_ID = B.ESTIMATE_ID LEFT JOIN REPLDOADM.IRE_CHARGES_LU C ON B.CHARGE_ID = C.CHARGE_ID LEFT JOIN REPLDOADM.ire_charge_types_lU D ON C.CHARGE_TYPE_ID = D.CHARGE_TYPE_ID LEFT JOIN REPLDOADM.VW_IRE_TRADE_TRANSACTIONS E ON A.TRANSACTION_ID = E.TRANS_ID LEFT JOIN ( SELECT to_char(create_ts, 'HH24:MI:SS') as timeformated, TRANS_ID FROM REPLDOADM.VW_IRE_TRADE_TRANSACTIONS) timestamp_table ON (A.TRANSACTION_ID = timestamp_table.TRANS_ID) LEFT JOIN REPLDOADM.VW_IRE_ACCOUNTS F ON E.ACCOUNT_NAME = F.PB_ACCOUNT_NAME LEFT JOIN stig_adm.INSTRUMENT_UNIVERSE G ON E.TRADEABLE_INSTR_NAME = G.SHORT_NAME WHERE timeformated >= '07:00:00' AND timeformated <= '18:00:00' AND FUT_EXPIRATION_DATE >= add_months( trunc(sysdate), -12) Thoughts? |
Multiple Vue 3 watchers & Typescript ... how to use? Posted: 05 Aug 2021 09:10 AM PDT N.B. I'm using the @vueuse/core library to obtain some values for the below example, but I believe knowledge of the library for this question is moot. I have the following triple watcher: // Reactive Mouse Positionining const { x, y } = useMouse() // Detect if the Mouse has been pressed: const { pressed } = useMousePressed({ target: celestiaSkyViewerRoot, touch: true }) watch([pressed, x, y], ([newPressed, newX, newY], [prevPressed, prevX, prevY]) => { if (showConstellations.value) { if (!newPressed && newX !== prevX) { activeConstellation.value = getActiveConstellation(newX, newY) } } dragging.value = pressed.value if (newPressed && newX !== prevX) { azimuthalOffset.value -= (newX - prevX) / 6 } }) However, I am seeing the following Typescript errors occur: For newX , relating to the line: activeConstellation.value = getActiveConstellation(newX, newY) Argument of type 'number | boolean' is not assignable to parameter of type 'number'. Type 'boolean' is not assignable to type 'number'. For newX , relating to the line: azimuthalOffset.value -= (newX - prevX) / 6 The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. However, Vetur is only showing an issue for newY , relating to the line: azimuthalOffset.value -= (newX - prevX) / 6 : The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. Does anyone know a possible solution for this? Essentially, these errors are stopping a reload of my dev server ... and it's very much becoming a frustrating development bottle neck ... |
Copy Data from Web page and paste into Excel Posted: 05 Aug 2021 09:11 AM PDT I have been trying to scrap the web data using EXCEL VBA. Below code paste the date from excel to wen then initiated the submit button to go to the result page. which looks like this: I want to copy and paste the first and the second line into excel like this: if any individual gets first dose then put details of first dose, and return empty for the second dose if its empty. If both dose are not available then return empty for both. I am not able to develop this last thing and struggling since couple of hours to achieve this (copy data and paste into excel) it would required a ID number and date to submit for the result that i can provide in comments. I have been using following code to accomplish this your help will be much appreciated. Option Explicit Sub Newfunction() Const Url As String = "https://nims.nadra.gov.pk/nims/certificate" Dim LogData As Worksheet Set LogData = ThisWorkbook.Worksheets("Sheet1") Dim IdNumber As String Dim openDate As Date IdNumber = LogData.Cells(3, "A").Value openDate = LogData.Cells(3, "B").Value Set LogData = Nothing Dim ie As Object Set ie = CreateObject("InternetExplorer.Application") With ie .Navigate Url Do While .Busy Or .ReadyState <> 4 DoEvents Loop .Visible = True Dim ieDoc As Object Set ieDoc = .Document End With 'Enter the CNIC Dim IDdata As Object Set IDdata = ieDoc.getElementById("checkEligibilityForm:cnic") If Not IDdata Is Nothing Then IDdata.Value = IdNumber Set IDdata = Nothing 'Enter Date Dim puttdate As Object Set puttdate = ieDoc.getElementById("checkEligibilityForm:issueDate_input") If Not puttdate Is Nothing Then puttdate.Value = Format(openDate, "dd-mm-yyyy") Set puttdate = Nothing 'Answering the captcha question 'Split the innerText to string array to determine the equation Dim captchaQns As Object Set captchaQns = ieDoc.getElementsByClassName("submit__generated")(0) If Not captchaQns Is Nothing Then Dim mathEq() As String mathEq = Split(captchaQns.innerText, " ") Set captchaQns = Nothing 'mathEq(0) = first number 'mathEq(1) = math operator 'mathEq(2) = second number If IsNumeric(mathEq(0)) Then Dim firstNum As Long firstNum = CLng(mathEq(0)) If IsNumeric(mathEq(2)) Then Dim secondNum As Long secondNum = CLng(mathEq(2)) 'Select Case statement used here in case you encounter other form of math question (e.g. - X /), expand cases to cater for other scenario Dim mathAnswer As Long Select Case mathEq(1) Case "+": mathAnswer = firstNum + secondNum End Select End If End If If mathAnswer <> 0 Then 'Enter the answer to the box Dim captchaAns As Object Set captchaAns = ieDoc.getElementsByClassName("submit__input")(0) If Not captchaAns Is Nothing Then captchaAns.Value = mathAnswer Set captchaAns = Nothing 'Get the submit button element, remove "disabled" attribute to allow clicking Dim submitBtn As Object Set submitBtn = ieDoc.getElementsByName("checkEligibilityForm:j_idt79")(0) submitBtn.removeAttribute "disabled" submitBtn.Click Set submitBtn = Nothing End If End If Dim tbls, tbl, trs, tr, tds, td, r, c Set tbl = ie.Document.getElementsByTagName("table")(0) Set trs = tbl.getElementsByTagName("tr") For r = 0 To trs.Length - 1 Set tds = trs(r).getElementsByTagName("tr") 'if no <td> then look for <th> If tds.Length = 0 Then Set tds = trs(r).getElementsByTagName("td") For c = 0 To tds.Length - 1 ActiveSheet.Range("C4").Offset(r, c).Value = tds(c).innerText Next c Next r End Sub HTML Tags: |
How can I define that all values belong to another one and meet requirement Posted: 05 Aug 2021 09:11 AM PDT I have a table and now I want to define which mentor has all his interns with marks "5". I tried to add this: SELECT Mentor_lname FROM Table WHERE Mentor_lname = ALL (SELECT Mentor_lname FROM Table WHERE mark = 5)); But it doesn't help, I have already spent a few hours to get a proper result. Maybe I use "ALL" incorrectly? [Table] |
How i can call callback in useEffect return (componentWillUnmount) with dependencies [closed] Posted: 05 Aug 2021 09:11 AM PDT The problem is this, in the component I receive new data and when unmounting the component I need to call a method with new data. How I can this be implemented with hooks, because if I add dependencies to useEffect, callback in return will be called every time the dependencies change, but I only need at the moment of unmounting. |
Simple Form + Select2: can't type dynamic tag Posted: 05 Aug 2021 09:10 AM PDT I am using Rails 6 with simple form & Select2. I have an Item model with array field "tags". I want to add tags to items using Select2 dynamic option creation. Problem is that I cannot type in the Select2 field. Other functions work fine. Any idea what I am doing wrong? In my form: = f.input :tags, collection: @items.distinct('tags'), input_html: { class: 'select-tags', multiple: true }, include_hidden: false javascript: document.addEventListener("turbolinks:load", () => { $(".select-tags").select2({ tags: true }); }); |
vba export a range to new csv file, but the first row should be clear Posted: 05 Aug 2021 09:10 AM PDT i am new at vba and i have a question about this code. this code export the exact range of values that i want to a new csv file, but it should start at row 2, so i can fill the first row with a headline (another range value). i hope someone can help me with my questions. thank you. Sub TestRange() Dim ws As Worksheet, fd As FileDialog, rngTest As Range, rngExport As Range, fltr As FileDialogFilter Dim start As Long start = 2 ' Dim jahr As Integer ' jahr = Date 'Nach jeweiliger Zeit wird Datenreihe (start ab) ausgewählt If Time < TimeValue("11:15") Then Do Until Daten.Range("ov" & start) = Date + 1 start = start + 1 Loop Else Do Until Daten.Range("ov" & start) = Date + 2 start = start + 1 Loop End If 'Worksheet auf dem die Daten stehen Set ws = Worksheets("Daten") 'Zelle die auf Inhalt überprüft werden soll Set rngTest = ws.Range("ov2") 'Bereich der exportiert wird Set rngExport = ws.Range("ov" & start & ":ow5000") If rngTest.Text <> "" Then Set fd = Application.FileDialog(msoFileDialogSaveAs) 'Filename fd.InitialFileName = "LG" & " " & Diagramm.Range("a5").Value & " " & "RZ" & " " & Format(Date, "mmmm") & " " & Format(Date, "yyyy") & "_" & "MW" & "_" & "ab" & " " & Daten.Range("ov" & start).Value ' Application.Dialogs(xlDialogSaveAs).Show filenameComplete With fd .Title = "" 'Filterindex für CSV-Dateien ermitteln For i = 1 To .Filters.count If .Filters(i).Extensions = "*.csv" Then .FilterIndex = i Exit For End If Next 'Wenn OK geklickt wurde starte Export If .Show = True Then ExportRangeAsCSV rngExport, ";", .SelectedItems(1) End If End With End If End Sub 'Prozedur für den Export eines Ranges in eine CSV-Datei Sub ExportRangeAsCSV(ByVal rng As Range, delim As String, filepath As String) Dim arr As Variant, line As String, csvContent As String, fso As Object, csvFile As Object Set fso = CreateObject("Scripting.FileSystemObject") Set csvFile = fso.OpenTextFile(filepath, 2, True) arr = rng.Value 'Filter If IsArray(arr) Then For r = 1 To UBound(arr, 1) line = "" For c = 1 To UBound(arr, 2) If c < UBound(arr, 2) Then line = line & """" & arr(r, c) & """" & delim Else line = line & """" & arr(r, c) & """" End If Next csvContent = csvContent & line & vbNewLine Next csvFile.Write (csvContent) csvFile.Close Else MsgBox "Bereich besteht nur aus einer Zelle!", vbExclamation End If Set fso = Nothing Set csvFile = Nothing End Sub i copied this code from the internet and it works well, but i couldnt find a solution, how i change the code in a way that my csv file has the first row above clear, that i can write the headlines of the two columns in the first row. |
Apps Script Google Drive CSV Import Posted: 05 Aug 2021 09:10 AM PDT I try to use a script to import a csv from drive. Every solution i have found works fine if there is only a "," as seperator. In my case, i have two seperators, and i can not replace the text seperator. It looks like there is a problem with importing the text seperator. How to fix this? id;name;colorGroup;isOnline;publishedAt;material;washing;care;description;additionalDescriptions;offlineOnly;createdAt;updatedAt;modifiedFromCalaogueAt;imageMtime;manufacturerProductId;marketingColor;stock;stockTotal 101000000021;"501 Original Fit Jeans";dunkelblau;1;"2014-05-06 10:27";"100% Baumwolle ";;"Maschinenwäsche bei 30 Grad,Nicht bleichen,Trockenreinigung Kein Trichlorethylen,Trockner bei normaler Temperatur,Heiß bügeln";;"Reguläre Passform mit gerader Beinöffnung,Normale Leibhöhe,Hoher Tragekomfort durch Stretch-Denim,Abriebstellen an den Taschen- und Abschlusskanten,Mit einer Knopfleiste zu verschließen,Bei einer Größe von 1.87 m trägt unser Model Gr. 31/32";;"2015-07-07 11:21";"2021-08-05 14:23";"2021-08-05 02:50";"2015-11-16 11:49";0050101;01;"29/30->0, 29/32->0, 29/34->0, 30/30->3, 30/32->1, 30/34->1, 31/30->1, 31/32->1, 31/34->1, 32/30->0, 32/32->1, 32/34->2, 33/30->1, 33/32->2, 33/34->2, 34/30->0, 34/32->1, 34/34->2";19 This is the script. function importCSVFromGoogleDrive() { var file = DriveApp.getFilesByName("productsAll.csv").next(); var csvString = file.getBlob().getDataAsString() csvString = csvString.replace(/;/g, ",") csvString = csvString.replace(/"/g, "") //Logger.log(csvString); //csvString = csvString.replace(/\|/g, ".") var csvData = Utilities.parseCsv(csvString); var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('test'); sheet.clear(); sheet.getRange(1, 1, csvData.length, csvData[0].length).setValues(csvData); } Best regards Andi |
Vue meta i18n variable name showing instead of value Posted: 05 Aug 2021 09:10 AM PDT I Have a vue2 project with vue-meta and i have i18n to localize the project. In my bookmarks and when looking in google analytics it seems that my variable is being shown instead of the value in the variable. Examples: - In google analytics n users has visited "home.meta.title".
- When opening google chrome and see "previously visited pages" it says i have visited "home.meta.title" or "about.meta.title" etc..
the issue is solved when i write a static text instead of variable, then it will display the text. But i want it to show different texts depending on the language. From what i understood the crawlers doesnt see my variable values due to not loading any scripts?? How can i solve this issue? |
Running Sqoop in Sub-processes errors [duplicate] Posted: 05 Aug 2021 09:10 AM PDT This is what I am using import subprocess from pysqoop.SqoopImport import Sqoop sqoop = Sqoop(help=True) code = sqoop.perform_import() subprocess.run( ["/usr/local/hadoop/sqoop", "list-databases", "--connect", "jdbc:mysql://localhost:3306/testDb", "--username Amel", "--password Amel@-1998;"]) These are the errors, keep in mind I gave this directory chmod 777 /usr/local/hadoop/sqoop File "/home/amel/PycharmProjects/pythonProject/Hello.py", line 5, in <module> subprocess.run( File "/usr/lib/python3.8/subprocess.py", line 493, in run with Popen(*popenargs, **kwargs) as process: File "/usr/lib/python3.8/subprocess.py", line 858, in __init__ self._execute_child(args, executable, preexec_fn, close_fds, File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child raise child_exception_type(errno_num, err_msg, err_filename) PermissionError: [Errno 13] Permission denied: '/usr/local/hadoop/sqoop' sqoop import None --help name 'run' is not defined Process finished with exit code 1 |
Print x number of list and then insert new line in python Posted: 05 Aug 2021 09:10 AM PDT I have a list of integer like this [1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] I want to print maybe 10 int in one line, and then insert a new line so the output should looks like this: [1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] I need to do this because i need to screenshoot the output of the list to my paper, its better if the list look more tidy. Thanks before. |
Pycharm doesn't recognise Sqoop libraries Posted: 05 Aug 2021 09:10 AM PDT I am on Pycharm trying to use Sqoop import job to load MySQL data in to HDFS. I downloaded this package on terminal pip install pysqoop I tried running this package from pysqoop.SqoopImport import Sqoop sqoop = Sqoop(help=True) code = sqoop.perform_import() This was the error /home/amel/PycharmProjects/pythonProject/venv/bin/python /home/amel/PycharmProjects/pythonProject/Hello.py Traceback (most recent call last): File "/home/amel/PycharmProjects/pythonProject/Hello.py", line 1, in <module> from pysqoop.SqoopImport import Sqoop ModuleNotFoundError: No module named 'pysqoop' Process finished with exit code 1 How can I solve this problem? |
Find the largest rectangular grid pattern from a set of 2D points Posted: 05 Aug 2021 09:10 AM PDT I have been struggling with the 2D version of finding Longest Arithmetic Subsequence . Given a set of 2D points in integers, is there an efficient algorithm that finds the largest subset of these points that form a rectangular grid (e.g. 7x3, 3x3) pattern? Note that the grid pattern can have different step sizes along X and Y directions. For points in the figure, the algorithm should return the 3x3 rectangular grid pattern of size 9 in red All suggestions and references are greatly appreciated! |
How to show/hide a dash-cytoscape object on a dashboard? Posted: 05 Aug 2021 09:11 AM PDT I am currently working on a Plotly Dash webapp where I want to show/hide a cytoscape graph using either display style on a parent div or by redrawing it (I am also opened to other solutions), none of what I tried worked. Is there something I am missing? Here is a code example showing this issue: import json import dash import dash_bootstrap_components as dbc import dash_cytoscape as cyto import dash_html_components as html import requests from dash.dependencies import Input, Output def load_json(st): if 'http' in st: return requests.get(st).json() else: with open(st, 'rb') as f: x = json.load(f) return x app = dash.Dash(__name__) server = app.server # Load Data elements = load_json('https://js.cytoscape.org/demos/colajs-graph/data.json') stylesheet = load_json('https://js.cytoscape.org/demos/colajs-graph/cy-style.json') # App app.layout = html.Div( children=[ dbc.Button("display", id="btn_display"), dbc.Button("redraw", id="btn_redraw"), html.Div( [ cyto.Cytoscape( id='cytoscape-responsive-layout', elements=elements, stylesheet=stylesheet, layout={ 'name': 'cose', }, responsive=True ) ], id="div", style={"display": "inherit"} ) ] ) # callbacks @app.callback(Output("div", "style"), Input("btn_display", "n_clicks")) def style_toggle(n: int): disp = {"display": "none" if (n is not None and n % 2 == 1) else "inherit"} return disp @app.callback(Output("div", "children"), Input("btn_redraw", "n_clicks")) def redraw(_): return [ cyto.Cytoscape( id='cytoscape-responsive-layout', elements=elements, stylesheet=stylesheet, layout={ 'name': 'cose', }, responsive=True ) ] if __name__ == '__main__': app.run_server(debug=True, port=8052) The style_toggle callback correctly hide the div but when it set back the display style to inherit the graph does not reappear. The redraw callback seems to have no effect. And here is my env: $ python -m pip list | grep dash dash 1.20.0 dash-bootstrap-components 0.11.1 dash-core-components 1.16.0 dash-cytoscape 0.2.0 dash-daq 0.5.0 dash-extensions 0.0.51 dash-html-components 1.1.3 dash-renderer 1.9.1 dash-table 4.11.3 jupyter-dash 0.4.0 EDIT: It turns out the responsive=True parameter was the cause, I have reorganized my dashboard to work without... If someone has a workaround which keeps the responsiveness that would be great. |
ARM templates how to add public IP to dns zone Posted: 05 Aug 2021 09:11 AM PDT I'm using arm templates for deployments (preferable bicep). Is there a simple way to add my public ip resource to preexisting DNS zone? Public IP has property named dnsSettings, but it seems that it only can set DNS pointing to azure default domain publicipname.eastus.cloudapp.azure.com, instead of publicipname.customdomain.com. resource publicIp 'Microsoft.Network/publicIPAddresses@2020-11-01' = { location: rg_location name: 'pip-example' tags: tags_list sku: { name: 'Standard' tier: 'Regional' } properties:{ dnsSettings:{ domainNameLabel: 'publicipname' fqdn: 'publicipname.customdomain.com' } publicIPAllocationMethod: 'Static' } } |
Make notification bar slide up from the bottom Posted: 05 Aug 2021 09:10 AM PDT I have a small horizontal notification bar that slides up from the bottom of the page. It comes up fine, but when you open up the page it quickly flashes, then disappears and then slides up. How do I modify it so it doesn't appear/disappear before the transition takes place? #notificationBarBottom { position: fixed; z-index: 101; bottom: 0; left: 0; right: 0; background: #5cb85c; color: #ffffff; text-align: center; line-height: 2.5; overflow: hidden; -webkit-box-shadow: 0 0 5px black; -moz-box-shadow: 0 0 5px black; box-shadow: 0 0 5px black; } @-webkit-keyframes slideDown { 0%, 100% { -webkit-transform: translateY(0px); } 10%, 90% { -webkit-transform: translateY(510px); } } @-moz-keyframes slideDown { 0%, 100% { -moz-transform: translateY(0px); } 10%, 90% { -moz-transform: translateY(510px); } } .cssanimations.csstransforms #notificationBarBottom { -webkit-transform: translateY(510px); -webkit-animation: slideDown 2.5s 1.0s 1 ease forwards; -moz-transform: translateY(510px); -moz-animation: slideDown 2.5s 1.0s 1 ease forwards; } <div id="notificationBarBottom">Hello, human!</div> Jsfiddle demo here: https://jsfiddle.net/cnfk36jd/ (but unfortunately the problem is not visible there). Here's the page where you can see the "flickering" http://www.whycall.me/bannerTest.html I tried the advice here: https://css-tricks.com/pop-from-top-notification/ and tweaked the translateY values quite a bit, but it doesn't help, not sure what else to do. Thank you for your help |
Remove rows that contain False in a column of pandas dataframe Posted: 05 Aug 2021 09:10 AM PDT I assume this is an easy fix and I'm not sure what I'm missing. I have a data frame as such: index c1 c2 c3 2015-03-07 01:27:05 False False True 2015-03-07 01:27:10 False False True 2015-03-07 01:27:15 False False False 2015-03-07 01:27:20 False False True 2015-03-07 01:27:25 False False False 2015-03-07 01:27:30 False False True I want to remove any rows that contain False in c3 . c3 is a dtype=bool . I'm consistently running into problems since it's a boolean and not a string/int/etc, I haven't handled that before. |
I want my android application to be only run in portrait mode? Posted: 05 Aug 2021 09:10 AM PDT I want my android application to be only run in portrait mode? How can I do that? |
No comments:
Post a Comment