Categories
Mastering Development

Regex in the list does not work as expected in my python code

I have a pdf from which I’m extracting the data by converting into text and using regex in python. I’m using PYPDF2 to convert into text and my pdf has 5 pages. I have to extract specific data from each page and write it into an excel. When I give a single regex in the […]

Categories
Mastering Development

Is there a good tidy way to turn character columns into ordered factors?

I have a list of columns in my data that I want to turn from character into ordered factor. My current solution is this horridly ugly construct, which works but does scald the eyes a bit: load_from_file <- function(filename) { d <- read.csv(filename) d <- d[,2:37] d %<>% na_if("") for(column in alwaystonever_questions) { eval(parse(text=paste(‘d$’,column,’ <- […]

Categories
Mastering Development

getting error when using jlink to create runtime image with time4j datepicker

i am using time4j library for Persian date picker . when i run with gradle i see the app running but when i use jlink to create java fx runtime image i get this error: Caused by: java.util.ServiceConfigurationError: net.time4j.engine.ChronoExtension: module alif.pooya.merged.module does not declare `uses` at java.base/java.util.ServiceLoader.fail(Unknown Source) at java.base/java.util.ServiceLoader.checkCaller(Unknown Source) at java.base/java.util.ServiceLoader.<init>(Unknown Source) at […]

Categories
Mastering Development

NestJS – database entities is returned from the backend instead of DTO

I am new to the NestJs and i am stuck on problem with returning response entity from my backend. The problem is that even when i return Promise-PostDTO-. It’s still returns Post entity from database. With all the properties and nestjs ignore return type. Do you know where can be problem? I though that automatic […]

Categories
Mastering Development

Cannot determine GraphQL input type for argument named

I have two relationed models: 1.- RoleEntity import { Column, Entity, BaseEntity, OneToMany, PrimaryColumn } from "typeorm"; import { Field, ObjectType } from "type-graphql"; import { UserEntity } from "./user.entity"; @ObjectType() @Entity({ name: "tb_roles" }) export class RoleEntity extends BaseEntity { @Field() @PrimaryColumn({ name: "id", type: "character varying", length: 5 }) id!: string; @Field() @Column({ […]

Categories
Mastering Development

Python tkinter scrollable frame – optimize code

#!/usr/bin/env python # -*- coding: utf-8 -*- import tkinter as tk from tkinter import ttk from ttkthemes import ThemedStyle from time import sleep ”’ Usage: scroll_frame_1 = ScrollableFrame.make_scrollable_frame(root,0,0,100,100,"blue",True,True) root = container 0 = row (grid system) 0 = column (grid system) 100 = width 100 = height "blue" = background colour True = scroll_down True […]

Categories
Mastering Development

How to enable @ experimentalDecorators in next.config.js or babelrc

Hi if someone would help me, I wanna use @Decorators on my nextjs app, but I get the following error. Hope someone knows what Im doin wrong Error message: Syntax error: Support for the experimental syntax ‘decorators-legacy’ isn’t currently enabled: I’m trying to use typeorm / type-graphql to generate my backend in an app subfolder. […]

Categories
Mastering Development

Print and use preview using tableView or model pyqt5

I’m trying to print a content of a tableview or the model taht running the table view by using the Qprinter and QPrintPreviewDialog but the best that I can get is an empty table like this this is my code for handle Preview def handlePreview(self): dialog = QtPrintSupport.QPrintPreviewDialog() dialog.setFixedSize(1000,690) dialog.paintRequested.connect(self.handlePaintRequest) dialog.exec_() and for the handle […]

Categories
Mastering Development

Creation of ReplicatedMergeTree table via sqlalchemy

I’m trying to create a new table on Clickhouse cluster via sqlalchemy. And I don’t understand how to specify all the required parameters for ReplicatedMergeTree table’s engine. I used https://github.com/xzkostyan/clickhouse-sqlalchemy library from sqlalchemy import create_engine, Column, MetaData, literal from clickhouse_sqlalchemy import Table, make_session, get_declarative_base, types, engines engine = create_engine(URL) session = make_session(engine) metadata = MetaData(bind=engine) […]

Categories
Database Development

Explain Like I’m Five : SQL (relational) and NOSQL (non-relational) databases

If I had to explain SQL & NOSQL to a college student within 1 minute : You’re familiar with an Excel spreadsheet, right ? That is SQL: id, name, age, weight 1, Adam, 20, 150 2, Bob, 30, 160 … Now imagine if you didn’t know the column names up-front, and wanted to flexible in […]