input
stringlengths
51
42.3k
output
stringlengths
18
55k
Return first and last digits of an integer using while loop <p>I've been trying to write a program that uses a while loop to return the first and last digits entered. </p> <p>Here's what I've got so far:</p> <pre><code>import java.util.Scanner; public class FirstLastInt { public static void main(String[]args) { i...
<p>If you want to keep using your own code to see how it can be achieved that way then change your while condition and take system print outside:</p> <pre><code>import java.util.Scanner; public class FirstLastInt { public static void main (String[] args) { int ldig, num; Scanner in = new Scanner(S...
Multiple File groups on a Virtual machine for SQL Server <p>In many of the SQL Server articles it is mentioned that the best practice is to use multiple File group on a physical disk to avoid disk contention and disk spindle issues .So my query are :</p> <p>1:Does the same theory of having multiple file group hold t...
<p>The question needs a bit more information about your environment. If the drives for the VM are hosted on a SAN somewhere and the drives presented to the VM are all spread across the same physical disks on the SAN then you're not going to avoid contention. If, however, the drives are not on the same physical drives t...
How do I load an png image on unity3d and use a loading scene <p>I am making a loading scene . I am not using a loading bar . I going to use a png image . The script I have is for loading png image . I don't have any errors . The png is already imported in the project. Here is what I got for code :</p> <pre><code>usin...
<p>So from what I understand you want a static image as your loading screen, in which case this should give you an idea of what you will need to do, keep in mind this script needs to be attached to a UI Image object to work.</p> <pre><code>using UnityEngine; using System.Collections; using UnityEngine.SceneManagement;...
Installing APK keeps on loading <p>I am new to android app development, am using an online platform to learn but I have been having serious issues with android studio(2.1.2). It was first giving me errors on gradle build then I created another project and the error didn't show in the new project but in the new project ...
<p>I already have the same issue before.</p> <p>In your gradle.properties you can enlarge the heap with this property : <code>org.gradle.jvmargs=-Xmx2048M</code>(2048 = 2Go RAM allocated for Gradle).</p> <p>In order to know if it's Android Studio issue or adb issue, you can try to install the APK by adb commands like...
How can I Select the values from different tables? <p>In an example below, how will I implement a sql query that selects from different tables.</p> <pre><code>SalesCodeA ---------------------------------------------------- ID | EMPLOYEE NAME | EMPLOYEE CODE || EMPLOYEE SALES 1 STEVE JOBS A 1...
<p>Probably you are looking for this(<code>UNION ALL</code>)</p> <pre><code>SELECT ID,[EMPLOYEE NAME],[EMPLOYEE CODE],[EMPLOYEE SALES] FROM TABLE_1 WHERE [EMPLOYEE CODE] = 'A' UNION ALL SELECT ID,[EMPLOYEE NAME],[EMPLOYEE CODE],[EMPLOYEE SALES] FROM TABLE_2 WHERE [EMPLOYEE CODE] = 'A' UNION ALL SELECT ID,[EMPLOY...
How to stop uninstalling android app using or ask password for enterprise app <p>I am developing Enterprise application and I want to know when the employees uninstalling the application.I have tried with DevicePolicyManager .I have googled it all are suggesting DevicePolicyManager,I have tried with <a href="http://www...
<p>The only way to do this is device policy management. You need to be the device owner, not just a device administrator. At that point, you can control the ability to install or uninstall applications. But there's no ability to just password protect a single app from being uninstalled- you have to control the phon...
AngularJS $watch not behaving as expected <p>I have a directive that should call a function whenever a service variable is changed.</p> <p>The following code is inside the directive:</p> <pre><code>$rootScope.$watch('movesService.selectedMove', function() { console.log(movesService.selectedMove); if (movesSer...
<p>With the plunker you have provided,I've made some changes in the watch function as below.</p> <pre><code>$scope.$watch('test', function() { //scope variable should be watched like this $scope.watchCount++ });//removed true for strict checking (===) as $scope.test is initalised as String 'Hello' </code></pre> <...
How do I generate automatic urls for this simple script? <p>I have a script that automatically loads an image from a directory everytime the page is refreshed. However, if the person wants to link to the image, they cannot, since there are no URLs generated. Here's the current script:</p> <pre><code>&lt;?php $imagesDi...
<p>All you need is a way to get parameters into your script. A common way is with the query string.</p> <pre><code>http://example.com/yourScript.php?image=abcdefg.jpg </code></pre> <p>Then in your PHP script, you can use <code>$_GET['image']</code> to determine that requested image was <code>abcdefg.jpg</code>.</p> ...
PHP - Redirected You Too Many Times Error On Server Not Localhost <p>I have a LAMP site running on an online server.<br> I tested the site on Localhost and it works fine.<br> I put the site on the server and got this error:</p> <pre><code>[SITE] redirected you too many times. ERR_TOO_MANY_REDIRECTS </code></pre> <p>I...
<p>Instead of putting <code>$user-&gt;is_logged_in</code> directly in the <code>if</code> statement, try using <code>isset($user-&gt;is_logged_in)</code></p> <pre><code>if (!isset($user-&gt;is_logged_in)) { die(header("Location: login.php")); } </code></pre> <p>And</p> <pre><code>if (isset($user-&gt;is_logged_in)) ...
angular material material design horizontal nav tabs convert to mobile menu when browser window size changes <p>I have created AMD page with horizontal tabs using <code>&lt;md-tab&gt;</code> and i want it to be mobile menu when i change browser size to small size then resize to normal and vice versa like bootstrap mobi...
<p>Here's an example of how you can show and hide elements based on screen size - <a href="http://codepen.io/camden-kid/pen/kkrOPP?editors=1010#0" rel="nofollow">CodePen</a></p> <p>In your code you would swap <code>md-tabs</code> with <code>md-menu</code> or <code>md-menu-bar</code>.</p> <p>Check the <a href="https:/...
pip ssl certificate error OSX installing scrapy <p>Getting an error from pip when installing scrapy on OS X El Capitan</p> <pre><code> ~ pip install scrapy Requirement already satisfied (use --upgrade to upgrade): scrapy in /usr/local/lib/python2.7/site-packages Requirement already satisfied (use --upgrade to upgra...
<p>The entire environment was broken.</p> <p>I deleted the following folders out of ~/usr/lib/</p> <ul> <li>python2.7</li> <li>python3.4</li> <li>python3.5</li> </ul> <p>Then did the following</p> <pre><code>brew uninstall python brew update brew upgrade brew doctor brew cleanup brew install python pip install scra...
Visual Basic 2010 Search datagrid but data was not complete <p>I have create 2 combobox enable user to choose the departure and destination and search for available flight, but i am facing a problem here.</p> <p>Before click on searching button, i can see the datagrid is showing all details, but once i click the searc...
<p>That is the wrong way to filter data. What you should be doing is binding your <code>DataTable</code> to a <code>BindingSource</code>, binding that to the <code>DataGridView</code> and then setting the <code>Filter</code> of the <code>BindingSource</code>. As you're using a typed <code>DataSet</code>, I'm guessing...
TSQL - Looking for code clarification <p>This is the code I used and the result is posted below:</p> <pre><code>SELECT * FROM (SELECT P.ProductID, PC.Name, ISNULL (P.Color, 'uncolored') AS color FROM SalesLT.ProductCategory AS PC JOIN SalesLT.Product AS P ON PC.ProductCateg...
<p><code>ProductID</code> won't show because you have used it as an aggregation column while pivoting the table. Only the counts of product Id for each colour will be shown. For seeing <code>ProductID</code> remove the pivot part of query. <code>Name</code> shows up in your final result because it is there in your inne...
Training data for Conversation Enhanced Watson Application <p>Looking at Retrieve and Rank Web UI bound to the conversation-enhanced application:<br> <a href="https://github.com/watson-developer-cloud/conversation-enhanced" rel="nofollow">https://github.com/watson-developer-cloud/conversation-enhanced</a></p> <p>no qu...
<p>That training data was created manually, not using the UI, using the approach described in <a href="https://www.ibm.com/watson/developercloud/doc/retrieve-rank/training_data.shtml" rel="nofollow">https://www.ibm.com/watson/developercloud/doc/retrieve-rank/training_data.shtml</a> (because it was prepared before the t...
Range of Bluetooth on iphone with other devices <p>I know bluetooth on iphone is class 2 and range is 30 feet. But i tried connecting 2 iphone via bluetooth and it's range is 40 - 50m.<br> What happens when I connect the iPhone with a class 1 Bluetooth device? what is range?<br> Can anyone give me an explanation?<br> T...
<p>Bluetooth power classes from Spec v4.2. <a href="http://i.stack.imgur.com/IKUpf.png" rel="nofollow"><img src="http://i.stack.imgur.com/IKUpf.png" alt="enter image description here"></a></p> <p>Typically two class1 devices can communicate over 100meters. where as Class2 devices communicate till 10 meters. mixing the...
How to print image that is in byte array using json <p>i am developing an app,in that i am calling services using json. In that whatever string data is there i am displaying it using textView. But i want to display image that is in byte array.Below is my code:</p> <pre><code> t1 = (TextView) findViewById(R.id....
<ol> <li><p>Parse your byte array <code>Image</code> from your json to a byte array variable.</p></li> <li><p>Convert your byte array to bitmap like below</p> <pre><code>Bitmap bmap = BitmapFactory.decodeByteArray(image, 0, image.length); // image is your byte array </code></pre></li> <li><p>Set the bitmap bmap to an ...
How can I populate a txt with results from a mechanized results? <p>I am trying to populate a txt file with the response I get from a mechanized form. Here's the form code</p> <pre><code>import mechanize from bs4 import BeautifulSoup br = mechanize.Browser() br.open ('https://www.cpsbc.ca/physician_search') first = r...
<p>This should not be too complicated. Assuming your file with all the names you want to query upon is called "names.txt" and the output file you want to create is called "output.txt", the code should look something like:</p> <pre><code>with open('output.txt', 'w') as file_out: with open('names.txt', 'r') as file_...
circle UIBezierPath with stork animation <p>I'm trying to draw a circle with UIBezierPath and add a stork animation to circle like this:</p> <p><img src="http://i.stack.imgur.com/i7PC3.gif" alt="circle animation"></p> <p>I don't know how to build this with UIBezierPath because I'm new to Swift. I tried some code on s...
<p>You can use this link as a reference.</p> <p><a href="http://stackoverflow.com/questions/28495396/custom-circle-progress-view/28495807#28495807">Custom circle progress view</a></p> <p>Take one image with same gradient</p> <p><a href="http://i.stack.imgur.com/mZdN9.png" rel="nofollow"><img src="http://i.stack.imgu...
Using For Loops To Initialize And Add JTextFields and JLabels to JPanel Using Arrays Causes Error <p>I'm trying to make a program that takes input from the user for how many students they have in their class and their names/grades and calculate average and letter grades. I'm trying to get better with <em><strong>For Lo...
<p>The exception stack trace points to this line:</p> <pre><code> p.add(nlabel[i]); </code></pre> <p>So either <code>nlabel[i]</code> is <code>null</code>, or <code>p</code> is <code>null</code>. But <code>nlabel[i]</code> was initialised to a non null value in the previous loop, pointing to <code>p</code> as ...
Unable to process jar entry from Jar <p>I'm trying to run simple program on restfull api and i'm getting the following Exception</p> <pre><code>&gt;Sep 12, 2016 10:05:02 AM org.apache.catalina.startup.ContextConfig processAnnotationsJar SEVERE: Unable to process Jar entry [javassist/tools/rmi/RemoteRef.class] from Jar...
<p>Which jdk version you are using? I tried with jdk version after 1.8.0_92 and issue got resolved for me. Before that my jar artifacts were not able to build due to NoClassDefFoundError. Though compilation shown valid class existence.</p>
Abstract class member inaccessible due it's protection level <p>How do I access a protected member of an abtsract class? Assume I have classes defined as below</p> <pre><code>public abstract class BaseClass { private int index ; protected int GetIndex { get { return index ;} set { index =...
<p>Your problem is exactly what <strong>protected</strong> is meant to be used for.</p> <p>It <strong>protects</strong> fields/methods from being used from <strong>outside</strong> of the base class or sub classes. TestClass is not derived from BaseClass or MyClass; and does you can't get to <em>GetIndex</em>. It is a...
Java 6 - StackOverflowError when trying to copy and paste a file <p><strong>Java 6</strong><br> <strong>jboss-as-7.1.1.Final</strong></p> <p>I need to copy and paste a file. Using org.apache.commons.io.FileUtils and I tried with the following code,</p> <p>If I invoke <code>sync()</code> from a jsp, getting </p> <bl...
<p>I'm guessing that since you're copying your file into the WAR that has the program that is copying it, it then syncs. Which then copies the file into the WAR which is copying it, and then syncs. Which then copies the file into the WAR which is copying it, and then syncs....</p> <p>JBoss is smart enough to try to ...
Receiving and empty list when trying to make a webscraper to parse websites for links <p>I was reading <a href="http://docs.python-guide.org/en/latest/scenarios/scrape/" rel="nofollow">this</a> website and learning how to make a webscraper with <code>lxml</code> and `Requests. This is the webscraper code:</p> <pre><co...
<p>First off, your xpath is wrong, there are no classes with <em>data-url</em>, it is an <em>attribute</em> so you would want <code>div[@data-url]</code> and to extract the attribute you would use <code>/@data-url</code>:</p> <pre><code>from lxml import html import requests headers = {"User-Agent":"Mozilla/5.0 (X11;...
Parsing time with Regex in Java <p>The code snipped below is trying to extract the hour, minutes and seconds of a string. Ex: "PT5M30S"<br> "PT1H13M59S"</p> <p>I am getting a NullPointerException in this line (group=null): int number = new Integer(group.substring(0, group.length()-1));</p> <pre><code> // Create a...
<p>Just try to compile this code for both the <code>String</code>'s individually, one by one.</p> <p>You'll then notice that this program compiles successfully for the second String i.e., <code>PT1H13M59S</code> whereas it gives <code>NullPointerException</code> for the first String, i.e., <code>PT5M30S</code></p> <p...
Sub-setting data table using & and grepl <p>I've got a data set with column names like:</p> <pre><code>names(d) [1] "Code" "LX(RI)" "LX(VO)" "LX(MV)" "LX(WC189)" "LX(WC035)" [7] "NX(RI)" "NX(VO)" "NX(MV)" "NX(WC189)" "NX(WC035)" "AX(RI)" [13] "AX(VO)" "AX(MV)" "A...
<p>Try this </p> <pre><code>ab &lt;- c("Code","LX(RI)","LX(VO)","LX(MV)","TX(RI)","NX(RI)","NX(RI)") ab[grepl("Code|RI",ab)] [1] "Code" "LX(RI)" "TX(RI)" "NX(RI)" "NX(RI)" </code></pre>
Azure SSL and TrafficManger Implementation <p>I have Requirement where i want to configure Azure Traffic Manager with SSL. I have Scenarion like I have Hosted WebAPP1.azurewebsite.ne and WebAPP2.azurewebsite.net and configured trafficmanager top of that lets say mytrafficmanager.trafficmanager.net. now i want to buy t...
<p>It is not clear from your question where you want to use SSL protection. Could you clarify if it for the health probes originating from Azure Traffic Manager or whether it is for another scenario?</p> <p>Thanks, Dilip L [MSFT]</p>
Updating nested map with multiple keys <p>Say we have map like this:</p> <pre><code>state = %{ data: %{ "default" =&gt; %{ "someKeyword" =&gt; %{updated: 2}}, "baila" =&gt; %{ "someKeyword" =&gt; %{updated: 2}}, "morena" =&gt; %{updated: 2} } } <...
<p>Here's one way using <code>Enum.reduce/3</code> and <code>Kernel.put_in/3</code>:</p> <pre><code>state = %{ data: %{ "default" =&gt; %{ "someKeyword" =&gt; %{updated: 2} }, "baila" =&gt; %{ "morena" =&gt; %{updated: 2} } } } new_keyword = %{"someKeyword" =&gt; %{updated: 3, othe...
Runing cuda socket program <p>I want to create a socket conected directly to the gpu. I would like to send data from a server to the gpu without spending a copy/moving time from host to device. Is it possible?</p>
<p>If you have suitable network hardware and are willing to write your own device driver for your network adaptor, then <a href="http://docs.nvidia.com/cuda/gpudirect-rdma/index.html#axzz4K15QrVmc" rel="nofollow">maybe</a>. <a href="https://developer.nvidia.com/gpudirect" rel="nofollow">Several</a> Infiniband and iWARP...
Lync Client SDK 2013 : Skype for Business File Attachement <p>I'm trying to log the file name when attaching the file in skype for business by using Lync Client SDK 2013. I used the ContentSharingModality's ModalityStateChanged and ContentAdded event.</p> <p>My problem is that this ContentSharingModality's event only ...
<p>Content sharing is a feature of the conference server so it's only available in meeting conversations. It's not available in one-to-one conversations. </p> <p>As soon as you add content in the Lync Client UI your conversation is auto-upgraded to a meeting conversation. If your using the Lync Client SDK you have ...
Spring AMQP - Sender and Receiving Messages <p>I am facing an issue in receiving a message from RabbitMQ. I am sending a message like below</p> <pre><code> HashMap&lt;Object, Object&gt; senderMap=new HashMap&lt;&gt;(); senderMap.put("STATUS", "SUCCESS"); senderMap.put("EXECUTION_START_TIME", new...
<blockquote> <p>it leads to an exception</p> </blockquote> <p>What exception?</p> <blockquote> <p><strong>TypeId</strong>: com.diff.approach.JobListenerDTO</p> </blockquote> <p>That means you are sending a DTO, not a hash map as you describe in the question.</p> <p>If you want to remove the typeId header, you c...
How to calculate aggregate values in distributed architecture <p>I have a cluster of Web applications (Java + Tomcat), and the apps generate events. The volume is not that high, but somewhere under 10 million of events per day (unevenly distributed with peaks and valleys). </p> <p>We need to display calculated aggrega...
<p>You can go with a push model or a pull model. (Or proactive/reactive if you like those terms better.) In both cases you've got a centralized records-keeper that must aggregate the data you want. In the push model your decentralized services/servers/applications will periodically push updates to your records keeper. ...
Splash Screen Winforms <p>I have a .Net Winform application which will take some time to load.</p> <p>I want to create a Splash Screen which will start when I click on my Application and closes when my Application opens up.Basically through Splash Screen I want to moniter the initialization process of my Application <...
<p>That's a lot of questions, I'll answer the "how to create a splash screen" and then you can try further with cancelling and showing initialization progress.</p> <p>You basically create another form which acts as the Splash form.</p> <p>Set the properties:</p> <ul> <li>StartPosition = FormStartPosition.CenterScree...
Send Windows 10 Notification from Windows Service <p>I can find code on how to fire a Windows 10 notification from an Universal Windows App, or a remote notification from a cloud server, but I can't see how to make one from a background Windows Service.</p> <p>Is this possible to be made?</p>
<blockquote> <blockquote> <p>"Is this possible to be made?"</p> </blockquote> </blockquote> <p>If you want to push notifications from background task. The answer is yes.</p> <p>You would need to know some background task knowledge in UWP. Please read this document for details: <a href="https://msdn.microsoft....
How to remove (make invisible) EditText's cursor thumb? <p>How to remove (make invisible) EditText's cursor thumb and make cursor position unchangeable?</p>
<p>You can use either the xml attribute <code>android:cursorVisible="false"</code> and add this <code>&lt;requestFocus /&gt;</code> in <strong>edittext</strong> before closing. or the java function <code>editext.setCursorVisible(false)</code>.or try this xml attribute <code>android:textCursorDrawable="@null"</code></p>...
Wait for daemon threads to complete an iteration using an executor service <p>I have to parallelize an existing background task such that instead of serially consuming 'x' resources, it parallely finishes the job at hand using only 'y' threads (y &lt;&lt; x). This task constantly runs in the background and keeps proces...
<p>Your code seems to be unnecessarily complex. Why have your own queue when there is a queue already inside of the <code>ExecutorService</code>? You are having to do a whole bunch of administration when I think that you can let the stock <code>ExecutorService</code> handle it for you.</p> <p>I'd define your jobs as...
How to change image height and width to CGPoint in iOS? <p>I am new in iOS. I need help to image height,width to eight point to change like as crop image,in bottom i show image change height, width can you have any demo for this?</p> <p><img src="http://i.stack.imgur.com/ccIbj.png" alt="image"></p>
<p>you should see this link hep you for your<a href="https://github.com/baris/ResizeImages" rel="nofollow">see this</a> image height,width to eight point</p>
How to disable "automatically manage signing" in Xcode 8 <p>My Xcode project in Xcode 8 has a check in "automatically manage signing" as a default.<br> How can I disable it by using CLI, not Xcode, because my Cordova-based app has to be built by Jenkins.</p> <p>After opening the Xcode project, I disable the check and ...
<p>We are using automatically managed signing with Xcode 8 and Cordova through Jenkins. I wrote about how we set it up here:<br> <a href="https://dpogue.ca/articles/cordova-xcode8.html" rel="nofollow">https://dpogue.ca/articles/cordova-xcode8.html</a></p> <p>To recap, you need to specify your developer team ID. In the...
How can I select a older version of ubuntu ie 12.04 in aws ec2 instance.when I launch the instance I can only see ubuntu 14.x <p>I need ubuntu 12.04 for my cloudera manager to install.It can't be installed on 14.04.So how can I choose the older version of ubuntu in mt ec2 instance?</p>
<p>Go to: <a href="https://cloud-images.ubuntu.com/locator/ec2/" rel="nofollow">Ubuntu AMI Finder</a></p> <p>Scroll All the way to bottom of the page. Select version as <code>12.04</code>. Select region and it will return a list of AMIs</p> <p><a href="http://i.stack.imgur.com/30mQ8.png" rel="nofollow"><img src="http...
MySQL database sync options <p>What are some of the good options to sync two or more MySQL databases of the same schema, situated at different locations; reliably?</p> <p>We have four database in four different locations.</p> <p>we tried using the generic master master replication but the link breaks again and again ...
<p><a href="http://www.jumpmind.com/products/symmetricds/overview" rel="nofollow">SymmetricDS</a> can replicate MySQL to MySQL. There is also a <a href="http://www.symmetricds.org/" rel="nofollow">community edition</a></p>
How to store user profile information in firebase database android <p>I am making an activity to store user'sinformation in firebase database. this is the code which i have trued, but it is not storing any value in databse neither signout button is working...</p> <p>activity_profile.xml</p> <pre><code>&lt;?xml versio...
<p>once user model gets filled by the profile details (feilds)</p> <pre><code>Map&lt;String, Object&gt; childUpdates = new HashMap&lt;&gt;(); myRef = database.getReference("parent_node**strong text**name").child(user_profile_id); myRef.child(user_profile_id).push(); childUpdates.put(user_profile_id, usermodel); my...
Bugzilla integration with sonarqube <p>I want to setup one build automation environment, in which code should be statically analysed first, and the issues which are identified as part of static analysis should be raised as bugs.</p> <p>for static analysis, I am using sonarQube and for bugs, I am using Bugzilla.</p> <...
<p>Not only is this not available, it's not recommended, for a couple of reasons. </p> <p>First, not every issue raised by SonarQube should be an individual work ticket:</p> <ul> <li>some will be resolved as Won't Fix - i.e. valid issues but not relevant for your context. </li> <li>some issues can be handled en mass...
How to run cucumber scenario multiple time without using Scenario Outline <p>In my cucumber jvm project, I want to execute my scenario 10 times with the same set of data (data being provided in excel) without using scenario outline.</p> <p>Can anyone guide me how to achieve this?</p>
<p>First of all <code>Scenario Outline</code> is designed to be used in cases when your input data is changing. So that doesn't fit your case in the first place.</p> <p>AFAIK you have the following options:</p> <p><strong>Set the logic internally in the step</strong>. Meaning looping through the required actions ins...
How to refer to a function in HTML? <p>I am making an html file that basically prints out the coordinates given by the user in a map. Whenever I click the submit button, it returns me an error of "UncaughtReferenceError: NewMap is not defined" i tried using an external javascript and inline javascript but it does not s...
<ol> <li>Include Google Map Library</li> <li><p>You have missed out a comma after center property.</p> <p>var mapOptions = { center: document.getElementById("Lat, Lng"), zoom:15 }</p></li> </ol>
Return report in html format <p>I wrote a Crystal Report in Visual Studio. The controller uses a SQL query to find a blacklisted truck and return it in PDF format. Now I want to return it as an HTML object to make the report clickable. How can I do this?</p> <pre><code>var c = db.Database.SqlQuery&lt;Models.Reports.bl...
<p>Try this:</p> <pre><code>Stream s = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.HTML40); return File(s, "text/html","blacklisted.html"); </code></pre>
Call Model Method In Controller In Yii <p>Hello Friends I am new to Yii2 Framework. </p> <p>i am writing following code as specified in mention filename still....</p> <p>While i am calling model method then does not showing output showing <strong>500 error</strong> in console </p> <p>Is Any Mistake in code then plea...
<p>call your method without <code>models()</code></p> <pre><code>$data = Site::getData(); </code></pre>
python create nested directory based on two lists <p>Good morning,</p> <p>This might be easy but I´m just starting with python. For learning: Is there are 'cleaner' way creating a nested dict based on two lists than this:</p> <pre><code>person = ['mama.a','mama.b', 'mama.c', 'mama.d', 'papa.a', 'papa.b'] ki...
<pre><code>{p.split('.')[0]: {k: [] for k in kind} for p in person} </code></pre>
How to check recieved parameter in javascript function an instance of user defined object? <p>I have a javascript function with a variable 'object' which may recieve any of two types of object ,say x and y object</p> <pre><code>function myFunction(object){alert(instanceof object) }; </code></pre> <p>Is there somethin...
<blockquote> <p>Is there something like this? It should alert x or y</p> </blockquote> <p>Yes:</p> <pre><code>alert(object instanceof TheConstructorYouWantToCheckAgainst); </code></pre> <p>If I read your question correctly, your constructors are <code>x</code> and <code>y</code> (convention would be to use an uppe...
Android Studio Advice <p>On my Android Studio, it says it "cannot resolve R symbol." So I tried rebuilding it and cleaning it several times, but it's still like this. </p> <p>What do I do?</p> <p>Here's my code- The first url shows my code</p> <p><a href="http://i.stack.imgur.com/8vkvl.png" rel="nofollow"><img src="...
<p>This happens quite often to me too. I usually end up going File> Invalidate Caches and Restart which fixes it 99% of the time</p>
Test cases getting failed when trying to do with mocha and chai <p>I am trying simple test cases using mocha framework </p> <p>I have written simple typescript </p> <pre><code>class Rectangle { constructor(width, height) { this.width = width; this.height = height; } get height() { ...
<p>If you look in the <a href="http://chaijs.com/guide/styles/#should" rel="nofollow">docs for Should</a> you'll see this:</p> <blockquote> <p>var should = require('chai').should() //<strong>actually call the function</strong></p> </blockquote> <p>So your code needs to look like this:</p> <pre><code>import * as ch...
Equivalent of repeated takeWhile calls: does this function have a "standard" name? <p>I have a scenario where the standard <code>List.groupBy</code> function isn't what I want, but I don't know the right name for this function so it's making it hard to search for.</p> <p>I have a list of items of type <code>'T</code>,...
<p>I'm a little late and it seems that you have found a solution, and it seems that there doesn't exists a single function i F# that can handle the problem.</p> <p>Just for the challenge I tried to find some usable solutions and came up with the following (whether they are efficient or not is up the reader to deside):...
Show the saved images in gallery <p>I am creating a directory to store the bitmap images.This is my code:</p> <pre><code> String root = Environment.getExternalStorageDirectory().toString(); File myDir = new File(root + "/ABC"); myDir.mkdirs(); Random generator = new Rand...
<p>Use this broadcast </p> <pre><code> if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.KITKAT) { Intent mediaScanIntent = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri contentUri = Uri.fromFile(out); //out is your file you saved/delete...
FileNotFoundException in LIUM Speaker Diarization after re-sampling <p>I am trying to configure LIUM tool for speaker diarization. This question is a follow up of <a href="https://stackoverflow.com/questions/18967169/unsupportedaudiofileexception-in-lium-speaker-diarization#">UnsupportedAudioFileException in LIUM Speak...
<p>File not found exception means the file is missing. Indeed you lack a space here:</p> <pre><code>--fInputMask= C:\Users\Ravi\Desktop\converted_f2.wav--sOutputMask= C:\Users\Ravi\Desktop\converted_converted_2.seg </code></pre> <p>You need a space before <code>--sOutputMask</code> </p> <pre><code>--fInputMask= C...
Android not receiving Firebase Push Notification - MismatchSenderId <p>I'm trying to work on a messenger app, but the twist here is I have 2 Entities (<em>i.e. 2 apps A &amp; B</em>) here.</p> <p>Now I'm trying to put messaging logic between the two using Firebase. Firebase doesn't support communication between two di...
<h3>Edit #1:</h3> <p>1) Make sure you are sending a valid json to the fcm. 2) Make sure you are sending to the right token.</p> <p>Other informations on how to send notifications:</p> <p><strong>Send messages to specific devices</strong></p> <p>To send messages to specific devices, set the to the registration tok...
Problems with reading in a text file, annoying error <p>I am trying to parse this text file, but I keep getting an error </p> <blockquote> <p>"error reading file exception" </p> </blockquote> <p>from my code. I am looking over and over at the code and I can't see what is wrong. Any ideas as to what can be the error...
<p>Your <code>br.close();</code> is in the <code>while</code>-loop but should be after the loop. This way you close the file after reading the first line.</p> <p>So the fixed code (not tested) should look like this:</p> <pre><code>public static List&lt;String&gt; parseCode() { List&lt;String&gt; inputList = new A...
Passive to active voice NLP <p>I am in a need of converting a passive sentence to active sentence. Using stanford NLP parser, I came to know that I can detect active/passive voice. Can somebody throw some light on whether we can do this? If so, would be much helpful if some examples/link is provided.</p> <p>1) what I ...
<p>Update: There are some <a href="https://github.com/rgrishman/jet/blob/52ca610354b9e76d954e62725e0fb56762e674d1/src/main/java/edu/nyu/jet/parser/DepTransformer.java#L233-L260" rel="nofollow">hacky ways</a> of doing this; not sure how good is the quality. </p> <hr> <p>Use this <a href="https://github.com/IllinoisCo...
How to prevent System.getProperty("user.name") from being spoofed <p>I am building a desktop app in java where I need the logged in username . I am using <code>System.getProperty("user.name")</code> to get the username.</p> <p>But this can be spoofed by using </p> <pre><code>Properties p = System.getProperties(); ...
<p>System properties are not environment variables. Use <code>System.getenv("USERNAME")</code> for environment variables. <code>System.properties</code> can still be set by user on java command line with <code>java -Duser.name=someoneelse</code>.</p>
Pass data from index method of one controller to create of another <p>I generated a devise model User, and I also have a Conversation controller. I'm showing all users, except the logged in one, and I'm trying to create a new Conversation between user1 and user2, but I get redirected to the index method of the Conversa...
<p>By default <code>link_to</code> helper sends GET request. You can do it with adding <code>method: :post</code> to its options.</p> <pre><code>&lt;%= link_to 'Send', path, method: :post %&gt; </code></pre>
Cannot recognise the typedef type defined in .h file <p>I'm having issues getting the compiler to recognise the return type for a function template in a .tem file (used for separating the implementation from the .h file).</p> <pre><code>In file included from tests/Graph.h:57:0, from tests/test1.cpp:3:...
<ol> <li><p>Add the qualified name for them (with <code>typename</code> keyword, see <a href="http://stackoverflow.com/questions/610245/where-and-why-do-i-have-to-put-the-template-and-typename-keywords">Where and why do I have to put the “template” and “typename” keywords?</a>), like:</p> <p><code>typename Nod...
Is this async or blocking code? <p>Is this blocking code if I have <code>JSON.stringify</code> inside <code>writeFile</code>.Lets say it is big file. Is this why I am getting error <code>conection refused</code> when I push button multiple times in second which triggers this api endpoint?</p> <pre><code> app.patch('/'...
<h3>Edit #1:</h3> <p><code>JSON.stringify</code> parsing object to string <strong>synchronously</strong>. but you missing that you called <code>JSON.stringify</code> inside the <code>patch</code> function and not inside the writeFIle.</p> <h3>Original:</h3> <p>It's <code>Async</code>. if you want to write a file syn...
How many objects were created where B is inherited from A? <p>Here are two classes, </p> <pre><code>class A { } class B extends A { } </code></pre> <p>and <strong>A</strong> is inherited from <strong>B</strong>.What confuses me is that How many objects were created when I use the following code</p> <pre><code>A a = ...
<p><strong>One</strong> object is created, which is a <code>B</code> object, which has both the aspects defined by <code>A</code> and the aspects defined by <code>B</code>. Since it incorporates all of the aspects defined by both of them, it's <code>instanceof</code> both <code>A</code> and <code>B</code>.</p> <blockq...
Angularjs push table row to another table <p>I have 2 tables i want to push the row of the first table to the second. table 1 :</p> <pre><code>&lt;table&gt; &lt;tr ng-repeat="row in items"&gt; &lt;td&gt;{{row.PRODUCTDESCRIPTION}}&lt;/td&gt; &lt;td&gt;&lt;input type="text" ng-model="quantity[$i...
<p>You can use <code>ng-model</code> and create a new property on all the items. </p> <p><a href="http://plnkr.co/edit/aSrKlU8DjCcqVvz04dvT?p=preview" rel="nofollow">plunker Example</a></p>
SQL difficult statement <p>Currently I'm looking for a solution. English is not my native language so I added two pictures to clarify it a bit. My knowledge of SQL is rather basic.</p> <p><img src="http://i.stack.imgur.com/5J31L.png" alt="Table"> <img src="http://i.stack.imgur.com/WlbVP.png" alt="Database"></p> <p>A ...
<p>This would be my approach:</p> <pre><code>Table: Products -- a table of products ProductID ProductName DateAdded 1 Chair X 01/01/2016 2 Chair Y 05/05/2016 3 Spare Set A 06/06/2016 ... Table: Components -- a table of components ComponentID ComponentName ItemNumber DateAd...
Pandas INT column datatype changes depending on how the data is called (BUG?) <p>I have a dataframe <code>XY</code> with two columns, one is an integer column, the other one a float column.</p> <p>The integer column is called <code>Count</code> (with a capital C to avoid problems) and its unique values are these:</p> ...
<p>I think you get back a float because each row of your dataframe contains a mix of integer and float types. Upon selecting a row index with <code>ix</code> or <code>loc</code>, integers are being converted to floats. To get around this, you could use loc to select from just the required column and not the whole dataf...
How do I get data from an anonymous type that's sent from webapi? <p>I'm trying to get data from web api using HttpClient. In my webapi i'm sending data in anonymous type.</p> <p>Here is the code in webapi.</p> <pre><code>[HttpGet] public HttpResponseMessage Get(int id) { User user = new User() { FirstName = "fn"...
<p>You can parse the json response to a dynamic object like this</p> <p>Using Newtonsoft.Json.Linq</p> <pre><code>var jsonData = await response.Content.ReadAsAsync&lt;string&gt;(); dynamic data = JObject.Parse(jsonData); var user = (User)data.UserInfo; var cmp = (Company)data.CompanyInfo; </code></pre>
Adding Where in a SelectList with OrderBy in LINQ <p>This code is already working, but how do I add the <code>WHERE</code> clause in my existing LINQ?</p> <pre><code>ViewBag.UserType= new SelectList(_odb.USR_TYP_MSTR.OrderBy(o =&gt; o.USR_TYP_ID), "USR_TYP_ID", "USR_TYP_DESC"); </code></pre>
<pre><code>ViewBag.UserType= new SelectList(_odb.USR_TYP_MSTR.Where(o =&gt; o.USR_TYP_ID ==1 ).OrderBy(o =&gt; o.USR_TYP_ID), "USR_TYP_ID", "USR_TYP_DESC"); </code></pre>
Selecting dropdown list box invisible items <p>How to select a invisible dropdown list drop from following code?</p> <pre><code>&lt;div id="form:munit_panel" class="ui-selectonemenu-panel ui-widget ui-widget-content ui-corner-all ui-helper-hidden ui-shadow" style="width: 125px; display: block; top: 177px; left: 798.26...
<p>You should try using <a href="https://seleniumhq.github.io/selenium/docs/api/java/org/openqa/selenium/support/ui/WebDriverWait.html" rel="nofollow"><code>WebDriverWait</code></a> to wait until <code>dropdown</code> options visible and enable to click after clicking on <code>dropdown</code> as below :-</p> <pre><cod...
Pass subarray to function <p>I have a function to which I need to pass an array. </p> <p>But I don't want to pass the entire array (e.g., valid indices from array[0] to array[size-1]), but a subarray (e.g., valid indices starting at array[5] to array[size-1]).</p> <p>Is there a way to do that in C++?</p>
<p>You can transfer array to function parameter below</p> <pre><code>void Foo(int* arr, int length); //call Foo Foo(&amp;a[0], length); //or Foo(a, length); </code></pre> <p>you can also transfer a certain range of array.</p> <pre><code>Foo(&amp;a[1], length); Foo(a + 1, length); </code></pre> <p>Just, simple code....
How to Pass Parameter from HTML to CSS? <p>I have the color from the database for each photo like below:</p> <p><a href="http://i.stack.imgur.com/IdoIK.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/IdoIK.jpg" alt="enter image description here"></a></p> <p>I'd like to pass this color to css. For what I want t...
<p>You will have to use javascript.</p> <p>e.g.</p> <p><code>&lt;button type="button" onclick="document.getElementById('id1').style.color = 'red'"&gt;</code></p> <p>(taken from <a href="http://www.w3schools.com/js/js_htmldom_css.asp" rel="nofollow">http://www.w3schools.com/js/js_htmldom_css.asp</a>)</p>
ROW_NUMBER is not working in CTE <p>I was playing around reports and it appeared that row_number is not working in recursion.</p> <p>!! I have simplified the example!! </p> <p>From table with 3 records:</p> <pre><code>declare @sometable table (id int, id2 int) insert into @sometable select 1 as id, 11 as id2 un...
<p>This is a documented behavior. Hence it should be considered as a "feature". Here is the documentation for this case: <a href="https://msdn.microsoft.com/en-us/library/ms175972.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/ms175972.aspx</a> </p> <blockquote> <p>Analytic and aggregate functions in ...
Cannot call notifyItemInserted method in a scroll callback recyclerview-v7:24.2.0 <p>Recently I upgrade my recyclerview-v7:23 into recyclerview-v7:24.2.0, My applicaton show endless scroll list, error message pointing line <code>notifyItemInserted</code> when I add loading view into recyclerview (null object it means l...
<ol> <li>The issue is not with new version of Recyclerview.</li> </ol> <p>2 &amp; 3. You cannot change item while it is setting (with calling onBindViewHolder). In that case you have to call notifyItemInserted at the end of current loop by calling Handler.post()</p> <pre><code>Handler handler = new Handler(); ...
CSS /JavaScript. Giving value to the same attribute <p>There is a <code>div</code> for example. If <code>width</code> value is defined using JavaScript as <code>value1</code>, and the same width value in CSS is defined as <code>value2</code> (<code>value1 != value2</code>), which value will <code>div</code> get for the...
<p>You can take a look at <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity" rel="nofollow"><strong>Specificity</strong></a> of CSS.</p> <p>When you will using javascript the style will be added as inline style unless you are adding it as a class.</p> <blockquote> <p>Inline styles added to an el...
How to Get the arrow to "top header" without changing XML content of "Top header" <p><a href="http://i.stack.imgur.com/5lMhA.png" rel="nofollow"><img src="http://i.stack.imgur.com/5lMhA.png" alt="enter image description here"></a></p> <p>Hi friends, I'm new to Andriod, I need to get the forward arrow to top of the hea...
<p>I hope I understood your question correctly:</p> <p>You want to get that "right" Arrow into the ToolBar (like the "left" arrow on the left side).</p> <p>Typically the <a href="https://developer.android.com/guide/topics/ui/menus.html" rel="nofollow">Android Menu</a> is placed there.</p> <p>So you should add a menu...
What is the difference between include and parsedinclude <p>What is the difference between using </p> <pre><code> &lt;?php include("filename.inc"); ?&gt; </code></pre> <p>and</p> <pre><code> &lt;%parsedinclude(filename.inc)%&gt; </code></pre> <p>Both work, but I'm curious about the <strong>&lt; ?</strong> a...
<p>To answer your first question, <code>&lt;?php</code> is the normal PHP open tag while <code>&lt;%</code> is a variant of it that is used in Nucleus CMS (an open-source blog management software package written in PHP).</p> <hr> <p>Regarding the second question, <code>parsedinclude</code> is a function in Nucleus CM...
Raspberry pi 2(IoT) httpclient error: The certificate authority is invalid or incorrect c# <p>I am trying to make my Raspberry pi running on windows IoT get information from a webservice i have on an internal server. To achieve this I am using UWP in visual studio community 2015.</p> <p>Context: I have a sql database ...
<p>You would need to add the internal CA certificate to the raspberry pi's trusted root certification authorities store. (domain joined pc's automatically do this for you).</p> <ol> <li>Download the certificate authority certificate from the server (which can be located at C:\windows\system32\certserv\certenroll\MyInt...
How can I clear the stack completely? <p>I am writing assembly code using the ARM Cortex-M0 instruction set. Since I have pushed quite a large number of elements into the stack, is there any way I can completely clear the stack, without popping the elements one by one? Some guidance would be appreciated</p>
<p>If you want to completely discard any data on the stack, for example if you are calling a function that will never return (and you have taken copies of any parameters passed in) then you can simply set the SP to its initial value (or any other valid value). However remember that you will have then lost all the data ...
Variable passing to use path in partial <p>I'm learning Ruby on Rails by using this <a href="https://www.railstutorial.org/book/" rel="nofollow">book</a>. I'm stuck on the second exercise from <a href="https://www.railstutorial.org/book/updating_and_deleting_users#sec-exercises_edit_form" rel="nofollow">here</a>.</p> ...
<p>So in the end to pass the needed url as requirement from the second exercise <a href="https://www.railstutorial.org/book/updating_and_deleting_users#sec-exercises_edit_form" rel="nofollow">here</a>, it works with providing just the <code>user_path</code>. As I mentioned in my question I tried it already with <code>u...
InvalidOperationException for ColorAnimation for WPF Grid.Background inside ControlTemplate <p>I'm customizing the stock WPF GroupBox control. I need to implement a color animation for its background when the mouse pointer enters the control area - say, change the background color slowly to a predefined color (let it b...
<p>Your <code>TargetElement</code> needs an initial Setter in its Style in order to get the Animation to work.</p> <p><strong>Example</strong></p> <pre><code>&lt;GroupBox&gt; &lt;GroupBox.Style&gt; &lt;Style TargetType="GroupBox"&gt; &lt;Style.Setters&gt; &lt;Se...
Softlayer API: How to do image capture with specify certain data disk? <p>I have a vm with disk 1,2,3,4, I want to do some image operations: </p> <ul> <li>Q1: How can i capture the image only contain system disk and disk 3?</li> <li>Q2: If I achieve the image production described in Q1, can I use this image install or...
<p>at moment to create the image template you can specify the block devices that you want in the image template you can do that using the API and the portal.</p> <p>this is an example using the API</p> <pre><code>""" Create image template. The script creates a standard image template, it makes a call to the SoftLaye...
Get the Age format from the givent input param <pre><code>DECLARE @AGE_NME VARCHAR(250),@OUTPUT Varchar(Max) SET @AGE_NME='056YRS03MTHS13DAYS/M' --MY INPUT AGE FORMAT WILL BE LIKE THIS. SET @OUTPUT= ?? --I WANT THE OUTPUT AS BELOW /* IF MY @AGE_NME (INPUT) IS ----YEAR PART CONDITIONS '056Yrs03Mths13Days/Male...
<p><strong>Attention</strong> Your attempt to declare the variable <code>@OUTPUT</code> must be wrong:</p> <pre><code>DECLARE @AGE_NME VARCHAR(250),@OUTPUT DATETIME </code></pre> <p>Your desired output-format is - for sure! - no <code>DATETIME</code>...</p> <h2>Try this</h2> <p>This will first extract all parts out...
GPS not working in emulator <p>I'm developing an app that uses LocationManager.GPS_PROVIDER to request location updates. Everything is working on my Samsung Galaxy S5, but in the emulator I get the exception "java.lang.IllegalArgumentException: provider doesn't exist: gps" when calling requestLocationUpdates().</p> <p...
<p>I'd advise that you simply use GenyMotion - It's a nice emulator and would easily do what you're trying to do. You would need to specify the coordinates in the free version. I'm not sure of the paid version. The link is <a href="https://www.genymotion.com/" rel="nofollow">here</a>. Cheers</p>
How to add members to an existing definition in flowjs <p>TypeScript seems to have an important little feature that lets you add members to an existing interface definition. In interfaces, the members are additive so if you define interface with a set of members you can define the interface a second time to add additio...
<p>Intersection types might work for you.</p> <pre><code>type A = { foo: string; }; type B = { bar: string; }; type AB = A &amp; B; </code></pre> <p>AB has for type <code>{ foo: string; bar: string;}</code>;</p> <p>From <a href="https://github.com/Microsoft/TypeScript/issues/1265" rel="nofollow">https://github.com/M...
Why is install.package() - building the package from scratch? <p>I installed RStudio and R recently on a new laptop</p> <p>I installed RTools after I noticed that my "packages" (it's source code) - was being downloaded in a temp. folder under "Users...\AppData\ etc. and I couldn't find the actual package and use them....
<p>this worked for me:</p> <p>I installed the package directly from the windows binary zip file:</p> <pre><code>LINK &lt;- "https://cran.r-project.org/bin/windows/contrib/3.3/caret_6.0-71.zip" install.packages(LINK, repos =NULL) </code></pre> <p>The links to binaries were found at: <a href="https://cran.r-project.or...
Python, Store specific words to varibles in input <p>The title says it all. Is there a way so I input</p> <pre><code>input("") </code></pre> <p>They input</p> <pre><code>dbs -U thebos123 -P pw.txt </code></pre> <p>Then store <strong>thebos123</strong> into a variable but not the rest</p>
<p>If it's always the third word, you can get it this way. </p> <pre><code>line = raw_input("Some input please: ") # or `input("Some...` in python 3 splitline = line.split(" "); var = splitline[2] print var </code></pre> <p>Test</p> <pre><code>python pyprog.py Some input please: dbs -U thebos123 -P pw.txt thebos12...
How to use split function in perl to do the work of awk <p>I am writing a script in perl and I want to avoid using external commands as awk, tr , etc as much as possible. This is the command I am running from inside the script , using backticks:</p> <pre><code>my @arr = `$cmd | tr " " "\n" | xargs -n1 host | awk '{pri...
<p>Trivially. By default <code>split</code> works just like <code>awk</code>. So:</p> <pre><code>my @arr = split; print $arr[3]; #note - arrays start at zero. </code></pre> <p>However, perl generally also works line by line on a filehandle, and a <code>split</code> gets you stuff you don't want. </p> <p>You can eit...
How to save a HashMap in a text file? <p>Here is my class of <code>Word</code> and <code>HashMap</code> object shown. I want to save it on text file in Java. Please, guide me.</p> <pre><code>public class Word { private String path; private transient int frequency; private List&lt;Integer&gt; lindex=new Ar...
<p>You can use Jackson XML for this task. </p> <pre><code>import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.JsonParseException; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.File; import java.io.IOException; import java.io.Serializable; import java.util.*; p...
feature extraction from websites <p>this is more of a theoretical question</p> <p>whenever i search the web for feature extracting and feature matching, the only results i get are about image objects.. like finding a face or a patterened pillow etc..</p> <p>but what im trying to achive is a good feature matching (or ...
<p>I think you can try <strong>HOG</strong>(Histogram of Oriented Gradients) feature extraction. This technique counts occurrences of gradient orientation in localized portions of an image. And simple <strong>Euclidean distance</strong> is good for feature Matching. </p>
Apple's MVC vision code samples <p>I know that there are a lot of patterns like MVC, MVP, MVVP etc, I don’t want to discuss which is better here (it’s prohibited by StackOverflow’s rules), I just want to find out Apple’s latest vision on that patterns, including Swift and protocols.</p> <p>I want to understand...
<p>It is hard to give a definitive answer without being affiliated with Apple. However, one may argue that Apple still promotes <a href="https://developer.apple.com/library/ios/referencelibrary/GettingStarted/DevelopiOSAppsSwift/Lesson4.html" rel="nofollow">MVC</a> incorporating <a href="https://developer.apple.com/vid...
Meteor Iron-Router: Wait for Subscription sequential <p>I have the following route defined in my iron-router:</p> <pre><code> this.route("/example/:id", { name: "example", template: "example", action: function () { this.wait(Meteor.subscribe('sub1', this.params.id)); this.wait(Meteor.sub...
<h2>Publish Composite Package:</h2> <p>If the second subscription is reactively dependent on certain fields from the first dataset -- and if there will be a many-to-many "join" association, it might be worth looking into <a href="https://atmospherejs.com/reywood/publish-composite" rel="nofollow"><code>reywood:publish-...
Uncaught Error: cannot call methods on autocomplete prior to initialization; attempted to call method <p>Regarding the answer to <a href="http://stackoverflow.com/questions/21549126/error-cannot-call-methods-on-autocomplete-prior-to-initialization-attempted-to">Error: cannot call methods on autocomplete prior to initia...
<p>Try that:</p> <pre class="lang-php prettyprint-override"><code> return $this-&gt;renderTag('input', array('type' =&gt; 'hidden', 'name' =&gt; $name, 'value' =&gt; $value)). parent::render('autocomplete_'.$name, $visibleValue, $attributes, $errors). sprintf(&lt;&lt;&lt;EOF &lt;script type="t...
How to show a plain text only on build description in jenkins? <p>I want that the user will have the option to edit the build description as a plain text, but I also display some HTML text on the build page.<br> If i change the <strong>Configure Global Security -> Markup Formatter</strong> to escaped HTML it treats all...
<p>No, you cannot do this. The markup formatter selection has global scope.</p>
Recognizing clang, gcc, and tcc by implementation-defined macros <p>I use <code>clang</code>, <code>gcc</code>, and <code>tcc</code>, and I'd like to be able to differentiate between the three in a common header.</p> <p>Judging by their macro dumps, I expect that the presence of the <code>__clang__</code> macro will ...
<p>Use __TINYC__ to detect tcc<sup>1</sup>. </p> <p>Detection of gcc and clang is explained in this StackOverflow question: <a href="https://stackoverflow.com/questions/28166565/detect-gcc-as-opposed-to-msvc-clang-with-macro">Detect gcc as opposed to msvc / clang with macro</a></p> <hr> <p><sup>1</sup> (Quoted from:...
Rails Get Request Send Array of Objects <p>Through URL I am sending an array of objects. Example</p> <pre><code>[{id: "1234", name: "DraftHouse"}] </code></pre> <p>Im passing the request as follows using Jquery</p> <pre><code> var tags = JSON.parse($("#admin-tags-array").val()); //Where tags is for example- [{id:...
<p>If you can get this from request: </p> <pre><code>h = { '0' =&gt; {id: '1234', name: 'Drafthouse'}, '1' =&gt; {id: '4567', name: 'New House'}} </code></pre> <p>Then you can do:</p> <pre><code>h.map{|key, value| value} #=&gt; [{"id"=&gt;"1234", "name"=&gt;"Drafthouse"},{"id"=&gt;"4567","name"=&gt;"New House" }] </...
How do smallest width for layouts work with this example? <p><em>I have read the officel documentation but still dosn't understand it!</em></p> <p>I'm playing and experimenting with the smallest-width layouts in Android and it dosn't give any sense to me. </p> <p>I have created these layouts: <code>sw-300dp/350dp/360...
<p>The density of the screen on the S7 is 4.0</p> <p>That means that there are 4 pixels per dp, therefore the screen is 1440 / 4 = 360dp wide.</p> <p>I use the following methods frequently:</p> <pre><code>public static int dpToPx(int dp) { return (int) (dp * Resources.getSystem().getDisplayMetrics().density); } ...
Unable to update textview in Fragment from Service <p>I'm running a service that runs audio. I've created a <code>TextView</code> in the layout of the fragment that should display the title of the track being played.</p> <p>Currently I've set the <code>TextView</code> to be updated when the user selects a track from w...
<p>You are using LocalBroadcastManager in the fragment.</p> <p>Use below in MusicService.java:</p> <pre><code>LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent); </code></pre> <p>instead</p> <pre><code>sendBroadcast(intent); </code></pre>
Don't understand the following jstl tag <pre><code>&lt;c:url var="queryString" value="?${requestScope['javax.servlet.forward.query_string']}"/&gt; </code></pre> <p>I know <code>&lt;c:url&gt;</code> is used for URL rewriting. But here from where the url value is assigned to the var queryString. I don't understand the m...
<p>From the documentation:</p> <blockquote> <p>The name of the request attribute that should be set by the container when the forward(ServletRequest, ServletResponse) method is called. It provides the original value of a path-related property of the request. See the chapter "Forwarded Request Parameters" in th...
how to fetch multiple pattern and numbers <p>i have this this file ( pattern1 and pattern2 is fixed but numbers is randoms ) </p> <pre><code>aaaa patern1[1234] bbbb cccc pattern2[5678] jjjj patern1[9999] hhhhhhhh </code></pre> <p>and I want to extract the following patterns with <code>bash</code> script</p> <pre...
<pre><code>$ cat ip.txt aaaa pattern1[1234] bbbb cccc pattern2[5678] jjjj pattern1[9999] hhhhhhhh $ perl -ne '(@a)=/pattern[12]\[\d+\]/g; print join(" ", @a)."\n"' ip.txt pattern1[1234] pattern2[5678] pattern1[9999] </code></pre> <ul> <li><code>(@a)=/pattern[12]\[\d+\]/g</code> extract pattern from input lines and ...
Reverse Relationships in Django-Rest framework <p>I have two models . Now the Class Track Model has an Album foreignkey. I want to write a Track Serializer that has Album Name. How can i achieve that?</p> <pre><code>class Album(models.Model): album_name = models.CharField(max_length=100) artist = models.CharFi...
<p>There are a lot of solutions. You can use several types of fields e. g. a StringRelatedField or a SerializerMethodField.</p> <p>Here is an example with a custom related field:</p> <pre class="lang-py prettyprint-override"><code>from rest_framework import serializers class TrackField(serializers.RelatedField): ...
Monitoring a log file while used by a daemon <p>i use mosquitto as a mqtt broker and forward all debug output to a log file. With this <a href="https://bitbucket.org/denilsonsa/small_scripts/src/327d437996a35e8447b2a60e6c647f244b16e3d9/sleep_until_modified.sh?at=default&amp;fileviewer=file-view-default" rel="nofollow">...
<p>You can use <code>inotify</code>.</p> <p>Start reading here: <a href="http://man7.org/linux/man-pages/man1/inotifywait.1.html" rel="nofollow">http://man7.org/linux/man-pages/man1/inotifywait.1.html</a></p> <blockquote> <p><code>inotifywait</code> efficiently waits for changes to files using Linux's <code>inot...
PJSIP build error for ios <p>I was building PJSIP step by step according by <a href="https://trac.pjsip.org/repos/wiki/Getting-Started/iPhone" rel="nofollow">iPhone</a>,but when I build project in Xcode, I received some error like:</p> <blockquote> <p>Undefined symbols for architecture arm64: "_RGB24ToARGB", ref...
<p>You have to link libyuv.a to your project.</p>
activating virtualenv in windows which was created in ubuntu <p>I created a <code>virtualenv</code> in ubuntu for one of my projects. Later I wanted to use the same <code>virtualenv</code> in windows and tried activating it using only the <code>activate</code> command <br></p> <p>But the environment it activated had n...
<p>You'll not be able to use a virtual environment created in Linux on Windows or vice versa. The installation files for different packages and libraries would be different for both the platforms, and you will not be able to use the raw Linux binaries on Windows anyway.</p> <p>If you want to maintain parity in virtual...