Creating a hook to redirect to a page whenever an article(node) is created

I’m a beginner with Drupal 9. I’ve been trying to create a hook to redirect me to a specific page whenever an article(content-type) node is created.

But this seem to not be working

    <?php
    use DrupalCoreFormFormStateInterface;

    function hello_world_form_article_node_form_alter(&$form, FormStateInterface $form_state, $form_id) {

      $form('actions')('submit')('#submit')() = 'hello_world_node_form_redirect';
    }


    function hello_world_node_form_redirect(array $form, FormStateInterface $form_state) {


      unset($_GET('destination'));
      unset($_REQUEST('edit')('destination'));

      $form_state('redirect') = 'api/v1/test';
    }

Please help

Created php page in wordpress – Error Page can not be reached

I want to create a folder within wordpress site at root and add a php page abc.php with simple code like
<?php echo "Test php page." ?>
But when I try to run this page like this http://mydomainname.com/Myfolder/abc.php
it gives error "This site can’t be reached"
Why it is not reading my php page. I did the same on my another domain and it is working fine.
Please help.

I created a simple Python-based speed test for measuring peroformance of different hosting provider

I needed a way to evaluate VPS hosting providers so I created this script.

https://github.com/vprelovac/python-speed

I main… | Read the rest of https://www.webhostingtalk.com/showthread.php?t=1839597&goto=newpost

dnd 5e – How much XP does a monster created by Animate Objects add to an encounter?

This is a good mental exercise for learning about DND combat encounters…that’s for sure.

I don’t know the “actual answer”, except maybe “If you defeated the spell caster, then no”. But, if you’re reading this looking for a path toward a practical solution in the case where the party does not definitely defeat the spell-casting enemy in combat…..analyze the Treant and the Galeb Duhr. See what comparisons you can make and what insights you can glean….

A Treant is roughly a CR 6 without it’s Animate Tree (“AT”) action, but in actual fact it has a CR of 9 due in large part to the max. damage/round boost AT gives it (or, AT applies an XP Encounter Multiplier of 1.5-2x, as you go from facing 1 monster to up to 3 monsters).

Galeb Duhr is another monster we can apply the same thought process to, which as an action can cast Animate Boulders (“AB”). Without AB, the Galeb Duhr has a CR of 3 or 4. Again, because of the jump in max. damage per round, it’s a CR of 6 (or, AB applies an XP Encounter Multiplier of 2x, as you go from facing 1 monster to 3 monsters). Though I believe this is a concentration spell for the Galeb Duhr (it’s not for the Treant).

Thoughts:

For a party of 13th level adventurers, combat against a Treant without AT is of “medium” Encounter Difficulty (this is all “in my estimation”, looking at the DMG pgs 82 & 274-5). However, with AT, the Encounter Difficulty is downright “deadly”. So, instead of 2,300 XP as a CR 6 without AT…. with AT, as a CR 9, it imparts >2x the XP (5,000 XP).

Key questions

Without Animate Objects, how much damage is the enemy spell-caster able to inflict? What’s its best damage concentration spell, otherwise?

If you killed the 2 Animated Trees, but failed to kill the main spell-casting Treant, would your adventurers gain any XP? If so, how much? Why?

If the Treant was somehow unable to cast Animate Tree effectively (no trees within 60 feet, say) would you still get the full 5,000 XP for the kill? Likely yes.

If the Treant was an ally NPC, and assisting the party in battle but was unable or refused to use AT, would the DM still give the Treant the same cut of XP gained from the encounter compared to if it had used AT?

*What does putting another 3-10 enemy targets (@ 5th lvl), or adding an additional 10d4+40 max damage/round *(as in the case of animating 10 “Tiny” objects that do 1d4+4 damage each…with ACs of 19 & +8 to hit, a fly speed of 30 and darkvision….) do for the enemy?

How dangerous is the enemy without that ability, in the context of the combat encounter (the enemy caster could be 500 feet away, still giving commands to the constructs…!)

Or, put another way, what’s the CR of that particular enemy without Animate Objects?
&
For the particular combat Encounter, how significant is the impact of Animate Objects on the total Encounter Difficulty?

Final Thoughts

If you kill or successfully defeat the spell-casting enemy, I don’t see a legitimate reason to count XP from defeating the animated object constructs.

However, if the party makeup is such that it faces a significant degree of difficulty and successfully vanquishes the animated object creatures, and accomplishes some goal/side-quest — even despite failing to kill or otherwise defeat the enemy spell-caster for whatever reason — then I think XP should be awarded and tied to the combat.

If you have 11 enemies on the battlefield (Spell caster + 10 constructs), that’s an XP Encounter Multiplier of 3. If you figure each one is worth even just 10 XP….10x10x3 = 300xp? Sounds good for a 3rd-4th level party who needs to extract a valuable item from a castle guarded by 10 “tiny” animate object constructs, but clearly isn’t @ a high enough level to defeat the evil wizard controlling the constructs.

Maybe they escape by the skin of their teeth with the treasure, after defeating the constructs in a 10 round combat session, just before the wizard arrives in person to destroy them (but was several hundred feet away, in another part of the castle). Nail biter, worthy of combat XP.

Again….

This is a good mental exercise for learning about DND combat encounters…that’s for sure.

sharepoint online – Using the column Created gives the right date format, but the time is not correct

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

WordPress: posts and categories not created by me but visible online

i have a little problem, i see on line page with url composed of my site name / category and post which I have never created and do not see in the control panel. This post contain more comment with obsolete url’s for pornsite.

1. how can i fix this problem?
2. how can i see and delete this category and post?

Thank you for reply.

I created a fun way to interact with website visitors!

Hi, fellow business owners!

I used to run an e-commerce store in sunglasses a while back and had mixed feelings about it. I had decent amounts of traffic but literally almost 0% conversion rate compared to the average ~1-2%.
SEMrush

I knew something was off but couldn’t really validate what it was because there was no way for me to ask the website visitors or at least engage them long enough to increase their likelihood of converting to a customer. I eventually shut down the store a while ago but didn’t forget about my experience running it.

A couple of years later now, I built the tool that I was thinking of but didn’t fully realize at that time. I created a live shopping widget that I put on my website to engage with website visitors.

It helps me get a human presence on my website, just like you would have in a real store.

To finish the story, a friend (who comically is also running an e-commerce store in sunglasses but way more successful than me…) is using this to increase his conversions. We are going live later today on our website https://www.tryemcee.com/ to showcase the widget.

Let me know if you have any feedback!

 

created sql query to REBUILD/REORGANIZE indexes

I’ve created sql query to REBUILD/REORGANIZE indexes, but some of the avg_fragmentation_in_percent remains at 50% even after rebuilding them.

really appreciate any suggestions.

create table #tempQueries
(
    Query nvarchar(max),
)

CREATE TABLE #TempTable
(
    ROWID int identity(1,1) primary key,
    Name nvarchar(max),
)

insert into #TempTable
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'

--select * from #TempTable
DECLARE @MAXID INT, @Counter INT

SET @COUNTER = 1
SELECT @MAXID = COUNT(*) FROM #TempTable

WHILE (@COUNTER <= @MAXID)
BEGIN
    --DO THE PROCESSING HERE  
    insert into #tempQueries
    SELECT 
    'ALTER INDEX ' + QUOTENAME(ind.name)  + ' ON ' +QUOTENAME(object_name(ind.object_id)) + 
        CASE    WHEN indexstats.avg_fragmentation_in_percent>30 THEN ' REBUILD ' 
            WHEN indexstats.avg_fragmentation_in_percent>=5 THEN ' REORGANIZE'
            ELSE NULL END as (SQLQuery)  -- if <5 not required, so no query needed
    FROM sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, NULL) indexstats 
    INNER JOIN sys.indexes ind ON ind.object_id = indexstats.object_id 
        AND ind.index_id = indexstats.index_id 
    WHERE 
    --indexstats.avg_fragmentation_in_percent , e.g. >10, you can specify any number in percent 
    ind.Name is not null 
    and OBJECT_NAME(ind.OBJECT_ID) = (SELECT Name FROM #TempTable where ROWID = @Counter)
    ORDER BY indexstats.avg_fragmentation_in_percent DESC

    SET @COUNTER = @COUNTER + 1
END

delete from #tempQueries where Query is null
select * from #tempQueries

While (Select Count(*) From #tempQueries) > 0
Begin

    DECLARE @sql NVARCHAR(MAX);
    
    SET @sql = (select top 1 Query from #tempQueries)

    print @sql
    exec (@sql)

    Delete top (1) from #tempQueries

End

drop table #tempQueries
drop table #TempTable

sharepoint online – Column default value settings on folders created when creating Ms Teams channel

I am migrating sites from SharePoint On Premise to SharePoint Online/Ms Teams. We have not been using folders in our document libraries, instead we have relied on managed metadata. For one of the new sites, I created the site as an Ms Teams, and then I set up a number of channels, one for each sub-process (that we have metadata for). So I got the corresponding folders in my SharePoint library, one for each channel.

I would now like to have the files added to the folders tagged with the sub-process metadata for that folder automatically. But when I go to “Column default value setting” I can see none of the folders that exist in the library. I can just set default values for the document library.

How can I get the folders created by Ms Teams to display in “Column default value settings”?

python – Pystray doesn’t work in multiprocessing-started subprocess if there’s an QApplication created

Given this code:

#import multiprocessing  # (1)

def g():
    def f():
        print("Function `f` is run")

        from PIL import Image
        from pystray import Icon
        icon=Icon("Plover")
        icon.icon=Image.new("RGB", (10, 10), (255, 255, 255))
        icon.visible=True
        icon.run()

    import multiprocessing
    p=multiprocessing.Process(target=f)
    p.start()
    p.join()

if __name__=="__main__":
    from PyQt5.QtWidgets import QApplication
    from threading import Thread
    import time

    t=Thread(target=g)
    t.start()

    app=QApplication(())
    t.join()

This code should create a thread (runs function g), and create a subprocess (runs function f), print Function `f` is run, and create a system tray icon (that contains a white square) in it.

However, the code instead only print Function `f` is run, without creating the icon. (the icon is not visible)

Why does this happen?

  • Pystray uses appindicator by default for me, but it can be forced by PYSTRAY_BACKEND=appindicator and the behavior remains the same. (I’m using X on GNU/Linux)

  • If I uncomment line 1 (or whenever multiprocessing is first imported before the QApplication is constructed), then the bug does not happen.

  • If time.sleep(1) is added after the thread is started and before QApplication is constructed, then the bug also does not happen.

  • python --version -> Python 3.9.2.

  • pip list -> pystray 0.17.2 and PyQt5 5.15.3.

  • I checked that the environment variables are the same in both cases by adding this to after the print statement in function f:

    import os, hashlib
    print(hashlib.sha1(str(os.environ).encode('u8')).hexdigest())
    

Background:

I’m writing a plugin for a program, that executes my code on a separate (not main) thread. And I want the plugin to be able to control a tray icon.

So I can’t run any code on the main thread or import multiprocessing module earlier than the creation of QApplication by the host program.

Because the code is executed on a separate thread, I didn’t figure out any easy way to properly use QSystemTrayIcon, so I looked the external package pystray, but then encounterthis weird behavior.