ixudra

Developer at Ixudra

Hire Me

Experience

13,465

2 Best Reply Awards

  • Member Since 3 Years Ago
  • 134 Lessons Completed
  • 0 Favorites

12th September, 2017

ixudra left a reply on Two Way Binding Not Successful • 1 week ago

@phpMick Yeah, both workoutList and workout props are passed and bound using v-bind, see component files. If I inspect the workouts in the browser, I can clearly see that all props are present in the HTML

ixudra started a new conversation Two Way Binding Not Successful • 1 week ago

I'm making an app that allows me to drag and drop elements between lists so I can later store that into a database. I managed to ge this working using the Vue.Draggable library, which is a wrapper around SortableJS.

The problem that I'm having is that only the visual representation is matching. The data does not get updated when I drag an item from one list to another and I have no idea how to make this work. I tried doing some magic using the addToList method, but that didn't do me any good. It seems I can only access the HTML element in there and not the Vue data object it is representing, thus I can not update the data. Am I missing something? Am I not setting it up correctly?

    <div class="row" id="vue-root">
        <div class="col-lg-12">
            <div class="col-lg-4">
                <h2>Required</h2>
                <hiddit-workout-list v-bind="requiredWorkouts"></hiddit-workout-list>

                <h2>Optional</h2>
                <hiddit-workout-list v-bind="optionalWorkouts"></hiddit-workout-list>
            </div>
            <div class="col-lg-8">
                <div class="row col-lg-12">
                    <h1>Workout planning</h1>
                </div>
                <div class="row col-lg-12">
                    <div class="col-lg-4 dropzone">
                        <hiddit-workout-list v-bind="mondayMorningWorkouts"></hiddit-workout-list>
                    </div>
                    <div class="col-lg-4 dropzone">
                        <hiddit-workout-list v-bind="wednesdayMorningWorkouts"></hiddit-workout-list>
                    </div>
                    <div class="col-lg-4 dropzone">
                        <hiddit-workout-list v-bind="fridayMorningWorkouts"></hiddit-workout-list>
                    </div>
                </div>
                <div class="row col-lg-12">
                    <div class="col-lg-4 dropzone">
                        <hiddit-workout-list v-bind="mondayEveningWorkouts"></hiddit-workout-list>
                    </div>
                    <div class="col-lg-4 dropzone">
                        <hiddit-workout-list v-bind="wednesdayEveningWorkouts"></hiddit-workout-list>
                    </div>
                    <div class="col-lg-4 dropzone">
                        <hiddit-workout-list v-bind="fridayEveningWorkouts"></hiddit-workout-list>
                    </div>
                </div>
            </div>
        </div>
    </div>
Vue.component('workout', require('./components/Workout.vue'));
Vue.component('workout-list', require('./components/WorkoutList.vue'));

let vue = new Vue({

    el: '#vue-root',

    data: {

        workouts: [
            {
                id: 1,
                name: 'Cardio 1',
                type: 'cardio',
                optional: false,
                day: 'none',
                timeOfDay: 'none',
                sets: 3,
                reps: 10,
                rest: 24
            },
            {
                id: 2,
                name: 'Cardio 2',
                type: 'cardio',
                optional: true,
                day: 'none',
                timeOfDay: 'none',
                sets: 3,
                reps: 10,
                rest: 24
            },
            {
                id: 3,
                name: 'Agility 1',
                type: 'agility',
                optional: false,
                day: 'none',
                timeOfDay: 'none',
                sets: 3,
                reps: 10,
                rest: 24
            },
            {
                id: 4,
                name: 'Agility 2',
                type: 'agility',
                optional: true,
                day: 'none',
                timeOfDay: 'none',
                sets: 3,
                reps: 10,
                rest: 24
            },
            {
                id: 5,
                name: 'Ropeskipping 1',
                type: 'rope',
                optional: false,
                day: 'none',
                timeOfDay: 'none',
                sets: 3,
                reps: 10,
                rest: 24
            },
            {
                id: 6,
                name: 'Ropeskipping 2',
                type: 'rope',
                optional: true,
                day: 'monday',
                timeOfDay: 'morning',
                sets: 3,
                reps: 10,
                rest: 24
            },
            {
                id: 7,
                name: 'Ropeskipping 3',
                type: 'rope',
                optional: true,
                day: 'monday',
                timeOfDay: 'morning',
                sets: 3,
                reps: 10,
                rest: 24
            },
            {
                id: 8,
                name: 'Ropeskipping 4',
                type: 'rope',
                optional: true,
                day: 'wednesday',
                timeOfDay: 'evening',
                sets: 3,
                reps: 10,
                rest: 24
            }
        ]
    },

    methods: {

    },

    computed: {

        requiredWorkouts() {
            return {
                day: 'none',
                timeOfDay: 'none',
                workouts: this.workouts.filter( workout => !workout.optional && workout.day === 'none' && workout.timeOfDay === 'none' )
            };
        },

        optionalWorkouts() {
            return {
                day: 'none',
                timeOfDay: 'none',
                workouts: this.workouts.filter( workout => workout.optional && workout.day === 'none' && workout.timeOfDay === 'none' )
            };
        },

        mondayMorningWorkouts() {
            return {
                day: 'monday',
                timeOfDay: 'morning',
                workouts: this.workouts.filter( workout => workout.day === 'monday' && workout.timeOfDay === 'morning' )
            };
        },

        mondayEveningWorkouts() {
            return {
                day: 'monday',
                timeOfDay: 'evening',
                workouts: this.workouts.filter( workout => workout.day === 'monday' && workout.timeOfDay === 'evening' )
            };
        },

        wednesdayMorningWorkouts() {
            return {
                day: 'wednesday',
                timeOfDay: 'morning',
                workouts: this.workouts.filter( workout => workout.day === 'wednesday' && workout.timeOfDay === 'morning' )
            };
        },

        wednesdayEveningWorkouts() {
            return {
                day: 'wednesday',
                timeOfDay: 'evening',
                workouts: this.workouts.filter( workout => workout.day === 'wednesday' && workout.timeOfDay === 'evening' )
            };
        },

        fridayMorningWorkouts() {
            return {
                day: 'friday',
                timeOfDay: 'morning',
                workouts: this.workouts.filter( workout => workout.day === 'friday' && workout.timeOfDay === 'morning' )
            };
        },

        fridayEveningWorkouts() {
            return {
                day: 'friday',
                timeOfDay: 'evening',
                workouts: this.workouts.filter( workout => workout.day === 'friday' && workout.timeOfDay === 'evening' )
            };
        }

    }

});
<!-- Workout.vue -->
<template>

    <div class="workout">
        {{ name }}
    </div>

</template>


<script>

    export default {

        props: {
            id: {
                type: Number,
                required: true,
            },
            name: {
                type: String,
                required: true,
            }
        }

    }

</script>
<!-- WorkoutList.vue -->
<template>

    <draggable v-model="workouts" :options="{ group: 'workouts' }" @add="addToList">
        <transition-group class="workout-list">
            <workout v-for="workout in workouts" :key="workout.id" v-bind="workout" class="item"></hiddit-workout>
        </transition-group>
    </draggable>

</template>


<script>

    import draggable from 'vuedraggable'
    import Workout from './Workout.vue'

    export default {

        props: {
            workouts: {
                type: Array,
                required: false
            },
            day: {
                type: String,
                required: true
            },
            timeOfDay: {
                type: String,
                required: true
            }
        },

        components: {
            draggable,
            Workout
        },

        methods: {
            addToList: function(event) {
                // event.item is a HTML element, no connection the the actual data element to be found...
                event.item.day = this.day;
                event.item.timeOfDay = this.timeOfDay;
            }
        }

    }

</script>

5th September, 2017

ixudra left a reply on How To Test My Package? • 2 weeks ago

@topvillas Mocking the CurlService doesn't solve anything. That class is just an intermediary, only 2 lines of code in there. The real complexity is in the Builder class, that's the one I need to test. And I don't need the CurlService at all to do that

That said, I did consider partial mocking for the Builder class. I could help to get me some coverage at least, but not nearly the level I'm aiming towards

ixudra left a reply on How To Test My Package? • 2 weeks ago

@topvillas That is the general idea, yes, but I have no idea how to accomplish it. cURL is a PHP extension, you can't just mock that. Additionally, the package is platform independent so I don't have a IOC container or facade I can rely on

ixudra started a new conversation How To Test My Package? • 2 weeks ago

I maintain several packages that are available for download via composer. To my shame, most of these do not have tests, despite me using them extensively in my day to day activities. Reason is simple: I don't know how to make them work properly.

For example: my most used package is ixudra/curl, a package for easily sending cURL requests through a fluent query builder. Ideally, I'd want to set up tests that cover all different methods and options, such as GET requests, POST requests, file upload, various header types, ... but I have no idea how to do this. I can't just use random websites, I'll be fixing my tests all the time if they change their interface. I could set up a website myself and provide all the required routes but that just seems silly

How could I best tackle this issue? How can I write reliable tests without external dependencies?

Thx

27th August, 2017

ixudra left a reply on Laravel Mix Failures - Possible Dependency Issue • 4 weeks ago

It seems NodeJs was the problem here. I recently updated to Node 8.4.* and all my problems disappeared

ixudra started a new conversation How Is JavaScript Set Up In Laravel? • 4 weeks ago

So this is the default app.js file in the Laravel framework:


window._ = require('lodash');

/**
 * We'll load jQuery and the Bootstrap jQuery plugin which provides support
 * for JavaScript based Bootstrap features such as modals and tabs. This
 * code may be modified to fit the specific needs of your application.
 */

try {
    window.$ = window.jQuery = require('jquery');

    require('bootstrap-sass');
} catch (e) {}

/**
 * We'll load the axios HTTP library which allows us to easily issue requests
 * to our Laravel back-end. This library automatically handles sending the
 * CSRF token as a header based on the value of the "XSRF" token cookie.
 */

window.axios = require('axios');

window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';

/**
 * Next we will register the CSRF Token as a common header with Axios so that
 * all outgoing HTTP requests automatically have it attached. This is just
 * a simple convenience so we don't have to attach every token manually.
 */

let token = document.head.querySelector('meta[name="csrf-token"]');

if (token) {
    window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
    console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}

/**
 * Echo exposes an expressive API for subscribing to channels and listening
 * for events that are broadcast by Laravel. Echo and event broadcasting
 * allows your team to easily build robust real-time web applications.
 */

// import Echo from 'laravel-echo'

// window.Pusher = require('pusher-js');

// window.Echo = new Echo({
//     broadcaster: 'pusher',
//     key: 'your-pusher-key'
// });

I understand what is going on here - we use requirejs to load in lodash, jQuery, bootstrap, axios and possibly pusher as the file is loaded in. Thing is, I don't understand how this is happening. I looked at the requirejs documentation and it seems completely different from what I'm seeing here. How does the app know to look for ~/node-modules/jquery/dist/jquery.js, only from the string 'jquery'? There doesn't seem to be any pattern as far as I can see, so how is that set up?

Let's say I have a small js file from a friend of mine, how could I include it? Right now, I merge them using the mix file, but it seems like there should be a more elegant way of doing this... ?

6th July, 2017

ixudra left a reply on Supervisor Not Found • 2 months ago

Honestly I don't really remember because it's been such a long time but if I had to guess:

[[email protected]]# supervisorctl
unix:///tmp/supervisor.sock refused connection
supervisor> status
unix:///tmp/supervisor.sock refused connection
supervisor> reread
error: <class 'socket.error'>, [Errno 111] Connection refused: file: /usr/lib64/python2.7/socket.py line: 224
supervisor> exit

basically means that the service was not started correctly before accessing the control panel. So what you need to do to fix that, is (surprise surprise) start supervisor:

sudo service supervisor restart

After that, you should be able to access the control panel without issue

4th July, 2017

ixudra left a reply on Laravel Mix Failures - Possible Dependency Issue • 2 months ago

@kehator To be honest: I'm about 98.749% sure the path problem will resolve itself as soon as I manage to update my Laravel mix to > 0.8, it's a know bug that @JeffreyWay actually added a fix for (see Github link in original post). I just have no idea what is going wrong here

ixudra left a reply on Laravel Mix Failures - Possible Dependency Issue • 2 months ago

@kehator I believe you misread: I am NOT using a custom webpack config file.

ixudra left a reply on Laravel Mix Failures - Possible Dependency Issue • 2 months ago

Any ideas?

2nd July, 2017

ixudra started a new conversation Laravel Mix Failures - Possible Dependency Issue • 2 months ago

I'm trying to manage my dependencies using Laravel Mix. Installing my dependencies works fine, however running npm run dev brings me to a world of trouble.

Here is my package.json file:

{
  "private": true,
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  },
  "devDependencies": {
    "axios": "^0.16.2",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.0.1",
    "eonasdan-bootstrap-datetimepicker": "^4.17.0",
    "modernizr": "^3.3.1",
    "restfulizerjs": "^1.0.0",
    "jquery": "^3.1.1",
    "laravel-mix": "^1.0",
    "lodash": "^4.17.4",
    "vue": "^2.1.10"
  }
}

Here is my Laravel mix file:

let mix = require('laravel-mix');

var paths = {
    'bootstrap':        './node_modules/bootstrap-sass/assets/',
    'dateTimePicker':   './node_modules/eonasdan-bootstrap-datetimepicker/src/',
    'jquery':           './node_modules/jquery/',
    'modernizr':        './node_modules/modernizr/',
    'moment':           './node_modules/moment/',
    'momentTimezone':   './node_modules/moment-timezone/',
    'restfulizer':      './node_modules/restfulizerjs/'
};

mix

// Compile SASS files
    .sass('resources/assets/bootstrap/sass/app.scss', 'public/bootstrap/css/app.css')

    // Copy fonts to public directory
    .copy(paths.bootstrap + 'fonts/bootstrap/**', 'public/bootstrap/fonts')

    // Combine Javascript files
    .js([
        paths.jquery + "dist/jquery.js",
        paths.bootstrap + "javascripts/bootstrap.js",
        paths.moment + "moment.js",
        paths.dateTimePicker + "js/bootstrap-datetimepicker.js",
        paths.restfulizer + "jquery.restfulizer.js",
        "resources/assets/bootstrap/js/app.js"
    ], 'public/bootstrap/js/app.js', './')

    // Version stylesheet and javascript file
    .version();

The error that I get is the following:

$ npm run dev

> @ dev /var/www/my-hiddit/htdocs
> npm run development


> @ development /var/www/my-hiddit/htdocs
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.output.path: The provided value "public" is not an absolute path!

That brought me to these posts on the Laravel Mix github page. At first, it didn't seem to apply to me because I have Laravel mix at ^1.0 in my package.json file. But then I ran a node list --depth=0 and got the following:

$ npm list --depth=0
/var/www/my-hiddit/htdocs
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] invalid
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

I've tried to fix this in any number of ways, but no matter what I do Laravel Mix always stays stuck at 0.7.5 - even if I fix the version or if I remove all other dependencies from the file. I assume this is what's causing my other problem but I have absolutely no idea why this is happening or how I can fix it.

Any help would be appreciated.

OS: Ubuntu 16 Ruby version: 2.3.1 Node version: 8.0.7 NPM version: 5.0.3

12th April, 2017

ixudra left a reply on Non-searchable Arguments Not Returned By Algolia • 5 months ago

Any suggestions?

6th April, 2017

ixudra started a new conversation Non-searchable Arguments Not Returned By Algolia • 5 months ago

I have a small app where I use algolia. Amongst other things, I store a profile image in Algolia. These image urls and alts should not be searchable so I exclude them in the algolia rankings screen. This works fine, except for the fact that these fields are now no longer returned in the search results. This is no good and absolutely makes no sense to me.

Is this normal behavior or am I doing something wrong?

14th February, 2017

ixudra left a reply on Composer Dependency Issues • 7 months ago

@KamalKhan That did indeed solve this issue, but it wasn't what I was looking for. I was hoping to set up an app where I could test all my own packages on dev-master, but I guess that's not possible if they depend on each other.

Thanks everyone for the help

10th February, 2017

ixudra left a reply on Composer Dependency Issues • 7 months ago

@KamalKhan That was one of the first things I tried, same error.

ixudra started a new conversation Composer Dependency Issues • 7 months ago

I'm having some issues with downloading a couple of packages via composer. As far as I can see, there should not be a problem. Sadly, I keep getting an error saying that there is a mismatch in the dependencies.

Composer.json file for the application:

{
    "name": "Project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "laravelcollective/html": "~5.3",
        "laracasts/presenter": "0.2.*",
        "arcanedev/log-viewer": "^4.0",
        "ixudra/translation": "dev-master",
        "ixudra/portfolio": "dev-master",
        "ixudra/validation": "dev-master",
        "ixudra/core": "dev-master",
        "ixudra/csi": "dev-master"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "scripts": {
        "post-install-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postInstall",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled"
        ],
        "post-update-cmd": [
            "Illuminate\\Foundation\\ComposerScripts::postUpdate",
            "php artisan optimize",
            "php artisan ide-helper:generate"
        ]
    }
}

Composer.json for package 1:

{
    "name": "ixudra/portfolio",
    "version": "0.2.0",
    "require": {
        "php": ">=5.4.0",
        "illuminate/support": "~5.0",
        "laravelcollective/html": "~5.0",
        "ixudra/core": "~5.0",
        "ixudra/translation": "~5.1",
        "ixudra/imageable": "~6.0",
        "laracasts/presenter": "0.2.*"
    },
    "autoload": {
        "classmap": [
            "src/database/migrations"
        ],
        "psr-4": {
            "Ixudra\\Portfolio\\": "src/"
        }
    }
}

Composer.json for package 2:

{
    "name": "ixudra/core",
    "version": "5.3",
    "require": {
        "php": ">=5.4.0",
        "illuminate/support": "~5.0",
        "laracasts/presenter": "0.2.*"
    },
    "autoload": {
        "classmap": [
            "src/migrations"
        ],
        "psr-4": {
            "Ixudra\\Core\\": "src/"
        }
    }
}

This is the error I receive:

$ composer update --no-scripts
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for ixudra/portfolio dev-master -> satisfiable by ixudra/portfolio[dev-master].
    - ixudra/portfolio dev-master requires ixudra/translation ~5.1 -> satisfiable by ixudra/translation[5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.1.4, 5.1.5, 5.2.0, 5.2.1] but these conflict with your requirements or minimum-stability.

As far as I can see, the ixudra/translation dependency should be resolved by [dev-master]. I don't understand why this is not the case. If I remove the ixudra/portfolio package from the app, the dev-master version of ixudra/translation is downloaded without a problem... Can someone please understand what I am doing wrong here?

30th November, 2016

ixudra left a reply on Catching Errors In CURL Requests • 9 months ago

@jekinney Try-catch will not work as controller and cURL request are in two different applications. My question is related to recovering the error message in the second application, where no actual exception is thrown. Also your condescending tone is noted but not appreciated

@ejdelmonico As you can see from my example, using curl_error($e); returns a generic error message instead of the `You shall not pass that I expect. Maybe there is something wrong with my cURL request, but in all my experiments, I have never been able to make this work.

29th November, 2016

ixudra started a new conversation Catching Errors In CURL Requests • 9 months ago

Question about cURL: say I have the following code

class MyController {

    public function index()
    {
        throw new \InvalidArgumentException('You shall not pass!!');
    }
}

Now let's say that I want to call this piece of code via cURL:

// Create a curl handle to a non-existing location
$ch = curl_init('http://someUrl.net/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

if(curl_exec($ch) === false)
{
    echo curl_error($ch);
}

// Close handle
curl_close($ch);

The code itself works fine, only I don't see my custom exception message. All I see is error code 500 and the following error message:

The requested URL returned error: 500 Internal Server Error

This message is not very helpful as I want to see what exactly went wrong. Is there a way to do this?

27th November, 2016

ixudra left a reply on Error When Upgrading To Laravel 5.3 • 9 months ago

Found the problem. Our current installation of newRelic is incompatible with Laravel 5.2-5.3, which is causing the issue. Took me a while to find it because the stack trace doesn't actually show the full class name, but found it through dd(). Solution is to upgrade your newRelic to a more recent version:

https://discuss.newrelic.com/t/php-agent-breaks-laravel-5-2/32801/31

25th November, 2016

ixudra left a reply on Error When Upgrading To Laravel 5.3 • 10 months ago

@freekmurze The bootstrap/compiled.php file has been removed so that is also not causing the problem..

24th November, 2016

ixudra left a reply on Error When Upgrading To Laravel 5.3 • 10 months ago

@Tirke Yes, I have the routes directory in my root with web, api and console files. The original routes.php has been deleted

@ejdelmonico All arguments from the boot methods in all ServiceProviders have been removed

Like I said: locally I have no issues, the site runs perfectly in 5.3. It all goes wrong as soon as I deploy to our staging server

23rd November, 2016

ixudra started a new conversation Error When Upgrading To Laravel 5.3 • 10 months ago

I upgraded my app to Laravel 5.3 from 5.2, no errors locally. But when I deploy to the server, the following error occurs:

BadMethodCallException in Macroable.php line 74: Method after does not exist.

    in Macroable.php line 74
    at Router->__call('after', array(object(AfterFilter))) in BootProviders.php line 17
    at Router->after(object(AfterFilter)) in BootProviders.php line 17
    at Application->boot() in BootProviders.php line 17
    at BootProviders->bootstrap(object(Application)) in Application.php line 203
    at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 254
    at Kernel->bootstrap() in Kernel.php line 145
    at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
    at Kernel->handle(object(Request)) in index.php line 57

I have no clue where this is coming from or even where to begin looking for the solution. I tried reverting back to 5.2 and removing all cached files (routes, config,...) but that didn't do anything. Any suggestions are welcome

3rd May, 2016

ixudra started a new conversation Laravel Queries • 1 year ago

I was wondering exactly how queries are handled in Laravel. for a while now, we are experiencing some issues on our database server. At some times, for no apparent reason, our app can no longer connect to the database and collect information from it:

[2016-04-15 12:17:39] production.ERROR: exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'db-001.server.com' (99 "Cannot assign requested address")' in /path/to/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:55

This happens on random times, even in the middle of the night when nobody is actually using the app. The issue always resolves itself after a minute or two, but it's a huge problem if you are actually working on something important at that particular moment.

I've contacted the hosting support and they expect it to be some kind of pooling issue, saying that laravel is making too many database connections and not closing them properly. Hence my question: how does this work in Laravel? Is every query a new connection or is this handled more gracefully (per transaction,...)?

24th April, 2016

ixudra left a reply on Where Can I Get A Step By Step Guide On Installing Packages In Laravel • 1 year ago

@AndrewBen Did you manage to resolve the issue you were having?

ixudra left a reply on Sending Emails With Mailgun • 1 year ago

Sadly, no.. The domain needs to be verified before you can send emails... And the domain will not be verified until the DNS changes have been propagated :-(

ixudra left a reply on Sending Emails With Mailgun • 1 year ago

Well, I have to add two TXT but also one CNAME for the link tracking, so I guess I just have to wait it out either way..

ixudra left a reply on Sending Emails With Mailgun • 1 year ago

From mailgun.com:

Once you've added the appropriate DNS records for verification, it can take 24-48 hours for them to propagate.

I'm not making this stuff up...

ixudra left a reply on Sending Emails With Mailgun • 1 year ago

Well I did add the domain, but it takes 24-48h for it to verify... As a matter of fact, my domain just verified and I was able to send emails after that.

So how and when would I use the sandbox? I'm still trying to make sense of this..

ixudra started a new conversation Sending Emails With Mailgun • 1 year ago

I'm trying to use Mailgun to send emails to my users in my app. Unfortunately, I can't get this to work. I added a custom domain and I'm waiting for that to resolve. In the meantime, I'd like to continue working on my app on my development machine. I can't get this to work and it's getting really frustrating.

First, I tried sending it using the mailgun driver:

MAIL_DRIVER=mailgun
MAILGUN_DOMAIN=sandbox-------------------.mailgun.org
MAILGUN_SECRET=key-----------------------

Unfortunately, I get the following error:

Client error: `POST https://api.mailgun.net/v3/sandbox-----------------------.mailgun.org/messages.mime` resulted in a `400 BAD REQUEST` response: { "message": "Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authoriz (truncated...)

So instead, I tried using smtp:

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=25
MAIL_USERNAME=postmaster@sandbox------------------------.mailgun.org
MAIL_PASSWORD=somePassword
MAIL_ENCRYPTION=null

which also thrown an exception:

Expected response code 250 but got code "554", with message "554 Sandbox subdomains are for test purposes only. Please add your own domain or add the address to authorized recipients in domain settings. " 

Which begs the question: what are these sandbox domains for? How can and should they be used? I'm at a loss here..

And how are you supposed to send emails in a development setting using Mailgun?

25th March, 2016

ixudra left a reply on Supervisor Not Found • 1 year ago

@ohffs The first command doesn't yield any output at all, but that doesn't surprise me. I knew from the start that the setup wasn't perfect. As an example: the supervisor.conffile is not stored in /etc/supervisor, as you would think, but instead can be found in the /etc directory itself. Additionally, the queues themselves are defined inside the config file instead of using a directory with additional files, as is common.

ixudra left a reply on Supervisor Not Found • 1 year ago

@ohffs No success, alas.. Distro: CentOS Linux release 7.2.1511 (Core)

ixudra left a reply on Supervisor Not Found • 1 year ago

@ohffs Supervisor is not listed in the output, which I guess means that the service is not known. Does this mean the installation wasn't done correctly? I inherited this setup from a previous developer, so I have no knowledge of what he has done with it or why.

How can I fix this issue?

ixudra left a reply on Supervisor Not Found • 1 year ago

Problem still persists - any help is appreciated

23rd March, 2016

ixudra left a reply on Rebuild Artisan Command • 1 year ago

@frezno I think you misunderstand the question. I know how to create commands, what I want to know is how to "recover" the full command that has been entered into the console by the user. My current code is like this:


    protected function getFullCommandName()
    {
        $name = $this->name;

        foreach( $this->getArguments() as $argument ) {
            $name .= ' '. $this->input->getArgument( $argument[ 0 ] );
        }

        foreach( $this->getOptions() as $option ) {
            $key = $option[ 0 ];
            $name .= ' --'. $key .'='.$this->input->getOption( $key );
        }

        return $name;
    }

but I was wondering if there was maybe a simpler solution

ixudra started a new conversation Rebuild Artisan Command • 1 year ago

I'm trying to make a script that logs which artisan commands are executed in my web apps. This should include the name of the command, as well as the arguments and the options that were used to run it. Does anyone know if there is a way to easily get a hold of the actual command or do I need to rebuild it myself?

ixudra started a new conversation Supervisor Not Found • 1 year ago

I'm trying to restart supervisor on my server but I can't seem to get it going. It seems the process is already started but I get a connection error if I try to access the control panel:

[root@server]# supervisorctl
unix:///tmp/supervisor.sock refused connection
supervisor> status
unix:///tmp/supervisor.sock refused connection
supervisor> reread
error: <class 'socket.error'>, [Errno 111] Connection refused: file: /usr/lib64/python2.7/socket.py line: 224
supervisor> exit

I then try to restart the process but that also doesn't seem to work.

[root@server content-audit]# service supervisorctl restart
Redirecting to /bin/systemctl restart  supervisorctl.service
Failed to restart supervisorctl.service: Unit supervisorctl.service failed to load: No such file or directory.
[root@server content-audit]# service supervisor restart
Redirecting to /bin/systemctl restart  supervisor.service
Failed to restart supervisor.service: Unit supervisor.service failed to load: No such file or directory.
[root@server content-audit]# service supervisord restart
Redirecting to /bin/systemctl restart  supervisord.service
Failed to restart supervisord.service: Unit supervisord.service failed to load: No such file or directory.

Anyone have any idea what this could be?

15th March, 2016

ixudra left a reply on Problems With Missing PHP Extensions • 1 year ago

Well I solved it by adding the xml extension, which took care of the problem. This solved this specific issue but the overall problem is still there though: e.g the Imagick extension still can't be installed right out of the box, even though it's a predefined option in the Puphpet UI (same error as above).

So my question remains: is there a manual somewhere that can explain to me how this is possible, what packages are common and/or how I an avoid possible problems like this in the future?

ixudra left a reply on Events Are "handled" Twice • 1 year ago

@hilnius Occam's razor: the simplest explanation is usually the correct one. So if we translate that to this particular situation: you probably messed up somewhere and you're actually firing two events instead of one. That's where I went wrong :-)

10th March, 2016

ixudra started a new conversation Measure Website Performance • 1 year ago

I'm building a web performance suite for a client which measures stuff like amount of JS files, amount of images, total image size,... for webpages of their clients, so no root access to the webservers. Two of the things I need to measure are 1) total page load time and 2) total website CPU usage. I'm currently trying to figure how this can be done.

Regarding 1) it seems the best option I have is to start a times before doing a cURL request and stop the timer when the request is done. Problem is I'm not sure if that also includes the time it would take to render the page and perform any Javascript operations that get triggered on page load. My guess is no, which would make this not a very accurate measurement

  1. seems just impossible to me. I'd have to profile the machine on which the actual website is running, which seems impossible.

I was just wondering if anyone here had any experience with something similar and could help me out.

8th March, 2016

ixudra started a new conversation Problems With Missing PHP Extensions • 1 year ago

Trying to set up a new Puphpet box but having difficulties with it every single time. About 80% of the stuff in my config file works as intended, the rest is just pure mess and a pain to work out. The latest issue is the following:

$ composer install
You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for phpunit/phpunit 4.8.21 -> satisfiable by phpunit/phpunit[4.8.21].
    - phpunit/phpunit 4.8.21 requires ext-dom * -> the requested PHP extension dom is missing from your system.
  Problem 2
    - phpunit/phpunit 4.8.21 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - codeception/codeception 2.1.5 requires phpunit/phpunit ~4.8.0 -> satisfiable by phpunit/phpunit[4.8.21].
    - Installation request for codeception/codeception 2.1.5 -> satisfiable by codeception/codeception[2.1.5].

So naturally I try to change my config file and provision the box once because I don't want to fix it manually now, then forget about it and have to go through this mess all over again. I add the dom extension to the config file, run my vagrant up --provision command once again but then I receive the following error:

 Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5.6-dom' returned 100: Reading package lists...
==> dev: Building dependency tree...
==> dev: Reading state information...
==> dev: E: Unable to locate package php5.6-dom
==> dev: E: Couldn't find any package by regex 'php5.6-dom'
==> ixudra-dev: Error: /Stage[main]/Puphpet_php/Puphpet::Php::Module[dom]/Php::Module[dom]/Package[PhpModule_dom]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install php5.6-dom' returned 100: Reading package lists...
==> dev: Building dependency tree...
==> dev: Reading state information...
==> dev: E: Unable to locate package php5.6-dom
==> dev: E: Couldn't find any package by regex 'php5.6-dom'

This is really pissing me off because I constantly run into problems like this. I had the same thing with the imagick extension just hours earlier. Can someone explain to me how this is possible? PHP 5.6 is over one year old now, how can these extensions be "missing"?? And which are the steps I need to follow to fix this?

Thanks

25th February, 2016

ixudra left a reply on Complicated Database Query • 1 year ago

@jlrdw you are correct, the suggestion also applied to databases directly - my mistake. I did actually look at it before I answered, I'm not an idiot. The group by however doesn't help me since it gives me only one result instead of all of them.

How does a procedure help me btw, what would that look like?

ixudra left a reply on Complicated Database Query • 1 year ago

@jlrdw Same response as I gave before: this is NOT an eloquent issue, rather a database issue. I need to be able to run this query directly on the database without any PHP manipulation. I just posted in the Eloquent section because it seemed the best place for it.

ixudra left a reply on Complicated Database Query • 1 year ago

The exact schema hardly matters, the example I gave describes the principle well enough. The actual query involves a couple more joins, but that's about it.

table: users {
    'name' : string
}
table: friends {
    'name' : string,
    'user_id': integer
}

ixudra left a reply on Complicated Database Query • 1 year ago

Ok, maybe I should clarify: this is NOT an eloquent issue, rather a database issue. I need to be able to run this query directly on the database without any PHP manipulation. I just posted in the Eloquent section because it seemed the best place for it.

@ohffs Thanks for trying anyways

ixudra started a new conversation Complicated Database Query • 1 year ago

I inherited an old database for a new client, which contains several tables with one-to-many relationships. The client runs CSV exports of these relationships but now he wants me to replace the export with a query that he can use to extract the same data. I have looked into this and as far as I can tell, this is just not possible. I was hoping to get some feedback here.

This is (a simplified version of) the relationship I need to query

User -> hasMany -> Friends

Now each User has 75 or more Friends. If I look up all the friends for a given User, I thus receive 75 or more rows from the database, like so:

| User_id | Friend_id |
|------|--------|
| John | Jane |
| John | Jimmy |
| John | Jeremy |

The objective of the query I'm asked to write, is to give the following result: | User_id | Friend_1_id | Friend_2_id | Friend_3_id | | John | Jane | Jimmy | Jeremy |

The only thing I can see is joining with the `Friends` table for about 75 times, but given that there are over  3.000.000 records in that table, that doesn't sound like such a good idea to me... Am I missing something here?

27th January, 2016

ixudra left a reply on Increase Disk Space • 1 year ago

After further analysis I found that most if not all of the problems are due to MySQL. It has gotten to the point where MySQL refuses to start due to disk space. The disk distribution is like this:

$ sudo du -scmh /var/*
1.4M    /var/backups
425M    /var/cache
8.6M    /var/data
12G /var/lib
4.0K    /var/local
0   /var/lock
31M /var/log
4.0K    /var/mail
4.0K    /var/opt
0   /var/run
20K /var/spool
4.0K    /var/tmp
3.9G    /var/www
16G total

So there should be plenty of space left, but MySQL still refuses to start. This means I can't connect to it at all - not via sequel pro or via mysql command in the terminal. The /var/mysql/lib file/dir is 12GB in size. Does anyone know how I can solve this??

26th January, 2016

ixudra left a reply on Gulp Compile Problem • 1 year ago

Impossible to tell unless you show us your gulp file :-)

ixudra left a reply on Increase Disk Space • 1 year ago

@bashy the issue occurred when I tried to import a new database dump. The previous dump was about 2GB, which was no problem. The new dump however, is about 6GB, which did not make my computer very happy...

@fideloper I tried that, it seemed to work at first but I'm still getting errors regarding disk space eery now and again. I increased the disk with 20GB, so that should have done the trick as far as I can see.

18th January, 2016

ixudra started a new conversation Increase Disk Space • 1 year ago

I'm currently running out of disk space on my VM and I would like to increase it. Sadly, I'm using VMWare and I can only find information regarding VirtualBox.

Does anyone know how to do this??

Edit Your Profile
Update

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