How do you compute and compare the delays between a (4:2) compressor and (3,2) counter carry save tree?

My question: How is Table 6.8 shown below computed for different operands? For example, for 3 operands how did they compute:

Number of levels using (3,2) = 1

Number of levels using (4;2) = 1

Equivalent delay: 1.5

Or how about for 9 operands how did they compute:

Number of levels using (3,2) = 4

Number of levels using (4;2) = 3

Equivalent Delay: 4.5

The textbook also points out that the equivalent delay of a (4;2) compressor carry save tree with 9 operands (4.5) is bigger than that of a carry save tree using (3,2) counters. Why is that?

What are the general conditions when one is bigger than the other?

The following is an image of a (4:2) compressor taken from this book.

enter image description here

The truth table provided for this compressor is:

enter image description here

where $ a=b=c=1$ and $ d=e=f=0$ . I think these constants are used to generalize the circuit.

An adder tree that uses (4;2) compressors will have a more regular struc-ture and may have a lower delay than an ordinary CSA tree made of (3,2) counters. Table 6.8 compares the delays of carry-save trees using either (3,2) counters or (4;2) compressors. Since the delay of a (4;2) compressor is 1.5 times that of a (3,2) counter, the number of levels of (4;2) compressors in column 3 is multiplied by 1.5 to yield the equivalent delay in column 4. Note that the equivalent delay of a carry save tree using (4;2) compressors (column 4) is not always smaller than that of a carry save tree using (3,2) counters (column 2). For example, for nine partial products, (3,2) counters will yield a carry save tree with an overall lower delay. Various other counters and compressors can be employed in the implementation of the addition tree for the partial product accumulation; for example, (7,3) counters

Please look at the bold face sentence above: enter image description here

Why does Min-Max algorithm delays a good move indefinitely?

I implemented a min-max algorithm for a game and discovered a problem.

Let’s say there is a 2×2 grid:

.. .. 

Assume we start at location (0, 0) and the target is (1, 1):

S. .T 

Moves allowed: adjacent or diagonal move.

Evaluation: if I land at (1, 1), I get +100.

If I implement the mini-max algorithm for this with depth 1, some of the branches are as follows:

(0, 0) -> (0, 1) -> (1, 1) Here, we return +100

(0, 0) -> (1, 0) -> (1, 1) Here, we return +100

(0, 0) -> (1, 1) -> (0, 1) Here, we return +0

If you look at this, the algorithm should actually play the 3rd branch and immediately go to (1, 1) but rather it would select 1st or 2nd branch. And after playing that move it will again go into the same situation and continue to select branches that have (1, 1) as the 2nd step.

How to solve this problem? My game has entered a kind of an infinite situation where it is just playing another move with the hope of playing good move at depth 1 but again does the same process and repeats this infinitely.

Can excessive delays in workflows cause SharePoint timer job to be stuck?

One of my workflows has excessive delays and that too of a longer duration. For instance, one delay in my workflow is of three months and other is of a single month. Now the problem is that my SharePoint timer service gets stuck and its status is “Pausing”. Is it possible that the delays in workflows are causing the timer to be stuck? Has this happened to anyone before?

This article suggests that this problem can be caused by a bad workflow instance. Does my workflow come in that category?

Schedule periodic task in Java, with separate delays for success and failure

I want a Java program that runs a certain job every 5 minutes.

  • If the job runs longer than 5 minutes, a new iteration should not start until immediately after the current one ends. Otherwise, it should start 5 minutes after the last one started.
  • If the job fails for any reason, it should try again 1 minute after the failure occurred (even if it ran for over 5 minutes).
  • It should be robust in case the system clock is turned back and not wait too long in that case.

How can this be cleanly accomplished (using e.g ScheduledThreadPoolExecutor or TimerTask)?

Sources of information about flight times and delays

I booked travel from Perth Australia (QF648 2350 11 April 2019) via Melbourne Australia to Christchurch New Zealand (QF133 0715 12 April 2019) but there was a delay in Perth. Because I was going to miss my connection in Melbourne, Qantas transferred me to Air New Zealand in Melbourne so I could travel to Christchurch via Auckland on flights NZ722 and NZ555. I think there was also some sort of delay with one or other of those flights but I’m not sure, and I got to Christchurch too late on 12 April 2019 to travel to the town where I had pre-booked accommodation so I had extra expenses in Christchurch.

I’m now trying to complete a travel insurance claim but I can’t remember all the details. Is there a free open-source list of that kind of thing? It’s not like I have to prove in the claim that the delays occurred because I would guess the insurance company is going to check that in any case; but I would like to get the details right.

Delays with Fetching website Data using VBA

I developped a macro that allows me to scrap/extract data from web/server and present it to user using VBA but this problem that is taking too much time like 15 sec per reference .

What I want to do is to make it quicker and efficient and eliminate all the unecessary lines .

My code is :

1- prepars Excel and clean all cells

2- connect to website and fetch for the data which are selected in excel

3-Copy data from Website and past it into excel

4- call another macros in order to do also another tasks

the delays is on opening website and waiting then reselecting excel to past Data

This is the first code :

Sub extramod() Dim ie As Object, obj As Object Dim itm As IHTMLElement Dim htmlcurrentDoc As IHTMLElement Dim elemCollection As Object Dim r As Long, c As Long, t As Long, d As Long, i As Long, x As Long, ii As Long, jj As Long Dim lastRow As Variant Dim count As Long Dim j As Long, K As Long Dim ks As Worksheet Dim ele As Object Dim eRow As Long Dim f As Variant Dim tags As Object Dim oHtml As HTMLDocument Dim doc As Object Dim tagx As Object  Dim a As Object Dim l As Object Dim l2 As Integer Dim n As String Dim val As String Dim tex As String Dim tRow As Object, tCel As Object Dim MPNum As Variant, wb As Excel.Workbook, ws As Excel.Worksheet Dim SWs As SHDocVw.ShellWindows, vIE As SHDocVw.InternetExplorer Dim RegEx As New RegExp, TestString As String        'add the microsoft Internet Controls   Set ie = CreateObject("InternetExplorer.Application")    Set ks = ThisWorkbook.Sheets.Add(After:= _          ThisWorkbook.Sheets(ThisWorkbook.Sheets.count)) ks.Name = "Feuil1" Set wb = Excel.ActiveWorkbook Sheets("Feuil1").Activate Set ws = wb.ActiveSheet   lastRow = Worksheets("Feuil2").Cells(Rows.count, "A").End(xlUp).row Sheets("Feuil2").Range("C2:C10").Clear Sheets("Feuil2").Range("C2:H1000").Clear  Sheets("Feuil2").Range("O2:T1000").Clear    With ie      d = 1      For Each f In Sheets("Feuil2").Range("A2:A" & lastRow).Value      MPNum = f      d = d + 1  .Visible = False .navigate "it's my own website"   While ie.Busy Or ie.readyState <> 4: DoEvents: Wend 'we ensure that the web Page is loaded completely    Set itm = ie.document.getElementsByName("searchById")(0)  If Not itm Is Nothing Then itm.Value = MPNum  Set doc = ie.document    Set tags = ie.document.getElementsByTagName("input")  For Each tagx In tags    If tagx.src = "http://it's my own button" Then     tagx.Click    End If Next  On Error Resume Next  While ie.Busy Or ie.readyState <> 4: DoEvents: Wend  'Set SWs = New SHDocVw.ShellWindows  'For Each vIE In SWs  'If Left(vIE.LocationURL, 62) = "http://my own website " Then 'avoid explorer windows/etc this way 'Sheets("Feuil2").Range("J" & d).Value = "http://website cells =" & MPNum 'End If 'Next  Set SWs = Nothing Set vIE = Nothing   Sheets("Feuil1").Range("A1:AK500").ClearContents  If Sheets("Feuil2").Range("N4").Value = "MOD" Then x = 2 c = 1 'Application.Wait (Now + TimeValue("0:00:03"))  On Error Resume Next   While ie.Busy Or ie.readyState <> 4: DoEvents: Wend   Set oHtml = New HTMLDocument   oHtml.body.innerHTML = ie.document.body.innerHTML   Set elemCollection = oHtml.getElementsByTagName("table")(71)             ' Search for Table 62 and Extract it into Sheet 1     For Each tRow In elemCollection.Rows    For Each tCel In tRow.Cells     Cells(x, c) = tCel.innerText    c = c + 1    Next tCel    c = 1    x = x + 1    Next tRow     tex = "MOD"  Set h = Cells.Find(What:=tex, After:=Cells(1), LookAt:=xlPart)   h.Select    Selection.Offset(1, 0).Select   Selection.Copy   Worksheets("Feuil2").Select   Range("C" & d).Select   ActiveSheet.Paste  Sheets("Feuil1").Activate      For i = 2 To lastRow  TestString = Sheets("Feuil2").Cells(i, 3).Value  With RegEx     .Pattern = "^(?:[0-9]{6})" Or "^(?:[0-9]{5})"                                                        'TestString if     number  End With  If RegEx.test(TestString) = True Then  Sheets("Feuil2").Cells(i, 4).Value = Left(Sheets("Feuil2").Cells(i, 3).Value, 6)  End If  While ie.Busy Or ie.readyState <> 4: DoEvents: Wend  If Sheets("Feuil1").Range("A2").Value = "Type" Or Sheets("Feuil1").Range ("A2").Value = "TRS " Or Sheets("Feuil1").Range("A2").Value <> "MOD Number (CIN)" Then  x = 2 c = 1 'Application.Wait (Now + TimeValue("0:00:03")) On Error Resume Next While ie.Busy Or ie.readyState <> 4: DoEvents: Wend   Set oHtml = New HTMLDocument  oHtml.body.innerHTML = ie.document.body.innerHTML   Set elemCollection = oHtml.getElementsByTagName("table")(72)             ' Search for Table 72 and Extract it into Sheet 1    For Each tRow In elemCollection.Rows    For Each tCel In tRow.Cells     Cells(x, c) = tCel.innerText    c = c + 1    Next tCel    c = 1    x = x + 1    Next tRow     Set elemCollection = oHtml.getElementsByTagName("table")(73)             ' Search for Table 72 and Extract it into Sheet 1    For Each tRow In elemCollection.Rows    For Each tCel In tRow.Cells     Cells(x, c) = tCel.innerText    c = c + 1    Next tCel    c = 1    x = x + 1    Next tRow   '  Set elemCollection = oHtml.getElementsByTagName("table")(74)             ' Search for Table 72 and Extract it into Sheet 1   ' For Each tRow In elemCollection.Rows   ' For Each tCel In tRow.Cells   '  Cells(x, c) = tCel.innerText  '  c = c + 1  '  Next tCel  '  c = 1 '   x = x + 1  '  Next tRow     Set elemCollection = oHtml.getElementsByTagName("table")(75)             ' Search for Table 72 and Extract it into Sheet 1    For Each tRow In elemCollection.Rows    For Each tCel In tRow.Cells     Cells(x, c) = tCel.innerText    c = c + 1    Next tCel    c = 1    x = x + 1    Next tRow     Set elemCollection = oHtml.getElementsByTagName("table")(76)             ' Search for Table 72 and Extract it into Sheet 1    For Each tRow In elemCollection.Rows    For Each tCel In tRow.Cells     Cells(x, c) = tCel.innerText    c = c + 1    Next tCel    c = 1    x = x + 1    Next tRow        Set elemCollection = oHtml.getElementsByTagName("table")(77)             ' Search for Table 72 and Extract it into Sheet 1    For Each tRow In elemCollection.Rows    For Each tCel In tRow.Cells     Cells(x, c) = tCel.innerText    c = c + 1    Next tCel    c = 1    x = x + 1    Next tRow   tex = "MOD"   Debug.Print tCel.innerText   Set h = Cells.Find(What:=tex, After:=Cells(1), LookAt:=xlPart)   h.Select    Selection.Offset(1, 0).Select   Selection.Copy    Worksheets("Feuil2").Select   Range("C" & d).Select   ActiveSheet.Paste   Sheets("Feuil1").Activate    TestString = Sheets("Feuil2").Cells(i, 3).Value   With RegEx     .Pattern = "^(?:[0-9]{6})" Or "^(?:[0-9]{5})"                                                     'TestString if number   End With   If RegEx.test(TestString) = True Then   Sheets("Feuil2").Cells(i, 4).Value = Left(Sheets("Feuil2").Cells(i, 3).Value, 6)   End If   End If   Next      'Set elemCollection = oHtml.getElementsByTagName("table")(63)             ' Search for Table 62 and Extract it into Sheet 1  '  For Each tRow In elemCollection.Rows  '  For Each tCel In tRow.Cells   '  Cells(x, c) = tCel.innerText  '  c = c + 1   '   Next tCel   '   c = 1   '  x = x + 1   '   Next tRow   '  tex = "CR/Context Number"   ' Set h = Cells.Find(What:=tex, After:=Cells(1), LookAt:=xlPart)   'h.Select   'Selection.Offset(2, 0).Select   'Selection.Copy    'Worksheets("Feuil2").Select   'Range("F" & d).Select   'ActiveSheet.Paste   'Sheets("Feuil1").Activate    'tex = "CR/Context Number"   'Set h = Cells.Find(What:=tex, After:=Cells(1), LookAt:=xlPart)   'h.Select    'Selection.Offset(2, 0).Select   'Selection.Offset(0, 2).Select   'Selection.Copy   'Worksheets("Feuil2").Select    'Range("I" & d).Select   'ActiveSheet.Paste   'Sheets("Feuil1").Activate    'tex = "Origin (Type + Reference)"   'Set h = Cells.Find(What:=tex, After:=Cells(1), LookAt:=xlPart)   'h.Select   'Selection.Offset(2, 0).Select   'Selection.Copy   'Worksheets("Feuil2").Select   'Range("G" & d).Select   'ActiveSheet.Paste   'Sheets("Feuil1").Activate     'If Sheets("Feuil1").Range("A8").Value <> "" And Left(Sheets("Feuil1").Range("A8").Value, 0) = "N" Then   ' Set h = Cells.Find(What:=tex, After:=Cells(1), LookAt:=xlPart)    'h.Select   'Selection.Offset(2, 0).Select   'Selection.Copy   'Worksheets("Feuil2").Select   'Range("AA" & d).Select   'ActiveSheet.Paste   'Range("BB" & d).Value = Range("AA").Value & "/" & Range("F" & d).Value   'Range("F", d).Value = Range("BB" & d).Value   'Sheets("Feuil1").Activate   'End If  End If    Next f  End With ie.Quit   Set ie = Nothing   Sheets("Feuil2").Select   'Call titreMP1    K = Sheets.count  For j = K To 1 Step -1     t = Sheets(j).Name     If t = "Feuil1" Then         Application.DisplayAlerts = False             Sheets(j).Delete         Application.DisplayAlerts = True     End If  Next j     Call exemt       K = Sheets.count   For j = K To 1 Step -1     t = Sheets(j).Name     If t = "Feuil1" Then         Application.DisplayAlerts = False             Sheets(j).Delete         Application.DisplayAlerts = True     End If    Next j   MsgBox "Done" End Sub 

The 3 others macro have the simlar function to this ,

my macro keeps closing and opening website for fetching information and paste them to excel

any recommendation are welcome

Best Regards , sameur

Database listing delays

I am having issues with below code which display the news added in the database after few hours, the news is added straight away in the database once created and not sure if i need to make any changes in below code so it fetches the updated

<? $  query="SELECT SQL_CALC_FOUND_ROWS *, id, title, valid_from FROM news WHERE active AND '$  date_now'>=news.valid_from ORDER BY valid_from DESC LIMIT 4"; @$  result=mysql_query($  query); $  num_rows=mysql_num_rows($  result);  $  query_count="SELECT FOUND_ROWS() as no_results_total"; @$  result_count=mysql_query($  query_count); @$  row_count=mysql_fetch_assoc($  result_count); @$  no_results_total=$  row_count['no_results_total'];  while(@$  row=mysql_fetch_assoc($  result))     {     $  news[$  row['id']]=$  row;     }  $  query="SELECT *                 FROM                     (                     SELECT id,ext,database_id                     FROM images                     WHERE database_name='news' AND database_id IN(" . implode(',',array_keys($  news)) . ")                     ORDER BY role                     ) AS images2                 GROUP BY database_id"; @$  result=mysql_query($  query); while(@$  row=mysql_fetch_assoc($  result))     {     $  news[$  row['database_id']]['img']=$  row;     }  foreach($  news as $  val)     {     $  last=$  val['valid_from']; 

?> ‘);”> &ext=&th=n” />

Gaming: How do input delays stack up for game streaming

My question in short:

If you run a game locally you have an input lag X. If you stream it remotely, the input lag will be X + ping + additional overhead. How much additional overhead is there and how is it produced ?

Longer version:

I have recently tested a cloud computing provider that streams the remote desktop to my PC. The input seemed surprisingly laggy. You could feel the delay when moving the mouse pointer and scrolling was incredibly choppy.

Ping to their servers was 10ms, download rate ca 8MB/s (byte not bit), connected over cable (checked network stats, there are no package drops). The desktop content was streaming at 720p. Intuitively I would have expected this to result in a very speedy connection.

For my purposes, their service is still very attractive. I don’t need the streamed desktop and am just interested in the price/performance ratio to buy compute power. But still, this made me wonder: Lately there are many articles about cloud gaming services. How can these services work? Are they targeting people with an even better internet connection (after skimming docs for parsec, it looks like I’m well within the optimal requirements).

What are the key factors for input delay in a local vs remote setup?

Let’s press space for jumping, locally this means:

  • drivers and OS route this event to the game
  • game does calculations and renders frame (probably strongly depends on the game)
  • frame is written to frame buffer, screen picks it up (on 60Hz, the time between frames is 16.666ms, so that’s the worst case here)

Remotely:

  • drivers and OS
  • package input and send over network (UDP I guess, so this would be fast)
  • receive input on remote PC, emulate button press for game to pick up
  • game logic and frame render
  • encoding frame
  • network stack again, send frame back (frames must be kept in order. Pure UDP is probably not possible)
  • decoding
  • frame buffer and wait for screen

Increase key press delays for the contrl keys

I’m using Unity desktop. The foremost reason I use that because it enables me switching windows by pressing Super+N where N belongs to {0, 1, 2, 3 … 9}

The way I have optimized is by assuming, at most I will be using 10 apps in real life. So I made the dock hidden and keep switching to the apps I needed based on the preset location (1-PyCharm, 2-Terminator, 3-DBeaver, 4-Sublime, 5-Opera, 6-Zim, 7-Filemanager, 8-Slack, 9-Postman, 0-Telegram)

Now the problem is, when I switch windows quickly by pressing Super followed by a number, the trouble happens often, while pressing the combo (Super+N), I tend to release the Super key milliseconds prior to hitting the number.

Now the question is, how to add a timedelay for Super key so that it last 0.25 seconds longer even after it was released?