Stealing Secrets from Students

Opinion

Stundents College Walking Youth
Stealing Secrets from Students

USA – -(AmmoLand.com)- When most Americans think of espionage, we think of debonair foreign spies sneaking around military compounds – or bespectacled hackers hammering away at keyboards to steal top secret information from foreign adversaries.

But there is an entire world of espionage happening right under our noses – at American colleges and universities.

Foreign intelligence services routinely probe computer systems at US higher education institutions – and they also enlist (or implant) students and professors as assets to pass important research and findings to their spy agencies.

The main goal isn’t typically to learn any classified state secrets (not in academic espionage anyway). Foreign actors want to steal the important technological advancements, research, and innovations being created by our nation’s best and brightest researchers and scientists.

Back in 2013, the Commission on the Theft of Intellectual Property said that this academic espionage made up a significant part of the estimated $300 billion of intellectual property theft America endured that year. According to the commission, “American scientific innovations and new technologies are tracked and stolen from American universities, national laboratories, private think tanks, and start-up companies, as well as from the major R&D centers of multinational companies.”

This is a serious problem for the United States. If this level of academic espionage continues, our ability to lead the world in innovation and new technology could be severely hampered – and the future could be defined by the countries who are stealing our ideas.

One of the biggest offenders is China. I detail the many ways in which the Chinese Communist Party is spying on Americans (and the Chinese people) in my new book Trump vs. China: America’s Greatest Challenge, which comes out in October. Former National Counterintelligence Executive Michelle Van Cleave told the US-China Economic and Security Review Commission on June 9, 2016 that “hundreds of thousands of students and academicians” aid China’s spy operations. Many of these students, professors, and researchers (either willingly or through intense pressure and coercion from the Chinese Communist Party) help to “potentially extend the reach of Chinese intelligence into the core structures of our nation’s security,” Van Cleave told the commission.

Of particular concern are China’s Confucius Institutes that have been established on campuses in the US and across the world. At first blush, these institutes appear to be legitimate academic foreign exchange programs promoting Chinese language and cultural studies. However, they are also used to spread Chinese Communist Party propaganda and soft power by promoting the party’s vision of China. Concerns have been raised that they could be used for espionage efforts. On February 13, 2018, FBI Director Christopher Wray told the Senate Intelligence Committee that China is beginning to pull back on this effort, but the institutes are still “something that we’re watching warily and in certain instances have developed … appropriate investigative steps.”

Luckily, there is an ongoing effort in Congress to curb this activity and protect American colleges and universities from being helpless targets of foreign espionage.

The Stop Higher Education Espionage and Theft Act of 2019 (or SHEET Act) was introduced in the Senate by Senator Ted Cruz of Texas. It is being carried in the US House of Representatives by Florida Representative Francis Rooney.

This bill will create a new way for federal law enforcement to designate an entity suspected of spying in our colleges and universities as a “foreign intelligence threat to higher education.” (The designation will be promptly appealable when warranted.) Colleges and universities that accept gifts from or enter into contracts with designated threats will have more stringent reporting requirements under the Higher Education Act. If evidence of espionage is found, US authorities will be able to quickly remove identified threats.

This is a critically important problem that we must solve. When foreign countries steal our research and ideas, American researchers, innovators, and thinkers lose the ability to lead our country into the future. Ultimately, this costs American jobs – and our security.

Congress should pass the SHEET Act as soon as possible.

Your Friend,
Newt


Newt’s World Ep 21: Communist China vs. Hong Kong

One of the most important struggles on the planet is taking place right now between the people of Hong Kong and Communist China. In this week’s episode of my Newt’s World podcast, I discuss the implications of this major turning point in China and across the world. Listen for free here>>


Newt Gingrich
Newt Gingrich

P.S. My new book, Trump’s America: The Truth About Our Nation’s Great Comeback is out and available for order.

About Newt Gingrich

Newt Gingrich is well-known as the architect of the “Contract with America” that led the Republican Party to victory in 1994 by capturing the majority in the U.S. House of Representatives for the first time in forty years. After he was elected Speaker, he disrupted the status quo by moving power out of Washington and back to the American people.

Gingrich Productions is a performance and production company featuring the work of Newt Gingrich and Callista Gingrich. Visit : www.gingrichproductions.com

The post Stealing Secrets from Students appeared first on AmmoLand.com.

via AmmoLand.com
Stealing Secrets from Students

Gun Review: SIG SAUER P365 Manual Safety

Josh Wayner for TTAG

Unless you’ve been living under a rock, you’ll know that SIG SAUER has upped the ante in the concealed carry and self-defense world with their P365. For the cave dwellers among you, the P365 — SIG calls it “America’s most popular handgun” — is a sub-compact 9mm pistol that boasts excellent accuracy and a staggering 10+1 standard capacity in a very compact form factor.

Recently they raised the bar by making their already innovative pistol safer in the eyes of many people, this writer included.

The P365 variant here, announced at this year’s SHOT Show, features a manual thumb safety. That may not seem like that much of a big deal until you realize that a manual safety is a make or break option for many, many shooters. I conducted an informal survey among several dozen people I encountered in the course of my daily travels and about two-thirds of the crowd wanted an external safety.

Tactical polo bros rarely value a manual safety and sometimes consider it to be a dangerous feature or an outright liability. This high-speed mentality often ignores the fact that the majority of people who carry aren’t gun people and want simple, safe features that they are comfortable with.

I won’t get into the nuances of this mentality as I could never consume enough Monster Energy flavored vape cartridges to put myself into the mindset necessary to relay it to you.

Suffice to say, even routine actions like loading and holstering can lead to an accidental discharge or an unsafe situation when no manual safety is present. The fact that the gun is basically ready to fire the moment you put your hand on the grip is not something that delights many people, especially those who carry off-body in a purse, backpack, or diaper bag.

The addition of a manual safety model to the P365 line is the thing that fully convinced me to make this a daily use carry gun. I previously reviewed the original P365 and liked it, but I never really felt great about carrying it. The triggers on the P365 pistols I have tested are light and crisp, just like a full-size pistol.

The small grip and crisp trigger made it so that I was somewhat uncomfortable with carrying it for fear of an accidental discharge. The addition of a manual safety makes me completely comfortable with it now in both a pocket holster or IWB.

Josh Wayner for TTAG

I have carried a Smith & Wesson .38 J-Frame for years and it has no manual safety. It also has a super-heavy double action trigger that really can’t be pulled by accident.

The SIG P365 has a trigger pull that’s significantly lighter at about 7 lbs, which puts it in the same range as most regular 1911s and some AR rifles. That’s relatively light, which, in my book, makes it absolutely necessary to exercise caution when carrying with a round chambered. There is no trigger safety, so it is imperative that you are unerringly careful.

While it may not seem like a huge upgrade, the manual thumb safety makes the P365 one of the safest everyday carry guns on the market today. The safety itself is ambidextrous and clicks positively into position. A great feature of this model is that it can be loaded and unloaded with the safety on. The same can’t be said for many other guns which only allow loading with the thumb safety off.

15 round magazines do add a bit of length, however they are great for a backup mag. (Josh Wayner for TTAG)

Aside from the safety, the features of the gun are the same as the standard P365 (see our review here). Night sights are standard. They’re easy to use and are very easy to pick up in low light or total darkness. Magazines drop free with no hangups. Included with the gun are two, 10-round mags, one with a short finger extension and the other a flush fit version. Twelve and 15-round extended mags are available, too.

I tested this new SIG P365 version with the safety with a mountain of ammunition to fully ensure that it’s able to pass my own standards for a carry gun and to dispel lingering rumors of problems with the design.

The P365 I received saw over 2,000 rounds right out of the box and was never cleaned or even wiped down. I fired just about every brand of ammo and recorded my results below.

SIG SAUER 115gr 365———————————-1075fps, 1.25”
SIG SAUER 365 115gr FMJ—————————–1067fps, .75”
SIG SAUER 365 115gr V-Crown————————1079fps, .75”
SIG SAUER 124gr V-Crown—————————–1140fps, 1”
SIG SAUER 124gr FMJ———————————-1112fps, 1.25”
SIG SAUER 115gr V-Crown—————————–1190fps, 1.25”
SIG SAUER 147gr Elite Competition———————899fps, .75”
Hornady 135gr +P Critical Duty————————1050fps, 1.5”
Hornady 124gr +P Critical Duty————————1130fps, 1.5”
Hornady Custom 147gr XTP—————————–950fps, 2”
Hornady Critical Defense 115gr FTX——————–1123fps, 2”
Buffalo Bore 147gr Outdoorsman———————–1000fps, 2.5”
Buffalo Bore Barnes 95gr +P+ ————————–1349fps, 2”
Buffalo Bore 147gr JHP +P+ —————————-1060fps, 1”
Black Hills 115gr FMJ————————————1075fps, 1”
Black Hills 100gr HoneyBadger +P———————-1175fps, .5”
Black Hills 125gr Subsonic HoneyBadger—————-973fps, 2”
Lehigh Defense 70gr HERO——————————1490fps .5”
Lehigh Defense 90gr Xtreme Defense +P—————1301fps, 1”
Lehigh Defense 105gr Controlled Fracture————-1100fps, .75”
Lehigh Defense 105 Max Expansion——————–1050fps, .75”

Accuracy shown is the average of three, five-shot groups at 15 yards and velocity is the average of 10 rounds fired over an Oehler 35P chronograph five feet from the muzzle.

As far as general performance was concerned, the P365 shot anything and everything I put through it. I had absolutely no failures to feed, to fire, or to eject with any ammo tested. The pistol was very accurate, especially for a compact carry gun, with virtually everything I fired through it.

Black Hills 100gr +P is an amazing load. (Josh Wayner for TTAG)

Of particular note was the accuracy I got from the Black Hills 100gr HoneyBadger. I have tested this load in numerous guns across many months and even did a standalone review here on TTAG. I keep coming back to this load in my article notes as it is just so damn accurate and reliable. I love all the ammo I test, but for whatever reason this load from Black Hills is always the most accurate at every range.

Close in at 15 yards it was matched by Lehigh Defense’s HERO load, but out to 25 yards it quickly outpaces all the others and behaves like a little rifle round. I was easily able to make hit after hit at 50 yards on a 10” plate using the Black Hills load.

Josh Wayner for TTAG

That said, I am always impressed by the ammo innovations from the other companies featured in this article. For general carry, SIG’s 365 load is hard to beat. You can read the review of that here.

Hornady makes some of the best carry ammo out there and their Critical Duty loads inspire plenty of confidence. Look forward to a detailed review of the 135gr +P this summer. Buffalo Bore makes some of the most powerful 9mm available and you can find a review of the 95gr +P+ here.

Josh Wayner for TTAG

The P365 Manual Safety is one of the most compact, reliable, and accurate handguns you can own today. I will be using this pistol across the summer for most of ammo testing. I think that it will serve me and you well as you read the results I get. I don’t recommend this gun lightly, either.

Specifications: SIG SAUER P365 Manual Safety

Caliber: 9x19mm
Barrel Length: 3.1”
Overall Length: 5.8”
Width: 1”
Weight: 17.8oz
Sights: SIG XRAY Night Sights
Magazine: 10 round standard, 12-round magazine and 15-round magazine available
MSRP: $599 (seen about $100 lower retail)

Ratings (Out of Five Stars):

Accuracy * * * * *
This is probably the most accurate compact semi-automatic everyday carry gun I’ve ever used. It shot like a full-size pistol and refused to miss even small targets.

Reliability * * * * *
I put a stupid number of rounds through the P365-MS in only a couple of range trips to ensure it goes bang every time. In 2,000+ rounds it never failed to feed or fire.

Ergonomics * * * * *
This is a well-engineered pistol that feels great in the hand and carries easily on the hip. The manual safety lever feels very positive and is easy to disengage.

Customize This * * * * *
It already comes with XRAY3 night sights. The ability to change out grip modules, change colors, add lasers, swap sights, and go from 10+1 to as many as 15+1 makes this one of the most user-friendly carry guns out there.

Aesthetics * * * * 
The gun is small and efficient. I love the smooth lines and high capacity (for a sub-compact). Many small carry guns are plain, if not downright ugly, but SIG managed to make the P365 fairly pretty and functional.

Overall * * * * *
Just like the article says, this may be the best carry gun on the market right now. There is really nothing out there that even comes close when you blend size, capacity and features. The addition of the safety option makes it darn close to perfect.

via The Truth About Guns
Gun Review: SIG SAUER P365 Manual Safety

Server-side Font-Awesome rendering with Laravel

Font Awesome Blade directives for Laravel

Latest Stable Version License Travis (.com) StyleCI Scrutinizer code quality (GitHub/Bitbucket)

This package will render font awesome icons in your views on the server side. This removes the need to add extra JavaScript or webfont resources on the client side and in doing so reduces the size of your website significantly.

This is achieved by replacing the icons with their svg counterpart before sending the response to the client.

Requirements

  • PHP >= 7.1.3
  • Laravel >= 5.6

Installation

Install the package using Composer.

composer require jerodev/laravel-font-awesome 

Service Provider

The package will be auto-discovered by Laravel. If you disabled auto-discovery, you should add the following provider to your config/app.php file.

\Jerodev\LaraFontAwesome\FontAwesomeServviceProvider::class, 

Usage

To use Font Awesome icons in your view there are a few new blade directives.

// Let the package discover the best library for this icon. @fa('laravel')  // Define the library that should be used. @far('circle') // Regular @fas('circle') // Solid @fab('laravel') // Brands

When using the @fa() directive. The package will scan the different Font Awesome libraries and use the first library where it finds the icon.

The order in which the libraries are scanned is regular, brands, solid. But this can be modified in the configuration.

Middleware

This package includes a middleware that injects a minimal stylesheet into your views on render. By default, this middleware is added to the web middleware group.

If you don’t want to have the style injected automatically, you can disable middleware.all_requests in the configuration. In this case, you will have to add the middleware to selected routes yourself or add your own CSS.

The middleware you should use is \Jerodev\LaraFontAwesome\Middleware\InjectStyleSheet::class.

Configuration

The package contains a few configuration options that can be modified by first publishing the config file using the command below. This will create a fontawesome.php file in your config folder.

php artisan vendor:publish --provider="Jerodev\LaraFontAwesome\FontAwesomeServviceProvider" 
Key Type Default value Description
libraries string[] ['regular', 'brands', 'solid'] The icon libraries that will be available. This is also the order in which the libraries will be searched for icons.
middelware.all_requests boolean true When enabled, the stylesheet needed for the icons will automatically be injected on every request returning html.

To Do

Currently the package only supports basic icon rendering. There is no support for special cases, such as: stacking icons or masking icons, because I never used these myself.

In the future however, I want to add these as well to make this package support the full api that is available using the Font Awesome library.

via Laravel News Links
Server-side Font-Awesome rendering with Laravel

Troubleshooting Errors and Performance Issues in Laravel Using Logs

In a perfect world, there wouldn’t be any errors or bugs in production applications. However, we don’t live in a perfect world, and from experience, you know there is no such thing as a bug-free application. If you are using the Laravel framework, you can leverage its log tracking and error logging to catch bugs early and enhance the performance of your Laravel-based application.

Laravel comes pre-packaged with tools to help you track and monitor events. This reduces the effort required to track down those bugs. It comes with a stackable logging system built on top of the popular Monolog library. It also allows you to set up multiple channels based on the severity of the log or event. These channels include stack (stacked), single, daily, Slack, syslog, monolog, SolarWinds® Papertrail®, and so on.

Single Server Environment

Configuring logging for a single server production environment is simple and straightforward. Since the data is always retained on the server, we do not have to worry about keeping the logs offsite. Laravel handles the log rotation, so you do not have to manually maintain that information either. The following configuration logs debug level errors and exceptions to a log file.

return [ 'default' => env('LOG_CHANNEL', 'stack'), 'channels' => [ 'stack' => [ 'driver' => 'stack', 'channels' => ['daily'], 'ignore_exceptions' => false, ], 'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', 'days' => 14, ] ] ];

Production Environments

Production environments are dynamic and they often scale up and down, which means that the servers will be created or destroyed with increases and decreases in user traffic or load. This means you cannot rely on file-based logging because storage is ephemeral and load balancers make it quite difficult to track down which web server received a request. In order to aggregate and save the logs for any retention period, you’ll have to set up a dedicated syslog server or use a service like Papertrail, which can store logs and make them accessible in a web browser.

A screenshot of logs in Papertrail.

While setting up a logs server is easy, it’s not beneficial for everyone. A decent amount of Linux knowledge and a dedicated server is required, especially if you’re managing more than one production environment.

I like Papertrail for its ease of setup and use. You just have to set up the logging channel to “papertrail” and add two configurations into your environment file (.env).

PAPERTRAIL_URL=logsXXX.papertrailapp.com PAPERTRAIL_PORT=52204

You should be able to get the values for these settings in your Papertrail account. There is also documentation on the Laravel site about configuring the Papertrail channel.

Once set up you can easily monitor and search your logs.

Common Errors

5XX Server Errors

These are usually server side or hard errors which are thrown on the server side. These errors usually mean something unexpected happened and your program didn’t know how to handle the situation. The error could be caused by many things and we’ll describe a few common ones below.

Code Syntax Errors

These errors are easy to detect if you have debug turned on or if you’re looking at the error log. Errors usually start with syntax error, unexpected… and will give you the name of the file and line number of the code that caused the error.

PHP version Compatibility

PHP 5.6 and 7.0 hit EOL (end of life) last year and chances are your server isn’t using those versions or won’t be for much longer. I’ve listed a few tools below which you can use to check your code for compatibility.

  • php7mar – PHP 7 Migration Assistant Report (MAR) (Recommended)
  • phpstan – PHP Static Analysis and compatibility check
  • phan – A static analyzer, PHP 7 checker

504 Gateway Time-out

These errors usually happen when you’re running the PHP outside of Apache/Nginx as a separate process (for example, FPM or CGI) and the response isn’t returned to your web server in a timely manner. Performance tracking middleware defined in the Performance issues section later in the article might be helpful for you for tracking these issues.

Database Connection Issues

This can be solved by checking the credentials for DB connection in your environment file and making sure that the credentials are correct, the application communicates with the database server, and the database/tables exist.

The following are a few log messages thrown by this issue:

SQLSTATE[HY000] [1045] Access denied for user [USERNAME] SQLSTATE[HY000] [2002] Operation timed out

4XX Client Errors

These errors are considered soft errors and are usually thrown when we receive an invalid request from a client.

404 Page Not Found

This error usually means that Laravel was not able to find the controller, controller method or a 404 error was thrown by your custom code. Some common steps to debug these would be to confirm that the route, controller, and method exist. If they all exist, then check to see if your code is throwing a 404 error.

Some common 404 errors are as follows:

Error Message Possible Reason(s)
404 | Not Found 1. Route is not defined
2. No results were found when findOrFail() was called for a model
Class [CLASS_NAME] does not exist Controller class does not exist or the path to it is incorrect
Method [METHOD_NAME] does not exist Method does not exist or the path to it is incorrect

Note: findOrFail() callback on a model returns a 404 error if no matching result is found in the database.

419 Page Expired

Laravel comes pre-loaded with a CSRF protection and it requires you to pass that token with all your non-GET requests. This requires a valid session to be maintained on the server side.

If you wish to exclude any requests from CSRF verification, then add those requests to your VerifyCsrfToken middleware.

/** * The URIs that should be excluded from CSRF verification. * * @var array */ protected $except = [ 'foo/bar', 'foo/*', 'http://example.com/foo/bar', 'http://example.com/foo/*', ];

422 Unprocessable Entity

This error usually means that the data you posted using AJAX was invalid for this request. This happens when you have a Request Rules setup. Laravel validates each request before it passes onto your controller method. The issue may be in your data or the request rule used for the request.

When an AJAX request is made JSON content type request it will return an error message like following, explaining what the issue is.

{ "message": "The given data was invalid.", "errors": { "name": ["The name field is required."], "email": ["The email field is required."] } }

Out of Memory Error

Memory limits on PHP applications exist for a reason. You do not want to allow your application an unlimited amount of memory. This error message exists for that very reason. If you’re receiving an out of memory error it means that there is a memory leak in your application. Maybe you forgot to reset an object, and the size continues to increase until the application doesn’t have any memory left to run.

Allowed memory size of [SIZE] bytes exhausted (tried to allocate [SIZE] bytes)

The following loop will keep running until the program runs out of memory:

$data = []; $i = 100; while($i > 100) { $data[] = time(); $i++; }

Performance Issues

Slow Queries

A single slow query can slow down your entire application. You did everything you could think of and made sure that all of your queries were using indexes and didn’t do anything; however, maybe you still missed something… How do you monitor for that? It’s simple enough in Laravel. Add the following code to your AppServiceProvider::boot() method:

 public function boot() { \DB::listen(function($sql) { if($sql->time > 1000){ \Log::info(“SLOW QUERY DETECTED:”); \Log::info($sql->sql); \Log::info($sql->bindings); \Log::info($sql->time); } }); }

This will log every query that takes longer than a second (1000 ms) to execute. You can adjust the time accordingly to fit your needs. Running an explain on your query will provide you with some insights as to why your query is running slow.

Slow Response Time

Tracking slow response time in Laravel is relatively simple. You can define a middleware like the following example and include it in your requests.

<?php //File Name: app/Middlewares/Performance.php namespace App\Http\Middleware; use Closure; class Performance { public function handle($request, Closure $next) { return $next($request); } public function terminate($request, $response) { $execution_time = microtime(true) - LARAVEL_START; if($execution_time > 1){ // You can change the 1 to a desired amount in seconds \Log::info("Slow Response[{$execution_time}]: You should log some information here."); } } }

After creating the middleware do not forget to include it in your Kernel.php like this:

 protected $routeMiddleware = [ 'auth' => \App\Http\Middleware\Authenticate::class, .... 'performance' => \App\Http\Middleware\PerformanceTracker::class, ];

You can also include it in your web or API route groups if you want to include it in all requests on web/API.

Caching

Caching your content is another way to optimize your application. You don’t have to fetch data from your database if it doesn’t change often. Laravel provides drivers for file, db, memcache, and redis backends. By default, Laravel uses a file-based caching system. Configuring caching in Laravel is easy and can be done in minutes.

Recap

In this article, you learned how we can use logging to reduce the time and effort spent on debugging your code while improving the performance of your application at the same time.

As you see, you can use logging to reduce the time and effort spent debugging your code while improving the performance of your application at the same time.

Data is your friend and it’s there waiting for you to make use of it! Tools like SolarWinds® Papertrail® make it easier to access logs and debug problems. Check out the Papertrail free trial.

via Laravel News Links
Troubleshooting Errors and Performance Issues in Laravel Using Logs

SCOTUS: Ban on “FUCT” trademark registration violates First Amendment

SCOTUS: Ban on “FUCT” trademark registration violates First Amendment

Fuct

Federal law prohibits the registration of trademarks that are “immoral or scandalous.” At least it did until today, when the Supreme Court held that the requirement violated the First Amendment.

The case focused on artist and entrepreneur Erik Brunetti, who sells clothing under the trademark FUCT. Brunetti claims the mark is “pronounced as four letters, one after the other: F-U-C-T.” But a lot of people have interpreted it as (in the words of the government’s lawyer in the case) “the profane past participle form of a well-known word of profanity.”

Beyond that, the US Patent and Trademark Office looked at the products being sold under the FUCT mark. “Brunetti’s website and products contained imagery, near the mark, of ‘extreme nihilism’ and ‘antisocial’ behavior,” the Supreme court noted in its Monday opinion. The trademark office concluded that the FUCT mark “communicated misogyny, depravity, and violence,” and rejected the registration.

But that’s exactly the kind of analysis a government agency isn’t allowed to do under the First Amendment, a six-justice majority ruled.

Bong hits 4 Jesus

“If a trademark registration bar is viewpoint-based, it is unconstitutional,” the court held.

The justices noted that the trademark office has a track record of making viewpoint-based judgments about trademark registrations under the immorality clause.

A registration for “YOU CAN’T SPELL HEALTHCARE WITHOUT THC” got rejected as immoral and scandalous, while a registration for “SAY NO TO DRUGS—REALITY IS THE BEST TRIP IN LIFE” was accepted. Beverages called “MARIJUANA COLA” and “KO KANE” were also refused trademark registrations.”JESUS DIED FOR YOU” could be registered, but “BONG HITS 4 JESUS” couldn’t.

That’s a problem, the court concluded, because “a law disfavoring ‘ideas that offend’ discriminates based on viewpoint, in violation of the First Amendment.”

The case wasn’t about Brunetti’s right to sell products with the “FUCT” label on them. It’s perfectly legal to sell products with an unregistered mark, and these marks even have limited legal protections. But registration provides much stronger legal powers to prevent others from using the trademark without permission.

The ruling follows a landmark 2017 precedent

The ruling comes two years after another Supreme Court ruling on offensive trademarks. In that case, the high court struck down language prohibiting the registration for trademarks that were disparaging to any individual or group of people.

That case focused on an Asian-American rock band called “The Slants.” The band was attempting to reclaim a derogatory term for Asian people, but the trademark office rejected the trademark for disparaging Asians. The Supreme Court ruled it was unconstitutional for the government to prohibit trademarks that disparage people while allowing trademarks that praise them.

Now the Supreme Court has applied the same reasoning to the rule against immoral and scandalous trademarks. However, the high court left open the possibility that Congress could ban a narrower class of trademarks that are lewd, sexually explicit, or profane. If Congress chose to pass such a law, then trademarks using the F-word might once again be excluded from registration. But if you’ve always wanted to own a registered trademark with a swear word in it, now is your chance.

via Ars Technica
SCOTUS: Ban on “FUCT” trademark registration violates First Amendment

Broadcasting with Laravel, Passport, Pusher & Vue.js

When using Laravel + Passport to create a headless application, in this case the API for the backoffice of an commerce platform, we couldn’t find one clear tutorial how to set up both the API (with for example the Broadcast authorization route) and on the other hand the Pusher integration in Vue, with the token that was originally created by Passport during authentication. We wrote this step by step tutorial after implementing the solution.
via Laravel News Links
Broadcasting with Laravel, Passport, Pusher & Vue.js

Laravel Eloquent UUID

Eloquent UUID

GitHub stars

GitHub tag (latest SemVer) Build status Packagist PHP from Packagist Packagist

Introduction

A simple drop-in solution for providing UUIDv4 support for the IDs of your Eloquent models.

Installing

You can install the package via composer:

composer require goldspecdigital/laravel-eloquent-uuid

Usage

When creating a Eloquent model, instead of extending the standard Laravel model class, extend from the model class provided by this package:

<?php  namespace App\Models;  use GoldSpecDigital\LaravelEloquentUUID\Database\Eloquent\Model;  class BlogPost extends Model {  // }

User model

The User model that comes with a standard Laravel install has some extra configuration which is implemented in its parent class. This configuration only consists of implementing several interfaces and using several traits.

A drop-in replacement has been provided which you can use just as above, by extending the User class provided by this package:

<?php  namespace App\Models;  use GoldSpecDigital\LaravelEloquentUUID\Foundation\Auth\User as Authenticatable;  class User extends Authenticatable {  // }

Generating UUIDs

If you don’t specify the value for the primary key of your model, a UUIDv4 will be automatically generated. However, if you do specify your own UUIDv4 then it will not generate one, but instead use the one you have explicitly provided. This can be useful when needing the know the ID of the model before you have created it:

// No UUID provided (automatically generated). $model = Model::create(); echo $model->id; // abb034ae-fcdc-4200-8094-582b60a4281f  // UUID explicity provided. $model = Model::create(['id' => '04d7f995-ef33-4870-a214-4e21c51ff76e']); echo $model->id; // 04d7f995-ef33-4870-a214-4e21c51ff76e

Running the tests

To run the test suite you can use the following commands:

# To run both style and unit tests. composer test # To run only style tests. composer test:style # To run only unit tests. composer test:unit

If you receive any errors from the style tests, you can automatically fix most, if not all of the issues with the following command:

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License – see the LICENSE.md file for details.

via Laravel News Links
Laravel Eloquent UUID

Laravel Data Sync

Laravel Data Sync

Laravel utility to keep records synced between environments through source control

Installation & Usage

  • Via composer: composer require distinctm/laravel-data-sync
  • Run php artisan vendor:publish --provider="distinctm\LaravelDataSync\DataSyncBaseServiceProvider" --tag="data-sync-config" to publish config file. Specify directory for sync data files (default is a new sync directory in the project root)
  • Create a JSON file for each model, using the model name as the filename. Example: Product.json would update the Product model
  • Use nested arrays in place of hardcoded IDs for relationships
  • Run php artisan data:sync (or php artisan data:sync --model={model} with the model flag to specify a model)

Optional

If using Laravel Forge, you can have the data sync run automatically on deploy. Edit your deploy script in Site -> App to include:

if [ -f artisan ] then php artisan data:sync php artisan migrate --force fi 

Notes

  • use studly case for model name relationships as JSON keys (example: ‘option_group’ => ‘OptionGroup’). This is important for case sensitive file systems.
  • empty values are skipped
  • the criteria/attributes for updateOrCreate are identified with a leading underscore
  • nested values represent relationships and are returned using where($key, $value)->first()->id
  • order of import can be set in config/data-sync.php with an array:
return [ 'path' => base_path('sync'), 'order' => [ 'Role', 'Supervisor', ] ]; 

Examples

User.json:

[ { "name": "Ferris Bueller", "properties->title": "Leisure Consultant", "phone_numbers->mobile": "555-555-5555", "phone_numbers->office": "", "_email": "ferris@buellerandco.com", "department": { "name": "Management", "location": { "name": "Chicago" } } } ]

translates to…

User::updateOrCreate([  'email' => 'ferris@buellerandco.com', ],[  'name' => 'Ferris Bueller',  'properties->title' => 'Leisure Consultant',  'phone_numbers->mobile' => '555-555-5555',  'department_id' => Department::where('name', 'Management')  ->where('location_id', Location::where('name', 'Chicago')->first()->id)  ->first()  ->id, ]);

Role.json:

[ { "_slug": "update-student-records" }, { "_slug": "borrow-ferrari" }, { "_slug": "destroy-ferrari" } ]

translates to…

 Role::updateOrCreate(['slug' => 'update-student-records']);   Role::updateOrCreate(['slug' => 'borrow-ferrari']);   Role::updateOrCreate(['slug' => 'destroy-ferrari']);

RoleUser.json (pivot table with model):

[ { "_user": { "email": "ferris@buellerandco.com" }, "_role": { "slug": "update-student-records" } }, { "_user": { "email": "ferris@buellerandco.com" }, "_role": { "slug": "borrow-ferrari" } }, { "_user": { "email": "ferris@buellerandco.com" }, "_role": { "slug": "destroy-ferrari" } } ]

translates to…

 RoleUser::updateOrCreate([  'user_id' => User::where('email', 'ferris@buellerandco.com')->first()->id,  'role_id' => Role::where('slug', 'update-student-records')->first()->id,  ]);   RoleUser::updateOrCreate([  'user_id' => User::where('email', 'ferris@buellerandco.com')->first()->id,  'role_id' => Role::where('slug', 'borrow-ferrari')->first()->id,  ]);   RoleUser::updateOrCreate([  'user_id' => User::where('email', 'ferris@buellerandco.com')->first()->id,  'role_id' => Role::where('slug', 'destroy-ferrari')->first()->id,  ]); 

via Laravel News Links
Laravel Data Sync