samedi 31 août 2019

How to download/mirror my website built using Iweb on mac when i have no access to hosting?

I created a site using Iweb in mac few years ago. But now I donot have the domain.sites file to edit the site. Also, I donot have access to the hosting account since it has been long I have been active on it. I used httrack website copier and dozens of other tools on windows to clone the site, but i am not getting good results. Some resources are not loading on offline version. How can i mirror the site ?

I also tried the python Wpull and linux wget but no good results.

My site is: http://www.smith-lakehomes.com




How to detect mobile device like Zara.com?

I did some research, and am aware of there are 2 ways to detect a mobile website, either by check user-agent, or by screen resolution. Though it seems that zara.com does not use 1 of those 2. For instance, open zara.com with chrome debugger mobile mode would not return mobile site, or "Request desktop site" on iOS would not return desktop site.

So I am really curious, how does Zara do it?




Web scraping python error (NameError: name 'reload' is not defined)

Trying to do some web scraping with python and getting an error.

I am not sure what this trackback error means, I am running it in Python3, can anyone help?

Traceback (most recent call last): File "/home/l/gDrive/AudioBookReviews/WebScraping/GoodreadsScraper.py", line 3, in reload(sys) NameError: name 'reload' is not defined

# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf8')
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.firefox.options import Options
#from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common import keys
import csv
import time
import json

class Book:
    def __init__(self, title, url):
        self.title = title
        self.url = url
    def __iter__(self):
        return iter([self.title, self.url])

url = 'https://www.goodreads.com/'

def create_csv_file():
    header = ['Title', 'URL']
    with open('/home/l/Downloads/WebScraping/GoodReadsBooksNew.csv', 'w+') as csv_file:
        wr = csv.writer(csv_file, delimiter=',')
        wr.writerow(header)

def read_from_txt_file():
    lines = [line.rstrip('\n') for line in open('/home/l/Downloads/WebScraping/BookTitles.txt')]
    return lines

def init_selenium():
    options = Options()
    options.add_argument('--headless')
    global driver
    driver = webdriver.Chrome("/home/l/Downloads/WebScraping/chromedriver")
    driver.get(url)
    time.sleep(30)
    driver.get('https://www.goodreads.com/search?q=')

def search_for_title(title):
    search_field = driver.find_element_by_xpath('//*[@id="search_query_main"]')
    search_field.clear()
    search_field.send_keys(title)
    search_button = driver.find_element_by_xpath('/html/body/div[2]/div[3]/div[1]/div[1]/div[2]/form/div[1]/input[3]')
    search_button.click()

def scrape_url():
    try:
        url = driver.find_element_by_css_selector('a.bookTitle').get_attribute('href')
    except:
        url = "N/A"

    return url

def write_into_csv_file(vendor):
    with open('/home/l/Downloads/WebScraping/GoodReadsBooksNew.csv', 'a') as csv_file:
        wr = csv.writer(csv_file, delimiter=',')
        wr.writerow(list(vendor))

create_csv_file()
titles = read_from_txt_file()    
init_selenium()

for title in titles:
    search_for_title(title)
    url = scrape_url()
    book = Book(title, url)
    write_into_csv_file(book)




Python web scraping, getting a FileNotFound error

I am trying to run the following script to get some book data from goodreads.com starting with just a list of titles. I have had this code working recently but am now getting the following error:

Traceback (most recent call last):
  File "/home/l/gDrive/AudioBookReviews/WebScraping/GoodreadsScraper.py", line 66, in <module>
    create_csv_file()
  File "/home/l/gDrive/AudioBookReviews/WebScraping/GoodreadsScraper.py", line 29, in create_csv_file
    with open('/home/l/Downloads/WebScraping/GoodReadsBooksNew.csv', 'w') as csv_file:
FileNotFoundError: [Errno 2] No such file or directory: '/home/l/Downloads/WebScraping/GoodReadsBooksNew.csv'

Here is the Code: https://pastebin.com/Y5NQiVEp




Should I use tomcat or a application server?

I'm gonna start to develop a web application which will be accessed by 20-30 users simultaneously. I'll use a 2gb(ram) server and tomcat for a low memory comsumption. Can Tomcat solve my problem without the Java EE implementions and provide a good perfomance application? I don't want to use JPA, CDI and the other stuffs becaouse of my little memory.




How can I Add a code example as an image for design purposes

I was wondering if there is a tool that can generate image like this one with my code inside it ?! Example




Put links and text on same line popup window

I have a popup window that should have a header, a save button, and a close button.

This code

                <div>
                    <a href="#close" class="close">Cancel</a>
                    <a href="" class="spacer">............</a>
                    <a href="#">Deselect your free blocks</a>
                    <a href="" class="spacer">............</a>
                    <a href="#close" class="save">Save</a>
                </div>

does this

This code

                <div>
                    <a href="#close">Cancel</a>
                    <a href="" class="spacer">............</a>
                    <p >Deselect your free blocks</p>
                    <a href="" class="spacer">............</a>
                    <a href="#close">Save</a>
                </div>

does this

(The class 'spacer' just sets opacity to 0)

Any idea how I can have something that's not a link there and still have it fit on one line?




why am i getting red lines when i'm using bootstrap

I'm working on a small site for a startup the site works well on desktops, but i'm trying to make it more responsive using the bootstrap grid system, however i'm getting red grid lines please help, what am i doing wrong?

please view the image here Screenshot




Error on retrieving assets for web (flutter)

I face an issue for Flutter WEB. I followed tutorial on assets from Flutter team (https://flutter.dev/docs/development/ui/assets-and-images) however I receive an error

 ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following assertion was thrown resolving an image codec:
Unable to load asset: assets/images/my_custom_image.png

When the exception was thrown, this was the stack:
dart:sdk_internal 4602:11                                  throw_
load
package:flutter_web/…/services/asset_bundle.dart:220
dart:sdk_internal 25309:9                                  <fn>
...

Image provider: AssetImage(bundle: null, name: "assets/images/my_custom_image.png")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#078a9(), name:
  "assets/images/my_custom_image.png", scale: 1)
════════════════════════════════════════════════════════════════════════════════════════════════════ 

My pubspecs.yaml

flutter:
  uses-material-design: true

  assets:
    - assets/images/

I'm loading image like this

Image.asset("assets/images/my_custom_image.png")

Where did I mess up?




Getting error while calling servlet through jsp in maven project

In web application built with maven , apache tomcat 8.5, mvc , getting error 500 while calling servlet from jsp

I have tried reinstalling eclipse and tomcat

The error I am getting is : Type Exception Report

Message Error instantiating servlet class [com.mvc.Serv]

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

javax.servlet.ServletException: Error instantiating servlet class [com.mvc.Serv] org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748)

Root Cause

java.lang.ClassNotFoundException: com.mvc.Serv org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1360) org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1182) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748)

Note The full stack trace of the root cause is available in the server logs.




Webscraping multiple tags from in a single site from multiple websites

I am attempting to scrape data from multiple webpages that have multiple iterations of various tags. See the example below.

I've been able to pull the data from the webpage and store the first iteration of the table tags however I'm not able to pull the rest of the tags. I'm sure I need another for loop somewhere but I'm not sure where to add it if thats what is required.

df_list = []
folder = 'camupdate'
for cam_data in os.listdir(folder):
    with open(os.path.join(folder, cam_data),encoding="utf8") as file:
        soup = BeautifulSoup(file)
        title = soup.find('title').contents[0]
        main_title = soup.find('div', id_='login_inputs')
        tag = soup.find('div', class_='tag_row')
        tag_title = tag.find('span').contents
        viewers = tag.find_all('span')[1].contents
        rooms = tag.find_all('span')[2].contents
        df_list.append({'title': title,
                        'main_title': main_title,
                        'tag_title': tag_title,
                        'viewers': viewers,
                        'rooms': rooms})

df = pd.DataFrame(df_list, columns = ['title','main_title', 'tag_title', 'viewers', 'rooms'])


Example of code:

# I am trying to pull from this tag, the page=1
<div id="login_inputs">
<form method='post' action='/auth/login/?next=/tags/?page=1' target="_top">

<a href="/tag/x1/" title="x1">x1</a>
</span>
<span class="viewers">48804</span>
<span class="rooms">550</span>

<div class="tag_row">
<span class="tag">
<a href="/tag/x2/" title="x2">x2</a>
</span>
<span class="viewers">22067</span>
<span class="rooms">400</span>

<a href="/tag/x3/" title="x3">x3</a>
</span>
<span class="viewers">12857</span>
<span class="rooms">253</span>

# I am trying to pull from this tag, the page=2
<div id="login_inputs">
<form method='post' action='/auth/login/?next=/tags/?page=2' target="_top">



<a href="/tag/y1/" title="y1">y1</a>
</span>
<span class="viewers">1425</span>
<span class="rooms">16</span>


<div class="tag_row">
<span class="tag">
<a href="/tag/y2/" title="y2">y2</a>
</span>
<span class="viewers">785</span>
<span class="rooms">32</span>

<a href="/tag/y3/" title="y3">y3</a>
</span>
<span class="viewers">492</span>
<span class="rooms">12</span>


Actual

    title   main_title  tag_title   viewers    rooms
0   Tags    None        x1          [48804]    [388]
1   Tags    None        y1          [1425]     [16]


Expected

    title   main_title  tag_title   viewers    rooms
0   Tags    Page 1      x1          [48804]    [550]
1   Tags    Page 1      x2          [22067]    [400]
3   Tags    Page 1      x3          [12857]    [253]
4   Tags    Page 2      y1          [1425]     [16]
5   Tags    Page 2      y2          [785]      [32]
6   Tags    Page 2      y3          [492]      [12]




vendredi 30 août 2019

Which programming language should I use for building an interactive 'flowchart' on my website? [on hold]

I have a website with a login-system and so on, and now I want to create a page for the users where they can create their own sort of flowchart that can be seen by others. Basically what I want is:

  • a button that, when pressed, creates a new bubble a background 'grid' of points so that each new bubble is placed only on the points in an ordered manner
  • the possibility to add a new bubble from another bubble so that they are connected by a line
  • the possibility to add lines between existing bubbles
  • the ability to move the bubbles anywhere on the grid, as long as there isn't another bubble on the point they're placed (and the lines to adjust to their new position)
  • ability to delete one bubble or an entire branch of bubbles
  • ability to add a description to bubbles + a description box in the corner so that when a bubble is clicked (after editing is done), a description of it will be shown in the box
  • ability to change colour of bubbles
  • etc.

Obviously these flowcharts need to be saved so that when the user logs out and in again, they're still there. Can this be done in Javascript, or is there another programming language or something else that would make it a lot easier?




Where is the gsite documentation?

One of my friend tell me the website builder tool "gsite". Please tell me where the "gsite" documentation is? I can't find the "gsite" official site.




my question is about web crawling to find all websites linking to a specific website

I have been given a project to know what websites are linking to some particular website, for example, Wikipedia. We can do this by web crawling, and according to my knowledge web crawler find all the url in a website and then find all the url in that url and so on crawl all the internet. But we are asked to start from any website on the internet and reach the desired website Wikipedia. They say this way we will find all the websites that are linking to the Wikipedia. I am completely confused where to start. please help.




Why does a line show between the two unordered list in my code?

I want to make a grid of 8 images with 4 images in a row with no gap between images. For a row I used an unordered list and floated them towards the left. In the output there is a gap between the two unordered list which was not expected. Can someone explain why ?

Using inspect element I can see that the figure element takes the correct size but the img element has a little less height than expected.

How should I correct it ?

CSS:

*{
    padding: 0;
    margin: 0;
}
.meals-showcase {
    list-style: none;
    width: 100%;
}

.meals-showcase li{
    display: block;
    float: left;
    width: 25%;
}

.meal-photo {
    width: 100%;
    margin: 0;                                                    
    padding: 0;
}

.meal-photo img {
    width: 100%;
    height: 100%;
}

html:

<body>

    <ul class="meals-showcase">
        <li>
            <figure class="meal-photo">                          
                <img src="resources/img/1.jpg" alt="Korean bibimbap with egg and vegetables">
            </figure>
        </li>
        <li>
            <figure class="meal-photo">                           
                <img src="resources/img/2.jpg" alt="Simple italian pizza with cherry tomatoes">
            </figure>
        </li>
        <li>
            <figure class="meal-photo">                        
                <img src="resources/img/3.jpg" alt="Chicken breast steak with vegetables">
            </figure>
        </li>
        <li>
            <figure class="meal-photo">               
                <img src="resources/img/4.jpg" alt="Autumn pumpkin soup">
            </figure>
        </li>
    </ul>
     <ul class="meals-showcase">
        <li>
            <figure class="meal-photo">                                           
                <img src="resources/img/5.jpg" alt="Paleo beef steak with vegetables">
            </figure>
        </li>
        <li>
            <figure class="meal-photo">                                           
                <img src="resources/img/6.jpg" alt="Healthy baguette with egg and vegetables">
            </figure>
        </li>
        <li>
            <figure class="meal-photo">                                            
                <img src="resources/img/7.jpg" alt="Burger with cheddar and bacon">
            </figure>
        </li>
        <li>
            <figure class="meal-photo">                                            
                <img src="resources/img/8.jpg" alt="Granola with cherries and strawberries">
            </figure>
        </li>
    </ul>
</body>




Can a browser check to see if it has a JS library regardless of its source and use it?

BLUFF

Can a browser be told to check to see if it already has a JS library cached from another source by using some sort of identifying metric (Hash, Signature, Version ID, etc) and then use the cached version instead of re-downloading it?

Problem

Assume that there a hundreds of devices on an offline network that have slightly different Single Page Apps (SPA) that all use the same single large JS library. They each serve both the SPA and library locally. Admins of these devices will have fast access to some devices and slow access to others. I am trying to determine if there is anyway to speed up the downloading of the SPA to the Admin's browser for the 'slow access' devices by leveraging the common use of the large library.

The ideal solution would be opportunistic. It would ask the browser if it has the large JS Library with a certain has hash (liblarge.js,sha-256: B4...X) and if it did use it, if not then load the one over the slow link.

I understand that I could try to determine the fast access devices and then try to serve the large library from them, but this would require some sort of reconnaissance along with overhead.

I also understand that I could try to put something like a CDN on the network and serve the large JS lib but there are other aspects of the offline network that make this difficult.




Is there any way to Block HTTrack (or other website cloner) by using htaccess or any other method? Help is greatly appreciated

I run a static HTML webpage and I need to block the website cloners (like HTTrack). Just wondering if there's any way to do it.




Whats the best way to extract the text in this case?

I want to find and grab all the text given under a . Now it returns the text as well as the I want to learn the quickest way to too this, and format it by a comma.

now i alternatively code it by commanding to grab every separately. But i want to grab more then 20 items, so i want to find a quicker way. and also learn from it :D

I tried switching in find and find_all as well by adding get_text at the end. they all give a error

        kenmerken = BeautifulSoup(browser.page_source, 'lxml')
        details = kenmerken.find_all ('div', {'class':'detail-tab-content kenmerken'})
        try:
            tr = details[0].find_all ('td', {'class': 'value'})
        except IndexError:
            size_space = 'Unknown'
        print(tr)

result:

    [<td class="value">
            Herenhuis

    </td>, <td class="value">
            2008
    </td>, <td class="value">
            250 m²
    </td>, <td class="value">
            -    
    </td>, <td class="value">
            -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        -
    </td>, <td class="value">
            -
    </td>, <td class="value">
            -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        5
    </td>, <td class="value">
        -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        Ja
    </td>, <td class="value">
        -
    </td>, <td class="value">
        -
    </td>, <td class="value">
        Ja
    </td>, <td class="value">
        3.627
    </td>, <td class="value">
        64
    </td>]

[




Are there any Facebook page shop API for display product in website?

I want to display Facebook shop product in website with custom design




QUESTION: Personalized web URL on sign up?

Some websites I've seen on signup allow you to declare e.g. Company name. Once signup is complete the name will be used in the URL.

companyname.webapp.com

Only allowing access to those who are invited. I would just like to understand what technologies are used to achieve this? I will be developing in React if that helps or would this be a back-end thing?




What is the best Open-source image editor API?

I need to use an image editor in my web application but i never use any editor. So, i am looking for open-source image editor API which can easily integrateable with good support.




Does bootstrap need the webserver to support mysql and php?

i want to host a bootstrap website on world4you.

Do i need the webserver to support mysql and php?

Thanks




What is the difference between Angular.js and vue.js?

I have to create Signup form in Vue.js but this is new for me. I have worked on Angular.js ...So , first i want to learn What is the different between Angular.js and vue.js? also from coding point of view




Problem load view from controller in Codeigniter 3

So, i want to load a main view from my controller in codeigniter 3.0, but instead of showing the view, the page shows the "Object of class CI_Loader could not be converted to string", and the view i want to show is on the top of my page not in the center of my page.

Here is the error screenshot

sorry for my bad english.

this is my controller:

if($this->session->userdata('logged_in')){
    $data['utama'] = $this->load->view('spvcoll/v_list');
    $data['judul'] = 'List Assign';
    $this->load->view('v_index',$data);
}else{
    redirect('c_index');
}

Here i want to call the variable:

<?php echo $utama;?>




firebase integration with web

i am working on a project in which some of the nodes are moving and enter into a network of main units. so when nodes are connected to that units , main unit sends a value '0' if disconnected and '1' if connected to the fire base real time database.These are the status of individual nodes, connected to main nodes or not.

Till now i have log in to the console of fire base and make an id there and make a project. After than i go to my command prompt and install firebase and then "login" there and run command "firebase init". After then i created a html code and .js file to send the data over the console. i want a web page which tells us that if node is connected or not.

i tried the code which i am showing here.

<html>
   <head>
      <meta>
         <titile>VANET REALTIME DATABASE ></title>
         <script
         src ="https://www.gstatic.com/firebasejs/6.5.0/firebase-app.js">
         </script>
    </head>
         <body>
           <!--value -->
           <pre id ="node1">
           </pre>
           <!--Child -->


           <script src="app.js"></script>
         </body>
    </html>  
```` 
here are my .js file
```` app.js

(function() {
 // Initialization Firebase
  const firebaseConfig = {
    apiKey: "*************************",
    authDomain: "***************************",
    databaseURL: "https://*******************",
    projectId: "van**********",
    storageBucket: "*******************",
    messagingSenderId: "37*************6",
    appId: "1:*********************8"
  };
  // Initialize Firebase
  firebase.initializeApp(firebaseConfig);
   //get elements
   const preObject = document.getElementById('node1');
   //create referencees
   const dbRefObject = firebase.database().ref().child('node1');

   //sync object changes
   dbRefObject.on('value',function(snapshot){
          console.log(snapshot.val());
   });


});

my project has node1 which i created manually and feed some value for testing purpose. but when i run the code it doesn't show me any error but when i see on console there is no output which i feeded in node1. i refresh the page. but no change. please help, i think something is missing , but i couldn't debug it. output should be like node1 1




jeudi 29 août 2019

How to implement upload image via url in django

Basically I am creating a website where you can upload images of different websites using url. How to implement it. How to validate if it is an image and how to fetch it and store in your database




Custom search engine indexing pdf files

I'm managing a simple site that is mainly used to browse through organized lists of a lot of PDF documents (all behind a login). Since so much of the site's content is restricted to PDF files I thought it would be really handy if we could add a search function that indexes these and displays search results based on the text inside the documents (or at least shows you the relevant files, ranked in order of "relevance").

The problem is; I have no idea how this would even be done. Are there any open source, or perhaps even google solutions for this? All I want is a little search bar that searches the content of the site, while also taking the content of PDF files into consideration. Type of technology doesnt really matter- I wasnt the one who built the original site , but its simple enough so that I can rebuild it on another platform if needed. Any suggestions or pointers welcome!




Any Suggestions please

I am building a website for image hosting. People can upload via url or images directly from their device. Trying to implement it on python / Django but not getting the proper tutorials. Any suggestions? Should I use aws s3 for storage and ec2 for server. Any suggestions? I am lost.




What is public facing?

My website consists of a login and a form. The user can be a guest and complete the form, OR the user can login and complete the form. Would it be a public facing website?




Visual Studio Live server respondeds to updates but githubs real hosted website doesnt

Problem

So I recently bought a website, tntsplash.net. I am a beginner to HTML and CSS. So when I went to my real website and saw it wasn't responding I was completely bewildered. Also, the buttons are not working!

Button Code

        <body>
          <!-- Navigation -->
          <nav class="upperpart"></nav>
          <ul>
            <li><a href="#Home">Home</a></li>
            <li></li>
            <li><a href="#Appeals">Appeals</a></li>
            <li></li>
            <li><a href="#Store">Store</a></li>
            <li></li>
            <li><a href="#Contact">Contact</a></li>
          </ul>
        </body>
      </html>
    </nav>

My Full Github Project link: https://github.com/BatDev0/htmlwebsite

Clickable Website Link: https://tntsplash.net




Trusted Web Activity - Address bar not hide - no app deep persmission

i am testing PWA (TWA) to APK and i have a problem with address bar still visible in that app. I think i have a problem with App linking.

i have tested it there: https://developers.google.com/digital-asset-links/tools/generator and it say: No app deep linking permission found for cz.svetandroida.app at svetandroida.cz.

Hosting domain: svetandroida.cz

App package name: cz.svetandroida.app

fingerprint: 2D:C8:DA:46:31:77:D3:20:27:D9:1A:8A:17:26:24:9D:79:5E:7C:7A:7D:22:86:6C:21:CD:DE:49:B9:09:7B:6A

My Json is working and but still have an error. https://svetandroida.cz/.well-known/assetlinks.json

Do you have any idea? :)




Which conversions are made by `curl --data

I've read man curl, but I'm still not sure of the semantics of curl --data <data>.

From the description of --data, it seems like this option causes Curl to send an HTTP POST request, using the Content-Type application/x-www-form-urlencoded, with the specified <data> (and nothing more).

However, reading the description of --data-binary, it says, compared to --data, that newlines are preserved and conversions are never done.

So, is --data removing all newlines, and what conversions will it make? Why isn't this mentioned in the description of --data?

Excerpt of man curl:

 --data-binary <data>
              (HTTP) This posts data exactly as specified with no extra processing whatsoever.

              If you start the data with the letter @, the rest should be a filename.  Data is posted in a similar manner as --data-ascii does, except that newlines are preserved and conversions are  never
              done.

 -d, --data <data>
              (HTTP) Sends the specified data in a POST request to the HTTP server, in the same way that a browser does when a user has filled in an HTML form and presses the submit button. This will cause
              curl to pass the data to the server using the content-type application/x-www-form-urlencoded.  Compare to -F, --form.

              -d, --data is the same as --data-ascii. To post data purely binary, you should instead use the --data-binary option. To URL-encode the value of a form field you may use --data-urlencode.




Cross platform frameworks to have the exact same code on mobile and web

I am looking for a list of frameworks that let you build an app with the exact same source code both for mobile and web environments. I have only found a couple of them but only individually: Haxe+OfenFL, Flutter (which web is still on Alpha) and Adobe Air (which is about to die).

Are there any others?




SonarQube don't start

I'm trying to install SonarQube on my CentOS7 server.

When i try to access via web I see this:

web_page

It's supposed to show a SonarQube page right??

Here i put my logs and configs:

web.log:

2019.08.29 17:24:54 INFO  web[][o.s.s.a.EmbeddedTomcat] HTTP connector enabled on port 9000
2019.08.29 17:25:05 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2019.08.29 17:25:05 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2019.08.29 17:25:06 INFO  web[][o.e.plugins] [Kurt Wagner] modules [], plugins [], sites []
2019.08.29 17:25:06 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2019.08.29 17:25:06 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 6.4.0.25310 / ad64a17b531c0e1f6fef0ce7e4d0d0b060977754
2019.08.29 17:25:06 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:postgresql://localhost/sonar
2019.08.29 17:25:06 ERROR web[][o.s.s.p.Platform] Web server startup failed
java.lang.IllegalStateException: Can not connect to database. Please check connectivity and settings (see the properties prefixed by 'sonar.jdbc.').
        at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:108)
        at org.sonar.db.DefaultDatabase.start(DefaultDatabase.java:75)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.invokeMethod(ReflectionLifecycleStrategy.java:110)
        at org.picocontainer.lifecycle.ReflectionLifecycleStrategy.start(ReflectionLifecycleStrategy.java:89)
        at org.sonar.core.platform.ComponentContainer$1.start(ComponentContainer.java:320)
        at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.start(AbstractInjectionFactory.java:84)
        at org.picocontainer.behaviors.AbstractBehavior.start(AbstractBehavior.java:169)
        at org.picocontainer.behaviors.Stored$RealComponentLifecycle.start(Stored.java:132)
        at org.picocontainer.behaviors.Stored.start(Stored.java:110)
        at org.picocontainer.DefaultPicoContainer.potentiallyStartAdapter(DefaultPicoContainer.java:1016)
        at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1009)
        at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:143)
        at org.sonar.server.platform.platformlevel.PlatformLevel.start(PlatformLevel.java:88)
        at org.sonar.server.platform.Platform.start(Platform.java:231)
        at org.sonar.server.platform.Platform.startLevel1Container(Platform.java:190)
        at org.sonar.server.platform.Platform.init(Platform.java:86)
        at org.sonar.server.platform.web.PlatformServletContextListener.contextInitialized(PlatformServletContextListener.java:43)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4727)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5189)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (FATAL: password authentication failed for user "sonar")
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1549)
        at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
        at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
        at org.sonar.db.profiling.NullConnectionInterceptor.getConnection(NullConnectionInterceptor.java:31)
        at org.sonar.db.profiling.ProfiledDataSource.getConnection(ProfiledDataSource.java:323)
        at org.sonar.db.DefaultDatabase.checkConnection(DefaultDatabase.java:106)
        ... 30 common frames omitted
Caused by: org.postgresql.util.PSQLException: FATAL: password authentication failed for user "sonar"
        at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:451)
        at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:223)
        at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
        at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:211)
        at org.postgresql.Driver.makeConnection(Driver.java:407)
        at org.postgresql.Driver.connect(Driver.java:275)
        at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
        at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
        at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
        at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
        ... 35 common frames omitted

sonar.log:

2019.08.29 17:28:37 INFO  app[][o.s.a.SchedulerImpl] Process [web] is stopped
2019.08.29 17:28:37 INFO  app[][o.s.a.SchedulerImpl] Process [es] is stopped
2019.08.29 17:28:37 INFO  app[][o.s.a.SchedulerImpl] SonarQube is stopped
<-- Wrapper Stopped
--> Wrapper Started as Daemon
Launching a JVM...
Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
  Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

2019.08.29 17:28:40 INFO  app[][o.s.a.AppFileSystem] Cleaning or creating temp directory /opt/sonarqube/temp
2019.08.29 17:28:40 INFO  app[][o.s.a.p.JavaProcessLauncherImpl] Launch process[es]: /usr/java/jdk1.8.0_131/jre/bin/java -Djava.awt.headless=true -Xmx1G -Xms256m -Xss256k -Djna.nosys=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonarqube/temp -cp ./lib/common/*:./lib/search/* org.sonar.search.SearchServer /opt/sonarqube/temp/sq-process6725369398987844378properties
2019.08.29 17:28:45 INFO  app[][o.s.a.SchedulerImpl] Process[es] is up
2019.08.29 17:28:45 INFO  app[][o.s.a.p.JavaProcessLauncherImpl] Launch process[web]: /usr/java/jdk1.8.0_131/jre/bin/java -Djava.awt.headless=true -Dfile.encoding=UTF-8 -Xmx512m -Xms128m -XX:+HeapDumpOnOutOfMemoryError -Djava.io.tmpdir=/opt/sonarqube/temp -cp ./lib/common/*:./lib/server/*:/opt/sonarqube/lib/jdbc/postgresql/postgresql-9.4.1209.jre7.jar org.sonar.server.app.WebServer /opt/sonarqube/temp/sq-process3428525909039640490properties

systemctl status httpd:

[oksmart@CLOUDSVRSONAR01 logs]$ systemctl status httpd -l
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2019-08-29 16:59:00 CEST; 33min ago
     Docs: man:httpd(8)
           man:apachectl(8)
  Process: 5697 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=0/SUCCESS)
 Main PID: 5834 (httpd)
   Status: "Total requests: 50; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─5834 /usr/sbin/httpd -DFOREGROUND
           ├─5835 /usr/sbin/httpd -DFOREGROUND
           ├─5836 /usr/sbin/httpd -DFOREGROUND
           ├─5837 /usr/sbin/httpd -DFOREGROUND
           ├─5839 /usr/sbin/httpd -DFOREGROUND
           ├─5900 /usr/sbin/httpd -DFOREGROUND
           ├─5901 /usr/sbin/httpd -DFOREGROUND
           ├─5903 /usr/sbin/httpd -DFOREGROUND
           ├─5904 /usr/sbin/httpd -DFOREGROUND
           ├─5905 /usr/sbin/httpd -DFOREGROUND
           └─5906 /usr/sbin/httpd -DFOREGROUND

Aug 29 16:59:00 CLOUDSVRSONAR01 systemd[1]: Starting The Apache HTTP Server...
Aug 29 16:59:00 CLOUDSVRSONAR01 httpd[5834]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::250:56ff:fe01:114a. Set the 'ServerName' directive globally to suppress this message
Aug 29 16:59:00 CLOUDSVRSONAR01 systemd[1]: Started The Apache HTTP Server.

/etc/httpd/conf.d/sonar.oksmart.es.conf :

<VirtualHost *:80>
    ServerName localhost
#   ProxyPreserveHost On
#   ProxyPass / http://localhost:9000/
#   ProxyPassReverse / http://localhost:9000/
    TransferLog /var/log/httpd/sonar.oksmart.es_access.log
    ErrorLog /var/log/httpd/sonar.oksmart.es_error.log
</VirtualHost>

NOTE: I commented the proxy options because if i comment out those lines, i get an error on the web page.

sonar.sh :

DEF_APP_NAME="SonarQube"
DEF_APP_LONG_NAME="SonarQube"
APP_NAME="${DEF_APP_NAME}"
APP_LONG_NAME="${DEF_APP_LONG_NAME}"
WRAPPER_CMD="./wrapper"
WRAPPER_CONF="../../conf/wrapper.conf"
PRIORITY=
PIDDIR="."
RUN_AS_USER=root
...

sonar.service:

[Unit]
Description=SonarQube service
After=syslog.target network.target
[Service]
Type=forking
ExecStart=/opt/sonarqube/bin/linux-x86-64/sonar.sh start
ExecStop=/opt/sonarqube/bin/linux-x86-64/sonar.sh stop
User=root
Group=sonar
Restart=always
[Install]
WantedBy=multi-user.target

Any idea of what am i doing wrong??

Firewall is disabled.

Thanks all!




print screen active website with vba code

I have been doing some searching on here and google for a few hours for some code that will simply printscreen an active website and paste it in to a given cell of my choice on a named worksheet.... however, I have tried so many and tried modifying that none work at all! it seems a lot of people have a lot of issues with something that seems simple.

can someone please help me and provide me code that will do this.

thanks

gaz

p.s I am a beginner, I can do webbots but with others snippets and still learning, so please be kind.




Free DNS provider with reactjs hosting

I have my own domain which I want to load a web project made in reactjs. I have two doubts:

  1. The hosting must have compatibility with reactjs to load the project or is it not important the compatibility of the hosting with the tools used?
  2. Is there a dns provider with free hosting included?

I'm new working with this and I don't understand how it works

I use firebase as a provider of dns and hosting but it charges me 7 USD per month and to only perform tests it can be somewhat expensive




django: while files are preparing for download , show loading animation

I use Django , When files are preparing for download , I want to show loading circle animation , How can i understand files preparing finish time ?

I try this code but its useless because it calculate is long for response

request.start_time = time.time() print("start") print(request.start_time) print("final") print(time.time()) total = time.time() - request.start_time print("total unclear") print(total) print("total") print(int(total * 1000))

No error




How to auto align/resizing picture even when web browser is change spontaneously ? (Like Youtube Video)

Currently, there is no style adjustment in the class. So the picture shift depending on the web browser size. However, if I were to change size of my browser window the picture stay the same size until I hit refresh. I want to get that out of the way. Similarly, like youtube video (see the picture).

Autoresizing1 Autoresizing2




Hide Header for custom (/) page odoo v12

I want to hide the header (Menu) of my Website for some page

Example: when I open the first page of my site I find just a small portal

enter image description here

if I click on home it will show me the home page with the normal Header (Menu) enter image description here

what are the steps to follow




can't use imported var from js file in code

I try to use imported vars from a js file into my code but I can't get it to work the excepted way.

location_var.js

var location = {

    place: "Bogotá",
    lat: "4.710988599999999",
    lng: "-74.072092"

};
export { location };

index.html

<script type="module">
    import { location } from './location_var.js'
    console.log(location.lat) // this will be displayed
</script>

but if I put a <script> tag below, I can't use my variables back.

<body>
    <!--The div element for the map -->
    <div id="map"></div>
    <script>
        function initMap() {
            var place = { lat: location.lat, lng: location.lng }; // this doesn't work - console says the vars are undefined for some reasons
            var map = new google.maps.Map(
                document.getElementById('map'), { zoom: 4, center: place });
            var marker = new google.maps.Marker({ position: place, map: map });
        }
    </script>
    <script async defer
        src="https://maps.googleapis.com/maps/api/js?key=API_KEY&callback=initMap">
        </script>
</body>

Any ideas why I can't call it back there?




How to use third party control in my Genexus project

I am developing a web application in the Genexus 16. In this I have to use a third party chart control(e.g goJs or syncfunsion). Please let me know how to integrate this control in my project.

Thanks in advance.

~Santosh.




Azure App service connect to SQL Server on premise without hybrid connection

I have a Web API deployed to an Azure service app (2 nodes). I want to connect to an on-premise SQL Server 2016 database.

I get the message:

Cannot connect to the database

I disabled the firewall on the on-premise SQL Server (to test), but it still is not working.

I can connect running the app on my PC connecting to the SQL Server (by ipnr), but not if I publish it to Azure (I checked the web.config in Azure, it is looking good). I am using an ipnr (in the connection string) to connect.

  • .NET framework 4.5.2
  • Entity Framework 4.6.3

It's already working with a hybrid connection, but that's limited to 25 connections, in my case, the app will be used by a lot of concurrent users, like 200 users, so I don't want a hybrid connection. I want a direct connection based on an ipnr and firewall settings. Or another solution.

Hybrid connection is working, but is limited to 25 connections. I have more concurrent users.

It must connect with the on-premise SQL Server database.




launch a script compiled using pyinstaller on a website [on hold]

i compilled a script in python using pyinstaller but i was asked to make it an executable on a website (that i will need to create). (my website need to launch the script then offer to download the result and there is a moment where i use tkinter "tkinter.Tk") i use those library:

import tkinter as tk
import os
from selenium import webdriver as driver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup as soup
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
import time
from sys import exit

so is it possible to make a website launch it? is it possible to use django to make it into a website? if not is it possible to use html and javascript?




I want to create my own chat bot with python and add into my website? [on hold]

I want to create an chat bot in python and add into my website. can anyone suggest me good answer or workflow or kind of tutorials?




How to get started with back-end development (very beginner) [on hold]

I'm starting to learn web development to get a job at my city but I'm feeling lost. I have learned basic front-end (basic html, css and javascript) and now I want to learn back-end but I have no clue how to connect the front-end websites I have created with a back-end.

What I need to know is how to get the information I have on my html websites and connect them to a database using a back-end language like php or C# (I need to learn these two).

What do I need to learn first? Whats the best way to learn web development.

I tried watching tutorials on C# .NET MVC but it feels like people are building the websites from scratch and not just adding back-end support to an existing front-end website..

Thanks!




mercredi 28 août 2019

I scraped a wiki table from multiple companies ibm,oracle,accenture using BeautifulSoup and Pandas. how to show all the tables in single flask page?





from flask import Flask,render_template
app = Flask(__name__)

import pandas as pd
import requests
from bs4 import BeautifulSoup

@app.route('/microsoft')
def microsoft():
    data=[]
    url = "https://en.wikipedia.org/wiki/Microsoft"
    page = requests.get(url)
    soup = BeautifulSoup(page.content, 'html.parser')
    table=soup.find('table',{'class':'wikitable float-left'})
    rows=table.find_all('tr')
    for row in rows:
        data.append([cell.text.replace('\n', ' ')for cell in row.find_all(['th', 'td'])])

    df = pd.DataFrame(data[1:],columns=data[0])


    return render_template('index.html', header="true", table_id="table", tables=[df.to_html(classes='data')], titles=df.columns.values)

@app.route('/oracle')
def oracle():
    data=[]
    url="https://en.wikipedia.org/wiki/Oracle_Corporation"
    page = requests.get(url)
    soup = BeautifulSoup(page.content, 'html.parser')
    table=soup.find('table',{'class':'wikitable float-left'})
    rows=table.find_all('tr')
    for row in rows:
        data.append([cell.text.replace('\n', ' ')for cell in row.find_all(['th', 'td'])])

    df = pd.DataFrame(data[1:],columns=data[0])


    return render_template('index.html', header="true", table_id="table", tables=[df.to_html(classes='data')], titles=df.columns.values)  
 
@app.route('/accenture')
def accenture():
    data=[]
    url="https://en.wikipedia.org/wiki/Accenture"
    page = requests.get(url)
    soup = BeautifulSoup(page.content, 'html.parser')
    table=soup.find('table',{'class':'wikitable float-left plainrowheaders'})
    rows=table.find_all('tr')
    for row in rows:
        data.append([cell.text.replace('\n', ' ')for cell in row.find_all(['th', 'td'])])

    df = pd.DataFrame(data[1:],columns=data[0])


    return render_template('index.html', header="true", table_id="table", tables=[df.to_html(classes='data')], titles=df.columns.values)   

   


if __name__ == '__main__':
    app.run(debug=True)

how to show all scraped wiki tables in single page and scrolling down method or line by line using python flask?

now i get answer only this method http://127.0.0.1:5000/oracle or http://127.0.0.1:5000/accenture or http://127.0.0.1:5000/ibm but i want to show http://127.0.0.1:5000 just click the link, show the all tables.




Can I use Gatsby for my website with users?

Can I build a Gatsby website where people can sign up, edit their profiles, they can submit forms, files, leave comments and other features that my site has? Is this form of communication with a database available and if so how is it executed?

I literally can not find anything on the internet about this and it's giving me doubts.




How to get a server's current time from client side?

I'm using a web page thats not displaying the server time. How can I get the exact server time from client side, if I don't have access to the server's admin panel?




Django-ratelimit not working in development mode

I am using django-ratelimit package. Everything is working fine and no error but it is not rate limiting my views.




AWS Cloud9 Server refuses to connect

So I'm trying to make a website for school and I've been following this guys tutorial on how to make a website. But for some reason when I get to lesson 32 and I enter the ec2-user:~/environment/blog $ rails server -b $IP -p $PORT command, the website doesnt run and it says " somenumbersandletters.vfs.cloud9.us-east-2.amazonaws.com refused to connect " with an error. I've followed all the steps correctly (Except for the directory he runs it from, I run it straight from blog instead of environment because it tells me I need to make a new app the other way). I've tried disabling my firewall, I've enabled Cookies and searched the internet for a solution. I am very new to Servers and Coding and any help would be greatly appreciated! This is my Terminal Log




django-ratelimit not rate limiting my signup view

Everything is working but it is not rate limiting. @ratelimit(key='ip', rate='5/m') def signup(request)

No error just not rate limiting. Development mode. Windows. Cache setting is django default cache

Any example program how to use Django-ratelimit.




setState not re-rendering react component inside array

I'm trying to create a react app that adds a react component when pressing a button a then re-renders it. I'm using an array of p elements inside state as a test. The event handler function uses setState to modify the array but for some reason it does not re-renders de component so the change (the new element) is not showed in the screen. What I'm doing wrong?

import React, {Component} from "react";

export default class Agenda extends React.Component{

  constructor(props){

    super(props);

    this.list = [];

    this.state = {

      list:[]

    };

    this.addItem = this.addItem.bind(this);

    const items = ["Hola Mundo 1","Hola Mundo 2","Hola Mundo 3"];

    const itemComponent = items.map((item) => 
      <p>{item}</p>
    );

    this.list = itemComponent;
    this.state.list = itemComponent; 

  }

  addItem(){

    //Adds a new paragraph element at the end of the array
    this.list[3]= <p>Hola Mundo 4</p>;

    this.setState(

      {
        list: this.list
      }
    );

  }

  render(){


    return(

      <div id={this.props.id} className={this.props.className}> 


        {this.state.list}

        <button onClick={this.addItem}>

          Add item

        </button>

      </div>

    );

  }
}




How to pull a JSON file from a secure domain without causing web page to be flagged as insecure

I'm setting up a squarespace site and want to create dynamic content based off a JSON string that is being served by another domain.

I've created an inline script that uses XMLHttpRequest to pull the JSON string from the remote domain and then, after formatting, uses document.write() to write the required information to the page. However, by embedding the script the Squarespace domain is now being flagged as insecure by web browsers. Both domains are secure when navigated to separately so I can't figure out why.

Below is the function I use to get the JSON

function httpGet(){
   var xmlHttp = new XMLHttpRequest();
   xmlHttp.open( "GET", URL, false );
   xmlHttp.send( null );
   return(xmlHttp.responseText);
}

When I check in the developer console it says the request is using CORS but the site is still flagged as insecure. Any ideas what may be causing this as there is no explanation given in the console. I don't whether moving the script to the header rather than being inline may help, but I don't see why it would.




jenkinsfile - copy files to s3 and make public

I am uploading a website to an s3 bucket for hosting, I upload from a jenkins build job using this in the jenkins file

withAWS(credentials:'aws-cred') {

             sh 'npm install'
             sh 'ng build --prod'
             s3Upload(
                       file: 'dist/topic-creation',
                       bucket: 'bucketName',
                       acl:'PublicRead'
                     )
        }


After this step I go to the s3 bucket and get the URL (I have configured the bucket for hosting), when i go to the endpoint url I get a 403 error. When i go back to bucket and give all the items that got uploaded public access, then the URL brings me to my website.

I don't want to make the bucket public, I want to give the files public access, I thought adding the line acl:'PublicRead' which can be seen above would do this but it does not.

Can anyone tell me how I can upload the files and give public access from a jenkins file?

Thanks




How can I create a dropdown with images in the list

I want to create a dropdown that when clicked I want it to drop a list of items including small images next to the item names.




how to set pixel code in digital marketing?

can you tell me please how pixel code add for [digital marketing][1] when I am trying to add in the website so it's showing me an error.

enter code here   <html lang="en"> <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="language" content="english" /> <meta http-equiv="content-language" content="en-us"> <meta name="robots" content="index,follow"/> <meta property="og:type" content="website" />

where is suitable to add code.




Website for various cryptography algorithms

Is there any single website where I can encrypt and decrypt using various algorithms?




Software/Method to post updates on different servers

I know this is not a typical question but I'll try my best to simplify it: enter image description here

I have a web-app (developed in the .Net framework) which folder is kept in the storage, when I update a (or multiple) page in that app, I replace it in the folder in the storage and then I manually deploy those updates on each server located in different countries one after another which takes lots of times.

Is there a software that will help me by letting me select which servers in which countries to automatically deploy the update on the servers I chose?

If not, any recommendation on how to accomplish this task?

Thanks.




How to insert a database record if no matching Web Method is called

I am trying to creating a simple SOAP Web Service and I would like it to log (by adding a SQL database record) when no matching WebMethod is called, and include what the failed method/action is.

The Web Service contains two WebMethod's; MethodA and MethodB.

If MethodA or MethodB is called, it adds an entry into the SQL database using my custom class "Common.LogRequestResponse" which takes a SQL connection string, and the name of the called method. This works perfectly.

However, if neither MethodA or MethodB is called, I'd like the web service to add a record specifying what the failed method was. For example, if a SOAP request trying to call "MethodC" is sent to the web service, it will obviously fail but the web service should catch this and use "Common.LogRequestResponse" noting "MethodC".

This is the Web Service code;

namespace SOAPWebService
{
    [WebService(Namespace = "http://test.com")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class SOAPService : System.Web.Services.WebService
    {

        [webMethod]
        public string MethodA()
        {
            string strConnect = ConfigurationManager.ConnectionStrings["DefaultConnectionString"].ConnectionString;
            Common.LogRequestResponse(strConnect, "MethodA");

            return "this is a Method A";
        }

        [webMethod]
        public string MethodB()
        {
            string strConnect = ConfigurationManager.ConnectionStrings["DefaultConnectionString"].ConnectionString;
            Common.LogRequestResponse(strConnect, "MethodB");

            return "this is a Method B";
        }

        // some kind of Catch code here if neither methods above called
        Catch()
        {
            string MethodCalled = xxx // the name of the method being called
            string strConnect = ConfigurationManager.ConnectionStrings["DefaultConnectionString"].ConnectionString;
            Common.LogRequestResponse(strConnect, MethodCalled);

            return "Failed to find method"+ MethodCalled;
        }

    }
}

This is a SOAP Request XML that correctly calls MethodA;

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <MethodA xmlns="http://test.com" />
    </soap:Body>
</soap:Envelope>

And this is a SOAP Request XML that calls a method I have not defined, and would like the Web Service to record "MethodC";

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <MethodC xmlns="http://test.com" />
    </soap:Body>
</soap:Envelope>




How can I sum values which are coming from web api in foreach loop? Javascript

Why can not I sum prices in foreach loop that I wrote for web api service? It takes only last price for last index bills.bills[6].price

export class BillManager {
    async updateBill(className) {
        const billService = new BillService();
        const bills = await billService.get();

        bills.bills.forEach((parameter, index) => {
            var total=0;
            total += bills.bills[index].price;
            price.innerHTML = "<b>" + "Total: " + total + "EUR" + "</b>";
});

This gives 5EUR output. It is the last index's price.




Dynamic Snapshot Testing

I have a time differences function that gets a date and calculates it differences with the current time and return time differences like:

4 days ago

Now, I used this function on a web page with some Unit test and Snapshot test. Snapshot testing will fail every day because tomorrow the differences will be 5 days ago

What can I do in this situation?




How to change or hide original path in core php

I want to hide my url path ,so that no one can see the actual path of my file location.

For Example ,for this path ->localhost/example/api/Provider/signup.php

i want to change it like following ,

localhost/Provider/signup

in my .htaccess if i write following ,it works

RewriteEngine On
RewriteRule ^signup?$ signup.php

but when i try to change like below it wouldn't work

RewriteEngine On
RewriteRule ^signup?$ api/Provider/signup.php




How would I make a user who is verifed have a blue tick next to their name in Django

I would like to know how I would go about adding a system so that if a user if verified, a tick will appear next to their name. I think I will have to make a variable called verifed and make it a bool and only admins can change it. So how would I display an icon next to their name if verified == True?

I haven't tried anything because whenever I Google it, tutorials on how to get verified on Instagram flood everything




mardi 27 août 2019

TemplateDoesNotExist at /sign up/

I'm trying to implementation email confirmation at the time of signup. I'm following this tutorial. https://medium.com/@frfahim/django-registration-with-confirmation-email-bb5da011e4ef Everything is correct except TemplateDoesNotExist at sign up acc_active_email.html It cannot find email confirmation htmt template sent during sign up




How to update a webpage via sms text messaging (NON wordpress)

I want to update a webpage by submitting the content via sms text messaging from my phone, to my website. Similar to the way a wordpress blog would be able to, but this is a static, NON Wordpress website.

Any thoughts on how I can use PHP to achieve this?

I include my content via PHP on each 'index.php' file as such:

<!-- include the specific content for a page... -->
    <?php 
        // depending on where we're at, include that specific file...
        if($location == "/") {
            include($_SERVER['DOCUMENT_ROOT'].'/content.php');
            } elseif($location == "/articles-blog/") {
                    include($_SERVER['DOCUMENT_ROOT'].'/articles-blog/blog.php');

So I'd like to be able to include content submitted via sms text messaging (into the "blog.php" file).

Thanks & Best Regards




Why does the help page of my Web Api 2 project pull controllers from other projects in the same solution?

I'm following the Web Api 2 tutorial on Microsoft Docs (https://docs.microsoft.com/en-us/aspnet/web-api/overview/getting-started-with-aspnet-web-api/creating-api-help-pages) as I'm building some fairly basic endpoints in my Web Api Project.

I'm specifically at the creating the Help Page process. However, I created the Web Api 2 project inside an existing solution with other class libraries and .net core projects.

The problem I'm facing is that, after I installed the nuget HelpPage package and set it up for XML documentation, the help page is showing Controllers from other projects that I do not wish to display in it.

Is there a way to just filter the help page to display controllers within it's project and not access other projects?

Thanks.

I




Bizarre, randomly timed scraping errors

so I've got a functioning scrapy web crawler that will search a given url ("amazon.ca" + "sku(from a csv)") and then return title, img url from 2nd level page, etc)... but it stops working after 300 or so URL crawls, giving this error in the terminal output:

 TypeError('Request url must be str or unicode, got %s:' % type(url).__name__)
TypeError: Request url must be str or unicode, got NoneType:

I know I'm doing some pretty random stuff to narrow in on my desired content before saving as items, but the real issue here is the fact that this stops working randomly after being run a certain number of times.

Here's my crawler:

import scrapy
import csv
from scrapy2.items import Scrapy2Item
  
class spider1(scrapy.Spider):
    name = "spider1"
    domain = "https://www.amazon.ca/s?k="

    with open("C:/Users/Tyler/Desktop/scraper/scrapy2/spiders/csv/input.csv", newline="") as csvfile:
        skureader = csv.reader(csvfile, delimiter=' ', quotechar='|')

        sku_list = []

        for row in skureader:
            sku_list.append(''.join(row))

    def start_requests(self):
        for url in self.sku_list:
            yield scrapy.Request(url=spider1.domain+url, callback = self.parse)

    custom_settings = {
        'DEPTH_LIMIT': 1
    }

    def parse(self, response):

        RESULT_SELECTOR = ".sg-col-20-of-24" + \
                          ".s-result-item" + \
                          ".sg-col-0-of-12" + \
                          ".sg-col-28-of-32" + \
                          ".sg-col-16-of-20" + \
                          ".sg-col" + \
                          ".sg-col-32-of-36" + \
                          ".sg-col-12-of-16" + \
                          ".sg-col-24-of-28"


        for dataset in response.css(RESULT_SELECTOR):

            items = Scrapy2Item()

            titlevar = dataset.css('span.a-text-normal ::text').extract_first()
            artistvar = dataset.css('span.a-size-base ::text').extract()

            skuvar = response.xpath('//meta[@name="keywords"]/@content')[0].extract()

            skuvar_split = skuvar.split(',', 1)[0]
            artistvar_split = artistvar[1]

            if any ("Sponsored" in s for s in artistvar):
                items['artist'] = "DELETE THIS"
                items['sku'] = "DELETE THIS"
                items['title'] = "DELETE THIS"
            elif any("by " in s for s in artistvar):
                items['artist'] = artistvar_split
                items['sku'] = skuvar_split
                items['title'] = titlevar
            else:
                items['artist'] = ""
                items['sku'] = skuvar_split
                items['title'] = titlevar

            itempage = response.urljoin(dataset.css('div.a-section > h2.a-size-mini > a ::attr(href)').extract_first())

            items['theurl'] = itempage

            request = scrapy.Request(itempage, callback=self.get_iteminfo)
            request.meta['items'] = items  # By calling .meta, we can pass our item object into the callback.
            yield request  # Return the item info back to the parser.

    def get_iteminfo(self, response):

        items = response.meta['items']  # Get the item we passed from scrape()

        imgvar = [response.css('img#landingImage ::attr(data-old-hires)').extract_first()]
        items['image_urls'] = imgvar

        yield items

and then the items.py

import scrapy

class Scrapy2Item(scrapy.Item):
    theurl = scrapy.Field()
    sku = scrapy.Field()
    title = scrapy.Field()
    artist = scrapy.Field()
    image_urls = scrapy.Field()

and then the pipelines.py:

import scrapy
from scrapy.pipelines.images import ImagesPipeline

import csv

class Scrapy2Pipeline(ImagesPipeline):
    def get_media_requests(self, item, info):
        return [scrapy.Request(x, meta={'image_name': item['sku']})
                for x in item.get('image_urls', [])]

    # write in current folder using the name we chose before
    def file_path(self, request, response=None, info=None):
        return '%s.jpg' % request.meta['image_name']


def write_to_csv(item):
   writer = csv.writer(open('C:/Users/Tyler/Desktop/scraper/scrapy2/spiders/csv/output.csv', 'a'), lineterminator='\n')
   writer.writerow([item[sku] for sku in item.keys()])

class WriteToCsv(object):

    def process_item(self, item, info):
        write_to_csv(item)
        return item

and lastly, the settings.py

BOT_NAME = 'scrapy2'

SPIDER_MODULES = ['scrapy2.spiders']
NEWSPIDER_MODULE = 'scrapy2.spiders'

# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'scrapy2 (+http://www.yourdomain.com)'
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:39.0) Gecko/20100101 Firefox/39.0'

# Obey robots.txt rules
ROBOTSTXT_OBEY = True

# Configure item pipelines
# See https://docs.scrapy.org/en/latest/topics/item-pipeline.html
ITEM_PIPELINES = {
   # 'scrapy.pipelines.images.ImagesPipeline' : 1,
   'scrapy2.pipelines.Scrapy2Pipeline': 100,
   'scrapy2.pipelines.WriteToCsv': 200,
}

IMAGES_STORE = 'C:/Users/Tyler/Desktop/scraper/scrapy2/spiders/images'



How to set yourself up to code a website from scratch

I need to make a website for my computer science class. I know enough about coding to make one. My question is more like an advice that I need as it is the first time that I will be making a full website from scratch. Basically, I wonder if there is anything I should do before coding such as a plan, as my goals for this website. To sum things up, what pre-code actions should I do to make my website coding easier?




which is better in the term of performance and best pratice?(react - redux)

I am creating an E-commerce website using react and redux, it shows all products in home page then show all products again in another page but with options of filtering and sorting.

I asked here a question two days ago asking about the best way to process data (filtering and sorting) here

The answers went for doing the data processing after fetching data and fetch data again when filtering and sorting query changes then again process data instead of fetching once and doing data processing in the reducers.

Now as i described my website above, i need to show all products in home page and adding the feature of filtering and sorting data in another page and my mind goes for creating two requests one in home page and second in the other page using fetch function using the same API link and i can add filtering and sorting functionality in an action different from one related to home page products.

Code:

const mapDispatchToProps = (dispatch) => {
  return {
    loadProducts: () => {
      fetch(productsAPI).then(res => res.json()).then(json =>
        dispatch(fetchProducts(json.products))).catch(err => 'error fetching data')
    }
  };
}


action.js: (all products in home page)

const fetchAllProducts = (allProducts) => {(
  type: FETCH_ALL_PRODUCTS,
  payload: allProducts
)} 


action.js: (products in the other page)

const fetchProducts = (allProducts, filter, sortBy) => {
    let products;


    if (filters && filters.length > 0) {
        products = filters.map(f => allProducts.filter(p => p.category === f)).reduce((acc, cur) => [...acc, ...cur], []);
    }

    if (sortBy) {
        if (sortBy === 'low to high price') {
           products.sort((a, b) => a.newPrice - b.newPrice);
        }

        if (sortBy === 'high to low price') {
            products.sort((a, b) => a.newPrice - b.newPrice)
        }
    }

    return {
        type: FETCH_PRODUCTS,
        payload: products
    }
}

Now what is the better way to do that in the term of performance and best practice, i think processing data in a reducer would be acceptable in that case or should i make two requests one for every page???




How to write .net web api controller to consume and expose another web api

I need to wrap an api call with my own api to avoid CORS and so I can avoid exposing credentials to the client. Can anyone help me to figure out what I'm doing wrong?

This works in a webform but I don't know how to put its an api controller class. When I try to return the objects with the code below it throws an error

Controller
public class sampleController : ApiController
{
    public IEnumerable<sample> GetSample() 
    {

        string url = String.Format("sampleurl.json");
        WebRequest requestObj = WebRequest.Create(url);
        requestObj.Credentials = new NetworkCredentials("USER", "PW");
        requestObj.Method = "GET";
        HttpWebResponse responseObj = null;
        responseObj = (HttpWebResponse)requestObj.GetResponse();
        string str = null;
        using (Stream stream = responseObj.GetResponseStream())
        {
            StreamReader sr = new StreamReader(stream);
            str = sr.ReadToEnd();
            sr.Close();
        }

        var ser = new System.Web.Script.Serialization.JavaScriptSerializer();
        sample sampleList = (sample).ser.Deserializer(str, typeof(sample));

        return sampleList.Root_Object;

    }    

}


Model
public class sample
{
    public List<Root_Object> Root_Object {get; set;}
}

public class Root_Object
{
    public string listItemOne { get; set; }
    public string listItemTwo { get; set; }
}

I expected to be able to return all objects from Root_Object. The return statement gives me an error of "Cannot implicitly convert type 'System.Collections.Generic.IList' to 'System.Collections.Generic.IEnumerable'. An explicit conversion exists(are you missing a cast?)"




How to transfer data to a template without using EJS?

app.get("/movies",function(req,res){Movies.find({},function(err,foundMovie){
if(err){
    console.log(err);
}
else{
    res.render("movies/index",{movie_index:foundMovie});
}});});

I have this code that finds a movie and send that foundMovie to an EJS file. The route is created following RESTful routes. I can display anything about that foundMovie in my EJS file as I please. The EJS file then takes the foundMovie and manipulates it. Then the EJS file will be rendered by the app.js on the mentioned route.

My questions are following:

1- Since I dont wanna use EJS, how will transfer the data/foundMovie from the app.js to an HTML file.

2 - How will I use the data/foundMovie inside HTML file without using the EJS syntax (<%= movie_index.name%>)

Note: KIndly state your answer for NodeJS environment only.




Web Application Project not accessible due to form tag on every page

I have a legacy Web Application Project (WAP) that I need to ensure is accessible. This type of project has a Master Page (Site.Master) and each page (called a Web Form) inherits from that page to maintain a consistent look.

A fresh Master Page looks like below:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="First5Edmx.Site" %>

<!DOCTYPE html>

<html>
<head runat="server">
    <title></title>
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>

You will see that the body contains a form tag, which means that every page using Site.Master as it's template will have a form on it, regardless of if it's actually a form. If you remove the form tag the project will not compile.

When I run web accessibility on my site I am getting the error "The page contains a form but there is no submit button" on every page. It is, of course, correct, but how do I make this code accessible (without re-creating the whole project in more modern technology)?




Python - Scrape MP3 From Site

i want to download some audio from youtube, but i want to use a website service to convert the videos to mp3's but i can't figure out how to get to the download part, anyone with beautifulsoup experience could guide me?

here is my code so far:

from datetime import datetime
import re
import urllib
import os
from bs4 import BeautifulSoup
import sys
import requests




def songs():


        song = 'taylor swift love story'

        try:
            query_string = urllib.parse.urlencode({"search_query" : song})
            content = urllib.request.urlopen("http://www.youtube.com/results?" + query_string)


            search_results = re.findall(r'href=\"\/watch\?v=(.{11})', content.read().decode())



        except:
            print('Something happened!!')
            exit(1)

        downOnly = 'https://savemp3.cc/download?video=' + 'http://www.youtube.com/watch?v=' + search_results[0]


        r = requests.get(downOnly)


songs()




Inline Block divs changing height on Active State

I want to have 4 boxes on my screen with some active effect like changing font size and some padding-top (to move the text down a little). everything is working well except that when I click on the boxes, it adds white space around that or the neighbouring boxes.

I have tried adding a span inside the div with inline-block 100% height/width and applying the :active class to that span instead, then it would work fine for the top two boxes but the bottom two boxes would still do the same thing.

https://jsfiddle.net/946v3o1t/4/

<div id="container"><div class="div one">div1</div><!-- 
--><div class="div two">div2</div><!-- 
--><div class="div three">div3</div><!-- 
--><div class="div four">div4</div></div>


@import url('https://fonts.googleapis.com/css?family=Acme|Righteous&display=swap');

body, html{
    padding: 0;
    margin: 0;
    user-select: none;
    font-family: 'Acme', sans-serif;
        }
#container{
    height: 100vh;
    width: 100vw;
    max-width: 100%;
    overflow: none;
    }
.div{
    height: 50vh;
    width: 50vw;
    max-width: 50%;
    display: inline-block;
    text-align: center;
    line-height: 50vh;
    color: white;
    font-size: 4rem;
    overflow: none;
}
.div:hover{
    cursor: pointer;
}
.div:active{
    font-size: 3.8rem;
    padding-top: 5px;
}
.one{
    background-color: #005b9f;
}
.two{
    background-color: #004c40;
}
.three{
    background-color: #6c6f00;
}
.four{
    background-color: #a00037;
}

What do I need to change so that when I click on the boxes, it only update the content as styled and not change the height/width or style for the neighbouring divs.




Is fopen() safe to use on a server for reCaptcha [on hold]

So, hear me out I've been told a few times N O T to use the fopen() function in PHP, because it is not safe. It was even disabled on the server where I had to use, and our provider simply said "It is not safe". Now we have our own server and full control over everything. Now, I need to use the fopen() function for Google's reCaptcha. My question is.... is it a good idea to use fopen() like that? Will I be (more) vulnerable to attacks? Also, I did found some similar answers to this same question, but they are over 7 years old. The PHP version is 7.3 where it would be running.

To avoid this, I just implemented a simple math question, but reCaptcha would really, really be nice.

$recapchaResponse=$_POST['g-recaptcha-response'];
$secretKey = 'superDuperSecret';
$request = fopen("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&response=".$recapchaResponse);
$response = json_decode($request);

etc...




What is the concept of making a pdf reader website?

Actually I wanted to build a pdf reader website. But I don't know much about it. How can be it made? Do i have to use mysql to store my data for this? Or I have to code individually a page for each of my books? Please help me. I have no idea. For that I didn't attached any code. Thank you.




How do this website do it? (Wikiwand.com loads Wikiepdia and apply Style to it)

I need to load Wikipedia from my site and apply some "readability" Style to it.

For example:

This is a Wikipedia regular page: https://en.wikipedia.org/wiki/Glass

Then, if one changes the domain to wikiwand's: https://www.wikiwand.com/en/Glass

It opens the same page more a lot more readable and beautiful.

Screenshots:

Glass article on Wikipedia https://prnt.sc/oy9ati

Glass article viewed through Wikiwand website. https://prnt.sc/oy9chd




nested for loop in html table with thymeleaf

I am trying to create a table that is created from Lists of different sizes. I have a list of Cars List<Car>. So in the header i want to place the names of the different companies which i did.

then i have a List<List<CarSales>> and not all Cars exist in each carSales. So i want to iterate through the List of List of each tr (also ok) and then i want to iterate in the td though the List and place the CarSales.sales in the correct td where CarSales.mark=Car.makr of the header.

So if List<Cars> is (i mean Cars.mark)

[BMW, MERCEDES,FIAT]

and List<List<CarSales>> is (i mean object that have mark and sales inside)

[[BMW:5,FIAT:10],[MERCEDES:12]]

I want a table with:

BMW - MERCEDES - FIAT

5 - 0 - 10

0 - 12 - 0




Unable to track custom events by platform (iOS app, iOS web, desktop, android web) in Branch.io, how can this be fixed?

When comparing by platform (iOS app, iOS web, desktop, android app, android web) in Branch.io in order to know where the results are coming from across the different ad platforms (Facebook, Google Ads, etc.), the total impressions by ad platform get attributed to a “-“ platform whereas the custom events (we currently track sign up and orders that are sent to Branch.io from Amplitude) are attributed to “OTHER” and it's only clicks, web sessions start, installs and opens (from my selected metrics) are attributed to the different platforms. Any suggestions on how this can be fixed?

My expectations is that I will be seeing Google Ads, Facebook Ads, Organic, etc. impressions, clicks, installs, sign ups, orders, cost... for every platform: - iOS app - iOS web - Desktop web - Android web - Android app




InvalidOperationException: The entity type 'Array' requires a primary key to be defined

I am making a Web API with .Net and it is receiving a custom JSON object from a web form to serialize to the model. I am currently having an issue displaying the API response. I am storing the data in an in memory database at first just to get it working.

I am not sure why it is asking me for a primary key despite there being a key defined on my model.

My next step is to add multipart-form data but that is its own can of worms.
The error happens on the _context.ProjectItems.ToListAsync(); line.
I have already added an ID to the model.  


    [Required]
    [Key]
    public new long Id { get; set; }

    [HttpGet("{id}")]
    public async Task<ActionResult<ProjectItem>> GetProjectItem(long id)
    {
        var projectItem = await _context.ProjectItems.FindAsync(id);

    if (projectItem == null)
    {
        return NotFound();
    }

return projectItem;

   }
  [HttpGet]
    public async Task<ActionResult<IEnumerable<ProjectItem>>> 
GetProjectItems()
    {
        return await _context.ProjectItems.ToListAsync();
    }

My model: ProjectItem.cs using System.ComponentModel.DataAnnotations;

    namespace RupAPI.Controllers
    {
        public class ProjectItem : Project
        {
            [Required]
            [Key]
            public new long Id { get; set; }

            public string ProjName { get; set; }
            public DateTime DateSub { get; set; }
            public DateTime DueDate { get; set; }
            public DateTime ArrivalDate { get; set; }
            public string Desc { get; set; }
            public Array Sku { get; set; }
            public Array SkuDesc { get; set; }
            public Array Item { get; set; }
            public Array ItemDesc { get; set; }
            public Array FileName { get; set; }
            public new byte[] File { get; set; }
        }
    }

An unhandled exception occurred while processing the request. InvalidOperationException: The entity type 'Array' requires a primary key to be defined.
    Microsoft.EntityFrameworkCore.Infrastructure.ModelValidator.ValidateNonNullPrimaryKeys(IModel model)
    Stack Query Cookies Headers 
    InvalidOperationException: The entity type 'Array' requires a primary key to be defined.
    +
                return await _context.ProjectItems.ToListAsync();
    lambda_method(Closure , object )




How to save modification to another's website

Question : Is there a way to make modifications to a website (using the "Inspect" fromm Chrome) permanent for my session only

Context: My company recently unveiled a new website we will have to work with on a daily basis. The problem is how bloody hideous it is. I mean it's like they took the Windows Blue Screen of Death as a reference and decided to build on that. And they're not willing to modify it cause of the usual corporate BS "Hooooo the budget, think of the budget !!!"

I use Chrome and can modify the colors, font, ect using "Inspect". However, as soon as I reload the page everything goes back to the original.

I've looked around the net a bit but can't find anything concrete. There's gotta be an App for that !

Thanks to all !




Computed value changed, template is not rerendered unless page refreshed

I have a button which is shown whenever some computed value is not located in local storage. Unfortunately the button is not being shown or hidden when the value is deleted or set in local storage unless I refresh the page.

<template>
<v-card>
    <v-text-field v-model="token" v-if="!savedLogin"></v-text-field>
    <v-btn v-if="!savedLogin" @click="loadClientsPage">Login</v-btn> <template v-show="savedLogin"><v-btn >Continue</v-btn></template> <v-btn v-if="savedLogin" @click="clearToken">clear login</v-btn>
</v-card>

<script>
export default {
    name: "Login",
    data(){
        return {
            token:'',
        }
    },
    computed:{
        savedLogin:{
            get(){
            return localStorage.getItem('token') !== null
            },
            set(tokenValue){
                if(tokenValue ==='')
                    return localStorage.removeItem('token');

            return localStorage.setItem('token', tokenValue);
            }
            }
    },
    methods:{
        loadClientsPage(){
            this.savedLogin = this.token;
            this.$forceUpdate();
        },
        clearToken(){
            this.savedLogin = '';
        }
    }
}




When ASP.NET MVC is not recommended?

In an interview, a person asked: " When it's not recommended to use MVC ?" I need an obvious answer to this question, please.




I need some advice to improve the search engine and menu of my website [on hold]

I am stuck when it comes to improving the menu and the search engine of this website, could you give me some advice




How to share whatsapp on whatsapp web on desktop and whatsapp app on phone

I'm trying to implement a button that shares the current page on whatsapp, theres no issue with using the link on phone but on desktop i can't send it to whatsapp web or open whatsapp web if it's not opened yet.

i was searching for long on SO and other webpages as well on documentation, which i cant find (i only face android documentation but not web documentation for it).

i refered to https://api.whatsapp.com nut no info can be found here.

My approach is this line as i said someone posting here: How to implements whatsapp share button in website

<a href="https://api.whatsapp.com/send?text=urlencodedtext" target="_blank">Share to whatsapp</a>

i bet that this function was moved to whatsapp for business, are it?

Any help will be apreciated.

Regards




How to get the data(temperature) for bulk of cities from the public web service and save to salesforce by using batch apex?

Met in a problem of how to get the records of temperature from the public portal. i didnt get the data updated in salesforce org.

global class WeatherBatch implements Database.Batchable<sObject>,Database.AllowsCallouts,Database.Stateful{
    public static void futureMethod(){
        HttpRequest request = new HttpRequest();
        Http http = new Http();
        request.setEndpoint('https://api.weatherbit.io/v2.0/current?city=Mumbai&key=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
        request.setMethod('GET');
        HttpResponse response= http.send(request);
        if(response.getStatusCode() == 200){
          Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
            List<Object> data = (List<Object>) results.get('data');
            System.debug(data.size());
            System.debug('Received the following data:');
            for (integer i=0; i<data.size(); i++)
              System.debug(data);
            }
        }




Deploy a netbeans web application on an external server

How to deploy a NetBeans web application on an external tomcat server ? I'm using NetBeans as an IDE and I'm trying to deploy the web application on an external server.




I can't run this query, but when i simulate it in phpmyadmin, it returns the rows

I'm going to delete some rows in one of my table called 'sy_user'. I want to delete some of the rows that is not matched in the other table, which is the 'tb_master_pegawai'. How do i solve this query to do the row delete using the subquery as the WHERE condition?

I used subquery as the WHERE condition in the DELETE query. When i run it in phpmyadmin it says "You can't specify target table 'sy_user' for update in FROM clause" but when i simulate it, it has return rows.

DELETE FROM sy_user 
       WHERE user_id NOT IN 
                (SELECT tbpeg.ID 
                 FROM tb_master_pegawai AS tbpeg 
                 JOIN sy_user AS tbuser ON tbpeg.ID=tbuser.user_id)

i expect the result is i have deleted the rows that are not matched with the same data in the other table.




lundi 26 août 2019

Which hosting Plans/Third Party service to set up like Netflix application(small scale up to 500 gb storage) in india

we are building application like netflix on android platform. Application storage will be 700GB. Can we go for cloud hosting/ media hosting




Is nested ng-apps allowed in angularjs?

I work on a website builder editor, and the whole Html tag must have an AngularJS app and a controller, and I wanna know if I can use nested AngularJS apps in my project and if it will cause a problem or not.




Footer keeps appearing in the middle of the page

I am creating a web page with html and css, however when I created the footer CSS it sits in the middle of the page. I've tried w3 schools but I couldn't find anything on it.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="description" content="The Dusty Garage">
    <title> The Dusty Garage </title>

CSS STARTS HERE html, body { margin: 0;

            font-family: Arial, Helvetica, sans-serif, Verdana, Geneva, Tahoma, sans-serif;
        }

        #wrapper {
            margin: auto;
            width: 100%;
            max-width: 100%;

        }

        #navigationbar {
            clear: both;
            height: 50px;
            max-width: 100%;
            background-color: cornflowerblue;
        }

        #companyname {
            margin: 0;
            float: left;
            padding: 5px;
            font-size: 12px;
            text-decoration: none;
        }

        #companyname a {
            color: black;
            text-decoration: none;

        }

        nav {
            float: right;
        }

        nav ul {
            list-style: none;
            margin: 0;
            padding-left: 0;
        }

        nav ul li {
            color: #fff;
            display: block;
            float: left;
            padding: 1rem;
            border-right: 1px solid #bbb;
            position: relative;
            text-decoration: none;
            transition-duration: 0.5s;
        }

        nav ul li a {
            display: block;
            text-decoration: none;
            color: white;
        }

        nav ul li:hover,
        nav ul li:focus-within {
            background-color: royalblue;
            cursor: pointer;
        }

        nav ul li:focus-within a {
            outline: none;
        }

        nav ul li ul {
            background-color: cornflowerblue;
            visibility: hidden;
            opacity: 0;
            position: absolute;
            transition: all 0.5s ease;
            margin-top: 1rem;
            left: 0;
            white-space: nowrap;
        }

        nav ul li:hover>ul,
        nav ul li:focus-within>ul,
        nav ul li ul:hover,
        nav ul li ul:focus {
            visibility: visible;
            opacity: 1;
            display: block;
        }

        nav ul li ul li {
            background-color: cornflowerblue;
            width: 100%;
            display: inline-block;

        }

        nav li:last-child {
            border-right: none;
        }

        nav .active {
            background-color: black;
        }

        /* Navigation CSS End */

        /* Banner Image CSS Start */
        .hero {
            height: 70vh;
            display: block;
            justify-content: center;
            align-items: center;
            text-align: center;
            color: white;

            background-image: url(https://memberpress.com/wp-content/uploads/2015/06/Google-tools@2x-1.png);
            background-size: cover;
            background-position: center center;
            background-repeat: no-repeat;
            background-attachment: fixed;
        }

        .hero>* {
            color: black;
        }

        .hero>h2 {
            font-size: 3rm;
            padding-bottom: 20rem;
            text-align: center;
            vertical-align: middle;

        }

        /* HERO IMAGE BANNER END */

        /* START SECTION CSS FOR BROWSE AND SELL */

        .browsesellarea {
            display: flex;
            flex-wrap: wrap;
        }

        /* Heading Style */

        .browsesellarea-heading {
            position: absolute;
            margin-top: 0;
        }

        .browsesellarea-area {
            flex: 1 0 500px;
            box-sizing: border-box;
            border: 1px solid #ccc;
            box-shadow: 2px 2px 6px 0px rgba(0, 0, 0, 0.3);
            margin: 3rem .5rem .5rem .5rem;
            padding: .1rem .1rem .1rem .1rem
        }

        .browsesellarea-area img {
            display: block;
            border: black;
            width: auto;
            height: 290px;
            padding: .1rem .1rem .1rem .1rem
        }

        /* END BROWSE-SELL CSS  */

        /* START FOOTER CSS */
        .footer {
            display: flex;
            align-items: center;
            justify-content: center;
            background-color: cornflowerblue;
            color: white;
            margin: auto;

        }
    </style>
</head>

<body>
    <div id="wrapper">
        <!---Contains Navigation and Logo-->
        <header>
            <div id="navigationbar">
                <div id=companyname>
                    <a href="#">
                        <h1>The Dusty Garage</h1>
                    </a>
                </div>
                <nav>
                    <ul>
                        <li>
                            <a href="#">Home</a>
                        </li>
                        <li>
                            <a href="#BrowseTools">Browse Tools</a>
                            <ul>
                                <li>
                                    <a href="#BrowseTools">Browse Tools</a>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </nav>
            </div>
        </header>
        <section class="hero">
            <h2>Find the Perfect Tool</h2>

        </section>

        <main>
            <!---Contains Main Content-->
            <div class="goal-heading">
                <h1>Our Aim</h1>
            </div>
            <p> The Aim of this project is to develop a peer to peer marketplace for used and new tools. Many people own
                tools
                they don’t use anymore, so instead of gathering dust in the garage, this marketplace aims to give old
                tools
                a
                new lease on life. From garden to industrial tools, users can list tools they own for sale and make bids
                on
                other user’s listed tools. Users can see a list of bidders and contact the user who has made the most
                appealing
                bid, for transaction outside the website. Once a sale has been made, all the seller needs to do is mark
                the
                item
                as sold .</p>
            <section class="browsesellarea">
                <section class="browsesellarea-heading">
                    <h2>Looking for Tools?</h2>

                    <div class="browsesellarea-area">
                        <img src="Images/2925.jpg" alt="Browse Tools to Buy" />
                    </div>
                    <button>Browse Categories</button>




                    <h2> Got a shed full of dusty tools?</h2>
                    <div class="browsesellarea-area">
                        <img src="Images/10975.jpg" alt="Browse Tools to Buy" />
                    </div>
                    <button>Sell Your Tools Here</button>

                </section>
            </section>
        </main>
    </div>
    <!-- FOOTER -->

    <footer class="footer">
        <div>
            <p>Copyright &copy; 2019</p>
        </div>

    </footer>

</body>

</html>

Footer should sit on the bottom of the page. However, it sits in the middle. I'd like it to sit on the bottom of the page as a footer should do. Would anyone know how to fix this issue?