How can I display a dialog before opening a component with Angular and Angular material? Posted: 22 Oct 2021 07:57 AM PDT How can i display a dialog before opening a component with Angular and Angular material? I have 2 components, the first component contains a button onclick route to the second component. I want to display a popup or a dialog in opening this second component. how can i do this ! I work with Angular 8 and Angular material. |
PySpark Leverage Function on MapType Column Values Posted: 22 Oct 2021 07:57 AM PDT Below is a dataframe that represents what I'm trying to accomplish. Please note though, that the function I want to leverage is a bit more complex than this example. import pyspark from pyspark.sql import SparkSession #spark = SparkSession.builder.appName('pyspark-by-examples').getOrCreate() arrayData = [ ('1',{1:100,2:200}), ('1',{1:100,2:None})] df=spark.createDataFrame(data=arrayData, schema = ['id','value']) What I'd like to do is to leverage withColumn to create a new column with a new map typeobject that a function has been applied to. Let's say I wanted to square every value. I know I can create a udf that multiplies values by 2 and use withColumn... However that doesn't appear to work with applying to the MapType. The output I'm trying to achieve is: arrayData = [ ('1',{1:200,2:200},{1:400,2:400}), ('1',{1:100,2:None},{1:200,2:None})] df=spark.createDataFrame(data=arrayData, schema = ['id','value','newCol']) Lastly, I need to maintain parallelism and am trying to avoid explode as I want to keep it in a single row. |
InvalidArgumentException when a binding is configured but not used Posted: 22 Oct 2021 07:57 AM PDT Symfony throw an InvalidArgumentException when a binding is configured but not used by any service $services->defaults() ->autowire() ->autoconfigure() ->bind('$logger_aws', service('logger.aws')); A binding is configured for an argument named "$logger_aws" under "_defaults" ..., but no corresponding argument has been found. It may be unused and should be removed, or it may have a typo. Why can't we make some binding available but not used ? Any known workaround ? Thanks |
Gatsby and WPGraphQL - Build Error "Cannot query field "pages" on type "Query" Posted: 22 Oct 2021 07:57 AM PDT I'm completely new to WPGraphQL and I'm having some bother with building a Gatsby site from my new Wordpress endpoint. When I execute the following query to my endpoint in Postman, I get the page data back successfully: query MyQuery { pages { edges { node { id slug status } } } } However when I attempt to build the Gatsby site, I get the following: ERROR #85923 GRAPHQL There was an error in your GraphQL query: Cannot query field "pages" on type "Query". The relevant code in gatsby-node.js is: const _ = require('lodash') const path = require('path') const { createFilePath } = require('gatsby-source-filesystem') const { paginate } = require('gatsby-awesome-pagination') const getOnlyPublished = edges => _.filter(edges, ({ node }) => node.status === 'publish') exports.createPages = ({ actions, graphql }) => { const { createPage } = actions return graphql(` { pages { edges { node { id slug status } } } } `) .then(result => { if (result.errors) { result.errors.forEach(e => console.error(e.toString())) return Promise.reject(result.errors) } Gatsby config: module.exports = { siteMetadata: { siteUrl: "https://www.yourdomain.tld", title: "graphql-test", }, plugins: [ { resolve: "gatsby-source-wordpress", options: { url: "https://*********/graphql", }, }, "gatsby-plugin-sass", "gatsby-plugin-react-helmet", "gatsby-plugin-sitemap", ], }; This is a brand new test Gatsby site created with gatsby new, all plugins are the latest version. Any help with this greatly appreciated! |
Simple Auth0 for Heroku Posted: 22 Oct 2021 07:56 AM PDT I have a Heroku application, built in React, that I would like to provide simple password protection for. I do not need to provide registration to new users. Just access for 3 or 4 whitelisted developers while we work on this website. I added Auth0 as an add-on in Heroku. Here is the problem. The Auth0 documentation is so overcomplicated that I am not sure how to provision it. And I am unfamiliar with the Auth0 ecosystem. This is so simple. Yet, it is so hard. Thanks if you can help. |
How adding a reset button in SPFx directline chatbot webpart Posted: 22 Oct 2021 07:56 AM PDT actually I have a directline bot extension in SPO connected to qna maker. Would like to add a "reset" button, where user can restart the conversation. Can someone give support on this? |
Is it possible reschedule a task after the web app is running? Posted: 22 Oct 2021 07:56 AM PDT I'm trying to build a web app (in asp.net core mvc) where the user can define when the a scheduled task will be run through a cron expression. The scheduled task will be responsable to send emails with data based on time intervals also defined by the user. In this tutorial I can define when a task will be run before putting the web app running but after that I cannot redefine that cron expression. https://blog.maartenballiauw.be/post/2017/08/01/building-a-scheduled-cache-updater-in-aspnet-core-2.html I don't know if what I want to do is feasible or not. I appreciate any help you can give. Thanks in advance. |
What is the differences between these two for loops? [duplicate] Posted: 22 Oct 2021 07:57 AM PDT Both of the consolt results are same. Anyone can explain me why it is being like that? console result for (let index = 0; index < 5; index++) { console.log(index) } for (let index = 0; index < 5; ++index) { console.log(index) } |
What does Amazon SES Error message: Missing '"' mean? Posted: 22 Oct 2021 07:57 AM PDT Error executing "SendEmail" on "https://email.us-east-1.amazonaws.com"; AWS HTTP error: Client error: `POST https://email.us-east-1.amazonaws.com` resulted in a `400 Bad Request` response: <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <Error> <Type>Sender</Type> <Code>InvalidPara (truncated...) InvalidParameterValue (client): Missing '"' - <ErrorResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/"> <Error> <Type>Sender</Type> <Code>InvalidParameterValue</Code> <Message>Missing '"'</Message> </Error> <RequestId>86fcc78e-4781-407c-b444-26f46a516958</RequestId> </ErrorResponse> The email was not sent. Error message: Missing '"' This is the error i am getting !! and cant figure out the reason .. Somebody give me a hint please |
A question on dynamic programming leetcode problem 221 Posted: 22 Oct 2021 07:57 AM PDT I'm a beginner in Python. The following is my code for leetcode 221 (Maximal Square), it can only pass more than 30 test samples. It fails at the matrix: M=[["1","0","1","0","0"],["1","0","1","1","1"],["1","1","1","1","1"],["1","0","0","1","0"]] . def maximalSquare(matrix): colleng=len(matrix) rowleng=len(matrix[0]) maxsqlst=[] dp=[[0]*rowleng]*colleng for i in range(colleng): for j in range(rowleng): if matrix[i][j]=='1': if i==0 or j==0: print('A',i,j,dp) dp[i][j]=1 print('B',i,j,dp) else: dp[i][j]=min(dp[i-1][j],dp[i][j-1],dp[i-1][j-1])+1 print(i,j,dp) maxsqlst.append(max(dp[i])) return max(maxsqlst)**2 By inserting some print() command, I find that it goes wrong when i=j=0, A 0 0 [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]] B 0 0 [[1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0], [1, 0, 0, 0, 0]]. Why does it make the first colume to be 1 instead of just dp[0][0]? |
I have broken my poetry installation and don't know where to begin to fix it? Posted: 22 Oct 2021 07:57 AM PDT I was using poetry in combination with pyenv for some hobby projects. I created some virtualenvs with pyenv inside some poetry hobby projects. For some reason I deleted some of these python installs which broke the virtualenvs within these projects and now poetry won't work at all anymore. I'm getting this message when I try to start poetry. I'm using Linux Mint 20.1: /home/milkman/.poetry/lib/poetry/_vendor/py2.7/subprocess32.py:149: RuntimeWarning: The _posixsubprocess module is not being used. Child process reliability may suffer if your program uses threads. "program uses threads.", RuntimeWarning) Traceback (most recent call last): File "/home/milkman/.poetry/bin/poetry", line 16, in <module> from poetry.console import main File "/home/milkman/.poetry/lib/poetry/console/__init__.py", line 1, in <module> from .application import Application File "/home/milkman/.poetry/lib/poetry/console/application.py", line 7, in <module> from .commands.about import AboutCommand File "/home/milkman/.poetry/lib/poetry/console/commands/__init__.py", line 4, in <module> from .check import CheckCommand File "/home/milkman/.poetry/lib/poetry/console/commands/check.py", line 2, in <module> from poetry.factory import Factory File "/home/milkman/.poetry/lib/poetry/factory.py", line 18, in <module> from .repositories.pypi_repository import PyPiRepository File "/home/milkman/.poetry/lib/poetry/repositories/pypi_repository.py", line 33, in <module> from ..inspection.info import PackageInfo File "/home/milkman/.poetry/lib/poetry/inspection/info.py", line 25, in <module> from poetry.utils.env import EnvCommandError File "/home/milkman/.poetry/lib/poetry/utils/env.py", line 23, in <module> import virtualenv File "/home/milkman/.poetry/lib/poetry/_vendor/py2.7/virtualenv/__init__.py", line 3, in <module> from .run import cli_run, session_via_cli File "/home/milkman/.poetry/lib/poetry/_vendor/py2.7/virtualenv/run/__init__.py", line 13, in <module> from .plugin.activators import ActivationSelector File "/home/milkman/.poetry/lib/poetry/_vendor/py2.7/virtualenv/run/plugin/activators.py", line 6, in <module> from .base import ComponentBuilder File "/home/milkman/.poetry/lib/poetry/_vendor/py2.7/virtualenv/run/plugin/base.py", line 5, in <module> from backports.entry_points_selectable import entry_points ImportError: No module named entry_points_selectable I have no idea where to start to fix this. Anytime I try a command with poetry I get this same message. Can anyone point me in the right direction? Thank you! |
PHP delete the last word in string by specific word Posted: 22 Oct 2021 07:56 AM PDT How can i delete the last word by a specific word in a string? So example, this is the string $string = 'bla test bla test bla test bla test bla' Now i want to delete test but just the last one, not everyone. Output must be this $string = 'bla test bla test bla test bla bla' i just find str_replace and something, but than i delete every test and not only the last one... I also searched here but not finding something to delete the specific word that i will delete. Jsut find something with trim last space or something. But AFTER the last word i search for, there can be more words |
Laravel custom rule's custom validation error message Posted: 22 Oct 2021 07:57 AM PDT i have a custom rule which i made using rule objects and its working fine except for one thing, that it doesn't pick up the custom validation message i created for it in the component and instead picks whatever it is assigned to it in the validation.php file or the equivalent translation of it from the translated validation.php file. other non-custom rules are working as expected with the custom messages for the same field. the component: public function rules() { return[ 'topic' => ['required', 'string', 'max:250', 'min:5', new Profane], 'name' => ['required', 'string', 'max:250'], 'email' => ['required', 'email:rfc,dns', 'max:250'] ]; } protected $messages = [ 'topic.required' => 'some message', 'topic.max' => 'some message', 'topic.min' => 'some message', --> 'topic.profane' => 'some message', 'name.required' => 'some message', 'name.max' => 'some message.', 'email.email' => 'some message', 'email.required' => 'some message', ]; the rule object: public function passes($attribute, $value) { $profane = ProfaneWord::all(); $words = $profane->pluck('word'); foreach ($words as $word) { if (stripos($value, $word) !== false) return false; } return true; } /** * Get the validation error message. * * @return string */ public function message() { return trans('validation.profane'); } |
PHP String replace <?php $test; ?> with another string Posted: 22 Oct 2021 07:56 AM PDT I need to replace a string that contains <?php echo $test; ?> with "Hello world ". strpos($string_with_php_tags,'<?php echo $test; ?>') !== false) // <-- not working $hello = str_replace('<?php echo $test; ?>', 'hello world', $string_with_php_tags); // not working. Is this possible with PHP? I couldn't find a way to escape from this. Perhaps a regex? Thanks Jorge. |
Members Cache only has me and a bot in it even though I have server members intents Posted: 22 Oct 2021 07:57 AM PDT So I'm making a server info command which needs a member list. I used guild.members.cache.map.lengh but it only returned 2. I tried to trouble shoot it with looking at the collection itself but I only saw myself and the bot. I searched for the issue and found one but the writer just said "its just intents problem" so I turned the member intent on and added GUILD_MEMBERS to my intents but still doesn't work. Can someone tell me how to fix it? |
MongoDB: query greater than value of x by a specfic value Posted: 22 Oct 2021 07:57 AM PDT I have a MongoDB database with documents representing locations on a map, the document structure is below. I'am trying to query for documents with sw_x and sw_y value that is 1000 more or 1000 less than the value of the user location which i get from another post request. This is my get request: router.get('/getdata', (req, res) =>{ mongoose.connect(url, function(err, db) { if (err) throw err; db.collection("mArGo").find({}).toArray(function(err, result) { if (err) throw err; console.log(result); db.close(); }); }) }) Currently this returns all documents in the database, i just need to figure out how to filter them. So in other words i need my query to return docs with sw_x, sw_y values that are greater than or less than the user location value by 1000 DB document example: { _id: new ObjectId("6172a1dcb5ce25759cd9506b"), epsg: 25832, filename: 'dom_657000_5354000_500.sfb', offset_x: -650000, offset_y: -5360000, size_x: 500, size_y: 500, x_sw: 657000, y_sw: 5354000 } |
Do I need to use Enum after I have used Stream? Posted: 22 Oct 2021 07:56 AM PDT I have a lot of data and I'm using Stream.map/2 to get the result. So after using this function I'm getting this result #Stream<[ enum: #Function<51.58486609/2 in Stream.resource/3>, funs: [#Function<47.58486609/1 in Stream.map/2>] ]> Now if I map through the result and just return the value so it will return every value twice. If I'm using Enum.map instead of Stream.map I'm getting the result. Since I cannot use Enum function here what should I do? The result will be a list of map |
How many model classes should I have entity? Posted: 22 Oct 2021 07:56 AM PDT I have an Article entity in my database: public class Article { public Guid Id { get; set; } public string Heading { get; set; } public string Author { get; set; } public string Content { get; set; } public DateTime CreatedOn { get; set; } public DateTime UpdatedOn { get; set; } public int ViewsCount { get; set; } public ImageData Image { get; set; } public IEnumerable<Comment> Comments { get; set; } } For the creation I have ArticleInputModel , and for displaying the details view, I have ArticleDetailsModel , and for update I have ArticleUpdateModel (etc....) However those models have the same properties. - Should I separate this much if it means repetitions of code?
- I try to follow SRP but this seems like is breaking DRY principle?
- Am I overlooking something and what?
|
Symbol 'type scala.package.Serializable' is missing from the classpath Posted: 22 Oct 2021 07:56 AM PDT my classpath is missing serializable and cloneable classes.. i am not sure how to fix this. i have a sbt application which looks like this name := "realtime-spark-streaming" version := "0.1" resolvers += "confluent" at "https://packages.confluent.io/maven/" resolvers += "Public Maven Repository" at "https://repository.com/content/repositories/pangaea_releases" val sparkVersion = "3.2.0" // https://mvnrepository.com/artifact/org.apache.spark/spark-core libraryDependencies += "org.apache.spark" %% "spark-core" % "3.2.0" // https://mvnrepository.com/artifact/org.apache.spark/spark-streaming libraryDependencies += "org.apache.spark" %% "spark-streaming" % "3.2.0" libraryDependencies += "org.apache.spark" %% "spark-sql" % "3.2.0" libraryDependencies += "com.walmart.grcaml" % "us-aml-commons" % "latest.release" libraryDependencies += "org.apache.spark" %% "spark-streaming-kafka-0-10" % sparkVersion //libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-10_2.11" % "3.2.0" % "2.1.3" //libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.7.12" // https://mvnrepository.com/artifact/org.apache.kafka/kafka libraryDependencies += "org.apache.kafka" %% "kafka" % "6.1.0-ccs" resolvers += Resolver.mavenLocal scalaVersion := "2.13.6" when i do a sbt build i am getting.. Symbol 'type scala.package.Serializable' is missing from the classpath. This symbol is required by 'class org.apache.spark.sql.SparkSession'. Make sure that type Serializable is in your classpath and check for conflicting dependencies with `-Ylog-classpath`. A full rebuild may help if 'SparkSession.class' was compiled against an incompatible version of scala.package. import org.apache.spark.sql.{DataFrame, SparkSession} Symbol 'type scala.package.Serializable' is missing from the classpath. This symbol is required by 'class org.apache.spark.sql.Dataset'. Make sure that type Serializable is in your classpath and check for conflicting dependencies with `-Ylog-classpath`. A full rebuild may help if 'Dataset.class' was compiled against an incompatible version of scala.package. def extractData(spark: SparkSession, configDetails: ReadProperties, pcSql: String, query: String): DataFrame = { my dependency tree only shows jars, but this seems to be a class/package conflict or missing.. |
NestJS cannot resolve dependencies Posted: 22 Oct 2021 07:57 AM PDT I am trying to add a servicerequestservice into ordersservice and I keep getting this error. est can't resolve dependencies of the ServiceRequestsService (ServiceRequestRepository, [object Object], CounterService, ?, +). Please make sure that the argument dependency at index [3] is available in the ServiceRequestsModule context. I tried forward reffing the dependancies to eachother like the documentation but this also does not seem to help. service-requests.module.ts import { ServiceRequestsService } from './service-requests.service'; import { ServiceRequestsController } from './service-requests.controller'; import { TypeOrmModule } from '@nestjs/typeorm'; import { ServiceRequest } from './entities/service-request.entity'; import { OrdersModule } from 'src/orders/orders.module'; import { ProductsModule } from 'src/products/products.module'; import { OrderItemsModule } from 'src/order-items/order-items.module'; @Module({ imports: [TypeOrmModule.forFeature([ServiceRequest]), forwardRef(() => OrdersModule), ProductsModule, OrderItemsModule,], controllers: [ServiceRequestsController], providers: [ServiceRequestsService] }) export class ServiceRequestsModule {} orders.module.ts import { forwardRef, Module } from '@nestjs/common'; import { TypeOrmModule } from '@nestjs/typeorm'; import { OrdersService } from './orders.service'; import { OrdersController } from './orders.controller'; import { Order } from './order.entity'; import { OrderItemsModule } from 'src/order-items/order-items.module'; import { ProductsModule } from 'src/products/products.module'; import { CommentsModule } from 'src/comments/comment.module'; import { RetailersModule } from 'src/retailers/retailers.module'; import { PurchasesModule } from 'src/purchases/purchases.module'; import { DeliveriesModule } from 'src/deliveries/deliveries.module'; import { ServiceRequestsModule } from 'src/service-requests/service-requests.module'; @Module({ imports: [TypeOrmModule.forFeature([Order]), forwardRef(() => OrderItemsModule), forwardRef(() => ServiceRequestsModule), ProductsModule, CommentsModule, RetailersModule, PurchasesModule, DeliveriesModule], providers: [OrdersService], controllers: [OrdersController], exports: [OrdersService] }) export class OrdersModule {} service-requests.service.ts import { InjectRepository } from '@nestjs/typeorm'; import { CounterService } from 'src/counter/counter.service'; import { OrderItemsService } from 'src/order-items/order-items.service'; import { Order } from 'src/orders/order.entity'; import { OrdersService } from 'src/orders/orders.service'; import { Product } from 'src/products/product.entity'; import { ProductsService } from 'src/products/products.service'; import { PurchasesService } from 'src/purchases/purchases.service'; import { Repository } from 'typeorm'; import { CreateServiceRequestDto } from './dto/create-service-request.dto'; import { UpdateServiceRequestDto } from './dto/update-service-request.dto'; import { ServiceRequest } from './entities/service-request.entity'; import {format} from "date-fns"; @Injectable() export class ServiceRequestsService { constructor( @InjectRepository(ServiceRequest) private repo: Repository<ServiceRequest>, @Inject(forwardRef(() => OrdersService)) private readonly orders: OrdersService, private readonly counter: CounterService, private readonly purchases: PurchasesService, private readonly orderItems: OrderItemsService, ) {} order.service.ts import { forwardRef, Inject, Injectable, NotFoundException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { FindConditions, getMongoRepository, MongoRepository, Repository } from 'typeorm'; import { Order } from './order.entity'; import { isValidObjectId } from 'mongoose'; import { OrderItemsService } from 'src/order-items/order-items.service'; import { DeliveriesService } from 'src/deliveries/deliveries.service'; import { CounterService } from 'src/counter/counter.service'; import { ObjectId } from 'mongodb'; import {format, parseISO, toDate} from 'date-fns'; import { formatAddress } from 'src/addresses/address.entity'; import { PurchasesService } from 'src/purchases/purchases.service'; import { ActivitiesService } from 'src/activities/activities.service'; import { CommentsService } from 'src/comments/comment.service'; import { ServiceRequestsService } from 'src/service-requests/service-requests.service'; // let lastSku = 0; @Injectable() export class OrdersService { constructor( @InjectRepository(Order) private repository: Repository<Order>, @InjectRepository(Order) private mongoRepository: MongoRepository<Order>, @Inject(forwardRef(() => OrderItemsService)) private readonly orderItems: OrderItemsService, @Inject(forwardRef(() => PurchasesService)) private readonly purchases: PurchasesService, private readonly deliveries: DeliveriesService, private readonly counter: CounterService, @Inject(forwardRef(() => ServiceRequestsService)) private readonly service_request: ServiceRequestsService, private readonly comments: CommentsService, private readonly activities: ActivitiesService, ) { } |
Calling Fortran from C# in VS2019 with iFort Posted: 22 Oct 2021 07:56 AM PDT I am trying to call Fortran code from C#. I am using Visual Studio 2019 and the Intel Fortran Compiler (iFort). I created a fortran DLL project with the following code that compiles without issue (project set to 'release', 'x64'): module Fortran_DLL_Lib implicit none contains subroutine adder(a,b,x,y) !DEC$ ATTRIBUTES DLLEXPORT, ALIAS:'adder' :: adder !DEC$ ATTRIBUTES REFERENCE :: x,y implicit none integer, intent(in) :: a,b integer, intent(out) :: x,y y = a + b x = 2*a+3*b end subroutine end module I then created a C# console application with the following code (project also set to 'Release', 'x64'): using System; using System.Runtime.InteropServices; namespace Call_Fortran_Dll_FromCS_Test { class Program { [DllImport("Fortran_DLL_Lib.dll", CallingConvention = CallingConvention.Cdecl)] public static extern void adder(int a, int b, [Out] int x, [Out] int y); static void Main(string[] args) { int a = 4; int b = 3; int x = 0; int y = 0; Console.WriteLine(a); Console.WriteLine(b); Console.WriteLine(x); Console.WriteLine(y); adder(a, b, x, y); //error occurs here Console.WriteLine(a); Console.WriteLine(b); Console.WriteLine(x); Console.WriteLine(y); Console.ReadKey(); } } } The program runs up until the line that calls the fortran function, then returns the error Exception thrown: 'System.DllNotFoundException' in Call_Fortran_Dll_FromCS_Test.dll An unhandled exception of type 'System.DllNotFoundException' occurred in Call_Fortran_Dll_FromCS_Test.dll Unable to load DLL 'Fortran_DLL_Lib.dll' or one of its dependencies: Access is denied. (0x80070005 (E_ACCESSDENIED)) I have copied both the 'Fortran_DLL_Lib.dll' and 'Fortran_DLL_Lib.lib' files into both the folder that contains the c# project files, as well as the location where the executable project is located, neither seems to help/matter. This is just based on example code I found trying to find ways to do this and isn't specific to what I'm doing. I'm just trying to get a 'proof of concept' together before jumping into more complex applications. The solution doesn't even necessarily be a DLL, that's just what I saw people recommending as the solution to this (in 7+ year old questions on this site). Open to any solutions that successfully call Fortran code from a C# project (eventually, a C# project with a WPF GUI, if that matters). I am in a situation where I can't install Dependency Walker, change environment variables, or pretty much anything that requires elevated privileges. Any help would be greatly appreciated! Update: The very thorough and detailed answer by @JAlex below works perfectly, for both .NET Framework and .NET Core. My ongoing issues are due to user account policies at my workplace that prevent running *.dll files (apparently). Trying the solution on a normal, un-restricted system worked perfectly without issue. |
WPF DataGrid horizontal scrollbar snpas right on column resize Posted: 22 Oct 2021 07:56 AM PDT I have a problem with the default behavior of the resizing of columns: If a DataGrid is too wide for its container, the horizontal scrollbar appears. If I drag the bar to the right and resize most right column, the scrollbar sticks to the right. In my case I don't want that behavior. The scrollbar should either just not stick to the right, or, perfect would be, a resize preview like MS Excel. Can someone tell me how to achieve that? Edit1: This behavior is fine (not sticking to the right): What I don't like is this: If I could realize that easily, I would prefer: /Edit1 I am using .Net 4.8 for a simple WPF application. If an example is need, the following will display two grids and the left one can be used for that behavior: <Window x:Class="DataGridTest.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:DataGridTest" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"> <Window.DataContext> <local:MasterViewModel/> </Window.DataContext> <DockPanel> <Button DockPanel.Dock="Bottom" Command="{Binding DisplaySelectionCountCommand}">Display Selection Count</Button> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <DataGrid Grid.Column="0" ItemsSource="{Binding Items}" AutoGenerateColumns="False" SelectionMode="Extended" local:MultiSelect.IsEnabled="True" HorizontalScrollBarVisibility="Auto"> <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="100"/> <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="100"/> <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="100"/> </DataGrid.Columns> </DataGrid> <DataGrid Grid.Column="1" ItemsSource="{Binding Items}" SelectionMode="Extended" local:MultiSelect.IsEnabled="True"/> </Grid> </DockPanel> </Window> |
rendering sjplot in rmarkdown Posted: 22 Oct 2021 07:57 AM PDT I am using sjPlot to create some tables in rmarkdown (they look great!). However, the tables are generated as individual html pages in my browser, and not as a single html file. Similar to this problem here. I tried pander, and print ..but I can't get it to work! Right now, I have to take a screen shot of each table that appears my browser and paste the tables together. :( Problem: I want to have all the tables in a single file (html, pdf or word) so that I can scroll down the file to view all the tables at once. Here is an example of a single table (there are multiple of these). Could someone please let me know how I can render each of the tables into a single html file? Here is the code from my rmarkdown file. It should run with no error. --- title: "testChi" author: "g" date: "10/15/2021" output: pdf_document: default word_document: default html_document: default --- ```{r setup, include=FALSE, error=FALSE, warning=FALSE} library(magrittr) library(dplyr) library(readr) library(pander) # cols <- svy_final %>% select(matches("Q44_[[:digit:]]")) %>% names(.) cols <- mtcars %>% select(matches("mpg|cyl|disp")) %>% names(.) create_plots <- function(dat,title_name) { # school <- enquo() for (i in cols) { plt <- sjPlot::tab_xtab( var.row = dat$gear, var.col = dat[[i]], show.row.prc = TRUE, var.labels = c("gear size", i), title = title_name ) # return(out) print(plt) } } ``` ```{r loop_print, results = 'asis',error=FALSE, warning=FALSE, message=FALSE} create_plots(mtcars, 'gear and stuff') %>% pander() ``` |
Test my custom AOSP Android OS on real Hardware Posted: 22 Oct 2021 07:57 AM PDT Can I test my AOSP built (Custom Os) on redmi5a phone (rooted)? And How (Explaination will be appreciated) ? Does it requires some specific built? |
pass variable from one page to another in angular 10 Posted: 22 Oct 2021 07:56 AM PDT Hi I am trying to pass a variable from one component to another, I tried the following: @Output() public userFlow = new EventEmitter<boolean>(); this.userFlow.emit(this.userFlowThrough); Now in my other page I want to receive it but just in the ts file and not the html as it will be used for internal logic. I tried this but it did not work: @Input() userFlow: boolean; |
iOS Bluetooth Low Energy Scan in Background (swift3) Posted: 22 Oct 2021 07:57 AM PDT I'm actually working on a Bluetooth Low Energy app on iOS, written in Swift3. My app is working well when is in foreground (scan, connect, exchange data..) with CoreBluetooth whereas, I want it to work in background (the first step is to scan peripheral in background). I read about the subject so I already added the Background modes for the BLE (I added all the background modes so the issue is not there). So, in my code, when I enter in the applicationDidEnterBackground method, I call the initCBCentralManager method. This is working well because it then go in the centralManagerDidUpdateState and in the "Powered On" state. My scan function is called so that's not the problem. But, after the scan method is called, nothing happens, I never get didDiscover peripheral called. When I use the functions in foreground (by calling my functions in applicationWillEnterForeground instead of applicationDidEnterBackground ), it works, but not when it's in background. I read that I need to discover a particular service so it's what I do (my service is 6E400001-B5A3-F393-E0A9-E50E24DCCA9E and also that CBCentralManagerScanOptionAllowDuplicatesKey option will be ignored, but if I change it to false, nothing more happens. So, how am I supposed to scan Bluetooth Low Energy peripheral when I enter in background ? Here is my code : import CoreBluetooth @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, CBPeripheralDelegate, CBCentralManagerDelegate { var _manager : CBCentralManager? func applicationDidEnterBackground(_ application: UIApplication) { initCBCentralManager() } func initCBCentralManager() { var dic : [String : Any] = Dictionary() dic[CBCentralManagerOptionShowPowerAlertKey] = false _manager = CBCentralManager(delegate: self, queue: nil) } public func centralManagerDidUpdateState(_ central: CBCentralManager) { switch central.state { case .poweredOff: print("State : Powered Off") case .poweredOn: print("State : Powered On") scan() case .resetting: print("State : Resetting") case .unauthorized: print("State : Unauthorized") case .unknown: print("State : Unknown") case .unsupported: print("State : Unsupported") } } func scan() { print("SCAN") let service = "6E400001-B5A3-F393-E0A9-E50E24DCCA9E" var service_cbbuid:[CBUUID] = [CBUUID(string: service)] _manager?.scanForPeripherals(withServices: service_cbbuid, options: [CBCentralManagerScanOptionAllowDuplicatesKey:true]) } func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) { print("BACKGROUND_SCAN -> \(peripheral.name.unsafelyUnwrapped) \(RSSI)dBm") } |
Restful API becomes 404 when using the CXF at the same time Posted: 22 Oct 2021 07:56 AM PDT I have a project starts up with Spring Boot. It has some restful API via Spring Integration inbound gateway. Afterward, some webservice endpoint added to the project with CXF. When I setup the CXFServlet mapping, all the restful API became 404. Only I suspend the CXF config the restful API available again. May I know if there is anything block the restful API or the spring integration inbound gateway during using CXF? CXFServlet and Bus @Configuration @ComponentScan("com.kennie") @ImportResource("classpath:cxf-services.xml") public class SimbaAdapterApplicationConfiguration { @Bean public ServletRegistrationBean dispatcherServlet() { return new ServletRegistrationBean(new CXFServlet(), "/ws/*"); } @Bean(name=Bus.DEFAULT_BUS_ID) public SpringBus springBus() { SpringBus bus = new SpringBus(); bus.getInInterceptors().add(new LoggingInInterceptor()); bus.getOutInterceptors().add(new LoggingOutInterceptor()); return bus; } XML configuration <import resource="classpath:META-INF/cxf/cxf.xml"/> <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/> <jaxws:server id="MyService" address="/ws/MyService" serviceClass="com.kennie.IMyService" > <jaxws:serviceBean> <ref bean="myServiceImpl" /> </jaxws:serviceBean> </jaxws:server> Service Interface @WebService public interface IMyService{ @WebMethod public @WebResult(name = "Response") Response doRequest( @WebParam(name = "Request", mode = WebParam.Mode.IN) Request request ); } |
viewing core when compiling with cabal Posted: 22 Oct 2021 07:56 AM PDT When building my application, I would like cabal to automatically output the intermediate core to a file. I can add the -ddump-simpl flag to the cabal file's ghc-options field, but this prints everything to stdout. Is there a way I can get cabal to redirect all of this to a file? |
Flask Jinja Template '<br>'.join Posted: 22 Oct 2021 07:56 AM PDT I have a list: list = ['var','var','var'] In my Jinja template I want to do: {{'<br>'.join(list)}} But the <br> actually shows on the page. Is there a way to do this without adding another {% for item in list %} {{item}} <br> {% endfor %} |
django & the "TemplateDoesNotExist" error Posted: 22 Oct 2021 07:56 AM PDT Ive got an as it seems common beginners problem. im working on my first django project and when I set up my view I get an "TemplateDoesNotExist" error. Ive spend lots of hours on this now - and I know theres lots of topics on it but nothing helped me till now. I hope I can supply all the information needed so an advanced django user can probably directly see what Im doing wrong. im using the developement server. and windows 7 & sqlite3. this is the error I get: TemplateDoesNotExist at /skates/ allsk8s.html Request Method: GET Request URL: http://127.0.0.1:8000/skates/ Django Version: 1.4.3 Exception Type: TemplateDoesNotExist in settings.py I set up the TEMPLATE_DIRS like this: TEMPLATE_DIRS = ( r'H:/netz2/skateprojekt/templates/', ) the template loaders looks like this: TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', # 'django.template.loaders.eggs.Loader', ) this is my view: from django.shortcuts import render_to_response from django.template import RequestContext from sk8.models import Sk8 def AllSk8s(request): skates = Sk8.objects.all().order_by('name') context = {'skates':skates} return render_to_response('allsk8s.html', context, context_instance=RequestContext(request)) it should link to allsk8s.html - and it looks like it does but the file can not be found although it is definitely in the right folder. but as you can see: Template-loader postmortem Django tried loading these templates, in this order: Using loader django.template.loaders.filesystem.Loader: H:\netz2\skateprojekt\templates\allsk8s.html (File does not exist) this is a part of my urls.py urlpatterns = patterns('', url(r'^admin/', include(admin.site.urls)), (r'^skates/$', 'sk8.views.AllSk8s'), ) and this is the system path: H:\netz2\skateproject\templates and in the templates folder is a file called allsk8s.html so as far as I understood it - this should work. I really hope somebody can help me cause this is the second time I ran into a problem like this and I can not figure out the problem. thanks in advance danielll edit: I tried to add this to my settings.py: import os DIRNAME = os.path.abspath(os.path.dirname(__file__)) and changed my TEMPLATE_DIRS to: TEMPLATE_DIRS = ( os.path.join(DIRNAME, r'H:/netz2/skateprojekt/templates/'), ) cause I read it would help - but it still returned the same error - so I changed it back again. ;( edit: also, Ive checked, when I enter a wront url, it throws this error: Using the URLconf defined in skateproject.urls, Django tried these URL patterns, in this order: ^admin/ ^skates/$ so the skates url should be there - but cant be "resolved" - i dont get it :( edit: I found out something new today, the Template-loader postmortem says it also checks these directories: Using loader django.template.loaders.app_directories.Loader: C:\Python27\lib\site-packages\django\contrib\auth\templates\allsk8s.html (File does not exist) C:\Python27\lib\site-packages\django\contrib\admin\templates\allsk8s.html (File does not exist) so I moved my template files there and received a new error - got this fixed by converting my html files from ansi to utf8 and tada - it worked. unfortunately I can not let the template files in this folder cause its not part of the project. when i moved the files back to the original location I was back at the old error :( |
No comments:
Post a Comment