How to make updates to data and return list of updates without breaking Command query separation or DRY?

I have a use case to make updates to a slightly complex JSON object and then return the list of changes made (not the updated data). The process of finding the list of changes is extremely similar to the process of making the changes and it would bring in some redundancy if I chose to separate the two methods. So I’m wondering if there is a way to do this without choosing DRY over CQS and SRP.

UK Customs or TSA removed my TSA lock but didn’t leave a note or return the lock, what can I do?

I flew to the US on a business trip last month, and locked my soft suitcase with a TSA lock. I did the same on the flight back, but when I got my bag off the carousel at Heathrow there was no lock, no note, and a carrier bag containing a bottle of Hershey’s sauce was at the top of the bag instead of in the middle where I packed it. Nothing else was moved, and due to the lack of a note I don’t actually know who opened my bag or why.

I know it’s not a big deal, but the lock was borrowed and I now owe somebody a lock. My colleague’s suitcase was also opened but the lock was inside along with a note from the TSA saying that they searched the bag.

What can I do?

Why does this query return a result in MySQL but not in php?

I have a query that isn’t returning a result in php for a certain search term (that I believe it should), but when I test it directly in MySQL, it does return one. Other search terms return fine.

SELECT id,   CONCAT_WS(' ',             TRIM(SUBSTRING_INDEX(                  SUBSTRING(`text`, 1, INSTR(`text`, 'rig') - 1 ),                  ' ',                  -8)             ),             TRIM(SUBSTRING_INDEX(              SUBSTRING(`text`, INSTR(`text`, 'rig') ),              ' ',              7)         )   ) as `sample`, `title`, `url`  FROM `documents` WHERE MATCH(text) AGAINST('"rig"' IN BOOLEAN MODE ) OR MATCH(title) AGAINST('"rig"' IN BOOLEAN MODE ) 


if (!$  result=$  mysqliSiteSearch->query($  query)) send("3149","e"); $  hitArray=array();       while ( $  row=$  result->fetch_assoc() ) { $  hitArray[]=$  row; } 

I set up a .txt log file to record the result of:

print_r($  result,true) 

I tested a different search term which returns 8 results both directly in MySQL and when running the php script, and my log file shows:

mysqli_result Object (     [current_field] => 0     [field_count] => 4     [lengths] =>      [num_rows] => 8     [type] => 0 ) 

I then test the search term “rig”, which, when testing the same query directly in MySQL, returns 1 row, but when running my php script, I get no hit, and my log file shows:

mysqli_result Object (     [current_field] => 0     [field_count] => 4     [lengths] =>      [num_rows] => 0     [type] => 0 ) 

Clearly I’m overlooking something, but what please?

Thank you for your time and help.

American citizen overstayed visa in the UK and wants to return home. Some questions

I’m an American citizen and I’ve overstayed my visa in the UK for years now. I want to book my flight back to the US ASAP on my own dime but I have a some questions about traveling home.

A lot of flights I’ve seen back to the US have a connecting flight in either The Netherlands or the Republic of Ireland (not in the UK).

Would it be an issue to travel through these countries considering I’ll likely need to be issued a transit visa upon arrival and I’ve overstayed a visa in the UK?

Would it be best to find a flight that goes directly to the US, no stops in other countries?

And I also wanted to ask about the airport. What can I expect when I’m there?

1.) Is there anything specific I should bring with me (I’ll have my valid US passport and a print out of my flight details)?

2.) Should I go directly to immigration and speak to them? Will I be detained and/or issued a fine/ban?

3.) Do they check passports when you leave (I’ll likely need to take a flight out of Heathrow in London if I can’t transit through other countries)? I don’t believe there are formal exit controls in the UK but don’t they do random checks?

4.) Can I just go and board my flight as normal?

I just want to make sure I’m doing the right thing so as to allow this to go as smoothly as possible. Any advice would be greatly appreciated.

How do you write an equation to look in one cell for an IF AND result and return the adjacent cell’s value in Google Sheets?

I am trying to write an equation for a catering form that recognizes a number of beverages the client wants and returns the corresponding price per cup based on a pre-determined volumetric dependent value in a table.

Prices are obviously not real in the example table.

enter image description here

Ideally I would use this to streamline our catering quotes and have a quicker response time.

COUNTA and FILTER returning a 1 when it should return a 0

I am using a summary page to show stats from a registration page. I want to show the number of registrations based on their date of registration (which is in column A of the Registrations page. I modified a formula offered here via a different post:

=countA(FILTER('Reg-6-20-2019'!A$  2:A,LEFT('Reg-6-20-2019'!A$  2:A,2)="01")) 

So this should return all of the registrations that were made in “01” because the exported format from the software is in the mm/dd/yyyy format. It does this fine. I add cells to display 02, 03, 04, 05, 06, 07, 08 All of them work great, but when I get to 07 and 08 (future registrations) which should return 0, it returns a 1.

Not a big deal, but not sure I understand why it would do this. All months that actually have registrations are correct.

It does correctly output a 1 for July if I put an July entry into the data sheet, and a 2 if I put in 2 of them, but why am I getting a 1 if there are no such entries matching the criteria?

How to return to the same location on the screen after a table refresh

I have an ASP.Net MVC application. A view is composed of two partial views, a filter view and a results view. The filter view is used to set the status of the result items and call the controller method to get the results.

The results view renders the search results as a table of single element rows, each containing another table representing the result item. On each row there is a drop down allowing the user to change the status of that particular item. Thus, the user can scroll through the result items and change the status of any number of them. The user can then click on a button to update the changed items status. Following that the query is executed again and results are refreshed.

What is required here is for the results table to automatically be scrolled to the last item viewed so the user does not have to scroll there manually.

After a UK visa decision, how long for VFS Global to return passport?

I applied for a UK visitors visa from the US. I sent the materials to the VFS scanning hub in NY along with a return UPS label. I received an email telling me that a decision had been made and that my passport would be returned soon. It’s been 5 days and VFS hasn’t sent it yet. (I have the tracking number for the return label since I created it.)

Is this a normal timeline? When should I expect it?

How to exploit this buffer overflow. Where is the return address?

I’m practicing doing buffer overflows and, weirdly, I can do some but not others and it is not clear to me why. Here is the example code:

Code that I need help with::

#include <stdio.h> int main(int argc, char * argv[]) {     char buf[256];     if(argc == 1) {         printf("Usage: %s input\n", argv[0]);         exit(0);     }     strcpy(buf,argv[1]);     printf("%s", buf); } 

I compile this code with gcc -z exestack -fno-no-stack-protector


  1. I understand that the general technique is to write to a buffer such that I overwrite where the next instruction register looks in memory. So my question is, where do I insert a breakpoint in this code to figure out where to overwrite? If I do disas main I get:

    0x080497b1 <+60>: add $ 0x10,%esp

    0x080497b4 <+63>: sub $ 0xc,%esp

    0x080497b7 <+66>: push $ 0x0

    0x080497b9 <+68>: call 0x804fd50

    0x080497be <+73>: mov 0x4(%eax),%eax

    0x080497c1 <+76>: add $ 0x4,%eax

    0x080497c4 <+79>: mov (%eax),%eax

    0x080497c6 <+81>: sub $ 0x8,%esp

    0x080497c9 <+84>: push %eax

    0x080497ca <+85>: lea -0x108(%ebp),%eax

    0x080497d0 <+91>: push %eax

    0x080497d1 <+92>: call 0x8049028

    0x080497d6 <+97>: add $ 0x10,%esp

    0x080497d9 <+100>: sub $ 0x8,%esp 0x080497dc <+103>: lea -0x108(%ebp),%eax

If I add a breakpoint at *main+97, and then run AAAAAA I get the following:

Breakpoint 1, 0x080497d6 in main () (gdb) info registers eax            0xbffff1f0   -1073745424 ecx            0xbffff575   -1073744523 edx            0xbffff1f0   -1073745424 ebx            0x80da000    135110656 esp            0xbffff1e0   0xbffff1e0 ebp            0xbffff2f8   0xbffff2f8 esi            0x80da000    135110656 edi            0x80481e8    134513128 eip            0x80497d6    0x80497d6 <main+97> eflags         0x246    [ PF ZF IF ] cs             0x73 115 ss             0x7b 123 ds             0x7b 123 es             0x7b 123 fs             0x0  0 gs             0x33 51 

Am I putting the breakpoint in the right place to help with this overflow? Right after the call to strcpy? Also, I see that ebp is at 0xbffff2f8. Does this mean that I want to overwrite the address right next to this at 0xbffff2fc to point back inside the buffer and I will be done? Because that does not appear to work: my buffer is a NOP sled and shell code.

Thanks for any help!

Function to parse a Javascript object and return a CSV

This function converts a Javascript Object into a CSV.

var dataFromAPI = [{"name":"first"},{"name":"sec,ond"},{"name":"third 'jibberish"},{"name":"fourth, jibberish"}]  function convertToCSVandDownload(objArray) {     var csvOutput = "";     Object.keys(objArray).forEach(function(key) {       if (csvOutput.length == 0) {         csvOutput = "Index,Field Value\n";         csvOutput = csvOutput + JSON.stringify(key) + "," + JSON.stringify(objArray[key]["name"]) + "\n";                } else {         csvOutput = csvOutput + JSON.stringify(key) + "," + JSON.stringify(objArray[key]["name"]) + "\n";                        }     })     return csvOutput; }  console.log(convertToCSVandDownload(dataFromAPI));