Recent Questions

متن مرتبط با «how to lock cells in excel 2013» در سایت Recent Questions نوشته شده است

15 years of blogging 500 posts later

  • You know, it's funny how the big milestones can sneak up on us. Just as I was putting the finishing touches on my recent Headless Hashnode tutorial, I realized it's been 15 years since I started this blogging jouey—and what's more, I was just 1 post away from blog update 500! It got me thinking about how this whole blogging adventure has shaped my career in web development. I’ve had the same enthusiasm for sharing my experiences as I have for coding, and what better way to commemorate this occasion than to share a bit of that story? Getting started It all started back in 2009 as a university student studying web design at the since-closed Hull School of Art and Design, An early assignment was creating a blog, not even a dynamically driven one - although mine certainly was - and the content expectations were simple too, just a post or 2 for every semester. For me, I began pouring my newfound knowledge into blog posts or tutorials—basic at first, like a PHP script connecting to a MySQL database. As time went on and my understanding broadened, so did the richness of my content. A huge motivation at the time was how helpful this content was for my classmates. I've always loved helping people, and seeing my content become a go-to reference for those around me boosted my confidence to no end. Tinkering and Transformation As the content of my blog evolved so did the blog platform itself. I've always loved deep-diving into how things work, and creating a blog has always been a cycl, ...ادامه مطلب

  • How to disable Laravel console commands

  • Suppose you find yourself in a situation where you need to disable or intercept a console command in Laravel. This tutorial will primarily focus on how to intercept the php artisan migrate command. We'll delve into the command method app/Console/Keel.php and explore how to prevent the migrate command from executing any actions. Inside the command method of app/Console/Keel.php In Laravel 11 use routes/console.php Intercept command You can intercept php artisan migrate and, instead, catch it and use a closure. Artisan::command('migrate', function () { // }); This would essentially stop the migrate command from doing anything. You could then print a message out: Artisan::command('migrate', function () { $this->info('Command NOT AVAILABLE. Use this: php artisan app:migrate'); }); Running an alteative command: To run a different command: Artisan::command('migrate', function () { $this->call('app:migrate'); }); In this case, a new command called app:migrate would be executed. Run command with a --path option: Artisan::command('migrate', function () { $this->call('app:migrate', [ '--path' => 'database/migrations' ]); }); Now when running php artisan migrate you will get an error: The "--path" option does not exist. The reason for this is the custom command does not have a path option. Lets create the command and add the option. Create a command: php artisan make:command AppMigrate This creates a class called AppMigrate.php inside, ...ادامه مطلب

  • Vue show and hide form elements

  • Introduction When working with forms, it is common to display or conceal various fields based on the options selected. I'll use Vue to conditionally show or hide form elements. In this example, I'm going to use an SFC (Single File Component) for ease of us. You'll see this in full in the putting it all together section below. For this to work it does not need to use a SFC, the HTML and JS will work when used in traditional setups i.e. having JS in javascript blocks and the HTML in a page's body. Creating the form elements Here I have 2 select elements, imagine the insurance type should only be displayed if the answer to Do you want insurance? was Yes <div> <label for="insurance">Do you want insurance?</label> <select id="insurance"> <option value="">Select</option> <option>Yes</option> <option>No</option> </select> </div> <div> <label for="insuranceType">Insurance Type</label> <select id="insuranceType"> <option value="">Select</option> <option>Home</option> <option>Travel</option> </select> </div> Binding Form Elements First, we need to create variables to bind the elements. Inside a script tag define a const for each element. <script setup> import {ref} from "vue"; const insurance = ref(); const insuranceType = ref(); </script> Notice that , ...ادامه مطلب

  • Extracting a time into select menus with PHP

  • That begs the question how do you separate the time into seperate elements? Making use of explode can work. Exploding where there a : so: $parts = explode(':', '14:25:00'); This would result in an array: [ "14", "25", "00", ] To use an element you can refer to its index for example $parts[0] would contain 14 Using them by their index is fine to do but kinda messy. I prefer to give each element a name using the list function list($hours, $minutes, $seconds) = explode(':', '14:25:00'); When using list() passing an array to it will allow you to name each index of the array in the order listed. Putting this into practice I like to define the null versions before using list to ensure the variables will exist. $estimatedTime = 14:25:00; $estimatedHour = null; $estimatedMinute = null; $estimatedSeconds = null; list($estimatedHour, $estimatedMinute, $estimatedSeconds) = explode(':', $estimatedTime); Now we have the variables that can be used in select menus: note I'm using Blade syntax here for readability. <select name="estimatedTime_hour"> <option value="0">Hours</option> @foreach(range(0,23) as $hour) <option value="{{ $hour }}" {{ old('estimatedTime_hour', $estimatedHour) == $hour ? 'selected=selected' : '' }}>{{ $hour }}</option> @endforeach </select> <select name="estimatedTime_minute"> <option value="0">Minutes&l, ...ادامه مطلب

  • Running HTTP requests in PhpStorm

  • Running API tests you may be tempted to open PostMan or another API client, did you know, you can run HTTP requests from inside PhpStorm directly? When developing a new API, you will want to run the API endpoints. Being able to run them without leaving PhpStorm speeds up your workflow. To start a request file, you can either select a HTTP Request file when using the new file or create a new scratch file. For a scratch file select the HTTP Request type. In either case a file ending in .http for example scratch.http You can name the file anything you like and have multiple files. The difference between having .http files in your projects and a scratch file is a scratch file is only stored in your .idea folder and not inside your project files, (outside of version control. Demo API Throughout this post, I will be using a sample public API https://reqres.in/ Request Format To create a request enter the type of request (GET, POST, PUT, PATCH, DELETE) followed by the URL to fetch. You can also set headers by typing them in the format of key:value If you need to pass through a body then type that out with a line break in a json format. Use ### to separate each request. Method Request-URI HTTP-Version Header-field: Header-value Request-Body ### Get Request To create a GET request type GET followed by the URL to fetch. You can also set headers by typing them in the forma, ...ادامه مطلب

  • My PhpStorm Setup

  • I've documented my PhpStorm setup, what theme I use, plugins, and keybindings. Theme I use the New UI which is located at Appearance & Behaviour -> New UI Once tued on I use the Light Theme: I like to keep things minimal, in fact, I tu off the toolbars and status bars by toggling distraction-free mode Plugins .env file support Environment variables completion based on .env, Dockerfile and docker-compose.yml files. Go to declaration(in .env file) and usages(in code), by Ctrl(Cmd)+click or hotkey(Ctrl(Cmd)-B, etc.) .env file syntax highlighter BitBucket Pull Requests (Paid) The plugin allows you to review Atlassian Bitbucket pull requests right in the IDE. It works with both Bitbucket Cloud and Bitbucket Server (6.x or later). Github Codespaces GitHub Codespaces provides a better development environment hosted in the cloud. Now you can spin up any codebase and connect from any compatible JetBrains IDE and start coding - whether it's a long-term project, or a short-term task like reviewing a pull request. Github Copilot GitHub Copilot provides autocomplete-style suggestions from an AI pair programmer as you code. You can receive suggestions from GitHub Copilot either by starting to write the code you want to use or by writing a natural language comment describing what you want the code to do. Jira This plugin provides the following functionalities: Fetch issues from the server with customizable, ...ادامه مطلب

  • I'm writing a new Laravel book on testing called Laravel Testing Cookbook

  • Laravel Testing Cookbook will cover common use cases and will be ready in a few months time. Sign up for the waitlist to be notified when it's ready! The book will cover both PestPHP and PHPUnit. Use the book as a reference for practical examples of testing URLs, Forms, Interactions, Transactions, using third-party API's and more. Join the waitlist or pre-order at https://laraveltestingcookbook.com/ بخوانید, ...ادامه مطلب

  • Laravel Extract Language to lang files

  • If you've already used JSON lang in your views, here's a handy package to extract all lang keys to language files. The package exports all your __(‘some text’) calls to language files. https://github.com/kkomelin/laravel-translatable-string-exporter Here's a video demo. [embedded content] بخوانید, ...ادامه مطلب

  • Upload images in Ckeditor 5 with Laravel

  • CKeditor 5 out of the box does not come with upload capabilities. Uploading is supported with its plugins, some are official paid plugins that require subscriptions. There are a few free options. Base64 upload adapter This plugin allows uploads that will convert an uploaded image into base64 data. Very easy to use but will require you to save the complete base64 code with the post, this can be get long. Docs Simple image adapter An image upload tool. It allows uploading images to an application running on your server using the XMLHttpRequest API with a minimal editor configuration. Docs Use the online builder to add the simple image adapter then download the generated bundle unzip and place the folder inside a publicly accessible place in Laravel. such as /public/js/ckeditor5 Then link ckeditor.js in the pages you want to use Ckeditor <script src="/js/ckeditor5/build/ckeditor.js"></script> Using Ckeditor in a textarea. I've made a blade component called Ckeditor so I can use: <x-form.ckeditor wire:model="content" name="content" /> To render the editor. I'm using Livewire and AlpineJS. The component looks like this: @props([ 'name' => '', 'label' => '', 'required' => false ]) @if ($label == '') @php //remove underscores from name $label = str_replace('_', ' ', $name); //detect subsequent letters starting with a capital $label = preg_split('/(?=[A-Z])/', $label); //display capi, ...ادامه مطلب

  • Adding pinned posts with Laravel

  • Let's say you have a blog and have posts ordered by their published date. Later you decide you want to pin certain posts. Pinned posts should be displayed before any other posts regardless of their published date. The Solution You can accomplish this by modifying the order clause in the query. Take this order: ->orderBy('published_at', 'desc') This will order posts by their published date in descending order. Adding a second-order clause: ->orderBy('is_pinned', 'desc')->orderBy('published_at', 'desc'); This time ordered by a is_pinned column then order by the published_at column. This will show the posts pinned first and then show the posts in their published order. The Setup Adding a migration to add a column called is_pinned to a posts table php artisan make:migration add_pinned_field_to_posts Migration <?php use IlluminateSupportFacadesSchema; use IlluminateDatabaseSchemaBlueprint; use IlluminateDatabaseMigrationsMigration; class AddPinnedFieldToPosts extends Migration { /** * Run the migrations. * * @retu void */ public function up() { Schema::table('posts', function (Blueprint $table) { $table->boolean('is_pinned')->default(false); }); } /** * Reverse the migrations. * * @retu void */ public function down() { Schema::table('posts', function (Blueprint $table) { $table->dropColumn('is_pinned'); , ...ادامه مطلب

  • Running Docker on M1 Mac - docker: compose is not a docker

  • When upgrading from an Intel mac to an Apple Silicone I noticed docker fails to run. I'm using Laravel Sail when Sail is installed or when a sail up command is attempted I get an error:  docker: 'compose' is not a docker command The reason for this is a docker-compose is now a plugin. Docker needs docker-compose to be installed. Use brew to install docker-compose brew install docker-compose Once installed sail will function normally without any extra setup. بخوانید, ...ادامه مطلب

  • Use PHP to generate table of contents from heading tags

  • I wanted to create a table of contents from the post's heading tags automatically without having to change the headings like adding an id or anchor. I started to look at existing solutions and came across this custom function on Stackoverflow by sjaak-wish function generateIndex($html) { preg_match_all('/<h([1-6])*[^>]*>(.*?)</h[1-6]>/',$html,$matches); $index = "<ul>"; $prev = 2; foreach ($matches[0] as $i => $match){ $curr = $matches[1][$i]; $text = strip_tags($matches[2][$i]); $slug = strtolower(str_replace("--","-",preg_replace('/[^da-z]/i', '-', $text))); $anchor = '<a name="'.$slug.'">'.$text.'</a>'; $html = str_replace($text,$anchor,$html); $prev <= $curr ?: $index .= str_repeat('</ul>',($prev - $curr)); $prev >= $curr ?: $index .= "<ul>"; $index .= '<li><a href="#'.$slug.'">'.$text.'</a></li>'; $prev = $curr; } $index .= "</ul>"; retu ["html" => $html, "index" => $index]; } This will generate a list of links based on the headings. To use the function call it and pass in your content, then specify the array key to use. html for the body and index for the table of contents. Table of contents: toc($post->content)['index'] Content: toc($post->content)['html'] بخوانید, ...ادامه مطلب

  • Expression Web Tutorial: How to Design a Website with Microsoft Expression Web

  • Microsoft's free web editor is a sophisticated WYSIWYG web editor with many features usually only found in commercial offerings (and no wonder, since it was previously something you had to buy). This tutorial series takes you through the process of designing a fully functional multi-page website with Expression Web., ...ادامه مطلب

  • What's the Difference Between a Domain Name Registrar and a Web Host?

  • This article on whether a domain name registrar is the same thing as a web host answers a question I was asked by a visitor., ...ادامه مطلب

  • How to Create a Blog

  • This guide takes you through the steps of setting up your own blog. (Note that the article deals specifically with making a blog. If you want some other type of site, you should read How to Create a Website instead.), ...ادامه مطلب

  • جدیدترین مطالب منتشر شده

    گزیده مطالب

    تبلیغات

    برچسب ها