input
stringlengths
51
42.3k
output
stringlengths
18
55k
Playing encrypted MP4 <p><p>I'm making a <strong>(local - Multi-Platform) video protection app</strong> but I don't know what is the right solution to first "encrypt->save on HDD" and then <strong>"load from HDD->decrypt->play"</strong> encrypted video.</p> <p>I read about MPEG-DASH and some DRMs and found this Bento4 ...
<p>After many searches on google I found the answer of <a href="http://stackoverflow.com/users/1936622/erti-chris-eelmaa">@erti-chris-eelmaa</a> here:<p> <a href="http://stackoverflow.com/questions/7316729/playing-encrypted-video">Playing encrypted video</a></p> <blockquote> <p>I wrote my own Videoplayer using openG...
Android:Custom Fonts to Text View. It mess up my other code <p>I was able to change the font in a new fresh project (only one activity and text "hello world") in Android Studio to a unique font not available in Android Studio. It worked great. </p> <p>But when I followed the exact same procedure and used the exact sam...
<p>You can try to this code..</p> <pre><code>public class MainActivity extends AppCompatActivity implements View.OnClickListener { private Button button_sbm; private TextView myTextview; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout...
Dutch flag with four colors <p>I went through a solution for two and three colors but I am unable to get it for four colors.</p> <p>Please help.</p> <p>Will it be <code>rrbb????yyyggg</code>? How will we swap the green flag?</p> <p>I tried the solution below but it is not working with swapping the last yellow with g...
<p>I run your code and realized that your code goes into <em>infinite loop</em>, which let does your programm do nothing.</p> <p>In the main method, <code>sort0123(arr, arr_size);</code> is called and within this method, <code>while (mid &lt;= hi)</code>, mid = 6 and hi = 9 and that means <code>6 &lt;= 9</code...
Implementing both SAML and legacy login without Spring Security API <p>I have a similar question to <a href="http://stackoverflow.com/questions/29027961/can-i-implement-both-saml-and-basic-spring-security-within-an-application">this</a> one however our application (which makes use of only Spring Beans &amp; Annotations...
<p>It is in fact possible to use Spring SAML extension without 'implementing' the Spring security aspect in the project. However the spring security jars are needed as a dependency.</p>
busyindicator for angular2 kendo ui grid before data is loaded through http <p>I'm using angular2 kendo ui grid and binding data to the grid by http call</p> <p>before http call returns the data i need to show busy indicator without showing grid header till data is assigned.How to achive this</p> <p>Thanks, Raghu s</...
<p>I achieved this by declaring the following within the HTML template.</p> <p>Add a new div above the grid with a conditional loading text for when the grid is loading:</p> <pre><code>&lt;div *ngIf="loading == true" class="loader"&gt;Loading..&lt;/div&gt; </code></pre> <p>Add a div wrapper around the grid for when ...
PLSQL - How does this Prime number code work? <pre><code>DECLARE i number(3); j number(3); BEGIN i := 2; LOOP j:= 2; LOOP exit WHEN ((mod(i, j) = 0) or (j = i)); j := j +1; END LOOP; IF (j = i ) THEN dbms_output.put_line(i || ' is prime'); END IF; i := i + ...
<p>Lets rewrite it so its a bit simpler:</p> <pre><code>BEGIN &lt;&lt;outer_loop&gt;&gt; FOR value IN 2 .. 50 LOOP FOR divisor IN 2 .. value - 1 LOOP CONTINUE outer_loop WHEN MOD( value, divisor ) = 0; END LOOP; DBMS_OUTPUT.PUT_LINE( value || ' is prime' ); END LOOP; END; / </code></pre> <p>Al...
Wordpress Query posts wrap each item in a div rather than an li and show descendants of current page <p>I am using the following to wrap through a list of posts as I want to display them within divs.</p> <p>Despite using </p> <pre><code> global $post; $currentPage = $post-&gt;ID; </code></pre> <p>and</p> <p...
<p>Originally posted this solution as a comment, because I wasn't sure it was the only change that was necessary. Turned out it is, so here's the solution:</p> <pre><code>&lt;?php global $post; $currentPage = $post-&gt;ID; // Get posts (tweak args as needed) $args = array( 'child_of' =&...
MySQL creating a table with 2 diffirent selects <pre><code>SELECT COUNT(*) as not_returned_devices, contact_email FROM device_rent WHERE rent_end IS NULL GROUP BY contact_email; SELECT COUNT(*) as returned_devices, contact_email FROM device_rent WHERE rent_end IS NOT NULL GROUP BY contact_email; </code></pre> <p>What...
<p>Just use conditional aggregation:</p> <pre><code>SELECT contact_email, SUM(rent_end IS NULL) as not_returned_devices, SUM(rent_end IS NOT NULL) as returned_devices FROM device_rent GROUP BY contact_email; </code></pre> <p>Note that this uses a MySQL short-cut, where boolean expressions are treated as "1" fo...
Power shell to create user and set Regional Configuration <p>Can anyone help. I'm creating users on our exchange 2016 system by using the following cmd's</p> <pre><code>Enable-MailUser -Identity "joe.bloggs" -ExternalEmailAddress 'joe.bloggs@domain.co.uk' Get-MailUser -Identity "joe.bloggs" | Enable-Mailbox Add-Mail...
<p>You could add <code>sleep</code> interval into your script to give exchange time to sort out the account before running the <code>Set-MailboxRegionalConfiguration</code> cmdlet. </p> <pre><code>Enable-MailUser -Identity "joe.bloggs" -ExternalEmailAddress 'joe.bloggs@domain.co.uk' Get-MailUser -Identity "joe.bloggs...
Implement async method synchronously <p>I have an interface which forces me to implement an (async) Task:</p> <pre><code>namespace Microsoft.Owin.Security.Infrastructure { public interface IAuthenticationTokenProvider { .. Task CreateAsync(AuthenticationTokenCreateContext context); .. ...
<p>Just implement the method without awaiting:</p> <pre><code>public async Task&lt;Foo&gt; GetFooAsync() { return new Foo(); } </code></pre> <p>It doesn't matter that you're not awaiting anything. It's not a requirement of an async method to await anything (although the compiler will warn you that you're not awai...
Typescript compiler suddenly started to generate errors <p>I'm working on an angular/2 project and all of a sudden I have started to get lots and lots of errors when I try and run the typescript compiler. Can anybody please advise on where to start searching? I have not knowingly changed anything fundamental and even w...
<p>It looks like you have the node typings in two places.</p> <p>node_modules/@types/node/index.d.ts</p> <p>typings/globals/node/index.d.ts</p>
dispatch_async ( queue, block) vs dispatch_async (queue) { block } <p>Is there any difference between these two snippets? In the first one, the block is inside the <code>dispatch</code> part. Tks </p> <pre><code> dispatch_async(dispatch_get_main_queue(),{ //do something }) ...
<p>No, there is no difference between these two blocks.</p> <p>It is part of Swift's ability to accept closures provided as an argument after the function parentheses.</p> <p><em>NB: This answer and its examples are written in Swift 3, but the syntax for Swift 2 should be similar.</em></p> <p>Consider the following ...
Resize UIImageView based on HTTP image response in Swift <p>I have an UIImageView in my story board and I am using SDWebImage to set image the property.</p> <pre><code>imageView.sd_setImageWithURL(photoURL) </code></pre> <p>How could I update the UIImageView size to match this image that is coming as a response from ...
<p>After you load the image into the imageView: </p> <pre><code>var frame = imageView.frame let imageSize = imageView.image.size frame.size.width = imageSize.width frame.size.height = imageSize.height imageView.frame = frame </code></pre>
get selected row Id from jquery datatable version 1.9.4 <p>Sorry this may be a duplicated question, but couldn't able to find the solution any where in the web as well as in StackOverflow</p> <p><strong>Problem</strong> </p> <p>I need to get the selected row id from jquery data table</p> <p><strong>My code what I ha...
<p>Use <a href="http://legacy.datatables.net/ref" rel="nofollow"><code>$()</code></a> API method to perform a jQuery selector action on the table's <code>TR</code> elements. </p> <p>For example:</p> <pre class="lang-js prettyprint-override"><code>$("#myDataTable").dataTable().$("tr.selected").each(function(){ var ...
SQLException: java.util.Date cannot be cast to java.sql.Time using hibernate <p>I have a object and I created it by using <strong>Hibernate Reverse Engineering Wizard</strong> and <strong>Hibernate Mapping Files and POJOs From Database</strong>.</p> <p>In this case my table has a sql time field(<strong>reminder_time</...
<p><code>repeat</code> is a <a href="http://dev.mysql.com/doc/refman/5.5/en/keywords.html" rel="nofollow">reserved keyword in MySQL</a> and needs to be escaped by backticks or use a different column name.</p>
How to send and receive multipart data in node.js? <p>Here is my HTML page where I want to send an image file and information about a TODO task and description. <a href="http://pastebin.com/W9TVy4An" rel="nofollow">http://pastebin.com/W9TVy4An</a></p> <pre><code>form.on('part', (part) =&gt; { if (part.filename) { le...
<p>Okay, I figured out a way and it is to read the <code>fields</code> and <code>files</code> properties when parsing a form.</p> <pre><code>let form = new multiparty.Form() form.parse(req, (err, fields, files) =&gt; { console.log(fields) }) </code></pre> <p>Fields is a object with the name of the attribute as a ke...
Spring Cloud Contract and plain Spring AMQP <p>We are using plain <a href="http://projects.spring.io/spring-amqp/" rel="nofollow">Spring AMQP</a> in our spring boot projects. </p> <p>We want to make sure that our message consumers can test against real messages and avoid to test against static test messages. </p> <p>...
<p>Actually we don't support it out of the box but you can set it up yourself. In the autogenerated tests we're using an interface to receive and send messages so you could implement your own class that uses spring-amqp. The same goes for the consumer side (the stub runner). What you would need to do is to implement an...
existing Cassandra 2.2.x cluster, changing the number of vNodes - will data be lost or not? <p>If the number of vNodes in the existing Cassandra 2.2.x cluster is changed - will it cause all the data in that cluster to be lost or not?<br> Is it possible to change # of vNodes and keep all the data stored in the Cassandra...
<p>The value in the config (cassandra.yaml) is only read on startup. Changing the value here will basically have no effect. You won't lose data.</p> <p>There used to be a feature called shuffle - but it turned out you really don't want to change the token layout in this way, the streaming associated with shuffle wil...
swift 3 equivalent for indexAtPosition, urlRequest.url!.isEqual <p>Hi i am getting following errors while upgrading from swift 2.2 to swift 3 </p> <blockquote> <p>Argument labels '(atPosition:)' do not match any available overloads"</p> </blockquote> <p>Below are the following code in swift 2.2.could you guys help...
<p>For <code>isEqual</code> error with <code>URL</code> use <code>==</code> instead of <code>isEqual</code> to compare.</p> <pre><code>if urlRequest.URL! == strongSelf.request?.urlRequest?.URL { </code></pre> <p>For error <code>Argument labels '(atPosition:)'</code> </p> <pre><code>indexPath.index(atPosition: (index...
SQLite3 - Why LEFT JOIN differs from other RDBMSes? <p>For example, two tables have has many (or has one) relation. Author and books. For example, we want to check if this an new author which doesn't have any books written.</p> <pre><code>SELECT authors.id FROM authors LEFT JOIN books ON authors.id = books.author_id A...
<p>You are incorrect that the version with the condition in the <code>ON</code> clause does any filtering. For instance, <a href="http://www.sqlfiddle.com/#!9/afa7df/1" rel="nofollow">here</a> is a MySQL SQL Fiddle that shows that putting the condition in the <code>ON</code> clause returns two rows.</p> <p>This is th...
SQL - date group by year, month, days - update <p>I used code to calculate difference between two date group by year, months, date:</p> <pre><code>;WITH calendar AS ( SELECT CAST(MIN([From date]) as datetime) as d, MAX([To date]) as e FROM ItemTable UNION ALL SELECT DATEADD(day,1,d), e FROM calendar WHERE d ...
<p>Change the last select to:</p> <pre><code>SELECT Item, [Year], CASE WHEN SUM(NoOfDays) &lt; 0 THEN SUM(NoOfMonth)-1 WHEN SUM(NoOfDays) &gt; 30 THEN SUM(NoOfMonth)+1 ELSE SUM(NoOfMonth) END as NoOfMonth, CASE WHEN SUM(NoOfDays) &gt;= 30 THEN SUM(NoOfDays)-30 ...
ToggleClass - very basic <p>My toggle does not work.</p> <pre><code>&lt;head&gt; &lt;script src="js/jquery-2.2.3.min.js"&gt;&lt;/script&gt; &lt;script src="js/functions.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body class="bkg-blue"&gt;... </code></pre> <p>In functions.js, I just have :</p> <pre><code>$(document).rea...
<p>In fact, I just removed the $(document).ready(function() at the beginning and it now works.</p>
How to get front camera, back camera and audio with AVCaptureDeviceDiscoverySession <p>Before iOS 10 came out I was using the following code to get the video and audio capture for my video recorder:</p> <pre><code> for device in AVCaptureDevice.devices() { if (device as AnyObject).hasMediaType( AVMediaTypeAudio ...
<p>You can get the front camera with the following:</p> <pre><code>AVCaptureDevice.defaultDevice(withDeviceType: .builtInWideAngleCamera, mediaType: AVMediaTypeVideo, position: .front) </code></pre> <p>The back camera:</p> <pre><code>AVCaptureDevice.defaultDevice(withDeviceType: .builtInWideAngleCamera, mediaType: A...
Connecting rounded squares <p>How do I create the div logo, as per the attached image below:</p> <p><a href="http://i.stack.imgur.com/6om35.png"><img src="http://i.stack.imgur.com/6om35.png" alt="2 sets of connected round squares"></a></p> <p>This is what I have created in <a href="https://jsfiddle.net/60jnk66d/16/">...
<p>Considering the hassle of aligning and <a href="http://stackoverflow.com/questions/28986125/double-curved-shape">making double curves with <em>CSS</em></a>, this is clearly a job for SVG. The curves are much easier to create and control. Here is an example using :</p> <ul> <li>Inline SVG</li> <li><a href="https://d...
getting org.xml.sax.SAXParseException in web.xml on line <taglib> <p>I want to use jstl tag library, for that I have included tag in web.xml</p> <p>but its showing following exception on starting apache tomcat server.</p> <pre><code>SEVERE: Begin event threw exception java.lang.IllegalArgumentException: taglib defin...
<p>The xsi:schemaLocation - url "<a href="http://java.sun.com/xml/ns/j2ee" rel="nofollow">http://java.sun.com/xml/ns/j2ee</a> web-app_3_0.xsd" does not contain a schema .. Try "<a href="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" rel="nofollow">http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd</a>"</p>
How to subtract two days from a date in Java? <pre><code> String dateSample = "2016-09-30 21:59:22.2500000"; String oldFormat = "yyyy-MM-dd HH:mm:ss"; String newFormat = "MM-dd-yyyy"; SimpleDateFormat sdf1 = new SimpleDateFormat(oldFormat); SimpleDateFormat sdf2 = new SimpleDateFormat(newFormat); ...
<pre><code>Calendar cal = GregorianCalendar.getInstance(); cal.setTime( sdf1.parse(dateSample)); cal.add( GregorianCalendar.DAY_OF_MONTH, -2); // date manipulation System.out.println(sdf2.format(cal.getTime())); </code></pre> <p>Hope I helped</p>
How to undo and redo event in Javascript with browser compatible? <p>I am having a tshirt custom design software tool and have to add the redo and undo event for text which is draggable</p> <p><a href="http://wordpress.tshirtecommerce.com/design-online/?product_id=17" rel="nofollow">http://wordpress.tshirtecommerce.co...
<p>Here we are..</p> <p>This is a simple example of doing an Undo &amp; Redo buffer, and using a function closure to handle the redo..</p> <p>This is of course a very simple example, so that it is hopefully easy too follow, but there is no reason this technique can't be used to undo/redo anything. Anything, you pass...
MYSQL UPDATE and SET statements in PHP (500 error response) <p>I'm a newb, so thanks in advance for bearing with me. That being said, I'm trying to update a table in my database and failing. I received a few NULL responses, adjusted a few things, and most recently got a few 500 internal server errors, which typically s...
<p>This is your <code>UPDATE</code>:</p> <pre><code>UPDATE `Room_Status` SET `Room_Availability` = `IN` WHERE `Room_Name` = "'.$_POST['room'].'"' </code></pre> <p>The backticks around <code>IN</code> mean that this is a column reference. You probably want a string, so use single quotes:</p> <pre><code>UPDAT...
Successfully installed azure toolkit for java plugin for eclipse but not showing any option “New Azure Deployment Project” <p>I have successfully installed azure toolkit for java plugin for eclipse from <a href="http://dl.msopentech.com/eclipse" rel="nofollow">http://dl.msopentech.com/eclipse</a> via "install new ...
<p>Per my experience, the following steps may be useful for you.</p> <p>1.You should use a pure Eclipse Environment and you could get a pure eclipse from this URL <a href="http://www.eclipse.org/downloads/eclipse-packages/" rel="nofollow">http://www.eclipse.org/downloads/eclipse-packages/</a>.</p> <p>2.You could clic...
How to dump one database to another database using mysql? <p>i have tried the following query but i gate with an error.</p> <pre><code>mysql&gt; mysqldump test |mysql test1; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to ...
<p>You have to use these commands on command prompt.</p> <p><strong>Syntax :</strong> </p> <pre><code>mysqldump --opt -u [uname] -p[pass] [dbname] &gt; [backupfile.sql] </code></pre> <p>i.e.</p> <pre><code>C:\&gt;mysqldump --all-databases &gt; dump.sql </code></pre> <p>If you want to create dump for any specific d...
Generate html document with images and text within python script (without servers if possible) <p>How can I generate HTML containing images and text, using a template and css, in python?</p> <p>There are few similar questions on stackoverflow (e.g.: <a href="http://stackoverflow.com/questions/6748559/generating-html-d...
<p>There are quite a few python template engines - for a start you may want to have a look here : <a href="https://wiki.python.org/moin/Templating" rel="nofollow">https://wiki.python.org/moin/Templating</a></p> <p>As far as I'm concerned I'd use jinja2 but YMMV.</p>
How to set Windows application ToolstripMenuItems Text Foreground Color Change When Hover Mouse in C# <p>Windows application ToolstripMenuItems Text Foreground Color Change When Hover Mouse in C#</p> <p><img src="http://i.stack.imgur.com/OHKLf.png" alt="My ToolStripMenuItems .Click Here to Show"></p>
<p>Use the MouseEnter and MouseLeave event as follows:</p> <pre><code> private void helpToolStripMenuItem_MouseEnter(object sender, EventArgs e) { helpToolStripMenuItem.ForeColor = Color.Green; } private void helpToolStripMenuItem_MouseLeave(object sender, EventArgs e) { helpToolStrip...
Run a bash script on a remote server <p>I am developing an application which would require me to execute a bash script on a remote server when my users give me a command through a web interface.</p> <p>What would be some ways to run a bash script on a remote server when I get a command on my main application server?</...
<p>Take a look at this:</p> <p>Let us say you have 2 servers, A and B. You want to run a bash script on B, when you get a command on A.</p> <p>In order to make it work, we may want to setup auto-ssh between 2 server. Otherwise, it would require manual intervention, of entering password, each time.</p> <pre><code># S...
Object to Objects mapper with differing names <p>I have a legacy application which contains a Class called <code>CustomerInvoice</code>. I need to relate these items to database tables which have less than friendly names (for example there is <code>CUSTOMER_INV_HEAD</code>, <code>CUST_INV_LINES</code>, <code>CUST_INV_...
<p>You can add Attributes to your class properties to give their underlying database names. This is the approach taken by the frameworks XML serializer. You then only need one "special method" to extract the database name attribute from the property of a class, via reflection. Note on the following example link the ove...
Sinatra on Rails 5 <p>I have problems adding sinatra as rack middleware for rails 5. The issue is that once I add <code>gem "sinatra"</code> to Rails Gemfile I cannot get the server running. But <code>bundle install</code> still finishes without errors. Could someone please explain to me how to add a (middleware) Sinat...
<p>Rails will automatically <code>require</code> all gems in the gemfile, which is not ideal when using Sinatra as a middleware. This is documented on the Sinatra website <a href="http://www.sinatrarb.com/intro.html#Sinatra::Base%20-%20Middleware,%20Libraries,%20and%20Modular%20Apps" rel="nofollow">here</a>.</p> <p>A ...
Play 2.5: Depedency injection in templates <p>I am trying to deal with dependency injected objects in Scala template (I am using Java-based Play 2.5). </p> <p>I have a system of templates, where I have layout template with minimal HTML base and that one is included by almost all other HTML templates which are construc...
<p>I think you can try to use ActionBuilder + implicit parameters on view to achieve your requirement. (My answer is based on the link on my comment).</p> <p>First you need to define an ActionBuild that extract the current user from database or from session object field on request and add it to a subtype of WrappedReq...
Easiest way to show differently styled buttons <p>I want to modernize an old VCL application based on a design template. That design template contains different button styles. Let's say there are three types of buttons: <code>LightButton</code>, <code>DarkButton</code> and <code>GreenButton</code>. </p> <p>Since more ...
<p><strong>Q</strong> : Now I want to add the other button styles to the .vsf file and use it in my application. What is the best way to do it?</p> <p><strong>A</strong> : The VCL Styles internals doesn't allow to use more than one button style from the vsf file. (The images inside of the VCL Styles files are used to...
Remove specific characters in filename <p>Is there any easy solution how to trim suffix in my filename? Problem is, that my suffix length is vary. Only the same string in filename is _L001.</p> <p>See the example:</p> <pre><code>NAME-code_code2_L001_sufix NAME-code_L001_sufix_sufix2_sufix3 NAME-code_code2_code3_L001_...
<p>Using pure string manipulation technique:-</p> <pre><code>$ string="NAME-code_code2_L001_sufix"; printf "%s\n" "${string%_L001*}" NAME-code_code2 </code></pre> <p>For all the lines int the file, you can do the same by <code>bash</code>, by reading the file in-memory and performing the extraction</p> <pre><code># ...
How to choose object from list and print its name <p>I have class Something with few objects:</p> <pre><code>class Something(): def __init__(self, name, attr1, attr2): self.name= name self.attr1= attr1 self.attr2= attr2 def getName(self): return self.name Obj1=Something('Name1', 'bla bla1', 'bla b...
<p>Thing is that you compare string to an object here:</p> <pre><code>if y == i: </code></pre> <p>so you should either look at <code>__eq__</code> method of your class, or compare input string with obj name like:</p> <pre><code>if y == i.getName() </code></pre>
css, lines dashing vertically through bullets <p>This may sound stupid, But I am on edge here. Does anyone knows how to do this in css or javascript? (preferably css)</p> <p><img src="http://i.stack.imgur.com/wHEML.png" alt="enter image description here"></p>
<p>You could try this:</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-css lang-css prettyprint-override"><code>body { font-family: Helvetica, Arial, sans-serif; font-size: 12px; } .section_header { ba...
Can I change numerous HTML elements using an array in Javascript? <p>I want to change the contents of two HTML elements simultaneously when a user clicks on a button. What the contents of the elements changes to is based on a random number which will then access arrays defined within the function.</p> <p>That's what I...
<p>This might work out as a better solution:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function createCard(){ var shuffle = Math.floor(Math.random()*2); var ca...
Select from table <p>select records from table using like for loop in postgres where user given value less than particular column value then stop loop else select next record based on remaining value</p> <p>ex:</p> <pre><code>NO: value: inv1 5 inv2 20 inv3 30 </code></pre> <p>user given value 23 means </p> <...
<p>You are looking for a cumulative sum and some additional logic:</p> <pre><code>select t.*, (case when cume_value &lt; 23 then value else cume_value - value end) from (select t.*, sum(value) over (order by ??) as cume_value from t ) t where cume_value &lt; 23; </co...
2D Orthogonal projection of vector onto line with numpy yields wrong result <p>I have 350 document scores that, when I plot them, have this shape:</p> <pre><code>docScores = [(0, 68.62998962), (1, 60.21374512), (2, 54.72480392), (3, 50.71389389), (4, 49.39723969), ..., (345, 28.3756237), (...
<p>If you are using the plot to visually determine if the solution looks correct, you must plot the data using the same scale on each axis, i.e. use <code>plt.axis('equal')</code>. If the axes do not have equal scales, the angles between lines are distorted in the plot.</p>
Primefaces p:messages won't show first FacesMessage <p><strong>Prerequisites</strong>:<br> - JSF 2.1<br> - Primefaces 5.2<br> - Glassfish 3.1 </p> <p><strong>Story</strong>:<br> I've created a p:dialog used for displaying FacesMessages on a p:messages element. This dialog is needed, because the user has to commit ...
<p>First of all it is not allowed to put a form inside of another, as stated in W3C XHTML specification, "form must not contain other form elements." visit: <a href="https://www.w3.org/TR/xhtml1/#prohibitions" rel="nofollow">https://www.w3.org/TR/xhtml1/#prohibitions</a>.</p> <p>So your dialog should not be inside of ...
Terminal does not recognize git <p>None of my git repositories work. I open the terminal and I go to the folder where I have git: cd ... I usually see a green asterisk . It means that it recognizes that the folder has git. But now, I do not see the green asterisk. It happens with all my repositories. </p> <p>I have c...
<p>After trying a lot of things I could find that the program XCode creates some problem. I had a new version of XCode downloaded but not opened yet. When I opened and agreed to the new conditions, git and the terminal work well again. </p>
Creating ipa from XCode 7.x and submit to AppStore is supported for iOS 10? <p>Our app already live in AppStore. Now i am going to take ipa from Xcode 7 with iOS 7.0 greater choosen. Also ll upload this binary from Application loader not from XCode. Xcode 7.3 has iOS 9 sdk. I know to run this app in device i need to go...
<p>Sure, i've uploaded an ipa file (built with xCode 7.3) to ItunesConnect and it's currently online and available for iOS 10 devices. You could install manually iOS 10 simulators to test your app on iOS 10 using xCode 7.x</p>
how can I launch a first time installation project? <p>I have an android project for first time installation. It is related with my firm agreement pages. It comes after google agreement pages.</p> <p>I tried some technics for doing it. For example,I set it as a system application. However, it is cleaned when backup an...
<p>Your application doesn't have any launcher activity. Replace these lines</p> <pre><code>&lt;category android:name="android.intent.category.HOME" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; </code></pre> <p>with</p> <pre><code>&lt;category android:name="android.intent.category.LAUNCHER"...
How to get coverage report for external APIs? <p>I'm trying to get coverage report for the API code. I have all the test cases running perfectly in mocha. My problem is that my API server and the test cases are written in separate repositories.</p> <p>I start my node API server on localhost, on a particular port, and ...
<h2>Testing env</h2> <p>If you want to get coverage, supertest should be able to bootstrap the app server, like in the <a href="https://github.com/visionmedia/supertest#example" rel="nofollow">express example</a>. </p> <p>The drawback is that <em>you must not run your tests against a running server</em>, like</p> <p...
How to check if an Android OS is forcing an application icon background color? <p>I am working with a team to develop a cross-platform application on mobile, and we're using Visual Studio 2015 and Xamarin.Forms v2.3.2.127. </p> <p>We have already created the application icons that we need for the three different plat...
<p>This is a custom launcher / icon pack's doing. Most likely the manufacturer's doing(LEAGOO). You may notice that "Known" apps will have a custom icon, but if you created a custom app it might look much different with a random background and perhaps an icon transformation of some sort. </p> <p>It might be worth gett...
How Can I populate a JTable from an excel file, as long as there is more than 1 matching element in my Array List? [Java] <p>[![enter image description here][1]][1]I'm having a problem populating a JTable from an excel file. Here is the operation, I will search, lets say "Line 1", there are 2 cells matching this value,...
<blockquote> <p>I was able to get this working, however, this only creates one row for the first matching value, </p> </blockquote> <p>That is because in your "looping code" you create a new JTable each time.</p> <p>Instead you want to create the table once and add data to your TableModel inside the loop. So the st...
Pig Script Merging Rows after join and group by <p><strong>Movie table</strong>:</p> <pre><code>id movie genre 1 ABC A|B|C 2 DEF D|A|F </code></pre> <p>There are multiple genres which are separated by a <code>|</code> delimiter.</p> <p><strong>Ratings table:</strong></p> <pre><code>user_id movie_id ra...
<p>You can achieve it by:</p> <pre><code>genre_data = join movie by id, ratings by movie_id; genre_data = group genre_data by user_id; user_data = foreach genre_data { genres = foreach genre_data generate movie::genre as genres; generate group as user_id, BagToString(genres, '|'); }; </code></pre>
Need URL for Appstore connectivity and Xcode developer account connectivity <p>In my office, proxy and URL restriction is there so am not able to update the app/softwares through Appstore application and also not able to add the Team, signing certificate in Xcode. I raised the complaint to IT admin and inorder to enabl...
<p>Best to run a network traffic analyser on your computer and make a list of attempted accesses.</p> <p>Even better, do the same from home (or wherever you have access), and list the actual URLs.</p> <p>Or (in the mean time) ask/urge IT if they can open HTTPS (and HTTP) access <code>*.apple.com/*</code> and <code>*....
Regex pattern match by delimiter <p>to get the value of gs from the below query.</p> <p><strong>(2|3|4|5|6|7|8|9|10|11|gs=accountinga sdf* |gs=tax*|12|ic='38')</strong></p> <p>I have tried with below pattern</p> <p><strong>(?&lt;=gs=)(.*)([|])</strong></p> <p>But this results <strong>gs=accounting asdf* |gs=tax*|12...
<p>This regex will match as you want.</p> <pre><code>(?&lt;=gs=)([^|)]*) </code></pre> <p>It will also handle the case where gs is the last clause without including the closing bracket in the group.</p>
Webdav Servlet Implementation <p>I am trying to use WebDAV protocol to access my file store on my server. I want all functionalities of WebDAV both level 1 and level 2+.</p> <p>My server is Apache Tomcat, and authentication rules are in MySQL database. </p> <p>I have seen libraries like Jackrabbit and Tomcat's defaul...
<p>The best option is <a href="http://milton.io" rel="nofollow">milton.io</a>, that allows you to completely control the persistence of content and authentication and authorisation rules. Milton with dav level 2 is not free, but I'm the author. You can get a trial license through the milton website.</p> <p>Tutorials a...
How to create a compound field in group by in sqlserver <p>I have a table that contains 2 fields (for simplicity). the first one is the one that I want to group by on, and the second one is the one that I want to show as a comma separated text field. How to do it?</p> <p>So my data is like this:</p> <pre><code>col 1 ...
<p>You can use <code>FOR XML PATH</code> for this:</p> <pre><code>select col1, count(*) , STUFF((SELECT ',' + col2 FROM mytable AS t2 WHERE t2.col1 = t1.col1 FOR XML PATH('')), 1, 1, '') FROM mytable AS t1 group by col1 order by count(*) </code></pre>
How to change the frame of a UIView subclass on device orientation which is programmatically created? <p>I have a UIView subclass which is created programmatically.I have portrait and landscape mode in my application which uses Autolayout. Initially the UIView frame is set using initWithFrame.But when the orientation ...
<p>Just detect the orientation of device whether it is in <code>landscape</code> or <code>portrait</code> mode and then change the size of <code>UIView</code> accordingly see below code:</p> <p><strong>To detect device orientation:</strong></p> <pre><code>-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientati...
Can checkins be blocked in VS2015 between certain times <p>In Visual Studio 2015 can a check in be blocked between certain times of the day so they do not actually get checked in until after the time period expires?</p>
<p>For TFVC the only way I can think of doing this is to use scheduled tasks to change permissions.</p> <p><a href="https://www.visualstudio.com/en-us/docs/tfvc/permission-command" rel="nofollow"><code>tf permission</code></a> from the command line – thus can be scheduled – can be used to change permissions.</p>
Angular Directive - Correct order of execution of functions <p>Being bit confused as per the following 2 blogs: </p> <blockquote> <p><strong>I.</strong> Eric W Green - Toptal <a href="https://www.toptal.com/angular-js/angular-js-demystifying-directives" rel="nofollow">https://www.toptal.com/angular-js/angular-js-...
<p>The concept is as a matter of fact indeed baffling , but ones you understand the actual flow, it would remain clear throughout.</p> <p>The actual order of execution is ..<strong>Compile -> Controller -> Pre-Link -> Post-Link</strong></p> <p>For further understanding, just go through this <a href="https://www.unde...
Ngnix downloading php <p>I am trying to get nginx to route all requests starting with /embed to <code>/home/forge/dev.tline.io/embed/index.php</code> </p> <p>My Nginx config: </p> <pre><code>location /embed { root /home/forge/dev.tline.io; try_files /embed/index.php =404; } location / { root /home/...
<p>Please try out the following code,</p> <pre><code>map $request_uri $rot { "~ /embed" /home/forge/dev.tline.io/embed/; default /home/forge/dev.tline.io/; } map $request_uri $ind { "~ /embed" index.php; default index.html; } server { ... root $rot; index index.php index.html index.htm; ... ...
How to let Q_PROPERTY only evaluate once <p>In <code>Qt</code> + <code>QML</code>, I'm using <code>Q_PROPERTY</code> a lot. The <code>NOTIFY</code> signals are excellent to reevaluate the value.</p> <pre><code>class SomeComponent: public QObject { public: const QString&amp; GetMyValue(void) const; void SetMyVa...
<p>You need to remove this: <code>text: "OldValue: " + myComponent.myValue</code> because reading <code>myComponent.myValue</code> will get the value from C++ by calling <code>GetMyValue</code>.</p> <p>In QML, you create a function</p> <pre><code>function updateDisplay(){ iText.text = "OldValue: " + myComponent.myV...
Create Javascript File/Blob object from image URI <p>Is it possible to create a File or Blob object for my image out of an image URI?</p> <p>Using Cordova Image Picker, a plugin on my mobile app, I can retrieve photo URI's that look like this: "file:///data/user/0/..../image.jpg"</p> <p>However, I am now trying to cr...
<p>Have a look at a question that I posted a while back which deals with this but for videos (same principle applies): <a href="http://stackoverflow.com/questions/38439987/uploading-video-to-firebase-3-0-storage-using-cordovafiletransfer/38501655#38501655">Uploading video to firebase (3.0) storage using cordovaFileTran...
How to integrate Admob Rewarded Ads in Android? <p>I am struggling with <code>admob rewarded ads</code> integration. I tried with google tutorials but unable to achieve what i want.</p> <p>Please suggest me any good <code>tutorial</code> (prefer video tutorial) to integrate <code>admob rewarded</code> ads in android.<...
<pre><code> public class YourActivity extends AppCompatActivity implements RewardedVideoAdListener RewardedVideoAd mAd = MobileAds.getRewardedVideoAdInstance(this); mAd.setRewardedVideoAdListener(this); loadRewardedVideo(); private void loadRewardedVideo() { mAd.loadAd(getString("YOUR_AD...
RxJS Observable fire onCompleted after a number of async actions <p>I'm trying to create an observable that produces values from a number of asynchronous actions (http requests from a Jenkins server), that will let a subscriber know once all the actions are completed. I feel like I must be misunderstanding something be...
<p>Yes there is a better way. The problem right now is that you are relying on time delays for your synchronization when in fact you can use the <code>Observable</code> operators to do so instead.</p> <p>The first step is to move away from directly using <code>setTimeout</code>. Instead use <code>timer</code></p> <pr...
How to programmatically maintain aspect ratio of object in wpf <p>I programmatically add a <code>Border</code> with a certain width and height to a grid. However, I want to get either one of the following:</p> <ol> <li>Make the border keep aspect ratio and fill make it as big as possible inside the grid</li> <li>Make ...
<p>As lerthe61 suggested, just use a <a href="https://msdn.microsoft.com/en-us/library/system.windows.controls.viewbox(v=vs.110).aspx" rel="nofollow">Viewbox</a> with its <code>Stretch</code> property set to <code>Uniform</code>:</p> <pre><code>Color borderColor = (Color)ColorConverter.ConvertFromString(BorderColor); ...
How to enable read only permision to some specified cells and sheets in excel using openxml in c# <p>I am reading XML data then I pasted to data-set and the I created spreadsheet and copied the data to to sheets in spreadsheet.So now I want to only allow some sheets and cells to read-only. To prevent to no changes to h...
<p>We can customise protection by password in different means.For making excel sheet specified area or column or row as read only or a full sheet into read only by giving protection to sheet by password.If we want to protect whole sheet use this code</p> <pre><code> PageMargins pageM = sheetPart.Worksheet.GetFirstChil...
wso2 esb authenticate webservice called inside the flow <p>I'w defining a flow in wso2 esb, in this flow 1)I receive a soap message from an external salesforce (salesforce1) 2)I send the same message to another salesforce (salesforce2)</p> <p>salesforce 1 and 2 are associated with different account so when making the ...
<p>You can use <a href="https://store.wso2.com/store/assets/esbconnector/details/fbb433b5-4d74-4064-84c2-e4b23c531aa2" rel="nofollow">Salesforce connector</a> to connect Salesforce API.Use the logout method to invalidate the session for the first Salesforce call and then use init method with Salesforce2 credentials to ...
SAPUI5 filter with and-operation over multiple arguments <p>I would like the implement multiple filter for the search on a table binding. The requirement is to associate multiple filter with an and-condition: </p> <p>Pseudo code: </p> <pre><code>if(filterA &amp;&amp; filter1 || filterB &amp;&amp; filter1 || filterC &...
<p>You were on the right track with the <a href="https://sapui5.netweaver.ondemand.com/sdk/#docs/api/symbols/sap.ui.model.Filter.html#constructor" rel="nofollow">and</a> property:</p> <pre class="lang-js prettyprint-override"><code>new sap.ui.model.Filter({ and:false, filters: [ new sap.ui.model.Filter({...
Why some JavaScript functions don't work when a anchor is activate (#anchor in URL) <p><strong>EDIT NUMBER ONE : It is really strange in fact my javascript functions don't work when I click on the anchor ! Really... If someone has an idea I would be so thanksful</strong> !</p> <p>I am coding a simple home page compose...
<p>You could do this:</p> <pre><code>$('a').on('click', function(e){ e.preventDefault(); }); </code></pre> <p>This would prevent the defaut behavior of links also tho.</p>
JS how to dynamically populate a second date picker with minDate of the first one <p>How can I populate 2 date pickers? The second date picker has to have at least the value of first date picker.This is my code right now:</p> <pre><code>selector.dtmDlgLimitFrom.attr('readonly', true).datepicker({ changeMonth: true...
<p>you can try following to set the min date of second date selector:</p> <pre><code> minDate: $("#idoffirstdateselector").datepicker("getDate") }); </code></pre> <p>e.g.</p> <pre><code>selector.dtmDlgLimtTo.attr('readonly', true).datepicker({ changeMonth: true, changeYear: true, minDate: $("#idoffirs...
Find the approximate value in data.frame <p>There vector of ideal values, it looks like this:</p> <pre><code>gr &lt;- c(2.12, 7.58, 1.23, 6.98, 1.98, 3.45) # 6 numbers </code></pre> <p>And there data.frame with a large number rows (for example, show data.frame with five rows):</p> <p><img src="http://i.stack.imgur.c...
<p>Let <code>v</code> be a column and a be the value to approximate for that column. Then we want to minimize <code>abs(sum(v * x) - a)</code> over all zero-one vectors <code>x</code>. The ones in <code>x</code> will either all be less than <code>a</code> or else will be the least value in <code>v</code> no smaller t...
How to prevent this css shape to scroll left and right <p>I would like to keep this shape so it is responsive and keeps the same direction, and that it can still scroll down the page. The problem is that because of its size it scrolls left and right, which I wish to avoid. </p> <p>If I set <code>overflow: hidden;</cod...
<p>You can just set <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/overflow-x"><code>overflow-x: hidden;</code></a>, so scrolling in y direction will be nevertheless possible:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <p...
Icons separation and horizontal line behind <p>I search any problem but without results. Have big problem with separation of icons in inline-block after add css spearation ::after and ::before in the middle icon and with rwd of it.here's my code.</p> <p>HTML:</p> <pre><code>&lt;div class="icon-box"&gt; &l...
<p>first. you have common styles for all the <code>.icon_1,.icon_2,.icon_3</code> divs except the <code>background-image</code> . so, give a common class <code>icon</code> for example, to all those divs, or, if you can't change the HTML , use <code>.icon_1,.icon_2,.icon_3</code> instead of <code>.icon</code> in my exam...
Retruning multiple objects and using them as arguments <p>I have a function which goes something like this:</p> <pre><code>def do_something(lis): do something return lis[0], lis[1] </code></pre> <p>and another function which needs to take those two return objects as arguments:</p> <pre><code>def other_functi...
<p>You need to unpack those arguments when calling <code>other_function</code>. </p> <pre><code>other_function(*do_something(lis)) </code></pre> <p>Based on the error message, it looks like your other function is defined (and should be defined as)</p> <pre><code>def other_function(arg1, arg2): pass </code></pre>...
PHP SOAP Credentials in Header securityContext <p>Im struggling with this 2 days and trying almost everything I found on internet. I have SOAP service with username and password in header securityContext but have no idea how to provide data in that form in PHP?</p> <p>This is required header XML:</p> <pre><code>&lt;s...
<p>Huh, i managed it to work. Here is what is necessery if someone have similar problem.</p> <p>Part for adding header values:</p> <pre><code> $soap = new SoapClient($wsdl, $options); $auth = array( 'userName' =&gt; self::SOAP_USERNAME, 'password' =&gt; self::SOAP_PASSWORD, ...
Multiple ViewModels in View WPF <p>How to,bind the property of first/second/third Viewmodel to a grid column in a single view.</p> <p>How could I explicitly reference each property in the appropriate view model to grid column in view..! </p> <pre><code>DataContext="{DynamicResource VMContainer}"&gt; &lt;Window.Resou...
<p>If your <em>UserControl</em> have a <em>DataContext</em> of your <em>MyClass</em> and container is a public property below:</p> <pre><code>public MyClass { public VMContainer Container {get; set;} } </code></pre> <p>Your binding should looks like:</p> <pre><code>Binding="{Binding Container.VM1.Salary, Mode=TwoWay...
Directory.createDirectory creates files instead of directory in iOS <p>I have to save some data locally on iOS device for an Unity Game. Unity provide</p> <pre><code> Application.persistentDataPath </code></pre> <p>to get public directory to save data. And printing it on console shows that this path returned for i...
<p>Possible sloutions:</p> <p><strong>1</strong>.<code>Path.Combine(Application.persistentDataPath,"SavedPoses");</code> adds back slash before <code>savedPoses</code> while others are forward slashes. Maybe this causes a problem on iOS. Try raw string concatenating without the <code>Path.Combine</code> function.</p> ...
parallelize() method while using SparkSession in Spark 2.0 <p>I see that <code>SparkSession</code> doesn't have <code>.parallelize()</code> method, Do we need to use <code>SparkContext</code> again to create a RDD?. If so, is creating both <code>SparkSession</code> &amp; <code>SparkContext</code> in a single program ad...
<p>Once you build your SparkSession, you can fetch the underlying SparkContext created with it as followed :</p> <p>Let's consider that SparkSession is already defined :</p> <pre><code>val spark : SparkSession = ??? </code></pre> <p>You can get SparkContext now :</p> <pre><code>val sc = spark.sparkContext </code><...
Kentico Universal Pager update panel <p>I have a Pages data source, repeater, and universal pager. All is working, but i'm trying to avoid a QueryString and page reload. </p> <p>I've set the universal pager to Post back, but that still forces a page reload. Checking Use update panel as well, changes the pagination sta...
<p>Put all the web parts in a separate zone and set the zone to "Use update panel". Make sure the "Use update panel" setting is off for the web parts themselves though.</p>
Facebook sharing not work <p><strong>I used the below code for facebook sharing. It is working with google and twitter but not working in fb.Please help me with this code.</strong></p> <pre><code>&lt;meta property='og:type' content='website' /&gt; &lt;meta property='og:title' content='&lt;?php echo $title; ?&gt;' /&...
<p>Check the URL in Facebook Debug Tool, <a href="https://developers.facebook.com/tools/debug/" rel="nofollow">https://developers.facebook.com/tools/debug/</a>. Scrape your URL again and again and check. It will display the error that you are missing.</p> <p>The minimum image size is 200 x 200 pixels. If you try to u...
Append one by one in input text from checkboxes <p>I have a <code>jQuery</code> script that appends all checkboxes values into one <code>&lt;input type="text"/&gt;</code> with <code>','</code>, but when I check one box, it appends all the values from the others checkboxes aswell, and I want only to append those I check...
<p>Firstly note that <code>input</code> elements are self-closing, so its <code>&lt;input /&gt;</code>, not <code>&lt;input&gt;&lt;/input&gt;</code>.</p> <p>A simpler way to do this would be to map the selected values in to an array and update the text of the <code>input</code> with the values from that array each tim...
check if click is outside of Element - on removed item <p>I tried the jquery way with closest, to check if a click is outside of an Element:</p> <pre><code>$(document).click(function(event) { if(!$(event.target).closest("#wrapper").length) { console.log($(event.target)) console.log("click outside of #wrappe...
<p>Try this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).click(function(event) { if($(event.target).prop("tagName").toLowerCase() == "html") { conso...
Math in a NodeRed function block <p>I am trying to do a math function in a function-block in Node-RED but it can only handle easier task like multiply.</p> <p>I am trying to do this function but it can't handle the exponents(^). Perhaps there is a math function or something to declare this? It just returns a wacko num...
<p>You can use the cmath header which contains the pow function, in your case it would look something like: </p> <pre><code>#include &lt;cmath&gt; msg.payload = (6*std::pow(10,47))/(std::pow(msg.payload,16.66)); return msg; </code></pre> <p>The number returned is the first parameter raised by the second. </p>
Why subroutine needs to be written after the declaration of variables used in it? <p>Let's assume we have this code, why it fails with the explicit package name error since the function is called only after the declaration of the <code>$value</code>?</p> <pre><code>use strict; use warnings; sub print_value{ print...
<p>It's because of <a href="https://en.wikipedia.org/wiki/Scope_(computer_science)" rel="nofollow"><strong>scope</strong></a>. That's where in your program your variable is visible. Your <code>$value</code> is a <em>lexical</em> variable because you have declared it with <code>my</code>. That means, it exists inside a ...
css | button:hover background still grey <p>I noticed that the buttons (button.term) next to the grid turn grey when hover. I've set the pseudo classes (hover, focus, active, visited) to white!important, but it still doesn't work.</p> <p><a href="https://dercampus.ch/en/" rel="nofollow">Website</a></p>
<p>Add to the css:</p> <p><code>box-shadow:none;</code></p> <pre><code>.is-desktop #course_grid button.term { flex-basis: 7.5%; color: transparent!important; background: no-repeat center center; background-color: white !important; background-size: contain; opacity: 0.7; box-shadow: none; }...
Display NULL if some value is not found in SQL <p>I have a sample data here</p> <pre> id name ---------- 1 Test1 2 Test2 3 Test3 4 Test4 </pre> <p>So when I execute this QUERY</p> <pre><code>select id,name from table1 where name IN ('Test1','Test3','Test5') </code></pre> <p>It gives me an output of </p> <...
<p>You could use <a href="https://msdn.microsoft.com/en-us/library/dd776382.aspx" rel="nofollow">table value constructors</a>(>= 2008):</p> <pre><code>SELECT CASE WHEN EXISTS(SELECT 1 FROM table1 t WHERE E.Name = t.Name) THEN E.Id ELSE NULL END AS Id,...
Get commands by two criteria <p>How can we execute Get-Command command to get result by two criteria? Let's say it this way: I want in one execution to get list of commands that starts with <strong>Add</strong> or <strong>Get</strong></p> <p>Documentation of <code>Get-Command</code> command states that <code>-Verb</co...
<p>For me it worked like this: </p> <pre><code>Get-Command -verb Get,Add </code></pre>
How to Increase socket memory allocation in Linux kernel <p>I'm implementing a custom transport layer datagram protocol in the Linux kernel. I've implement send and receive Queues for in-order delivery in lossy environments.</p> <p>I noticed that with my current implementation, My socket runs out of memory with only 1...
<p>As it turns out, I need not define the sysctl interface manually for my protocol. I just used the following sysctl command on my test machine to increase the amount of memory allocated to each socket</p> <pre><code>sysctl -w net.core.wmem_default=&lt;new_value&gt; sysctl -w net.core.wmem_max=&lt;new_value&gt; </cod...
import a function to use the scope it is called from <p>Using Meteor, I am trying to use a function from one file on a template's scope lays in a different file. I tried using an arrow function:</p> <p>first file:</p> <pre><code>export const myFunc = ()=&gt;{ console.log(this.x); }; </code></pre> <p>second file:...
<p>What about passing your template's variables as parameters to the function? Combining that with the use of ReactiveVar you can set them in myFunc</p> <pre><code>import { myFund } from './myFunc.js' Template.MyTemplate.onCreated(function () { this.myVar = new ReactiveVar('Foo'); }); Template.myTemplate.onRendere...
Spring Security hasIpAddress causes errors <p>In my configuration, I have defined that:</p> <pre><code>@EnableGlobalMethodSecurity(prePostEnabled = true, proxyTargetClass = true) </code></pre> <p>And with the following code:</p> <pre><code> http.exceptionHandling() .authenticationEntryPoint(authEntryP...
<p>So as I turned out, I was receiving the request via proxy from nginx, which wasn't passing the original IP address of a requester. I had to add some additional nginx configuration, and now, I can verify IP address like this:</p> <pre><code>@RequestMapping(value = "/payment", method = POST) public String saveOrder(P...
Android Bluetooth Low Energy: Not hearing advertisements on some devices <p>I have a device that is emitting Bluetooth Low Energy (BLE) advertisements and a Nexus 7 (2013) Android tablet that should hear those advertisements. However, it cannot hear the BLE advertisements from my device and appears not to hear any BLE ...
<p>You need to activate location in the settings to receive ble scan results on Android 6+</p>
Insert data row-wise instead of column-wise and 1 blank row after each record <p>Here is my code:</p> <pre><code>wb = Workbook() dest_filename = 'book.xlsx' th_list = ["this", "that", "what", "is", "this"] ws1 = wb.active ws1.title = 'what' for row in range(1, 2): for col in range(1, len(th_list)): _ = ...
<p>Why are you writing something so incredibly complicated?</p> <pre><code>for v in th_list: ws.append([v]) # pad as necessary, never encode ws.append() # blank row </code></pre>
Default values are incorrect in html angular application <p>In this angularjs application I have a login page initially where the user types Username and Password. Once in the application, they can chose another page that requires a different username and password for database access. I want the database username to ...
<p>Corrected the problem... It is Google Chrome that was the problem. Apparently, when you use ids that are a form of 'username' and 'password' Chrome tries to 'help' by inserting the previous text that was used as a username and password.</p> <p>To fix the problem, I changed my ng-model names to variations of UsrNm a...
How can I create a variable in a service that gets its data from a promise yet is shared between two components? <p>I have a service in an Angular 2 using TypeScript. I want to be able to share an array of values that I get from that service. when one component makes a change to the array I need it to be reflected in a...
<p>@Krenom's answer was corrrect. with one import needing to be changed on my setup.</p> <p>I needed <code>import { Observable, Observer } from 'rxjs/Rx';import { Observable, Observer } from 'rxjs/Rx';</code></p>
Select folder path with writefile() <p>I success to extract the content (blob) into a file. However, how to change the file destination to another folder ?</p> <pre><code>Attach database 'serverFilesDatabase.db' as db1; Attach database 'ServerDatabase.db' as db2; Select writefile((b.filename),(data)) from db1.files a...
<p>My colleague, find the solution for this problem under Windows :</p> <pre><code>Select writefile(( "C:\\MyPath\\" || b.filename),(data)) from db1.files a inner join db2.filesTable b on a.fileId= b.fileId Limit 1; </code></pre>
Why is Burn elevating? <p>Why is my <code>perUser</code> bundle elevating?</p> <p>I have 3 packages in my chain. Here's a log snippet:</p> <pre><code>[0BD8:0324][2016-10-06T15:23:57]i201: Planned package: NetFx461Web, state: Present, default requested: Present, ba requested: Present, execute: None, rollback: None, ca...
<p>You should be getting a warning like this while compiling the bundle:</p> <blockquote> <p>Bundles require a package to be either per-machine or per-user. The MSI '{0}' ALLUSERS Property is set to '2' which may change from per-user to per-machine at install time. The Bundle will assume the package is per-{1} and w...
get select option value using onchange function in jQuery from multiple dynamic record? <p>Here is my code </p> <pre><code>foreach($test as $val){ &lt;select name="change" onchange="Change()" id="change-&lt;?=$val['id']?&gt;" data-id="&lt;?php echo $val['id'];?&gt;"&gt; &lt;option value="1"&gt;one&lt;/option&gt;...
<p>Replace <code>onchange="Change()"</code> with <code>onchange="Change(this)"</code> In HTML part.</p> <p>And function should be as below.</p> <pre><code>function Change(el){ alert("value : "+el.value+" and Id : "+el.id+' and data-id : '+el.getAttribute("data-id")); } </code></pre> <p><strong>Please check Wor...
How to avoid side effects while using Binding in JavaFX between model and view? <p>Let me explain my problem with the following vehicle example:</p> <p>I've got:</p> <ul> <li>IntegerProperty: <strong>speed</strong></li> <li>BooleanProperty: <strong>crash</strong></li> <li>JavaFX slider element: <strong>speed_slider</...
<p>I think the solution is simple, instead of unidirectional bindings, use bidirectional:</p> <pre><code>speed.bindBidirectional(speed_slider.valueProperty()); </code></pre> <p>Then you can still do a unidirectional binding with the crash and others etc. All this does is make sure the slider is always in sync with th...
Ajax receiving the incorrect error from PHP <p>I am attempting to set up modal for a project in which a client would be able to update their favorite team, city of birth and their size. Upon not entering some of the information I would like an error message to be returned to them but the only error message being echoed...
<p>You are using <code>if else if</code> construct for you checks which will only report at most one error. Change it to independent if statements</p> <pre><code>if(!$_POST['city']){ $error .= "City was not updated as there was not new information submitted."; } if(!$_POST['team']){ $error .= "Team was not up...
laravel 5 reletionship hasMany on two columns <p>I'm trying to implement relationship on two columns, record_id and table_name, </p> <p>here is what I got so far, Model name BatteryAssets: </p> <pre><code>public function Attachments() { return $this-&gt;hasMany('App\Attachments','record_id','id')-&gt;where...
<p>The error says Colomn not found, the column name you are trying to 'call' is called 'tabel_name'. Are you sure the column name isn't 'table_name'? (table in english and not dutch, atleast I think you are dutch)</p> <p>So it should be:</p> <pre><code>public function Attachments() { return $this-&gt;hasMa...
rspec error michael hartl lesson 3 <p>while executing the command</p> <p>$ bundle exec rspec spec/requests/static_pages_spec.rb</p> <p>i get this error /home/sarfraz/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rb:229:in <code>require': cannot load such file -- te...
<p>It seems the test/unit libraries are being loaded instead of the RSpec libraries. Review the contents of spec/spec_helper.rb and spec/rails_helper.rb, and the 'require' statements in the spec files to ensure that they match the instructions in the Hartl tutorial. Also, make sure you are using the current tutorial, a...