Posts

Showing posts from July 9, 2018

list item highlighted but not the entire row

Image
list item highlighted but not the entire row My current fiddle is working fine apart from one thing. When I hover over the button I see the list displayed. Then when I hover over a list item the background changes colour which is all fine. However when the list item changes colour there is almost a box to the left of the item which is not highlighted and can't seem to get rid of it? .dropbtn { background-color: #9FACEC; color: white; padding: 16px; font-size: 16px; border: none; } .dropdown { position: relative; display: inline-block; } .dropdown-content { display: none; position: absolute; background-color: #f1f1f1; min-width: 160px; box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); z-index: 1; } .dropdown-content li { color: black; padding: 12px 16px; text-decoration: none; display: block; } .dropdown-content li:hover {background-color: #ddd;} .dropdown:hover .dropdown-content {display: block;} .dropdown:hover .dro

individual components should be connected to the store instead of just a few,

individual components should be connected to the store instead of just a few, "Redux may not be as efficient out of the box when compared to other libraries. For maximum rendering performance in a React application, state should be stored in a normalized shape, many individual components should be connected to the store instead of just a few" I read this on https://redux.js.org/faq/performance The question is why "many individual components should be connected to the store instead of just a few" help improve performance ? I always try to minimize accessing to redux store by reduce connected Component , does it right ? Yes, example to avoid to re render a Parent component for refresh a Child component it is usefull to directely connect the Child ... and many other reasons – N.Safi Jul 2 at 14:22

Log Trace.WriteLine in Azure

Log Trace.WriteLine in Azure Our team has an ASP.NET Core Web Application which integrates Multisafepay payment provider (MSP). We use the .NET wrapper of MSP to communicate with the API of the payment provider. In some cases when we asking for the payment URL where the user can pay for his order we got an error code 9999 (unknown error). Mostly this happens after we restart our Web App in Azure or when it comes back from idle time. I checked out the code of the MSP wrapper. It has some Trace.WriteLine statement in its code right where the error 9999 occurs. Is there any way to log the content of the trace in Azure? I've tried almost everything. Modyfing the web.config, and adding trace listneres to it, turning on the Application Loggin and Log Stream in Azure, etc. but nothing worked. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cooki

How do you handle the serving of images for screens with different dpi?

How do you handle the serving of images for screens with different dpi? I have images with different dpi , How do you handle the serving of images for screens with different dpi? here is what I have so far. @media only screen and (-webkit-min-device-pixel-ratio: 1.5), only screen and (min--moz-device-pixel-ratio: 1.5), only screen and (-o-device-pixel-ratio: 3/2), only screen and (min-device-pixel-ratio: 1.5) { //high resolution images go here } Is this the right way of handling images with different dpi? 1 Answer 1 The best way to handle different image-sizes (responsive) in combination with retina is to use scrset/sizes, here you hand the browser information it needs to deside which is the best image to use. https://ericportis.com/posts/2014/srcset-sizes/ <img src="small.jpg" srcset="large.jpg 1024w, medium.jpg 640w, small.jpg 320w&q

Cannot create new Rust project with Docker: “could not determine the current user”

Cannot create new Rust project with Docker: “could not determine the current user” Following the Docker documentation for Rust, I can't create a new project using cargo new without getting could not determine the current user, please set $USER . Here's the command I'm using: cargo new could not determine the current user, please set $USER docker run -it --rm -v "$PWD":/app -w /app rust:1.27.0-slim-stretch cargo new project --bin 1 Answer 1 Forwarding the $USER environment variable from my machine seems to do the trick: $USER docker run -it --rm -e USER=$USER -v "$PWD":/app -w /app rust:1.27.0-slim-stretch cargo new project --bin 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

Do Runtime Type Services (RTTS) use database to get data descriptions?

Do Runtime Type Services (RTTS) use database to get data descriptions? Question Do methods like describe_by_data , get_ddic_field_list , get_components (of cl_abap_typedescr and similar), retrieve data from database or does it get generated on application server? describe_by_data get_ddic_field_list get_components cl_abap_typedescr I looked at those classes and all of the some methods (that populate cache, presumably) appear to pull data in non-standard ways ( METHOD ... BY KERNEL MODULE ... ) and others pull data from cache. I am wondering how it gets pulled if it is not cached. METHOD ... BY KERNEL MODULE ... Google didn't give me any concrete info on this topic either. Some context, in case details become relevant I've been looking into implementing dynamic select clauses generation for some generic classes (to replace asterisk for column-based processing in S/4HANA and hopefully reduce the strain on DB). Since most of those classes retrieve data into dictionary type stru

Chapter 7, Automate the boring stuff with Python, practice project: regex version of strip()

Chapter 7, Automate the boring stuff with Python, practice project: regex version of strip() I am reading the book "Automate the boring stuff with Python'. In Chapter 7, in the project practice: the regex version of strip(), here is my code (I use Python 3.x): def stripRegex(x,string): import re if x == '': spaceLeft = re.compile(r'^s+') stringLeft = spaceLeft.sub('',string) spaceRight = re.compile(r's+$') stringRight = spaceRight.sub('',string) stringBoth = spaceRight.sub('',stringLeft) print(stringLeft) print(stringRight) else: charLeft = re.compile(r'^(%s)+'%x) stringLeft = charLeft.sub('',string) charRight = re.compile(r'(%s)+$'%x) stringBoth = charRight.sub('',stringLeft) print(stringBoth) x1 = '' x2 = 'Spam' x3 = 'pSam' string1 = ' Hello world!!! ' string2 = 'SpamSpamBaconSpamEggsSpamSpam' stripRegex(x1

How to check if stored procedure returns data or not?

Image
How to check if stored procedure returns data or not? I have a stored procedure GetLastRecordId() in SQL Server which returns the last record id in controller of ASP.NET MVC project. But the problem is that when there is no data in the table, it shows a result like below so I can't check against null: GetLastRecordId() My stored procedure: ALTER PROCEDURE [dbo].[GetLastRecordId] AS BEGIN SET NOCOUNT ON; SELECT CustomerCreditAppId, CompanyName FROM tblname WHERE CustomerCreditAppId = (SELECT MAX(CustomerCreditAppId) FROM tblname) END Expand the results view and re-upload your screenshot maybe? Also, copy/paste the stored procedure and add corresponding tag? – Rafalon Jul 2 at 14:01 I cannot see anything in this screenshot :-)

Do we really need to add spring boot starter web for spring boot admin clients?

Do we really need to add spring boot starter web for spring boot admin clients? Version 1.5.4 was working fine without extra declaration of starter web in POM. When I upgraded to 2.0.1, I had to add starter web to POM to make it work. Without starter web, there is no error or no log related to registering the application. It's not documented anywhere as far as I know. Can anyone please confirm? can u post the exception which u were getting without the dependency? – Indraneel Bende 10 hours ago Hi @IndraneelBende , I did not get any error in logs. I'm updating the question. – Anand Varkey Philips 9 hours ago Can u post the complete log w

How to flat map a dataframe with unequal lists?

How to flat map a dataframe with unequal lists? I have a data frame as follows- a | b | c [1] | [3,4,5,6] | [7,8,9,10] i need the output as a | b | c 1 3 7 1 4 8 1 5 9 1 6 10 Currently i am getting output as below upon using the following statement- cols=['a','b','c'] df.rdd.flatMap(lambda x: itertools.izip_longest(*[x[c] for c in cols])).toDF(cols) a | b | c 1 3 7 null 4 8 null 5 9 null 6 10 The number of columns are not fixed. If the solution is a generalized it would be helpful. 1 Answer 1 One option is to use itertools.repeat to repeat each array whose length is less than length of the longest array. itertools.repeat from itertools import izip_longest, repeat, chain cols = df.columns def zip_wit

Prolog simple recursion

Prolog simple recursion This is a really simple quesiton but I don't get it. insert(X, L, [X|L]). insert(X, [H|T], [H|T2]) :- insert(X, T, T2). We run it with insert(1, [2,3], L). insert(1, [2,3], L). When it's called the 1st insert produces (1, [2,3], [1|2,3]) > L = [1,2,3], then it looks at the second insert(1, [2|3], [2|T2]) // T2 is a variable im guessing.. and it calls insert(1, [3], T2) which calls the 1st insert again with insert(1, [3], [1|3]) > L = [1,3], which is not true, because it actually returns L = [2,1,3]. What am I missing about recursions? Syntax correction [1|[2,3]] not [1|2,3] and [2|[3]] not [2|3] . – lurker Jul 2 at 13:47 [1|[2,3]] [1|2,3] [2|[3]] [2|3] You neglected to unravel the full recursion in your second example. The call to insert(1, [2|[3]], L) matches the sec

Toggle image(flag's) in language panel

Image
Toggle image(flag's) in language panel I have a language panel in which I have one image ( main-image ) that show's when the page is loaded. I also have three additional image's which are hidden when the page loads. image main-image image's The question is how to toggle main image when one of the additional image's is clicked . I need to toggle main-image with the image which is clicked. image's image Here is Codepen My first try let menuBtn = document.getElementById("menu-btn"); menuBtn.addEventListener("click", ()=>{ let mainBtnImg = document.getElementById("main-btn-img"); let otherThreeImg = document.querySelectorAll(".menu-img"); for(let i = 0;i< otherThreeImg.length; i++){ mainBtnImg.src = otherThreeImg[this].src; } }) Second try changed this part only mainBtnImg.src = this.otherThreeImg; Downvoters please comment first $(document).on('click', function (e) { if ($(e.tar

Handling Chinese /Japense characters in sqoop import

Handling Chinese /Japense characters in sqoop import I am trying to do sqoop import from db2, where table contains Chinese characters in 2 columns like 燃油油位传感器 Using below sqoop command: sqoop job -conf /app1/sqoop-metastore/jdcp/sqoop-site.xml --create <jobname> -- import --connect <connectionstring> --username <xxx> --password-file <xxx> --table <ttt> --target-dir <targetpath> --fields-terminated-by '07' --map- column-java DTC_NAME=String,DTC_DESC=String -m 1 --delete-target-dir Getting below error: Error: java.io.IOException: SQLException in nextKeyValue Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][4.15.120] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null Caused by: java.nio.charset.MalformedInputException: Input length = 1 at java.nio.charset.CoderResult.throwException(CoderResult.java:281) at com.ibm.db2.jcc.am.q.a(q.java:45) a

Specifying array size with constructor

Specifying array size with constructor I found some answers on this but I probably didn't understand it correctly because it didn't work for me Employee is an object defined in another class Employee public class Firm { Employee employees; public Firm (int rosterSize){ this.employees = new employees[rosterSize]; } } Error: cannot find symbol, class employees My question: how can I specify the size of the array employees with a constructor? Is there a question here? – Eran Jul 2 at 13:50 If your class name is Employee , it should be new Employee[rosterSize] – Eran Jul 2 at 13:50 Employee new Employee[rosterSize] Welcome to StackOverflow! P

Personalization of Carousel on AEM 6.3

Personalization of Carousel on AEM 6.3 I have a requirement where we need to personalize the carousel in the home page, based on the location from where the website is accessed. For this I have created required segments and activity and brand, and targeted to the carousel component. The issue I am facing here is that the /etc/cloudsettings/default/contexthub.kernel.js is loading after all the client libs in my project is loaded, so the carousel images are getting updated but not displayed in the form of slides, but one below the other. Is there any event which can be captured by js and then reload the owl-carousel.js? Could someone please suggest any fix for this? 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.

cudart_static - when is it necessary?

cudart_static - when is it necessary? Since newer drivers ship with the CUDA runtime (I can choose 9.1 or 9.2 in the drivers download page) my question is: should my library (which uses a CUDA kernel internally) be shipped with -lcudart_static ? -lcudart_static I had issues launching kernels compiled with 9.2 on systems which used 9.1 CUDA drivers. What's the most 'compatible' way of ensuring my library will run everywhere a recent CUDA driver is installed? (I'm already compiling for a virtual architecture) 1 Answer 1 Since newer drivers ship with the CUDA runtime (I can choose 9.1 or 9.2 in the drivers download page) No, that's incorrect. That choice in the drivers download page is related to the fact that each CUDA version has a minimum required driver version associated with it. It does not mean that the driver ships with the CUDA runtime (stated another way, the driver does

Why sort order in table makes the View in initial stage in my MVC application

Why sort order in table makes the View in initial stage in my MVC application I want to implement SortOrder into my project. There are few issues at this moment SortOrder If I click on th to sort the item, A-Z does not change in the first place but item gets sorted. To make Z-A , I again has to click on th and again it sorts the item. th A-Z Z-A th Based on country USA , its data has populated in table when page first loads. But the problem is when I change country to UK or some other countries. I gets the data from database on these search. USA UK Now, I again want to sort th but it reloads the whole page and the page goes into initial stage where Country dropdown changes from UK to USA . th UK USA Please guide me. I do not know where I am going wrong. Thank you in advance for your kind help! Model public class CountryList { public int? Country { get; set; } public IEnumerable<SelectListItem> CountriesList { get; set; } public IEnumerable<C