Laravel - Model Truncation failing - laravel-9

I have a model that I'm trying to enable truncating for, but it doesn't seem to be working.
I set up a clean install of Laravel 9 and have attempted to use 3 different ways to truncate.
The first way uses the Foo::truncate() method, as suggested in the documentation, which works in Tinker but not from my FoosController. I then tried using the Foo::query()->truncate() method, which is similarly ineffective. Lastly, I also tried using DB::table('foos')->truncate() which also, frustratingly, doesn't seem to work.
Other model operations seem to work. Is there anything I'm missing here? Thank you in advance.

Try using:
\Illuminate\Support\Facades\DB::statement("TRUNCATE TABLE foos");

Related

How tf.contrib.seq2seq.TrainingHelper can be replaced in TensorFlow 2.2

I am trying to run the project from GitHub but I have a trouble with TrainingHelper. Now, I am stuck with it, I dont know how to convert it to tf2. The console always returns the error like this:
AttributeError: module 'tensorflow_addons.seq2seq' has no attribute 'TrainingHelper'
Please help me!
Seems to be https://www.tensorflow.org/addons/api_docs/python/tfa/seq2seq/TrainingSampler
The api is a bit different, though. Some parameters passed in the constructor in TrainingHelper, are passed in TrainingSampler.initialize() instead. Also there are minimal differences in some of the return values. So, you have to do some adaptation for code migration.

MobX 4 `decorate` doesnt work with `computed`

EDIT: this is now solved and i no longer need help. see solution below. thank you
I am getting a weird error when trying the new decorate syntax with computed variables - any idea why it might sometimes invalidate the store? I'm pretty sure the computed is causing this as it works when I remove it.
sandbox here: https://codesandbox.io/s/jnmz0v2189
and screenshot here:
i should use decorate on the class, not the instance.
https://twitter.com/askerovlab/status/974752575676436481
more info here.

Apache 2.4.9 Pseudo Streaming

Im aware of this however, this appears to only work for apache 2.2.x. I'm looking for something like this for 2.4.9.
I've done quite a bit of googleing already and can't seem to find anything.
For whatever reason I couldn't get the module to work my initial go around (I tried more than once). However, I got it to work today.
Not sure what I did different but I just followed the instructions below (again).
http://h264.code-shop.com/trac/wiki/Mod-H264-Streaming-Apache-Version2

Why is my vs2012 forcing extra parentheses

First, thank you for taking pity on me and reading this issue. I CANNOT for the life of me figure out what extension I might have installed that is causing this issue, but it is EXTREMELY cumbersome.
Whenever I begin to type code (VB I think it also occurs in C#), for example "For Each" once I hit the F it forces a set of parentheses. Which would look like F(), but because I keep typing it looks like F(or). This only occurs when coding inside code blocks like a function or a sub, but when I'm creating the function it does not occur. I've disabled any and all power tools and the like, or at least I'm 90% sure I've done this for all of them, and yet it still occurs.
I'm usually pretty proficient at digging about the net and finding the answer, but for this one I'm at a loss. There is just too many keywords involved, so all I see is non-related topics, or how to make the parentheses occur, not get rid of them.
If anyone can provide some steps to resolve this, I'm happy and eager to try them. It's just such a hassle to live with for right now.
If you think it is a Visual Studio extension, then start by disabling all of them and adding them back one at a time.
You can also run VS with the command line switched to disable features.
Devenv switches
The simple answer to the cause is the Codealike VS Extension. I logged a bug with them and hopefully they'll fix it soon

Jade - way to add dynamic includes

I'd like to do something like the following within a jade template.
include page-content/#{view.template}
As this won't work I have ended up with.
-if(view.path==="/")
include ../page_content/home
-else if(view.path==="/login/")
include ../page_content/login
-else if(view.path==="/join/")
include ../page_content/join
-else if(view.path==="/user/")
include ../page_content/user
ad nauseum
I asked TJ whether it was possible, he replied
unfortunately no, they're compile-time includes, which is somewhat necessary for a few technical reasons that I wont get into but we may eventually need to add a dynamic alternative
I'm wondering if anyone has come up with any alternatives, for example using view helpers.
I'm stuck with a big config file to generate the views - and the if-else statements in the template , I know are going to come back and haunt me. :)
If this is possible using another engine, like ejs or mustache, I'd love to know.
Any ideas much appreciated.
Feels like way too much logic in the view to me. Seems like the best way to do this would be through a dynamicHelper or possibly a mixin