title
stringlengths
15
150
body
stringlengths
38
32.9k
label
int64
0
3
Socket issue, client claiming it failed to connect, but server says it did
<p>I've run into a problem when running my server on a remote PC that is connected to the same network.</p> <p>I manage to connect client to server, but the client throws an exception saying it failed to open socket; on the server side, though, I see that client did indeed connect, and I can send messages from client to server, but not from server to client.</p> <p>Here is the server side to start a server.</p> <pre><code>private void StartServer() { try { _serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _serverSocket.Bind(new IPEndPoint(IPAddress.Parse("192.168.5.150", 3333)); _serverSocket.Listen(5); _serverSocket.BeginAccept(new AsyncCallback(AcceptCallback), null); textBox.Text += "Waiting for connections\r\n"; } catch (SocketException ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } </code></pre> <p>I have opened a port in my router for 3333 UDP/TCP as well on that IP.</p> <p>Here is client connecting code.</p> <pre><code>void Connect() { try { _clientSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); _clientSocket.BeginConnect(new IPEndPoint(IPAddress.Parse("192.168.5.150"), 3333), new AsyncCallback(ConnectCallback), null); _clientSocket.BeginReceive(_buffer, 0, _buffer.Length, SocketFlags.None, new AsyncCallback(RecieveCallback), _clientSocket); AppendToTextBox("Connected!"); } catch { MessageBox.Show("Failed to open socket!"); } } </code></pre> <p>When I run both on my machine, everything works flawlessly, but when I try to do it remotely, it fails; however, since I'm able to send messages to the server from the client, and not vice versa I'm kinda confused about this.</p> <p>Thanks.</p>
2
Delete a dynamically created Table row upon row button click
<p>I've tried to delete a dynamically created table row when the user clicks on the delete button which is part of that table row. But this doesn't seem to work for me. I've tried many different methods but still it either deletes from the firstly created row or doesn't delete at all. This is what I currently have at hand and doesn't work.</p> <p>JS Function:</p> <pre><code>var rowID=0; var table = document.createElement('table'); table.id = "attrtable"; table.className = "attrtable"; function showAttributes() { var tr = document.createElement('tr'); tr.id=rowID; var attributeName = document.getElementById("attNam").value; var choice=document.getElementById("attrTypefromCombo"); var attrTypeCombo = choice.options[choice.selectedIndex].text; showAttrDivision.appendChild(attrName); showAttrDivision.appendChild(attrType); showAttrDivision.appendChild(closeattr); var tdAttrName = document.createElement('td'); var tdAttrType = document.createElement('td'); var tdDelete = document.createElement('td'); var text1 = document.createTextNode(attributeName); var text2 = document.createTextNode(attrTypeCombo); var deletebtn = document.createElement("button"); deletebtn.type="button"; //deletebtn.id = rowID; var text3= "&lt;img src='../Images/Delete.png'&gt;"; deletebtn.innerHTML = text3; deletebtn.onclick = function() { deleteRow(rowID); }; tdAttrName.appendChild(text1); tdAttrType.appendChild(text2); tdDelete.appendChild(deletebtn); tr.appendChild(tdAttrName); tr.appendChild(tdAttrType); tr.appendChild(tdDelete); rowID++; table.appendChild(tr); showAttrDivision.appendChild(table); } function deleteRow(row) { document.getElementById("attrtable").deleteRow(row); } </code></pre>
2
ExifInterface always return 0 Orientation
<p>I see many questions about that but i don't have found an answer to my issue.</p> <p>I try to display an profil image that can be captured with the camera or loaded from the storage.</p> <p>I use ExifInterface to determine the right rotation for Picasso which load images.</p> <p>I don't understand why for all pictures there is an orientation = 0</p> <p><a href="https://i.stack.imgur.com/Y938X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y938X.png" alt="enter image description here"></a></p> <p>Below my code, very simple :</p> <pre><code> private void onCaptureImageResult(Intent data) { Bitmap thumbnail = (Bitmap) data.getExtras().get("data"); ByteArrayOutputStream bytes = new ByteArrayOutputStream(); thumbnail.compress(Bitmap.CompressFormat.JPEG, 90, bytes); File destination = new File(Environment.getExternalStorageDirectory(), System.currentTimeMillis() + ".jpg"); FileOutputStream fo; try { destination.createNewFile(); fo = new FileOutputStream(destination); fo.write(bytes.toByteArray()); fo.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { Picasso.with(getBaseContext()).load("file:" + destination.getPath()).rotate(MyTools.getFileExifRotation("file:" + destination.getPath())).into(avatar); } catch (IOException e) { e.printStackTrace(); } } @SuppressWarnings("deprecation") private void onSelectFromGalleryResult(Intent data) { Bitmap bm=null; Uri uri=null; if (data != null) { try { bm = MediaStore.Images.Media.getBitmap(getApplicationContext().getContentResolver(), data.getData()); uri=data.getData(); } catch (IOException e) { e.printStackTrace(); } } try { Picasso.with(getBaseContext()).load("file:" + uri.getPath()).rotate(MyTools.getFileExifRotation("file:" + uri.getPath())).into(avatar); } catch (IOException e) { e.printStackTrace(); } } public static int getFileExifRotation(String path) throws IOException { ExifInterface exifInterface = new ExifInterface(path); int orientation = exifInterface.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: return 90; case ExifInterface.ORIENTATION_ROTATE_180: return 180; case ExifInterface.ORIENTATION_ROTATE_270: return 270; default: return 0; } } </code></pre> <p>I test on a LG G4 phone.</p>
2
Ruby Array of Arrays Group and Count by Values
<p>I'm trying to get a Ruby Array of Arrays and group it in order to count its values.</p> <p>The Array has a month, and a boolean:</p> <pre><code>array = [["June", false], ["June", false], ["June", false], ["October", false]] </code></pre> <p>I will like to end with a new Array that let me know how many false vs trues in each month.</p> <p>Example: (where the first item in the Array is month, the second is the count of false and the third is the count of true)</p> <pre><code>new_array = [["June", 3, 0]], ["October", 1, 0]] </code></pre>
2
Texture shown plain one color on mesh with custom geometry in Three.js
<p>I added texture to my triangle geometry. But all was one plain colour base on the lightest value. Then I learn that I should assign UVs. But same problem but with darkest colour of my texture (see picture).</p> <p>Here the code:</p> <pre><code>var material = new THREE.MeshBasicMaterial( { map: new THREE.TextureLoader().load(texture), overdraw: true } ); var geometry = new THREE.Geometry(); // 1re marche de 3 (30 degrées) geometry.vertices.push(new THREE.Vector3(0.0, 0.0, 0.0)); geometry.vertices.push(new THREE.Vector3(longueurTotalFacteur, largeur, 0.0)); geometry.vertices.push(new THREE.Vector3(0.0, largeur, 0.0)); geometry.vertices.push(new THREE.Vector3(0.0, 0.0, -epaisseur)); geometry.vertices.push(new THREE.Vector3(longueurTotalFacteur, largeur, -epaisseur)); geometry.vertices.push(new THREE.Vector3(0.0, largeur, -epaisseur)); geometry.faces.push(new THREE.Face3(0, 1, 2)); // Dessus geometry.faces.push(new THREE.Face3(5, 4, 3)); // Dessous geometry.faces.push(new THREE.Face3(3, 1, 0)); // Côté long geometry.faces.push(new THREE.Face3(4, 1, 3)); // Côté long geometry.faces.push(new THREE.Face3(4, 2, 1)); // Côté court geometry.faces.push(new THREE.Face3(5, 2, 4)); // Côté court geometry.faces.push(new THREE.Face3(5, 0, 2)); // Côté moyen geometry.faces.push(new THREE.Face3(3, 0, 5)); // Côté moyen assignUVs(geometry); ... (snipped)... function assignUVs(geometry) { geometry.faceVertexUvs[0] = []; geometry.faces.forEach(function(face) { var components = ['x', 'y', 'z'].sort(function(a, b) { return Math.abs(face.normal[a]) &gt; Math.abs(face.normal[b]); }); var v1 = geometry.vertices[face.a]; var v2 = geometry.vertices[face.b]; var v3 = geometry.vertices[face.c]; geometry.faceVertexUvs[0].push([ new THREE.Vector2(v1[components[0]], v1[components[1]]), new THREE.Vector2(v2[components[0]], v2[components[1]]), new THREE.Vector2(v3[components[0]], v3[components[1]]) ]); }); geometry.uvsNeedUpdate = true; } </code></pre> <p>Here what I get:</p> <p><a href="https://i.stack.imgur.com/6xRAq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6xRAq.png" alt="enter image description here"></a></p>
2
FTP files via CMD along with date created
<p>I have a batch file that ftp all the files in a particular directory on my server but when it is done with FTP, the date created of the file changes. Is there any way I can preserve this or perhaps concatenate it along with the file name? I need this info for further processing.</p> <p>Here is my batch file code:</p> <pre><code>@echo off echo open *ip* &gt;&gt; temp.txt echo *user* &gt;&gt; temp.txt echo *pass* &gt;&gt; temp.txt echo cd *directory* &gt;&gt; temp.txt echo lcd *localdirectory* &gt;&gt; temp.txt echo prompt no &gt;&gt; temp.txt echo mget *.q* &gt;&gt; temp.txt echo quit &gt;&gt; temp.txt ftp -s:temp.txt del temp.txt exit </code></pre>
2
Static files outside the wwwroot for .netcore app
<p>I'm using <a href="https://github.com/ebekker/ACMESharp">https://github.com/ebekker/ACMESharp</a> for my SSL at my @home web-server (it's free! :O). It was pretty manual, but noticed on the wiki it mentioned another project at <a href="https://github.com/Lone-Coder/letsencrypt-win-simple">https://github.com/Lone-Coder/letsencrypt-win-simple</a> which was a GUI for the automation of applying for, downloading, and installing of your SSL cert to your web-server.</p> <p>The method the GUI uses to validate the domain is yours, is by created a randomly named file with a random string of text within <code>[webroot]/.well-known/[randomFile]</code> w/o an extension. With the .dotnetcore application running on this [webroot], I am unable to serve the file, even after following the instructions for changing "Handler Mappings" under IIS.</p> <p>It seems like I can serve files by navigating directly to them at <code>[webRoot]/wwwroot/[whatever]</code> - so why can't I in <code>[webroot]/.well-known/[randomFile]</code>?</p> <p>Anyone know a way around this? I can delete the .netcore app, then run the SSL cert installation, but this installation needs to happen every 2-3 months, and since it's manual I'd prefer to figure out how to do it the right way.</p>
2
How to offset the message displayed in an empty table view
<p>I would like to show a message when my table is empty. I create a UILabel and set it to backgroundView of my tableView, however I would like to offset the text from the the tableView borders. I am trying this by reducing the UILabel Width when I create the label (see the code below) but that doesn't have any effect. </p> <p><a href="https://i.stack.imgur.com/UNSVv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UNSVv.png" alt="enter image description here"></a></p> <pre><code> override func numberOfSectionsInTableView(tableView: UITableView) -&gt; Int { if array.count &gt; 0 { self.tableView.separatorStyle = UITableViewCellSeparatorStyle.SingleLine return array.count } else { let messageLabel = UILabel(frame: CGRect(x: 20.0, y: 0, width: self.tableView.bounds.size.width - 40.0, height: self.tableView.bounds.size.height)) messageLabel.text = "This is the message I would like to display when there is nothing returned from my model" messageLabel.numberOfLines = 0 messageLabel.textAlignment = NSTextAlignment.Center messageLabel.sizeToFit() tableView.backgroundView = messageLabel self.tableView.separatorStyle = UITableViewCellSeparatorStyle.None } return 0 } </code></pre>
2
scipy.integrate.trapz and discontinuous functions
<p>The function <code>scipy.integrate.trapz</code> uses <em>Newton-Cotes formula of order 1</em> as it said in the scipy documentation. However, in the derivation of this formula it is usually assumed that</p> <ul> <li>the integrand is a continuous function and</li> <li>the points, in which the value of the integrand is known, are distinct.</li> </ul> <p>However, I tried to approximate the integral of the function <code>f:[0,2] --&gt; [0,2]</code>, defined by <code>f(x) = 0 if x &lt; 1 else 2</code> by calling</p> <pre><code>scipy.integrate.trapz([0, 0, 2, 2], [0, 1, 1, 2]) </code></pre> <p>and obtained the right result (<code>2.0</code>). In the upper call,</p> <ul> <li>an integrand is NOT a continuous function, and</li> <li>the points in which the value of the integrand is known, are NOT distinct.</li> </ul> <blockquote> <p>Can this "hack" be safely used in the way presented in the example?</p> </blockquote> <p>(For each point of discontinuity <code>x</code>, insert <code>x</code> twice in the list of points, and insert the left and right limit of the integrand into the corresponding places in the list of values.)</p>
2
Best way to authenticate/authorize users of a HANA application with LDAP (on-premise, not HCP)
<p>Running HANA on-premise I want to authenticate users in my xs-application against our existing LDAP-Server.</p> <p>Furthermore I need to read user-related information from LDAP (like the users group) and provide this information inside of my xs-application.</p> <p>What is the best way to do/configure this in HANA?</p>
2
How to display @ instead of being encoded as %40 (urlencode) in browser address bar?
<p>I've tried to use this line in Python3 (Flask) project, which is UTF-8 encoding:</p> <pre><code>@app.route('/@&lt;username&gt;', methods=['GET', 'POST']) </code></pre> <p>But in browser address bar, it always displays like:</p> <pre><code>http://example.com/%40username </code></pre> <p>How to display the original '@' in browser address bar? thanks!</p>
2
Display 3 posts in one loop for a Carousel Slider
<p>I want to display three posts in one loop so I can use a carousel slider. In this way I can wrap all the three posts in the loop with a so my carousel slider can see them as an item. How do I go about this? Here is my current loop:</p> <pre><code> &lt;div class="col-lg-5 col-md-4 col-sm-6"&gt; &lt;h3 class="mgntop"&gt;LATEST NEWS&lt;/h3&gt;&lt;br&gt; &lt;div id="owl-demo" class="owl-carousel owl-theme"&gt; &lt;?php $newsposts = get_posts('cat=4&amp;posts_per_page=3'); foreach($newsposts as $post) : setup_postdata($post); ?&gt; &lt;div class="newswidth newsbox item"&gt; &lt;h6&gt;&lt;a href="&lt;?php the_permalink(); ?&gt;"&gt; &lt;?php the_title(); ?&gt; &lt;/a&gt;&lt;/h6&gt; &lt;div class="boxelements"&gt; &lt;span class="fa fa-calendar"&gt; &lt;/span&gt; &lt;?php the_time(); ?&gt; &lt;/div&gt; &lt;p&gt; &lt;?php the_excerpt() ?&gt; &lt;/p&gt; &lt;a href="&lt;?php the_permalink(); ?&gt;"&gt; &lt;div class="more-btn"&gt;read more&lt;/div&gt; &lt;/a&gt; &lt;span class="fa fa-comments cmnt"&gt; &lt;?php comments_number('0','1','%'); ?&gt;&lt;/span&gt; &lt;/div&gt; &lt;?php endforeach; ?&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>This is my JQuery</p> <pre><code>jQuery(document).ready(function($) { $("#owl-demo").owlCarousel({ navigation : true, // Show next and prev buttons slideSpeed : 300, paginationSpeed : 400, items : 1, // itemsDesktop : false, // itemsDesktopSmall : false, // itemsTablet: false, // itemsMobile : false </code></pre> <p>});</p> <p>Thanks in anticipation!</p>
2
How to obtain the eigenvalues after performing Multidimensional scaling?
<p>I am interested in taking a look at the Eigenvalues after performing Multidimensional scaling. What function can do that ? I looked at the <a href="http://scikit-learn.org/stable/modules/generated/sklearn.manifold.MDS.html#sklearn.manifold.MDS" rel="nofollow">documentation</a>, but it does not mention Eigenvalues at all.</p> <p>Here is a code sample:</p> <blockquote> <pre><code>mds = manifold.MDS(n_components=100, max_iter=3000, eps=1e-9, random_state=seed, dissimilarity="precomputed", n_jobs=1) results = mds.fit(wordDissimilarityMatrix) # need a way to get the Eigenvalues </code></pre> </blockquote>
2
Account checkout-fields not working in woocommerce
<p>I am designing my selected fields in woocommerce checkout-form although some work fine but the fields associated with account are not working properly. I took help from <a href="https://stackoverflow.com/questions/31581310/wordpress-woocommerce-show-and-modify-account-fields-on-checkout-page">this</a> answer but still account fields didn't load properly. <a href="https://i.stack.imgur.com/q0Gf8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q0Gf8.png" alt="enter image description here"></a></p> <p>I am using this code for generating these fields in form-billing.php</p> <pre><code>woocommerce_form_field( 'account_username', $checkout-&gt;checkout_fields['account']['account_username'], $checkout-&gt;get_value( 'account_username') ); woocommerce_form_field( 'account_password', $checkout-&gt;checkout_fields['account']['account_password'], $checkout-&gt;get_value( 'account_password') ); woocommerce_form_field( 'account_password-2', $checkout-&gt;checkout_fields['account']['account_password-2'], $checkout-&gt;get_value( 'account_password-2') ); </code></pre> <p>any help would be appreciated. :)</p>
2
.join for possible empty Queue in python
<p>I'm trying to implement a <code>Queue</code> processing thread in python as follows:</p> <pre><code>from queue import Queue from threading import Thread import sys class Worker(Thread): def __init__(self, queue): # Call thread constructor self.queue = queue def run(self): while True: task = self.queue.get() # doTask() self.queue.task_done() queue = Queue() thread = Worker(thread) thread.start() while True: inp = user_input() if condition(inp): queue.put(sometask()) else: queue.join() thread.join() sys.exit(0) </code></pre> <p>In this example, suppose user decides to <code>exit</code> without adding any item to queue. Then my thread will be blocking at <code>self.queue.get</code> and I <code>queue.join()</code> won't work. Because of that, I can't perform a proper <code>exit</code>.</p> <p>How can I deal with this issue?</p>
2
Powershell write output of a program to a console live and pipe to a file
<p>I am running a fairly complex python script from a powershell script. I would like to both display the stdout and stderr streams of the .python script in the console in real time (ie as the .py script writes to them) and also write them to a file.</p> <p>My current solution looks like this:</p> <pre><code>Do-PreliminaryStuff log = &amp; ".\myPyScript.py" -myArgument "\this\that\thingy.txt" 2&gt;&amp;1 $log Write-Output $log $log | Out-File "$logDir\pyScriptLog.log" Do-RestOfScript </code></pre> <p>This has the problem that the text is only printed out after the .py script has finished, making it much harder to watch the progress of the .py script.</p> <p>Is there a way to somehow ..sample.. the pipeline as object go through it?</p>
2
How to add ng-click of angular for the element created by Jquery?
<p>Someone created custom tag in the project, such as </p> <p><code>&lt;mytable config='{head:[title1, title2],data:[[col1, col2]]}'&gt;&lt;/mytable&gt;</code> ,</p> <p>the tag above will generate a table after the page is loaded.</p> <p>I want to create a button in the table, then I insert the string : </p> <p><code>'&lt;button class="btn btn-primary" ng-click="lookup(3)"&gt;lookup&lt;/button&gt;';</code></p> <p>but the ng-click doesn't work. I write a simple code to mock it:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html ng-app="myApp"&gt; &lt;head&gt; &lt;script type="text/javascript" src="/javascripts/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/javascripts/angular/1.4.0/angular.min.js"&gt;&lt;/script&gt; &lt;script&gt; var create = function () { $('#template').html('&lt;button ng-click="changeName()"&gt;click me&lt;/button&gt;') } &lt;/script&gt; &lt;/head&gt; &lt;body ng-controller="myCtrl"&gt; &lt;span&gt;{{name}}&lt;/span&gt; &lt;div id="template"&gt;&lt;/div&gt; &lt;button onclick="create()"&gt;create&lt;/button&gt; &lt;script&gt; var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.name = "John"; $scope.changeName = function () { $scope.name = "Jack"; alert("success"); } }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I have googled and find the angular should compile the newly created element, but I don't know how to in this situation</p>
2
Change Google Chart Data and Appearance with button
<p>I am creating a project that requires being able to display multiple google donut charts with different values and colors for each chart. Currently, I am creating 3 charts that are navigated to with three buttons on separate html pages with the example google chart code:</p> <pre><code> &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.charts.load("current", {packages:["corechart"]}); google.charts.setOnLoadCallback(drawChart); function drawChart() { var data = google.visualization.arrayToDataTable([ ['Task', 'Hours per Day'], ['Work', 11], ['Sleep', 7] ]); var options = { title: 'My Daily Activities', pieHole: 0.95, slices: { 0: { color: 'yellow' }, 1: { color: 'transparent' } } }; var chart = new google.visualization.PieChart(document.getElementById('donutchart')); chart.draw(data, options); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="donutchart" style="width: 900px; height: 500px;"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>But providing different data in the <code>data</code> array and different colors in the <code>slices</code> array. </p> <p>Instead of having to create three separate charts with three separate html pages, is there a way to only use 1 chart and change the data and color of the one chart to three different sets of values by just using buttons and 1 html page? Ideally the solution would have multiple buttons that when clicked, would change the chart to include different sets of data and a different color chart to distinguish the different sets of data but I am not sure if this is possible or not.</p>
2
Track status of multiple async requests when using Spring @Async
<p>I am using spring boot for developing services in my application.</p> <p>I have a scenario where-in the request submitted to the back-end would take some time to complete.</p> <p>To avoid waiting the client I want to return the response immediately with a message your request has been accepted. The request would be in progress in a background thread.</p> <p>I see Spring provides the @Async annotation which can be used to create a separate processing thread from the main thread and using that I am able to offload the processing in a separate thread.</p> <p>What I want to do is when I return the initial response as accepted I also want to provide the client with a tracking key/token which the client can later use to check the status of the request.</p> <p>Since there can be multiple clients who would be accessing the service there should be a way of uniquely identifying each client's request from another.</p> <p>I see there is no such feature in Spring Async or Future which can return a tracking id as such. </p> <p>One possibility I see it to put the Future returned in HttpSession and later use that to check for the status by the client. But, I prefer not to use HttpSession and want my services to be stateless.</p> <p>Is there any way/approach I can accomplish my requirement.</p> <p>Thanks,</p> <p>BS</p>
2
How to retrieve a parameter value based on a result set from stored procedure in SSRS 2014?
<p>I would like to know how do I select a parameter based on the result set from a stored procedure. </p> <p>My code looks something like this:</p> <pre><code>CREATE PROCEDURE usp_UserInformation (@ReportRunDate DATE = NULL) AS WITH CTE AS ( SELECT -- some fields FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID WHERE RegisteredDate = DATEADD(MONTH, DATEDIFF(MONTH, -1, @ReportRunDate) - 2, -1) --I'll output the result set after applying all the logic like SELECT UserID, UserName, DOJ FROM CTE </code></pre> <p>Now, when the user selects the date on the report, I created another parameter and trying to retrieve records from the "Available Values" using 'Get values from a query'. I would like to show the list of UserIDs from the above query result set and allow the user SELECT based on that.</p> <p><a href="https://i.stack.imgur.com/kpOxd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kpOxd.jpg" alt="Parameters"></a></p> <p><a href="https://i.stack.imgur.com/EptiA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EptiA.jpg" alt="Available Values for Parameters"></a></p> <p><a href="https://i.stack.imgur.com/ZjYGc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZjYGc.jpg" alt="Values from Query"></a></p> <p><a href="https://i.stack.imgur.com/AneSm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AneSm.jpg" alt="Design View"></a></p> <p><a href="https://i.stack.imgur.com/AjcRc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AjcRc.jpg" alt="5th image"></a></p> <p><strong>UPDATE:</strong> I have created another stored procedure as there is no other alternative. Now my question is, how do I pass the second stored procedure value to the first one in WHERE clause?</p> <pre><code>CREATE PROCEDURE usp_UserInformation (@ReportRunDate DATE = NULL) AS WITH CTE AS ( SELECT -- some fields FROM Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID WHERE RegisteredDate = DATEADD(MONTH, DATEDIFF(MONTH, -1, @ReportRunDate) - 2, -1) --I'll output the result set after applying all the logic like SELECT User_ID, UserName, DOJ FROM CTE WHERE User_ID = EXEC usp_Get_UserID </code></pre> <p>I am looking for something like this where the user can select the ID first and any date of his choice in the report.</p> <p><a href="https://i.stack.imgur.com/QfCEw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QfCEw.jpg" alt="Report Parameters"></a></p> <p>PS: I am not allowed to write in-line SQL and only SPs are allowed. I don't want to create two SPs for the same report.</p>
2
PHP Amazon SES Email Verification
<p>Is there a way to verify email domain or send verification through API? I would like my client to confirm their email domain when they create an email campaign in my website.</p> <p>I am using PHP AWS SDK v2. <a href="http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-ses.html" rel="nofollow">http://docs.aws.amazon.com/aws-sdk-php/v2/guide/service-ses.html</a></p> <pre><code>$mailbox_email = '[email protected]'; $aws_client = \Aws\Common\Aws::factory(array( 'region' =&gt; 'eu-west-1', 'credentials' =&gt; array( 'key' =&gt; AWS_ACCESS, 'secret' =&gt; AWS_SECRET ) )); $ses_client = $aws_client-&gt;get('Ses'); $ses_result = $ses_client-&gt;verifyEmailIdentity(['EmailAddress' =&gt; $mailbox_email]); // Set bounces, complaint, deliveries notification $ses_client-&gt;setIdentityNotificationTopic(array( 'Identity' =&gt; $mailbox_email, 'NotificationType' =&gt; 'Bounce', 'SnsTopic' =&gt; 'arn:aws:sns:eu-west-1:9:ses_bounces' )); $ses_client-&gt;setIdentityNotificationTopic(array( 'Identity' =&gt; $mailbox_email, 'NotificationType' =&gt; 'Complaint', 'SnsTopic' =&gt; 'arn:aws:sns:eu-west-1:9:ses_complaints' )); $ses_client-&gt;setIdentityNotificationTopic(array( 'Identity' =&gt; $mailbox_email, 'NotificationType' =&gt; 'Delivery', 'SnsTopic' =&gt; 'arn:aws:sns:eu-west-1:9:ses_deliveries' )); $ses_client-&gt;SetIdentityFeedbackForwardingEnabled(array( 'Identity' =&gt; $mailbox_email, 'ForwardingEnabled' =&gt; false )); </code></pre>
2
Get Records from Kinesis using sequence number and partition ID
<p>I have written a code to get records from kinesis stream to a lambda function which gives an output payload of Data, partition ID and sequence number, then I try to invoke a second lambda to get the sequence number and partition ID from first Lambda, then the second lambda pulls the data from the kinesis stream. I'm stuck with getting data from kinesis stream using sequence number and partition ID.</p> <p>Below is the code for invoking one lambda to another.</p> <pre><code>public class LambdaFunctionHandler implements RequestHandler&lt;KinesisEvent, Object&gt; { private static final String regionName = "us-east-1"; private static final String functionName = "Test1"; @Override public Object handleRequest(KinesisEvent input, Context context) { context.getLogger().log("Input: " + input); List&lt;KinesisEventRecord&gt; records = input.getRecords(); for (KinesisEventRecord rec : records){ ByteBuffer recdata = rec.getKinesis().getData(); String data = new String( recdata.array(), Charset.forName("UTF-8") ); context.getLogger().log("Data: " +data); context.getLogger().log("Partition key: " +rec.getKinesis().getPartitionKey()); context.getLogger().log("Sequence Number: " +rec.getKinesis().getSequenceNumber()); } //call another lambda function try { AWSLambdaClient lambda = new AWSLambdaClient(); Region region = Region.getRegion(Regions.fromName(regionName)); lambda.setRegion(region); InvokeRequest invokeRequest = new InvokeRequest(); invokeRequest.setFunctionName(functionName); invokeRequest.setPayload("\" AWS Lambda Test - internal call\""); System.out.println( lambda.invoke(invokeRequest).getPayload()); } catch (Exception e) { System.out.println(e.getMessage()); } // TODO: implement your handler return null; } } </code></pre> <p>here is the code which i have tried for get records using sequence number and partition ID.</p> <pre><code>public class LambdaFunctionHandler implements RequestHandler&lt;KinesisEvent, Object&gt; { private static final String streamName = "Test"; private static final String partitionKey = "123456676454"; private static final String sequenceNumber = "12345" public Object handleRequest(KinesisEvent input, Context context) { context.getLogger().log("Input: " + input); GetRecordsRequest getRecordsRequest = new GetRecordsRequest(); getRecordsRequest.setStreamName(streamName); getRecordsRequest.setPartitionKey(partitionKey); getRecordsRequest.setsequenceNumber(sequenceNumber); KinesisEvent.getRecord(getRecord); } } </code></pre> <p>please let me know a way to get records from the kinesis stream using sequence number and partition ID.</p>
2
"Null correlation not allowed" when trying to use bean with @CorrelationStrategy annotation
<p>I am new to Spring Integration and am trying to use Java DSL configuration to specify a flow that aggregates messages using an class GroupPublishAggregator that has @Aggregator, @ReleaseStrategy, and @CorrelationStrategy annotations. </p> <p>I suspect that I'm making a newbie mistake in the configuration, because what I see when the aggregator receives a message is "java.lang.IllegalStateException: Null correlation not allowed. Maybe the CorrelationStrategy is failing?" If I debug the framework code, I see that the AbstractCorrelatingMessageHandler is invoking the default org.springframework.integration.aggregator.HeaderAttributeCorrelationStrategy instead of my strategy.</p> <p>The configuration code looks like:</p> <pre><code>@Bean public GroupPublishAggregator publishAggregator() { // This class has methods with @Aggregator, @ReleaseStrategy, // and @CorrelationStrategy annotations. return new GroupPublishAggregator(); } @Bean public IntegrationFlow publish() { return IntegrationFlows.from(this.inputChannel()) .wireTap("monitor") .aggregate(new Consumer&lt;AggregatorSpec&gt;() { @Override public void accept(AggregatorSpec aggregatorSpec) { aggregatorSpec.processor(publishAggregator(), null); } }) .get(); } </code></pre>
2
Entity framework: disable delete globally
<p>We are starting a new application. We want to use Entity Framework. We are little afraid of deleting sql rows accidentally (especially by set related data accidentally etc.)</p> <p>I thought to disable every delete, since we just mark every row with "validUntil" column and never delete rows.</p> <p>I saw <a href="https://stackoverflow.com/q/20309150/3202422">that it can done by roles in sql</a>, but I want that all logic and control will be just in code.</p> <p>Maybe in Entity Framework core there is new feature to enable that? I know that it can still write row sql with EF, but we don't afraid of such case.</p> <p>I also tried remove setters of entities relationships to be more relax, but it broke the normal functionality of EF, and did not look like a good idea.</p> <p>I saw in the above link a recommendation to use the Repository Pattern, but <a href="https://softwareengineering.stackexchange.com/a/220126">here</a> it looks like it is not good practice.</p> <p>How can I work safely with EF? thanks!</p>
2
Trying to validate archive in Xcode - What certificate is missing?
<p>Since I last distributed an app on App Store, I have changed Mac. (When doing so, I automatically moved all files from the old to the new one)</p> <p>When I now try to validate an archive prior send to appStore, I get this annoying message</p> <p><a href="http://i.stack.imgur.com/d4DbC.png" rel="nofollow">"Missing iOs distribution signing identity for (my name)" Image here</a> I have checked all provisioning profiles and they seem to be there.</p> <p>Question is: Should I have exported the developer profile from old Xcode on old Mac and import on new Mac even though I moved over all old files?</p> <p>Preferences in Xcode looks like this. <a href="http://i.stack.imgur.com/7zh2w.png" rel="nofollow">Where is says "ios develoment" and "ios distribution" there is a button saying "reset" See image here</a></p> <p><strong>I guess "reset" means I am still lacking something although I have been dowloading all profiles needed to take me this far in the signing routine?</strong></p> <p>Please help if you can. I have been spending so much time with this. (I have access to olf Mac, still, but it is some distance away)</p>
2
Could not convert socket to TLS on Apache Commons Mail
<p>I have a problem connecting to a SMTP Server with Apache Commons Mail. I have tried everything but the only thing I can find online is for Java Mail. This is my error: </p> <blockquote> <p>Caused by: javax.mail.MessagingException: Could not convert socket to TLS; nested exception is: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</p> </blockquote> <p>I have seen that you can fix the issue on Java Mail with <code>props.put("mail.smtp.ssl.trust", "smtp.gmail.com");</code> for example, but I can't a equivalent command to use on Apache Commons. </p>
2
iOS GPS track users location realtime
<p>I'm building an iOS app that needs access to the location of the two users: driver and passenger. This app will be quite similar to Uber app where the passenger requests for a driver nearby to pick him up and eventually track the location of the driver real time. I'm new with location based app, so I would like to ask for best approach to do this. So here's my algorithm so far:</p> <ol> <li>Passenger app requests for driver by sending his current location to the server</li> <li>Server queries the nearest driver and sends push notification message to the selected driver</li> <li>Driver receives the push notification message and sends confirmation back to the server</li> <li>Server sends the details to the passenger</li> <li>Driver starts sending his location to the server (every 10secs) thru REST API request</li> <li>Server sends the drivers location to the passenger thru push notification</li> </ol> <p>Thanks</p>
2
How do I create a reference to an object before the object's element in FXML?
<p>I have two objects defined in an FXML document. I want one of them to have a reference, also defined in FXML, to the other. The FXML element of the object that has the other object comes first in the document. When loaded via javafx.fxml.FXMLLoader, the property is left unassigned. It <em>does</em> assign the property if the object that has the other object comes second. Is there a way to assign an object reference to the property of an object that comes earlier in the FXML document?</p> <p>Here's a minimal complete verifiable example. The object that has a reference to another and comes before it doesn't get its property assigned and when tested it's null. The one that comes after the object it references does get its property assigned and prints out the toString() of the object.</p> <p>issue.fxml: </p> <pre><code>&lt;?import java.lang.*?&gt; &lt;?import java.util.*?&gt; &lt;?import javafx.scene.*?&gt; &lt;?import javafx.scene.control.*?&gt; &lt;?import javafx.scene.layout.*?&gt; &lt;?import test.control.*?&gt; &lt;HBox xmlns:fx="http://javafx.com/fxml/1" id="pane1" prefHeight="400.0" prefWidth="600.0"&gt; &lt;FriendlyButton fx:id="priorObjectReference" friend="$normalButton" /&gt; &lt;Button fx:id="normalButton" /&gt; &lt;FriendlyButton fx:id="subsequentObjectReference" friend="$normalButton" /&gt; &lt;/HBox&gt; </code></pre> <p>FXMLIssue.java, loads above FXML and tries to print the object references:</p> <pre><code>import java.io.IOException; import java.nio.file.Paths; import java.util.logging.Level; import java.util.logging.Logger; import javafx.application.Application; import javafx.application.Platform; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.control.Button; import javafx.stage.Stage; import test.control.FriendlyButton; public class FXMLIssue extends Application { @Override public void start(Stage stage) { Parent container = null; try { container = FXMLLoader.load(Paths.get("issue.fxml").toUri().toURL()); } catch (IOException ex) { Logger.getLogger(FXMLIssue.class.getName()).log(Level.SEVERE, "Failed to load file.", ex); Platform.exit(); } FriendlyButton priorObjectReference = (FriendlyButton) container.lookup("#priorObjectReference"); System.out.println(priorObjectReference.getFriend() == null ? "priorObjectReference's friend property wasn't loaded from FXML" : "priorObjectReference's friend is: " + priorObjectReference.getFriend().toString()); FriendlyButton subsequentObjectReference = (FriendlyButton) container.lookup("#subsequentObjectReference"); System.out.println(subsequentObjectReference.getFriend() == null ? "subsequentObjectReference's friend property wasn't loaded from FXML" : "subsequentObjectReference's friend is: " + subsequentObjectReference.getFriend().toString()); Platform.exit(); } public static void main(String[] args) { launch(args); } } </code></pre> <p>FriendlyButton.java, just a class that has a property that refers to another object in FXML:</p> <pre><code>package test.control; import javafx.scene.control.Button; public class FriendlyButton extends Button { private Button mFriend; public Button getFriend() { return mFriend; } public void setFriend(Button friend) { mFriend = friend; } } </code></pre>
2
Use an Image as a watermark in iText 7
<p><a href="http://itextpdf.com/itext7" rel="nofollow">iText 7</a> just came out May 2016, and while some of the tutorials have been helpful, some of the more advanced functions have been harder to figure out. <a href="http://developers.itextpdf.com/content/itext-7-jump-start-tutorial/chapter-3-using-renderers-and-event-handlers" rel="nofollow">This page</a> has an example of how to use text as a watermark (about 90% of the way down the page), but I can't figure out how to use an Image as a watermark, and I really have no idea where to start with the new release. Anyone know how to use an Image as a watermark in iText 7? Any ideas where to start?</p>
2
Updating junit gives compilation error at @Rule and TestName
<p>Have been using <code>@Rule</code> from <code>junit</code> using <code>4.12</code>. But today updated to 4.5</p> <pre><code> &lt;!-- https://mvnrepository.com/artifact/junit/junit --&gt; &lt;dependency&gt; &lt;groupId&gt;junit&lt;/groupId&gt; &lt;artifactId&gt;junit&lt;/artifactId&gt; &lt;version&gt;4.5&lt;/version&gt; &lt;/dependency&gt; </code></pre> <p>Getting error on compiling the code on </p> <pre><code>@Rule public TestName name = new TestName(); </code></pre> <blockquote> <p>package org.junit.rules does not exist </p> <p>cannot find symbol [ERROR] symbol: class Rule [ERROR] location: package org.junit</p> </blockquote> <p>Has this been removed? Any alternatives to it?</p>
2
Best practice translate CakePHP 3.x __ Function
<p>Using the __('') function is really nice. But I am wondering how can I translate whole paragraphs with links and highlighting in it. For example:</p> <pre><code>&lt;p&gt;&lt;?= __('Bla bla text in german bla bla ')?&gt; &lt;a href="/user"&gt;Account&lt;/a&gt; text bla bla &lt;b&gt;bla&lt;/b&gt;.&lt;/p&gt; </code></pre> <p>Appart from the link (I know I should use Cake HTML Helper, how to work with this? For translation in diffrent languages it sucks to translate arround these blocks, because the translater sometimes doesnt know the context.</p> <p>Is this what I am looking for? <a href="http://book.cakephp.org/3.0/en/orm/behaviors/translate.html" rel="nofollow">http://book.cakephp.org/3.0/en/orm/behaviors/translate.html</a> I am developing in the views - so I am not writing content to the DB with add etc. Maybe this is my first problem?</p>
2
Android custom notification not showing code changes
<p>There's some weird behavior here. I've got a bunch of code, pictures, followed by some description of the weird behavior and <strong>then</strong> my questions.</p> <p><strong>Files</strong></p> <p>I have a file <code>random_start_bonus_cards_notification.xml</code>, which looks like:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="5dp" android:gravity="center"&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/firstCard" /&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/secondCard" /&gt; &lt;LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/ifNotCoal" android:visibility="gone"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="(" android:paddingTop="15dp" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/if_not_coal" android:paddingTop="15dp" /&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/thirdCard" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text=")" android:paddingTop="15dp" /&gt; &lt;/LinearLayout&gt; </code></pre> <p></p> <p>And a file <code>random_start_bonus_cards.xml</code></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"&gt;&lt;/RelativeLayout&gt; </code></pre> <p>This is a deliberately blank layout, because of weirdness we'll get into. It turns out this file has to be here, but it doesn't matter what it contains.</p> <p>Annnnd my <code>styles.xml</code>:</p> <pre><code>&lt;resources&gt; &lt;style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"&gt; &lt;/style&gt; &lt;style name="NotificationTitle"&gt; &lt;item name="android:textColor"&gt;?android:attr/textColorPrimaryInverse&lt;/item&gt; &lt;item name="android:textStyle"&gt;bold&lt;/item&gt; &lt;/style&gt; &lt;style name="NotificationText"&gt; &lt;item name="android:textColor"&gt;?android:attr/textColorPrimaryInverse&lt;/item&gt; &lt;/style&gt; </code></pre> <p></p> <p>And some Android code:</p> <pre><code> private void showStartBonusCardsDialog(DrawnCards drawnCards) { LayoutInflater factory = LayoutInflater.from(CalculatorActivity.this); final View dialogContent = factory.inflate(R.layout.random_start_bonus_cards_notification, null); ((ImageView) dialogContent.findViewById(R.id.firstCard)).setImageResource(getDrawableIdForStartCard(drawnCards.firstCard())); ((ImageView) dialogContent.findViewById(R.id.secondCard)).setImageResource(getDrawableIdForStartCard(drawnCards.secondCard())); if(drawnCards.hasThirdCard()) { dialogContent.findViewById(R.id.ifNotCoal).setVisibility(View.VISIBLE); ((ImageView) dialogContent.findViewById(R.id.thirdCard)).setImageResource(getDrawableIdForStartCard(drawnCards.thirdCard())); } else { dialogContent.findViewById(R.id.ifNotCoal).setVisibility(View.GONE); } AlertDialog drawnCardsDialog = new AlertDialog.Builder(CalculatorActivity.this).create(); drawnCardsDialog.setView(dialogContent); drawnCardsDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); drawnCardsDialog.show(); } private void showStartBonusCardsNotification(DrawnCards drawnCards) { Intent openIntent = new Intent(CalculatorActivity.this, CalculatorActivity.class); openIntent.setAction(refreshStartCardsAction); PendingIntent openPendingIntent = PendingIntent.getActivity(this, 0, openIntent, 0); RemoteViews notificationView = new RemoteViews(getPackageName(), R.layout.random_start_bonus_cards_notification); notificationView.setImageViewResource(R.id.firstCard, getDrawableIdForStartCard(drawnCards.firstCard())); notificationView.setImageViewResource(R.id.secondCard, getDrawableIdForStartCard(drawnCards.secondCard())); if(drawnCards.hasThirdCard()) { notificationView.setViewVisibility(R.id.ifNotCoal, View.VISIBLE); notificationView.setImageViewResource(R.id.thirdCard, getDrawableIdForStartCard(drawnCards.thirdCard())); } else { notificationView.setViewVisibility(R.id.ifNotCoal, View.GONE); } NotificationCompat.Builder notification = new NotificationCompat.Builder(this); notification.setVisibility(NotificationCompat.VISIBILITY_PUBLIC); notification.setSmallIcon(R.drawable.white); notification.setContentIntent(openPendingIntent); notification.setContent(notificationView); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); int notificationId = 1; notificationManager.notify(notificationId, notification.build()); } </code></pre> <p>And here's two screenshots to refer to: <a href="https://i.stack.imgur.com/J3iiF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/J3iiF.png" alt="Dialog"></a> <a href="https://i.stack.imgur.com/hdWfZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hdWfZ.png" alt="Notification"></a></p> <p><strong>Weirdness</strong></p> <p>I initially had just one layout file, since the layouts were identical. With this, the text colour of the dialog was black (good) and the text colour of the notification was white and couldn't be read on my HTC M9.</p> <p>(1) If I put the XML from <code>random_start_bonus_cards_notification.xml</code> into <code>random_start_bonus_cards.xml</code>, and replace all usages of <code>random_start_bonus_cards_notification</code> with <code>random_start_bonus_cards</code>, the text colours are wrong. If I keep the code as-is, but delete <code>random_start_bonus_cards</code>, the text colours are wrong. If I use <code>random_start_bonus_cards_notification.xml</code> and keep <code>random_start_bonus_cards.xml</code> in the project, even if it's empty, <em>I get black text in both the dialog and notification!</em></p> <p>(2) The background on the notification is a pale green. This colour was in the resource file at one point, but has been removed (as shown). After removing the background colour the dialog layout has a white background, but the notification background is still pale green, no matter whether I change it to red or anything.</p> <p>(3) If I stop calling the dialog code, the same behavior occurs. I've included the dialog code since I'm worried there might be some interaction here, but I don't see how.</p> <p><strong>Questions</strong></p> <p>Generally, how does RemoteViews work with custom notification layouts? Is there any kind of system caching that could account for the background colour not changing?</p> <p>Why is my notification not changing background colour when I change the layout background colour?</p> <p>Why does my app change behavior when I delete this empty file <code>random_start_bonus_cards.xml</code>, that isn't even being used?</p> <p>Why does my notification text colour not work unless I use the file named <code>random_start_bonus_cards_notification.xml</code>? (If I remove the <code>_notification</code>, the text changes colour).</p> <p>Thanks for reading!</p>
2
Dynamically create NSString with Unicode emoji
<p>I have the string <code>@"Hi there! \U0001F603"</code>, which correctly shows the emoji like <code>Hi there! </code> if I put it in a <code>UILabel</code>.</p> <p>But I want to create it dynamically like <code>[NSString stringWithFormat:@"Hi there! \U0001F60%ld", (long)arc4random_uniform(10)]</code>, but it doesn't even compile. If I double the backslash, it shows the Unicode value literally like <code>Hi there! \U0001F605</code>.</p> <p>How can I achieve this?</p>
2
Django forms in ReactJs
<p>Is there any way I can use Django forms inside a ReactJS script, like include <code>{{ form }}</code> in the JSX file? </p> <p>I have a view which displays a from and it is rendered using React. When I load this page from one page the data in these fields should be empty, but when I hit this view from another page I want date to be prefilled in this form. I know how to do this using Django forms and form views, but I am clueless where to bring in React.</p>
2
How to do RSA encryption for IOS using Ionic
<p>I'm developing a native android app and hybrid IOS app. I'm encrypting the password before sending the request to BL. Below is my native code.</p> <pre><code>public String Encrypt (String plain) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { try { AssetManager assets = context.getAssets(); byte[] key = readFully( assets.open("encryption.der", AssetManager.ACCESS_BUFFER)); KeySpec publicKeySpec = new X509EncodedKeySpec(key); KeyFactory kf = KeyFactory.getInstance("RSA"); Key pk = kf.generatePublic(publicKeySpec); Cipher cipher = Cipher.getInstance("RSA"); cipher.init(Cipher.ENCRYPT_MODE, pk); ByteArrayOutputStream out = new ByteArrayOutputStream(); CipherOutputStream cout = new CipherOutputStream(out, cipher); try { cout.write(plain.getBytes(UTF_8)); cout.flush(); }catch (Exception e){ e.printStackTrace(); }finally { try { cout.close(); } catch (IOException e) { e.printStackTrace(); } } encrypted = new String(encode(out.toByteArray(), DEFAULT), "UTF-8"); return encrypted; } catch (IOException e) { e.printStackTrace(); } catch (InvalidKeySpecException e) { e.printStackTrace(); } return null; } static byte[] readFully(InputStream inputStream) throws IOException { InputStream in = new BufferedInputStream(inputStream); byte[] tmp = new byte[1024]; int readLen, size = 0; ByteArrayOutputStream out = new ByteArrayOutputStream(); while ((readLen = in.read(tmp)) != -1) { if (((long) size + readLen) &gt; Integer.MAX_VALUE) { // woah! did we just ship an app of 2GB? throw new IllegalStateException("Invalid file. File size exceeds expected " + "maximum of 2GB"); } size += readLen; out.write(tmp, 0, readLen); } return out.toByteArray(); } </code></pre> <p>I have my key in encryption.der file. Everything works fine in android. Now coming to IOS which I'm using Ionic to develop. I'm not able to achieve the encryption part. I have used the "cryptico" : link : <a href="https://github.com/wwwtyro/cryptico/blob/master/README.md" rel="nofollow">https://github.com/wwwtyro/cryptico/blob/master/README.md</a> . And finally converting to Base64 like these.</p> <pre><code>var EncryptionPassword = cryptico.encrypt($scope.userInfo.Password, publicKey); $scope.encPass = base64.encode(EncryptionPassword.cipher); </code></pre> <p>But I'm getting ArrayIndexOutOfBound Exception from BL. Can you suggest exact same solution has android for angularjs too. So RSA encrytion works on both IOS and Android.</p>
2
How to set a GCS object lifecycle for all objects below a path, not bucket-wide?
<p>The <a href="https://cloud.google.com/storage/docs/lifecycle" rel="noreferrer">docs</a> only mention setting an object lifecycle for an entire bucket. However I want to set lifecycles for several paths within a bucket, but not for the entire bucket.</p> <p>Is this possible on Google Cloud Storage? If so, how can I do it?</p>
2
istanbul with webpack, mocha
<p>I'm using mocha-webpack to run my tests for a react project. The reason I"m not just specifying babel in the call to mocha is that I have jsx that references svg files and that blows up when I do it that way. mocha-webpack works fine. But I can't get it to work with istanbul. I have replaced the babel-loader with bable-istanbul-loader, and the compiles and executes the tests but it doesn't output the coverage folder anywhere.</p> <p>Also, babel-istanbul seems to want to use karma, but I don't use karma since I'm testing in the browser.</p> <p>loader looks like this:</p> <pre><code> { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-istanbul' }, </code></pre> <p>package.config says</p> <pre><code>"test": "mocha-webpack --webpack-config ./app/webpack.config-testing.js", </code></pre>
2
Is it possible to apply an other tag to a dependency role?
<p>I have a playbook like that, with one role per client.</p> <pre><code>- hosts: hosting roles: - { role: client1, tags: ['client1'] } - { role: client2, tags: ['client2'] } </code></pre> <p>And on each role, I have a dependency on nginx for example.</p> <pre><code>/roles/client1/meta/main.yml dependencies: - nginx </code></pre> <p>I would like to <strong>not launch</strong> the nginx role when it is not necessary. So I have added the nginx tag to the dependency.</p> <pre><code>/roles/client1/meta/main.yml dependencies: - { role: nginx, tags: ['system'] } </code></pre> <p>But when I launch the playbook with the tag client1, the nginx role is executed. Is there a solution to avoid that ?</p> <p>I know a can "export" the dependency on the playbook, it works good, but it's not a nice solution I think.</p> <pre><code>- hosts: hosting roles: - { role: nginx, tags: ['system'] } - { role: client1, tags: ['client1'] } - { role: client2, tags: ['client2'] } </code></pre>
2
script tag breaks sightly data-sly tag in author mode
<p>I am using angular with sightly. So I have angular html template surrounded by script tag, which also has sightly attributes like data-sly-resource. Below example code will give you clear idea.</p> <pre><code> &lt;script type="text/ng-template" id="example.html"&gt; &lt;section data-sly-resource="${ @path='textOverImage', resourceType='example/components/textOverImage'}" id="textOverImage" &gt; &lt;div ng-include="'private/textOverImage.html'" data-sly-test="${!wcmmode.edit}"&gt;&lt;/div&gt; &lt;/section&gt; &lt;/script&gt; </code></pre> <p>It works fine in non-edit mode , but in edit mode, I can not author data-sly-resource part. It looks like <code>&lt;script&gt;</code> tag is not letting it work roperly because when I remove <code>&lt;script&gt;</code> tag ,than I can author it.</p> <p>And removing script tag is not an option as well.</p> <p>So how can I stop script tag form breaking sightly functionality in edit mode?</p>
2
How to serve front end with koa?
<p>I'm trying to serve a front end with Koa (v2). Eventually, I want to use React. But for now, I'm simply trying to serve a simple html file. </p> <p>app/index.html</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta charset="utf-8"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Hello World&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>server.js</p> <pre><code>import 'babel-polyfill'; import koa from 'koa'; import koaRouter from 'koa-router'; import serve from 'koa-static'; import mount from 'koa-mount'; const app = new koa(); const router = new router({ prefix: '/koa' }); // This route works router.get('/', async (ctx) =&gt; { ctx.body = 'Hello from Koa!'; }); app.use(router.routes()); const front = new koa(); // This route doesn't work. front.use(serve(__dirname + '/app')); // However, this will work, so then, I'm not using koa-serve correctly? // front.use(async (ctx) =&gt; { // ctx.body = "Mount this."; // }); app.use(mount('/', front)); app.listen(3000); </code></pre> <p>So how do I serve the front-end?</p>
2
How to configure Spring WebSocket in cluster
<p>I have configured Spring Websocket over Stomp in my project. </p> <p>My enviroment have 2 cluster node and one balancer. How can configure the spring websocket in cluster mode?</p> <p>Thanks in advance</p>
2
How do I get File Name to load in the listbox as a listbox item without loading the filename extension?
<p>The plugins I am loading have to be loaded on the listbox on the left and they have to be loaded without the filename extension. </p> <p>So </p> <blockquote> <p>"FirstPlugin.dll"</p> </blockquote> <p>would load as </p> <blockquote> <p>"FirstPlugin"</p> </blockquote> <p><a href="http://i.stack.imgur.com/3oopg.png" rel="nofollow">When I load the file name without extension in the code I tried, either it loads just the name and does not execute or it just loads the file name with the extension.</a> </p> <p>Here's the code behind: </p> <pre><code>using System.Collections.Generic; using System.Windows; using System.Windows.Controls; using PluginContracts; using System; using System.IO; using Microsoft.Win32; using System.ComponentModel.Composition; using System.ComponentModel.Composition.Hosting; using System.Reflection; using System.Diagnostics; using System.Linq; namespace SimplePlugin { /// &lt;summary&gt; /// Interaction logic for MainWindow.xaml /// &lt;/summary&gt; public partial class MainWindow : Window { Dictionary&lt;string, IPlugin&gt; _Plugins; // move to class scope public MainWindow() { InitializeComponent(); _Plugins = new Dictionary&lt;string, IPlugin&gt;(); } private void AssembleComponents(object sender) { string selection = ""; if (sender is ListBox) { if (((ListBox)sender).SelectedValue != null) selection = ((ListBox)sender).SelectedValue.ToString(); } string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins"); DirectoryCatalog cat = new DirectoryCatalog(path); //ICollection&lt;IPlugin&gt; plugins = PluginLoader.LoadPlugins("Plugins"); ICollection&lt;IPlugin&gt; plugins = GenericPluginLoader&lt;IPlugin&gt;.LoadPlugins("Plugins"); foreach (var item in plugins) { //add only if not already present if (!_Plugins.ContainsKey(item.Name)) { string dllName = GetDLLName(item.Name); Button b = new Button() { Name = dllName.Replace(".", "").ToUpper(), Content = item.Name, Visibility = System.Windows.Visibility.Hidden }; b.Click += b_Click; PluginGrid.Children.Add(b); _Plugins.Add(item.Name, item); // this.PluginGrid.Children.Clear(); //by Vasey } } // make visible the selected plugin button foreach (var ctl in PluginGrid.Children) { if (ctl is Button) { Button button = (Button)ctl; if (button.Name.Equals(selection.Replace(".", "").ToUpper())) { button.Visibility = System.Windows.Visibility.Visible; } else { button.Visibility = System.Windows.Visibility.Hidden; } } } } private void b_Click(object sender, RoutedEventArgs e) { Button b = sender as Button; if (b != null) { string key = b.Content.ToString(); if (_Plugins.ContainsKey(key)) { IPlugin plugin = _Plugins[key]; plugin.Do(); } } } private void addPlugin_Click(object sender, RoutedEventArgs e) { //Calls OpenFile Method OpenFile(); } private void OpenFile() { _Plugins = new Dictionary&lt;string, IPlugin&gt;(); ICollection&lt;IPlugin&gt; listbox = GenericPluginLoader&lt;IPlugin&gt;.LoadPlugins("Plugins"); var fileDialog = new OpenFileDialog(); fileDialog.Multiselect = true; fileDialog.Filter = "All files (*.*)|*.*|DLL files (*.dll)|*.dll|CS Files (*.cs)|*.cs"; if (fileDialog.ShowDialog() == true) { string filename = fileDialog.FileName; var ext = System.IO.Path.GetFileNameWithoutExtension(filename); // ListBox lbFiles = new ListBox(); //this.Controls.Add(lbFiles); //lbFiles.Size = new System.Drawing.Size(200, 100); //lbFiles.Location = new System.Drawing.Point(10, 10); lbFiles.Items.Add(System.IO.Path.GetFileName(filename)); //foreach (var item in listbox) //{ // //add only if not already present // if (!_Plugins.ContainsKey(item.Name)) // { // string dllName = GetDLLName(item.Name); // ListBox lbName= new ListBox() // { // Name = dllName.Replace(".", "").ToUpper(), // }; // //lbFiles.Items.Add(item.Name); // PluginGrid.Children.Add(lbName); // _Plugins.Add(item.Name, item); // // this.PluginGrid.Children.Clear(); // //by Vasey // } //} //Calls CopyToDir method and copies dll's to Plugin Folder CopyToDir(filename); } } private void CopyToDir(string filename) { string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Plugins"); Console.WriteLine(path); //Check the directory exists if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } try { FileInfo fi = new FileInfo(filename); if (!File.Exists(System.IO.Path.Combine(path, fi.Name))) { File.Copy(fi.FullName, System.IO.Path.Combine(path, fi.Name)); } } catch (Exception ex) { throw ex; } } // Get linkage between ListBox's DLL name list and the loaded plugin names string GetDLLName(string name) { string ret = ""; name = name.Replace(" ", ""); // strip spaces Assembly asm = AppDomain.CurrentDomain.GetAssemblies(). SingleOrDefault(assembly =&gt; assembly.GetName().Name == name); if (asm != null) { ret = Path.GetFileNameWithoutExtension(asm.Location); } return ret; } private void lbFiles_SelectionChanged(object sender, SelectionChangedEventArgs e) { AssembleComponents(sender); } private void ClearBtn_Click(object sender, RoutedEventArgs e) { try { // Clears the ListBox lbFiles.Items.Clear(); //Clears the Assembly this.PluginGrid.Children.Clear(); //Loads next Assembly _Plugins = new Dictionary&lt;string, IPlugin&gt;(); } catch { System.Windows.MessageBox.Show("No Items to Clear"); } } private void RemoveSelectedItem_Click(object sender, RoutedEventArgs e) { try { lbFiles.Items.RemoveAt(lbFiles.SelectedIndex); } catch { System.Windows.MessageBox.Show("No Items to Remove"); } } } } </code></pre> <p>How do I get File Name into the listbox and work without the extension? </p>
2
How do I convert rows to columns, and repeat the adjacent cells?
<p>I'm sorry if the title is confusing, but a visual should hopefully help:</p> <p>Here's what my sheet looks like:</p> <pre><code> A B C D 1 x y z t 2 q w e r 3 y u i o </code></pre> <p>I need to generate a separate sheet wherein:</p> <pre><code> A B C 1 x y t 2 x z t 3 q w r 4 q e r ... </code></pre> <p>Basically, I need the middle two columns of the original sheet to be transposed and the adjacent columns to it pulled into my new sheet as well (as duplicate rows).</p> <p>I have the transpose working correctly, and when I pull the adjacent columns that works too. The issue is, I can't autofill the sheet. When I try to drag &amp; autofill, instead of autofilling using row 2 from the original sheet, the new sheet will autofill using row 3 (which is the same row # in the new sheet).</p> <p>Please let me know if this isn't making sense, I'll try to explain better! I'm not very well versed in the Google Spreadsheets scripts - I've tried before but they seem rather cumbersome. But I'm happy to try that as well.</p>
2
Get IP with just knowing MAC address
<p>I'm trying to write a batch file, that gives me an IP back, but I just know the MAC address</p> <pre><code>arp -a </code></pre> <p>wont work for me, because I never pinged that IP before. I want to search for it in the network with literally just knowing the MAC address.</p> <blockquote> <p>Information: The IP is static.</p> </blockquote>
2
How to use .csslintrc in Atom's CSSLint to ignore rules?
<p>I'm using <a href="https://github.com/steelbrain/linter" rel="nofollow noreferrer">Linter</a> with <a href="https://github.com/AtomLinter/linter-csslint" rel="nofollow noreferrer">Linter-CSSlint</a> in Atom (windows) and I want to prevent some warnings globally (like &quot;ids&quot;).</p> <p>In CSSlint's readme says that it supports <code>.csslintrc</code> but I can't find info of <em>where</em> should I put this <code>.csslintrc</code> file.</p> <p>I saw a <code>.csslintrc</code> file inside:</p> <pre><code>.atom \packages \linter-csslint \spec \fixtures \project </code></pre> <p>with this inside: <code>--errors=empty-rules</code></p> <p>But adding there some rules there doesn't do anything. Rules like:</p> <pre><code>--errors=empty-rules { &quot;ids&quot;: false, &quot;box-model&quot;: false, } </code></pre> <p>Can somebody point me in the right direction?</p> <p>Thanks!</p>
2
JSON Schema: XOR on required fields
<p>JSON Schemas have <a href="https://spacetelescope.github.io/understanding-json-schema/reference/object.html#required" rel="nofollow">a <code>required</code> property</a>, which lists the required fields in a JSON object. For example, the following (simplified) schema validates a call that sends a text message to a user:</p> <pre><code>{ "type": "object", "properties": { "userId": { "type": "string" }, "text": { "type": "string" }, }, "required": ["userId", "text"] } </code></pre> <p>Suppose that I want to enable sending the message to multiple users, i.e. have either a <code>userId</code> field, or an array of <code>userIds</code> (but not both or neither). Is there a way to express such a condition in a JSON Schema?</p> <p>Naturally, there are ways to overcome the problem in this case - for example, a <code>userId</code> array with a single element - but the general case is interesting and useful.</p>
2
Redirecting stdout of EOF
<p>I want to redirect the error and output streams to <code>/dev/null</code> and I used <code>2&gt;&amp;1 /dev/null</code> in my script file (below) but I am getting error as</p> <pre><code>"UPDATE 1 UPDATE 1 UPDATE 1 UPDATE 1 ERROR: syntax error at or near "EOF" LINE 1: EOF 2&gt;&amp;1 /dev/null" ^ </code></pre> <p>How to redirect stdout?</p> <h1>File:</h1> <pre><code>psql -h xx.xx.xx.xx -U postgres -d dbname &lt;&lt; update rhq_alert_condition set threshold = $critical_threshold where alert_definition_id = $critical_id; update rhq_alert_condition set threshold = $critical_threshold where alert_definition_id = $critical_recovery_id; update rhq_alert_condition set threshold = $warning_threshold where alert_definition_id = $warning_id; update rhq_alert_condition set threshold = $warning_threshold where alert_definition_id = $warning_recovery_id; EOF 2&gt;&amp;1 /dev/null </code></pre>
2
Autofac - InstancePerRequest created from DependencyResolver.Current.GetService<>() - When is it released?
<p>In an API controller project in .NET, there is a service I am using, say <code>SomeService</code>, requires one time only initialisation (not per request or per SomeService instance) (Although I do not think it is relevant, here the explanation for this init part: It does some setup in Azure storage for once the api is created. Doing this for every instance of <code>SomeService</code> is unnecessarely costly. Therefore there was the following line in Global.asax</p> <pre><code>new SomeService().Init(); </code></pre> <p>Now, I am using <code>Autofac</code> for dependency injection. I register <code>SomeService</code> as <code>ISomeService</code> and as <code>InstancePerRequest</code> (because <code>SomeService</code> is not thread-safe). Therefore now I want to initialise SomeService in Global.asax via an instance from container. However If I try to get an instance from container as in </p> <pre><code>container.Resolve&lt;ISomeService&gt;().Init(); </code></pre> <p>it gives this error</p> <pre><code>An exception of type 'Autofac.Core.DependencyResolutionException' occurred in Autofac.dll but was not handled in user code Additional information: No scope with a Tag matching 'AutofacWebRequest' is visible from the scope in which the instance was requested. This generally indicates that a component registered as per-HTTP request is being requested by a SingleInstance() component (or a similar scenario.) Under the web integration always request dependencies from the DependencyResolver.Current or ILifetimeScopeProvider.RequestLifetime, never from the container itself. </code></pre> <p>Therefore in Global.asax I get an instance as suggested in the error explanation.</p> <pre><code>DependencyResolver.Current.GetService&lt;ISomeService&gt;().Init(); </code></pre> <p>What I want to know is that the <code>SomeService</code> instance I get from <code>Current</code> is released or not? Since there is no real request, I am not sure. At worst I can get the instance from concrete with <code>new</code>.</p>
2
Do custom HTML elements inherit parent CSS styles?
<p>When creating custom elements in HTML, does the child tag inherit the parent's CSS styles?</p> <p>Here is my test case, from Chrome:</p> <pre><code>var h1bProto = document.registerElement ('h1-b', { prototype: Object.create (HTMLHeadingElement.prototype), extends: "h1" }); </code></pre> <p>When I append a child using the new h1bProto it generates an H1 tag with is="h1-b", example below:</p> <pre><code>var node = document.body.appendChild (new hibProto()); node.textContent = "Hello"; &lt;h1 is="h1-b"&gt;Hello&lt;/h1&gt; </code></pre> <h1>Hello</h1> <p>This gives me the parents CSS styles. However, if I add a node by creating the element first, then appending the node, the code looks like this:</p> <pre><code>var node = document.createElement ("h1-b"); node.textContent = "Hello"; document.body.appendChild (node); &lt;h1-b&gt;Hello&lt;/h1-b&gt; </code></pre> <p>Hello</p> <p>Am I missing something, or do children not inherit the parent's CSS styles? If they don't, then is the best work around to use the Shadow DOM?</p>
2
Remove notifications from tray
<p>How can I remove all notifications in the notification tray that were sent by my server when the user clicks on one notifiaction?</p> <p>I have a chatting-app and the user gets a notification for each message (if the app is not in foreground). When the user clicks on one of those notifications the app will be brought to foreground / will be started. After that has happened, I want all other notifications in the notification bar to disappear as well.</p>
2
VBA JsonParser clsJsonParser does not work
<p>I have built a spider with scrapy. I run it and have the output in the json file as shown below. Then I am using clsJsonParser in a VBA, with the following code. But I am getting an 3265 error "element not found in this collection" for element.item("newstxt"); while the element.item("newstitle") works fine. What is going wrong? is it my VBA code, or the format of my json file?</p> <pre><code>Public Sub JSONImport() Dim coll As Collection Dim json As New clsJSONparser Dim db As DAO.Database Dim rs As DAO.Recordset Dim element As Variant Dim FileNum As Integer Dim DataLine As String, jsonStr As String ' READ FROM EXTERNAL FILE FileNum = FreeFile() Open "C:\Users\Philippe\sfo\unepinquiry\items.json" For Input As #FileNum ' PARSE FILE STRING jsonStr = "" While Not EOF(FileNum) Line Input #FileNum, DataLine jsonStr = jsonStr &amp; DataLine &amp; vbNewLine Wend Close #FileNum Set db = CurrentDb Set rs = db.OpenRecordset("News_1", dbOpenDynaset, dbSeeChanges) Set coll = json.parse(jsonStr) For Each element In coll rs.AddNew rs!newstitle = element.item("newstitle") rs!newstxt = element.item("newstxt") rs.Update Next Set element = Nothing Set coll = Nothing </code></pre> <p>End Sub</p> <blockquote> <p>[{"newstxt": ["On June 21, 2016, the fourth meeting of the G20 Green Finance Study Group was held in Xiamen. The meeting was hosted by Co-chairs from the People's Bank of China and the Bank of England. Delegates from G20 countries, invited guest countries and International Organizations participated in the meeting. The delegates discussed and agreed in principle on the G20 Green Finance Synthesis Report, which would be submitted to the June G20 Finance and Central Bank Deputies Xiamen Meeting. The study group will further revise and submit the Report to the July G20 Finance Ministers and Central Bank Governors Chengdu Meeting."], "newstitle": "\nFourth Meeting of the G20 Green Finance Study Group Concludes in Xiamen\n"}, {"newstxt": ["Mumbai, 29 April 2016\u00a0- India has set ambitious goals for inclusive and sustainable development, which require the mobilization of additional low-cost, long-term capital. A new report launched today by the United Nations Environment Programme (UNEP) and the Federation of Indian Chambers of Commerce and Industry (FICCI) shows how the country is already introducing innovative approaches to attract private capital for green assets - and outlines a number of key steps to deepen this process in India."], "newstitle": "\nNew Report Shows How India Can Scale up Sustainable Finance\n"}]</p> </blockquote>
2
How to use .unionAll() in a reduce expression to create single dataframe
<p>I'm trying to learn to use functional programming constructs like <code>reduce</code>, and I'm trying to grok how to use it to <code>union</code> multiple <code>dataframes</code> together. I was able to accomplish it with a simple for loop. You can see the commented out <code>expr</code> which was my attempt, the problem I'm running into is the fact that <code>reduce</code> is a <code>Python</code> function, and so I'm interleaving <code>Python</code> and <code>Spark</code> code in the same function, which doesn't make the compiler happy.</p> <p>Here is my code:</p> <pre class="lang-py prettyprint-override"><code>df1 = sqlContext.createDataFrame( [ ('1', '2', '3'), ], ['a', 'b', 'c'] ) df2 = sqlContext.createDataFrame( [ ('4', '5', '6'), ], ['a', 'b', 'c'] ) df3 = sqlContext.createDataFrame( [ ('7', '8', '9'), ], ['a', 'b', 'c'] ) l = [df2, df3] # expr = reduce(lambda acc, b: acc.unionAll(b), l, '') for df in l: df1 = df1.unionAll(df) df1.select('*').show() </code></pre>
2
window.onload with Chrome
<p>Attempting to get a h1 to fade-in once the page loads. It works in all browsers when testing locally. But when hosted, with Chrome, it doesn't always fade-in. Sometimes it's just fully visible right from the start. I've tried 2 methods that both seem to work in Safari and Firefox, but Chrome is an "iffy" whether it works or not.</p> <p>Is Chrome just loading from cache, without executing, or is there another method of writing this JavaScript?</p> <p>I've tried: </p> <pre><code>$('.headerTopHeading, .headerSubHeading').animate({ 'opacity': '1'}, 1200); </code></pre> <p>Wrapped in a document.ready, and setting the Opacity to zero via CSS from the start.</p> <p>And I've tried:</p> <pre><code>window.onload = function () { $('.headerTopHeading, .headerSubHeading').fadeIn('1200'); }; </code></pre> <p>Setting the display to none via CSS and placed outside the document.ready wrap.</p> <p>Any suggestions? Or reason why Chrome doesn't behave consistently all the time?</p>
2
Disable dates before today in angular ui datepicker
<p>The website is confusing! How do I disable days prior to this one?</p> <p>angular-ui.github.io/bootstrap/ (ctrl + f mindate)</p>
2
Translate linux ssh config syntax to PuTTY and Git
<p>I have to use a proxy to get from my computer to an external server. From there I ssh to a remote server and then hop to a final gitlab server so I can do git stuff.</p> <p>Summary: Personal Computer -> Internal Server (Proxy) -> Remote Server -> Remote Gitlab Server === Now I should be able to use Git/SourceTree/etc to do "git stuff".</p> <p>I have gotten this to work on Ubuntu (without having to go through the proxy) using the directions below but I need this capability on Windows (have to go through the proxy) hence PuTTY. This <a href="https://monkeyswithbuttons.wordpress.com/2010/10/01/ssh-proxycommand-and-putty/" rel="nofollow">website</a> gave a pretty close representation of what I am looking at doing.</p> <p>The linux instructions I got which don't account for the proxy are as follows:</p> <ol> <li><p>Create the following ~/.ssh/config file:</p> <pre><code>Host gitlab.TEMP.com User &lt;your user id&gt; ProxyCommand nc -x localhost:5555 %h %p </code></pre></li> <li><p>Create an ssh tunnel:</p> <pre><code>ssh -D 5555 &lt;your user id&gt;@gitlab.TEMP.com </code></pre></li> <li><p>Adjust Socks Proxy on browser (this is just necessary to view the gitlab in a browser. Do this in your non-default browser (Explorer/Mozilla) as you won't be able to search the internet with this browser)</p> <pre><code>localhost:5555 </code></pre></li> <li><p>Login to Gitlab in connected browser and add rsa pair information</p></li> <li><p>Clone repository</p> <pre><code>git clone [email protected]:&lt;your user id&gt;/&lt;project&gt;.git </code></pre></li> </ol> <p>Important: I have been able get through the proxy and to the remote gitlab server to view the gitlab repository (i.e., steps 1-4 plus the missing proxy step) but I can not get Git (via Git Bash or SourceTree) to connect to the repository (step 5). I get the error:</p> <pre><code>ssh: connect to host gitlab.TEMP.com port 22: Connection refused fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. </code></pre> <p>Ideas and suggestions would be appreciated, pictures of the putty interface would give you 10 gold stars! :) Thanks in advance.</p>
2
How is Branch app indexing different from Firebase app indexing?
<p>I wanted to know which one is easier to implement. In the branch app indexing method is it required to implement app content sitemaps? </p>
2
Showing NaN to NaN in jquery bootstrap datatable
<p>I have integrated jquerydatatable in bootstrap framework and when i select All it is showing like this</p> <p>Showing NaN to NaN of 7 entries.</p> <p>Javascript</p> <pre><code>$(function () { $('#example2').DataTable({ "lengthMenu": [5, 10, 50, "All"] }); }); </code></pre>
2
Sorting by date (dd.mm.YYYY) in Datatable using Moment.js and Ordering Plugin
<p>I seem to have pretty much the same problem as Felix here:</p> <p><a href="https://stackoverflow.com/questions/36035219/problems-with-sorting-by-date-dd-mm-yyyy-in-datatable-using-moment-js-and-orde">Problems with sorting by date (dd.mm.YYYY) in Datatable using Moment.js and Ordering Plugin</a></p> <p>Dates in HTML are formatted by PHP: <code>DateTime::createFromFormat('Y-m-d', $date);</code></p> <p>I considered the correct moment.js date format "DD.MM.YYYY". However DataTables sorts the date column alphabetically.</p> <p>These are my code snippets:</p> <p>JavaScript:</p> <pre><code>$(document).ready(function() { // Setup - add a text input to each header cell for filtering $('#dt-requests thead th').each( function () { var title = $(this).text(); $(this).html( title+'&lt;br&gt;&lt;input type="text" placeholder="Filter" /&gt;' ); } ); // Setup - register the format "tt.mm.jjjj" to detect (by moment.js) and order (by DataTables.js) $.fn.dataTable.moment('DD.MM.YYYY'); // DataTable var table = $('#dt-requests').DataTable({ 'paging': false, // Keine Paginierung 'order': [[0, 'desc']], // Sortiere die erste Spalte absteigend (=&gt; neueste ID zuerst, somit chronologisch) 'columnDefs': [ // Set column definition initialisation properties { // Aktionenspalte soll für den User nicht sortierbar sein 'orderable': false, 'targets': 6 }, { // Datum sortierbar machen 'type': 'date-moment', 'targets': 5 } ], language: { search: 'Filtern:' } }); // Individual column searching (text inputs). table.columns().eq(0).each(function(colIdx) { $('input', table.column(colIdx).header()).on('keyup change', function() { table .column(colIdx) .search(this.value) .draw(); }); // Stop the input fields triggering column sorting when clicking them. $('input', table.column(colIdx).header()).on('click', function(e) { e.stopPropagation(); }); }); }); </code></pre> <p>HTML:</p> <pre><code>. . . &lt;script type="text/javascript" charset="utf8" src="/vendor/moment.js/2.8.4/moment.min.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="/vendor/jQuery_DataTables/1.10.12/datatables.css"&gt; &lt;script type="text/javascript" charset="utf8" src="/vendor/jQuery_DataTables/1.10.12/datatables.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" charset="utf8" src="/vendor/jQuery_DataTables/plugins/1.10.12/sorting/datetime-moment.js"&gt;&lt;/script&gt; . . . &lt;table id="dt-requests" class="table table-striped table-bordered table-hover display dataTable" role="grid" aria-describedby="dt-requests_info"&gt; &lt;caption&gt;Übersicht&lt;/caption&gt; &lt;thead&gt; &lt;tr role="row"&gt; &lt;th class="verticalBottom sorting" tabindex="0" aria-controls="dt-requests" rowspan="1" colspan="1" style="width: 70px;" aria-label="ID: activate to sort column ascending"&gt;ID&lt;br&gt;&lt;input type="text" placeholder="Filter"&gt;&lt;/th&gt; &lt;th class="verticalBottom sorting" tabindex="0" aria-controls="dt-requests" rowspan="1" colspan="1" style="width: 259px;" aria-label="Investitionsgegenstand: activate to sort column ascending"&gt;Investitionsgegenstand&lt;br&gt;&lt;input type="text" placeholder="Filter"&gt;&lt;/th&gt; &lt;th class="verticalBottom sorting" tabindex="0" aria-controls="dt-requests" rowspan="1" colspan="1" style="width: 130px;" aria-label="Status: activate to sort column ascending"&gt;Status&lt;br&gt;&lt;input type="text" placeholder="Filter"&gt;&lt;/th&gt; &lt;th class="verticalBottom sorting" tabindex="0" aria-controls="dt-requests" rowspan="1" colspan="1" style="width: 70px;" aria-label="Besitzer: activate to sort column ascending"&gt;Besitzer&lt;br&gt;&lt;input type="text" placeholder="Filter"&gt;&lt;/th&gt; &lt;th class="text-right verticalBottom sorting" tabindex="0" aria-controls="dt-requests" rowspan="1" colspan="1" style="width: 115px;" aria-label="€ Investitions-volumen: activate to sort column ascending"&gt;€ Investitions-volumen&lt;br&gt;&lt;input type="text" placeholder="Filter"&gt;&lt;/th&gt; &lt;th verticalbottom="" class="sorting_asc" tabindex="0" aria-controls="dt-requests" rowspan="1" colspan="1" style="width: 97px;" aria-label="Antragsdatum: activate to sort column descending" aria-sort="ascending"&gt;Antragsdatum&lt;br&gt;&lt;input type="text" placeholder="Filter"&gt;&lt;/th&gt; &lt;th width="15%" class="verticalBottom sorting_disabled" rowspan="1" colspan="1" style="width: 133px;" aria-label="Aktion"&gt;Aktion&lt;br&gt;&lt;input type="text" placeholder="Filter"&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tfoot&gt; &lt;tr&gt; &lt;th rowspan="1" colspan="1"&gt;ID&lt;/th&gt; &lt;th rowspan="1" colspan="1"&gt;Investitionsgegenstand&lt;/th&gt; &lt;th rowspan="1" colspan="1"&gt;Status&lt;/th&gt; &lt;th rowspan="1" colspan="1"&gt;Besitzer&lt;/th&gt; &lt;th class="text-right" rowspan="1" colspan="1"&gt;€ Investitions-&lt;br&gt;volumen&lt;/th&gt; &lt;th rowspan="1" colspan="1"&gt;Antrags-&lt;br&gt;datum&lt;/th&gt; &lt;th width="15%" rowspan="1" colspan="1"&gt;Aktion&lt;/th&gt; &lt;/tr&gt; &lt;/tfoot&gt; &lt;tbody&gt; &lt;tr class="even" id="609" role="row"&gt; &lt;td class=""&gt;609&lt;/td&gt; &lt;td&gt;2.1 Investitionsgegenstand (und sonstiger Investitionszweck)&lt;br&gt; &lt;div class="btn-group attachments"&gt; &lt;button aria-expanded="false" aria-haspopup="true" data-toggle="dropdown" class="btn btn-default btn-xs dropdown-toggle" type="button"&gt; &lt;i class="glyphicon glyphicon-paperclip"&gt; &lt;/i&gt; Anlagen &lt;span class="caret"&gt;&lt;/span&gt; &lt;/button&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;Beschreibung des Investitionsvorhabens: &lt;a target="_blank" href="download/609/135"&gt;&lt;span class="attFileName"&gt;LanguageMgr.dll&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/td&gt; &lt;td&gt;An SPOC gegeben&lt;/td&gt; &lt;td&gt;muelfrit&lt;/td&gt; &lt;td class="text-right"&gt;5.000&lt;/td&gt; &lt;td class="sorting_1"&gt;04.07.2016&lt;/td&gt; &lt;td&gt; &lt;div class="btn-group"&gt; &lt;a href="#" class="btn btn-primary"&gt;&lt;i class="fa fa-cog"&gt;&lt;/i&gt; Aktionen&lt;/a&gt; &lt;a href="#" data-toggle="dropdown" class="btn btn-primary dropdown-toggle"&gt; &lt;span class="fa fa-caret-down"&gt;&lt;/span&gt; &lt;/a&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;&lt;a target="_blank" href="preview/609"&gt;&lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt; Vorschau&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="edit/609"&gt;&lt;i class="fa fa-pencil"&gt;&lt;/i&gt; Bearbeiten&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-target="#modalInquiry609" data-toggle="modal" href="#"&gt;&lt;i class="glyphicon glyphicon-repeat"&gt;&lt;/i&gt; Rückfrage an SB&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-target="#modalPassToABV609" data-toggle="modal" href="#"&gt;&lt;i class="glyphicon glyphicon-repeat"&gt;&lt;/i&gt; In Pool zurückstellen&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a data-target="#modalAudit609" data-toggle="modal" href="#"&gt;&lt;i class="glyphicon glyphicon-arrow-right"&gt;&lt;/i&gt; Auf Prüfstatus setzen&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="ownRequest odd" id="608" role="row"&gt; &lt;td class=""&gt;608&lt;/td&gt; &lt;td&gt; 2.1 Investitionsgegenstand (und sonstiger Investitionszweck)&lt;/td&gt; &lt;td&gt;Entwurf&lt;/td&gt; &lt;td&gt;mayehein&lt;/td&gt; &lt;td class="text-right"&gt;5.000&lt;/td&gt; &lt;td class="sorting_1"&gt;04.07.2016&lt;/td&gt; &lt;td&gt; &lt;div class="btn-group"&gt; &lt;a href="#" class="btn btn-primary"&gt;&lt;i class="fa fa-cog"&gt;&lt;/i&gt; Aktionen&lt;/a&gt; &lt;a href="#" data-toggle="dropdown" class="btn btn-primary dropdown-toggle"&gt; &lt;span class="fa fa-caret-down"&gt;&lt;/span&gt; &lt;/a&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;&lt;a target="_blank" href="preview/608"&gt;&lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt; Vorschau&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="submit/608"&gt;&lt;i class="fa fa-paper-plane"&gt;&lt;/i&gt; an SPOC geben&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="edit/608"&gt;&lt;i class="fa fa-pencil"&gt;&lt;/i&gt; Bearbeiten&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="ownRequest even" id="607" role="row"&gt; &lt;td class=""&gt;607&lt;/td&gt; &lt;td&gt; 2.1 Investitionsgegenstand (und sonstiger Investitionszweck)&lt;/td&gt; &lt;td&gt;Entwurf&lt;/td&gt; &lt;td&gt;mayehein&lt;/td&gt; &lt;td class="text-right"&gt;5.000&lt;/td&gt; &lt;td class="sorting_1"&gt;04.07.2016&lt;/td&gt; &lt;td&gt; &lt;div class="btn-group"&gt; &lt;a href="#" class="btn btn-primary"&gt;&lt;i class="fa fa-cog"&gt;&lt;/i&gt; Aktionen&lt;/a&gt; &lt;a href="#" data-toggle="dropdown" class="btn btn-primary dropdown-toggle"&gt; &lt;span class="fa fa-caret-down"&gt;&lt;/span&gt; &lt;/a&gt; &lt;ul class="dropdown-menu"&gt; &lt;li&gt;&lt;a target="_blank" href="preview/607"&gt;&lt;i class="glyphicon glyphicon-search"&gt;&lt;/i&gt; Vorschau&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="submit/607"&gt;&lt;i class="fa fa-paper-plane"&gt;&lt;/i&gt; an SPOC geben&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="edit/607"&gt;&lt;i class="fa fa-pencil"&gt;&lt;/i&gt; Bearbeiten&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; . . . &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Anyone sees what might be wrong?</p> <p>BTW: Since I can control the date format that is outputted into HTML I would rather use something like the legacy iDataSort parameter as stated <a href="http://legacy.datatables.net/usage/columns" rel="nofollow">here</a>. But there seems to be no equivalent in the current DataTables version.</p>
2
Recording an Espresso Test without having to do a clean install every time
<p>I have successfully recorded Espresso tests using Android Studio 2.2 Preview 3, but I don't seem to be able to run my app, go to a particular point, and then start the recorder.</p> <p>It seems as if I can only record tests from a clean install, meaning I have to record the same initial steps again and again.</p> <p>Any ideas please? Will this functionality be added in the future?</p>
2
Tensorflow - feeding examples with different length
<p>Each of my training examples is a list with different length. I am trying to find a way to feed those examples into the graph. Below is my attempt to do so by creating a list whose elements are placeholders with unknown dimensions.</p> <pre><code>graph2 = tf.Graph() with graph2.as_default(): A = list () for i in np.arange(3): A.append(tf.placeholder(tf.float32 ,shape = [None,None])) A_size = tf.shape(A) with tf.Session(graph=graph2) as session: tf.initialize_all_variables().run() feed_dict = {A[0]:np.zeros((3,7)) ,A[1] : np.zeros((3,2)) , A[2] : np.zeros((3,2)) } print ( type(feed_dict)) B = session.run(A_size ,feed_dict=feed_dict) print type(B) </code></pre> <p>However I got the following error:</p> <pre><code>InvalidArgumentError: Shapes of all inputs must match: values[0].shape = [3,7] != values[1].shape = [3,2] </code></pre> <p>Any idea on how to solve it? </p>
2
how to delete old image from destination folder when updating image in laravel?
<p>i have done image update function.The following code updates only the file name in the database but i need to remove the old image from the destination folder too while updating else the folder size will become too large. Any Ideas would be great. Here my code.</p> <pre><code>public function updateQuoteItemImage($image){ $file=Input::file('filename'); $random_name=str_random(8); $destinationPath='images/'; $extension=$file-&gt;getClientOriginalExtension(); $filename=$random_name.'_quote_itm_image.'.$extension; $byte=File::size($file); //get size of file $uploadSuccess=Input::file('filename')-&gt;move($destinationPath,$filename); $data=QuoteItemImage::findOrFail($image-&gt;id); $data-&gt;quote_item_id=$image-&gt;quote_item_id; $data-&gt;filename=$filename; $data-&gt;filesize=$byte; $data-&gt;save(); return Common::getJsonResponse(true, 'image updated', 200); } </code></pre>
2
ACS712 Current Sensor Data Plot using MATLAB and Arduino
<p>I am working on a GUI to plot ac712 current data to MATLAB GUI. The problem is I cannot plot the data properly. The plot seems to be triangular and not sinusoidal curve. Also the current values are correct but I think x-axis values are incorrect. Please help.</p> <pre><code>clear all clc a = arduino('com3','uno'); samples = 200 for i = 1:201 x = [0:0.001:2]; y = zeros(1,201); b = a.readVoltage(0); y(i) = ((b-2.5)/.234); i = i+1 pause (0.006) end figure(1) plot(x,y) </code></pre> <p><a href="https://i.stack.imgur.com/6JvIw.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6JvIw.jpg" alt="Plot obtained using MATLAB"></a> <br><sup><em>Fig. Plot obtained using MATLAB</em></sup></p> <p>When I use arduino only for the same, the values for current are as follows:</p> <pre><code>0.46 -0.69 1.04 -0.94 0.81 -0.29 -0.06 0.71 -0.83 1.08 -0.81 0.62 0.04 -0.31 0.87 -0.87 1.1 -0.67 0.37 0.27 -0.56 1.02 -0.92 0.94 -0.46 0.08 0.52 -0.71 1.04 </code></pre> <p>which when plotted using Excel is as follows:</p> <p><a href="https://i.stack.imgur.com/9mLJo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9mLJo.png" alt="plot obtained with Arduino current data and x axis values as: 1-29"></a> <br><sup><em>Fig. Plot obtained with Arduino current data and x axis values as: 1-29</em></sup></p>
2
Stream Output of Predictions in Keras
<p>I have an LSTM in Keras that I am training to predict on time series data. I want the network to output predictions on each timestep, as it will receive a new input every 15 seconds. So what I am struggling with is the proper way to train it so that it will output h_0, h_1, ..., h_t, as a constant stream as it receives x_0, x_1, ...., x_t as a stream of inputs. Is there a best practice for doing this?</p> <p><a href="https://i.stack.imgur.com/jldey.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jldey.png" alt="enter image description here"></a></p>
2
React:Uncaught TypeError: Cannot read property 'set' of undefined
<pre><code>var React = require('react'); var Recipe = require('../models/recipes.js').Recipe; var IngredientCollection =require('../models/recipes.js').IngredientCollection; var IngredientForm = React.createClass({ getInitialState: function(){ var ingredients = new IngredientCollection(); ingredients.add([{}]); return{ ingredients: ingredients, recipe: new Recipe() }; }, handleAmount: function(e){ var ingredients = this.state.ingredients; this.props.ingredient.set('amount', e.target.value); }, handleUnits: function(e){ var ingredients = this.state.ingredients; this.props.ingredient.set('units', e.target.value); }, handleName: function(e){ var ingredients = this.state.ingredients; this.props.ingredient.set('name', e.target.value); }, render: function(){ var ingredient = this.props.ingredient; var count = this.props.counter + 1; return ( &lt;div className="ingredients row"&gt; &lt;h1 className="ingr-heading"&gt;Ingredients&lt;/h1&gt; &lt;div className="ingredient-wrapper col-xs-10 col-xs-offset-1"&gt; &lt;input onChange={this.handleAmount} ref={"amount"} type="text" className="amount form-control" id="amount" placeholder="Amount"/&gt; &lt;select onChange={this.handleUnits} ref={"units"} className="unit form-control" defaultValue="A"&gt; &lt;option disabled value="A"&gt;unit&lt;/option&gt; &lt;option value="B"&gt;tsp.&lt;/option&gt; &lt;option value="C"&gt;tbsp.&lt;/option&gt; &lt;option value="D"&gt;fl oz(s)&lt;/option&gt; &lt;option value="E"&gt;cup(s)&lt;/option&gt; &lt;option value="F"&gt;pt(s)&lt;/option&gt; &lt;option value="G"&gt;qt(s)&lt;/option&gt; &lt;option value="H"&gt;gal(s)&lt;/option&gt; &lt;option value="I"&gt;oz(s)&lt;/option&gt; &lt;option value="J"&gt;lb(s)&lt;/option&gt; &lt;/select&gt; &lt;input onChange={this.handleName} ref={"name"} type="text" className="ingr-place form-control" id="name" placeholder="Ingredient"/&gt; &lt;button id="submit-ingredient" type="button" className="btn btn-default"&gt;Add&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; // &lt;div className="recipe-form"&gt; // &lt;form className="holding" onSubmit={this.handleNewRecipe}&gt; // &lt;span className="make"&gt;Makes&lt;/span&gt; // &lt;input type="text" className="servings" onChange={this.handleNameChange} &gt;&lt;/input&gt; // &lt;span className="how-many"&gt;Servings&lt;/span&gt; // &lt;button className="btn btn-primary"&gt;Adjust Recipe&lt;/button&gt; // &lt;/form&gt; // &lt;/div&gt; ) } }) var RecipeForm = React.createClass({ getInitialState: function(){ var ingredients = new IngredientCollection(); ingredients.add([{}]); return{ ingredients: ingredients, recipe: new Recipe() }; }, componentWillMount: function(){ var self = this; var recipe = this.state.recipe; recipe.on('change', this.update); this.state.ingredients.on('add', this.update); }, update: function(){ this.forceUpdate(); }, handleSubmit: function(e){ e.preventDefault(); var router = this.props.router; var recipe = this.state.recipe; var ingredients = this.state.ingredients; recipe.set('ingredients', ingredients.toJSON()); console.log(recipe); recipe.save().done(function(e){ router.navigate('recipes/add', {trigger: true}); }); }, handleTitleChange: function(e){ this.state.recipe.set('title', e.target.value) }, render: function(){ return( &lt;form&gt; &lt;IngredientForm /&gt; &lt;/form&gt; ) } }) module.exports = RecipeForm; </code></pre> <p>Im getting "cannot read property 'set' of undefined". I thought I did set it? I dont understand how else I am suppose to define it other than what Ive written so far. If anyone has any ideas please post, this is for a project that needs to be done soon!</p>
2
Alexa skills custom slot for date times
<p>So, I'm working a project with the Amazon Echo. My goal is to record when I did a specific action and to record it into a DB. My issue is timezones, and I avoid this by using epoch time. However, from what I can tell of custom slots for an intent, my choices are formatted date strings with no time, or formatted time strings with no dates, and on top of all of that, I have no way of grabbing the client's timezone without specifically asking for it based on some forum posts I found with my google fu.</p> <p>Does the echo just hate dates? This seems like something that should be really easy, but I'm struggling to figure out how to go about it without being really awkward and asking where they live so I can do a lookup of their timezone. I already had to make a pivot from telling them the specific time they did something to how long ago they did something because I can't pass dates back to the Echo and expect it to translate it. Is this another silly pivot I have to make?</p>
2
Only display specific labels of a ggplot legend
<p>I have some data points, and I want to single out some of the points in my visualization. I would do it like this:</p> <pre><code>df = data.frame( x = 1:4, y = 1:4, special = c('normal', 'normal', 'normal', 'special') ) ggplot(df) + geom_point(aes(x, y, color = special)) + scale_color_manual(values = c('red', 'black')) + labs(color = "") + theme_bw() </code></pre> <p><a href="https://i.stack.imgur.com/qdnBV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qdnBV.png" alt="example"></a></p> <p>My issue here is that the black points are very self explanatory and don't need a label. I want <em>just</em> the red "special" label to appear. Is there a way I can hide the "normal" label?</p>
2
Cannot set property '_renderItem' of undefined with data("ui-autocomplete")
<p>I am having a problem with autocomplete which is keep giving this error and I am unable to figure it out what is causing this issue. I have tried everything on so and still not able to figure it out.</p> <p>I have bootstrap js and jquery ui also loaded in order of </p> <p>jquery-1.11.2', 'jquery-ui', 'bootstrap'</p> <pre><code>$("#search-destination").autocomplete({ minLength: 3, source: function (request, response) { var url = "http://localhost/abc/public_html/query/visiting?"; var data = {term: $("#search-destination").val()}; $.getJSON(url, data, function (data) { // data is an array of objects and must be transformed for autocomplete to use var array = data.error ? [] : $.map(data.places, function (m) { var data = { label: (!isEmpty(m.city)) ? m.title + " (" + m.city + ")" : m.title, }; return data; }); response(array); }); }, focus: function (event, ui) { }, select: function (event, ui) { } }).data("ui-autocomplete")._renderItem = function (ul, item) { var $a = $("&lt;a&gt;&lt;/a&gt;").text(item.label); highlightText(this.term, $a); return $("&lt;li&gt;&lt;/li&gt;").append($a).appendTo(ul); }; </code></pre>
2
How to load TextAsset from txt file containing extended ASCII characters in Unity?
<p>In my case specifically, I have bullet-points (• or #149) in my text file.<br> If I copy paste "•" into my Unity text field in the editor, it shows up, so I am pretty sure the bullet-point is lost in the reading process. (I checked in debug mode, and indeed the bullet-point is lost at reading).</p> <p>This is how I read in my text file as a TextAsset:</p> <pre><code>TextAsset content = Resources.Load(SlideManager.slideLanguage+"\\"+fileName+" ("+SlideManager.slideNumber+")") as TextAsset; </code></pre>
2
How to change the default code template for C++ in Eclipse?
<p>I'm using Eclipse as an IDE for C++ programming. When creating a new project, I get the following default template:</p> <pre><code>//============================================================================ // Name : .cpp // Author : "name I can specify" // Version : // Copyright : ©opyRights // Description : Hello World in C++, Ansi-style //============================================================================ #include &lt;iostream&gt; using namespace std; int main() { cout &lt;&lt; "" &lt;&lt; endl; // prints return 0; } </code></pre> <p>So, what I want to know is: How can I change this default template as a whole - the include files, the first part which contains the Name (in blank), and other information?</p> <p>Thanks.</p>
2
How to mock a sequence of calls to the same method to return different values in AutoFixture using NSubstitute?
<p>I'm looking for a way to mock a method so that when called multiple times, the result is different. More specifically what i'm after, is to mock a method so that the third time it is called, I want to assert against that result.</p> <p>This syntax is <em>not</em> correct, but simulates what I want to accomplish:</p> <pre><code>var foo = Fixture.Freeze&lt;IFoo&gt;(); foo.Exists(Arg.Any&lt;object&gt;()).Returns("firstcall").SecondCall("secondcall").ThirdCall("thirdcall"); </code></pre> <p>Can you do this in AutoFixture?</p> <p>EDIT: As pointed out by Mark this is a question related to NSubstitute rather than AutoFixture itself. I've updated the title.</p>
2
Nodejs: Huge performance difference among UUID in normal string, base64 string and Buffer comparison
<p>Result:</p> <pre><code>true base64: 35.758ms true string: 12.811ms true buffer: 127.691ms </code></pre> <p>Code:</p> <pre><code>let n = 1000000; let uuid = require("node-uuid"); let uuidaString = uuid.v4(), uuidbString = uuidaString.slice(0), uuidaBuffer = uuid.parse(uuidaString, new Buffer(16)), uuidbBuffer = uuid.parse(uuidbString, new Buffer(16)), uuidaBase64 = uuidaBuffer.toString("base64"), uuidbBase64 = uuidbBuffer.toString("base64"); console.log(uuidaBase64 === uuidbBase64); console.time("base64"); for (let i = 0; i &lt; n &amp;&amp; uuidaBase64 === uuidbBase64; i++) { } console.timeEnd("base64"); console.log(uuidaString === uuidbString); console.time("string"); for (let i = 0; i &lt; n &amp;&amp; uuidaString === uuidbString; i++) { } console.timeEnd("string"); console.log(Buffer.compare(uuidaBuffer, uuidbBuffer) === 0); console.time("buffer"); for (let i = 0; i &lt; n &amp;&amp; Buffer.compare(uuidaBuffer, uuidbBuffer) === 0; i++) { } console.timeEnd("buffer"); </code></pre> <p>Does anybody explain the result? I would expect normal string comparison would be the slowest but it shows the fastest. Other than that I would expect base64 string comparison would be faster than normal string comparison because base64 string is shorter than normal string. Is it a bug?</p>
2
Firefox: mouseover doesn't work while mouse button is pressed
<p>Here is what I'm trying to make: <a href="https://gfycat.com/ValidEmbarrassedHochstettersfrog" rel="noreferrer">https://gfycat.com/ValidEmbarrassedHochstettersfrog</a></p> <p>I want to highlight some of <code>&lt;td&gt;</code> objects in <code>&lt;table&gt;</code> using mouse. This video is recorded on Chrome, where it works perfectly. Unfortunately it doesn't on firefox.</p> <p>Here is how it works:</p> <ol> <li>User clicks on first cell in table</li> <li>He drags mouse to other cell</li> <li>Cells are being highlighted</li> </ol> <p>Code:</p> <pre><code>$("#productList").on("mousedown", "td", function () { //save from where to start } $("#productList").on("mouseover mouseenter mouseover hover", "td", function () { //update highlighting, modify classes //this function isn't fired when I click on one of &lt;td&gt; and drag mouse somewhere else } </code></pre> <p>Where <code>#productList</code> is <code>&lt;table&gt;</code>.</p> <p>While in Chrome everything works as expected, firefox seem to not fire mouseenter event (and any other that I tried). Mouseover works only on objects that I've clicked on. It seems like Firefox considers only focused objects when I drag using mouse.</p> <p>How can I bypass it?</p> <p>EDIT: One important thing to mention: I have an <code>&lt;input&gt;</code> in each cell. This could cause problems <a href="https://jsfiddle.net/q8v7f6uv/6/" rel="noreferrer">https://jsfiddle.net/q8v7f6uv/6/</a></p>
2
Change viewport on changing a div width
<p>I have a form designer in my app and for the purpose of user experience I need to give the user this ability to change the viewport and see how the form would looks like in the actual form.</p> <p>I am using bootstrap 3 to shape the form and using the col and row classes to manage the layouts. there is 4 button in the form with the icon of the viewport such as Desktop , Tablet , Tablet-Horizontal , Mobile. </p> <p>when the user click on those buttons I add the desired class to my container div and resize it with the width property. but when I bootstrap does not detect that and don't respond to the div changes because it works with window width ( like media queries ).</p> <p>here is the css:</p> <pre><code>.edit__container { &amp;.container--lg { width: 100%; } &amp;.container--md { width: 80%; } &amp;.container--sm { width: 60%; } &amp;.container--xs { width: 30%; } } </code></pre> <p>what I tried is change the viewport meta tag with javascript and set the width to something like 200 or more, but not working.</p> <p>another try was to change the window width with jquery, but no luck.</p> <p>just so remember, i cannot use iframe inside my form.</p>
2
undefined reference when compiling code with cfitsio library
<p>I am receiving an <strong>undefined reference</strong> error for every function used from the <strong>cfitsio</strong> library when compiling my code. Below is the relevant chunk of the <strong>make null</strong> command's output (Note that <strong>-L/usr/lib/ -lcfitsio</strong> is in the first line):</p> <pre><code>gcc -g -I../mdl/null -DCHABRIER -DCHANGESOFT -DDENSITYU -DDENSITYUNOTP -DDIFFUSION -DDODVDS -DDTADJUST -DEPSACCH -DPARTICLESPLIT -DPROMOTE -DGASOLINE -DJEANSSOFT -DNSMOOTHINNER -DRTFORCE -DSETTRAPFPE -DSTARFORM -DTHERMALCOND -DTOPHATFEEDBACK -DTWOPHASE -DVSIGVISC -DWENDLAND -DRADIATION -DRADIATIONLUM -DDDSIMPLE -DR2PPBMAX -DCOOLING_METAL -L/usr/lib/ -lcfitsio -I/usr/include/fitsio.h -o gasoline.dfTest main.o master.o param.o outtype.o pkd.o pst.o grav.o ewald.o walk.o eccanom.o hypanom.o fdl.o htable.o smooth.o smoothfcn.o collision.o qqsmooth.o cooling_metal.o cosmo.o romberg.o starform.o feedback.o millerscalo.o supernova.o supernovaia.o startime.o stiff.o runge.o dumpframe.o dffuncs.o dumpvoxel.o rotbar.o special.o ssio.o treezip.o log.o radiation.o erf.o v_sqrt1.o ../mdl/null/mdl.o -lm dumpframe.o: In function `fitsError': /.../dumpframe.c:2156: undefined reference to `ffrprt' dumpframe.o: In function `dfFinishFrame': /.../dumpframe.c:2175: undefined reference to `ffinit' /.../dumpframe.c:2176: undefined reference to `ffcrim' /.../dumpframe.c:2197: undefined reference to `ffppr' /.../dumpframe.c:2198: undefined reference to `ffclos' collect2: error: ld returned 1 exit status Makefile:539: recipe for target 'gasoline.dfTest' failed make[1]: *** [gasoline.dfTest] Error 1 make[1]: Leaving directory '/home/grondjj/Code/gasoline' Makefile:457: recipe for target 'null' failed make: *** [null] Error 2gcc -g -I../mdl/null -DCHABRIER -DCHANGESOFT -DDENSITYU -DDENSITYUNOTP -DDIFFUSION -DDODVDS -DDTADJUST -DEPSACCH -DPARTICLESPLIT -DPROMOTE -DGASOLINE -DJEANSSOFT -DNSMOOTHINNER -DRTFORCE -DSETTRAPFPE -DSTARFORM -DTHERMALCOND -DTOPHATFEEDBACK -DTWOPHASE -DVSIGVISC -DWENDLAND -DRADIATION -DRADIATIONLUM -DDDSIMPLE -DR2PPBMAX -DCOOLING_METAL -L/usr/lib/ -lcfitsio -I/usr/include/fitsio.h -o gasoline.dfTest main.o master.o param.o outtype.o pkd.o pst.o grav.o ewald.o walk.o eccanom.o hypanom.o fdl.o htable.o smooth.o smoothfcn.o collision.o qqsmooth.o cooling_metal.o cosmo.o romberg.o starform.o feedback.o millerscalo.o supernova.o supernovaia.o startime.o stiff.o runge.o dumpframe.o dffuncs.o dumpvoxel.o rotbar.o special.o ssio.o treezip.o log.o radiation.o erf.o v_sqrt1.o ../mdl/null/mdl.o -lm dumpframe.o: In function `fitsError': /.../dumpframe.c:2156: undefined reference to `ffrprt' dumpframe.o: In function `dfFinishFrame': /.../dumpframe.c:2175: undefined reference to `ffinit' /.../dumpframe.c:2176: undefined reference to `ffcrim' /.../dumpframe.c:2197: undefined reference to `ffppr' /.../dumpframe.c:2198: undefined reference to `ffclos' collect2: error: ld returned 1 exit status Makefile:539: recipe for target 'gasoline.dfTest' failed make[1]: *** [gasoline.dfTest] Error 1 make[1]: Leaving directory '/home/grondjj/Code/gasoline' Makefile:457: recipe for target 'null' failed make: *** [null] Error 2 </code></pre> <p>Here are the relevant lines from the Makefile for <strong>make null</strong></p> <pre><code> FITS_LIB = -L/usr/lib/ -lcfitsio BASE_LD_FLAGS = $(PNG_LIB) $(GSL_LIB) $(FITS_LIB) NULL_LD_FLAGS = $(BASE_LD_FLAGS) null: cd $(NULL_MDL); make "CC=$(CC)" "CFLAGS=$(NULL_CFLAGS)" make $(EXE) "CFLAGS=$(NULL_CFLAGS)" "LD_FLAGS=$(NULL_LD_FLAGS)"\ "MDL=$(NULL_MDL)" "XOBJ=$(NULL_XOBJ)" "LIBMDL=$(NULL_LIBMDL)" </code></pre> <p>In <strong>dumpframe.c</strong> I include the <strong>cfitsio</strong> header <strong>fitsio.h</strong> along with the other inlcudes at the top of the file:</p> <pre><code> #ifndef GSS_DUMPFRAME #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;math.h&gt; #include &lt;assert.h&gt; #include &lt;string.h&gt; #include "fitsio.h" </code></pre> <p>The library was installed from source code. The source resides in <strong>/usr/local/src/cfitsio/</strong>, it was then installed via the following commands:</p> <pre><code> $ ./configure --prefix=/usr $ make shared $ make install $ make clean </code></pre> <p>Which results in the libraries (<strong>libcfitsio.a</strong>, <strong>libcfitsio.so</strong>, <strong>libcfitsio.so.5</strong>, <strong>libcfitsio.so.5.3.39</strong>) being installed in <strong>/usr/lib/</strong> and the auxiliary files (<strong>longnam.h</strong>, <strong>fitsio.h</strong>, <strong>fitsio2.h</strong>, <strong>drvrsmem.h</strong>) being installed in <strong>/usr/include/</strong>.</p> <p>I am not sure what causes this, as the compiler does not complain about missing libraries or a missing <strong>fitsio.h</strong> header file.</p>
2
Does Intel Pentium supports Virtualization?
<p>On my BIOS i have option for Virtualization, but even after enabling it am not able to install HAXM. I tried unchecking hyper-V. All my attempts failed in installing HAXM. Please suggest some solution.</p>
2
How to run code-first migrations to multiple tenants (separated by schemas)
<p>We are developing a scholar system witch is a multi-tenant application using entity framework 6 MVC and <strong>CODE FIRST MIGRATIONS</strong> and that's the problem, our multi tenant uses schemas (Sql server 2012+) to separate the data but all the migrations are being generated with DBO schema. For the development there is no problem on doing that BUT... when going on production we need to run these migrations on all our client schemas. Is there a beautiful way to do that? What do you guys suggest us to do? Well my friends, thanks in advance :)</p>
2
Undefined method cast after update to Ecto 2.0
<p>I recently migrated to latest versions of phoenix and ecto.</p> <p>Now I have changed code of a model, according to ecto changelog to </p> <pre><code>defmodule Spaces.Tag do use Spaces.Web, :model #Changed to below defmodule Spaces.Tag do use Ecto.Schema </code></pre> <p>I am getting <code>(CompileError) web/models/tag.ex:23: undefined function cast/4.</code> Anything I am missing?</p> <p>My mix.exs relevant code</p> <pre><code> defp deps do [{:phoenix, "~&gt; 1.2"}, {:postgrex, "&gt;= 0.0.0"}, {:phoenix_ecto, "~&gt; 3.0"}, {:phoenix_html, "~&gt; 2.6"}, {:phoenix_live_reload, "~&gt; 1.0", only: :dev}, {:gettext, "~&gt; 0.9"}, {:cowboy, "~&gt; 1.0"}, {:httpoison, "~&gt; 0.8.0"}, {:jsx, "~&gt; 2.8"}, {:scrivener_ecto, "~&gt; 1.0"}, {:phoenix_html_simplified_helpers, "~&gt; 0.4.0"}, {:ex_doc, "~&gt; 0.12.0", only: [:dev]} ] end </code></pre>
2
Angular2: Inject external Component into other component via directive not working
<p>I want child component template to load into parent component template. (for the lack of better wording I call them child and parent)</p> <p>This is my child:</p> <pre><code>import {Component,Directive, ElementRef, Input} from '@angular/core'; import {IONIC_DIRECTIVES} from 'ionic-angular'; @Component({ selector: '[parentselector]', template: '&lt;div&gt;I AM A CHILD&lt;/div&gt;', directives: [IONIC_DIRECTIVES] }) export class ChildPage { constructor() { } } </code></pre> <p>This is my parent:</p> <pre><code>@Component({ templateUrl: 'build/pages/parent/parent.html', directives: [ChildPage] }) </code></pre> <p>And the HTML of Parent:</p> <pre><code>&lt;ion-content&gt; &lt;ion-slides&gt; &lt;ion-slide&gt;&lt;parentselector&gt;Parent To Be Overriden&lt;/parentselector&gt; &lt;/ion-slide&gt; &lt;/ion-slides&gt; &lt;/ion-content&gt; </code></pre> <p>Any idea whats wrong?</p>
2
Google spreadsheet - Formula does not show negative time
<p>I have a google spreadsheet where I write down my working time. For example there are the following records</p> <p>G9 | 05:05</p> <p>H9 | 06:30</p> <p>Now I want to calculate if there is time left or not. First try:</p> <pre><code>=IF(G9&gt;0;G9-H9;0) </code></pre> <p>Second try:</p> <pre><code>=IF(G9&gt;0;IF(G9&lt;H9;G9-H9;H9-G9);0) </code></pre> <p>Unfortunately both ends up with a time like <code>22:35</code>. Because calculation below <code>0</code> let the system think it should start by <code>24:00</code>.</p> <p>How can I display the value like <code>-1:25</code> or vice-versa for positive times (<code>1:05</code> e.g.) dynamically with a formula?</p> <p>I have tried to change the format of the field, but it doesn't work since it would display all times as negative ones, even when they are positive.</p> <p>EDIT:</p> <p>As information if someone has troubles to work with the text values. Like @words mentioned you have to convert the value. But you also need a function if you want to work with arrays:</p> <pre><code>=SUM(ARRAYFORMULA(VALUE(I2:I32))) </code></pre>
2
The edge module has not been pre-compiled for node.js version v6.3.0
<p>When I try to build my app from <code>vs2015 update3</code> for ios, I get this error during compile</p> <blockquote> <p>The edge module has not been pre-compiled for node.js version v6.3.0. You must build a custom version of edge.node. Please refer to <a href="https://github.com/tjanczuk/edge" rel="nofollow">https://github.com/tjanczuk/edge</a> for building instructions</p> </blockquote> <p>I went to that project on github, but I couldn't find anything usefull.</p> <p>also I run <code>sudo npm i edge</code> on mac and edge compiles fine but still can't build the app</p> <p>also I cleared the npm cache on mac by <code>sudo npm clear cache</code> still build error</p> <p>My environment on mac is:</p> <ul> <li>node 6.3.0 </li> <li>npm 3.10.6 </li> <li>cordova 5.4.1</li> </ul> <p>My environment on windows</p> <ul> <li>Win10</li> <li>Vs2015 update 3</li> <li>node 6.3.0 </li> <li>npm 3.10.6 </li> <li>cordova 5.4.1</li> </ul> <h2>Update 1</h2> <p>when I try to install edge by <code>npm install edge</code> on windows I get the same error in npm</p> <pre><code>[email protected] install C:\Users\Reza\node_modules\edge node tools/install.js *************************************** Error: The edge module has not been pre-compiled for node.js version v6.3.0. You must build a custom version of edge.node. Please refer to https://github.com/tjanczuk/edge for building instructions. at determineVersion (C:\Users\Reza\node_modules\edge\lib\edge.js:21:11) at Object.&lt;anonymous&gt; (C:\Users\Reza\node_modules\edge\lib\edge.js:33:102) at Module._compile (module.js:541:32) at Object.Module._extensions..js (module.js:550:10) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module._load (module.js:409:3) at Module.require (module.js:468:17) at require (internal/module.js:20:19) at Object.&lt;anonymous&gt; (C:\Users\Reza\node_modules\edge\tools\checkplatform.js:2:2) </code></pre> <hr> <p>Success: platform check for edge.js: node.js x64 v6.3.0 C:\Users\Reza `-- [email protected]</p>
2
Using Ribbon-Kubernetes discovery with Zuul
<p>I managed to have ribbon dynamically discover instances in a <code>k8s</code> cluster using <a href="https://github.com/fabric8io/kubeflix" rel="nofollow">kubeflix</a> and <a href="https://github.com/fabric8io/spring-cloud-kubernetes" rel="nofollow">spring-cloud-kubernetes</a></p> <p>This was when I manually used <code>Ribbon</code> to communicate between my microservices.</p> <p><code>Zuul</code> automatically uses <code>Ribbon</code> for the routes defined in its configuration.</p> <p>Has anyone managed to enable <code>Ribbon</code> discovery for <code>Zuul</code>? I think I would need to override the instance of <code>LoadBalancer</code> for each of the routes. Any ideas how to do that?</p>
2
Mqtt Forwarder for bluetooth
<p>I've been told that in order to connect devices through bluetooth, need to implement a Forwarder from <a href="https://stackoverflow.com/questions/33483943/rsmb-mqtt-sn-bluetooth">RSMB MQTT-SN &amp; Bluetooth</a>. </p> <p>Btw, is there any more clearer way to state how to create a forwarder and how to connect through bluetooth for mqtt??</p>
2
Android show all GridView rows [disable scrolling]
<p>I have my gridView in a layout contained in a scrollView, so I want to make gridView show all its items. I already use <code>android:layout_height="wrap_content"</code> but it still makes it scrollable.</p> <p>my grid item</p> <pre><code>&lt;GridView android:id="@+id/year_4_badge_gridView" android:layout_width="match_parent" android:layout_height="wrap_content" android:columnWidth="90dp" android:gravity="center" android:horizontalSpacing="10dp" android:numColumns="auto_fit" android:stretchMode="columnWidth" android:verticalSpacing="10dp" /&gt; </code></pre>
2
Yii2 How to remove site/index and page parameter from url
<p>I am using pagination on default page,i.e, on site/index in yii2. So the URL generated by linker for paginations looks like this</p> <pre><code>domain.com/site/index?page=1 </code></pre> <p>I want to remove site/index and page parameter so that it looks like as follows</p> <pre><code>domain.com/1 </code></pre> <p><br> I tried writing rule in URL manager in config file like this</p> <pre><code>'site/index/&lt;page:\d+&gt;' =&gt; 'site/index' </code></pre> <p>This made the url like as follows</p> <pre><code>domain.com/site/index/1 </code></pre> <p><br>So to remove site/index as well, I set route of pagination to '/' like this</p> <pre><code>$pagination-&gt;route = '/'; </code></pre> <p>This removed site/index from URL but this again changed the URL to look like</p> <pre><code>domain.com/?page=1 </code></pre> <p><br>I tried changing rule in URL manager like this</p> <pre><code>'/&lt;page:\d+&gt;' =&gt;'site/index'; </code></pre> <p>But the URL remained the same. My question is how to make it look like</p> <pre><code>domain.com/1 </code></pre> <p>I am using Yii2 advanced template and have enabled strict parsing in URL manager.</p>
2
@RunWith(PowerMockRunner.class) says @RunWith not applicable to method
<p>I have a gradle file</p> <pre><code>testCompile('junit:junit') testCompile('org.powermock:powermock-core:1.6.5') testCompile('org.powermock:powermock-api-mockito:1.6.5') testCompile('org.powermock:powermock-module-junit4:1.6.5') </code></pre> <p>And my test file</p> <pre><code>import org.junit.runner.RunWith; import org.mockito.Mockito; import org.powermock.api.mockito.PowerMockito; import org.powermock.core.classloader.annotations.PrepareForTest; import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class) @PrepareForTest(ExperimentService.class) </code></pre> <p>There seems to be an error with the @RunWith and I have can't seem to find the problem, it just says that '@RunWith' not applicable to method.</p> <p>What am I doing wrong?</p> <p>Thanks.</p>
2
How to call a method of the component that Navigator has mounted?
<p>I want to call a method from the component (scene) that the Navigator has instantiated once the <code>onDidFocus()</code> function is called.</p> <p>This is how I instantiate the Navigator:</p> <pre><code>&lt;Navigator initialRoute={{ name: 'Login' }} renderScene={ this.renderScene } configureScene={(route, routeStack) =&gt; Navigator.SceneConfigs.FloatFromRight} onDidFocus={(route) =&gt; route.component.onFocus()} /&gt; </code></pre> <p>And this is my <code>renderScene()</code> method:</p> <pre><code>renderScene(route, navigator) { if(route.name == 'Login') { route.component = &lt;Login navigator={navigator} {...route.passProps} /&gt; } return route.component } </code></pre> <p>But <code>route.component.onFocus()</code> is <code>undefined</code> since (I presume) <code>route.component</code> is not a reference to the instance that was mounted of <code>Login</code> but a reference to the type <code>Login</code>.</p> <p>So how can I get a reference to the instance of the component that was mounted?</p> <p>How can I call a method of the component that has been mounted when the <code>onDidFocus()</code> method is called?</p>
2
Get the user's codepage name for functions in boost::locale::conv
<h2>The task at hand</h2> <p>I'm parsing a filename from an UTF-8 encoded XML on Windows. I need to pass that filename on to a function that I can't change. Internally it uses <a href="https://msdn.microsoft.com/en-us/library/8f30b0db.aspx" rel="nofollow noreferrer"><code>_fsopen()</code></a> which does not support Unicode strings.</p> <h2>Current approach</h2> <p>My current approach is to convert the filename to the user's charset hoping that the filename is representable in that encoding. I'm then using <code>boost::locale::conv::from_utf()</code> to convert from UTF-8 and I'm using <code>boost::locale::util::get_system_locale()</code> to get the name of the current locale.</p> <p><strong>Life is good?</strong></p> <p>I'm on a German system using code page <a href="https://msdn.microsoft.com/en-us/library/cc195054.aspx" rel="nofollow noreferrer">Windows-1252</a> thus <code>get_system_locale()</code> correctly yields <em>de_DE.windows-1252</em>. If I test the approach with a filename containing an umlaut everything works as expected.</p> <h2>The Problem</h2> <p>Just to make sure I <a href="http://knowledgebase.progress.com/articles/Article/4677" rel="nofollow noreferrer">switched my system locale</a> to Ukrainian which uses code page <a href="https://msdn.microsoft.com/en-us/library/cc195053.aspx" rel="nofollow noreferrer">Windows-1251</a>. Using some Cyrillic letter in the filename my approach fails. The reason is that <code>get_system_locale()</code> still yields <em>de_DE.windows-1252</em> which is now incorrect. </p> <p>On the other side <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/dd318070%28v=vs.85%29.aspx" rel="nofollow noreferrer"><code>GetACP()</code></a> correctly yields 1252 for the German locale and 1251 for the Ukrainian locale. I also know that Boost.Locale can convert to a given locale as this small test program works as I expect:</p> <pre><code>#include &lt;boost/locale.hpp&gt; #include &lt;iostream&gt; #include &lt;string&gt; #include &lt;windows.h&gt; int main() { std::cout &lt;&lt; "Codepage: " &lt;&lt; GetACP() &lt;&lt; std::endl; std::cout &lt;&lt; "Boost.Locale: " &lt;&lt; boost::locale::util::get_system_locale() &lt;&lt; std::endl; namespace blc = boost::locale::conv; // Cyrillic small letter zhe -&gt; \xe6 (ш on 1251, æ on 1252) std::string const test1251 = blc::from_utf(std::string("\xd0\xb6"), "windows-1251"); std::cout &lt;&lt; "1251: " &lt;&lt; static_cast&lt;int&gt;(test1251.front()) &lt;&lt; std::endl; // Latin small letter sharp s -&gt; \xdf (Я on 1251, ß on 1252) auto const test1252 = blc::from_utf(std::string("\xc3\x9f"), "windows-1252"); std::cout &lt;&lt; "1252: " &lt;&lt; static_cast&lt;int&gt;(test1252.front()) &lt;&lt; std::endl; } </code></pre> <h2>Questions</h2> <ul> <li><p>How can I query the name of the user locale in a format Boost.Locale supports? Using <code>std::locale("").name()</code> yields <em>German_Germany.1252</em>, using it results in a <code>boost::locale::conv::invalid_charset_error</code> exception.</p></li> <li><p>Is it possible that the system locale remains <em>de_DE.windows-1252</em> although I'm supposedly changing it as local admin? Similarly system language is German although my account's language is English. (Log in screen is German until I log in)</p></li> <li><p>should I stick with <a href="https://stackoverflow.com/a/2735723/1969455">using short filenames</a>? Does not seem to work reliably though.</p></li> </ul> <h2>Fine-print</h2> <ul> <li>Compiler is MSVC18</li> <li>Boost is version 1.56.0, backend supposedly winapi</li> <li>System is Win7, system language is German, user language English</li> </ul>
2
Spring Integration JAVA DSL Using original payload in a subsequent call
<p>I am using spring integration to define a flow that will do two things - firstly execute http call with given payload and then use the response provided and original payload to make another http call.</p> <p>How can this be achieved? In the code below I am able to use and modify the first payload and use it in the firstHttpRequest but then how can I use the original payload with the response from the firstHttpRequest?</p> <p>Any good practices? </p> <pre><code>@Bean public IntegrationFlow makeHttpCalls(){ return message -&gt; message .transform(new GenericTransformer&lt;Message&lt;String&gt;, String&gt;() { @Override public String transform(Message&lt;String&gt; message){ return message.getPayload() + " first call"; } }) .handle(makeFirstHttpRequest()) .transform(new GenericTransformer&lt;Message&lt;String&gt;, String&gt;() { @Override public String transform(Message&lt;String&gt; message) { logger.debug("Response from transform: " + message); return message.getPayload(); } }) .handle(makeSecondHttpRequest()) .channel("entrypoint"); } </code></pre>
2
Python: Polling a SQL database every n seconds and executing a task based on it
<p>I want to make a program that polls a SQL database every n seconds (n>10). And it validates the data in a particular column and calls a function based on it. </p> <p>For eg, </p> <pre><code>when column has '1' -&gt; call function1 when column has '2' -&gt; call function2 when column has '3' -&gt; exits </code></pre> <p>I looked into multithreading and saw a solution based on the <code>threading.timer</code>, will that satisfy my use-case?<br> Also, I will be okay with time drifts of up to +/-1 second. </p>
2
Infinite loading with script tag inside iframe
<p>Here is code, stuck with that simple issue which I never have had in past 7 years:</p> <pre><code>&lt;html&gt; &lt;body&gt; &lt;iframe&gt;&lt;/iframe&gt; &lt;script&gt; window.frames[0].document.write('&lt;scr' + 'ipt type="text/javascript" src="//code.jquery.com/jquery-3.0.0.min.js"&gt;&lt;\/scr' + 'ipt&gt;'); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>The problem is that browser's spin wheel continue to circle.</p> <p>Network console shows all loaded.</p> <p>If I remove iframe from DOM, or add/change @src attribute - loading stops.</p>
2
Set default tab to Angular.js tabs
<p>I have an <code>Angular.js</code> component which has a list of tabs. When a tab is clicked I assign an <code>ng-class</code>to it (active), so it gets highlighted. This is working fine, but I also want the first tab to be the default active one when a user first load the page, but at the moment nothing is highlighted when I load the page.</p> <p>Here's my component:</p> <pre><code>'use strict'; angular.module('menuBar').component('menuBar', { templateUrl: 'menu-bar/menu-bar.template.html', controller: function menuBarController() { this.menus = [ { name: 'Tab1' }, { name: 'Tab2' }, { name: 'Tab3' }, { name: 'Tab4' }, { name: 'Tab5' } ]; this.tab = this.menus[0].name; this.setTab = function (tabId) { this.tab = tabId; } this.isSet = function (tabId) { return this.tab === tabId; } } }); </code></pre> <p>Here my html template:</p> <pre><code>&lt;div class="navbar navbar-inverse navbar-collapse"&gt; &lt;div class="container"&gt; &lt;ul class="nav nav-tabs"&gt; &lt;li ng-repeat="menu in $ctrl.menus" ng-class="{active:tab.isSet(menu.name)}"&gt; &lt;a href ng-click="tab.setTab(menu.name)"&gt;{{menu.name}}&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Maybe something wrong at this line here where I'm trying to set my default tab?</p> <pre><code>this.tab = this.menus[0].name; </code></pre> <h2>Update: Plunker added</h2> <p><a href="https://plnkr.co/edit/FC5YhnbhkZWRE2wXlxSn?p=preview" rel="nofollow">Live preview here</a></p>
2
How to detect the default GPU at Runtime?
<p>I have a little weird problem here that i´m having a lot of dificulties to find out the answer.</p> <p>I have a C++ 3D Engine, and I´m using OpenCL for optimizations and OpenGL interoperability.</p> <p>In My machine i have Two GPU´s installed, a GTX 960 and a AMD R9 280X.</p> <p>Everything is working fine, including the detection of the GPU´s and CPU and the graphics interoperability are running really fast as expected.</p> <p>But, allways in a machine we have a default GPU on the system(This are setup on windows depending the order we install the drivers).</p> <p>So, when i´m starting read all the devices and detect the GPU´s when i try create the interoperability contexts i have a weird situation:</p> <p>When i have AMD as default GPU: in the case of NVIDIA devices the OpenCL returns to me an error informing that its not possible create the CL context(Becouse is not the default GPU), and when i create the OpenGL context for the AMD GPU the context are created properly.</p> <p>When i have NVIDIA as default GPU: in the case of NVIDIA devices the context are created properly , but when i try create the AMD context, instead return me an error, the system Crash!</p> <p>So, my main problem is how to detect the default GPU during Runtime to create interoperability contexts, only for the default GPU since the AMD are crashing instead return error...(Becouse with the errors i can setup a flag informing the default GPU based on this results...).</p> <p>Anyone have an idea of how can i detect the default GPU at runtime using C++ ?</p> <p>Kind Regards.</p>
2
WebGL: fade drawing buffer
<p>I've set <code>preserveDrawingBuffer</code> to <code>true</code>. Doing this results in everything drawn on the buffer to be seen all at once, however, I was wondering if there is a way to somehow fade the buffer as time goes on so that the old elements drawn disappear over time, and the newest drawn elements appear with a relatively high opacity until they also fade away. </p> <p>Is there a better way to achieve such an effect?</p> <p>I've tried to render previous elements again by lowering their opacity until it reaches 0 but it didn't seem like an efficient way of fading as once something is drawn I don't plan on changing it.</p> <p>Thanks!</p>
2
needed to show Toastr Notification jquery Plugin
<p>guys, i am using Toastr Notification (jquery Plugin) whenever user updates record it shows notification of success alert using plugin but problem is that whenever I update record it shows error in the console of the browser </p> <pre><code>**Uncaught ReferenceError: success is not defined** my alert code is &lt;?php if($update_recored) { ?&gt; &lt;script&gt; Command: toastr[success]("Record Updated", "Successfully Updated"); &lt;/script&gt; &lt;?php } ?&gt; </code></pre>
2
Setting video.currentTime in componentDidMount with Reactjs (HTML5 Video Element) not working in Safari?
<p>I am using reactjs with the flux architecture to run a html5 video. I store the users currentTime in my database so when they come back to the page the user has the option to resume or restart the video. I was setting the videos's currentTime with this.video.currentTime in componentDidMount. This seems to work beautifully except in Safari!!!! Am I doing something wrong? the video is give a refs in accordance to the following instructions <a href="https://facebook.github.io/react/docs/more-about-refs.html" rel="nofollow">https://facebook.github.io/react/docs/more-about-refs.html</a></p> <p>Here is where I reference my video in componentDidMount:</p> <pre><code>componentDidMount: function(){ if (this.video !== null) { this.video.currentTime = this.props.persistedCurrentTime; this.video.addEventListener('ended', this.handleOnEnded); } }, </code></pre> <p>In the render I do a refs on the video which is why i'm using this.video above. Here is the render of this component:</p> <pre><code>render: function() { return ( &lt;video ref={function(ref) { this.video = ref }.bind(this)} controls={false} onClick={this.handleClick} onPlay={this.handleOnPlay} onPause={this.handleOnPause} onTimeUpdate={this.handleTimeUpdate} onVolumeChange={this.handleVolumeChange} onMute={this.handleMute} id="video"&gt; &lt;source src={this.props.src} type="video/mp4" /&gt; &lt;/video&gt; ); } </code></pre> <p>To try and better understand what was happening I used several console.log statements in the componentDidMount. Here is what I printed:</p> <pre><code> if (this.video !== null) { console.log("this.video = "+this.video) console.log("this.props.persistedCurrentTime = "+this.props.persistedCurrentTime) console.log("this.video.currentTime = "+this.video.currentTime) this.video.currentTime = this.props.persistedCurrentTime; console.log("this.video.currentTime = "+this.video.currentTime) } </code></pre> <p>In the console of Chrome I receive the following feedback:</p> <pre><code> this.video = [object HTMLVideoElement] this.props.persistedCurrentTime = 35 this.video.currentTime = 0 this.video.currentTime = 35 </code></pre> <p>Which is what I expected to receive, as it progresses the video's currentTime to 35 seconds. </p> <p>However, in Safari I receive the following:</p> <pre><code>[Log] this.video = [object HTMLVideoElement] (main.js, line 770) [Log] this.props.persistedCurrentTime = 35 (main.js, line 771) [Log] this.video.currentTime = 0 (main.js, line 772) [Log] this.video.currentTime = 0 (main.js, line 774) </code></pre> <p>notice that in the last line the video.currentTime is not 35 seconds :( WHY!!!!!! It is clear that the video element has mounted from the first line. What's even more crazy is that if I do this.video.currentTime = 35 in the console, the video moves to 35 seconds! </p> <p>In advance, thank you for any advice.</p>
2
How to hide child pages under specific parent from wordpress search result
<p>I have been looking for a way to tweak my wordpress search results.</p> <p><strong>This is what I want:</strong></p> <p>In my site I have posts, pages &amp; and custom post types. Now there are certain pages which in a child page of other page. For example, let's say there is a parent page called <code>Services</code> and there are 5 child pages under it named as <code>ABC Service</code>, <code>XYZ Service</code> and so one.</p> <p>Now I want to return the following things only, in the wordpress search result:</p> <ul> <li><p>All Posts</p></li> <li><p>Pages (Not the Services Page and any child pages under it). So all page will show up in the search except the <code>Services</code> page and all the 5 child page which has parent page set up as <code>Services</code>.</p></li> <li><p>Other custom post types</p></li> </ul> <p><strong>This is what I did:</strong></p> <p>First I created a small function to check the sub pages:</p> <pre><code>function ism_is_subpage() { $post = get_post(); if ( is_page() &amp;&amp; $post-&gt;post_parent ) { return $post-&gt;post_parent; } else { return false; } } </code></pre> <p>after this I have created a wordpress <code>pre_get_posts</code> filter call to pass it though. Like this:</p> <pre><code>add_filter('pre_get_posts', function( $query ) { if (!$query-&gt;is_admin &amp;&amp; $query-&gt;is_search) { $query-&gt;set('post_type', array('post', 'page', 'other-post-type1')); } return $query; }); </code></pre> <p>But the problem is no matter how I call the <code>ism_is_subpage()</code>, I am not getting my desired result. </p> <p>Can any of you please help?</p>
2
How to get file name using C++17 Filesystem
<p>Suppose I have a path <code>"C:/SomeFolder/sometextfile.txt"</code>. How can a file name, <code>"sometextfile.txt"</code>, be extracted from a path using C++17 filesystem library?</p>
2
Bootstrap collapsible navbar with search bar: form-inline does not scale well with resizing
<p>(fiddle link: <a href="https://jsfiddle.net/xdo6u5p6/1/" rel="nofollow noreferrer">https://jsfiddle.net/xdo6u5p6/1/</a>)</p> <p>I'm having difficulty placing a search bar into my navbar-default without having the formatting completely messed up when resizing. In desktop view, my header looks like so:</p> <p><a href="https://i.stack.imgur.com/mZi5c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mZi5c.png" alt="enter image description here"></a></p> <p>Now, if I were to resize the window width small enough (or go to mobile). The header looks like:</p> <p><a href="https://i.stack.imgur.com/KIPz3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KIPz3.png" alt="enter image description here"></a></p> <p>The search bar has kicked the list items onto the next line and looks pretty ugly. Even worse is if I resize it to the point where the menu collapses:</p> <p><a href="https://i.stack.imgur.com/W2Oj7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W2Oj7.png" alt="enter image description here"></a></p> <p>The root cause of the issue is my <code>form-inline</code>, because without that search bar the header works perfectly. How can I allow the header to fit everything on one line up until it collapses, then correctly align the search bar somewhere in the collapsed window? My initial guess is that setting the <code>margin-left</code> of the form inline to <code>70</code> is a big part of the problem, but I don't want the form sitting right beside the banner. Here's the html :</p> <pre><code>&lt;div class="navbar navbar-default"&gt; &lt;div class="container-fluid"&gt; &lt;div class="navbar-header"&gt; &lt;button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#header"&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;span class="icon-bar"&gt;&lt;/span&gt; &lt;/button&gt; &lt;a href="../index.html" class="navbar-brand"&gt;Highli.ne&lt;/a&gt; &lt;/div&gt; &lt;div class="collapse navbar-collapse" id="header"&gt; &lt;form class="form-inline"&gt; &lt;div class="form-group"&gt; &lt;input type="text" class="form-control" id="search" placeholder="Search area or name" /&gt; &lt;/div&gt; &lt;button type="submit" class="btn btn-default"&gt;Search&lt;/button&gt; &lt;/form&gt; &lt;ul class="nav navbar-nav navbar-right"&gt; &lt;li&gt;&lt;a href="register.html"&gt;Register&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="login.html"&gt;Login&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="about.html"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>and the css:</p> <pre><code>/* header -- begin */ .navbar-default { z-index: 1; background-color: #2457af; border-radius: 0; border-style: none; position: fixed; left: 0; right: 0; margin: 0 auto 0 auto; padding: 10px 30px; } .navbar-header .navbar-brand, .navbar-header .navbar-brand:hover { color: white; text-decoration: none; font-size: 36px; } .navbar-default .form-inline { display: inline-block; margin-top: 10px; margin-left: 100px; } .navbar-default .form-control { background-color: rgba(0,0,0,0.7); border-style: none; border-radius: 0; font-size: 16px; color: white; } .navbar-default .btn-default { border-radius: 0; display: inline; background-color: rgba(0,0,0,0); color: white; } .navbar-default .navbar-nav { list-style: none; display: inline-block; } .navbar-default .navbar-nav li { display: inline; padding: 0 10px; } .navbar-default .navbar-nav li a { color: white; } .navbar-default .navbar-nav li a:hover { color: white; text-decoration: underline; } /* header -- end */ </code></pre>
2
Twisted Klein: Synchronous behavior
<p>I am using Twisted Klein because one of the promise of the framework is it is Asynchronous, but i tested that app i develop and a little code for testing and the framework behavior seems to be synchronous.</p> <p>The test server code is:</p> <pre><code># -*- encoding: utf-8 -*- import json import time from datetime import datetime from klein import Klein app = Klein() def setHeader(request, content_type): request.setHeader('Access-Control-Allow-Origin', '*') request.setHeader('Access-Control-Allow-Methods', 'GET') request.setHeader('Access-Control-Allow-Headers', 'x-prototype-version,x-requested-with') request.setHeader('Access-Control-Max-Age', 2520) request.setHeader('Content-type', content_type) def cleanParams(params): for key in params.keys(): param = params[key] params[key] = param[0] return params @app.route('/test/', methods=["GET"]) def test(request): setHeader(request,'application/json') time.sleep(5) return json.dumps([str(datetime.now())]) if __name__ == "__main__": app.run(host='0.0.0.0',port=12030) </code></pre> <p>And the request for testing is:</p> <pre><code># -*- encoding: utf-8 -*- import requests from datetime import datetime if __name__ == "__main__": url = "http://192.168.50.205:12030" params = { } print datetime.now() for i in xrange(6): result = requests.get(url + "/test/", params) print datetime.now(), result.json() </code></pre> <p>With the server up, if i run the second code alone:</p> <pre><code>2016-07-19 12:50:53.530000 2016-07-19 12:50:58.570000 [u'2016-07-19 12:50:58.548000'] 2016-07-19 12:51:03.604000 [u'2016-07-19 12:51:03.589000'] 2016-07-19 12:51:08.634000 [u'2016-07-19 12:51:08.625000'] 2016-07-19 12:51:13.670000 [u'2016-07-19 12:51:13.654000'] 2016-07-19 12:51:18.717000 [u'2016-07-19 12:51:18.708000'] 2016-07-19 12:51:23.764000 [u'2016-07-19 12:51:23.748000'] </code></pre> <p>Perfect, but if i run at the same time two instances:</p> <p>Instance 1:</p> <pre><code>2016-07-19 12:53:05.025000 2016-07-19 12:53:10.057000 [u'2016-07-19 12:53:10.042000'] 2016-07-19 12:53:20.113000 [u'2016-07-19 12:53:20.097000'] 2016-07-19 12:53:30.181000 [u'2016-07-19 12:53:30.166000'] 2016-07-19 12:53:40.236000 [u'2016-07-19 12:53:40.219000'] 2016-07-19 12:53:50.316000 [u'2016-07-19 12:53:50.294000'] 2016-07-19 12:54:00.381000 [u'2016-07-19 12:54:00.366000'] </code></pre> <p>Instance 2:</p> <pre><code>2016-07-19 12:53:05.282000 2016-07-19 12:53:15.074000 [u'2016-07-19 12:53:15.059000'] 2016-07-19 12:53:25.141000 [u'2016-07-19 12:53:25.125000'] 2016-07-19 12:53:35.214000 [u'2016-07-19 12:53:35.210000'] 2016-07-19 12:53:45.270000 [u'2016-07-19 12:53:45.255000'] 2016-07-19 12:53:55.362000 [u'2016-07-19 12:53:55.346000'] 2016-07-19 12:54:05.402000 [u'2016-07-19 12:54:05.387000'] </code></pre> <p>And the server output:</p> <pre><code>2016-07-19 12:53:10-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:04 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:15-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:10 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:20-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:15 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:25-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:20 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:30-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:25 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:35-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:30 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:40-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:35 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:45-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:40 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:50-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:45 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:53:55-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:50 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:54:00-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:53:55 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" 2016-07-19 12:54:05-0400 [-] "192.168.50.205" - - [19/Jul/2016:16:54:00 +0000] "GET /test/ HTTP/1.1" 200 30 "-" "python-requests/2.9.1" </code></pre> <p>As you can see, the server is blocking the current execution and it seems to be working in synchronous instead asynchronous.</p> <p>What i am missing?</p> <p>Best Regards.</p>
2
Xamarin Forms - Two ListViews Stacked
<p>I have a simple Content Page that I want two ListViews to live. I want the ListViews stacked on top of each other.</p> <p>If I add them as part of a StackPannel, each ListView takes up half the View vertically. However, I want the first (top) ListView to expand all the way when scrolling, then pickup the second ListView. So essentially the height of the View needs to be the height of each ListView combined.</p> <p>I could accomplish this via 1 ListView and just do Grouping, but in this case I want two separate ListViews that are fully expanded vertically.</p> <p>What is the trick to accomplish this? Should I be using the ScrollView element? </p>
2