dk4210

Experience

14,120

0 Best Reply Awards

  • Member Since 1 Year Ago
  • 119 Lessons Completed
  • 0 Favorites

17th May, 2018

dk4210 started a new conversation Gulp On Production • 4 days ago

Hello Guys,

I have a question in regards to running gulp on production or UAT. If I run gulp on my local and commit the branch do I need to run it again on UAT or Prod?

Thanks!

22nd April, 2018

dk4210 left a reply on Passing Array From Controller And View In Blade • 4 weeks ago

That worked!

Thanks, Dan

dk4210 left a reply on Passing Array From Controller And View In Blade • 4 weeks ago

Thanks for the info. How would display it on the page without var_dump?

maybe with the {{ }}

dk4210 started a new conversation Passing Array From Controller And View In Blade • 4 weeks ago

Hello Guys,

I want to display only certain values from an array. I can't seem to make it work.

This is my controller ( The response comes from a zillow api call )

 return view('listhome',compact('response'));

If I add this in blade (listhome)

 @php
      echo "<pre>";
        var_dump($response);
       echo "</pre>";
    @endphp

i see this

array(1) {
  ["results"]=>
  array(1) {
    ["result"]=>
    array(17) {
      ["zpid"]=>
      string(8) "1433324"
      ["links"]=>
      array(4) {
        ["homedetails"]=>
        string(85) "https://www.zillow.com/homedetails/an address/14673332_zpid/"
        ["graphsanddata"]=>
        string(100) "http://www.zillow.com/homedetails/an address/14673332_zpid/#charts-and-data"
        ["mapthishome"]=>
        string(42) "http://www.zillow.com/homes/146732423_zpid/"
        ["comparables"]=>
        string(48) "http://www.zillow.com/homes/comps/146324432_zpid/"
      }
      ["address"]=>
      array(6) {
        ["street"]=>
        string(18) "101 test street"
        ["zipcode"]=>
        string(5) "30964"
        ["city"]=>
        string(7) "Albany"
        ["state"]=>
        string(2) "NY"
        ["latitude"]=>

How can I get it to just display the street?

Thanks in advanced.

11th April, 2018

dk4210 left a reply on NPM Install [email protected] • 1 month ago

I fixed the issue. After trying everything I got it to work. I ended up re cloneing the project from the repo and downgrading the Node and NPM version to an older one

node - v6.10.2 npm - 3.10.10

I then ran NPM install and composer install.

In my case, that worked because the application that I'm working on is based on Laravel 5.2 and I guess the Node version I had was to updated I guess.

dk4210 started a new conversation NPM Install [email protected] • 1 month ago

Hello Guys,

For some reason everytime I do an NPM install it gets stuck on installing the node-sass. The project doesn't even use node-sass. This is the error.

[email protected] install C:\development\node_modules\gulp-sass\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://npm.taobao.org/mirrors/node-sass/v3.13.1/win32-x64-57_binding.node
Cannot download "https://npm.taobao.org/mirrors/node-sass/v3.13.1/win32-x64-57_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> [email protected] install C:\development\node_modules\uws
> node-gyp rebuild > build_log.txt 2>&1 || exit 0


> [email protected] postinstall C:\development\node_modules\gulp-sass\node_modules\node-sass
> node scripts/build.js

Any way to stop it from trying to install this?

Thanks in advance.

29th March, 2018

dk4210 left a reply on How I Can Get "admin" Auth User Information • 1 month ago

When you "not working" can you tell me what you receive? An error or just empty vars?

dk4210 left a reply on Access Array In Object • 1 month ago

What do you see when you do dd($company)

dk4210 left a reply on Dusk Chrome Driver Error - Unknown Error: Call Function Result Missing 'value' • 1 month ago

Worked like a charm! Can't thank you enough!

28th March, 2018

dk4210 left a reply on Dusk Chrome Driver Error - Unknown Error: Call Function Result Missing 'value' • 1 month ago

not sure why it says "chromedriver=2.28.455520"

dk4210 started a new conversation Dusk Chrome Driver Error - Unknown Error: Call Function Result Missing 'value' • 1 month ago

Hello Guys,

I'm having a strange problem with the chrome driver for running tests. It's been working fine for months and all of a sudden i get an error when running my tests.

Here's the error (simplified)

Tests\Browser\Elements\LoginTest::testExample Facebook\WebDriver\Exception\UnknownServerException: unknown error: call function result missing 'value' (Session info: chrome=65.0.3325.181) (Driver info: chromedriver=2.28.455520 

Here's the entire error message

success: "Warning: TTY mode is not supported on Windows platform. PHPUnit 5.7.23 by Sebastian Bergmann and contributors. E 1 / 1 (100%) Time: 4.36 seconds, Memory: 12.00MB There was 1 error: 1) Tests\Browser\Elements\LoginTest::testExample Facebook\WebDriver\Exception\UnknownServerException: unknown error: call function result missing 'value' (Session info: chrome=65.0.3325.181) (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 6.1.7601 SP1 x86_64) C:\xampp\htdocs\automation_team\vendor\facebook\webdriver\lib\Exception\WebDriverException.php:114 C:\xampp\htdocs\automation_team\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:320 C:\xampp\htdocs\automation_team\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:535 C:\xampp\htdocs\automation_team\vendor\facebook\webdriver\lib\Remote\RemoteExecuteMethod.php:40 C:\xampp\htdocs\automation_team\vendor\facebook\webdriver\lib\Remote\RemoteWebElement.php:66 C:\xampp\htdocs\automation_team\vendor\laravel\dusk\src\Concerns\InteractsWithElements.php:169 C:\xampp\htdocs\automation_team\tests\Browser\Todaytest.php:33 C:\xampp\htdocs\automation_team\vendor\laravel\dusk\src\TestCase.php:91 C:\xampp\htdocs\automation_team\tests\Browser\Todaytest.php:63 ERRORS! Tests: 1, Assertions: 0, Errors: 1. ",

The steps I've taken

  1. Upgraded chrome browser
  2. Updated the chrome driver to 2.27.544315
  3. Updated npm
  4. Ran composer update 5 ran npm update
  5. Viewed other sources

Still no luck.

Any one have any ideas?

26th March, 2018

dk4210 started a new conversation Redirecting Users Based On Role • 1 month ago

Hello all,

I'm trying to figure out how to redirect users based on their role. Currently all users just redirect to my-account. I would like the user to be directed to certain areas based on their role.

Here's my controller (FrontEndController)

getLogin method

public function getLogin()
    {
        // Is the user logged in?
        if (Sentinel::check()) {
            return Redirect::route('my-account');
        }
        // Show the login page
        return view('login');
    }

Heres the PostLogin method

public function postLogin(Request $request)
    {

        try {
            // Try to log the user in
            if ($user=Sentinel::authenticate($request->only('email', 'password'), $request->get('remember-me', 0))) {
                //Activity log for login
                activity($user->full_name)
                    ->performedOn($user)
                    ->causedBy($user)
                    ->log('LoggedIn');

               return Redirect::route("my-account")->with('success', trans('auth/message.login.success'));
            } else {
               return redirect('/')->with('error', 'Email or password is incorrect.');
               //return Redirect::back()->withInput()->withErrors($validator);
            }

        } catch (UserNotFoundException $e) {
            $this->messageBag->add('email', trans('auth/message.account_not_found'));
        } catch (NotActivatedException $e) {
            $this->messageBag->add('email', trans('auth/message.account_not_activated'));
        } catch (UserSuspendedException $e) {
            $this->messageBag->add('email', trans('auth/message.account_suspended'));
        } catch (UserBannedException $e) {
            $this->messageBag->add('email', trans('auth/message.account_banned'));
        } catch (ThrottlingException $e) {
            $delay = $e->getDelay();
            $this->messageBag->add('email', trans('auth/message.account_suspended', compact('delay')));
        }

        // Ooops.. something went wrong
        return Redirect::back()->withInput()->withErrors($this->messageBag);
    }

The roles will be something like

1 super admin
2 admin
3 traveler
4 home owner

Please advise on the best approach

Thanks!

25th March, 2018

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

Figured it out. Looks like my auth is being controller by Sentinel so i did this

@if(Sentinel::check())
            Logged in
        @else
            Not logged in
        @endif

and it works

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

I know right. It's driving me insane! LOL

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

This code

@if (auth()->guest())
 Guest         
@else
        User
@endif 

displays guest logged in or not.

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

I'm using 5.5.34

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

Hmm no luck.

added this

 @guest
        Guest       
       @endguest
        @auth
              User        
        @endauth

Saved then logged in and it says "Guest"

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

This is in my controller

 /**
     * get user details and display
     */
    public function myAccount(User $user)
    {
        $user = Sentinel::getUser();
        $countries = $this->countries;
        return view('user_account', compact('user', 'countries'));
    }

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

Yep. its in there. The header works fine. When I'm logged in i see a page called my-account. If I logout (by manually entering in "logout" in the browser) I can't see the page any more.

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

No errors that I see.

Thanks!

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

This is the entire header

<div class="header">
        <div class="container">
       <div class="row">
       <div class="col-md-8">            
    <img class="header_logo" src="{{ asset('images/logo.png') }}" alt="Homes" />
  </div>
  <div class="col-md-4">

        @guest
        <ol class="login-nav">
            <li><a href="#" data-toggle="modal" data-target="#login-modal">traveler login</a></li><span class="vl"></span>
            <li><a href="{{ url("login/owner") }}">homes owner login</a></li>
        </ol>
            <a href="{{ url("list-your-home") }}" class="btn">list your home</a>
        @endguest
        @auth
        <li><a href="{{ url("logout") }}">logout</a></li>
        @endauth
        
  </div>

      
  {{-- Start Modal --}}

  <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
        <div class="modal-dialog">
                
              <div class="loginmodal-container">
                    <button class="close" type="button" data-dismiss="modal" aria-hidden="true">x</button>
                   <h1><div class="login-txt">Login to Your Account</div></h1><br>
                   <!-- Notifications -->
                   <div id="notific">
                   @include('notifications')
                   </div>
                   <form action="{{ route('login') }}" class="omb_loginForm"  autocomplete="off" method="POST">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <div class="form-group {{ $errors->first('email', 'has-error') }}">
                        <label class="sr-only">Email</label>
                        <input type="email" class="form-control" name="email" placeholder="Email"
                               value="{!! old('email') !!}">
                    </div>
                    <span class="help-block">{{ $errors->first('email', ':message') }}</span>
                    <div class="form-group {{ $errors->first('password', 'has-error') }}">
                        <label class="sr-only">Password</label>
                        <input type="password" class="form-control" name="password" placeholder="Password">
                    </div>
                    <span class="help-block">{{ $errors->first('password', ':message') }}</span>
                    <div id="remember-checkbox">
                        <label>
                            <input type="checkbox"> Remember Password
                        </label>
                    </div>
                    <input type="submit" class="loginmodal-submit" value="Log In">
                   {{--Don't have an account? <a href="{{ route('register') }}"><strong> Sign Up</strong></a>--}} 
                </form>
                  
                <div class="login-help">
                  <a href="#">Register</a> - <a href="#">Forgot Password</a>
                </div>
              </div>
          </div>
        </div>

  {{-- End Modal --}}
  
</div>
</div>
<div class="navbar">
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <nav>
                        <ul class="nav">
                            <li><a href="{{ url("/") }}" {!! (Request::is('/') ? 'class="active"' : '') !!}>home</a></li>
                            <li><a href="{{ url("aboutus") }}" {!! (Request::is('aboutus') ? 'class="active"' : '') !!}>about us</a></li>
                            <li><a href="{{ url("find-a-home") }}" {!! (Request::is('find-a-home') ? 'class="active"' : '') !!}>find a home</a></li>
                            <li><a href="{{ url("blog") }}" {!! (Request::is('blog') ? 'class="active"' : '') !!}>blog</a></li>
                            <li><a href="{{ url("testimonials") }}" {!! (Request::is('testimonials') ? 'class="active"' : '') !!}>testimonials</a></li>
                        </ul>
                    </nav>         
                </div>
            </div>
        </div>
        <div class="navbar-inner">
            
        </div>
    </div>

</div>



<?php Request::is('/') ?>

dk4210 left a reply on Blade Check If User Is Logged In • 1 month ago

Thanks for the reply. I replaced the code that you provided and still no luck. I tested by logging in and out and the options never changed.

Thanks!

dk4210 started a new conversation Blade Check If User Is Logged In • 1 month ago

Hello Guys,

I want to display different options ( in blade) if a user is logged in or not. I can't seem to get it to work. I know the following is suppose to work, but it doesn't. It displays the logout no matter if I'm successfully logged in or not.

 @if (Auth::guest())
        <ol class="login-nav">
            <li><a href="#" data-toggle="modal" data-target="#login-modal">traveler login</a></li><span class="vl"></span>
            <li><a href="{{ url("login/owner") }}">homes owner login</a></li>
        </ol>
            <a href="{{ url("list-your-home") }}" class="btn">list your home</a>
        @else
        <li><a href="{{ url("logout") }}">logout</a></li>
        @endif

Please advise.

dk4210 left a reply on Error Response In Modal Without It Disappearing • 1 month ago

Perfect! that worked!

Thank you!

dk4210 left a reply on Error Response In Modal Without It Disappearing • 1 month ago

Still no luck. I added this at the bottom of the file

<script>
$( document ).ready(function() {
    @if (count($errors) > 0)
    $('#login-modal').modal('show');
  @endif
});
</script>

dk4210 left a reply on Error Response In Modal Without It Disappearing • 1 month ago

I know the 1st option requires ajax. I think the second option would be best. It's kinda doing a page refresh cause when i click on login it tries to validate then refreshes the page. I would like for the modal to pop back up.

dk4210 left a reply on Error Response In Modal Without It Disappearing • 1 month ago

As soon as i click on log in with the wrong credentials the modal disappears and when i click on log in again it displays the error message. I guess I would like for the modal to either stay and display the message or as the page reloads have the modal pop back up.

dk4210 started a new conversation Error Response In Modal • 1 month ago

Hello Guys,

I know that this question has been asked many times but I can't seem to get it right.

I want to get to display the errors in the modal and not disappear after clicking on login.

Here's the log in page

<div class="header">
        <div class="container">
       <div class="row">
       <div class="col-md-8">            
    <img class="header_logo" src="{{ asset('images/hautelogo.png') }}" alt="Hautes Homes" />
  </div>
  <div class="col-md-4">
        <ol class="login-nav">
                <li><a href="#" data-toggle="modal" data-target="#login-modal">traveler login</a></li><span class="vl"></span>
                <li><a href="{{ url("login/owner") }}">haute homes owner login</a></li>
            </ol>
            <a href="{{ url("list-your-home") }}" class="btn">list your haute home</a>
  </div>

      
  <script>
        @if (count($errors) > 0)
        $('#login-modal').modal('show');
    @endif
  </script>

  

   {{-- Start Modal --}}

  <div class="modal fade" id="login-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
        <div class="modal-dialog">
                
              <div class="loginmodal-container">
                    <button class="close" type="button" data-dismiss="modal" aria-hidden="true">x</button>
                   <h1><div class="login-txt">Login to Your Account</div></h1><br>
                   <!-- Notifications -->
                   <div id="notific">
                   @include('notifications')
                   </div>
                   <form action="{{ route('login') }}" class="omb_loginForm"  autocomplete="off" method="POST">
                    <input type="hidden" name="_token" value="{{ csrf_token() }}">
                    <div class="form-group {{ $errors->first('email', 'has-error') }}">
                        <label class="sr-only">Email</label>
                        <input type="email" class="form-control" name="email" placeholder="Email"
                               value="{!! old('email') !!}">
                    </div>
                    <span class="help-block">{{ $errors->first('email', ':message') }}</span>
                    <div class="form-group {{ $errors->first('password', 'has-error') }}">
                        <label class="sr-only">Password</label>
                        <input type="password" class="form-control" name="password" placeholder="Password">
                    </div>
                    <span class="help-block">{{ $errors->first('password', ':message') }}</span>
                    <div id="remember-checkbox">
                        <label>
                            <input type="checkbox"> Remember Password
                        </label>
                    </div>
                    <input type="submit" class="loginmodal-submit" value="Log In">
                   {{--Don't have an account? <a href="{{ route('register') }}"><strong> Sign Up</strong></a>--}} 
                </form>
                  
                <div class="login-help">
                  <a href="#">Register</a> - <a href="#">Forgot Password</a>
                </div>
              </div>
          </div>
        </div>

  {{-- End Modal --}}
  
</div>
</div>
<div class="navbar">
        <div class="container">
            <div class="row">
                <div class="col-sm-12">
                    <nav>
                        <ul class="nav">
                            <li><a href="{{ url("/") }}" {!! (Request::is('/') ? 'class="active"' : '') !!}>home</a></li>
                            <li><a href="{{ url("aboutus") }}" {!! (Request::is('aboutus') ? 'class="active"' : '') !!}>about us</a></li>
                            <li><a href="{{ url("find-a-home") }}" {!! (Request::is('find-a-home') ? 'class="active"' : '') !!}>find a haute home</a></li>
                            <li><a href="{{ url("blog") }}" {!! (Request::is('blog') ? 'class="active"' : '') !!}>blog</a></li>
                            <li><a href="{{ url("testimonials") }}" {!! (Request::is('testimonials') ? 'class="active"' : '') !!}>testimonials</a></li>
                        </ul>
                    </nav>         
                </div>
            </div>
        </div>
        <div class="navbar-inner">
            
        </div>
    </div>

</div>


<?php Request::is('/') ?>

Here's the controller/ method

 /**
     * Account sign in form processing.
     *
     * @return Redirect
     */
    public function postLogin(Request $request)
    {

        try {
            // Try to log the user in
            if ($user=  Sentinel::authenticate($request->only('email', 'password'), $request->get('remember-me', 0))) {
                //Activity log for login
                activity($user->full_name)
                    ->performedOn($user)
                    ->causedBy($user)
                    ->log('LoggedIn');

                return Redirect::route("my-account")->with('success', trans('auth/message.login.success'));
            } else {
               return redirect('/')->with('error', 'Email or password is incorrect.');
               //return Redirect::back()->withInput()->withErrors($validator);
            }

        } catch (UserNotFoundException $e) {
            $this->messageBag->add('email', trans('auth/message.account_not_found'));
        } catch (NotActivatedException $e) {
            $this->messageBag->add('email', trans('auth/message.account_not_activated'));
        } catch (UserSuspendedException $e) {
            $this->messageBag->add('email', trans('auth/message.account_suspended'));
        } catch (UserBannedException $e) {
            $this->messageBag->add('email', trans('auth/message.account_banned'));
        } catch (ThrottlingException $e) {
            $delay = $e->getDelay();
            $this->messageBag->add('email', trans('auth/message.account_suspended', compact('delay')));
        }

        // Ooops.. something went wrong
        return Redirect::back()->withInput()->withErrors($this->messageBag);
    }

Please advise.

Thanks!

28th January, 2018

dk4210 left a reply on React Async Validation • 3 months ago

That's correct I want to see if the package exists on the back end. Back end is going to be developed with Java ( I wish it was laravel). I'm trying to do the front end. If nothing else maybe fake it with a json file or something to prove it works.

Thanks!

dk4210 started a new conversation React Async Validation • 3 months ago

Hello All,

Anyone have any experience with React / async validation? I'm trying to figure out how to do an async validation with JOI.

I can do client side validation, but not sure how to add the async validation. I basically have a required field called package. I want it to server side validation onBlur to see if the package is taken. Can some one give me a hand?

Here's what my code looks like

'use strict';
import axios from 'axios'
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import validation from 'react-validation-mixin';
import strategy from 'joi-validation-strategy';
import Joi from 'joi';
import { Row, Col, Button,  ButtonDropdown, DropdownToggle, DropdownMenu, DropdownItem, Card, CardHeader, CardFooter, CardBody, Form, FormGroup, FormText, Label, Input,
InputGroup, InputGroupAddon, InputGroupButton} from 'reactstrap';

 
class Step1 extends Component {
 constructor(props) {
    super(props)

    // sets state of package name
    this.state = {
      packagename: props.getStore().packagename
      
    };

    this.validatorTypes = {
      packagename: Joi.string().required().min(3).label("The Package Name")
    };

    this.getValidatorData = this.getValidatorData.bind(this);
    this.renderHelpText = this.renderHelpText.bind(this);
    this.isValidated = this.isValidated.bind(this);
  }

  isValidated() {
    return new Promise((resolve, reject) => {
      this.props.validate((error) => {
        if (error) {
          reject(); // form contains errors
          console.log("Error fired");
          return;
        }

        if (this.props.getStore().packagename != this.getValidatorData().packagename) { // only update store of something changed
          this.props.updateStore({
            ...this.getValidatorData(),
            savedToCloud: true // use this to notify step4 that some changes took place and prompt the user to save again
          });  // Update store here (this is just an example, in reality you will do it via redux or flux)
         
          // Ajax send response to server goes here!
          console.log("Validation fired");
        
        }

        resolve(); // form is valid, fire action
        
      });
    });
  }

  getValidatorData() {
    return {
      packagename: this.refs.packagename.value,
    }
  };

  onChange(e) {
      let newState = {};
      newState[e.target.name] = e.target.value;
      this.setState(newState);
  }

  renderHelpText(message, id) {
    return (<div className="val-err-tooltip" key={id}><span>{message}</span></div>);
};

render() {
  // explicit class assigning based on validation
  let notValidClasses = {};
  notValidClasses.packagenameCls = this.props.isValid('packagename') ?
      'no-error col-md-8' : 'has-error col-md-8';

return (
  

    <div className="step step1">
      <div className="row">
      
        <form id="Form" className="form-horizontal">
            <div id="stepscontainer" className="form-group">
            <label className="col-md-12 control-label">
              <h2>Please provide a unique name for the package</h2>
            </label>
            <div className="row content">
              <div className="col-md-12">
                  Give a short name that can identify the package with, using underscore and no spaces.
                  <br /><br />
                     <FormGroup row>
                     <Col xs="12" md="9">
                     <div className={notValidClasses.packagenameCls}>
                     <input
                            ref="packagename"
                            name="packagename"
                            autoComplete="off"
                            type="text"
                            className="form-control"
                            placeholder="Package name"
                            required
                            defaultValue={this.state.packagename}
                            id="packagename"
                            onBlur={this.props.handleValidation('packagename')}
                            onChange={this.onChange.bind(this)}
                            size="145" />
                        {this.props.getValidationMessages('packagename').map(this.renderHelpText)}
                     </div>
                    </Col>
                  </FormGroup>
              
              </div>
              <div className="col-md-12 eg-jump-lnk">
               
              </div>
            </div>
          </div>
          
        </form>
      </div>
      </div>
    )
  }
}

Step1.propTypes = {
  errors: PropTypes.object,
  validate: PropTypes.func,
  isValid: PropTypes.func,
  handleValidation: PropTypes.func,
  getValidationMessages: PropTypes.func,
  clearValidations: PropTypes.func,
  getStore: PropTypes.func,
  updateStore: PropTypes.func
};


export default validation(strategy)(Step1);

Thanks, Dan

12th December, 2017

dk4210 left a reply on Jquery Question • 5 months ago

Dang my stupid mistake. It works now. I knew that. Thanks for your help!

dk4210 left a reply on Jquery Question • 5 months ago

Opps I saw that and removed it, but still doesn't work.

<div class="headertxt">Activity</div>
<hr>
<script>
  var aoptions = [
     { "href": "s2pstandpack.jsp", "text": "OPQ32R DeviceOpt Component" },
     { "href": "s2psolution.jsp", "text": "VATGUNR scaleset" },
     { "href": "tcstandpack.jsp", "text": "G+ Package" },
     { "href": "tcsolution.jsp", "text": "MoE Custom Report" },
     { "href": "tcsolution.jsp", "text": "VATNR Professional Normgroup" }
];

$.each(aoptions, function(index) {
    $("activityList").append($('<li> <i class="fa fa-link" aria-hidden="true"></i>').append($(" <a>", { href: aoptions[index].href, text : aoptions[index].text})));
    console.log(aoptions[index].text);
});

</script>
      <ul id="activityList"></ul>


dk4210 left a reply on Jquery Question • 5 months ago

If I add it logs to the console just fine. Hmm something with the append.

console.log(aoptions[index].text); 

or

console.log(aoptions[index].href);

dk4210 started a new conversation Jquery Question • 5 months ago

Hello Guys,

I have an issue with my jquery and I cant seem to figure it out

So I have a home.jsp file and I have two include statements

I'm including quicklinks,jsp and activity.jsp

In my quicklinks.jsp file i have the following and it displays a list as it should

<div class="headertxt">Quick Links</div>
<hr>
<script>
  var options = [
     { "href": "something1.jsp", 
       "text": "My linktext1" },
     { "href": "something1.jsp", "text": "My linktext12" },
     { "href": "something3.jsp", "text": "My linktext13" },
     { "href": "something4jsp", "text": "My linktext14" }
];
$(document).ready(function() {
$.each(options, function(index) {
    $("#myList").append($('<li> <i class="fa fa-link" aria-hidden="true"></i>').append($(" <a>", { href: options[index].href, text : options[index].text})));
});
});
</script>
      <ul id="myList"></ul>

When I add this to my activity.jsp file it doesn't display a list at all. I also don't receive any errors

<div class="headertxt">Activity</div>
<hr>
<script>
  var aoptions = [
     { "href": "l2something1.jsp", "text": "My other linktext1" },
     { "href": "l2something2.jsp", "text": "My other linktext2" },
     { "href": "l2something3jsp", "text": "My other linktext3" },
     { "href": "l2something4.jsp", "text": "My other linktext4" },
     { "href": "l2something5.jsp", "text": "My other linktext5" }
];

$.each(aoptions, function(index) {
    $("#activityList").append($('<li> <i class="fa fa-link" aria-hidden="true"></i>').append($(" <a>", { href: aoptions[index].href, text : aoptions[index].text})));
    console.log("Testing");
});

</script>
      <ul id="#activityList"></ul>

Any ideas why the activity list wont show?

6th December, 2017

dk4210 left a reply on Writing To A File With Start And End • 5 months ago

I have to get better with Regex.

dk4210 left a reply on Writing To A File With Start And End • 5 months ago

@burlresearch dude your'e awesome! It worked like a champ. Here's my final code. In hopes it will help others

    $file = $filename;
    $replace = $tcontent2;
    $replacement = "#start\n{$replace}\n#end\n";
    $contents = file_get_contents($file);
    $output = preg_replace("/#start.*#end\s+/sm", $replacement, $contents);
    file_put_contents($file,$output);

5th December, 2017

dk4210 left a reply on Writing To A File With Start And End • 5 months ago

Thanks! I will give it a try.

dk4210 left a reply on Writing To A File With Start And End • 5 months ago

Yea I need it between the two placeholders, due to there being code that should not be changed under the #end placeholder.

dk4210 started a new conversation Writing To A File With Start And End • 5 months ago

Hello guys,

This i mainly a PHP question.

I have a file that contains two comments

#start

#end

I would like to search in the file and find the #start and #end tags and replace whatever is between it with custom content.

Here's the code I have so far. This will only replace one line though, which is the #start line only. I need it to replace between the two comments.

$filename = (public_path('/../tests/Browser/mytest.txt'));

    $find = "#start";
    $replace = "whatever";
    $file = $filename;
    $contents = file_get_contents($file);
    $contents = str_replace($find,$replace,$contents);
    file_put_contents($file,$contents);

Please advise

Thanks!

5th November, 2017

dk4210 left a reply on Adding A Php Editor Within The Application • 6 months ago

I guess its sort of like TinyMCE but I want to read the contents of a .php file and modify it via the application. Basically, build test cases through my application.

dk4210 started a new conversation Adding A Php Editor Within The Application • 6 months ago

Hello Guys,

Is there a package out there that I could use to modify the contents of a php file. What I have is a dusk test file that I would like for my users to be able to modify through my application instead of via IDE. Is this possible? Not worried about any security implications due to this being an Intranet only app. Anyone have any ideas?

11th October, 2017

dk4210 left a reply on An Editor Within Laravel • 7 months ago

Anyone?

10th October, 2017

dk4210 started a new conversation An Editor Within Laravel • 7 months ago

Hello Guys,

Do you know of a package that I can open certain php files to edit within an editor via the site? It's not really a wysiwyg editor. It's basically a text editor. Is there such a thing?

Thanks, Dan

5th October, 2017

dk4210 left a reply on Send Json Data From Controller And View In Blade Templete • 7 months ago

Question here.

If I have a controller that has an if statement and based on the value from the it, how would i use Ajax to grab that value and enter it in the DOM of the view?

I know I need to create a route, just unsure how to get the value from the IF statement,

dk4210 left a reply on Send Json Data From Controller And View In Blade Templete • 7 months ago

Thanks guys!

4th October, 2017

dk4210 started a new conversation Send Json Data From Controller And View In Blade Templete • 7 months ago

I can't seem to get this to work for anything.

Here is my controller code

return response()->json(['test_result' => 'Test Failed']); 

I simply want to display the value "Test Failed" in the blade template.


<span data-id="{{ $testlist->id }}" class="finalstatus" style="display: none;">

{{ test_result }} 
         
          
</span>
 

This doesn't work. I can see that its passing the Json data in the the dev tools.

{test_result: "Test Passed"}
test_result: Test Passed"

I've tried json decode and many things with no success.

Please advise.

Thanks, Dan

29th September, 2017

dk4210 left a reply on Passing A Variable From One Method To The Other Within The Same Controller • 7 months ago

So How can I simply pass a string to my view then based on if isSuccessful() is true of false?

dk4210 left a reply on Passing A Variable From One Method To The Other Within The Same Controller • 7 months ago

Changed it to return and still no value. Baffling me

public function testresult($test_result){
            return $test_result;
        }

dk4210 left a reply on Passing A Variable From One Method To The Other Within The Same Controller • 7 months ago

Still no value returning

``

$this->testresult($test_result); //echo $process->getOutput();

}

    public function testresult($test_result){
        echo $test_result;
    }

I know the ajax call works cause I can do this

public function testresult($test_result){ echo "String to display"; }

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.