Sunday, March 21, 2021

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


A coding task i have been assigned to attempt to complete but as i am still a beginner in coding i have no clue on how to solve them

Posted: 21 Mar 2021 08:16 AM PDT

I get TypeError: choice() got an unexpected keyword argument 'k' , when using python random.choice

Posted: 21 Mar 2021 08:16 AM PDT

I want to generate a random string of length n, on a given alphabet.

import random  alphabet = "ACTG"  n= 10  # print(''.join(random.choice(alphabet) for x in range(n)) ) # work fine    print(''.join(random.choice(alphabet, k=n))) # doesn't work  

The error:

Traceback (most recent call last):    File "<input>", line 3, in <module>  TypeError: choice() got an unexpected keyword argument 'k'  

Why does this code won't work? It displays 0

Posted: 21 Mar 2021 08:16 AM PDT

whenever I compile it displays 0 instead of 11. what is wrong this code? I used a function add. I notice that this works when I'm using an array string.

#include <stdio.h>    #include <stdlib.h>    void add(int result, int a, int b);    int main(void) {      int num1 = 5;      int num2 = 6;      int result1 = 0;      add(result1, num1, num2);     printf("%d", result1);     return 0;  }     void add(int result, int a, int b) {    result = a + b;    }  

it's get null but _products has Data List<Product> get products => _products;

Posted: 21 Mar 2021 08:16 AM PDT

i've got data from _product and it's pass to products by code List get products => _products; so it's return null to snapshot. thanks in advance for any answer for this problem. Regards

import '../uti/productsModel.dart';  import '../services/base_services.dart';  import 'package:flutter/foundation.dart';    class ProductListState extends ChangeNotifier {    bool isLoading;    Services _services;    List<Product> _products;    int _categoryId;      List<Product> get products => _products;      ProductListState(categoryID) {      isLoading = true;      this._categoryId = categoryID;      _products = List();      _services = Services();      initProducts();    }      initProducts() async {      _products = await _services.fetchProductsByCategory(          categoryId: _categoryId, page: 1);      isLoading = false;      notifyListeners();    }  }  

Is it possible to combine multiple .stl files to form 3d object?

Posted: 21 Mar 2021 08:16 AM PDT

I am currently working on creation of 3d models with picture and I succeed in creating one face my question is obviously there are multiple faces of for example CPU so it is possible to combine them and create a proper 3d object?Output of .stl file

Can a service be linked to pods with different images?

Posted: 21 Mar 2021 08:16 AM PDT

In Kubernetes, a Service is linked to a Deployment with the selector property of the Service and the label property of the Deployment.

Then, can a Service be linked to Deployments or pods with different images?

How can I read this video with OpenCV?

Posted: 21 Mar 2021 08:16 AM PDT

Why is not properly reading my video? I believe the path syntax is correct. I get the following error:

AttributeError: 'NoneType' object has no attribute 'clip'

Which I read it is a common one, but I cannot find a solution.

from google.colab.patches import cv2_imshow  import cv2    TrDict={'csrt':cv2.TrackerCSRT_create,          'kfc':cv2.TrackerKCF_create,          'boosting':cv2.TrackerBoosting_create,          'mil':cv2.TrackerMIL_create,          'tld':cv2.TrackerTLD_create,          'medianflow':cv2.TrackerMedianFlow_create,          'mosse':cv2.TrackerMOSSE_create}      tracker=TrDict['csrt']()   try:    if tracker:      print('Tracker ready')  except:    print('Tracker not ready')    v=cv2.VideoCapture(r'\Users\Alberto\OneDrive\Documents\Big Data\pirple\opencv\padel.mp4')  #---------------------------------  ret,frame= v.read()  #read until video is completed:  if (v.isOpened() == False):       print("Error opening video stream or file")    while True:    #capture frame by frame    ret,frame=v.read()    if not ret:      break      (success,box)=tracker.update(frame)    if success:      (x,y,w,h)=[int(a) for a in box]      cv2.rectangle(frame, (x,y),(x+w,y+h),(255,0,0),2)        cv2_imshow('Frame',frame)      key=cv2.waitKey(5) & 0xFF      if key==ord('q'):      break    v.release()  cv2.destroyAllWindows()    #---------------  ret,frame=v.read()  cv2_imshow(frame)  bb=cv2.selectROI('Frame',frame)  tracker.init(frame,bb)  

I'm getting thread error while clicking on login button which should move view to another home view controller but get thread on run time

Posted: 21 Mar 2021 08:15 AM PDT

Not Login 2021-03-21 08:05:13.707070-0700 CarSaleAgent[28101:221025] pushViewController:animated: called on <UINavigationController 0x7fa3ba046800> while an existing transition or presentation is occurring; the navigation stack will not be updated. Ok 2021-03-21 08:05:19.099331-0700 CarSaleAgent[28101:221025] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/apple/Library/Developer/CoreSimulator/Devices/B81E5794-CC42-4D72-AEC2-9402A99389A8/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles 2021-03-21 08:05:19.101287-0700 CarSaleAgent[28101:221025] [MC] Reading from private effective user settings. Login Successfull 2021-03-21 08:05:30.885064-0700 CarSaleAgent[28101:221025] *** Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKitCore_Sim/UIKit-3698.84.15/UICollectionView.m:5372 2021-03-21 08:05:30.902325-0700 CarSaleAgent[28101:221025] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier homeCollectionViewCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard' *** First throw call stack: ( 0 CoreFoundation 0x000000010b46129b __exceptionPreprocess + 331 1 libobjc.A.dylib 0x000000010a9fd735 objc_exception_throw + 48 2 CoreFoundation 0x000000010b461022 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000010a401b47 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 194 4 UIKitCore 0x00000001105bad1e -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:] + 2536 5 UIKitCore 0x00000001105bafa9 -[UICollectionView dequeueReusableCellWithReuseIdentifier:forIndexPath:] + 169 6 CarSaleAgent 0x000000010a0a4d99 $S12CarSaleAgent18HomeViewControllerC010collectionE0_13cellForItemAtSo012UICollectionE4CellCSo0lE0C_10Foundation9IndexPathVtF + 345 7 CarSaleAgent 0x000000010a0a501c $S12CarSaleAgent18HomeViewControllerC010collectionE0_13cellForItemAtSo012UICollectionE4CellCSo0lE0C_10Foundation9IndexPathVtFTo + 108 8 UIKitCore 0x00000001105a48f0 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:] + 314 9 UIKitCore 0x00000001105a47b0 -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 31 10 UIKitCore 0x00000001105a9e67 -[UICollectionView _updateVisibleCellsNow:] + 6164 11 UIKitCore 0x00000001105af68e -[UICollectionView layoutSubviews] + 364 12 UIKitCore 0x0000000110c16015 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1441 13 QuartzCore 0x000000011253ad3d -[CALayer layoutSublayers] + 175 14 QuartzCore 0x000000011253fbf7 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 395 15 QuartzCore 0x00000001124b8aa6 _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 342 16 QuartzCore 0x00000001124efc2a _ZN2CA11Transaction6commitEv + 576 17 UIKitCore 0x00000001104f6ff9 _UIApplicationFlushRunLoopCATransactionIfTooLate + 165 18 UIKitCore 0x0000000110454090 __handleEventQueueInternal + 6874 19 CoreFoundation 0x000000010b3c4b31 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17 20 CoreFoundation 0x000000010b3c43a3 __CFRunLoopDoSources0 + 243 21 CoreFoundation 0x000000010b3bea4f __CFRunLoopRun + 1263 22 CoreFoundation 0x000000010b3be221 CFRunLoopRunSpecific + 625 23 GraphicsServices 0x00000001146b91dd GSEventRunModal + 62 24 UIKitCore 0x00000001104fd115 UIApplicationMain + 140 25 CarSaleAgent 0x000000010a0b36d7 main + 71 26 libdyld.dylib 0x000000010e158551 start + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

Zipping coordinates and then accessing them

Posted: 21 Mar 2021 08:17 AM PDT

I have a three vectors of x,y,z coordinates, something like

x = [1,2,3,4,5]  y = [6,7,8,9,10]  z = [11,12,13,14,15]  

I want to zip them to have an 5x3 array of coordinates. But when I do

coords = zip(x,y,z)  

and then try to print coords, I get

enter image description here

and I cannot plot them either,

enter image description here

How can I get 5x3 array?

Need to write a python program to extract questions and answers and create a csv file

Posted: 21 Mar 2021 08:15 AM PDT

I have a text file consist of questions and answers

Below is the example of text file

1. What is namespace in Python?    Answer: In Python, every name introduced has a place where resides and can be found. This space is known as a  namespace. It is an address location where a variable name is mapped to the object placed. Whenever the variable is  searched out, this address location will be searched, to get the corresponding object.    2. How do you make 3D plots/visualizations using NumPy/SciPy?    Answer: Like 2D plotting, 3D graphics is beyond the scope of NumPy and SciPy, but just as in the 2D case, packages exist  that integrate with NumPy. Matplotlib provides basic 3D plotting in the mplot3d subpackage, whereas Mayavi provides a wide  range of high-quality 3D visualization features, utilizing the powerful VTK engine.    3. Differentiate between .py and .pyc files?    Answer: Both .py and .pyc files hold the byte code. ".pyc" is a compiled version of Python file. This file is automatically  generated by Python to improve performance. The .pyc file is having byte code which is platform independent and can be  executed on any operating system that supports .pyc format.      

Output required as csv file with two columns question and answer respectively

question,answer  "1. What is namespace in Python?",  "Answer: In Python, every name introduced has a place where resides and can be found. This space is known as a  namespace. It is an address location where a variable name is mapped to the object placed. Whenever the variable is  searched out, this address location will be searched, to get the corresponding object."      "2. How do you make 3D plots/visualizations using NumPy/SciPy?",  "Answer: Like 2D plotting, 3D graphics is beyond the scope of NumPy and SciPy, but just as in the 2D case, packages exist  that integrate with NumPy. Matplotlib provides basic 3D plotting in the mplot3d subpackage, whereas Mayavi provides a wide  range of high-quality 3D visualization features, utilizing the powerful VTK engine."      "3. Differentiate between .py and .pyc files?  ","Answer: Both .py and .pyc files hold the byte code. ".pyc" is a compiled version of Python file. This file is automatically  generated by Python to improve performance. The .pyc file is having byte code which is platform independent and can be  executed on any operating system that supports .pyc format.  Note: there is no difference in speed when the program is read from .pyc or .py file; the only difference is the load time.  "    

I want to write a python script to save it as csv file.

Register route 404 not found

Posted: 21 Mar 2021 08:18 AM PDT

I am building a register page and when I submit the I am getting a 404 not found. I am using react and express and I think the front end is good. I am missing some back end or have the wrong url for my post request: axios.post('http://localhost:3000/auth'. Would appreciate some advice if anyone can see what I have wrong.

     const handleSubmit = event => {          event.preventDefault();          const user = {            username: username,            password: password,            }          axios.post('http://localhost:5000/', { user })            .then(res=>{              console.log(res);              console.log(res.data);            })        }  

This is the registerPost function for my route.

export const registerPost = async (req, res) => {            const {username, password} =  req.body;            const newUser = new User({username, password});        try {          await newUser.save();          console.log(newUser);            res.status(201).json(newUser);      } catch (error) {          res.status(409).json({ message: error.message });      }      }  

These are the routes.

import express from 'express';    import { getPosts } from '../controllers/posts.js'  import { createPost, updatePost, deletePost, registerPost } from '../controllers/posts.js'    const router = express.Router();    router.get('/', getPosts);  router.post('/', createPost);  router.patch('/:id', updatePost);  router.delete('/:id', deletePost);  router.post('/auth', registerPost);    export default router;        

PHP Merge with separators

Posted: 21 Mar 2021 08:16 AM PDT

I am trying to merge two strings in a specific way.

Essentially I need to merge the first two strings into a third with a pipe symbol between them then separated by commas:

$merge1 = "id1,id2,id3"  $merge2 = "data1,data2,data3"  

Those two would become:

$merged = "id1|data1,id2|data2,id3|data3"  

I hope this makes sense?

Uncaught TypeError: $(...).fullCalendar is not a function is the issue that appears when I try to introduce my calendar into a bootstrap template

Posted: 21 Mar 2021 08:16 AM PDT

I think I may load my scripts wrong but I really can't seem to be finding the problem. If you have any idea it would be much appreciated. If you do have any ideas please share because I watched all of the posts on this topic and I really cannot fix it

<?php  // Initialize the session  require_once "isconnected.php";  ?>    <!DOCTYPE html>  <html lang="en">    <head>     <link rel="stylesheet" href="assets/css/lib/fullcalendar/fullcalendar.min.css" />   <script src="assets/js/lib/fullcalendar/lib/moment.min.js"></script>   <script src="assets/js/lib/fullcalendar/lib/jquery.min.js"></script>   <script src="assets/js/lib/fullcalendar/fullcalendar.min.js"></script>         <script>     $(document).ready(function () {       var calendar = $('#calendar').fullCalendar({           editable: true,           events: "fetch-event.php",           displayEventTime: false,           eventRender: function (event, element, view) {               if (event.allDay === 'true') {                   event.allDay = true;               } else {                   event.allDay = false;               }           },           selectable: true,           selectHelper: true,           select: function (start, end, allDay) {               $("#myModal").modal();               var title = prompt('Event Title:');                 if (title) {                   var start = $.fullCalendar.formatDate(start, "Y-MM-DD HH:mm:ss");                   var end = $.fullCalendar.formatDate(end, "Y-MM-DD HH:mm:ss");                     $.ajax({                       url: 'add-event.php',                       data: 'title=' + title + '&start=' + start + '&end=' + end,                       type: "POST",                       success: function (data) {                           displayMessage("Added Successfully");                       }                   });                   calendar.fullCalendar('renderEvent',                           {                               title: title,                               start: start,                               end: end,                               allDay: allDay                           },                   true                           );               }               calendar.fullCalendar('unselect');           },             editable: true,           eventDrop: function (event, delta) {                       var start = $.fullCalendar.formatDate(event.start, "Y-MM-DD HH:mm:ss");                       var end = $.fullCalendar.formatDate(event.end, "Y-MM-DD HH:mm:ss");                       $.ajax({                           url: 'edit-event.php',                           data: 'title=' + event.title + '&start=' + start + '&end=' + end + '&id=' + event.id,                           type: "POST",                           success: function (response) {                               displayMessage("Updated Successfully");                           }                       });                   },           eventClick: function (event) {               var deleteMsg = confirm("Do you really want to delete?");               if (deleteMsg) {                   $.ajax({                       type: "POST",                       url: "delete-event.php",                       data: "&id=" + event.id,                       success: function (response) {                           if(parseInt(response) > 0) {                               $('#calendar').fullCalendar('removeEvents', event.id);                               displayMessage("Deleted Successfully");                           }                       }                   });               }           }         });   });     function displayMessage(message) {         $(".response").html("<div class='success'>"+message+"</div>");       setInterval(function() { $(".success").fadeOut(); }, 1000);   }   </script>     <style>   body {       margin-top: 50px;       text-align: center;       font-size: 12px;       font-family: "Lucida Grande", Helvetica, Arial, Verdana, sans-serif;   }     #calendar {       width: 700px;       margin: 0 auto;   }     .response {       height: 60px;   }     .success {       background: #cdf3cd;       padding: 10px 60px;       border: #c3e6c3 1px solid;       display: inline-block;   }   </style>         <meta charset="utf-8">     <meta http-equiv="X-UA-Compatible" content="IE=edge">     <meta name="viewport" content="width=device-width, initial-scale=1">     <title>Focus Admin: Creative Admin Dashboard</title>     <!-- ================= Favicon ================== -->     <!-- Standard -->       <link rel="shortcut icon" href="http://placehold.it/64.png/000/fff">     <!-- Retina iPad Touch Icon-->     <link rel="apple-touch-icon" sizes="144x144" href="http://placehold.it/144.png/000/fff">     <!-- Retina iPhone Touch Icon-->     <link rel="apple-touch-icon" sizes="114x114" href="http://placehold.it/114.png/000/fff">     <!-- Standard iPad Touch Icon-->     <link rel="apple-touch-icon" sizes="72x72" href="http://placehold.it/72.png/000/fff">     <!-- Standard iPhone Touch Icon-->     <link rel="apple-touch-icon" sizes="57x57" href="http://placehold.it/57.png/000/fff">     <!-- Styles -->     <link href="assets/css/lib/calendar2/pignose.calendar.min.css" rel="stylesheet">     <link href="assets/css/lib/chartist/chartist.min.css" rel="stylesheet">     <link href="assets/css/lib/font-awesome.min.css" rel="stylesheet">     <link href="assets/css/lib/themify-icons.css" rel="stylesheet">     <link href="assets/css/lib/owl.carousel.min.css" rel="stylesheet" />     <link href="assets/css/lib/owl.theme.default.min.css" rel="stylesheet" />     <link href="assets/css/lib/weather-icons.css" rel="stylesheet" />     <link href="assets/css/lib/menubar/sidebar.css" rel="stylesheet">     <link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">     <link href="assets/css/lib/helper.css" rel="stylesheet">     <link href="assets/css/style.css" rel="stylesheet">        </head>    <body>     <div class="sidebar sidebar-hide-to-small sidebar-shrink sidebar-gestures">       <div class="nano">           <div class="nano-content">               <ul>                   <div class="logo"><a href="index.html">                           <!-- <img src="assets/images/logo.png" alt="" /> --><span>Aplicatie Proiect AS</span></a></div>                   <li class="label">Main</li>                   <li><a class="sidebar-sub-toggle"><i class="ti-home"></i> Dashboard <span                               class="badge badge-primary">2</span> <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                         <li><a href="index1.html">Dashboard 2</a></li>                           <li><a href="index1.html">Dashboard 2</a></li>                       </ul>                   </li>                     <li class="label">Apps</li>                   <li><a class="sidebar-sub-toggle"><i class="ti-bar-chart-alt"></i> Administrare <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="app-profile.php">Profil</a></li>                           <li><a href="app-event-calender.html">Pontaj</a></li>                           <li><a class="sidebar-sub-toggle">Manageri<span                           class="sidebar-collapse-icon ti-angle-down"></span></a>                           <ul>                             <li><a href="index1.html">Dashboard 2</a></li>                               <li><a href="index1.html">Dashboard 2</a></li>                           </ul>                         </li>                           <li><a href="chartist.html">Noutati</a></li>                           <li><a href="chart-peity.html">Task List</a></li>                           <li><a href="chart-sparkline.html">Raport situatie</a></li>                           <li><a href="chart-sparkline.html">Raport situatie OLD</a>  </li>                           <li><a href="chart-sparkline.html">Raport activitate</a></li>                       </ul>                   </li>                   <li><a href=#><i class="ti-layout-grid2-alt"></i> Gospodarii</a></li>                   <li><a href=#><i class="ti-layout-grid2-alt"></i> Beneficiari</a></li>                   <li><a href=#><i class="ti-layout-grid2-alt"></i> Verificari</a></li>                   <li><a href=#><i class="ti-layout-grid2-alt"></i> Instrumente</a></li>                     <li class="label">Features</li>                   <li><a class="sidebar-sub-toggle"><i class="ti-layout"></i> UI Elements <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="ui-typography.html">Typography</a></li>                           <li><a href="ui-alerts.html">Alerts</a></li>                             <li><a href="ui-button.html">Button</a></li>                           <li><a href="ui-dropdown.html">Dropdown</a></li>                             <li><a href="ui-list-group.html">List Group</a></li>                             <li><a href="ui-progressbar.html">Progressbar</a></li>                           <li><a href="ui-tab.html">Tab</a></li>                         </ul>                   </li>                   <li><a class="sidebar-sub-toggle"><i class="ti-panel"></i> Components <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="uc-calendar.html">Calendar</a></li>                           <li><a href="uc-carousel.html">Carousel</a></li>                           <li><a href="uc-weather.html">Weather</a></li>                           <li><a href="uc-datamap.html">Datamap</a></li>                           <li><a href="uc-todo-list.html">To do</a></li>                           <li><a href="uc-scrollable.html">Scrollable</a></li>                           <li><a href="uc-sweetalert.html">Sweet Alert</a></li>                           <li><a href="uc-toastr.html">Toastr</a></li>                           <li><a href="uc-range-slider-basic.html">Basic Range Slider</a></li>                           <li><a href="uc-range-slider-advance.html">Advance Range Slider</a></li>                           <li><a href="uc-nestable.html">Nestable</a></li>                             <li><a href="uc-rating-bar-rating.html">Bar Rating</a></li>                           <li><a href="uc-rating-jRate.html">jRate</a></li>                       </ul>                   </li>                   <li><a class="sidebar-sub-toggle"><i class="ti-layout-grid4-alt"></i> Table <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="table-basic.html">Basic</a></li>                             <li><a href="table-export.html">Datatable Export</a></li>                           <li><a href="table-row-select.html">Datatable Row Select</a></li>                           <li><a href="table-jsgrid.html">Editable </a></li>                       </ul>                   </li>                   <li><a class="sidebar-sub-toggle"><i class="ti-heart"></i> Icons <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="font-themify.html">Themify</a></li>                       </ul>                   </li>                   <li><a class="sidebar-sub-toggle"><i class="ti-map"></i> Maps <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="gmaps.html">Basic</a></li>                           <li><a href="vector-map.html">Vector Map</a></li>                       </ul>                   </li>                   <li class="label">Form</li>                   <li><a href="form-basic.html"><i class="ti-view-list-alt"></i> Basic Form </a></li>                   <li class="label">Extra</li>                   <li><a class="sidebar-sub-toggle"><i class="ti-files"></i> Invoice <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="invoice.html">Basic</a></li>                           <li><a href="invoice-editable.html">Editable</a></li>                       </ul>                   </li>                   <li><a class="sidebar-sub-toggle"><i class="ti-target"></i> Pages <span                               class="sidebar-collapse-icon ti-angle-down"></span></a>                       <ul>                           <li><a href="page-login.html">Login</a></li>                           <li><a href="page-register.html">Register</a></li>                           <li><a href="page-reset-password.html">Forgot password</a></li>                       </ul>                   </li>                   <li><a href="../documentation/index.html"><i class="ti-file"></i> Documentation</a></li>                   <li><a href="../themes/logout.php"><i class="ti-close"></i> Logout</a></li>               </ul>           </div>       </div>   </div>     <!-- /# sidebar -->       <div class="header">       <div class="container-fluid">         <div class="row">           <div class="col-lg-12">             <div class="float-left">               <div class="hamburger sidebar-toggle">                 <span class="line"></span>                 <span class="line"></span>                 <span class="line"></span>               </div>             </div>             <div class="float-right">               <div class="dropdown dib">                 <div class="header-icon" data-toggle="dropdown">                 <span class="user-avatar"><?php echo htmlspecialchars($_SESSION["username"]); ?>                   </span>                   <i class="ti-angle-down f-s-10"></i>                   <div class="drop-down dropdown-profile dropdown-menu dropdown-menu-right">                     <div class="dropdown-content-body">                       <ul>                         <li>                           <a href="app-profile.php">                             <i class="ti-user"></i>                             <span>Profil</span>                           </a>                         </li>                         <li><a href="http://localhost/Aplicatie/themes/logout.php"><i class="ti-close"></i> Logout</a></li>                       </ul>                     </div>                   </div>                 </div>               </div>             </div>           </div>         </div>       </div>     </div>             <div class="content-wrap">         <div class="main">             <div class="container-fluid">                 <div class="row">                     <div class="col-lg-8 p-r-0 title-margin-right">                         <div class="page-header">                             <div class="page-title">                                 <h1>Bine ati venit!</h1>                             </div>                         </div>                     </div>                     <!-- /# column -->                     <div class="col-lg-4 p-l-0 title-margin-left">                         <div class="page-header">                             <div class="page-title">                                 <ol class="breadcrumb">                                     <li class="breadcrumb-item"><a href="#">Dashboard</a></li>                                     <li class="breadcrumb-item active">Home</li>                                 </ol>                             </div>                         </div>                     </div>                     <!-- /# column -->                 </div>                 <!-- /# row -->                 <section id="main-content">                     <div class="row">                         <div class="col-lg-12">                             <div class="card">                                 <div class="card-title">                                     <h4>Pontaj </h4>                                     <div class="float-sm-right">                                     <button href="#" data-toggle="modal" align="right" data-target="#add-gosp" class="btn btn-primary btn-addon" type="button">                                       <i class="ti-pencil-alt2"></i>Adauga gospodarie</button>                                     </div>                                           <div id='calendar'></div>                                     <div class="row">                                       </div>                             </div>                             <!-- /# card -->                         </div>                         <!-- /# column -->                     </div>                     <!-- /# row -->                     <div class="response"></div>                           <div class="col-lg-12">                             <div class="footer">                                 <p>2018 © Admin Board. - <a href="#">example.com</a></p>                             </div>                         </div>                     </div>                 </section>               </div>         </div>     </div>         <!-- jquery vendor -->     <script src="assets/js/lib/jquery.min.js"></script>     <script src="assets/js/lib/jquery.nanoscroller.min.js"></script>     <!-- nano scroller -->     <script src="assets/js/lib/menubar/sidebar.js"></script>     <script src="assets/js/lib/preloader/pace.min.js"></script>     <!-- sidebar -->       <script src="assets/js/lib/bootstrap.min.js"></script>     <script src="assets/js/scripts.js"></script>     <!-- bootstrap -->           <!-- scripit init-->    </body>    </html>    

I moved the declarations around and I still cannot find the problem when I get rid of one error another 2 pop up.

how to set image and info side by side in css

Posted: 21 Mar 2021 08:16 AM PDT

I am stuck in a problem when am trying to set image and text side by side then its not shown perfect , checkout below I shared my code.

This is my image

https://ibb.co/SKS3bJM

i want like this

https://ibb.co/RhFkbkX

index.html

<div class="container">      <div class="row">          <div class="col-md-4 mt-2">              <img src="Images/twitter.jpg" style="width: 200px;">              <div style="margin-top: 10px;">                  <h4>Should Twitter Get Rid of Follower Counts?</h4>                  <p>The possibility feels closer than ever</p>                  <p>Cool Neha in All Things Creative</p>                  <p><b>JAN 9. 5 min read</b></p>                </div>                       </div>          <div class="col-sm-4">              <div class="row" style="display: flex; flex-direction: column;"  style="height: 50px;">                  <div class="col-sm-4" style="display: flex; ">                      <img src="Images/html.jpg" style="width: 100px; height: 100px;">                      <p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>                  </div>                  <div class="col-sm-4" style="display: flex;">                      <img src="Images/cs.png" style="width: 100px; height: 100px;">                      <p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>                  </div>                  <div class="col-sm-4" style="display: flex;">                      <img src="Images/js.png" style="width: 100px; height: 100px;">                      <p>Html, a standardized system for tagging text files to achieve font, colour, graphic, and hyperlink effects on WWW pages.</p>                  </div>              </div>          </div>          <div class="col-sm-4  mt-2">              <img src="Images/cofee.png" style="width: 350px;">              <div style="margin-top: 10px;">                  <h4>No,That's Not How You Say It.</h4>                  <p>A short Personal history of my favourite fast Food.</p>                  <p>VIP Singh</p>                  <p><b>JAN 29. 8 min read</b></p>              </div>                       </div>      </div>  </div>  

How to centre text vertically AND horizontally in a div whilst also flowing around an image who's size can vary

Posted: 21 Mar 2021 08:16 AM PDT

Is it possible to centre text using CSS horizontally and vertically within a div that also has a variable size image (which should always be right-aligned)?

For example, this is to style the "header" of a sports league table display - with the header basically consisting of the league name (the text) and optionally a league logo (the image). The image width and height could be variable, depending on the logo image used.

.lbo_header_logo {      border: 1px solid #31639C;      float: right;      margin-left: 20px;      vertical-align: middle;  }    .lbo_header_title {      padding: 5px;      background-color: #ddeeff;      border: 1px solid #31639C;      min-width: 550px;      vertical-align: middle;      width: 50%;  }    .lbo_header_name {      color: black;      font-size: 16px;      font-weight: bold;      overflow: hidden;      text-align: center;      vertical-align: middle;  }
<html>    <head>      <title>Test!!</title>  </head>        <body>    <div class="lbo_header_title">      <div class="lbo_header_name">League 1<IMG class="lbo_header_logo" src="images/logo1.gif" width="70" height="30"></div>  </div>    <div class="lbo_header_title">      <div class="lbo_header_name">League 2<IMG class="lbo_header_logo" src="images/logo2.gif" width="30" height="70"></div>  </div>                            </body>    </html>

I think I've managed to get the text centred horizontally (as per the example), but have struggled vertically!

I've tried all manner of hacks, such as the line-height trick - but this doesn't work for me as the height of the image is unknown.

I guess I'd be looking for some sort of solution that uses a max value for the image height, as ultimately I'd want to limit the logo to a sensible height/width anyway (i.e. to avoid them uploading a stupidly long/wide image that screws up the display anyway!).

x86 Assembly: int13h seems to not load program

Posted: 21 Mar 2021 08:16 AM PDT

Recently I've been trying to make an operating system for fun and I started with the bootloader. First I'd like to start by saying I asked another question about the same side effect (program not running) yesterday, but it turns out the cause is probably different than what I first thought. So, this is the bootloader code:

start: jmp boot    boot:      cli                               ; Disable interrupts      cld                               ; Clear direction flags          mov al, 2                         ; Read 2 sectors      mov ch, 0                         ; Track 0      mov cl, 2                         ; Read 2nd sector (1st sector is bootloader)      mov dh, 0                         ; Head number      mov dl, 0                         ; Drive number (0 = floppy drive)        ; Specify memory address to read floppy to      mov cx, 0x5000      mov bx, cx      mov es, bx      xor bx, bx        mov ah, 0x2                       ; INT 0x13 with AH=0x2 means read sector      int 0x13                          ; Call BIOS to read sector      jmp cx                            ; Jump to sector      ; Must be 512 bytes    times 510 - ($-$$) db 0    dw 0xAA55                           ; Boot Signature  

However, the sample program I have never runs. Running this on QEMU, I previously thought the issue was that the jmp goes to the wrong address, but now after getting a memory dump and doing some more debugging I see that the jmp happens and it goes to the correct address, but address 0x5000 is all zeroes and has absolutely nothing, nor does anything near it. Could this be a problem with GDB/QEMU not being good with segmentation or real mode? I read something about that. Or perhaps I am using int 0x13 wrong? Perhaps segmentation doesn't work like this? Since I use the value of a register for the address to start storing the data into and then also use it to jump there, shouldn't it be the exact same address thus should be correct? I couldn't find anything on the internet helping with this and I'm totally confused. Please enlighten me. All help is appreciated, thank you!

CHARTJS baar chart not showing

Posted: 21 Mar 2021 08:17 AM PDT

i have this js code for a bar chart and i use python data for the yaxis this is my js code :

 <div class="btcprices-chart">                      <canvas id="myChart3"></canvas>                      <script>                          var ctx = document.getElementById('myChart3').getContext('2d');                          var chart = new Chart(ctx, {                              // The type of chart we want to create                              type: 'bar',                                // The data for our dataset                              data: {                                  labels: ["day1", "day2", "day3", "day4"],                                  datasets: [{                                      label: 'bitcoin brices per day',                                      backgroundColor: 'rgb(66, 103, 178, 0.6)',                                      borderColor: 'rgb(75, 79, 220))',                                      borderWidth: 2,                                      data: {{ btcprices|safe }}                                  }]                              },                                // Configuration options go here                              options: {                                  title: {                                      display: true,                                      text: 'bitcoin brices per day'                                  }                              }                          });                      </script>                  </div>  

i have another chart but with nother data values : data=[626830186, 1055315163, 64138356, 314568549] and for this chart btcprices=[59014, 57922, 58243, 58376] (that's what shows in the console after i runserver because i have pprint(data) and print(btcprices) in my views.py)

in data : {{ btcprices|safe }} , it works when i replace it by {{ data[safe }} but when i put in data : {{ btcprices|safe }} it shows this : weird bar chart output

ps : whn i call the 2 variables data and btcprices in th html just to print them on the web page like : {{data}} and {{btcprices}} only data shows !!!! this is my views.py by the way :

context = {      "data": data,      "btcprices": btcprices,  }  return render(request, "index.html", context)  

How to run Angular e2e with SSL enabled?

Posted: 21 Mar 2021 08:17 AM PDT

I have a pretty simple Angular sample project, with some end to end tests. I'm testing OAuth2 and OIDC flows in my end to end tests, and browsers behave quite differently with or without SSL/TLS enabled. So I'd like to run my end to end tests with SSL turned on locally too.

I now run my tests with the Angular CLI like this:

ng e2e  

I tried to run it like this:

ng e2e --ssl=true  

Although the --ssl=true option does work for ng serve, it does not work for ng e2e giving me:

Unknown option: '--ssl'

Is there a way or workaround to make the Angular CLI based Protractor / Selenium tests run with SSL?

How to delete the # from the URL when linking in react or vanilla js

Posted: 21 Mar 2021 08:16 AM PDT

I'm developing a website where I have a navbar at the top, and when an option is selected, the screen goes to the part of the page that is linked with the ID. My question is, once that I press the option, the URL shows the # + the option selected. How can I remove the # and leave just the word, or if is it's an option to delete both. IM NOT USING REACT-ROUTER-DOM

WHAT HAPPENS: www.mywebsite.com/#aboutus

WHAT I WANT TO HAPPEN: www.mywebsite.com/aboutus or just www.mywebsite.com

NAVBAR

<div className="main-navbar">      <a href="#home">home</a>      <a href="#aboutus">about</a>      <a href="#contact">contact</a>  </div>  

EXAMPLE

<div id="aboutus">    //CONTENT  < /div>  

different colors for bar chart with chart.js

Posted: 21 Mar 2021 08:16 AM PDT

Good day, I have a problem with the color scheme of my bar chart. For each time there are 4 values. These values should have 4 different colors. You will find the code and a current picture in the attachment.

I tried several options for the coloring. Nothing works.

For example, if I change the following, the bars will all just be grayed out

backgroundColor: [ "red", "green", "blue", "black", "yellow", ],

Thank you!!!!

 public function auswertungBarDiagrammUhrzeiten($daten, $auswertungsKategorien)      {          $html = "";            foreach($daten as $daten_tag_key =>$daten_tag) {                $labelString = "";              $datasetString = "";                $auswertungsKategorien = array_unique($auswertungsKategorien);               sort($auswertungsKategorien);                              for ($x = 0; $x < 24; $x++) {                  $labelString .= '"' . $x . '",';              }                foreach ($daten_tag as $daten_tag_kategorie_key => $daten_tag_kategorie) {                  $dataString = "";                  for ($x = 0; $x < 24; $x++) {                      $dataString .= '"' . $daten_tag_kategorie[$x . '_A'] . '",';                  }                    $datasetString .=                      '{                        label: "'.$daten_tag_kategorie_key.'",                         backgroundColor: "red",                        data: [' . $dataString . '],                   },';              }                $html .= '<canvas id="myBarChartUhrzeiten' . $daten_tag_key . '"></canvas>'                         . '<script>                                            var ctx = document.getElementById("myBarChartUhrzeiten' . $daten_tag_key                . '").getContext("2d");                                            console.log(ctx);                      var chart = new Chart(ctx, {                          // The type of chart we want to create                          type: "bar",                                // The data for our dataset                          data:                          {                              labels:   [' . $labelString . '],                              datasets: [' . $datasetString . ']                          },                                                    options:                          {                               legend:                                {                                  display: false,                               },                                                              plugins:                                {                                  datalabels:                                   {                                      display: false,                                  },                               }                          }                      });                        </script>';            }          return $html;      }

enter image description here

Can I put activity final node directly after Synchronization node?

Posted: 21 Mar 2021 08:17 AM PDT

I want to put activity final node after Parallelization node.

enter image description here

Am I correct in putting activity final node, or better use flow final node in one of the activity node?

Php code runs sometimes or not in html file with isset($_POST

Posted: 21 Mar 2021 08:16 AM PDT

I'm a bit noob in php and i'm trying to write a simple page with button inside, these buttons just run php tasks

Obviously, 2 buttons work but the last one not

<!DOCTYPE html>  <html>  <head>          <title>                  Update Post Mise à Jour          </title>  </head>  <body style="text-align:center;">          <h1 style="color:blue;">                  Welcome back          </h1>                   <?php                  if(isset($_POST['button1'])) {                          $file = 'example.php';                          $newfile = 'example.txt.bak';                          echo "La copie est faite";                            if (!copy($file, $newfile)) {                          echo "La copie $file du fichier a échoué...\n";                          }                    }                  if(isset($_POST['button2'])) {                            $lines1 = file( '/var/www/html/EmailService.php', FILE_IGNORE_NEW_LINES );                          $lines2 = file( '/var/www/html/EmailServicecopy.php', FILE_IGNORE_NEW_LINES );                            $result = array_diff( $lines1, $lines2 );                          print_r( $result );                  }                  if(isset($_POST['button3'])) {                            $filename = "/var/www/html/EmailService.php";                          $fichier = fopen($filename, 'c+b');                          $texte = fread($fichier, 5454);                          $filename2 = "/var/www/html/motif.txt";                          $fichier2 = fopen($filename2, 'r');                          $texte .= fread($fichier2, filesize($filename2));                          $texte .= fread($fichier, filesize($filename));                          fseek($fichier, 0);                          fwrite($fichier, $texte);                          fclose($fichier);                          fclose($fichier2);                                            echo "Update effectué";                  }          ?>          <form method="post">                  <input type="submit" name="button1" value="Copie de EmailService"/>                    <input type="submit" name="button2" value="Check des fichiers"/>                    <input type="submit" name="button3" value="Update du script"/>          </form>  </body>  </html>  

The first and second if(isset($_POST['button1'])) { work but the third not I got the answer Update effectué but my file is not modified

When i put

<?php                          $filename = "/var/www/html/EmailService.php";                          $fichier = fopen($filename, 'c+b');                          $texte = fread($fichier, 5454);                          $filename2 = "/var/www/html/motif.txt";                          $fichier2 = fopen($filename2, 'r');                          $texte .= fread($fichier2, filesize($filename2));                          $texte .= fread($fichier, filesize($filename));                          fseek($fichier, 0);                          fwrite($fichier, $texte);                          fclose($fichier);                          fclose($fichier2);  ?>  

in a file and i run php file.php, then it works

I'm a bit lost What am i doing wrong ?

Error in XGBoost: 'data' has class 'character' and length

Posted: 21 Mar 2021 08:15 AM PDT

I'm trying to to XGBoost in R. I have a lot of factor variables, which can be seen in the data description.

enter image description here

I used step_string2factor and step_dummy to convert all factor variables to dummy variables so that the XGBoost can work. I also tried step_dummy(all_predictors(),-all_nominal()). Yet, in my last chunk I keep getting the following error:

x Fold1: preprocessor 1/1, model 1/10: Error in xgboost::xgb.DMatrix(x, label = y, missing = NA): 'data' has class 'character' and length 3666440. 'data' accepts either a numer...

The weird part is that I saw online that XGBoost worked in other recipes when using step_dummy and I don't understand the given error, as my data does not have a character class.

xgb_recipe <- recipe(Conversion ~ .,                          data = Data_train_balanced) %>%                step_string2factor(all_nominal()) %>%                step_dummy(Jaar, Aantal, Verzekering, Retentie, Correct_Emailadres_flag,                           Klant_Email_Ja_Nee, Klant_Bellen_Ja_Nee, Klant_Mailen_Ja_Nee, Topsegment, Regio_Naam,                           Month, Weeks_split, Max_Loss, one_hot = TRUE)  
xgb_model_tune <- boost_tree(trees = tune(),                               tree_depth = tune(),                               learn_rate = tune(),                               stop_iter = 200) %>%                    set_mode("classification") %>%                    set_engine("xgboost")  
xgb_tune_wf <- workflow() %>%    add_recipe(xgb_recipe) %>%    add_model(xgb_model_tune)    xgb_tune_wf  
class_metrics  
# Create tuning grid  set.seed(0132)  xgb_grid <- expand.grid(trees = 250 * 1:10,                          learn_rate = c(0.1, 0.01),                          tree_depth = 1:5)  xgb_grid    
# Perform the grid search based on our created cross-validation (cv_folds)  xgb_tune_res <- tune_grid(    xgb_tune_wf,    resamples = cv_folds,    grid = xgb_grid,    metrics = class_metrics  )  

Getting a mean from a portion of a column in a data frame

Posted: 21 Mar 2021 08:16 AM PDT

I've got problems with trying to find a mean of a section of a column in a data frame. The first thing I have run into is that the mean as to be a specific part of the data in the column. I do not know how to get R to do this.

The second thing I need to set a marker in the column, as i then need to subtract the mean from the rest of the data, but the marker changes based on what data.frame I'm looking at.

Ive linked the data file. the section that I wanted to find the mean of is from sample 1-168, before the number resets back to 1. When the number resets is the point i need to start subtracting the mean from

Thanks!

Updating a list within a class

Posted: 21 Mar 2021 08:16 AM PDT

Is it possible to update a list within a class based on instance details?

I would like to do something like this:

from formtools.wizard.views import SessionWizardView  class ContactWizard(SessionWizardView):          form_list = [ # a list of forms used per step              (S1, Q1),              (S2, Q2),              (S3, Q3),          ]          def form_updater(self):              if self.get_cleaned_data_for_step("0") != None:                  form_list.append((S3, Q3),)              return form_list    #However, I get thrown an error when I try to make the following call:  ContactWizard.form_updater(ContactWizard)  ## error:  get_cleaned_data_for_step() missing 1 required positional argument: 'step'  

Any help or guidance that you can provide would be VERY greatly appreciated.

how to open / continue expo project in another device with github

Posted: 21 Mar 2021 08:16 AM PDT

I'm pretty new to the expo and developing a mobile app, currently I'm using expo dan react native

I've built an app with the expo and I want to open it on another laptop, so I use GitHub to commit my work there

on the new laptop I already installed expo, node, vs, etc. i cloned the project and can't start it on my new laptop with "npm start"

it shows error like this "Cannot determine which native SDK version your project uses because the module expo is not installed"

which I already checked on my cmd with expo --version

TL: DR how do I start the expo on another laptop with GitHub?

How to let Idea comment my comments in xml right?

Posted: 21 Mar 2021 08:16 AM PDT

I am using Idea to manage my spring project. It uses mybatis for ORM. When I was working on a mapper XML file, I added some comments, marked them, and hit ctrl + / to comment that line, the comments are commentted with a # sign at the start of line.

            ...              <if test="cm.timeTipEnd != null">                  <![CDATA[and r.create_time <= #{cm.timeTipEnd}]]>              </if>  #            My comments explaining the next if below              <if test="cm.writersId != null and cm.writersId != ''">              ...  

Then I tried the block comment hotkey, ctrl + shift + /, and /* */ shows up!

            <if test="cm.timeTipEnd != null">                  <![CDATA[and r.create_time <= #{cm.timeTipEnd}]]>              </if>              /*My comments explaining the next if below*/              <if test="cm.writersId != null and cm.writersId != ''">              ...  

What I want is <!--My comments explaining the next if below-->, though. Is there a way to fix this? I noticed if I select some xml tags and hit the comment key, it would be comment right. However, my comments don't need xml tags.

Edit: a gif demonstration of me adding line comment and block comment to a select statement in mybatis mapper(not working), and doing the same thing to a select tag(working) enter image description here My idea log file: download link

How to set a timeout with a default soap response in soap producer?

Posted: 21 Mar 2021 08:16 AM PDT

I know that timeout is a property of client , but we need to send a response in 2 minutes from spring soap endpoint.

How to timeout in spring soap and send a default response within a specified time from soap producer app?

Container : Tomcat

@Endpoint  public class SOAPEndpoint {      private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";        private Repository repository;                @PayloadRoot(namespace = NAMESPACE_URI, localPart = "getData")      @ResponsePayload      public Response getCountry(@RequestPayload SampleRequest request) {      Response response = new Response();          response.setCountry(repository.retrieveData(request.getParam())); // this lines takes 5 minutes to respond            return response;      }  }  

Yarn - Command yarn import error: This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions

Posted: 21 Mar 2021 08:17 AM PDT

I'm looking for using yarn and npm together in my project and if I find yarn useful for my particular case, I could move my project to use yarn only.

Nevertheless, I'm getting the following error with $yarn import:

local:project_middleware jgil$ yarn import    Internal Error: project-middleware@workspace:.: This package doesn't seem to be present in your lockfile; try to make an install to update your resolutions  at J.getCandidates (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:325115)  at i.getCandidates (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:314232)  at /Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:335605  at Array.map (<anonymous>)  at Ae.resolveEverything (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:335321)  at async Ae.applyLightResolution (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:357937)  at async Ae.restoreInstallState (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:357667)  at async Ke.execute (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:98394)  at async Ke.validateAndExecute (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:2:626801)  at async j.run (/Users/jgil/Development/BerserkerStudio/project_middleware/.yarn/releases/yarn-berry.cjs:17:3854)  

I have already run $yarn set version berry and tried out again and again with different combinations of removing the node_modules directory, running npm install, etc. and nothing gets to make it work... no idea of what's missing.

Could it be a problem with either the version of Node.js or any other component I'm using?

WHMCS show single ticket reply by last update

Posted: 21 Mar 2021 08:16 AM PDT

I want make a new file to call a ticket replies from db and adding feature for showing a single reply only by reply id or reply time for example if called a URL like

history.php?tid=844130&c=1uT0TR8y&lastreply=1222  

How I can do that?

No comments:

Post a Comment