I'm getting a List of Object with URL,some Data and a User Id .I want to write a function to call the different web services asynchronously and return a list of response and User Id in list. But if the URL is same then the call should be Synchronous to that particular service with different data provided in input.
jeudi 2 mai 2019
How to execute multiple SQL Oracle queries at once in php?
I am creating a web (html css php) that takes ORDER_ID as an input. Then it looks into several ORACLE databases and show everything on a page. I have optimised queries to maximum but still i am above 2 seconds per query.
The queries are not dependant on each other. Is there a way to simultaneously access 3 or more databases and execute queries in php ?
Or is there another way to approach this? Thanks.
How to fix 'trim() expects parameter 1 to be string, array given' In Router.php line 560:?
After 'php artisan make:controller Admin/DashboardController', I included code below (Controllers/Admin/DashboardController).
DashboardController.php
namespace App\Http\Controllers\Admin;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
class DashboardController extends Controller
{
//Dashboard
public function dashboard(){
return view('admin.dashboard');
}
}
In web.php:
Route::get(['prefix'=>'admin', 'namespace'=>'Admin', 'middleware'=>
['auth']], function(){
Route::get('/', 'DashboardController@dashboard')->name(admin.index);
});
In views/admin/dashboard.blade.php
@extends('layouts.app)
@section('content')
<h1>Admin test</h1>
@endsection
mercredi 1 mai 2019
I have a login php file giving me this error "mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean"
I have a login page for a website that is connected to a MySQL database but I'm getting an error when I try to log in to the website. I am also using xampp. The error says "Warning: mysqli_stmt_close() expects parameter 1 to be mysqli_stmt, boolean given in C:\xamppp\htdocs\mitch\login.php on line 86".
This feature is supposed to let you log in based on the username and password in the database it's connected to. I've tried moving the "mysqli_stmt_close($stmt);" statement into different places, commenting it out, and playing around with the syntax.
if(empty($username_err) && empty($password_err)){
// Prepare a select statement
$sql = "SELECT id, username, [password] FROM users WHERE username = ?";
if($stmt = mysqli_prepare($link, $sql)){
// Bind variables to the prepared statement as parameters
mysqli_stmt_bind_param($stmt, "s", $param_username);
// Set parameters
$param_username = $username;
// Attempt to execute the prepared statement
if(mysqli_stmt_execute($stmt)){
// Store result
mysqli_stmt_store_result($stmt);
// Check if username exists, if yes then verify password
if(mysqli_stmt_num_rows($stmt) == 1){
// Bind result variables
mysqli_stmt_bind_result($stmt, $id, $username, $hashed_password);
if(mysqli_stmt_fetch($stmt)){
if(password_verify($password, $hashed_password)){
// Password is correct, so start a new session
session_start();
// Store data in session variables
$_SESSION["loggedin"] = true;
$_SESSION["id"] = $id;
$_SESSION["username"] = $username;
// Redirect user to welcome page
header("location: welcome.php");
} else{
// Display an error message if password is not valid
$password_err = "The password you entered was not valid.";
}
}
} else{
// Display an error message if username doesn't exist
$username_err = "No account found with that username.";
}
} else{
echo "Sorry, Please try again.";
}
}
*this is the line that is giving me the error *\
mysqli_stmt_close($stmt);
}
mysqli_close($link);
I'm hoping for the login function to work and bring the user to the welcome page
how can ı fix my code acording to duty text [on hold]
hello I've been learning python for only three months and I have a project homework but ı did'n complete code ı need help ı write to diffrent code then ı will combine them but ı agains some error this point ı wanna suggest
MY DUTY TEXT
Python Projects
Newspaper webpage crawling: It should crawl the websites specified. It should show the option of storing raw html or only the news text. Second option should include news topic and the text. Output files should be html for raw html files, txt for news text. Name of the files can be arbitrary numbers. For each website a folder should be created. Inputs: Websites Crawling depth Storing option (raw html or news next) Root folder Output: Folders with website name Files containing website data
MY first code
-
import requests from bs4 import BeautifulSoup
url = 'https://www.dailystar.co.uk/' r = requests.get(url) source = BeautifulSoup(r.content,"lxml") title_link =source.find_all("h3",attrs={"class":"title"})
file_text = open("news_title.text","w") file_text.write("-") for link in title_link: print(link.text) file_text.write(str(link.text)) file_text.write("\n-") file_text.close()
print("*******************************") file_html = open("html_adress.html","w") for html in source: file_html.write(str(html)) file_html.close()
print("*******************************")
my second code import requests from bs4 import BeautifulSoup
Read News Application
# headers = requests.utils.default_headers() headers.update({ 'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0', })
print("Lütfen bekleyin... Haberler çekiliyor...\n") url= 'https://www.dailystar.co.uk/' istek=requests.get(url,headers) icerik=istek.content soup = BeautifulSoup(icerik, "html.parser")
print(" LİNKlER VE HABERLER ŞU ŞEKİLDE:\n ------------------------")haberler=soup.find_all("h3",{"class": "title"}) linkler=soup.find_all("a",{"class": "story"})
sayi=1 for i in haberler:
print(sayi, "-)", i.text) sayi+=1 sayi =1for i in linkler:
print(sayi, "-)", i.get("href")) sayi+=1 istek2 = requests.get(i.get("href"), headers) istek_soup = BeautifulSoup(istek2.content, "lxml") print(istek2.status_code, "İstek durumu") metin = istek_soup.find_all("div", {"class": "news-content"}) for j in metin: print(j.text)**strong text**
Need help choosing the right front-end build/bundler for DOM based static assets
Thank you for taking the time to read my post. I am in need of some advice on which tools would be a good fit to build a set of simple HTML, JS and CSS assets for CDN deployment. I have used webpack in the past to do similar packaging, however, webpack 4 seems to be even more difficult to use than previous versions. Particularly, this new version of webpack wants to make everything I minify JavaScript, instead of just keeping it as css. Parcel seemed promising until I realized that it requires an HTML entry point, leaving me lost in terms of trying to get it to generate the HTML files via something like posthtml-extend. I need some help from someone with more front-end experience than I have to choose the simplest and least painful approach.
Basic Requirements
- Create static HTML files from a hierarchical set of templates. These templates are simple HTML pages and components that just need basic induce and property support prior to rendering.
- Minify CSS/JS/HTML files.
- Add cache busting hash to CSS/JS/HTML paths in the generated HTML files.
HTML Input Example
In this example, I would like to start with base.html and create a handful of files with different "content" substituted in from a file or property for each block. I would like to have the generated files minified and have <link href=, <script src= and <a href= tags fixed for cache busting. I would also like control of where these files will be output and the name of the file being output.
assets/html/base.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>App - <block name="title"></block></title>
<!-- Minify and add cache busting -->
<link href="/css/app.css" rel="stylesheet" type="text/css">
<!-- Minify and add cache busting -->
<script src="/js/app.js"></script>
</head>
<body>
<!-- Add content block for another file -->
<block name="content"></block>
</body>
</html>
assets/html/pages/page1.html
<h1>hello world!</h1>
<a href="/sub/page2.html">next</a>
Obtain URLs from search using rvest in R
I am trying to obtain URLs for searches into Western Union website from Nigerian provinces. In particular, I want to search the following webpage https://locations.westernunion.com/search/nigeria/ for a vector of provinces, and for each search to keep the corresponding URL to then webscrape each of the obtained links. I know how to do the second step but not the first one. In particular, my code is
#install.packages("selectr")
#install.packages("xml2")
library(selectr)
library(xml2)
library(rvest)
library(xlsx)
provinces = as.vector(read.xlsx("provinces.xls", 1)[,1])
URL <- "https://locations.westernunion.com/search/nigeria/"
webpage <- read_html(URL)
But now I don't know how to proceed to search and store the URL for each of my provinces from the vector mentioned previously.
Any tip? Thank you a lot guys.
PS: First time posting here.