text
stringlengths
3
1.74M
label
class label
2 classes
source
stringclasses
3 values
TIFU by spilling 4000 gallons of jet fuel.. But seriously, that's like 30,000 dollars worth of fuel that's going to cost at least 100,000 dollars to have cleaned up. Now for the story. I work at an airport as a line service technician, which mostly involves fueling aircraft. The fuel in our trucks comes from tanks we have on the field, which are filled up by tanker trucks a few time a day. So I was checking in this fuel load, and didn't get all the right valves open to direct it to a certain tank, and it re routed to another tank which happened to already be full. Now the fun begins, when the tank gets full, the high level emergency shutoff valves is supposed to kick on and stop the flow of fuel into the tank. The shutoff valve on this tank happened to be broken, thus causing the 4000 gallons of fuel to spray out the top of the tank like a sprinkler. The way I see it, it's as much my fault as it is my supervisors. Apparently this has happened twice before, never this much, but it has happened. Yes, I did have the valves wrong, but my supervisor also failed to fix the faulty equipment.
0non-cybersec
Reddit
Thoughtful Tip's On Gardening A Small Space.
0non-cybersec
Reddit
Former AS Monaco VP Vadim Vasilyev on Kylian Mbappé turning down Real Madrid in summer 2017: "He said to me: 'Deep down, I know it is too early. I am Parisian, I don't want to leave my country like that.'".
0non-cybersec
Reddit
How much does the data model affect scalability and performance in so called &quot;NoSQL&quot; database?. <p>You can't ever have a talk about so called "NoSQL" database without bringing the CAP theorem (Consistency, Availability, Partition : pick two). If you have to pick say, between MongoDB (Partition, Consistency) and CouchDB (Availability, Partition), the first you need to think about is "Do I need correct data or do I need access all the time?".</p> <p>Those new database were <em>made</em> to be partitioned. But what If I <em>don't</em>? What if I just think its pretty cool to have a Key/Value, Column, Document, whatever database instead of a relational one, and just create one server instance and never shard it? In that case, wouldn't I have both availability and consistency? MongoDB wouldn't need to replicate anything, so it would be available. And CouchDB would have only one source of data, so it would be pretty consistent. </p> <p>So that would mean that, in that case, MongoDB and CouchDB would have little difference in term of use case? Well, except of course performance, API, and al, but that would be more like choosing between PostgreSQL and MySQL than having two fundamentally different set of requirements.</p> <p>Am I right here? Can I change a AP or CP database to an AC one by not creating more than one instance? Or is there something that I am missing?</p> <p>Let's ask the question in reverse. What if I take a relational database, let say MySQL, and put it in a master/slaves configuration. I don't use ACID transactions If I require that any write be synchronized to the slave immediately, wouldn't that make it a CP database? And what if I synchronise it a some predefined intervals, and it doesn't matter if a client read stale data from a slave. Wouldn't that make it an AP database? Wouldn't that mean that if I give up ACID compliance I can still use the relationnal model for a partionned database?</p> <p>In essence : is scalability about what you are ready to give up in the CAP theorem, more than the underlying data model? Does having Column, Document, Key Value, whatever give a boost to scalability over a relational model? Could we design a relational database designed from the ground up for partition tolerance? (Maybe it already exists). Could we make NoSQL database ACID compliant?</p> <p>Sorry, its a lot of questions, but I have read a lot about NoSQL database recently and it seem to me that the biggest benefit of using them is that they fit better the "shape" of your data, rather than just the partition, CAP and giving up ACID compliance. After all, not everyone has so much data that they need to partition it. Is there a performance/scalability benefit to not using the relational model <em>before I even think about partitioning my data?</em></p>
0non-cybersec
Stackexchange
i just love hot and humid days.
0non-cybersec
Reddit
Two of my [51m] kids [18f and 13m] hate each other.. I have 4 kids: 18f, 15f, 13m, and 10m. Through the years, each of them have gone through "phases" of not getting along. However, they've always grown out of it after a couple years; all except the 18 and 13 year old. There are no other major ongoing tensions with ANY of them. They are both close with the other 2 kids, but they can't stand each other. The first explanation I have is that their personalities just clash. They always have, and I fear they always will. Since my son could talk, he's been arguing with his oldest sister. I'm ashamed to admit it, but parenting did play a role. Their mom left about 5 years ago, but she mentally checked out after the birth of our youngest. Money was tighter back then so I was working 2-3 jobs at the time. From the time she was 8 or 9, my oldest daughter would look after her young siblings after school and summers until I got home at 6 or 7 as their mother would spend all her time on the computer. It got to the point where I would have to ask my 9 year old daughter what my 1 year old son was saying, because she was the only one who understood his baby talk. This went on until she was about 13 or 14 when I got a better job and was able to spend more time with them. Because of this, her relationship with her siblings is somewhat skewed; she's a half-mother figure to them. She corrects them like a parent would and this causes countless arguments with her 13 year old brother. I've told her over and over that she needs to stop bossing him around and I can tell she tries, but it's an old habit that was encouraged for years. Her bossiness isn't the sole reason for their fights, but it instigates many of them. They'll bicker over anything and it escalates. Most times, the 13 year old becomes annoyed over a small thing (ex:her telling him to take his elbows off the table) and takes it way too far, calling her names and trying to get on her nerves until she inevitably loses patience with him. They both find entertainment in making the other angry. I know there's still a chance they'll outgrow it, but that seems less and less likely the older they get. Some of the things they've said to each other are just atrocious; my daughter is an amazing and caring person normally, but (unbeknownst to me) she was subjected to years of psychological abuse from her mother and she can become incredibly cruel. I thought the 18 year old moving out would help things, but I've realized while she's been home from college on winter break that nothing has changed. I want ALL my kids to get along and look forward to reunions when they're all grown. How do I go about trying to fix their relationship? --- **tl;dr**: Two of my four kids despise each other. I believe there are 2 reasons: 1) Their personalities clash and 2) the 18 year old was forced into helping raise her siblings when she was younger and still occasionally acts more like a parent than a sister. How can I fix their relationship?
0non-cybersec
Reddit
Touch ID: Biometry is locked out. Code=-8. <p>Im using Touch id to identify iPhone users in my app, when is use <code>canEvaluatePolicy: LAPolicyDeviceOwnerAuthenticationWithBiometrics</code> to evaluate if the user is eligible for using Touch id, but after many failed tries even if the user is eligible for using touch id, it returns <code>FALSE</code>.</p> <p>And that will lead the app to skip this step and thinks that the touch id is not supported in this device.</p> <p>Here is the error i get:</p> <blockquote> <p>Error Domain=com.apple.LocalAuthentication Code=-8 "Biometry is locked out." UserInfo={NSLocalizedDescription=Biometry is locked out.}</p> </blockquote>
0non-cybersec
Stackexchange
Microsoft To-Do&#39;s Open Email in Outlook.exe. <p>When flagging an email in outlook you can set this up to sync between Microsoft To-Do's</p> <p>To-Do's gives you the option to open the flagged message but this opens in outlook online where it would be preferred to open in outlook desktop app.</p> <p>Is this possible?</p> <p><a href="https://i.stack.imgur.com/vO6Ll.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vO6Ll.png" alt="enter image description here" /></a></p>
0non-cybersec
Stackexchange
ZFS Equivalent of lvdisplay snap_percent. <p>I've been using LVM snapshots for backing up MySQL databases. <code>FLUSH TABLES WITH READ LOCK</code> is issued and then <code>lvcreate --snapshot --size 4G</code> etc. Because the database is live while the snapshot is active the <code>snap_percent</code> (amount of snapshot storage being used to track deltas with the original state of the filesystem at the time the snapshot was taken) starts increasing. This <code>snap_percent</code> is monitored day-over-day and the <code>--size</code> is increased in the event it reaches 80%.</p> <p>My question is whether or not there is an equivalent statistic or property in ZFS for determining how much space is being consumed by a snapshot as a percentage of space remaining in the pool? Obviously I don't need to pass a <code>--size</code> parameter to <code>zfs snapshot</code> but how can I determine whether the clone based upon that snapshot is nearing the limits of the pool.</p> <p>Hopefully that makes sense, it sure sounds like a convoluted question now that I read.</p>
0non-cybersec
Stackexchange
リスクアセスメント.
1cybersec
Reddit
TIL how to actually pronounce Friedrich Nietzsche's last name..
0non-cybersec
Reddit
Hell Is For Children. “Do *good girls* keep secrets, Mommy?” As I dreamily tucked my daughter into bed, I was brought back to reality by the weight of her question. “Uhm. . . .” I stammered. “What do you mean, Gracie?” With a yawn, she answered, “I was just wondering.” “We’ll talk about it tomorrow,” I said before I kissed her on the forehead, and I left her bedroom. As I prepared myself to go to bed, I talked with my husband about what Gracie asked me. “She could have overheard someone in church,” Michael suggested. Spitting my mouthwash into the bathroom sink, I expressed my dissatisfaction with his explanation. “I don’t think Father Richards discusses children keeping secrets from their parents in his homilies,” I said as I exited the bathroom, and I climbed into bed with Michael. “What if it was someone in preschool?” “Why do you think that?” “She started preschool yesterday,” I explained. “And she didn’t tell us much about it. What if she has a bully, who tells her to keep it a secret?” Before he could respond, I said, “I’m not jumping to conclusions, Michael.” “I didn’t say anything,” he responded. “I was going to say that it’s not odd for children to keep secrets from their parents.” I murmured, and he continued, “Did you have a bully when you went to *Sunny Days*?” “No,” I admitted. Although my recollections of *Sunny Days* were vague, I couldn’t remember having a bully. “But I don’t want our daughter to keep secrets from us.” “I know that,” he said. “And it’ll be OK. Goodnight, honey.” “Goodnight,” I replied, and we turned off our bedside lamps in unison. Although I more or less accepted Michael’s explanation for Gracie’s question, I didn’t understand something that I withheld from Michael — “*Good girls* keep secrets.” Why did that sentence unnerve me? It caused a sense of unease to build within me, but I didn’t understand why. As I ruminated on these thoughts, I eventually fell asleep. The room was dark, the lone source of illumination coming from the candles held by the group of people in brown robes. I was a child, standing in the center of a pentagram on the floor. A woman in a brown robe turned me around to face her, and she held a disposable paper cup to my lips, pouring its contents into my mouth. The cup was filled to the brim with blood. The woman crouched down to my level, and she said, “*Good girls* keep their secrets.” I screamed, a loud, piercing shriek, and then I woke up. My face was stained with tears. I considered waking Michael up, but I decided against it. *It was just a nightmare*. I lay myself back down on the bed. *Right?* On the following day, I decided to speak with Natalie, the head teacher of *Sunny Days Daycare*. When I picked Gracie up from preschool, I saw that she was sitting at her desk in the front of the room, reading from a red folder as parents picked up their children. I walked toward her with Gracie’s hand in mine. After she saw us approach her, she closed the folder, placed it in her desk, and she arose from her seat. “Mrs. Hendricks,” she said as she shook my hand. “Natalie.” “Please,” I said with a shake of the head. “Julie.” “Was there anything you wanted to talk about, Julie?” She smiled. “I wanted to know how well Gracie is doing in school,” I answered. “Fantastic.” “Has she made any friends?” I asked. “Mommy. . . .” Gracie said as she tugged on my sleeve. “I want to go home.” “Wait a minute, baby,” I replied. “*Has* she made any friends?” “Yes,” Natalie answered. “She is a sweetheart. All of us here at Sunny Days love her.” I smiled before I laughed, “My husband says I worry too much, which I’m inclined to believe is true.” “It’s OK,” she replied. “I understand a mother’s concern for her daughter’s welfare.” “Thank you for speaking with me.” “No problem,” she said. “I’ll see you tomorrow, right, Gracie?” “Right,” she said. We said goodbye to Natalie, who began to talk with other parents. As Gracie and I left the preschool, we entered my car for the drive home. I watched as Natalie closed the blinds of the window in the front room. I wanted to believe that I was worrying too much, but I couldn’t shake the feeling that there was something more to *Sunny Days Daycare*. However, life took precedence, and I fell into a routine. I would drop Gracie off in the morning, go to work, and I would pick Gracie up on the way home. As I waited one day for class to be dismissed, I looked at the drawings made by the class hanging on the wall in the front room. I recalled a memory of my experience at *Sunny Days*, where my teacher hung my drawing on the wall, and she patted my head, referring to me as a “*Good little girl*.” Despite my best efforts, I could not remember the content of the drawing. The class was dismissed, and Gracie came up to me. As we hugged each other, I saw a teacher leave a room toward the back of the building with a sign inscribed, “*PLAYROOM*,” and she locked the door behind her. After Gracie and I greeted each other, I noticed the distinct smell of candles emanating from the back of the building. It reminded me of church. Natalie approached us, and I asked her, “Do you smell that?” “What?” “It smells like candles. Blown out candles. . . .” I trailed off. “I’m sorry,” Natalie said. “I don’t.” “Do you, Gracie?” I asked. She shook her head, and therefore I dismissed it. Gracie bade farewell to Natalie, and we left for home. As the week went on, Gracie continued to acclimate to her new environment. She made friends — “Boys and girls, Mommy!” — and she was chosen to be the caretaker of a rabbit, whom Natalie introduced as the class pet. Gracie was expected to name him, but she was unable to think of a name that she liked. After I suggested it, Gracie christened the class pet, “Thumper.” The week seemed to be an idyll. On Friday of the first week of preschool, I lavished Gracie with praise as I dropped her off, and I promised her that she and I would join her father at the local ice cream parlor to celebrate her first week of school. With a smile on her face, she left the car in haste, and she waved goodbye before she entered the school with Natalie and her fellow classmates. As I drove toward work, I noticed something in the rearview mirror. *Gracie’s bookbag*. I looked at the time on the car radio, and I deduced that I would be able to give Gracie her bookbag and make it to work on time. I turned around, and I headed back toward *Sunny Days*. I parked in the parking lot, and I grabbed her bookbag from the backseat, looking into it to ensure that she had everything that she needed in it. In her bookbag, I found drawings, which gave me pause as I was under the impression that all of her drawings were given to the teachers to hang on the wall of the front room of the school. I looked at them with a smile on my face. They depicted scenes from home with her father and me, school with her friends, her grandparents’ houses. However, I found a piece of paper torn haphazardly from a larger piece of paper, and the words, “*Miss Natalie is*. . . .” written on it with a red crayon. I put the papers back into her bookbag, and I exited my car. It was then that I noticed the blinds of the window in the front room were closed, and no light emanated from within. Confused by the empty appearance of the school, I walked slowly to the front door, which was unlocked. I was going to alert the teachers to my presence, but a voice within told me, *Be quiet*. I smelled the same distinct smell of candles. As I walked through the darkened school, I seemed by rote to be heading toward the Playroom. *What is going on?* I stopped at the door to the Playroom, and I heard indistinct voices within. Through the din of voices, I was able to distinguish the voice of Natalie. However, I could not hear everything that she was saying — “Good boys, *good girls*. . . . Your parents have given you to us. . . . *Keep your secrets*.” As I debated with myself to open the door, I heard a loud, piercing shriek, and the sound of children crying. The door seemed to open on its own, which gave me a chance to peek inside. Gracie, dressed in a tattered white nightgown, lying in the center of a pentagram on the floor, which was surrounded by adults in hooded brown robes, all of whom were holding onto her classmates. Natalie, dressed in a brown robe, holding a dead Thumper in her hands, its white fur turning pink as a result of the blood gushing from its neck. She held the animal over Gracie’s head, draining its blood into her mouth. Gracie appeared weak as Natalie traced a pentagram onto her forehead with Thumper’s blood. I held my hand to my mouth in shock. As I saw my daughter forced to drink the blood of her pet, I attempted to rush into the playroom, but I was held back as if by a force that I could not see. *Get out*. I was pushed back in the direction of the front room. When I attempted again to rush into the playroom, I was pushed toward the front door. As I made my third attempt, I was struck by an intense pain in my head, which caused me to collapse onto the floor. The pain was accompanied by memories from *Sunny Days*, which flashed in my mind as if they were slides in a projector — the disposable paper cup with its crimson contents, pink rabbits twitching, “The Master” — a man, physically beautiful, dressed entirely in black, who asked us to sign his book. I was eventually pushed out of the front door, falling back onto the gravel in the parking lot. A wave of nausea overcame me, and I vomited into the grass. The memories of *Sunny Days* concluded — the teacher, a woman in her seventies, caressing my tear–stained face, saying, “You’re a *good girl*, Julie. And what do *good girls* do?” “*Good girls keep their secrets*.”
0non-cybersec
Reddit
Picoctf 2017 starts Friday!.
1cybersec
Reddit
java String.format: numbers with localization. <p>Is it possible to localize numbers in String.format call the same way as NumberFormat.format does?</p> <p>I've expected it simply to use</p> <pre><code>String.format(locale, "%d", number) </code></pre> <p>but this doesn't return the same result as if using NumberFormat. For example:</p> <pre><code>String.format(Locale.GERMAN, "%d", 1234567890) </code></pre> <p>gives: "1234567890", while </p> <pre><code>NumberFormat.getNumberInstance(Locale.GERMAN).format(1234567890) </code></pre> <p>gives: "1.234.567.890"</p> <p>If it can't be done, what's recommended way for localizing text including numbers? </p>
0non-cybersec
Stackexchange
How can I mount the SSD drive on Amazon&#39;s m3.medium?. <p>Amazon's <a href="http://aws.amazon.com/ec2/instance-types/" rel="noreferrer"><code>m3.medium</code></a> instance comes with a 4GB SSD Drive:</p> <p><img src="https://i.stack.imgur.com/SSDpY.png" alt="enter image description here"></p> <p>But I can't seem to find the device using <code>df</code>:</p> <pre><code>$ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 20G 2.9G 16G 16% / none 4.0K 0 4.0K 0% /sys/fs/cgroup udev 1.9G 8.0K 1.9G 1% /dev tmpfs 375M 228K 375M 1% /run none 5.0M 0 5.0M 0% /run/lock none 1.9G 0 1.9G 0% /run/shm none 100M 0 100M 0% /run/user </code></pre> <p>Or at <code>/dev</code>:</p> <pre><code>$ ls /dev autofs hvc0 i2c-5 loop7 ram0 ram7 tty1 tty21 tty33 tty45 tty57 ttyS1 ttyS21 ttyS5 vcs6 zero block hvc1 i2c-6 loop-control ram1 ram8 tty10 tty22 tty34 tty46 tty58 ttyS10 ttyS22 ttyS6 vcs7 btrfs-control hvc2 i2c-7 mapper ram10 ram9 tty11 tty23 tty35 tty47 tty59 ttyS11 ttyS23 ttyS7 vcsa char hvc3 input mem ram11 random tty12 tty24 tty36 tty48 tty6 ttyS12 ttyS24 ttyS8 vcsa1 console hvc4 kmsg net ram12 rfkill tty13 tty25 tty37 tty49 tty60 ttyS13 ttyS25 ttyS9 vcsa2 core hvc5 log network_latency ram13 shm tty14 tty26 tty38 tty5 tty61 ttyS14 ttyS26 uinput vcsa3 cpu hvc6 loop0 network_throughput ram14 snapshot tty15 tty27 tty39 tty50 tty62 ttyS15 ttyS27 urandom vcsa4 cpu_dma_latency hvc7 loop1 null ram15 snd tty16 tty28 tty4 tty51 tty63 ttyS16 ttyS28 vcs vcsa5 disk i2c-0 loop2 port ram2 stderr tty17 tty29 tty40 tty52 tty7 ttyS17 ttyS29 vcs1 vcsa6 ecryptfs i2c-1 loop3 ppp ram3 stdin tty18 tty3 tty41 tty53 tty8 ttyS18 ttyS3 vcs2 vcsa7 fd i2c-2 loop4 psaux ram4 stdout tty19 tty30 tty42 tty54 tty9 ttyS19 ttyS30 vcs3 vga_arbiter full i2c-3 loop5 ptmx ram5 tty tty2 tty31 tty43 tty55 ttyprintk ttyS2 ttyS31 vcs4 xen fuse i2c-4 loop6 pts ram6 tty0 tty20 tty32 tty44 tty56 ttyS0 ttyS20 ttyS4 vcs5 xvda1 </code></pre> <p>The small print (with a <code>*</code>) suggests that I should have inserted some sort of parameter during launch:</p> <blockquote> <p>*6 Instance storage for M3 instances will be provided when these block device mappings are specified in the instance launch parameters.</p> </blockquote> <p><strong>Do I have to re-launch the instance to gain access to the SSD drive? Which parameters are required during launch?</strong></p>
0non-cybersec
Stackexchange
[WP] A day in the life of a US American in 2016... in the alternate universe where the Native Peoples beat the Europeans..
0non-cybersec
Reddit
How much truth do you all think there is behind the statement “a drunk mind speaks a sober heart”?. I’ve definitely said things and confessed feelings to people while being drunk that I never had the courage to say sober, and on the other hand I’ve also said things that I really didn’t mean and absolutely regretted it later on. What do y’all think about it?
0non-cybersec
Reddit
Ever heard of The Battle of the Oranges? A peculiar way to celebrate Carnival days in northern Italy.
0non-cybersec
Reddit
Native JS add class using a counter reset on each parent class. <p>I have this structure:</p> <pre><code>&lt;div class=&quot;parent&quot;&gt; &lt;div class=&quot;child&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;parent&quot;&gt; &lt;div class=&quot;child&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child&quot;&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I need to increment on each child div by one and reset the counter when it passes to the new parent class. I can do this easily with Jquery using <code>each</code> but I am struggling to make it work with native JavaScript, since the project I am working on does not use Jquery. The structure should look like this:</p> <pre><code>&lt;div class=&quot;parent&quot;&gt; &lt;div class=&quot;child-1&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child-2&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child-3&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child-4&quot;&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class=&quot;parent&quot;&gt; &lt;div class=&quot;child-1&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child-2&quot;&gt;&lt;/div&gt; &lt;div class=&quot;child-3&quot;&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I have been using <code>var ParentDiv= document.querySelectorAll(&quot;.parent&quot;);</code> and <code>ChildDiv = document.querySelectorAll(&quot;.child&quot;);</code></p> <p>I've got a counter going on with a <code>for</code> loop but not been able to get it to restart the counter on each parent. Any help to point me out how I can accomplish this?</p>
0non-cybersec
Stackexchange
Lebesgue integral, differentiation under the integral sign. <p>Let $f:[0,1] \times [0,1] \to \mathbb R$ be a function such that:</p> <p>(a) for each $x \in [0,1]$, the function $y \to f(x,y)$ is Lebesgue integrable on $[0,1]$.</p> <p>(b) $\dfrac{\partial f}{\partial x}(x,y)$ is a bounded function of $(x,y)$.</p> <p>Show that for each $x$, the function $y \to \dfrac{\partial f}{\partial x}(x,y)$ is measurable and $\dfrac{d}{dx} \int_0^1 f(x,y)dy=\int_0^1 \dfrac{\partial f}{\partial x}(x,y)dy$.</p> <p>I am a bit stuck on the exercise, to prove that $g_x(y)=\dfrac{\partial f}{\partial x}(x,y)$ I did the following:</p> <p>If for each $x$, $f_x(y)=f(x,y)$ is integrable, by definition, it is measurable. So given $x$ in [0,1), the function $f_{x+\frac{1}{n}}$ is measurable for each $n&gt;\dfrac{1}{x+1}$ and the function $f_{1-\frac{1}{n}}$ is measurable for $x=1$, but then for $0 \leq x &lt;1$ we have $$\dfrac{\partial f}{\partial x}(x,y)=\lim_{n \to \infty} \dfrac{f(x+\frac{1}{n},y)-f(x,y)}{\frac{1}{n}}$$</p> <p>and for $x=1$, $$\dfrac{\partial f}{\partial x}(x,y)=\lim_{n \to \infty} \dfrac{f(x-\frac{1}{n},y)-f(x,y)}{-\frac{1}{n}}$$</p> <p>Since each function is a pointwise limit of measurable functions, then for each $0 \leq x \leq 1$, $\dfrac{\partial f}{\partial x}(x,y)$ is a measurable function.</p> <p>I am not sure if my reasoning is correct and I don't know what to do for the last part of the exercise. Any help would be greatly appreciated. Thanks in advance</p>
0non-cybersec
Stackexchange
Need to find an inhibitor for a future lab experiment!. I've been looking online like my professor said to pick an inhibitor and then email it to him for approval for our lab experiment in two weeks. I really can't find anything but descriptions of inhibitors so I thought I'd ask you guys. Are there any basic inhibitors that you know of that I could use? Thanks!
0non-cybersec
Reddit
How to Install a Macromedia Dreamweaver using Wine. <p>I need to install Macromedia Dreamweaver in Ubuntu14.04. I have Wine1.6 installed in my system. I have a setup file of Macromedia Dreamweaver of Windows. Is there possible to install windows setup file directly in Ubuntu using wine? If is it possible,I need to know Installation steps. </p>
0non-cybersec
Stackexchange
Rename outlook2007 categories not working. <p>I'm new to outlook 2007 and I'm trying to rename a category. Acordingly to MS, I can achieve it by just renaming it:</p> <p><a href="http://office.microsoft.com/en-us/outlook/HA012316361033.aspx" rel="nofollow noreferrer">http://office.microsoft.com/en-us/outlook/HA012316361033.aspx</a></p> <p>But as soon as I click the OK button, confirming the change, it returns to it's original value. For instance, if I rename the "Blue Category" to "Home" it will accept without erros. But, when I click again in the Categorize icon, I'll see that the "Blue Category" is still there, and my "Home" category does not exist.</p> <p>Has someone experienced this kind of problem?</p> <p>TIA,</p> <p>Bob</p>
0non-cybersec
Stackexchange
Running a website on Pi Zero?. Would it have the power to run a very simple Python flask server? It would only have one visitor (me). The only thing I'm worried about is that I would like to also have it run a headless browser, like Firefox using selenium. I know this would probably be pushing the Zero, but I'm strapped for cash and would rather not buy the 3.
0non-cybersec
Reddit
How to delete a record using GQL?. <p>I need to iterate and delete all records of my datastore. I am using Google App engine Launcher to test it on local host. How to do it?</p> <p>When I am trying to delete all recors in Person model that way:</p> <pre><code> qObj = Person.all() db.delete(qObj) </code></pre> <p>I am getting error <code>BadValueError: Property y must be a str or unicode instance, not a long</code> I guess there is conflict in Model data types.</p> <pre><code>class Person(db.Model): name = db.StringProperty() x = db.StringProperty() y = db.StringProperty() group = db.StringProperty() </code></pre> <p>The field <code>y = db.StringProperty()</code> previously was <code>y = db.IntegerProperty()</code>. At this moment I need to flush all db records. How can I do that?</p> <p>Is there is an opportunity to delete local file which stores all db records?</p>
0non-cybersec
Stackexchange
How to show $7^{th}$ degree polynomial is non-positive in $[0,1]$. <blockquote> <p>Let <span class="math-container">$0\le x\le 1$</span>, show that inequality <span class="math-container">$$99x^7-381x^6+225x^5-415x^4+157x^3-3x^2-x-1\le 0$$</span></p> </blockquote> <p>This problem comes from the fact that I solved a different inequality.I tried to solve it by factorizing it to see if I could get symbols.but I failed.</p> <p>this inequality is hold by <a href="https://www.wolframalpha.com/input/?i=99x%5E7-381x%5E6%2B225x%5E5-415x%5E4%2B157x%5E3-3x%5E2-x-1" rel="nofollow noreferrer">wolfapha</a> Test it.</p>
0non-cybersec
Stackexchange
Shoney’s Hit By Apparent Credit Card Breach.
1cybersec
Reddit
Free PSN Games for November 2016 - all in one direct link on the PlayStation Store.
0non-cybersec
Reddit
Wanted to show you guys my newest makeup splurge! My Sailor Moon Compact!.
0non-cybersec
Reddit
linux server constantly kicking me out. <p>I have a linux server that has started acting a little funny...</p> <p>First of all the box is way under utilized. It's a database server, with a very low load. I'll put vmstat below and top...</p> <ol> <li>I'm running centos 5.4</li> <li>This server has been running fine for weeks</li> <li>It's firewalled, it's unlikely it's been hacked (chkrootkit agrees).</li> <li>Load is really low.</li> <li>I'm on a Gigabit switch with the server.</li> <li>I'm not having this problem with any other server.</li> <li>I have remote syslog set up on another box and it's not indicating any corresponding errors.</li> </ol> <p>So, when I ssh(putty) to the box, if I haven't gotten on it in a while, putty immediatly throws a 'network connection reset' error.</p> <p>Randomly it just kicks me out (or network drops)</p> <p>a steady stream of pings shows now interruption.</p> <pre><code>--- vdbsrv1 ping statistics --- 80620 packets transmitted, 80619 received, 0% packet loss, time 23838ms rtt min/avg/max/mdev = 0.234/0.273/1.741/0.043 ms, ipg/ewma 0.295/0.297 ms </code></pre> <p>SQL queries ("Select 1") to the box take about 5 seconds, even though SQL is reporting something like a .04 second execution time, so the other 4.96 seconds is a mystery </p> <p>Anyone have any ideas?</p> <pre><code>top - 11:49:28 up 12 days, 17:05, 4 users, load average: 0.00, 0.03, 0.01 Tasks: 150 total, 1 running, 149 sleeping, 0 stopped, 0 zombie Cpu(s): 0.2%us, 0.0%sy, 0.0%ni, 99.3%id, 0.5%wa, 0.0%hi, 0.0%si, 0.0%st Mem: 8174028k total, 8074924k used, 99104k free, 4558300k buffers Swap: 19464184k total, 4k used, 19464180k free, 2306952k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1 root 15 0 10348 692 576 S 0.0 0.0 0:02.13 init root@dbsrv1# vmstat procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------ r b swpd free buff cache si so bi bo in cs us sy id wa st 0 0 4 98980 4558300 2306992 0 0 1 13 3 2 0 0 99 0 0 </code></pre>
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
Windows 7 default TCP connect timeout. <p>Is there a way to change default TCP/IP new connection timeout ?</p> <p>In earlier Windows, timout value was stored in registry, as said here:</p> <p><a href="https://serverfault.com/questions/193160/which-is-the-default-tcp-connect-timeout-in-windows">Which is the default TCP connect timeout in Windows?</a></p> <p>But this is not true for Windows 7</p>
0non-cybersec
Stackexchange
Is there a 64bit version of Qmaster. <p>I just noticed that all of the qmaster stuff on my mac is 32 bit. Software update doesn't have any information about newer versions though. Was this package dropped by Apple or are there 64 bit versions that I can download somewhere?</p>
0non-cybersec
Stackexchange
Flutter - Fix Drawer Header. <p>Following this link <a href="https://flutter.io/docs/cookbook/design/drawer" rel="noreferrer">Add a Drawer to a screen</a> I have created a drawer. </p> <p>Following is my piece of code:</p> <pre><code>// FUNCTION CONTAINING LEFT SIDE MENU ITEMS _drawerList() { return Drawer( child: ListView( padding: EdgeInsets.zero, children: &lt;Widget&gt;[ DrawerHeader( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: &lt;Widget&gt;[ Text( 'John Doe', ), ], ), decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/menu_bg.png'), fit: BoxFit.cover, ), ), ), ListTile( // Some Code ), ], ), ); } @override Widget build(BuildContext context) { return Scaffold( // Some Code drawer: Drawer( child: _drawerList(), ), // Some Code } } </code></pre> <p>Is there any way I can fix "DrawerHeader" so that it doesn't move with the drawer and list view.</p> <p>P.S. I don't want to hold ListView. I just want to hold or fix "DrawerHeader".</p>
0non-cybersec
Stackexchange
Light Pillars in Alaska.
0non-cybersec
Reddit
Foods that will harm your dog.. Earlier this evening I read a post about a dog that passed away due to consuming onions. After reading a lot of comments with people seeming unsure of what foods could harm their animals and posting info that was not validated even to them I wanted to contribute a real list of foods that will harm your dog if consumed. Some not immediately(such as grapes or onions). * Toxic foods for your dog: * Alcoholic beverages * Apple seeds * Apricot pits * Avocados * Cherry pits * Candy (particularly chocolate—which is toxic to dogs, cats, and ferrets—and any candy containing the toxic sweetener Xylitol) * Coffee (grounds, beans, and chocolate-covered espresso beans) * Garlic * Grapes * Gum (can cause blockages and sugar free gums may contain the toxic sweetener Xylitol) * Hops (used in home beer brewing) * Macadamia nuts * Moldy foods * Mushroom plants * Mustard seeds * Onions and onion powder * Peach pits * Potato leaves and stems (green parts) * Raisins * Rhubarb leaves * Salt * Tea (because it contains caffeine) * Tomato leaves and stems (green parts) * Walnuts * Xylitol (artificial sweetener that is toxic to pets) * Yeast dough A couple other foods to consider that are not toxic but ARE harmful are large quantities of fat and cooked bones. Large amounts of fat(like a few spare ribs is all) can cause pancreatic failure. It's a huge issue for dogs come BBQ time. Cooked bones are brittle and splinter. This can cause lacerations or blockages in their intestines. Be a responsible pet owner and know your animal and what is best for their well being! It is your only obligation to them(their well being). Take that to heart when taking them into your home. You owe them that.
0non-cybersec
Reddit
Meet the NRA's enemies list. As you'd expect, it's nuts..
0non-cybersec
Reddit
AttributeError: &#39;SequenceGenerator&#39; object has no attribute &#39;shape&#39; Custom Sequence Generator Keras 2.2.4. <p>I am trying to use <code>fit_generator</code> with a custom <code>train_sequence_generator</code> and custom <code>test_sequence_generator</code> I got the error below. please advise where shall I change my code.</p> <p><strong>1. The Custom Sequence class:</strong> </p> <pre><code>import os import numpy as np from keras.utils import Sequence from batchGenerator import BatchGenerator from settings import batch_size, train_folder, test_folder class SequenceGenerator(Sequence): def __init__(self, batches_folder): self.batch_generator = BatchGenerator(folder_name=batches_folder) self.names = [f for f in os.listdir(batches_folder) if f.lower().endswith('.jpg')] def __len__(self): return int(np.ceil(len(self.names) / float(batch_size))) def __getitem__(self, idx): print('Getting a bacth{0}'.format(idx)) [X_batch, Y_batch] = self.batch_generator.load_batch_from_disk(idx) return X_batch, Y_batch def train_seq_genenrator(): return SequenceGenerator(train_folder) def test_seq_generator(): return SequenceGenerator(test_folder) </code></pre> <p><strong>2. Fit_generator in CoLab</strong></p> <pre><code>from sequenceGenerator import train_seq_genenrator, test_seq_generator history = new_model.fit_generator(train_seq_genenrator() , steps_per_epoch=num_train_samples // batch_size , validation_data=test_seq_generator() , validation_steps=num_test_samples // batch_size , epochs=epochs , shuffle=False) </code></pre> <h2><strong>3. Error</strong></h2> <pre><code>----------------- AttributeError Traceback (most recent call last) &lt;ipython-input-22-ad1d08859faf&gt; in &lt;module&gt;() 4 , validation_steps=num_test_samples // batch_size 5 , epochs=epochs ----&gt; 6 , shuffle=False) /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch) 1424 use_multiprocessing=use_multiprocessing, 1425 shuffle=shuffle, -&gt; 1426 initial_epoch=initial_epoch) 1427 1428 def evaluate_generator(self, /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training_generator.py in model_iteration(model, data, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch, mode, batch_size, **kwargs) 113 batch_size=batch_size, 114 epochs=epochs - initial_epoch, --&gt; 115 shuffle=shuffle) 116 117 do_validation = validation_data is not None /usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/training_generator.py in convert_to_generator_like(data, batch_size, steps_per_epoch, epochs, shuffle) 375 376 # Create generator from NumPy or EagerTensor Input. --&gt; 377 num_samples = int(nest.flatten(data)[0].shape[0]) 378 if batch_size is None: 379 raise ValueError('You must specify `batch_size`') AttributeError: 'SequenceGenerator' object has no attribute 'shape' </code></pre>
0non-cybersec
Stackexchange
Factoring polynomials modulus p. <p>Mathematica can factor easily polynomials over $\mathbb{Z}/p\mathbb{Z}$ (p prime), but I'm having a hard time trying to factor the polynomial over $\mathbb{Z}/m\mathbb{Z}$ where m is a composite number. Is there any easy way to use its factorization modulus p to obtain its factorization over m?</p> <p>Thanks.</p> <p>For example, $1+x+x^2+x^4$ is $(x^2+7x+10)(x^2+12x+2)$ over $\mathbb{Z}/19\mathbb{Z}$</p> <p>How can I factor it over $\mathbb{Z}/779\mathbb{Z}$?</p>
0non-cybersec
Stackexchange
Asset Catalog Compiler Error. <p>I'm not sure what I did to get this error in Xcode 5: </p> <p>"None of the input catalogs contained a matching app icon set named "AppIcon"".</p> <p>My app was building fine - then my machine locked up tighter than the arctic - don't know why - and now I get this error.</p> <p>(There was an existing answer to this same question - but I couldn't quite understand it. Sorry)</p> <p>Thanks for any help.</p>
0non-cybersec
Stackexchange
Only print every other enum value in for loop. <p>I'm trying to make it so only every other colour is being printed off in my for loop statement but because of the type difference I'm unable to incorporate it in an <code>if</code> statement.</p> <pre><code>public enum Example{Red, Blue, Green, Yellow, Orange, Purple, Brown} public class Test { public static void main(String[] args) { for (Example colour: Example.values()) { if (????) { System.out.println(colour); } } } } </code></pre> <p>Desired output:</p> <pre><code>Red Green Orange Brown </code></pre>
0non-cybersec
Stackexchange
How does the Mean Value Theorem translate to higher dimensions?. <p>For <span class="math-container">$f:\mathbb{R}^2 \rightarrow \mathbb{R}$</span> such that for all <span class="math-container">$(x,y) \in (\mathbb{R}^2)^2$</span> we have:</p> <p><span class="math-container">$|f(x)-f(y)| \leq ||x-y||^2$</span></p> <p>I'm trying to prove that <span class="math-container">$f$</span> has to be a constant function. My instinct would be to divide one of the <span class="math-container">$|x-y|$</span>'s to the other side and use the mean value theorem to argue that the derivative has to be zero at every point. However, I'm unclear on whether the mean value theorem would work here, since <span class="math-container">$f$</span> is a function from <span class="math-container">$\mathbb{R}^2$</span>. Would it still work as normal, or do I need to change my approach?</p>
0non-cybersec
Stackexchange
Should have looked both ways..
0non-cybersec
Reddit
Object Has been collected cannot evaluate ContentValues.values.tostring(). <p>Can anyone tell me what this is about. Im getting this error when i am adding data in database. its Happening only for a particular row. I tried finding answer or reason over the internet. but in vain. The screenshot <a href="https://i.stack.imgur.com/oIKof.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/oIKof.jpg" alt="Screenshot while debugging"></a></p> <pre><code>public void FunSetVisitorDetails(String strResult) { Log.d(TAG, "Get Visitor Details started."); if (!strResult.equalsIgnoreCase("NA") &amp;&amp; !strResult.equalsIgnoreCase("NI")) { SQLiteDatabase database = getWritableDatabase(); database.delete("TBL_VISITOR_MASTER", null, null); String[] strResultData = strResult.split("#"); for (int index = 0; index &lt; strResultData.length; index++) { String[] strRowData = strResultData[index].split(","); ContentValues values = new ContentValues(); values.put("VISITORID", strRowData[0]); values.put("MEMBERID", strRowData[1]); values.put("TEAMID", strRowData[2]); values.put("CATEGORY", strRowData[3]); values.put("NAME", strRowData[4]); values.put("COMPNAME", strRowData[5]); values.put("SPECIALIZED1", strRowData[6]); values.put("SPECIALIZED2", strRowData[7]); values.put("SPECIALIZED3", strRowData[8]); values.put("SPECIALIZED4", strRowData[9]); values.put("SPECIALIZED5", strRowData[10]); values.put("CLIENT1", strRowData[11]); values.put("CLIENT2", strRowData[12]); values.put("CLIENT3", strRowData[13]); values.put("CLIENT4", strRowData[14]); values.put("CLIENT5", strRowData[15]); values.put("ASK", strRowData[16]); values.put("GIVE", strRowData[17]); values.put("TAGLINE", strRowData[18]); values.put("EMAIL", strRowData[19]); values.put("MOBILE", strRowData[20]); values.put("WEBSITE", strRowData[21]); values.put("LOCATION", strRowData[22]); try{ values.put("COMP_LOGO", strRowData[23]);// it is happening when adding the logo and image below. there is no exception thrown as well. values.put("PERSON_IMAGE", strRowData[24]); } catch (Exception e){ e.printStackTrace(); } database.insert("TBL_VISITOR_MASTER", null, values); } </code></pre>
0non-cybersec
Stackexchange
Microsoft Word - 123.doc SCALABILITY AND OPTIMISATION OF A COMMITTEE OF AGENTS USING GENETIC ALGORITHM T. Marwala*, P. De Wilde*, L. Correia**, P. Mariano**, R. Ribeiro** V. Abramov***, N. Szirbik***, J. Goossenaerts*** *Electrical and Electronic Engineering Department, Imperial College, Exhibition Road, London SW7 2BT, England **FCT- Dept. Informatics, Universidade Nova Lisboa, 2825-114 Monte Caparica, Portugal ***Information & Technology Department, Faculty of Technology Management, Eindhoven University of Technology, The Netherlands ABSTRACT A population of committees of agents that learn by using neural networks is implemented to simulate the stock market. Each committee of agents, which is regarded as a player in a game, is optimised by continually adapting the architecture of the agents using genetic algorithms. The committees of agents buy and sell stocks by following this procedure: (1) obtain the current price of stocks; (2) predict the future price of stocks; (3) and for a given price trade until all the players are mutually satisfied. The trading of stocks is conducted by following these rules: (1) if a player expects an increase in price then it tries to buy the stock; (2) else if it expects a drop in the price, it sells the stock; (3) and the order in which a player participates in the game is random. The proposed procedure is implemented to simulate trading of three stocks, namely, the Dow Jones, the Nasdaq and the S&P 500. A linear relationship between the number of players and agents versus the computational time to run the complete simulation is observed. It is also found that no player has a monopolistic advantage. 1. Introduction In this work a population of committees of agents is used to simulate the stock market. Each committee of agents is viewed as a player in a game. These players compete and interact. The committee of agents [1] are optimised using genetic algorithm [2]. Perrone and Cooper [1] introduced a committee of networks, which optimises the decision-making of a population of networks. They achieved this by assuming that the trained networks were available and then assigning to each network a weighting factor, which indicates the contribution that the network has on the overall decision of a population of networks. The limitation of their proposal is that in a situation where the problem is changing such as the stock market the method is not flexible enough to allow the dynamic evolution of the population of networks. This paper seeks to fill the limitation on the committee procedure by ensuring that the individual networks that make the committee are allowed to dynamically evolve as the problem evolves. This is achieved by employing genetic algorithms [2]. The parameters defining the architecture of the networks, such as the number of hidden units, which form a committee, are defined as design variables and are allowed to evolve as the problem evolves. The network attributes that are fit to survive replace those that are not fit. On implementing genetic algorithm to select the fit individuals three steps are followed [2]: (1) crossover of network attributes within the population; (2) Mutation of each individual attributes; (3) and reproduction of the successful attributes. The simple crossover, the binary mutation and roulette wheel reproduction techniques are used. Finally the proposed technique is implemented to simulate the trading of three stocks. The scalability of the number of agents and players in the simulations with respect to computational time are investigated. The evolution of the complexity of the simulation as the players participate in more trading is also investigated. 2. Structure of the simulation technique The structure that is proposed consists of committees of agents forming a player in the stock market. Each agent contributes equally to the overall decision-making of the player. The simulation framework consists of a population of these players that compete for fixed number of stocks. The agents learn using neural networks. The schematic illustration of the committee of agents is shown in Figure 1. The structure of each agent evolves using genetic algorithm such that its contribution to the overall function of a committee adapts to the evolutionary time-varying nature of the problem. The characteristics of the agents that evolve are the number of hidden units. The numbers of hidden units are constrained to fall within a given space, in this study 1 and 10. The output activation function is randomly chosen to be either linear or logistic [3]. Each committee of agents known as a player has trade stocks with other players. When prices of stocks are announced, the players trade by following these rules: • Once a price is announced, the committees look at the current price and the future price of stocks. The future price is determined from the agents that that learn using neural networks. For a player, the predicted price is the average of the prediction of each agent within that particular player. • If the predicted price of a stock is lower than the current price, then the player tries to sell the stock. If the predicted price for the stock is higher than the current price, then the committee tries to buy the stock. • At any given stage the committee is only prepared to sell the maximum of 40% of the volume of stocks it has. • The amount of stocks that a committee buys or sells depends on, amongst other factors, the predicted price. If the predicted price of a particular stock is x-% higher than the current price, the committee tries to acquire x-% of the volume available on the market of that particular stock. This simulation is started by choosing the number of players that participate in the trading of stocks together with the number of agents that form a player. Then the agents are trained by randomly assigning the number of hidden units to fall in the interval [1 10]. The output activation units are randomly chosen to be linear or logistic. The agents are trained using the data from the previous 50 trading days. The trained agents are grouped into their respective players and are then used predict the next price given the current price. The players trade stocks using the rules that are be described later on in the paper. The schematic diagram of the simulation is shown in Figure 2. Agent 1 Agent 2 . . . . . . . Agent 3 Agent N �= N i iAgentN O 1 Figure 1: Schematic diagram representing the committee of agents. After 50 days have elapsed the performance of each agent is evaluated and the number of hidden units are transformed into 8 bits and within each player exchange bits with other players, a process called crossover. Thereafter, the agents mutate at low probability. The successful agents are duplicated while the less successful ones are eliminated. Then the networks are retrained again and the whole process is repeated. When a price is announced trading of stocks is conducted until the consensus is reached [4]. At this state, the overall wealth of the committees does not increase as a result of trading. 3. Introduction to Genetic Algorithms Genetic algorithms were inspired by Darwin’s theory of natural evolution. In natural evolution, members of the population compete with each other to survive and reproduce. Evolutionary successful individuals reproduce while weaker members die. As a result the genes that are successful are likely going to spread within the population. This natural optimization method is Start Choose number of players and agents Train the networks by randomising the network architecture. The number of hidden units is randomly chosen Stop Crossover of hidden units of agents that make a player Evaluate the performance of networks on new data by letting the players trade for given prices of stocks Mutation of hidden units of agents that make a player For each player agents that make are successful reproduce at a high probability Evaluate the performance of networks on unseen data by letting the players trade stocks Figure 2: Schematic diagram of the trading simulation. used in this paper to optimize the decision of a committee of agents in Figure 1. The basic genetic algorithm suggested by Holland [4] is implemented. The algorithm acts on a population of binary-string chromosomes. These chromosomes are obtained by using the Gray algorithm [5]. Each of these strings is discretised representation of a point in the search space. Here we are searching for the most optimum combination of architectures that form a committee and that give the least errors. Therefore the objective function is the error given by committee of agents. On generating a new population three operators are performed: (1) crossover; (2) mutation; (3) and reproduction. Just like in natural evolution, the probability of mutation occurring is lower than that of crossover or reproduction. The crossover operator mixes genetic information in the population by cutting pairs of chromosomes at random points along their length and exchanging over the cut sections. This operator has a potential of joining successful operators together. Simple crossover [4] is implemented in this paper. The mutation operator picks a binary digit of the chromosomes at random and inverts it. This has the potential of introducing to the population new information. Reproduction takes successful chromosomes and reproduces them in accordance to their fitness function. The fit parameters are allowed to reproduce and the weaker parameters are eliminated. This is done using the roulette wheel [2] procedure. 4. Application: Simulating the stock market The example that is considered in this study is the trading of three stocks, namely: (1) the Dow Jones; (2) NASDAQ; (3) and S&P 500. The time-histories of the stocks are downloaded from the Internet and used to train agents. For a given set of price of these stocks the committee of agents predict the future prices of stocks. The following procedure is followed: 1. Using the time histories of the stocks generate N numbers of players trading M number of stocks. Each player consists of k-trained networks that form a committee. 2. Given the current price of pmt of the m th stock the at time t, the nth player predicts the price of the mth stock pmn(t+1) at time t+1. 3. Evaluate the change in prices mnt mnt)t(mn mnt p )pp( p − =∆ +1 . 4. For the nth player mth stock, calculate the decision factor mi,imimntmnt Qpdf ≠= ∆= 1 where Q is the maximum quantity of stocks available for the mth stock. 5. Randomly choose the order in which the players are allowed to play. 6. For player m if )dfmin()dfmax( mntmnt < then sell else buy the stock. 7. Repeat 3 8. Set t = t+1; 9. Go to 4. It should be noted that on implementing this procedure the total number of stocks available is kept constant [6]. The sample results showing the net worth of players are shown in Figure 5. This figure indicates that sometimes the players with successful strategies do not necessarily dominate indefinitely. This is due to the fact that strategies that are successful in one time frame are not necessarily successful at a later time. 0 200 400 600 800 1000 1200 0 1 2 3 4 5 6 x 10 7 Day Ne tw or th Figure 3: The net worth of each player versus trading days. 5. Scalability In this section some aspect about the scalability of the simulations are studied. It is found that the method proposed is scalable. However, generally it was observed that the computational time increases with the increase in number of agents and players. A linear relationship exists between the average computational time taken to run the complete simulation and the number of players as well as the number of agents that form a player. This may be seen in Figures 4 and 5. 5 10 15 20 25 30 35 40 200 300 400 500 600 700 800 900 Number of agents that makes a player: number of players is 20 C P U ti m e ta ke n to ru n th e co m pl et e si m ul at io n (C P U m in ut es ) Figure 4: CPU time versus the number of players. 5 10 15 20 25 30 35 40 40 60 80 100 120 140 160 180 200 Number of a players: the number of agents in a player is 4 C P U t im e t a ke n t o r u n t h e c o m p le te s im u la tio n ( C P U m in u te s) Figure 5: CPU time versus the number of agents. 6. Complexity In this section we present a study of the complexity of the populations of agents that make players of the game. In this paper we view complexity as the measure of a degree of variation in a population of agents. Each species of agents form a dimension in space. Each dimension has a variation indicating the level of complexity of a population of that species. In mathematical for this definition of complexity may be written as: � = = N i iieComplexity 1 σ (1) Figure 6 shows the average number of hidden units of an agent that forms a player versus the number of training conducted. This figure shows that as the system evolves the number of hidden units for a given player steadily decreases and stabilizes around 3. 2 4 6 8 10 12 14 16 18 20 22 24 1 2 3 4 5 6 7 8 9 10 Number of adaptations − this player has 4 agents A v e ra g e n u m b e r o f h id d e n u n it s Figure 6: Average number of hidden units of an agent that forms a player versus the number of training conducted. 0 5 10 15 20 25 3.4 3.6 3.8 4 4.2 4.4 4.6 4.8 5 Adptations − 10 players 4 agents C o m p le x it y − s o lid /d o tt e d l in e s = a g e n ts w it h l o g is ti c /l in e a r o u tp u t Figure 7: Complexity of species made of linear and logistic output functions versus the number of training conducted. Solid: Linear; Dashed: Logistic The graph showing the complexity of two species i.e. logistic and linear output activation functions versus time of training is shown in Figure 7. This figure shows that on average the complexity of the agents with linear output units decreases as the time elapses. The complexity of the agents with logistic output units is approximately constant. 7. Conclusion A simulation of the stock market was successfully conducted. It is found that the number of players and agents that form a player that participate in the trading game are directly proportional to the computational time taken to run the simulation. It is further observed that no player has the monopolistic advantage on the prediction of the stock market. The simulation also shows that as the time of the trading elapses, the complexity of the players decreases. This is due to the fact that as the time of trading elapses the players become more adapted to the time-varying nature of the problem, thereby developing common features. Optimising a committee of agents is found to be a feasible approach to modelling a player in the stock market. Acknowledgement This work has been carried in the framework of research project No. IST-1999-10304 supported by Commission of the European Communities, European Union. Reference: 1. Perrone, M.P. and Cooper, L.N., (1993) When networks disagree: ensemble methods for hybrid neural networks Ed. R.J. Mammone, Artificial Neural Networks for Speech and Vision, Chapman and Hall, London, UK, 126-142. 2. Goldberg, D.E., Genetic algorithms in search, optimization and machine learning, Addison-Wesley, Reading, MA, 1989. 3. Bishop, C.M., “Neural Networks for Pattern Recognition,” Oxford University Press, 1995. 4. Holland, J., “Adaptation in natural and artificial systems,” University of Michigan Press, 1975. 5. Michalewicz, Z., “Genetic algorithms + data structures = evolution programs,” Springer-Verlag, 1996. 6. Mas-Colell, A., Whinston, M.D., and Green, J., Microeconomic theory. Oxford University Press, 1995.
0non-cybersec
arXiv
What a cute little turtle!.
0non-cybersec
Reddit
Beta Release of Empire 3.0 on BC Security fork.
1cybersec
Reddit
'Announce Messages with Siri' feature returns for AirPods owners in iOS 13.2 - 9to5Mac.
0non-cybersec
Reddit
Taylor Hawkins & The Coattail Riders - I Don't Think I Trust You Any More..
0non-cybersec
Reddit
[New Video] Jon Connor - Scriptures.
0non-cybersec
Reddit
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
Convergnce of complex sum. <p>How to show that $\sum_{n=1}^{\infty}x_n+i y_n=x+i y$ if and only if $\sum_{n=1}^{\infty}x_n=x$ and $\sum_{n=1}^{\infty} y_n= y$?</p>
0non-cybersec
Stackexchange
JavaScript sleep/wait before continuing. <p>I have a JavaScript code that I need to add a sleep/wait function to. The code I am running is already in a function, eg:</p> <pre><code>function myFunction(time) { alert('time starts now'); //code to make the program wait before continuing alert('time is up') } </code></pre> <p>I have heard that a possible solution might include</p> <pre><code>setTimeout </code></pre> <p>but I am not sure how to use it in this case.</p> <p>I can't use PHP, as my server does not support it, although using jQuery would be fine.</p>
0non-cybersec
Stackexchange
Ubuntu 20.04 WiFi Password does not save. <p>sometimes randomly the system asks for wifi password on reboot even if it has been provided and saved in previous sessions. IT just needs to click authenticate in the specific window as the pswd is already stored, but you manually need to open the window. This is quite an issue for remote controlled machines. NEver happened in previuos ubuntu versions. Bug or misconfiguration?</p>
0non-cybersec
Stackexchange
The valleys of north Dartmoor, England, captured in morning mist (OC) [1000x560]..
0non-cybersec
Reddit
Save complex object to session ASP .NET CORE 2.0. <p>I am quite new to ASP .NET core, so please help. I would like to avoid database round trip for ASP .NET core application. I have functionality to dynamically add columns in datagrid. Columns settings (visibility, enable, width, caption) are stored in DB.</p> <p>So I would like to store <strong>List&lt;,PersonColumns></strong> <strong>on server</strong> only for actual session. But I am not able to do this. I already use JsonConvert methods to serialize and deserialize objects to/from session. This works for <strong>List&lt;,Int32></strong> or objects with simple properties, but not for complex object with nested properties. </p> <p>My object I want to store to session looks like this:</p> <pre><code>[Serializable] public class PersonColumns { public Int64 PersonId { get; set; } List&lt;ViewPersonColumns&gt; PersonCols { get; set; } public PersonColumns(Int64 personId) { this.PersonId = personId; } public void LoadPersonColumns(dbContext dbContext) { LoadPersonColumns(dbContext, null); } public void LoadPersonColumns(dbContext dbContext, string code) { PersonCols = ViewPersonColumns.GetPersonColumns(dbContext, code, PersonId); } public static List&lt;ViewPersonColumns&gt; GetFormViewColumns(SatisDbContext dbContext, string code, Int64 formId, string viewName, Int64 personId) { var columns = ViewPersonColumns.GetPersonColumns(dbContext, code, personId); return columns.Where(p =&gt; p.FormId == formId &amp;&amp; p.ObjectName == viewName).ToList(); } } </code></pre> <p>I would like to ask also if my approach is not bad to save the list of 600 records to session? Is it better to access DB and load columns each time user wants to display the grid? </p> <p>Any advice appreciated</p> <p>Thanks </p> <p><strong>EDIT</strong>: I have tested to store in session <strong>List&lt;,ViewPersonColumns></strong> and it is correctly saved. When I save object where the <strong>List&lt;,ViewPersonColumns></strong> is property, then only <strong>built-in types</strong> are saved, List property is null.</p> <p><strong>The object I want to save in session</strong></p> <pre><code>[Serializable] public class UserManagement { public String PersonUserName { get; set; } public Int64 PersonId { get; set; } public List&lt;ViewPersonColumns&gt; PersonColumns { get; set; } //not saved to session?? public UserManagement() { } public UserManagement(DbContext dbContext, string userName) { var person = dbContext.Person.Single(p =&gt; p.UserName == userName); PersonUserName = person.UserName; PersonId = person.Id; } /*public void PrepareUserData(DbContext dbContext) { LoadPersonColumns(dbContext); }*/ public void LoadPersonColumns(DbContext dbContext) { LoadPersonColumns(dbContext, null); } public void LoadPersonColumns(DbContext dbContext, string code) { PersonColumns = ViewPersonColumns.GetPersonColumns(dbContext, code, PersonId); } public List&lt;ViewPersonColumns&gt; GetFormViewColumns(Int64 formId, string viewName) { if (PersonColumns == null) return null; return PersonColumns.Where(p =&gt; p.FormId == formId &amp;&amp; p.ObjectName == viewName).ToList(); } } </code></pre> <p><strong>Save columns to the session</strong></p> <pre><code>UserManagement userManagement = new UserManagement(_context, user.UserName); userManagement.LoadPersonColumns(_context); HttpContext.Session.SetObject("ActualPersonContext", userManagement); HttpContext.Session.SetObject("ActualPersonColumns", userManagement.PersonColumns); </code></pre> <p><strong>Load columns from the session</strong></p> <pre><code>//userManagement build-in types are set. The PersonColumns is null - not correct UserManagement userManagement = session.GetObject&lt;UserManagement&gt;("ActualPersonContext"); //The cols is filled from session with 600 records - correct List&lt;ViewPersonColumns&gt; cols = session.GetObject&lt;List&lt;ViewPersonColumns&gt;&gt;("ActualPersonColumns"); </code></pre>
0non-cybersec
Stackexchange
My Black, Red, and ever Improving Battlestation.
0non-cybersec
Reddit
My OCD senses are tingling.....
0non-cybersec
Reddit
Looking for a good beginners cookbook.. I am a single guy in my mid 20s looking for a cookbook recommendation. I try to cook dinners most days and am getting tired of the same few super basic things I make and would like to learn to cook more dishes. I work 9 or 10 hours on a typical day so I don’t have a ton of time to buy ingredients and spend time cooking so something on the simpler side would be perfect. Thanks!
0non-cybersec
Reddit
Every closed subset of $\mathbb R^n$ has a point that minimizes the distance to a given point $p\in\mathbb R^n$. <blockquote> <p>Let $p\in\mathbb R^n$ and $\|\cdot \|$ the Euclidian norm. Show that if $K\subset \mathbb R^n$ is a close set, then $$\exists a\in K: \forall x\in K, \|a-p\|\leq \|x-p\|.$$</p> </blockquote> <p>Since $\|x-p\|\geq 0$, there is a $m\geq 0$ such that $$m=\inf_{x\in K}\|x-p\|.$$</p> <p>Now, I have to show that there is a $a\in K$ such that $m=\|a-p\|$. My idea is to take a sequence $(x_n)_{n\in\mathbb N}\subset K$ such that $\lim_{n\to \infty }\|x_n-p\|=m$. My problem is to show that $(x_n)_{n\in\mathbb N}$ converge or that $(x_n)$ has a subsequence that converge.</p>
0non-cybersec
Stackexchange
What is the difference between exploitable security measures and security theater?. <p>As an example, the US no-fly list is commonly referred to as a security theater given that it is <a href="https://www.schneier.com/blog/archives/2008/09/my_la_times_op.html" rel="nofollow noreferrer">easy to work around</a>. However <a href="https://security.stackexchange.com/questions/207492/why-do-people-hide-their-license-plates-in-the-eu">blurring license plates when posting a picture online</a> is not considered a security theater, even though license plates are open for everyone to see when the car is driving. </p> <p>So where is the exact line between security measures that are merely exploitable and security measures that can be referred to as "security theater"?</p>
1cybersec
Stackexchange
what is slope in derivatives?. <p>What do we mean by slope especially in application of derivatives? Please explain it in basic way. I want to understand it to apply. When is it to be used?</p>
0non-cybersec
Stackexchange
Which ruggedized PoE switch would you recommend?. It needs 36 ports and needs to have PoE on all of them. It needs to be able to withstand ambient temps of up to 130.
1cybersec
Reddit
Augmented Interactions - A new mod which aims to immerse the player into the world.
0non-cybersec
Reddit
Calling a free() wrapper: dereferencing type-punned pointer will break strict-aliasing rules. <p>I've tried to read up on the other questions here on SO with similar titles, but they are all a tiny bit too complex for me to be able to apply the solution (or even explanation) to my own issue, which seems to be of a simpler nature.</p> <p>In my case, I have a wrapper around <code>free()</code> which sets the pointer to <code>NULL</code> after freeing it:</p> <pre><code>void myfree(void **ptr) { free(*ptr); *ptr = NULL; } </code></pre> <p>In the project I'm working on, it is called like this:</p> <pre><code>myfree((void **)&amp;a); </code></pre> <p>This makes <code>gcc</code> (4.2.1 on OpenBSD) emit the warning "dereferencing type-punned pointer will break strict-aliasing rules" if I crank up the optimization level to <code>-O3</code> and add <code>-Wall</code> (not otherwise).</p> <p>Calling <code>myfree()</code> the following way does not make the compiler emit that warning:</p> <pre><code>myfree((void *)&amp;a); </code></pre> <p>And so I wonder if we ought to change the way we call <code>myfree()</code> to this instead.</p> <p>I believe that I'm invoking undefined behaviour with the first way of calling <code>myfree()</code>, but I haven't been able to wrap my head around why. Also, on all compilers that I have access to (<code>clang</code> and <code>gcc</code>), on all systems (OpenBSD, Mac OS X and Linux), this is the only compiler and system that actually gives me that warning (and I know emitting warnings is a nice optional).</p> <p>Printing the value of the pointer before, inside and after the call to <code>myfree()</code>, with both ways of calling it, gives me identical results (but that may not mean anything if it's undefined behaviour):</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; void myfree(void **ptr) { printf("(in myfree) ptr = %p\n", *ptr); free(*ptr); *ptr = NULL; } int main(void) { int *a, *b; a = malloc(100 * sizeof *a); b = malloc(100 * sizeof *b); printf("(before myfree) a = %p\n", (void *)a); printf("(before myfree) b = %p\n", (void *)b); myfree((void **)&amp;a); /* line 21 */ myfree((void *)&amp;b); printf("(after myfree) a = %p\n", (void *)a); printf("(after myfree) b = %p\n", (void *)b); return EXIT_SUCCESS; } </code></pre> <p>Compiling and running it:</p> <pre><code>$ cc -O3 -Wall free-test.c free-test.c: In function 'main': free-test.c:21: warning: dereferencing type-punned pointer will break strict-aliasing rules $ ./a.out (before myfree) a = 0x15f8fcf1d600 (before myfree) b = 0x15f876b27200 (in myfree) ptr = 0x15f8fcf1d600 (in myfree) ptr = 0x15f876b27200 (after myfree) a = 0x0 (after myfree) b = 0x0 </code></pre> <p>I'd like to understand what is wrong with the first call to <code>myfree()</code> and I'd like to know if the second call is correct. Thanks.</p>
0non-cybersec
Stackexchange
Bought both of these windbreakers at two different thrift stores. Definitely have seen better days, but I think they're kinda cool. Thoughts?.
0non-cybersec
Reddit
Equivalent of Python&#39;s Pass in Scala. <p>If there is a function that you don't want to do anything with you simple do something like this in Python:</p> <pre><code>def f(): pass </code></pre> <p>My question is, is there something similar to <code>pass</code> in Scala?</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
Large india telco hacked... data already sold!!.
1cybersec
Reddit
Entity framework auto eager load. <p>Is there a way to get entity objects to automatically pull all relevant data through the relationships instead of having having to .Include everything I want populated? I can't use lazy loading as this needs to be serialized to go over WCF. It would just be fantastic to have it auto populate the relevant collections.</p>
0non-cybersec
Stackexchange
[Funny!] Practical Priest's Guide to Leap of Faith.
0non-cybersec
Reddit
intersymbol interference (ISI), channels, and frequencies. <p>When describing 802.11b/g and the <a href="http://en.wikipedia.org/wiki/IEEE_802.11b#Channels_and_Frequencies" rel="nofollow">2.4 GHz channel</a>s, or 802.11a/n with <a href="http://www.ni.com/white-paper/3740/en" rel="nofollow">5 GHz channels</a>, textbooks (<a href="https://play.google.com/store/books/details/David_D_Coleman_CWNA_Certified_Wireless_Network_Ad?id=T4bXd18QlEYC&amp;feature=nav_result#" rel="nofollow">CWNA Official Study Guide</a>) often show some figure with channels spaced such that certain channels cannot overlap and therefore <a href="http://en.wikipedia.org/wiki/Intersymbol_interference" rel="nofollow">ISI</a> is avoided. The explanation is that <a href="http://en.wikipedia.org/wiki/Intersymbol_interference" rel="nofollow">ISI</a> occurs in cases of multipath, where the signals of the same frequency interfere. This does make sense to me, i.e. that signals of the same frequency can interfere, and so non-overlapping channels would avoid ISI. </p> <p>My understanding is that the 802.11 design assigns 1 signal per constant width of "frequency space" in a channel, for example</p> <ul> <li>1 signal per 2 MHz in a DSSS channel</li> <li>1 signal per subcarrier in OFDM channel</li> </ul> <p>If we look at the figures in the URLs, the spacing of the channels and frequencies show a sequential order by Hz. What's not clear to me, is whether the same exact sequence must also hold for the <em>timing</em> of each signal's arrival. For example, consider 2.4 GHz channel 1: does the 2.410 GHz signal always arrive at the receiver before the 2.414 GHz signal? After the first 1 cycle, I would guess that the signals within a single channel arrive in order of lowest to highest Hz. But does this precise order hold after <em>any</em> length of time? What would prevent signals at different Hz from arriving at exactly the same instant? Or if simultaneous arrival of different-frequency signals is already expected to occur, then how does the radio discern which is the correct signal to receive? </p>
0non-cybersec
Stackexchange
I made a cozy furniture thing..
0non-cybersec
Reddit
Shot of my house in the survival village community realm being run by several friends and I.
0non-cybersec
Reddit
Prove that the nth prime number $p_n$ satisfies $p_n\leq 2^{2n-1}$. <blockquote> <p>Prove that the <em>nth</em> prime number $p_n$ (with $p_1 = 2, p_2 = 3, p_3 = 5$, etc.) satisfies $p_n \leq 2^{2n-1}$ </p> </blockquote> <p>So far I have figured out that $p_n$ = the nth prime and that I have to use mathematical induction to prove $p_n \leq 2^{2n-1}$. This is similar to the proof of infinitely many primes such that<br> $m = 1 + p_1 p_2 p_3\cdots p_n$ so there exists a prime $p | m$. </p> <p>With this information I have concluded that $p_{n+1} \leq p \leq m = 1 + p_1 p_2 p_3\cdots p_n$</p> <p>I need to figure out how to produce the right side of this inequality with induction. I'm not sure how to do this. </p> <p>Thank you for any and all help. </p>
0non-cybersec
Stackexchange
Renaming and Hiding an Exported Rcpp function in an R Package. <p>Writing an R package, I have a R function that calls a specific Rcpp function. The Rcpp function just serves as a helper function and I do not want to creat a .Rd file for it. My solution so far is to export both functions in the Namespace file which causes the warning to create an .Rd file for the Rcpp function as soon as I run the check command. If I remove the helper function in the Namespace file, I get rid of this warning causing now the problem that the R function is not able to find it anymore. </p> <p>Is there a way to solve this problem. That means to make the Rcpp function still visible for the R function and at the same time to get rid of the warning that there exists no .Rd file for the Rcpp function? </p> <p>Thanks a lot :-) </p>
0non-cybersec
Stackexchange
[OC][Rework] Magic item card - Behelit of Deceit.
0non-cybersec
Reddit
Afghani boti/Tikka street food of Karachi Pakistan..
0non-cybersec
Reddit
Why my idea is not right on this classical probability problem. <p>Sorry for my poor math, here is a classical probability problem</p> <blockquote> <p>Suppose there are $n \ge 2$ books, all books are randomly allocated to John and Jack, what is the probability of both John and Jack get at least one book?</p> </blockquote> <p>My solution is since both John and Jack can get at least one book, suppose John gets a book, and then Jack gets another book to make sure at least both of them can get one book, and the rest $n-2$ book will be randomly allocated to John and Jack, so there are $n \times (n-1) \times 2^{n-2}$ possible events, and the probability is </p> <p>$$P=\frac{n \times (n-1) \times 2^{n-2}}{2^n}$$</p> <p>But apparently, my solution is not right, the right solution is </p> <p>$$P=\frac{2^n-2}{2^n}$$</p> <p>What is the right solution to directly solve this problem?</p>
0non-cybersec
Stackexchange
Sorting algorithms visualized [OC].
0non-cybersec
Reddit
How Pants Should Fit.
0non-cybersec
Reddit
Possibly a bit tame for this sub, but trashy nonetheless.
0non-cybersec
Reddit
Linux Live USB Drive Created with dd Corrupt Partition Table and Reliability Issues. <p>I am trying to create a Linux Live USB drive from an isohybrid (<code>.iso</code>) image.</p> <p>To accomplish this task, I have taken these steps in the past:</p> <ol> <li><p>Securely wipe the flash drive using the command:</p> <p><code>sudo dd bs=4M if=/dev/zero of=/dev/sdx</code></p> </li> <li><p>Create an <code>msdos</code> partition table on the flash drive with <code>gparted</code></p> </li> <li><p>Create a new partition (<code>/dev/sdx1</code>) that is the entire size of the flash drive with a <code>fat32</code> filesystem (for cross-platform compatibility) <strong>aligned to cylinder</strong> with <code>gparted</code></p> </li> <li><p>Set the <code>bootable</code> flag on the newly created partition (<code>/dev/sdx1</code>) using <code>gparted</code></p> </li> <li><p>Check the filesystem on the newly created partition (<code>/dev/sdx1</code>) to make sure all of the disk formatting operations were carried out properly using <code>gparted</code></p> </li> <li><p>Write the <code>.iso</code> image to the flash drive using the command:</p> <p><code>sudo dd bs=4M if=&lt;distro&gt;.iso of=/dev/sdx</code></p> </li> </ol> <p>However, after completing the last step, <strong>when I inspect the disk again with gparted, it reports that all of the space on the flash drive is unallocated and that there is no partition table on the disk</strong>. I suspect that this may have something to do with the Master Boot Record (MBR) being overwritten or corrupted when I write the <code>.iso</code> to the flash drive using the <code>dd</code> command.</p> <p>When I mount the flash drive all of the files that were contained within the <code>.iso</code> appear to be properly extracted from the <code>.iso</code>, and I am sometimes able to boot the live USB. However, I have had various reliability issues using this method during boot up and also when trying to install a distro on a hard drive using the live USB. Like I mentioned before, I suspect that this may have something to do with the partition table being corrupted and the fat32 filesystem not being properly detected after the <code>.iso</code> is written to the flash drive, which may be leading to some reading and writing issues with the disk when booting and installing.</p> <p>Is there a way to prevent these reliability issues from occurring and the partition table from being corrupted, while still using only <code>gparted</code> and <code>dd</code>?</p>
0non-cybersec
Stackexchange
"basketball" court in Brno.
0non-cybersec
Reddit
Efficient way to map data to legend text color in ggplot2. <p>I'm wondering if there's an efficient way to map data onto legend text color in ggplot2, just like we can do with axis text. Reproducible example follows.</p> <p>First, let's make a plot:</p> <pre><code>library(ggplot2) library(dplyr) drv_counts &lt;- mutate(mpg, drv = case_when(drv == "r" ~ "rear wheel drive", drv == "4" ~ "4 wheel drive", drv == "f" ~ "front wheel drive"), model_drv = interaction(model, drv)) %&gt;% group_by(model_drv) %&gt;% summarize(model = model[1], drv = drv[1], count = n()) %&gt;% arrange(drv, count) %&gt;% mutate(model = factor(model, levels = model)) p &lt;- ggplot(drv_counts, aes(x=model, y=count, fill=drv)) + geom_col() + coord_flip() + guides(fill = guide_legend(reverse=T)) + theme_minimal() p </code></pre> <p><a href="https://i.stack.imgur.com/IGrX6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IGrX6.png" alt="enter image description here"></a></p> <p>Now let's color the axis labels by drive train. This is very easy:</p> <pre><code># ggplot2 colors cols &lt;- c("4 wheel drive" = "#F8766D", "front wheel drive" = "#00BA38", "rear wheel drive" = "#619CFF") p2 &lt;- p + theme(axis.text.y = element_text(color = cols[drv_counts$drv])) p2 </code></pre> <p><a href="https://i.stack.imgur.com/lJBWA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lJBWA.png" alt="enter image description here"></a></p> <p>Now let's try the same trick on the legend. It doesn't work:</p> <pre><code>p2 + theme(legend.text = element_text(color = cols)) </code></pre> <p><a href="https://i.stack.imgur.com/hJeaC.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hJeaC.png" alt="enter image description here"></a></p> <p>The reason this doesn't work for legend text but does work for axis text is that all the axis labels are drawn in one grob, and hence we can give that grob a vector of colors, but the legend labels are drawn in separate grobs.</p> <p>We can go in and color all the grobs manually, but that's super ugly and cumbersome:</p> <pre><code>g &lt;- ggplotGrob(p2) g$grobs[[15]]$grobs[[1]]$grobs[[9]]$children[[1]]$gp$col &lt;- cols[g$grobs[[15]]$grobs[[1]]$grobs[[9]]$children[[1]]$label] g$grobs[[15]]$grobs[[1]]$grobs[[10]]$children[[1]]$gp$col &lt;- cols[g$grobs[[15]]$grobs[[1]]$grobs[[10]]$children[[1]]$label] g$grobs[[15]]$grobs[[1]]$grobs[[11]]$children[[1]]$gp$col &lt;- cols[g$grobs[[15]]$grobs[[1]]$grobs[[11]]$children[[1]]$label] grid::grid.newpage() grid::grid.draw(g) </code></pre> <p><a href="https://i.stack.imgur.com/8VNpy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8VNpy.png" alt="enter image description here"></a></p> <p>My question is: Can somebody think of a way of getting this effect without having to dig down into the grob tree? I'm Ok with a patch to ggplot2 if it's only a few modified lines. Alternatively, can the digging down into the grob tree be automated so I don't have to access child grobs by manually setting list indices that will change the moment I make a minor change to the figure?</p> <p><strong>Update:</strong> A related question can be found <a href="https://stackoverflow.com/q/23588127/4975218">here.</a> To make my question distinct, let's add the requirement that colors aren't copied over from the symbols but rather can be set to any arbitrary values. This added requirement has real-world relevance because I usually use a darker color for text than for symbols.</p>
0non-cybersec
Stackexchange
Corn bin collapses and catches fire in southern Indiana.
0non-cybersec
Reddit
[C#] [HOMEWORK] Rock Paper Scissors. For class, I am to develop a program to play Rock Paper Scissors with a computer opponent and loop until the user decided to not play. The instructions given to me are as follows: Begin by asking users if they are ready to play. If they answer "yes" (accept ANY combination of capital and lowercase letters with the new string manipulation methods you learned in the chapter), then have the computer randomly select rock, paper, or scissors and display this in the console window. This is cheating... giving us psychic powers to know what player 1 is going to select, but for purposes of this exercise, it will help you to ensure your code is working right. Next, prompt the user for their selection – rock, paper, or scissors. Then use the "judging" section of the code exactly as you did last week to evaluate inputs and display the result. Finally, ask the user if they want to play again. Exit the program, if the user elects not to play again. I'm trying to use a version I've made using two inputs as a base and I can't seam to convert, for lack of better word, the player one input to the computer properly nor get the loop to go back to the beginning. The problem I'm having with the computer choice, is that it's always picking rock, and not another option. using System; class RPS { public static void Main(string[] args){ /* THe variable string allows characters to be grouped together to make typing the program easier*/ string string1 = "Player One <Computer> Selection - "; string string2 = "Player Two Selection - "; string string3 = "Type 1 for rock, 2 for paper, or 3 for sisscors. "; string playRPS = "Do you want to play Rock, Paper, Scissors?"; string yesOrNo; string player2choice; Random computer = new Random(); int number = computer.Next(1,4); string cpuchoice = number.ToString(); Console.Write(playRPS); yesOrNo = Console.ReadLine(); yesOrNo = yesOrNo.ToUpper(); while (yesOrNo == "YES"){ Console.WriteLine(string1); Console.WriteLine(string2 + string3); player2choice = Console.ReadLine(); switch (int.Parse(cpuchoice)) { case 1: Console.WriteLine("It is a draw."); break; case 2: Console.WriteLine("Player 1 wins."); break; case 3: Console.WriteLine("Player 2 wins."); break; default: Console.WriteLine("Oops, you entered a number not in the range 1 to 3"); break; } } //Swtich Ends } } } The switch in the program works fine, so I left that part out. At the moment I'm more focused on getting the loop and computer choices to line up. Appreciate the help. EDIT: Took out the switch to help with readability.
0non-cybersec
Reddit
Your butt isn't as fluffy!. Yesterday, I went to the grocery store to stock up on my veggies for this weekend and ran into an old friend of mine and her son that used to live around the corner from us. As we were standing in line he said to me, rather loudly "your butt isn't as fluffy as it used to be. Where did it go?" I thought his mother was going to faint from embarrassment after he said that. I couldn't help but laugh. I love how honest kids are! That was the first time anyone had said anything about my weight loss. I'll take it!
0non-cybersec
Reddit
How I Wrote Fight Club: Chuck Palahniuk (writer), Jim Uhls (screenwriter), David Fincher (director), and more talk about how they created this film and book!.
0non-cybersec
Reddit
Problems trying to create gradle build. <p>We have recently migrated to Android Studio (from Intellij). I am currently trying to migrate our project to use gradle for builds. I have tried fitting it around our current folder structure, and I have tried to migrate our files to match the gradle file structure. </p> <p>I have had errors each way, I have been looking for an answer, but can't find anything that quite matches what we are getting.</p> <p>The error I get when trying to migrate to the gradle file structure is:</p> <ul> <li><p>What went wrong:</p> <p>A problem occurred configuring project ':'.</p> <blockquote> <p>Failed to notify project evaluation listener. Configuration with name 'default' not found</p> </blockquote></li> </ul> <p>The error I get using our old file structure is:</p> <pre><code>:&lt;project&gt;:processDebugResources /Users/kbrown/dev/AndroidClient/&lt;project&gt;/build/res/all/debug/values/values.xml:311: error: Error retrieving parent for item: No resource found that matches the given name '@style/Widget.Sherlock.ActionBar.Solid'. /Users/kbrown/dev/AndroidClient/&lt;project&gt;/build/res/all/debug/values/values.xml:312: error: Error: No resource found that matches the given name: attr 'background'. /Users/kbrown/dev/AndroidClient/&lt;project&gt;/build/res/all/debug/values/values.xml:314: error: Error: No resource found that matches the given name: attr 'backgroundSplit'. </code></pre> <p>Any ideas on where to look. We do have a couple references to libraries like ActionBarSherlock.</p> <p>build.gradle</p> <pre><code>buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.4' } } apply plugin: 'android' dependencies { compile files('libs/android-support-v4.jar') compile files('libs/retrofit-1.0.0-SNAPSHOT.jar') compile project(':ThirdParty:ActionBarSherlock') compile project(':ThirdParty:drag-sort-listview') compile project(':ThirdParty:SlidingMenu') compile project(':ThirdParty:Android-ViewPagerIndicator') } android { compileSdkVersion 17 buildToolsVersion "17.0.0" defaultConfig { minSdkVersion 8 targetSdkVersion 17 } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' resources.srcDirs = ['src'] res.srcDirs = ['res'] } instrumentTest.setRoot('../UnitTests/src') } } </code></pre> <p>settings.gradle</p> <pre><code>include ':library:Android-ViewPagerIndicator',':library:SlidingMenu',':library:drag-sort-listview',':library:ActionBarSherlock',':&lt;project&gt;' </code></pre> <p>Any ideas would be appreciated.</p>
0non-cybersec
Stackexchange
What is the correct etiquette for holding a door open for someone walking behind you?.
0non-cybersec
Reddit
How to copy rows from one sheet to another based on some criteria?. <p>I need to copy rows from one sheet to another sheet in Excel, based on some criteria. If at Sheet 1 in some row cell in column H have "X" I want that hole column to be copy on Sheet 2. And I want that for all rows in Sheet 1. I have now about 130 rows in Sheet 1, but will have more in future. Can somebody can help me? Thanks, Nenad </p>
0non-cybersec
Stackexchange
He thinks curls make him big.
0non-cybersec
Reddit
A bound for the minimum vertex cover of scale-free graphs. <p>For a complete graph, the size of minimum vertex cover is $n-1$.</p> <p>I was wondering whether there exist an upper bound (or an expected value or upper bound) for the size of minimum vertex cover for <a href="http://en.wikipedia.org/wiki/Scale-free_network" rel="nofollow">scale-free graphs</a>, i.e. such whose degree distribution follows a <a href="https://en.wikipedia.org/wiki/Power_law" rel="nofollow">power law</a>.</p> <p>I searched and didn't find anything, is anybody aware of any bounds?</p>
0non-cybersec
Stackexchange
Taylor Swift new song, Robert Pattinson and more great moments.
0non-cybersec
Reddit
One day till the pass - Himalayas, India.
0non-cybersec
Reddit
How to deduce the return type of a function object from parameters list?. <p>I'm trying to write a projection function that could transform a <code>vector&lt;T&gt;</code> into a <code>vector&lt;R&gt;</code>. Here is an example:</p> <pre><code>auto v = std::vector&lt;int&gt; {1, 2, 3, 4}; auto r1 = select(v, [](int e){return e*e; }); // {1, 4, 9, 16} auto r2 = select(v, [](int e){return std::to_string(e); }); // {"1", "2", "3", "4"} </code></pre> <p>First attempt:</p> <pre><code>template&lt;typename T, typename R&gt; std::vector&lt;R&gt; select(std::vector&lt;T&gt; const &amp; c, std::function&lt;R(T)&gt; s) { std::vector&lt;R&gt; v; std::transform(std::begin(c), std::end(c), std::back_inserter(v), s); return v; } </code></pre> <p>But for </p> <pre><code>auto r1 = select(v, [](int e){return e*e; }); </code></pre> <p>I get:</p> <blockquote> <p>error C2660: 'select' : function does not take 2 arguments</p> </blockquote> <p>I have to explicitly call <code>select&lt;int,int&gt;</code> to work. I don't like this because the types are redundant.</p> <pre><code>auto r1 = select&lt;int, int&gt;(v, [](int e){return e*e; }); // OK </code></pre> <p>Second attempt:</p> <pre><code>template&lt;typename T, typename R, typename Selector&gt; std::vector&lt;R&gt; select(std::vector&lt;T&gt; const &amp; c, Selector s) { std::vector&lt;R&gt; v; std::transform(std::begin(c), std::end(c), std::back_inserter(v), s); return v; } </code></pre> <p>The result is same error, function does not take 2 arguments. In this case I actually have to supply a 3rd type argument:</p> <pre><code>auto r1 = select&lt;int, int, std::function&lt;int(int)&gt;&gt;(v, [](int e){return e*e; }); </code></pre> <p>Third attempt: </p> <pre><code>template&lt;typename T, typename R, template&lt;typename, typename&gt; class Selector&gt; std::vector&lt;R&gt; select(std::vector&lt;T&gt; const &amp; c, Selector&lt;T,R&gt; s) { std::vector&lt;R&gt; v; std::transform(std::begin(c), std::end(c), std::back_inserter(v), s); return v; } </code></pre> <p>For </p> <pre><code>auto r1 = select&lt;int, int, std::function&lt;int(int)&gt;&gt;(v, [](int e){return e*e; }); </code></pre> <p>the error is:</p> <blockquote> <p>'select' : invalid template argument for 'Selector', class template expected</p> </blockquote> <p>For </p> <pre><code>auto r1 = select(v, [](int e){return e*e; }); </code></pre> <blockquote> <p>error C2660: 'select' : function does not take 2 arguments</p> </blockquote> <p>(I know the last two attempts are not particularly great.)</p> <p>How can I write this <code>select()</code> template function to work for the sample code I put in the beginning?</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
Are the matrix products $AB$ and $BA$ similar?. <blockquote> <p>Given two matrices $A,B.$ On what conditions does $AB \sim BA$ hold?</p> </blockquote>
0non-cybersec
Stackexchange
A problem about a matrix in $SL_2(\mathbb Q)$. <p>If a matrix $A\in SL_2(\mathbb Q)$ has finite multiplicative order, then $\operatorname{tr}(A)\le 2$. Does anyone know a demonstration of this fact?</p>
0non-cybersec
Stackexchange