text
stringlengths
36
35k
label
class label
2 classes
source
stringclasses
3 values
tokens_length
int64
128
4.1k
text_length
int64
36
35k
Dual boot ubuntu alongside Windows 10 in UEFI mode on HP notebook. <h2>My device is HP Laptop 15-dy0xxx. I installed Ubuntu 20.04LTS on a transcend 1TB Hard External harddrive alongside default Windows 10 (in UEFI mode by disabling secure boot in BIOS). After completion, when I restarted the pc it shows- Boot device not found 3FO, Please install an operating system on your hard drive</h2> <p>And it only moves to bios settings. I tried several way but in vain. with fear, i then factory reset my pc and it started from the beginning of the brand new windows setup and running on windows 10 clearly.</p> <p><strong>1. The Ubuntu partition is still on the ex-drive; Can I repair it anyhow for dual boot ?</strong></p> <p><strong>2. If not, can anyone suggest me how to install Ubuntu on my system for dual boot ?</strong></p>
0non-cybersec
Stackexchange
220
831
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
349
1,234
LO Calc / Excel - Dropbox change another cell. <p>I am creating a simple Point of Sale System for a store using an excel/libre office spreadsheet. </p> <p>The spreadsheet has a sheet called "Inventory" which has the following columns:</p> <ol> <li>Name</li> <li>Price</li> </ol> <p>This holds data like:</p> <ul> <li>Scrabble - $5</li> <li>Monopoly - $10</li> <li>Drink - $1</li> <li>Ice-cream - $2</li> <li>(etc, about 500 entries total)</li> </ul> <p>It has another sheet called "Product Sales", which has two columns:</p> <ol> <li>Item</li> <li>Price</li> </ol> <p>The first column "Item" uses cell validation to create a dropdown box that lets me choose from all of the names defined in "Inventory" (column 1). </p> <p>I would like for "Product Sales".Price to automatically update to the appropriate Inventory.Price when "Product Sales".Item is changed.</p> <p>The only way I can think to do this right now is with a huge, unwieldy, hard to edit, and bug-prone if statement. Another way to do it would be with a for() loop, but I can't do that.</p> <p>Is there some other method I'm not aware of? </p>
0non-cybersec
Stackexchange
375
1,118
Using Ninject with Owin and InRequestScope. <p>We are trying to use Ninject within an Owin with WebAPI pipeline. We have everything setup according to <a href="https://github.com/ninject/Ninject.Web.Common/wiki/Setting-up-a-OWIN-WebApi-application">this documentation</a>, but we cannot get InRequestScope() to work.</p> <p>Here's the significant part of the startup.cs</p> <pre><code>public class Startup { public void Configuration(IAppBuilder app) { HttpConfiguration config = new HttpConfiguration(); // Web API routes config.MapHttpAttributeRoutes(); // Ninject Setup app.UseNinjectMiddleware(NinjectConfig.CreateKernel); app.UseNinjectWebApi(config); } </code></pre> <p>}</p> <p>NinjectConfig looks something like this:</p> <pre><code>public sealed class NinjectConfig { public static IKernel CreateKernel() { var kernel = new StandardKernel(); INinjectModule[] modules = { new ApplicationModule() }; instance.Load(modules); // Do we still need to do this wtih Owin? instance.Bind&lt;IHttpModule&gt;().To&lt;OnePerRequestHttpModule&gt;(); } } </code></pre> <p>Our ApplicationModule lives in a separate infrastructure project with access to all of our different layers, for handling DI &amp; Mapping:</p> <pre><code>public class ApplicationModule: NinjectModule { public override void Load() { // IUnitOfWork / EF Setups Bind&lt;ApplicationContext&gt;().ToSelf().InRequestScope(); Bind&lt;IUnitOfWork&gt;().ToMethod(ctx =&gt; ctx.Kernel.Get&lt;ApplicationContext&gt;()}); Bind&lt;ApplicationContext&gt;().ToMethod(ctx =&gt; ctx.Kernel.Get&lt;ChromLimsContext&gt;()}).WhenInjectedInto&lt;IDal&gt;(); // other bindings for dals and business objects, etc. } } </code></pre> <p>Then we have a couple interfaces:</p> <pre><code>public interface IUnitOfWork() { void SaveChanges(); Task SaveChangesAsync(); } </code></pre> <p>and</p> <pre><code>public interface IDal() { // Crud operations, Sync and Async } </code></pre> <p>then our actual classes using these:</p> <pre><code>public class SomeBusinessObject { private IUnitOfWork _uow; private IDal _someDal; public SomeBusinessObject(IUnitOfWork uow, IDal someDal) { _uow = uow; _someDal = someDal; } public Task&lt;SomeResult&gt; SaveSomething(Something something) { _someDal.Save(something); _uow.SaveChanges(); } } </code></pre> <p>Some Dal</p> <pre><code>public class SomeDal : IDal { private ApplicationContext _applicationContext; public SomeDal(ApplicationContext applicationContext) { _applicationContext = applicationContext; } public void Save(Something something) { _applicationContext.Somethings.Add(something); } } </code></pre> <p>Our EF DbContext</p> <pre><code>public class ApplicationContext : DbContext, IUnitOfWork { // EF DBSet Definitions public void SaveChanges() { base.SaveChanges(); } } </code></pre> <p>The expectation is that for every request, a single instance of ApplicationContext is created and injected into the business objects as an IUnitOfWork implementation and into the IDals as an ApplicationContext.</p> <p>Instead what is happening is that a new instance of ApplicationContext is being created for every single class that uses it. If I switch the scope from InRequestScope to InSingletonScope, then (as expected) exactly 1 instance is created for the entire application, and injected properly into the specified classes. Since that works, I'm assuming this isn't a binding issue, but instead an issue with the InRequestScope extension.</p> <p>The only issue I could find similar to what I'm experiencing is <a href="https://groups.google.com/forum/#!topic/ninject/Wmy83BhhFz8">this one</a>, but unfortunately the solution did not work. I'm already referencing all of the packages he specified in both the WebApi and Infrastructure projects, and I double checked to make sure they are being copied to the build directory.</p> <p>What am I doing wrong?</p> <p><strong>Edit:</strong> Some additional information. Looking at the Ninject source code in both Ninject.Web.WebApi.OwinHost and Ninject.Web.Common.OwinHost, it appears that the Owin Middleware adds the OwinWebApiRequestScopeProvider as the IWebApiRequestScopeProvider. This provider is then used in the InRequestScope() extension method to return a named scope called "Ninject_WebApiScope". This will be present until the target class that being injected into switches. The named scope then disappears, and a new scope is created. I think this may be what @BatteryBackupUnit was referring to in their comment, but I don't know how to correct it.</p>
0non-cybersec
Stackexchange
1,380
4,890
How to deploy SNAPSHOT with sources and JavaDoc?. <p>I want to deploy sources and javadocs with my snapshots. This means that I want to automize the following command:</p> <pre><code>mvn clean source:jar javadoc:jar deploy </code></pre> <p>Just to execute:</p> <pre><code>mvn clean deploy </code></pre> <p>I don't want to have javadoc/sources generation executed during the <code>install</code> phase (i.e. local builds).</p> <p>I know that source/javadoc plugins can be synchronized with the execution of the <code>release</code> plugin but I can't figure out how to wire it to the snapshots releases.</p>
0non-cybersec
Stackexchange
185
612
Hi we are Mike, Robb, and JP of The Trailer Park Boys, The Drunk and on Drugs Happy Funtime Hour and SwearNet. Ask us any fucking thing.. We're about to launch our new website, www.swearnet.com with a live, online PPV this Saturday at 8pm EST. Prebuy tickets now, or become a Founding Fucker at www.swearnet.com We had an awesome time doing this last time (http://www.youtube.com/watch?v=orCM2bVC4Ss&feature=share&list=PLC6A823BC86F67929). So we're back and answering your fucking questions at 2pm EST. Edit: THANK YOU!!! THIS WAS FUCKING FUN! https://twitter.com/SWEARNET/status/308680101770452993 Don't forget to join RICKY, JULIAN and BUBBLES LIVE on www.swearnet.com March 9th - They'll be getting drunk and answering questions LIVE via SKYPE! https://www.facebook.com/events/557080224331851/
0non-cybersec
Reddit
260
802
Bitcoin Best Practices by the Bitcoin Foundation. <p>The <a href="https://www.bitcoinfoundation.org">Bitcoin Foundation</a>'s Executive Director, Peter Vessenes, in his <a href="https://www.bitcoinfoundation.org/about/letter">open letter</a> states that the Foundation is aiming to</p> <blockquote> <p>Publish a set of best practices for businesses transacting in Bitcoin, covering topics from accounting to physical and digital security</p> </blockquote> <p>Is there any information on how this set of best practices is being developed, who is working on it and whether any individual can contribute to the works?</p>
0non-cybersec
Stackexchange
165
623
Regular expressions in R to erase all characters after the first space?. <p>I have data in R that can look like this:</p> <pre><code>USDZAR Curncy R157 Govt SPX Index </code></pre> <p>In other words, one word, in this case a Bloomberg security identifier, followed by another word, which is the security class, separated by a space. I want to strip out the class and the space to get to:</p> <pre><code>USDZAR R157 SPX </code></pre> <p>What's the most efficient way of doing this in R? Is it regular expressions or must I do something as I would in MS Excel using the mid and find commands? eg in Excel I would say:</p> <pre><code>=MID(@REF, 1, FIND(" ", @REF, 1)-1) </code></pre> <p>which means return a substring starting at character 1, and ending at the character number of the first space (less 1 to erase the actual space). </p> <p>Do I need to do something similar in R (in which case, what is the equivalent), or can regular expressions help here? Thanks.</p>
0non-cybersec
Stackexchange
286
975
A limit related to super-root (tetration inverse).. <p>Recall that <a href="http://en.wikipedia.org/wiki/Tetration" rel="noreferrer">tetration</a> ${^n}x$ for $n\in\mathbb N$ is defined recursively: ${^1}x=x,\,{^{n+1}}x=x^{({^n}x)}$. </p> <p>Its inverse function with respect to $x$ is called <a href="http://en.wikipedia.org/wiki/Tetration#Super-root" rel="noreferrer">super-root</a> and denoted $\sqrt[n]y_s$ (the index $_s$ is not a variable, but is part of the notation &mdash; it stands for "super"). For $y&gt;1, \sqrt[n]y_s=x$, where $x$ is the unique solution of ${^n}x=y$ satisfying $x&gt;1$. It is known that $\lim\limits_{n\to\infty}\sqrt[n]2_s=\sqrt{2}$. We are interested in the convergence speed. It appears that the following limit exists and is positive: $$\mathcal L=\lim\limits_{n\to\infty}\frac{\sqrt[n]2_s-\sqrt2}{(\ln2)^n}\tag1$$ Numerically, $$\mathcal L\approx0.06857565981132910397655331141550655423...\tag2$$</p> <hr> <p>Can we prove that the limit $(1)$ exists and is positive? Can we prove that the digits given in $(2)$ are correct? Can we find a closed form for $\mathcal L$ or at least a series or integral representation for it?</p>
0non-cybersec
Stackexchange
411
1,167
Can code after &#39;await&#39; run in different thread in ASP.NET?. <p>I've read here <a href="https://blog.stephencleary.com/2009/10/synchronizationcontext-properties.html" rel="nofollow noreferrer">https://blog.stephencleary.com/2009/10/synchronizationcontext-properties.html</a> that ASP.NET applications' execution context does not have specific associated thread. Does it mean code after await will(can) be executed in different thread with the same context ? In this case how it is possible that deadlock can be caused by synchronous execution? Or ASP.NET application is not the case for such deadlock ?</p> <p>Thanks in advance.</p>
0non-cybersec
Stackexchange
174
641
slow query logging in mysql server. <p>I have installed MySQL Community Edition 5.1.41 on a windows 2000 server. In my.ini file I have enabled slow query logging and have redirected the output to a table.I have set the long_query_time to 10 seconds. Then after running some queries I checked up the slow query log table and found that all the queries which were executed have been logged and a file called database-slow.log has also been created in the data folder. Can anybody please tell me where I am going wrong. I am using the inbuilt innodb and not activated the innodb plugin.</p> <p>Thanks</p>
0non-cybersec
Stackexchange
145
603
Setting up multiple domains in Exchange as different Organizational Units?. <p>I some questions regarding the above a few months ago, and was pointed to the tutorials below. I have followed the tutorials, but have a few more questions for you experts. <a href="http://technet.microsoft.com/en-us/library/bb936719%28EXCHG.80%29.aspx#Optn1" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/bb936719%28EXCHG.80%29.aspx#Optn1</a> <a href="http://technet.microsoft.com/en-us/library/aa996314.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/aa996314.aspx</a></p> <p>To describe what I am doing in more details: I currently have my company (domain1.com) running on it's own Exchange 2010 server (Windows Server 2008). I also have my whole clan, about 25 family members, (domain2.com) running on a separate Exchange 2007 server (SBS 2008). I have recently acquired a new domain (domain3.com) which I want to move my company onto, so I will need to receive emails on the original domain and the new one.</p> <p>So far... I have installed a typical instance of Exchange 2010 onto a new Server 2008 instance and have set it up as a domain in a new forest titled "domain3.com". I have created two organizational units under this active directory called "domain3.com" and "domain2.com". I have created three accepted domains in EMC titled "domain1.com", "domain2.com" and "domain3.com". I have created two email address policies titled "domain2.com and "domain3.com".</p> <p>I DID NOT follow the steps in the above tutorials around changing permissions to the GAL, New Address List and Offline Address List as it doesn't matter if the different organizational units cross over on these. We do not make use of the GAL, and it doesn't matter if the different parties access the different Address Lists. Is this OK or should I have followed these steps too?</p> <p>Am I on the correct track so far?</p> <p>How do I configure the new users so that I can assign them to one of the two accepted domains? At the moment, they can only be assigned to domain3.com as it is set to default.</p>
0non-cybersec
Stackexchange
593
2,125
Monit vs Source Control: permission problems. <p>I'm trying to be good. That's my big mistake.</p> <p>I'm being good by having process monitoring: I have monit watching some key processes, and restarting them if they fail. </p> <p>I'm being good by not running as root: Monit runs a web-server, and I don't want it to run as root in case there is a security issue. So, I have a special 'monit' user, that has the permissions required to start and stop some key processes, and that is about it.</p> <p>The monit process reads from a ~monit/.monitrc file, and monit insists that the file is only readable by the the user it runs as - i.e. the monit user.</p> <p>I'm being good by storing all my operational scripts and configurations in source-control (mercurial), so I can rebuild machines with the same specs. I, or other devs, check-in changes to the scripts to source control, and then I pull the results onto the production machine. Symbolic links point from ~monit/.monitrc into the source control directory.</p> <p>However, that's where it all falls down - the source control directory is written to by Mercurial when I pull the latest scripts, but the pull command isn't running as monit, so the monitrc file is writable by another user... which monit doesn't like, and won't run.</p> <p>I can constantly chowning and chmodding the monitrc file before and after each pull, but that is fraught with oversights.</p> <p>I can't see how to ask monit to relax about ownership. I can't see how sticky bits will help.</p> <p>Any suggestions?</p>
0non-cybersec
Stackexchange
425
1,553
Ejaculation stories. I'm 14 and ejaculated for the first time yesterday and it felt really weird and good, as I thought it should. I would like to hear you first ejaculation stories but first I'll share mine: I've masturbated before, but nothing ever really came out. Then one night I noticed I had a boner, but it was larger, tougher, and harder than all my other boners. I wasin the shower fumbling around with my penis, but it didn't really do anything so I went to bed. I started looking at something on my iPod (not porn) and started jacking off. I wasn't really paying attention to my penis, but it regained the hard tough boner I had in the shower and then I felt something. I dropped my iPod and store down at my penis, and out was coming yellowish white semen. I was a little freaked because in the spur of the moment I squirted all over my iPod. I thought I should share
0non-cybersec
Reddit
213
881
OpenSSH Server for Windows 10 - Could not enter anything in Ubuntu terminal launched from cmd / powershell SSH session. <p>Would like to seek for advice for an issue regarding Windows 10's new OpenSSH feature.</p> <p>Firstly, I have installed the "ubuntu" from Windows Store following the support of Windows Subsystem for Linux. It functioned properly, ubuntu could by launched successfully from either cmd or powershell sessions locally (just type "ubuntu").</p> <p>(Reference: <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/windows/wsl/install-win10</a> )</p> <p>Then I installed "OpenSSH Server (beta)". After some setup, from another device I could SSH into the Windows machine, and it showed command prompt (cmd) as default. I could open a powershell session by just typing "powershell".</p> <p>However, I could not launch ubuntu from neither cmd nor powershell in the SSH session. In either case, after I enter "ubuntu", it just loads a while and ended with nothing happened.</p> <p>May I know if there are additional setup required to launch linux shell from cmd/powershell in Win 10 SSH? Would also like to see if there is a way to change the default terminal type (cmd/powershell/ubuntu etc.) upon SSH login , thanks!</p> <p>(Reference: <a href="https://blogs.msdn.microsoft.com/powershell/2017/12/15/using-the-openssh-beta-in-windows-10-fall-creators-update-and-windows-server-1709/" rel="nofollow noreferrer">https://blogs.msdn.microsoft.com/powershell/2017/12/15/using-the-openssh-beta-in-windows-10-fall-creators-update-and-windows-server-1709/</a> <a href="https://www.bleepingcomputer.com/news/microsoft/how-to-install-the-built-in-windows-10-openssh-server/" rel="nofollow noreferrer">https://www.bleepingcomputer.com/news/microsoft/how-to-install-the-built-in-windows-10-openssh-server/</a>)</p> <p><strong>========== UPDATE (25 Apr 2018) ==========</strong></p> <p>After following the guidlines below to set the local launch and activation rights, I managed to get ubuntu launchable from a SSH cmd session.</p> <p>(Reference: <a href="https://adrift.io/2017/10/11/windows-subsystem-for-linux-error-0x80070005-access-denied/" rel="nofollow noreferrer">https://adrift.io/2017/10/11/windows-subsystem-for-linux-error-0x80070005-access-denied/</a>)</p> <p>I could see the bash shell is launched. However, I could not type in anything in the terminal. It looked as if the cursor is freezed.<br/></p> <p><a href="https://i.stack.imgur.com/d11EN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d11EN.png" alt="bash shell freezes"></a></p> <p>No error is observed in the Windows event viewer.</p> <p>Kindly see if you have any ideas on this, thanks.</p>
0non-cybersec
Stackexchange
859
2,777
Querying MongoDb after scheme change. <p>The database schema of an application is rarely fixed, due to new development the schema has to change. This also applies to a schema-less solution like MongoDB. There is <a href="http://mongodb.github.io/mongo-csharp-driver/2.3/reference/bson/mapping/schema_changes/" rel="nofollow noreferrer">documentation</a> on how to handle schema changes, i.e. if a property has been removed / renamed etc. My problem is how to query data after such a schema change. </p> <p>This is best illustrated with an over-simplified example. Consider the class Person</p> <pre><code>public class Person //version 1.0 { public Guid Id {get;set;} public string FirstName {get;set;} public string LastName {get;set;} } </code></pre> <p>At the time of the first release, there is the ill-conceived assumption that no two people can have the same name. So in order to retrieve one person entity from the database, I would either find the record by ID, or call the method "Find"</p> <pre><code> public class DbContext { public IEnumerable&lt;T&gt; Find(Expression&lt;Func&lt;T, bool&gt;&gt; expression) { return _mongoDocumentCollection.AsQueryable().Where(expression).ToList(); } private readonly IMongoCollection&lt;T&gt; _mongoDocumentCollection; //implementation omitted } </code></pre> <p>An example of using Find:</p> <pre><code>new DbContext().Find(p =&gt; p.FirstName + p.LastName == "JohnDoe"); </code></pre> <p>Here I thus query the collection using an expression. As previously mentioned, this code will not work for long since multiple people can have the same name. So instead we add a field with a user name.</p> <pre><code>public class Person //version 2.0 { public Guid Id {get;set;} public string FirstName {get;set;} public string LastName {get;set;} public string UserName {get;set;} } </code></pre> <p>When fetching a document written in v1.0 <strong>by id</strong>, we follow the strategy <a href="http://mongodb.github.io/mongo-csharp-driver/2.3/reference/bson/mapping/schema_changes/" rel="nofollow noreferrer">outlined here</a>, which will programatically add the field <code>UserName</code> by concatenating the first and last names. However, doing </p> <pre><code> new DbContext().Find(p =&gt; p.UserName == "JohnDoe"); </code></pre> <p>will never find the document written in v1.0 since it does not contain the property <code>UserName</code>. </p> <p>The business only wants documents to be replaced if they are actually changed, so writing a migration script is not a solution. This also implies that I can eventually have N different versions of the same class in the document collection, i.e. v1.0, v2.0, .... vN. What patterns / design strategies are for querying data after a schema change?</p>
0non-cybersec
Stackexchange
812
2,805
PANDAS GroupBy Removing Header. <p>I'm using the PANDAS groupBy and noticing it is removing the header name of the value I am running it on.</p> <pre><code>data = pd.read_csv("&lt;CSV FILE NAME&gt;", low_memory=False) print data.head() print data.columns </code></pre> <p>Gives me the following output: </p> <pre><code> Store ID Daily Sales 0 4444444 436 1 4555555 406 2 6435353 487 3 3421456 637 4 1111111 516 Index([u'Store ID', u' Daily Sales'], dtype='object') </code></pre> <p>When I run </p> <pre><code>data = data.groupby(['Store Number']).mean() print data.head() print data.columns </code></pre> <p>The output is changed to </p> <pre><code> Daily Sales Store ID 4166646 236.280394 4166663 152.061884 4166664 131.163746 4166665 144.920044 4166666 225.075027 Index([u'Daily Sales'], dtype='object') </code></pre> <p>The Store ID header name is being added as a value and removed from the header names. What is the reason behind this and is there a fix?</p>
0non-cybersec
Stackexchange
361
1,123
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
349
1,234
Why not have every team of each conference have the Bye Week at the same time.. Long long long time ago someone told me why this was a bad idea but i forgot. I know it is bad for fantasy football. But I am not sure why it would be bad for the NFL. I would say have one conference have the Bye on week 10 than have the other one have it week 13. Than switch every other year. The network or streaming service \(I am hoping that Netflix gets NFC and Hulu, Amazon or Youtube gets AFC\) that has the AFC games gets the NFC game of their choice during the AFC bye week, and vice versa. Is there any obvious problems with this scheme. Still get 17 weeks for football and on top of that you will get crazy high ratings for the 4\-5 games played in the afternoon of Sunday.
0non-cybersec
Reddit
182
768
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
349
1,234
How to get string from dataPackageView.GetDataAsync(). <p>I'm trying to get non-standard-format data from the clipboard using <code>DataPackageView.GetDataAsync</code>. I am stumped on converting the returned <code>system.__ComObject</code> to a string. </p> <p><strong>Here is the code:</strong></p> <pre><code>var dataPackageView = Windows.ApplicationModel.DataTransfer.Clipboard.GetContent(); if (dataPackageView.Contains("FileName")) { var data = await dataPackageView.GetDataAsync("FileName"); // How to convert data to string? } </code></pre> <p>I am looking for a solution that will work with any non-standard clipboard format. "FileName" is an easily testable format as you can put it on the clipboard by copying a file in Windows Explorer.</p> <p>In <code>C++/Win32</code>, I can get the clipboard data as follows:</p> <pre><code>OpenClipboard(nullptr); UINT clipboarFormat = RegisterClipboardFormat(L"FileName"); HANDLE hData = GetClipboardData(clipboarFormat); char * pszText = static_cast&lt;char*&gt;(GlobalLock(hData)); GlobalUnlock(hData); CloseClipboard(); </code></pre> <p>In <code>C++</code>, the clipboard data is just an array of bytes. It must be possible to get the same array of bytes in C#, but I have no clue on unwrapping/converting the <code>system.__ComObject</code></p> <p><strong>Edit: Rephrasing the question:</strong></p> <p><strong>How do I get a string or array of byes out of the system.__ComObject returned by dataPackageView.GetDataAsync(someFormat), where someFormat is an arbitrary clipboard format created by another application?</strong></p> <p>It is very clear to me how to get the data. The difficult part is using the data that is returned.</p> <p>The accepted answer must show how to create a string or array of bytes from the "data" returned by</p> <pre><code>var data = await dataPackageView.GetDataAsync(someFormat); </code></pre>
0non-cybersec
Stackexchange
564
1,900
My computer does not use DCHP, it only uses default adress? No network access. <p>Recently one of my computer's network connection stopped to work. When I did an ipconfig I saw that the NIC was using the IP address outside the range of my DCHP server, something like "168.254.60.120(default), 255.255.0.0" instead of 192.168.1.74/24 witch the router has given the computer. All other computers on the network are working, so it is not an issue with the router. The troubled computer is indeed using DHCP and not the above /16 adress. I tried to hardcode the IP address under IPv4 settings but it doesent work.</p> <p>Any ideas?</p> <p>The computer is a laptop from Asus with a broadcom NIC, running Windows 7. </p>
0non-cybersec
Stackexchange
199
717
One important information for all of you regarding having friends vs not having friends. Having friends can make your life harder than not having friends. There are some reasons for this. At first, friends sometimes trouble/bother us during our busy times as they might need to ask for our help. Also, when we ask for their help/advice, the things they give/do might not be helpful to us or even make matters worse. This is because they misunderstand either the current situation or what we ask for. This should be tolerated as well as possible since we are also sometimes doing mistakes to others. Lastly, friends sometimes argue with our opinions and make tasks harder due to long arguments. The worst case of arguments is if our friends’ opinions are not as good as ours when doing something together (e.g. group projects) and they try to defend their opinions. Meanwhile, having no friends can be happier since we do not have anyone to care about and can focus more on our own business. In conclusion, if you do not have friends, do not think that other people who have friends will live happier than you. Their life might be more difficult than you.
0non-cybersec
Reddit
242
1,156
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
349
1,234
Propagate property changes through multiple classes. <p>I'm trying to figure out how to properly pass properties through multiple classes. I know I can just implement <code>INotifyPropertyChanged</code> in each class and listen for changes on the property, but this seems to be quite a lot of unnecessary code.</p> <p>The situation:<br /> I have a class (let's call it <code>Class1</code>) with two dependency properties: <code>FilterStatement</code> (String) and <code>Filter</code> (Filter class). Setting the statement affects the filter and vice versa. <br /> The conversion logic between statement and filter, however, isn't located in <code>Class1</code>, but in <code>Class3</code> - which <code>Class1</code> doesn't know directly. In between there is <code>Class2</code> which just has to pass through the changes. (You can imagine class 1 to 3 beeing Viewmodel, Model and Repository, though in the real situation this doesn't completly match). </p> <pre><code>public class Class1 { public static readonly DependencyProperty FilterProperty = DependencyProperty.Register( "Filter", typeof(Filter), typeof(Class1), new FrameworkPropertyMetadata(null)); public static readonly DependencyProperty FilterStatementProperty = DependencyProperty.Register( "FilterStatement", typeof(String), typeof(Class1), new FrameworkPropertyMetadata(null)); public Filter Filter { get { return (Filter)GetValue(FilterProperty); } set { SetValue(FilterProperty, value); } } public string FilterStatement { get { return (string)GetValue(FilterStatementProperty); } set { SetValue(FilterStatementProperty, value); } } public Class2 MyClass2Instance { get; set; } } public class Class2 { public Class3 MyClass3Instance { get; set; } public void ChangeClass3Instance(object someParam) { ... // this can change the instance of MyClass3Instance and is called frome somewhere else // when changed, the new Class3 instance has to get the property values of Class1 } } public class Class3 { private Filter _filter; // here is where the filter set in Class 1 or determined by the statement set in class 1 has to be put public string MyFilterToStatementConversionMemberFunction(Filter filter) { ... } public Filter MyStatementToFilterConversionMemberFunction(string statement) { ... } } </code></pre> <p>My naive solution would be to duplicate the properties across all three classes, implement <code>INotifyPropertyChanged</code> in <code>Class2</code> and <code>Class3</code> and listen to the changes, propagating everything down to <code>Class3</code> and in Result back up to <code>Class1</code>. Isn't there a better solution to this?</p>
0non-cybersec
Stackexchange
718
2,838
Upgrade to Ubuntu 20 breaking mysqlclient pip package. <pre><code>Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 16, in &lt;module&gt; import MySQLdb as Database File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in &lt;module&gt; from . import _mysql ImportError: libmysqlclient.so.20: cannot open shared object file: No such file or directory The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/tom/.pyenv/versions/3.7.2/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/home/tom/.pyenv/versions/3.7.2/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 76, in raise_last_exception raise _exception[1] File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute autoreload.check_errors(django.setup)() File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/utils/autoreload.py", line 53, in wrapper fn(*args, **kwargs) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "&lt;frozen importlib._bootstrap&gt;", line 1006, in _gcd_import File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load File "&lt;frozen importlib._bootstrap&gt;", line 967, in _find_and_load_unlocked File "&lt;frozen importlib._bootstrap&gt;", line 677, in _load_unlocked File "&lt;frozen importlib._bootstrap_external&gt;", line 728, in exec_module File "&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/contrib/auth/models.py", line 2, in &lt;module&gt; from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/contrib/auth/base_user.py", line 47, in &lt;module&gt; class AbstractBaseUser(models.Model): File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/models/base.py", line 121, in __new__ new_class.add_to_class('_meta', Options(meta, app_label)) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/models/base.py", line 325, in add_to_class value.contribute_to_class(cls, name) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/models/options.py", line 208, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/__init__.py", line 28, in __getattr__ return getattr(connections[DEFAULT_DB_ALIAS], item) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/utils.py", line 207, in __getitem__ backend = load_backend(db['ENGINE']) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/utils.py", line 111, in load_backend return import_module('%s.base' % backend_name) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/home/tom/cs344/group8-rw334-project-2/venv/lib/python3.7/site-packages/django/db/backends/mysql/base.py", line 21, in &lt;module&gt; ) from err django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient? </code></pre> <p>Before the upgrade I had no issues with mysqlclient. When trying to run my django environment I get this error. I have tried everything I could find online but nothing has worked. I do have the pip package installed.</p> <p>I have tried completely removing mysqlserver, reinstalling python-dev all the dependencies of the mysqlclient package mentioned on the PyPi page.</p>
0non-cybersec
Stackexchange
1,880
5,315
Keyboard layout related issue - fixed in GUI but receive error in terminal. <p>I run on Ubuntu 14.04. I have an issue related to the keyboard layout in GUI mode. I managed to fix it in the GUI by using: <code>setxkbmap -layout us</code> [1] and adding it to the <code>~/.bashrc</code>. That works fine. However, the problem I have now is that when I login to the text-mode terminal I receive an error - <code>Cannot display "default display"</code>. This is not surprising because this command does not work in text mode. </p> <p>The question is: where should I put [1] and have no error in text mode terminal?</p>
0non-cybersec
Stackexchange
169
616
Css: Position element by it&#39;s bottom relative to it&#39;s container&#39;s top. <p>I have an <code>div</code> element with variable height which I need to be positioned by it's <code>bottom</code> relative to the containers top.</p> <p>This must be done without changing the html.</p> <p>e.g.</p> <pre><code>&lt;div id="container"&gt; &lt;h1&gt;Some Text&lt;br/&gt;more...&lt;/h1&gt; &lt;/div&gt; </code></pre> <p><code>h1</code>'s bottom should be 100px below <code>#container</code>'s top.</p> <p>Thanks a lot</p> <p>EDIT:</p> <p>So by Request what I did (or didn't) tried:</p> <ul> <li>Searching with Google for <code>css bottom top position relative</code> but that's not the best search terms in the world...</li> <li>Normally I would put a container around <code>h1</code> and give it a height of 100px but then I would need to change the html and that I can't</li> <li>using <code>bottom: somevalue</code> but that positions the element's <em>bottom</em> relative to the container's bottom.</li> <li>slain some vampires</li> </ul>
0non-cybersec
Stackexchange
368
1,053
A trans bathroom bill has been filed in TX. How many bills have been filed to ban sex offenders from bathrooms? ZERO. This has nothing to do with protecting women and kids. They want to use trans-folks as a scapegoat while ignoring the average of 70 reports/week of child sex abuse in US churches.. A bill has been filed in Texas that would, if passed, limit where transgender people can pee. [Link.](http://www.nytimes.com/2017/01/05/us/texas-transgender-bathroom-access.html?_r=0) Their main argument is that women and children need to be protected from those pesky men in dresses. First, that shows a clear lack of understanding regarding transgender people in the first place. **Do you really want someone who for all intents and purposes is female, has real boobs that grew thanks to hormone therapy, to go into the restroom with your sons instead of daughters?** Also, where the fuck are the bills banning sex offenders from bathrooms? If we're truly concerned about the safety of women and children in restrooms, might we consider banning people **who have actually been fucking convicted of sex crimes** as opposed to poor transgender people who have never been convicted of any crime? I suppose that's just too much logic for those poor bastards in the Texas legislature. Honestly, and this is just my theory, but I think transgender folks are being used as a scapegoat here. No doubt we have an epidemic of child sexual abuse in this country. **But it ain't happening in bathrooms.... in fact, it's pretty damn common in church.** On average, there are around 70 reports per week of children being abused sexually in American churches. [Link.](http://churchandstate.org.uk/2016/05/kids-more-likely-to-be-molested-at-church-than-in-transgender-bathrooms/) Where are the laws banning clergy from public restrooms? Where are the laws banning sex offenders, you know people with an actual history of sex abuse, from bathrooms? FUCKING NO WHERE. These asshats don't care about protecting the children. They want to distract you from the real problem. If you live in TX and want to contact your senators regarding this legislation, you can find their contact information [here.](http://www.senate.state.tx.us/75r/Senate/Members.htm) Let them know you'd prefer they ban actual sex offenders from restrooms as opposed to innocent citizens.
0non-cybersec
Reddit
557
2,358
Does $u\in H^{3/2}(\Omega)$ imply continuity of $\nabla u\cdot\overrightarrow{n}$ across an interior interface?. <p>When investigaing the regularity of certain functions, I encountered this problem:</p> <p>if $u\in H^{3/2}([0,1]\times [0,1])$, what can we say about the continuity of $\nabla u\cdot\overrightarrow{n}$ across a line segment inside the domain, where $\overrightarrow{n}$ is the unit normal ?</p> <p>Without loss of generality, we formulate the problem as below:</p> <blockquote> <p>Let $\Omega$ be the unit square in two dimensions and let $\gamma$ denote a vertical line segment inside $\Omega$.</p> <p>If $u\in H^{3/2}(\Omega)$, can we deduce that $$\frac{\partial u}{\partial x}|_{\gamma^+}=\frac{\partial u}{\partial x}|_{\gamma^-} \;\;\; ?$$ </p> </blockquote> <p>The subscripts $\gamma^+$ and $\gamma^-$ denote traces from left and right sides of $\gamma$, respectively.</p> <p><strong>Here we assume that</strong> $$ \frac{\partial u}{\partial x}|_{\gamma^+}\in L^2(\gamma),\quad \frac{\partial u}{\partial x}|_{\gamma^-}\in L^2(\gamma).$$ Note that this assumption is not redundant because trace theorem does not hold for $H^{1/2}(\Omega)$ with index $1/2$.</p> <p>What if the assumption above is weakened into: $$ \frac{\partial u}{\partial x}|_{\gamma^+}\in H^{-1/2}(\gamma),\quad \frac{\partial u}{\partial x}|_{\gamma^-}\in H^{-1/2}(\gamma) \;\;\; ?$$</p> <p>The question was asked in MSE last year but there is still no response, so I plan to ask here.</p>
0non-cybersec
Stackexchange
474
1,507
Controlling Remote Processes from Linux Access Server. <p>I have constructed a HA web cluster in LXD with each major service run within its own container. I.e, 2 x Nginx servers in a container each, 2 x MySQL etc. </p> <p>I would like to add a management container that I can ssh to, issue commands, for example, <code>service nginx restart</code> and have the command redirected to the appropriate container, the Nginx servers in this case.</p> <p>The closest thing I have found is OpenShift but given that I don't want to create a full blown PaaS I would prefer to find something more lightweight.</p> <p>Is what I want to achieve possible?</p>
0non-cybersec
Stackexchange
171
650
Appendix heading suddenly becomes Chapter. <p>I have a couple of appendices all with multiple tables. The first two appendices are labeled "Appendix A" and Appendix B". At some point, tables in appendix B change their name to "Table 2.1" instead of "Table B.#". Then the next appendix is labeled "Chapter 3" </p> <p>The document reads as follows</p> <pre><code>\include{Chapter1} \include{Chapter2} \appendix \include{appendix1} \include{appendix2} \include{appendix3} \include{appendix4} </code></pre> <p>What can be causing this?</p>
0non-cybersec
Stackexchange
171
549
Find the density of their average. <blockquote> <p>If $f_{X,Y,Z}(x,y,z)=e^{-(x+y+z)}I_{[0,\infty]}(x)I_{[0,\infty]}(y)I_{[0,\infty]}(z)$ find the density of their average $\frac{X+Y+Z}{3}$</p> </blockquote> <p>I'm a little lost on how to solve this exercise, $f_{X,Y,Z}(x,y,z)$ It looks like the product of three exponential random variables $X\sim exp(1),Y\sim exp(1),Z\sim exp(1)$. </p> <p>This would be the case of making the transformation with Jacobian calling $$A=\frac{X+Y+Z}{3},B=Y,C=Z$$ then finding $$f_{A,B,C}(a,b,c)$$ and finally $$f_A(a)=\int f_{A,B,C}(a,b,c)dbdc$$ this seems to me somewhat complicated and rather laborious</p>
0non-cybersec
Stackexchange
268
651
I really regret buying an FM transmitter now. About a month ago the auxiliary port on my car’s deck decided to call it quits. It had been a long time coming, as the audio has been cutting out for a while now. At first I thought it was just the cable, but after replacing three different audio cables, I knew it was the aux port itself. I tried listening to all of my old CDs, but that quickly grew tiresome and annoying to have to continually switch them out. I decided getting an FM transmitter was my cheapest option (to avoid spending over 200 bucks on a new deck). I found one on sale through Amazon and within a couple days my car audio troubles were solved. A few days after I started using the FM transmitter was when things started getting weird. I’ve read stories here before about random radio stations and I’ve heard of EVP before (thanks to the shitty movie “White Noise”), but I’m not exactly sure about what’s been happening. The first time anything happened, I had my phone plugged into the transmitter, but I was using my phone for a call. I had switched it to use the speaker rather than use my car’s audio. Mid conversation, static blasted through my car speakers. Nearly caused me to run off of the freaking road. I assumed it was just the FM transmitter going into sleep mode or something, but then I saw that the station had been changed to 88.5. I figured I must have bumped it by accident and changed it myself. Then, it suddenly switched back to the station I had it on originally. The same thing happened the next day, and then day after that. The third time is when I remembered about EVP and, as sort of a joke, decided to leave it on for a little while and listen to the static. I heard something subtle break through the gurgles of electricity. I wasn’t entirely certain, but it sounded like someone said my name. I quickly turned my radio off, and then laughed about it moments later. I had just heard what I wanted to hear in the static, right? This same pattern happened every day on my way to and from work. My transmitter would randomly switch to station 88.5, which never seemed to work. All that would come through the speakers was static. There were a few more times when I could have sworn that I heard my name through the static, but I just shrugged it off. There was no way I could really believe that was what I was actually hearing. I was just psyching myself out about it and my mind was playing tricks on me. As it kept happening, I kept getting more intrigued. I looked at reviews online for the FM transmitter I bought, but none of them mentioned anything like what was happening to me. That was when I started paying attention to when it was happening. Like I said, it would happen when I was driving to work and then again when I was on my way home. I started paying attention to when it switched and when it would switch back. I wasn’t overly surprised when I noticed there was actually a pattern to what was happening. On my way to work, I have to drive through an older part of town. Some of the houses are pretty run down and some are even boarded up and probably abandoned. As soon as I would hit that stretch of road, the station would switch to 88.5, and once I was out of the area, it would switch back. I decided to test this a little bit further and drove through the area slower than I normally would and found that the static seemed to be the loudest as I passed in front of one of the boarded up houses. All of this has led up to today. On my way to work this morning, I decided to stop in front of the house and listen to the static. It has been bothering me and I figured this would be the way to put my mind at ease. At least that was what I was hoping it would do. I sat in my car listening to 88.5, switching my gaze between the blue screen that displayed the radio station and the house. There was a break in the static and I knew for sure it wasn’t my imagination. I heard my name through the choppiness of the radio. The static cut back in. Then I heard my name again, just like before. I’m shivering just thinking of it, but the static broke one last time before I sped off and headed to work. “We’re waiting for you.” No. Just no. I told a couple friends and they suggested we go inside to see who is waiting for me. I told them to shove that idea up their asses. There is no way I’m going to go inside that building. I’ve been looking up online if it is possible for someone to use an FM transmitter from inside their house. Part way through, I realized something that worried me even greater: even if someone was transmitting their own signal, how did they know my name? I’m really freaked out at this point and I’m currently trying to find out if anyone else has experienced this type of thing before. Needless to say, I’ve gone back to listening to my CDs for now.
0non-cybersec
Reddit
1,123
4,864
convert private key to bitcoin address using python or php. <p>I have private key like this <code>5JYJWrRd7sbqEzL9KR9dYTGrxyLqZEhPtnCtcvhC5t8ZvWgS9iC</code> how to convert to bicoin address using python or php?</p> <p>example bitcoin address <code>18V7u8YNHKwG944TCkzYYj32hb6fdFPvQf</code></p>
0non-cybersec
Stackexchange
130
295
How to set the background color of a Row() in Flutter?. <p>I'm trying to set up a background color for a Row() widget, but Row itself has no background color or color attribute. I've been able to set the background color of a container to grey, right before the purple-backgrounded text, but the text itself does not fill the background completely and the following spacer does not take any color at all.</p> <p>So how can I have the Row background set to the "HexColor(COLOR_LIGHT_GREY)" value so it spans over the whole row? </p> <p>Any idea? Thanks a lot!</p> <p><a href="https://i.stack.imgur.com/hCeM3.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hCeM3.png" alt="enter image description here"></a></p> <p>Here's the code that I have so far:</p> <pre><code>import 'package:flutter/material.dart'; import '../manager/ShoppingListManager.dart'; import '../model/ShoppingListModel.dart'; import '../hexColor.dart'; import '../Constants.dart'; class ShoppingListWidget extends StatelessWidget { final Color color = Colors.amberAccent; final int shoppingListIndex; ShoppingListWidget({this.shoppingListIndex}); @override Widget build(BuildContext context) { ShoppingListManager slm = new ShoppingListManager(); String shoppingListName = slm.myShoppingLists.shoppingLists[shoppingListIndex].name; int categoryCount = slm.myShoppingLists.shoppingLists[shoppingListIndex].categories.length; return Scaffold( appBar: AppBar( title: Text(shoppingListName), automaticallyImplyLeading: true, ), body: ListView.builder( itemBuilder: (context, index) { Category cat = slm.myShoppingLists.shoppingLists[shoppingListIndex] .categories[index]; return Container( decoration: new BoxDecoration( border: new Border.all(color: Colors.grey[500]), color: Colors.white, ), child: new Column( children: &lt;Widget&gt;[ getCategoryWidget(context, cat), getCategoryItems(context, cat), ], ), ); }, itemCount: categoryCount, ), ); } // Render the category "headline" row where I want to set the background color // to HexColor(COLOR_LIGHT_GREY) Widget getCategoryWidget(BuildContext context, Category cat) { return new Row( children: &lt;Widget&gt;[ new Container(height: 40.0, width: 10.0, color: HexColor(cat.color)), new Container( height: 40.0, width: 15.0, color: HexColor(COLOR_LIGHT_GREY)), new Container( child: new Text("Category", textAlign: TextAlign.start, style: TextStyle( fontFamily: 'Bold', fontSize: 18.0, color: Colors.black), ), decoration: new BoxDecoration( color: Colors.purple, ), height: 40.0, ), Spacer(), CircleAvatar( backgroundImage: new AssetImage('assets/icons/food/food_settings.png'), backgroundColor: HexColor(COLOR_LIGHT_GREY), radius: 15.0, ), new Container(height: 15.0, width: 10.0, color: Colors.transparent), ], ); } // render the category items Widget getCategoryItems(BuildContext context, Category cat) { return ListView.builder( itemBuilder: (context, index) { String itemName = "Subcategory"; return new Row(children: &lt;Widget&gt;[ new Container(height: 40.0, width: 5.0, color: HexColor(cat.color)), new Container(height: 40.0, width: 20.0, color: Colors.white), new Container( child: new Text(itemName), color: Colors.white, ), Spacer() ]); }, itemCount: cat.items.length, shrinkWrap: true, physics: ClampingScrollPhysics(), ); } } </code></pre>
0non-cybersec
Stackexchange
1,148
4,013
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
349
1,234
Unable to join windows server 2012 r2 domain. <p>Hi I'm using two virtual box machines one machine is win7 and other win server 2012 r2. When I try to join the domain it get the following message An Active directory Domain Controller (AD DC) could not be contacted. I have done ipconfig/all if it helps I did nslookup found the DNS request time out. So where to from here? How do I fix this issue?</p> <p>P.S I'm new at this! </p> <hr> <p>Vbox network settings Internal cable is connected.</p> <pre><code>C:\Users\Administrator&gt;ipconfig/all Windows IP Configuration Host Name . . . . . . . . . . . . : SERVER2012VM_SH Primary Dns Suffix . . . . . . . : nwk305sh.local Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No DNS Suffix Search List. . . . . . : nwk305sh.local Ethernet adapter Ethernet: Connection-specific DNS Suffix . : Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Desktop Adapter Physical Address. . . . . . . . . : 08-00-27-50-1C-3F DHCP Enabled. . . . . . . . . . . : No Autoconfiguration Enabled . . . . : Yes IPv4 Address. . . . . . . . . . . : 10.1.10.2(Preferred) Subnet Mask . . . . . . . . . . . : 255.0.0.0 Default Gateway . . . . . . . . . : 10.1.10.1 DNS Servers . . . . . . . . . . . : 10.1.10.2 10.1.10.1 NetBIOS over Tcpip. . . . . . . . : Enabled </code></pre> <p>Win7 <code>ipconfig</code></p> <pre><code>Ethernet adapter Local Area Connection: Connection-specific DNS Suffix . : NWK305sh.local IPv4 Address. . . . . . . . . . . : 10.1.10.100 Subnet Mask . . . . . . . . . . . : 255.0.0.0 Default Gateway . . . . . . . . . : 10.1.10.1 Tunnel adapter isatap.NWK305sh.local: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : NWK305sh.local C:\Users\Win7-SH&gt; </code></pre>
0non-cybersec
Stackexchange
716
1,951
Tragedy after login Unity from unity-greeter (lightdm) launched from processing unity. <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://askubuntu.com/questions/73576/appearance-does-not-change-on-switching-the-theme">Appearance does not change on switching the theme</a> </p> </blockquote> <p><strong>Prorouge</strong> <em>:( Naughty Me haz launched unity-greeter (lightdm) on gnome-terminal with processing unity.</em></p> <p>I accidentally login with the same user with my single click.</p> <p><strong>Edit</strong> It seems it would be easier to figure it out by graphic:</p> <p><img src="https://i.stack.imgur.com/iTK0O.png" alt="reproduce step"></p> <p>Then I clicked the box and logged in.</p> <p>The theme all sessions in the same user account changes like the following:</p> <p><img src="https://i.stack.imgur.com/gcWRW.png" alt="problem shot"></p> <p><img src="https://i.stack.imgur.com/2l6JO.png" alt="problem shot2"></p> <p><img src="https://i.stack.imgur.com/IRkmB.png" alt="problem shot3"></p> <p>In my opinion, this maybe a problem of mis-detection of icon-theme? or GTK+ theme? or Shell theme?</p> <p>Or, worst, the broken behavior of whole system before login</p> <p>I have try these steps but meaningless ( in my own user ):</p> <blockquote> <ol> <li>reboot</li> <li>unity --reset &amp;&amp; reboot</li> <li>rm -rf ~/.config/compiz &amp;&amp; reboot</li> <li>apply theme at System Setting > Appearance and reboot</li> <li>reinstall unity-greeter, lightdm</li> </ol> </blockquote> <p>Here are the facts I have found out:</p> <blockquote> <ol> <li>ugly-themed interface in gnome3-fallback-session, Unity 2D, Unity with the same user</li> <li>normal interface in Guest session</li> <li>broken shutdown function in whole system EVEN before the broken user has been logged in ( in a new boot up process ).</li> </ol> </blockquote> <p>According to fact#3, I weakly believe everything goes wrong before the broken user has been logged in.</p> <p>Series of problems are brought out, something like</p> <blockquote> <ol> <li>unable to unlock user (account) setting with disabled unlock button ( and add &amp; delete button )</li> <li>crash in ubuntu software center</li> </ol> </blockquote> <p>Due to the fact that I have found out many 'complication', I believe that I would reinstall the whole system if it cannot be solved by fixing a little but major problem.</p> <p>Thanks for involvement. :)</p>
0non-cybersec
Stackexchange
818
2,494
Execute a script on package manager console via Tools &gt; External tools. <p>I would like to be able to run Entity Framework Cores dbScaffold by using a shortcut. so far this works well if I use entity framework core's CLI tools and link that script as external tool (<a href="https://nickmeldrum.com/blog/how-to-run-powershell-scripts-from-solution-explorer-in-visual-studio-2010" rel="nofollow noreferrer">as described here</a>).</p> <p>but this requires the EF tools to be installed. If I execute that script in package manager console just having the EF Core Design nuget package referenced is enough. </p> <p>So my question is: Is there any way to execute a .ps1 script from Tools > External tools inside Visual studio 2019 on the package manager console?</p>
0non-cybersec
Stackexchange
203
768
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
349
1,234
Cannot line break in chemical equation in flowchart using mhchem and TikZ. <p>I can't seem to get a line break mid equation; in this example, to fit in a box (and not change the size of the box). my usual method of <code>\\</code> is not working.</p> <pre><code>\documentclass[12pt]{report} \usepackage{tikz} \usepackage[version=3]{mhchem} \usepackage{amsmath} \begin{document} \centering \begin{figure} \tikzstyle{1L} = [rectangle, draw, text width=8cm, text centered, fill=blue!20] \tikzstyle{2L} = [rectangle, draw, text width=5cm, text centered, fill=blue!20] \tikzstyle{arrow} = [thick,-&gt;,&gt;=stealth,-to,shorten &gt;=5pt, shorten &lt;=2pt] \begin{tikzpicture}[node distance=4cm] \node (1L) [1L] {\underline{Oxidation} \begin{equation} \ce{ $\underset{\text{Pyrite}}{\cf{FeS2}}$ + 3.5O2 + H2O -&gt; Fe^2+ + 2SO4+2- + 2H+} \end{equation} }; \node (2L) [2L,below of=1L, minimum height=3em] {Fe$^{2+}$}; \draw [arrow] (1L)--(2L); \end{tikzpicture} \caption{Flowchart} \end{figure} \end{document} </code></pre>
0non-cybersec
Stackexchange
404
1,042
How to use numba together with functools.reduce(). <p>I have the following code where I am trying to parallel loop using <code>numba</code>, <code>functools.reduce()</code> and <code>mul</code>:</p> <pre><code>import numpy as np from itertools import product from functools import reduce from operator import mul from numba import jit, prange lst = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] arr = np.array(lst) n = 3 flat = np.ravel(arr).tolist() gen = np.array([list(a) for a in product(flat, repeat=n)]) @jit(nopython=True, parallel=True) def mtp(gen): results = np.empty(gen.shape[0]) for i in prange(gen.shape[0]): results[i] = reduce(mul, gen[i], initializer=None) return results mtp(gen) </code></pre> <p>But this is giving me an error:</p> <pre><code>--------------------------------------------------------------------------- TypingError Traceback (most recent call last) &lt;ipython-input-503-cd6ef880fd4a&gt; in &lt;module&gt; 10 results[i] = reduce(mul, gen[i], initializer=None) 11 return results ---&gt; 12 mtp(gen) ~\Anaconda3\lib\site-packages\numba\dispatcher.py in _compile_for_args(self, *args, **kws) 399 e.patch_message(msg) 400 --&gt; 401 error_rewrite(e, 'typing') 402 except errors.UnsupportedError as e: 403 # Something unsupported is present in the user code, add help info ~\Anaconda3\lib\site-packages\numba\dispatcher.py in error_rewrite(e, issue_type) 342 raise e 343 else: --&gt; 344 reraise(type(e), e, None) 345 346 argtypes = [] ~\Anaconda3\lib\site-packages\numba\six.py in reraise(tp, value, tb) 666 value = tp() 667 if value.__traceback__ is not tb: --&gt; 668 raise value.with_traceback(tb) 669 raise value 670 TypingError: Failed in nopython mode pipeline (step: nopython frontend) Invalid use of Function(&lt;built-in function reduce&gt;) with argument(s) of type(s): (Function(&lt;built-in function mul&gt;), array(int32, 1d, C), initializer=none) * parameterized In definition 0: AssertionError: raised from C:\Users\HP\Anaconda3\lib\site-packages\numba\parfor.py:4138 In definition 1: AssertionError: raised from C:\Users\HP\Anaconda3\lib\site-packages\numba\parfor.py:4138 This error is usually caused by passing an argument of a type that is unsupported by the named function. [1] During: resolving callee type: Function(&lt;built-in function reduce&gt;) [2] During: typing of call at &lt;ipython-input-503-cd6ef880fd4a&gt; (10) File "&lt;ipython-input-503-cd6ef880fd4a&gt;", line 10: def mtp(gen): &lt;source elided&gt; for i in prange(gen.shape[0]): results[i] = reduce(mul, gen[i], initializer=None) ^ </code></pre> <p>I am not sure where I have gone wrong. Can anyone point me to the right direction? Many thanks.</p>
0non-cybersec
Stackexchange
996
2,976
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
349
1,234
Probability of drawing cards on specific draw counts. <blockquote> <p>There is a deck of $30$ cards, each card labeled a number from $1$ to $15$, with exactly $2$ copies of a card for each number. You draw $8$ cards. What is the probability that you draw the number '$1$' card by the $5$th draw (on the $5$th draw or before that), AND also drawing the number '$2$' card on or before the $8$th draw?</p> </blockquote> <p>I know how to compute the probability of drawing both the cards on or before the $5$th draw:</p> <p>$$\frac{\binom{2}{1}\cdot \binom{2}{1} \cdot \binom{26}{3}}{\binom{30}{5}}$$</p> <p>Since there's $2$ ways to choose from each of the '$1$' and '$2$' cards, and then there's $26$ cards left after those $4$ cards so the other $3$ cards can be any of those $26$, and the total number of combinations you can draw $5$ cards from $30$.</p> <p>But we want to expand this search to $8$ draws, and also at the same time want to have assumed that we have already drawn the '$1$' card on or before the $5$th draw (if we don't get the '$2$' card by the $5$th draw. How can I combine these ideas? Thanks</p>
0non-cybersec
Stackexchange
353
1,123
color value drawable resource issue. <p>I have an image that is 1900*1200 in a folder called drawable-sw600dp that id like to have used on a nexus 7. When I try to run the app the main activity the screen is white and I get the following error:</p> <pre><code>java.lang.NumberFormatException: Color value '@drawable-sw600dp/background5' must start with # at com.android.layoutlib.bridge.impl.ResourceHelper.getColor(ResourceHelper.java:71) at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:248) at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:782) </code></pre> <p>Could it be that the image is too large to use? Or what could cause this error to happen?</p> <p>This is in my activity_main.xml where the background is set:</p> <p> <pre><code>xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background5" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin" android:id="@+id/MainLayout" tools:context=".MainActivity"&gt; </code></pre> <p>In my other folders drawable-hdpi,-mdpi there is no problem. However I made the .jpg image a higher resolution and now it creates this error, thats why I suspect the high resolution is causing the issue.</p>
0non-cybersec
Stackexchange
429
1,481
How can I get rid of this invisible file?. <h2>Background</h2> <p>I have a folder named <code>akorg✽</code>. That Unicode character causes headaches for me when software makes incorrect assumptions about the text encoding of my file paths, so I'd like to remove it from the name.</p> <h2>The problem</h2> <p>You'd think this would be easy:</p> <pre><code>$ mv akorg✽ akorg mv: cannot move ‘akorg✽’ to a subdirectory of itself, ‘akorg/akorg✽’ </code></pre> <p>but—that's strange—it thinks a folder called <code>akorg</code> already exists. I'm pretty sure there isn't one:</p> <pre><code>$ ls -la total 699K drwxr-xr-x 15 ak ak 15 Jun 12 17:34 . drwxr-xr-x 57 ak ak 4.0K Jun 12 17:35 .. drwxr-xr-x 11 ak ak 21 Jun 12 16:58 akorg✽ drwxr-xr-x 2 ak ak 2 May 28 20:47 Desktop ... </code></pre> <p>Still, <code>stat</code> says otherwise:</p> <pre><code>$ stat akorg File: ‘akorg’ Size: 21 Blocks: 33 IO Block: 1536 directory Device: 15h/21d Inode: 292128 Links: 11 ... </code></pre> <p>So apparently there is an invisible folder in the way. Whatever, I'll just remove it:</p> <pre><code>$ rmdir akorg rmdir: failed to remove ‘akorg’: No such file or directory </code></pre> <p>Right, then. What in the world is this thing?</p> <h2>What I know so far</h2> <ul> <li>I'm using the <a href="https://launchpad.net/~zfs-native/+archive/stable" rel="nofollow">stable release</a> of <a href="http://zfsonlinux.org/" rel="nofollow">ZFS on Linux</a>. Here's the <a href="http://paste.ubuntu.com/5759985/" rel="nofollow">zpool status and zfs properties</a>.</li> <li><p><code>stat</code> returns the same inode for both <code>akorg</code> and <code>akorg✽</code>. Searching by that inode returns only <code>akorg✽</code>:</p> <pre><code>$ find . -maxdepth 1 -inum 292128 ./akorg✽ </code></pre></li> <li><p>More things that don't work on the "invisible" folder:</p> <pre><code>$ rm akorg rm: cannot remove ‘akorg’: Is a directory $ unlink akorg unlink: cannot unlink ‘akorg’: Is a directory $ mv akorg akorg_temp mv: cannot move ‘akorg’ to ‘akorg_temp’: No such file or directory </code></pre></li> <li>I get the same results in both Bash 4.2.45 and zsh 5.0.0. In both, tab-completion of <code>ak</code> returns only <code>akorg✽/</code>.</li> <li>The <a href="http://paste.ubuntu.com/5762504/" rel="nofollow">strace</a> of my initial renaming attempt confirms that I'm typing the names correctly and that the attempt is thwarted by the preexistence of a folder named <code>akorg</code>.</li> <li><p>This response to a more explicit renaming attempt is puzzling and scary:</p> <pre><code>$ mv --verbose --no-target-directory --no-clobber akorg✽ akorg removed ‘akorg✽’ </code></pre> <p>I don't understand why it claims to have removed <code>akorg✽</code>, or why it would try. Fortunately, <code>ls</code> and <code>stat akorg akorg✽</code> reveal that nothing is actually gone. Here's the <a href="http://paste.ubuntu.com/5762743/" rel="nofollow">strace</a>.</p></li> <li><p>To rule out encoding quirks as the cause of this, I've temporarily given <code>akorg✽</code> an intermediate name:</p> <pre><code>$ mv --verbose --no-target-directory --no-clobber akorg✽ bananas ‘akorg✽’ -&gt; ‘bananas’ </code></pre> <p>That worked as expected,</p> <pre><code>$ ls -la total 715K drwxr-xr-x 16 ak ak 16 Jun 13 15:11 . drwxr-xr-x 57 ak ak 4.0K Jun 13 14:03 .. drwxr-xr-x 11 ak ak 21 Jun 12 16:58 bananas drwxr-xr-x 2 ak ak 2 May 28 20:47 Desktop ... </code></pre> <p>but the "invisible" folder is still present:</p> <pre><code>$ stat bananas akorg File: ‘bananas’ Size: 21 Blocks: 33 IO Block: 1536 directory Device: 15h/21d Inode: 292128 Links: 11 ... File: ‘akorg’ Size: 21 Blocks: 33 IO Block: 1536 directory Device: 15h/21d Inode: 292128 Links: 11 ... </code></pre> <p>and <code>mv</code> still behaves strangely when I try to use the name <code>akorg</code>:</p> <pre><code>$ mv --verbose --no-target-directory --no-clobber bananas akorg removed ‘bananas’ </code></pre></li> </ul>
0non-cybersec
Stackexchange
1,495
4,084
Shitty Ask MakeupAddiction. Inspired by /r/shittyaskscience and more recently a [Shitty Ask Fragrance](https://www.reddit.com/r/fragrance/comments/4vl8ll/shitty_ask_fragrance/) thread on /r/fragrance, let's do a Shitty Ask MakeupAddiction. Perfect for Text Only Tuesday. The idea is simple... ask a shitty question and we'll give shitty answers. For example, [one of the recent threads](https://www.reddit.com/r/shittyaskscience/comments/4vres0/a_thermos_keeps_drinks_warm_in_winter_and_cold_in/) on /r/shittyaskscience is "A thermos keeps drinks warm in winter and cold in summer. But how does the thermos know when it's summer or winter?" One of the answers to the question is essentially "wild thermoses are warm blooded".
0non-cybersec
Reddit
223
728
How or is that possible to prove or falsify `forall (P Q : Prop), (P -&gt; Q) -&gt; (Q -&gt; P) -&gt; P = Q.` in Coq?. <p>I want to prove or falsify <code>forall (P Q : Prop), (P -&gt; Q) -&gt; (Q -&gt; P) -&gt; P = Q.</code> in Coq. Here is my approach.</p> <pre><code>Inductive True2 : Prop := | One : True2 | Two : True2. Lemma True_has_one : forall (t0 t1 : True), t0 = t1. Proof. intros. destruct t0. destruct t1. reflexivity. Qed. Lemma not_True2_has_one : (forall (t0 t1 : True2), t0 = t1) -&gt; False. Proof. intros. specialize (H One Two). inversion H. </code></pre> <p>But, <code>inversion H</code> does nothing. I think maybe it's because the coq's proof independence (I'm not a native English speaker, and I don't know the exact words, please forgive my ignorance), and coq makes it impossible to prove One = Two -> False. But if so why has to coq eliminate the content of a proof?</p> <p>Without the above proposition, I can't prove the followings or their negations.</p> <pre><code>Lemma True_neq_True2 : True = True2 -&gt; False. Theorem iff_eq : forall (P Q : Prop), (P -&gt; Q) -&gt; (Q -&gt; P) -&gt; P = Q. </code></pre> <p>So my question is:</p> <ol> <li>How to or is that possible to prove or falsify <code>forall (P Q : Prop), (P -&gt; Q) -&gt; (Q -&gt; P) -&gt; P = Q.</code> in Coq?</li> <li>Why <code>inversion H</code> does nothing; does it's because the coq's proof independence, and if so, why does Coq waste energy in doing this.</li> </ol>
0non-cybersec
Stackexchange
571
1,493
NP-Hard vs NP-Complete Why NP-complete so important?. <p>A problem <span class="math-container">$L$</span> is NP-complete when:-</p> <ol> <li><span class="math-container">$L\in \text{NP}$</span></li> <li>For every problem <span class="math-container">$L' \in \text{NP}$</span>, <span class="math-container">$L'$</span> is polynomial time reducible to <span class="math-container">$L$</span></li> </ol> <blockquote> <p>When at least property 2 is satisfied for a problem <span class="math-container">$L$</span> (but not necessarily property 1), then <span class="math-container">$L \in \text{NP-Hard}$</span>.</p> </blockquote> <p>When a problem <span class="math-container">$L\in \text{NP-Complete}$</span> is shown to have a polynomial-time solution, we say <span class="math-container">$\text{P}=\text{NP}$</span> due to <a href="https://en.wikipedia.org/wiki/Cook%E2%80%93Levin_theorem" rel="nofollow noreferrer">Cook-Levin Theorom</a>.</p> <blockquote> <p>Wikipedia states:</p> <p>An important consequence of the theorem is that if there exists a deterministic polynomial time algorithm for solving Boolean satisfiability, then there exists a deterministic polynomial time algorithm for solving all problems in NP. Crucially, the same follows for any NP complete problem.</p> </blockquote> <p>This can be attributed to transitivity property of polynomial-time reductions.</p> <p>If we are able to show that a problem <span class="math-container">$L''$</span> already known to be in NP-complete to be polynomial-time reducible to the problem <span class="math-container">$L$</span>, then <span class="math-container">$L$</span> satisfies property 2 by transitivity.</p> <p>Well as the <strong>property 2 is satisfied by the NP-Hard problems too.</strong></p> <p>My assumptions -</p> <ol> <li>A known NP-Hard problem is polynomial-time reducible to a unknown problem <span class="math-container">$L$</span>. Then <span class="math-container">$L$</span> should satisfy property 2 too. So, <span class="math-container">$L$</span> is NP-Hard. If <span class="math-container">$L\in \text{NP}$</span> also true, then <span class="math-container">$L\in \text{NP-complete}$</span>.</li> <li>If <span class="math-container">$L \in \text{NP-Hard}$</span> but not shown to be NP yet and we have a deterministic polynomial-time algorithm for <span class="math-container">$L$</span> then <span class="math-container">$\text{P}=\text{NP}$</span>.</li> </ol> <p>Now, my questions-</p> <ol> <li>Are my assumptions above true? - <a href="https://en.wikipedia.org/?title=NP-hard" rel="nofollow noreferrer">Wikipedia</a> says it is true. Please confirm and provide other good references to check my assumptions.</li> <li>If above is true, why are the NP-Complete class considered so important when the answer to P=NP rests on existence of a deterministic polynomial-time algorithm to any NP-Hard problem (be it NP-Complete or not)?</li> </ol>
0non-cybersec
Stackexchange
898
2,927
How do I solve quadratic equations when the coefficients are complex and real?. <p>I needed to solve this: $$x^2 + (2i-3)x + 2-4i = 0 $$</p> <p>I tried the quadratic formula but it didn't work. So how do I solve this without "guessing" roots? If I guess $x=2$ it works; then I can divide the polynomial and find the other root; but I can't "guess" a root.</p> <p>$b^2-4ac=4i-3$, now I have to work with $\sqrt{4-3i}$ which I don't know how. Apparently $4i-3$ is equal to $(1+2i)^2$, but I don't know how to get to this answer, so I am stuck.</p>
0non-cybersec
Stackexchange
189
548
can&#39;t browse secure sites, not chrome firefox or opera. <p>I can't browse any secure site in Ubuntu 13.04. And I mean any site! Even when sites use somethings like Google analytics, HTTPS, CSS or JavaScript or something, I have to refresh sometimes to see the site. </p> <p>For example, I can't visit gmail, but I can browse the same site on a Windows 8 machine running through qemu on this Ubuntu!</p> <p>I could visit HTTPS sites before, but beginning some days ago, I can't.</p> <p>Any help is appreciated.</p>
0non-cybersec
Stackexchange
148
521
Is there a way to trigger gesture events on Mac OS X?. <p>I want to trigger multitouch gesture events on Mac OS X. Is there a way to do this? Mouse or keyboard events can be triggered with CGEventCreateMouseEvent and CGEventCreateKeyboardEvent. Is there similar low level function for multitouch events?</p> <p>Rok</p> <hr> <p>Your suggestion is not working. I've tried this code: <code><pre>- (void)rotateWithEvent:(NSEvent *)event { NSLog(@"ROTATE"); } -(IBAction)button:(id)sender { CGEventSourceRef eventSource = CGEventSourceCreate(kCGEventSourceStateCombinedSessionState); CGEventRef event = CGEventCreate(eventSource); CGEventSetType(event, NSEventTypeRotate); CGEventPost(kCGHIDEventTap, event); NSLog(@"POST EVENT"); }</pre></code></p> <p>But function rotateWithEvent never gets called. Am I doing something wrong?</p>
0non-cybersec
Stackexchange
259
856
Question about elementary row operations with block matrices. <p>Given two <span class="math-container">$n \times n$</span> matrices <span class="math-container">$A$</span> and <span class="math-container">$B$</span>, form a new block matrix </p> <p><span class="math-container">$$P := \begin{bmatrix}I_n&amp;B\\-A&amp;0\end{bmatrix}$$</span></p> <p>Then by using only elementary row operations, show that <span class="math-container">$P$</span> can be transformed into</p> <p><span class="math-container">$$P' := \begin{bmatrix}I_n&amp;B\\0&amp;AB\end{bmatrix} $$</span> </p> <hr> <p>The solution to this problem is:</p> <p><span class="math-container">$$P = \begin{bmatrix}I_n&amp;B\\-A&amp;0\end{bmatrix} \sim \begin{bmatrix}I_n&amp;B\\-A + AI_n &amp;0 + AB\end{bmatrix} \sim \begin{bmatrix}I_n&amp;B\\0&amp;AB\end{bmatrix}$$</span></p> <p>I don't understand this solution. Why can <span class="math-container">$A$</span> be multiplied from the left on the first half of the matrix and then be added to the second half of the matrix to form a sequence of elementary row operations?</p>
0non-cybersec
Stackexchange
381
1,096
Different menu for different tabs in tab+swipe application for android project. <p>I am a beginner to android applications and java, basically I am a PHP developer.</p> <p>I've a project for a tab+swipe application,</p> <h2><em><strong>Reseller.java</em></strong></h2> <pre><code>package com.idevoc.onsitereseller; import java.util.ArrayList; import android.app.ActionBar; import android.app.ActionBar.Tab; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.MenuInflater; public class Reseller extends FragmentActivity { FragmentTransaction transaction; static ViewPager mViewPager; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_reseller); Fragment tabOneFragment = new TabOne(); Fragment tabTwoFragment = new TabTwo(); PagerAdapter mPagerAdapter = new PagerAdapter(getSupportFragmentManager()); mPagerAdapter.addFragment(tabOneFragment); mPagerAdapter.addFragment(tabTwoFragment); //transaction = getSupportFragmentManager().beginTransaction(); mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mPagerAdapter); mViewPager.setOffscreenPageLimit(2); mViewPager.setCurrentItem(0); mViewPager.setOnPageChangeListener( new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between pages, select the // corresponding tab. getActionBar().setSelectedNavigationItem(position); } }); ActionBar ab = getActionBar(); ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); Tab tab1 = ab.newTab().setText("Tab One") .setTabListener(new TabListener&lt;TabOne&gt;( this, "tabone", TabOne.class)); Tab tab2 = ab.newTab().setText("Tab Two") .setTabListener(new TabListener&lt;TabTwo&gt;( this, "tabtwo", TabTwo.class)); ab.addTab(tab1); ab.addTab(tab2); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu, menu); return true; } public static class TabListener&lt;T extends Fragment&gt; implements ActionBar.TabListener { private Fragment mFragment; private final Activity mActivity; private final String mTag; private final Class&lt;T&gt; mClass; /** Constructor used each time a new tab is created. * @param activity The host Activity, used to instantiate the fragment * @param tag The identifier tag for the fragment * @param clz The fragment's Class, used to instantiate the fragment */ public TabListener(Activity activity, String tag, Class&lt;T&gt; clz) { mActivity = activity; mTag = tag; mClass = clz; } /* The following are each of the ActionBar.TabListener callbacks */ public void onTabSelected(Tab tab, FragmentTransaction ft) { // Check if the fragment is already initialized if (mFragment == null) { // If not, instantiate and add it to the activity mFragment = Fragment.instantiate(mActivity, mClass.getName()); ft.add(android.R.id.content, mFragment, mTag); } else { // If it exists, simply attach it in order to show it ft.attach(mFragment); } } public void onTabUnselected(Tab tab, FragmentTransaction ft) { if (mFragment != null) { // Detach the fragment, because another one is being attached ft.detach(mFragment); } } public void onTabReselected(Tab tab, FragmentTransaction ft) { // User selected the already selected tab. Usually do nothing. } public void onTabReselected(Tab arg0, android.app.FragmentTransaction arg1) { } public void onTabSelected(Tab arg0, android.app.FragmentTransaction arg1) { mViewPager.setCurrentItem(arg0.getPosition()); } public void onTabUnselected(Tab arg0, android.app.FragmentTransaction arg1) { } } public class PagerAdapter extends FragmentPagerAdapter{ private final ArrayList&lt;Fragment&gt; mFragments = new ArrayList&lt;Fragment&gt;(); public PagerAdapter(FragmentManager manager){ super(manager); } public void addFragment(Fragment fragment){ mFragments.add(fragment); notifyDataSetChanged(); } @Override public int getCount() { return mFragments.size(); } @Override public Fragment getItem(int position) { return mFragments.get(position); } } } </code></pre> <h2><em><strong>TabOne.java</em></strong></h2> <pre><code> package com.idevoc.onsitereseller; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class TabOne extends Fragment { public static final String ARG_SECTION_NUMBER = "section_number"; @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tab_a, container, false); return view; } } </code></pre> <h2><em><strong>TabTwo.java</em></strong></h2> <pre><code> package com.idevoc.onsitereseller; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class TabTwo extends Fragment { @Override public void onActivityCreated(Bundle savedInstanceState){ super.onActivityCreated(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.tab_a, container, false); return view; } } </code></pre> <p>Here I am loading two tabs for the application and loading a common menu, but I need to load a different menu for different tabs like:</p> <p>if the tab is TabOne then load menu_a, if tab is TabTwo then load menu_b with different options. I don't want to load the common menu. How can I do this?</p>
0non-cybersec
Stackexchange
1,924
7,191
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
349
1,234
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
349
1,234
What causes long sequences of consecutive &#39;collatz&#39; paths to share the same length?. <p>I asked <a href="https://math.stackexchange.com/q/470782/20792">Longest known sequence of identical consecutive Collatz sequence lengths?</a> some time ago, but I don't feel like it really got to the bottom of things.</p> <p>See, in the answers <a href="https://math.stackexchange.com/a/470820/20792">lopsy</a> find a sequence in the range of $596310 ... 596349$ and makes a heuristic argument:</p> <blockquote> <p>There's nothing special about these numbers, as far as I can see. In fact, there are probably arbitrary long sequences of consecutive numbers with identical Collatz lengths. Here's a heuristic argument:</p> <p>A number $n$ usually takes on the order of ~$\text{log}(n)$ Collatz steps to reach $1$.</p> <p>Suppose all of the numbers between $1$ and $n$ have random Collatz lengths between $1$ and ~$\text{log}(n)$. Then, if we choose a starting point at random, the probability that the next $X$ consecutive numbers all have the same Collatz length is ~$\text{log}(n)^X$. There are ~$n$ possible starting points, so we want $X$ so that the probability is $\text{log}(n)^X \cong &gt; \frac{1}{n}$. Then I'd expect the longest sequence to have around $X$ consecutive numbers.</p> <p>As it turns out, $X=\frac{\text{log}(n)}{\text{log}\text{log}(n)}$ does the trick.</p> </blockquote> <p>Except in the comments exchanged afterwards I point out that:</p> <blockquote> <p>log(596349)/log(log(596349)) ~ 7, not 40</p> </blockquote> <p>(that should be <a href="https://www.google.co.uk/search?q=log(596310)%2Flog(log(596349))" rel="nofollow noreferrer"><code>log(596310)/log(log(596349))</code></a> but the comment holds)</p> <p>So Heuristically we're expecting 33 fewer consecutive sequences of the same length, seem like a massive outlier.</p> <p>So perhaps these sequences are <em>special</em>; what causes them to to arise?</p>
0non-cybersec
Stackexchange
640
1,981
Using a global object in React Context that is not related to state. <p>I want to have a global object that is available to my app where I can retrieve the value anywhere and also set a new value anywhere. Currently I have only used Context for values that are related to state i.e something needs to render again when the value changes. For example:</p> <pre><code>import React from 'react'; const TokenContext = React.createContext({ token: null, setToken: () =&gt; {} }); export default TokenContext; import React, { useState } from 'react'; import './App.css'; import Title from './Title'; import TokenContext from './TokenContext'; function App() { const [token, setToken] = useState(null); return( &lt;TokenContext.Provider value={{ token, setToken }}&gt; &lt;Title /&gt; &lt;/TokenContext.Provider&gt; ); } export default App; </code></pre> <p>How would I approach this if I just want to store a JS object in context (not a state) and also change the value anywhere?</p>
0non-cybersec
Stackexchange
281
1,013
Secure password encryption/decryption of strings in PHP. <p>I wanted to know if there exists a somewhat simple, but secure, method to encrypt strings(not passwords), with a password which is not stored on the server, in PHP.</p> <p>I've checked <a href="http://www.tonymarston.net/php-mysql/encryption.html">A reversible password encryption routine for PHP</a>, but I'm unsure if it is secure enough if intruders have access to the server and source.</p> <p>We're talking about a automatic system where a computer sends a request to a server, which stores information in a log. So I'm thinking I could send the encryption password in the request header, preferably encrypted, but then it would be difficult to decrypt without storing the password somehow on the server. Wait, I think i might be complicating things a bit too much, but I hope you get the idea... It's meant to keep the information safe, even if hackers have full control over the server.</p>
0non-cybersec
Stackexchange
230
960
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
349
1,234
Any scenario for using both, OpenID Connect and OAuth 2.0?. <p>Since OpenID Connect builds on OAuth 2.0, I am assuming that everything that is possible with OAuth 2.0 is also possible with OpenID Connect.</p> <p>In particular, say that my website stores some information that belongs to the user and implements OpenID Connect to authenticate users. When the user is authenticating through another website, that website can use the same OpenID Connect flow to obtain authorization from the user to give it access to that user's information on my website.</p> <p>Is that statement correct? Could there be any scenario where I would need to implement OAuth 2.0 independently of OpenID Connect?</p>
0non-cybersec
Stackexchange
164
697
async &amp; await - How to wait until all Tasks are done?. <p>ok. I made a simple console app to figure out how to make all this work. Once I have the basic outline working, then I'll apply it to the real application.</p> <p>The idea is that we have a lot of database calls to execute that we know are going to take a long time. We do NOT want to (or have to) wait for one database call to be completed before we make the next. They can all run at the same time.</p> <p>But, before making all of the calls, we need to perform a "starting" task. And when all of the calls are complete, we need to perform a "finished" task. </p> <p>Here's where I'm at now:</p> <pre><code>static void Main(string[] args) { Console.WriteLine("starting"); PrintAsync().Wait(); Console.WriteLine("ending"); // Must not fire until all tasks are finished Console.Read(); } // Missing an "await", I know. But what do I await for? static async Task PrintAsync() { Task.Run(() =&gt; PrintOne()); Task.Run(() =&gt; PrintTwo()); } static void PrintOne() { Console.WriteLine("one - start"); Thread.Sleep(3000); Console.WriteLine("one - finish"); } static void PrintTwo() { Console.WriteLine("two - start"); Thread.Sleep(3000); Console.WriteLine("two - finish"); } </code></pre> <p>But no matter what I try, <code>Ending</code> always gets printed too early:</p> <pre><code>starting ending one - start two - start one - finish two - finish </code></pre> <p>What IS working right is that <code>PrintTwo()</code> starts before <code>PrintOne()</code> is done. But how do I properly wait for <code>PrintAsync()</code> to finish before doing anything else?</p>
0non-cybersec
Stackexchange
502
1,697
2019 Apr 8 Stickied helpdesk thread - Do you need HELP? Do you need IDEAS? LOOK HERE!. [Link to last week's thread](https://www.reddit.com/r/raspberry_pi/comments/b8jh5q/2019_apr_2_stickied_helpdesk_thread_do_you_need/) This thread is the place to ask your questions that Google couldn't help with!^(†) Looking for help with a project? Have a question that you need answered? Was it not answered last week? Did not get a satisfying answer? A question that you haven't done any research for? Maybe something you think everyone but you knows? Ask it here! # [Check out the Frequently Asked Questions (FAQ) here](https://www.reddit.com/r/raspberry_pi/wiki/faq) Perhaps you just want ideas of what to do with that Raspberry Pi that's been sitting in a drawer or maybe you haven't even purchased yet. Well look no further, [there's a huge list of ideas right here!](https://www.reddit.com/r/raspberry_pi/search?q=flair%3Atutorial+OR+flair%3Aproject&restrict_sr=on&sort=relevance&t=all) ([link for users using broken mobile apps](https://goo.gl/bX3HBn)) Before posting your question think about if it's really about the Raspberry Pi or not. If you were doing math homework using a Bic pen, would you ask on pen forums for math help? **There may be better places to ask your question**, such as /r/AskProgramming, /r/learnpython, /r/AskElectronics, or /r/linuxquestions. Asking in a forum more specific to your question will likely *get better answers*! Questions should be on topic, concise, and answerable. Answers must be a real answer that solves the question. Are you a regular of /r/raspberry_pi? [**Please don't downvote this thread just because you already know everything!**](https://xkcd.com/1053/) The more people that see this this helpdesk and idea thread the less the front page will be filled with questions like these: * does anyone have any project ideas * do I need 5 pis to do 5 things * why won't windows read my SD card after it was in the Pi * can I use another computer as a monitor * can I replace the OS on the SD card with another OS * can I upgrade the CPU or GPU or RAM * why do I only get a blank screen * how to tie a tie * can I use this LCD as a screen * what's a Raspberry Pi * how do I ssh * how do I watch Netflix * can anyone google this for me # If you're just looking for ideas, [there's a huge list of ideas right here!](https://www.reddit.com/r/raspberry_pi/search?q=flair%3Atutorial+OR+flair%3Aproject&restrict_sr=on&sort=relevance&t=all) ([link for users using broken mobile apps](https://goo.gl/bX3HBn)) --- † [See the /r/raspberry\_pi rules.](https://www.reddit.com/r/raspberry_pi/about/rules/) While /r/raspberry_pi should not be considered your personal search engine, some exceptions will be made in this help thread.
0non-cybersec
Reddit
803
2,766
Is there a better/more efficient way to capture composite X windows in Linux?. <p>As per subject I have the following pseudo-code to setup window capture in X (Linux):</p> <pre class="lang-cpp prettyprint-override"><code>xdisplay = XOpenDisplay(NULL); win_capture = ...find the window to capture... XCompositeRedirectWindow(xdisplay, win_capture, CompositeRedirectAutomatic); XGetWindowAttributes(xdisplay, win_capture, &amp;win_attr); // attributes used later GLXFBConfig *configs = glXChooseFBConfig(xdisplay, win_attr.root, config_attrs, &amp;nelem); // cycle through the configs to // find a valid one ... win_pixmap = XCompositeNameWindowPixmap(xdisplay, win_capture); const int pixmap_attrs[] = {GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT, GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT, None}; gl_pixmap = glXCreatePixmap(xdisplay, config, win_pixmap, pixmap_attrs); gl_ctx = glXCreateNewContext(xdisplay, config, GLX_RGBA_TYPE, 0, 1); glXMakeCurrent(xdisplay, gl_pixmap, gl_ctx); glEnable(GL_TEXTURE_2D); glGenTextures(1, &amp;gl_texmap); glBindTexture(GL_TEXTURE_2D, gl_texmap); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, win_attr.width, win_attr.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); </code></pre> <p>Then, much later on, this would be the loop to capture the frames:</p> <pre class="lang-cpp prettyprint-override"><code>glXMakeCurrent(xdisplay, gl_pixmap, gl_ctx); glBindTexture(GL_TEXTURE_2D, gl_texmap); glXBindTexImageEXT(xdisplay, gl_pixmap, GLX_FRONT_LEFT_EXT, NULL); glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, data); // data is output RGBA buffer glXReleaseTexImageEXT(xdisplay, gl_pixmap, GLX_FRONT_LEFT_EXT); </code></pre> <p>I basically do <code>glXBindTexImageEXT</code> -> <code>glGetTexImage</code> -> <code>glXReleaseTexImageEXT</code> so that I get an updated picture. It does work, but not sure I'm doing the right/optimal thing.</p> <p>Is there a better/more optimized way to get such picture/context?</p>
0non-cybersec
Stackexchange
741
2,132
Set a Max allocated size for a sellected storage path in db2. <p>I have a DB2 storage group with storage paths set like</p> <p>C:\</p> <p>D:\</p> <p>E:\</p> <p>Size of my C: drive is 100 GB and the other programs keep crashing because it fill data drive by one, even I can allocate more storage and extend this it first fill free space In my c:\ drive and move to new storage, I like to know is it possible to give a max size for 1 particular drive(storage path) and how? </p> <p>NOTE : If I can change the PathState to 'NotInUse' will it fix this , will it effect the editing of the existing data in that path ? </p> <p>INFO: DB2 10.1</p> <pre><code>C:\IBM\SQLLIB\BIN&gt;db2pd -storagepaths -tablespaces -db DEMO Database Member 0 -- Database DEMO -- Active -- Up 0 days 17:16:44 -- Date 02/09 /2016 11:06:24 Storage Group Configuration: Address SGID Default DataTag Name 0x000007FFCCFCAE40 0 Yes 0 DEMOFORTEST Storage Group Statistics: Address SGID State Numpaths NumDropPen 0x000007FFCCFCAE40 0 0x00000000 2 0 Storage Group Paths: Address SGID PathID PathState PathName 0x000007FFCCFF7560 0 0 InUse C: 0x000007FFCCFCAF60 0 1 InUse E: Database Member 0 -- Database DEMO -- Active -- Up 0 days 17:16:44 -- Date 02/09 /2016 11:06:24 Tablespace Configuration: Address Id Type Content PageSz ExtentSz Auto Prefetch BufID BufIDD isk FSC NumCntrs MaxStripe LastConsecPg Name 0x000007FFC0018BC0 0 DMS Regular 32768 4 Yes 4 1 1 Off 1 0 3 SYSCATSPACE 0x000007FFC0021460 1 SMS SysTmp 32768 32 Yes 32 1 1 On 1 0 31 TEMPSPACE1 0x000007FFC002C360 2 DMS Large 32768 32 Yes 32 1 1 Off 1 0 31 USERSPACE1 0x000007FFC0035360 3 DMS Large 32768 4 Yes 4 1 1 Off 1 0 3 SYSTOOLSPACE 0x000007FFC003E300 4 DMS Regular 32768 16 No 16 1 1 Off 2 1 15 STORE_TS 0x000007FFC0047480 5 DMS Regular 32768 16 No 16 1 1 Off 2 1 15 INDEX_TS 0x000007FFC0055B00 6 DMS Large 32768 16 No 16 1 1 Off 2 1 15 LOB_TS Tablespace Statistics: Address Id TotalPgs UsablePgs UsedPgs PndFreePgs FreePgs HWM Max HWM State MinRecTime NQuiescers PathsDropped TrackmodStat e 0x000007FFC0018BC0 0 7168 7164 6944 0 220 6944 6944 0x00000000 0 0 No n/a 0x000007FFC0021460 1 1 1 1 0 0 0 0 0x00000000 0 0 No n/a 0x000007FFC002C360 2 1024 992 96 0 896 96 96 0x00000000 0 0 No n/a 0x000007FFC0035360 3 1024 1020 80 0 940 80 80 0x00000000 0 0 No n/a 0x000007FFC003E300 4 1477648 1477616 1476624 0 992 1476624 1476624 0x00000000 0 0 No n/a 0x000007FFC0047480 5 248832 248800 247792 0 1008 247792 247792 0x00000000 0 0 No n/a 0x000007FFC0055B00 6 9134368 9134336 9134112 0 224 9134112 9134112 0x00000000 0 0 No n/a Tablespace Autoresize Statistics: Address Id AS AR InitSize IncSize IIP M axSize LastResize LRF 0x000007FFC0018BC0 0 Yes Yes 33554432 -1 No N one None No 0x000007FFC0021460 1 Yes No 0 0 No 0 None No 0x000007FFC002C360 2 Yes Yes 33554432 -1 No N one None No 0x000007FFC0035360 3 Yes Yes 33554432 -1 No N one None No 0x000007FFC003E300 4 Yes Yes 33554432 -1 No N one 02/09/2016 10:12:09.687557 No 0x000007FFC0047480 5 Yes Yes 33554432 -1 No N one 02/09/2016 10:52:17.557144 No 0x000007FFC0055B00 6 Yes Yes 33554432 -1 No N one None No Tablespace Storage Statistics: Address Id DataTag Rebalance SGID SourceSGID 0x000007FFC0018BC0 0 0 No 0 - 0x000007FFC0021460 1 0 No 0 - 0x000007FFC002C360 2 -1 No 0 - 0x000007FFC0035360 3 -1 No 0 - 0x000007FFC003E300 4 -1 No 0 - 0x000007FFC0047480 5 -1 No 0 - 0x000007FFC0055B00 6 -1 No 0 - Containers: Address TspId ContainNum Type TotalPgs UseablePgs PathID Str ipeSet Container 0x000007FFC00558C0 0 0 File 7168 7164 0 0 C:\DB2\NODE0000\DEMO\T0000000\C0000000.CAT 0x000007FFC002A080 1 0 Path 1 1 1 0 E:\DB2\NODE0000\DEMO\T0000001\C0000000.TMP 0x000007FFC00350A0 2 0 File 1024 992 0 0 C:\DB2\NODE0000\DEMO\T0000002\C0000000.LRG 0x000007FFC003E040 3 0 File 1024 1020 0 0 C:\DB2\NODE0000\DEMO\T0000003\C0000000.LRG 0x000007FFC0047040 4 0 File 1303568 1303552 0 0 C:\DB2\NODE0000\DEMO\T0000004\C0000000.USR 0x000007FFC0047250 4 1 File 174080 174064 1 1 E:\DB2\NODE0000\DEMO\T0000004\C0000001.USR 0x000007FFC0050220 5 0 File 164864 164848 0 0 C:\DB2\NODE0000\DEMO\T0000005\C0000000.USR 0x000007FFC0050430 5 1 File 83968 83952 1 1 E:\DB2\NODE0000\DEMO\T0000005\C0000001.USR 0x000007FFC0050BE0 6 0 File 6504736 6504720 0 0 C:\DB2\NODE0000\DEMO\T0000006\C0000000.LRG 0x000007FFC0050DF0 6 1 File 2629632 2629616 1 1 E:\DB2\NODE0000\DEMO\T0000006\C0000001.LRG </code></pre>
0non-cybersec
Stackexchange
2,102
6,584
SerialPort not receiving any data. <p>I am developing program which need to interact with COM ports.</p> <p>By learning from this Q&amp;A: <a href="https://stackoverflow.com/questions/2281618/net-serialport-datareceived-event-not-firing">.NET SerialPort DataReceived event not firing</a>, I make my code like that.</p> <pre><code>namespace ConsoleApplication1 { class Program { static SerialPort ComPort; public static void OnSerialDataReceived(object sender, SerialDataReceivedEventArgs args) { string data = ComPort.ReadExisting(); Console.Write(data.Replace("\r", "\n")); } static void Main(string[] args) { string port = "COM4"; int baud = 9600; if (args.Length &gt;= 1) { port = args[0]; } if (args.Length &gt;= 2) { baud = int.Parse(args[1]); } InitializeComPort(port, baud); string text; do { String[] mystring = System.IO.Ports.SerialPort.GetPortNames(); text = Console.ReadLine(); int STX = 0x2; int ETX = 0x3; ComPort.Write(Char.ConvertFromUtf32(STX) + text + Char.ConvertFromUtf32(ETX)); } while (text.ToLower() != "q"); } private static void InitializeComPort(string port, int baud) { ComPort = new SerialPort(port, baud); ComPort.PortName = port; ComPort.BaudRate = baud; ComPort.Parity = Parity.None; ComPort.StopBits = StopBits.One; ComPort.DataBits = 8; ComPort.ReceivedBytesThreshold = 9; ComPort.RtsEnable = true; ComPort.DtrEnable = true; ComPort.Handshake = System.IO.Ports.Handshake.XOnXOff; ComPort.DataReceived += OnSerialDataReceived; OpenPort(ComPort); } public static void OpenPort(SerialPort ComPort) { try { if (!ComPort.IsOpen) { ComPort.Open(); } } catch (Exception e) { throw e; } } } } </code></pre> <p>My problem is DataReceived event never gets fired.</p> <p>My program specifications are:</p> <ol> <li>Just .net console programming</li> <li>I use VSPE from <a href="http://www.eterlogic.com" rel="nofollow noreferrer">http://www.eterlogic.com</a></li> <li>My computer has COM1 and COM2 ports already.</li> <li>I created COM2 and COM4 by using VSPE.</li> <li>I get output result from mystring array (COM1, COM2, COM3, COM4)</li> </ol> <p>But I still don't know why <code>DataReceived</code> event is not fired.</p> <hr> <h1>Updated</h1> <p>Unfortunately, I still could not make to fire <code>DataReceived</code> event in any way.</p> <p>So, I created new project by hoping that I will face a way to solve.</p> <p>At that new project [just console application], I created a class...</p> <pre><code>public class MyTest { public SerialPort SPCOM4; public MyTest() { SPCOM4 = new SerialPort(); if(this.SerialPortOpen(SPCOM4, "4")) { this.SendToPort(SPCOM4, "com test..."); } } private bool SerialPortOpen(System.IO.Ports.SerialPort objCom, string portName) { bool blnOpenStatus = false; try { objCom.PortName = "COM" + portName; objCom.BaudRate = 9600; objCom.DataBits = 8; int SerParity = 2; int SerStop = 0; switch (SerParity) { case 0: objCom.Parity = System.IO.Ports.Parity.Even; break; case 1: objCom.Parity = System.IO.Ports.Parity.Odd; break; case 2: objCom.Parity = System.IO.Ports.Parity.None; break; case 3: objCom.Parity = System.IO.Ports.Parity.Mark; break; } switch (SerStop) { case 0: objCom.StopBits = System.IO.Ports.StopBits.One; break; case 1: objCom.StopBits = System.IO.Ports.StopBits.Two; break; } objCom.RtsEnable = false; objCom.DtrEnable = false; objCom.Handshake = System.IO.Ports.Handshake.XOnXOff; objCom.Open(); blnOpenStatus = true; } catch (Exception ex) { throw ex; } return blnOpenStatus; } private bool SendToPort(System.IO.Ports.SerialPort objCom, string strText) { try { int STX = 0x2; int ETX = 0x3; if (objCom.IsOpen &amp;&amp; strText != "") { objCom.Write(Char.ConvertFromUtf32(STX) + strText + Char.ConvertFromUtf32(ETX)); } } catch (Exception ex) { throw ex; } return true; } } </code></pre> <p>I am not sure that I face good luck or bad luck because this new class could make fire <code>DataReceived</code> event which is from older console application that is still running. It is miracle to me which I have no idea how this happen.</p> <p>Let me tell you more detail so that you could give me suggestion for better way.</p> <ol> <li>Finally I created 2 console projects.</li> <li>First project is the class which I posted as a question yesterday.</li> <li>Second project is the class called MyTest which could make fire <code>DataReceived</code> event from First project, at the same time when two of the project is running.</li> </ol> <p>Could anyone give me suggestions on how could I combine these two projects as a single project?</p>
0non-cybersec
Stackexchange
1,735
5,903
Compute e^x for float values in System Verilog?. <p>I am building a neural network running on an FPGA, and the last piece of the puzzle is running a sigmoid function in hardware. This is either:</p> <pre><code>1/(1 + e^-x) </code></pre> <p>or</p> <pre><code>(atan(x) + 1) / 2 </code></pre> <p>Unfortunately, x here is a float value (a <code>real</code> value in SystemVerilog). </p> <p>Are there any tips on how to implement either of these functions in SystemVerilog?</p> <p>This is really confusing to me since both of these functions are complex, and I don't even know where to begin implementing them due to the added complexity of being float values.</p>
0non-cybersec
Stackexchange
207
666
[Build Complete] - White Prodigy M on Air - 4670k/GTX 680. **Photos:** http://imgur.com/a/cWg13/ ------------------- Australian build commenced in October 2013, finished building in November 2013. Finished overclocking and testing on 1st of November. **Name:** White Prodigy M on Air **Size:** SFF mITX - Gaming PC **Purpose:** Gaming - Overclocking - Video Editing **Build Log Pictures :** http://imgur.com/a/cWg13/ **Final Build Log Video:**http://youtu.be/xR8a3SzjbzU ------------------------- **Info**: Overclocked 4670K build, with the GTX 680 to punch out the games. All cooled on air, and fit tight in the Prodigy M. **Research:** Mid/High-Range Gaming PC, bargain hunting and looking around for the right parts, the cheapest overclocking gear, and the fans to cool my rig. This is what i came up with. If you subbed out the $500 SSD, this would be a $1600 Rig. **Shoutouts and Acknowledgements:** * David Chen, Sam and Co. @ [ARC Computers Penrith](http://arc.com.au/pub.php) for sourcing as many parts as they could for my build * Les/Pete/John for their DIY advice * /u/karmapopsicle @ /r/buildapcforme where i mod * [PCCaseGear](http://www.pccasegear.com) in Melbourne Australia ----------------- **Build problems**: * *Manouvering round the case* If i could give one piece of advice in building in the Prodigy M, it would be to install small components first (fans, usb 3.0 and cables), then RAM, then put the rest in after. Building it outside the rig is almost impossible, particularly when screwing down the motherboard, and the CPU cooler. SATA cables are literally IMPOSSIBLE to take the cable out. Have to have someone with small hands nearby. * *Installing the Noctua NH-D14 Cooler:* Had to mount one of the fans higher, to provide allowance for RAM, and the thing definitely was a squeeze in this case. If you have to access anything around it you'll have to do it before installation * *CABLE MANAGEMENT:* What a BITCH! There is nowhere really out of the way, besides the side panel to route your cables, but with the side panel I/O on the backside of the motherboard, it really becomes super limited. I didn't want to install the panel on the opening side, because disconnecting and reconnecting all those wires would be an even worse fate then death. So with all my might and about an hour of cable tying and routing, i managed all the cables with a Side Panel which needed a bit of force to put in place ----------------- **The List**: Type|Item|Price :----|:----|:---- **CPU** | [Intel Core i5-4670K 3.4GHz Quad-Core Processor](http://au.pcpartpicker.com/part/intel-cpu-bx80646i54670k) | $278.72 @ ARC Penrith **CPU Cooler** | [Noctua NH-D14 65.0 CFM CPU Cooler](http://au.pcpartpicker.com/part/noctua-cpu-cooler-nhd14) | $89.00 @ ARC Penrith **Motherboard** | [Gigabyte GA-Z87M-D3HP Micro ATX LGA1150 Motherboard](http://au.pcpartpicker.com/part/gigabyte-motherboard-gaz87md3h10) | $129.00 @ PCCaseGear **Fan Controller** | [Bitfenix Recon Fan Controller](https://www.google.com.au/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCsQFjAA&url=http%3A%2F%2Fwww.bitfenix.com%2Fglobal%2Fen%2Fproducts%2Faccessories%2Frecon%2F&ei=mS-TUpqpMqKjigeanoDABw&usg=AFQjCNEtUdW1SX4I2vwNtfwfkj299-HF9A&sig2=t0pP_C_bOVIWybxtC9IQ2g&bvm=bv.56988011,d.aGc) | $39.00 @ PCCaseGear **Fan** | [Bitfenix Spectre Pro 230mm White LEDs](https://http://pcpartpicker.com/part/bitfenix-case-fan-bfflpro23030wrp) | $27.00 @ ARC Penrith **Fan** | [Bitfenix Spectre Pro 140mm White LEDs](http://pcpartpicker.com/part/bitfenix-case-fan-bfflpro14025wrp) | $23.10 @ ARC Penrith **Memory** | [Corsair Vengeance 8GB (2 x 4GB) DDR3-1600 Memory](http://au.pcpartpicker.com/part/corsair-memory-cmz8gx3m4x1600c9) | $53.33 @ eBay **Storage** | [Samsung 840 Pro Series 512GB 2.5" Solid State Disk](http://au.pcpartpicker.com/part/samsung-internal-hard-drive-mz7pd512bw) | $450.00 @ eBay **Video Card** | [EVGA GeForce GTX 680 2GB Video Card](http://au.pcpartpicker.com/part/evga-video-card-02gp43682kr) | $315.58 @ PLE Wangara **Wireless Network Adapter** | [TP-Link TL-WN822N 802.11b/g/n USB 2.0 Wi-Fi Adapter](http://au.pcpartpicker.com/part/tp-link-wireless-network-card-tlwn822n) | $23.00 @ ARC Penrith **Case** | [BitFenix Prodigy M Arctic White MicroATX Mini Tower Case](http://au.pcpartpicker.com/part/bitfenix-case-bfcprm300wwxkwrp) | $112.86 @ ARC Penrith **Power Supply** | [Silverstone Strider Plus 600W 80+ Bronze Certified ATX Power Supply](http://au.pcpartpicker.com/part/silverstone-power-supply-st60fp) | $119.00 @ PCCaseGear **Operating System** | [Microsoft Windows 8.1 Pro - 64-bit - OEM (64-bit)](http://au.pcpartpicker.com/part/microsoft-os-885370635003) | $61.00 @ ARC Penrith **Keyboard** | [Cooler Master CM Storm QuickFire TK - Limited Edition White Wired Standard Keyboard](http://au.pcpartpicker.com/part/cooler-master-keyboard-sgk4020gkcr2us) | $130 @ eBay **Mouse** | [Logitech G500s Laser Gaming Mouse Wired Laser Mouse](http://au.pcpartpicker.com/part/logitech-mouse-910003602) | $63.00 @ ARC Penrith **Headphones** | [SteelSeries Siberia v2 Headset](http://au.pcpartpicker.com/part/steelseries-headphones-51104) | $69.00 @ Mwave Australia | | **Total** | Prices include shipping, taxes, and discounts when available. | $2012.88 | Generated by PCPartPicker 2013-11-25 21:59 EST+1100 | **Results**: On that tiny cooler i managed to get the CPU to 4.0GHz with a fair voltage boost. However, any further it would throttle something fierce. Boot up at 4.2GHz max. I'm still playing around with testing to try and kick it to at least 4.2 stable. The Summer weather doesn't help Waiting on that Black Friday Amazon BF4 Sale to really put it through its paces. ----------------- **Questions:** Feel free to PM me or comment about anything to do with the build.
0non-cybersec
Reddit
1,961
5,814
When calling a function in debug mode, GDB is crashed. <p>I'm trying to make a c++ program on Windows using MinGW.</p> <p>The built program runs fine, Nevertheless, the problem occurs while debugging.</p> <p>When debugging, If I try to inspect a execution result of function or method, like screenshots below, GDB is forced terminated.</p> <p>I've ran GDB as a command line, the result has been the same though.</p> <p>I also changed MinGW to different version, but to no avail.</p> <p>GDB on WSL is working fine without any problems by the same configurations.</p> <p>It's not working only on native Windows.</p> <p>I would appreciate if you let me know why.</p> <hr> <pre><code>Just before watching "add(2, 3)". </code></pre> <p><a href="https://i.stack.imgur.com/PkFM0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PkFM0.png" /></a></p> <pre><code>ERROR: GDB exited unexpectedly. Debugging will now abort. </code></pre> <p><a href="https://i.stack.imgur.com/P0V2p.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/P0V2p.png" /></a></p> <hr> <pre><code>The same result of GDB command line. "p v[1]", "p v.at(1)", "p v.empty()", "p v.size()", ... were failed, "p add(2, 3)", "p my_obj.func()", ... were crashed. </code></pre> <p><a href="https://i.stack.imgur.com/hEfST.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hEfST.png" /></a></p> <hr> <pre><code>G++ version is 8.1.0 gdb version is 8.1 </code></pre> <p><a href="https://i.stack.imgur.com/XWvJd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XWvJd.png" /></a></p>
0non-cybersec
Stackexchange
609
1,619
[Squat form] I have seriously long legs, and It's difficult to maintain proper form. [LINK TO GIF](http://gfycat.com/GroundedInnocentHerculesbeetle) I've been squatting for about a year now, and while I've seen some strength gains (current 1RM is 95kg), I have a really hard time going to parallel with the heavier weight as my glutes go out really far and a lot of strain is put on my lower back. Any advice on how to fix this/my squat form in general is greatly appreciated! and yes I'm wearing girl trousers.
0non-cybersec
Reddit
138
514
AngularJS Karma-jasmine and visual studio 2015. <p>I have an angularJS application and now I would like to start testing it. So I have watched a few tutorials, but none of them show you how to set up testing with visual studio 2015. Does anyone know about a good resource to read or can help me set it up.</p> <p>The questions I have are:</p> <ol> <li>Do I need to set up separate views for each test?</li> <li>Apart from installing karma-jasmine and karma-chrome-launcher do I need to install anything else?</li> <li>How can I view my tests in a browser?</li> </ol> <p>Any help given will be awesome.</p>
0non-cybersec
Stackexchange
184
610
Prove an equality with floor function.. <p>Let $p\in \Bbb N \ne 0$ and $x\in \Bbb R$.</p> <p>prove that</p> <p>$$\left\lfloor \frac {\lfloor px \rfloor}{p} \right\rfloor=\lfloor x\rfloor$$</p> <p>I tried using the double inequality $$\lfloor px\rfloor \le px&lt;\lfloor px\rfloor +1$$</p> <p>and divided by $p$ but a small problem remains.</p>
0non-cybersec
Stackexchange
136
348
Asymptotic behavior of the hypergeometric function. <p>I'm trying to understand the asymptotic behavior of the hypergeometric function <span class="math-container">$$ _2F_1(a, b; c; z) $$</span> at fixed argument <span class="math-container">$0 &lt; z &lt; 1$</span> when some of the parameters <span class="math-container">$a$</span>, <span class="math-container">$b$</span> and <span class="math-container">$c$</span> are large.</p> <p>There are two specific cases I'm interested in, but I only know the answer in one of them. Let me start with the solved example to set the stage:</p> <p>1) Consider <span class="math-container">$$ _2F_1(a + n, b + n; c + 2n; z) $$</span> in the limit <span class="math-container">$n \to \infty$</span>. In this case one can use the saddle-point method in the integral representation of the hypergeometric function to show that <span class="math-container">$$ _2F_1(a + n, b + n; c + 2n; z) \approx (1-z)^{(c-a-b-1/2)/2} \left( 2 \frac{1 - \sqrt{1-z}}{z} \right)^{2n + c - 1} $$</span> This is the kind of result I'm after: it shows that the hypergeometric function grows at most like <span class="math-container">$2^{2n}$</span> when <span class="math-container">$|z|&lt;1$</span>.</p> <p>2) Now consider the other case of interest <span class="math-container">$$ _2F_1(a + n, b - n; c; z) $$</span> It is similar to the first case in the sense that the parameters are "balanced" in <span class="math-container">$n$</span>. But now one of these parameters goes negative at large <span class="math-container">$n$</span>, and I can observe numerically that the function oscillates in <span class="math-container">$n$</span>. I assume that there should be an asymptotic expression for the amplitude of these oscillations, but I am not able to get one.</p> <p>I cannot make progress neither with the saddle-point method nor with a variety of hypergeometric identities. Does anyone have a solution, or at least a suggestion on how to attack the problem?</p>
0non-cybersec
Stackexchange
620
1,995
I&#39;m getting InvalidCastException while actually casting nothing. <pre><code>AutoResetEvent receiver = new AutoResetEvent(false); Thread t = null; t = new Thread(new ThreadStart(() =&gt; { while (Browser.ReadyState != WebBrowserReadyState.Complete) // error { Thread.Sleep(10); } receiver.Set(); t.Abort(); })); t.Start(); // Timeout success = receiver.WaitOne(10000); </code></pre> <p>Browser is</p> <pre><code>public WebBrowser Browser { get; set; } </code></pre> <p><img src="https://i.stack.imgur.com/xdIyo.png" alt="Screenshot"></p> <p>I don't really understand why I get such error. The Browser.ReadyState is a enum type <code>WebBrowserReadyState</code></p> <p>So what do you think?</p> <p>EDIT: <strong>First:</strong> <img src="https://i.stack.imgur.com/GKVu8.png" alt="SS1"> <strong>Second:</strong> <img src="https://i.stack.imgur.com/2fj1V.png" alt="SS2"></p>
0non-cybersec
Stackexchange
332
1,055
Big $O$ -- $k^n$ vs $(k-1)^n\cdot n$, $(k&gt;1)$. <p>I tried to do the following:</p> <p><span class="math-container">$$ k^n = (k-1)^n\cdot \left(\frac{k}{k-1}\right)^{n}$$</span></p> <p>Now if i compare the above expression on the R.H.S with <span class="math-container">$$(k-1)^n \cdot n$$</span> I just need to compare <span class="math-container">$n$</span> and <span class="math-container">$\left(\frac{k}{k-1}\right)^{n}$</span>.</p> <p>Now <span class="math-container">$\frac{k}{k-1}$</span> will definitely be greater than 1, so let <span class="math-container">$\frac{k}{k-1} = c$</span> , so this will reduce into <span class="math-container">$c^n$</span> which is greater than n.</p> <p>Where am i going wrong?</p> <p>The answer given is that <span class="math-container">$(k-1)^n\cdot n &gt; k^n$</span></p>
0non-cybersec
Stackexchange
317
822
$\{y_m\}_{m=1}^{\infty}$ does not converge to $y\in\mathbb{R}^\mathbb{N}$ with respect to box topology. <p>For each $m\in \mathbb{N}$, define $$y_m(j)= y(j), \;\;\;\;\mbox{if $\;\;$ $j\leq m$,}$$ and $$y_m(j)=0, \;\;\;\; \mbox{if $\;\;$ j&gt;m}.$$</p> <p>How will I show that $\{y_m\}_{m=1}^{\infty}$ does not converge to $y\in \mathbb{R}^\mathbb{N}$ such that $y(j)\neq 0$ for all $j\in\mathbb{N}$ when endowed in box topology.</p> <p>In particular, what open box in $\mathbb{R}^{\mathbb{N}}$ contains $y$ but not $y_m$?</p> <p>Please help me with this problem in the book. Thank you!</p>
0non-cybersec
Stackexchange
234
594
Help me with my DILLemma.... This one is weird... I grew up eating lots of dill (Eastern European lineage). I love the stuff. I've been cooking with it for years, mostly in soups. The past year or so, in Orange County, CA, I've been cooking soups and all the dill I buy around here is as bland as it gets- have shopped at Trader Joe's, Sprouts, Whole Foods, Stater Bros.- always flavorless. When you open the little packets to smell it, 95% have absolutely zero aroma and they've been adding virtually no flavor to my food, which are both just wrong for such an aromatic, fresh herb! When I visited my parents in LA a few weeks ago, we made dill pickle soup with fresh dill and sure enough, resplendent with dill flavor. I thought maybe the supply around here is bad or something. I asked some Russians at a local Russian market where they recommend getting dill, and they said Super King (a large ethnic supermarket chain) or a local Persian market whose name they couldn't recall. I exclaimed at Super King, since that's where we shop up in LA and I never had a clue they had one down here. I went right then and there to the local SK, found the dill, smelled it and tasted a bit, and it was right on! Success, right? Wrong. I smelled it once or twice to more to ensure it was potent, when this nasty, old sock/mildew smell hit me. I picked up another bunch- same. It was the case with all of them. I was disgusted and searched Yelp for the Persian market they recommended. Found a European/Middle Eastern market and went there. Same deal. "Real" dill but with real mildew/sock odor! Before smelling the bad part I tasted a tiny bit and it too, like SK's, had the flavor/potency I was looking for. (Note that never growing up, or since, had I smelled this stink with fresh dill, only the real, refreshing dill aroma.) So I'm both baffled and at a loss for a plan of action: 1. Why on Earth do all the supermarkets here have flavorless dill? It's all "organic" and expensive and of supposedly higher quality, but it tastes like water. It has no flavor and almost no smell, good or bad. 2. Likewise, why would local ethnic markets have actual potent dill? 3. The heck is this nasty funk? I know all the dill at these markets is sitting in the open and drenched in water. That it (?) 4. What do I do? I don't have the time to grow my own or go hunt down farmers' markets. I'm super busy and one of the reasons I make soups is that I can mindlessly and relatively quickly make up a huge pot to last me weeks. Simplicity is a selling point for me. Me needs good dill that doesn't stink! Help me, Moldy None?
0non-cybersec
Reddit
672
2,619
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
349
1,234
How to display an image that we received through Ajax call?. <p>Web server generates images and sends them to client directly. There are no URLs to the images, for security reasons. For example, if I enter <code>/images/25</code> URL in the browser server will send it and browser will download it. </p> <p>Now I want to get this image from Ajax call and then display it on existing page. I can get the image data. My question is: how can I display an image?</p> <pre><code>$.get("/images/25", function (rawImageData) { // ??? Need to add an image to DOM }); </code></pre> <p><strong>Update</strong></p> <p>I apologize for being so stupid. Thank you, JW. Of course I can just put img tag with src to my URL. It does not matter if this is a direct URL to an image file or the server sends it dynamically.</p>
0non-cybersec
Stackexchange
226
815
Is $\exp \left(-\sum_{i=1}^d \frac{(x_i - y_i)^2}{s_i^2} \right) $ analytic in $\mathbf{x}$ on $\mathbb{R}^d$?. <p>I would like to know whether the following statement is true. </p> <p><strong>Conjecture</strong>: For all $\mathbf{y} \in \mathbb{R}^d$, $s_1&gt;0,\ldots,s_d&gt;0$, $f_{\mathbf{y}}(\mathbf{x}) := \exp \left(-\sum_{i=1}^d \frac{(x_i - y_i)^2}{s_i^2} \right) $ is analytic in $\mathbf{x}$ on $\mathbb{R}^d$.</p> <p>Apology if this is a very well known fact. I am not working in this area. </p> <p>If it is true, could you please give me a reference? If this is not known, could you please let me know how I might show it? So far, I have been trying to show it by using Proposition 2.2.10 in <a href="http://www.springer.com/la/book/9780817642648" rel="nofollow">A Primer of Real Analytic Functions</a> which gives a condition on the partial derivatives for a function on $\mathbb{R}^d$ to be analytic. I have not yet succeeded.</p> <p>Another thing I notice is that if $d=1$, then $f_y(x) = \exp\left( -(x-y)^2/s^2\right)$ is known as a <a href="https://en.wikipedia.org/wiki/Gaussian_function" rel="nofollow">Gaussian function</a>. A Gaussian function is known to be analytic. In our case, we have a product $d$ Gaussian functions. That is, $f_\mathbf{y}(\mathbf{x})$ is separately analytic on each coordinate of $\mathbf{x}$. I would like to know if it is jointly analytic in $\mathbf{x}$.</p> <p>Thanks. (This is not a homework question.)</p>
0non-cybersec
Stackexchange
503
1,465
Exit code of traps in Bash. <p>This is <code>myscript.sh</code>:</p> <pre><code>#!/bin/bash function mytrap { echo "Trapped!" } trap mytrap EXIT exit 3 </code></pre> <p>And when I run it:</p> <pre><code>&gt; ./myscript.sh echo $? 3 </code></pre> <p>Why is the exit code of the script the exit code with the trap the same as without it? Usually, a function returns implicitly the exit code of the last command executed. In this case:</p> <ol> <li>echo returns 0</li> <li>I would expect <code>mytrap</code> to return 0</li> <li>Since <code>mytrap</code> is the last function executed, the script should return 0</li> </ol> <p>Why is this not the case? Where is my thinking wrong?</p>
0non-cybersec
Stackexchange
249
694
Docker with yarn. <p>First time trying to get yarn and docker working together. How can I stop yarn from installing the packages every single time I run <code>docker build</code> command?</p> <p>I've found some solutions like storing <code>node_modules</code> in a temporary directory and then linking it, but with various packages installed I get too many errors to handle. Is there maybe a way to compare my <code>yarn.lock</code> with the one existing inside Docker or any other solutions?</p> <p>Dockerfile:</p> <pre><code>FROM node:8.9.1-alpine COPY package.json yarn.lock /usr/src/ RUN cd /usr/src \ &amp;&amp; yarn install --pure-lockfile COPY . /usr/src EXPOSE 3005 </code></pre> <p>With this setup I get a message saying <code>Sending build context to Docker daemon 375.2MB</code>, then the <code>yarn install</code> is run as usual, fetching the packages every single time.</p>
0non-cybersec
Stackexchange
267
899
How to prove what values of $\beta$ would $f{\left (x,y \right )} = -\beta x y + x^{2} + y^{2}$ is always greater than 0. <p>$\beta \in R$</p> <p>$f{\left (x,y \right )} = -\beta x y + x^{2} + y^{2}$</p> <p>For what values is $\beta$, $f(x,y) \geq 0$</p> <p>Note: I know that when $-2 \leq \beta \leq 2$, $f(x,y) \geq 0$, but how do I prove it?</p>
0non-cybersec
Stackexchange
160
352
Evaluating the arc length integral $\int\sqrt{1+\frac{x^4-8x^2+16}{16x^2}} dx$. <blockquote> <p>Find length of the arc from $2$ to $8$ of $$y = \frac18(x^2-8 \ln x)$$</p> </blockquote> <p>First I find the derivative, which is equal to $$\frac{x^2-4}{4x} .$$</p> <p>Plug it into the arc length formula $$\int\sqrt{1+\left(\frac{dy}{dx}\right)^2} dx$$ and get</p> <p>$$\int\sqrt{1+\frac{x^4-8x^2+16}{16x^2}} dx.$$</p> <p>I am not sure how to proceed from here, as I cant figure out a way to put the sqrt argument into a form that I can find the square root of</p>
0non-cybersec
Stackexchange
228
568
GRUB rescue error on installed Ubuntu 13.04 with my Windows 8 pro. I tried to merge a partition of e drive that was not my os drive. <p>I have installed Ubuntu 13.04 on my Windows 8 Pro of HP dv6 7012tx. When I am opening my laptop, its showing these error before showing Windows 8 logo.</p> <pre><code>error : unknown filesystem. grub rescue&gt; </code></pre> <p>Please help me to solve my problem as HP customer care told me to format my entire laptop what I don't wanna do. Help me to resolve or uninstalled Ubuntu via commandline.</p> <p>Thanks.</p>
0non-cybersec
Stackexchange
155
557
How does &#39;addEventListener` work behind the scenes?. <p>So, I have had this curiosity for quite a while now. I want to know, how <code>addEventListener</code> works behind the scenes. I know what it does but I am just not able to get my head around how it does it. </p> <p>I have checked many links and resources and <a href="https://stackoverflow.com/questions/33914044/how-does-addeventlistener-work-under-the-hood">this</a> is the one that was closest to what I was looking for but still no success.</p> <p>To clarify on what I am really looking for, I want to know how can one create his own <code>addEventListener</code> function that would take the first argument as the event name and the second argument as the callback that would accept the <code>eventArgs</code> argument.</p>
0non-cybersec
Stackexchange
209
793
Possible A Record Conflict. <p>I just inherited management of the domain names from another person who resigned from my company. I am new to this type of task. </p> <p>I want to map the new ip address I bought to the following example domain</p> <p>*.subdomain.apps.domain.com</p> <p>However when I look up the other anames in our domain, there is already an entry for *.apps.domain.com</p> <p>If I add the new A Name Record for *.subdomain.apps.domain.com mapped to the new ip address will there be a conflict if a user goes to the said domain having also an A Name for *.apps.domain.com? </p>
0non-cybersec
Stackexchange
172
599
Align multiple equations with text. <p>I have 4 equations (2 on each line) separated by text. I cannot get the equal signs (red box) to align. Here is the code to recreate the image:</p> <pre><code>\begin{equation*} \eta_{1 i}=x_{1 i}^{T} \beta \qquad \quad \eta_{2 i}=x_{2 i}^{T} \alpha \end{equation*} where \begin{equation*} \theta_{1}=h_{1}(\eta_{1 i}) \qquad \quad \theta_{2}=h_{2}(\eta_{2 i}) \end{equation*} </code></pre> <p><a href="https://i.stack.imgur.com/2s8lU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2s8lU.png" alt="enter image description here"></a></p> <p>I have tried with alignedat but cannot find a way to include the text "where" to be left justified</p> <pre><code> \begin{equation*} \begin{alignedat}{2} \eta_{1 i}&amp;=x_{1 i}^{T} \beta \qquad \quad &amp;\eta_{2 i}&amp;=x_{2 i}^{T} \alpha\\ \theta_{1}&amp;=h_{1}(\eta_{1 i}) \qquad \quad &amp;\theta_{2}&amp;=h_{2}(\eta_{2 i}) \end{alignedat} \end{equation*} </code></pre> <p><a href="https://i.stack.imgur.com/fKpkS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fKpkS.png" alt="enter image description here"></a></p>
0non-cybersec
Stackexchange
453
1,183
scikit-learn classification on soft labels. <p>According to the documentation it is possible to specify different loss functions to <code>SGDClassifier</code>. And as far as I understand <code>log loss</code> is a <code>cross-entropy</code> loss function which theoretically can handle soft labels, i.e. labels given as some probabilities [0,1].</p> <p>The question is: is it possible to use <code>SGDClassifier</code> with <code>log loss</code> function out the box for classification problems with soft labels? And if not - how this task (linear classification on soft labels) can be solved using scikit-learn?</p> <p><strong>UPDATE:</strong></p> <p>The way <code>target</code> is labeled and by the nature of the problem hard labels don't give good results. But it is still a classification problem (not regression) and I wan't to keep probabilistic interpretation of the <code>prediction</code> so regression doesn't work out of the box too. Cross-entropy loss function can handle soft labels in <code>target</code> naturally. It seems that all loss functions for linear classifiers in scikit-learn can only handle hard labels.</p> <p>So the question is probably:</p> <p>How to specify my own loss function for <code>SGDClassifier</code>, for example. It seems <code>scikit-learn</code> doesn't stick to the modular approach here and changes need to be done somewhere inside it's sources</p>
0non-cybersec
Stackexchange
364
1,401
Is it ok to use C# Property like this. <p>One of my fellow developer has a code similar to the following snippet <code></p> <pre><code>class Data { public string Prop1 { get { // return the value stored in the database via a query } set { // Save the data to local variable } } public void SaveData() { // Write all the properties to a file } } class Program { public void SaveData() { Data d = new Data(); // Fetch the information from database and fill the local variable d.Prop1 = d.Prop1; d.SaveData(); } } </code></pre> <p></code></p> <p>Here the Data class properties fetch the information from DB dynamically. When there is a need to save the Data to a file the developer creates an instance and fills the property using self assignment. Then finally calls a save. I tried arguing that the usage of property is not correct. But he is not convinced. </p> <p>This are his points</p> <ol> <li>There are nearly 20 such properties.</li> <li>Fetching all the information is not required except for saving.</li> <li>Instead of self assignment writing an utility method to fetch all will have same duplicate code in the properties.</li> </ol> <p>Is this usage correct? </p>
0non-cybersec
Stackexchange
363
1,369
What are the real life implications for an Apache 2 license?. <p>I want to use <a href="http://code.google.com/p/svg-edit/" rel="noreferrer">SVG Edit</a> for a project. This software is distributed under the Apache 2 license.</p> <p>I've seen that:</p> <ul> <li>all copies, modified or unmodified, are accompanied by a copy of the licence</li> <li>all modifications are clearly marked as being the work of the modifier</li> <li>all notices of copyright, trademark and patent rights are reproduced accurately in distributed copies</li> <li>the licensee does not use any trademarks that belong to the licensor</li> </ul> <p>Do these pertain to the code or should I display the license somewhere in the GUI? The <a href="http://svg-edit.googlecode.com/svn/branches/2.5.1/editor/svg-editor.html" rel="noreferrer">original software</a> displays a "powered by SVG Edit", is it ok if I remove this? And most importantly: what is the correct etiquette for doing this? I don't want to be a jerk, but at the same time I want to simplify the UI as much as possible and removing the link will be part of it if it's not considered <em>rude</em>.</p>
0non-cybersec
Stackexchange
336
1,140
is there a better way to handle index.html with Tornado?. <p><br> I want to know if there is a better way to handle my index.html file with Tornado.<br></p> <p>I use StaticFileHandler for all the request,and use a specific MainHandler to handle my main request. If I only use StaticFileHandler I got a 403: Forbidden error</p> <pre><code>GET http://localhost:9000/ WARNING:root:403 GET / (127.0.0.1): is not a file </code></pre> <p>here how I doing now:</p> <pre class="lang-py prettyprint-override"><code>import os import tornado.ioloop import tornado.web from tornado import web __author__ = 'gvincent' root = os.path.dirname(__file__) port = 9999 class MainHandler(tornado.web.RequestHandler): def get(self): try: with open(os.path.join(root, 'index.html')) as f: self.write(f.read()) except IOError as e: self.write("404: Not Found") application = tornado.web.Application([ (r"/", MainHandler), (r"/(.*)", web.StaticFileHandler, dict(path=root)), ]) if __name__ == '__main__': application.listen(port) tornado.ioloop.IOLoop.instance().start() </code></pre>
0non-cybersec
Stackexchange
379
1,152
Where&#39;s iOS 4.2 image file?. <p>On Apple Developers portal, under downloads I get this:</p> <p><img src="https://i.stack.imgur.com/cygEE.png" alt="alt text"></p> <p><strong>Where are the iPhone 3G / 4 / iPad versions of the OS?</strong></p> <p>As I had beta 2 on my iPad (I'm have a iOS developer account), and I want to update to the new one, iTunes says iPad has version 4.2 (witch is right, 4.2b) and mentions, that there is no newer version.</p>
0non-cybersec
Stackexchange
153
457
Discontinuity of principal argument in nonpositive real axis. <p>Let $\operatorname{Arg}(z)$ be principal argument function defined in branch $(-\pi, \pi]$.<br> Prove that $\operatorname{Arg}(z)$ is discontinuous in every point in nonpositive real axis.</p> <p>"Solution":<br> Let $z_0$ be a point on the nonpositive part of real axis.<br> By $z$ approaching $z_0$ "from below" the $\operatorname{Arg}(z)$ reaches $\pi$<br> By $z$ approaching $z_0$ "from top" the $\operatorname{Arg}(z)$ reaches $-\pi$<br> Therefore for two given paths $\operatorname{Arg}(z)$ has two different limits.<br> Therefore $\operatorname{Arg}(z)$ has no limit.</p> <p>Can you please help me find more rigorous solution which specifically bases on $\operatorname{Arg}(z) = \arctan\left(\frac{y}{x}\right) + \pi$? I understand that I have to find two paths for which $$\lim_{x \to x_0, \ y \to y_0}\operatorname{Arg}(z)$$ does not exist. But what are they?</p>
0non-cybersec
Stackexchange
294
942
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
349
1,234
natbib + BibTeX: suppress url if doi is available. <p>I am using <code>natbib</code> (+ BibTeX). Some entries in my bibliography file (<code>.bib</code>) have the field <code>doi</code>, some have <code>url</code> and some have both. I would like to edit the bibliography style file (<code>.bst</code>) so that, if <code>doi</code> is available, <code>url</code> is suppressed.</p> <p>At the moment, the <code>.bst</code> file has the functions:</p> <pre><code>FUNCTION {format.doi} { doi empty$ { "" } { new.block "\doi{" doi * "}" * } if$ } FUNCTION {format.url} { url duplicate$ empty$ { pop$ "" } { "\urlprefix\url{" swap$ * "}" * } if$ } </code></pre> <p>[I was looking for a solution to this problem and found some similar questions and answers. However, they didn't address this specific case. After searching and trying, I could solve it. I present the solution as a reply for my own question to document it.]</p>
0non-cybersec
Stackexchange
305
966
Differential Fault Analysis of AES. <p>Let's say: an error is induced into an implementation of the AES-128 to produce a faulty ciphertext. The error is a one-byte eror and is always induced on the last state byte, during round9, before the <code>MixColumns</code> operation. The induced errors are unknown and can be different. However the key is the same in both cases.</p> <p>Then how can I recover 4 bytes of the last round key? Which bytes of that round key can I recover and what's their value?</p> <pre><code>ciphertext1 = 0xe719f8ab9e0b846f0cf2e5c32a0e5b45 faultytext1 = 0xe719f86f9e0beb6f0c97e5c38b0e5b45 ciphertext2 = 0x78f272c7cf5383085fa240236d97130f faultytext2 = 0x78f27277cf53e7085f944023fa97130f </code></pre>
1cybersec
Stackexchange
256
729
Rails: Form for selecting an existing parent when creating new child records?. <p>I have a has_many and belongs_to association set up between two models: Project and Task. </p> <p>I'd like to be able to create a form which enables me to create a new Task and assign an existing Project as a parent. For example, this form might have a pulldown for selecting from a list of existing projects.</p> <p>There are only a finite set of projects available in this application, so I've created Project records via a seeds.rb file. I do not need to make a form for creating new Projects.</p> <p>I believe I've achieved a solution by using a <code>collection_select</code> form helper tag in the new Task form. I'm pretty happy with how this works now, but just curious if there are other approaches to this problem.</p> <pre><code>#models/project.rb class Project &lt; ActiveRecord::Base has_many :tasks, :dependent =&gt; :destroy end #models/task.rb class Task &lt; ActiveRecord::Base belongs_to :project end #controllers/tasks_controller.rb class TasksController &lt; ApplicationController def new @task = Task.new respond_to do |format| format.html # new.html.erb format.xml { render :xml =&gt; @task } end end def create @task = Task.new(params[:task]) respond_to do |format| if @task.save format.html { redirect_to(@task, :notice =&gt; 'Task was successfully created.') } format.xml { render :xml =&gt; @task, :status =&gt; :created, :location =&gt; @task } else format.html { render :action =&gt; "new" } format.xml { render :xml =&gt; @task.errors, :status =&gt; :unprocessable_entity } end end end end #views/new.html.erb &lt;h1&gt;New task&lt;/h1&gt; &lt;%= form_for(@task) do |f| %&gt; &lt;div class="field"&gt; &lt;%= f.label :name %&gt;&lt;br /&gt; &lt;%= f.text_field :name %&gt; &lt;/div&gt; &lt;div class="select"&gt; &lt;%= collection_select(:task, :project_id, Project.all, :id, :name) %&gt; &lt;/div&gt; &lt;div class="actions"&gt; &lt;%= f.submit %&gt; &lt;/div&gt; &lt;% end %&gt; &lt;%= link_to 'Back', tasks_path %&gt; </code></pre>
0non-cybersec
Stackexchange
730
2,188
My party's pet goblins. I'm currently running a 5th edition game using the Mines of Phandelver module, and my party came up against a unique difficulty. At the beginning of the module, when the party was ambushed by the Cragmaw clan, they captured one of the goblins alive and negotiated the location of the Cragmaw hideout in exchange for the goblin's life. Later, they took on the Redbrand ruffians, and came to a similar exchange with the goblin Droop: information in exchange for his life. It has gotten increasingly difficult for the party to justify their ever-growing menagerie of goblins, but they weren't sure what to do with the things. Both of the goblins had been entirely helpful to the good-aligned party (goblins being by nature both disloyal and cowardly), so the idealistic members of the party were loathe to summarily execute them, but the practical members of the party pointed out that the goblins would, if released on their own recognizance, immediately return to a life of raiding and scavenging from vulnerable human settlements for sustenance. One of the members of the party is a highly charismatic tiefling sorcerer, and he came up with the idea of convincing the goblins that all tieflings were, at one point, goblins. But through performing numerous good deeds over the years, they earned the right to ascend into tieflinghood. He rolled a natural 20 on his Charisma (deception) check, which made the goblins' Wisdom checks effectively moot. He convinced the *hell* out of them. There are now at least two goblins in Faerun who are convinced that, should they perform enough good works, they will become tieflings. And, having done so, they will be able to demand the respect that they deserve from their larger goblinoid cousins, the hobgoblins and bugbears.
0non-cybersec
Reddit
438
1,799