text
stringlengths 3
1.74M
| label
class label 2
classes | source
stringclasses 3
values |
---|---|---|
Why I Stream - GrndPaGaming (2019) After rupturing three vertebrae in his neck, GrndPaGaming uses video games to manage his pain. [9:30]. | 0non-cybersec
| Reddit |
Holy shit, this dude is amazing.. | 0non-cybersec
| Reddit |
What is the determinant of []?. <p>I typed this in Matlab, but I can't understand why it returns the determinant
one.</p>
<p>A =</p>
<pre><code> []
</code></pre>
<blockquote>
<blockquote>
<p>det(A)</p>
</blockquote>
</blockquote>
<p>ans =</p>
<pre><code> 1
</code></pre>
| 0non-cybersec
| Stackexchange |
Is there a way to develop custom SmartArt?. <p>Is there a way to develop custom SmartArt for PowerPoint. I'm not looking for a way to develop "fake" smart art, like add a bunch of shapes and then group them and copy/paste between presenations. I'd like to create a number of new SmartArts that are based on this kind of fake SmartArt that my company uses, but have it "smart", like hitting Enter adds another shape with the right colors and text formatting. Has anyone done this before? Thx!</p>
| 0non-cybersec
| Stackexchange |
Can I use TCP in a RESTful service?. <p>REST is using current features of the Web and applying some principles on it to make it more efficient. It uses standard HTTP verbs for communication and take help of its stateless nature. </p>
<p>However, is it possible that a REST service use the TCP protocol for its communication? If yes, then will it violate its principles? </p>
| 0non-cybersec
| Stackexchange |
TIL Splatoon is worth €0.01. | 0non-cybersec
| Reddit |
A ship in a teacup by Chris Anthon (guest spot at The Pearl Harbor Gift Shop, Toronto ON). | 0non-cybersec
| Reddit |
How to make a display frame with replaceable content that goes in your car. Great for selling, trolling, memes, political messages, and advertising. Cheap & easy to make.. | 0non-cybersec
| Reddit |
A morphism to the mapping cone?. <p>In the second part of the proof for the Proposition 2. in <a href="http://therisingsea.org/notes/DerivedCategories.pdf" rel="nofollow"><strong>Derived Categories</strong> by <em>Daniel Mufet</em></a>, one finds the following: </p>
<blockquote>
<p>A collection of morphisms $f^n:Q^n\to X^n\oplus Y^{n-1}$ with components $g^n:Q^n\to X^n$ and $\Sigma^n:Q^n\to Y^{n-1}$ defines a morphism of complexes $f:Q\to C_u[-1]$ if and only if $g:Q\to X$ is a morphism of complexes and $\Sigma$ is a homotopy $ug\simeq0,$ and moreover we can recover $g$ as the composite $kf.$ </p>
</blockquote>
<p>And my question is why is this true? </p>
<p>When I compute the commutative diagram:<br>
$$\begin{matrix}Q^n&\overset{\partial_Q^n}{\to}&Q^{n+1}\\
\downarrow f^n&&\downarrow f^{n+1}\\
C_u[-1]^n&\overset{\partial_u^{n-1}}{\to}&C_u[-1]^{n+1}
\end{matrix},$$
I get the following two relations:<br>
$$\begin{cases}g^{n+1}\circ\partial_Q^n=-\partial_X^n\circ g^n\\
\Sigma^{n+1}\circ\partial_Q^n=u^n\circ g^n+\partial^{n-1}\circ\Sigma^n\end{cases},$$<br>
which differs from my expectations by some negative signs.<br>
Since $g=kf$ is a morphism indeed, I guess I am missing something in the above calculations, but I don't see where I went wrong. </p>
<p>Any help is appreciated. </p>
<p>P.S. Here we wre working in an abelian category, $u:X\to Y$ is a morphism, $C_u^n:=X^{n+1}\oplus Y^n$ is the mapping cone of $u,$ and $k$ is the projection $C_u[-1]\to X.$</p>
| 0non-cybersec
| Stackexchange |
Which is better MAX function or ORDER BY column_name DESC with LIMIT 1. <p>I have one scenario where I want to have max value on date column,</p>
<p>eg. for table</p>
<pre><code>CREATE TABLE IF NOT EXISTS `sample_table` (
`id` TINYINT UNSIGNED NOTNULL,
`name` VARCHAR(45) NOT NULL,
`created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARYKEY(`id`))
ENGINE = InnoDB;
</code></pre>
<p>So I used a query as below:</p>
<pre><code>SELECT MAX(created_at) AS latest FROM sample_table;
</code></pre>
<p>But I was suggested to index created_at column and use following query for faster result</p>
<pre><code>SELECT created_at FROM sample_table ORDER BY created_at DESC LIMIT 1;
</code></pre>
<p>I am clueless which is best way to do so? If second query is better, than why there is inbuilt MAX function</p>
| 0non-cybersec
| Stackexchange |
The most Evil Building, waiting for DLC money to be completed. [xpost: r/evilbuildings]. | 0non-cybersec
| Reddit |
when I start Desktop Rstudio every time, I get an error message as:rstudio error yaml.load readlin con errorlevel errorlevel. <p>after I login the Desktop Rstudio, the following message will appear:</p>
<pre><code>Error in yaml.load(readLines(con), error.label = error.label, ...) :
object 'C_unserialize_from_yaml' not found
Error in yaml.load(readLines(con), error.label = error.label, ...) :
object 'C_unserialize_from_yaml' not found
Error in yaml.load(readLines(con), error.label = error.label, ...) :
object 'C_unserialize_from_yaml' not found
Error in yaml.load(readLines(con), error.label = error.label, ...) :
object 'C_unserialize_from_yaml' not found
Error in yaml.load(readLines(con), error.label = error.label, ...) :
object 'C_unserialize_from_yaml' not found
and I try to reinstall R and Rstudio with the newest program,it still appear error again.
when I start R program ,it can work with no error. Only Rstudio, and I try to rename the directory"C:\Users\Administrator\AppData\Local\RStudio-Desktop" in another name, Let it create when Rstudio launch,the error message again.
And I can't knit some Rmd file working normal, it will appear following error:
Error in yaml::yaml.load(string, ...) :
找不到对象'C_unserialize_from_yaml'
Calls: <Anonymous> ... parse_yaml_front_matter -> yaml_load_utf8 -> <Anonymous>
停止执行
</code></pre>
<p>Who can help me to slove the problem.Thanks very much.</p>
| 0non-cybersec
| Stackexchange |
When it's just not your day.... [This basically sums it up](https://youtu.be/Zb0TVVks2P8) | 0non-cybersec
| Reddit |
C# Unit Testing with TestInitialize/TestCleanup in base class. <p>I am testing a module where every test class share the same behavior:</p>
<ul>
<li>Begin a transaction</li>
<li>Execute SQL queries</li>
<li>Rollback transaction </li>
</ul>
<p>I've decided to use TestInitialize and TestCleanup to execute the Begin and Rollback of transactions respectively.</p>
<p>The strait forward approach would be writing the TestInitialize/TestCleanup in a parent class but that is not going to work with this testing framework.</p>
<p>The <strong>work around</strong> for this was to use <strong>partial classes</strong>. This approach seems to viable in my case because my test classes are mainly stateless. Event not being the ideal solution it at least saved me a couple of copy/paste actions.</p>
<p>Anyone knows a better way to do this?</p>
<p>Here is a sample of the <strong>partial class</strong> solution:</p>
<p>In my case I test each module separately and for this example I will use the <strong>Sales</strong> module:</p>
<p><strong>SalesTest.cs file</strong>:</p>
<pre><code>[TestClass]
public partial class SalesTest
{
[TestInitialize]
public void Setup()
{
//begin transaction
}
[TestCleanup]
public void Cleanup()
{
//rollback transaction
}
}
</code></pre>
<p><strong>SalesTest.Order file</strong>:</p>
<pre><code>public partial class SalesTest
{
[TestMethod]
public void SaveOrder_OnlyRequiredValuesFilled_SuccessfullySaved()
{
//Run some SQL queries
}
}
</code></pre>
| 0non-cybersec
| Stackexchange |
PHP in Aptana - function declarations?. <p>I was wondering if there is an easier (or just any) way to declare functions in PHP files. For example, let's say we have following function:</p>
<pre><code>function myfunc($parama = '', $paramb = 0) {}
</code></pre>
<p>Would it be possible to add (as part of PHP bundle) a snippet to create:</p>
<pre><code> /***
*
*
* @param $parama String
* @param $paramb Integer
* @return
* @author
* @copyright {current_date}
*/
</code></pre>
<p>In case it's doable, the bundle would auto-add it just by typing <code>/***</code> above function.</p>
<p>Any thoughts are warmly welcome. I managed to do that in TextMate a while ago, but can't figure out how to do it in Aptana.</p>
<p>FYI: I'm referring to Aptana 3.0.6.</p>
<p>Thanks! :)</p>
<p>...</p>
<p><em>(an hour later)</em></p>
<p>Actually, I figured it out - created a snippet for this:</p>
<pre><code>snippet 'Declare Function' do |s|
s.trigger = 'docf'
s.scope = 'source.php'
s.expansion = '/***
*
*
* @param
* @return
* @author $6
* @copyright ' + Time.now.strftime('%Y-%m-%d') + '
*/
function ${1:functionName}($2)
{
$0
}'
end
</code></pre>
<p>Hope it's useful for other devs. :)</p>
| 0non-cybersec
| Stackexchange |
Get refunded orders and refunded order items details in Woocommerce 3. <p>I see when I look at an order it will show the specific item that was refunded if the whole order wasn't. </p>
<p>Is there a way to find using the <code>WC_Order_Item_Product</code> if an item was refunded? Also, is there a way to get the discount amount that shows up below the item in the order view? </p>
<p>I'm currently doing it manually but if there is a function for it already, I would rather use it.</p>
| 0non-cybersec
| Stackexchange |
is this right truth value. <p>Let $P(x,y)$ be the predicate $2x+y = xy$, where the domain of discourse for $x$ and $y$ is integers. Determine the truth value of each statement.</p>
<p>$P(-1,1)$ : true</p>
<p>$\exists xP(x,y)$ : true</p>
<p>$\exists yP(4,y)$ : false</p>
<p>$\forall yP(2,y)$ : false</p>
<p>$\forall x \exists y(x,y)$ : false</p>
<p>$\exists y \forall x(x,y)$ : false</p>
<p>Have I answered correctly or have not?</p>
<p>Please guide me if I'm wrong. thank you.</p>
| 0non-cybersec
| Stackexchange |
Why is dd so slow on a NVMe SSD?. <p>I recently watched <a href="https://www.youtube.com/watch?v=Zuwa8zlfXSY" rel="nofollow noreferrer">this video</a> and in it, the author explains that a ram disk is far faster than HDD/SSD when using <code>dd</code> command. I understand why this is the case. What I don't understand, however, is why I got a write speed of 220MB/s when I did his example command of <code>dd if=/dev/zero of=test.iso bs=1M count=8000</code> on a system with 16GB of RAM, a 12-core Ryzen 3600X CPU, and a NVMe SSD rated at up to 5GB/s write speeds.</p>
<p>I understand RAM will always be faster, but this seems so slow that there must be something else at play here. Is it the way that he was using the <code>dd</code> command? I don't know the internals of <code>dd</code> but is this a situation where the system is limiting the performance, or has the command just been misused?</p>
<p><em>Note: After running the exact same command a second time in a row, the second write was much faster at 1.4GB/s, but this doesn't clear up confusion for me.</em></p>
| 0non-cybersec
| Stackexchange |
Tea-time Cupcake (667x1000). | 0non-cybersec
| Reddit |
Is it possible to access `WriterT`'s partially collected `tell`s in case of exception?. <p>Is it possible to have a WriterT monad that is able to share its partially collected <code>tell</code>s in case of an exception? If I <code>try</code> outside of <code>runWriterT</code> the <code>w</code> seems to be discarded. If I try to <code>try</code> inside, I seem to need <code>MonadUnliftIO</code>. <code>MonadUnliftIO</code> sounds like it could help me, but that package says that it is only able to unlift monadic contexts and not monadic state which I guess Writer is. Has anyone done this with Writer or something similar?</p>
<p>Example pseudocode:</p>
<pre class="lang-hs prettyprint-override"><code>x <- runWriterT $ do
result <- try $ do
tell "a"
tell "b"
error "c"
tell "d"
case result of
Left e -> Just e
Right a -> Nothing
x `shouldBe` (Just "c", "ab")
</code></pre>
| 0non-cybersec
| Stackexchange |
RIP to my grandma (left). Found this week while digging around for pictures for her funeral - late 1960’s. | 0non-cybersec
| Reddit |
AppleScript : searching for a tab on chrome and saving the tab as a variable. <p>I'm using this script which is finding the tab I want, then bring the tab to focus.</p>
<p>set searchString to "Tab I'm Looking FOR"</p>
<pre><code>tell application "Google Chrome"
set win_List to every window
set win_MatchList to {}
set tab_MatchList to {}
set tab_NameMatchList to {}
repeat with win in win_List
set tab_list to every tab of win
repeat with t in tab_list
if searchString is in (title of t as string) then
set end of win_MatchList to win
set end of tab_MatchList to t
set end of tab_NameMatchList to (id of win as string) & ". " & (title of t as string)
end if
end repeat
end repeat
if (count of tab_MatchList) is equal to 1 then
set w to item 1 of win_MatchList
set index of w to 1
my setActiveTabIndex(t, searchString)
else if (count of tab_MatchList) is equal to 0 then
display dialog "No match was found!" buttons {"OK"} default button 1
else
set which_Tab to choose from list of tab_NameMatchList with prompt "The following Tabs matched, please select one:"
set AppleScript's text item delimiters to "."
if which_Tab is not equal to false then
set tmp to text items of (which_Tab as string)
set w to (item 1 of tmp) as integer
set index of window id w to 1
my setActiveTabIndex(t, searchString)
end if
end if
end tell
on setActiveTabIndex(t, searchString)
tell application "Google Chrome"
set i to 0
repeat with t in tabs of front window
set i to i + 1
if title of t contains searchString then
set active tab index of front window to i
return
end if
end repeat
end tell
end setActiveTabIndex
</code></pre>
<p>This work fine, but how can I save the tab number as a variable so if I need to do more stuff in this actual tab I can just do something like this (imagining the tab number is saved as "TABNUMBER")</p>
<pre><code>tell application "Google Chrome"
set myTab to front window's tab TABNUMBER
set URL of myTab to "https:..."
end tell
</code></pre>
| 0non-cybersec
| Stackexchange |
You woke me for this!. | 0non-cybersec
| Reddit |
How to change the icon size of Google Maps marker in Flutter?. <p>I am using <code>google_maps_flutter</code> in my flutter app to use google map I have custom marker icon and I load this with <code>BitmapDescriptor.fromAsset("images/car.png")</code> however my icon size on map is too big I want to make it smaller but I couldn't find any option for that is there any option to change custom marker icon.
here is my flutter code:</p>
<pre><code>mapController.addMarker(
MarkerOptions(
icon: BitmapDescriptor.fromAsset("images/car.png"),
position: LatLng(
deviceLocations[i]['latitude'],
deviceLocations[i]['longitude'],
),
),
);
</code></pre>
<p>And here is a screenshot of my android emulator:
<a href="https://i.stack.imgur.com/mBejl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/mBejl.png" alt=""></a></p>
<p>As you can see in the picture my custom icon size is too big</p>
| 0non-cybersec
| Stackexchange |
Convergence of a sequence in $L^2(\mathbb R)$. <p>I have been stack with something which is perhaps just in front of my eyes but I just cannot get it. I have a sequence $(f_n)$ in $L^2(\mathbb R)$ which converges to $f$ in the $L^2$-topology. If I assume that $\int_{\mathbb R}f_n(x)dx=0$ for all $n$, then does it follow that $\int_{\mathbb R}f(x)dx=0$? Sorry if this too obvious.</p>
<p>Thanks for answer.</p>
<p>Math</p>
| 0non-cybersec
| Stackexchange |
How to use spot instance with amazon elastic beanstalk?. <p>I have one infra that use amazon elastic beanstalk to deploy my application.
I need to scale my app adding some spot instances that EB do not support.</p>
<p>So I create a second autoscaling from a launch configuration with spot instances.
The autoscaling use the same load balancer created by beanstalk.</p>
<p>To up instances with the last version of my app, I copy the user data from the original launch configuration (created with beanstalk) to the launch configuration with spot instances (created by me).</p>
<p>This work fine, but:</p>
<ol>
<li><p>how to update spot instances that have come up from the second autoscaling when the beanstalk update instances managed by him with a new version of the app?</p>
</li>
<li><p>is there another way so easy as, and elegant, to use spot instances and enjoy the benefits of beanstalk?</p>
</li>
</ol>
<p><strong>UPDATE</strong></p>
<p>Elastic Beanstalk add support to spot instance since 2019... see:
<a href="https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html" rel="nofollow noreferrer">https://docs.aws.amazon.com/elasticbeanstalk/latest/relnotes/release-2019-11-25-spot.html</a></p>
| 0non-cybersec
| Stackexchange |
Does my graphics card support CUDA?. <p>I am running Ubuntu 17.10, and this is my graphics card:</p>
<p><a href="https://i.stack.imgur.com/ogvSa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ogvSa.png" alt="screenshot"></a>
<a href="https://i.stack.imgur.com/IqDvq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IqDvq.png" alt=""></a></p>
<p>and I want to know if it is CUDA enabled. There is a NVIDIA GEFORCE sticker on my computer, so I thought it might be...</p>
| 0non-cybersec
| Stackexchange |
Salmon advice?. I have a big part of salmon filet, but I don't have any idea of what to make with it. Easy question,do u any advice/recipe with salmon?
thx | 0non-cybersec
| Reddit |
Cool Kids - '88. | 0non-cybersec
| Reddit |
ELI5: The new "breakthrough" in quantum computing by IBM. This stuff seems very interesting, but I'm not sure if I completely understand it. Can someone more knowing explain what this means? | 0non-cybersec
| Reddit |
Is it true that smartphones could get compromised via their baseband chip?. <p>I read about this <a href="https://www.devever.net/~hl/nosecuresmartphone" rel="nofollow noreferrer">here</a>. </p>
<p>If I understand this correctly, it states that a smartphones could get compromised via it's baseband chip and it's (potentially) unsafe and closed-source firmware.</p>
<p>I also read <a href="https://news.ycombinator.com/item?id=10905643" rel="nofollow noreferrer">this</a> discussion about the mentioned article.</p>
<p>But as I have no deep understanding of the low-level hardware used inside smartphones (or the security implications of different connection types between the GSM chip and other components, I do not really know what to believe.</p>
<p>torproject.org's article "<em>Mission Improbable: Hardening Android for Security And Privacy</em>" states: </p>
<blockquote>
<p>Until phones with auditable baseband isolation are available (the Neo900 looks like a promising candidate), the baseband remains a problem on all of these phones. It is unknown if vulnerabilities or backdoors in the baseband can turn on the mic, make silent calls, or access device memory</p>
</blockquote>
<p><strong>How realistic is an attack scenario like this when thinking of an adversary capable of compromising the radio link (given a perfectly safe operating system on the smartphone)?</strong></p>
| 0non-cybersec
| Stackexchange |
Nintendo eShop down now/soon for 24hrs reminder. | 0non-cybersec
| Reddit |
She rolled this car because she was texting.. | 0non-cybersec
| Reddit |
Serve content generated by a script with Apache. <p>Suppose you have a domain that is pointed to your server's IP.
As soon as it reaches your server's IP you use Apache to point it
to a DocumentRoot (in a VirtualHost).</p>
<p>But instead of pointing it to a document root, can you point it to a script?
I want the script to control what is displayed on the web, not the DocumentRoot.</p>
| 0non-cybersec
| Stackexchange |
Quantum security risk to present encryption. <p>Quantum computers will seal the fate of conventional encryption techniques. Of these, the hardest hit will be the RSA algorithm used by 99 percent of all applications the encryption standard for any secure transfer and storage of communication data or software updates. What are some solutions to the inevitable?</p>
| 0non-cybersec
| Stackexchange |
Making mathematical expressions as balanced trees as possible. <p>I am having some trouble with turning the following mathematical expressions into as balanced binary trees as possible.</p>
<p>This is what I have done so far, but is there a way to make them even more balanced?</p>
<p>$(𝑥 − 3)(𝑦^2 + 𝑦 − 1)$</p>
<p><a href="https://i.stack.imgur.com/k9w5k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k9w5k.png" alt="enter image description here"></a></p>
<p>$4(𝑥 − 1)(𝑦 − 2)(𝑧 − 3)$</p>
<p><a href="https://i.stack.imgur.com/Cs7sQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Cs7sQ.png" alt="enter image description here"></a></p>
| 0non-cybersec
| Stackexchange |
React Handle interaction state between components. <p>I have a simple component who show element onClick:</p>
<pre><code> class MyComponent extends React.Component {
state = {
isVisible : false
}
render() {
const { isVisble } = this.state
return(
<div>
{isVisble ?
<div onClick={() => this.setState({isVisble: false})}>Hide</div> :
<div onClick={() => this.setState({isVisble: true})}>Show</div>}
</div>
)
}
}
</code></pre>
<p>I use this component three times in other component :</p>
<pre><code>class MySuperComponent extends React.Component {
render() {
return(
<div>
<MyComponent />
<MyComponent />
<MyComponent />
</div>
)}
}
</code></pre>
<p>I need to pass isVisible at false for all other component if one of have isVisible to true</p>
<p>How to do that ?</p>
<p>Thanks</p>
| 0non-cybersec
| Stackexchange |
jQuery Drag and Drop on touch devices (iPad, Android). <p>We have a card game website that makes extensive use of jQuery Draggable & Droppable and which has worked nearly flawlessly (when using a mouse) for almost a year.</p>
<p>We would REALLY like to have the site work on touch screen devices, but we cannot seem to get jQuery's drag and especially drop functionality to work reliably.</p>
<p>Dragging works "ok" unless the div being dragged is inside another dom element with any kind of offset, margin, padding, etc. If it is, the dragged element is also offset from the user's finger by a similar amount. May not sound like a big deal, but it makes the interface unusuable.</p>
<p>Dropping just doesn't seem to work.</p>
<p>We've researched various options presented here on SO (will try to update this post with links to some of them if I can), but none work for us.</p>
<p>We've also researched jQuery Mobile but this is still in alpha and even so seems to be more of a framework for making a site emulate the UI of a phone vs what we're looking for.</p>
<p>Most of the SO and Google posts on this topic seem to trail off in late 2010 which makes me think there is an obvious answer that maybe we're just missing.</p>
<p>BTW, the functionality we're looking for is clearly technically possible because the YUI libraries for drag and drop work as expected. Unfortunatly, we can't justtify refactoring the site to switch from jQuery to YUI.</p>
<p>Anyone out there have any ideas? We would settle for a answer that supports only iPad, but it really needs to not require we refactor the existing site.</p>
<p>Thanks!</p>
| 0non-cybersec
| Stackexchange |
A question on Derangement Combinatorics. <p>Six cards and six envelopes are numbered <span class="math-container">$1$</span>, <span class="math-container">$2$</span>, <span class="math-container">$3$</span>, <span class="math-container">$4$</span>, <span class="math-container">$5$</span>, <span class="math-container">$6$</span> and cards are to be placed in envelopes so that each envelope contains exactly one card and no card is placed in the envelope bearing the same number and moreover the card numbered <span class="math-container">$1$</span> is always placed in envelope numbered <span class="math-container">$2$</span>. Then, what is the number of ways this can be done?</p>
<p>Since card one is already fixed, I tried directly applying the Derangement formula for <span class="math-container">$5$</span> things.</p>
<p>But it didn't work. I guess it's not so simple since the envelope no. <span class="math-container">$2$</span> is already occupied. </p>
<p>I just need a hint on how to proceed. </p>
| 0non-cybersec
| Stackexchange |
David Bowie - The Hearts Filthy Lesson [Rock]. Here's something a little different | 0non-cybersec
| Reddit |
No reposing. | 0non-cybersec
| Reddit |
Options to share a folder between Azure VM & local PC. <p>I have an Azure VM on line, do you know a way to share a folder between this VM and a local PC? for technical reasons we cannot use remote desktop to connect the user</p>
<p>Any ideas will be welcomed</p>
<p>Regards... </p>
| 0non-cybersec
| Stackexchange |
Binomial Congruence (mod 5) Identity. <p>I've got a (hard?) Putnam-style problem that I've been given to look at . . . I've never worked any problem even vaguely like this, but my director thinks I should be able to do it. I doubt it (100% not my area or my taste in problem), so I need some help!</p>
<p>The problem posed is to prove that 5 does not divide $\sum_{k=0}^{n} {{2n+1} \choose {2k+1}}2^{3k}$ for any $n$.</p>
<p>I can interpret the summation well enough from a design or lattice path perspective, but a bijection-type proof seems futile. I've played around with some binomial identities trying to clean the expression up, but I don't have any real experience with that sort of thing and nothing seemed to "simplify" the problem.</p>
<p>So, I'm just wondering if anyone has a nice proof, preferably without using generating functions - alternatively, what are the basic techniques typically used in this sort of problem, if there is any such thing? There seem to be a lot of ways to approach the problem, but not having any experience with this I don't know what direction to go, nor do I have background in most of those apparent directions =P</p>
<p>Thanks a lot!</p>
| 0non-cybersec
| Stackexchange |
Massive armadillo unearthed during construction. | 0non-cybersec
| Reddit |
Residue of high order pole. <p>I'm trying to compute the residue $\displaystyle\operatorname{Res}\left(\frac{1}{(z^2+1)^7},i\right)$.</p>
<p>I know that there is the formula: </p>
<p>$$\operatorname{Res}(f,z_0)=\frac{1}{(m-1)!}\lim_{z\rightarrow z_0 }[(z-z_0)^mf(z)]^{(m-1)}$$</p>
<p>for a pole with order $m$.</p>
<p>But I'm pretty sure that I should not try to compute the 6th derivative of $\dfrac{1}{(z+i)^7}$.</p>
<p>Is there another way to compute the residue beside this formula?</p>
| 0non-cybersec
| Stackexchange |
Using Easylist and leaving one entry bullet blank. <p>So I have a checklist using the checkboxes. I want to make occasional ones not have the check box because there are several indented checkboxes I want to choose from.
I see <a href="https://tex.stackexchange.com/questions/187616/choosing-the-bullet-of-a-single-item-in-easylist">Choosing the bullet of a single item in Easylist</a></p>
<p>Which gets me very close with the second one: <code>\ListProperties(Style1*=)</code></p>
<p>So, how do I go back to the checkboxes? Google hasn't helped me find what the style name would be for the checkboxes again.</p>
<pre><code>\documentclass[12pt,letterpaper]{article}
\usepackage{multicol}
\usepackage{multienum}
\usepackage{comment}
\usepackage[at]{easylist}
\usepackage[english]{babel}
\usepackage[top=.5in, bottom=1.5in, left=1.5in, right=1in]{geometry}
\begin{document}
\begin{easylist}[checklist]
@ First thing
@ Thing I want indented but no checkbox
@@ Sub things I want with checkbox
@@ Sub things I want with checkbox
@ New thing I want with checkbox
@ Another thing I want without checkbox
@@ Another thing I want without checkbox
@@@ Sub thing with checkbox
@@@ Sub thing with checkbox
@@ Another thing without checkbox
\end{easylist}
\end{document}
</code></pre>
<p>I've added the example latex with easylist. I've listed what I want to do I think...</p>
<p>This is the current output</p>
<p><img src="https://i.stack.imgur.com/8hlZk.png" alt="Current Output"></p>
<p>This is what I want</p>
<p><img src="https://i.stack.imgur.com/1pFXb.png" alt="What I want"></p>
| 0non-cybersec
| Stackexchange |
He comes out of hibernation twice a year, when the sun sets in the southern Blue Ridge.. | 0non-cybersec
| Reddit |
All I want to do is share 2 folders. <p>... on my home network.</p>
<p>I've installed Ubuntu 20.04 on an SSD, created the 2 folders on an HDD in the Ubuntu machine, clicked the 'tab' on the local network share for each folder.</p>
<p>One folder I want anybody on our home network to access, so I've 'ticked' "Allow others to create and delete files in this folder" and "Guest access" then changed the permissions tab to Owner, Group, and Others to "Create and delete files".</p>
<p>The other folder I wish to have only accessible to me, so I've shared that then changed the permissions tab to Owner, Group to "Create and delete files", but Others have "None".</p>
<p>On the Windows machine I add the network drive \ip-address\folder name for each folder. I was unable to access the first (supposedly open!) folder until I added the line "force user = myUbuntuID" under the global section of /etc/samba/smb.conf</p>
<p>That has now enabled access from the Windows machine.</p>
<p>I remain unable to access the second folder. On the Windows machine I add the network drive \ip-address\folder, I get user/password prompt and enter my Ubuntu ID and password, but it just says "Access is denied".</p>
| 0non-cybersec
| Stackexchange |
What's the most ridiculous rule your boss have ever given you? I'll start.... So, I worked at a jewelery store a year ago. One day, I was polishing watches while my manager helped some lady look at wedding bands (I wasn't really paying attention to them). It was early summer and I was suffering from some minor hay fever, so I was sniffling quite a lot.
Anyways, after the lady left, my manager came up to me, looking concerned. Apparently the customer had asked her if I do crack, since apparently people who use it sniffle a lot. I laughed, thinking my manager had thought this comment was funny, and explained about my allergies.
My manager was angry. She told me that I was no longer permitted to sniffle at work. When I told her that I was already using allergy medication, she told me to "use a stronger one". Dead serious.
What's your story, Reddit? | 0non-cybersec
| Reddit |
How can I track button click in google analitycs?. <p>I had register my website in the google analytics and I had put the script in my default index like this : </p>
<pre><code><html>
<head>
<meta name="google-site-verification" content="****************" />
<script async src="https://www.googletagmanager.com/gtag/js?id=AW-7**4*7***"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'AW-7**4*7***');
</script>
</head>
<body>
...
<a class="" href="/Contents/Make-App">
<div class="text">Make app</div>
</a>
...
<script src="/Content/assets/script/combined.min.js" type="text/javascript"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-*4**0**6-*"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-*4**0**6-*');
</script>
</body>
</html>
</code></pre>
<p>I want if I click button "make app", it will be listed on Google Analytics. so I can see how many people clicked on that button</p>
<p>How can I do it? </p>
| 0non-cybersec
| Stackexchange |
Bibliography not showing up in Table of Contents with tocbibind package. <p>I'm trying to get the Bibliography inside my Table of Contents by using the tocbibind package, but only the List of Figures shows. I used the package like this: <code>\usepackage[nottoc]{tocbibind}</code>, and everything compiles without any errors, but the Bibliography is not in there. I saw in several forum discussions that people write the <code>\bibliography{bib}</code> command within the document class, after <code>\tableofcontents</code>, but if I try that, I get an error saying that the bibliography command can only be used in the preamble. I've also never seen how people using this package print the bibliography. I do it in the appendix like this:</p>
<pre><code>\begin{appendix}
\newpage
\printbibliography
\newpage
\listoffigures
\end{appendix}
</code></pre>
<p>The bibliography itself looks perfectly fine, it's just not listed in the contents.
Does anyone have an idea what might be causing this? This is what it looks like, the Bibliography should be on page 50:</p>
<p><a href="https://i.stack.imgur.com/US2TA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/US2TA.png" alt="Table of Contents showing only List of Figures" /></a></p>
| 0non-cybersec
| Stackexchange |
TIL That in the Amazon, butterflies will drink the tears of turtles to provide necessary sodium in their diet.. | 0non-cybersec
| Reddit |
NSV: Will power and my pants are actual pants now!. Two NSV's today! This morning, I realized that my pants, which used to be pushed low by my little belly, now comfortably sit right where they should! And then, whilst eating lunch, I got about halfway through my salad and chicken breast when I realized... 'I'm full', and promptly stored the rest back in the fridge. Self control and inches lost for the win! Very small NSVs, but victories nonetheless!
I've been working out about 5 times a week and watching what I eat. It's interesting to see how your body can change a noticeable amount without losing much weight.
I am 25/F/5'6, SW 168, CW 164, GW 135. | 0non-cybersec
| Reddit |
Unable to open terminal & File Manager in Ubuntu 18.04. <p>Too descriptive question, please bear with me. Thank you
I'm using Dell Atitude E7440, which has ubuntu 18.04. The alt+ctl+t is not opening any terminal & clicking on "File Manager"(keeps on loading near Activities bar for few seconds) as well is not opening any window. I opened VS code and from there, I am able to access my terminal. So far, I have checked if there are any broken packages which seems of no issue. I have reinstalled nautilus & it didn't help. When I try to right click on desktop & open terminal , it as well is not opening window for terminal. Strange thing after I restarted laptop ,(File Manager broke, terminal broke & Chrome asking for password out of nowhere)
Please help me to open the nautilas & terminal.</p>
<p>I'm able to open nautilus from VS Code terminal using-</p>
<pre><code>sudo nautilus
Called "net usershare info" but it failed: Failed to execute child process “net” (No such file or directory)
</code></pre>
<p>Within Nautilus, I see two new mounted devices on the left side (efi & the loaded drive to the laptop)<a href="https://i.stack.imgur.com/TajVN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TajVN.png" alt="enter image description here"></a></p>
<p>Thank you</p>
| 0non-cybersec
| Stackexchange |
Garrosh pumpkin. | 0non-cybersec
| Reddit |
Solve for Y; don't understand Wolfram Alpha's solution. <p>Answering this StackOverflow <a href="https://stackoverflow.com/questions/28345621/converting-davenport-diagram/28352182#28352182">question</a>, I needed to solve this equation in terms of y:</p>
<p>$$x = 6.1 + \log(\frac{{y}}{{0.03p}})$$</p>
<p>Doing it by hand:</p>
<p>$$y = 0.03p10^{{(x-6.1)}}$$</p>
<p><a href="http://www.wolframalpha.com/input/?i=x%20%3D%206.1%20%2B%20log10%28y%20%2F%20%280.03p%29%29%2C%20solve%20for%20y" rel="nofollow noreferrer">Wolfram alpha</a> tells me it's:</p>
<p>$$y = 3p10^{{(x-8.1)}}$$</p>
<p>How are these equivalent?</p>
<p><strong>EDITS</strong></p>
<p>So the how is pretty straightforward, but now the why. Is this a simpler form of the equation or an artifact of Wolfram's processing?</p>
| 0non-cybersec
| Stackexchange |
Which was your first Apple product? Do you still have it?. This is more of a nostalgic post. So I came across this beauty the other day (http://i.imgur.com/5qnacAW.jpg). What a joy to use my beloved iPhone 4 was. I have literally so many wonderful memories with this little beast.
Which was the first Apple product you guys ever owned? Do you still have it with you kept somewhere, and can you care to share some photographs? I was hoping we could all admire their sheer beauty, and maybe bring back the fond memories you might have had with yours. | 0non-cybersec
| Reddit |
How can I use enum types in XAML?. <p>I'm learning WPF and I encountered the following problem:</p>
<p>I have an enum type in another namespace than my XAML:</p>
<pre><code> public enum NodeType
{
Type_SYSTEM = 1, // System
Type_DB = 2, // Database
Type_ROOT = 512, // Root folder
Type_FOLDER = 1024, // Folder
}
</code></pre>
<p>in my XAML I'd like to trigger an image with an integer</p>
<pre><code><Image.Style>
<Style TargetType="{x:Type Image}">
<Style.Triggers>
<DataTrigger Binding="{Binding Type}" Value="{NodeType: }">
<Setter Property="Source" Value="/Images/DB.PNG"/>
</DataTrigger>
<DataTrigger Binding="{Binding Type}" Value="128">
<Setter Property="Source" Value="/Images/SERVER.PNG"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</code></pre>
<p>Is there a way to get an integer value and compare it with an enum type directly in XAML code?</p>
<p>My enum is in namespace <code>AnotherNamespace.Types</code></p>
<pre><code><DataTrigger Binding="{Binding IntegerType}" Value="MyEnumType.Type_DB">
<Setter Property="Source" Value="/Images/SERVER.PNG"/>
</code></pre>
<p></p>
| 0non-cybersec
| Stackexchange |
You guys helped my son build his first PC and he just finished it. Thank you!. | 0non-cybersec
| Reddit |
How can we design this one?. <p>Design a DFA to recognize string over Σ = {0,1} that <em>contains AT LEAST two zeros at its last three positions.</em></p>
| 0non-cybersec
| Stackexchange |
Showing that the indicator/characteristic function is not a regulated function. <p>I want to show that the indicator function (aka. the characteristic function) is not a regulated function. </p>
<blockquote>
<p>\begin{align} \chi : \begin{cases}[a,b] & \longrightarrow \mathbb{R} \\ x & \longmapsto \begin{cases} 0, \ x \in \mathbb{Q} \cap [a,b] \\ 1 , \ x \in (\mathbb{R} \setminus \mathbb{Q} ) \cap [a,b] \end{cases} \end{cases} \end{align}</p>
</blockquote>
<p>The definition (Königsberger Analysis) uses seems to differ to other sources where such topics are discussed. </p>
<blockquote>
<p><strong>Def</strong>: A function $f: [a,b] \to \mathbb{R}$ is called a <em>regulated function</em> if $\exists (f_n)_{n \in \mathbb{N}}$ sequence of step functions $f_n: [a,b] \to \mathbb{R}$ such that $$ \lim_{n \to \infty}\|f_n-f \| =0 $$
where $\|. \|$ denotes the supremum norm.</p>
</blockquote>
<p><strong>My approach</strong>: I am having trouble with the 'elegant' formulation of the solution. Also I am not sure how to do the calculation.</p>
<p>I want to show that for all step functions $\phi: [a,b] \to \mathbb{R}$ it follows that $\| \phi -f \| \geq 1$ or some other small value. </p>
<p>So let $\phi : [a,b] \to \mathbb{R}$ be a step function and $a=x_0< x_1< \dots < x_n =b$ a partition of $[a,b]$, since $\mathbb{Q}$ is dense in $\mathbb{R}$ I can always find $v_1 \in (a, x_1)\cap \mathbb{Q}$ and $v_2 \in (a,x_1) \cap (\mathbb{R} \setminus \mathbb{Q})$. Since $\phi$ is a step function it would also follow that $\phi(v_1) = \phi (v_2) = c_0 \in \mathbb{R}$ </p>
<p>Now I want to use this for a calculation with the norm $$\| \phi - \chi \| = \sup_{x \in [a,b]} |\phi (x) -\chi(x) | \geq \max_{x \in [a,b]} | \phi (x) -\chi(x) | $$</p>
<p>and now, sadly, I lack experience on how to argument with the maximum or the minimum. I tried to visalize it for easier functions than $\chi$ but I couldn't see how I could split up the maximum in order to make even use of my calculations above. </p>
<p>I'd appreciate some insight on how to continue with my calculations, i.e. since I have partition of my interval, I can maybe split up the maximum for all these cases and always end up with states such as: $$ \geq \max(|\phi(v_1)-\chi(v_1)|, \dots , |\phi(v_n)-\chi(v_n)| \\ \geq \max(|\phi(v_1)-\chi(v_1)|, | \phi(v_2)- \chi(v_2)|) = \max (|c_0|, |c_0-1|) $$
but that just doesn't seem right to me.</p>
| 0non-cybersec
| Stackexchange |
Canadians who got a programming job without a degree?. Any Canadians manage to do this without a CS degree? What did you have to do exactly? I know a lot of Americans manage to do this but I want to know if there are any Canadians (especially Torontonians) who had success doing this since I haven't heard many cases of it
Please let me know. I'm worrying a lot about my future as I'm probably never going to get in to a CS program at UofT or Waterloo. | 0non-cybersec
| Reddit |
Chrome “forgets” search engine integration. <p>When enabling the <em>Instant Extended API</em>, Chrome provides a rather nice integration of its search engine into the browser. Supposedly, this means that the Google Search website no longer displays the search text box, along with some other stuff:</p>
<p><img src="https://4.bp.blogspot.com/-O5kQzNvJtRM/UgWHlheKRBI/AAAAAAABLhU/IjYy9pRIeoE/s640/chrome-new-tab-changes-3.png" alt="screenshot"></p>
<p>(This screenshot is actually outdated, the actual result looked even slimmer.)</p>
<p>After updating to version 30.0.1599.69, this did indeed work for me. However, for whatever reason, the setting silently reverted yesterday. Now I’m once again presented with this:</p>
<p><img src="https://i.stack.imgur.com/YfGZO.png" alt="screenshot"></p>
<p>Since I didn’t change <em>any</em> setting in the browser, I’m quite puzzled what might have caused this. I checked under <code>chrome://flags</code>, and “Instant Extended API” is still enabled.</p>
<p>This might have something to do with the actual search URI, since it also changes search results: before the revert yesterday, searching for just “weather” would display the current weather at my location. Searching for “restaurants” would show nearby restaurants, etc. Now, searching for either of those terms doesn’t turn up relevant results, just the normal results list.</p>
<p>Here’s my search engine string (needless to say, I also did <em>not</em> change it):</p>
<pre><code>{google:baseURL}search?q=%s&{google:RLZ}{google:originalQueryForSuggestion}{google:assistedQueryStats}{google:searchFieldtrialParameter}{google:searchClient}{google:sourceId}{google:instantExtendedEnabledParameter}{google:omniboxStartMarginParameter}ie={inputEncoding}
</code></pre>
<p>How can I re-enable the search engine integration?</p>
<p>(Other parts that use the Instant Extended API still work, e.g. the History still shows open tabs on my other devices.)</p>
<p>In case it matters, I’m located in the UK. <code>{google:baseURL}</code> still seems to resolve to <code>google.com</code> rather than <code>google.co.uk</code> (see screenshot) but I’m reasonably certain it also did that before.</p>
| 0non-cybersec
| Stackexchange |
PS4's emulator for PS2 games needs anti-aliasing badly.. Okay, seriously now, with the release of the Jak games it is becoming even more clear that this emulator has no decent image quality whatsoever. There is nothing but some shitty post processing going on it seems like. Am I playing the wrong games? War of the Monsters looked terrible. And the jaggies are horrendous. Are there other games with better image quality? I was thinking about buying a couple but War of the Monsters put me off that notion.
Whatever upsampling they are doing is not working, and I really have no idea why the PS2 emulator is not being improved at this point. Unless it is being improved? We never hear anything about it.
Do you realize how nice it would be to play these games on a great emulator at least with better resolution with all the PS4 features? More and more I feel like I am still pushed to PCSX2 for emulation because the actual company that makes the games refuses to do anything about their own emulation.
It kind of pisses me off. Do you think they will ever improve PS2 emulation on PS4? Do you have any information about any games that do look good? Are they always jaggy?
https://arstechnica.com/gaming/2015/11/the-ps4-can-now-emulate-playstation-2-games/
Due to this article I thought all these games were going to look amazing. With the few I have this is certainly not the case. | 0non-cybersec
| Reddit |
German fighter ace Werner Mölders describes his latest dogfight to Adolf Galland and Theodor Osterkamp (1941) [799x506]. | 0non-cybersec
| Reddit |
Ruth! (not sure if repost). A guy has a talking dog. He brings it to a talent scout. "This dog can speak English," he claims to the unimpressed agent. "Okay, Sport," the guys says to the dog, "what’s on the top of a house?" "Roof!" the dog replies. "Oh, come on..." the talent agent responds. "All dogs go ‘roof’." "No, wait," the guy says. He asks the dog "what does sandpaper feel like?" "Rough!" the dog answers. The talent agent gives a condescending blank stare. He is losing his patience. "No, hang on," the guy says. "This one will amaze you. " He turns and asks the dog: "Who, in your opinion, was the greatest baseball player of all time?" "Ruth!" goes the dog. And the talent scout, having seen enough, boots them out of his office onto the street. And the dog turns to the guy and says "Maybe I shoulda said DiMaggio?" | 0non-cybersec
| Reddit |
Double summation index problem. <p>I often meet the following situation:</p>
<p>$$\sum\limits_{n=0} ^\infty \sum\limits_{k=0} ^n f(k)g(n-k)=\sum\limits_{p=0} ^\infty \sum\limits_{q=0}^\infty f(p)g(q)$$</p>
<p>While intuitively this is very clear to me, I'm having problems to rigorously prove this. Could somebody please help me out?</p>
<p>So far my friends and I have come up with the map: $(n,k) \rightarrow (q,p) \text{ with } k\leq n$ where $q(n)=n-k$ and $p(n)=q+n=k$ Therefore we only need to prove bijection.</p>
<p>Thanks</p>
<p>EDIT: The original problem was motivated by:</p>
<p>$$e^{(L_A+L_B)}=\sum\limits_{n=0} ^\infty \sum\limits_{k=0} ^n \frac{1}{k! (n-k)!} L_1^k L_2^{n-k}=\sum\limits_{p=0} ^\infty \sum\limits_{q=0}^\infty \frac{1}{p! q!} L_1^p L_2^q=$$</p>
<p>where $L_A$ and $L_B \in \mathcal{B}$ and $\mathcal{B}$ is a Banach space. However, I encountered the same problem when dealing with double Fourier transforms</p>
| 0non-cybersec
| Stackexchange |
Is it true? Has Germany compromised wages and benefits to remain competitive?. | 0non-cybersec
| Reddit |
Why, when on Kubuntu I lose internet connection, am I unable to reconnect?. <p>Using Kubuntu 11.10. Sony Vaio computer.
Network controller: Intel Corporation WiFi Link 5100.</p>
<p>If I connect to a wireless network, and the signal drops, then I am unable to connect to any network without a reboot. I can assure that the issue has nothing to do with the computer going to sleep, as I have experienced the above while using my computer continuously.</p>
<p>Here is exactly what happens:</p>
<ol>
<li><p>Connect to network (at University, where the connection is not so great).</p></li>
<li><p>The connection is broken</p></li>
<li><p>There are three other possible networks available, but none of them can be connected to. I have tried off and on sometimes for hours.</p></li>
<li><p>I am always able to reestablish a connection after a reboot.</p></li>
</ol>
<p>I can only think of two explanations. The first is that a temp file is corrupted when the internet connection is abruptly dropped. The second is that my computer actually corrupts something before the loss of internet connection, which causes the loss in signal, and inability to reconnect. However, I am not confident that my explanations are complete, nor do I have any idea how to test these things.</p>
| 0non-cybersec
| Stackexchange |
Made some medicated pesto yesterday. Looks like Martian vomit, but tastes amazing and packs one hell of a punch. | 0non-cybersec
| Reddit |
local shop put out a deal on flash roses. had to go.. | 0non-cybersec
| Reddit |
c++ copy constructor with shared_ptr members. <p>From <a href="http://www.cplusplus.com/articles/y8hv0pDG/">cplusplus.com</a>:</p>
<blockquote>
<p>Rarely you will come across a class that does not contain raw pointers
yet the default copy constructor is not sufficient. An example of this
is when you have a reference-counted object. boost::shared_ptr<> is
example.</p>
</blockquote>
<p>Can someone elaborate on this? If we have a class containing a <code>boost::shared_ptr</code>, won't that get copy constructed when the class gets copy constructed - and hence won't the <code>shared_ptr</code> constructor do the right thing and increase the reference count? The following code, for example, copies <code>Inner</code> properly - why wouldn't this work for <code>shared_ptr</code>?:</p>
<pre><code>#include <iostream>
using namespace std;
class Inner
{
public:
Inner() { cout << "inner default constructed" << endl;}
Inner(const Inner& other) { cout << "inner properly copied" << endl;}
};
class Outer
{
Inner i;
};
int main() { Outer o; Outer p(o); return 0;}
</code></pre>
| 0non-cybersec
| Stackexchange |
Hand Study, Final, Anatomy. | 0non-cybersec
| Reddit |
Will using the following logic work on solving the integral $A$?. <p>I have the following integral </p>
<p><span class="math-container">$$ \int_0^{\frac{\pi}{3}} \cos(x)\tan\left(\frac{\pi}{6}-\frac{x}{2}\right)=A $$</span></p>
<p>This integral can be solved directly with integration techniques however, for the sake of the question please assume i am not able to do so (find an anti-derivative). </p>
<p>I will reflect the function on the Y axis such that </p>
<p><span class="math-container">$$\int_0^{\frac{\pi}{3}} \cos(x)\tan\left(\frac{\pi}{6}-\frac{x}{2}\right) = \int_{\frac{-\pi}{3}}^{0} \cos(x)\tan\left(\frac{\pi}{6}+\frac{x}{2}\right)$$</span></p>
<p>I, then subtract both integrals over the same limits of integration to obtain an antiderivative <span class="math-container">$P(x)$</span> and a value <span class="math-container">$K$</span></p>
<p><span class="math-container">$$\int_0^{\frac{\pi}{3}} \cos(x)\tan\left(\frac{\pi}{6}-\frac{x}{2}\right) - \int_0^{\frac{\pi}{3}}\cos(x)\tan\left(\frac{\pi}{6}+\frac{x}{2}\right) = P(x)|_0^{\frac{\pi}{3}}=K$$</span></p>
<p>Since the functions are reflections of each other I can say that the above is equivalent to </p>
<p><span class="math-container">$$-\int_{\frac{-\pi}{3}}^0 \cos(x)\tan\left(\frac{\pi}{6}-\frac{x}{2}\right) + \int_0^{\frac{\pi}{3}} \cos(x)\tan\left(\frac{\pi}{6}-\frac{x}{2}\right) = P(x)|_0^{\frac{\pi}{3}}=K$$</span></p>
<p>So based on this, can I use <span class="math-container">$P(x)$</span> to find the value of Integral <span class="math-container">$A$</span>?
<a href="https://i.stack.imgur.com/im7pj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/im7pj.png" alt="enter image description here"></a></p>
<p>Kind Regards, </p>
<p>Thank you for your help and time. </p>
| 0non-cybersec
| Stackexchange |
delphi XE multi-unit namespace question. <p>I am reading RAD Studio Documentaion in Delphi XE.
here a some texts.</p>
<blockquote>
<p>[ Delphi Reference -> Delphi Language Guide -> Programs and Units -> Using Namespaces -> Searching Namespaces -> Multi-unit Namespaces ] </p>
<p><strong>Multi-unit Namespaces</strong></p>
<p>Multiple units can belong to the same namespace, if the unit declarations refer to the same namespace.
For example, one can create two files, unit1.pas and unit2.pas, with the following unit declarations: </p>
</blockquote>
<pre><code>// in file 'unit1.pas'
unit MyCompany.ProjectX.ProgramY.Unit1
// in file 'unit2.pas'
unit MyCompany.ProjectX.ProgramY.Unit2
</code></pre>
<blockquote>
<p>In this example, the namespace MyCompany.ProjectX.ProgramY logically contains all of the interface symbols from unit1.pas and unit2.pas. </p>
<p>Symbol names in a namespace must be unique, across all units in the namespace.<br>
In the example above, it is an error for Unit1 and Unit2 to both define a global interface symbol named mySymbol </p>
</blockquote>
<p>I tested this.
code below .</p>
<pre><code>-----------------------------------------------------------------
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils,
Lib.A in 'Lib.A.pas',
Lib.B in 'Lib.B.pas';
begin
WriteLn ( TestValue ) ;
ReadLn ;
end.
-----------------------------------------------------------------
unit Lib.A;
interface
const TestValue : Integer = 10 ;
implementation
end.
-----------------------------------------------------------------
unit Lib.B;
interface
const TestValue : Integer = 10 ;
implementation
end.
</code></pre>
<p>This is not error. Why? I don't understand.</p>
| 0non-cybersec
| Stackexchange |
Moving-Target Defense for Detecting Coordinated
Cyber-Physical Attacks in Power Grids
Subhash Lakshminarayana∗, E. Veronica Belmega† and H. Vincent Poor‡
∗ School of Engineering, University of Warwick, UK
† ETIS, Université Paris Seine, Université Cergy-Pontoise, ENSEA, CNRS, Cergy-Pontoise, France
‡ Department of Electrical Engineering, Princeton University, Princeton, NJ 08544, USA
Emails: ∗[email protected], †[email protected] ‡ [email protected]
Abstract—This work proposes a moving target defense (MTD)
strategy to detect coordinated cyber-physical attacks (CCPAs)
against power grids. A CCPA consists of a physical attack, such
as disconnecting a transmission line, followed by a coordinated
cyber attack that injects false data into the sensor measurements
to mask the effects of the physical attack. Such attacks can lead
to undetectable line outages and cause significant damage to the
grid. The main idea of the proposed approach is to invalidate
the knowledge that the attackers use to mask the effects of the
physical attack by actively perturbing the grid’s transmission
line reactances using distributed flexible AC transmission system
(D-FACTS) devices. We identify the MTD design criteria in this
context to thwart CCPAs. The proposed MTD design consists
of two parts. First, we identify the subset of links for D-FACTS
device deployment that enables the defender to detect CCPAs
against any link in the system. Then, in order to minimize
the defense cost during the system’s operational time, we use
a game-theoretic approach to identify the best subset of links
(within the D-FACTS deployment set) to perturb which will
provide adequate protection. Extensive simulations performed
using the MATPOWER simulator on IEEE bus systems verify the
effectiveness of our approach in detecting CCPAs and reducing
the operator’s defense cost.
I. INTRODUCTION
Cyber threats against power grids are of increasing concern
due to the deep integration of information and communication
technologies (ICT) into grid operation. A recent real-world
example was the December 2015 cyber attack against the
Ukraine’s power grid which resulted in large-scale outages that
lasted several hours [1]. The attack was carried out by opening
several transmission line circuit breakers and simultaneously
blocking the information lines (e.g., telephone lines) to cover
up the attacks. Such attacks have alerted us to a general class of
attacks called the coordinated cyber-physical attacks (CCPAs).
As the name suggests, a CCPA consists of two components,
namely, a physical attack and a cyber attack. The physical
attack involves disconnecting a transmission line, generator
or transformer. On the other hand, a cyber attack involves
manipulating the sensor measurements that are conveyed from
the field devices to the control center, and has an effect
of masking the physical attack. The attacker may readily
launch such a cyber attack by exploiting the power grid’s
This work was supported in part by a startup grant at the University of
Warwick and in part by the U.S. National Science Foundation under Grants
DMS-1736417 and ECCS-1824710.
communication vulnerabilities [2]. CCPAs can have severe
effects on the grid, since undetected line/generator outages
may trigger cascading failures, and have received significant
recent attention [3], [4], [5], [6].
To defend against CCPAs, recent studies [4] and [6] have
proposed strategies based on securing a set of measurements
(e.g., by encryption) or relying on measurements from known-
secure phasor measurement units (PMU) deployed in the grid.
However, power grids consist of many legacy devices whose
life cycles can last several decades, and incorporating major
security upgrades in these devices can be quite expensive.
Moreover, extensive research has shown that PMUs themselves
are vulnerable to false data injection (FDI) attacks, which can
be launched by spoofing their GPS receivers [7].
In this work, we propose a novel defense strategy to detect
CCPAs based on the technique of moving target defense
(MTD). As in prior works [3], [4], [5], [6], we only consider
physical attacks that disconnect the transmission lines. We note
that to craft an undetectable CCPA, the attacker must obtain
an accurate knowledge of certain line reactances [4], [6]. The
main idea of the proposed MTD defense in this context is to
invalidate the attacker’s prior acquired knowledge by actively
perturbing of the grid’s line reactance settings. This can be ac-
complished using distributed flexible AC transmission system
(D-FACTS) devices, which are capable of performing active
impedance injection and are being increasingly deployed in
power grids [8]. The proposed MTD defense strategy has the
potential to make it extremely difficult for the attacker to track
the system’s dynamics and gather sufficient information to
craft undetectable CCPA. The main contributions of this work
are as follows:
• First, we formulate the MTD design problem to defend
against CCPAs and identify the MTD design criteria in
this context.
• We then propose a solution to the D-FACTS deployment
problem using a graph-theoretic approach. Our proposed
solution identifies the minimum-sized subset of links for
D-FACTS deployment which enables the defender to
detect CCPAs against any transmission line.
• However, an MTD solution that involves perturbing a
large number the branch reactances can be expensive
due to the MTD’s operational cost [9]. To reduce the
operator’s cost of defense, during the system’s operational
ar
X
iv
:1
90
8.
02
39
2v
1
[
cs
.C
R
]
6
A
ug
2
01
9
time, we use a game-theoretic formulation to identify the
best subset of links to perturb that will provide adequate
protection.
Extensive simulations conducted using the MATPOWER sim-
ulator shows the effectiveness of our solution. Moreover, the
results show that the game-theoretic approach significantly
reduces the operator’s defense cost.
II. PRIOR WORK
Power grid security has received significant interest in the
past few years. In particular, FDI attacks against power grid
state estimation have been extensively studied [10], [11], [12].
While FDI attacks affect only the sensor measurements that
are conveyed to the control center (and hence consist only of
a cyber attack), recent research [3], [4], [5], [6] has studied
CCPAs attacks, which as noted above consist of both cyber
and physical components. CCPAs were first proposed in [3]
based on disconnecting a set of transmission lines and blocking
sensor measurements from the attacked area. However, the
proposed cyber attack cannot completely mask the effects
of the physical attack. Moreover, under some conditions, it
was shown that the operator can recover the phase angles
and detect the physical attack using information from outside
the attacked zone [3]. On the other hand, [4], [5] and [6]
proposed the design of cyber attacks that can completely mask
the effects of the physical attack under different assumptions
about the attacker’s knowledge. Further, [4], [5] and [6] have
also investigated defense against CCPAs relying on a subset
of protected measurements, which however is vulnerable (see
Section I).
Recently, the concept of MTD has been applied to defend
against FDI attacks [13], [14], [9], [15]. In comparison to
these works, we are the first to apply MTD for defense against
CCPAs. Our analysis shows that MTD for defending against
CCPAs requires the formulation of novel design criteria both
in terms of D-FACTS placement as well as D-FACTS per-
turbation selection in comparison to aforementioned works.
Finally, we note that while game theory has been used in the
context of defense against FDI attacks [16], [17], this work is
the first to apply it in the context of MTD design in power
grids.
III. SYSTEM MODEL
Power Grid Model: We consider a power grid consisting
of N buses and L transmission lines. The set of buses and
transmission lines are denoted by N = {1, . . . , N} and
L = {1, . . . , L} respectively. An example of the IEEE-4
bus system with 5 links is shown in Fig. 1. At bus i, we
denote the amount of generation and load by Gi and Li
respectively. We let l = {i, j} denote a transmission line
l ∈ L that connects bus i and bus j and its reactance by
xl. The power flowing on the corresponding line l is denoted
by Fl, which under the DC power flow model [18] is given
by Fl =
1
xl
(θi − θj), where θi and θj are the voltage phase
angles at buses i, j ∈ N respectively. In vector form, the power
flow vector f = [F1, . . . , FL]T is related to the voltage phase
G1
Bus 4Bus 1
G2
Bus 2 Bus 3
L1
L2
L3
L4
L5
Fig. 1: An example of a 4 bus power grid.
angle vector θ = [θ1, . . . , θN ] as f = DATθ, where the
matrix A ∈ RN×L is the branch-bus incidence matrix [18]
and D ∈ RL×L is a diagonal matrix of the reciprocals of link
reactances. We denote the set of links on which D-FACTS
devices are deployed by LD where LD ⊆ L. D-FACTS
devices enable the reactances of these lines to be varied within
a pre-defined range [xmin,xmax], where xmin,xmax are the
reactance limits achievable by the D-FACTS devices.
Optimal Power Flow: For any given load condition l =
[L1, . . . , LN ], the system operator sets the generation dispatch
and line reactance settings by solving the optimal power flow
(OPF) problem, stated as follows:
COPF = min
g,x
∑
i∈N
Ci(Gi) (1a)
s.t. g − l = Bθ, (1b)
f ∈ F ,g ∈ G,x ∈ X , (1c)
where Ci(·) is the generation cost at bus i ∈ N . Equa-
tion (1a) is the nodal power balance constraint, where the
matrix B = ADAT . Constraints (1c) correspond to the
branch power flows, generator limits, and D-FACTS limits,
respectively, where F = [−fmax, fmax],G = [gmin,gmax] and
X = [xmin,xmax] and fmax is the maximum permissible line
power flow (i.e., the thermal limit) and gmin,gmax are the
generator limits. We note that in the absence of D-FACTS,
OPF optimizes over the generator dispatch values only.
State Estimation & Bad Data Detection: The system state,
i.e., the voltage phase angles θ, are estimated from the
noisy sensor measurements using the state estimation (SE)
technique. The sensor measurements, which we denote by z ∈
RM , correspond to the nodal power injections, and the forward
and reverse branch power flows, i.e. z = [p̃, f̃ ,−f̃ ]T and M is
the total number of measurements, where M = N + 2L. We
denote the sensor measurement noises by a vector n ∈ RM ,
which is assumed to follow a Gaussian distribution. Under the
DC power flow model, the relationship between θ and z is
given by z = Hθ + n, where H ∈ RM×N is the system’s
measurement matrix given by H = [DAT ;−DAT ;ADAT ]
([A;B] denotes the row concatenation of matrices A and B).
The maximum likelihood (ML) technique is used for system
state estimation [18]. Under ML estimation, the estimate θ̂ is
related to the measurements z as θ̂ = (HTWH)−1HTWz,
where W is a diagonal weighting matrix whose elements are
reciprocals of the variances of the sensor measurement noise
components.
After state estimation, a bad data detector (BDD) computes
a quantity referred to as the residual, which we denote by r
as r = ||z−Hθ̂||. A bad data alarm is flagged if the residual
exceeds a predefined threshold τ. The threshold is adjusted
to ensure that the false positive (FP) rate does not exceed α,
where α > 0 (usually a small value close to zero).
Undetectable False Data Injection Attacks: We denote the
FDI attack vector by a ∈ RM , which the attacker injects into
the sensor measurements and the measurement vector with the
FDI attack by za, given by za = z + a. It has been shown
[10] that an FDI attack of the form a = Hc, where c ∈ RN ,
remains undetected by the BDD. Specifically, the probability
of detection for such attacks is equal to the FP rate α. We call
these attacks undetectable FDI attacks.
Coordinated Cyber and Physical Attack: While an FDI
attack only modifies the sensor measurements, a CCPA attacks
the grid physically followed by a coordinated FDI attack on
the sensor measurements, as noted above. In particular, we
consider physical attacks that disconnect a set of transmission
lines, e.g., by opening the line circuit breakers. The physical
attack will alter the power grid’s topology and power flow, and
the mismatch between the pre-attack (i.e., line disconnections)
and post-attack measurements can generally be detected by the
BDD. However, it has been shown that if the attacker injects
a carefully-constructed coordinated FDI attack on the sensor
measurements, then the effect of the physical attack on the
BDD residual can be completely masked [6]. Hence, the attack
remains undetected by the BDD.
Denote the set of links disconnected by the attacker under
a physical attack by LA. We use the subscript “p” to denote
the power grid parameters following the physical attack. It can
be shown that the grid measurements post the physical attack
are related to the pre-attack measurements by zp = z + ap,
where ap = H∆θ + ∆Hθp, where ∆H is the change in the
measurement matrix before and after the physical attack, given
by, ∆H = H − Hp. Reference [6] showed that in order to
mask the effect of the physical attack and remain undetected
by the BDD, the attacker must inject a coordinated FDI attack
of the form a = ∆Hθp.
Knowledge Required to Launch a CCPA: Next, we enlist
the knowledge required by the attacker to construct an FDI
attack of the form a = ∆Hθp. Assume that the attacker
disconnects a single branch LA = {l} that connects buses
i and j. It can be easily verified that ∆H depends on the
tripped branch reactance xl only. Therefore, to construct the
attack a = ∆Hθp, the attacker must obtain knowledge of the
branch reactance xl and the difference in phase angles of the
buses i and j following the physical attack, i.e., θi,p−θj,p [6].
The knowledge of θi,p − θj,p can be obtained by monitoring
the line power flows following the physical attack as follows:
θi,p − θj,p = −
∑
m∈pk
l
xlmFlm,p, (2)
where pkl is any alternative path between nodes i and j in
the residual power network following the physical disconnec-
tions, i.e., L \ LA. Each path pkl in turn is a collection of
links pkl = {lk1 , lk2 , . . . , lkM } such that src(lk1) = i and
dst(lkM ) = j, and kM is the number of links in the path
pkl . We denote by Pl = {p
1
l , p
2
l , . . . , p
Kl
l } a collection of
all alternative paths between buses i and j, where Kl is the
number of such alternative paths. Note that the subscript l
denotes the disconnected link.
In the IEEE-4 bus example, assume that the attcker dis-
connects link 1. After the disconnection, there are two alter-
native paths between buses 1 and 4, and hence, K1 = 2.
These paths are given by p1l = {2, 3, 4} with k1 = 3 and
p2l = {5, 4} with k2 = 2. The attacker can compute the
phase angle difference between nodes 1 and 2 using (2) as
θ1,p− θj2p = − (x2F2,p + x3F3,p + x4F4,p) or, θ1,p− θj2p =
− (x5F5,p + x4F4,p) .
In (2), the attacker can obtain the knowledge of power flows
Flm,p by monitoring the line flow sensor measurements. On
the other hand, the line reactances xlm can be learned by
monitoring the grid power flows over a period of time using
existing techniques [19], [20]. The attacker can also learn the
reactance of the disconnected branch xl similarly.
IV. MOVING-TARGET DEFENSE FOR CCPAS
In this work, we propose a solution to defend the system
against CCPAs based on the MTD technique. The main idea
behind this approach is to periodically perturb the branch
reactances of certain transmission lines to invalidate the at-
tacker’s acquired knowledge. Hence, an attack constructed
using outdated knowledge of the system can be detected by
the BDD. (The reader can refer to [20] for practical guidance
on how frequently the branch reactances must be perturbed.)
In this section, we first formalize the MTD design problem
to defend against CCPAs. The solution to the MTD design
problem is presented in Section V. The details are presented
next.
Recall from (2) that to construct an undetectable CCPA,
the attacker must acquire the following: (i) knowledge of the
reactance of the tripped branch, xl, and (ii) knowledge of
branch reactances in at-least one alternate paths pkl between
the nodes i and j. Therefore, under MTD, the defender can
thwart the CCPA by invalidating one of the two:
C1. Invalidate the attacker’s knowledge of the tripped
branch’s reactance xl.
C2. Invalidate the attacker’s knowledge of at-least one of the
branches in the path pkl between nodes i and j.
Note that the defender however cannot have prior knowledge
of which link the attacker chooses to disconnect. Moreover,
for a disconnected link l, the defender has no way of knowing
which path pkl ∈ Pl the attacker may have used to compute the
phase angle difference θi,p−θj,p as in (2). Thus, the defender
must invalidate the attacker’s knowledge of the reactance of
at-least one branch in every path pkl ∈ Pl. The defender must
do so for every link l ∈ L (such that the attacker cannot launch
a CCPA by disconnecting any link in the grid). Based on the
arguments above, the MTD perturbation selection problem can
be stated as follows:
Problem 1 (MTD problem). For each branch l ∈ L, invalidate
the knowledge of at-least one of the branches in {l}∪pkl , k =
1, . . . ,Kl.
The MTD perturbation problem poses constraints on the D-
FACTS deployment set LD, since a preliminary requirement
to invalidate the attacker’s knowledge of a branch reactance
is the presence of a D-FACTS device on that link. Thus,
LD must be chosen in a way that it gives the defender the
ability to protect every link l ∈ L. A trivial solution is to
deploy a D-FACTS device on every link of the power grid.
However, a system operator may wish to minimize the number
of D-FACTS devices installed in order to minimize the device
deployment cost.
On the other hand, MTD perturbations incur an opeartional
cost for the defender. Reference [9] characterized this cost in
terms of the increase in OPF cost of the grid due to the MTD
perturbations1. Perturbing the reactances of a large number
of links may be expensive. Thus, at the system’s operational
time, the defender may wish to perturb the reactances of only
a subset of links, which we denote by LDw , where LDw ⊆
LD, such that the attacker cannot launch CCPAs against some
specific links that are perceived to be important and vulnerable
to attack.
In what follows, we provide solutions to both the afore-
mentioned aspects of MTD design problem. Specifically, we
first present an algorithm to find the D-FACTS deployment set
LD that satisfies the MTD design problem with a minimum
number of devices based on a graph-theoretic approach. Sub-
sequently, we present a solution to the problem of selecting
a subset of links LDw for reactance perturbation at the
operational time based on a game-theoretic approach.
V. SOLUTION TO THE MTD DESIGN PROBLEM
In this section, we solve the MTD design problem formal-
ized in Section IV. We first address the problem of finding the
D-FACTS deployment set.
A. D-FACTS Deployment
Our key observation to solve the D-FACTS deployment set
problem is that each set of links {l}∪pkl , k = 1, . . . , kM , forms
a loop in the graph G. For example, in the 4-bus example
in Figure 1, assuming that the attacker disconnects link 1,
the links {1} ∪ {2, 3, 4} and {1} ∪ {4, 5} form loops in the
corresponding graph. If a DFACTS device is installed on a
subset of links in the graph such that every loop in the network
has at least one link with a D-FACTS device installed, then
the attacker cannot launch an undetectable CCPA.
In graph-theoretic terms, the problem is equivalent to re-
moving a subset of links in the network such that the residual
graph has no loops. For optimized deployment, LD must be
the minimum number of such links. If each link is assigned a
weight of 1, then LD must be a subset of links with minimum
weight.
1Note that in the absence of MTD, the D-FACTS settings are adjusted to
minimize the OPF cost as in (1a). Thus, the MTD perturbations will increase
the OPF cost, and the MTD operational cost in non-negative.
The set LD can be found by solving the minimum weight
feedback edge set problem in an undirected graph [21]. The so-
lution proceeds by finding the maximum weight spanning tree
(MWST). Specifically, let Lsptr be the MWST of the graph G.
If D-FACTS devices are installed on the links L\Lsptr, then the
attacker cannot find a loop within the graph whose branches
do not have a D-FACTS device installed. Equivalently, the
attacker cannot launch an undetectable CCPA. Further, since
the links in Lsptr form a maximum-weighted spanning tree,
L \ Lsptr are the links with minimum weight which can be
disconnected. Equivalently, the links L\Lsptr are the minimum
number of links that satisfy the D-FACTS desgin problem
described in Section IV. Thus, the D-FACTS deployment set
LD = L \ Lsptr.
Consider the D-FACTS deployment set LD chosen accord-
ing to the above arguments. Assume that the defender perturbs
the reactances of the set of links LDw ⊆ LD. Then, we have
the following:
• A physical attack against a link l can be detected by the
BDD if the links in LDw ensure that the conditions listed
in Problem 1 are satisfied for that link. We will henceforth
refer to such a link to being “protected” under the MTD
link perturbation set LDw .
• Naturally, based on the arguments stated in this section,
if LDw = LD, then all the links l ∈ L are protected from
the physical attacks.
B. MTD Perturbation Selection Using Game Theory
MTD perturbations incur an operational cost, and perturbing
the reactances of a large set of links may not be cost effective.
In this section, we answer the question of how to select the
appropriate perturbation set LDw . The main idea is to protect
only a subset of links from physical attacks depending on
the operational state of the system, as well as the perceived
threat to those links. This is approached using a game-theoretic
formulation. The details are presented next.
1) Game Formulation: We define the strategic interactions
between the attacker and the defender as a two-player non-
cooperative game. To formalize this, we define the game as a
triplet G , ({D,A}, {SD,SA}, {uD, uA}) in which the com-
ponents are: (i) the set of players {D,A}; (ii) SD and SA, the
sets of actions that defender and attacker can take respectively;
and (iii) the payoffs of the players uk : SD × SA → R for
k ∈ {D,A}, where uk(sD, sA) measures the benefit obtained
by player k when the action profile that has been played is
s = (sD, sA).
We denote the attacker’s and the defender’s action sets by
SA = {a0, a1, . . . , aNA−1} and SD = {d0, d1, . . . , dND−1}
respectively, where NA and ND are the cardinality of the sets
SA and SD respectively. The attacker’s action set is the subset
of links it disconnects physically. We denote the set of links
disconnected by the attacker under action ai by Lai , where,
Lai ⊆ L, i = 0, 1, . . . , NA − 1. The action a0 corresponds
to the case when the attacker does not attack any link. The
defender’s action is to select a subset of links within LD whose
reactances will be perturbed. We denote the set of links chosen
by the defender under action di by Ldi , where, Ldi ⊆ LD, i =
1, . . . , ND − 1. The action d0 corresponds to the case when
the defender does not perturb the reactance of any link.
Next, we characterize the attacker’s and the defener’s pay-
offs. The cost of damage due to the attack can be characterized
as follows. If the attacker disconnects a link l that is protected
by the defender (due to the MTD perturbations), then the
CCPA will be detected by the BDD, and the system operator
can quickly restore the link to ensure that the attack does
not result in any further damage. For instance, the defender
can quickly restore the circuit breaker of the disconnected
link to a closed position. On the other hand, if the attacker
disconnects a link that is not protected by the defender, then
the CCPA will go undetected. The link disconnection will
result in redistribution of power flows. Consequently, all the
links on which the power flows exceeds the corresponding
thermal limits will experience physical damage, and will get
disconnected from the grid. In this case, the system operator
will have to initiate load shedding in order to ensure that the
attack does not result in further damage. (Herein, we assume
that the BDD will detect the attack once additional links are
disconnected, since the attacker’s data injection will only mask
the effect of disconnection of the first link.) We denote the cost
of load shedding at bus i by Ci,s(Lsi ), where L
s
i (≤ Li) is the
quantity of load that is shed. We denote ls = [Ls1, . . . , L
s
N ].
Let COPF(am, dn) denote the OPF cost when the attacker
takes an action am and the defender takes an action dn. It can
be computed as follows:
COPF(am, dn) = min
g,ls
∑
i∈N
Ci,g(Gi) + Ci,s(L
s
i ) (3)
s.t. g − l + ls = Bam,dnθ,
f ∈ F ,g ∈ G,
where Bam,dn is given by Bam,dn = Aam,dnDam,dnA
T
am,dn
.
Here, Aam,dn is the bus-branch connectivity matrix when
the attacker and the defender choose actions am and dn
respectively. These quantities are computed as in Algorithm 1.
ALGORITHM 1: Cost Computation
Data: am, dn
Result: COPF(am, dn)
1 Set branch reactances to xdn .
2 Set Aam,dn = Aa0,d0 .
3 Solve (3) to obtain COPF(a0, dn).
4 if attack is successful then
5 Recompute power flows after removing the branches in
Lam .
6 Monitor the branches for which the power flow exceeds the
line capacity. Denote such links by Lcam .
7 Set Aam,dn , Dam,dn by removing the branches Lam and
Lcam . Solve (3) to compute COPF(am, dn).
8 else
9 Set COPF(am, dn) = COPF(a0, dn).
10 end
Based on the formulation above, the defender’s payoff is
given by
uD(sD, sA) =
{
COPF(d0, a0)− COPF(sD, a0), if IS = 0
COPF(d0, a0)− COPF(sD, sA), if IS = 1,
and the attacker’s payoff is
uA(sD, sA) =
{
0, if IS = 0
COPF(sD, sA)− COPF(d0, a0), if IS = 1,
where IS is an indicator variable to represent the success
(IS = 1) or failure of an attack (IS = 0). Both players
aim to choose their actions such that their own payoff is
maximized and although the game is not a zero-sum game, we
can see that the two players have contradictory objectives. The
above payoffs can be explained as follows. First, COPF(d0, a0)
denotes the benchmark operating cost of the defender when
none of the players takes an action to either disrupt or defend
the system. The term COPF(sD, sA) − COPF(d0, a0) denotes
the the additional cost incurred by the defender and caused
by a successful attack, when the attacker chooses sA and the
defender chooses sD; the defender’s aim is to minimize this
cost whereas the attacker wants to maximize it. The term
COPF(sD, a0) − COPF(d0, a0) represents the additional cost
incurred by the defender for choosing an action sD against
an unsuccessful attack sA; the defender will seek to minimize
this cost while neutralizing the attack. Of course, the benefit
of the attacker if its attack fails is equal to zero.
2) Solving the Game Formulation: The game described
above is discrete and finite. In such an interactive situation, a
natural solution is the Nash equilibrium (NE), which is a stable
state to unilateral deviation. Mathematically this is defined as:
Definition 1. A strategy profile (s∗D, s
∗
A) is an NE for the
game G if the following conditions are met: uD(s∗D, s
∗
A) ≥
uD(sD, s
∗
A), ∀sD ∈ SD, uA(s
∗
D, s
∗
A) ≥ uA(s
∗
D, sA), ∀sA ∈
SA.
This means that neither player has any incentive to unilat-
erally deviate and will lose in terms of utility otherwise. This
type of game may not have a pure NE solution but it always
has at least one mixed-strategy NE [22], which is the NE of
the extension of the game G to mixed strategies. It is defined as
follows: G̃ , ({D,A}, {∆D,∆A}, {ũD, ũA}). The action sets
of the extended game G̃ are the probability simplices of dimen-
sion Nk, k ∈ {D,A}: ∆k =
{
pk ∈ RNk+
∣∣∣∑Nkj=0 pk,j = 1}
where pk = (pk,0, . . . , pk,Nk−1) is the discrete probability
vector of player k such that pD,j and pA,j represent the
probability of choosing the action dj by the defender and
the probability of choosing the action aj by the attacker,
respectively. The modified payoffs are simply the resulting
expected payoffs following the randomization of play:
ũk(pD, pA) =
ND−1∑
j=0
NA−1∑
i=0
uk(dj , ai) pD,j pA,i. (4)
The mixed NE can be defined similarly to the pure strategy
NE.
Definition 2. A mixed strategy profile (p∗D, p
∗
A) is a mixed
an NE for the game G if it is a NE for the ex-
tended game G̃ and the following conditions are met:
ũD(p
∗
D, p
∗
A) ≥ ũD(pD, p
∗
A), ∀pD ∈ ∆D, and ũA(p
∗
D, p
∗
A) ≥
ũA(p
∗
D, pA), ∀pA ∈ ∆A.
The mixed NE can be computed by using the Von-Neumann
indifference principle [22], which basically says that: i) player
k is rendered indifferent (in terms of its expected payoff)
between its pure actions that are played at the NE with strictly
positive probability, by the choice of the other’s mixed action
p−k, for any k ∈ {D,A}; and ii) the actions that are not
played at the NE (their probability equals 0 at the NE) give
strictly lower payoffs than the ones that are played (see i)),
for both players. Formally, this is stated in the following.
Definition 3. A mixed strategy profile (p∗D, p
∗
A) is a mixed NE
for the game G if it is an NE for the extended game G̃ and
the following conditions are met:
1) both players are indifferent among their own pure ac-
tions that are played with positive probability at the NE
ũD(dj , p
∗
A) = ũD(di, p
∗
A), ∀dj , di ∈ I
∗
D,
ũA(p
∗
D, aj) = ũA(p
∗
D, ai), ∀aj , ai ∈ I
∗
A.
2) the pure actions that result in strictly smaller payoffs
are played with zero probability at the NE
ũD(dj , p
∗
A) < ũD(di, p
∗
A), ∀dj /∈ I
∗
D, di ∈ I
∗
D,
ũA(p
∗
D, aj) < ũA(p
∗
D, ai), ∀aj /∈ I
∗
A, ai ∈ I
∗
A
where the sets I∗k ⊆ Sk,∀k denote the actions that are played
with strictly positive probability at the NE: I∗D = {dj ∈ SD :
p∗D,j > 0} and I
∗
A = {aj ∈ SA : p
∗
A,j > 0}.
All defender’s actions that are not in the set dj /∈ I∗D have
zero probability at the NE p∗D,j = 0 (they are not played at
all at the NE) and the same goes for the attaker, all actions
aj /∈ I∗A have zero probability p
∗
A,j = 0 at the NE. Definition 3
provides a simple way to compute the mixed NEs by solving
a system of linear equations and checking some conditions,
which we adopt in this work.
VI. SIMULATION RESULTS
In this section, we perform simulations to show the ef-
fectiveness of the proposed defense. All the simulations are
carried out using the MATPOWER simulator.
First, we examine the D-FACTS deployment set problem.
We perform simulations using the IEEE-14 bus system. As
proposed in Section V-A, we solve the minimum weight
feedback edge set problem for the graph corresponding to the
IEEE-14 bus system. Following this approach, the D-FACTS
deployment set is given by LD = {1, 3, 5, 8, 9, 18, 19}. We
then perturb the reactances of all the links in the set LD.
We simulate physical attacks against the three most important
links in the system, i.e., Links 1, 2 and 3 (which have the
maximum power flow among all the links in the bus system)
by disconnecting the links (one at a time), and injecting a
corresponding CCPA of the form a = ∆Hθp, where both
1 2 3 4 5 6 7 8 9 10
0
0.2
0.4
0.6
0.8
1
Line 1
Line 2
Line 3
Fig. 2: Attack detection probability as a function of the
percentage change (η) in the link reactance.
Bus system |L| |LD|
IEEE 9-bus system 9 1
IEEE 14-bus system 20 7
IEEE 24-bus system 38 15
IEEE 39-bus system 36 8
TABLE I: Size of the D-FACTS deployment set |LD| for
different IEEE bus systems.
∆H and θp are computed using outdated knowledge of the
system. We plot the BDD’s attack detection probability for
each case in Fig. 2 as a function of the percentage change
in line reactances. It can be observed that the CCPAs can be
detected with a high probability following the MTD approach.
Moreover, about 5 − 6% perturbation in the line reactances
is sufficient to achieve a high detection rate. We also enlist
the size of the D-FACTS deployment set for different IEEE
bus systems in Table I. It can be observed that the proposed
algorithm enables the defender to protect all the links in the
system with only a few D-FACTS devices. Moreover, this is
also the minimum-sized D-FACTS deployment set that can
detect any CCPA against the grid. From the table, we can also
conclude that |LD| depends on not just the size of the bus
system, but also its actual topology (e.g., |LD| = 15 for the
24 bus system, where as |LD| = 9 for the 39-bus system).
Finally, we show the effectiveness of the game-
theoretic approach in reducing the operator’s defense
cost. The simulations are done on a IEEE-14 bus
system. The generation cost is assumed to be linear,
i.e., Ci(Gi,t) = ciGi,t. The generators’ capacities at
buses 1, 2, 3, 6, 8 are Gmax = 300, 50, 30, 50, 20 MWs and
ci = 20, 30, 40, 50, 35 $/MWh respectively. fmax is chosen to
be 160 MWs for link 1, and 60 MWs for all other links. We
consider two load conditions: (i) a heavily loaded system,
scenario 1 with the load values at Bus 1 to 14 given by
0, 21.7, 94.2, 47.8, 7.6, 11.2, 0, 0, 29.5, 9, 3.5, 6.1, 13.5, 14.9
MWs respectively, and (ii) a lightly loaded system,
scenario 2 with the load values at Bus 1 to 14 given
by 0, 100, 94.2, 47.8, 30, 11.2, 0, 0, 0; 0, 0, 0, 0, 0 MWs
respectively. We consider five MTD perturbation strategies for
the defender, i.e., d1 = {1}, d2 = {1, 3}, d3 = {1, 3, 5}, d4 =
{1, 3, 5, 8}, d5 = {1, 3, 5, 8, 9, 18, 19}. We note that d5 = LD,
which protects all the links of the system from CCPA. The
Load scenario NE D-FACTS
perturbation set
Defense cost
Scenario 1 {1,3,5,8,9,18,19} 11.62 %
Scenario 2 {1,3,5,8} 2.86 %
TABLE II: D-FACTS perturbation set and the defense cost (the
percentage increase in OPF cost) computed using the game-
theoretic approach for different load scenarios.
attacker in turn launches a CCPA by disconnecting one of
the links at a time. Under this set-up, we compute the NE
solution in each of two scenarios according to Definition 3
and the results are listed in Table II. It can be observed
that the D-FACTS perturbation sets in the two scenarios are
different. While, in the heavily loaded scenario (scenario 1),
all the links in LD need to be perturbed, in the lightly loaded
scenario (scenario 2), it is sufficient to perturb only a subset
of links. The rationale is that in the lightly loaded scenario,
only a subset of links need to be protected from physical
attacks, since the attacker is unlikely to target the unimportant
links (i.e., the links that have very little power flow). We
also list the defense cost, which is the percentage increase
in the OPF cost. The NE solution of scenario 2 incurs much
lower defense cost, since only a subset of links are perturbed.
The above experiments show that the MTD perturbation set
depends on the operational state of the system. By following
the proposed game-theoretic approach, the operator can
reduce its defense cost.
VII. CONCLUSIONS AND FUTURE WORK
In this work, we have proposed a novel strategy to detect
CCPAs based on MTD and presented MTD design criteria
in this context. We have identified the subset of links for D-
FACTS device deployment that enables the defender to detect
physical attacks against any link in the system. Further, to
reduce the operator’s defense cost, we have identified the set
of links whose reactances must be perturbed at the operational
time based on a game-theoretic approach.
There are still many open problems. First, D-FACTS devices
are traditionally deployed in the grid with an objective of
minimizing the transmission losses [23]. On the other hand, in
this work, we discuss the D-FACTS device deployment prob-
lem from a security point of view only. These considerations
suggest that the D-FACTS deployment problem will generally
involve a trade-off between minimizing the transmission power
losses and the security application. Another important problem
arises in the game-theoretic formulation. Definition 3 provides
a simple way to compute the mixed NEs by solving a system
of linear equations and checking some conditions. Still, in
order to use it, one would have to know in advance the
faces of the simplex ∆D × ∆A on which the NE (p∗D, p
∗
A)
lies, i.e., one would have to know the sets I∗D and I
∗
A for
all NEs in advance. An exhaustive search has exponential
complexity: the (ND +NA)-dimesional simplex has 2ND+NA
faces and all possibilities will have to be considered. Thus, a
low-complexity algorithm must be found to compute the NE.
We plan to investigate these issues in our future work.
REFERENCES
[1] “Analysis of the cyber attack on the Ukrainian power grid,” http://bit.
ly/2ohNwJ1.
[2] “Hackers infiltrated power grids in U.S., Spain,” https://bit.ly/2WxFxoj.
[3] S. Soltan, M. Yannakakis, and G. Zussman, “Joint cyber and physical
attacks on power grids: Graph theoretical approaches for information
recovery,” in Proc. ACM International Conference on Measurement and
Modeling of Computer Systems (SIGMETRICS), 2015, pp. 361–374.
[4] Z. Li, M. Shahidehpour, A. Alabdulwahab, and A. Abusorrah, “Bilevel
model for analyzing coordinated cyber-physical attacks on power sys-
tems,” IEEE Trans. Smart Grid, vol. 7, no. 5, pp. 2260–2272, Sep. 2016.
[5] ——, “Analyzing locally coordinated cyber-physical attacks for unde-
tectable line outages,” IEEE Trans. Smart Grid, vol. 9, no. 1, pp. 35–47,
Jan. 2018.
[6] R. Deng, P. Zhuang, and H. Liang, “CCPA :Coordinated cyber-physical
attacks and countermeasures in smart grid,” IEEE Trans. Smart Grid,
vol. 8, no. 5, pp. 2420–2430, Sept. 2017.
[7] D. P. Shepard, T. E. Humphreys, and A. A. Fansler, “Evaluation of the
vulnerability of phasor measurement units to GPS spoofing attacks,” In-
ternational Journal of Critical Infrastructure Protection (IJCIP), vol. 5,
pp. 146–153, 2012.
[8] D. Divan and H. Johal, “Distributed FACTS; A new concept for realizing
grid power flow control,” IEEE Trans. Power Syst., vol. 22, no. 6, pp.
2253–2260, Nov 2007.
[9] S. Lakshminarayana and D. K. Y. Yau, “Cost-Benefit analysis of moving-
target defense in power grids,” in Proc. IEEE/IFIP Dependable Systems
and Networks (DSN), June 2018, pp. 139–150.
[10] Y. Liu, P. Ning, and M. K. Reiter, “False data injection attacks against
state estimation in electric power grids,” in Proc. ACM Conference on
Computer and Communications Security (CCS), 2009, pp. 21–32.
[11] L. Xie, Y. Mo, and B. Sinopoli, “Integrity data attacks in power market
operations,” IEEE Trans. Smart Grid, vol. 2, no. 4, pp. 659–666, Dec
2011.
[12] T. T. Kim and H. V. Poor, “Strategic protection against data injection
attacks on power grids,” IEEE Trans. Smart Grid, vol. 2, no. 2, pp.
326–333, June 2011.
[13] K. L. Morrow, E. Heine, K. M. Rogers, R. B. Bobba, and T. J. Overbye,
“Topology perturbation for detecting malicious data injection,” in Proc.
International Conference on System Sciences, Jan 2012, pp. 2104–2113.
[14] M. A. Rahman, E. Al-Shaer, and R. B. Bobba, “Moving target defense
for hardening the security of the power system state estimation,” in Proc.
First ACM Workshop on Moving Target Defense, 2014, pp. 59–68.
[15] C. Liu, J. Wu, C. Long, and D. Kundur, “Reactance perturbation for
detecting and identifying fdi attacks in power system state estimation,”
IEEE Journal of Selected Topics in Signal Processing, vol. 12, no. 4,
pp. 763–776, Aug 2018.
[16] M. Esmalifalak, G. Shi, Z. Han, and L. Song, “Bad data injection attack
and defense in electricity market using game theory study,” IEEE Trans.
Smart Grid, vol. 4, no. 1, pp. 160–169, March 2013.
[17] A. Sanjab and W. Saad, “Data injection attacks on smart grids with
multiple adversaries: A game-theoretic perspective,” IEEE Trans. Smart
Grid, vol. 7, no. 4, pp. 2038–2049, July 2016.
[18] A. Wood and B. Wollenberg, Power Generation, Operation, and Control.
A Wiley-Interscience, 1996.
[19] X. Li, H. V. Poor, and A. Scaglione, “Blind topology identification for
power systems,” in Proc. IEEE International Conference on SmartGrid
Communications (SmartGridComm), Oct 2013, pp. 91–96.
[20] S. Lakshminarayana, F. Wen, and D. K. Y. Yau, “Trade-offs in data-
driven false data injection attacks against the power grid,” in Proc. IEEE
International Conference on Acoustics, Speech and Signal Processing
(ICASSP), Apr. 2018, pp. 2022–2026.
[21] J. A. Bondy and U. S. R. Murty, Graph Theory with Applications.
London : Macmillan, 1976.
[22] D. Fudenberg and J. Tirole, Game theory. MIT Press, 1991.
[23] K. M. Rogers and T. J. Overbye, “Some applications of distributed
flexible AC transmission system (D-FACTS) devices in power systems,”
in Proc. North American Power Symposium (NAPS), Sept 2008, pp. 1–8.
http://bit.ly/2ohNwJ1
http://bit.ly/2ohNwJ1
https://bit.ly/2WxFxoj
I Introduction
II Prior Work
III System Model
IV Moving-Target Defense for CCPAs
V Solution to the MTD Design Problem
V-A D-FACTS Deployment
V-B MTD Perturbation Selection Using Game Theory
V-B1 Game Formulation
V-B2 Solving the Game Formulation
VI Simulation Results
VII Conclusions and Future Work
References
| 1cybersec
| arXiv |
Categorical introduction to Algebra and Topology. <p>At the moment I am reading books on Algebra and on Category theory. More exactly, I started working through the book <em>Algebra</em> by Serge Lang. I have read the chapters on groups and rings, but then my motivation somehow disappeared and I turned to category theory.</p>
<p>More exactly, I started reading <em>Categories for the Working Mathematician</em> by Saunders MacLane. I now feel comfortable with all the concepts discussed in the first five Chapters, i.e. categories and functors and the usual formulations of universal properties.</p>
<p>I would really like to go on reading about algebra, but once I understood the strucutrual approaches to Mathematics, I can hardly imagine to continue doing all the awful calculations, basic Algebra books like Lang's are filled with, instead of using universal properties and so on.</p>
<p>So basically, my question is, if there are books on Algebra, not assuming any algebraic knowledge, but extensively using category-theoretic methods. Of course, it is very non-standard to cover all the basic category theory before turning to applications in Algebra, but I hope someone knows a book or some lecture notes satisfying my needs.</p>
<p>Furthermore, I would like to learn some topology. In this field I have even less knowledge than in Algebra, i.e. I don't even know the definition of a topological space. My question is the same as with Algebra: Is there a categorical/conceptional introduction to general topology?</p>
| 0non-cybersec
| Stackexchange |
Any FS image + declarative spec of the format in Kaitai Struct can be mounted now as a real filesystem. | 1cybersec
| Reddit |
Synchronise Google Drive when not logged in. <p>I have installed Google Drive on a server. When I login to the server, Google Drive starts automatically and synchronizes files, pulling changes down from the cloud. All good so far. However, I would like the sync to run even if I am not logged in.</p>
<p>Is there any way to start the sync process automatically, maybe as a scheduled task?</p>
<p><sub>Background: I have other jobs on the server which distribute the files by FTP so I would like the server copies of the files to be up to date.</sub></p>
<p><sub>(Windows Server 2008 R2)</sub></p>
| 0non-cybersec
| Stackexchange |
Join multiple table using generic repository patten with Entity framework with unit of work. <p>I am developing a web application using MVC4 with Entity framework 5.</p>
<p>I have created generic repository for accessing database with unit of work. </p>
<p>Having the below two repository,</p>
<ul>
<li>CustomerRepository - Customer table</li>
<li>LibraryRepository - Library table</li>
</ul>
<p>These two tables are not linked with each other( there is no foreign key relation ). </p>
<p>Want to write a query by combining these repository. Is possible to write a query by combining two different repository?</p>
<p>If yes, please let me know the way.</p>
| 0non-cybersec
| Stackexchange |
Odds of outcome with P probability repeated N times. <p>If I have 100 hard drives, and the odds of a hard drive failing on a given week are 1%, what is the probability of 8 (or more) hard drives failing on the same week?</p>
<p>I realize this is a fairly basic probability question but I can't quite figure out how to approach the problem and which combinations/permutations/binomials/products etc to use to "Frame" the problem mathematically.</p>
<p>The best I can come up with is a more generalized statement of the problem: "Given an event with probability P, what is the probability Q of the event occurring <em>at least</em> N times out of T trials?"</p>
| 0non-cybersec
| Stackexchange |
Is changing upper case to lower case URLs bad for SEO?. <p>When building an new website with same URL structure: if the old website has URLs appearing as e.g. www.example.com/ServicePage, what, if any, effect will changing the URLs to www.example.com/servicepage have on the site's SEO, given that there are probably links pointing to the existing URLs with the first format? </p>
<p>I would not have thought any, since when typing the second format into the browser, it resolves to the first format with no apparent redirection. But I want to be clear before doing anything. </p>
<p>Thank you for the advice. </p>
| 0non-cybersec
| Stackexchange |
MRW I tell the ladies about my Steam library. | 0non-cybersec
| Reddit |
Transaction records?. <p>Can you track your payment if you do a transaction from person to person for a house rental if the seller doesn't follow through with their end of the deal and doesn't send the keys can you get your money back? </p>
<p>Or in other words is there a record of your transaction so you can claim a dispute or track down the person who didn't follow through? </p>
<p>What safety do i have in this aspect for example i am applying for rental house but i found out they're in the states and I'm in Canada so they have to send me they keys but they want the payment first through btc wallet so if i do this and send the bitcoins and he doesn't send me the keys and i find out it was a scam is there a way for me to recover my payment? </p>
| 0non-cybersec
| Stackexchange |
Why take full backups when you can do COPY_ONLY?. <p>With a SQL Server 2012 availability group, you can only take <code>COPY_ONLY</code> full backups on replica. You can make regular <code>BACKUP LOG</code>.</p>
<p>As <a href="http://sqlmag.com/blog/breaking-backup-chain-redux-or-eating-crow" rel="nofollow noreferrer">it's possible to restore logs backups</a> after a database restoration from a <code>COPY_ONLY</code> dump, do we really need to take full (non-<code>COPY_ONLY</code>) backups?</p>
<p>Yeah, it creates a new LSN sequence, but if we're not doing <code>DIFFERENTIAL</code> backups, is it something we have to think about?</p>
<p>By using only <code>COPY_ONLY</code> backups, I would hope to gain the ability to perform all backups on the read-only replica. My AG is asynchronous, so the backups might be behind the primary, but that is an acceptable risk.</p>
<p>I do take log backups. According to my tests, I'm able to restore any log backup on a database (restored from a <code>COPY_ONLY</code> or not) as soon as the log backup LSN is more recent than the full backup. The full backup changes the <code>database_backup_lsn</code>, the <code>COPY_ONLY</code> doesn't, but it seems it doesn't affect log restore. It seems I just can't restore DIF backups, but I don't need that.</p>
<p>There's a good explanation in the dba.se Q &A:</p>
<p><a href="https://dba.stackexchange.com/a/37071/35661">SQL Server 2008 R2 Restore COPY_ONLY full backup with transaction logs</a></p>
<p>...but it does not answer my question. For now, my conclusions are: Except for the first backup (without which you will not be able to take log backups), we just can work with <code>COPY_ONLY</code> backups if we don't use differentials.</p>
<p>My (general) question is: Do we really need non-<code>COPY_ONLY</code> backups if we don't take differentials, and if yes, why?</p>
| 0non-cybersec
| Stackexchange |
[USA] Cammer captures two drunk drivers. | 0non-cybersec
| Reddit |
Asterisk test ISDN card. <p>I have an AVM ISDN controller C4 plugged into an asterisk machine.</p>
<p>It shows up in the PCI device list as:</p>
<p><code>Digital Equipment Corporation StrongARM DC21285 (rev 04)</code></p>
<p>How can I test this card to see its working from Asterisk, if possible without plugging actual phones into it?</p>
<p>Anybody knows a command for it inside Asterisk's CLI?</p>
| 0non-cybersec
| Stackexchange |
Razor will not render hidden accurate PK in HiddenFor. <p>Running into a weird problem in my ASP MVC 4 site. If the user opens the <code>create</code> form and attempts to add an agent to our database, we naturally run validation on the fields first. If there is an error, we save the agent in incomplete status, and redirect the user back to the create page. </p>
<p>The error comes when the user attempts to re-save the agent. On the first post-back, the agent is saved into the database and a PK is generated. On the second post-back, however, the PK is being sent to the server with a value of <code>0</code> instead of what was just auto-generated.</p>
<p>I've added a <code>HiddenFor</code> on the <code>Create</code> view, however this renders with a value of <code>0</code> each and every time. </p>
<p>I've also stepped through the code to make sure that the PK is being generated after the <code>.Save</code> is called, is still present when <code>return View</code> is called and also ensured that the <code>Model.ID</code> property contains the same value when the view is being rendered. </p>
<p>Regardless, if I right click the page and view the source, the hidden field renders like so: </p>
<pre><code><input data-val="false" data-val-number="The field ID must be a number." data-val-required="The ID field is required." id="ID" name="ID" type="hidden" value="0" />
</code></pre>
<p><strong>Model</strong></p>
<pre><code>public partial class AgentTransmission
{
public int ID { get; set; }
.
.
.
}
</code></pre>
<p><strong>View</strong></p>
<pre><code>@model MonetModelFromDb.Models.AgentTransmission
@{
ViewBag.Title = "Create new Agent";
}
@Html.HiddenFor(model => model.CreatedDate, new { data_val = "false" })
@Html.HiddenFor(model => model.CreatedOperator, new { data_val = "false" })
@Html.HiddenFor(model => model.ReferenceNumber, new { data_val = "false" })
@Html.HiddenFor(model => model.Region, new { data_val = "false" })
@Html.HiddenFor(model => model.INDDist, new { data_val = "false" })
@Html.HiddenFor(model => model.LastChangeDate, new { data_val = "false" })
@Html.HiddenFor(model => model.LastChangeOperator, new { data_val = "false" })
@Html.HiddenFor(model => model.EditTaxId, new { data_val = "false" })
@Html.HiddenFor(model => model.ParentId, new { data_val = "false" })
@Html.HiddenFor(model => model.IsSubstat, new { data_val = "false" })
@Html.HiddenFor(model => model.ID, new { data_val = "false" })
</code></pre>
<p><strong>Rendered HiddenFor Section</strong></p>
<pre><code><input data-val="false" data-val-date="The field CreatedDate must be a date." id="CreatedDate" name="CreatedDate" type="hidden" value="" />
<input data-val="false" id="CreatedOperator" name="CreatedOperator" type="hidden" value="" />
<input data-val="false" id="Region" name="Region" type="hidden" value="NM-834" />
<input data-val="false" id="INDDist" name="INDDist" type="hidden" value="834" />
<input data-val="false" data-val-date="The field LastChangeDate must be a date." data-val-required="The LastChangeDate field is required." id="LastChangeDate" name="LastChangeDate" type="hidden" value="4/8/2015 10:43:30 AM" />
<input data-val="false" id="LastChangeOperator" name="LastChangeOperator" type="hidden" value="TYPCLS" />
<input data-val="false" data-val-required="The EditTaxId field is required." id="EditTaxId" name="EditTaxId" type="hidden" value="False" />
<input data-val="false" data-val-number="The field ParentId must be a number." id="ParentId" name="ParentId" type="hidden" value="" />
<input data-val="false" data-val-required="The IsSubstat field is required." id="IsSubstat" name="IsSubstat" type="hidden" value="False" />
<input data-val="false" data-val-number="The field ID must be a number." data-val-required="The ID field is required." id="ID" name="ID" type="hidden" value="0" />
</code></pre>
<p><strong>Controller</strong></p>
<pre><code> [HttpPost]
[MonetAuthorize]
public ActionResult Create(AgentTransmission agenttransmission, bool andAddAgent = false)
{
.
.
.
//Determine if this is first POST or not
if (agenttransmission.ID > 0)
{
db.Entry(agenttransmission).State = EntityState.Modified;
}
else
{
db.AgentTransmission.Add(agenttransmission);
}
db.SaveChanges();
//Send back to view if errors pressent
if (!String.IsNullOrWhiteSpace(errorMsg))
{
return View(agenttransmission);
}
}
</code></pre>
<p><strong>EDIT</strong></p>
<p>If I remove the <code>HiddenFor</code> helper and simply cut/paste the rendered <code>input</code> tag, I'm able to capture the corret PK value. However, this is a little hacky so I was hoping to find a more elegant solution (if possible)</p>
<pre><code><input data-val="false" id="ID" name="ID" type="hidden" value="@Model.ID" />
</code></pre>
| 0non-cybersec
| Stackexchange |
Regarding Ubuntu 13.10 upgrade. <p>I am planning to install Ubuntu alongside Windows 7 (both fresh as I am buying new laptop) by doing separate installation partition for both OS. I have two ques:</p>
<p>1) For Ubuntu 13.10 it says 9 months support. Does it mean I can't be able to use after 9 months?</p>
<p>2) If I have to update in future to 14.XX LTS system, then will my Windows 7 be affected? I don't want to loose any data and don't want to do fresh installation in future.
Please help me. I am going to use Ubuntu first time.</p>
| 0non-cybersec
| Stackexchange |
Setting network namespace when GDM / graphical login is done. <p>I am trying to get two different users that share a system to have independent network stacks. I think that I can achieve that thanks to namespaces.</p>
<p>At first, I thought of using <code>pam_namespace.so</code>, but that seems to be only for filesystem namespaces.</p>
<p>I am not sure where to "hook" the namespace isolation. It is a multiseat environment, and I am not sure if I can "attach namespaces" according to loginctl or according to who logs in, or some other mechanism.</p>
<p>Is there a standard way of manipulating namespaces on login / on user / on seat?</p>
| 0non-cybersec
| Stackexchange |
Windows security popup first time a user logs in to webserver with windows authentication. <p>Windows Authentication has been enabled on the virtual directory for the website. First time a user logs in with Domain authentication a Windows Security popup window appears. All the user has to do is close it and it won't show up again until a iisreset has been done. The site already have a login screen, so I don't really need that, to be honest, annoying popup. How can I make that popup not show up ever when Windows authentication is enabled? </p>
<p>IIS7 Web server is running on windows 2008 R2 Server.</p>
| 0non-cybersec
| Stackexchange |
Ubuntu 18.04 configure Terminator Shell. <p>I can use the default terminal on Ubuntu for software development but prefer Terminator. </p>
<p>On Ubuntu 16.04, I just installed Terminator and it ran the same way as the normal terminal but on Ubuntu 18.04, I installed Terminator but it seems to default to the bash shell that keeps giving me <strong>Permission denied</strong>.</p>
<p>I tried <code>Preferences -> Profile -> Command</code> and checked both <strong>Run command as a login shell</strong> and <strong>Run a custom command instead of my shell</strong>.</p>
<p>Then put <code>/bin/sh</code> in the window and "Hold the terminal open." <br>
This gives me just a "$ " prompt and the same <strong>Permission denied</strong> response to sudo and the title bar still has <code>/bin/bash</code> </p>
<p>What am I doing wrong?</p>
| 0non-cybersec
| Stackexchange |
What does %5B and %5D in POST requests stand for?. <p>I'm trying to write a Java class to log in to a certain website. The data sent in the POST request to log in is</p>
<p><code>user%5Blogin%5D=username&user%5Bpassword%5D=123456</code></p>
<p>I'm curious what the <code>%5B</code> and <code>%5D</code> means in the key <strong>user login</strong>.</p>
<p>How do I encode these data?</p>
| 0non-cybersec
| Stackexchange |
/r/Android is trending, yay. | 0non-cybersec
| Reddit |
NSNotificationCenter selector not being called. <p>In my iPad app, in one class I register for a notification:</p>
<pre><code>NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self selector:@selector(selectedList:) name:@"TTSelectedList" object:nil];
</code></pre>
<p>My <code>selectedList:</code> method looks like this:</p>
<pre><code>- (void)selectedList:(NSNotification*)notification
{
NSLog(@"received notification");
}
</code></pre>
<p>Then in another class (a <code>UITableViewController</code>) I post that notification when a row is selected:</p>
<pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"posting notification");
[[NSNotificationCenter defaultCenter] postNotificationName:@"TTSelectedList" object:nil];
}
</code></pre>
<p>I can confirm that the notification is being posted, because "posting notification" is logged to the console, but "received notification" is never called, meaning that the notification isn't received and the selector hasn't been called. I can't figure out what's causing this.</p>
<p>Thanks</p>
| 0non-cybersec
| Stackexchange |
Emails sending with the wrong name on Outlook 2011 Mac. <p>Our client has 6 Macs. We recently set up Outlook 2011 with an exchange account for all of the users.</p>
<p>On one of the Macs, I had setup the profile for another user (Person B), before removing it and adding the correct person (Person A).</p>
<p>Now what is happening, is when Person A sends an email to anyone, the recipient receives an email from Person A's email address, but with the name of Person B. Like this:</p>
<pre><code>Person B <[email protected]>
</code></pre>
<p>I can see in the address book, that Person B is indeed next to the email address of Person A, We've removed this several times but it comes back.</p>
<p>Does anyone know why this keeps happening?</p>
| 0non-cybersec
| Stackexchange |
Tracert high latency. <p>I have used tracert command to check local network status, at the second hop I get random- high numbers for latency,(attached file), but when I use ping the total latency has an average of 1ms.</p>
<p>What is the problem?
I really appreciate your help.</p>
<p>BR.
<a href="https://textuploader.com/dbfm6" rel="nofollow noreferrer">tracert</a></p>
| 0non-cybersec
| Stackexchange |
I can't get OS prober to find Ubuntu Server 16.04. <p>My computer was configured to triple boot Ubuntu Server 16.04, Arch Linux, and Gentoo Linux.</p>
<p>After starting the Linux from Scratch project, (I know, I have a problem) I'd inadvertently made it to where my computer wouldn't boot. I was stuck in GRUB Menu. I used my Arch ISO to mount the boot and root partitions for Arch, Chroot into the system, and re-install Grub (In Arch, the package GRUB actually installs GRUB2, so this is NOT grub-legacy). I can now get Arch to boot, but when I run OS-prober, it can't find Ubuntu or Gentoo anymore. At one point, I could get Gentoo to boot, but after some tinkering, I managed to make that break too. In fact, the Grub entry for Gentoo shows the Gentoo kernel using the root partition for Ubuntu instead of the root partition for Gentoo. </p>
<blockquote>
<blockquote>
<blockquote>
<p>inb4 post to Arch/Gentoo.
I'm at a loss and I'm unsure where to post this question, so I've decided to post this to forums for all three distros.</p>
</blockquote>
</blockquote>
</blockquote>
<p>From what I understand, GRUB should be installed on one distro, then use os-prober to find the others. Initially, it was Ubuntu that held the GRUB installation. Now it's Arch. Is it for this reason that Ubuntu won't boot? And if so, how do I fix it? I am trying very hard to figure this out and troubleshoot the issue rather than re-installation. </p>
<ul>
<li>sda2 is boot</li>
<li>sda3 is swap</li>
<li>sda4 is Ubuntu</li>
<li>sda5 is Arch</li>
<li>sda6 is Gentoo</li>
</ul>
| 0non-cybersec
| Stackexchange |
Polycystic kidney disease treatment with stem cell transplant - Stem Cell Transplant. | 0non-cybersec
| Reddit |
How To Replace Unity with Gnome Shell via Ubuntu Software Center?. <p>IMHO, Unity is just as productive and functional as Gnome Shell, and since for me, Gnome Shell looks a lot more stylish, I would like to replace Unity in Ubuntu 11.10 with Gnome Shell.</p>
<p><strong>EDIT:</strong> Without a further thought, I opened the Ubuntu Software Center > searched "Gnome Shell" and installed it. And since I use auto-login, Ubuntu logs-me-into Unity.</p>
<p>To prevent that...</p>
<ul>
<li><p>I want to uninstall Unity completely. How do I do that?</p></li>
<li><p>After doing the above, Gnome Shell loads by default right?</p></li>
</ul>
| 0non-cybersec
| Stackexchange |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.