mardi 30 novembre 2021

I need help to get the xpath of the value which is under p tag inside the header

Can you please help me in extracting ingredient list inside the

tag. I tried few things and was able to get till header - Ingredients. I am look to extract the value which should be alligned with header - Ingredients. Path i tried - //DIV[@id="important-information"]//h4[text()='Ingredients:']/text()

enter image description here




Create url using data fetched from database in my webpage

I have a database that has a table of assignments

CREATE TABLE `assignments` (
 `a_id` int NOT NULL AUTO_INCREMENT,
 `title` varchar(50) NOT NULL,
 `description` varchar(250) NOT NULL,
 `file` varchar(50) NOT NULL,
 ` deadline ` datetime NOT NULL,
 PRIMARY KEY (`a_id`)
) 

in my website I would like to view assignments by title, then click on each title (title should be hyperlinked ) to be redirected to details of this specific assignment. here's what I've got so far

  // Get records from the database
    $query = $db->query("SELECT * FROM assignments ORDER BY a_id ASC ");
    
    if($query->num_rows > 0){ 
        while($row = $query->fetch_assoc()){ 
            $assigment_title = $row['a_id'];
           
    ?>
    <div class="list_item">
        <?php echo "<tr><td><a href= 'A i'>" . $row["title"]. "</a></td></tr>"; ?></div>

the problem is 'A i' part, what I want is for the href to change according to the title, I am new to php and I cannot find my workaround. assuming I have a list of urls: A 1,A 2,...A n TIA




Global Error Handling in ASP.NET Core MVC

I tried to implement a global error handler on my Asp.net core mvc web page. For that I created an error handler middleware like described on this blog post.

    public class ErrorHandlerMiddleware
{
    private readonly RequestDelegate _next;

    public ErrorHandlerMiddleware(RequestDelegate next)
    {
        _next = next;
    }

    public async Task Invoke(HttpContext context)
    {
        try
        {
            await _next(context);
        }
        catch (Exception error)
        {
            var response = context.Response;
            response.ContentType = "application/json";

            switch (error)
            {
                case KeyNotFoundException e:
                    // not found error
                    response.StatusCode = (int)HttpStatusCode.NotFound;
                    break;
                default:
                    // unhandled error
                    response.StatusCode = (int)HttpStatusCode.InternalServerError;
                    break;
            }

            var result = JsonSerializer.Serialize(new { message = error?.Message });
            await response.WriteAsync(result);
            context.Request.Path = $"/error/{response.StatusCode}"; // <----does not work!
        }
    }
}

The middleware works as expected and catches the errors. As a result i get a white page with the error message. But i am not able to display a custom error page. I tried it with the following line of code. But this does not work.

context.Request.Path = $"/error/{response.StatusCode}";

Any ideas how I can achive my goal?

Thanks in advance




Python use API to get data

I am kind of stucked in trying to solve following issue: I try to access a web-page in order to get some data for a supplier (need to do it for work) in an automated way, using an api

The API is called https://wl-api.mf.gov.pl and shall provide information stored in json for supplier which can be found over their tax ID.

I use the request package and I am able to manage to get positive response:

import requests
nip=7393033097
response=requests.get("https://wl-api.mf.gov.pl")
print(response) --> Response [200]

If I click on the link and scroll until I find the specific part for the tax information, I find the following line

GET /api/search/nip/{nip}

So what I did is to add this line into my response variable, since this is how I understood it - and there is the point where I think I am wrong

response=requests.get("https://wl-api.mf.gov.pl/search/7393033097/{7393033097}")

However, I cannot access it. Am I doing something wrong - I do believe yes - and can anyone give me a little help :)

Update: If I check the requirements / documentation I find following information where I need a bit support to implement it

GET /api/search/nip/{nip}

(nip?date)
Single entity search by nip

**Path parameters**
nip (required)
*Path Parameter — Nip*

**Query parameters**
date (required)
*Query Parameter — format: date*

**Return type**
EntityResponse
Example data
Content-Type: application/json



Tailwind !important overwrite

I am trying to set a specific margin when it comes to screen size. When using mx-auto it does what I want it to do at first. Starting off with that for smaller screens.

As my user-screen gets bigger, I want the margin to only be 2px instead of auto

This is my code below for my element.

<img    src={'https://i.ibb.co/SnDDJ99/45219372-2219308534767966-7383583342043594752-n.jpg'}
   alt='Oscar Self Portriat'
    className=" h-full
                w-6/12
                rounded-xl


                md:w-4/12
                md:ml-4"
/>

but when the screen gets wider, mx-auto is still prioritized over my md:ml-4 is there any reason why? How can I make sure mx-auto only works for smaller screens and breaks off after md.




firebase control-cache my website is not showing but if you put slash my html code will show

my html code is not showing on https://mangazwert.web.app but if put /home or anything my html code will show. i contacted the firebase team and they say it's cache control and send me some link about them and i dont know what to do in firebase.json.my firebasejson is not working or maybe i did it wrong. could anyone please help me! { "hosting": { "public": "public", "ignore": [ "firebasejson", "/.*", "/node_modules/" ], "rewrites": [ { "source": "", "destination": "/index.html" } ],

"headers": [

  {

    "source": "**/*.@(jpg|jpeg|gif|png|js)",

    "headers": [

      {

        "key": "Cache-Control",

        "value": "no-cache"

      }

    ]

  }

]

} } this is the firebasejson which i did, please tell me if i do it wrong.




Local Audio in HTML

How can I make my html page represent local audio without uploading.
I have code like but the audio is not playing it just represent audio style:

<audio controls preload="none" id="audio"> 
    <source id="first-audio" src="/home/linux/Desktop/Mega/upload/Audio Files/file.wav" type="audio/wav">
 </audio>



How to solve the problem that resultMsg of spring security loginChk.json is broken?

How to solve the problem that resultMsg of spring security loginChk.json is broken?

The settings in security-context.xml are as follows:

         <sec:form-login login-page="/login/index.do"
                         login-processing-url="/login/loginChk.json"/>

At this time, when the login information is entered incorrectly in login/index.do, the result is received as follows.

loginChk.json preview

{resultCd: "fail",… }
resultCd: "fail"
resultMsg: "ì•„ì ´ë"” ë¹„ë°€ë²ˆí ¸ê°€ 맞지 ìŠìŠµë‹ˆë‹¤. ¸í•´ì£¼ì„¸ìš”."

I want to check the contents of resultMsg, but I am wondering how to solve the problem that comes out like a foreign language.

Best Regards!




function webcam not show

i try to modified script with function webcam not work, that show my webcam and i can take picture. i think the code it's obsolete i try to change but nothing show

 var self = this;

    var video = document.querySelector("#videoElement");

    navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia;
    
    if (navigator.getUserMedia) {       
        navigator.getUserMedia({video: true}, handleVideo, videoError);
    }
    
    function handleVideo(stream) {
        video.src = window.URL.createObjectURL(stream);
    }
    
    function videoError(e) {
        // do something
    }

could you help me




can we convert android app script into web app?

i want to know that can we convert the android app script into a web app? if anyone knows about it please tell me. before answering my question I would tell you that I know that we can convert a web app into Andriod app but I don't know can we convert an android app script into a web app or not.instead of down vote your answer will be highly appreciated.




MapBox - How to add a route while scrolling?

How do I add a route between points and make it appear when scrolling just like they have done it here: https://www.arkansasonline.com/2020marathon?

Kind regards




How to redirect a website page to a specific DNS

Maybe this is impossible but I'm atempting to redirect a website page url to a specific dns. The idea is to create the illusion that every page is a different website even if thoses websites are just sub pages.

exemple :

example.com/mypage

I would like to create subdomains to " Mywebsite" such as :

mypage.example.com

Then I would like my previous pages to redirect to the specific subdomain name:

example.com/mypage -> redirect to -> mypage.example.com

Do you think this is something doable?




Web Design and Development

Can any help me where we can find the best design services find?




How to make dynamic id in order records laravel 8

Hello can anyone help me please? its been 2 days anyway, so i just want to make a cashier restaurant order. i have a page with menu list and cart. my problem is when i klik "Beli"(Buy) button and enter amount of menu in the form the order details like menu name, price, quantity etc alway inserted in the first row in my order tables. I.E if i have 3 rows with id (1, 2, 3) the order details will just inserted in order tables with id 1. so i just want insert data appropriate with currently active order id. anyone know how to do it? sorry for my bad english and explanation

My Route

Route::get('/order/create', [OrderController::class, 'index'])->middleware('auth');
Route::post('/order/create/store', [OrderController::class, 'store_order_table'])->middleware('auth')->name('order_store');
Route::get('/order/edit/{id}', [OrderController::class, 'edit_order_table'])->middleware('auth')->name('edit_order');
Route::post('/order/details/{id}', [OrderController::class, 'create_order_details'])->middleware('auth');
Route::get('/order/list', [OrderController::class, 'get_order_list'])->middleware('auth');

My Controller

public function store_order_table(Request $request)
{
    $order = Order::create([
        'user_id' => Auth::user()->id,
        'order_number' => $request->order_number,
        'order_note' => $request->order_note
    ]);

    return redirect()->route('edit_order', ['id' => $order->id]);
}

public function edit_order_table($id)
{
    return view('cashier.edit_order', [
        'menus' => Menu::all(),
        'data' => Order::with('order_details')->where('id', $id)->first()
    ]);
}

public function create_order_details(Request $request, $id) 
{
    $menu = Menu::where('id', $id)->first();

    $new_order = Order::where('user_id', Auth::user()->id)->where('is_paid', 0)->first();
    $order_details = new OrderDetail;
    $order_details->menu_id = $menu->id;
    $order_details->menu_name = $menu->menu_name;
    $order_details->order_id = $new_order->id;
    $order_details->code = 1;
    $order_details->quantity = $request->qty;
    $order_details->one_unit_price = $menu->menu_price;
    $order_details->total_price = $menu->menu_price * $request->qty;
    $order_details->save();

    return redirect()->route('edit_order', ['id' => $new_order->id]);
}

Orderlist

Cart




What is the current state of the art software for creating Excel, Word and PDF Reports

As mentioned i am looking whats currently everybody is using to create Excel, Word and PDF reports.

Currently we are using BIRT but we hope there is something better out there that currently everybody is using.

Can you let me know what you guys are using and whats the pros/cons of the software.




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

I took a udemy course where instructor teach about how to get user tweet.

when i run code it gives me AttributeError: 'NoneType' object has no attribute 'getText'

not getting good support on udemy so kindly anyone please make this code work. Thank you

=====================================================================

from bs4 import BeautifulSoup as soupy

import urllib.request
import re

html = urllib.request.urlopen('https://twitter.com/samad_bloch0x1').read()

soup = soupy(html, features="html.parser",)

x = soup.find('p', {'class':'js-tweet-text'}).getText()

filter = re.findall(r'"(.*)"', x)ut
tweet = filter[0]  

print(tweet)

=============================================================================== Here i pasted whole code, please help me to make this working, Thanks.




How to design a keyword's search in api - by api or procedure in database

I designed a simple page where I display records from the database. They are downloaded via api written in the asp.net core. Each record has a column where it's just a json string with different fields and values. The number of fields in json is dynamic. I don't know in advance how many there will be. I wanted to make a search engine that would search all fields in json right away - does not indicate the field in the search engine. I am generating the appropriate api string with the passed values ​​from the search engine. Api receives it. Now I have a problem. Should the search engine in this case be done only on the api side? Or also on the database side with the use of views and procedures with dynamic query.

1st version is like this:

  • Api receives a string like this:
http://mypage/api/search?keywords=James&keywords=Doe

Api must download the entire data set and then filter it in a loop using the selected keywords. So I think it's not good idea in this form.

2nd version I was thinking about: Api calls a procedure in the database, which after passing parameters, calls a dynamic query like:

Select * from Documents where Json
 like '% James%' and Json like '% Doe%' 



Issue finding html tag with package RSelenium in a specific website

I'm using RSelenium to do some webScraping on the website https://unicancer.sigaps.fr/. I want to rewiew my team sigaps points (for those who don't know, when you publish an article in a scientific magazine, you get points and the more you have points the more you will get acknowledged blablabla). I want to automatize, the collect of those data.

So i already used RSelenium on other website and it worked, but on this specific one i can't find the html tags with those function:

remDr$findElement(using = "xpath", value = "/html/body/div[1]/div/div[2]/form/table/tbody/tr[2]/td[2]/input")$sendKeysToElement(list(username))
remDr$findElement(using = "name", value = "mdp")$sendKeysToElement(list(password))

I tried with the xpath and the name tag but both don"t work. I can't find any of the page elements.

I get this error :

   Selenium message:no such element: Unable to locate element: 
   {"method":"xpath","selector":"/html/body/div[1]/div/div[2]/form/table/tbody/tr[2]/td[2]/input"}
   (Session info: chrome=96.0.4664.45)
   For documentation on this error, please visit: 
   https://www.seleniumhq.org/exceptions/no_such_element.html
   Build info: version: '4.0.0-alpha-2', revision: 'f148142cf8', time: '2019-07-01T21:30:10'
   System info: host: 'PD06B6F', ip: '10.208.107.111', os.name: 'Windows 10', os.arch: 'amd64', 
   os.version: '10.0', java.version: '1.8.0_261'
   Driver info: driver.version: unknown
 
   Error:    Summary: NoSuchElement
     Detail: An element could not be located on the page using the given search parameters.
     class: org.openqa.selenium.NoSuchElementException
     Further Details: run errorDetails method

When i'm looking on the page code with my browser I can idnetify the html elements:

<input name="login" class="text_box" type="text">

So the website have an issue and I need to solve the interaction problem between RSelenium and it.

Here my whole code (maybe it is a docker problems ? I don't really know what it is thought i'm not a web developer)

rD <- rsDriver(browser= "chrome", port = 3955L,chromever = "96.0.4664.45")
remDr <- rD[["client"]]
 
remDr$navigate("https://unicancer.sigaps.fr/")
 
remDr$screenshot(TRUE)
 
username <- "xyz"
password <- "lol93"
 
 
remDr$findElement(using = "xpath", value = "/html/body/div[1]/div/div[2]/form/table/tbody/tr[2]/td[2]/input")$sendKeysToElement(list(username))
remDr$findElement(using = "name", value = "mdp")$sendKeysToElement(list(password))
 
rD$server$stop()
remDr$close()
system("taskkill /im java.exe /f", intern=FALSE, ignore.stdout=FALSE)



Max-height value is wrong on Chrome but it's OK on Firefox

I've recently updated Chrome from 95.0.4638.69 to 96.0.4664.45

Before the update everything was working correctly but after the update max-height value is wrong.

This is on Firefox which is works correctly:

enter image description here

This is updated Chrome which is works wrong:

This is updated Chrome which is works wrong:

Are there anyone who encountered this problem too? Thank you all.




lundi 29 novembre 2021

Google search freezes on Safari

Google search freezes and will leave the bottom half blank, but still able to scroll down. Only happens on Safari, not Chrome. I used AdGuard before with no problem, and that's the only extension I have on Safari. Disabling AdGuard did not help the issue.

Error messages from inspect element is attached. Currently running macOS Monterey 12.0.1, Safari version 15.1(17612.2.9.1.20). Anyone has any idea what is causing it? Appreciate any help!

errors in element inspection




I want to play a video in canvas in javascript without

A.O.A(greetings) I saw many snippets of code that how we play video on js canvas but all these snippets use video tag on same page but I don't want to do this! I want to do something like this: var video = new Video() video.src = "sample.mp4" ctx.drawImage(video,0,0) video.currentTime++ can anyone help me




Is it possible to make a website that only works properly in Internet Explorer 11?

I know this is counterintuitive to the norm and would raise some eyebrows but I'm planning on making an easter egg of sorts for my circle of friends and want the website I'm making to only be available on Internet Explorer 11.

With that in mind, what are some things that I can do so that my website could only render in Internet Explorer aside from ActiveX controls? Are there IE-specific HTML tags or JavaScript functions I can use that don't work on modern day browsers?

I initially thought of just checking the browser's user agent but that's too easy to get around with, however, I would prefer that they don't need to download additional things (Silverlight, etc) and just use the default Internet Explorer included with Windows 10.




Scrolling behaviour for single page navbar button in CSS

I am attempting to create a single page resume using pure HTML/CSS. I'm implementing a navbar such that when clicking a button that links to a div (on the same page), it automatically scrolls down to that section (with the scrolling effect). How can this be done? Thanks.




How interpret Simple XML to HTML with PHP?

I get response from the server in Simple XML, but I want get to my page only data I need and show this data in html tags. How I can do it?

My request code:

    include "TopSdk.php";
    date_default_timezone_set('Asia/Shanghai'); 
    $c = new TopClient; 
    $c->appkey = '*******';
    $c->secretKey = '***************';
    $req = new AliexpressAffiliateProductQueryRequest; 
    $req->setAppSignature("1111"); 
    $req->setFields("sale_price"); 
    $req->setKeywords("car"); 
    $req->setMaxSalePrice(300); 
    $req->setMinSalePrice(150); 
    $req->setPageNo(1); 
    $req->setPageSize(2); 
    $req->setSort("SALE_PRICE_ASC"); 
    $req->setTargetCurrency("USD"); 
    $req->setTargetLanguage("en"); 
    $req->setTrackingId("trackID");
    echo "<pre>";
    var_dump($c->execute($req));
    echo "</pre>";

Server response in SXML:

    object(SimpleXMLElement)#2717 (2) {
    ["resp_result"]=>
    object(SimpleXMLElement)#2486 (3) {
    ["resp_code"]=>
    string(3) "200"
    ["resp_msg"]=>
    string(13) "Call succeeds"
    ["result"]=>
    object(SimpleXMLElement)#2500 (4) {
    ["current_page_no"]=>
    string(1) "1"
    ["current_record_count"]=>
    string(1) "2"
    ["products"]=>
    object(SimpleXMLElement)#2493 (1) {
    ["product"]=>
    array(2) {
    [0]=>
    object(SimpleXMLElement)#2434 (29) {
    ["app_sale_price"]=>
    string(4) "1.50"
    ["app_sale_price_currency"]=>
    string(3) "USD"
    ["commission_rate"]=>
    string(4) "9.0%"
    ["discount"]=>
    string(3) "80%"
    ["first_level_category_id"]=>
    string(2) "34"
    ["first_level_category_name"]=>
    string(32) "Automobiles, Parts & Accessories"
    ["hot_product_commission_rate"]=>
    string(4) "0.0%"
    ["lastest_volume"]=>
    string(1) "0"
    ["original_price"]=>
    string(4) "7.50"
    ["original_price_currency"]=>
    string(3) "USD"
    ["product_detail_url"]=>
    string(53) "https://www.aliexpress.com/item/1005002897604484.html"
    ["product_id"]=>
    string(16) "1005002897604484"
    ["product_main_image_url"]=>
    string(65) "https://ae04.alicdn.com/kf/H251d6cd1fb6b457f86d9418c8fb69bfc4.jpg"
    ["product_small_image_urls"]=>
    object(SimpleXMLElement)#2431 (1) {
    ["string"]=>
    array(6) {
    [0]=>
    string(65) "https://ae04.alicdn.com/kf/H251d6cd1fb6b457f86d9418c8fb69bfc4.jpg"
    [1]=>
    string(65) "https://ae04.alicdn.com/kf/Hef9247dcda18452b86cec742dc6e1512T.jpg"
    [2]=>
    string(65) "https://ae04.alicdn.com/kf/H0c39946d5ce345feb6f8fe2785157a2aw.jpg"
    [3]=>
    string(65) "https://ae04.alicdn.com/kf/H46444b25ac824ca48144ce8a41de8df1E.jpg"
    [4]=>
    string(65) "https://ae04.alicdn.com/kf/Hd5ec838b5f2544b3a21827f2751bcf48y.jpg"
    [5]=>
    string(65) "https://ae04.alicdn.com/kf/H550518786e1a472ebc1cf0b8cfdc522f2.jpg"
    }
    }
    ["product_title"]=>
    string(163) "Car Parasol Front Windshield Side Window Cover Interior UV-protective Curtain шторки для автомобиля шторка для автомобилей "
    ["promotion_link"]=>
    string(807) "https://s.click.aliexpress.com/s/4BScZUQRCtnCPCxSv0PKwEvDQD4u6TRQDsTl9yY3LPNpjcFJYJYgdvBwDDpTrktMG0Bk7vaKjL6XyPRVpHoWa7nQNlQFkqJPggCvZt8DKU9umyHh6eIX5opg0KuXEYNPi7ieG5LeqJDbqOacEd03kB7TjoPS5lw5oIH5JFWbhzN203U3K2CHxLHglZ3KrbYkGRGOE1cgm0v2oQRL2P5WzsJEV9UY7mMsJJsfwdoEo4YKzpQ4A6hFKY1Q4wYvOojPSfj2bFrEVwvkPSR5Y6FnaSrCZc6K5dZ2jfPZN2c5Uz6ken8DkMcl0at0TpyWMnasTOgxAit4gFga3NDjwESqiUlIktUrZigriucp0TyWz5DmYrGN654flY9yNmmuVez6QNmDok6kjJHM2iFZeBpJBYwSpaEMGvA21M0pjyJqLzq0lO7917WednH9wn4FJlFBHs5yGVX2PaCvU9EH41B3YaDNHDfKWP9aj0XcvBrV85e7h6Zukmu3erQ1h85q1gaClmOGLuF1rrw8w5b4j4NoikPBrUQlBXFQxH8B6bISevyTUl95U1uWA7Gt4uk4ySEEqlsHQLrcVwcF70ySnxuoDQ5dCf6LjaoOs8SOMJRm6I8SippRCihNz7PiLXmfmhyaTO6Bcff1hHQ4xIa4bwasbnh5IL3kF3MobRZBYCinXezrYyhCxlXrqw1GbFYwJ1dc9NGGSwU33s6x8XBpjUzib5y5uE1NVAwTBFCdwOewHMKpebf9e5El5yOT9IQBp2tp2O7zWr"
    ["relevant_market_commission_rate"]=>
    string(4) "3.0%"
    ["sale_price"]=>
    string(4) "1.50"
    ["sale_price_currency"]=>
    string(3) "USD"
    ["second_level_category_id"]=>
    string(9) "200003411"
    ["second_level_category_name"]=>
    string(20) "Interior Accessories"
    ["shop_id"]=>
    string(9) "912064829"
    ["shop_url"]=>
    string(42) "https://www.aliexpress.com/store/912064829"
    ["target_app_sale_price"]=>
    string(4) "1.50"
    ["target_app_sale_price_currency"]=>
    string(3) "USD"
    ["target_original_price"]=>
    string(4) "7.50"
    ["target_original_price_currency"]=>
    string(3) "USD"
    ["target_sale_price"]=>
    string(4) "1.50"
    ["target_sale_price_currency"]=>
    string(3) "USD"
    }
    [1]=>
    object(SimpleXMLElement)#2432 (29) {
    ["app_sale_price"]=>
    string(4) "1.35"
    ["app_sale_price_currency"]=>
    string(3) "USD"
    ["commission_rate"]=>
    string(4) "9.0%"
    ["discount"]=>
    string(3) "73%"
    ["first_level_category_id"]=>
    string(2) "34"
    ["first_level_category_name"]=>
    string(32) "Automobiles, Parts & Accessories"
    ["hot_product_commission_rate"]=>
    string(4) "0.0%"
    ["lastest_volume"]=>
    string(1) "0"
    ["original_price"]=>
    string(4) "5.00"
    ["original_price_currency"]=>
    string(3) "USD"
    ["product_detail_url"]=>
    string(53) "https://www.aliexpress.com/item/1005003402966179.html"
    ["product_id"]=>
    string(16) "1005003402966179"
    ["product_main_image_url"]=>
    string(65) "https://ae04.alicdn.com/kf/Hd263fbbd1dad4d49a3a3277261c6c408L.jpg"
    ["product_small_image_urls"]=>
    object(SimpleXMLElement)#2431 (1) {
    ["string"]=>
    array(5) {
    [0]=>
    string(65) "https://ae04.alicdn.com/kf/Hd263fbbd1dad4d49a3a3277261c6c408L.jpg"
    [1]=>
    string(65) "https://ae04.alicdn.com/kf/H3595b1b670c04d8b95307ad54f30ee5ac.jpg"
    [2]=>
    string(65) "https://ae04.alicdn.com/kf/Hbc1076a0bbca4f91a60d8eb27f9392547.jpg"
    [3]=>
    string(65) "https://ae04.alicdn.com/kf/H999a513e61be49d2ad374fa87e4f34897.jpg"
    [4]=>
    string(65) "https://ae04.alicdn.com/kf/H7e29d629b6d04ec8870f166a71cf87212.jpg"
    }
    }
    ["product_title"]=>
    string(124) "2022 New Car Interior Accessories Car Perfume Aromatherapy Cute Crown Teddy Bear Air Outlet Plaster Bear Ornament Decoration"
    ["promotion_link"]=>
    string(807) "https://s.click.aliexpress.com/s/4BScZUQRCtnCPCxSv0PKwEvDQD4u6TRQDsTl9yY3LPNpjcFJYJYgdvBwDDpTrktMG0Bk7vaKjL6XyPRVpHoWa7nQNlQFkqJPggCvZt8DKU9umyHh6eIX5opg0KuXEYNPi7ieG5LeqJDbqOacEd03kB7TjoPS5lw5oIH5JFWbhzN203U3K2CHxLHglZ3KrbYkGRGOE1cgm0v2oQRL2P5WzsJEV9UY7mMsJJsfwdoEo4YKzpQ4A6hFKY1Q4wYvOojPSfj2bFrEVwvkPSR5Y6FnaSrCZc6K5dZ2jfPZN2c5Uz6ken8DkMcl0at0TpyYdHF0HQtA8jRRgCMGPA1XaVUh1IydbFgJOCvwetULs4d0J8ib9Xni5t3QrUNsxQ3lSARntkxnshpruYkDmzb3HJ3sf9GyH5rTL3OTC0dpG3XfbyCmQI7sE1rDkdWSBbIvIHJXWaawBxtuhmqr6WfjZDNeYY0JfdgUsh9F8OqLed1uePoqJHK8FdFG6GAnXwZkCbS84viXRSeHP4EjjjC4Z7gtBzNveIjurnHopaqkY4FNXnJzdGJwnudZyXpX7pV7jkaygdr7GnlfsroGM4P1e8GnFgcimWdqfV0vg71vTxlBJmVDSrtmndZVpTXu3dfIZbjuIyWZWwlCrKCxWbqsppQYItz8662L6l9uKNJLIoKipN0ZTyWkGA2XYBg9al3sPUsO39aTK7ZnxOr3SWOk8Zo6Ua3q3v6UemjvLqqruSU46TCFydPTWxg9wegSuYctUTY0MgdLen"
    ["relevant_market_commission_rate"]=>
    string(4) "3.0%"
    ["sale_price"]=>
    string(4) "1.35"
    ["sale_price_currency"]=>
    string(3) "USD"
    ["second_level_category_id"]=>
    string(9) "200003411"
    ["second_level_category_name"]=>
    string(20) "Interior Accessories"
    ["shop_id"]=>
    string(9) "912521256"
    ["shop_url"]=>
    string(42) "https://www.aliexpress.com/store/912521256"
    ["target_app_sale_price"]=>
    string(4) "1.35"
    ["target_app_sale_price_currency"]=>
    string(3) "USD"
    ["target_original_price"]=>
    string(4) "5.00"
    ["target_original_price_currency"]=>
    string(3) "USD"
    ["target_sale_price"]=>
    string(4) "1.35"
    ["target_sale_price_currency"]=>
    string(3) "USD"
    }
    }
    }
    ["total_record_count"]=>
    string(6) "472235"
    }
    }
    ["request_id"]=>
    string(12) "iirdj5wwp91x"
    }

I need for example olny strings: Title["product_title"], Price["sale_price"] and TrackID["promotion_link"], how I can get it's? And show on web page only this data:

    <h1>Title</h1>
    <h2>Price</h2>
    <a href>TrackID</a>

Thanks!




Do I need MAMP or can do it manually?

do I need to install MAMP on the MAC to run a local web server / be able to develop sites locally? Or can I install everything manually? I went through Homebrew and it has MySQL, Apache and PHP. So the question is, can I install and run it manually without installing the mamp? Even if it were 'more complicated'?My primary goal is to learn, so I don't like installing a package (mamp) that seems to solve everything for me.




How can I consume an API in Java? [duplicate]

Last time I asked a question about API I realized I wasn't very concise with what I needed, so I'm asking again.

I've learned from my last question that an API is consumed, not integrated. Basically what I want to know, is how can I access the methods from that my API provides(let's assume for example GET circuits and GET drivers are the two methods). I want to use these two methods to build a web application(java based), but I don't see any tutorials on how to just access the methods. I am familiar with Java, but not with this kind of usage and I really want to learn the know how. Do I need a framework(Spring) to work on my Web-Application? Can you direct me for some tutorials or some steps on how to just build a super-simple application?

I tried to make an API Request in IntelliJ, but it's saying that I don't have the key, I tried to put it in a class using the code snippet provided by the API I'm using, but I don't know where to write it exactly in order for IntelliJ to see it and use it. If you need any more details about my question, please ask me, I really need help in this matter(take in consideration that it's my first time building an Web Application using API's)

P.S: I've read loads of sites, but none of the seem to explain how to do what I need.




How to set limit of writes in a period of time firebase?

i made a web page where you can draw pixels in a square but it is vulnerable to spam bots or scripts to draw the whole square. this shouldn't be possible.

is there a way to limit the number of pixels an user can write in for example a day?




Accessing third party location url [duplicate]

I have an application where you need to give permission to access files. The user clicks a button which opens a pop up window for the user to log in and allow access. The pop up window then redirects to a url which contains a code. I need to get this code from the url, so I can then send it to my API.

The issue I am having is I continue to get this error:

Uncaught DOMException: Blocked a frame with origin "http://localhost:3000" from accessing a cross-origin frame.

A preview of the code is as follows:

var windowReference;
    const openAccessWindow = async () => {
        if (windowReference == null || windowReference.closed) {
            windowReference = window.open(
                'https://sandbox-api.some_more_information',
                'Records', 'popup');
console.log(windowReference.location.href);

        } else {
            windowReference.focus()
        }
    }




Why the Webpage views counts is not working

I have a problem with my website views count, first, it counts only from my laptop and each clicks count twice, the second problem it's not counting from other devices at all example once I click from my mobile or any mobile or iPad or another laptop not counting at all, I am looking to someone how can help me on this, please.




What is the best language for the web?

I know it all depends on what you're going to develop, but overall, which language is best for the web?

I develop websites using php, but recently I started using node js to develop some things off the web and this question came to me. Which language today is better for developing websites, blogs or web systems?




I want a script that nottificates me when a change made in a website [closed]

For example: When a text in li element changes, the script will nottificate me.




Assign query result to a variable and return variable

private int getuserid(String username){
        
            SqlConnection con = new SqlConnection(_conString);
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.Text;

            cmd.CommandText = "SELECT USER_ID from tblUser where USERNAME ='" +username+"'";
            int locid = Convert.ToInt32(cmd.CommandText);

            return locid;
        }

Hi everyone, do you have an idea on how to assign value of user_id in a variable and return it. I tried but I am not sure its good.




How to host Flutter on the web using Firebase? And how well does it work?

How do I host flutter on the web using firebase and how well does it work? I have never done this before but have used firebase to host html, javascript and Css pages in the past. I am now learning flutter and dart for mobile and web development. I was looking for methods on how to host flutter using firebase and how well it works. Thanks!




How do I decide between using a Typescript file and a Svelte file?

My friend uses Typescript and Svelte to make web apps. I asked him how he chooses when something should be a Typescript file, versus when it should be a Svelte file; and he said, "in a svelte file it's code per instance of a component," whereas Typescript is "a regular file...global, one per application."

This makes sense to me logically, but I still can't comprehend when I should use which one. Is it possible to make the SAME exact web app using:

  1. ONLY Typescript files,
  2. ONLY Svelte files, and
  3. a mix of both?

If so, then why is option 3 superior? If not, which options are possible and which options aren't, and why? Better put, what (if anything) can Typescript files do that Svelte files can't, and vice versa?




How can I merge columns from two rows into a new row for mobile?

I have the below section on my website. I have 2 rows both with 3 cols each. on lg screens the cols are -6 each so the 3rd col is pushed on to a new separate row by its self.

I would like 1 of the cols from the second row to join the 3rd col(from the first row) which is now sitting alone on its own row. I'm not sure how to do this. Can anyone help?

<div class="container pt-5 pb-3" id="cardSection">
  <div class="row gx-3 gy-3">
    <div class="col-xl-4 col-lg-6 col-sm-12 d-flex justify-content-center">
      <div class="card" style="width: 23rem;">
        <img src="F:\Home\Sam\Website Homepage\appointments.jpg" class="card-img-top" alt="doctors appointment with patient">
        <div class="card-body">
          <h5 class="card-title">Appointments</h5>
          <p class="card-text">Book your appointents online with our 24/7 online service.</p>
          <a href="#" class="btn btn-primary">Book Now</a>
        </div>
      </div>

    </div>
    <div class="col-xl-4 col-lg-6 col-sm-12 d-flex justify-content-center">
      <div class="card" style="width: 23rem;">
        <img src="F:\Home\Sam\Website Homepage\prescriptions.jpg" class="card-img-top" alt="image of prescriptions">
        <div class="card-body">
          <h5 class="card-title">Prescriptions</h5>
          <p class="card-text">Order your prescriptions online with our 24/7 online service.</p>
          <a href="#" class="btn btn-primary">Order now</a>
        </div>
      </div>

    </div>
    <div class="col-xl-4 col-lg-6 col-sm-12 d-flex justify-content-center">
      <div class="card" style="width: 23rem;">
        <img src="F:\Home\Sam\Website Homepage\self help.jpg" class="card-img-top" alt="woman making a heart with hands">
        <div class="card-body">
          <h5 class="card-title">Self Help</h5>
          <p class="card-text">Find tips, guides, tools and activities to support and improve mental health.</p>
          <a href="#" class="btn btn-primary">Find help</a>
        </div>
      </div>

    </div>
  </div>
</div>
<!-- CARD SECTION - ROW 2 -->
<div class="container pb-5">
  <div class="row gx-3 gy-3">
    <div class="col-xl-4 col-lg-6 col-sm-12 d-flex justify-content-center">
        <div class="card" style="width: 23rem;">
          <img src="F:\Home\Sam\Website Homepage\reception.jpg" class="card-img-top" alt="image of a reception area">
          <div class="card-body">
            <h5 class="card-title">Reception Enquires</h5>
            <p class="card-text">Advice on who you need to see for a number of queries.</p>
            <a href="#" class="btn btn-primary">Enter</a>
          </div>
        </div>
    </div>
    <div class="col-xl-4 col-lg-6 col-sm-12 d-flex justify-content-center">
      <div class="card" style="width: 23rem;">
        <img src="F:\Home\Sam\Website Homepage\services.jpg" class="card-img-top" alt="image of prescriptions">
        <div class="card-body">
          <h5 class="card-title">Our Services</h5>
          <p class="card-text">Discover a range of services we offer at Dene Medical Centre</p>
          <a href="#" class="btn btn-primary">Services</a>
        </div>
      </div>

    </div>
    <div class="col-xl-4 col-lg-6 col-sm-12 d-flex justify-content-center">
        <div class="card" style="width: 23rem;">
          <img src="F:\Home\Sam\Website Homepage\PPG.jpg" class="card-img-top" alt="image of a reception area">
          <div class="card-body">
            <h5 class="card-title">Patient Participation Group</h5>
            <p class="card-text">Advice on who you need to see for a number of queries.</p>
            <a href="#" class="btn btn-primary">Enter</a>
          </div>
    </div>
  </div>
</div>```



ALL request to web api became slow on IIS [closed]

I have fine working web api app, IIS hosted, web api 2.0, win server 2012r2, IIS 8.5. After moving this application to IIS 10 (Win server 2019), ALL request became slower approximately 3-5 seconds. Again, all requests, not first. App pool is "Always running" E.G. /token request runs 3.5 seconds instead of 30 ms on old server. And all requests runs the same manner.

What can be the reason?




Is it usefull to make Offline Desktop Application these days?

I wonder are offline desktop applications still able to spread and influence among people?




Is good practice with REST APIs to assume default values when values are not present?

An application let others applications to get weather information for a region. This application implements a REST API and JSON objects to represent the resources and the users indicates the region via region attribute in a JSON object in the request.

It is working this way: if the region is not indicated in the request, this is if the attribute is not present in the JSON or it has null value, the application assumes region is "Tenesse" (some region by default). Is this a good practice? What is the disadvantage of doing this against making the region a required attribute and explicitly indicates the region?




How do I use Android (Java) Project on Web Project (HTML,CSS,JS vb.)?

I have a native android (java) project. This project is the exported version of Unity project for android (I can't take webgl export because this project not supported webgl export). I want to use in web this project. Is this possible?




dimanche 28 novembre 2021

Why is the font size on the pdf version of a webpage smaller than the font size on the webpage itself?

If we were to visit the lorem ipsum site https://www.lipsum.com/ on windows 10 chrome and use chrome's Microsoft Print to PDF feature, the font size in the pdf and webpage are different. Attached image as example: enter image description here On the left is the PDF version of the webpage viewed through Adobe Acrobat Reader DC at a zoom level of 100% and on the right is the actual webpage itself. Why does this happen and how do I make the font size in the PDF identical to it's web counterpart?




Ideas regarding building a web page with downloadable link , using our own DB

I wanted to build a web page in which I wanted a downloadable link(of a json file , size less than 5mb) to be there, and that json file should come from my database. Also I wanted to know a way to create that database schema(basically I wanted to display my database table as it is in a web page)

I am a beginner in development and not sure what tech stack should I use.




Why my display is different from bootstrap offical example?

I have a directory included

  • css
  • js
  • index.html

When I copy bootstrap examples, the look and size is different.

This is my link and script, it seems link and script is different from bootstraps examples

<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script type="js/bootstrap.min.js"></script>

This is boostrap example

    <!-- Bootstrap core CSS -->
<link href="/docs/5.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">

example link

https://getbootstrap.com/docs/5.1/examples/sign-in/




javascript await for a Dart function to complete throws exceptions or doesn't wait

I have a large web app and I'm implementing an API that can be used by independent js scripts. Using the recommended package:js/js.dart with @JS annotations, the calls from js to Dart all work fine except for async calls to await a Dart function.

So as not to swamp the question with thousands of lines of code I have written a small sample project that easily reproduces the problem.

The Dart async functions return a Future but when the future is completed an exception is thrown. Presumably this is to do with Dart returning a Future but the javascript expecting a Promise?

There are a lot of posts referencing Dart calls into javascript but I have found very little in the reverse direction (js to Dart) using async/await.

I expected the promiseToFuture and futureToPromise functions to perhaps throw some light on this problem but there's not much information out there in the js-to-dart context. The Dart documentation seems to be non-existent.

There is another odd issue that could just be a symptom. Using 'webdev serve' the await calls throw exceptions but, if they are caught in a try/catch', the awaits actually work. Using 'webdev build' the await calls do not wait at all.

If I have missed the relevant documentation I would be very grateful to be pointed in the right direction. Aside from that, I'd like to hear any suggestions for a working solution!

All the Dart code is in main.dart:

@JS()
library testawait;

import 'dart:async';
import 'dart:core';
import 'package:js/js.dart';

/// main.dart
///
/// This web app is an example of a javascript script await-ing Dart async
/// functions. The Dart async functions return a Future but when the future 
/// is completed an exception is thrown. Presumably this is to do with Dart
/// returning a Future but the javascript expecting a Promise?
/// 
/// The script is triggered by a button (Click me) in the web page (index.html).
///
/// When running with WEBDEV SERVE the awaits respect the Future.delays but throw
/// exceptions and the returns go to the catch.
/// 
/// When running with WEBDEV BUILD the awaits do not delay and the returns go to
/// the next statement.
///  

@JS('connect')
external set _connect(void Function(String host) f);

@JS('connect2')
external set _connect2(void Function(String host) f);

@JS('write')
external set _write(void Function(String text) f);

@JS('read')
external set _read(void Function() f);


void main() async {
    _connect = allowInterop(connect);
    _connect2 = allowInterop(connect2);
    _write = allowInterop(write);
    _read = allowInterop(read);
}

///
/// using '.then'
/// 
/// The return causes an exception:
///     future_impl.dart:419 Uncaught TypeError: T.as is not a function
///     at _Future.new.[_setValue] (future_impl.dart:419)
///
Future<dynamic> connect(String host) async {
    print('before connect');

    // simulating the connect with a delay
    return Future.delayed(Duration(seconds: 1))
        .then((onValue) => 'connect complete');
}

///
/// Future<void>
///
/// The return causes an exception:
///     Uncaught Error: Assertion failed: org-dartlang-sdk:///lib/async/future_impl.
///     dart:606:12
///     !_isComplete is not true
///
Future<void> connect2(String host) async {
    print('before connect2');

    // simulating the connect with a delay
    await Future.delayed(Duration(seconds:1), () {
        print('connect2 done after 1s');
    });
}

///
/// The return causes an exception:
///     Uncaught Error: Assertion failed: org-dartlang-sdk:///lib/async/future_impl.
///     dart:606:12
///     !_isComplete is not true
///
Future<dynamic> write(String text) async {
    print('before write');

    // simulating the write with a delay
    await Future.delayed(const Duration(seconds: 2), () {
        print('write done after 2s');
        return 'write complete';
    });
}

///
/// The return causes an exception:
///     Uncaught Error: Assertion failed: org-dartlang-sdk:///lib/async/future_impl.
///     dart:606:12
///     !_isComplete is not true
///
Future<dynamic> read() async {
    print('before read');

    // simulating the read with a delay
    await Future.delayed(const Duration(seconds: 3), () {
        print('read done after 3s');
        return 'read complete';
    });
}

And here is the html that includes the js script:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="scaffolded-by" content="https://github.com/dart-lang/sdk">
    <title>testawait</title>
    <link rel="stylesheet" href="styles.css">
    <script defer src="main.dart.js"></script>
</head>

<body>
    <input type="button" value="Click me" onclick="scriptWaits()"></input>

    <script>
    async function scriptWaits() {
        var reply = '';

        console.log('before calling connect');
        try {
            reply = await connect('host');
            console.log('after calling connect, reply=' + reply);
        } catch(e) {
            console.log('catch connect wait, ' + e);    
        }

        console.log('before calling connect2');
        try {
            await connect2('host');
            console.log('after calling connect2');
        } catch(e) {
            console.log('catch connect2 wait, ' + e);   
        }

        console.log('before calling write');
        try {
            reply = await write('a string');
            console.log('after calling write, reply=' + reply);
        } catch(e) {
            console.log('catch write wait, ' + e);  
        }

        console.log('before calling read');
        try {
            reply = await read();
            console.log('after calling read, reply=' + reply);
        } catch(e) {
            console.log('catch read wait, ' + e);   
        }
        console.log('after calling read, reply=' + reply);
    }
    </script>
</body>
</html>

and pubspec.yaml:

name: testawait
description: Testing javascript await a Dart function
version: 1.0.0

environment:
  sdk: '>=2.14.4 <3.0.0'

dependencies:
  http: ^0.13.3

dev_dependencies:
  build_runner: ^2.1.2
  build_web_compilers: ^3.2.1
  js: ^0.6.3
  lints: ^1.0.0



Nginx occasional infinite redirects

I am finding issues of occasional infinite redirects with the following code. I am very confused as the problem does not occur consistently. It works on my devices and many online redirect checkers. Others however report an infinite redirect.

    listen         443 ssl http2;
    listen         [::]:443 ssl http2;
    ssl_certificate /etc/nginx/conf.d/cert/example.com.crt;
    ssl_certificate_key /etc/nginx/conf.d/cert/example.com.key;
    server_name    example.com;
    root           /var/www/example.com;
    index          index.html;
}

server {
    listen [::]:80;
    listen 80;
    server_name example.com www.example.com;
    return 302 https://example.com$request_uri;
}

server {
    listen [::]:443 ssl http2;
    listen 443 ssl http2;
    server_name www.example.com;
    return 302 https://example.com$request_uri;
}



How can we change the audio tracks in video .mp4 format in web?

I have video file of .mp4 format. It has multiple audio tracks in-built in it.

VideoJs & ReactPlayer is not detecting those audio tracks. Is there any way to target particular audio track. ??

How to target those audio tracks and how can we change them ? Is there a player for this?




How to query select an element that is not contained in the referenced document?

I have a separate file for my navbar, which I load into the main file using the method from the first answer here. However when I now try to select the elements from the navbar, I get a null reference error. How can I solve this?




CSS, doted down slider [closed]

Basically, I want to create that green line which I saw at a website as u scroll to it, animation start and line start to slide down through Dotes Cope with each dote notes with it.

can anyone help or just give me a name to search by , lol I'm kinda familiar css and web so i could handle

This Green Line

this Green line




Use echo after the header('Location: ' . $_SERVER['HTTP_REFERER']); in php

How can I use echo after this in php:

header('Location: ' . $_SERVER['HTTP_REFERER']);



Angular proxy to backend not resolved

Trying to fix similar issue, but have no idea why it's not working.

I have API: localhost:8080/api/acl/authorize

Have next http client:

const AUTH_URI = "/api/acl/"

const httpOptions = {
  headers: new HttpHeaders({
      'Content-Type': 'application/json',
      'Access-Control-Allow-Origin': '*'
    }
  )
};

@Injectable({
  providedIn: 'root'
})
export class AuthService {

  constructor(private http: HttpClient) {
  }

  login(credentials: { login: string; passwordHash: string; }): Observable<any> {
    return this.http.post(AUTH_URI + "authorize", {
      login: credentials.login,
      passwordHash: credentials.passwordHash
    }, httpOptions);
  }
}

Add proxy conf:

{
  "/api/acl/authorize": {
    "target": "http://localhost:8080/",
    "secure": false,
    "pathRewrite": {
      "^/api/acl/authorize": ""
    }
  }
}

Starting with proxy option via ng serve --proxy-config proxy.config.json (in packge.json).

Also tried "target": "http://localhost:8080/api/acl/authorize". But still have incorrect request POST http://localhost:4200/api/acl/authorize instead of POST http://localhost:8080/api/acl/authorize

How can I fix this issue?




service worker is not in navigator

I am trying to add push notifications to my app to do this I am using service workers. for me everything works correctly on google chrome and Firefox but for my friend it says that navigetor.serviceWorker is undefined. he is using Firefox 94.0.2 (64-bit) that should support it according to mozilla

the site http protocol is https and window.isSecureContext is true

I don't know what is the problem all I see about it is the browser support and the secure window things but all of those are ok.

ill be glad if you will be able to help me :)




How to open page at a certain position?

How can I set and get the current web page scroll position?

I have a chat with position fixed and if you decide to close it, the page reloads and goes back to top, which is annoying for users..because they have to scroll back down to the point they were at.

If I could save the current scroll position (in a hidden input) before the page reloads, I could then set it back after it reloads.. right? But please, show me how to do it because I am new to this.

function closeChat() {
    var x = document.getElementById("chatArea");

    if(x.style.display == 'block'){
        x.style.display = 'none';
    }
    
    window.location.assign("explore.php");
    return false;
}

PS: I have to assign to the same page because I am sending a parameter through the url and when the chat is closed, the parameter is still there... so that's why




What is the best way to post edits of website to control panel?

So far I have been editing the files locally using Visual Studio and then just replaced the files that I have changed on the server using the control panel of my hosting provider. Surely there must be a better way to do this (maybe using git)?




How can I create a ul in html that affects which video is played?

For my Website I want to create a ul with li elements that function as buttons. If you press one buttom the video played next to it should change. How can I do this?

I want it to generally look similar to the one pitch integrated in the section "Build stunning decks in record time" https://pitch.com/




How do I upload files to my web server by passing the file path in the URL using Flask?

I am able to upload files through forms using Flask but what I require is to be able to put the local file path in the URL and then flask can upload the file and process it. How do I do this?




How do I store texts with line breaks in database?

I'm a newbie web developer.

I am trying to make my own web based text editor application thus I need this info.

How do I store text with line breaks in database. I am thinking to use MongoDB.

Also, I'm interested in knowing:

  1. What database YouTube uses to store comments?
  2. What database stackoverflow uses to store comments?

Thanks in Advance.




Parent element highlighted when child is clicked on mobile

My mobile-only web app has some <div> elements that should be highlighted when clicked/long clicked, and was hoping to achieve this with CSS only.

It's important to note that this is a legacy app with very complex code that is meant for low-end devices, so lists, for example, are not rendered using <ul>'s and <li>'s, but everything is a <div>.

I noticed a CSS (maybe intentional?) side effect -

When an element and its direct child both have the following CSS applied to them:

div {
  pointer-events: auto;
  cursor: pointer;
}

Then clicking/long-clicking on the child element will always highlight the parent element only.

This means that if, for example, a small <div> lives inside of a larger <div> and the child is clicked, the larger parent <div> is highlighted.

I know that I can use Javascript to solve this issue, but this app is meant for low-end devices so I prefer to avoid adding more Javascript code.

This feels like an undesired side-effect and I couldn't find any documentation about this behavior.




samedi 27 novembre 2021

React : {-} is not defined no-undef

error is -
Line 16:18: 'username' is not defined no-undef

Line 20:18: 'imageUrl' is not defined no-undef

Line 22:49: 'username' is not defined no-undef

Line 22:76: 'caption' is not defined no-undef

<Post username="elitorbi" caption="something in here" imageUrl="https://static.toiimg.com/thumb/msid-67586673,width-800,height-600,resizemode-75,imgsize-3918697,pt-32,y_pad-40/67586673.jpg"/>
  
<Post username="elitorbi" caption= "this is a caption" imageUrl="https://i.guim.co.uk/img/media/fe1e34da640c5c56ed16f76ce6f994fa9343d09d/0_174_3408_2046/master/3408.jpgwidth=1200&height=900&quality=85&auto=format&fit=crop&s=0d3f33fb6aa6e0154b7713a00454c83d"/>

================================================================

import React, {useState} from 'react'
import './post.css'
import './App.js'
import Avatar from "@material-ui/core/Avatar"


function Post() {
    return (
        <div className="post">
            <div className="post__header">
            <Avatar
                className="post__avatar"
                alt= 'elitorbi'
                src="/static/images/avatar/1.jpg"
            ></Avatar>
            <h3>**{username}**</h3>
            </div>
            <img
            className = "post__image" 
            src={imageUrl} />
            
            <h4 className="post__text"><strong>{username}</strong><n> </n>{caption}</h4>
        </div>
    )
}

export default Post



System.FormatException: 'Could not parse the JSON file.' in C# .NET core 3.1

enter image description here

I am doing web application using C# .NET core 3.1, the code can run and the web page is working when I built this application in the beginning; and I download 3 packages Microsoft.EntityFrameworkCore.SqlServer Microsoft.EntityFrameworkCore.Tools Microsoft.VisualStudio.Web.CodeGeneration.Design; and connect the sql server to my application, then the code still can run but the error appears.




TLS updating query?

Good morning, I am writing to you hoping to get some assistance regarding issues raised when attempting to publish a personal website. I am using an old but trusty website creation app named WebPageMaker, it is no longer supported and I am unable to find any assistance for it...I have used it for a number of years and am reluctant to dump it. With no changes made in the publishing details window I now find I can no longer publish to WPM, in trying I get the following message:

421-Sorry, cleartext sessions and weak ciphers are not accepted on this server. < 421 Please reconnect using TLS security mechanisms. Unable to establish a connection to server: Publishing Failed !

In attempting to correct I have made a number of changes in Control Panel/ Internet options/security/advanced to the TLS settings but nothing I do makes a difference.

Would you be able to shed any light on it and offer any suggestions as to a fix? I must point out that I am a little 'technology challenged' :)

Kind Regards,

Paul, Australia.




How to edit the data shown in a grid view from a SQL database

I made a search function using Grid View, the program reads the user input and based on that it returns the data that matches from the data base, however it returns the whole line, which includes 2 ID columns which I don't want to show. Sounds like something simple yet I can't seem to find any kind of tutorial on how to do this.

Also, the second column IdCargo (IdProfession, in english), I'd like to translate this data, as in, if a specific ID is supposed to appear I would like to instead show the profession of said employee. I would also like to show the column with "Cargo" name instead of "IdCargo", also instead of "CargaHoraria" I want to show "Carga Horaria".

If anyone knows any kind of guide or tutorial with using GridViews and SQL, that would be extremely helpful for future research as well.

enter image description here




Adding frappe gantt to AdminLTE Dashboard

I have been editing the frappe gantt(https://frappe.io/gantt) and now I want to add it to the dashboard called admin lte (https://adminlte.io/)

but I couldnt add it. I added the code for the gantt chart to the admin LTE dashboard but it would not appear the gantt chart? idk whats the problem?

Can someone help me figure whats the problem?




Error with Selenium module on instagram (scraping)

i have a problem with this bit of code:

from selenium import webdriver
driver = webdriver.Chrome(executable_path="E:\Hack\chromedriver_win32\chromedriver.exe")
driver.get("https://www.instagram.com/")
user_name=driver.find_element_by_xpath('//*[@id="loginForm"]/div/div[1]/div/label/input')
user_name.send_keys('user_name')

Now the problem is that the script cant find the username/pasword input fields on https://www.instagram.com/... I tried through name, class, XPath or whatever it's called but othing! It just doesnt want to work. Can anyone find a solution to this pls ? :(




React Hooks with button on clicks

I just started with React hooks and trying to have 3 buttons which I can click on and it should tell me how many times it was clicked. I can make them separately working but that's not performant.

Therefore I was looking for making it useful with just two classes: one for the buttons and the other one for the counter part. But now I'm struggling with calling the functions and separating (which one is clicked) the buttons.

import React, { useState } from "react";
import Counter from "./Counter";
const Buttons = () => {
  const HandleClick = () => {
    setCounter(count + 1);
  };
  const [count, setCounter] = useState(0);
  return (
    <div>
      <button className={"GoodBtn"} onClick={HandleClick}>
        Good
      </button>
      <button className={"NeutralBtn"} onClick={HandleClick}>
        Neutral
      </button>
      <button className={"BadBtn"} onClick={HandleClick}>
        Bad
      </button>
    </div>
  );
};

export default Buttons;

import React, { useState } from "react";
import Buttons from "./Buttons";

const Counter = () => {
  const [count, setCount] = useState(0);
  const teller = () => count + 1;
  return (
    <div>
      <h2>Statistics</h2>
      <p>Good {Buttons.count}</p>
      <p>Neutral {Buttons.count}</p>
      <p>Bad {Buttons.count}</p>
    </div>
  );
};

export default Counter;



Best and affordable hosting platforms for dynamic website with custom database like mongodb

I have a website with static as well as dynamic data and want to host it on a hosting platform with a custom database like mongodb etc... what kind of hosting or platform I should use.?




What's the best way to manage fixed data?

I am trying to make a web app can look up game items. The items are composed as follows.

  1. They may be added or changed by game updates.
  2. They have attributes which have range by item types (ex. Ring can have max strength +5, mana +20 etc..)
  3. The number of items are about 3-4 thousands.

Now, I hard-coded some of them as map data structure for my prototype, but I think it's not efficient. I consider of using RDBMS, such as PostgreSQL, so I can easily filter items by SQL and the main structure of items will get hardly changed. Also, it is easy to import or export. However, if I use RDBMS, the hard part is to manage item attributes. The item can have multiple attributes and I need to know the minimum and maximum stats of each. Are there better way to manage these data?




is there map for ipv4 internet?

sorry my poor title but I don't know how to express my intention.

In ipv4 there are 2**32 addresses right?

and then if I send 1024 packets per second I could check all the devices of the internet in 1165 hours to create map of the internet. with it I want to make a topology of the internet

it's not that bad, if I go with multiple computers like raspberry pie it would be more faster.

if it's not me but somewhat organization or people and they have enough time, it could even scanning all the ports of all the devices of the internet..!

is my thought a daydream? or somebody already did it? please let me know! I'm curious




Is that possible to use IF statement to get data from database and save it into String?

I want to get some record from tbl_jadwal and save it into string in my laravel. This is my code,

$get_time = if (now()->isMonday()) {
            return DB::table('tbl_jadwal')->where('Hari', 'Senin')->value('Jadwal_masuk');
        } else if(now()->isSaturday()) { {
            return DB::table('tbl_jadwal')->where('Hari', 'Sabtu')->value('Jadwal_masuk');
        };

$time = $get_time;

but i got message syntax error, unexpected token "if", is there any other way to solve this problem ?




vendredi 26 novembre 2021

How to use a hidden api Website which doesn't open in browser [closed]

https://doodstream.com/search.php?page=1&search=Avengers&_=1637982183869

The above website opens just like an api which give results in json format but the problem is it's only opening in the website and not in any browser

When I try to open it in a browser it shows just a blank white page

When I inspected the website




How do I list all websocket connections? (JavaScript)

How do I list all running websocket connections, and if possible intercept the messages being sent and received? I am looking for a way to do this with javascript through the console so please dont answer/comment with chrome dev tools.




Seeing an error for site owner as the user

I am trying to register for an account so I can fill out a job application, but I am unable to progress from the Application Info stage due to the reCAPTCHA being inaccessible. Oddly enough, I am seeing an "Error for site owner" message: Error for site owner

Everywhere I've looked online has talked about solving this issue from the point of view of the site owner, so I have no idea why I am seeing it.

How do I fix this on my end?




How to redirect the user to mobile app or web app?

I have a web and mobile app and I want to share a link to open the mobile application if the user has installed it. But if it doesn't have it installed, I need to open the web application.

My code is

<body>
  redirecting...
  <script>
    window.location = `mobile-app-test://...`;

    setTimeout(function() {
      window.location = `https://webapp.com`;
    }, 1000);
  </script>
</body>

So I activate my application's schema and after a second I open the web application. But the code is bad.

Is it possible for me to validate if I opened the mobile application successfully? So I don't always need to open the web application after a second.

I want to try to open the mobile application and in case of error (it doesn't have it installed) then I open the web application.

Thanks =)




How to add text between two radio buttons of same group

I am trying to create a selection in which I have two radio buttons of same group and some text in between. Like single correct MCQ...

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Practice</title>
</head>
<body>
    <input type="radio"> This_1 <br> 
    or <br>
    <input type="radio"> This_2
</body>
</html>

Now what I want is that user can select only one of the radio button. However, as soon as I add OR in between, the radio buttons divide into two groups. And instead I can select both of them,u know what I'm saying... Please help is really appreciated. Thank you so much!!




How can I block harmful request from a browser with htaccess?

I have been having some troubles with DDOS or something like that. I have noticed that a lot of redirections to a website have been made through weird requests like: "porn, sex, etc"(this is an example, actual requests a little bit worse). I found out that you can ban them with some lines of code inside of .htaccess file. I have tried this as was offered, but it did not work:

RewriteCond %{HTTP_REFERER} ^https://?.(-|.)?%D0%BF%D0%B8%D1%81%D1%8F%20%D0%B2%20%D0%BC%D0%B0%D0%BD%D0%B4%D1%83(-|.)?.$ [NC,OR]

RewriteCond %{HTTP_REFERER} ^https://?.(-|.)?%D0%BF%D0%B8%D1%81%D1%8F%20%D0%B2%20%D0%B0%D0%BD%D1%83%D1%81(-|.)?.$ [NC,OR]

RewriteCond %{HTTP_REFERER} ^https://?.(-|.)?%D0%BF%D0%BE%D1%80%D0%BD%D0%BE%20%D0%BA%D0%B0%D0%BB%D1%8C%D1%8F%D0%BD%D0%BD%D0%B0%D1%8F(-|.)?.$ [NC]


Can anybody please help me resolve that ? I would really appreciate Your help ! Thanks in advance !




How do I install popper.js, or bootstrap addons, on a FastAPI project in PyCharm/IntelliJ?

I'm working on a FastAPI project using PyCharm, and I have Jinja templates which use some Bootstrap. I would like to add boostrap packages such as bootstrap-dropdown, or popper.min.js.

I've seen this post but I can't wrap my head around how I can add popper.min.js to my project.

How can I do so?




Trying to create a war with the exist-db 5.3.0 release

The last release downloable in war format was the 4.7.1. I've been trying to turn the 5.3.0 release into a war since the project i'm working in needs it that way and i want to upgrade the exist version. Hopefully someone out there is working on something similar or has already achieved this modification succesfully and could help me a little. Thank you in advance.




API service - an array of struct grows bigger and bigger in each response

I have an API service written in Go which returns some kind of JSON. The json contains primitive types as well as nested structures and, importantly, arrays.

There's no database or any storage involved here.

I use only well known standard libraries such as "encoding/json", "net/http" and others.

I've noticied that in each response the json keys with type array will grow bigger and bigger, and as a result there'll appear more and more duplicates as I make requests.

The code is large, therefore I won't post it here.

I use the standard way of appending elements to an array

newElem := createNewElem(1, 2, 3)
retStruct.MyArrayElements1 = append(retStruct.MyArrayElements1, newElem)

How is it possible that the state of the array keys is preserved between requests in "net/http"?

Is this the normal standard behaviour of

a) append() function

b) arrays in general

c) "net/http" package

?

And, how to fix this? I want a new empty array in each request.




How to create onClick event to the icon in ASP.NET C#

kindly help me out for this issue, Onclick event for the icon is not working!

HTML :

<button id="create_project" runat="server" onclick="create_new_project" style="outline: none; border: none;"><i class='bx bxs-add'></i></button>

code behind:

protected void create_new_project(object sender, EventArgs e)
    {
        main_content.Visible = true;
        defualt_content.Visible = false;
    }

where main_content and default_content are two




A website that reloads when dom nodes added/removed?

I'm debugging a problem with web-scraping. I need a website that does a reload when DOM nodes get added or removed. So SPA's don't count as they don't do a reload. I was wondering if someone knows a website that does that?




Show image based on select price box

I have two box price of product and now I want to show image base of box that user selected with javascript, should I change the image src with javascript? here is my code

<div class="offer__prices">
 <div class="price__box">
    <span class="offer__weight">500 gr</span>
    <span class="offer__price">49.99$</span>
 </div>
 <div class="price__box">
    <span class="offer__weight">1 Kg</span>
    <span class="offer__price">69.99$</span>
 </div>
</div>
<div class="offer__imgSlide">
 <img id="offer__img" src="assets/img/offers/1kilo.jpg" alt="">
</div>



How can I do web crawling successfully with NodeJS?

I want to do a script in NodeJS that help me to web crawling all kinds of sites. This is what I've tried so far (I found this script):

const Crawler = require("crawler");

let obselete = []; // Array of what was crawled already

let c = new Crawler();

function crawlAllUrls(url) {
 //console.log(`Crawling ${url}`);
 c.queue({
     uri: url,
     callback: function (err, res, done) {
         if (err) throw err;
         //console.log("debug 1");
         let $ = res.$;
         //console.log("debug 2");
         try {
             let urls = $("a");
             //console.log("debug 3");
             console.log(res);
             Object.keys(urls).forEach((item) => {
                 //console.log("debug 4");
                 if (urls[item].type === 'tag') {
                     //console.log("debug 5");
                     let href = urls[item].attribs.href;
                     //console.log("debug 5.1");
                     if (href && !obselete.includes(href) && href.startsWith(url)) {
                         //console.log("debug 6");
                         href = href.trim();
                         obselete.push(href);
                         // Slow down the
                         //console.log("debug 7");
                         setTimeout(function() {
                             href.startsWith('http') ? crawlAllUrls(href) : crawlAllUrls(`${url}${href}`) // The latter might need extra code to test if its the same site and it is a full domain with no URI
                             //console.log("debug 8");
                        }, 5000)
                     }
                 }
             });
         } catch (e) {
             //console.log("debug 9");
             console.error(`Encountered an error crawling ${url}. Aborting crawl.`);
             done()
             //console.log("debug 10");
         }
         //console.log("debug 11");
         done();
         //console.log("debug 12");
     }
 })
}

crawlAllUrls('https://www.amazon.com/Roku-Streaming-Device-Vision-Controls/dp/B09BKCDXZC/ref=lp_16225007011_1_2');

OBS: This script as it's now works perfectly! My issue is when I want to get web content from another kind of sites (obvious another URL), sites that are using the directive ng-app of AngularJS ( see image from Mozilla Firefox inspect mode: https://www.dropbox.com/s/pylmv0ge11u00ws/img5.PNG?dl=0 ). You can see in the image that this website uses AngularJS to handle requests and that returns JSON file format data, that JSON raw data is what I needed. I've censored site name because is a public auctions governmental website. I want to know if is possible to web crawl that site and if I don't, I want to know why? Site have any crawl blocking method or because website security (encrypted connection TLS / SSL)...

Thanks!




How to redirect wildcard subdomain to my domain

I would like to redirect wildcard subdomain to my actual domain.

like this (I already have error.example.com)

dsfas.example.com -> error.example.com

but I could not do this after hours of searching. Is there a solution to this.

I am using apache




Does twitter allows iframes inside its app?

I saw this behavior inside Twitter:podcast player with options

Is it an iframe? Is it secure to allow iframes inside a social app?




Ask about Ricoh Theta Camera API with java script code

I try to Connect Ricoh Theta Camera with my App and i used java Script

this is help Text in API Documentation :

Shooting with WebAPI v2.1 (OSC ver. 2) If you have THETA V or later based on WebAPI v2.1, you can shoot with the following line, so you can easily try the API. It’s in this format, just change the part of THETAYL00123456 to the serial number of your camera. Since digest authentication is used in CL mode, set the ID and password for CL mode connection with –digest. ID and password can be set with the RICOH THETA smartphone app.

% curl -X POST http://THETAYL00123456.local./osc/commands/execute --data '{"name":"camera.takePicture"}' -H 'content-type: application/json' --digest -u THETAYL00123456:00123456

And my try code is:

 async function get(){
const content = {name:'camera.takePicture', parameters:{sessionId:'SID_0001'}};

const response = await fetch('THETAYN10113693.local./osc/commands/execute', {
        
        method: 'POST', 
        body: JSON.stringify(content),
        headers:{ 'Content-Type': 'application/json' }
    });

    // Get the fetch response as a stream 





const reader = response.body.getReader();

// Async loop the stream
let chunk = await reader.read();
while (chunk && !chunk.done) {
    for (let index = 0; index < chunk.value.length; index++) {
         // parse the response in chunks       
    }
    chunk = await reader.read();
}

 }

 get();

I want ask about some points:

  • they told me that I must change this THETAYL00123456 to my Camera serial number and this ((THETAYL00123456)) repeated in API Doc twice, So which one should I to change ?

  • Is this code which I wrote is Correct?Does it match to written information in API Doc? if not I hope please Fix it

  • How Can I test the Connection if work or No?

I wish your help and thanks so much




Asteroids Game on Das Keybaord Site

How would I be able to incorporate A similar kind of game thats shown on the Das Keyboard site. https://www.daskeyboard.com/ All the way at the bottom under sub menu Connect/Destroy This Site.

This then launches a game that destroys the elements on the site. How do I even go about beginning to incorporate something like this on my own site. Are we looking at Javascript?




server crashed down when I was trying to login the data for testing validation

I was trying to input wrong data to see how the server getting data from the database and responding to the client if there is any incorrect like wrong username/password or username does not exist. It worked perfectly and responded for 1 to 2 times until the third time the crash happened:

  1. Cannot set headers after they are sent to the client

  2. ERR_CONNECTION_REFUSED``

Here is my server-side:

const express = require("express");
const router = express.Router();
const { Users } = require("../models");
const bcrypt = require('bcryptjs');


router.post("/", async (req, res) => {
    const {username, password, phone, email} = req.body;

    const user = await Users.findOne({ where: {username: username}});
    if(user) {
        res.json({ error: "User is unavailable"});
    } else {
        bcrypt.hash(password, 10).then((hash) => {
            Users.create({
                username: username,
                password: hash,
                phone: phone,
                email: email,
            });
            res.json("SUCCESS");
        });
    };
    
});

router.post("/login", async (req, res) => {
    const { username, password } = req.body;
  
    const user = await Users.findOne({ where: { username: username } });
  
    if (!user) res.json("User Doesn't exist");
    bcrypt.compare(password, user.password).then((match) => {
        if (!match) res.json("Wrong Username or Password");
        res.json("YOU LOGGED IN");
    });
});


module.exports = router;

and Here is my client side:

import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
import {faUser, faLock, faEye, faEyeSlash} from  '@fortawesome/free-solid-svg-icons';
import { BiUser } from "react-icons/bi";
import {Link} from 'react-router-dom';
import { useState } from 'react';
import axios from 'axios';

function Register() {
    const [username, setUsername] = useState("");
    const [password, setPassword]= useState("");
    const [type, setType] = useState("password");
    const [icon, setIcon] = useState(faEye);

    const handleShowHidePass = () => {
        let currentType = type === "password" ? "text" : "password";
        let currentIcon = icon === faEye ? faEyeSlash : faEye;
        setType(currentType);
        setIcon(currentIcon);
      }

    const login = e => {
        e.preventDefault();
        
        axios.post ("http://localhost:3001/auth/login", {
            username: username,
            password: password,
        }).then((res) =>{
            console.log(res.data);
        });
    };

    return(
        <div className="right">
            <span className="title"><BiUser className="tilteIcon"/></span>

            <form onSubmit={login} >
                <div className="formInput">
                    <span className="icon"><FontAwesomeIcon icon={faUser}/></span>
                    <input 
                        type="text" 
                        className="username" 
                        value={username}
                        placeholder="Username" 
                        onChange={(e) => {
                            setUsername(e.target.value)
                        }}
                        />
                </div>

                

                <div className="formInput">
                    <span className="icon"><FontAwesomeIcon icon={faLock}/></span>
                    <input 
                        type={type} 
                        className="password1" 
                        value={password}
                        placeholder="Password" 
                        onChange={(event) => {
                            setPassword(event.target.value)
                        }}
                        
                        />
                    <span className="show"><FontAwesomeIcon icon={icon} onClick={handleShowHidePass}/></span>
                </div>
                
                <div className="formInput">
                    <button type="submit">Sign Up</button>
                </div>
                
                <div className="login">
                    <Link to="/register" style=>I already have an account!</Link>
                </div>
            </form>
        </div>
    );
}

export default Register;



Show View in Telerik Report Designer

Along with Store Procedure I also want View to be displayed when we select Stored Procedure radio button in Sql Data Source Component Telerik Report Designer. How can it be done? Thanks




PYTHON: Open Chrome on Bookmarks

So every time I open my chrome browser, it loads the company website, and of course I don't have adm permissions to modify the settings on chrome.

It is possible using Python webbrowser or another library to open directly my chrome bookmarks?

I have something like this, but didn't work:

import webbrowser

webbrowser.get("C:/Program Files/Google/Chrome/Application/chrome.exe %s").open("chrome://bookmarks")



How to use Unity as REST API? [closed]

I have a question. I want to use unity project as library on website. Because I need to be able to access and dynamically change a url parameter in the project through other web applications. Unity application should also work according to this link. I think I should use the Rest API but is there a different way to do it? How can I do it if there is no other way? Can I use Unity project as REST API?




I am trying to add many to many feild in django but getting error

Models are-

class Product(models.Model):

    name = models.CharField(max_length=50)
    price = models.IntegerField(default=0)
    seller=models.ForeignKey(Seller,null=True,on_delete=models.CASCADE,)        
    category = models.ForeignKey(Category,null=True, on_delete=models.CASCADE,)
    description = models.CharField(max_length=200, default='' , null=True , blank=True)
    image = models.ImageField(upload_to='uploads/products/')
    rating=models.FloatField(null=True)
    people=models.IntegerField(default=0,null=True)
    customers=models.ManyToManyField(Customer,blank=True)

class Customer(models.Model):

    user_name = models.CharField(max_length=50)
    phone = models.IntegerField(default='8928')
    email = models.EmailField()
    password = models.CharField(max_length=500)
        

        qq=Product.objects.get(id=8) 
        print(qq)
        print(Customer.objects.all().first()) 
        qq.customers.add(Customer.objects.all().first())
        print("qq.customers is",qq.customers)
"""
Product object (8)
Customer object (1)
qq.customers is store.Customer.None"""

I want to know how we can add customers in product.customers which is showing none in this problem .Please help me to solve this




jeudi 25 novembre 2021

How to lead web projects with the first-year undergrads?

my alma mater sometimes invites me to lead student projects. Students are smart, they know C++, but not web (no js/css).

I'd like to give them a project in web. Something like checker game with a chat-in-game, and an option to choose a random player or play with a friend.

I would expect student will have about 3-4 months with about 10 hours a week for a project. It includes both reading manuals and implementing the project itself.

So there is a series of the question if you were I.

  1. What stack would you use to learn web-development quickly and implement the project?
  2. For the stack you suggest, can you supply with the materials you think are the best to study it?
  3. Do you have any suggestions in general how to effectively lead students from the empty repository to a working website? Would you send students to study flask/django, or better some BaaS like Parse/Firebase? Would you make them to learn only JavaScript, or TypeScript as well?
  4. What are your beloved short reads, like ah-ha moments in web development, you would send to your students?



xpath of following sibling which is stored as header and value

I am trying to extract the flavour name - Fizzy Drink which has a label Flavour. so far i tried Xpath - //span[contains(@class, "a-size-base a-text-bold") and text()="Flavour"] which gives me the flavour, I want to extract the value - Fizzy Drink using next sibling. Please help

<tr class="a-spacing-small">
<td class="a-span3">
<span class="a-size-base a-text-bold">Flavour</span>
</td>
<td class="a-span9">
<span class="a-size-base">Fizzy Drink</span>
</td>
</tr>



The input from client side should entered only digits, if is alphabets should give an error msg. using HTML, JavaScript

This is the question;

Create an html page with the following form:

Enter your name

Add a js validation function to the form that ensures that you can only add numbers in the textbox If you enter alphabets, you should generate an error message in the given div. -->

I run the requiermtn successfully and I'm giving the error message when it entered alphabets. However, it's giving me the same error message when I enter digits as well. Please kindly show how the function or the window.onload should be implemented. Thank you.

My answer is down below;

<head>

    <meta charset="utf-8">

    <title></title>

</head>

<body>




    <script>

        window.onload = function() {

            let form = document.getElementById('form_ref')

            form.onsubmit = function() {

                let user = form.user.value;

                if(parseInt(user) !== user) {

                    document.querySelector('div').innerHTML = "Error! Please enter digits only!";

                    return false;

                }

                return true;

            }

        }

    </script>

   

    <form id="form_ref" method="post" name="example" action="">

   

        <label for="username">User</label><input type="text" name="user" id="username" required>

        <div id="a"></div>

        <br>

       

   

        <input type="submit" value="Submit Information" id="submit">

    </form>

</body>



Send GET Request in C to IPv6 web server on windows

I am trying to make a simple GET request to a webserver that has an IPv6 adress, and i does not work. My code has to be available on windows so I use the windows libraries, e.g.

#include <stdio.h>
#include <winsock2.h>
#pragma comment (lib, "Ws2_32.lib")
#include <windows.h>
#include <winuser.h>
#include <string.h>

Here is the part of the code that establishes the connection :

int portno = 825;
//yes, strange port number...
const char *adress = "[2a02:842a:86d1:d001:26dd:8d7a:8202:d9a3]";
WSADATA wsa;
SOCKET sockfd;
char message[4096] = "GET //page//index.php?data=somedata HTTP/1.1\r\nHost: [2a02:842a:86d1:d001:26dd:8d7a:8202:d9a3]\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r\n\r\n");
struct hostent *server;
struct sockaddr_in6 serv_addr;
int bytes, sent, received, total;
char response[4096];
int iResult = WSAStartup(MAKEWORD(2,2),&wsa);
sockfd = socket(AF_INET6 , SOCK_STREAM , 0 );

//while debugging i noticed that this line does not work
server = gethostbyname(adress);

memset(&serv_addr,0,sizeof(serv_addr));
printf("1\n");
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(portno);
memcpy(&serv_addr.sin_addr.s_addr,server->h_addr,server->h_length);
connect(sockfd,(struct sockaddr *)&serv_addr,sizeof(serv_addr));

If anybody knows how to change this code so that it will allow IPv6 connections, please tell me :)




How to get multiple NULL values in web api get [duplicate]

How would I get data from a SQL Server table where there is null and convert it to a string in Web API ?`

I get this error:

Unable to cast object of type 'System.DBNull' to type 'System.String'

My code:

SqlCommand AGetCommand = new()
        {
            Connection = DataSource,
            CommandType = CommandType.StoredProcedure,
            CommandText = "GetCustomers"
        };

SqlDataReader AGetCommandDataReader;
AGetCommandDataReader = AGetCommand.ExecuteReader();

List<Customer> ExampleCustomers = new();

if (AGetCommandDataReader.HasRows)
{
    while (AGetCommandDataReader.Read())
    {
        Customer ExampleCustomer = new()
                {
                    CustomerID = (string)AGetCommandDataReader["CustomerID"],
                    CompanyName = (string)AGetCommandDataReader["CompanyName"],
                    ContactName = (string)AGetCommandDataReader["ContactName"],
                    ContactTitle = (string)AGetCommandDataReader["ContactTitle"],
                    Address = (string)AGetCommandDataReader["Address"],
                    City = (string)AGetCommandDataReader["City"],
                    Region = (string)AGetCommandDataReader["Region"],
                    PostalCode = (string)AGetCommandDataReader["PostalCode"],
                    Country = (string)AGetCommandDataReader["Country"],
                    Phone = (string)AGetCommandDataReader["Phone"],
                    Fax = (string)AGetCommandDataReader["Fax"]
                };

        ExampleCustomers.Add(ExampleCustomer);
    }
}

AGetCommandDataReader.Close();
DataSource.Close();

return ExampleCustomers;



My www website is different then not www website

So, I uploaded my website to a host, and everything was working fine, until I uploaded a newer version of my site. Now, if I use the non-www version the older version of the site loads, and if I use the www version the newer one comes up. How can I fix this?




What does the code do that hacker typer produces?

so I was going on hackertyper and realized how much this looks like HTML code. Am I correct about that? what does the code do? btw here's a snippet`struct group_info init_groups = { .usage = ATOMIC_INIT(2) };

struct group_info *groups_alloc(int gidsetsize){

struct group_info *group_info;

int nblocks;

int i;



nblocks = (gidsetsize + NGROUPS_PER_BLOCK - 1) / NGROUPS_PER_BLOCK;

/* Make sure we always allocate at least one indirect block pointer */

nbl|

`




How to improve performance of Flutter websites?

I've developed a Flutter Webapp, it's a small and functioning multi-page app with image assets, database connections, and several other features. It shouldn't be heavy but the loading time is very slow and the performance in general is not good.

I'm fairly new to Flutter but I can't understand why its so slow as I've kept it quite lean during development.

Please run my site https://www.coursekiosk.com on https://web.dev/measure/ The main thing seems to be the JS scripts (which is Firebase code for connecting to database etc), and the content painting - which I'm not sure how to make fast without losing the quality of assets used.

I have a feeling it's my overall design/structure which may not be very efficient, and I'd like to know how to develop a website, whether Flutter or not, with performance in mind.

I'm happy to give more information if needed. Thanks for the help.




Website will load forever without http:// in the url, but will load instantly with it included

I have a website that will load when you put in http://my-domain.net but not when you just enter my-domain.net.

I figure this is DNS related, but I'm not sure what to look for in my DNS settings. This behavior also varies from machine to machine. On my PC it will resolve either url, but on my laptop it will not.

Can provide any additional information that could prove useful.




How to get imdb film id using javascript with only film title? [closed]

i want to output movie id from imdb, i have only film title for searching the film for example "No Time to Die" . how can i get on my site this id from imdb ? tt2382320 maybe possible with javascript to get film id ?




Keep a horizontal table scrollbar always in view

I got a table on my webpage, and for low resolutions, it has a horizontal scrollbar. However, the scrollbar is fixed on the bottom of the table, and with many entries, it's a bit unnecessary to always scroll down, scroll left / right and scroll back to where we were again.

My table CSS looks like that:

th,
td {
    white-space: nowrap;
}
table {
    table-layout: auto;
}

How is it possible to have the scrollbar always appear at the bottom of the screen, if the bottom of the table is out of view? Most questions I've found were more like "how to always show the scrollbar, even if it isn't needed", but still only at the bottom of the table.

Thanks in advance!




How should i copy a code from github to make a website [closed]

I am trying to make a website for notes collection which will store all the notes and i need some help making it




How to Navigate to separate URL in react router Dom v6?

i am making a validation form , with a function that checks for password and email , if true it should navigate to a separate website (not to a path within the web). But it is not working

This is my code below:

function validate() {
    if (email==='123@123.com' && password==="123456"){
        console.log(email);
 history('http://www.dummy.com/webmail')
}
}

return{
.
.
.
<Button className={stylesAuth.submitButton} variant="warning" onClick={validate}>
}

How should I do so?




Google Chrome Web Serial API: How do I address a Modbus device with a hex code?

It is my intention to address a device with Modbus via the Web Serial API built into Google Chrome. I want to address my device with a HEX code. The following screenshot proves that my device can be successfully addressed with a tool like this. enter image description here The interface is thus addressed with the following hex value: 01 03 00 01 00 02 95 CB

My question now is. The Tutorial only shows how to address the interface as Uint8Array or Text. How can I address the interface with a HEX code?

Thanks for the help




I have a problem calling with my carousel codes, it keeps keeping variables for other conditions

I have tried so many method to stop this error but nothing seems to work, here is a link to my codepen: https://codepen.io/T_manuel/pen/PoKMYVx

when the page loads, I call the function but when I resize the page, Javascript seems to do the new logic also with previous logics...

const mediaQuery_1 = '(max-width:601px)';

const mediaQueryList1 = window.matchMedia(mediaQuery_1);

/carousel parent div -- to dynamically load the carousel items

// define media queries

const mediaQuery_1 = '(max-width:601px)';

// add matchMedia

const mediaQueryList1 = window.matchMedia(mediaQuery_1);

if (mediaQueryList1.matches) {
  carouselFunc(); // dynamic loaded pictures
  LeftArrow.classList.add("displayNone");
  let indexOfImg = 0; //to be accessed for the carousel, index for first image
  let endofImg = 3; //carousel use, index for next image to be displayed
  otherCarouselLogic(indexOfImg, endofImg);
  if (carouselPics.length > 3) {
    for (i = 3; i < carouselPics.length; i++) {
      carouselPics[i].classList.add("displayNone");
    }
    RightArrow.classList.remove("displayNone");
  } else {
    RightArrow.classList.add("displayNone");
  }
}

else {

  carouselFunc(); //dynamic loaded Pictures
  LeftArrow.classList.add("displayNone");
  let IndexOfImg = 0; //to be accessed for the carousel, index for first image
  let EndOfImg = 4; //carousel use, index for next image to be displayed
  otherCarouselLogic(IndexOfImg, EndOfImg);
  if (carouselPics.length > 3) {
    for (i = 4; i < carouselPics.length; i++) {
      carouselPics[i].classList.add("displayNone");
    }
  }
  // not to display carousel arrows if pics can be showed at once
  if (carouselPics.length <= 4) {
    RightArrow.classList.add("displayNone");
  }
}

// add event Listener

mediaQueryList1.addEventListener("change", function carouselUx(event) {

  if(event.matches) {
    
    document.getElementById("carous").innerHTML = "";
    carouselFunc(); //contains dynamic loaded pictures
    LeftArrow.classList.add("displayNone");
    let indexOfImg = 0; //to be accessed for the carousel, index for first image
    let endofImg = 3; //carousel use, index for next image to be displayed
    otherCarouselLogic(indexOfImg, endofImg);
    if (carouselPics.length > 3) {
      for (i = 3; i < carouselPics.length; i++) {
        carouselPics[i].classList.add("displayNone");
      }
      RightArrow.classList.remove("displayNone");
    } else {
      RightArrow.classList.add("displayNone");
    }
  }
  
   else {

    document.getElementById("carous").innerHTML = "";
    carouselFunc();
    LeftArrow.classList.add("displayNone");
    let IndexOfImg = 0; //to be accessed for the carousel, index for first image
    let EndOfImg = 4; //carousel use, index for next image to be displayed
    otherCarouselLogic(IndexOfImg, EndOfImg);
    if (carouselPics.length > 3) {
      for (i = 4; i < carouselPics.length; i++) {
        carouselPics[i].classList.add("displayNone");
      }
    }
    // not to display carousel arrows if pics can be showed at once
    if (carouselPics.length <= 4) {
      RightArrow.classList.add("displayNone");
    }
  }
})

function otherCarouselLogic(cpF, newImg) {

  /* carousel code ends here */

  carouselBtn.forEach(function (btns) {
    btns.addEventListener("click", function (e) {
      clickedArrow = e.currentTarget.id;

      if (clickedArrow === "right") {
        console.log(newImg);
        carouselPics[cpF].classList.add("displayNone");
        carouselPics[newImg].classList.remove("displayNone");
        LeftArrow.classList.remove("displayNone");
        cpF += 1;
        newImg += 1;
      }

      if (clickedArrow === "left") {
        cpF -= 1;
        newImg -= 1;
        carouselPics[newImg].classList.add("displayNone");
        carouselPics[cpF].classList.remove("displayNone");
        RightArrow.classList.remove("displayNone");
        console.log(newImg);
      }

      // ux purpose, when we get to the last pics in the carousel, the right arrow is hidden
      diffR = carouselPics.length - newImg;

      // diffL
      if (diffR === 0) {
        RightArrow.classList.add("displayNone");
      }

      if (cpF === 0) {
        LeftArrow.classList.add("displayNone");
      }
    });
  });

  /* carousel code ends here */
}

upon load,

newImg is set to 4 and all seems to work

after resize, it is set to either 3 or 4 depending on the logic, but instead of incrementing that value alone, it gives value for the load and also for the resize.