Is it typical for there to be no real design prior to someone being assigned a task?

I’m a junior engineer, but I’ve worked at two companies now. In both cases I’ve found that my colleagues and I are assigned tasks with no thought put into the design before being told to do it.

Typically I spend about 90% of my time writing down on paper how I’m going to do the task, then the code sort of writes itself in maybe a day, sometimes two if I run into difficulties with an API.

Is there something strange about this picture? Is the design supposed to be the work? I don’t really begrudge it, I quite like the designing of things.

But it seems to me it would be more productive to together as a team determine the design of everything to be done, and then everyone can go away and do it pretty quickly, this would put everyone on the wavelength, and so there would be less instances of interfaces not being as you’d like. I feel that once the design is done, the coding is essentially a series of ‘write a function which takes in X and does Y’, which anyone can easily do except perhaps in the case of some complex algorithm being required.

I am thinking of asking my team if we could try designing things up front, before assigning the work. But I am not sure if they will be up for this, or if it’s a ridiculous idea and that’s why I’ve not seen anyone do it.

sql server – Blocking task report is showing false positive

Here is the code I am using to send email alerts. It seems to send more false +ves, can anyone guide me how to resolve this ?

DECLARE @Waiting INT;
DECLARE @Message NVARCHAR(MAX);

SELECT  @Waiting = COUNT( s.session_id )
FROM    sys.dm_exec_sessions s
LEFT OUTER JOIN sys.dm_exec_connections c ON ( s.session_id = c.session_id )
LEFT OUTER JOIN sys.dm_exec_requests r ON ( s.session_id = r.session_id )
LEFT OUTER JOIN sys.dm_os_tasks t ON ( r.session_id = t.session_id AND  r.request_id = t.request_id )
LEFT OUTER JOIN (
                    -- In some cases (e.g. parallel queries, also waiting for a worker), one thread can be flagged as
                    -- waiting for several different threads.  This will cause that thread to show up in multiple rows
                    -- in our grid, which we don't want.  Use ROW_NUMBER to select the longest wait for each thread,
                    -- and use it as representative of the other wait relationships this thread is involved in.
                    SELECT  *
                            ,ROW_NUMBER() OVER ( PARTITION BY waiting_task_address ORDER BY wait_duration_ms DESC ) AS row_num
                    FROM    sys.dm_os_waiting_tasks ) w ON ( t.task_address = w.waiting_task_address )
                                                            AND w.row_num = 1
LEFT OUTER JOIN sys.dm_exec_requests r2 ON ( r.session_id = r2.blocking_session_id )
WHERE   ISNULL( t.task_state, N'' ) <> ''
        AND ISNULL( DB_NAME( r.database_id ), N'' ) = 'MyDB'
        AND ISNULL( w.wait_duration_ms, 0 ) > CASE
                                                    WHEN FORMAT( GETDATE(), 'HH:mm' ) >= FORMAT( CAST('07:00AM' AS TIME), N'hh.mm' )
                                                        AND  FORMAT( GETDATE(), 'HH:mm' ) < FORMAT( CAST('05:30PM' AS TIME), N'hh.mm' ) THEN 10000
                                                    ELSE 20000
                                                END ---  this will change the wait time to 20s during offpeak hours.
        AND s.session_id <> ISNULL( w.blocking_session_id, 0 )
        AND is_user_process = 1;    ---- added on 2019-04-02 @8.40AM to neglect the parallel queries.threads blocking themselves 

IF ( @Waiting > 30 )
    --send email 

Jobs – Get 55 BMF – EASY TASK | Proxies-free

Earnings Disclaimer:  All the posts published herein are merely based on individual views, and they do not expressly or by implications represent those of Proxies-free or its owner. It is hereby made clear that Proxies-free does not endorse, support, adopt or vouch any views, programs and/or business opportunities posted herein. Proxies-free also does not give and/or offer any investment advice to any members and/or it’s readers. All members and readers are advised to independently consult their own consultants, lawyers and/or families before making any investment and/or business decisions. This forum is merely a place for general discussions. It is hereby agreed by all members and/or readers that Proxies-free is in no way responsible and/or liable for any damages and/or losses suffered by anyone of you.

c# – How can I use task async await to get all directories and files with progress report?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Management;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Schema;

namespace Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

        }

        private Task ProcessData(List<string> list, IProgress<ProgressReport> progress)
        {
            int index = 1;
            int totalProcess = list.Count;
            var progressReport = new ProgressReport();

            return Task.Run(() => 
            {
                for(int i = 0; i < totalProcess; i++)
                {
                    progressReport.PercentComplete = index++ * 100 / totalProcess;
                    progress.Report(progressReport);
                    Thread.Sleep(10);
                }

            });
        }



        async Task ProcessRead()
        {
            await Task.Run(() =>
            {
                IEnumerable<string> fileEntries = Directory.EnumerateFiles(@"c:windows","*.*", SearchOption.TopDirectoryOnly);
                int count = 0;
                foreach (string fname in fileEntries)
                {
                    try
                    {
                        count++;
                        string text = File.ReadAllText(fname);
                    }
                    catch (Exception ex)
                    {

                    }
                }
            });
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private async void btnStart_Click(object sender, EventArgs e)
        {
            List<string> list = new List<string>();

            for(int i = 0; i < 1000; i++)
            {
                list.Add(i.ToString());
            }

            lblStatus.Text = "Working...";
            var progress = new Progress<ProgressReport>();
            progress.ProgressChanged += (o, report) =>
            {
                lblStatus.Text = string.Format("Processing...{0}%", report.PercentComplete);
                progressBar.Value = report.PercentComplete;
                progressBar.Update();
            };

            await ProcessData(list, progress);
            lblStatus.Text = "Done !";
        }
    }
}

This will report the progress in percentages.

but I want to use the ProcessRead function to work on a thread so while it’s getting the files and read each file I will be able to click other ui like buttons.

I want to use the ProcessRead function instead the loop i < 1000
I also want to report progress using counting variables how many files and directories was got so far how many files was reading so far.

The idea is to read the files content and doing with each file content something and to do it all in real time and so I ill be able to use ui while it’s working.

Now if I put the ProcessRead function just call it instead the loo I < 1000

private async void btnStart_Click(object sender, EventArgs e)
        {
            List<string> list = new List<string>();

            ProcessRead().Wait();

            lblStatus.Text = "Working...";
            var progress = new Progress<ProgressReport>();
            progress.ProgressChanged += (o, report) =>
            {
                lblStatus.Text = string.Format("Processing...{0}%", report.PercentComplete);
                progressBar.Value = report.PercentComplete;
                progressBar.Update();
            };

            await ProcessData(list, progress);
            lblStatus.Text = "Done !";
        }

The program just freeze I mean the ui freeze and waiting for it to finish.

c# – How can I use Task Async Await to read files content from multiple directories recursive?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            ProcessRead().Wait();
        }

        static async Task ProcessRead()
        {
            await Task.Run(() =>
            {
                IEnumerable<string> fileEntries = Directory.EnumerateFiles(@"Directory");
                int count = 0;
                foreach (string fname in fileEntries)
                {
                    try
                    {
                        count++;
                        string text = File.ReadAllText(fname);
                        Console.WriteLine(text);
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }

                Console.WriteLine(count);
            });
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
    }
}

This is working but only for the given directory in EnumerateFiles.
but I want to get all the files in all directories recursive.

For example if I put the directory of windows :

IEnumerable<string> fileEntries = Directory.EnumerateFiles(@"c:windows");

I want it to read the content of all the files in the directory windows and also all the sub directories in windows. So it will read all the files content in the given root directory and all it’s sub directories recursive.

winforms – C# Windows.Forms.Timer synchronous Task Processing with multiple Timers

In the bellow test scenario i like to trigger some task by using multiple timers. Some event can trigger another event.
An event must finish the process, before a new process can be started. Events that gets triggered, while another event is processing, shall queue up and start once nothing is processing. The timer doesn’t need to be accurate.

The current problem on the code bellow, is that things get mixed up. Line2 starts processing, while Line still hasn’t finished. How to make the orders queue up properly and process it properly?

The console output of this code is;
Line1 Processing
Line1 CompletedLine2 Processing
Line2 CompletedLine1 Processing
……..

What is required is;
Line1 Processing Line1 Completed
Line2 Processing Line2 Completed
……..
Im a beginner, so please be patient 🙂

public partial class Form1 : Form
    {
        readonly System.Windows.Forms.Timer myTimer1 = new System.Windows.Forms.Timer();
        readonly System.Windows.Forms.Timer myTimer2 = new System.Windows.Forms.Timer();

        int leadTime1 = 100;
        int leadTime2 = 100;

        public Form1()
        {
            InitializeComponent();
            TaskStarter();

        }

        private void TaskStarter()
        {
            myTimer1.Tick += new EventHandler(myEventTimer1);
            myTimer1.Tick += new EventHandler(myEventTimer2);

            myTimer1.Interval = leadTime1;
            myTimer2.Interval = leadTime2;

            myTimer1.Start();
        }

        private void myEventTimer1(object source, EventArgs e)
        {
            myTimer1.Stop();
            Console.WriteLine("Line1 Processing ");
            MyTask();
            Console.Write(" Line1 Completed");
            myTimer2.Start();
            myTimer1.Enabled = true;
        }

        private void myEventTimer2(object source, EventArgs e)
        {
            myTimer2.Stop();
            Console.WriteLine("Line2 Processing ");
            MyTask();
            Console.Write(" Line2 Completed");
            myTimer2.Enabled = true;
        }

        private void MyTask()
        {
            Random rnd = new Random();
            int tleadtime = rnd.Next(1000, 5000);
            Thread.Sleep(tleadtime);
        }
    }

☑️NEW – Task coin app Reviews: SCAM or LEGIT? | Proxies-free

Do you happen to know the pay scale for solving captcha? Normally it is so low that you can’t really earn money by doing this task. Do the other tasks pay a bit more for data entry, playing games, or performing the other tasks from the site? It would be nice to understand how much you can actually earn by completing the tasks from the app.

 

Jobs – Get 59 BMF – EASY TASK | Proxies-free

Earnings Disclaimer:  All the posts published herein are merely based on individual views, and they do not expressly or by implications represent those of Proxies-free or its owner. It is hereby made clear that Proxies-free does not endorse, support, adopt or vouch any views, programs and/or business opportunities posted herein. Proxies-free also does not give and/or offer any investment advice to any members and/or it’s readers. All members and readers are advised to independently consult their own consultants, lawyers and/or families before making any investment and/or business decisions. This forum is merely a place for general discussions. It is hereby agreed by all members and/or readers that Proxies-free is in no way responsible and/or liable for any damages and/or losses suffered by anyone of you.