jeudi 30 avril 2020

Making a site bilingual [closed]

Apologies in advance if this is a simple question -- I'm very new to web development.

I'm trying to make a site multi-lingual (EN & FR).

I understand how to get the buttons to switch from an English site to a French site and vice versa.

HTML:

<body>
        <a href="#eng" data-reload>English</a>
        <a href="#fr" data-reload>Français</a>

        
        <script>
        //define language reload anchors
                var dataReload = document.querySelectorAll("{data-reload]");


        //Language Translations
                var language = {
                        eng:{
                                Hello: "Hi!"
                        },
                        
                        fr:{
                                Hello: "Bonjour!"
                        }
                };
                //Define language via window hash
                if (window.location.hash){
                        if (window.location.hash === "#fr") {
                                hi.textContent = language.fr.hello;
                        }
                }
        
        //Define language reload onclick illiteration
        for(i=0;i<=dataReload.length;i++){
                dataReload[i].onclick=function(){
                        location.reload(true);
                        };
                }
        </script>

The entire site is in English. But I'm not sure how to actually translate the French page... there's very little words so I don't mind translating it myself. Is there any way to do this?

(I've heard great things about i18n, but don't fully understand how to use it yet.)

Thank you!




Creating ApplicationContext more than one time (In struts + Spring project)

I have a legacy system , which is in struts 1 and spring 3, now I need to upgrade the version of spring 3 to 5. I have done almost all the things and everything is working fine. there is only an issue which I face when i start tomcat server.

Let see with code:- This is the web.xml configuration earlier,

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <servlet>
        <servlet-name>context</servlet-name>
        <servlet-class>
            org.springframework.web.context.ContextLoaderServlet
        </servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet> 

After upgrading the version:-

<context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

  <servlet>
        <servlet-name>servlet</servlet-name>
        <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>       
        <init-param>
            <param-name>debug</param-name>
            <param-value>2</param-value>
        </init-param>       
        <init-param>
            <param-name>detail</param-name>
            <param-value>2</param-value>
        </init-param>
        <load-on-startup>2</load-on-startup>
    </servlet>  

    <servlet-mapping>
        <servlet-name>servlet</servlet-name>
        <url-pattern>*.do</url-pattern>
   </servlet-mapping>

Now, when I start my tomcat server, then applicationContext environment gets created two time. one for "org.apache.struts.action.ActionServlet" and second for this "org.springframework.web.context.ContextLoaderListener"

check log:

INFO: TLD skipped. URI: http://struts.apache.org/tags-nested is already defined
May 01, 2020 11:14:09 AM org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 01, 2020 11:14:09 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
May 01, 2020 11:14:09 AM org.apache.catalina.core.ApplicationContext log

// First time
INFO: Initializing Spring root WebApplicationContext  


log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
Calling the CacheManager Constructor...
May 01, 2020 11:14:17 AM org.apache.catalina.core.ApplicationContext log
// Second time
INFO: Initializing WebApplicationContext for Struts ActionServlet 'servlet', module ''  

May 01, 2020 11:14:19 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-9090"]
May 01, 2020 11:14:19 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-9009"]
May 01, 2020 11:14:19 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 18889 ms

Suggest me how to fix this.




How two websites communicate?

likesplanet.com enables people to like other's social media like Facebook, Youtube. I am curious how this works, cause youtube would not tell likesplanet.com if this user likes this video or not. I also analyzed the web requests and can not find useful info.




Trying to write an excel using a python code

I am making a program that writes the job information of indeed & Stack overflow to Excel, I am getting this error.

Traceback (most recent call last):
File "main.py", line 7, in <module>
jobs = indeed_jobs + so_jobs
TypeError: can only concatenate list (not "dict") to list

stackoverflow file is working. but indeed file is not working.

Can anyone please help me? Thank you.




Selenium don't read text

I have just started studing selenium. I have this small code into I try to read the price of something in amazon.

    driver = webdriver.Chrome()
    link = "https://www.amazon.it/AMD-Ryzen-5-3600-Processori/dp/B07STGGQ18/ref=sr_1_2? 
    __mk_it_IT=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=amd+ryzen+5&qid=1588259430&sr=8-2"
    driver.get(link)
    price = driver.find_elements_by_id("priceblock_ourprice")
    print(price.text)               
    driver.quit()

But the program say:

    AttributeError: 'list' object has no attribute 'text'

Now i noe that price is a list, but now, how can i take the price from amazon? Thank you




The function (fileupLoad) is working fine with postman app, but not working from frontend as per requirement

Have a Query guys, please help me executing it!! I am not getting the desire result, The upload file function is not working as per requirement.The error block is executing instead of the actual function block.

main.component.ts:

  uploadFile() {
    console.log('Inside  uploadFile');
    const files: FileList = this.fileInput.nativeElement.files;
    console.log('Inside  uploadFile line 02');
    if (files.length === 0) {
      console.log('Inside  uploadFile 03');
      console.log('no file content here');
      console.log('Inside  uploadFile 04');
      return;
    };
    console.log('Inside  uploadFile 05');

    this.restservice.parseTable(files).subscribe((data: any) => {
      console.log('Inside  uploadFile 06');
      console.log('Data that i am sending: ' + data);
    },  (error) => {
      console.log('Inside  uploadFile 07');
      console.log('No Data Found' + error);
    });
}

Service.ts:

parseTable(files) {
    console.log('Inside parsetable function 01');
    const httpOptions = {
      headers: new HttpHeaders({
          'Content-Type': 'multipart/form-data',
      })
    };
    console.log('Inside parsetable function 02');
    const formData: FormData = new FormData();
    formData.append('file', files[0], files[0].name);
    console.log('Inside parsetable function 03');
    return this.http.post(this.backendAddress, formData, httpOptions);
  }

App.py:

@app.route('/uploader', methods = ['POST','GET'])
#@cross_origin(["http://localhost:4200"])
@cross_origin(allow_headers=['http://localhost:4200'])
def upload_file():
    print(request.files)
    # check if the post request has the file part
    if 'file' not in request.files:
        print('no file in request')
        return"no file in request"
    file = request.files['file']
    if file.filename == '':
        print('no selected file')
        return"no selected file"
    if file and allowed_file(file.filename):
        print("hello")
        filename = secure_filename(file.filename)
        #file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
        return "Successful"
    print("end")
    return"Bye"

OUTPUT:

Inside handleFileInput
Inside uploadFile
Inside uploadFile line 02
Inside uploadFile 05
Inside parsetable function 01
Inside parsetable function 02
Inside parsetable function 03
Inside uploadFile 07
No Data Found[object Object]



Angular component comuniaction

I need help about angular component comunication.

I have Parent component and children.

In parent component i have list. I would like to click of item list and move data {name, text} to children component and set it to children component where is froala editor.




Cann't create file in MODEL folder. Error The system cannot find the path specified

I have an ASP.NET MVC project on Git, I owner this project. I can create and add DB in to Model folder. However, my team can't create anything in the Model folder and gets an error:

Error The system cannot find the path specified

img: https://i.stack.imgur.com/Dac0r.png

This is my project: https://github.com/Ki2Nam3/ui_FastFood?fbclid=IwAR0W-BLY1BLiyZCkdqEFFGGFghMG4-CE28V-46-Ag3sPK3RhHKr5pE9tiCs

Thanks for reading !




click submit button on div popup by selenium python

this is my code

driver.find_element_by_xpath('//*[@id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_ok2"]').click()

and this is the code of target

<div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form" class="Form" tabindex="-1" status="focused" style="left: 0px; top: 0px; width: 424px; height: 342px;"><div class="nexacontainer" id="nexacontainer" style="width: 424px; height: 342px;"><div class="nexainnercontainer" id="nexacontainer" style="width: 424px; height: 342px;"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.sta_title" class="Static sta_WF_PopupTitle" tabindex="-1" style="left:0px;top:0px;width:424px;height:50px;" aria-label="확인 " aria-description="팝업창" status="enabled"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.sta_title:text" class="nexacontentsbox" style="left:30px;top:0px;width:394px;height:50px;">확인</div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg" class="Div" tabindex="-1" style="left:18px;top:146px;width:392px;height:108px;" role="document" aria-label=" " aria-description="" aria-labelledby="accessibility_notify_0" status="focused"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form" class="Form" tabindex="-1" userstatus="contents" status="focused" style="left: 0px; top: 0px; width: 392px; height: 108px;"><div class="nexacontainer" id="nexacontainer" style="width: 392px; height: 108px;"><div class="nexainnercontainer" id="nexacontainer" style="width: 392px; height: 108px;"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.sta_msg" class="Static sta_WF_AlertMessage" tabindex="-1" style="left: 8px; top: 0px; width: 360px; height: 108px;" aria-label=" " aria-description="" status="enabled"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.sta_msg:text" style="left: 0px; top: 0px; width: 360px; height: 108px; white-space: pre-wrap; overflow-wrap: break-word; word-break: break-all; text-align: center; vertical-align: middle;">기준일자를 기준으로 예약현황이 새로고침 됩니다.</div></div></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.hscrollbar" class="HScrollBarControl hscrollbarForm" tabindex="-1" status="disabled" style="left: 0px; top: 108px; width: 392px; height: 0px; border: 0px none;"><div class="nexasimplecontainer" id="nexacontainer" style="left: 0px; top: 1px;"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.hscrollbar.decbutton" class="ButtonControl decbutton" tabindex="-1" status="disabled" style="left: 0px; top: 0px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.hscrollbar.decbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.hscrollbar.incbutton" class="ButtonControl incbutton" tabindex="-1" status="disabled" style="left: 96px; top: 0px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.hscrollbar.incbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.vscrollbar" class="VScrollBarControl vscrollbarForm" tabindex="-1" status="disabled" style="left: 392px; top: 0px; width: 0px; height: 108px; border: 0px none;"><div class="nexasimplecontainer" id="nexacontainer" style="left: 1px; top: 0px;"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.vscrollbar.decbutton" class="ButtonControl decbutton" tabindex="-1" status="disabled" style="left: 0px; top: 0px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.vscrollbar.decbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.vscrollbar.incbutton" class="ButtonControl incbutton" tabindex="-1" status="disabled" style="left: 0px; top: 380px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.div_msg.form.vscrollbar.incbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div></div></div></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_ok2" class="Button btn_WF_CRUD02" tabindex="-1" style="left: 162px; top: 280px; width: 100px; height: 40px;" role="button" aria-label="확인 " aria-description="" status="enabled"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_ok2:icontext" class="nexacontentsbox" style="left:0px;top:2px;width:100px;height:38px;">확인</div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_ok" class="Button btn_WF_CRUD02" tabindex="-1" style="visibility: hidden; left: 109px; top: 280px; width: 100px; height: 40px;" role="button" aria-label="예 " aria-description=""><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_ok:icontext" class="nexacontentsbox" style="left:0px;top:2px;width:100px;height:38px;">예</div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_cancel" class="Button btn_WF_CRUD01" tabindex="-1" style="visibility: hidden; left: 214px; top: 280px; width: 100px; height: 40px;" role="button" aria-label="아니오 " aria-description=""><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_cancel:icontext" class="nexacontentsbox" style="left:0px;top:2px;width:100px;height:38px;">아니오</div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_close" class="Button btn_WF_PopupClose" tabindex="-1" style="left:374px;top:0px;width:50px;height:50px;" role="button" aria-label="팝업닫기 " aria-description="" status="enabled"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.btn_close:icontext" class="nexacontentsbox" style="left:0px;top:0px;width:50px;height:50px;background-image:url(./_resource_/_theme_/esky_pc/images/btn_WF_Close02.png);"></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.sta_bg" class="Static sta_WF_Alert2" tabindex="-1" style="left:0px;top:50px;width:424px;height:80px;" role="document" aria-label=" " aria-description="" aria-labelledby="accessibility_notify_0" status="enabled"></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.sta_00" class="Static" tabindex="-1" style="visibility:hidden;left:126px;top:366px;width:224px;height:44px;background:aqua;" role="document" aria-label=" " aria-description="" aria-labelledby="accessibility_notify_0"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.sta_00:text" class="nexacontentsbox" style="left:0px;top:0px;width:224px;height:44px;">↑ confirm, alert 버튼 겹쳐 있음</div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.sta_01" class="Static" tabindex="-1" style="left:121px;top:321px;width:150px;height:21px;" role="document" aria-label=" " aria-description="" aria-labelledby="accessibility_notify_0"></div></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.hscrollbar" class="HScrollBarControl hscrollbarForm" tabindex="-1" status="disabled" style="left: 0px; top: 342px; width: 424px; height: 0px; border: 0px none;"><div class="nexasimplecontainer" id="nexacontainer" style="left: 0px; top: 1px;"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.hscrollbar.decbutton" class="ButtonControl decbutton" tabindex="-1" status="disabled" style="left: 0px; top: 0px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.hscrollbar.decbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.hscrollbar.incbutton" class="ButtonControl incbutton" tabindex="-1" status="disabled" style="left: 330px; top: 0px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.hscrollbar.incbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.vscrollbar" class="VScrollBarControl vscrollbarForm" tabindex="-1" status="disabled" style="left: 424px; top: 0px; width: 0px; height: 342px; border: 0px none;"><div class="nexasimplecontainer" id="nexacontainer" style="left: 1px; top: 0px;"><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.vscrollbar.decbutton" class="ButtonControl decbutton" tabindex="-1" status="disabled" style="left: 0px; top: 0px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.vscrollbar.decbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div><div id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.vscrollbar.incbutton" class="ButtonControl incbutton" tabindex="-1" status="disabled" style="left: 0px; top: 412px; width: 12px; height: 12px;"><div class="nexacontentsbox" id="mainframe.childframe.msgPop_51f51eb4-5253-d248-88be-cb5340d14c3a.form.vscrollbar.incbutton:icontext" style="left: 0px; top: 0px; width: 12px; height: 12px; background-image: url(&quot;./_resource_/_theme_/esky_pc/images/btn_WF_ScrD.png&quot;);"></div></div></div></div></div>

and it's not able to find element i want. how can i fix?




Why does my web application ask for credentials

i have a web application written in c#, and for some reason it always asks me for credentials (of the user logged to the computer). in the file Web.config there is a tag:

<authentication mode="Windows">
</authentication>

even if I remove this, it still asks me for credentials. There is no place in my code that asks for it. Does anyone know why it happens? i use visual studio 2019




How can I solve this with HTML, JS, PHP? [closed]

So I need to make a 10x10 tic tac toe game. I have to give two numbers (the coordinates: which row whoch column) and if I want to put an X or an O. Then press "Send" button and it takes an X or o to the given cell.




How to integrate the Twilio Video chat in React js Web application

Hello friends i am new in rect Js web applcaiton. I am trying to integrate the Twilio in react js web application.In this web application a one user communicate with another user using video call now how to communicate this two user with each other in react js web application. I have created the account on twilio and i am referring this link and GitHub repository link but its not running even after i am setting the env file like sid ,app key,app secrete key. on localhost 8080 display the output Cannot GET / thanks in advance..




How should I program a Form so that the user can incorpe any file he wants (png,txt,etc)?

This is how it should work. As u can see u can atach any file you want.

Photo

http://www.theyellowcolor.com/send-us-files/




Which is best place to get totally free Domain?

where i can find a free domain? I have tried several different website to search it but i was unable to find one. But it doesn't work for me!




Relation of IaaS and PaaS

im trying to understand whats IaaS and PaaS and how they related to each other. There are a many picture like this enter image description here In relation of this picture IaaS is a part of PaaS and PaaS cant stand alone, is that right ? I mean…i could use a PaaS in my company and „put“ this PaaS on my own infrastucture ? In this case i would manage the Virtualization Servers, Storage and Networking itself.
Can someone explain this ?




Scrap data from json

Hello I am making price statistics project with python and I have problem scrapping data from api. API : https://www.rolimons.com/api/activity I want to get prices (last 2 values from one block) example from [[1588247532,0,"1028606",464,465] I would need 464 and 465 only , also I want to do that for all table. I have no Idea how could I do that.

import requests 
import json

r = requests.get('https://www.rolimons.com/api/activity')
content = json.loads(r.content.decode())
for key, value in content.items():
    print(key)   



Web socket connection does not work over SSL

I have Web Socket that works perfectly fine on localhost and production (https://www.example.com) environment.

However, when I deploy the same code to pp environment (https://pp.example.com) I get WebSocket handshake: Unexpected response code: 404

I have AWS certificate manager generated certificate for domain example.com, with additional domain name www.example.com and pp.example.com

www.example.com and pp.example.com are sitting on different server so they have different ip addresses.

When I go to www.example.com and make the following call,

let ws = new WebSocket("wss://www.example.com/ws");

It works perfectly fine.web socket is connected.

However, when I switch to pp.example.com and make the following call

let ws = new WebSocket("wss://pp.example.com/ws");

I get error from Safari, Firefox and Chrome:

WebSocket connection to 'wss://pp.example.com/ws' failed: Error during WebSocket handshake: Unexpected response code: 404

Any ideas?

The code are exactly the same.




Checking if the parameter was correctly passed in View in ASP.NET Core Web Application

I have a problem with my Web Application. I managed to search through the jokes and display the ones that contain certain word (by using API https://icanhazdadjoke.com/), but I don't know how to display them in better way than this:

I have my async Task method that search jokes:

    [HttpPost]
    public async Task<List<string>> SearchJoke()
    {
        string searchedWord = Request.Form["word"];
        var client = _httpClientFactory.CreateClient("API Client");
        string url = client.BaseAddress + "search?term=" + searchedWord;
        string responseBody = await client.GetStringAsync(url);

        JokesModel jokes = JsonConvert.DeserializeObject<JokesModel>(responseBody);
        List<string> list = new List<string>();

        for (int i = 0; i < jokes.Results.Count; i++)
        {
            list.Add(jokes.Results[i].Joke);
        }

        return list;           
    }

And I just return a View like this:

    public IActionResult Index()
    {
        return View();
    }

My plan is to write something like this:

    public IActionResult Index()
    {
        //check if the word was passed and redirect to the another View which displays jokes
        // else show some message that the word is incorrect or there are no jokes contain that word

    }

I tried checking if the word was passed and wrote another method:

    [HttpPost]
    public bool GetWord()
    {
        string searchedTerm = Request.Form["word"];
        if (searchedTerm != null)
            return true;
        return false;
    }

And do something like this:

     public IActionResult Index()
    {
        if (GetWord())
        {
            return RedirectToAction(nameof(HomeController.SearchJoke), "Home");
            //this is the page where I display joke in more readable way
        }
        return View();
    }

But I got an error: "System.InvalidOperationException: „Incorrect Content-Type:" when I want to download word in GetWord() method.

Anybody can give me some advice or help me with this problem?




how to get json data in different pages, with tag a

I want to display data using json on 2 different pages. instructors.php for the list, and instructor-detail.php for the details of each instructor.

I have created a data file for json, which I am confused about how to fetch data every I click the instructor's photo.

I give this example from the application that I made.

instructors.php view

instructor-detail.php view

and this is my instructors.php code

<body>
    <main>
        <section id="instructors">
            <div class="container">
                <div class="row">
                    <div class="col col-3">
                        <a href="#" class="card-leader" data-id="0">
                            <div class="image">
                                <img src="<?= $base_url ?>assets/img/packleaders/shiqeen.jpg" class="img-fluid">
                            </div>
                            <div class="content">
                                <div class="name">Shiqeen</div>
                                <div class="initial">S</div>
                            </div>
                        </a>
                    </div>
                    <div class="col col-3">
                        <a href="#" class="card-leader" data-id="1">
                            <div class="image">
                                <img src="<?= $base_url ?>assets/img/packleaders/mandy.jpg" class="img-fluid">
                            </div>
                            <div class="content">
                                <div class="name">Mandy</div>
                                <div class="initial">M</div>
                            </div>
                        </a>
                    </div>
                    <div class="col col-3">
                        <a href="#" class="card-leader" data-id="2">
                            <div class="image">
                                <img src="<?= $base_url ?>assets/img/packleaders/hannah.jpg" class="img-fluid">
                            </div>
                            <div class="content">
                                <div class="name">Hannah</div>
                                <div class="initial">H</div>
                            </div>
                        </a>
                    </div>
                    <div class="col col-3">
                        <a href="packleader.php" class="card-leader">
                            <div class="image">
                                <img src="<?= $base_url ?>assets/img/packleaders/bebe.jpg" class="img-fluid">
                            </div>
                            <div class="content">
                                <div class="name">Bebe</div>
                                <div class="initial">B</div>
                            </div>
                        </a>
                    </div>


                </div>
            </div>
        </section>
    </main>

    <?php
    include 'footer.php';
    ?>

    <script>
        $('.card-leader').on('click', function(event) {
            event.preventDefault();
            /* Act on the event */

            let get_id = $(this).data('id');

            window.location.href = "<?= base_url(); ?>instructor-detail.php" + '?id=' + get_id;
        });
    </script>
</body>

</html>

and this is my instructor-detail.php code

    <main>

        <?php
        $data = file_get_contents("http://cru68.test/assets/js/data-instructor.json");
        $data = json_decode($data, TRUE);

        echo $data[0]['image'];
        ?>

        <section id="packleader">
            <div class="container-fluid custom-container">
                <div class="row">
                    <div class="col-12 col-sm-12 col-md-12 col-lg-6  video">
                        <div class="main-video d-flex-justify-content-center">
                            <div class="content-video">
                                <img src="assets/img/packleaders/packleaders-video-sample.jpg" alt="" class="img-fluid">
                            </div>
                        </div>
                    </div>
                    <div class="col-12 col-sm-12 col-md-12 col-lg-6 ">
                        <div class="biography">
                            <legend class="title"><?= $data[0]['name']; ?></legend>
                            <div class="text">
                                <?= $data[0]['description']; ?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>
</body>

</html>



Why is the event dispatched by window not captured by other elements?

  <body>
    <div id="d"></div>
    <script>
      document
        .getElementById("d")
        .addEventListener("test", () => console.log("div"), true);

      document.body.addEventListener("test", () => console.log("body"), true);

      window.addEventListener("test", () => console.log("window"));

      window.dispatchEvent(new CustomEvent("test"));
    </script>
  </body>

Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output. Run the above code, you will only see one output.




Django admin template: what is base_site.html

I am currently customizing the admin templates and this makes me wonders that what is the usage/purpose of base_site.html?

I understand that base_site.html extends from base.html but from the original code itself, it only adds HTML content for branding and title blocks. Hence, if I'm overriding the whole base.html, I can just add HTML content for branding and title blocks in base.html and empty the base_site.html.

Please correct me if I am wrong. Thank you




Best algorithm for design responsive site

I want design responsive site but my idea is :

first : detective device with JavaScript ( ex : tablet or phone or desktop ) second : set special URL for device ( ex : mobile URL link for mobile , ... )

I ask u , this idea is right ?




mercredi 29 avril 2020

Why is my HTML website taking so long to load initially though all images are compressed? [closed]

https://www.studioaps.in/demo/pink-pastures-website/ This is the site. Even after refreshing twice or thrice all the images are not loading, even the background images. The loading speed is extremely slow. I don't know what to do.




selenium python cannot send number as key for input

i tried to send phone numbers to input element below

<div id="mainframe.childframe.form.div_main.form.div_work.form.edt_mbtlTelNoCentral" class="Edit" tabindex="-1" style="left:309px;top:305px;width:85px;height:28px;" aria-label="휴대전화 가운데자리(필수입력) " aria-description="" userstatus="" status="enabled"><input id="mainframe.childframe.form.div_main.form.div_work.form.edt_mbtlTelNoCentral:input" class="nexainput" style="left:0px;top:0px;width:83px;height:26px;ime-mode:disabled;" value="" maxlength="4" type="text"><input id="mainframe.childframe.form.div_main.form.div_work.form.edt_mbtlTelNoCentral:input" class="nexainput" style="left:0px;top:0px;width:83px;height:26px;ime-mode:disabled;" value="" maxlength="4" type="text"></div>

with this code

actions = ActionChains(driver)
ele = driver.find_element_by_xpath('//*[@maxlength="4"]')
actions.click(ele).key_down(Keys.CONTROL).send_keys("a").key_up(Keys.CONTROL).send_keys("Keys.Delete").send_keys('9049').perform()

but it keep send key like this enter image description here

how can i fix this?




Masking address into .html using htaccess

im new here.

so i have VPS Centos 7 on Google Cloud, i've install LAMP(php 7.3) on there and place source code in var/www/html/ so i've found some problem that my htaccess doesnt work to masking

addres : example.com/media.php?module=home (this address work properly in browser)

into : example.com/home.html (this address show error The requested URL /home.html was not found on this server.)

my htaccess :

RewriteEngine On

RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^(.*)$ https://www.example.id/index.php$1 [R=301,L]

RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^home.html$ media.php?module=home1 [L]

NB : this htaccess are working in last cpanel whm and doesnt work in my new VPS only installed LAMP

Thankyou




How to save the html code of a website correctly?

I wan´t to download the html code of facebook, but when I open the file the page opens but without the graphic design. Any suggestions would be grat!




What do you need to get a job as a FrontEnd Developer? [closed]

You're answers is much appreciated. If you work as a FrontEnd Developer, I'd like to ask you a few questions?

You answer will help me take a career change decision. You can assume that I know HTML, CSS and basic vanilla JavaScript, little PHP and Photoshop.

1.- What do you need to get a job as FrontEnd Developer? 2.- Do you really need to become an expert in Vanilla Javascript? 3.- How big is job market competition? 4.- Do they really pay what they advertise? ($100k and up?),(I saw $190K/year the other day) 5.- Do you code all by typing or use a software to develop websites?

Thank you so much! Your answer can change people's life!!! :)




Facade\Ignition\Exceptions\ViewException : Trying to get property 'follows' of non-object (View: E:\tweety\resources\views\_friends-lists.blade.php)

I am getting this error since 5 days please help me to solve it. Code:

<h3 class="font-bold text-lg mb-4 block">Following</h3>
<ul>
    @foreach (auth()->user()->follows as $user)
        <li class="mb-2">
            <div class="flex items-center text-sm">
                <img src="" alt="" class="rounded-full mr-2"></div>
        </li>
    @endforeach
</ul>



Should Terms and Conditions checkbox persist?

I have a question about a good practice.

I have on my web page a form with a checkbox for Terms and Conditions. My question is: if the user will check the T&C and proceed further, but he will return to the initial page, should I persist his choice on T&C checkbox?

What would be the pros and cons for this?

Thank you in advice!




Dependencies necessary for developing java web project

I just started to make myself get used to develop java web project with maven in IDEA. However, I found out those basic dependencies like servelt or apachetaglibs should be implemented manually in pom.xml, which were unnecessary in normal java web project. So what's the reason?

By the side, i really eager to know which dependencies are really indispensable. It already takes me pretty of time for figure those issues caused by the dependence.




Logging requests into database

Should I log requests info (client ip, request status code, execution time etc.) in my web app into the database to analyse users behavoir and arised errors? And what info log for better experience?




Having issues to get data from json file using ajax

I have 2 JSON files. One is for food types for e.g, Starters, Main Course, Beverages etc and the other is for displaying the details for each food item like the food name, food type, food description and price.

I want to select a food category from one JSON file and make an AJAX call to load another JSON file based on the first one in order to display the required food for that category. However, I am not getting the information.

<?php
  $url = 'http://localhost/trial2/buildFoodCategoriesJSON.php';
  $json = file_get_contents($url);
  $obj = json_decode($json, false);
?>

<p>Select a food category to view corresponding details
  <select id="foodCat">
    <option value=''></option>
    <?php foreach($obj as $foodCategory) {
      echo "<option value='" . $foodCategory->Food_Type . "'>". $foodCategory->Food_Type . "</option>";
    } ?>
  </select>
</p>
$(document).ready(function() {
  $('select#foodCat').change(function() {
    var fCategory = $(this).val();

    if (fCategory != '') { //if user did not choose blank
      var url = "http://localhost/trial2/getFoodItemsJSON.php?Food_Type=";
      url = url + fCategory;

      $.getJSON(url, function(data) {
        alert(JSON.stringify(data)); //no output
        $.each(data, function(i, obj) {
          foodName = obj['Food_Name'];
          foodDesc = obj['Food_Description'];
          foodPrice = obj['Food_Price(Rs)'];
          alert(foodName); //no output
        });
      });
    }
  });
});



How to load a website from a different postion than the top

I was wondering if it was possible to start viewing the webpage not from the default top but from a different location(for instance - middle of the page). This way, when the page loads, the user would have the option to scroll not only down but also up.

Is it even possible and if so, how can you choose the precise location? I tried looking for answers but no luck :(




Bought a Website in Hostinger and want it to point to LocalHost

So, just like the title says, I bought a website in hostinger (www.mynewwebsite.com) and want it to point to localhost. So that when navigating to https://ift.tt/2KHgpHg actually points to localhost:3000/param/1

About my set up: 1. created my website using node js, and is connected to local SQL server 2012 instance 2. using windows 10 computer




Request["key"] is not working in C# web application (ASP.NET Core)

I am trying to get parameter form a View and passing it to the controller:

 [HttpPost]
 public string GetWord()
 {
     string word = Request["word"];
     return word;
 }

But I got an error

Indexing using the [] construct cannot be used for an Http Request expression

I looked at documentation and I don't know why it is not working. What should I do to fix this?




About apply the data mining algorithm on website, not web scraping

I am doing my project about data mining algorithm with python, but the professor tell me that I should put the data mining program on the website and process it, but I cannot find any information for apply the data mining on website, is that possible? The data mining program I have done in the visual studio code and it can run successfully from the visual studio code. I have no idea how to apply this program on the website, the program can input csv, have a perdition and have accuracy etc. I think the program just like the program which is possible run on cmd? I have not test it on cmd, I have no idea to apply the whole data mining program on website, if someone know how to do it, please tell me or tell me is that possible. Thank you.




Duplicate content generated(uuids, cached responses) javascript

For an ecommerce website we are building data registration object. For this we need te create uuid's of websessions. While building we seeme to generate a lot of duplicates. As a small test we build a small piece of code. This code however still gives a lot of duplicates.

        <script>
        (function () {
            var urlEndpoint = 'https://<url>/<endpoint>';
            var createXmlHttpRequest = function (url, settings) {
                var request = ('XMLHttpRequest' in window) ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP'); // eslint-disable-line no-undef
                request.open('POST', url);
                request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
                request.send((settings.data || ''));
                request.onload = function () {
                    if (request.status >= 200 && request.status < 300 && typeof settings.callback === 'function') {
                        settings.callback('uuid=' + JSON.parse(request.response).uuid + '&timestamp=' + JSON.parse(request.response).timestamp);
                    }
                }
            };
            createXmlHttpRequest(urlEndpoint + '?getuuid=1&' + (new Date()).getTime(), {
                callback: function (data) {
                    createXmlHttpRequest(urlEndpoint + '?' + (new Date()).getTime(), {data: data})
                }
            })
        })();
    </script>

what we do is: - get a uuid from a backend script trough a post - pass that uuid back to another backend script and save it in a database

when doing this, we get al lot of duplicates in the second backend call. This does not make any sense to me, but maybe someone can shed a light and help us out.

This is by the way a high trafiic website with more then 2M view a day.

Also: the second call to save the uuid is for testing purposes. This will be removed and we will be using the uuid in the frontend




how to scrape img from website (direct url is restricted)

So I have a website with tons of images I want to scrape but the direct urls to the images are resricted (403). I can not access them directly but I can view and manually download the images on the on the browser that I am viewing on. I would perfere to stay away from selenium.




Project 2D image on a surface

I'm building a web app that projects a 2d image on a flat surface. For this to work I need a marker that I can recognize on the surface.

My idea is to use the QR code finder and alignment patterns as a marker to figure out orientation, distortion and distance. The orientation and distortion part is easy with QR codes. For the distance I thought that I can print the finder patterns with a fixed distance between them of 1cm and calculate the distance to scale the image accordingly.

Now I have 2 questions:

  • Is this a good approach?
  • Is there a better way or marker that I can use to achieve the same thing?



How do I define my own record sampling order? Django

I want to add the ability to define and then the current record will be displayed. I am thinking of adding an additional IntegerField that will change the order, but I don't think this is a good thing. There is also an option to make a field associated with the current model and recursively select the next one. What's your advice?




mardi 28 avril 2020

How to detect the image that not load correctly/completed on web page?

How to detect the image that not load correctly on web page? I used the following jquery but not working.

$('#image1').on('load', function() {
    if ($('#image1').prop('complete')) {
        console.log("image complete: true");
    } else {
        console.log("image complete: false");
    }
}).on('error', function() {
    console.log("image loaded error");
}).attr("src", imgUrl);

enter image description here




Uploading an excel file but not allowing download option

I have an excel file. This file has some unique calculations. I want the user of this file to see only a portion of the file along with file download option disabled. The user of file should be able to use the file. That means the file should work for the user. Changing in data should return changing in result for the user. I want to upload it on blogspot.com or somewhere else as you suggest. But the condition is the user should not be able to download the file, but only able to use the file and its contents. I have tried embed facility of onedrive.com for this, but there download option is visible for users. May you suggest how I can do this? Even if it is possible by opening a website and then uploading the content etc etc, I am also ready to do that, but how I shall start and whom to should I meet? Someone told me it is possible in some other format of website languages? Please guide me how I can do this.




Web scripts that can process text inputs into animated video overlays?

I'm looking for a way for a user to input text into a field, and for something on the back end to take the text input and process a text animation and styling onto the text and overlay it onto an existing video.

Sorry if this question is very vague and poorly worded, but I'm starting to piece together a rough framework on how something like this can be achieved and where to look.

Rough examples to help explain what I'm trying to do: Text the user would input on the website: https://drive.google.com/open?id=1OxE1xCIzFWMAhV7H6-dR5MoYjGtsj1iG

The video that the website would compile and spit back out: https://drive.google.com/open?id=1YulK2CCRWu6QwVjZwF9eu2n-TSqIEz4z

Any help is appreciated!




What areas in Tokeet do I need to check when I encounter a missing Booking Engine check out page in preview mode

I am creating a booking engine and before finalizing all the changes, I am checking the preview page. I notice that the check out page on the booking engine shows an error. Where areas do I need to check in Tokeet to troubleshoot this?




How to add Web as a wizard, so I can create new .css in eclipse?

I just followed the instructions in the link below and downloaded Web Tools Platform (WTP) and Web Tools Platform SDK (WTP SDK) successfully. https://cedocs.intersystems.com/atelier/latest/index.jsp?topic=%2Fcom.intersystems.atelier.help%2Fhtml%2Ftasks%2Fweb-development.html
However, when I wanna new a .css file in my project by select New > Other > Web > CSS, I still cannot find it. What should I do? I have restarted the eclipse what it shows when I search css

Thank you so much!




How to edit a website with only the domain name, user id and password

I was hired to make changes to a website so I asked the person who made it to grant me access. She gave me this HOSTING: http://www.example.com/ User name: user1 Password: password1 I asked her how to log in and told my client to tell me to stop bothering her and that he should hire someone who knows what they are doing. I tried using those credentials in filezilla but had no luck. How can I connect to the host to edit the files?




How to make my website dynamically resize elements

Im relatively new to web development working on creating a website using React JS.

Im really not able to figure out how I can make the elements on the website resize or arrange themselves nicely when the window gets resized, or appear like when viewed from a mobile device.

Like all the elements adjust themselves based on vh and vw when the window size decreases/increases diagonally, however if the vh stays the same and vw changes, everything ends up all over the place.

Are there any plugins or anything ReactStrap related that can help me achieve this dynamic resizing and fitting? OR should i use tools like wordpress which seem to automatically take care of this issue rather than me manually writing all the HTML and CSS for the website.

Thank you




Clickable links in autocomplete search box

I have created a clickable search bar but am having trouble in redirecting the web browser once the user clicks the link.

    <script type="text/javascript">
var source = [ {value: "www.google.com", label: "This is a test"}];

$(document).ready(function() {
    $("input#autocomplete").autocomplete({
        source: source,
        select: function( event, ui ) { 
            window.open.href = ui.item.value;
        }
    });
});

</script>

is the select function implemented correctly? My understanding of this is that when the user clicks the suggested drop down link the select function is called and the "Window.open.href = ui.item.value" is used to redirect the browser.. but so far the browser just fills the search input. Any help would be appreciated.




Streaming audio from Python to website: Which Tools/Technologies to use?

That's my project:

1) send GPS data from a clients smartphone to a Python program on my server 2) according to the GPS data an audio stream is manipulated with Python
3) send the audio stream to the smartphone

I'm a beginner, but I'm willing to learn anything necessary. I just need to know on what to focus (honestly, I'm lost in information). Therefore my question: Which tools and technologies should I focus on?

My assumptions so far:

referring 1): In order to get the GPS data into Python I need to use WSGI. Do you recommed a Web Framework like Django, Flask or Tornado?

referring 2): In order to manipulate and stream audio in real-time does the program really have to work asynchronously or in "non-blocking" fashion?

referring 3): In order to send an audio stream that's live manipulated I think that WebSockets is the right technology. I tried it server-side using the Python module "websockets" and client-side using JavaScript. That worked. But I wonder what's happening if multiple clients want to connect. I think I need some server program that deals with all those requests. I've read that my beloved Apache is no good choice as it is not designed to handle WebSockets. So maybe Tornado? But they want me to write everything asynchronously while I'm still learning Python...

I would appreciate any help.




How do I scrape a randomly generated sentence from this website

Im using python 3.8x to try and scrape a randomly generated sentence from this website. https://randomwordgenerator.com/sentence.php Except when I read it, the generated sentence isn't in the HTML. Can any one help me find a way to scrape the generated sentence? I found the HTML tags when the sentence is generated but it doesn't generate when I request.

Here is my code.

random_sentence_webpage = 'https://randomwordgenerator.com/sentence.php'

# The HTML tag for the generated sentence
start_marker = '"support-sentence">'
end_marker = '</span>'

from urllib.request import urlopen, Request
headers = {'User-Agent': 'Chrome/81.0.4044.129'}
reg_url = random_sentence_webpage
req = Request(url=reg_url, headers=headers) 
html = urlopen(req).read()
html_text = html.decode('utf-8', 'backslashreplace')

starting_position = html_text.find(start_marker)
end_position = html_text.find(end_marker,starting_position)

random_generated_sentence = html_text[starting_position + len(start_marker):end_position]

print(random_generated_sentence)



Why I'm not able to see my cards as flex or grid layout?

I actaually made cards for my team members, and the cards went well but the layout is problematic. I tried with both CSS Flexbox and CSS3 Grid, my browser supports both of them but though I'm facing. And this works very well in mobile!!

I tried flex: 2 0 100%;

and also display: grid; grid-template-columns: repeat(470px, 1fr); grid-auto-rows: auto; grid-gap: 1em;

Is there any solution for this problem?

.cards2 {
    font-size: 11px;
    width: 100%;
    height: auto;
    padding: 1em 0;
}

.cards2 a { text-decoration: none; }

.cards2 .container {
    display: grid;
    grid-template-columns: repeat(470px, 1fr);
    grid-auto-rows: auto;
    grid-gap: 1em;
}

.cards2 .container .card-wrapper {
    margin: 25px;
}

.cards2 .container .card-wrapper .card {
    width:/* 32rem*/ 470px;
    margin: 34px 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: #EBEEF8;
    box-shadow: 0.5rem 0.5rem 3rem rgba(0, 0, 0, 0.2);
    /* box-shadow:  20px 20px 60px #bec3c9, 
             -20px -20px 60px #ffffff; */
    border-radius: 28px;
}

.cards2 .container .card-wrapper .card .card-bg {
    width: 100%;
    height: 26rem;
    object-fit: cover;
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 78%, 0% 100%);
    clip-path: polygon(0 0, 100% 0, 100% 78%, 0% 100%);
    border-top-right-radius: 28px;
    border-top-left-radius: 28px; 
}

.cards2 .container .card-wrapper .card .card-logo {
    width: 14rem;
    height: 14rem;
    object-fit: cover;
    border-radius: 50%;
    margin-top: -170px;
    z-index: 999;
    border: 12px solid #EBEEF8;
}

.cards2 .container .card-wrapper .card h1 {
    font-size: 40px;
    font-family: 'Poppins', sans-serif;
    color: #333;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
    margin: 25px 15px;
}

.cards2 .container .card-wrapper .card .title {
    color: #777;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 1.1rem;
    text-align: center;
}

.cards2 .container .card-wrapper .card .desc {
    font-family: 'Lato', sans-serif;
    font-weight: 500;
    word-spacing: 0.8px;
    font-size: 1.3rem;
    text-align: center;
    font-style: italic;
    margin: 20px 0;
    padding: 8px;
}

.cards2 .container .card-wrapper .card .rb {
    background: #666;
    color: var(--light);
    padding: 10px;
    margin: 3px;
    border-radius: 50%;
}

.cards2 .container .card-wrapper .card .rb i {
    font-size: 16px;
}

.cards2 .container .card-wrapper .card .rb:hover {
    background: #555;
}

.cards2 .container .card-wrapper .card .social-icons {
    width: 100%;
    list-style: none;
    display: flex;
    justify-content: space-evenly;
    padding: 2rem 0;
    margin-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.2);
}

.cards2 .container .card-wrapper .card .social-icons h3 {
    font-size: 2.3rem;
}

.cards2 .container .card-wrapper .card .social-icons i {
    font-size: 2.8rem;
    color: #0596C2;
}

.cards2 .container .card-wrapper .card .social-icons i:hover {
    color: #50B4F2;
}
<div class="cards2">


    <div class="container">

      <div class="card-wrapper">


        <div class="card">
          <img src="images/authorSmaranBg.jpg" alt="Smaran Background" class="card-bg">
          <img src="images/authorSmaran.jpg" alt="Smaran Logo" class="card-logo">
          <h1>Smaran Bose B</h1>
          <p class="title">Author</p>
          <p class="desc">
            " Knowledge is everything to me. I love exploring. I don’t lose my control over patience. I like to keep a positive attitude. I am always ready to learn new skills and ready to face challenges. I don’t lose my cool so easily. I show my keen interest in music. My ultimate goal is to become a professional guitarist and a singer. I am also good at sports. I am good at playing cricket and badminton. "
          </p>
          <!-- <a href="#" class="rb"><i class="im im-warning"></i></a> -->
          <ul class="social-icons">
            <li><a href="https://www.instagram.com/smaranbose/"><i class="fab fa-instagram"></i></a></li>
            <li><a href="https://www.facebook.com/smaranbose.badugu.5"><i class="fab fa-facebook-square"></i></a></li>
          </ul>
        </div>

<div class="cards2">


    <div class="container">

      <div class="card-wrapper">


        <div class="card">
          <img src="images/authorSmaranBg.jpg" alt="Smaran Background" class="card-bg">
          <img src="images/authorSmaran.jpg" alt="Smaran Logo" class="card-logo">
          <h1>Smaran Bose B</h1>
          <p class="title">Author</p>
          <p class="desc">
            " Knowledge is everything to me. I love exploring. I don’t lose my control over patience. I like to keep a positive attitude. I am always ready to learn new skills and ready to face challenges. I don’t lose my cool so easily. I show my keen interest in music. My ultimate goal is to become a professional guitarist and a singer. I am also good at sports. I am good at playing cricket and badminton. "
          </p>
          <!-- <a href="#" class="rb"><i class="im im-warning"></i></a> -->
          <ul class="social-icons">
            <li><a href="https://www.instagram.com/smaranbose/"><i class="fab fa-instagram"></i></a></li>
            <li><a href="https://www.facebook.com/smaranbose.badugu.5"><i class="fab fa-facebook-square"></i></a></li>
          </ul>
        </div>

<div class="cards2">


    <div class="container">

      <div class="card-wrapper">


        <div class="card">
          <img src="images/authorSmaranBg.jpg" alt="Smaran Background" class="card-bg">
          <img src="images/authorSmaran.jpg" alt="Smaran Logo" class="card-logo">
          <h1>Smaran Bose B</h1>
          <p class="title">Author</p>
          <p class="desc">
            " Knowledge is everything to me. I love exploring. I don’t lose my control over patience. I like to keep a positive attitude. I am always ready to learn new skills and ready to face challenges. I don’t lose my cool so easily. I show my keen interest in music. My ultimate goal is to become a professional guitarist and a singer. I am also good at sports. I am good at playing cricket and badminton. "
          </p>
          <!-- <a href="#" class="rb"><i class="im im-warning"></i></a> -->
          <ul class="social-icons">
            <li><a href="https://www.instagram.com/smaranbose/"><i class="fab fa-instagram"></i></a></li>
            <li><a href="https://www.facebook.com/smaranbose.badugu.5"><i class="fab fa-facebook-square"></i></a></li>
          </ul>
        </div>

<div class="cards2">


    <div class="container">

      <div class="card-wrapper">


        <div class="card">
          <img src="images/authorSmaranBg.jpg" alt="Smaran Background" class="card-bg">
          <img src="images/authorSmaran.jpg" alt="Smaran Logo" class="card-logo">
          <h1>Smaran Bose B</h1>
          <p class="title">Author</p>
          <p class="desc">
            " Knowledge is everything to me. I love exploring. I don’t lose my control over patience. I like to keep a positive attitude. I am always ready to learn new skills and ready to face challenges. I don’t lose my cool so easily. I show my keen interest in music. My ultimate goal is to become a professional guitarist and a singer. I am also good at sports. I am good at playing cricket and badminton. "
          </p>
          <!-- <a href="#" class="rb"><i class="im im-warning"></i></a> -->
          <ul class="social-icons">
            <li><a href="https://www.instagram.com/smaranbose/"><i class="fab fa-instagram"></i></a></li>
            <li><a href="https://www.facebook.com/smaranbose.badugu.5"><i class="fab fa-facebook-square"></i></a></li>
          </ul>
        </div>
</div>
</div>
</div>



Firebase phone number verification using web without recaptchaVerifier

i have used Firebase JavaScript code to send OTP to verify user phone number and it is working perfectly. But right now, i want to enhance the code by using it as personal API to verify phone number just by calling the URL and pass the phone number.

The only tree that fell on my way is Firebase "recaptchaVerifier".

Please, is there a way to use Firebase web phone number verification without recaptchaVerifier? Just only the phone number only.

<script type="text/javascript">
function onSignInSubmit(e) {
    e.preventDefault();
    if (isPhoneNumberValid()) {
      window.signingIn = true;
      updateSignInButtonUI();
      var phoneNumber = getPhoneNumberFromUserInput();
      var appVerifier = window.recaptchaVerifier;
      firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)  //HERE IS WHERE THE DEVIL IS..
          .then(function(confirmationResult) {
            window.signingIn = false;
            updateSignInButtonUI();
            resetRecaptcha();
            // SMS sent. Prompt user to type the code from the message, then sign the
            // user in with confirmationResult.confirm(code).
            var code = window.prompt('Enter the verification code you received by SMS');
            if (code) {
              confirmationResult.confirm(code).then(function () {
                window.close();
              }).catch(function (error) {
                // User couldn't sign in (bad verification code?)
                console.error('Error while checking the verification code', error);
                window.alert('Error while checking the verification code:\n\n'
                    + error.code + '\n\n' + error.message)
              });
            }
          }).catch(function(error) {
            // Error; SMS not sent
            window.signingIn = false;
            console.error('Error during signInWithPhoneNumber', error);
            window.alert('Error during signInWithPhoneNumber:\n\n'
                + error.code + '\n\n' + error.message);
            updateSignInButtonUI();
            resetRecaptcha();
          });
    }
  }
</script>



A problem with the design with bootstrap(Internet Explorer)

[1]A problem with the design with bootstrap

[1]: https://i.stack.imgur.com/KY5Ob.png [error Image(IE)]

[1]: https://i.stack.imgur.com/uFAPC.png[ chrome]




Does a level 2 subdomain contribute to a subdomain's ranking?, and SEO?

I have a website called x.domain.com, and I need to create another website y. the content of the second website is relative to the first one. Which is better in terms of SEO and website ranking?:

  1. y.x.domain.com, will y contribute to x's ranking?, or have it's own separate ranking?
  2. x.domain.com/y/

Please help Thanks




WEB AUDIO API creating rain crackling noises

I'm trying to create rain in the javascript Web Audio API. So far I've created a low frequency rumbling noise for the background and I'm working on a high frequency noise which will imitate the sound of rain droplets. However, right now the high-frequency noise is very much like white noise and too intense to be individual droplets. Does anyone know how to "separate" the sound a little so it almost sounds like crackling. Here is a link to what I would like the high-frequency noise to sound like if you increase the last slider (violet) you can hear it.

And here is my HTML code so far

<script>
let context= new AudioContext();
let context2= new AudioContext();

let lowpass = context.createBiquadFilter();
  lowpass.type = 'lowpass';
  //lowpass.Q.value = -7.01;
  lowpass.frequency.setValueAtTime(80, context2.currentTime);

let gain = new GainNode(context);
  gain.gain.value= 0.4;

let gain2 = new GainNode(context2);
  gain2.gain.value= 0.02;

let highpass=context2.createBiquadFilter();
  highpass.type = 'highpass';
  highpass.Q.value = 2;
  //highpass.frequency.setValueAtTime(6000, context2.currentTime);

let distortion = context2.createWaveShaper();

let delay = context2.createDelay(90.0);




function StartAudio() {context.resume()};
context.audioWorklet.addModule('basicnoise.js').then(() => {
  let myNoise = new AudioWorkletNode(context,'noise-generator');

  myNoise.connect(lowpass);
  lowpass.connect(gain);
  gain.connect(context.destination);
});

function StartAudio2() {context2.resume()};
context2.audioWorklet.addModule('basicnoise.js').then(() => {
  let myNoise2 = new AudioWorkletNode(context2,'noise-generator');

  myNoise2.connect(highpass);
  highpass.connect(gain2);
  gain2.connect(delay);
  delay.connect(context2.destination);
});

I've been playing around with different functions, some of them didn't do much or I simply am not using them correctly as I am very new to the audio API scene. Any help is appreciated as this is for a school project and I know some other students want to make fire sounds and could also benefit from the crackling noise !! Thank you !!




Can't seem to add code directly in Firefox's event inspector

After clicking the event button , Firefox Dev Tools will show the handler associated with it.

How can I edit that function to add code (eg alert(1)) to it?

enter image description here




How to pass "System.Object" type to the Controller through a FromQuery parameter

I have this method in my controller that needs to receive a List of filtering expressions, so I can filter a DynamoDB table but the Value to filter can be string, numeric, boolean, etc... so I used a "System.Object" typed property. But it seems the controller can't bind a FromQuery Parameter to a Type "System.Object" object.

        [HttpGet]
        public IActionResult Get(
            [FromRoute]string name,
            [FromQuery]FilterExpression[] filters
            )
        {
            return Ok(m_attributeService.GetByAttributeName(name, filters));
        }

The FilterExpression class

    public class FilterExpression
    {
        public FilterExpression(){}
        public FilterExpression(
            string field, 
            string comparisonOperator, 
            dynamic values
            )
        {
            Field = field;
            ComparisonOperator = comparisonOperator;
            Values = values;
        }

        public string Field { get;set; }
        public string ComparisonOperator { get;set; }
        public object Values { get;set; }
    }

But every time I do any request the Values Property is always null. I want to know a workaround solution to receive different data types on my method.




How to make my website look the same on all screens?

How can I make my website: informatiestuderen.nl on small screen (for example on phone) look the same as on big screen like desktop (computer)?

Because my website doesn't work at all on phone.

For example this website: carrieretijger.nl looks the same on phone as on desktop.

I would like to be able to zoom in on the website on small screen.




Heroku multiple web dynos (docker) on same app

I would like to know if it is possible to deploy several "web dynos" microservices (spring boot apps) in the same app in heroku.

I have an app that is compose by several microservices and they also "talk" each others. I was able to deploy a docker container in heroku naming it as "web", there is a post where I solve it:

Heroku docker spring boot image error 503 H14

now the problem is that if I only can deploy one web dynos in a app, i have to create several apps to deploy one of each microservice. One of the microservice is the api gateway that is the only one that must be exposes to internet (I have read something about workers that can run in the same app but are not exposed or something like that, I dont have understood this behaiviour)

If it is not possible another problem is that my microservices connect to the database with the environment property that heroku creates in each app so I will have to manually write in each microservice the URL of the another app database instead of the automatic connection that I have code And it perfecty works for the microservice that is deploy in the app with the database.

Another question if it is not possible is, can I send request for one service to another by using a name or something like that as kubernetes does?

Thank you in advance and sorry for my english (I am spanish).




How to detect duplicated monitors(HDMI, VGA) via javascript or any web language?

It is important for me to recognizes how many monitors are currently connected(from each user) to the specific website. Whether user duplicates monitor or not? I am not sure if it is possible, I couldnt find anything.




Create an whatsapp account in gupshup

Shall I changed the number after creating the account whatsapp api and using 1 week.

In Gupshup whatsapp subscription option is available.




php json_encode() works well. However, the results are broken on the client side

I am working on saving the query results from mysql in an array from php and sending the array to the client in json form. All the character sets, including mysql character set, are utf8, and after checking the results after json_encode(), an invalid json string came out.

$final_result = json_encode($result, JSON_UNESCAPED_UNICODE | JSON_INVALID_UTF8_IGNORE | JSON_INVALID_UTF8_SUBSTITUTE);
echo $final_result; // == valid json data

After checking using the json validator, I found that a valid json data was created.

However, after the echo call, I received the data from the client to ajax and checked it, and the following error occurred, so I cannot parse it.

SyntaxError: Unexpected token  in JSON at position 64362
    at parse (<anonymous>)
    at jquery.min.js:2
    at l (jquery.min.js:2)
    at XMLHttpRequest.<anonymous> (jquery.min.js:2)

enter image description here

lastime":"2020-03-19 08:55:10�����"

As a result of checking, the characters shown in the picture were created in the middle, so the parsing is not working.

$.ajax({
        url: 'test.php',
        data: {action: 'get_Data'},
        type: 'post',
        dataType: 'json'
    }).done(function (json_text) {
        alert("done");
        console.log(json_text);
        json_Obj = JSON.parse(json_text);
        console.log(json_Obj);
    }).fail(function (xhr, status, errorThrown) {
        alert("fail");
        console.log(xhr);
        console.log(xhr.responseText);
        console.log(status);
        console.log(errorThrown);
    });

Of course, I declared the data type json at the place where I called Ajax Post.

I don't know why well-encoded data in php-side is called jquery, ajax on the client side, and why the following happens.

Can you tell me what I missed?




Find all pages on a site with no hyperlinks

It happens with me that I find a useful/interesting website but it's a one-page application with no hyperlinks. Only when you know what "path" to add after the base URL that you can explore other pages. Although websites like these should have a homepage, the fact of the matter is that they don't.

For example, I found this site - it helps understanding how the human voice works: https://dood.al/pinktrombone/ and it's brilliant. Now, I thought are there other web pages like this on the same site. I went to its homepage but no luck, the homepage has another application.

I tried Googling "site:dood.al" which helped me find an oscilloscope application[https://dood.al/oscilloscope/] but is there is a more reliable way of finding all valid complete URLs given a site.

It happens with me very often that I find these sites but no way to navigate on the website.




How to use the ZoomMeetings API in C#?

I am currently using zoom for school. Because of Corona the schools are closed. I want to make a Zoom Control panel in C#. something like a form with a textBox and a button.

you type in the username you want and click the button. now you have the username that you typed in the form in zoom

Im not very in WebRequests and so. But I really want to learn it. Can someone give me a piece of code so I know how to start?




ASP.net - Custom error page for error 400

I am doing custom error pages for errors in ASP. I did the following lines to web.config.

<customErrors mode="On" defaultRedirect="~/Shared/Error">
  <error statusCode="404" redirect="~/Error/PageNotFound" />
  <error statusCode="400" redirect="~/Error/BadRequest" />
</customErrors>

Error 404 works fine and redirects me to the correct page however error 400 does not redirect me to its page.. Am I doing something wrong please?




typeAhead textfield in flutter web

I am using the typeAhead text field for auto-completion but the onSuggestionSelected function does not work. I am using flutter web. No selection is made and listView shows am hovering over an item above the one am actually hovering.

Below is the dialog, in this case the mouse pointer is actually below 'FIN' in the listView. I am using the typeAhead field in a dialog.

This is the code below.

TypeAheadFormField(
      //initialValue: 'bleh',
      textFieldConfiguration: TextFieldConfiguration(
          controller: _typeAheadController, //this.
          decoration: InputDecoration(
              hintText: 'Programme(required)' //label
              )),
      suggestionsCallback: (pattern) {
        return programme
            .where((String dc) => dc
                .toLowerCase()
                .contains(pattern.toLowerCase()))
            .toList(); //|| dc.toLowerCase().contains(other.toLowerCase())).toList();
      },
      itemBuilder: (context, String suggestion) {
        return ListTile(
          title: Text(suggestion),
        );
      },
      transitionBuilder:
          (context, suggestionsBox, controller) {
        return suggestionsBox;
      },
      onSuggestionSelected: (String suggestion) {
        _typeAheadController.text = suggestion; //this
        print(suggestion + ' selected bith');
      },
      validator: (value) {
        if (value.isEmpty ||
            programme.indexOf(value) == -1) {
          return 'Please select a course offered in the university you selected!';
        }
      },
      onSaved: (value) => this._selectedCity =
          value, //<--------- upload value
    )

'programme' is the list of strings returned in which string 'dc' is found. 'print(suggestion + ' selected bith');' does not print a thing to show I never actually have onSelection run at all. Anyone know a work around? thank you.

Dialog:

Dialog image




How to use / as URL parameter at web server?

I need a deeplink for ionic app and need to fulfil following criteria. 1. Prompt user to download app if the app is not present 2. Open the app and pass parameter to app to complete certain action.

Ideally the deeplink should look like https://ift.tt/2YcCbLh

But the problem is the webserver unable to read the dynamic URL properly, which will always showing 404 NOT found error.

The webserver is a linux based share hosting with apache https://ift.tt/35cVlC6 will be simple html with basic javascript to redirect user to playstore or appstore.

How can I make the webserver ignore /parameter1/parameter2/parameter3 and open directly https://ift.tt/35cVlC6? Do I need to configure webserver to achieve this?

Or any suggestion to achieve the same method?

Thanks.




Sharing data between 2 Vue projects

So to make it really simple, because of the way we're using Vue, we have 2 different projects running in html.partials. A:In my layout of the page, and B: a page which show a list of results

A: recieves data from an API, in this case a bool

B: I want to disable/enable button depending on the bool

I've tried simple state management https://vuejs.org/v2/guide/state-management.html#Simple-State-Management-from-Scratch which did not work I've tried EventBus I've tried saving in sessionStorage and using Getters and Seets, eventhandlers, and various packages to get a "sessionStorageChanged" event. Nothing.

Is it really not possible for me to get data from app.Axxxx to app.Bxxxx?




lundi 27 avril 2020

What are most recommended 360-degree Video Players for Web?

I am working on new Website for playing 360-degree videos on both Desktop & Mobile web browsers, and was looking for the most recommended 360-degree/WebVR players that can play Live/Playback videos and can support HLS streaming protocol.




I am getting error 404 in laravel website

I have read other post regarding 404, but solution is not available for my case

I am registering a user for newsletter in website so in web.php

// FrontEnd 
Route::post('store/newsletter','FrontController@StoreNewsletter')->name('store.newsletter');

in index.blade.php in below

<form action=" " method="post" class="newsletter_form">
    @csrf
     <input type="email" class="newsletter_input" required="required"
       placeholder="Enter your email address" name="email">
     <button class="newsletter_button" type="submit">Subscribe</button>
</form>

I even tried changing button to input in form

this is FrontController.php which is in app/Http/Controller/

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;

class FrontController extends Controller
{
public function __construct(){
    echo 'in frontend controller ';
}


public function StoreNewsletter(Request $request){
    echo 'in frontend controller method';
    $validateData = $request->validate([
        'email' => 'required|unique:newsletters|max:55',
    ]);

    $data = array();
    $data['email'] = $request->email ;
    DB::table('newsletters')->insert($data);

    $notification = array(
        'messege' =>  'Thanks For Subscribing',
        'alert-type' => 'success'
    );
    return Redirect()->back()->with($notification);
}

}

This __construct i have put after error for debug purposes

This is my table name

Schema::create('newsletters', function (Blueprint $table) {
        $table->bigIncrements('id');
        $table->string('email');
        $table->timestamps();
    });



Jooby MySql vs Jooby Mongodb

Using MySql is faster and better and easier or Mongodb on the Jooby java web framework? and why?

Which has more benefits and what are they?

what is the default and best database match with jooby?




Google Font Is Not Displaying On Smartphone Browser - HTML, CSS, PHP

I am not getting the Google font "Montserrat" to display in my web pages on my iPhone X using both Chrome and Safari. What I find weird is that Chrome displays the correct font using the Inspect tool and selecting the mode to be mobile (in the desktop Chrome app).

My live website is: Chases.Website

I have looked at the possible solutions on here and none have worked:

  • Adding "< link href="https://fonts.googleapis.com/css?family=Lora:400,700|Montserrat:300" rel="stylesheet" >" to the header tag to each page
  • Adding "@import url('https://fonts.googleapis.com/css?family=Montserrat&display=swap');" to my stylesheet

This font issue appears to be effecting the entire site, so I'm not sure what code to include. The desktop view seems fine. Plug that URL into your smartphone and check it out. Take a look at the source on the site if you need to see it.

Let me know what else I can provide to make it easier. Thanks!




Cannot POST/ form.php

I've been trying to make a simple POST to insert data to a MySQL database but keep getting the cannot post error. I've tried everything please help. At first it worked but then it suddenly stopped. Can't see to understand why.

<form class="form-horizontal" action="form.php" enctype="multipart/form-data" method="post">
    <fieldset id="account">
      <legend>Your Personal Details</legend>
      <div class="form-group required">
        <label for="input-firstname" class="col-sm-2 control-label">First Name</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="input-firstname" placeholder="First Name" name="name">
        </div>
      </div>
      <div class="form-group required">
        <label for="input-lastname" class="col-sm-2 control-label">Last Name</label>
        <div class="col-sm-10">
          <input type="text" class="form-control" id="input-lastname" placeholder="Last Name"  name="lastname">
        </div>
      </div>
      <div class="form-group required">
        <label for="input-email" class="col-sm-2 control-label">E-Mail</label>
        <div class="col-sm-10">
          <input type="email" class="form-control" id="input-email" placeholder="E-Mail"  name="email">
        </div>
        <div>
          <input type="submit" value="Submit">
          </div>
      </div>

This is the php file

<?php

include_once 'connection.php';

mysqli_set_charset($dbconnection,"utf8");


if(isset($_POST['Submit']))
{


    $name = $_POST['name'];
    $lastname = $_POST['lastname'];
    $email = $_POST['email'];


    $query = "INSERT INTO customer (first_name, last_name, email, password) VALUES ('$name','$lastname','$email','loquesea')";


    mysqli_query($dbconnection, $query);

    echo 'lo hicimos!';
}
echo 'mala tuya';



Pass JavaScript variable to Flask variable

I have flask variable called 'gene_info' which is json object and I want to access one index in json for example 'gene_info['AMPH']'. 'AMPH' is a variable value in JavaScript. So how can I do this?

var symbol = 'AMPH'; var td_name = ''; console.log(td_name);




POSTMAN request not working after a couple of hours

Session is logging out and any request imported does not work after a couple of hours. I am seeing a SMSESSION=LOGGEDOFF in the Set-Cookie Header(Screenshot below). I've set up Basic Auth and I am getting a 200 but the request is actually not being completed.

enter image description here




what are the good combination of available encryption algorithms to overcome sensitive data exposure problem in web applications? [closed]

I would like to work on my dissertation and the area of my interest is web application security. I am interested in securing the data to prevent sensitive data exposure vulnerability using a combination of available tools or cryptography algorithms. I mean will it be good to combinely use two cryptography algorithms to prevent sensitive data exposure vulnerability?

Please suggest me tools or algorithms to overcome this problem and which are also implementable.




How can i explain why a web developer is better than Wix?

I'm going to start to develop websites, why people should choose a developer? How can I explain why a developer is better than Wix or something like that? Sorry for my English I'm from Argentina, if you can correct my misspellings I will be very grateful. Thanks for your time




How can show my content of react web page via embedly or else

Once you embed social link with embedly(Or simply type link on skype), you can see the content of that link.

For example: https://twitter.com/3CBilliards/status/1254480379370749953

Now I'm developing react web page.

And I want to show web content once share link via skype or else(Embedly is perfect).

I searched much time. But I couldn't find the way.

If anyone know this solution, please help me.

Thank you




Please help me out to make this navbar responsive at (min-width: 992px)

First, I created this nav bar for mobile device, And after that I made it responsive for desktop, but I have tried lots of time to make it responsive at the width of min 992px. But I couldn't... Please help out make this nav bar responsive at min 992px. I want that when we come from the width of 1200px to 768px all the menu items replace with "More" one by one. According to width...

/*----------------------------------------------------------------------
        >>> Toggle Button
------------------------------------------------------------------------*/
function load_nav_menu() {
    var x = document.getElementById("load-top-nav");
    if (x.style.display === "block") {
        x.style.display = "none";
    }
    else {
       x.style.display = "block"; 
    }   
}

function load_cross() { 
        var y = document.getElementById("get-bar");
        y.classList.toggle("fa-times");
        y.classList.toggle("fa-bars");          
}

function load_search_bar() {
    var z = document.getElementById("get-search-bar");
    if (z.style.display === "inline-block") {
        z.style.display = "none";
    }
    else {
        z.style.display = "inline-block";
    }
}
/*---------------------------------------------------------------------------------
        >>> Body and Wrapper
----------------------------------------------------------------------------------*/
*{
        margin: 0;
        padding: 0;
}
body{
        font-family: 'Lato', sans-serif;
}
.qt-wrapper{
        margin: 0;
        padding: 0;
}

/*---------------------------------------------------------------------------------
        >>> Site Global Style
----------------------------------------------------------------------------------*/
a{
        text-decoration: none;
}
ul{
        list-style: none;
}

/*---------------------------------------------------------------------------------
        >>> Nav Bar
----------------------------------------------------------------------------------*/
.qt-nav{
        background-color: #0096d6;
        width: 100%;
        height: 46px;   
}

/*---------------------------------------------------------------------------------
        >>> Site Name or Logo
----------------------------------------------------------------------------------*/
.qt-name{
        display: inline-block;
}
.qt-name h3{
        color: #fff;
        font-size: 25px;
        margin: 0 18px;
        margin-top: 6px;
        margin-bottom: -1px !important; 
        display: inline-block; 
        cursor: pointer;
}

/*---------------------------------------------------------------------------------
        >>> Toggle Button
----------------------------------------------------------------------------------*/
.toggler{
        float: right;
        display: inline-block;
        margin: 7px 13px 0 0;   
}
.toggle-button{
        font-size: 23px;
        border: none;
        background-color: #0096d6;
        outline: none;
}
.toggle-button i{
        padding: 5px;
        cursor: pointer;
        color: #fff;
}

/*---------------------------------------------------------------------------------
        >>> Top Nav Menu
----------------------------------------------------------------------------------*/
.qt-top-menu{
        position: relative;
        display: none;  
}
.qt-top-menu ul{
        width: 100%;
        height: auto;   
        background-color: #0096d6;
        text-align: center;
}
.qt-menu-item li{
        display: block;
        margin: 11px;
        margin-bottom: 18px;    
}
.menu-item-6{
        padding-bottom: 13px;
}
.qt-menu-item a{
        color: #fff;
        font-size: 18px;
        padding-bottom: 5px;            
}
.qt-menu-item a:hover{
        border-bottom: 3px solid #fff;
}

/*--------Sub Menu--------*/
.qt-sub-menu a{
        display: none;
}
.qt-sub-menu-item{
        background-color: red;  
        position: absolute;
        margin-top: 18px;
        display: none;  
}
.qt-sub-menu-item a{
        display: block;
        margin:  7px 10px;      
}
.qt-sub-menu:hover .qt-sub-menu-item{
        display: inline-block;
}

/*--------------------------------------------------------------------------------
        >>> Top Nav Icons
---------------------------------------------------------------------------------*/
.top-nav-icon{
        float: right;
        display: none;
        margin: 8.5px 20px 0 0;
}
.top-icon{
        color: #fff;
        font-size: 22px;
        margin: 0 10px;
        cursor: pointer;        
}
/*--------------------------------------------------------------------------------
        >>> Search Bar
---------------------------------------------------------------------------------*/
.search-bar{
        margin: 10px 55px 0 0;
        display: none;
        float: right;

}
.search-bar form{       
        display: inline-block;
        padding: 0;             
}
.search-bar-form input{
        padding: 7px;
        border: 2px solid #0096d6;
}
.search-bar-form input[type=submit]{
        color: #fff;
        background-color: #0096d6;
        outline: none;
        font-weight: bold;
        cursor: pointer;
        font-size: 15px;
}
.search-bar-form input[type=submit]:hover{
        background-color: #007db3;
        border-color: #007db3;
}
.search-bar-form input[type=text]{
        width: 200px;
        font-size: 15px;
}

/*--------------------------------------------------------------------------------
                                                                >>> Media Query <<<
---------------------------------------------------------------------------------*/
@media screen and (min-width: 768px) { 

/*---------------------------------------------------------------------------------
        >>> Toggle Button
---------------------------------------------------------------------------------*/
.toggler{
        display: none;
}
/*---------------------------------------------------------------------------------
        >>> Site Name or Logo
----------------------------------------------------------------------------------*/
.qt-name h3{
        margin: 0 30px; 
}

/*---------------------------------------------------------------------------------
        >>> Top Nav Menu
---------------------------------------------------------------------------------*/
.qt-top-menu{
        display: inline-block;
}
.qt-top-menu ul{
        height: 45px;
}
.qt-menu-item li{
        display: inline-block;
        margin-left: 18px;
        margin-right: 18px;
}
.qt-menu-item a{
        font-size: 20px;
}

/*--------------------------------------------------------------------------------
        >>> Top Nav Icons
---------------------------------------------------------------------------------*/
.top-nav-icon{
        display: inline-block;
}

/*-----------------------------------------------.--------------------------------
        >>> Search Bar
---------------------------------------------------------------------------------*/

}

@media screen and (min-width: 992px) {
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="robots" content="index,follow">
    <title>Quotesly | Quotes from the Heart</title>
    <meta name="description" content="Quotesly offers a huge collection of life-changing quotes by the world's greatest writers, including William Shakespeare, Steve Jobs, Helen Keller, and Mahatma Gandhi.
    ">

    <!---------------------CSS Stylesheet------------------>
    <link rel="stylesheet" type="text/css" href="style.css">

    <!-----------------------FontAwesome------------------->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

    <!----------------------Google Fonts------------------->
    <link href="https://fonts.googleapis.com/css2?family=Lato:wght@100;300;400;700;900&amp;display=swap" rel="stylesheet">

</head>
<body>
<div class="qt-wrapper">
    
    <!------------------------Nav Bar---------------------->    
    <nav class="qt-nav">

        <!--------------------Site Name-------------------->        
        <div class="qt-name">
            <h3 class="qt-name-text"><a href="#"></a>Quotesly</h3>
        </div><!--/Site Name-->

        <!-------------------Toggle Button-------------------->
        <div class="toggler">
            <button class="toggle-button" onclick="load_nav_menu()">
                <span onclick="load_cross()"><i class="fa fa-bars" aria-hidden="true" id="get-bar"></i></span>
            </button> 
        </div>

        <!-------------------Top Nav Menu------------------>
        <div class="qt-top-menu" id="load-top-nav">
            <ul class="qt-menu-item">
                <li class="menu-item-1"><a href="#">Home</a></li>
                <li class="menu-item-2"><a href="#">Authors</a></li>
                <li class="menu-item-3"><a href="#">Topics</a></li>
                <li class="menu-item-4"><a href="#">Picture Quotes</a></li>
                <li class="menu-item-5"><a href="#">Quotes of the Day</a></li>
                <li class="menu-item-6"><a href="#">Top Quotes</a></li>

                <!--Sub Menu-->
                <li class="qt-sub-menu"><a class="menu-item-7" href="#">More<i class="fa fa-caret-down fa-fw" aria-hidden="true"></i></a>
                    <div class="qt-sub-menu-item">
                        <a class="sub-menu-item-1" href="#">Topics</a>
                        <a class="sub-menu-item-2" href="#">Picture Quotes</a>
                        <a class="sub-menu-item-3" href="#">Quotes of the Day</a>
                        <a class="sub-menu-item-4" href="#">Top Quotes</a>
                    </div>    
                </li><!--/Sub Menu-->
            </ul>
        </div><!--/To Nav Menu-->

        <!---------------------------------Top Nav Icons------------------------------>
        <div class="top-nav-icon">
            <span id="top-search-icon" class="top-icon" onclick="load_search_bar()"><i class="fa fa-search" aria-hidden="true"></i></span>
            <span id="top-social-fb" class="top-icon"><i class="fa fa-facebook-official" aria-hidden="true"></i>
            </span>
        </div>
    </nav><!--/Nav Bar-->

    <!-----------------------Search Bar------------------------>
    <div class="search-bar" id="get-search-bar">
        <form action="" class="search-bar-form">
            <input type="text" placeholder="Search Quotes...">
            <input type="submit" value="Search">
        </form>
    </div>
</div>

<!------------------Custome JavaScript------------------>
<script type="text/javascript" src="js/main.js"></script>

</body>
</html>