Making your brand viral without buying ads

Hello I’m CharlyRabbit and this is my journey as Indie Maker
Indie Maker: Person building a software idea that can generate revenue

The Project(work in progress)
Viral Quotes (viral-quotes.com) will allows small business owners to viralize their brands without spending on ads

What exactly is a Viral Quote?
[​IMG]
This type of content is highly shareable on social networks because it makes people feel…

Making your brand viral without buying ads

Content that should be protected is served without authentication intermittently

Our website hosting is with a shared hosting provider. The only configuration we can make is through .htaccess files, we can’t touch the apache configuration files that are sourced when apache first starts.

The website root directory is public_html/. We have some content that should only be accessible to members, and this content is all kept under public_html/members_only/ files and subdirectories. Members have a username/password to authenticate when they want to get to the members-only portion of the site. The public_html/members_only/.htaccess file is fairly simple as follows:

AuthUserFile /path/to/.htpasswd AuthType Basic AuthName "Password Protected" Options -Indexes AuthGroupFile /dev/null <RequireAll>     Require valid-user     Require method GET POST HEAD </RequireAll> 

When a particular file public_html/members_only/auto/xyz.pdf is requested in the browser the expected 401 status is returned, the browser prompts the user for their credentials and, if correctly entered, the request is sent again and the file is served. This is as expected. The problem is that when any other user who has not authenticated subsequently requests this same file, it’s served to them without authentication, at least for a while. Then, after some interval, the next request is only satisfied if the user is authenticated.

Just to be sure I’m not experiencing some kind of browser caching confusion I have verified this behavior using curl -D headers https://<my website>/members_only/auto/xyz.pdf and examined the headers file.

I noticed another question that sounds very similar to my problem, but there were no answers. I am out of ideas at this point. I’ve tried tech support for the hosting provider (Endurance International Group), they are worse than useless.

Convert postgres varchar[] to text[] without downtime

As I discovered in researching this question, converting a column from varchar(100)[] to text[] requires a table rewrite and rebuilding indexes.

Is there a way to manage this conversion without the locking and rewriting through some catalog trickery like that used in this question? Particularly interested in version 10 if possible

How to evaluate a binary expression tree in hlsl without recursion or a stack

I’m currently working on a dual contouring implementation for which I want to create procedural terrain based on layers of noise. Both, the terrain generation and the mesh creation via dual contouring run on the GPU in compute shaders.

For configurating the terrain generation I previously changed the specific compute shader’s source code itself to generate different layers of FBM noise and combine them with various CSG operations (e.g. union, intersection, difference) to arrive at the final terrain. But this offers very little flexibility, e.g. I cannot change the terrain generation at runtime.

So in order to get more flexiblity for configuring the terrain generation, I’ve started implementing a graph tool (similiar to ShaderLab) using XNode: enter image description here Red (leaf) nodes are operands, grey (internal) nodes are operators (either binary or unary) and the green (root) node is simple the output node. On the GPU side each operator (internal node) equals a function, e.g. a function that creates the output of the noise node.

The idea is that I can visually create a binary expression tree (with additional unary operators), upload it to the GPU using a StructuredBuffer<NoiseGraphNode> where NoiseGraphNode is

struct NoiseGraphNode {     uint leftNodeIndex;     uint rightNodeIndex;     uint nodeType;     uint dataIndex;         // Index used in conjunction with nodeType                              // to access a node's data located in a                              // nodeType-specific StructuredBuffer, e.g.                              // the noise parameters in case of a noise node. }; 

and have that graph evaluated by the GPU’s compute shader for generating the noise that represents the final terrain. Normally such a graph would be evaluated using a recursive approach, something like:

evaluate(node) {      if(node has children){           left_val = evaluate(node->left);           right_val = evaluate(node->right);            // find operation symbol for node and use it as           // val = left_val operation right_val            return val;      }      else {           return node_value;      } } 

Pseudo-code taken from https://stackoverflow.com/questions/10769174/evaluating-expression-trees.

HLSL doesn’t support recursion though! Another way would be to emulate the recursive implementation using a stack and a while loop (after all recursion is leveraging the call stack). But creating a stack structure in HLSL like so

struct NoiseGraphStack {     uint buffer[20];     uint count;      void Push(uint number)     {         buffer[count++] = number;   // Doesn't work because an array reference                                      // cannot be used as an l-value.     }      float Pop()     {         return buffer[--count];     }      static NoiseGraphStack Create()     {         NoiseGraphStack stack;         stack.count = 0;          return stack;     } }; 

doesn’t work either because it requires the while loop to be unrolled which isn’t possible.

Note: The exact error message referred to in the code above is "array reference cannot be used as an l-value; not natively addressable, forcing loop to unroll."

So is it possible to evaluate a binary expression tree without recursion or a stack? Can I perhaps somehow preprocess the necessary steps for evaluating such a tree on the CPU (where I can use recursion just fine) first and linearize them before I send them to the GPU?

How to use WP_Query without breaking the main Query

The WP Query class can be used to make almost any imaginable query to the WP database. It’s amazing.

But it’s also used when WordPress is loaded, to run the main query for the current page request.

A common practice is to use wp_reset_query() and/or wp_reset_postdata()

But it’s unclear when to use one or the other, or if they must be used at all. And I don’t want to use them just in case but only when they are really needed.

So I would like to know what is the correct way to use the power of WP Query without breaking the main query.

How to make a content management system to load webpages without a PHP loader and its query strings?

I have a MediaWiki 1.35.2 Hebrew website which is principally all core; I host that website on a Apache, Nginx (as reverse proxy), PHP and MySQL hosting environment.

The default behavior of MediaWiki is to load any webpage with load.php and often many query strings;
It often raises errors in Google Pagespeed Insights about too many resources which consume loading time (maybe it’s better to load these informally without query strings) and it also makes my URLs "long" instead "short" (i.e. without using this load.php method) when they are already long because of Right-To-Left language Encoding.

For some reason/s I have a very hard time finding my way in the following MediaWiki guides on how to get shorter URLs without load.php and its query strings (guides that include explicitly outdated parts and/or many warnings and exceptions):

  • Manual:Short URL
  • Manual:Short URL/Apache

How to get all post categories without custom post type categories?

0

I am creating a Blog in wordpress.

I have a list of categories: Technology, Art, fashion, Home, Lifetime, Education, Business, Religion, Design and home, Marketing

In which some of these categories I am using only in Custom Post Type (Technology, Art, Fashion) and others only in Normal Posts (Home, Life, Education, Business, Religion, Design and home, Marketing).

When I created the custom pos type, I used the CPT UI plugin.

Now I need to get the list of categories that are only being used from normal posts to show them on my blog (). I tried to do the following but it returns all categories including CPTs:

$  categories = get_categories();   foreach($  categories as $  category) {     echo '<li class="cat-name"  . '>' . $  category->name . '</li>'; } 

I just need to show the categories: Home, Life, Education, Business, Religion, Design & Home, Marketing.

And exclude those that are being used in CPT. Please Help!

SQL Server UPDATE Command Fails without error

Using SSMS running the below UPDATE command I get returned message says 1 row affected. but if I then follow it up with a Select and it shows that the row never updated.

This issue happens in SSMS and a custom application I built in C# using Entity Framework. I have since stopped using Entity Framework generated code and moved straight to a stored proc. All of 3 different ways of performing the same task I randomly get this issue. Sometimes it can be 100’s or 1000’s of updates before the issue happens again or it could be a few updates later it happens again. I have run UPDATE STATISTICS, I have Rebuilt Indexes and Reorganized Indexes.

As a side note, I NEVER have an issue with INSERTs only UPDATEs we never DELETE any records. and total record count on the table is 201,741

UPDATE CreativeWorkFlowQueue     SET CurrentIndicator = 'N' WHERE CreativeWorkFlowQueueId = 198231  SELECT * FROM CreativeWorkFlowQueue WHERE CreativeWorkFlowQueueId = 198231 

enter image description here

here is the table

SET ANSI_NULLS ON GO  SET QUOTED_IDENTIFIER ON GO  CREATE TABLE [dbo].[CreativeWorkFlowQueue](     [CreativeWorkFlowQueueId] [int] IDENTITY(1,1) NOT NULL,     [DigitalCampaignCreativeId] [int] NOT NULL,     [WorkFlowQueueId] [int] NOT NULL,     [CurrentIndicator] [char](1) NOT NULL,     [CreateDate] [datetime] NOT NULL,     [LastUpdatedDate] [datetime] NOT NULL,     [IsDeleted] [bit] NOT NULL, PRIMARY KEY CLUSTERED  (     [CreativeWorkFlowQueueId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO  ALTER TABLE [dbo].[CreativeWorkFlowQueue] ADD  CONSTRAINT [CreateDate defaults to utcDate on CreativeWorkFlowQueue]  DEFAULT (getutcdate()) FOR [CreateDate] GO  ALTER TABLE [dbo].[CreativeWorkFlowQueue] ADD  CONSTRAINT [LastUpdatedDate defaults to utcDate on CreativeWorkFlowQueue]  DEFAULT (getutcdate()) FOR [LastUpdatedDate] GO  ALTER TABLE [dbo].[CreativeWorkFlowQueue] ADD  CONSTRAINT [DF_CreativeWorkFlowQueue_IsDeleted]  DEFAULT ((0)) FOR [IsDeleted] GO  ALTER TABLE [dbo].[CreativeWorkFlowQueue]  WITH CHECK ADD  CONSTRAINT [CreativeWorkFlowQueue DigitalCampaignCreativeId fk] FOREIGN KEY([DigitalCampaignCreativeId]) REFERENCES [dbo].[DigitalCampaignCreative] ([DigitalCampaignCreativeId]) GO  ALTER TABLE [dbo].[CreativeWorkFlowQueue] CHECK CONSTRAINT [CreativeWorkFlowQueue DigitalCampaignCreativeId fk] GO  ALTER TABLE [dbo].[CreativeWorkFlowQueue]  WITH CHECK ADD  CONSTRAINT [CreativeWorkFlowQueue WorkFlowQueueId fk] FOREIGN KEY([WorkFlowQueueId]) REFERENCES [dbo].[WorkFlowQueue] ([WorkFlowQueueId]) GO  ALTER TABLE [dbo].[CreativeWorkFlowQueue] CHECK CONSTRAINT [CreativeWorkFlowQueue WorkFlowQueueId fk] GO 

EDIT Adding the Stored Proc that also has the same issue.

I did not include this stored proc simply due to the fact that it is complex and if a simple update doesn’t work I figured start there first.

CREATE PROCEDURE [dbo].[sp_WtvToRtl]      -- Add the parameters for the stored procedure here     @tbl DCCIdList READONLY,         @WorkFlowQueueId int AS BEGIN     -- SET NOCOUNT ON added to prevent extra result sets from     -- interfering with SELECT statements.     SET NOCOUNT ON;           DECLARE @dccList TABLE (         CreativeWorkflowQueueId int null,         DigitalCampaignCreativeId int null,         WorkFlowQueueId int null,         CurrentIndicator varchar(1) collate SQL_Latin1_General_CP1_CI_AS null,         LastUpdatedDate datetime null     )      DECLARE @DCIDList TABLE(         DigitalCampaignCreativeId int null     )              DECLARE @res TABLE (         MergeAction VARCHAR(50) collate SQL_Latin1_General_CP1_CI_AS ,         CreativeWorkFlowQueueId INT,          _Position INT         )      BEGIN TRANSACTION t1      BEGIN TRY         INSERT INTO @dccList (CreativeWorkflowQueueId, DigitalCampaignCreativeId,LastUpdatedDate,WorkFlowQueueId,CurrentIndicator)         select CreativeWorkflowQueueId, DigitalCampaignCreativeId,LastUpdatedDate,WorkFlowQueueId, 'N' as CurrentIndicator from          dbo.CreativeWorkFlowQueue Where CurrentIndicator = 'Y'          and IsDeleted = 0         and DigitalCampaignCreativeId In          (SELECT DigitalCampaignCreativeId FROM VRF.DigitalCampaignCreative          WHERE IsDeleted = 0 and SfClosed = 0          and DccId in (Select DccId COLLATE SQL_Latin1_General_CP1_CI_AS from @tbl)         )                    INSERT INTO @DCIDList           SELECT DigitalCampaignCreativeId FROM @dccList          GROUP BY DigitalCampaignCreativeId          INSERT INTO @dccList (DigitalCampaignCreativeId,WorkFlowQueueId,CurrentIndicator)         select DigitalCampaignCreativeId, @WorkFlowQueueId as WorkFlowQueueId, 'Y' as CurrentIndicator from          @DCIDList           MERGE vrf.CreativeWorkFlowQueue a         USING              (             SELECT                  x.CreativeWorkflowQueueId,                 x.DigitalCampaignCreativeId,                 x.LastUpdatedDate,                 x.WorkFlowQueueId,                 x.CurrentIndicator              FROM @dccList x             ) stg                ON stg.CreativeWorkflowQueueId = a.CreativeWorkflowQueueId          WHEN MATCHED THEN             UPDATE SET                  a.CurrentIndicator  = stg.CurrentIndicator,                 a.LastUpdatedDate = getutcdate()         WHEN NOT MATCHED THEN             INSERT                  (                     CurrentIndicator,                     DigitalCampaignCreativeId,                     WorkFlowQueueId                 )             VALUES                  (                     stg.CurrentIndicator,                      stg.DigitalCampaignCreativeId,                      stg.WorkFlowQueueId                 )               -- ********************************************************************             -- Remove this if you don't need to return the results below.             OUTPUT                  INSERTED.CreativeWorkFlowQueueId,                 $  action              INTO @res (CreativeWorkFlowQueueId, MergeAction);             -- ********************************************************************           COMMIT TRANSACTION t1      END TRY     BEGIN CATCH          DECLARE @ErrorMessage NVARCHAR(MAX), @ErrorSeverity INT, @ErrorState INT;         SELECT @ErrorMessage = ERROR_MESSAGE() + ' Line ' + CAST(ERROR_LINE() AS NVARCHAR(5)), @ErrorSeverity = ERROR_SEVERITY(), @ErrorState = ERROR_STATE();         ROLLBACK TRANSACTION t1         --RAISERROR(@ErrorMessage, @ErrorSeverity, @ErrorState);         SELECT 'FAILED' MergeAction,                 s.CreativeWorkflowQueueId,                 s.DigitalCampaignCreativeId,                 '' DccId,                 s.WorkFlowQueueId,                 s.CurrentIndicator,                 null CreateDate,                 null LastUpdatedDate,                 null IsDeleted,                 @ErrorMessage ErrorMessage         FROM @dccList s     END CATCH       -- Normally, I would not have this.  But this will simulate     -- what EF does if you need it.     SELECT          r.MergeAction,         a.CreativeWorkFlowQueueId,         a.DigitalCampaignCreativeId,         d.DccId,         a.WorkFlowQueueId,         a.CurrentIndicator,         a.CreateDate,          a.LastUpdatedDate,         a.IsDeleted,         '' ErrorMessage     FROM vrf.CreativeWorkFlowQueue a      JOIN @res r ON a.CreativeWorkFlowQueueId = r.CreativeWorkFlowQueueId     JOIN vrf.DigitalCampaignCreative d ON a.DigitalCampaignCreativeId = d.DigitalCampaignCreativeId     ORDER BY          r.MergeAction,         r._Position   END 

The User-Defined Table Type is this.

CREATE TYPE [dbo].[DCCIdList] AS TABLE(     [DccId] [nvarchar](18) NULL ) 

Display related posts without a plugin

I’m trying to display the related posts using functions.php:

function posts_related($  related){ if (is_single()) { global $  post; // Build basic custom query arguments $  custom_query = new WP_Query( array(         'posts_per_page' => 8, // Number of related posts to display        'post__not_in' => array($  post->ID), // Ensure that the current post is not displayed        'orderby' => 'rand', // Randomize the results ));  // Run the loop and output data for the results if ( $  custom_query->have_posts() ) : while ( $  custom_query->have_posts() ) : $  custom_query->the_post();   if ( has_post_thumbnail()   ) {                   $  permalink = the_permalink();                  $  post_thumbnail = the_post_thumbnail('medium');                  $  title = the_title();                                         $  related .= '<a href="' . $  permalink .  '"><img src="' . $  post_thumbnail . '/></a>';                               }            $  related .=  '<a href="' .  $  permalink . '"><b>' . $  title . '</b></a>';      endwhile;   else :      $  related .= '<p>Nothing to show.</p>'; endif; // Reset postdata }          echo '<pre>'; var_dump( has_post_thumbnail() ); echo '</pre>';       return $  related;  }    //wp_reset_postdata();  add_filter( "the_content", "posts_related", 99 ); add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 100, 50, true ); 

But I’m not being able to handle the output properly. I need it to display below the post (single post).

display childs without parent

The following code displays the parent plus his children on the specific parent- and children-category pages as "filter-buttons". But in this list I do not want to display the parent, (because the parent is already displayed as "ALL"). How can I display list with only the childre/ without the parent?

Thank you for any further help.

<?php $ categories = get_the_category(); foreach($ categories as $ key => $ category) { $ url = get_term_link((int)$ category->term_id,'category'); $ categories[$ key] = "<pre><a href=\"{$ url}\">{$ category->name}</a></pre>"; } echo "" . implode("\n",$ categories) . ""; ?>