input
stringlengths
51
42.3k
output
stringlengths
18
55k
Cannot get my program to properly read in file to execute methods <p>In the following code, I'm having problems getting each part of the program to run the respective methods. Individually testing them, they work fine. However, I don't think the fileIn.next() is working how I need it to to get the letters and numbers t...
<p>EVERY <code>next</code> removes one token, so <code>if (fileIn.next().equals("G") &amp;&amp; fileIn.next().equals("1")){</code> reads two tokens if the first token equals <code>G</code> otherwise the <code>if</code> will fail on the first part and NOT read read the second <code>next</code> </p> <p>So you are better...
CS-Cart Thumbnail Size not working <p>In CS-Cart 4.3.8 I have set thumbnail sizes under Settings > Thumbnails, then I have used the 'Clean up generated thumbnails' But nothing changes and they remain at the default size...</p> <p>How can I set the thumbnail size?</p>
<p>In Settings > Thumbnails there are some thumbnail settings. </p> <p>You should change the relevant setting match to your view (Products list, Product detail, Product cart page, Quick View ...)</p>
pandas series drop when multiindex is not unique <p>consider the <code>pd.Series</code> <code>s</code></p> <pre><code>midx = pd.MultiIndex.from_product([list('ABC'), np.arange(3)]) s = pd.Series(1, midx) s A 0 1 1 1 2 1 B 0 1 1 1 2 1 C 0 1 1 1 2 1 dtype: int64 </code></...
<p>I'm not sure why the <code>s.drop('B')</code> doesn't work but using the <code>level=0</code> parameter does.</p> <pre><code>s.drop('B', level=0) A 0 1 1 1 2 1 2 0 C 0 1 1 1 2 1 dtype: int64 </code></pre>
How to collect values from Json by key <p>Thanks in prior for advising. I have the following JSON I retrieve from a REST Service. </p> <pre><code> "events": [ { "id": 408, "name": "My Test1", "modulename": "test", "instance": 0, "timestart": 1470370500, "timed...
<p>At first make sure that your json is in right format if your json is like that:-</p> <pre><code>$str='{"events": [ { "id": 408, "name": "My Test1", "modulename": "test", "instance": 0, "timestart": 1470370500, "timeduration": 864000 }, { "id": 418, "name": "Quiz Open", ...
What sort of drivers are used to connect Node.js applications to a database? <p><strong><em>If this question is inappropriate for stackoverflow please feel free to remove this question.</em></strong></p> <p>Typically when we connect to relational databases from applications (e.g. Java or .Net), a JDBC or ODBC driver i...
<p>There is no standard Database access API for Node.js. However if you like the JDBC APIs you can use a JDBC driver in your Node application with Avatar.js. This works fine with Oracle's UCP and JDBC thin driver (and maybe other drivers). This technique requires a thread pool to turn the blocking JDBC calls into non-b...
My cd function does not go to the home directory <p>I am building a custom shell in c, and one of the requirements is that the folder from while you run the program must be the "home" folder.</p> <p>That is, if you type in just <code>cd</code> or <code>cd ~</code> you should get to that directory. I have implemented i...
<pre><code> char *basedir; basedir = cwd; </code></pre> <p>You make <code>basedir</code> a <em>synonym</em> to <code>cwd</code>. Whenever <code>cwd</code> changes, <code>basedir</code> follows. It's a <em>pointer</em>, it cannot remember its own string, it can only point to someone else's string.</p> <p>You must ma...
Hg: How to fold local commits in the middle of the stack <p>Simple question: Let's say I have local commits like following:</p> <pre><code>master -&gt; a -&gt; b -&gt; c </code></pre> <p>I want to merge a and b. What is the hg command for this? I tried </p> <pre><code>hg up b hg fold -r a </code></pre> <p>got an er...
<p>if you want to squash the changes from two commits in to one commit then, you can use hg rebase command to squash the changes.</p> <blockquote> <p>$ hg rebase -r a::b -d master --collapse</p> </blockquote> <p>this will squash the changes of both a and b commits in to one commit</p> <p>for more info refer to: <a...
Access violation in changing data pointed to by char *const in C++ <p>I was reading C++ hacks by Steve Qualine and its written that:</p> <pre><code>char *const ptr;//statement 1 </code></pre> <p>The pointer is not affected by the const keyword, and the following is legal.</p> <pre><code>*ptr = 'S';//statement 2 </co...
<p>If you want to create a variable <code>char *const ptr</code>, you need to have memory ready at declaration for it to point to. This is because the <em>pointer</em> (as opposed to the memory it points to) is const, and must be set at declaration.</p> <p>This is in contrast to a <code>const char *</code>, where the ...
Key-value dictionary in bash 4 wrongly thinks it has a key <p>I want to store key-values to store addresses of people.</p> <p>The following code builds a bash 4 array, puts a key-value, then tries to get the value for a (non-existing) key:</p> <pre><code>#!/bin/bash declare -A addresses addresses["john doe"]="Cows st...
<p>There's a couple of problems in this bash file, plus I admit I'm currently unable to pass the dictionary as a parameter. BUT globally this is wrong:</p> <ul> <li>you loop through the dictionary to find the values: not the principle of a dictionary, and really not performant. Make it 200000 entries you'll see it's d...
sort array or json on basis of a number/object in javascript <p>I am facing an issue with sorting in JSON.I have a list which can reorder and the reordering can be saved so next time whenever user will come he/she can see the reordered list the way he arranged. The image is below.<a href="http://i.stack.imgur.com/6okK3...
<p><code>result</code> is the result.<br> <code>sort</code> function is not used .</p> <pre><code>var checked = []; var unchecked = []; lst.map(function(item){ if(item.ResourceSortedOrder !== null){ checked.push(item); }else{ unchecked.push(item); } }); var result = []; checked.map(funct...
On using swipe refresh in recyclerview my adapter is not getting data when it is refreshing <p>My Latest fragment </p> <pre><code>public class Latest extends Fragment { private RecyclerView recyclerLatest; private SwipeRefreshLayout swipeRecycler; private RecyclerView.LayoutManager mLayoutManager; private List&lt;Late...
<p>It seems like a logical bug :</p> <p>In method : refreshLatestAd(), Remove these line :</p> <pre><code>latestAdapter.clear(); latestAdapter.addAll(latestAdDetailsList); </code></pre> <p>and </p> <pre><code>recyclerLatest.setAdapter(latestAdapter); // It need not be set again. </code></pre> <p>Let me know if it...
how to handle different json result <p>I want to get information from baidu music web api. I use below tow link: <a href="http://openapi.baidu.com/rest/2.0/music/billboard/billlist?page_size=50&amp;timestamp=2016-09-22+18%3A47%3A54&amp;sign=b2e34bd4b6c19a065d5a7e49e591a41b&amp;session_key=9mzdDcHtDENrxP3Spvk7ZFbNHNijT8...
<p>Try this:</p> <pre><code>public class BaiduBillListContainer implements Serializable { Map&lt;String,BaiduBillList&gt; billboard; public Map&lt;String,BaiduBillList&gt; getBillBoardInfo() { return billboard; } public void setBillBoardInfo(Map&lt;String,BaiduBillList&gt; billBoardInfo) { ...
How to remove L.rectangle(boxes[i]) <p>I few days ago I implement a routingControl = L.Routing.control({...}) which works perfect for my needs. However I need for one of my customer also the RouteBoxer which I was also able to implement it. Now following my code I wants to remove the boxes from my map in order to draw ...
<p>You have to keep a reference to the rectangles so you can manipulate them (remove them) later. Note that neither Leaflet nor Leaflet-routeboxer will do this for you.</p> <p>e.g.:</p> <pre><code>if (this._currentlyDisplayedRectangles) { for (var i = 0; i &lt; this._currentlyDisplayedRectangles.length; i++) { ...
C# binary search tree <p>I was making a test case for some code on binary search tree my professor gave</p> <pre><code>public static void Main(string [] args) { //on my prof's code, public class BinSearchTree&lt;T&gt; BinSearchTree&lt;int&gt; myTree = new BinSearchTree&lt;int&gt;(); myTree.Insert(10); ...
<p>You have to implement <code>ToString()</code> by yourself in order to display it in the way you want; otherwise, <a href="https://msdn.microsoft.com/library/system.object.tostring(v=vs.110).aspx" rel="nofollow"><code>ToString()</code> from Object</a> is inherited and invoked, and it</p> <blockquote> <p>returns th...
Firebase Data Filtering <p>I have the following <code>Firebase</code> <code>JSON</code> data structure;</p> <pre><code> { "USERS": { "YjGJsvCb58OsTThv6JLmK1dMuHr1": { "Email": "test@test.com" }, "zQpb7o18VzYsSoTQtT9DNhOqTUn2": { "Email": "test2@test.com" } }, "POSTS": { "-KSe4eJy...
<p>Try This:- </p> <pre><code>FIRDatabase.database().reference().queryOrdered(byChild: "POSTS").queryEqual(toValue: "monthly").observeSingleEvent(of: .value, with: {(snap) in if let postsDict = snap.value as! [String:AnyObject]{ for each in postsDict { print(each) } }else{ ...
sequence in IONIC, angularjs controller..? <p>I have controller and execute eksekusiUlp function like below</p> <pre><code>.controller('ulpCtrl', function($rootScope, $ionicPopup, tanyaService, $state) { $rootScope.getKat = 'UL'; //get value from API Services $rootScope.eksekusiUlp = function...
<p>The answer has to do with properly understanding <a href="http://javascript.info/tutorial/events-and-timing-depth" rel="nofollow">JavaScript events and timing</a> more .</p> <p>plus <a href="https://spring.io/understanding/javascript-promises" rel="nofollow">Understanding JavaScript Promises</a> will help too.</p>
using PHP to read email attachment (csv) <p>I've got an application that I don't think I can interact via an API with. All it can do is export data in csv format as a one off download or have reports emailed as csv to an email.</p> <p>I want to make some sexy graphs with the data but don't want to have to manually do...
<pre><code>&lt;?php // Standard inclusions include("pChart/pData.class"); include("pChart/pChart.class"); // Dataset definition $DataSet = new pData; $DataSet-&gt;ImportFromCSV("Sample/CO2.csv",",",array(1,2,3,4),TRUE,0); $DataSet-&gt;AddAllSeries(); $DataSet-&gt;SetAbsciseLabelSerie(); ...
socket connection in node js <p>I have just started working on node js.I have been trying to make chat application using node js. In which a single user can logged in through multiple devices or browsers. If I am not wrong and as I understand each of the browser communicates with different port address since socket con...
<p>If I understand your problem correctly, let me try explain in my way. Lets say you have the following code for the server:</p> <pre><code> var io = require('socket.io')(somePort); //same port for the client to connect, e.g. 3000 io.on('connection', function(socket){ // in here you should define any acti...
Scikit learn split train test for series <p>I have a data which include dates in sorted order.</p> <p>I would like to split the given data to train and test set. However, I must to split the data in a way that the test have to be newer than the train set.</p> <p>Please look at the given example:</p> <p>Let's assume...
<p>If you insist that all testing data be newer than all training data, then there is only one way to accomplish the desired 20/80 split.</p> <pre><code>n = features_dataframe.shape[0] train_size = 0.2 features_dataframe = features_dataframe.sort_values('date') train_dataframe = features_dataframe.iloc[:int(n * train...
Window 10: How to run script on Genymotion emulator with appium using eclipse <p>Please help to solve my problem</p> <ol> <li>Genymotion with VirtualBox download from genymotion site and install properly </li> <li>Add Genymotion pluging on eclipse and set Genymotion directory</li> <li>Add virtual device Nexus9 os ver...
<p>From the logs what I can is "adb server version does not match".</p> <p>Try updating your Android SDK first through <strong>ANDROID SDK MANAGER</strong>.</p> <p>And you need to start appium server before you try to initialise the driver.</p> <p>When you start appium server, by default it starts with port number 4...
How to send the Diagnostic IDs (DIDs) through CAPL script? <p>Currently, I am automating the test cases for testing the Gauges in the Instrument Cluster. I have come across changing the units from metric to US through DIDs. Can anybody help me how to send the diagnostic related stuff using CAPL script.</p>
<h1>Try this may be it works using SendDiagRequest(reqobj);</h1> <p>1.Add respective CDD file in vector canoe 2.Set target ECU in Canoe settings 3.You have to define contents of service each byte value, can get those values in CAN trace 4.create object of services in CAPL and send it using SendDiagRequest(reqobj);</p>...
How to write http interceptor in backbone <p>Since I have already worked on backbone and now I am learning angular. I really liked the way angular gives features. I was just thinking about how can we implement the HTTP interceptor in backbone in order to show spinner and toaster while your JavaScript saves or fetches d...
<p>I am assuming you are using requireJS if not just convert the AMD to IIFE</p> <pre><code>define("vent", ["backbone", "backbone.marionette"], function(backbone) { return new backbone.Wreqr.EventAggregator }); define("backbone-sync", ["backbone", "underscore", "vent"], function(backbone, underscore, vent) { v...
How to track expirations <p>Let me provide an example to make my question clear:</p> <ul> <li>We have a node app and in this case we have customer subscriptions. The default is that we subscribe a new customer to a trial (say 30days of trial) and in the db record there will be a trialExpiration date.</li> <li>After th...
<p>In most cases, a <code>cron</code> job is preferable. Two reasons:</p> <ul> <li>You'll typically want other actions to be associated with an expiry—sending an email to the user that their account has expired, for example—which would not make any sense to have have happen when they arrive and sign in.</li> <li>Y...
Simple way to remove all slashes at the end of url in java <p>I need to remove all slashed at the end of url,and i don't known how many slashes at the end.</p> <p>for example</p> <pre><code>http://www.example.com/user// </code></pre> <p>after removing slashe at the end </p> <pre><code>http://www.example.com/user </...
<p>use <code>String.replaceAll ("\\/$", "");</code></p> <p>The <code>$</code> means that it is at the end of the String</p> <p>As per @WiktorStribiżew to remove multiple slashes</p> <p>use <code>String.replaceAll ("/+$", "");</code></p>
Call same $http function with different parameters after first is finished, using Factory in AngularJS <p><code>myData</code> is generated in <code>myFactory</code>, and the following code works if <code>myData</code> is generated from a single <code>myHttp.GetGroupMember</code> function.</p> <p>However, it is not wor...
<p>Easiest thing in the world:</p> <pre><code>myHttp.getGroupMember("Division1", "Group_Foo") .success(createMyData) .then(function() { return myHttp.getGroupMember("Division2", "Group_Bar") }).success(createMyData); </code></pre> <p>Read up on <a href="http://www.dwmkerr.com/promises-in-angularjs-the-definitiv...
How to close geckodriver with selenium 3.0.0 beta <p>Environment:- win 7, selenium 3.0.0 beta, FireFox- 49.0.1</p> <p>System.setProperty("webdriver.gecko.driver","C:\geckodriver.exe");</p> <p>WebDriver driver=new FirefoxDriver();</p> <p>Issue 1:-</p> <p>command:- driver.close(); or ((FirefoxDriver) driver).kill()...
<p>Below solution is tested on Windows7 with Firefox49, Selenium 3.0.1, Python 3.5 and geckodriver-v0.11.1 and is working fine.</p> <pre><code>import os </code></pre> <p>Then call </p> <p><code>os.system('tskill plugin-container')</code> </p> <p>before calling <code>driver.quit()</code></p>
JS-grid working example required <p>i am new working with jsgrid ,went through documentation but i'm unable to load data .. can any one please provide a working example of jsgrid with ajax calls.. i wanted to perform loaddata on service call, edit delete by making a service call..... Kindly donot mark negative ,ask...
<p>Here are completely working js-grid examples for different back-ends:</p> <ul> <li>PHP - <a href="https://github.com/tabalinas/jsgrid-php" rel="nofollow">https://github.com/tabalinas/jsgrid-php</a></li> <li>ASP.NET WebAPI - <a href="https://github.com/tabalinas/jsgrid-webapi" rel="nofollow">https://github.com/tabal...
Explanation of @Configuration @AutoConfigureAfter with Kotlin <p>I am a python dev and totally new to Spring boot and gradle. However i am fine with java and Trying my best with Kotlin. I was trying to run Spring Boot application(Kotlin) on localhost. Gradle build is working fine except these line</p> <pre><code>@Conf...
<p><code>WebMvcAutoConfigurationAdapter</code> isn't intended to be used directly by application code. You should be extending <a href="https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.html" rel="nofollow">WebMvcConfigurerAdapter</a> instea...
ajax call is not working for the c# method <p>i want to call the unlock method on closing or redirecting other page, so i have used ajax call. but the method unlock is not firing. please let me know what i am doing </p> <pre><code> [WebMethod] public void Unlock() { CreateProject_BL _objcreatebl = new CreateProjec...
<p>Where you passing project_id in your ajax call??? pass project_id in your method</p> <pre><code> [WebMethod] public void Unlock(string project_id) { CreateProject_BL _objcreatebl = new CreateProject_BL(); _objcreatebl.upd_lockedBy(Convert.ToInt32(Request.QueryString["project_id"]), ""); } </code></pre> <p>...
Convert String to JSON using Javascript <p>kindly i want to convert this string to Json using javascript</p> <pre><code> Result = {"result":"{\"Response\":\"Success\"}"} </code></pre> <p>i firstly use </p> <pre><code> Result=Result['result'] </code></pre> <p>and i have this </p> <pre><code> Result= '{"Respo...
<p>You can use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse" rel="nofollow">JSON.parse</a></p> <blockquote> <p>The JSON.parse() method parses a string as JSON, optionally transforming the value produced by parsing.</p> </blockquote> <pre><code> Result = {...
How to add multiple text to different positions on picture? <p>I'm currently making a camera app and I can add single text from the text field on picture. </p> <p>What I want is, I want to put multiple different text to the picture. So I add 4 text field to the storyboard and now I need to change something on view con...
<p>In your code you are adding the text one by one and returning the full image. The process you followed is not like draw the text in the space required for text, it wrote the text on image and return the full image.</p> <p>Hence modify your method to pass all the text at a time and draw all text on image and return ...
Need to get the data of span using protractor <p>I want to get the id=2504 which is in html span using protractor and display it in the console log. This id is generated dynamically so the id number can be different all the time.My code looks like :</p> <pre><code>&lt;span class="link ng-binding" ng-click="openTrackI...
<p>You can use regex to extract numbers from a string. Look at below example code.</p> <pre><code>var id = element(by.css("span.link")).getText().then(function(text){ return text.replace(/[^0-9]+/g, ""); }) </code></pre>
Mongo shell stops responding to commands <p>I am playing around a little with the mongo shell, but I have quite a tedious problem.</p> <p>After I've switched to the database I'm working with using "use nameOfDatabase", and I issue my first command, the shell won't respond to any further commands after giving me the fi...
<p><code>Ctrl+Z</code> is for 'suspend'. Try <code>Ctrl+D</code> to exit the mongo prompt.</p>
Proper way to insert binary and varbinary datat in MySQL? Need an example <p>How to insert binary and varbinary datat in MySQL? Need an example</p> <p>create table string_binary1 (binarydata binary(3)); </p> <p>insert into string_binary1 values ('a');</p> <p>insert into string_binary1 values ('12343');</p> <p>diffe...
<p>You can simpply use quotes to insert the data:</p> <pre><code>INSERT INTO varbinaryt1 (varbinarydata ) VALUES('myvarbinarydata') </code></pre> <p>See the <a href="http://dev.mysql.com/doc/refman/5.7/en/binary-varbinary.html" rel="nofollow">MySQL docs</a>:</p> <blockquote> <p>When BINARY values are stored, they ...
update Alamofire in podfile error <p>After migrating from Swift 2.3 to Swift 3, I have found these error on compile time:</p> <pre><code>Analyzing dependencies [!] Unable to satisfy the following requirements: - `Alamofire (~&gt; 4.0)` required by `Podfile` - `Alamofire (~&gt; 4.0)` required by `Podfile` - `Alamofir...
<p><a href="http://stackoverflow.com/questions/38067678/swift-3-ios-compatibility">According to these </a><a href="http://stackoverflow.com/questions/38414469/do-xcode-8-swift-3-apps-run-on-ios-7-successfully">related StackOverflow questions</a>, Swift 3 appears to only work on iOS 8 and newer.</p> <p>It sounds like y...
Custom filter in datatable with search button in jquery <p>I'm using datatables plugin and i would like add custom search button (Go) to filter the grid which is populated by datatable.When User clicks go button selecting drug and organisation results should be filter</p> <pre><code> $(document).ready(function() { ...
<p>It seems that you want to add multiple custom drop-down filters.</p> <p>you can do it in this way.</p> <pre><code>//Call datatable var table = table = $('#tableId').DataTable({}); //Call on change event of dropdown and same thing can be done on Go button click $('#drugDropdownId').on('change', function () { ...
Enable second combo box if the the first combo box value is scheduled in C# <p>Greetings for the Day!!</p> <p>I am a newbie to DOT NET. Developing a tool, building UI.</p> <p>I am stuck in generating combo box values on selection of other combo box.</p> <p>Question is : There are 2 Combo box : DropDownList1 and Drop...
<p>If I understood you correctly, you can use the <code>SelectedIndexChanged</code> event and check the values in your <code>cboStatus</code></p> <pre><code>private void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { if (DropDownList1.SelectedItem.ToString() == "2") { DropDownList2.En...
How to pull multiple column values into a single column in Google sheets? <p>I am having 12 columns which are getting auto filled up by the formula "IMPORTRANGE".</p> <p>I need to collate all the table values to a single value(condition is it should behave like as "ARRAYFORMULA").</p> <p>Just wondering is there any s...
<h2><strong>Common case</strong></h2> <p>I'll show sample formula for 3 columns, but you may use the same logic for any number of columns.</p> <p><a href="http://i.stack.imgur.com/bak5j.png" rel="nofollow"><img src="http://i.stack.imgur.com/bak5j.png" alt="enter image description here"></a></p> <p>the formula is</p>...
Primefaces datatable with column toggler conflicts with sort function on column <p>I have a data table that has a column toggler. When I uncheck a column and sort on a field the table is wrong. The header of the unchecked field pops back up and all data shift to the left, which leaves 1 column empty.</p> <p>My table.x...
<p>I found my answer in this blog post: <a href="http://blog.primefaces.org/?p=3341" rel="nofollow">http://blog.primefaces.org/?p=3341</a></p> <p>The solution was to keep the <code>Visibility</code> state of all columns in the backing bean.</p> <p>The toggler must trigger the onToggle function in your backing bean:</...
How to add fields to a model via eloquent in Laravel? <p>My question is if it is possible to add all the fields directly to a new model via Eloquent.</p> <p>I guess it would be something like</p> <pre><code>php artisan make:model MyModel --fields=? </code></pre> <p>However, I can't find anything related with that. A...
<p>If you mean table's column by <code>fields</code> then:</p> <p>Firstly you don't need to define <code>fields</code> in modal. I mean in Laravel no need to define <code>fields</code> while creating model. Besides, model automatically work with your database table's columns as its property. </p> <p>So, now you may w...
converting image and video data uri to base 64 <p>I was trying to encrypt image and video src by converting into base 64 encoded value. I had taken reference from <a href="https://www.iandevlin.com/blog/2012/09/html5/html5-media-and-data-uri" rel="nofollow">https://www.iandevlin.com/blog/2012/09/html5/html5-media-and-d...
<p>It does not work like this. You must base64 encode the actual contents of the file, not the path to the file. The link you used actually shows this in the example:</p> <pre><code>function getEncodedVideoString($type, $file) { return 'data:video/' . $type . ';base64,' . base64_encode(file_get_contents($file)...
getenv() does not find the environment variable that I manually set(I am writing in C) <p>If I try to get one of the existing variables everything works but if i try to access my variable the method returns NULL.I am writing this under windows 10 :)</p> <pre><code>#include &lt;stdio.h&gt; int main() { test1(); ...
<p>As the <a href="https://msdn.microsoft.com/en-us/library/tehxacec.aspx" rel="nofollow" title="documentation">documentation</a> says: </p> <blockquote> <p>getenv(): The return value is NULL if varname is not found in the environment table.</p> </blockquote> <p>On my computer, </p> <pre><code>char *libvar = ge...
Mongodb concat not working in aggregation <p>In my query the concat keyword is not working, it return <code>null</code>. </p> <p>Here is query:-</p> <pre><code>db.leads.aggregate([ {$project:{ _id:0, status:1, stage:1, "todo.title":1, created:{ day:{$substr:["$createdOn",8,2]}, mon...
<p>You don't necessarily need the <strong><a href="https://docs.mongodb.com/manual/reference/operator/aggregation/concat/#exp._S_concat" rel="nofollow"><code>$concat</code></a></strong> operator (i.e. if you're using MongoDB 3.0 and newer), the <strong><a href="https://docs.mongodb.com/manual/reference/operator/aggrega...
Xcode 8 remove storyboard, new project layout looks weird <p>I use Xcode 8.1 beta to create a new project, and remove storyboard.. it works but the view looks like this...<a href="http://i.stack.imgur.com/dj3oa.png" rel="nofollow"><img src="http://i.stack.imgur.com/dj3oa.png" alt="enter image description here"></a></p>...
<p>You just add splash screen to your project with 640x1136 size and name it as Default-568h@2x.png.</p> <p>It must work!! :)</p>
Different ways of object instantiation and their differences <p>What is the difference between: </p> <p><code>Student s = new Student(); //instantiating in the same line as declaration</code></p> <pre><code>Student s; s = new Student(); // instantiation and declaration in different lines </code></pre> <p>What is th...
<p>For Java, this really doesn't matter. Assuming that those two lines follow directly after each other. The only subtle difference:</p> <pre><code>1: Student s1, s2 = new Student(); 2: s1 = new Student(); </code></pre> <p>After line 1, s1 is <strong>null</strong>; but then the compiler will give you an error message...
IdentityServer Tutorial , token has Invalid Signature <p>I created a test application with the identity server.</p> <p>It is very simple. it has some hard coded InMemory Users,Clients and SCopes and uses the idsrv3test.pfx certificated from the samples for signing</p> <pre><code>var factory = new IdentityServerServic...
<p>Jwt.io cannot validate RS256 signatures. Only HS256.</p>
Change system default language programmatically with c# <p>We have a virtual keyboard (for touch screen) which its language layout is configured via the windows default language.</p> <p>I have seen numerous answers which involves <code>InputLanguageManager</code> and <code>CultureInfo</code>.<br> They're not useful to...
<pre><code> [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, ref uint pvParam, uint fWinIni); public void Foo() { uint localeUS = 0x00000409; uint localeNL = 0x00000403; SetSystemDefa...
How does apply function work to read all array arguments passed to inner function? <p>below i quote from eloquentJavascript</p> <p><a href="http://eloquentjavascript.net/05_higher_order.html#h_7/X8BSjdvi" rel="nofollow">Passing along Arguments</a></p> <pre><code>function noisy(f) { return function(arg) { consol...
<p><strong>See the bellow snippet</strong></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>// Code goes here function noisy(f) { return function() { var a...
How to deal with 1 to many SQL (Table inputs) in Pentaho Kettle <p>I have a situation where in i have the following tables.</p> <p><strong>Employee</strong> - emp_id, emp_name, emp_address</p> <p><strong>Employee_assets</strong> - emp_id(FK), asset_id, asset_name (<strong>1-many</strong> for employee)</p> <p><strong...
<p>To pull data in you can use multiple db lookup fields or a Database Join step. Performance wise I would think that the join would likely be faster but that's all dependent on the complexity of the query you use and how it's written etc.</p>
Elasticsearch java api, hits score always be 1.0 <p>I used ElasticSearch java client. I do search with <code>query_string</code>, and I get response, but score always be 1.0 .</p> <p>code is:</p> <pre><code> String query = "{\"query\": {\"query_string\": {\"query\": \"weblog data4\"}}}"; SearchRequestBuilder b...
<p>This solved my problem:</p> <p>change:</p> <blockquote> <p>String query = "{\"query\": {\"query_string\": {\"query\": \"weblog data4\"}}}"; </p> </blockquote> <p>to:</p> <blockquote> <p>String query = "{\"query_string\": {\"query\": \"weblog data4\"}}";</p> </blockquote> <p>more details: <a href="https://di...
checking type of reference in generics java <p>I am currently building a game in java(turn based RPG) and am facing a problem in inventory UI. Perhaps my problem is well known or has a simple solution, but having never had any training, I will still ask the question.</p> <p>While displaying the inventory after selecti...
<p>Due to runtime type erasure, you need to provide what's called a <em>type token</em> to the class:</p> <pre><code>public class ItemSelector&lt;T&gt; { private final Class&lt;T&gt; clazz; public ItemSelector(Class&lt;T&gt; clazz) { this.clazz = clazz; } public void test(GameObject ob) { ...
Node visulaization in Neo4j <p>How we can change Property name/Values manually in Neo4j. Which Property should be in centre to show relationships with other nodes. <a href="http://i.stack.imgur.com/uvTeR.jpg" rel="nofollow">An example just to elaborate the question</a></p> <p>In graph output,How "Tom Hanks" can be rep...
<p>This is related to the visualizer running in the browser view, and not neo4j itself.</p> <p>If you check the node labels at the top of the output view, tap on the label related to the thing you want to change (it may also show if you tap on the node in question to give it focus). Now, at the bottom of the window, y...
Broken Animation <p>Where on earth have I gone wrong with this <a href="/questions/tagged/css" class="post-tag" title="show questions tagged &#39;css&#39;" rel="tag">css</a> animation?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre...
<p>Add <code>position:relative;</code> to your CSS in order to control the <code>top, right, bottom, left</code> properties</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code...
send sms using services in android <p>I am able to send the SMS in the normal way.Here is my code:</p> <pre><code>public class MainActivity extends Activity { // Log tag private static final String TAG = MainActivity1.class.getSimpleName(); // Movies json url private static final String url = "http://...
<p>Declare service manifest file in application tag.</p> <pre><code> &lt;application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;service android:name=".MyService" /&gt; &lt;/application&gt; </code></pre> <p><strong>M...
batch script to copy script files ending with .1.tst <p>Hi i am new to batch scripting and i have to run a sanity test for that i have to copy all the basic script files to a folder. All the basic script files will be ending with </p> <blockquote> <p><code>.1.tst</code>.</p> </blockquote> <p>I have used the below c...
<pre><code>@echo off set src_folder=C:\Users\Mallik\Desktop\ set dst_folder=C:\Users\Mallik\Desktop\abc\ rem /Y Suppresses prompting to confirm you want to overwrite an existing destination file. xcopy %src_folder%*.1.txt %dst_folder% /y </code></pre> <p>xcopy could do it easily. </p> <hr> <p>Updated: (for <strong>...
How can I display dBi signal strength instead of graphical bars in B315s or any other 4G router? <p>I got an antenna for my 4G router (Huawei B315s), I want to start aligning and directing this thing to the signal source, but the signal bars are not accurate enough. </p> <p>Is the there any way to get it to display t...
<p>Looks like there is a Windows Utility that can connect to Huawei HiLink devices call <a href="http://mybroadband.co.za/vb/showthread.php/798330-Toolbox-for-new-Huawei-HiLink-devices-(E5186-B315s)" rel="nofollow">Huawei Toolbox</a>. Use the dBm value for RSSI and RSRP as the signal strength indicators for each antenn...
Java Random.nextDouble() probability <p>I'm trying to get random double numbers between 1.0 and 10.0 using the <code>Random.nextDouble()</code> as such:</p> <pre><code>double number = 1.0 + (10.0-1.0) * Random.nextDouble(); </code></pre> <p>Simulating this 10,000 times I find out that the probability of 1.0 and 10.0 ...
<p>The first point to note is that <code>(10.0-1.0)</code> is <em>exactly</em> <code>9.0</code> in IEEE754 double precision floating point.</p> <p>The next point to note is that <code>Random.nextDouble()</code> returns a number strictly less than <code>1.0</code> but greater than or equal to <code>0.0</code>. It will ...
onclick never execute function <p>I have the following html code to clear web storage data after click the button "Clear storage".</p> <p>The explorer (chrome and firefox) just never trigger the function clear after click the button of clear storage.</p> <p>The code is:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;s...
<p>Changing the function name did the trick. Just change your function name from <code>clear</code> to anything say <code>clearABC</code> and it will work.</p> <pre><code>function clearABC() { } </code></pre> <p>The reason for this in this post: <a href="http://stackoverflow.com/questions/7165570/is-clear-a-reserved-...
Chrome Extension: Set both themes and defaults in single extension <p>Is it possible to set both chrome themes and chrome defaults (i.e. Default Homepage and Search engine) in single chrome extension? </p>
<p>No, since Themes are separate from Extensions (that have the functionality to override settings) - it cannot be one entity. As soon as you declare <code>"theme"</code> in the manifest, you can't add normal Extension keys.</p> <p>An extension cannot cause other extensions (including themes) to be installed. I have b...
Lotus Notes - exclude current document from embedded view <p>I have an embedded view from which I would like to exclude the current document. Is there a way of doing this? The view selection is correct and displays a number of documents which include the document which contains the embedded view (which I would like to ...
<p>In my opinion you have no chance to exclude the current document from your embedded view because the only choice you have is to show a <strong>single category</strong> in an embedded view.</p> <p>A workaround could be to prevent the current document from opening:</p> <pre><code>Sub Queryopendocument(Source As Note...
Cannot import svg with '<image>' tag <p>I have a png picture. I open it in Adobe Illustrator and save it as svg without changing default configuration:</p> <p><a href="http://i.stack.imgur.com/FV9XJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/FV9XJ.png" alt="enter image description here"></a></p> <p>This g...
<p>While converting png to svg there are some rules which we need to follow. All converters are not working fine with their default configuration. In my case, I found the best converter site which will give you preview image to confirm during conversion, which will ask for free registration and then you can download yo...
How to adjust the View according to phone size programmatically? <p>I have created a view programmatically using frame: CGRectMake(0, 0, 320, 330) but when i tried to change my device the content size remains the same and bcoz of which it didn't look proper. I want to adjust the UI according to phone size. How can I do...
<p>Try this:</p> <pre><code>NewsTableView = UITableView(frame: UIScreen.mainScreen().bounds, style: UITableViewStyle.Plain) </code></pre> <p>or </p> <pre><code>NewsTableView = UITableView(frame: CGRectMake(0, 0, UIScreen.mainScreen().bounds.width, UIScreen.mainScreen().bounds.height), style: UITableViewStyle.Plain) ...
How to create custom Toolbar in android ..? <p>I need a custom toolbar for my app, can anyone help me to create toolbar like the image below</p> <p><a href="http://i.stack.imgur.com/XjfUH.png" rel="nofollow"><img src="http://i.stack.imgur.com/XjfUH.png" alt="Toolbar Image"></a></p> <p>Back Button in Left Title in C...
<p><strong>Use following xml</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content"&gt; &lt;...
How use PagingAndSorting with MyBatis? <p>I use mybatis for retriving data from the DB. But I would use the Pageable object (from spring) to have the pagination functionalities. Is this possible? It is still enough to extend myMapper with a PaginationAndSortRepository?</p> <p>Example:</p> <pre><code>@Mapper public in...
<p>I was searching the same thing some weeks ago and seems this is not possible. For what i found you have to implement your own paginator using RowBound parameter </p> <blockquote> <p>(The RowBounds parameter causes MyBatis to skip the number of records specified, as well as limit the number of results returned to ...
Cannot convert value of type 'GraphRequestResult<GraphRequest>' to type '[Any]' in coercion <p>I'm using the new facebook graph request:</p> <pre><code>let parameters = ["fields": "id, name, gender"] let nextrequest: GraphRequest = GraphRequest(graphPath: "me", parameters: parameters, accessToken: Acce...
<p>Check the signature of the <code>GraphRequestResult</code>, in your case it is <code>(connection: GraphRequestConnection! , result: AnyObject!, error: NSError!)</code> maybe the Swift conversion is creating <code>(connection: GraphRequestConnection! , result: AnyObject?, error: Error?)</code>. i.e <code>NSError</cod...
Singly Linked List program in C - Segmentation Fault Error <p>I have written a Code for Implementing Singly Linked List in C. While my code does compile, I get a segmentation fault when attempting to run my code.</p> <p>The Code is:</p> <pre><code>#include &lt;stdio.h&gt; #include&lt;stdlib.h&gt; struct Node{ in...
<pre><code>(struct Node*)malloc(sizeof(struct Node*)) </code></pre> <p>is wrong, you are creating a piece of memory of a pointer size. Try</p> <pre><code>(struct Node*)malloc(sizeof(struct Node)) </code></pre>
Application installed with Inno Setup writes files to unknown location instead of its installation folder <p>I try to make a setup with Inno Setup for my program.</p> <p>I have installed more file XML in the same folder as the .exe. The install work well, but when I run the program and modify the XML, the file is save...
<p>I think you are a victim of Windows File virtualization.</p> <p>You probably install data files to <code>Program Files</code> folder.</p> <p>That folder is not writable (unless your program runs with elevated privileges). If your program does not have <a href="https://msdn.microsoft.com/en-us/library/bb756929.aspx...
Can't find opensession() exception for Hibernatetemplatein hibernate5.1 and spring 4.1.6 integration <p>I am using <code>hibernate 5.1.0</code> and <code>spring 4.1.6</code> jars. For <code>Hibernate 3.6</code> jar, it's working fine, but i don't want to downgrade my hibernate jar. So what is the solution for <code>hib...
<p>You are using <code>HibernateTemplate</code> of version 3 with hibernate 5. this is incompatible. </p> <p>Also <code>HibernateTemplate</code> is deprecated. you should consider changing to sth else. </p> <p>Please have a look at <a href="http://docs.spring.io/spring/docs/current/spring-framework-reference/html/orm...
Please help me to solve this route errors <p>Route</p> <pre><code>Route::get('board/{category}', ['as' =&gt; 'board.showByCate', 'uses' =&gt;'BoardController@showByCate']); </code></pre> <p>Controller</p> <pre><code>public function cate() { $categories = category::all(); return view('welcome', compact('cat...
<p>You're trying to build URL with <code>route('board.showByCate')</code>, but you route has <code>{category}</code> parameter.</p> <p>So, you need to pass this parameter with <a href="https://laravel.com/docs/5.3/helpers#method-route" rel="nofollow"><code>route()</code></a>:</p> <pre><code>route('board.showByCate', ...
iOS UILabel sometimes is not displaying the correct color <p>I am using a UILabel to display text, sometimes it display correct color and sometimes not. I am using a simple UILabel object, below is my code:</p> <pre><code>UILabel *costomerTel = [[UILabel alloc] init]; costomerTel.textColor = RSColor(@"#0b192e"); costo...
<p>Just replace your this code with below code</p> <pre><code>// Separate into r, g, b substrings NSRange range; range.location = 0; range.length = 2; </code></pre> <p>Replace with this Code</p> <pre><code>// If Hex String Has Alpha Component NSInteger startRange = 0; CGFloat colorAlpha = 1.0f; // Separa...
How to get the id of the json data inserted in the Mongo db collection with node js app on Bluemix <p>I had one json data,I want to pass that JSON data in to Mongo db collection. The json data is,</p> <pre><code>json= { "customerdetails" : { "organId" : "sample", "address" : { "addressLine1" : "123213"...
<p>There are 2 issue in your code, we know that javascript is case sensitive and you are using <code>jsondata.customerDetails</code> while you should use <code>json.customerdetails</code> and you must know about <code>insert</code> callback function's argument.</p> <p>You do not need to use <code>JSON.parse(json);</co...
How to fetch the phone number for the imessage extension created application <p>I am trying to implement an iMessage Extension application, i want to fetch the number for whom i have selected the imessage to be created with the app i have created.</p> <p>How to fetch the number whom I am sending this custom message. A...
<p>For the moment it's not possible. It's more a question of privacy, Apple doesn't want dev to access private data like that. Maybe later Apple will allow it via a permission asked to the user (like they do for agenda/position etc).</p>
adding directory to my servlet web-app web.xml <p>Basically I have servlet web-app and I have a directory out the my web-app project say <code>D:\resources</code>, here in my porject web.xml I need to specify that the resources that my web-app would need could be found at <code>D:\resources</code>, I would really appre...
<p>Best way of achieving this is to configre your external resources with defining JNDI in your application server and then referring the same in your web.xml like for e.g.</p> <pre><code>&lt;resource-description&gt; &lt;res-ref-name&gt;myAppResources&lt;/res-ref-name&gt; &lt;jndi-name&gt;myResource&lt;/jndi-na...
Javascript object/function accesibility inside another one <p>I was looking for best solution, but I dont really what keyword should I look for. I need a bit of explanation of my problem :) Thats my code:</p> <pre><code>function fluidEdge(params) { var fluid = {}; fluid.point = function(config){ fluid.x = conf...
<p>You seem to have a slight mixup with how constructors and functions work. Your code should probably look somewhat like this:</p> <pre><code>function FluidEdge(params) {} FluidEdge.Point = function(config) { this.x = config.x; this.y = config.y; } FluidEdge.prototype.renderShape = function(params) { params =...
Pyhon - Best way to find the 1d center of mass in a binary numpy array <p>Suppose I have the following Numpy array, in which I have one and only one continuous slice of <code>1</code>s:</p> <pre><code>import numpy as np x = np.array([0,0,0,0,1,1,1,0,0,0], dtype=1) </code></pre> <p>and I want to find the index of the ...
<p>As one approach we can get the non-zero indices and get the mean of those as the center of mass, like so -</p> <pre><code>np.flatnonzero(x).mean() </code></pre> <p>Here's another approach using shifted array comparison to get the start and stop indices of that slice and getting the mean of those indices for determ...
Batch insert and arithmetic subtraction Yii 2 <p>I have this function that doesn't batch insert to my database, I only used the batch insert function recently because back then I only used object inserts through for loops like this</p> <pre><code>$subject = ActiveCurriculum::find() -&gt;select('scstock.*') -...
<p>You can perform subtraction using single query. Something like this:</p> <pre><code>$columnToUpdate = ['slots' =&gt; new \yii\db\Expression('[[slots]] - 1')]; $condition = ['sectiongroup' =&gt; $group]; ActiveCurriculum::updateAll( $columnToUpdate, $condition ); </code></pre> <p>It will execute SQL:</p> <pr...
System.Object constant cannot be created in this context <p>I try to write code that will iterate through my <code>DbSet&lt;staffCompetence&gt;</code> but it doesn't work.</p> <pre><code>[HttpPost] public ActionResult Index(StaffWrapper sw, HttpPostedFileBase file) { var st = db.staff.Where(s =&gt; s.ID.Equals(sw....
<p>You codes can be simplified to something like this following:</p> <pre><code>using (dbPMEntities db = new dbPMEntities()) { var model = db.staffCompetence; foreach (Guid id in ids) { **var scs = model.FirstOrDefault(s =&gt; s.competenceID.HasValue?s.competenceID.CompareTo(id):null); //Do double-check to see ...
Solr comparison functions report "Unknown function" <p>I'm attempting to write a reasonably basic boost function for Solr 4.x server.</p> <p>I wish for my boost function to work as such (pseudocode)</p> <pre><code>if (weight &gt;= 700) boost = 1.5 </code></pre> <p>The boost function I'm passing to Solr is the follow...
<p>The functions you mention was <a href="http://lucene.apache.org/solr/6_2_0/changes/Changes.html#v6.2.0.new_features" rel="nofollow">added in 6.2.0</a>.</p> <p>You can rewrite the query to something like <code>if(max(0, sub(weight, 700)), 1.5, 1.0)</code> - if the value is less than 700, use 0 - the if test will fai...
How to wrap checked exceptions but keep the original runtime exceptions in Java <p>I have some code that might throw both checked and runtime exceptions.</p> <p>I'd like to catch the checked exception and wrap it with a runtime exception. But if a RuntimeException is thrown, I don't have to wrap it as it's already a r...
<p>I use a "blind" rethrow to pass up checked exceptions. I have used this for passing through the Streams API where I can't use lambdas which throw checked exceptions. e.g We have ThrowingXxxxx functional interfaces so the checked exception can be passed through.</p> <p>This allows me to catch the checked exception i...
Unordered container with multiple keys / values <p>I need a data container for collecting numeric data based on one or multiple keys (like a key built of <code>int</code> and <code>std::string</code>). </p> <p>For one key, I simply can use <code>unordered_map&lt;std::string, int&gt;</code> respectively <code>unordered...
<p>You can use std::tuple for the same. Tuple Comparison works for multiple elements of almost all built in types. for example</p> <pre><code>typedef tuple&lt;int, int&gt; tx; tx t1 = make_tuple(1, 1); tx t2 = make_tuple(1, 2); if (t1 == t2) { cout &lt;&lt; "EQUAL" &lt;&lt; endl; } </code></pre> <p>or</p> <...
ORA-01007: variable not in select list-1007 <p>I have the table below:</p> <pre><code>CREATE TABLE req1_tb(TableName VARCHAR2(43), ColumnName VARCHAR2(98), Edit_ind CHAR) </code></pre> <p>Here's the dml for this table:</p> <pre><code>insert into req1_tb VALUES('Employees'...
<p>In your procedure the below code is going to create problem. As far i understand you are trying to select <code>columns</code> of table <code>employee</code> depending on <code>'Y'</code> flag from table <code>req1_tb</code>.</p> <p><strong><em>Problematic Part:</em></strong></p> <pre><code>for i in col_c loop EX...
How to get code to double values (x * 2) less than 10 in an array? (Java) <p>I'm taking an online Java programming class (I'm a beginner) and I cannot figure how to correctly complete the code. I've already written what I think is to be included, however I'm missing something that would make the code work completely.</...
<p>In your code, 12 &lt; 10 evaluates to be false and so, it goes out of loop and hence, it gives Wrong Output. Check the below code:</p> <pre><code> for (i = 0; dataPoints[i] &lt; NUM_POINTS ; ++i) { if(dataPoints[i] &lt; minVal) { dataPoints[i] = dataPoints[i] * 2; } } </code></pre> <p>I l...
Should I use try-catch block with Assertions <p>This question is in mind for quite a long time and I want to know whether should I use try-catch Block with assertion or not? for example-</p> <pre><code>1. assertEquals(actual, expected); 2. try { assertEquals(actual, expected); } catch(AssertionError e) { e.printStackT...
<p>The whole point of using JUnit, or TestNG, or something of that kind for your tests is that you can have thousands of tests in your project, and automate the testing. Running the tests can be part of the build process, and you get some feedback as to how many of the tests have passed. This is absolutely essential ...
Python 3, yield expression return value influenced by its value just received via send()? <p>after reading documentation, questions, and making my own test code, I believe I have understood how a <code>yield expression</code> works.</p> <p>Nevertheless, I am surprised of the behavior of the following example code:</p>...
<p>Your confusion lies with <code>generator.send()</code>. Sending is <em>just the same thing as using <code>next()</code></em>, with the difference being that the <code>yield</code> expression produces a different value. Put differently, <code>next(g)</code> is the same thing as <code>g.send(None)</code>, both operati...
Boost graph find edge in subgraph <p>There is a graph G0 and subgraphs G1...G7, and I want to find the occurrence of G7 in the set of subgraphs G1...G7, in this particular case the output should be G7 is in 5, G7 is in 7 but it doesnt work and output is G7 is in 4, ...
<p>I think you want to count the number of sub graphs containing the edges in G7.</p> <p>The line</p> <pre><code>if (edge(G7.local_to_global(source(*ei, G7)), G7.local_to_global(target(*ei, G7)), *ci).second) </code></pre> <p>seems to be in error, since it uses global vertex IDs to find an edge in <code>*ci</code>, ...
IntelliJ using external svn.exe even when option to use command-line client is switched off <p>How do I force IntelliJ to use it's internal SVN library (svnkit?) rather than an external command-line client? It appears to be ignoring the setting in the options dialog.</p> <p>Version is 2016.2.4</p> <p>I had previousl...
<p><a href="https://www.jetbrains.com/help/idea/2016.2/using-subversion-integration.html" rel="nofollow" title="IntelliJ SVN integration docs">I re-read the documentation</a> and realised the answer - the built-in IntelliJ SVN support (SVNKit) is only compatible with Subversion 1.7</p> <p>My working copy format is 1.8...
Oracle reduce result set on field duplication <p>I have a result set of a select in Oracle (12c) as the following:</p> <pre><code>GROUP_ID NAME ORDERING 1 AA 0 1 AA 1 1 AB 2 1 AC 3 2 BA 1 2 B...
<p>From your data, it seems that you only need:</p> <pre><code>select group_id, name, max(ordering) from yourTable group by group_id, name </code></pre>
Angular2 Wait for HttpPost response <p>I have an angular2 app in typescript. I am making a HTTP Post request in order to create a record. This post request happens fine and the record is saved, however, i return the new record from the service and i want to add it to a list in my component and update the DOM with the n...
<p>Like you noticed: <code>Observables</code> work async - so everything after your <code>.subscribe</code> call probably gets called before the code inside the <code>.subscribe</code> callback.</p> <p>To fix that, you need to put the code, that depends on the results of the <code>subscribe</code> call into its callba...
What is the best way for selecting 2 row from table in one row? <p>I have a table like following</p> <pre><code>TABLE_A ID PERSON_ID NAME GRADE ---------- ---------- ---------- ---------- 1 1 NAME_1 10 2 1 NAME_1 20 3 2 ...
<p>You can use GROUP BY as the other person suggested. </p> <p>Or you can make a join.</p> <pre><code>select t1.person_id, t1.grade as grade1, t2.grade as grade2 from TABLE_A t1 join TABLE_A t2 on t1.person_id=t2.person_id and t1.id!=t2.id </code></pre> <p>This JOIN joins all the rows with the same person, but not t...
Public Key is not available <p>I am trying to install ROS Kinetic on the Raspberry Pi 3 Model B running Raspbian GNU7Linux 8 (Jessie) following these <a href="http://wiki.ros.org/ROSberryPi/Installing%20ROS%20Kinetic%20on%20the%20Raspberry%20Pi" rel="nofollow">steps</a>.</p> <p>Setting up the repositories I get this o...
<p>Solved it.</p> <p>This manually adds the key:</p> <pre><code>sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys &lt;key number&gt; sudo apt-get update </code></pre>
access vba macro from outside the excel file <p>I've implemented a dialog box of password at the beginning of opening the file and wrong password or closing the dialog leads to </p> <pre><code>Application.Quit </code></pre> <p>by mistake at queryclose event I also make it close application with</p> <pre><code>Privat...
<p>If you hold Shift whilst clicking open the file it will open without running macros:</p> <p><a href="http://www.jkp-ads.com/Articles/preventopenevent.asp" rel="nofollow">http://www.jkp-ads.com/Articles/preventopenevent.asp</a></p>
Build an object having nested entities.Design Pattern <p>I am using Java 1.6</p> <p>Scenario: I have an entity structure called 'pnr' which looks like this:</p> <pre><code>&lt;pnr&gt; &lt;outbound&gt; &lt;travellers&gt; &lt;person&gt; &lt;name&gt;&lt;/name&gt; ...
<p>I think you are getting things wrong here. The layout of serialized data (for example when writing information into XML files) shouldn't affect the design of your <strong>classes</strong> at all.</p> <p>Example: in your XML you got those categories "inbound" and "outbound". Do you really need them in your <strong>o...
Nested ngRepeat with function call using parent property as parameter displaying wrong lists <p>I've got a nested ng-repeat that displays a seemingly random list of the possible ones I get.</p> <p>My HTML is like this:</p> <pre><code>&lt;table ng-init="getHouses()"&gt; &lt;tr&gt; &lt;td&gt;Id&lt;/td&gt; ...
<p>Your variable <code>peopleInHouse</code> will always reference to the same value. And since you are using a request to get data you can't simply use it directly in the <code>ng-repeat</code></p> <p>So just update the <code>ng-init</code> function so it populates the people in the house</p> <p>The function should l...
AWS SNS metadata when pushing to SQS <p>I'm using .net sdk to push messages to SNS which then publishes messages to subscribed SQS Queues, but SNS adds metadata such as message type etc, and i end up with larger JSON payload which i do not want, especially when SQS is limited to 256k per message.</p> <p>Is it possible...
<p>You want to enable RAW Message delivery in SNS:</p> <p><a href="http://docs.aws.amazon.com/sns/latest/dg/large-payload-raw-message.html" rel="nofollow">http://docs.aws.amazon.com/sns/latest/dg/large-payload-raw-message.html</a></p> <blockquote> <p>In addition to sending large payloads, with Amazon SNS you can no...
IOS Swift how reload viewcontroller when app come from background? <p>I want when user call app from background to reaload one function from viewcontroller?</p>
<p>You can register your controller for these notifications and reload your controller accordingly.</p> <pre><code>UIApplicationDidEnterBackgroundNotification UIApplicationWillEnterForegroundNotification </code></pre>
How to connect two variables when storing it to localStorage? <p>I'm writing my first app on Ionic. It's a simple notes app. I'm saving my list of notes like this: </p> <pre><code>save() { if(this.todoItem != "" &amp;&amp; this.todoText != "") { this.todoList.push(this.todoItem); localStorage.setIt...
<p>Instead of pushing plain todoItem to the list, you can try forming an Object with the pattern you require as shown.</p> <pre><code> save() { if(this.todoItem != "" &amp;&amp; this.todoText != "") { this.todoList.push({"todoItem":this.todoItem , "todoText":this.todoText}); localStorage.setIte...
Does this code causes UB? <p>I have checkd gcc and clang and both does not generate any warnings. I suppose that lifetime of temporary from foo() will be prolonged untill the end of full expression which is where semicolon in bar function call is located.</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt...
<p>The temporary returned by <code>foo()</code> (and <code>substr()</code>) will continue to exist until the end of the <code>bar</code> call (after the chain of method calls), this is safe.</p> <pre><code>int main() { A a; bar(a.foo().c_str()); //temporary is destroyed here bar(a.foo().substr().c_str...
Using '$' instead of 'jQuery' in WordPress <p>jQuery included with WordPress is in <a href="http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/" rel="nofollow">compatibility mode</a>. To avoid conflicts with other libraries we can not use the <code>$</code> shortcut for <code>jQuery</code>. To us...
<p>It's called <a href="https://api.jquery.com/jquery.noconflict/" rel="nofollow"><em>no conflict mode</em></a>, and not <em>compatibility mode</em>. To get this working, you have to use a <code>closure</code> or <a href="https://en.wikipedia.org/wiki/Immediately-invoked_function_expression" rel="nofollow"><code>IIFE</...
Can this chained comparison really be simplified like PyCharm claims? <p>I have a class with two integer attributes, <code>_xp</code> and <code>level</code>. I have a <code>while</code> loop which compares these two to make sure they're both positive:</p> <pre><code>while self.level &gt; 0 and self._xp &lt; 0: sel...
<p>IIRC, you could rewrite this as:</p> <pre><code>while self._xp &lt; 0 &lt; self.level: self.level -= 1 self._xp += self.get_xp_quota() </code></pre> <p>as per your reference above. It doesn't really matter that there's 2 different attributes or the same variable, ultimately you are simply comparing the val...
php - Antiflood - how to limit 2 requests per second <p>I have an anti flood function,</p> <pre><code>if (!isset($_SESSION)) { session_start(); } if($_SESSION['last_session_request'] &gt; time() - 1){ die(); } $_SESSION['last_session_request'] = time(); </code></pre> <p>If user requests more than 1 request in 1...
<p>I would do it this way:</p> <pre><code>&lt;? $time_interval = 1;#In seconds $max_requests = 2; $fast_request_check = ($_SESSION['last_session_request'] &gt; time() - $time_interval); if (!isset($_SESSION)) { # This is fresh session, initialize session and its variables session_start(); $_SESSION['last...