Time complexity of finding a node with no incoming edges in a DAG: O(n) or O(m+n)

I’m reading Algorithm Design by Jon Kleinberg. In section 3.6, in order to compute the topological ordering of a DAG, one first finds a root node in this DAG, then deletes it from the DAG. The author claimed that this can be done in O(n).

How should I understand this time complexity? Just because we traverse all nodes in O(n)? But in the iteration for some node v, one also needs to traverse all its incident edges. Does that mean the time complexity should be O(m+n) or O(m)?

Honeypot logs VM’s gateway IP instead of incoming ones

There is a virtual machine ( Virtual Box) managed by OS Xubuntu and a kippo( ssh-trap) on this one. NAT have been adjusted in the VM’s setups with port forwarding by this way: ssh tcp 195.x.x.x 22 22 (rule’s name—protocol—current host IP—host port—virtual machine’s IP—VM’s port). The Honeypot logs all connection attempts but writes VM’s gateway IP instead of incoming ones. Can anybody explain how to troubleshoot this problem?

Configure specific NIC for incoming local network

I currently have an Ubuntu 18.04.3 I have 2 NICs setup with, both NICs point to different router’s. 1 is my normal network that is reachable through all my other devices and has access to the internet, the 2 one is a PFsense router that’s connected through VPN to the external network. The PFsense router is NATed behind my existing router and devices under this router can’t be reached by my other devices that aren’t under this router.

Here is my route table Route table

I want to be able to reach external internet through ens19 but still can connect to other devices on ens18 in my internal network

I’ve partially achieved this, i’m reaching the external network through ens19 and can reach the internal devices through ens18 from this machine, however if I try to connect to this device through ens18 it won’t work.

thank you in advance.

Route incoming OpenVPN (TCP) Traffic to local tor proxy with ufw

I have a OpenVPN running on my Ubuntu (18) Server and a tor proxy. OpenVPN is running on TCP Port 443 (to bypass strict firewalls). Tor is running internally as proxy on port 9050. I would like to route every traffic which is coming from OpenVPN through tor.

I have following ufw rules:


I would like to do that with ufw (if possible). As far as I know ufw works on the same way like iptables. So it should be possible with ufw?

My second question would be about DNS. Currently my OpenVPN does NOT push any DNS server. How does DNS works when I connect via OpenVPN and the server does not push any dns? It is possible to do DNS also over (openvpn and) tor?

OS X Firewall Block all incoming Connections Affecting Software Updates?

I just bought a 2017 Macbook Pro with the latest OS (Mojave). In the OS X Mojave Security and Privacy-Firewall settings, I set Firewall to “Block all incoming connections” as I am extra cautious, but will my software (such as Chrome web browser, Firefox, etc.) still get new updates? For example, will my Firefox browser still get the latest software updates or will I have to manually check for software updates because the firewall is blocking all incoming connections?

Incorrect Start time and End time of an Incoming meeting in a Calendar list in sharepoint 2016

I have a calendar list on sharepoint 2016 for managing meetings in our organization. The problem is when we send a meeting by outlook to this list the Start and End Time field has about 14 hours difference with the actual start time however the Created time field is correct. we all checked the time zone of server,sharepoint regional setting,outlook and all of them are the same. The point is that incoming meeting that send from gmail is set on a correct time in this list. Does anyone have an idea to solve this problem?

Design pattern that can be used for checking and handling a change in version number for incoming JSON message into data stream?

I have a Spark Streaming Job which processes messages coming from Kafka.

My incoming json that I process sort of looks like

{"sv" : 1.0, "field1" : "some data"} 

The only thing I do is put these in a MYSQL database.

However, I need to process these messages differently based on the schema version number!

For instance, I may get data that looks like the below in the same stream

{"sv" : 1.0, "field1" : "some data"}  {"sv" : 1.1, "field1" : "some data", "field2" : "new data"}  {"sv" : 1.2, "field1" : "some data", "field2" : "new data", "field3" : "data"} 

Now what I do is I have a function that formats the data for me like so

  def formatData(json: String): Option[Data] = {      var outputData: Option[Data] = None      val jsonObject = new JSONObject(json)      outputData = formatDataBasedOnSchemaVersion(jsonObject)      outputData    } 

and another function that formats based on a schema version number

  private def formatDataBasedOnSchemaVersion(jsonObject: JSONObject): Option[Data] = {      val outputData = {       jsonObject.getDouble("sv") match {         case 1.0 => Some(formatVersion_1_0(jsonObject))         case 1.1 => Some(formatVersion_1_1(jsonObject))         case 1.2 => Some(formatVersion_1_2(jsonObject))         case x: Double => logger.warn("No formatter found for schema version: " + x); None       }     }      outputData   } 

An example of my format function can look like

  private def formatVersion_1_2(jsonObject: JSONObject): Data = {      val f1 = jsonObject.getString("field1")     val f2 = jsonObject.getString("field2")     val f3 = jsonObject.getString("field3")      val data = Data(f1,f2,f3)      data    } 

In the format_1_0 function, all I do is pull out the “field1” parameter.

My Data class is simple DTO it just looks like

case class Data(field1: String, field2: String, field3: String) 

If I get schema version 1.0, field2 and field3 are left blank and inserted into the DB as blank values.

The problem is, I have to hard code in the schema version numbers like “1.0”, “1.1” etc.. and design a new method to pull out the extra fields. So for every schema change, I have to edit the code and add a new method to pull out the new data. So is there any better pattern I can use that can handle this? Or maybe a framework? I’ve heard of ORM would this help with that problem or would I still need to make similar code changes for schema version changes?

Do not mute Sound on incoming notification – Android, YouTube

Is there an option to manage sound notification behaviour on a Android phone?

Description: In the morning, I do watch YouTube lectures, but every minute or so I do receive Slack message, that mute the voice in the video for 5 seconds. It is really annoying, and hard to listen the lecture.

How it should be:

Option 1: Allow a notification to interrupt the sound/video stream without muting it (so the 'bip' would overlay/merge to the sound stream, but the video would continue). Option 2: (the current system state): Mute the application, but do not stop the video (very annoying)! Option 3: Mute the application, but stop the stream/video/music. 

I know that there are some option to mute the phone (manual), or install an app (automatic), but I do not wan’t do mute the notification itself. I do want to hear it, just without muting the sound/video/music that is currently playing!

My system Android 5, Samsung Galaxy S5

Greetings Jakub

Related topic: Disable Notification while watching Videos or Listening Music

Forward all incoming and outgoing calls and messages from one iPhone to another iPhone

I have two iPhones: one is a personal iPhone and one is a work iPhone.

I would like the work iPhone to be able to make both outgoing and receive incoming calls, iMessages, and SMS messages from the personal iPhone. Simply put,

I want the personal iPhone to be sitting at home (and turned on) and not really in use, while the work iPhone can handle everything the personal iPhone can do, while the work iPhone functions normally under a separate number.

Why not use eSim on the work iPhone?

Not able to because it’s a corporate phone.

Let me try to break this down into separate parts:

Incoming calls

We should be able to just enable call forwarding on the personal iPhone to forward all calls to the work iPhone.

Incoming and Outgoing iMessages

If both work and personal iPhone share the same Apple ID, then the work iPhone can receive all personal iPhone messages. iMessages can also be sent from the number / Apple ID that the message was originally sent to, so I’m not concerned about that.

Incoming and Outgoing SMS / MMS

Since the introduction of Continuity (and cellular continuity), text messages can also be forwarded to another Apple device, and that same Apple device can send new messages from that number.

enter image description here

Outgoing calls

Now, this should work by enabling Wi-Fi calling on the personal device, and then adding Wi-Fi calling for other devices. Again, my doubt is whether that other device can include a second iPhone on that same Apple ID.

Actual question

So, my question is: When Apple uses the phrases “you can forward texts to another Apple device”, and “Add WiFi-calling for other device”, does that other device also include another iPhone, especially an iPhone with active service already?

In other words, how do your cellular services work when you have two different numbers under the same Apple ID?

Dynamically update cell contents by merging incoming Google Form submissions

I have a google form where multiple students will anonymously submit comments/feedback for another peer.

Currently I am using the formula below to essentially concatenate all of the student comments specific to the individual receiving feedback.

 =(join("    ",transpose(iferror(filter($  L$  3:$  L, $  C$  3:$  C=$  C3,$  B$  3:$  B=$  B3))))) 
  • The line break within the “join” function is to separate the individual comments by a line break.
  • Column L: The original comment submitted by the students.
  • Column C: Filters by the name of the student being evaluated.
  • Column B: Secondary filter criteria.

I am currently using the add-on “CopyDown” to apply said formula to each new submission. However, I notice that the newer submissions do not concatenate prior entries even though the filter conditions are met; the formula works correctly when I manually copy/paste it into the cell.

Is there a way to alter the original formula to dynamically update the cell contents as new submissions are incoming? Perhaps through arrayformula?