vendredi 31 mars 2017

Random() instance in web farm

I'm running an application on multiple web servers that communicate with a distributed in-memory caching cluster, where I generate exclusive lock IDs on the application server -- the problem is that in high concurrency of parallel execution it is possible that more than one execution across all servers would generate the same pseudo random lock value.

The idea would be to initiate a single instance of the Random class per application pool using an incrementing seed within the distributed caching cluster, and to re-seed the randomizer after each helper method to generate a thread safe random number has reached a specific number of invocations.

Interested to see what thoughts you would have on this.




How can I center these menu items with CSS?

site: http://ift.tt/2nFeAOV

Hi, learning web developer student here. I am trying to center the menu items in the main menu to make it look more attractive, but I can't figure out how to do it with CSS! I've tried different floats, aligns, etc, but to no avail! The only thing I was able to do was to get it centered using a left margin on the first menu item, but when the site is viewed on mobile, the buttons are then too far to the right to be visible at all because of the margin.

I also want to make the text on the buttons look larger, but when I do that using CSS, for some reason it removes the last button from view on the menu (it completely disappears) when the page is loaded. But only when the page is loaded. Strange!

Any help would be appreciated if you could point me in the right direction. :)




How do you tell if an imported library ever gets use by the end user?

I'm pretty new to software but I have a strong stats background and naturally I want everything to tell me how useful it really is.

At my work we have a pretty large web app that makes calls for big files. I would really like to start paring down on what is called and used but I am not sure where to start because I am not sure what files are actually getting used.

We have millions of visitors that use our app every month. We are using Angular 1 and Foundations along with a bunch of other things. If it is possible I would like to track if a foundations or angular library is requested, the size of the file, and if it was used.

Has anyone done something similar to this before? I know how to check and see if a function is used but I'm not sure the best way to get started on something like this.

Sorry in advance for the noob comment. Give me a few years haha.




What is the method used for a user to be able to drag a picture around until is centered?

My application allows the user to upload a profile photo, and then use JAvascript to apply a class to make the image look as follows.

enter image description here

Where I ran into an issue is trying to apply the functionality so the user can drag and center the image around. Any idea how this is done ? are there any librabries to implement this functionality?




How to check java-script,which is in JSP function output in java servlet file or scriptlets

Here my aim is to submit this form to servlet, which will built process DB query. I have validated the mail using javascript. Normally when i click submit it will validate email and prompt user for false format of mail and simultaneously pass to servlet all information which make query and insert into DB. But the validation of mail gives false mail. So how can i pass javascript function value to servlet to to validate first and then built query and insert into database? We can use Scriptlet also.

Javascript:

function ValidateEmail(inputText) { var mailformat = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if(inputText.value.match(mailformat)) { document.text1.focus(); return true; } else { alert("You have entered an invalid email address!"); document.text1.focus(); return false; } }

jsp:
Sign Up

Provide code snippet of scriplet for solution.




Content not showing past iframe

i have a website and i want to embed a Youtube player as a background (full width and height) and i want to add a white bar with icons to act as buttons to activate the slider above the youtube player.

Here is a picture that may help me explain it. Design

But when i add code past my iframe tag it wont show up on my website and it doesn´t even show up at the source code at chrome.

HTML:

  <div class="video-container">
    <iframe class="ytplayer" width="853" height="480" src="https://www.youtube.com/embed/z9Ul9ccDOqE?loop=1&autoplay=1&modestbranding=1&autohide=1&showinfo=0&iv_load_policy=3&controls=0&playlist=z9Ul9ccDOqE" frameborder="0" allowfullscreen</iframe>
  </div>

CSS:

.video-container, #content{
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -10;
}
.video-container {
padding-bottom: 56.25%;
padding-top: 0;
height: 0;
}

.video-container iframe, .video-container object, .video-container embed {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: -10;
}
.ytplayer {
pointer-events: none;
position: absolute;
}



can`t parse with simple html dom

i have problem about parsing.here is my code

<?php 

include ('parse_dom.php');

$html = file_get_html('http://ift.tt/2fEmVOx');

$ret = $html->find('.productThumbImg img'); echo implode('',$ret);

?>

but output is nothing.




Debugging web-site not firing breakpoints using Edge

I have had this work in the past, but I'm currently experiencing a bizarre situation whereby I'm not hitting breakpoints on debugging using Edge.

Some points that I've established may be relevant during research (or just think are relevant):

  • I'm running under IISExpress
  • Works using Chrome
  • In internet options, I've disabled the "Disable script debugging" options for both IE and others
  • I am trying to debug typescript, but I get the same issue with a standard javascript file
  • I'm using VS2017
  • I am running in debug mode
  • I can hit the same breakpoint using F12 dev tools, so the code does get executed (VS also makes the breakpoint hollow, indiciating it knows it can't break there)

I feel like I'm missing something, after all, surely Edge is the one browser that should debug with VS.




How to structure web pages

What's the technique behind when pages on a website is structured like this? http://ift.tt/2mW8bBG

When looking in the code behind it is obvious that page in question is actually placed in the root (domain.com) and furthermore it is possible append anything to the URL (like http://ift.tt/2nrou5V) and yet it still returns the correct page?

I simply don't know what to google for.




There is a way to print pseudo code on a web application?

I am currently looking for a solution that can help me print pseudo-code on a web application.

Example

I found MathML Library, but it doesn't support this type of code.

Did some one worked or know a library that can help me with this matter?

Thank you!




How to log failed login attempts in my web application?

I have a web application which uses Weblogic. I want to login information in a log file. However, how to log failed login attempts? In the web.xml, I defined like this:

 <login-config>
    <auth-method>FORM</auth-method>
    <form-login-config>
        <form-login-page>/login-success.html</form-login-page>
        <form-error-page>/login-fail.html</form-error-page>
    </form-login-config>
</login-config>

Thank you very much.




How to get div right floated below another right floated div

i want to ask how can I move floated div below and not next to another floated div on same side. Sorry for my english, thanks.




How to make search bar with Javascript that finds text on page and highlights it

I am trying to make a site that has a lot of content on it, but I am still learning JavaScript and I do not know hot to find text that was entered into a search bar, then finds it on the page and highlights it. Extra bonus points if you make it so if you hit enter it searches too. ;P




Getting the "Loading" status from Elm's RemoteData package

Here is the simplest Elm program I can think of that uses the RemoteData package to better model server responses:

module App exposing (..)

import Http exposing (..)
import Html exposing (..)
import Html.Events exposing (..)
import RemoteData exposing (..)
import Debug exposing (..)

type alias Model = WebData String

init : (Model, Cmd Msg)
init = (RemoteData.NotAsked, Cmd.none)

type Msg = Ask | OnUpdate (WebData String)

view : Model -> Html Msg
view model =
    div []
        [ button [ onClick Ask ] [ text "ask" ]
        , text (toString model)
        ]


update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        OnUpdate response -> (log (toString response) response, Cmd.none)
        Ask -> (model,
                Http.getString "https://api.ipify.org"
                    |> RemoteData.sendRequest
                    |> Cmd.map OnUpdate)

subscriptions : Model -> Sub Msg
subscriptions model = Sub.none

main : Program Never Model Msg
main =
    program
        { init = init
        , view = view
        , update = update
        , subscriptions = subscriptions
        }

Even though the package has the states of NotAsked, Loading, Success and Failure, I never see the Loading status. When does this package ever send this status and how would I use it?




Reset database field values when active page is unloaded

In my app, I have a record locking mechanism that prevents two people from being in the Edit view of a record at the same time. Here is the function that locks the record when it is called up in the Edit view:

public function lockRecord($id = null) {
$this->loadModel('User');
$this->Model->id = $id;
$current = $this->Model->read(null, $id);

//Get the current logged-in user's ID
$userid = $current['Model']['requester_id'];

//Get the current lock expiry time
$lock_time = $this->Model->find('first', array(
  'fields'=>array('Model.lock_expiry_time'),
  'conditions'=>array('Model.id'=>$id)
  )
); 

//Get the ID of the user who has the record lock (if any)
$logged_user = $this->Model->find('first', array(
  'fields'=>array('Model.lock_key'),
  'conditions'=>array('Model.id'=>$id)
  )
); 

//Get that same user's full name
$full_name = $this->User->find('first', array(
  'joins' => array(
    array(
      'table' => 'recordtable',
      'alias' => 'Model',
      'type' => 'INNER',
      'conditions' => array('Model.lock_key = User.id')
      )
    )
  )
);
$this->set('lock_time', $lock_time);
$this->set(compact($current));
$this->set(compact($logged_user));
$this->set(compact($full_name)); 
if(AuthComponent::user('id') != $logged_user['Msr']['lock_key'] && date("Y-m-d H:i:s") < $lock_time['Msr']['lock_expiry_time']) {
  $this->Session->setFlash(__('This MSR is locked for editing by ' . $full_name['User']['full_name'] . '. Please try again in a few minutes or wait for this user to close the document.<br/>
    (Lock expires at '. $lock_time['Msr']['lock_expiry_time'] . ')'));
  $this->redirect(array('action' => 'view', $id));
} else {
  //Set a new lock key and expiry time if the record is free for editing
  $locksession = $this->Msr->query("UPDATE msrs SET lock_key = {$userid}, lock_expiry_time = ADDTIME(NOW(), '00:05:00') WHERE id = {$id}");
  $this->set('locksession', $locksession);
  }
}

When the user saves their changes, the unlockRecord function is called to release the key, reset the lock_expiry_time, and redirect the user to the "View" view:

public function unlockRecord($id = null) {
//Get a list of security groups
$groups = $this->Session->read('groups');
$this->Msr->id = $id;
//Reset the lock_key and the lock_expiry_time
$locksession = $this->Msr->query("UPDATE msrs SET lock_key = '', lock_expiry_time = '' WHERE id = {$id} ");
//If the module admin manually releases the lock, display a message
if(in_array('msr_module_admin', $groups)) {
  $this->Session->setFlash(__('The MSR has been unlocked and is available for editing.'));
}
$this->redirect(array('action'=>'view', $id));
}

There are three other conditions where the lock can be released:

--An administrator manually releases the lock by clicking a link.

--The user logs out of the system entirely.

--The lock expires five minutes after it is set.

I need the lock to be released any time the record in the Edit view is no longer active. For instance, if the user clicks off to another site or clicks a different link in my own site; anything that takes them away from the record they have open in the Edit view. lock_key should be set to '' and lock_expiry_time set to ''. How might I accomplish this?




Does not work svg image in a safari

The gradient of the image in safari is not displayed. In other browsers everything works fine. I can not understand the problem

  <svg width="32" height="26" viewBox="0 0 32 26" xmlns="http://ift.tt/nvqhV5">
  <title>Group</title>
  <defs>
    <linearGradient x1="50.04%" y1="100%" x2="50.04%" y2="0%" id="a">
      <stop stop-color="#C44B52" offset="0%"/>
      <stop stop-color="#D14D53" offset="13.02%"/>
      <stop stop-color="#E04F54" offset="34.09%"/>
      <stop stop-color="#E85055" offset="59.42%"/>
      <stop stop-color="#EB5055" offset="100%"/>
    </linearGradient>
  </defs>
  <g fill-rule="nonzero" fill="none">
    <path fill="#EB5055" d="M32 13H7.602L0 26h24.438"/>
    <path fill="url(#a)" d="M24.438 0H0l7.602 13H32"/>
  </g>
</svg>




what is 'client:auth2' in gapi.load('client:auth2',

Not able to understand what is this 'client:auth2' in gapi.load function. Few places I have also seen only 'auth2'. Where can I get the complete list of parameters possible there. How is this gapi.load function working??




How to fill the primeng

I´m trying to fill my datatable () with my firebase database content. But I don´t know how to use the *ngFor like I used in a normal table. The normal way is done:

<tr *ngFor="let docu of documentos | async">
  <td></td>
  <td></td>
  <td  ></td>
  <td  ></td>
  <td width="20%"><a class="btn btn-success" target="_blank" href="">Ver</a></td>
</tr>

It fills perfectly. But now I want to use PrimeNG

<p-dataTable [value]="" *ngFor='let docu of documentos | async'>
<p-column field= header="Nombre"></p-column>
<p-column field="year" header="Tipo"></p-column>
<p-column field="brand" header="Permiso de usuario"></p-column>
<p-column field="color" header="Permiso de grupo"></p-column>
<p-column field="color" header="Enlace"></p-column></p-dataTable>

My problen is [value], I don´t know how to fill an array with a FirebaseObservableList. I retrieve the the list with this:

documentos: FirebaseListObservable<any> = af.database.list('/Documentos');

af is my AngularFire on constructor.

Some ideas?




How to save AR object without indexing ElasticSearch in Yii2?

i am use ElasticSearch ext in my yii2 app. After $model->save() elastic save this model data to index. But sometimes my elastic server not working, and AR object saving with fatal Exception (Elasticsearch Database Exception) 'yii\elasticsearch\Exception' with message 'Elasticsearch request failed: 7 - Failed to connect to elasticsearch...'. How i can save my AR model without indexing. Something like this:

try {
  $model->save();
} catch(yii\elasticsearch\Exception $e) {
  // save $model without indexing by elastic
}




error: cannot find symbol - Web Service java

I am trying to develop a GUI on Netbeans using a web Service. When I try to run the GUI Frame, an error is displayed saying "error: cannot find symbol". The location of all files are correct and I have refreshed all web services, so this would not be an issue.

The code I drag and dropped into the main GUI frame from the web service java code is below:

private static String addEmployee(java.lang.String username, java.lang.String password, java.lang.String employeep, java.lang.String firstname, java.lang.String secondname) {
    bankserver.BankEmployeeServer_Service service = new bankserver.BankEmployeeServer_Service();
    bankserver.BankEmployeeServer port = service.getBankEmployeeServerPort();
    return port.addEmployee(username, password, employeep, firstname, secondname);
}

This method is then called into a Jbutton Action performed.

  try {


            if(validation() == true){

            username = usernameep.getText();
            password = passwordep.getText();
            String employeep = positionep.getText();
            String firstname = firstnameep.getText();
            String secondname = secondnameep.getText();

            addEmployee(username, password, employeep, firstname, secondname);



               usernameep.setText(null);
                passwordep.setText(null);
                positionep.setText(null);
                firstnameep.setText(null);
                secondnameep.setText(null);


        }
    } catch (IOException ex) {
        Logger.getLogger(employeesPage.class.getName()).log(Level.SEVERE, null, ex);
    }

The code I have in my actual web server is shown below:

     @WebMethod(operationName = "addEmployee")
     public String addEmployee(@WebParam(name = "username") String username,     
     @WebParam(name = "password") String password, @WebParam(name = "employeep") String employeep, @WebParam(name = "firstname") String firstname, @WebParam(name = "secondname") String secondname) {

           String newEmployee = username + "," + password + "," + employeep + "," + firstname + "," + secondname;

           try{
               FileWriter out = new FileWriter("C:\\Users\\Evisa\\Desktop\\University of Westminster\\2nd Year\\2nd Semester\\Client Server Architecture\\coursework\\BankGUI v1.1\\Users.txt", true);
                BufferedWriter bw = new BufferedWriter(out);
                bw.write(newEmployee + "\r\n");
                bw.close();

           } catch (IOException ex) {
        Logger.getLogger(BankCustomerServer.class.getName()).log(Level.SEVERE, null, ex);
    }

    return newEmployee;


}




Angular not binding data on html directly

I'm a beginner in Angular (ver 1.6.3) and i ran into this problem :

i have a controller called prof :

    (function ()
{
    'use strict';

    angular
        .module('app.prof', [])
        .controller('ProfController', ProfController);

    /** @ngInject */
    function ProfController($scope, Data)
    {
        var vm = this;

        vm.documents = Data.documents;
        vm.classes = Data.classes;
    }
})();

Here's its associated module :

    (function ()
{
    'use strict';

    angular
        .module('app.prof')
        .config(config);

    /** @ngInject */
    function config($stateProvider, $translatePartialLoaderProvider, msApiProvider)
    {
        // State
        $stateProvider
            .state('app.prof', {
                url    : '/prof',
                views  : {
                    'content@app': {
                        templateUrl: 'app/main/prof/prof.html',
                        controller : 'ProfController as vm'
                    }
                },
                resolve : {
                    Data : function(msApi){
                        return msApi.resolve('data@get');
                    }
                }
            });

        $translatePartialLoaderProvider.addPart('app/main/prof');
        msApiProvider.register('data', ['app/data/prof/prof-data.json']);
    }
})();

And here's the main problem : i have this html :

<div class="document" ng-repeat="document in vm.documents">
                <ms-card template="'app/custom-directives/prof-card/prof-card.html'" ng-model="document"></ms-card>
</div>

it works perfectly fine, the data is correctly binded and all, but when i put the template called directly in the page instead of calling it throught a <ms-card> it doesn't work anymore ! i've tried to put some console.log() a little eveywhere but it always says the data isn't defined; i don't get it. Plus, the ng-repeat always works fine

ps : when i add the html directly i don't forget to put the ng-model="document" but it still doesn't work

This is very confusing for me :/




jeudi 30 mars 2017

Need help to post multipart form data using the post method in VBA

I am trying to use an API to update an online database.

The API is hosted by a french site and the usage details are slim with no examples.

This is the information they have provided

The query must be sent as a "multipart / form-data" html form using the "POST" method. 
Input parameters: 
ssid : (type "text") user's ScreenScraper identifier 
sspassword : (type "text") ScreenScraper password of the user 
gameid : (type "text") numerical identifier of the game on ScreenScraper 
or 
romid ( "text") numeric ID of the Roma on ScreenScraper 

to propose a textual info: 
modiftypeinfo ( "text") type of information sent (see list "modiftypeinfo") 
modifregion ( "text"





<html>
  <head>
  <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
  <META http-equiv="content-language" content="fr"> 
  <title></title>
  </head> 
  <body> 
    <form name="myform" id="myform" method="post" enctype="multipart/form-data" action="http://ift.tt/2oeZemR"> 
      <input type="text" name="gameid" value="3"> 
      <input type="text" name="modiftypeinfo" value="description">
      <input type="text" name="modifregion" value="">   
      <input type="text" name="modiflangue" value="fr"> 
      <input type="text" name="modifversion" value=""> 
      <input type="text" name="modiftexte" value="ici, le synopsis du jeu ! ne pas valider, c'est un test ;)"> 
      <input type="text" name="modifsource" value="botProposition / source de l'info">
      <input type="submit" value="envoyer"> 
    </form>

  <script> 
    document.getElementById("myform").submit();
    </script>

  </body>
</html> 

This is the code I have put together:

Sub Post_Detail()

    Dim xmlhttp As Object, response As String, SendString As String

    Set xmlhttp = CreateObject("MSXML2.XMLHTTP.6.0")

    '~~> Indicates that page that will receive the request and the type of request being submitted
    xmlhttp.Open "POST", "http://ift.tt/2oeZemR", False

    '~~> Indicate that the body of the request contains form data
    xmlhttp.setRequestHeader "Content-Type", "text/html; charset=UTF-8"
    xmlhttp.setRequestHeader "enctype", "multipart/form-data"

    '~~> Send the data as name/value pairs
    SendString = "&type=text&name=gameid&value=185882"
    SendString = SendString & "&type=text&name=modiftypeinfo&value=genres"
    SendString = SendString & "&type=text&name=modiftexte&value=Sports"
    SendString = SendString & "&type=submit&value=envoyer"
    Debug.Print SendString
    xmlhttp.send SendString

    response = xmlhttp.responseText
    MsgBox response

    Set xmlhttp = Nothing

End Sub

I am not sure what to do with this part: form name="myform" id="myform" in the instructions and I am not sure if my request via building a string is even anywhere near correct.

You won't be able to run without a login, it will return a password invalid error.




Proper Asynchronous Request Handling - JS

I am making a food finding web application. The application makes two requests, the first is to the MapBox API to load a map and the second is to the Yelp Fusion API (through my node server). The through throttling testing I have found that the MapBox Call takes aproximately 1/2 the time to complete as the Yelp Call.

I am a bit confused how to manage the two requests. Do I load one and then the next? Do I load them both and then create two input functions to account for the Yelp loading first/ the MapBox loading first?

Thanks.




MainWindow Displays Black Instead of Image

I recently created a web browser with PyQt4 however when I try to insert an image background it displays black instead:

This complete code is here below: I tried using QPallete and SetStyleSheet methods, same problem.

from PyQt4 import QtCore, QtGui

try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(1269, 670)
        MainWindow.setAutoFillBackground(True)
        palette2 = QtGui.QPalette()
        palette2.setBrush(QtGui.QPalette.Background, QtGui.QBrush(QtGui.QPixmap("bg.jpg")))
        MainWindow.setPalette(palette2)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
        self.tb_back = QtGui.QToolButton(self.centralwidget)
        self.tb_back.setGeometry(QtCore.QRect(10, 20, 41, 31))
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/back.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.tb_back.setIcon(icon)
        self.tb_back.setIconSize(QtCore.QSize(32, 32))
        self.tb_back.setObjectName(_fromUtf8("tb_back"))
        self.tb_reload = QtGui.QToolButton(self.centralwidget)
        self.tb_reload.setGeometry(QtCore.QRect(60, 20, 41, 31))
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/reload.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.tb_reload.setIcon(icon1)
        self.tb_reload.setIconSize(QtCore.QSize(32, 32))
        self.tb_reload.setObjectName(_fromUtf8("tb_reload"))
        self.tb_forword_2 = QtGui.QToolButton(self.centralwidget)
        self.tb_forword_2.setGeometry(QtCore.QRect(110, 20, 41, 31))
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/forword.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.tb_forword_2.setIcon(icon2)
        self.tb_forword_2.setIconSize(QtCore.QSize(32, 32))
        self.tb_forword_2.setObjectName(_fromUtf8("tb_forword_2"))
        self.tb_home = QtGui.QToolButton(self.centralwidget)
        self.tb_home.setGeometry(QtCore.QRect(160, 20, 41, 31))
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/home.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.tb_home.setIcon(icon3)
        self.tb_home.setIconSize(QtCore.QSize(32, 32))
        self.tb_home.setObjectName(_fromUtf8("tb_home"))
        self.ln_addressbar = QtGui.QLineEdit(self.centralwidget)
        self.ln_addressbar.setGeometry(QtCore.QRect(210, 20, 491, 31))
        self.ln_addressbar.setObjectName(_fromUtf8("ln_addressbar"))

        self.ln_addressbar.editingFinished.connect(self.OnEditingFinished)
        self.tb_search = QtGui.QToolButton(self.centralwidget)
        self.tb_search.setGeometry(QtCore.QRect(710, 20, 41, 31))
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/icons/icons/search.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.tb_search.setIcon(icon4)
        self.tb_search.setIconSize(QtCore.QSize(32, 32))
        self.tb_search.setObjectName(_fromUtf8("tb_search"))
        self.webView = QtWebKit.QWebView(self.centralwidget)
        self.webView.setGeometry(QtCore.QRect(0, 60, 1261, 591))
        self.webView.setStyleSheet("background: transparent")
        self.webView.setUrl(QtCore.QUrl(_fromUtf8("https://www.google.ca")))
        self.webView.setObjectName(_fromUtf8("webView"))
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(_translate("MainWindow", "Neel\'s Web Browser", None))
        self.tb_back.setText(_translate("MainWindow", "...", None))
        self.tb_reload.setText(_translate("MainWindow", "...", None))
        self.tb_forword_2.setText(_translate("MainWindow", "...", None))
        self.tb_home.setText(_translate("MainWindow", "...", None))
        self.tb_search.setText(_translate("MainWindow", "...", None))

    def OnEditingFinished(self):
        self.webView.setUrl(QtCore.QUrl("http://"+self.ln_addressbar.text()))
        print("User has visited:" + self.ln_addressbar.text())

from PyQt4 import QtWebKit


if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    MainWindow = QtGui.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())




C# code injection

Did is the way to inject code into chrome web pages? I want inject my css code in everey pagess who will be displayed in Google Chrome// Sorry for my English

<style>
body{
background-color: black;
color:Green;
}
</style>




Responsive sub nav

Recently had a friend make me a website and trying to tweak it. Looking for a way to make sub nav menu not only responsive to device resolution but also dynamic to menu text inserted in it. Website live at fenstar.us




Update web api record with knockout.js

I have this method in controller:

// PUT: api/Books/5
        [ResponseType(typeof(void))]
        public async Task<IHttpActionResult> PutBook(int id, Book book)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != book.Id)
            {
                return BadRequest();
            }

            db.Entry(book).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BookExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }

I have this method in Knockout.js

self.PutBook = function (item, book) {
        ajaxHelper(booksUri + item.Id, 'PUT').done(function (item) {
            self.books.put(item, book);

        });
    }

I want to update record with values that are entered in frontend input fields. What is missing in knockout.js? I'm not able to solve it.




Golang route not working

I just started to get into golang and as I plan to host at least two websites, I chose to use Mux to display different routes by "filtering" domains. Whenever I try to access my main route, it just gives me an 404 error. (Also, the fact that the "www" part is absent is perfectly normal. I don't type that to access the site).

But if I launch the server as a file server, I can access my files, so the server in itself is working I guess

func redirect(w http.ResponseWriter, req *http.Request) {
    target := "https://" + req.Host + req.URL.Path
    http.Redirect(w, req, target,
        http.StatusTemporaryRedirect)
}

func main() {
    go http.ListenAndServe(":80", http.HandlerFunc(redirect)) // Redirection

    // Serveur sécurisé

    r := mux.NewRouter()
    r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("/root/go/src/web/static/"))))
    s := r.Host("echecderi.me").Subrouter()
    s.HandleFunc("/", indexEchec)

    http.ListenAndServeTLS(":443", "domain-crt.pem", "domain-key.pem", nil)
}

func indexEchec(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "<h1>Echec de rime</h1> </br> <img src=\"/static/echecderime/echec.gif\">")
}




Implementation of Map geography in SO Developer survey 2017

I just liked map in geography cat on SO survey 2017.

http://ift.tt/2nTOkzV

Which API / Library is used? Can we also add a small image inside each hover?




Django. Adding objects that have two foreign keys to the same class

my problem is that when you want to add objects to a class that contains two foreign keys to other (equal) classes. First add an object of the class to which the foreign key refers. And when you want to select the same object but in another field, it does not appear.

models.py

class Team(models.Model):
     name = models.CharField(max_length=255)

class Match(models.Model):
     home = models.ForeignKey(Team)
     away = models.ForeignKey(Team)

So .. How do I do if I want local and away to be the same teams without having to update the admin page when I create the local team?

Thanks!

Agu




Content in Bootstrap Collapsable

I have a question about using the Bootstrap Collapse, the basic collapsible.

I am wondering if there is any limit to the content (text, images, videos) that you can put inside?

This is what I am looking at: http://ift.tt/2ocQwpd




Web Audio API workflow

I am looking for creating a skeleton app for the following workflow with Web Audio API similar to a mp3 online converter:

  • upload a large file
  • process the sound
  • notify so it can be uploaded

Is XMLHttpRequest supports large files? Is there a way to develop my sound processing with local files (loads my local file, process it and render a processed one)?

Thanks for any tip.




Radio buttons Responsive Web Design (HTML, CSS)

i have 4 radio buttons and an image as a background. Every radio button i want to be in a specific place of image and do not move. I want responsive web design but when i change the scale of the window all the radio buttons move out of their position. this is the code i have

.island{

 background-image: url("nhsia.png"); 

 position: relative;
 width: 100%;
 height: 550px;
 background-image: url("nhsia.png"); 
 background-repeat: no-repeat;
 background-size: contain;
 }


#radio1 {
 position:absolute;
 left:7%;
 top:17.5%;
}

#radio2 {
position:absolute;
left:15.5%;
top:15%;
}

#radio3 {
position:absolute;
left:40%;
top:28%;
}

#radio4 {
position:absolute;
left:56%;
top:37%;
}




Docker How to connect to MongoDB from Web Service inside Container

Currently I want to setup a Linux Server with MongoDB and a WebServer which saves stuff inside this DB. I need them both to run inside Docker containers.

My problem is that my WebServer doesnt seem to "see" the MongoDB from inside its container.

What ive tried so far is: run MongoDB with

docker run -p 27017:27017 -v... repoimage

it initializes fine and I can access this DB through the mongoshell without any problems. Also the Webserver can access the DB if it DOESNT run in a container but just on the host as java application.

When I try now to run the server through a container I get a java exception saying "Connection refused" (which is thrown when he cant open the socket)

(Important: the server accesses the mongodb through "localhost")

I thought that container networks are "linked" together. Does anyone have the same problem?




How to get focus of textarea in dotnetbrowser?

I am looking through the samples and I have got solution for focusing on dom element using tab.I am trying to focus on textarea which is on site, so i had used virtual Tab key press to find that particular textarea and its working correctly. But can anyone suggest how to directly focus on textarea. I also used excuteJavascript function but its not working.




Which cloud host provider would be best suited for my application?

I have an application which has heavy network and CPU requirement. The load could vary over time. Which cloud host provider would be best suited for my application?




File Extension in robots.txt when using mod_rewrite

When I use mod_rewrite in my .htaccess to rewrite all example.com/page.php to example.com/page, and I want to disallow certain pages in the robots.txt, do I write Disallow: /page.php or Disallow: /page? If it's the latter, I'd also use Allow: /$ to refer to the index.php, right?




Additional authentication for Wifi connection in LAN?

I have wifi .When user tries to connect to wifi it should be redirected to login page for additional authentication like username and password. How can i do that? Any help will be appreciated.




Best way to handle long-running tasks on a web server

For the past few days I've been googling about how should I handle long running tasks on a web server. I have found a lot of good answers of how to run them in a specific language, but not what languages to choose for this kind of job.

So, I have a web server which is running some kind of custom e-commerce platform. There is another server where some products dostributor is providing access to its data through API. I have to sync products list across these two servers. Product base is pretty big (about 100000 products).

My Idea was to write php script which collects data from various API endpoints and updates database accordingly. But it gonna take a long time, so without hard modofications and deep-diving to php itself it will timeout.

Now I'm thinking, maybe I should write python script which goes through API endpoints and collects data about each product. After data about product is collected python script could initiate php script which could update data in database about that particular product..

What are your toughts about it? What would be the best way to handle it?




Loading a JSON file vs querying MongoDB

It is a performance question - I created a web app (in Node.js) that loads a JSON file that has around 10 000 records and then displays that data to the user. I'm wondering if it would be faster to use (for example) MongoDB(or any other noSQL database, CouchDB?) instead? And how much faster would it be?




How do DNS record work

Ce résumé n'est pas disponible. Veuillez cliquer ici pour afficher l'article.


add slash to end of url htaccess

I have url http://localhost/sw-trainit/index.php http://localhost/sw-trainit/tutorial.php http://localhost/sw-trainit/detail.php?page=html&url=how-to-create-table-using-html

how can my url become http://localhost/sw-trainit/ http://localhost/sw-trainit/tutorial/ http://localhost/sw-trainit/html/how-to-create-table-using-html/




Tomcat Bad-Response (White page) for few users

I got a Problem with my Java Webpage. I just allow access over Port 443/HTTPS which is unblocked by the Firewall.

For most of the users the access to the page works fine: Accesslog:

"GET /test/ HTTP/1.1" 401 994
"GET /test/ HTTP/1.1" 200 2176
"GET /test/VAADIN/widgetsets/com.vaadin.DefaultWidgetSet/com.vaadin.DefaultWidgetSet.nocache.js?1490798129908 HTTP/1.1" 200 3295
"POST /test/?v-1490798129909 HTTP/1.1" 200 10346
"GET /test/VAADIN/themes/valo/fonts/open-sans/OpenSans-Light-webfont.woff 
HTTP/1.1" 304 -
"GET /test/VAADIN/themes/valo/fonts/open-sans/OpenSans-Regular-webfont.woff HTTP/1.1" 304 - 
"GET /test/VAADIN/themes/base/fonts/fontawesome-webfont.woff HTTP/1.1" 304 - 
"GET /test/VAADIN/themes/valo/fonts/open-sans/OpenSans-Semibold-webfont.woff HTTP/1.1" 304 -
"GET /test/VAADIN/themes/base/fonts/themeicons-webfont.woff HTTP/1.1" 304 -

Now somehow some users just gets a Blank-Page with the Tomcat Favicon:

"GET /test/ HTTP/1.1" 401 994
"GET /test/ HTTP/1.1" 400 -
"GET /test/ HTTP/1.1" 401 994
"GET /test/ HTTP/1.1" 400 -
"GET /test/ HTTP/1.1" 401 994
"GET /test/ HTTP/1.1" 400 -
"GET /test/ HTTP/1.1" 401 994
"GET /test/ HTTP/1.1" 400 -

Tomcat Version 8.0.41

Vaadin Plugin V3.0.0 in Eclipse




Rule for route and on "." or "/"

I want to configure url manager . I need if route match /deti/festival. or /deti/festival/ Yii enable Deti controller and festival action, but now for this requests yii return 404 , what's wrong? If i use option 'suffix'=>'/' rule /deti/festival/ work , but other rules don't work . What i must do ?

'urlManager'=>[
        'class' => 'yii\web\UrlManager',
        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'rules'=>[
            'messages' => 'lk/default/messages',
            'students' => 'lk/student/index',
            'ulogin/ulogin' => '/reg/ulogin/ulogin',
            'ulogin/auth' => '/reg/ulogin/auth',
            'lk/anketa/auth' => '/lk/auth/auth',
            'lk/anketa/logout' => '/lk/auth/logout',
            'deti' => '/deti/deti',
            'festival'=>'/deti/deti/view?id=562',
            '/deti/festival'=>'/deti/deti/festival',
            '/deti/eco'=>'/deti/deti/eco',
            '/deti/festival[.\/]?'=>'/deti/deti/festival',
            '/deti/eco/'=>'/deti/deti/eco',
            '/profile/exhview.php'=>'/exhibitions/default/old',
            '/profile/user.php'=>'/profile/profile/old'
        ]
    ]




django - Find max using two foreign keys, and using __in

I am pretty new on Django and Python and I have a problem. Here are my models :

class Similarity(models.Model):
    score = models.FloatField(max_length=10) 
    mother_fk = models.ForeignKey('MotherCompound', on_delete=models.CASCADE)
    father_fk= models.ForeignKey('FatherCompound',on_delete=models.CASCADE)

Using this view (only the important part) :

mothers =XXXXX_set.all() #queryset of mothers
fathers =XXXXX_set.all() #queryset of fathers

couple= Similarity.objects.filter(mother_fk__in=mothers,father_fk__in=fathers)

At the end, I will have a table of this shape, different combinations between these two foreign keys.

  • M1/F1 = 1.0
  • M1/F2 = 0.9
  • M2/F1 = 0.6
  • M3/F1 = 0.5
  • M2/F3 = 0.3
  • M3/F2 = 0.1

I want depending of the min(len(mothers),len(fathers))( let's say "3") to obtain three couple of Mother/Father with this filter :

You look for the best score where a mother and a father is involved in.

I mean, a mother and a father can be involved on different combination, but I want to display only one example of them based on the best score.

On this example, final output should be :

  • M1/F1 = 1.0
  • M2/F3 = 0.3
  • M3/F2 = 0.1

My question is, is it possible to make it in one line, within the query, or if after the query line , I have to make a loop and try to find the max for each mothers and fathers. In both case, I would like to have am example to follow because I am struggling since days on this problem.

I hope it will be clear, if not , do not hesitate to ask me more details. Thank you.




Best website designer for my needs

Good Day All.

I am a SQL dev. And want get my own website.

Of course I want it to work dynamically with a database but also look really nice.

Is there some nice software I can use to this. Nice in sense of "Drag and drop"

but can still look great and work with database to show graphs and store details.




I want to create a web site to "Hire engineers"

All I'm a IT student who passionate about web site designing & development. I want to create a web site "Hire Engineers" to choose different kind of engineer to different projects.Like Network,Civil,Electronic etc. for that 1.what kind of language i should use?(is PHP good?) 2.Is it better to use a framework or CMS? 3.where can I find sample templates to take ideas regarding this project? thank you!




How to query a list of registered user accounts on a website in Java?

I'm writing an app for android and ios mobile devices. The app needs to talk to a website that another developer is working on: My app will have a username/password field that needs to be filled in before proceeding.

I have the contact details of the web developer but I am kinda new to this (getting deeper data from a website, more than just html-scraping) So how do I make a request to a website and get -say- a list of registered user accounts on a website? What kind of info do I need to ask the guy making the website?




Redirecting non-existing paths to a specific page

I am trying to redirect users who browse paths that doesn't exist to another page I set. Example: site.com/dhdhshs will redirect users to a specitic page because the path is not available. How can I do this, also what kind of file should I create or edit on the webserver? Thanks




Raw Update Query inside a while loop in Django Python

Ok im new to python especially django so please be easy on me.

i just want to iterate through my resultset per row, then use its values for update query inside the while loop. so far i have this code.

def orprocesspost(request, pk):

cursor = connection.cursor()
#this query returns 2 rows
cursor.execute('select ord_recno, orm_recno, account_code, debit, credit, created_by, posted, remarks, origin, sort_order from or_details where orm_recno=%s', [pk])

row = cursor.fetchone()

while row is not None:

    cursor.execute('update general_ledger set dr_bal = dr_bal + %s, cr_bal = cr_bal + %s where gl_code = %s',[row[3],row[4],row[2]])
    row = cursor.fetchone()

if i remove this line cursor.execute('update general_ledger set dr_bal = dr_bal + %s, cr_bal = cr_bal + %s where gl_code = %s',[row[3],row[4],row[2]])

the loop executes fine and i can see the second row being read

but when i try to use the update query it only updates 1 row... i don't know whats happening here. i've been searching for the solution for hours..

by the way i followed this tutorial Fetching row by row from MySQL in Python

Thanks and regards




Using Office Add-In I want to place shape on active slide of power point

I am working on one project where User is provided with different Powerpoint templates and based on user selection - shapes will be added to powerpoint slide. This I could achieve quickly and with no issues in VSTO Add-Ins. But I want to place this add-in for sale on Office Store - I need to support Office 2013 and Office 2016. So I had to move from VSTO Add-In to Web Add-In.

Now I need help in converting below code of CSTO Add-In to Web Add-In.

    private void addShapeToSlide(Microsoft.Office.Interop.PowerPoint.Shape newshape, Microsoft.Office.Interop.PowerPoint.Shape shape)
    {
        //newshape.BackgroundStyle = shape.BackgroundStyle;

        newshape.Fill.ForeColor = shape.Fill.ForeColor;
        newshape.Fill.BackColor = shape.Fill.BackColor;

        if (shape.Fill.GradientStyle != MsoGradientStyle.msoGradientMixed)
        {
            newshape.Fill.TwoColorGradient(shape.Fill.GradientStyle, shape.Fill.GradientVariant);

            newshape.Fill.Background();
        }

        newshape.Fill.Transparency = shape.Fill.Transparency;
        newshape.Glow.Color.RGB = shape.Glow.Color.RGB;

        newshape.Name = shape.Name;

        newshape.AnimationSettings.AnimateBackground = shape.AnimationSettings.AnimateBackground;


        newshape.Shadow.Blur = shape.Shadow.Blur;
        newshape.Shadow.OffsetX = shape.Shadow.OffsetX;
        newshape.Shadow.OffsetY = shape.Shadow.OffsetY;
        newshape.Shadow.RotateWithShape = shape.Shadow.RotateWithShape;
        newshape.Shadow.Size = shape.Shadow.Size;
        if (shape.Shadow.Style != MsoShadowStyle.msoShadowStyleMixed)
        {
            newshape.Shadow.ForeColor = shape.Shadow.ForeColor;
            newshape.Shadow.Style = shape.Shadow.Style;
            newshape.Shadow.Transparency = shape.Shadow.Transparency;
        }

        if (shape.Type != MsoShapeType.msoPicture)
        {
            newshape.TextEffect.FontName = shape.TextEffect.FontName;
            newshape.TextEffect.FontSize = shape.TextEffect.FontSize;
            newshape.TextEffect.FontBold = shape.TextEffect.FontBold;
            newshape.TextEffect.FontItalic = shape.TextEffect.FontItalic;
            if (shape.Type != MsoShapeType.msoGroup)
            {
                newshape.TextFrame.TextRange.Font.Color.RGB = shape.TextFrame.TextRange.Font.Color.RGB;
                newshape.TextFrame.TextRange.Text = shape.TextFrame.TextRange.Text;
            }
        }
        else
        {

            //Image a = shape.CanvasItems.Background
            //newshape.CanvasItems.AddPicture()
        }
        newshape.Visible = shape.Visible;
    }

I won't mind even if I get some pointers. I could explore and findout that I have to use "Office.context.document.setSelectedDataAsync" method for placing images but I am not getting anything for placing different shapes.

You help will be greatly appreciated.




Redirect website to WWW apache .htaccess

I want to redirect kwikku.com to www.kwikku.com

What should I add in my .htaccess?




mercredi 29 mars 2017

Filter objects from another in django admin

In the django admin when the user adds an animal, I need to only see the "troops" that belong to the "farm" when selecting the "farm" field in the "troop" field. That is, respect the foreign key.

class Troop(models.Model):
    name = models.CharField(max_length=255)
    farm = models.ForeignKey(Farm)

class Farm(models.Model):
    name = models.CharField(max_length=255)

class Animals(models.Model):
    rp = models.CharField(max_length=50)
    name = models.CharField(max_length=50)
    farm = models.ForeignKey(Farm)
    troop = models.ForeignKey(Troop)

Thanks




Fetching dynamic content from URL in Java

I need to fetch some content from Web page (http://ift.tt/2nB8DnQ) in Java. What I need exactly are live results of currently going tennis matches. The problem is that results, as you can see, load dynamically (after 2 secs after loading a page), so InputStream from HTTPUrlConnection returns only a first version of page (before it loads dynamic content in itself).

Are there any ways to fetch content that's loaded dynamically by webpage after some time? (I'm bad in Web programming so I'm not sure what part of website loads dynamic data - JS or something else). Without any browser emulators, if it possible, of course.

Thank you!




Paper Input element doesn't work in Polymer 2

I'm working with polymer 2, I download polymer paper input elements, then i add the link tag:

<link rel="import" href="../bower_components/paper-input/paper-input.html">

then:

<paper-input  label="Floating label"></paper-input>

And the browser not showing the input text element

I'm working with the last version of chrome 56.0

Thanks for the help




Servlet error in doGet when POST request

I'm building a website with a chat using a Tomcat server. For that chat, I've got a form (with text input) that calls a JS function, that performs a jQuery POST request...

<!DOCTYPE html>

<html>
<body>
    <form method="post" action="javascript:submitNewMessage()" accept-charset="UTF-8" id="msgForm">
        <input type="text" name="msg" id="msgField"/>
        <input type="submit" name="submit" value="Send"/>
    </form>

    <script src="jquery.js"></script>
    <script>
"use strict";

function submitNewMessage() {
var msg = document.getElementById("msgField").value;
$.post("chatController", {message:msg, author:"${user.username}", gameId:"${game}", chat:"${chat.type}"});
}
</script>
</body>
</html>

... to this controller, chatController.java :

@WebServlet(urlPatterns = {"/chatController"})
public class ChatController extends HttpServlet {

protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    request.setAttribute("user", new User(request.getParameter("user")));
    request.setAttribute("game", Integer.parseInt(request.getParameter("gameId")));
    request.setAttribute("chat", new ChatRoom(ChatRoomType.fromString(request.getParameter("chat"))));
    request.setAttribute("lastMessage", 0);

    request.getRequestDispatcher("/WEB-INF/chat.jsp").forward(request, response);
}

protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    try {
        ChatDAO dao = new ChatDAO(this.ds);
        if (dao.submitMessage(...) // not implemented yet, returns false) {
                throw new ServletException();
            }
    } catch (Exception e) {
        response.sendError(400);
    }
}
}

The GET of chatController is used when the user joins the chat, and then only POST is used to submit messages. When I join the chat page, no error. But when I submit a message, the debugger (of Firefox) tells me XML parsing error : no element found at line 1. The HTML returned by chatController contains a Java error in the doGet method (NumberFormatException: null, at the 2nd line of doGet, where I do Integer.parseInt).

Why is the doGet method called here ? I do a POST request on chatController... And when I print something in doGet, it doesn't appear in the log : so why is that line throwing an error ? What's wrong with that code ?

Thanks for any help.




Web Scraping with Python (city) as parameter

def findWeather(city):
  import urllib

  connection = urllib.urlopen("http://ift.tt/2o8oqLP")
  rate = connection.read()
  connection.close()
  currentLoc = rate.find(city)
  curr = rate.find("currentDegree")
  temploc = rate.find("</span>", curr)
  tempstart = rate.rfind(">", 0, temploc)
  print "current temp:", rate[tempstart+1:temploc]

The link is provided above. The issue I have is everytime I run the program and use, say "Brussels" in Belgium, as the parameter, i.e findWeather("Brussels"), it will always print 24c as the temperature whereas (as I am writing this) it should be 19c. This is the case for many other cities provided by the site. Help on this code would be appreciated.

Thanks!




what is the difference between IDE online like WIX and the other normal IDE's like visual studio and atom

WIX is online editor and it's much easier to design a website on wix without learning codes and programming stuff , so why we learn codes and programming if such a web development online exists




How do i run nodejs apiai in runkit

http://ift.tt/2nhnfp4 I am not getting exactly happens when run this code in runkit. Can anyone help me to understand the process, Advance thanks !




How to scrape non-text items using JSoup

I have viewed all the posts on scraping text and titles and whatnot from a webpage, but I was wondering if there is any way to scrape other elements from a page. Specifically a button with a price inside it, or a slider, or things of that nature.

Thanks!




internal site search and return results in separate web page

Hello and thanks for your help in advance.

I want to make an internal search capability on my web site.

A user enters a keyword in the search field and after they press enter, the result are shown on a separate web page. So if someone enters the word cat, all the web pages on my web site will be populated in a list with hyperlinks to the pages. I want this to only search my site, no google search engines.

I want to make this in the simplest way possible to php no python, just javascript.

I attempted to make it happen but this code just takes me to a page that has the word i searched for on it.

<div id="widget-user">

    <form id="siteSearch" method="get" action="http://ift.tt/1qlTgqT">
        <input type="text" id="searchInput" name="q" maxlength="20">
        <input type="submit" value="Search">
    </form>

    <script>

        var a = document.getElementById("siteSearch");
        a.addEventListener("submit", function(event) {

            event.preventDefault();
            var b = document.getElementById("searchInput").value;
            window.location.href = "http://ift.tt/1qlTgqT" + b;

        });

    </script>




Technologies used for embedding Graphs in HTML

Please tell me what Web technologies are used to build this graph hosted on the Bloomberg website. Is it an API that anyone can use? Or is it proprietary and not commercial?
I am looking for a powerful API for creating interactive graphs similar to this one.




using angular 2 cli after starting the project without it.

I've Started a project with Angular 2 and built some modules and components without angular-cli. Now I want to continue the project from this point with cli, is there any way to adjust the old features to the cli or should I start everything from scratch?




Web Based 3D map

We need to make a web based map where a small area off a city is displayed in 3d. The Buildings need to be clickable or at least when you hover over them it needs to be different then the other buildings. We don't know anything about 3d maps on a website so does anybody know a good program which could be used.

Thanks!




A good tool for webdesign (windows)?

During my last site development process i realized that I reinvent the wheel every time I make a template. 1) I draw it in PS 2) I "draw" it again in CSS and HTML code.

I wounder if there any tool like Photoshop but for websites design? To end up with ready css+html template instead of just a "picture".

I've found a number of mobile app design tools, but couldn't find any modern app for webdesign:(




Broken image but path is correct

My file directory

This is a picture of my file directory. When I try to add the image to my index file with the proper path, I keep getting an error telling me the image is not found. The image is there and this doesnt make sense... What could be a possible issue with it besides the path?




UI Design for online text-processing

I need to write a thesis about web design principles and all, but I have to focus on on-line text-processing/analytics tool interface design. I have tried to search books or anything focused on the text part, but haven't succeeded. All material is about web design and generally UI design, but nothing I need.

I would be really thankful if anybody can recommend me some literature, articles or something I could use.




Is it best to use width 100% or width auto when styling form input with css?

Is it best to use width 100% or width auto when styling form input with css?




How do I set the TLS version of my SPA?

Fastly is deprecating TLS versions less than 1.2; I want to make sure my users can still pull content from the CDN. How can I, as a Frontend Engineer, set the version of TLS that connecting user-agents are using?




Get caller's phone number into web application using landline modem

I've been looking a lot for a solution, I'm working on a Taxi Dispatching system for an office that gets calls from customer using landline phone to place orders, what am trying to achieve is to get the caller's phone number and place it in an input field, is that possible?




How to simulate a button click using HttpClient

I am trying to navigate to a REST API, however the owner of the web page has inserted an HTML message page in front of the REST API URL. So, when I make the request to the REST API, instead of being returned the XML file that I requested, I get back an HTML page that has some informational message on it, and requires a button click to acknowledge the message.

The button itself, when inspected with Fiddler, shows no onclick event:

<div class="dialog-buttons">
    <button id="frmMessages:btnAcknowledge" name="frmMessages:btnAcknowledge" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="" title="Acknowledge and continue" type="submit">
        <span class="ui-button-text ui-c">OK</span>
    </button>
</div>

I am not able to navigate directly to the page where the button-click sends you, because it doesn't send you anywhere, it just acknowledges that you clicked the button, and closes the message.

I am trying to simulate this button click. I have tried using a System.Windows.Forms.WebBrowser class, but I have not been able to load my resultContent into the Browser, the DocumentText property remains empty, so when I try to invoke the button click, I get a null reference exception.

System.Windows.Forms.WebBrowser b = new System.Windows.Forms.WebBrowser();
b.Navigate("about:blank");
HtmlDocument doc = b.Document;
doc.Write(string.Empty);
b.DocumentText = resultContent;
var resp = b.Document.GetElementById("frmMessages:btnAcknowledge").InvokeMember("onclick");

It seems to me that the owner of the web page screwed something up here by inserting the HTML message page in front of a REST API call, and I have contacted them about that, however between now and when they can fix it (if it is even an issue to them) I need a method of bypassing this message box.




Onesignal could not load iframe error

Iam having issues after I changed the subdomain of my app, it was working the day before but now it doesn't it shows me the message

OneSignal: Could not load iFrame with URL http://ift.tt/2o6GLJd. Please check that your 'subdomainName' matches that on your OneSignal Chrome platform settings.

<script>
  var OneSignal = window.OneSignal || [];

  var OneSignal = window.OneSignal || [];
  OneSignal.push(["init", {
    appId: "MyAppID", // copied correctly the UUID
    autoRegister: false, /* Set to true to automatically prompt visitors */
    subdomainName: 'acacito',
    httpPermissionRequest: {
      enable: true
    },
    notifyButton: {
        enable: true /* Set to false to hide */
    }
  }]);
</script>

I have been trying to make it work deleting cookies or any data related that could be stored in the browser and it doesn't work. Also reloading with Ctr+Shit+r, not sure what happens.




How to get the streetname and city when user fills in zip code

I just took a look at www.wehkamp.nl (dutch only). When you try to make an account you can fill in your zip code (postcode) and it will automatically give you your city and street name. I knew this would be possible because most streets have it's own zip code. I have found some examples of automatically filling in country and city name when a user fills in his zip code. But none of street name + city name.

This is what Wehkamp returns when I fill in a zip code.enter image description here

The bottom text is even telling the user that housenumber 139 does not exist on the filled in zip code.

Does anyone know if there is a special technique for this?




Monitor a web page for changes in Javascript

I am currently developing a Chrome Extension for my school which will notify students when the school's website is updated. I have already figured out how to tell chrome that i am going to make cross-origin requests. But I am stuck at trying to get the request. I have the following code in bg.js:

var checkUrl="http://ift.tt/2og5hEU";
var firstCheck = false;
window.setInterval(checkForUpdate, 10000);
var pageLoad = new Date().getTime();

function checkForUpdate() {
$.ajax(checkUrl, {
    ifModified : true,
    type : 'HEAD',

    success : function (response, status, xhr) {
        if (firstCheck === false) {
          firstCheck = true;
          return;
        }
        console.info(response);   //ALWAYS outputs 'undefined'
        console.info(status);     //ALWAYS outputs 'undefined'

        // if the server omits the 'Last-Modified' header
        // the following line will return 0. meaning that
        // has not updated.

        var lastModified = new Date(xhr.getResponseHeader('Last-Modified')).getTime();

        console.info(lastModified);//ALWAYS outputs 0

        if (lastModified > pageLoad) {
          alert("modified TEST"); //Will change later
        }
    }
});
}

And this manifest.json:

{
"manifest_version": 2,
"name": "Hyperion",
"version": "0.0.1",

"description": "TEST",
"icons": {"16":"icons/icon16_chk.png"},
"background": {
  "scripts":["javascript/jquery-3.2.0.min.js","javascript/bg.js"],
  "persistent":false
},

"permissions":["http://*/", "https://*/"],

"browser_action": {
  "default_icon":"icons/icon16_chk.png",
  "default_title":"Nothing has changed!"
}
}

Why is the request and status always 'undefined' and why can i not see the Last-Modified header in the response

Any help would be appreciated! //Oskar




How to make Jsoup fetch the desktop version of a URL

I'm trying to scrape web-pages for their meta-data using JSoup in an Android app, but it's ending up downloading mobile versions for websites. Is there a way to make websites believe that the request is coming from a desktop client?




random password that contains an html tag fails to log in

Is there a reason why a randomly generated password, if it contains something resembling an html tag (i.e. something like "hunter<*(&#@sqe/>2"), would be usable to register with a website, but not be usable to log in? What kind of problem on the back end would that be indicative of?

This isn't a problem with my own code, but rather with a website I'm trying to use. I have basically zero experience with web dev (and it's their job to fix the problem), but I'm curious what this means.




Why image TTFB gets higher always on full page load, but not on single image request

I have a very simple e-commerce site that shows like 50 images on its home page, in a list of products.

This site is on a stage server, not production, so it's not under load. Resources are pretty high, 32 GB of RAM and 16 core of CPU and stuff. The point is, we test this on a very dedicated server, with only one client browser. So, slowness can't be because of the resources of the server.

But the problem is that, when we refresh our site's home page, we see that images' TTFB gets close to a second, while each image is loaded separately will only be server in less than 100 ms of TTFB.

We know that it's related the batch operation somewhere. Either in Browser as User Agent, or on the server. But we know for sure that it's not related to server resources. There must be some sort of configuration somewhere that prevents this.

How to debug this issue? We're using .NET platform, and Windows server, and IIS.




tomcat deploy module war to sub url path

I have a multi-module maven project whose structure looks like this:

app                // parent/root project folder
 |- src         
 |- target
      |- app.war   // common features
 |- app-payment    // child/module folder
        |- src   
        |- target
             |- app-payment.war  // shop/pay features

How can I map the two war files to urls like below?

requests for    
   localhost:8080/app/payment   --goto-->   $CATALINA_HOME/webapps/app-payment.war (or any other locations, doesn't matter)
other requests for
   localhost:8080/app           --goto-->   $CATALINA_HOME/webapps/app.war

The web.xml -> <servlet-mapping> both are <url-pattern>/</url-pattern>.

I'm using tomcat 8.5 and want to keep default settings if possible (e.g., do not add <Context> in server.xml, leave autoDeploy=true). So probably the approaches provided in A word on Contexts at http://ift.tt/2nL5N06 would not work (have tried anyway and no).

In case this turns out to be an XY problem...Is it the right way to use/modify tomcat to achieve such url pattern? Or should I change the project settings (or design)? It's a spring-mvc project and the whole spring-*.xml thing is like a myth...




How can I get data from diferents pages with javascripts buttons?

I have the following HTML:

<div class="pagination pagination-centered">
    <ul>
              <li class="active">
          <a class="page" data-page="1" href="javascript:void(0)">
            1          </a>
        </li>
              <li >
          <a class="page" data-page="2" href="javascript:void(0)">
            2          </a>
        </li>
              <li >
          <a class="page" data-page="3" href="javascript:void(0)">
            3          </a>
        </li>
              <li >
          <a class="page" data-page="4" href="javascript:void(0)">
            4          </a>
        </li>
              <li >
          <a class="page" data-page="5" href="javascript:void(0)">
            5          </a>
        </li>
              <li >
          <a class="page" data-page="6" href="javascript:void(0)">
            6          </a>
        </li>
              <li >
          <a class="page" data-page="7" href="javascript:void(0)">
            7          </a>
        </li>
              <li >
          <a class="page" data-page="8" href="javascript:void(0)">
            8          </a>
        </li>
              <li class="threeDots">
          <a class="page" data-page="..." href="javascript:void(0)">
            ...          </a>
        </li>
              <li >
          <a class="page" data-page="20" href="javascript:void(0)">
            20          </a>
        </li>
          </ul>
  </div>

When I click in this buttons I go to something like this http://ift.tt/2ntXkMk (x = number of the button) I use this:

Document doc = Jsoup.connect("http://ift.tt/2o9zx7E").get();
But i get always the first page HTML. How i can "click" or extract information about this pages? I dont know so much about PHP but i thing this page use it to change pages. Sorry for the expresion. English is not my native language and this is my first question, I am a beginner.


mardi 28 mars 2017

How can i enable browser cache for my website?

my website's spedd is very slow. I want enable browser cache for my website. how can do this plz hel me . My website address is http://ift.tt/2o5y8yt




how i can set image in middle during printing in html css?

Any one please tell me how i can set this image in center for print ? i am using paid plugin "Real 3d Flipbook" enter image description here




How do I write equivalent CSS code for this?

How do I write the equivalent css code for the following js code?

$("#breadcrumb-navbar > div.container").css("width","100%");




POST to 127.0.0.1 doesn't work

Followed the link here Using Custom Domains With IIS Express

In Chrome, I can access my web server by both https://localhost:44301 and https://127.0.0.1:44301

But when I tried to send POST strings to this web server, only localhost works, 127.0.0.1 will have "Connection refused" error.

For example, if using curl, the following command can work,

curl.exe -s -d "xxxxx=yyyyy" https://localhost:44301/API/NNN/Register

But the following command won't work,

curl.exe -s -d "xxxxx=yyyyy" http://ift.tt/2owcpfI

Could someone point out what I forget to do? My web server is developed by Visual Studio C# and IIS.

Thanks.




Dynamicly downsize an image

So I've got a large image 3000x2000 roughly and I want to span it across my website so it fills 100% width but stays the same proportions, but if I were to shrink the screen the image would resize automatically keeping the same proportions and no overflow scrolling.

<div class="row anfield">
    <img src="../Images/Anfield.jpg" />
</div>

.row{
width:100%;
display:flex;
flex-wrap:wrap
}

I have tried max-width / width 100% in the css anfield but neither worked.

<img style="max-width:100%" src="../Images/Anfield.jpg" />

This changes the width to 100% but doesn't resize the height accordingly.




How to summarize a long text using Thymeleaf?

I have an object with two attributes, one is the id and the other is an attribute of the type strring called TEXT (postgres database) that is used to store the text of a post from a client.

When the application loads these posts on the page, for it does not be a text too long,I would like to summarize this text.

I was able to do this using JSP, in an easy way, using forTokens.

How to do the same as the below code using thymeleaf?

<p class="post-texto">
    <c:forTokens var="resumo" items="${p.texto}" delims=" " begin="0" end="60">
            ${resumo}
    </c:forTokens><a href="<c:url value="/${p.link}" />">[Continue lendo]</a>
</p>




Redirect user to login if not logged in ASP.NET web form using C#

I'm trying to develop web app in ASP.NET web forms using C# and I've looked everywhere I could on the internet, but I found no solution to the problem. I've tried editing the default Web app template, to restrict a user from accessing any page if the user is not logged in. The default page should be the log in page and if the user clicks on anything else, he/she must be redirected to login page. Using MVC is easier, with just one bit of code on web.config but I've no idea what to do here in the web form

This is currently what my web.config contains.

<?xml version="1.0"?>
<configuration>

  <location path="Manage.aspx">
    <system.web>
      <authorization>
        <deny users="?"/>
      </authorization>
    </system.web>
  </location>

</configuration>

Where exactly I need to change?




What is promise? Is it part of Protractor or AngularJs or Javascript?

I am recently learning about Protractor that is used to automated testing of angularJS. All the tutorials I see online the word "Promise" seems to pop up. I am new to automation and have no idea what this means. I have looked around on web but did not find a good answer. Is "Promise" a Javascript thing or Protractor thing?

If you look at this link: http://ift.tt/2o3GgzF the word promise is used "Since all actions are asynchronous, all action methods return a promise. So, to log the text of an element, you would do something like:"




Max bitrate value for Google chrome browser

I have a simple question.

What is the current maximum bitrate value supported by Google Chrome browser for web camera ?

For example, if I have a virtual source with high bitrate output (constant bitrate 50 Mbits)

Would I be able to get all 50 Mbits in my Chrome browser when using this device?

Thank you.




Utlizing a List Value in Navbar (Error: Object returns null)

I am building a navbar with bootstrap in MVC 5 .ASP. I am populating the navbar buttons with category ("types") of hospitals.

This error occurs in the PublicViewResults Menu constructor:

Object reference not set to an instance of an object.

This is my NavController Constructor:

public PartialViewResult Menu()
{
    IEnumerable<string> Catagory = repository.Hospitals
            .Select(x => x.categories)
            .Distinct()
            .OrderBy(x => x);

    return PartialView(Catagory);
}

And the following is my Hospital class:

public class Hospital
{
    public int Id;
    public string Name;
    public string City;
    public string State;
    public string Zip;
    public string Beds;
    public string categories;
}

Additionally, the navbar bootstrap design is written in CSHTML:

*<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <link href="~/Content/bootstrap.css" rel="stylesheet" />
    <link href="~/Content/bootstrap.min.css" rel="stylesheet" />
</head>
<body>
    <div class = "navbar navbar-inverse" role = "navigation">
        <a class = "navbar-brand" href="#">HOSPITAL RY</a>
    </div>
        <div class= "row panel">
            div id = "Type" class ="col-xs-3">
            @Html.Action("Menu", "Nav")
        </div>
    <div class = "col-xs-8">
        @RenderSection("Body")
    </div>
</body>
</html>*

My question is: How to use the Category value for Hospital ACUTE or CHILDREN to populate the navbar categories to be displayed on the left sidebar?

Currently, categories retrieves null value and not correspond with this information in the repository below:

private List<Hospital> data = new List <Hospital>
{
    new Hospital{Id = 1, Name =  "Kaiser Permentae Irvine " ,City = "Irvine", State= "CA" , Zip = "9003" , Beds= "100" ,categories = "Acute" },
    new Hospital{Id = 2, Name =  "Kaiser Permentae Los Angeles " ,City = "Los Angeles", State= "CA" , Zip = "90213" , Beds= "200" ,categories= "Acute"},
    new Hospital {Id = 3, Name =  "Kaiser Permentae San Fransico " ,City = "San Fransico", State= "CA" , Zip = "9500" , Beds = "300" ,categories = "Children"}   
};




Is it possible to obfuscate web design?

I've run into a pretty irritating problem that I'm sure others have faced. I just don't know what to do to try and prevent it from happening again (or if it's even possible).

I purchased an eCommerce website from flippa some time back. After purchasing, I updated the design and styles to make it look better. The improvement made a big difference to the underlying sales.

Some time thereafter (about 3 months), on a whim, I was browsing flippa when I saw my own website for sale but as a different URL/domain. In essence, the previous owner of the site saw that I had improved so ripped everything and just changed the main logo and contact details.

This really infuriated me as I had put a lot of effort into the venture. I gave up soon after as it really left me demoralised.

I now want to get into a similar venture, but am worried that the same thing will happen again. I understand obfuscation can deter users from just stealing my design template and CSS - but is there anything I can really do about preserving it's authenticity?

Thanks in advance!




Customizing Free Wordpress Themes with CSS/HTML with brackets?

Is there a way that I can take maybe the header.php and the footer.php from the wordpress documentation and drag it into brackets with the provided stylesheet. I was thinking that this would make it a lot easier to make changes and see the live preview. If this isn't a good way of practicing editing wordpress themes, could you please guide me in the right direction? Thank you




GEO map based interface

I try to design a web sight for some organization which use geo map based interface. basically my web sight users can upload their post in all over the world with their current lacation and other users can view it on the map.

so i need to know how to do this???




stopping .load() jquery redirect the page after postback

 $('#<%= test.ClientID %>').load('users.aspx' );

this function work but after first postback my page gets redirected to users.aspx. How can i stop from doing it? (I cant stop postbacks since they are required to be done periodically)




PHP Login Form Session Variable Destroying

I am new to PHP and currently I am creating a login screen with a session variable. I am trying to destroy or unset my session variable when logging out but it doesn't seem to work.

My session variable:

$_SESSION['CurrentUser']

This is the button which should end the session:

<input type="submit" name="logout" id="logout" value="Log out">

When pressing a button:

if(isset($_POST['logout']))
{
    session_unset();  
    session_destroy(); 
}

Thank you in advance




Backend Server fetching data vs UI fetching data

I have an architecture question.

I am currently working on a system architecture for an Employee information system which will show all the employee information. But the information what needs to be shown to user is currently stored in two systems. But on UI for user we need to show the data in consolidated view. We have two option to approach this.

Option#1:

One backend server which fetches both the data from the two systems and then send it UI to display.

Option#2:

One backend server sends the data from one system and links to get the data from other system.UI then fetches the data from other system to display it on UI.

According to me the Option#2 is better since the data is fetched by UI as and when needed. But the concern with this approach is UI needs to make repeated calls to system2 which makes lot of HTTP requests.

Can I get suggestions on which option is better and why?




How to choose a file and save the path's file via JS [duplicate]

I want to click on a button to open a window and choose a file. I'm using this code for the choosing:

<button onclick="document.getElementById('file-input').click();">Open</button>
<input id="file-input" type="file" name="name" style="display: none;" />

How can I save the path? (For example c:\temp\song.mp3)

I dont need to download the file. it's a local file.




How in Yii 2 access AR object as component?

Actually, i want have access to some AR object in anywere. So i want access to this ojb as yii component. Like as Yii using this for user: Yii::$app->user->identity - User component contains User AR object. I want store my Page AR in component. So, it's look like something: Yii::$app->page->page - Page AR is a propery of Page component. Not very nice :(. This is the only way?




Get invisible web page info with BeautifulSoup

I am trying to get some info from the site "http://ift.tt/2nIjqwH", to be more precise all individual estimates, which are at the bottom of the page. But it shows only first 30 and then you should manually press the button "Show All" to get another 30 and so on. Here is my code so far:

from urllib import urlopen
from bs4 import BeautifulSoup
html = urlopen("http://ift.tt/2nIjqwH")
soup = BeautifulSoup(html.read(), "html.parser")
print(soup)

I see that there is a part of the printed code:

"totalCount":142,"total_estimates_showing":30,"

Is it possible to change this to get printed all the estimates?




Combine events or force one to fire before the other

Is there a way to combine two events into one?

For example a click event and someObject.selection event so I'll have access to both events' data? Both fire on a mouse click.

Alternatively, is there a way to guarantee one event firing before the other if both listen for a mouse click?




Java Web Application, glassfish server and iis 8

I have successfully hosted some few java web application on IIS 8, but now I am currently trying to understand how can i browse my java web applications without the path name e.g instead of browsing www.abc.com/path.

I would like to use www.abc.com to access my java web applications on IIS 8.




How to add id as a variable in jquery while appending? [on hold]

for(var i=0;i<va;i++){
            var not=result2.data[i].unique_id;
            var matchname = result2.data[i].description;
            $("#matches").append("<br><p id='"+ not +"'></p><br>");
            $("#not").text("hello");
        }

Even after adding id='"+ not +" not showing. The output is not showing anything. I am pretty sure it is considering id as some name but not as variable. How to make id as variable. I am new to jquery, Please help me out. Thanks in advance for the answer.




How to serve updatable Javascript files from a cdn

So here is the problematic.

I work for a company that generate customizable javascript files for each clients. Each client has to include the script on their product pages. The client can modify the configuration of the script at anytime.

What we are doing now is that we are managing all that internally but i was wondering if it was possible to serve those file from a cdn knowing that we must be able to modifify the files on the cdn when a client modify his configuration, and that the changes must take effect immediately.




Best Practice To Manage Laravel 5.4 API With Existing Web

I'm working on an e-commerce project using laravel-vue for website and laravel-api for mobile application, i wanted suggestion on the best way to manage api part or the best way to implement the project

these are my thoughts on implementing this

1->using same controller for both api and web, but worried abut complex logic and scalability

public function index(Request $request) 
{
    $users = User::all();

    if ($request->wantsJson()) {
        //return json-data for mobile app
    }

    return view('agents', compact('users'));
}

2->creating separate namespace for api controllers. namespace App\Http\Controllers\Api\;

3->creating just the api using laravel and create client app using vue-cli/angular2 so that the mobile app and web app can use the same api. here concerned about SEO

any suggestions are welcome

thank you




Execute an SQL query inside another SQL query

Ok, I assume that the title is not the best title, but let me explain my problem: I'm creating a website that needs to show posts of people (anyway), and I have to show their gravatar's profile picture, so this what I did:

<?php 
            function get_gravatar( $email, $s = 80, $d = 'mm', $r = 'g', $img = false, $atts = array() ) {
                $url = 'http://ift.tt/19xbBZH';
                $url .= md5( strtolower( trim( $email ) ) );
                $url .= "?s=$s&d=$d&r=$r";
                if ( $img ) {
                    $url = '<img src="' . $url . '"';
                    foreach ( $atts as $key => $val )
                        $url .= ' ' . $key . '="' . $val . '"';
                    $url .= ' />';
                }
                return $url;
            }
            require("db.php");
            $sql = "SELECT * FROM posts ORDER BY date DESC";
            foreach ($db->query($sql) as $row) {
                // var_dump($row);
                $user = $row['user_id'];
                $sql_user = "SELECT email FROM users WHERE id = $user";
                foreach ($db->$sql_user as $row_user) {
                    var_dump($row_user);
                    echo "<img src=\"".get_gravatar($row_user['email'])."\"/>";
                }
                echo "<h2>".$row['title']."</h2><br/>";
                echo "<p>".$row['content']."</p><br/>";
            }

But, it doesn't work (well, it works, but it doesn't shows me the profile picture of the user, only the post). So, I think the problem is that I can't call 2 times the variable $db at the same time, but I'm not sure, so that's m=why I'm asking if there is a way to fix my problem or to select 2 tables at the same time.




display a table after another table from a different file in php

I am showing two tables on top of my page from php_file1.php which is ajax based. Then in there is another table in body of the page which is shown after these two table. The thing is I need to display last table of php_file1.php after body's table. I cant modify anything in php side. Any way to do in front end?

Sharing code: php_file1.php (ajax based):

echo "<table class='class1' id='class1' style='width:90%;'>";
// some stuffs
echo "</table>";
<br>
echo "<table class='class2' id='class2' style='width:90%;'>";
// some stuffs
echo "</table>";

In my page body

echo "<table class='body' id='body' style='width:90%;'>";
// some stuffs
echo "</table>";

I need to display id with class2 after id with body I need to do it in run time only (javascript/jquery). I cant run any extra ajax because all data is in php_file1.php My page loads first only then ajax loads.




Selenium WebDriver Page Event Listening

I am using the java selenium webdriver to create some web tests but the pages I must test are for the most part dynamically loaded. Luckily, events are triggered when certain content is loaded on the webpage.

I would like to detect these events using selenium webdriver but I do not think it is natively possible. I have checked out the doc for the EventFiringWebDriver but this looks like it will only work on selenium created events.

Should I make use of implicit waits instead?

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);




I want to provide callback when clients load a javascript bundle library using snippet

my javascript library product is loaded asynchronously through the snippet in the client html.

As follows...

<html>
<head> ... </head>
<body>
    <script>

    ...

    !function(e,t){function n(e,t){
        ...
        // loads javascript bundle library from server
        ...
    }}(document, window.MYPRD||[]);

    ...

    </script>

    <script>

    // if bundle library is not loaded, the following code will return an error since MYPRD object and myFunc() is not defined.
    MYPRD.myFunc()

    </script>
</body>
</html>

However, the snippet in that script tag is executed asynchronously and loads the bundle, so a callback function might be needed to ensure order when there are another executable codes in html.

I would also like to know how to guarantee the order from the client html using a load function, but I wish I could solve this issue in my snippet or my JavaScript bundle library.

What should I do? Please explain in detail. (I am a beginner in Javascript and web development.)

Thank you.




lundi 27 mars 2017

How can I dynamically change the background height in CSS?

I'm trying to change my background height in CSS dynamically. I have a background that stays in place as I scroll down. So when I use a taller browser window I would like it to zoom in on my background so that there isn't a gap beneath it. My CSS is:

body {
    min-width: 100%;
    background-image: url("Photos/Tiger-4.jpg");
    background-position: 0px 0px;
    background-size: 100%;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

How it should look [Img]

What it looks like in a tall browser [Img]

In this second image you can see that there is a white gap underneath the background. I want it to zoom in on the picture instead so that it looks good on phones. So I want the background height the same as the window height, and the width to change appropriately to not stretch it.

I have tried:

background-size: auto 100%;

This just made the background stupidly large.

Any help is appreciated :)




Is it okay to directly read from Cassandra to surface information from a web application?

I'm using Cassandra as my primary data store for a time series logging application. I receive a high-volume number of writes to this database, so Cassandra was a natural choice.

However, when I try showing statistics about the data on a web application, I make costly reads to this database and things start to slow down.

My initial idea is to run periodic cron jobs that pre-compute these statistics every hour. This would ensure no slow reads. I'm wondering if there's another way to read from a Cassandra database and what is the best solution?




beginner php mysql - insert data to table from input form

im trying to add data to my database, and this data come from an html form.

here's my code:

<?php

error_reporting(E_ALL);

$conn = new mysqli(/* private info's */);

if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 

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

    $getName = $_POST['name'];

    $query = "INSERT INTO data ('name') VALUES ($getName)";

    if ($conn->query($query) === TRUE) {
        echo "New record created successfully";
    } else {
        echo "Error: " . $query . "<br>" . $conn->error;
    }

    $conn->close();
}
?>

<html>

<form method="post">
    Name: <input type="text" name="name"><br>
    <input type="submit">
</form>

</html>

I don't know why but when I click on the button, absolutely nothing happen.

Thanks for any help




Connect a mobile app to a online database

I plan to program a swift 3 app that should be connected with a database which will be updated at least once a month. The database is just filled with some text information and pictures. I don´t know what is the best way to connect the database, should I integrate it in the app and save it local or should I connect it online with some kind of a server? What way or which software do you recommend for getting a database online and connect it to a mobile app?




Material CSS Checkbox doesn`t change state

I just would like to know if anyone had the same experience on Material CSS Checkbox that It doesn`t change its state when you click it.

  <form>
       <p>
           <input type="checkbox" id="academic" />
           <label for="academic">Academic</label>
       </p>
   </form>




Can not get full and right data from web through esp8266

I use Arduino mego 2560 and esp8266 follow this http://ift.tt/2maYGhD and write this code:

void setup() {
 Serial.begin(9600);
 Serial1.begin(115200);  
}

void loop() { 
    Serial1.println("AT");  
    delay(1000);    

    Serial1.println("AT+CWMODE=1");
    delay(1000);

    Serial1.println("AT+CWJAP=\"SSSD\",\"PASSWORD\"");
    delay(5000);

    Serial1.println("AT+CIPSTART=\"TCP\",\"www.mywebsite.com\",80");
    delay(1000);

    Serial1.print("AT+CIPSEND=");
    String postRequest ="GET /nhap.php HTTP/1.1\r\n\r\nHost:http://www.mywebsite.com\r\n\r\nConnection:close\r\n\r\n";

    Serial1.println(postRequest.length());
    delay(5000);

    Serial1.println("GET /nhap.php HTTP/1.1");
    Serial1.println("Host: www.mywebsite.com");
    Serial1.println("Connection:close");
    Serial1.println();

    int check_down = 0;
    String content = "";
    while(Serial1.available()!=0)
    {  
        check_down++;
        content = content + String(char (Serial1.read()));
    } 
    Serial.println(check_down);
    //Serial.println(content);
    Serial.println(content.substring(10,50));
    delay(3000);

    Serial1.println("AT+CIPCLOSE");
    ShowSerialData();
    delay(1000);
}    
void ShowSerialData()
{
    while(Serial1.available())
        Serial.write(Serial1.read());
    while (Serial.available())
        Serial1.write(Serial.read());
}

My website:

<html>
<head></head>
<body>HELLO</body>
</html>

I want to get "HELLO" on serial monitor from arduino IDE but I got this:

AT+CIPCLOSE busy s...

SEND OK

+IPD,156:HTTP/1.1 200 OK SGET /nhap.php HTTP/1.1 Host: www.mywebsite.com Connectio:le

??? @@ so something wrong between mega2560(9600) and esp8266(115200) ?




Mean Stack Application: Page does not rerender on refresh, but returns only JSON

I'm currently designing a MEAN.js web application, and for some reason, whenever I refresh the page on a route or window.reload, it does not rerender the page, but only returns the JSON file found at that current route.

For example, when I'm at localhost:8080/people:

If I click here from the main page, I get enter image description here

but if I hit refresh or reload the page for whatever reason i get enter image description here

Does anyone have any idea why this is happening and how to fix it? Thanks!




asset() function in symfony3 does not convert url

i want to load pictures dynamicly from database ,

here's the table containing the image informations http://ift.tt/2o9HRRM

Controller code

public function listeproductAction()
{
    $em = $this->getDoctrine()->getManager();
    $img = $em->getRepository('AppBundle:image')->findAll();
    return $this->render('lucky/images.html.twig', array(
        'img' => $img ,

    ));

}

twig code



result

<div class="main-content">
        <img src="/uploads/brochures/0fa58c757752ced32d04b57bb7fa0d65.png ">
    </div>

the problem that asset funtion doesent find the image :(