Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $35$


Write an algorithm reading some numbers and print the ones with the sum of their digits greater than $ 35$ .

My try:

1) Start

2) $ N\leftarrow 0$

3) $ S \leftarrow 0$

4) $ R \leftarrow N-10\lfloor\frac{n}{10}\rfloor$

5) $ S \leftarrow R+S$

6) $ N\leftarrow\lfloor\frac{n}{10}\rfloor$

7) If $ N>0$ , go to $ 4$ , otherwise print $ S$

8) If $ S\le35$ then $ N\leftarrow N+1$ , otherwise print $ N$

9) end


I’m not sure if this algorithm works,so can someone please check that? plus does there exist any algorithm that determines the numbers such that the sum of their digits is greater than $ 35$ , besides determines how many such numbers exist? (I think they are infinity many such numbers)

How do incorporeal creatures attack corporeal ones

I found some posts for 3.5e but there’s not much information on incorporeal creatures attacking corporeal ones in the rules as far as I can find. It’s pretty clear in the universal monster rules how attacking an incorporeal enemy works if your corporeal but not the other way around. Some lines in the description seem to imply that it can attack but it also says it has no physical effect on its surroundings which makes me wonder how it actually attacks.

An incorporeal creature’s attacks pass through (ignore) natural armor, armor, and shields, although deflection bonuses and force effects (such as mage armor) work normally against it. Incorporeal creatures pass through and operate in water as easily as they do in air. Incorporeal creatures cannot fall or take falling damage. Incorporeal creatures cannot make trip or grapple attacks, nor can they be tripped or grappled. In fact, they cannot take any physical action that would move or manipulate an opponent or its equipment, nor are they subject to such actions. Incorporeal creatures have no weight and do not set off traps that are triggered by weight.

It says its attacks ignore most forms of ac but it also says it cannot move or manipulate an opponent or it’s equipment.

An example of an incorporeal attack is in the poltergeist’s supernatural abilities.

Telekinesis (Su)

A poltergeist has no method of attacking apart from telekinesis. This ability functions as the spell telekinesis, with a CL equal to the poltergeist’s Hit Dice (CL 3rd for most poltergeists). A typical poltergeist has a ranged attack roll of +3 when using telekinesis to hurl objects or creatures, and can use the ability on objects or creatures of up to 75 pounds. If a poltergeist attempts to hurl a creature with this ability, that creature can resist the effect with a successful DC 12 Will save. The save DC is Charisma-based.

So at least in the case of a poltergeist, they can only attack indirectly

Help with finding a flaw in argument simulating large Turing machines with smaller ones

I have an argument which, if it goes through, just about proves that either:

  • Programming languages are more powerful than Turing machines
  • The busy beaver function ($ BB()$ ) on Turing machines is computable

Now, I understand that it’s vastly more likely that my argument has some flaw that I can’t find. But it’s more interesting to me how I’m wrong, rather than whether I’m wrong.

Argument

Throughout, I use $ \mathbb{S}(x)$ to mean either the number of states that Turing machine $ x$ has or the number of states required by a Turing machine to write $ x$ to the tape.

Construct a Turing machine $ M_1$ as which takes as arguments (on the tape) $ n, k$ , simulates all Turing machines with $ n$ states until $ k$ of them halt, and then halts itself. This is easy to write in a programming language, as demonstrated by the following Python snippet:

def M1(n, k):     all_machines = generate_turing_machines(n)     is_halted = [0] * len(generate_turing_machines)     while sum(is_halted) < k:         for (i, machine) in enumerate(all_machines):             machine.step()             if machine.is_halted():                 is_halted[i] = 1 

Now, let $ \mathbb{S}(M_1) = m_1$ be the number of states required by $ M_1$ . Fix $ n$ much greater than $ m_1$ . Let $ k_1$ be the largest number such that $ M_1(n, k_1)$ halts and $ k_0$ be the smallest number such that when $ M_1(n, k_0)$ halts, $ k_1$ simulated Turing machines have halted (as all equivalent machines will halt on the same step). Choose $ k$ with $ k_0\leq k\leq k_1$ . This means that $ M_1(n,k)$ halts in about $ BB(n)$ steps.

Construct $ M_2$ which is the same as $ M_1$ except the first thing it does is write $ n$ and $ k$ to the tape. Let $ \mathbb{S}(M_2)=m_2$ . Then $ m_1+\mathbb{S}(n)+\mathbb{S}(k)+C=m_2$ for some small $ C$ (which is probably constant and likely $ 0$ ).

Now, $ \mathbb{S}(n)$ is at most $ O(log(n))$ . $ k$ is about $ n^n$ , so $ \mathbb{S}(k)$ is at most $ O(n)$ . That puts $ m_2$ just slightly larger than $ n$ . But here we have a problem: if $ k$ is even slightly easier to write to the tape, then $ m_2$ would be slightly smaller than $ n$ . That would mean $ BB(m_2)>BB(n)$ and $ m_2<n$ , a clear contradiction.

In my mind, these are the possible resolutions:

  • $ M_1$ is impossible to create as a Turing machine, meaning that Python is more powerful than Turing machines are.
  • There is some transfinite extension to Turing machines which is not much more powerful than Turing machines in general, and $ M_1$ can be written in this extension. In other words, $ M_1$ is the limit of a set of machines $ M_{1,N}$ , each of which can handle any $ n<N$ . This would probably entail the busy beaver function being computable.
  • There is a large set of numbers which cannot be written by a Turing machine in much fewer than $ log(k)=n$ states (we need $ \mathbb{S}(k)<n-log(n)$ ). It seems impossible to me that no candidate for $ (n, k)$ could be sufficiently compressed.

Where is the error in this logic?

Claim that Skype is an unconfined application able to access all one’s own personal files and system resources


Situation

I was about to install Skype on a laptop driven by Ubuntu 18.04 LTS Desktop. The software installation helper graciously informs me that Skype

is unconfined. It can access all your personal files and system resources

as per the screenshot below.

screenshot software installer ubuntu 18.04

Apparently there must be reasons to make a distinction from applications that do not call for this warning.

Reality-checks

  • Can Skype really scan anything I have in my home directory regardless of the permissions set to files and directories? Does it become like a sort of superuser?
  • What is the meaning of system resources there? Does it go about functional resources like broadband and memory, or is that an understatement for control on all applications?

Mitigation

  • How is it possible for an average “power user” to confine such an unconfined application?

Beside the mere answering, pointing out to interesting readings is also appreciated.

What difference to privacy will I get if i change my workplace wifi DNS to static ones on my iPad?

I access internet at my workplace with an iPad that has workplace profile installed on it. This allows me to automatically connect to the company wifi, along with their own DNS settings. If I change these settings to a static address, would I be able to have a bit more privacy when I access the web, or will all my activity still be monitored by the company?

Restrict crawling of region/lang combinations other than the provided ones in robots.txt

I want to allow crawling of my website only if the URL starts with accepted region/language combinations which are us/en, gb/en and fr/fr. Other language combinations must be restricted. On the other hand crawler should be able to crawl / or /about, etc. For example:

example.com/us/en/videos  # should be allowed example.com/de/en/videos  # should be blocked example.com/users/mark    # should be allowed 

Again, it should be blocked only if it starts with unaccepted region/language combinations. What I did so far does not work:

Disallow: /*? Disallow: /*/*/cart/ Disallow: /*/*/checkout/ Disallow: /*/*/ Allow: /*.css? Allow: /*.js? Allow: /us/en/ Allow: /gb/en/ Allow: /fr/fr/ 

I tested it with google’s online robots.txt tester.

Am I the only one who can’t help but constantly think back on all the horrible security nightmares (and potential ones) from my past? [closed]

I’m not going to go into any specifics here, because I’ve learned that “certain” open source projects are extremely sensitive about any criticism and will defend any kind of madness by blaming the user for not fully reading and comprehending the often extremely cryptic and ambiguous manual, while not putting any blame on the software for allowing the insecure configuration in the first place.

You may think I’m joking, but even 15-20 years later, I still have actual nightmares about things which happened, or could have happened, or may have happened without me ever finding out, in the past, due to bad security, either by myself and others (affecting me).

A huge issue with security is not realizing one’s own limitations and having a big ego. You know how it is: you are 15-16 and you are totally an “1337” cracker, aren’t you? Everyone else is stupid and you know everything. You couldn’t possibly misconfigure or misunderstand anything, right? That manual only seems to verify what you already knew… yes, that seems to be correct… yes, now let’s put it live! It’s rock-solid!

… and then it turns out that somebody has been remotely connecting from across the world to your ultra-sensitive database for the last eight months and saved all your private information to blackmail you perpetually. Because it allowed any password as long as they guessed the default admin account. Which was supposed to only be accessible from 127.0.0.1.

The most frustrating part is perhaps that, now that I know about many of these things, I find it utterly impossible to educate others about it. They are just as deaf to my advice as I would’ve been to advice from others back when I thought it was a good idea to enable that stupid mode which bypasses all passwords, because even though I read the manual, I read it horribly wrong!

I actually remember saying to myself: “Well, they can’t mean that ANY password goes, because that would defeat the entire purpose of having passwords in the first place, so I can safely conclude that they didn’t mean this.”

They meant it.

Not one day goes by without me thinking back on all these stupid decisions, and while I know very well that it does me no good, I can’t help but be bombarded with these memories and thoughts. It’s easy to laugh at it now and shake one’s head, but when I saved the config that fateful day and reloaded the service in question, I was 100% convinced that my database was fully locked down and that I was the only person in the world who would ever be able to access it, because I had read the manual as I was always instructed to do.

The above vague story is just one out of many such cases which I’ve experienced or heard of. Somehow, these experiences make me fully understand how there can be almost daily news of major critical databases exposed to the Internet with no password. They were simply set up by people who just didn’t understand what they were doing, and I consider it unfair to put all the blame on them.

I think a lot of software is made with a strange attitude to security, where you are harshly punished for not knowing everything about the software, as the developers (but nobody else) does.

Proof that language is not regular. $L=\{w\bar{w}|w\in \{0,1\}^* and\ \bar{w}\ is\ one’s\ complement\ of\ w\}$

I’m trying to proof that the following language is not regular using pumping lemma. $ L=\{w\bar{w}|w\in \{0,1\}^* and\ \bar{w}\ is\ one’s\ complement\ of\ w\}$

I started by stating that:

$ |w\bar{w}| = 2p = |xyz|$

Because of Pumping Lemma the following has to be true:

$ 1 \leq |y| \leq |xy| \leq p$

Because $ |xy| \leq p$ and $ |w|=|\bar{w}|$ have to be true, $ \bar{w}$ has to be completly in $ z$ . I now tried somehow to manipulate the first half, so that it always evaluates to a contradiction, but I am stuck.

I want to delete connections in tnsnames.ora. I need to figure out which ones are currently in use, so that I don’t delete them mistakenly


I’m using Oracle 12c in Debian 8 (on a vm)

This question is for educational purposes only. I’m not using any production servers, so anything that you can tell me won’t have consecuences

To start with, I found this link to delete registers in tnsnames.ora. I didn’t test it yet because first, I needed to know if there were active connections in the database using the information of the tnsnames.ora.
I’m asking here because I found no way of doing this, but it may be possible to do it.

For you to know, I’m using this command for connecting to the database, so that I clearly specify a tnsname

rlwrap sqlplus sys as sysdba@tnstest 

The contents of my tnsnames.ora are the following

tnstest =   (DESCRIPTION =     (ADDRESS_LIST =       (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))     )     (CONNECT_DATA =       (SERVER = DEDICATED)       (SERVICE_NAME = orcl)     )   ) 

But, if I want to be 100% sure that this is working, I use this command

tnsping tnstest 

Which results are…

TNS Ping Utility for Linux: Version 12.2.0.1.0 - Production on 28-JAN-2020 23:51:38  Copyright (c) 1997, 2016, Oracle.  All rights reserved.  Used parameter files: /opt/oracle/product/12.1.0.2/dbhome_1/network/admin/sqlnet.ora   Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1539))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl))) OK (0 msec) 

After all of this I know that my configuration is working, I’m using a register in tnsnames.ora for the connection, but I don’t know a way of checking…
“Hey, now that I’m connected, I want to know which register I used from the tnsnames file for connecting, if I used that file of course”

Is there any possibility that I could get this information?

Well, my following attempts of trying to figure this out, were checking the v$ session view, if there was any field that I could use to get this information, but I couldn’t find one.

After all of this, ultimately, I came here for asking. I don’t know what else to try nor I have more ideas of what should I do next.

P.S: there’s a chance that this problem is impossible to solve, because this is task I’m doing due to I’m a student of sysadmin, and our teacher intentionally added unsolvable questions.
Even so, I still think there might be a solution for this particular case