input
stringlengths
51
42.3k
output
stringlengths
18
55k
how to update ShapeGeometry in three.js <p>I'm new at three.js, and i tried to update a ShapeGeometry but it didn't work. now i have to remove and readd the shapeMesh evertime.</p> <pre><code> this.mesh.geometry.dispose() this.mesh.material.dispose() this.scene.remove(this.mesh) //vertex this.trian...
<p>Unfortunately, you cannot update the Shape used by a ShapeGeometry, because the Shape is just a higher-level description of the Geometry that is created from it, not really a part of the Geometry itself.</p> <p>The point here is this: The Shape is described in terms of vector-graphics, with curves and so on. When y...
C# Convert date from xml (which can vary format by locality) to DateTime datatype <p>I need to extract datetimes from xml in both long (yyyy-MM-dd HH:mm:ss) and short (yyyy-MM-dd) format from an xml doc. Date format can vary by locality e.g. MM/dd/yyyy vs yyyy-mm-dd. </p> <p>The app is run in each locality so will k...
<p>You might be interested in the methods <code>DateTime.TryParseExact</code> or <code>DateTime.ParseExact</code>. Then create a set of allowed format strings and loop throuh this set to test parse the date from the most specific formats first:</p> <pre><code>var formats = new List&lt;string&gt;(); formats.Add("yyyy-M...
Get c.SelectedItem in Controls C# <p>I am making some validation functions for my project but I am stuck on something. I want to have a single function to handle a couple of different controls and errors.<br> Here's my code:</p> <pre><code>private void ValidateControls(Control c) { if (c is TextBox) { ...
<p>You have to cast <code>c</code> to a <code>ComboBox</code> in this case</p> <pre><code>else if (c is ComboBox) { if (((ComboBox)c).SelectedItem == null) } </code></pre> <p>By the way, don't create a <code>_Validating</code> method for every control if they do the same thing. You can use a single...
Java file handling classes <p>What is the difference between FileInputStream and ByteArrayInputStream? When we should use them? What is the benefits of using one over other </p>
<p><strong>Streams</strong></p> <ol> <li>byte oriented stream (8 bit)</li> <li>good for binary data such as a Java .class file, images etc.</li> <li>good for "machine-oriented"</li> </ol> <p><strong>Readers/Writers</strong></p> <ol> <li>char (utf-16) oriented stream (16 bit)</li> <li>one character at a time</li> <li...
How to read formated xml file in SQL Server <p>I have XML file that need to read some data from it by SQL Server 2008.</p> <p>Please guide me to to solve this problem.</p> <p>My XML file like that:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;DataSet xmlns="http://tempuri.org/"&gt; &lt;xs:schema...
<p>Assuming your XML is stored in a variable called <code>@Data XML</code>, you can use this XQuery go get your data. </p> <p>The XPath expression "navigates" down the tree of nodes to give you a "virtual" table of XML fragments - one for each <code>&lt;Table&gt;</code> XML element. From that XML element, you can then...
Protractor 'toContain' error <p>This is my expect:</p> <pre><code>expect(mandatoryFields[index].getAttribute('class')).toContain('error'); </code></pre> <p>This is the error in console:</p> <p><strong>Expected['formControl ng-pristine ng-untouched ng-valid ng-empty ng-valid-maxlength error'] to contain 'error'.</str...
<p>Instead of <code>toContain</code> try using <code>toMatch</code>. toContain is used to check whether the required value is present in an array or not. whereas toMatch uses regex for validating the text present in any value.</p>
Ignore the Tasks throwing Exceptions at Task.WhenAll and get only the completed results <p>I am working on a Task parallel problem that I have many Tasks that may or may not throw Exception.</p> <p>I want to process all the tasks that finishes properly and log the rest. The <code>Task.WaitAll</code> propage the Task e...
<p>You can create a method like this to use instead of <code>Task.WhenAll</code>:</p> <pre><code>public Task&lt;ResultOrException&lt;T&gt;[]&gt; WhenAllOrException&lt;T&gt;(IEnumerable&lt;Task&lt;T&gt;&gt; tasks) { return Task.WhenAll( tasks.Select( task =&gt; task.ContinueWith( ...
Sonata User Advanced Configuration <p>I am trying to configure the advanced configuration of the SonataUser Bundle(<a href="https://sonata-project.org/bundles/user/3-x/doc/reference/advanced_configuration.html" rel="nofollow">https://sonata-project.org/bundles/user/3-x/doc/reference/advanced_configuration.html</a>).</p...
<p>Look at the doc the position is indented differently :</p> <pre><code>blocks: type: ~ settings: # Prototype id: [] position: right </code></pre> <p>In yours, position is just under the id... Might be ...
Android Manifest for Android TV only - too few devices supported? <p>I've created an Android TV app using Unity3D and am trying to write a proper android manifest. </p> <p>What I want is for my app to show up on as many Android TV devices as possible, but not on smartphones and tablets.</p> <p>The documentation says...
<p>The SONY TV list in the developer console is a bit misleading, but you can basically see it as: "BRAVIA 4K - SVP-DTV15" = [All 2K/4K 2015 models]. "BRAVIA 4K GB - BRAVIA_ATV2" = [All 2K/4K 2016+ models]. See more here: <a href="https://developer.sony.com/develop/tvs/android-tv/" rel="nofollow">https://developer.sony...
How to add external .vtt subtitle file to AVPlayerViewController in tvOS <h2>Question:</h2> <p>How do I add an external WebVTT file to my AVPlayer in tvOS?</p> <h2>Description:</h2> <p>I've been watching <a href="https://developer.apple.com/videos/play/wwdc2012/512/" rel="nofollow">this "What's New in HTTP Live Stre...
<p>While it was almost mentioned no where in the apple documentation, I read in an article that subtitles need to be embedded in the <code>HLS stream</code>.</p> <p>Subtitles are not intended to be added manually.. though I did find a StackOverflow post showing a hack. Unsure if it works or not.</p> <p>Seeing that I ...
Disabled cookies for my website, I get TokenMismatchException <p>I have disabled cookies for my website and get <code>TokenMismatchException</code>. Since I am using sessions file driver and in my form I have <code>{{ csrf_field() }}</code> why do I get <code>TokenMismatchException</code> when I disable cookies for my ...
<blockquote> <p>why do I get TokenMismatchException when I disable cookies for my website?</p> </blockquote> <p>Because the CSRF token value in the form needs to be compared to (the) one stored in the session.</p> <p>If your session is not working without cookies, then of course this will fail.</p> <p>So decide wh...
SSRS Excel export, Row height not increased in excel <p>In one of my SSRS Report, The cell is expanding properly in report but when the report is exported to Excel the single cell contain the whole text but I have to manually increase the row height in excel to make the whole text visible.</p> <p>Is there any export o...
<p>It depends on what reports layout you have, but generally simply setting CanGrow=True should expand cell in Excel export. Probably you'll need to set CanGrow=True for all cells in the row. This will not work in case you have merged cells in the row.</p> <p>See more info <a href="https://social.msdn.microsoft.com/Fo...
Kotlin reflection - getting all field names of a Class <p>Is there a Kotlin reflect method that will do the same as Java's <code>getDeclaredFields()</code>?</p> <p>I know there is an option for <code>MyClass::class.members</code> but there is no documentation about this call available.</p> <p>How can I get a list of ...
<p>Probably what you want is to get properties of a class, not fields. This can be done as follows:</p> <pre><code>MyClass::class.declaredMemberProperties </code></pre> <p>Getting fields is also possible through Java reflection:</p> <pre><code>MyClass::class.java.declaredFields </code></pre> <p>But fields are rathe...
Unity 5 WebGL: Communicating with external javascript from C# <p>I'm trying to get a Unity 5 WebGL project integrated with SCORM 1.2. This involves the Unity WebGL build communicating with some external javascript. </p> <p>I found this page:<br> <a href="https://docs.unity3d.com/Manual/webgl-interactingwithbrowserscr...
<p>In case anyone has the same problem, I've managed to dodge this issue: </p> <p>I used the first option on that Unity Manual page instead, so now my SCORM.js file is loaded into the index.html WebGL template. </p> <p>(To make a custom WebGL template, create a 'WebGLTemplates' folder in your Assets folder. Any fold...
I need help on script which will find particular value from one file and replace it in another file <p>I have two data files, <em>ABC</em> and <em>XYZ</em>:</p> <p>Partial contents of ABC:</p> <pre><code>cancsi(64): 10-s01: (c) Copyright 1995-2014 cancsi&gt; source ncancsi cancsi&gt; set dump_shm on on *Ve3* Load...
<p>(Tcl solution) You might try something like this, if I understand your specification correctly:</p> <pre><code>proc // args { global step data set args [lassign $args _ kword] set val [lindex $args end] switch -- $kword { step { set step $val } MK { d...
Java JDBC stored procedure into List<T> <p>I'm trying to write a method that utilizes an interface made by someone in my company. The interface method is set to return a type:</p> <pre><code>&lt;T&gt; List&lt;T&gt; </code></pre> <p>and takes amongst others a parameter of type:</p> <pre><code>RowMapper&lt;T&gt; rowMa...
<p>If you want to return the values exist in the result map you can do something like :</p> <pre><code>List&lt;Value&gt; list = new ArrayList&lt;Value&gt;(map.values()); </code></pre> <p>If you want to return the keys :</p> <pre><code>List&lt;String&gt; list = new ArrayList&lt;String&gt;(m.keySet()); </code></pre>
Less css: 'calc(x+y)' outputs 'calc(z)' instead of just 'z' <p>I have the following css rule:</p> <pre><code>@somevar = 8px .someclass { width: calc(8px + @somevar); } </code></pre> <p>After processing (lessc 2.7.1) it outputs:</p> <pre><code>.someclass { width: calc(16px); } </code></pre> <p>But the 'calc()' opera...
<p>If you don't want <code>calc</code> to appear in your output, don't include it in the input.</p> <p>As pointed out in comments, <code>calc</code> is not needed for the less compiler, it's a css function.</p> <p>So this will work:</p> <pre><code>@somevar: 16px; .someclass { width: 16px + @somevar; } </code></pre> ...
application web on spark? <p>I've some performance issues and i ve few questions for you :) I created a scala application. This application calculate in live some statistics like the session ... from a cassandra database. I used spray as http framework to create my API . I used spark for calculating and map reducing r...
<p>I would advise you to work directly with Cassandra and <a href="https://docs.datastax.com/en/cql/3.1/cql/cql_intro_c.html" rel="nofollow">CQL</a>. If you cannot reflect everything in CQL you can always create a User-Defined-Function (UDF).</p> <p><a href="https://docs.datastax.com/en/cql/3.3/cql/cql_using/useCreate...
Use Memcached in Cakephp 3 <p>How can I access a memcached database in cakephp without using the CakePhp MemcachedEngine.php? When I try to create a <strong>new Memcached()</strong> Object, Cake doesn't recognize that I need the php class and gives me an error like: </p> <p><strong><em>Class 'App\Controller\Memcached...
<p>You can try put at the top of your class: <code>use \Memcached;</code> or use <code>new \Memcached()</code>.</p>
Values of attributes in XML DOC <p>Im trying to get values of attribute in XML file, but always recieve message <code>"Object required"</code>.</p> <p><strong>My JS code</strong></p> <pre><code> &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; &lt;p id="demo"&gt;&lt;/p&gt; &lt;script </code></pre> ...
<p>Ok, it was simple,</p> <pre><code>var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = false; xmlDoc.load("Xml.xml"); var x = xmlDoc.getElementsByTagName("softKey")[0].getAttribute("speech"); </code></pre>
How do I get address of class member function by asm in GCC? <p>guys! I have a problem. How do I get address of class member function by asm in GCC?</p> <p>In VS2012, we can do below code to get address.</p> <pre><code>asm {mov eax, offset TEST::foo} </code></pre> <p>But, in GCC?</p> <pre><code>__asm__ __volatile__...
<p>AT&amp;T syntax doesn't use the <code>offset</code> keyword. And besides, you've asked the compiler to put <code>&amp;TEST::foo</code> in a register already.</p> <pre><code>__asm__ ( "mov %1, %0" :"=r"(addr) :"r"(&amp;TEST::foo) ); </code></pre> <p>Or better:</p>...
React hello world doesn't work with ES6 <p>What's wrong with my code? I see no error in the console of jsbin. </p> <p><a href="http://jsbin.com/susumidode/edit?js,console,output" rel="nofollow">http://jsbin.com/susumidode/edit?js,console,output</a></p> <pre><code>Class secondComponenent extends React.Component { re...
<p>First, you have to use <code>ReactDOM</code> to render your component to the browser not <code>React</code>. You code is: </p> <pre><code>React.render( &lt;secondComponenent id="abc" /&gt;, document.getElementById('react_example') ); </code></pre> <p>But in recent versions of <code>React</code> (above 0.1...
Fetch Build Statistics for an Application from Bamboo REST API <p>I am looking for the <code>Bamboo REST API</code> which give us all recent <code>Build Activity</code> of an Application within a time-frame like all build of <code>Last_7_Days</code>, <code>Last_1_Day</code>, <code>Last_30_Days</code> etc. Similar to th...
<p>As you have found there are no direct REST APIs for build activity by time period.</p> <p>I'd use the build REST API (<a href="https://developer.atlassian.com/bamboodev/rest-apis/bamboo-rest-resources#BambooRESTResources-BuildService%E2%80%94AllBuilds" rel="nofollow">https://developer.atlassian.com/bamboodev/rest-a...
How to access dbcontext & session in Custom Policy-Based Authorization <p>Is it possible that we can access dbcontext to get my table data and session in custom Policy-Based Authorization? Anyone can help how to achieve it?</p> <pre><code> services.AddAuthorization(options =&gt; { options.Ad...
<p>Policies can use <a href="https://docs.asp.net/en/latest/security/authorization/dependencyinjection.html" rel="nofollow">DI</a></p> <p>So, assuming your db context is in DI you could do something like</p> <pre><code>public class CheckAuthorizeHandler : AuthorizationHandler&lt;CheckAuthorizeRequirement&gt; { My...
Login with facebook not working ios <p>I know there are a number of answers solving this issue but none of them worked for me.</p> <p>I have done the following things.</p> <p>In <code>AppDelegate.m</code> -<code>didFinishLaunching</code> method</p> <pre><code>return [[FBSDKApplicationDelegate sharedInstance] applica...
<p>Finally I found the solution. I guess this was iOS 9.3 specific issue.</p> <p>I had to change <code>openUrl</code> method code in AppDelegate.</p> <pre><code>- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary&lt;NSString*, id&gt; *)options { return [[FBSDKApplicationDelegate shared...
Rails Routing Error w/ key <p>So I made this custom Route on my routes.rb </p> <pre><code>get'dashboard_report_m/:date/:branch_id'=&gt;'reports#monthly_and_branch' </code></pre> <p>I'm Getting Routing Error, No route matches [GET] "/dashboard_report_m" on my rake routes I have this</p> <p>on rake routes</p> <pre><...
<p>Some things to check:</p> <ol> <li>Is there a <code>ReportsController</code> with a ​<code>monthly_and_branch</code> action?</li> <li>Does the error occur if you visit <code>/dashboard_report_m/2016-09-20/1234</code> directly or are you using a path helper?</li> </ol> <p>UPDATE</p> <p>OK so you are accessing th...
mootools javascript return Array.each() with recursion <p>I have a JSON object and what I'm trying to achieve is, that I can search the object for child_objects by id. I am using an <code>Array.each()</code> and a function with recursion like the following:</p> <pre><code>1 Template.get_object_attributes_by_id = func...
<p>After a little bit more investigating and trying, my colleague and I solved the problem ourselves, by using a "for"-loop instead of "Array.each()".</p> <p>Here's the solution:</p> <pre><code>1 Template.get_object_attributes_by_id = function(id, template) 2 { 3 var template_obj = JSON.parse(template); 4 con...
JQuery for fixed position of navigation bar <p>Hello I am new to <code>JavaScript</code> please can anyone tell me the <code>JQuery</code> for keeping the navigation bar fixed on top while I scroll down. I am using the following code but i think some contents are missing</p> <p><strong>Code Snippet :</strong></p> <pr...
<pre><code>$( document ).ready(function() { var fixmeTop = $('.fixme').offset().top; $(window).scroll(function () { var currentScroll = $(window).scrollTop(); if (currentScroll &gt; fixmeTop) { $('.fixme').css({position: 'fixed', top: '0', left: '0'}); } else { $('...
IOS 10 core data executeFetchRequest crashes if called before insertNewObjectForEntityForName <p>I have a strange issue with an app that works perfectly on iOS &lt;10.</p> <p>After having updated the phone to iOS 10, my app crashes when doing a <code>executeFetchRequest</code> before <code>insertNewObjectForEntityForN...
<p>Thanks for the help.</p> <p>It seems to be a static method that gets called twice which re-initialized a variable.</p> <p>Found the solution while looking for the crash log, and stumbled over Zombie in xcode...</p>
AngularJS 1.XX - Why would anybody use the "M" restriction for a directive? <p>I know that a angular directive can be define in four ways: </p> <pre><code>'A' - only matches attribute name 'E' - only matches element name 'C' - only matches class name 'M' - only matches comment </code></pre> <p>For example a directive...
<blockquote> <p>Because if i comment out code, i don't want it to run.</p> </blockquote> <p>This is not HTML you're talking about, it's an <em>Angular</em> convention/feature. The comment is still visible/accessible inside the DOM as a comment node. The HTML parser won't do anything with it, true. But Angular can st...
Merge Query Performance - Unique Constraint or Indexing? <p>I am pushing 2K+ nodes and 8k+ edges to the Graph, which is taking approximately 7000ms. And, further I will be working with 100k+ Nodes and relationships. My query uses Merge operation in this way:</p> <pre><code>MERGE (a:User){user:'username'} MERGE (b:Hobb...
<h1>Index vs constraint</h1> <p>An index is a fast means of finding nodes which indexed property have a certain value, replacing a sequential scan of all the nodes (instead of an <em>O(n)</em> algorithm, you usually get <em>O(log(n))</em>). Many nodes can have the property with the same value.</p> <p>A constraint is ...
Database evolutions not working in Play framework and I'm getting following exception <p>I am using following line to run evolution scripts placed in <code>conf/evolutions/default/1.sql</code></p> <pre><code>libraryDependencies += evolutions </code></pre> <p>And I'm getting unexpected exception</p> <pre><code>Creati...
<p>Guice is failing because it is unable to create a database connection using the given configuration.</p> <p>Ensure your configuration is correct and is pointing to correct db.</p> <p>I am using <code>play-slick</code> with the following configuration and it works well for me.</p> <p>build.sbt</p> <pre><code>"com...
Inserting data into my database using a while loop <p>I've currently got a while loop running through one database which is selecting the data fine, one of the columns i am displaying an image which when clicked i want to insert the data into a different database.</p> <p>The if statement im using to insert the data is...
<p>In your acceptrequest.php page, check if $_GET['requestid'] is set and then perform your insert query.(make sure you have the correct data in place)</p> <p>You haven't shown how you have received the data via POST in your first block of code...could have made things clearer.</p>
vaadin-combo-box / vaadin-combo-box-overlay change background color / Polymer API <p>I'm trying to override the background color present in <code>vaadin-combo-box-overlay</code> element.</p> <p>Here is the css that I want to override, more specifically the background property, source taken from (<a href="https://githu...
<p>you can do it with javascript like that.</p> <pre><code> ready: function() { var domElem=Polymer.dom(this).node.$.YOUR-VAADIN-ELEMENT-ID.$.overlay.style.backgroundColor="red"; } </code></pre> <p>OR</p> <pre><code>ready: function() { var css = '#selector .item { background-color:red; }'; ...
Python regex to remove specific pattern from a list of strings <p>I have a list of strings with filenames. The filenames follow a specific naming format:</p> <pre><code>string1_YYYYMMDD_HHMMSS_string2 </code></pre> <p>Here YYYYMMDD and HHMMSS are actual date and time values.</p> <p>I want to delete all characters th...
<p>You don't need a regex, just split on the first underscore:</p> <pre><code>s = 'string1_YYYYMMDD_HHMMSS_string2' return s.split('_')[0] </code></pre> <p>[edit]:</p> <p>If you can only rely on the last parts ('_YYYYMMDD_HHMMSS_string2') then try indexing like this:</p> <pre><code>s = 's_t_r_i_n_g_1_YYYYMMDD_HHMMS...
Real time audio recording in Swift <p>I am building an application which needs to do real time audio recording. I am using Swift for the project - so unable to use Novocaine library (as it has some Obj-C++ code). </p> <p>What I need is get small chunks of the audio recording (real-time) which I can process or send to ...
<p>You do not need any of 3-rd party tools for getting audio from mic. It can be set up easily using AVAudioEngine. However, for minimising network traffic I suggest to use lame for compressing raw PCM audio stream into mp3.</p> <p><a href="https://github.com/vlider/Mic-recording-minimal-example" rel="nofollow">Here</...
Class instances VS Interfaces VS generic objects - Performance <p>I'm creating mock data so that I can code the front end.</p> <p>This data could be class instances or interfaces just plain old javascript objects. Personally I'd rather do it as javascript objects, because I don't like boiler plate code.</p> <p>I need...
<p>If all you want to do is mock a server response I would suggest using an interface not a class.</p> <pre><code>export interface IResult { id: number; brand: string; name: string; description: string; image: string; rating: number; categories: string[]; averagePrice: number; amount: string; revie...
How to map a NamedNativeQuery in a class that doesn't correspond to a single table <p>I've got a legacy SQL Server database, and they've given to me a query, which does some join between several tables. </p> <blockquote> <p>SELECT TipoDia, ServBus, Instante, Evento, [VistaHorariosActivos].Linea, Coche, [VistaHorario...
<p>When you have a named query and you want to map it to a result class (always an entity), you <strong>must</strong> annotate it with the <code>@Entity</code> annotation. You arent obliged to annotate it with <code>@Table</code> but hibernate (jpa in general) needs to know that this class is an entity. You also dont h...
'Select All' Parameter not working <p>Posted as a new question</p> <p>The report is working ok in regards to selecting one country and seeing the different data within the 12 or 36 months date range.</p> <p>The problem comes when I 'Select All' countries. What I want is the totals of all the countries to be represen...
<p>Based on what you've described I think something like this will work for you</p> <p>You are correct that you need two parameters: one for the country, the other is the period. For this second parameter specify two entries in the report designer. Give them the labels '12 months' and '36 months' and values or 12 and ...
Can i cascad persist and merge in same time? <p>I have 2 objects </p> <p>Network :</p> <pre><code>@Entity @Table(name = "network") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Network implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strateg...
<p>Change the Cascade type to <strong>All</strong>. Using Cascade type as All will allow both PERSIST and MERGE types.</p> <pre><code>@OneToOne(cascade = { CascadeType.ALL}) </code></pre>
Tab bar shows outside of screen <p>My problem lies in when receiving a call or a WiFi hotspot is active, the bottom tab bar is shifted outside of the screen.</p> <p><a href="http://i.stack.imgur.com/wfLNm.png" rel="nofollow"><img src="http://i.stack.imgur.com/wfLNm.png" width="250" alt="No extended status bar"/></a> <...
<p>It's a layout problem.</p> <p>I will use iPhone5S's screen size as an example to explain it.</p> <p>For normal situation, your view size is "Frame = {X=0,Y=0,Width=375,Height=667}", is equals to screen size, but iOS system will make all view's frame to "Frame = {X=0,Y=20,Width=375,Height=647}" when personal hotspo...
Failed to find style 'listMenuViewStyle' in Android Studio <p>I'm trying to add icons to my menu items in my android application. However the layout preview window in Android studio is displaying the error:</p> <pre><code>Failed to find style 'listMenuViewStyle' in current theme </code></pre> <p>I'm using the Holo.Li...
<p>The attribute listMenuViewStyle was introduced with api level 24. Make sure you use compileSdkVersion 24 or above.</p>
Show DIVs when page loads, not just 'on change' of drop down list <p>I currently have sections of a form which display based on the selection of a drop down list:</p> <pre><code>$('#Selection').on('change', function () { if(this.value === "Section1"){ $("#Section1").show(); } else { $("#Section1").hide(); } ...
<p>Try this one:</p> <pre><code>$( document ).ready(function() { // Handler for .ready() called. $("#Section1").show(); }); </code></pre>
oracle plsql how to check if number has decimal points <p>just started working with oracle using toad ide. trying to format the numbers from a table in specific format. the numbers come in from a variable in the table and I want to display the whole numbers as whole numbers and display floats as floats. So far, I can u...
<p>If your problem is about the way Toad shows numbers, you can follow the hints in the comments.</p> <p>If the problem is about the way Oracle shows numbers, converting them to strings, maybe this can help:</p> <pre><code>SQL&gt; select to_char(1.5, 'TM9') as num from dual union all 2 select to_char(100, 'TM9') f...
how to find the number of lines which got changed from one label to another in clear case? <p>I would like to find the number of lines of code which got added/modified/deleted between two releases. I have a label which is applied at the end of release.</p> <p>There is ClearCase Report Viewer which shows list of elemen...
<p>The easiest way (without involving any commercial third-party tool) is to use linux commands <a href="https://linux.die.net/man/1/diff" rel="nofollow"><code>diff</code></a> and <strong><a href="http://invisible-island.net/diffstat/" rel="nofollow"><code>diffstat</code></a></strong> and apply it to two dynamic views,...
Generating documentation for Power BI <p>Is there a native solution/application/script for creating documentation in Power BI? I am especially interested in documenting all relationships.</p>
<p>Power BI Models (and the new Tabular Models) have DMVs that are separate from the MDSCHEMA rowsets for SSAS multidimensional. While some of the SSAS MD DMVs mostly work, the new TMSchema DMVs work well since they are made specifically for this type of model. The trick is that you must know the connection info. The p...
Object Serialization somehow initialise hibernate proxies <p>I have a list<code>(List&lt;Employee&gt;)</code> with name <code>employees</code> returned by hibernate <code>(session.createQuery().list())</code> for my Domain <code>employee</code>. This list's employee elements has proxies for foreign key elements like <c...
<p>Serialization does not call getters/setters, neither constructors. This is the eclipse debugger which initializes the PersistenceCollection. </p> <p>Unless you have some custom serialization code, the collection will remain uninitialized.</p> <p>You can try adding into your code something like</p> <pre><code>Syst...
Angluar 2 IBM Bluemix Cloudant Example Code <p>Does anyone have any example code for using an Angular 2 web app to CRUD data from a Cloudant database on IBM Bluemix? I have had some success developing an Ionic 2 application to do so. However, I am not sure how I can do the same for a standard Angular 2 Web App. I have ...
<p>Cloudant does not have the library support for Angular 2, so please call HTTP requests to Cloudant database through your Angular 2 web app.</p>
It's posible to use Federated table in MySQL NDB Cluster <p>I'm developing a application that needs two diferent databases, this is because one of this databases is per client and the other one is a generic database.</p> <p>I'm thinking in make a MySQL NDB Cluster and i need to know if it's possible to uses some Feder...
<p>MySQL Cluster uses a full version of mysqld (slightly modified), which includes all storage engines included on a standalone version. So the question for your answer is YES, you can have some tables in FEDERATED storage engine, or any other storage engine. </p> <p>However, only tables with storage engine=ndbcluster...
Replacing last char (string) using regex or DOMDocument <p>I'm using one small script to convert from absolute links to relative ones. It is working but it needs improvement. Not sure how to proceed. Please have a look at part of the script used for this.</p> <p>Script:</p> <pre><code>public function links($path) { ...
<p>Is this what you want?</p> <pre><code>$file_contents = file_get_contents($new_path); $dom = new DOMDocument(); $dom-&gt;loadHTML($file_contents); $xpath = new DOMXPath($dom); $links = $xpath-&gt;query("//a"); foreach ($links as $link) { $href = $link-&gt;getAttribute('href'); if (substr($href, -1) === '/...
Why is VBA.Collection.Count a method <p>The VBA <code>Collection</code> has 5 members, all of which are methods: <code>Add</code>, <code>Count</code>, <code>Item</code>, <code>_NewEnum</code> and <code>Remove</code>.</p> <p>Of the 5 members, the <code>Count</code> method looks like it could/should be a <em>getter</em>...
<p>As far as I can tell it actually <em>is</em> a method:</p> <pre><code>[ odl, uuid(A4C46780-499F-101B-BB78-00AA00383CBB), helpcontext(0x000f7886), hidden, dual, oleautomation ] interface _Collection : IDispatch { [id(00000000), helpcontext(0x000f7903)] HRESULT Item( [in] VARIA...
trying to implement a js color picker that changes the background of a html5 document <pre><code> &lt;script src="jscolor.js"&gt;&lt;/script&gt; var Color: &lt;input class="jscolor" value="ab2567"&gt; &lt;script&gt; colorObject.value=#Color; colorObject.value document.body.style.backgroundColor=...
<p>You need add event listener to do that.</p> <p>See my snippet below:</p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="false" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function changeColor() { ...
How to drag external files into the browser using AngularJS <p>In my project i want to drag external files with extension <strong>".opgs"</strong> into the browser drop zone.</p> <p>How can i achieve this using angular js ?</p>
<p>I used an module: <code>ng-file-upload</code> - <a href="https://github.com/danialfarid/ng-file-upload" rel="nofollow">https://github.com/danialfarid/ng-file-upload</a>.</p> <p>Install with bower <code>bower i ng-file-upload -S</code>.</p> <p>Load it in your head tag:</p> <pre><code>&lt;script src="/admin/assets/...
android native calendar for my application - information should show under my app's name <p>I have to use android native calendar for my application data. And also I have to add milestones and also reminders to the events which I add through the app. <strong>I could found lot of tutorials to do those things.</strong> B...
<p>I could find a solution from this article. <a href="http://archive1.derekbekoe.com/blog/item/16-using-the-android-4-0-calendar-api.html#part1" rel="nofollow">enter link description here</a></p>
String splitting in R Programming <p>Currently the script below is splitting a combined item code into a specific item codes. </p> <pre><code>rule2 &lt;- c("MR") df_1 &lt;- test[grep(paste("^",rule2,sep="",collapse = "|"),test$Name.y),] SpaceName_1 &lt;- function(s){ num &lt;- str_extract(s,"[0-9]+") if(nchar(num...
<p>You can try something along these lines:</p> <pre><code>range &lt;- "324-326" x &lt;- as.numeric(unlist(strsplit(range, split="-"))) paste0("MR", seq(x[1], x[2])) [1] "MR324" "MR325" "MR326" </code></pre> <p>I assume that you can obtain the numerical room sequence by some means, and then use the snippet I gave yo...
Download wilink8 build script <p>Sir, Actually i am using Virtual machine and runing ubuntu on this . Now for mine development i am trying to download somw build script using the command "git clone git//git.ti.com/wilink8-wlan/build-utilities.git" but i got the error fatal error:unable to connect git.ti.com:...
<p>First, telnet your proxy server and port from terminal as below; </p> <pre><code>telnet proxy.server.com 80 </code></pre> <p>if telnet works, run as below;</p> <pre><code>git config --global http.proxy http://user:password@proxyserver:proxyport </code></pre> <p>if telnet not work, you should fix virtual machine ...
Hide TabBar when push <p>I have two controller, main and detail, embed with navigationController and TabBarController; now I need to hide TabBar when performing the segue; I tried:</p> <ul> <li>in main controller adding <code>controller.hidesBottomBarWhenPushed = true</code> in preparefor(segue9 method;</li> <li>in de...
<p>show tapbar</p> <pre><code>self.tabBarController?.tabBar.isHidden = false </code></pre> <p>hide tapbar</p> <pre><code>self.tabBarController?.tabBar.isHidden = true </code></pre>
code coverage report not correct after upgrading to PHPUnit 5.5.4 <p>I'm using PHP 5.6.24 with PHPUnit 5.5.4 and XDebug 2.4.1 and I reach a code coverage of 0,83%. However, before I was using PHP 5.6.0 with PHPUnit 4.7.7 and XDebug 2.3.3 and reached a code coverage of more than 84%.</p> <p>I found out that since PHP 5...
<p>I am running 5.5.4, which is the latest stable release, 5.6 is a beta release. I added the logging to mine to see if it would work, and it did. It generated a HTML report that was in the report directory that showed me percentages correctly. Here is my phpunit.xml file</p> <pre><code>&lt;?xml version="1.0" encodi...
unit test for xts with no row <p>is this a bug in package <code>testthat</code>? I would expect <code>x</code> to be always identical to <code>x</code>... Instead I get an error.</p> <pre><code>x = structure(logical(0), index = structure(numeric(0), tzone = "", tclass = c("POSIXct", "POSIXt")), .indexCLASS = c("POSI...
<p>If you expect <code>x</code> to be <em>identical</em> to something, you should use <code>testthat::expect_identical</code>. <code>testthat::expect_equivalent</code> may not work on your <code>x</code> object because it's testing for equivalence between zero-length vectors, and appears to have trouble with that.</p> ...
Google Play store app rejection due to policy violation <p>After app submission I am getting message that "My app submission was rejected for violating the Device and Network Abuse policy. Before submitting your app for another review, read through the policy and modify your app to make sure that it doesn't download, m...
<p>Youtube terms of service say that:</p> <blockquote> <p>II. Prohibitions.</p> <ol start="10"> <li>Access any portion of any YouTube audiovisual content by any means other than use of a YouTube player or other video player expressly authorized by YouTube;</li> </ol> </blockquote> <p>So the only way to m...
spatial interpolation error using idw <p>I am trying to spatially interpolate a dataset of seawater pH by lat &amp; long: </p> <pre><code>sample&lt;-read.csv(file="Station locations 2016.csv", header=TRUE, sep=",", strip.white=T) head(sample) Station lat long pH 1 B17 -23.49174 152.0718 8.22...
<pre class="lang-r prettyprint-override"><code>library(gstat) library(sp) lat &lt;- c(-23.49174, -23.49179, -23.49182, -23.49183, -23.49185, -23.49187) long &lt;- c(152.0718, 152.0718, 152.0717, 152.0717, 152.0717, 152.0717) pH &lt;- c(8.222411, 8.19931, 8.140428, 8.100752, 8.068141, 8.048852) sample &lt;- data.fram...
HIVE comparing strings in join <p>I have keys in hive query which are strings. Joing that looks like its taking forever. Can I create an index or something instead of?</p> <pre><code>select * from e left join tabele a on e.string1=a.string2 </code></pre> <p>How can improve that that it would be faster?</p>
<p>Just for performance issue ,try to make hive tables as ORC format . Try to use Map join in query and try. <a href="http://grisha.org/blog/2013/04/19/mapjoin-a-simple-way-to-speed-up-your-hive-queries/" rel="nofollow">http://grisha.org/blog/2013/04/19/mapjoin-a-simple-way-to-speed-up-your-hive-queries/</a></p> <p><a...
Need to find out if the first letter in each array <p>Need to check if first letter in each array is in uppercase and issue an error message if not.</p> <pre><code> "use strict"; var title =["mr","Ms","miss"]; var message ="Please enter your title with the first letter being capitalized"; for(var i =0;i&lt;1;i++) { ...
<p>use this simple version (simple for loop):</p> <pre><code>"use strict"; var title =["mr","Ms","miss"]; var message ="Please enter your title with the first letter being capitalized"; for(var elem of title){ if (elem.charAt(0)===elem.charAt(0).toLowerCase()) { alert(elem + ": "+ message); } ...
TYPO3 OpenGraph with EXT:news <p>I'm using TYPO3 and News System and Bootstrap Package.</p> <p>I see the opengraph tags twice. One of the news and one of page. How i can resolve it?</p>
<p>You need to exclude the opengraph of the bootstrap package when being on a news detail page. Then you only get it once.</p> <p>Put this into your TypoScript</p> <pre><code>[globalVar = GP:tx_news_pi1|news &gt; 0] page.meta.og:title &gt; page.meta.og:site_name &gt; page.meta.og:description &gt; pa...
SendGrid Event Webhooks VB.net <p>I'm using sendgrid WebHook, i already enabled Event Notification Here:</p> <p><a href="https://app.sendgrid.com/settings/mail_settings" rel="nofollow">https://app.sendgrid.com/settings/mail_settings</a></p> <p><a href="http://i.stack.imgur.com/KsVIX.png" rel="nofollow"><img src="http...
<p>Already solved this by doing exactly how this is in c# converting into vb</p> <p><a href="https://sendgrid.com/blog/tracking-email-using-azure-sendgrid-event-webhook-part-1/" rel="nofollow">https://sendgrid.com/blog/tracking-email-using-azure-sendgrid-event-webhook-part-1/</a></p>
Should I notify while holding the lock on a condition or after releasing it? <p>The <a href="https://docs.python.org/3/library/threading.html" rel="nofollow">Python <code>threading</code> documentation</a> lists the following example of a producer:</p> <pre><code>from threading import Condition cv = Condition() # Pro...
<p>Don't read C++ documentation to understand Python APIs. Per <a href="https://docs.python.org/3/library/threading.html#threading.Condition.notify" rel="nofollow">the actual Python docs</a>:</p> <blockquote> <p>If the calling thread has not acquired the lock when this method is called, a <code>RuntimeError</code> i...
Asynchronous action in bottle <p>I have simple application in written in bottle. I need to run same method each 10 seconds. My first idea was something like this, but it is not working and I think it is ugly solution:</p> <pre><code>inc = 0 # after run server open /loop page in order do initiate loop @route('/loop', ...
<p>you can use the threading module to call the method with the Timer command: </p> <pre><code>from functools import partial import threading class While_True(threading.Thread): def __init__(self, **kwargs): threading.Thread.__init__(self) def whileTrue(self, *args): print args def ...
Failed to read file modules.xml in Android Studio <p>I'm getting this error:</p> <p><a href="http://i.stack.imgur.com/gzqhR.png" rel="nofollow"><img src="http://i.stack.imgur.com/gzqhR.png" alt="image"></a></p> <p>And I'm not sure what to do. There is no <code>modules.xml</code> file in the specified folder, so how c...
<ol> <li>Close Android Studio, if it's opened</li> <li>Go to the project workspace <em>(Eg: C:\wheverever\it\is\TheProjectName)</em></li> <li>Delete <strong>.idea</strong> folder</li> <li>Open Android Studio and re import that project into it.</li> </ol>
spring security : context destroyed event to listener instance AND BeanFactory not initialized or already closed <p>This is not a <strong><a href="http://stackoverflow.com/questions/20114955/beanfactory-not-initialized-or-already-closed-call-refresh-before"><code>duplicate</code></a></strong> as expected duplicate cont...
<p>You are missing <code>dispatch‌​erServlet</code> in config location</p> <pre><code>&lt;context-param&gt; &lt;param-name&gt;contextConfigLocation&lt;/param-name&gt; &lt;param-value&gt; /WEB-INF/dispatch‌​erServlet-servlet.xm‌​l, /WEB-INF/security-context.xml &lt;/param-v...
Selenium Web Driver executeScript Showing error: [JavascriptError: missing ) after argument list] name: 'JavascriptError' <pre><code>return driver.executeScript("\ console.log('Wrong sadmasdaskdka1sdkakdk');\ $('option:selected', 'select[name='who']').removeAttr('selected');\ $('select[name='who']').find('o...
<p>The issue is in the statements like <code>$('option:selected', 'select[name='who']')</code></p> <p>Make sure you close the quotes you are opening, in this case it gets confused. You should use something like: <code>$("option:selected", "select[name='who']")</code></p> <p>The same for the next one, include single q...
Not able to parse Map with Enum to Json in Play Scala <p>We use <code>Scala 2.11.8</code> and <code>Play framework 2.5.8</code></p> <p>Data to work with can be as simple as that:</p> <pre><code>object EnumA extends Enumeration { type EnumA = Value val ONE, TWO, THREE = Value } case class NoWork(data: Map[EnumA.V...
<p>Note that it is mandatory for Json keys to be strings.</p> <p>Following code works</p> <pre><code>Json.toJson(Map("mon" -&gt; EnumA.MON)) </code></pre> <p>Following code does not work because key for valid Json should always be string. Here the key is <code>EnumA.Value</code> which is not <code>String</code>.</p>...
fetch all sent mail from imap adaptor spring integration <p>I need to fetch all sent mail that are not deleted but not happening, but only shows total mails, recent at console in mail.debug true</p> <pre><code>&lt;int:channel id="receiveChannel" /&gt; &lt;int-mail:imap-idle-channel-adapter id="customAdapter" ...
<p>See <a href="http://docs.spring.io/spring-integration/reference/html/mail.html" rel="nofollow">the documentation</a>, you need to use a custom <code>SearchTermStrategy</code>.</p> <blockquote> <p>By default, the <code>ImapMailReceiver</code> will search for Messages based on the default SearchTerm which is All ma...
Javascript src with question mark <p>I have a question. In old project that I'm currently working on I have found this code:</p> <pre><code> &lt;script type="text/javascript" language="Javascript" src='&lt;%= Page.ResolveUrl("~/javascripts/CardConnectorManager.js?2016071203")%&gt;'&gt;&lt;/script&gt; </code></pre> <...
<p><a href="http://stackoverflow.com/a/39591681/930170">David R's answer</a> is pretty good, but I want to add a little bit info:</p> <p>Usually there are two approaches for cache-breaking:</p> <ol> <li>Rename file; </li> <li>Add some hash to the end of the file.</li> </ol> <p>The first approach may be better for so...
Checking if date is within a date range <p>I have a GridView and I want to change the colour of the row if the date in a column is within a certain date range.</p> <pre><code>DateTime dt = new DateTime(); if (DateTime.TryParse(c.Text, out dt)) { if (dt.Date &gt;= DateTime.Now.AddDays(Mod.ValidUntilDays).Date &amp;...
<p>you are asking the date to be >= 5-days-time and &lt;= 5-days-time. So unless it == 5-days-time it'll return false. I think you mean this:</p> <pre><code>DateTime dt = new DateTime(); if (DateTime.TryParse(c.Text, out dt)) { DateTime now = DateTime.Now; if (dt.Date &gt;= now.Date &amp;&amp; dt.Date &lt;= now.Ad...
How to prevent insert email if already exist with specific id in laravel? <p>I have table in which i'm trying to store email addresses. These email addresses will be save with <code>user_id</code>.</p> <p>For example in <code>email_list</code> table</p> <pre><code>|ID | user_id | email | .......................
<p><strong>Forcing A Unique Rule To Ignore A Given ID</strong></p> <p>You can specify an ID to be ignored as the optional third parameter. Furthermore, if your table uses a primary key column name other than id, you may specify it as the optional fourth parameter</p> <pre><code>'email' =&gt; "unique:{$table},{$field}...
How to insert all styles of a document in current document using 'insertFileFromBase64' in word add-in <p>I am developing a word add-in using word javascript api. I need to fetch the documents from sever and insert into current document in MS Word.</p> <p>Currently i am using below code to insert the document:</p> <p...
<p>this is a by design behavior, if styles from the same name are already in use in the document you are inserting the file to, Word does not override the existing style definitions. Couple of options you have is to change the style names, you can also try to insert the OOXML of the document and make sure the style de...
Returning JSON response from controller in laravel <p>I am new to Javascript. I want to do a ajax updation in my form. Everything works fine. once the update is done the value is updated in the database. where the problem occurs is when i try to update it in the view. Here is my controller </p> <pre><code>public funct...
<p>Well, I think that Eloquent <code>get()</code> returns a collection, not a certain object. Looks like you want to return just one object with <code>domain_id</code> that is unique. Try using </p> <pre><code>$new_data = domain_details::where('domain_id',$post['domain_id'])-&gt;first(); </code></pre> <p>instead.</p>...
angular.copy() does not break reference to model <p>Let's say I have a <code>model.data</code> object and want to copy that object to <code>datacopy</code> and do some changes on that new object (<code>datacopy</code>). But when I change <code>datacopy</code>, changes are also applied to <code>model.data</code>. How to...
<p>Because of reputation I can't comment to question.</p> <p><strong>Angular.copy()</strong> works fine.</p> <p>You can try this variant : <strong>copy object outside of function and send it as parameter</strong>.</p> <pre><code>function updateClone (datacopy, _object) { var index = _.findIndex(datacopy, functi...
Show/hide fragment on button click in Android <p>I want to know how to show and hide a fragment on a button click in Android. When button is in clicked state then fragment should appear, and when the button is clicked again then the fragment should disappear.</p>
<p>You should use Dialog fragment for this purpose. Dialog Fragment has all life cycle as fragment has and has behavior like dialog. For example to show, simply call dialogFragment.show() method, and to hide, call dialogFragment.dismiss() method.</p> <p>Here is an example how to make a dialog fragment.</p> <pre><cod...
Html center align the button on media screen <p>I want to align the button horizontally in the same line which is divided into columns in a blue color called <code>Läs mer</code> in media screen. following is the link <a href="http://www.visbyhemtjanst.se/" rel="nofollow">http://www.visbyhemtjanst.se/</a></p> <p>i ad...
<p>if you want to centre an element add this class</p> <pre><code>.center{ position:absolute; left:50%; transform:translateX(-50%); top:50%; /* Adjust this to place it correctly use percentage*/ } </code></pre> <p>Hope this helps</p>
Sending form data with angular-file-upload <p>I'm using nervgh's angular-file-upload and I'd like to send formData based on user inputs. I can request different fields from the formData but not when they are pushed onBeforeUploadItem. </p> <p>I have the uploader set up like so:</p> <pre><code>var uploader = $scope.up...
<p>Instead of trying this way, you may try to upload your files via formData using <em>multipart/form-data</em>. An example is given below:</p> <pre><code> &lt;form action="yoururl" method="post" ng-submit="yoursubmitaction" enctype="multipart/form-data"&gt; &lt;input type="text" name="text1" /&gt; &l...
TextEdit field input hangs on iOS10 <p>Im experiencing very odd issue on iOS10 since rebuilding my few apps. Every time i input more characters then it fits on screen in UITextField app just freeze and exactly nothing happens, there is no single error in debugger just frozen. After few minutes app crashes with memory i...
<p>I have resolved it with disabling Adjust to Fit for password field, but this is more workaround than fix.</p>
UnityContainer: what is default lifetimemanager <p>I use Web API 2 and here is configuration of my unity container (i configure my rabbitmq dependencies):</p> <pre><code>container.RegisterInstance(new ConnectionFactory { Uri = AppSettings.RmqConnectionString }); container.RegisterType&lt;IConnection, Autorecoveri...
<ol> <li><code>RegisterInstance</code>'s default lifetime is <code>ContainerControlledLifetimeManager</code></li> <li><code>RegisterType</code>'s default lifetime is <code>TransientLifetimeManager</code></li> </ol>
importing ecoinvent 3.2 with brightway <p>I am having some trouble importing Ecoinvent 3.2 with Brightway2, I was following the <a href="http://nbviewer.jupyter.org/urls/bitbucket.org/cmutel/brightway2/raw/default/notebooks/IO%20-%20importing%20Ecoinvent.ipynb" rel="nofollow">example notebook</a>:</p> <pre><code>from ...
<p>I have run into this in the past, surely because of the reasons @Chris evoked. </p> <p>You can use <code>projects.read_only = False</code> to force-write data. Please make sure that this is really what you want to do. You will <em>not</em> want to do this, for example, if you are accessing the same project through ...
JSONException never thrown in corresponding try statement <pre><code>@Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { try { if (action.equals("init")) { ctrl = io.display.sdk.Controller.getInstance(); ctrl.get...
<p>close try bracket properly. IDE is not recognizing where exception has been used.</p>
Adding and Deleting draggable rectangles on the Image and Saving to a file <p>I have written the following code through which I am loading an Image using a load button and then I draw different rectangles on the image using draw button and save them to a text file.</p> <p>I have made 3 buttons on my Image.</p> <p>1.l...
<p>Before saving, you should check if your rectangles are valid handle objects (i.e. not deleted):</p> <pre><code>function saveButton_Callback(hObject, eventdata, handles) rectangles=handles.rectangles; delete('P:\bla.txt'); fclose(fopen('P:\bla.txt', 'w')); % To be able to append for k...
Pipes. components injection to component in Angular 2 <p>In Angular2 RC.4 I can inject components and pipes to each component.</p> <pre><code>@Component({ pipes: [ ToShortTime, ToTimeZone], directives: [Restaurant, Spinner] }) </code></pre> <p>How can I do this in released version of Angular2. ( For example injec...
<p>Its not possible!</p> <p>You could create a Module including just that component..</p>
How to properly quit a QThread in PyQt5 when using moveToThread <p>I am trying to quit a thread after it is done processing. I am using moveToThread. I'm trying to quit the worker thread from the main thread by calling self.thread.quit() in the slot. And that's not working.</p> <p>I've found several examples of starti...
<p>Try running your script multiple times. Is the result of the call to <code>self.thread.isRunning()</code> always the same? Try adding a call to <code>time.sleep(1)</code> before checking if the thread is still running. Notice any difference?</p> <p>Remember that you are making a call from the main thread of your p...
Failing to delay function until after 'for' loop has fully completed <p>I've got a tool in place which is splitting a large query into manageable chunks, then using a simple AJAX method to spit this out. The destination for the AJAX form is just a script which delegates some form data to a function, including which 'c...
<p>This is a "Promise" based solution to your problem.</p> <p>First, decompose each pass into a function that does one unit of work:</p> <pre><code>function makePass(i) { return $.ajax({ type: 'POST', url: 'do.php?p=' + i, data: $('#form' + i).serialize() }).then(function(data) { $('#update' +...
Exclude line from compilation via Makro C++ <p>I've got some problem, which might be simple to solve.</p> <p>I have code like this:</p> <pre><code>#define _MG_ALL //This might be defined in some other headerfile #ifndef _MG_ALL #define MG_ALL &lt;?????&gt; #else #define MG_ALL &lt;nothing&gt; #endif </code></pre> <...
<p>What you could do is defining the macro like so:</p> <pre><code>#ifdef _ALL #define ALL if(1) #else #define ALL if(0) #endif </code></pre> <p>When you use it this it will produce code similar to this</p> <pre><code>ALL std::cout &lt;&lt; "Debug Message" &lt;&lt; std::endl; ==&gt; if(1) std::cout &lt;&lt; "Debug ...
How to make validation summary show red text and make bullet point not show? <p>Just a quick question, I want to make the bullet point not show on my validation summary and also I want to make the text red. I was just wondering how to do this, please check my code below.</p> <pre><code>&lt;div class="help-block col-md...
<p>Change your call of <code>ValidationSummary</code> extension method like this:</p> <pre><code>@Html.ValidationSummary(true, "", new { @class = "custom-validation-summary" }) </code></pre> <p>It will add the css class <code>custom-validation-summary</code> to the rendered html element which represents the summary, ...
How can I use more than 2100 values in an IN clause using Dapper? <p>I have a List containing ids that I want to insert into a temp table using Dapper in order to avoid the SQL limit on parameters in the 'IN' clause.</p> <p>So currently my code looks like this:</p> <pre><code>public IList&lt;int&gt; LoadAnimalTypeIds...
<p>Ok, here's the version you want. I'm adding this as a separate answer, as my first answer using SP/TVP utilizes a different concept.</p> <pre><code>public IList&lt;int&gt; LoadAnimalTypeIdsFromAnimalIds(IList&lt;int&gt; animalIds) { using (var db = new SqlConnection(this.connectionString)) { // This Open() ...
Celery - No module named 'celery.datastructures' <p>i am using <code>Django 1.10</code> + <code>celery==4.0.0rc3</code> + <code>django-celery with commit @79d9689b62db3d54ebd0346e00287f91785f6355</code> .</p> <p>My settings are:</p> <pre><code>CELERY_RESULT_BACKEND = 'djcelery.backends.database:DatabaseBackend' CELER...
<p>I was able to find the answer here <a href="https://github.com/celery/celery/issues/3303#issuecomment-246780116" rel="nofollow">https://github.com/celery/celery/issues/3303#issuecomment-246780116</a></p> <p>Basically <code>Django-celery does not support 4.0 yet</code> so i downgraded to <code>celery==3.1.23</code> ...
How to achieve whats app animation where toolbar disappear when scroll down and tabs stick to top? <p>I want to achieve something like whatsapp animation where toolbar is hidden during scroll down and show back when scroll up with the tab bar always sticking to the top so far i used Animated to set the toolbar height t...
<p>that is a new android xml block from the design and support library.</p> <pre><code>&lt;android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@color/white"&gt; &lt;android.support.design.widget.Collaps...
Regular Expression specific to a particular message pattern with mandatory elements <p>As I'm pretty new to Regular Expression, I'm looking for a regular expression which will validate whether entire string is separated by <code>|</code> and there will be values with <code>$</code> followed by an integer. </p> <p>Vali...
<p>This will do it for you:</p> <pre><code>^[\w.]+=\$\d+(?:\|[\w.]+=\$\d+)*$ </code></pre> <p>It matches at least one <em>word character</em> <strong>or</strong> <code>.</code> followed by an <code>=</code>, <code>$</code> and a digit. Then, optionally, a <code>|</code> followed by the first sequence again. This <em>...
Protobuf: Maximum memory size for the Arena <p>I am evaluating Protobuf Arena allocation to use with non protobuf related classes. Just as a tool to easily allocate/deallocate objects from a memory pool.</p> <p>I haven't found in its API (<a href="https://developers.google.com/protocol-buffers/docs/reference/cpp/googl...
<p>There is no real built-in functionality for capping the memory usage, but I believe you could achieve the same result by setting the right hooks on the <a href="https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.arena#ArenaOptions" rel="nofollow">ArenaOptions</a>. You would want to set...
How to generate sequence like <pre><code>+---+------------+ | V | output | +---+------------+ | y | 1 | | y | 2 | | y | 3 | | N | 0 | | y | 1 | | y | 2 | | N | 0 | | N | 1 | +---+------------+ </code></pre>
<p>Let me assume that you have a column (say, <code>id</code>) that has the ordering information. Then, you want to identify groups of "Y"s and "N"s that appear together and then enumerate them.</p> <p>You can do this using a difference of row numbers trick:</p> <pre><code>select t.v, row_number() over (parti...
Return type specification for wrapped method (TypeScript) <p>I'm trying to use the bcrypt module for Node with TypeScript's await / async options. The <code>compare</code> code is fairly simple:</p> <pre><code> let compare = util.asyncWrap( bcrypt.compare ); let result = await compare( password, stored ); r...
<p>Nowhere in your code do you specify that the return value of the operation is a boolean so the compiler can't infer that.</p> <p>This should probably do the trick:</p> <pre><code>return new Promise&lt;boolean&gt;(function(resolve, reject) { ... }); </code></pre>
Package version difference between pip and OS? <p>I have Debian OS and python version 2.7 installed on it. But I have a strange issue about package <code>six</code>. I want to use 1.10 version. </p> <p>I have installed six 1.10 via pip:</p> <pre><code>$ pip list ... six (1.10.0) </code></pre> <p>But when I run the f...
<p>You can use <code>virtualenv</code> for this.</p> <pre><code>pip install virtualenv cd project_folder virtualenv venv </code></pre> <p><code>virtualenv venv</code> will create a folder in the current directory which will contain the Python executable files, and a copy of the pip library which you can use to insta...
change the name of the identifier user_id <p>How can I change the name of the identifier user_id? variant does not work above. or is there an option sql.</p> <pre><code>id|user_id|name ---------------------- 15| 2 |testreg ---------------------- 18| 1 |Cheburashka ---------------------- 6 | 2 |testreg ----...
<p>If you want change the column name you should use an alter table (assuming the column to change name is an INT) </p> <pre><code>ALTER TABLE your_table_name CHANGE user_id your_new_name INT; </code></pre>