input
stringlengths
51
42.3k
output
stringlengths
18
55k
Styling a focused input in safari <p>I'm trying to apply custom styles to an input[type=range] and having issues applying those styles in Safari. Chrome, FF and IE are working properly (although FF and IE are not listed below in the code snippet). pe-color() are external scss functions calling stored variable colors. ...
<p>Everything you're looking for is in here <a href="https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/" rel="nofollow">https://css-tricks.com/styling-cross-browser-compatible-range-inputs-css/</a></p> <p>The reason you're not seeing any changes is because you probably haven't overwritten the de...
Node Server Does not Load HTML Page <p>I am having an issue here in my code... I have a server on NodeJS, which compiles very well without errors. But when I try to compile HTML files on the same root, localhost returns page not found.</p> <p>Please check my codes below and the file tree. Correct me where I am wrong.<...
<p>I have solved the problem by following each line of code one after another. I tried to compare the entire code with another server sample. I noticed that I did not include <code>app.use('/client',express.static('client'));</code> in order to serve client files.</p>
How to create a new object through code <p>for a class project, we have to make a family in Java. So our person class looks like this:</p> <pre><code>public class Person { String firstName; String middleName; boolean isMale; int age; //Make new person with age set to 0 public Person(String fir...
<pre><code>public void haveChild(String firstName, String middleName, boolean isMale) { System.out.println(firstName.trim().toUpperCase() + " is born."); //Prints Child's name this.child = new Person(firstName, middleName, isMale); //Set's the created Person() object as variable Child, or at least that's what t...
"Warning: Do not place Android context classes in static fields; this is a memory leak (and also breaks Instant Run)" <p>Similar question have been <a href="http://stackoverflow.com/questions/37709918/warning-do-not-place-android-context-classes-in-static-fields-this-is-a-memory">asked here</a>, <a href="http://stackov...
<p>I found the solution to this in the <a href="http://stackoverflow.com/a/39841446/6181476">answer to a similar question answer by CommonsWare</a></p> <p>I quote </p> <blockquote> <p>The quoted Lint warning is not complaining about creating singletons. It is complaining about creating singletons holding a refere...
Difference between mvn appengine:update and mvn appengine:deploy in Google App Engine <p>What is the difference between <code>mvn appengine:update</code> and <code>mvn appengine:deploy</code> in Google App Engine.</p>
<p>There is not references for <code>mvn appengine:deploy</code></p> <p>But for <code>mvn appengine:update</code> the documentation is:</p> <blockquote> <p>To deploy your app with Maven, run the following command from your project's top level directory, where the pom.xml file is located, for example:</p> <...
Learning Android Development <p>I'm in my last year of university and I'm currently performing my first out of two internships which I hope will lead to a job. Ahead of me lays two android projects, we will develop two apps which will be up for sale. I personally don't have any android experience, however I do have qui...
<p>This question isn't really on topic for this site, but <em>Android: Programming &amp; App Development For Beginners</em> by Samuel Shields is a good introduction in my opinion. It's not an "everything you ever wanted to know about Android development" type book (it's fairly short, but that's a feature in my opinion ...
Python: [Errno 2] No such file or directory - weird issue <p>I'm learning with a tutorial <a href="https://hackercollider.com/articles/2016/07/05/create-your-own-shell-in-python-part-1/" rel="nofollow">Create your own shell in Python</a> and I have some weird issue. I wrote following code:</p> <pre><code>import sys im...
<p>Copy-paste from comments in my link (thanks for <a href="http://stackoverflow.com/users/3009212/ari-gold">Ari Gold</a>)</p> <p>Hi tyh, it seems like you tried it on Windows. (I forgot to note that it works on Linux and Mac or Unix-like emulator like Cygwin only)</p> <p>For the first problem, it seems like it canno...
Type of an auto initialized list <p>In the C++ code below, what is type of <code>a</code>? <code>typeid</code> returns <code>St16initializer_listIPKcE</code></p> <pre><code>auto a = { "lol", "life" }; </code></pre>
<p>When you have</p> <pre><code>auto a = { "lol", "life" }; </code></pre> <p>The compiler will try to deduce a <code>std::initializer_list</code> where the type is what all of the elements are. In this case <code>"lol"</code> and <code>"life"</code> are both a <code>const char[]</code> so you have a <code>std::initi...
Resource management in F# <p>I know I need to use <code>use</code> keywork to dispose resouce:</p> <pre><code>use db = new dbml.MobileDataContext(connectionString) for rows in db.Item do .... </code></pre> <p>But I want to create the function which returns db connection:</p> <pre><code>let getConnection(connectionS...
<p>You should only use <code>use</code> in the outer function. If you use it inside <code>getConnection</code>, then your context will be disposed upon returning from <code>getConnection</code>, and so it will be already disposed in the outer function when you want to use it. As a general rule, if you dispose a value i...
git,curl,wget redirect to locahost <p>Git gives me this error:</p> <pre class="lang-none prettyprint-override"><code>$ git clone How people build software · GitHub Cloning into 'xxxx'... fatal: unable to access 'xxx (Michael Dungan) · GitHub': Failed to connect to 127.0.0.1 port 443: Connection refused </code></pr...
<p>i have solved this problem, i hava missed the http_proxy,https_proxy system environment variable in <code>/.bash_profile</code>. remove them, it is okay now.</p>
Unity: Infinite While Loop in Coroutine <p>Okay so I'm trying to create a small dash coroutine for my 2d character. When the coroutine calls, gravity switches off, he lerps between 2 speeds over a time. The issue is within my Dash coroutine, the while loop checks when time.time(current time) > start time + dash duratio...
<p><strong>You don't need all that for <em>dashing</em> !</strong></p> <p>If you use rigid bodies then the following code will do:</p> <pre><code>using UnityEngine; public class CubeController : MonoBehaviour { private Rigidbody _rigidbody; public float Force = 10; private void Start() { _ri...
Displaying unique name with total of column value in a group with additional variables in python <p>I'm learning Python and thought working on a project might be the best way to learn it. I have about 200,000 rows of data in which the data shows list of medication for the patient. Here's a sample of the data. </p> <pr...
<p>Have another look at the documentation for the <a href="http://pandas.pydata.org/pandas-docs/stable/groupby.html" rel="nofollow">pandas groupby methods</a>. </p> <p>Here's something that could work for you:</p> <pre><code>#first get the total MME for each patient and drug combination total_mme=semp.groupby(['PTNAM...
Why does decreasing the framerate with videorate incur a significant CPU performance penalty? <p>My understanding of the <a href="https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-videorate.html" rel="nofollow">videorate</a> element is that framerate correc...
<p><code>videorate</code> is tricky and you need to consider it in conjunction with every other element in the pipeline. You also need to be aware of how much CPU time is actually available to cut off. For example, if you're decoding a 60fps file and displaying it at 1fps, you'll still be eating a lot of CPU. You ca...
How to get content that isn't loaded yet? <p>I need to get content from ANOTHER SERVER web page, but when I use <code>file_get_content($url)</code>, URL won't show up for certain page probably because it isn't loaded yet.</p> <p>Is there any option to get content if page loads dynamically for couple of seconds?</p> <...
<p>Use JQuery for this.</p> <pre><code>&lt;div id="url-contents"&gt;&lt;/div&gt; &lt;script&gt; $( "#url-contents" ).load( "your/url.html" ); &lt;/script&gt; </code></pre>
Search elements including roots and descendents <p>What's a good way to search a small set of elements structured like this? I want to be able to find any element given its ID, without having to know exactly where I'm looking for it.</p> <pre><code>const elements = $(` &lt;div id="a"&gt; &lt;div id="aa"&gt;&l...
<p>From jQuery 1.11.2 and 2.1.2 onwards you can effectively use a <code>documentFragment</code> like this:</p> <pre><code>$(document.createDocumentFragment()) </code></pre> <p>This does not introduce an element. If you append the <code>element</code> contents to it, and query the parent of <code>#a</code> you'll get ...
How to pass a tuple3 as an argument to function? <p>I'm trying to pass a tuple as an argument to function. Unfortunately i can't do this. Can you give me some tips?</p> <pre><code>val t = Tuple3(3, "abc", 5.5); def fun(x: (Int, String, Double) = { x.productIterator.foreach(i =&gt; println("Value: " + i)); } def(t); ...
<p>There's a missing closing parenthese and you called <code>def(t)</code> instead of <code>fun(t)</code>. Note that you don't need to indicate the constructor <code>Tuple3</code> :</p> <pre><code>val t = (3, "abc", 5.5); def fun(x: (Int, String, Double)) = { x.productIterator.foreach(i =&gt; println("Value: " + i))...
Classification training with only positive sentences <p>I'm starting a project to build an automated fact checking classificator nad I have some doubts about the process to follow.</p> <p>I've a database of ~1000 sentences, each one being a fact check positive. In order to build a supervised machine learning model I'l...
<p>This situation happens often when the true sentences are relatively rare in the data. </p> <p>1) Get a corpus of sentences that resemble what you will be classifying in the end. The corpus will contain both true and false sentences. Label them as false or non-fact check. We are assuming they are all false even thou...
How to return related object, in Angular 2 with TypeScript <p>Sorry, i'm new in TypeScrit and Angular 2, and sorry for my poor english, it is not my native language. But i need your help.</p> <p>I have this data model:</p> <h2>country.ts</h2> <pre><code>export class Country{ id: number; name: string; } </cod...
<p>Your <code>getCitiesRefState</code> method is declared to return a <code>Promise&lt;City[]&gt;</code> but actually returns a <code>Promise&lt;City&gt;</code>. It helps to see if we expand the method out.</p> <pre><code>getCitiesRefState(id: number): Promise&lt;City[]&gt; { return this.getCities() .then(...
How to not load unused assembly <p>In ASP.NET MVC4 application System.Data.OracleClient assembly is loaded.</p> <p>Code in controller</p> <pre><code> var sb = new StringBuilder(); foreach (Assembly b in AppDomain.CurrentDomain.GetAssemblies()) sb.AppendLine(b.FullName); </code></pre> <p>Outputs it:</p> ...
<p>After further investigation I found that that this <code>system.data.oracleclient</code> is called and used by <code>System.Data</code> that is critical if you use any kind of data base.</p> <p>After even more investigation using the <code>ILSpy</code> I also found that the <code>mscorlib</code> (the core library) ...
How to Remove Trailing Comma <p>I am trying to remove the trailing comma from my php statement</p> <pre><code>&lt;?php foreach( $speaker_posts as $sp ): ?&gt; { "@type" : "person", "name" : "&lt;?php the_field('name_title', $sp-&gt;ID); ?&gt;", "sameAs" : "&lt;?php echo post_permalink( $sp-&gt;ID ); ?&gt;"...
<p>Assuming your array is well formed (has indexes starting from zero) you can put it at the beginning, skipping the first record:</p> <pre><code>&lt;?php foreach( $speaker_posts as $idx =&gt; $sp ): ?&gt; &lt;?php if ($idx) echo ","; ?&gt; { "@type" : "person", "name" : "&lt;?php the_field('name_title', $sp-&...
Why does adding parenthesis around a yield call in a generator allow it to compile/run? <p>I have a method:</p> <pre><code>@gen.coroutine def my_func(x): return 2 * x </code></pre> <p>basically, a tornado coroutine.</p> <p>I am making a list such as:</p> <pre><code>my_funcs = [] for x in range(0, 10): f = y...
<p><code>yield</code> expressions must be parenthesized in any context except as an entire statement or as the right-hand side of an assignment:</p> <pre><code># If your code doesn't look like this, you need parentheses: yield x y = yield x </code></pre> <p>This is stated in the <a href="https://www.python.org/dev/pe...
Use password parameter in Jenkins as Secret in Pipeline <p>I have a Jenkins pipeline job that needs to provide the username and password to checkout from RTC as parameters.</p> <p>The checkout action can use a userId and password variable, but the Password must be of the class "Secret".</p> <p>When trying to create a...
<p>I had to disable the groovy sandbox. After that, I was able to use the Secret class:</p> <pre><code>hudson.util.Secret secret = hudson.util.Secret.fromString(Build_Password) </code></pre>
.Net Core 1.0 Relative Project Dependencies Not Found <p>I have the project structure:</p> <pre><code>/src - common - common-x + project.json - module-a - project-a + project.json - project-a-tests + project.json + global.json </code></pre> <p>I'm trying to include the <code>comm...
<p>You should only need to specify top level folders in your <code>global.json</code> file, since sub-folders will be scanned automatically. <a href="https://docs.microsoft.com/hu-hu/dotnet/articles/core/tools/global-json" rel="nofollow">Global.json reference</a>.</p> <p>So your <code>global.json</code> should look li...
Provisioning CoreOS with Ansible pip error <p>I am trying to provision a coreOS box using Ansible. First a bootstapped the box using <a href="https://github.com/defunctzombie/ansible-coreos-bootstrap" rel="nofollow">https://github.com/defunctzombie/ansible-coreos-bootstrap</a></p> <p>This seems to work ad all but pip ...
<p>You can't use shell-style variable expansion when setting Ansible variables. In this statement...</p> <pre><code>environment: PATH: /home/core/bin:$PATH </code></pre> <p>...you are setting your <code>PATH</code> environment variable to the <em>literal</em> value <code>/home/core/bin:$PATH</code>. In other word...
Splitting sidebar into top and bottom around main content with Bootstrap <p>I am trying to use Bootstrap to split a left aligned sidebar into 2 different parts whenever the screen size gets to be near mobile device resolution. <a href="http://stackoverflow.com/questions/24990775/is-there-a-way-in-bootstrap-to-split-a-c...
<p>Welp, thanks to Google Chrome's developer tools I was able to find out that the code was fine, it was just getting reset during runtime by the Bootstrap code. Once I realized that, all I needed to do was add "!important" to the float right statement and it started working.</p> <pre class="lang-css prettyprint-ove...
Prevent touchStart but allow click events <p>I would like to prevent <code>touchStart</code> events in order to prevent Safari from bouncing in iOS devices under certain conditions. </p> <p>To do so I'm using the folowing:</p> <pre><code>$('.wrapper').on('touchstart', function(e) { e.preventDefault(); }); </code>...
<p>I don't have iOS 10 available for a test-drive, and this is a wild guess, but check this snippet:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$('.wrapper').on('click ...
Difference between a list of object types and a list of objects extending a type <p>I often encounter situations like:</p> <pre><code>List&lt;Fooable&gt; fooList; </code></pre> <p>vs</p> <pre><code>List&lt;? extends Fooable&gt; fooList; </code></pre> <p>What is the difference between these two? Or is there a name f...
<p>Well if there is no duplicate...</p> <p>A <code>List&lt;Animal&gt;</code> <em>can</em> contain <code>Cat</code>s and <code>Dog</code>s. You can add Cats and Dogs to the list. It does not mean it can only contain <code>Animal</code>s.</p> <p>But if you have a method <code>foo(List&lt;Animal&gt; foo)</code>, you can...
subset whole data frame for value and return rows in which value are found <p>I am trying to subset a data frame containing 626 obs. of 149 variables and I want to look for a specific string and return the rows that have that value regardless of what column it is found in. </p> <p>For example:</p> <p>I am looking for...
<p>You can use <code>apply</code> to do row-wise operation using the argument <code>MARGIN = 1</code>. Example:</p> <pre><code>mydf[apply(mydf, MARGIN = 1, FUN = function(x) {"GO:0004674" %in% x}), ] </code></pre>
Closed DLL still shows in GetAssemblies() list (.NET) <p>My project calls a (non-referenced) DLL project with UI. The end user is supposed to close this form before closing the main form (main project) but sometimes they do not. </p> <p>I tried using AppDomain.GetAssemblies() to see if the DLL Form is closed. However,...
<p>The only way to unload an assembly in .Net is to unload the AppDomain that it was loaded into. This means you need to load additional assemblies into their own app domains This, however, brings in additional complexity as you will not be able to share data between app domains and will have to use inter-process commu...
Enforcing non-emptyness of scala varargs at compile time <p>I have a function that expects a variable number of parameters of the same type, which sounds like the textbook use case for varargs:</p> <pre><code>def myFunc[A](as: A*) = ??? </code></pre> <p>The problem I have is that <code>myFunc</code> cannot accept emp...
<p>What about something like this?</p> <pre><code>scala&gt; :paste // Entering paste mode (ctrl-D to finish) def myFunc()(implicit ev: Nothing) = ??? def myFunc[A](as: A*) = println(as) // Exiting paste mode, now interpreting. myFunc: ()(implicit ev: Nothing)Nothing &lt;and&gt; [A](as: A*)Unit myFunc: ()(implicit e...
Error while trying to port a repo from github <p>There is a github code I am trying to use that is located <a href="https://github.com/PX4/pyulog" rel="nofollow">here</a>.</p> <p>I am trying to run <code>params.py</code> which is a code that will take a binary file and converts it so that I can plot it (or so I think)...
<p>Pip install tries to install the module from :</p> <ul> <li>PyPI (and other indexes) using requirement specifiers. </li> <li>VCS project urls. </li> <li>Local project directories. </li> <li>Local or remote source archives.</li> </ul> <p>When looking at the items to be installed, pip checks what type of item each i...
Batch consumer with Blocking Collection <p>I'm using Blocking Collection within a producer consumer pattern. In order to speed up my program, i have to make the consumer process in batch: process a list of items in the blocking collection(50 item) instead of one at a time.</p> <p>So i tried using <code>queue.Take(50)<...
<p>Writing <code>queue.Take(50)</code> is using the LINQ <code>Take</code> method (rather than the <code>BlockingCollection</code> <code>Take</code> method) on the <em>non</em> consuming enumerable, so you'll end up getting 50 items but leaving them all in the collection.</p> <p>If you just want to get 50 items you co...
Homework-Prove Big omega with witness <p>I am having trouble solving a proof. Given the situations : f(x)=x^4-50x^3+1 g(x)=x^4 we need to show that f(x)is big omega of g(x), also need to provide the witness</p>
<p>We have that <code>f(X)&gt;= X^4</code> for every <code>X&gt;=1</code> which by definition means that f is Ω(n^4) (or since g(X)=n^4, f is Ω(g(X)) ).</p>
Within a view, how do I return the MEDIA_URL for Imagefield queryset? <p>Assume I have the following model:</p> <pre><code>class ProductImage(models.Model): image = models.ImageField('Product image', null=True,blank=True) view = models.CharField(max_length=2, choices=VIEW_TYPES, default='FR', null=True,blank=T...
<p><code>p.image.url</code> gives you the full URL for the image, given p as a ProductImage instance. Since you have a queryset, you just need to iterate through; you shouldn't use <code>values</code> though.</p> <pre><code>allProductImages = ProductImage.objects.all() image_urls = [p.image.url for p in allProductImag...
Dagger 2 components chain dependencies <p>I have 3 components: Main app component:</p> <pre><code>@Singleton @Component(modules = {AppModule.class, UserModule.class, DatabaseModule.class}) public interface AppComponent { Context getContext(); DatabaseHelper getDatabaseHelper(); UserManager getUserManager...
<p>Your approach is correct. Components only have access to the types explicitly exposed by their direct parent component. </p> <p>This can be useful when, as a parent, you don't want to expose all of your dependencies to whoever depends on you. For example, a <code>Parent</code> may depend on a BankComponent and not ...
How to cast NSData to Data <p>I have created array of UInt8</p> <pre><code>var pixels: [UInt8] = [] </code></pre> <p>filled by alpha, red, green and blue components and need to create NSImage from he array. I wrote following code</p> <pre><code>let imageData = NSData(bytes: pixels, length: 1000) Swift.print(imageDat...
<p>You have a few issues.</p> <ol> <li>Why use <code>NSData</code> at all? Just use <code>Data</code>.</li> <li>Your error is the fact that <code>imageData</code> doesn't actually represent a valid image so <code>NSImage</code> is <code>nil</code> but you try to force unwrap it.</li> </ol> <p>Try something like this:...
How to access a dictionary value with Swift 3? <p>So since the release of Swift 3, a part of my code where I access a dictionary isn't working anymore, here is the code with the previous release of swift:</p> <pre><code>var locationDict: NSDictionary?//location dictionary if let getLocation = item.value?["Location"]{l...
<p>Try this:- </p> <pre><code> func setAnnotations(){ //get data FIRDatabase.database().reference().child("Stores").observe(.value, with: { (snapshot) in self.mapView.removeAnnotations(self.annArray) for item in snapshot.children{ if let itemDict = (item a...
Wrong direction of movement after changing node's velocity <p>After a node (car) collides into a "speed up" type of obstacle, it should speed up. Instead it slows down and starts moving out of the straight line. I checked if code is properly executed and it is, I assume the problem is with the coordinate system of the ...
<p>I am not familiar with SceneKit. But if you add a value to a component of a vector without changing the other components then the direction of the vector changes.</p> <p>If you want to make the vector longer by a certain factor without changing its direction you have to multiply all components by that factor.</p>
layout_gravity="bottom" doesn't work <p>Hello stackoverflow community! I'm newbie both in programming and on this site, but let's get to the point. I wrote an app:</p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools...
<p>This should work : </p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:gravity="bottom|center"&gt; &lt;Button android:layout_width="wrap_content" ...
Conditionals are true but are returning false <p>When debugging, <code>$var</code> is not equivalent to "<code>folder\that\isNot\equivalent\".</code></p> <p>I have tried changing it to an equivalency statement, but it is not working. Any insight would be appreciated.</p> <p>Here is all the relevant code:</p> <pre><c...
<p>The issue was whitespace surrounding the $var. I used the command <code>$var = $var -replace "\s",""</code></p> <p>That replaces every space symbol with an empty string, I also changed it to an equivalency statement. </p> <p><code>if ($var -eq "\folder\that\is\")</code></p>
Render a React element inside a React component <p>OK I'm trying to pass a component inside an object I use as a parameters to an action I'm triggering.</p> <pre><code>this.context.alt.actions.notificationActions.logMessage({ component: &lt;ModalLayoutEditorComments subscription="pop-up" contextualClass="info" callb...
<p>Your <code>render</code> logic is OK. It looks like you are using the wrong prop:</p> <pre><code>render() { return ( &lt;div&gt; {this.props.notifications[0].component} &lt;/div&gt; ); } </code></pre> <p>As an aside, <code>component</code> is quite a confusing property name. The object is a R...
run bash (command line) inside emacs text editor? <p>i want to run command line inside emacs text editor . i have just finished the emacs tutorial i want to practice in some SQL files and i need the command line near to me to see SQL changes and results any idea ? is this a profesional step i can't understand it now ?...
<p><a href="http://www.nongnu.org/emacsdoc-fr/manuel/shell.html" rel="nofollow">http://www.nongnu.org/emacsdoc-fr/manuel/shell.html</a> There you have some tips how to or basicaly run 2 terminals on one Computer(Subshells)</p> <p>or GNU documentation website of emacs with some valuable links for shells <a href="https:...
Is it possible to use Spring MVC with Jersey annotations? <p>I am wondering, if it's possible to use Spring Web MVC with Jersey annotations, as I'm having a massive problem with Spring not being able to parse part variables the way Jersey can and I need to migrate some Jersey code to Spring MVC.</p> <p>I have the foll...
<p>it's possible to use Spring Web MVC with Jersey annotations, try make a little sample in <a href="https://start.spring.io/" rel="nofollow">Spring Initializer </a> there you can check the option jersey, see how spring build this project and try in yours</p>
Cognos: Using rank() across multiple columns to order bar chart <p>I have some example data like this table:</p> <p><img src="https://i.stack.imgur.com/GyXDf.png" alt="table"></p> <p>where the left table is currently the data I have and I want to order by year, company, and product (based on total cost). Currently, t...
<p>Looks like you have two different tasks:</p> <ol> <li><p>Calculate top 5 AFAIR you can use rank() like this:</p> <pre><code>rank([total_cost] for [Country],[Year],[Product]) </code></pre></li> <li><p>List all billing area codes. It's not so simple. There is no special function for it (shame on them). So you can wr...
Semantic-UI - Links / A Tags / URLs Inside Semantic Ui Dropdown Menu Do Not Work <p>I am working with Semantic UI in a rails project and wanted to create a dropdown menu with items that would link to other view pages. Most of the problems i've seen with the dropdown stemmed from users not initializing the dropdown menu...
<p>After doing more and more research, I came to the conclusion that the links were not working in my semantic-ui dropdown menu because of some code, most likely Javascript, that i had inserted before.</p> <p>Of course, i ruled this way out of the realm of possibility because there was no way i would forget about such...
Twilio as a proxy for many-to-many SMS conversations <p>What is the best way to proxy marketplace messaging using SMS? </p> <p><strong>User Model:</strong> each conversation has <code>owner_id</code> and <code>renter_id</code>, if a message is received from one it should be proxied to the other. </p> <p><strong>If th...
<p>This concept will definitely require multiple Twilio numbers if you want to give a friction less experience (no PINs to enter ) , but you will only ever need to have as many numbers as people who a single user can contact. This is explained in more detail <a href="https://support.twilio.com/hc/en-us/articles/2231340...
Python - insert lines on txt following a sequence without overwriting <p>I want to insert the name of a file before each file name obtained through glob.glob, so I can concatenate them through FFMPEG by sorting them into INTRO+VIDEO+OUTRO, the files have to follow this order:</p> <p>INSERTED FILE NAME<br> FILE<br> IN...
<p>You are trying to modify <code>contents</code> list. I think if new list is used to get final output, then it will be simple and more readable as below. And as <strong>Zen of Python</strong> states</p> <p><strong>Simple is always better than complex.</strong> </p> <ol> <li>Consider you got <code>file_list</code> a...
Render the DepthTexture from a FrameBuffer <p>Hello I am trying to implement shadows in openGL using C++. I created a FrameBuffer and a DepthTexture. Every frame I<code>m rendering my entities to the FrameBuffer. For now I</code>m just displaying the texture on the screen like any other GUI, but the texture is complete...
<p>After using my normal projection matrix instead of the orthographical matrix it worked fine. So I experimented a bit and the near and far plane were set to 0 when I created the orthographical matrix. I fixed it and its now working. Thank you for your help.</p>
Modifying Android Search for ListView <p>I'm new to android app development and currently trying to figure out how to add search to an app. I did some searching and the tutorial that was the simplest for me to understand is <a href="https://www.beginnersheap.com/android-searchview-tutorial-android-search-bar-example/" ...
<p>For this type of dropdown suggestion functionality you would use <code>AutoCompleteTextView</code>.</p> <p>Example usage below:</p> <p>In your layout file:</p> <pre><code>&lt;AutoCompleteTextView android:id="@+id/auto_complete_tv" android:layout_width="match_parent" android:layout_height="wrap_content...
Why is my JavaFX window not the right width? <p>When I make a JavaFX window:</p> <pre><code> Scene scene = new Scene(pane, 600, 800); primaryStage.setResizable(false); primaryStage.setScene(scene); primaryStage.show(); </code></pre> <p>The resulting window is about 610 pixels wide.</p> <p>&nbsp;</p> ...
<p>Apparently it's <a href="http://stackoverflow.com/questions/20732100/javafx-why-does-stage-setresizablefalse-cause-additional-margins">a long standing bug</a> that happens when setResizable is used.</p> <p>I fixed it by using the sizeToScene function.</p> <pre><code> Scene scene = new Scene(pane, 600, 800); ...
Java, prevent class from calling a public method <p>For an assignment I have to write code for a "State" class that has all the attributes about position of an airplane. </p> <p>The Javadoc is already written up and must be strictly adhered to. All the set methods are public but must throw an exception if any class ot...
<p>I agree that this requirement is nonsense but this could do it:</p> <pre><code>public void setSpeed(double speed) { if(!Airplane.class.equals(Thread.getCurrentThread().getStacktrace()[1].getClass())) { //throw exception </code></pre>
How can you seed a first item with bufferWithCount in rx.js? <p>Say you do something like:</p> <pre><code>Rx.Observable.range(1, 5).bufferWithCount(2, 1).subscribe(console.log); </code></pre> <p>This returns:</p> <pre><code>[1, 2] [2, 3] [3, 4] [4, 5] [5] </code></pre> <p>I'd like for the result to look like (basic...
<p>How about:</p> <pre><code>Rx.Observable.range(1, 5) // Note this value will get used for every subscription // after it is defined. .startWith(userDefined) .bufferWithCount(2, 1) .subscribe(console.log); </code></pre>
What exactly does `: class` do in a protocol declaration? <p>This <a href="http://stackoverflow.com/questions/24066304/how-can-i-make-a-weak-protocol-reference-in-pure-swift-w-o-objc">SO post</a> explains pretty well how to solve the issue of creating a <code>delegate</code> that is <code>weak</code>.</p> <p>Essential...
<p><code>:class</code> ensures that only classes can implement the protocol. And that's <em>any</em> class, not just subclasses of <code>NSObject</code>. <code>@objc</code>, on the other hand, tells the compiler to use Objective-C-style message passing to call methods, instead of using a vtable to look up functions.</p...
Detect shadowed java bean property <p>Is there an easy way (idealy existing helper library) to detect shadowed attributes of a java bean given it has multiple level of hierarchy?</p> <p>[C] extends [B] extends [A]. Then attribute [A].firstName is defined.</p> <p>I want to detect beans where [C].firstName is redefined...
<p>Typically you wouldn't put this in a unit test, rather you'd put something like <a href="http://checkstyle.sourceforge.net/" rel="nofollow">Checkstyle</a> in your integration build process which will flag the same issue. </p>
Why is & being converted to &amp;amp? <pre><code>$file="csv.php?task=whovotedwho&amp;election=7"; $filename = "whovotedwho-election7.csv"; if (file_exists("trash.png")) { header('Content-Description: File Transfer'); header('Content-Type: text/csv'); header('Content-Disposition: attachment; f...
<p>This:</p> <pre><code>$file="csv.php?task=whovotedwho&amp;election=7"; </code></pre> <p>It's not a full/absolute url like <code>http://example.com/csv.php...</code>, so when readfile() kicks in, it's doing a <strong>LOCAL</strong> file request, and looking for a file whose name is literally <code>csv.php?tasketc.....
jQuery iFrame Variable from Text File in Wordpress <p>I am trying embed videos using a set of urls and parameters stored in a text file in Wordpress that change at random on F5 refresh. I am not a coder but I think I am close, but wrong and the example is here:</p> <p><a href="http://aaaad.com/jquery-forum-post/" rel=...
<p>Couple of things I've spotted.. </p> <ol> <li><p>The .video div never closes, so that might lead to some issues. (Maybe it does in your normal code, but it doesn't in what you posted above.</p></li> <li><p>This: </p> <p><code>var video = data.split("@"); idx = Math.floor(video.length * Math.random());</code></p></...
Jekyll - Image path works during jekyll serve, not on live site <p>I changed my _config.yml file to:</p> <pre><code>baseurl: "/pages" </code></pre> <p>That's where we're storing our pages. When I do <code>jekyll serve</code> on my localhost, everything is fine. The image path shows up as:</p> <pre><code> &lt;img src...
<p>If you are serving your site at <a href="http://example.com/" rel="nofollow">http://example.com/</a> rather than <a href="http://example.com/pages/" rel="nofollow">http://example.com/pages/</a>, then you don't want to set <code>baseurl</code>. <a href="https://byparker.com/blog/2014/clearing-up-confusion-around-base...
What is a 32-bit two's complement? <p>I'm really confused about the term "32-bit twos complement"</p> <p>If I have the number 9, what is the 32-bit twos complement?</p> <p>9 = 1001</p> <p>Two's complement = 0111</p> <p>32-bit 9 = 0000 0000 0000 0000 0000 0000 0000 1001</p> <p>Two's complement = 1111 1111 1111 1111...
<p>The most common format used to represent signed integers in modern computers is two's complement. Two's complement representation allows the use of binary arithmetic operations on signed integers.</p> <p>Positive 2's complement numbers are represented as the simple binary.</p> <p>Negative 2's complement numbers ar...
Adding custom pdf stamp to document from VBA <p>I've ran into a problem - I need to add a custom stamp (type of annotation) to a number of .pdf files. I can do it through Actions for Acrobat X Pro, but my clients do not have that license and they still need to do it. The list of files is stored in Excel spreadsheet, so...
<p>You can use "ExecuteThisJavaScript" from the AForm Api. Short example:</p> <p>Set AForm = CreateObject("AFormAut.App")</p> <p>AForm.Fields.ExecuteThisJavaScript "var x = this.numPages; app.alert(x);"</p> <p>It has the advantage that you don't need to translate the js examples into jso code. If you search for Exec...
Angular 2: Event Emitter not working properly <p>I have two components. I have a help menu component and a navigation component. When a user clicks the help button, it should show the help menu. I made a variable called help in the app component. In the nav component, I made an event emitter to try two-way binding, but...
<p>Not just changing the <code>[(helps)]</code> to <code>[(help)]</code> like Fabio mentioned, but you also need to change the name of the variable in the directive to remove the <code>s</code> from <code>helpsChange</code>. It's important that the input and output follow the naming format <code>property/propertyChange...
What does the Python operater ilshift (<<=)? <p>What does the Python operator ilshift (&lt;&lt;=) and where can I find infos about it?</p> <p>Thanks</p> <p><a href="https://docs.python.org/2/library/operator.html#operator.ilshift" rel="nofollow">https://docs.python.org/2/library/operator.html#operator.ilshift</a></p>...
<p>It is an BitwiseOperators (Bitwise Right Shift): <a href="https://wiki.python.org/moin/BitwiseOperators" rel="nofollow">https://wiki.python.org/moin/BitwiseOperators</a></p> <blockquote> <p>All of these operators share something in common -- they are "bitwise" operators. That is, they operate on numbers (normal...
Azure - Reverse Hub/Spoke Design ; Policy VPN Workaround <p>Due to a VNet only allowing for a single static gateway, and my onprem location gateways not supporting route based VPNs, I want to see if this is poss.</p> <ul> <li>Having a resources in a single vnet. </li> <li>Create a new VNet for each policy based VPN, ...
<p>Oh my, even if that thing works it will be horrific to maintain.</p> <p>Just spin up a Linux VM with <a href="https://www.strongswan.org/" rel="nofollow">StrongSwan</a> on-prem and IKEv2 to Azure:</p> <pre><code>conn azure authby=secret type=tunnel leftsendcert=never left=40.127.xxx.xxx leftsub...
Semantically disambiguating an ambiguous syntax <p>Using Antlr 4 I have a situation I am not sure how to resolve. I originally asked the question at <a href="https://groups.google.com/forum/#!topic/antlr-discussion/1yxxxAvU678" rel="nofollow">https://groups.google.com/forum/#!topic/antlr-discussion/1yxxxAvU678</a> on ...
<p>The issue here is that you're trying to make a distinction between "paths" while being created in the parser. Constructing paths inside the lexer would be easier (pseudo code follows):</p> <pre class="lang-antlr prettyprint-override"><code>grammar T; tokens { JAVA_TYPE_PATH, JAVA_FIELD_PATH } // parser rules ...
How do I create cluster singleton using FSharp API? <p>I'm not sure how do i spawn a cluster singleton using FSharp API. Should i use [spwane] or [spawnOpt] ? and how one does that ?</p>
<p>You cannot create cluster singleton using standard Akka.FSharp API. <em>Reason behind that is that Akka.FSharp API already hit v1.0 before the shape of the cluster singleton API was even known.</em></p> <p>You can however use <a href="https://github.com/Horusiath/Akkling/wiki" rel="nofollow">Akkling.Cluster.Shardin...
Bigquery If field exists <p>Short: Is there a way to query in BQ fields that doesn't exists, receiving nulls for these fields?</p> <p>I have almost the same issue than <a href="http://stackoverflow.com/questions/32276601/bigquery-if-field-exists-then">BigQuery IF field exists THEN</a> but in mine, sometimes my APIs ca...
<p>Let's assume your table has x and y fields only!<br> So below query will perfectly work </p> <pre><code>SELECT x, y FROM YourTable </code></pre> <p>But below one will fail because of non-existing field z</p> <pre><code>SELECT x, y, z FROM YourTable </code></pre> <p>The way to address this is as below</p> <pre>...
HTML Dropdown menu in nav <p>I made a nav bar which has some tabs, but I want to make a dropdown menu which appears on hover in genre tab. Code goes like this:</p> <pre><code>&lt;nav&gt; &lt;ul&gt; &lt;li&gt;&lt;a class="active" href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="index.html"&gt;PL...
<p>Add the Links you need at Genre <code>&lt;li&gt;&lt;a href="index.html"&gt;Genre&lt;/a&gt;&lt;/li&gt;</code></p> <pre><code>&lt;li&gt;&lt;a href="index.html"&gt;Genre&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="link.html"&gt;Link&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; </code></pre> <p>and then a...
Changing static URL as Dynamic - NodeJS <p>I have a directory where all the songs uploaded by user get uploaded. I have used mongodb for this app, mongodb is working fine but I want to use src url like uploads/something to songs/user/songname I have tried to used Router.get as shown in the Controller.js But when I use...
<p>Try this code, open in browser: <code>http://host:port/song/foo/bar</code> <br/> and write in comment what You get:</p> <pre><code>const fs = require('fs'), path = require('path'), bufferSize = 100 * 1024; Router.get('/songs/:artist/:song', (req, res) =&gt; { let file = '01-Whole Lotta Love.mp3'; ...
Kafka API: java.io.IOException: Can't resolve address: 357d78957cf5:9092 <p>I am trying to figure out how to properly write a simple producer application to Kafka. </p> <p>1) Please tell me if I should avoid using 0.10.0.1, I am totally struggled with it. </p> <p>This example I found from Apache wiki worked for 0.8 ...
<p>Some backgrounds you'll find useful before using the producer: The old producer(Scala) in 0.8.x had already been removed starting 0.9.0.</p> <p>Therefore, you are using the new producer(Java) now. Kafka dev team decides to remove any Zookeeper dependencies from the new client, no matter producer or consumer. So you...
Get Webpack not to bundle files <p>So right now I'm working with a prototype where we're using a combination between webpack (for building .tsx files and copying .html files) and webpack-dev-server for development serving. As you can assume we are also using React and ReactDOM as a couple of library dependencies as we...
<p>Change the <code>output</code> setting to be <em>name driven</em> e.g. </p> <pre><code> entry: { dash: 'app/dash.ts', home: 'app/home.ts', }, output: { path: './public', filename: 'build/[name].js', sourceMapFilename: 'build/[name].js.map' }, </code></pre>
There has to be a better way <p>Is there a more idiomatic way to accomplish the following in Python3?</p> <pre><code>if i%1 == 0 and i%2 == 0 and i%3 == 0 and i%4 == 0 and i%5 == 0 and i%6 == 0 and i%7 == 0 and i%8 == 0 and i%9 == 0 and i%10 == 0 and i%11 == 0 and i%12 == 0 and i%13 == 0 and i%14 == 0 and i%15 == 0 an...
<p>Yes use <a href="https://docs.python.org/3/library/functions.html#all" rel="nofollow"><em>all</em></a> with <a href="https://docs.python.org/3/library/functions.html#func-range" rel="nofollow"><em>range</em></a>:</p> <pre><code>if all(i % j == 0 for j in range(1, 21)): # python2 -&gt; xrange(2, 21) # do whateve...
Android: How to get back to main activity after click? <p>I am beginner in android and I have question how to get result from other activity and back to my main activity:</p> <p>Example from my project: I have some main activity ... when I click on button, application will open activity where is only list. After user ...
<p>You can use <code>startActivityForResult()</code> . Have a look here: <a href="https://developer.android.com/training/basics/intents/result.html" rel="nofollow">https://developer.android.com/training/basics/intents/result.html</a></p>
'System.TypeInitializationException' being thrown on previously working code <p><strong>My code worked fine previously, but now when I run it; it throws up this exception:</strong></p> <blockquote> <p>An unhandled exception of type 'System.TypeInitializationException' occurred in Debug Chamber.exe Additional info...
<p>That exception means an exception was thrown from a static constructor or field initializer. I suspect it's in the initializer for <code>evl</code>, since it's referencing static properties that do not have initial values set (they will be <code>null</code>).</p> <p>I would move that code to a static constructor s...
Set status code on http.ResponseWriter <p>How do I set the http status code on an <code>http.ResponseWriter</code>?</p> <p>i.e a 500, or 403.</p> <p>I can see that requests normally have a status code of 200 attached to them.</p>
<p>Use <a href="https://godoc.org/net/http#ResponseWriter" rel="nofollow"><code>http.ResponseWriter.WriteHeader</code></a>. From the documentation:</p> <pre><code>// WriteHeader sends an HTTP response header with status code. // If WriteHeader is not called explicitly, the first call to Write // will trigger an implic...
artifactory upload with powershell <p>How would you upload an artifact using powershell? </p> <p>The following works with bash</p> <pre><code>ARTIFACT_MD5_CHECKSUM=$(md5sum /tmp/bar.zip | awk '{print $1}') ARTIFACT_SHA1_CHECKSUM=$(shasum -a 1 /tmp/bar.zip | awk '{ print $1 }') curl --upload-file "/tmp/bar.zip" --he...
<p>Use <code>Invoke-RestMethod</code></p> <pre><code>$password = ConvertTo-SecureString -AsPlainText -Force -String '&lt;api_key&gt;' $cred = New-Object Management.Automation.PSCredential ('admin', $password) $ARTIFACT_SHA1_CHECKSUM=$(Get-FileHash -Algorithm SHA1 c:\bar.zip).Hash $HEADERS = @{"X-Checksum-SHA1"=$ARTIF...
Android: Pass value from activity to broadcastreceiver <p>First of all, sorry for my bad grammar. I am developing Auto Reply Message Application using broadcastreceiver i have problem with when I can receive value from activity to broadcastreceiver, the Auto Reply won't work. But if I'm not receive value from Activity,...
<p>The action will never be both <code>android.provider.Telephony.SMS_RECEIVED</code> and <code>my.action.string</code>. </p> <p>Change this:</p> <pre><code>if (action.equals(SMS_RECEIVED) &amp;&amp; action.equals("my.action.string")) { </code></pre> <p>To this:</p> <pre><code>if (action.equals(SMS_RECEIVED) || act...
Jena Fuseki API add new data to an exsisting dataset [java] <p>i was trying to upload an RDF/OWL file to my Sparql endpoint (given by Fuseki). Right now i'm able to upload a single file, but if i try to repeat the action, the new dataset will override the old one. I'm searching a way to "merge" the content of the data ...
<p>Use <code>accessor.add(m)</code> instead of <code>putModel(m)</code>. As you can see in <a href="https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/query/DatasetAccessor.html" rel="nofollow">the Javadoc</a>, <code>putModel</code> <em>replaces</em> the existing data.</p>
How to remove quotes from each element in a javascript array containing JSON encoded html strings returned from a mysql database with php <p>Ajax call to the mysql data base using data1.php file with pdo returns hmtl strings that are put into an array, encoded with json and sent to the ajax response function for displa...
<p>Don't replace anything anywhere. The only thing you need is to add <code>htmlspecialchars()</code> when you building the HTML string.</p> <pre><code>&lt;?php // ... $rows = []; foreach ($result as $r) { $rows[] = '&lt;tr&gt;&lt;td&gt;'.htmlspecialchars($r['id']) .'&lt;/td&gt;&lt;td&gt;'.htmlspecialchars...
I am using Kivy in Python and only the last button has it's embedded objects appearing <p>I apologize in advance if my question is stupid or obvious, but I have been researching this over and over and am coming up with nothing. I am currently using Kivy and have multiple buttons in a gridlayout, which is in a scrollvie...
<p>Here is something that should help you get what you want:</p> <p>A main.py like this:</p> <pre><code>from kivy.app import App import webbrowser class Solis(App): def __init__(self, **kwargs): super(Solis, self).__init__(**kwargs) self.lead1image='https://pbs.twimg.com/profile_images/562300519...
Only recording motion using gaussian mixture models <p>I am using <a href="http://www.mathworks.com/help/vision/examples/detecting-cars-using-gaussian-mixture-models.html?prodcode=VP&amp;language=en" rel="nofollow">this example</a> on Gaussian mixture models. </p> <p>I have a video displaying moving cars, but it's on ...
<p>The example you give uses a foreground detector. Still frame should not have foreground pixels detected. You can then choose to skip them when building a demo video of your results.</p> <p>You can build your new video by creating a rule a the type if N frames in a row do not contain foreground, do not write these f...
VS2015 bower glitch with versions <p>I have a problem with VS2015 Community and Bower plugin. I tried to install bootstrap version 3.3.7 (3.3.6 and early). You can see my <code>bower.json</code> file: </p> <p><img src="https://i.stack.imgur.com/pvPGE.png" alt="bower.json"> but always see latest version only downloade...
<p>Found reason, it was a old Git version installed issue. Not VS or Bower problem. When I updated Git to latest and clear Bower cache I got correct version of libs. Don't know why Bower or Git don't show error when it can't execute my request correctly!</p>
Trying to repeat a value from a JSON API and AngularJS <p>I'm using PetFinder API with Angular to display a JSON list. The problem I get stuck in is how to ng-repeat an array. My current code is the following:</p> <p>AngularJS:</p> <pre><code> awesomePF.controller('dogsController', function($scope, $http) { ... ...
<p>Looks to me like it should look like this</p> <pre><code>$http.get(durl).then(function(res) { $scope.doggies = res.data.petfinder.pets.pet; }); </code></pre> <p>then in your template</p> <pre><code>&lt;dl ng-repeat="dog in doggies track by dog.id.$t"&gt; &lt;dt&gt;Name&lt;/dt&gt; &lt;dd&gt;{{dog.name....
Unable to update main form control from subclass <p>Attempt #2.</p> <p>I'm attempting to call functions within two classes. One function to obtain data and call function B in class B to display the data through a Windows Form application. </p> <pre><code> //Class B containing function B using System; using Sys...
<p>I'm not sure that <code>this</code> in <code>Form1_Load</code> and <code>CHT</code> in <code>TestConnectivity</code> are the same object. They would have to be, because it is <code>this</code> that you are trying to update.</p>
Vim: How do I jump back from a multi-line move? <p>In vim, I usually have <code>:set relativenumber</code> active so that I can see what line to move to with a quick <code>&lt;n&gt;k</code> or <code>&lt;n&gt;j</code>. This allows me to move around quite efficiently, but as always in vim, I want more!</p> <p>Is there a...
<p>There's the <a href="http://www.vim.org/scripts/script.php?script_id=4571" rel="nofollow">reljump plugin</a>. Or you could just put the following into your <code>~/.vimrc</code>; adapt the limit of <code>1</code> to your needs (e.g. <code>4</code>):</p> <pre><code>nnoremap &lt;expr&gt; k (v:count &gt; 1 ? "m'" . v:...
How to add buttons to a JavaFX gui via the controller.java file using the fx:id of a GridPane <p>Still relatively new to JavaFX and I'm having a bit of trouble getting buttons to add to a GUI that I've setup.</p> <p>I have 3 files: Main.java, Controller.java, and sample.fxml (each located below)</p> <p>From what I've...
<p>The <code>Application</code> subclass - <code>Main</code> in your example - is really supposed to just startup the application. I.e. it should load the FXML, put it in a window, and show the window. Initialization and other configuration of the UI defined by the FXML, along with event handling, should be done by the...
Indentation on python <p>My python program isnt running. Im sure im missing something but im pretty sure i just indented wrong. Can anyone lend me a hand? thank you!</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-cod...
<p>From what I can see, <code>sales</code> is a local variable in the <code>main()</code>, and you are trying to access it in <code>DetermineCommRate</code>, and you have syntax errors in the definition of that function</p> <pre><code>def DetermineCommRate(sales): </code></pre> <p>Currently, you are passing sales to ...
Read colon tags values XML PHP <p>I've already read those topics: <a href="http://stackoverflow.com/questions/1575788/php-library-for-parsing-xml-with-a-colons-in-tag-names">PHP library for parsing XML with a colons in tag names?</a> and <a href="http://stackoverflow.com/questions/1186107/simple-xml-dealing-with-colons...
<p>You should use the <code>children()</code> on the <code>$item</code> element to get it's child-elements:</p> <pre><code>$str =&lt;&lt;&lt; END &lt;item&gt; &lt;title&gt; TITLE &lt;/title&gt; &lt;itunes:author&gt; AUTHOR &lt;/itunes:author&gt; &lt;description&gt; TEST &lt;/description&gt; &lt;itunes:subtitle&gt; TES...
Dynamic struct member names like in javascript in golang <p>I am writing a multi-lang website. I read the language info from users cookies, and I have several translation modules such as <code>en.go</code> <code>gr.go</code> etc. The modules are of type <code>map[string]string</code>.The problem here is in javascript I...
<p>One possible route would be to use a <code>map[string]map[string]string</code>.</p> <p>You could then have a base package in which you declare your base translation variable and in your translation modules, you can use an <code>init</code> function to populate the relevant sub-map. It's essentially optional if you ...
VSTS API Refresh Token Expires <p>I'm using the VSTS REST API. I use the refresh token, as instructed, to refresh the access token. This morning, the refresh tokens stopped working. Do they expire? If the access token and refresh token have both expired, how do I proceed? I can't find anything on this.</p> <p>For...
<p>Yes, the refresh token will be expired, you need to send request to re-authorize to get access token and refresh token again (your previous steps to authorize).</p>
Exclude matched regex pattern <p>I want to match all consecutive lines, prefixed with a space until a line starts without a space!</p> <p>The problem is that the "end pattern" [^ ] is part of the match. The end pattern is a start-of-line not starting with a space.</p> <p>The used pattern: <code>(?im)(?:^( (?s:.*?))(?...
<p>If I've interpreted your request right, you're overthinking it. The pattern you want is this:</p> <pre><code>/(?:^ .+\n)+/gm </code></pre> <p>What it'll do is match every line that starts with a space and ends with a newline, one or more times, in a contiguous fashion.</p> <p><a href="https://regex101.com/r/msVC5...
Adding category id or name to where clause $wpdb <p>This seems like it should be an easy answer but im struggling with this. How can I add category ID to the where clause? I have a bunch of post categories and I want to sort where category ID = 4 or category name = Restaurants. Below is my working $wpdb get_results ...
<p>Assuming that you are using the 'category' taxonomy and interested in the posts with either term id 4 or term name 'Restaurants', the query would look something like:</p> <pre><code>... LEFT JOIN wp_postmeta m4 ON p.id = m4.post_id AND m4.meta_key = 'bOpenClose' INNER JOIN wp_term_relationships AS tr ON tr....
sklearn: semi-supervised learning - LabelSpreadingModel memory error <p>I am using the <code>sklearn LabelSpreadingModel</code> as below:</p> <pre><code>label_spreading_model = LabelSpreading() model_s = label_spreading_model.fit(my_inputs, labels) </code></pre> <p>But I got the following errors:</p> <pre><code> M...
<p><strong>It's obvious: your PC is running out of memory.</strong></p> <p>As you are not setting any parameters, the <strong>rbf-kernel is used by default</strong> (<a href="http://scikit-learn.org/stable/modules/generated/sklearn.semi_supervised.LabelSpreading.html#sklearn.semi_supervised.LabelSpreading" rel="nofoll...
Unable to place a Bitmap file on Desktop <p>I'm creating a Drawing Application and for that i need to create a bitmap for a panel. My problem is when I get the desktop placement it gives me the Error of " Field initializer cannot reference the non-static field, method, or property 'Form1.path'" </p> <pre><code>usin...
<p><strong>Because your field must be static:</strong></p> <p>Initial code:</p> <pre><code>using System; using System.Drawing; internal class MyClass1 { private readonly string _path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); private Bitmap _bitmap = new Bitmap(_path + "\\" + "Bitmap.bmp"...
How to use a unit-testing framework for a function that has a dynamic output in Racket? <p>I was doing exercise 3.5 on SICP book.</p> <p>A Monte Carlo implementation in Racket generates the following code:</p> <pre><code>(define (monte-carlo trials experiment) (define (iter trials-remaining trials-passed) (cond...
<p>There's a built-in check for this - the preferred solution:</p> <pre><code>(check-= (estimate-pi) 3.1416 1e-4 "Incorrect value for pi") </code></pre> <p>The previous check verifies that the result falls within an acceptable <em>tolerance</em> value (also known as <em>epsilon</em>), and it's equivalent to this:</p>...
How do I concat a string of chars together from a matrix in python? <p>The problem I'm working on is outputting a matrix in a clockwise inwards spiral. My code, right now, does this but the output is a little different than what is expected. </p> <pre><code>matrix = [ ['a','d','g','e','t','c'], ['p','k','h','w','e...
<p>Instead of returning <code>result</code>, do</p> <pre><code>return ''.join(result) </code></pre> <p>As the name implies, it joins the contents of list <code>result</code> into one string. The empty string at the beginning means nothing will be put between successive elements. For more details, see the join section...
Websphere and MQ as JMS provider: Lost messages <p>We are using the following</p> <p><strong>Websphere 8.0.0.10</strong></p> <p><strong>MQ as JMS Provider</strong></p> <p>I have an MDB that is putting messages on to another Queue like this (gets triggered by a another message) </p> <pre><code> if (connectionFact...
<p>If this is happening in production then I would recommend opening a PMR with IBM Support and setting the ticket to Sev 1 so we can get the appropriate SMEs engaged.</p>
PL/SQL Triggers in Oracle <p><a href="https://i.stack.imgur.com/af0UO.jpg" rel="nofollow">enter image description here</a></p> <p>I have the following tables shown in the image. I need to create a trigger that inserts data into an AUDIT table from the PAYMENT table including information about the payment like- who mad...
<p>This is easy in Oracle because it has both <em>before</em> and <em>after</em> triggers. The difference between them is, as may well be guessed, when they execute -- just before the operation or after the operation.</p> <p>A <em>before</em> trigger is useful for intercepting the input stream for more sophisticated d...
bash find doesn't find text with underscores in it <p>new thing making me crazy today:</p> <p>create a file with this text:</p> <pre><code>get_modal_file_name_from_service get_modal_file_name_from get_modal_file_name get_modal_file get_modal </code></pre> <p>name it foo.py</p> <p>then try these commands in order:</...
<h3>The Problem, In Short</h3> <p>It's nothing to do with the underscores.</p> <p>Your problem is <code>-Ifile</code>, as GNU xargs replaces the sigil specified with <code>-I</code> even when it exists as a substring in a larger argument.</p> <h3>The Solution, In Detail</h3> <p>Use a sigil that doesn't exist in the...
Detect whether a Python string is a number or a letter <p>How can I detect either numbers or letters in a string? I am aware you use the ASCII codes, but what functions take advantage of them?</p>
<p>You may use <a href="https://docs.python.org/2/library/stdtypes.html#str.isdigit" rel="nofollow"><code>str.isdigit()</code></a> and <a href="https://docs.python.org/2/library/stdtypes.html#str.isalpha" rel="nofollow"><code>str.isalpha()</code></a> to find this. </p> <p>Sample Results:</p> <pre><code># For alphabet...
Flexbox layout pattern 1/3 <p>I'm looking for some help with preparing layout pattern in flexbox, the thing is that I will have a set of divs printed inside container and I can not change the rendering logic (i.e. add some wrapping rows), yet, I'd like to get something like this:</p> <p><a href="https://i.stack.imgur....
<p>What you want to do is not posible with flex-box as is pointed in <a href="http://stackoverflow.com/a/39645224/3597276">link</a> provided by @Michael_B</p> <p>You can generate something really close to what you want using floats:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data...
MySQL - How to Refer to Table in UPDATE Clause in Multiple Levels of Subqueires <p>I am having trouble getting the following query to work...</p> <pre><code>/*SET APPROPRIATE DATABASE CONTEXT*/ USE IDMAS_VESSELS; /*BEGIN UPDATE SCRIPT*/ UPDATE INSPECTION i SET i.WALL_LOSS = CASE WHEN i.STATUS IN('A','R') ...
<p>I have updated your code please see below. This should now work as you intend. Update format has been based off the following link...</p> <p><a href="http://stackoverflow.com/questions/45494/mysql-error-1093-cant-specify-target-table-for-update-in-from-clause?rq=1">MySQL Error 1093 - Can&#39;t specify target table ...