input
stringlengths
51
42.3k
output
stringlengths
18
55k
I need a regex that will return false if my value contains any letters <p>I need a <strong>regex</strong> that will return false if valueA contains any letters. I need letters rejected basically</p> <p><strong>Examples</strong>:</p> <p>1) test1 => reject 2) test => reject 3) 123 = > accept</p> <pre><code> ...
<p>The regex used is <code>/^[0-9]+$/</code></p> <p>You should replace <code>+</code> by <code>*</code> if an empty string is acceptable</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-ove...
How is Rails.cache variable available across threads? <p>If i write a value into say <code>Rails.cache.write('foo', :bar)</code> inside a rails controller action, how is this available inside a rails console context run at the same time?</p>
<p>Since cache is simply a storage (of your choice), it does not matter, where you are accessing it from, controller, model, console - wherever the <code>Rails</code> is defined, <code>Rails.cache.fetch/read/write/etc</code> will work.</p>
Disable/Remove images and link from loading in HTML <p>How can I disable images and links from loading in HTML using a script.</p> <pre><code>&lt;div id="mailPreviewTarget" style="padding: 10px; overflow: auto;"&gt; Sample Text &lt;p&gt;&lt;/p&gt; &lt;img src="http://.../track/0/0.png"&gt; &lt;div&gt...
<pre><code>&lt;script src="https://code.jquery.com/jquery-2.0.3.js"&gt; $(window).load(function(e){ e.preventDefault() $('img , a').remove(); }); &lt;/script&gt; </code></pre>
Python: decorator/wrapper for try/except statement <p>I have some blocks of code which need to be wrapped by function.</p> <pre><code>try: if config.DEVELOPMENT == True: # do_some_stuff except: logger.info("Config is not set for development") </code></pre> <p>Then I'll do again:</p> <pre><code>try: ...
<p>You could pass in a function.</p> <pre><code>boolean = True def pass_this_in(): print("I just did some stuff") def the_try_except_bit(function): try: if boolean: function() except: print("Excepted") # Calling the above code the_try_except_bit(pass_this_in) </code></pre> ...
I need to find out x-path for only number of videos present in page using selenium <p>I need to find out x-path for only number of videos present in page using selenium.</p> <pre><code>&lt;div&gt; &lt;h4&gt; From &lt;a href="/publishers/957-buzzfeed"&gt;BuzzFeed &lt;/a&gt; • 2188 Videos &lt;/h4&gt; &...
<p>First get the text containg number of videos as follows: String headerText = driver.findElement(By.cssSelector("div > h4")).getText();</p> <p>Then, replace all the non-digiy charecters from headerText like this:</p> <p>int totalVideos = Integer.valueOf(headerText.replaceAll("\\D+"));</p>
Where on the website should I put RDF/XML Schema.org code? <p>I'm trying to put Schema.org on a website. First I made JSON-LD but the website is not allowing any <code>script</code> in the <code>head</code> element. Then I converted it into RDF/XML format below. </p> <p>Now, where on the website should I put this for...
<p>If you want to include it in the HTML document, you would have to use a <code>script</code> element (just like with JSON-LD). This <code>script</code> element <a href="http://stackoverflow.com/a/28688394/1591669">doesn’t have to be</a> part of the <code>head</code>, you can place it in the <code>body</code>. An al...
FormUrlEncodedContent works but StringContent does not <p>I have a question about those 2 httpcontents.</p> <p>I've made an webapi (php), copy from this: <a href="http://www.9lessons.info/2012/05/create-restful-services-api-in-php.html" rel="nofollow">http://www.9lessons.info/2012/05/create-restful-services-api-in-php...
<p>They are very different formats. If the api does not have a smart model binder like Asp.Net Web API then it will not work. You can always base64 encode your byte array which is the typical way to transmit bytes via HTTP.</p>
Javascript: Maximum String length Chrome <p>in some other post I found that there should be limitation like 512mb (~2^27) for the maximum string length in javascript. I have the following code in my application:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div ...
<p>The problem is not with the length of the string, but that you're trying to update the value in the input field on screen 240k~ times.</p> <p>A better solution would be to copy the field value to a variable, perform the string concatenation in-memory and then update the finished string only once in the DOM (on scre...
C# - handling session variables like regular variables <p><strong>My primary problem is, that I have a code, which is full of method calls to set/get session variables which makes the source hard to read. I am searching for a better/simpler/more elegant solution. I tried operator overload in classes, wrapper classes, i...
<p>You can create the following Session Wrapper and just add your methods/properties/members to it</p> <pre><code>public static class EasySession { public static string UserId { get { return Get&lt;string&gt;(); } set { Set(value); } }...
Visual Studio 2015 - Typescript "Build:Cannot find module..." <p>I'm trying to add Typescript to an existing .NET MVC project. I however get weird error-messages when I try to build. The Intellisense works and I can see that the typeings works. I can also see the .js-files being generated on manual save, meaning that t...
<p>Are your npm dependencies installed? If not, then you should run <code>npm install</code> command on your project folder manually, or to avoid this in the future, you can automatically install npm packages to your project on build by editing your <code>.njsproj</code> file, after line</p> <pre><code>&lt;Import Proj...
C++ CScrollView, how to scroll an image? <p>I draw an image in CScrollView (inherited from CView). Image scale is recalculated if view form is zoom in or zoom out:</p> <pre><code>//*.h CPictureHolder pic; //*.cpp void CMyAppView::OnPaint() { CPaintDC dc(this); CBitmap bmp; BITMAP b; HBITMAP hbitmap; ...
<p>Try TO NOT execute </p> <pre><code>CScrollView::OnMouseWheel(nFlags, zDelta, pt); </code></pre> <p>and instead do</p> <pre><code>return FALSE; </code></pre>
How do I get more than 10 message attachments from Microsoft Graph API? <p>When I query Microsoft Graph API to return attachments of an email then only a maximum of 10 attachments are returned (<a href="https://graph.microsoft.io/en-us/docs/api-reference/v1.0/api/message_list_attachments" rel="nofollow">https://graph.m...
<p>I don't reproduce this with either Graph (using <a href="https://graph.microsoft.io/en-us/graph-explorer" rel="nofollow">Graph Explorer</a>) or Outlook APIs (using <a href="https://oauthplay.azurewebsites.net" rel="nofollow">OAuth Sandbox</a>). I've got a message with 24 attachments and they all come back. Can you t...
Two canvases at same absolute position, how to force mouse focus to the top one <p>I have two canvases exactly at same position, the first adCanvas is used to draw a video ad before a game is loaded to another div. When the video ad ends, I show the game and move focus to mainCanvas simply with a command adCanvas.styl...
<p>The <code>mainCanvas</code> is on top of <code>adCanvas</code> (i.e. a higher <code>z-index</code>) so it will accept any mouse clicks if it is visible.</p> <p>I'm guessing <code>mainCanvas</code> is transparent (otherwise you wouldn't be able to see <code>adCanvas</code> anyway, right?) at this point so why not hi...
Several questions to implement multi lingual functionality with Umbraco? <p>I'm struggling to implement the multilingual functionality in Umbraco CMS version 7.5, currently i see 2 possible solutions:</p> <p><strong>1- Use only one root path</strong></p> <p>I think the best package as a complement for this solution i...
<p>Both scenarios have their pros and cons and both are widely used in the Umbraco community / solutions. I prefer 2nd solution, as especially on larger sites it gives you ability to restrict access for different language editors for example and not each site has a requirement to be 1-1 content structured.</p> <p>Ther...
map not quite lazy? <p>map doesn't seem quite as lazy as I would like, in this example map calls the function one time as I would expect:</p> <pre><code>(first (map #(do (println "x: " %) %) '(0 1))) </code></pre> <p>but in these two examples it calls the function two times:</p> <pre><code>(first (map #(do (println ...
<p>Map (and similar HOFs which work on collections) work on sequence abstraction over collections: it creates a sequence from passed collection <code>(seq coll)</code> and works on returned sequence afterwards. PersistentList (<code>'(0 1)</code> is instance of PersistentList) implements ISeq through ASeq extension so ...
How to prevent scaling on touch screen != mobile <p>Am running a web app on touch screen computer where you can zoom in and out. I want to prevent this behaviour I added this meta tag:</p> <pre><code>&lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=0, width=device-width" /&gt; </code><...
<p>Try <code>user-scalable = no</code> instead of <code>user-scalable = 0</code>.</p>
How can I filter objects using django views? <p>I am using this generic view and I would like to filter the campaign_type's for only certain types. I was trying to use queryset= CampaignType.objects.filter(type='social') but it doesn't work. Any Clue ? Notice that the filter is for a manytomany relation with CampaignT...
<p>Try this</p> <pre><code>class CCtypeUpdate(generic.UpdateView): model = Campaign fields = ['campaign_type'] ...... #rest of your code def get_form(self, form_class=None): form = super(CCtypeUpdate, self).get_form(form_class) form.fields["campaign_type"].queryset = CampaignTy...
Can't display multiple data in select option using ionic <p>I want to display the data I get from my database and I actually getting 2 data but only one data are displayed in my select option.</p> <p>My code from my controller is this.</p> <pre><code> var link = 'http://127.0.0.1/mobile/subject.php'; v...
<p>You need to loop through each subject on the front-end like an ng repeat on option or ng-option. The way you are trying to display it now it will only show the last item within the array. Try the code below taken from here, but customize it to fit your work. <a href="https://docs.angularjs.org/api/ng/directive/sele...
`multiple definition of` lots of variables error - is my make file incorrect? <p>I am getting an error when I compile <code>multiple definition of</code> lots of variables. For example:</p> <pre><code>/tmp/ccwHwJ7t.o:(.data+0x0): multiple definition of `serial_number' /tmp/ccmT1XNI.o:(.data+0x0): first defined here </...
<p>You probably include the .h file in other source files too. No problem, but only in one source file should the variables be declared and in the others just defined. I use:</p> <pre><code>// ftdi.h #ifndef EXTERN # define EXTERN extern #endif EXTERN int examplevar; // main.c #define EXTERN #include "ftdi.h" // ftd...
How to conditionally drag and drop a div <p>When moving a div from <strong>FIRST</strong> to <strong>Second</strong> </p> <p>I need to check if this div already exists inside <strong>Second</strong></p> <p>(based on the tag-id="2" video-id="4" attributes)</p> <p>i have tried it this way </p> <p>During the drag and ...
<p>You have to use 'ui' instead of the 'event' , Here is the <a href="https://jsfiddle.net/Lphf43wd/" rel="nofollow">Working Demo</a></p> <p>below changes need in your stop function:</p> <pre><code> stop: function(event, ui) { debugger; console.log($(ui.item).a...
ionic push notification not working <p>I am Implementing push notification in <code>ionic</code></p> <p>I have successfully got device <code>token</code> and <code>FCM credentials</code>.</p> <p>But when I build the project, I got following error.</p> <pre><code>FAILURE: Build failed with an exception. * What went ...
<p>Did you find a solution for this? I got the same error when following these steps: <a href="https://github.com/edismooth/ionic2-firebase" rel="nofollow">https://github.com/edismooth/ionic2-firebase</a></p> <p>I guess that relates to the changes in RC0, but I have no idea what is causing this.</p>
Spring boot - rest template and rest template builder <p>I have questiom about spring resttemplate and resttemplatebuilder. As I know the resttemplatebuilder is some kind of factory for RestTemplate.I have few questions about using it:</p> <ol> <li><p>Very often in examples at internet I see something like this in @Co...
<ol> <li><p>No, you dont need to, typically you will have on rest template instance, and you would pass different url, and request parameters accordingly every time. </p> <p>String result = restTemplate.getForObject("<a href="http://example.com/hotels/" rel="nofollow">http://example.com/hotels/</a>{hotel}/bookings/{bo...
read css file from HTML throws error <p>I have the below code to read and append to a div tag.(I have a requirement to implement this.)</p> <pre><code>var totalCss= "\n"; var requiredSheets = ['test.css']; var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules; for (var s = 0; s &...
<p>There are multiple stylesheets with a document. So you have to loop all the stylesheets.</p> <p>Below is the working example</p> <h1>Update 1</h1> <p>Added ajax to get the external css linked with the page</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div ...
INotifyPropertyChanged Delegate <p>I saw a implementation of INotifyPropertyChanged like</p> <pre><code>public event PropertyChangedEventHandler PropertyChanged = delegate { }; </code></pre> <p>I usually implement it like</p> <pre><code>protected void OnPropertyChanged([CallerMemberName] string propertyName = null)...
<p>The difference is simply that by initializing <code>PropertyChanged</code> with a no-op delegate to start with, you don't need to worry about whether or not the delegate is <code>null</code> due to there being no subscribers.</p> <p>Before C# 6, the "check whether or not it's null" aspect was a bit of a pain - with...
combobox with different worksheets, that changes worksheets in code <p>i've a question: I would like to have a Combobox where all the worksheets are displayed. If you select a worksheet, then the worksheets in the code needs to change to the worksheet that you selected. I've tried but can't program this. easy example:...
<p>Use the following code in a <code>User_Form</code> Module </p> <pre><code>Private Sub ComboBox1_Change() ' select the worksheet selected in the ComboBox1 Worksheets(ComboBox1.Value).Activate End Sub Private Sub UserForm_Activate() Dim Sht As Worksheet ' show all sheets names in thisworkbook in ComboBox1 For E...
creating a list from a discrete function in mathematica <p>I'm trying to make a list of lists {{a},{b}...}, but instead I'm building a list of non-list terms {{{a}},{{b}}...}</p> <p>First, I started with a discrete function: </p> <pre><code> f[n_]:=RandomReal[BinormalDistribution[{c[[n, 3]], c[[n, 1]]}, ........... ...
<p>You can <code>Flatten</code> a single level in your list of lists. Essentialy you're squeezing out a singleton dimension in your 3d array, making it 2d:</p> <pre><code>In[22]:= mylist = {{{1.64219, 0.0231185}}, {{0.690885, 0.00599381}}} Out[22]= {{{1.64219, 0.0231185}}, {{0.690885, 0.00599381}}} In[23]:= Dimensio...
How to fetch all remote branches? <p>Somehow one of my repositories refuses to fetch new branches:</p> <pre><code>C:\temp&gt;git fetch --all Fetching origin C:\temp&gt;git branch -a * develop remotes/origin/develop C:\temp&gt;git ls-remote --heads origin d130c97c1ccbe9ab35cd6e268c760781e37e3628 refs/heads/2.1.0.x .....
<p>Check you <code>git config --get remote.origin.fetch</code> <strong><a href="https://git-scm.com/book/en/v2/Git-Internals-The-Refspec" rel="nofollow">refspec</a></strong>.</p> <p>It would only fetch <em>all</em> branches if the refspec is </p> <pre><code>+refs/heads/*:refs/remotes/origin/* </code></pre> <p>If the...
Prevent onClick event by clicking on a child div <p>I'm trying to create a modal in React JS</p> <p>I have one outter div which is the whole body and I have I inner div. I want to apply the function to close the modal if it's clicked outside of the inner div.</p> <p>My code is as follows :</p> <pre><code>popupOutter...
<p>If you attach a function to the inner div which <code>stops propagation</code> it should work, right?</p> <pre><code> function stopPropagation(e) { e.stopPropagation( } </code></pre> <p>In your case <code>&lt;div style={this.popupInnerDivStyle()} onClick={stopPropagation}&gt;</code></p> <p>Does this he...
error when defining a std::shared_ptr with new operator <p>I am trying to define a <code>std::shared_ptr</code> with <code>new</code> operator in the following way:</p> <pre><code>#include &lt;memory&gt; struct A { }; int main() { std::shared_ptr&lt;A&gt; ptr = new A(); return 0; } </code></pre> <p>but I obta...
<p><strong><em>tl;dr:</em> it's a consequence of the relevant constructor being <code>explicit</code>.</strong></p> <p>When you initialise with <code>=</code>, you invoke copy-initialisation. C++ does not allow copy-initialisation of a <code>shared_ptr</code> from a raw pointer, because it would be too easy to end up ...
callback function for Google Geocode API returning NULL Value <p>I have the geoCode function that uses a callback function to do something after the asynchronous request has completed. However, it returns a NULL value. </p> <pre><code> function codeAddress(callback) { /***** build string address from form data ...
<pre><code>var returnData = function () { return data; }; codeAddress (returnData ()); </code></pre> <p>Should be able to pass what you like.</p>
Migrating from AMPL to Pyomo <p>I am trying to use open source Pyomo lib instead of ampl, so i am trying migrating the ampl car problem that comes in the Ipopt source code tarball as example, but i am having got problems with the end condition (reach a place with zero speed at final iteration) and with the cost functio...
<p>Currently, a ContinuousSet in Pyomo has to be bounded. This means that in order to solve a minimum time optimal control problem using this tool, the problem must be reformulated to remove the time scaling from the ContinuousSet. In addition, you have to introduce an extra variable to represent the final time. I've a...
Flip a 2D character, using inverse kinematics, in Unity <p>I have a rigged 2D character with <a href="https://github.com/Banbury/UnitySpritesAndBones" rel="nofollow">Sprites And Bones</a> in Unity and I use inverse kinematics to animate it.</p> <p>But if I want to flip the X-axis, my character go berserk :</p> <p><a ...
<p>Okay, so as we discussed in comments, just to sum it up:<br> 1) You don't flip everything and/or don't reset bones correctly, that's why the animation "falls apart" on flipping<br> 2) One can do a <code>SpriteRenderer</code>.flip[X/Y] but this should be done on every element of the sprite<br> 3) Skeleton script has ...
No action occurred when clicking on Edite button <p>i'm trying to edit a row (my project is a simple phone book)from my index view which shows all of my records (Contact) but when i click on the edit button nothing happens </p> <p>this is my delete method </p> <pre><code>#region [- Delete -] #region [- Get -] ...
<p>In your Edit method in your HomeController, try this:</p> <pre><code>[HttpGet] public ActionResult Edit(int? _id) { if (_id==null) { return new HttpStatusCodeResult(HttpStatusCode.NoContent); } else { return View(); } } </code></pre>
Make a link that opens app if installed, open Google Play/Appstore if not installed, and open another link if desktop pc? <p>I want to make a link in an email, that opens my app, if the app is installed. If it isn't installed, I want it to open either google play or Appstore depending on the phone people use. If they a...
<p>Detect the user agent first, then according to that navigate the user to different locations. here is the simple javascript code which you can add up in your site, then give the site url in the email. Hope this help. </p> <pre><code>//Useragent detection from http://stackoverflow.com/questions/21741841/detecting-io...
How to get a webserver's content from a local html file <p>So right now I have a html file which I need locally stored, when I open this webpage I need it to download some content from a webserver.</p> <p>I've tried using Jquery's AJAX but that doesnt let me use cross domain, so I am stuck, here is what I have tried t...
<p>You can use JSONp method, this method is <strong>preferable</strong>. Here is how: <a href="http://stackoverflow.com/a/3506306/5434216">Link</a></p> <p>Or you can allow access on server side by using <code>Access-Control-Allow-Origin: *</code> in php headers. You write your own domain instead of using <code>*</code...
Pessimistic lock on orientDB graph API <p>I am creating a system in orientDB I have some cases where i need to make the system where multiple threads adding edges to certain vertex and updating a property on that vertex. My Question is that is there any method where i can block operations on this vertex until other thr...
<p>OrientDB has an optimistic concurrency control system, but on very high concurrent updates on the few records it could be more efficient locking records to avoid retries. You could synchronize the access by yourself or by using the storage API. Note that this works only with non-remote databases.</p> <pre><code>((O...
Heroku run cp -r is trying to run on the wrong git remote <p>I tried to run this command on Heroku. </p> <pre><code>heroku run cp -r /app/.heroku/python/lib/python2.7/site-packages/django/contrib/admin/static/admin doctor_app/static/ </code></pre> <p>And I got this error.</p> <pre><code>▸ Error: Could not find ...
<p>Heroku uses different git remotes to separate environments, so I believe it is interpreting the -r flag in your command as the remote to run on. Sticking the command in quotes will force it to interpret that whole block as one argument.</p> <p><code>heroku run "cp -r /app/.heroku/python/lib/python2.7/site-packages/...
how to complex manage shell processes with asyncio? <p>I want to track reboot process of daemon with python's asyncio module. So I need to run shell command <code>tail -f -n 0 /var/log/daemon.log</code> and analyze it's output while, let's say, <code>service daemon restart</code> executing in background. Daemon continu...
<blockquote> <p>But how to run track() strictly before reboot to not miss any possible output in log?</p> </blockquote> <p>You could <code>await</code> the first subprocess creation before running the second one. </p> <blockquote> <p>And how to retrieve return values of both coroutines?</p> </blockquote> <p><a h...
Worksheet_Changed Method for code generated Worksheet <p>I'm creating a Worksheet by Code and add some value. Now I want to check wheater the value in Column C has changed and want to change the value of column D too. I found the sub Worksheet_Change to do this. But this method is not working for my created worksheet, ...
<p>For the code to work in a newly created worksheet, it must be inserted into the worksheet code for the new sheet.<br><br><br>It is easier to <code>.Copy</code> an existing worksheet that already has the macro installed than to <code>.Add</code> a fresh worksheet.</p> <p>You get the added benefit that the <code>.Cop...
Object not rotating around its axis <p>I have a gun consisting of two parts (1 is handle, 2 is nozzle). I want to rotate the nozzle when I shoot the target.</p> <p><a href="http://i.stack.imgur.com/AbQGS.gif" rel="nofollow"><img src="http://i.stack.imgur.com/AbQGS.gif" alt="I want to rotate the Nozzle like this"></a><...
<p>Your parameters to transform.Rotate don't looks correct to me. Should be something like </p> <pre><code>gunNozzle.transform.Rotate(Vector3.right * Time.deltaTime); </code></pre> <p>Nb: Vector direction might be wrong in my example.</p>
MYSQL LEFT JOIN result not giving <p>I have 2 tables</p> <p>banks table </p> <pre><code>create table `banks` ( `bank_id` int , `bank_name` varchar (150), `balance` double , `b_date` date , `delete_state` double ); insert into `banks` (`bank_id`, `bank_name`, `balance`, `b_date`, `delete_state`) ...
<p>You need to group by bank_id. When you group a question you get the result for each value for the variable you group on.</p> <pre><code>SELECT bk.*, SUM(amount) AS tot_amount, (bk.balance - SUM(amount)) AS bank_balance FROM banks bk LEFT JOIN cheque ch ON (bk.bank_id = ch.bank_id AND ch.status = 1 AND ch.delete_...
Redux - Reset state of subtree <p>What is the proper way to reset the subtree of a redux store? I'm not interested in resetting the entire redux store, but just the reducer subtree portion of it. </p> <p>Here is an example snippet:</p> <pre><code>//initial state const initialState = { isFetching: false, erro...
<p>The object you create will look like this:</p> <pre><code>{ initialState: { isFetching: false, error: '', page: 0 } } </code></pre> <p>What you want is this:</p> <pre><code>case CLEAR_SUGGESTIONS : { return { ...initialState } } </code></pre>
Styling a checkbox without the label tag <p>I made a checkbox style and it uses the label tag. See below </p> <p>Is it possible to still have the CSS of the entire checkbox without the label tag? So i just have the Input tag, but still the CSS. Here is the CSS of the checkbox. </p> <p><div class="snippet" data-lang="...
<p>You can apply custom style to the checkbox using css <code>:after</code> , <code>:checked</code>.</p> <p>Please see below code or jsfiddle</p> <p>HTML</p> <pre><code>&lt;input type="checkbox"/&gt; </code></pre> <p>CSS</p> <pre><code> input[type='checkbox']:after{ line-height: 1.5em; content: ''; ...
How to install local jar with dependencies in maven <p>I have a local jar (a maven plugin I wrote myself) which I am installing with</p> <pre><code>mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file -Dfile=dependencies/my-maven-plugin-1.0.jar </code></pre> <p>The plugin has some dependencies (define...
<p>No, you can't do that. And it is normal: the <a href="http://maven.apache.org/plugins/maven-install-plugin/install-file-mojo.html" rel="nofollow"><code>maven-install-plugin</code></a> will install the file you pass it, which in this case is <code>my-maven-plugin-1.0.jar</code>, and that's it. It will also look insid...
Unfixable memory leak <p>I apologize for the long code snippet ahead, but I spent a good while looking on here and I feel like nothing I've seen so far can help me solve this. I've asked questions on course forums, had TAs help, and have gotten suggestions from friends and nothing has been able to lock down the root of...
<pre><code>root = malloc(sizeof(node)); </code></pre> <p>This gives a chunk of uninitialized memory.</p> <pre><code>if (current_node-&gt;children[index] == NULL) </code></pre> <p>Here you assume that the memory has been initialized, while it is actually garbage.</p> <p>You need to initialize the contents of <code>r...
MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response <p>I got this error on an Exchange 2007 mailbox. I see it is returning the <code>BAD</code> response from the error which is thrown by MailKit:</p> <pre><code>The IMAP server replied to the 'EXAMINE' command with a 'BAD' response. </code><...
<p>You can try parsing the <code>ImapCommandException.Message</code> property to get the text following the ':' character that is used in the exception message.</p> <p>I've also just added a <code>ResponseText</code> property to <code>ImapCommandException</code> so you can get this text w/o needing to parse it if you ...
Get artifact for GAV from Artifactory <p>For given groupId, artifactId, version, classifier and type, how can I download the corresponding artifact using REST?</p>
<p>use the gavc search to get the URL and from there you can download the artefact:</p> <p>GAVC Search</p> <blockquote> <p>Description: Search by Maven coordinates: GroupId, ArtifactId, Version &amp; Classifier. Search must contain at least one argument. Can limit search to specific repositories (local and remo...
Java List.addAll using collection's stream instead of using collection itself? <p>Recently I found a code snippet which uses stream in List.addAll, but I can't see the reason why it was used.</p> <p>So given a simple list. <code>List&lt;E&gt; subList</code> which is passed as argument to a method. There is a is an oth...
<p>There is no difference at all, using <code>originalList.addAll(subList)</code> will do exactly the same because <code>addAll()</code> method creates an array copy of <code>subList</code> in memory and does not point to the same reference. Perhaps there was some intermediate operation in the <code>Stream</code> which...
Python SQLITE3 Inserting Backwards <p>I have a small piece of code which inserts some data into a database. However, the data is being inserting in a reverse order.<br> If i "commit" after the for loop has run through, it inserts backwards, if i "commit" as part of the for loop, it inserts in the correct order, however...
<p>You can't rely on <em>any</em> ordering in SQL database tables. Insertion takes place in an implementation-dependent manner, and where rows end up depends entirely on the storage implementation used and the data that is already there.</p> <p>As such, no reversing takes place; if you are selecting data from the tabl...
One of threads rewrites console input in Python <p>I have a problem with console app with threading. In first thread i have a function, which write symbol "x" into output. In second thread i have function, which waiting for users input. (Symbol "x" is just random choice for this question).</p> <p>For ex.</p> <p>Threa...
<p>In a console, standard output (produced by the running program(s)) and standard input (produced by your keypresses) are both sent to screen, so they may end up all mixed.</p> <p>Here your thread 1 writes 1 <code>x</code> by line every second, so if your take more than 1 second to type <code>HELLO</code> then that w...
Cordova: can't use remote page as content for iOS CDVViewController <p>I'm trying to add Ionic 2 app as part of the native iOS application. As I found, CDVViewController should be used for integration.</p> <ul> <li>have Xcode 7.3.1</li> <li>installed <code>pod 'Cordova', '4.2.1'</code></li> <li>added <code>config.xml<...
<p>Finally found: needed to add <code>&lt;allow-navigation href="..." /&gt;</code> tag. In my case it was <code>&lt;allow-navigation href="http://localhost" /&gt;</code>. </p> <p>Check <a href="https://github.com/apache/cordova-plugin-whitelist#navigation-whitelist" rel="nofollow">https://github.com/apache/cordova-plu...
AVAudioPlayerNode doesn't play sound <p>I'm trying to generate sound with code below. Everthing is fine there is no error. But when I executed this code, there is no sound. How can I fix this problem ? </p> <p>By the way, I'm using this example : <a href="http://www.tmroyal.com/playing-sounds-in-swift-audioengine.html...
<p>Your <code>AVAudioEngine</code> looks like it's a local variable - that will go out of scope and be deallocated. Assign it to a class instance variable and maybe you'll hear some sound.</p>
Service Bus (On Premise) (1.1) and "High Availability" : Connection String <p>I have a question about Service Bus (On Premise) (1.1) and "High Availability".</p> <p>Below are 2 images from Microsoft. From this article </p> <p><a href="https://msdn.microsoft.com/en-us/library/jj193012%28v=azure.10%29?f=255&amp;MSPPEr...
<pre><code>To get ConnectionString Use the following cmdlet Get-SBAuthorizationRule -Namespace YourNamespaceName You have to Export and import the certificates to use the same connectionstring in your client machine. </code></pre> <p>For Your Reference: <a href="https://msdn.microsoft.com/en-us/library/jj192993.aspx...
How to find the product categories with subcategories and so on in wordpress? <p>Here i get 2-level categories of product but i want more than 2.Like prodA->proda1->proda11 </p> <pre><code>$taxonomy = 'product_cat'; $all_categories = get_categories(array( "taxonomy" =&gt;"product_cat","parent" =&gt; 0)); echo "&lt;pr...
<p>Please use this code becuase of if you not added <code>hide_empty =&gt; 0</code> then some unattached category product are not showing in your dropdown.</p> <pre><code>$args = array( 'type' =&gt; 'product', 'child_of' =&gt; 0, 'parent' =&gt; '', ...
PHP populated dropdown, onchange populate different dropdown based on value <p>Hi so the here is my question,</p> <p>I have a Database containing Categories and Subcategories. I have two dropdown boxes (select). I want them both to be populated by using PHP/MYSQL.</p> <p>My Categories have been generated:</p> <pre><...
<p>add an id on category select box , like this -</p> <pre><code>&lt;select name="prod_cat" id="prod_cat"&gt; &lt;?php include("php/dbconnect.php"); $sql = "SELECT * FROM categories"; $result = mysqli_query($conn, $sql); if (mysqli_num_rows($result) &gt; 0){ while ($ro...
i cannot round up and get it for my GTIN <pre><code>import random r1 = (random.randint(0,9)) r2 = (random.randint(0,9)) r3 = (random.randint(0,9)) r4 = (random.randint(0,9)) r5 = (random.randint(0,9)) r6 = (random.randint(0,9)) r7 = (random.randint(0,9)) print ("your item barcode number is", r1,r2,r3,r4,r5,r6,r7) r8 = ...
<pre><code>def round_up_by_ten(num): return num if not num%10 else ((num//10)+1)*10 </code></pre>
vpn service that use akamai servers <p>is it possible to host a vpn or a proxy on akamai servers and is there any available vpn services that host it servers on akamai I tried googling but it throw in another whole direction</p>
<p>@Rahim, As far as i am aware akamai doesn't host vpn servers, but there are other CDN providers which do provide this feature.</p> <p>If you are looking something within akamai then i suggest you contact the customer care, even though vpn server hosting might not be available but they will guide if you there are ot...
Convert tabulated column to array <p>My input is copied from a HTML table and looks like this in text format:</p> <p>1 2 3</p> <p>4 5 6</p> <p>(imagine 'tabs' instead of the spaces)</p> <p>The String would become then:</p> <p>1\t\2\t3\r\n4\t5\t6</p> <p>How can I create an array so that:</p> <p>myArray(0,0) retur...
<p>Since you know how to split it at the tabs, you can split it at the line break too.</p> <pre><code>stringIs = 1\t\2\t3\r\n4\t5\t6 firstSplit = stringIs.split("\r\n"); </code></pre> <p>Now you have an array with two elements.</p> <pre><code>firstSplit[0] = "1\t\2\t3"; firstSplit[1] = "4\t5\t6"; </code></pre> <p>...
Preprocessor definitions not working in C <p>I've been frantically trying to get this following code to work. The preprocessor definitions WIDR and LIDR aren't working and it's giving me the compile error: </p> <pre><code>projects/elcain.c: In function ‘main’: projects/elcain.c:17:6: error: ‘WIDR’ undeclared (...
<p>You probably simply want this:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; int main () { #ifdef _WIN32 char directory[] = "C:\\TEMP\\"; #elif defined _linux_ char directory[] = "~/.temp/"; #else #error Neither _WIN32 nor _linux_ are defined #endif printf("...
How to use ajax in Rails for destroy method? <p>I want to make an option "delete" for my items based on ajax.</p> <p>items_controller:</p> <pre><code>def destroy @item.destroy respond_to do |format| format.js { render :layout =&gt; false } end end </code></pre> <p>destroy.js.erb:</p> <pre><code>$('div#ite...
<p>It looks like your <code>destroy.js.erb</code> file is wrong. You are attaching an event handler when you just need to simply remove the line. Change your file to:</p> <pre><code>$('div#item_&lt;%= @item.id %&gt;').fadeOut(); </code></pre> <p>Now, you could also make a check to see if the item truly has been delet...
In AutoCompleteTextView apply on item click listner returns always id as a 1 <p><strong>This is my json responce :-</strong></p> <pre><code>{ "ReplyCode": 1, "Message": "Franchisee and Plans List", "data2": [ { "StateId": 1, "StateName": "Andaman and Nicobar Island", "CountryId": 1 }, ...
<p>Your code uses <code>i</code> that returns in the <code>onItemClick</code> callback, which refers to the item you clicked from the visible items in the auto-complete list, not your original list. When you click on the first item in the auto-complete list, <code>i=0</code>, which means it always returns the "<em>Anda...
Single OnClickListener for multiple ViewHolders <p>My <code>ViewHolder</code> (inner) class:</p> <pre><code>static class HostViewHolder extends RecyclerView.ViewHolder { ImageButton button1; ImageButton button2; HostViewHolder(View listItemView) { super(listItemView); button1 = (ImageBut...
<p>You can attach onClickListener in the ViewHolder class itself.</p> <pre><code>static class HostViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ ImageButton button1; ImageButton button2; HostViewHolder(View listItemView) { super(listItemView); button1 = (Imag...
Semantic git message and cleaning <p>In one of my node code, I must do some cleaning. For example removing unused <code>console.log()</code> functions or comments placed here during dev/debugging phase by my coworker.</p> <p>I try to follow some semantic git message rules, for cleaning, as mentioned <a href="http://ka...
<p>I'd go with <code>chore</code>, since this will not change the way the "production" code work.</p> <p>This is not a feature, not a bugfix, not a style change... so this is kind of a default choice, but it seems right.</p>
AngularJS: How to create and use an array for a value in the HTML <p>I have created a custom directive with fields: <code>ng-model</code>, <code>input-array</code></p> <pre><code>&lt;mydir ng-model="myBinding" input-array="input1,input2"&gt;&lt;/mydir&gt; </code></pre> <p>Input 1 and input 2 are both data bindings, h...
<p>Just wrap the variables in array braces</p> <pre><code>input-array="[input1,input2]" </code></pre> <p>Beyond that there isn't nearly enough detail in question</p>
Yield continue? <p>There's <code>yield return</code> to return the next element in the collection and then there's <code>yield break</code> to end the iteration. Is there a sort of <code>yield continue</code> to tell the loop controller to skip to the next element?</p> <p>Here's what I am trying to achieve, though it...
<p>There is no need to have a separate <code>yield continue</code> statement. Just use <code>continue</code> or any other conditional statement to skip the element as you need within your enumeration algorithm. </p> <p>The enumeration algorithm that uses <code>yield</code> is internally transformed into a state machin...
CSS Dropdown menu not working? <p>I've been following this video online on how to create dropdown menu using css. I followed it and there's no any signs of a dropdown menu on my website. It's so frustrating because i want to get over with it so i can focus now on backend dev. Hope you guys can figure this one out.</p> ...
<p>Add this to your CSS : It will help you to have the result you want. Of course there are still adaptations to do regarding your preferences.</p> <pre><code>/* Without this line, the submenu elements are black on black background */ #nav_menu .sub-menu li a { color: #fff; } /* With this line you will remove the ...
EF 6 Tries to insert an object twice <p>I'm new using Entity Framework, and we are triyng to addapt our application with an architecture using EF6 model first. I have a class like that (I have simplified the code to explain better):</p> <pre><code>class Country { int CountryId (identity column) { get; set; } string ...
<p>First of all, I think that your code doesn't compile. You have errors in Create() method. There is type Region and you use it as name of variable.</p> <p>Secondly, you asssign both navigation property (Country) and foreign key value (CountryId) in create method. You can just assign a CountryId property. So, in my o...
Is there any way to remove encryption from an existing Realm database? <p>We are using the Objective-C version of Realm, version 2.0.2. The database is currently encrypted and is in the field.</p> <p>Intermittent crashes on the startup of Realm have been occurring, with an error message of "Unable to open a Realm at ...
<p>You can use <code>writeCopyToURL:encryptionKey:error:</code> with a <code>nil</code> encryption key to write an unencrypted copy, and then move that over the original file:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { RLMRealmConfi...
Change div position with translate3d according to the mouse movement <p>I would like to achieve the effect of subtil div position changes with css transform translate3d according to the mouse movement. Something like the geometric figures of this website home section: <a href="http://riccardozanutta.com/" rel="nofollow...
<p>Solving your question for the max 5px displacement, you can multiply the X and Y coordinates with a factor like 0.1 to reduce the amount of movement. Like so:</p> <pre><code>$(".basic-skill").css({"left" : event.pageX * 0.1, "top" : event.pageY * 0.1}); </code></pre> <p><strong>EDIT:</strong> Instead of using <cod...
Open unique secondary window with Tkinter <p>I'm having a trouble when i open a secondary window. Now I'm just creating a toplevel window with a button and I need to open the same secondary window If i click the button (not generate a new instance).</p> <p>Which is the better way to generate single secondary window an...
<p>Finally after some tests I've found how to solve that, thanks to the @furas response and some investigation about the Tkinter events with the protocol function.</p> <p>I've got that working with:</p> <pre><code>import tkinter logWindowExists = False class LogWindow(): def __init__(self, parent): glob...
Why is my Presenter not subscribed to my View event in my WinForms project? <p>I am trying to implement the MVP pattern into my WinForms project. However, the method 'Activate' in my Presenter that is subscribed to my 'ActivatedForm' event from my View, does not seem to fire when i load the form. I have tested it simpl...
<p>The <code>Form.Activated</code> event is only fired when the form is visible. See <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.form.activated(v=vs.110).aspx" rel="nofollow">the documentation</a>.</p> <blockquote> <p>When the application is active and has multiple forms, the active form i...
Inverse match for HTML tags <p>Using <strong>NodeJS</strong>, I have the following regex: <code>/&lt;[^&gt;]*&gt;/g</code> which matches HTML tags: (<a href="https://www.regex101.com/r/KIC8hb/1" rel="nofollow">Live Demo</a>) <a href="http://i.stack.imgur.com/OYO06.png" rel="nofollow"><img src="http://i.stack.imgur.com/...
<blockquote> <p>Is it possible with JS?</p> </blockquote> <p>No. HTML can be arbitrarily nested, which means you need recursion in order to consume it using regex - something which JavaScript regex doesn't have.</p> <p>Assuming you can ditch JS and use a language that supports PCRE, this <strike>monstrous bunch of ...
Spring REST service log request and response messages <p>How to log incoming request and response HTTP messages along with headers for my Spring REST services? I am using Spring 4 and Tomcat 7. </p> <p>What is the best practice to log the above? </p> <p>I checked logBack TeeFilter but the documentation advises to dis...
<p>I have been using the answer provided in <a href="http://stackoverflow.com/questions/3017188/java-tomcat-standalone-how-to-log-access-all-the-http-get-requests?rq=1">Java/Tomcat standalone, how to log/access all the HTTP GET requests</a> for my Spring 4 project and it works like a charm. Idea behind this is to remov...
Currently working on my project and need some help ...want to save my command line info or text in Text File through c# <pre><code> System.Diagnostics.Process process1; process1= new System.Diagnostics.Process(); process1.EnableRaisingEvents = false; string strCmdLine; strCmdLine = "/k " +textBox3.T...
<p>Try this</p> <pre><code>using System.Diagnostics; Process.Start("cmd", "/k " + textBox3.Text + @" &gt; C:\test.txt"); </code></pre> <p>Also, read <a href="http://www.codeproject.com/Articles/335909/Embedding-a-Console-in-a-C-Application" rel="nofollow">Embedding a Console in a C# Application - CodeProject</a></p>...
React Native: synchronously run functions <p>I'm new to OOP. My knowledge of promises/asynchronously/synchronously running functions is simply basic. I'd really appreciate your time and attention!</p> <p>This is the example from React-Native docs:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-cons...
<blockquote> <p><code>getMoviesFromApi</code> is declared as <code>async function</code>. which means it will execute functions one after other.</p> </blockquote> <p>No. That only means that it will return a promise when called, and that you can use the <code>await</code> operator in the function body.</p> <blockqu...
Kotlin Jackson generation objects from JSON <p>Please help! I'm trying to generate object from JSON with jackson kotlin module. Here is json source:</p> <pre><code>{ "name": "row", "type": "layout", "subviews": [{ "type": "horizontal", "subviews": [{ "type": "image", ...
<p>There are several issues I found about your mapping that prevent Jackson from reading the value from JSON:</p> <ul> <li><p><code>Skeleton</code> class has not-null constructor parameters (e.g. <code>val type: String</code>, not <code>String?</code>), and Jackson passes <code>null</code> to them if the value for tho...
How to properly publish an event? <p>In a runtime only package, I've defined a TFrame descendant which publishes the OnLoaded event:</p> <pre><code>type TMyMethod = procedure() of object; TMyFrame = class(TFrame) protected FOnLoaded : TMyMethod; procedure Loaded(); override; published property OnL...
<h1>Updated (somewhat less bogus) answer</h1> <p>You accepted my original answer, but what I wrote was not correct. Rob Kennedy pointed to an <a href="http://community.embarcadero.com/blogs/entry/assigned-or-not-assigned-that-is-the-question-28836" rel="nofollow">article</a> by former Embarcadero developer Allen Bauer...
Convert String to INT64 <p>How do I convert in the following code the string to INT64 instead of INT32</p> <pre><code> public static int TransferClient(string NRIFActual, string NRIFNuevo) { int nResult = 0; try { nResult = ws.TransferClient(int.parse(NRIFActual), int.Parse(NRI...
<p>You probably get OverflowException because the value that an int(Int32) can store is between -2,147,483,648 and 2,147,483,647.</p> <p>1) Verify that the string input you pass is the correct one.</p> <p>2) If the users shouldn't insert number this high try to add a validation to the input(text box)</p> <p>3) If th...
FxCop analyzers do not show warnings on the fly <p>I am using the FxCop Analyzers NuGet package (Microsoft.CodeAnalysis.FxCopAnalyzers) to get analysis results in the error list while typing.</p> <p>The issue is that the FxCop analyzers are not returning CA1707 errors (underscore) while typing (or after loading the so...
<p>If you have Visual Studio 2015 Update 3 or later, you need to <a href="https://msdn.microsoft.com/en-us/library/mt709421.aspx" rel="nofollow">enable full solution analysis</a>.</p> <p>It's in Options > Text Editor > C#/Basic > Advanced.</p>
text not rendering in div <p>I have following CSS:</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-html lang-html prettyprint-override"><code>#navigation { background-color: #ededed; text-align: center; ...
<p>I forgot that I had put font-size to a value of 0 and that explains all why the text in the P is not shown. I have therefore set the font-size of the P element element to a higher value and that solves the problem.</p>
npm start error with create-react-app <p>I have a project who I didn't touch for 2 weeks. I take it back and now when I try to run <code>npm start</code> I got this error.</p> <pre><code>&gt; react-scripts start sh: react-scripts: command not found npm ERR! Darwin 16.0.0 npm ERR! argv "/usr/local/bin/node" "/usr/loc...
<p>Author of Create React App checking in.</p> <p><strong>You absolutely should not be installing <code>react-scripts</code> globally.</strong><br> You also <strong>don't</strong> need <code>./node_modules/react-scripts/bin/</code> in <code>package.json</code> as <a href="http://stackoverflow.com/a/39960523/458193">th...
Excel VBA - PivotItems returns inexsting value <p>In an Excel Workbook, I have "static" pivot table on a sheet, that is based on data from another sheet. I'm refreshing the data on my data sheet (thank you captain Obvious !), then I want to show ALL the items, exept the blank one, so I'm running throw all the PivotItem...
<p>I had a surprising issue like that, you need to check in the Pivot Table options :</p> <ul> <li>Right click on the pivot table,</li> <li>Select <code>Pivot Table options</code></li> <li>Go in <code>Data</code> tab</li> <li>Find <code>Retain items deleted from the data source</code></li> <li>Choose <code>None</code>...
Pivot Tables & VBA <p>So I have this pivot table where I can sort upon "Plant Name". I could simply hard code functionalityin saying "Plant26", "Plant12" etc to know the plant names that can be sorted upon. However, is there a different way to access all of these names and place them in an array, instead of iterating t...
<p>This will get you started, it will show you all <code>PivotItems</code> in <code>PivotField</code> "Plant Name".</p> <p><strong>Note</strong>: it is recommended to avoid using <code>ActiveSheet</code>.</p> <p>Option Explicit</p> <pre><code>Sub GetAllPlantNamefromPivot() Dim PvtItm As PivotItem Dim P...
How to open file in edit mode uploaded to google drive using google api service account <p>I have google api service account.I successfully upload the file on the drive, open the file on browser.But i am not able to get the edit mode.How can i open a particular file in edit mode.And the changes will reflect to original...
<p>One approach is to share the files to the users (depending on type in your use case). Once the file has been uploaded (thru Service Account), additional settings will be required to share the file. Set the role as <code>writer</code> and you'll be good to go (by calling the File's <code>selfLink</code>)</p>
Create Swift framework (revisited) <p>I have read <a href="http://stackoverflow.com/questions/26460998/create-and-import-swift-framework">Create and import swift framework</a> (and many more) but it does not work. Here's what I did: I created a vanilla framework and added a simple Test.swift.</p> <p><a href="http://i....
<p>With the information available from your question, "no such module" can mean that you either aren't linking against the framework, or the framework is not in the framework search path. Further, it looks like you have dragged the built framework directly into the dependent project, because I don't see the project whe...
Symfony2 - redirect logged in users when entering anonymous areas <p>I created an action that handles redirection to respected areas depending on user's type and ROLE (trainee, company or university let's say). If user is not logged in, it redirects to homepage (anonymous area), and if logged in - to their profile page...
<p>The Access Control section in the Symfony <a href="http://symfony.com/doc/current/security.html" rel="nofollow">documentation</a> might offer easier solutions to restrict access. In my time using Symfony I have always been able to use it for redirection and access control. </p>
Replaceing column content with image doesnt work. It only replaces last <p><a href="http://i.stack.imgur.com/rWHy0.png" rel="nofollow">LOOK at the image PLEASE</a> There is a table that is refreshing every second with AJAX. 2nd column of table has 0 or 1 inside. I want to replace 0 with one image and 1 with another im...
<p>Each time you call the <code>appendChild</code>, you <strong>move</strong> the image you have created.</p> <p>Try cloning it to create new image for each row:</p> <pre><code> if (safetyEls[i].innerHTML.trim() == "1") { safetyEls[i].appendChild(okImg.clo...
wkhtmltopdf - Hide rows with no value using CSS <p>I have a website that uses a form plugin that uses wkhtmltopdf to generate a PDF based on the values entered and emails it. A good number of the fields in the form are not required and I'd like not to display those fields in the PDF if I don't have to. My HTML looks so...
<p>can you try this:</p> <pre><code>&lt;tr style="display:@( NamePreferred=="" ? "block" : "none");"&gt; &lt;td&gt;Name Preferred:&lt;/td&gt;&lt;td&gt;[NamePreferred]&lt;/td&gt; &lt;/tr&gt; </code></pre>
Linq SelectMany in Entity Framework <p>I'm using Entity Framework. My typical access functionality would be something like this:</p> <pre><code> public IEnumerable&lt;Product&gt; Category(string category, int term) { using (var uow = new UnitOfWork(Connections.LoanComparision)) { var...
<p>If the relationship between <code>Product</code> and <code>ProductDetail</code> is one to many you could do this:</p> <pre><code>var query= context.ProductDetails.Include(pd=&gt;pd.Product.ProductRates) .Include(pd=&gt;pd.Product.Provider) .Where(pd=...
install package from a requirenment txt and failed <p>I read the rnn tutorial in <a href="https://github.com/dennybritz/rnn-tutorial-rnnlm" rel="nofollow">https://github.com/dennybritz/rnn-tutorial-rnnlm</a> and follow the installations to set up the environment. But I got the error which I have no idea about this. I s...
<p>Looks like ncurses library is not installed. If you are on Ubuntu, you should first install it with </p> <pre><code>sudo apt-get install libncurses5-dev libncursesw5-dev </code></pre>
Angular2: Return type of public static method from exported class has or is using private name <h2>Error</h2> <pre><code>Error at /Users/user/project/.tmp/shared/validation/validators/unicode-characters.validator.ts:12:52: Return type of public static method from exported class has or is using private name 'Validation...
<p>You have to export the interface as well:</p> <pre><code>export interface ValidationResult { [key:string]:boolean; } </code></pre> <p>The public function returns a <code>ValidationResult</code>. Which means it is accessible from the outside. That's why you should also export the <code>ValidationResult</code> :...
How to unscramble a list of words using a HashMap? <p>Basically I will be given two large input files. One will be a list of words, the other will be that list of those same words, but the words will be scrambled. I have to use a HashMap to get the list of words and scrambled words and then print the scrambled word wit...
<p>Make the dWordMap just <code>HashMap&lt;String, String&gt;</code>. For the line you're not sure of, do <code>dWordMap.put(createKey(word), word)</code>.</p> <p>Then loop through the scrableList and the word is <code>dWordMap.get(createKey(scrambledWord))</code>.</p> <p>You should probably also handle the case that...
Python, scipy : minimize multivariable function in integral expression <p>how can I minimize a function (uncostrained), respect a[0] and a[1]? example (this is a simple example for I uderstand scipy, numpy and py):</p> <pre><code>import numpy as np from scipy.integrate import * from scipy.optimize import * def functio...
<p>This is just a guess, because you haven't included enough information in the question for anyone to really know what the problem is. Whenever you ask a question about code that generates an error, always include the complete error message in the question. Ideally, you should include a <a href="http://stackoverflow...
SQL duplicate values in multiple columns <p>I have a table with duplicate ID's, but other values in the second column. Instead of removing all the duplicates with DISTINCT, I need 1 row with the ID and several columns with the values from the second column.</p> <p>Here is what I mean: (has to become result)</p> <p><i...
<p>You can use PIVOT for this. Check this.</p> <pre><code>SELECT * FROM [TABLENAME] PIVOT (COUNT(category) FOR [category] IN ([A],[B],[C],[D]) AS P </code></pre>
TypeMismatchError on post <p>I'm writing an <code>aurelia</code> application with <code>aurelia-fetch-client</code> library. When I try to post an object to my api service I get the error:</p> <blockquote> <p>TypeMismatchError </p> </blockquote> <p>In console only from Edge. Other browsers (Chrome, Firefox and IE11...
<p>In all but the newest versions of Edge you need to include the <strong>fetch</strong> polyfill in order for <code>aurelia-fetch-client</code> to work. I think it's supported since version 14 but I wouldn't necessarily rely on it. Edge is known to be quirky with some of these things (the Promise implementation is als...
read escaped character \t as '\t' instead of '\\t' Python ConfigParser <p>I have a config.ini file containing <code>delimiter = \t</code> which i now want to read using the python3 ConfigParser. However, the resulting string is <code>'\\t'</code> instead of <code>'\t'</code> which breaks my program. Is there a more ele...
<p>Python3 has a 'unicode_escape' codec.</p> <pre><code>r"a\tb".decode('unicode_escape') 'a\tb' </code></pre> <p>Sources:</p> <p><a href="https://bytes.com/topic/python/answers/37952-escape-chars-string" rel="nofollow">https://bytes.com/topic/python/answers/37952-escape-chars-string</a></p> <p><a href="http://stac...
udf Fuction for DataType casting, Scala <p>I have next DataFrame:</p> <pre><code>df.show() +---------------+----+ | x| num| +---------------+----+ |[0.1, 0.2, 0.3]| 0| |[0.3, 0.1, 0.1]| 1| |[0.2, 0.1, 0.2]| 2| +---------------+----+ </code></pre> <p>This DataFrame has follow Datatypes of columns:<...
<p>Your <code>udf</code> is wrongly declared. You should write it as follows :</p> <pre><code>val toFloat = udf((line: Seq[Double]) =&gt; line.map(_.toFloat)) </code></pre>
Classic ASP FormatPercent ignores 100%? <p>The code below works out percentages for my data. All works fine apart from 100% which should be red (#B20000) but in fact is green (#32CD32). I added an option that specifically refers to 100% but even that has not effect. Any ideas? Thanks </p> <pre class="lang-vbs prettyp...
<p>You're using the wrong syntax. <code>&lt;= "60%"</code> will compare the <strong>numeric</strong> value in <code>R</code> to the <strong>string</strong> "60%". VBScript doesn't complain about this because it's permissive by-design, but this also causes silent issues - like what you're experiencing.</p> <p>You're al...
Memory padding issues using __declspec <p>based on MSDN the __declspec(align(x)) should add x bit padding after the member variables for example:</p> <pre><code>#include &lt;iostream&gt; using namespace std; void main() { struct test { __declspec(align(32))char x; __declspec(align(32))int i; ...
<p><code>__declspec(align(1)) char j</code> doesn't do anything - a <code>char</code> requires no special alignment with or without the <code>__declspec</code>.</p> <p>Imagine you later declare an array of <code>test</code>: <code>test arr[2];</code>. Here, both <code>arr[0].i</code> and <code>arr[1].i</code> must be ...
Does c++ standard specify how to pass this pointer to member functions? <p>Most everybody knows that class member receive the <strong>this</strong> pointer as the first "invisible" parameter of the function. Is this specified in C++ standard? Can a certain compiler implementation pass it in a different way? Dedicated r...
<p>That's certainly how the very first versions of C++ were implemented (early C++ was transformed into C code), but be assured that the C++ standard does <strong>not</strong> mandate this.</p> <p>Passing it as the last parameter value also seems feasible, and for virtual functions, some different technique altogether...