input
stringlengths
51
42.3k
output
stringlengths
18
55k
After GIT merge I still have the old branches <p>I am sorry if this seems simple to some but I'm still getting my head around GIT. I thought all was fine. I'd create a branch, make edits, then merge back into master.</p> <p>Then the other day I checked and there are still two old branches there. I tried to merge th...
<p>After you merge a branch the branch doesn't get deleted. You have to do that manually: <br></p> <p><code>git branch -d my_branch_name</code></p> <p>If the branch hasn't been merged it will prompt you to use <code>-D</code> instead of <code>-d</code>.</p>
How to generate a vector that orthogonal to other vectors? <p>I have a matrix A which is</p> <pre><code>A=[1 0 0 1 0; 0 1 1 0 0; 0 0 1 1 0; 1 1 1 0 0] </code></pre> <p>And a given vector <code>v=[ 0 0 1 1 0]</code> which has two elements one. I have to change the position of element one such that the new ...
<p>As <a href="http://stackoverflow.com/users/6282716/avk">AVK</a> also mentioned in the <a href="http://stackoverflow.com/questions/39825150/how-to-generate-a-vector-that-orthogonal-to-other-vectors#comment66941872_39825150">comments</a>, <code>v_new = [0 1 0 0 1]</code> is not orthogonal to <em>all</em> rows of <cod...
JAVA FX Media player seek() method consumes high memory in heap, it causes application crash <p>I am using java-Fx media-player, while playing video if try to seek video up to specific duration, while seeking video, Media-player thread consumes huge memory in heap. and media-player hangs out. it causes unexpected appl...
<p>It could be related to this bug: <a href="https://bugs.openjdk.java.net/browse/JDK-8101978" rel="nofollow">https://bugs.openjdk.java.net/browse/JDK-8101978</a>. Apparently, the problem is that older versions of JavaFX relied on regular heap GC / finalization to free native heap allocations, and the former can't kee...
Does the number of warnings in project has anything to do with speed of that application? <p>Our project is having a lot of warnings, will that be having any impact on the speed of the application?</p>
<p>The fact that there is a warning does not affect application runtime performance (it only exists at compile time).</p> <p>What the warning is trying to tell you might point at some problem, though, and some of those problems may have an impact on performance (or worse: correctness).</p> <p>For example, "assignment...
box plot in R with additional point <p>I have a dataframe of multiple columns (let's say <code>n</code>) with different range and a vector of length <code>n</code>. I want different x-axis for each variable to be shown below each box plot. I tried <code>facet_grid</code> and <code>facet_wrap</code> but it gives common ...
<p>If you can live with having the text of the x axis above the plot, and having the order of the graphs a bit messed-up this could work: </p> <pre><code>library(grid) p = ggplot(plot.data, aes(x = 0, y=value)) + geom_boxplot() + geom_point(aes(x = 0, y = test_data), color = "red") + facet_wrap(~variable, s...
Spring Data Elasticsearch to fetch Documents between two dates generates wrong query <p>I am trying to fetch documents which are greater or lesser than specified date.</p> <p>I am using the below searchQuery for this purpose.</p> <pre><code>QueryBuilder queryBuilder = QueryBuilders.boolQuery() .must(...
<p>Your query would not return any results, since you're looking for dates strictly greater and strictly lower than the same date. You need to use <code>gte</code> and <code>lte</code> instead:</p> <pre><code>QueryBuilder queryBuilder = QueryBuilders.boolQuery() .must(QueryBuilders.rangeQuery("date") ...
make UIcollectionView header dynamic height <p>-</p> <p>I have UIcollectionView with header<br> the header type is <code>UICollectionReusableView</code><br> and its have a text label and this text size not fixed, its depends on what user entered<br> so I need my headr stretching depends on the height of label and othe...
<p><strong>Note:</strong> this is Swift 3 code.</p> <p>Your ViewController:</p> <pre><code>class ViewController: UIViewController { @IBOutlet weak var collectionView: UICollectionView! // the text that you want to add it to the headerView's label: fileprivate let myText = "Lorem ipsum dolor sit er elit l...
Display single list value in 2 different columns in a JSP <p>How can I display list value in two different columns according to ID's?</p> <pre><code>&lt;div id="mappedORg"&gt; &lt;table width="100%" id="myTable" class="sortable"&gt; &lt;tr&gt; &lt;h1&gt;Mapped Organization&lt;/h1&gt; &lt;thead&gt; ...
<p>You need to use two different TD s in the loop inside TR</p> <pre><code>&lt;s:iterator value="userOrgMappedList" var="quesvar" status="questat"&gt; &lt;tr&gt; &lt;td valign="top" class="style11" style="width: 20%;"&gt;&lt;s:property value="userOrgMappedList[#questat.index].univeristy"/&gt;&lt;/td&gt; &lt;td valign...
can't decrypt the AES256 encrypted text <p>I have used so many libraries and so many functions but can't decrypt it.</p> <pre><code>NSString *key = @"innoways21897016"; NSString *iv = @"61079821218970166107982121897016"; NSString *encrypted = @"iG5lIZKGevzV3UfhcqOzgA/xwKhAKjB75G1L4Z1s/RU="; NSData *data = [encrypted d...
<p>There are some errors and potential errors:</p> <ol> <li><p>You are specifying AES with a 256-bit key (<code>AES256DecryptWithKey</code>) but supplying a 128-bit (16-byte) key. Either specify AES with a 128-bit key or provide a 256-bit key.</p></li> <li><p>AES has a block size of 16-bytes you are supplying a 32-byt...
Powershell check if path is folder or file <p>I'm trying to write a powershell script which goes through a list of values which are folder or file paths, and delete the files first, then remove the empty folders.</p> <p>My script so far:</p> <pre><code>[xml]$XmlDocument = Get-Content -Path h:\List_Files.resp.xml $Fil...
<p>I think that your <code>$Files</code> object is an array of strings:</p> <pre><code>PS D:\PShell&gt; $Files | ForEach-Object {"{0} {1}" -f $_.Gettype(), $_} System.String D:\PShell\SO System.String D:\PShell\SU System.String D:\PShell\test with spaces System.String D:\PShell\tests System.String D:\PShell\addF7.ps1 ...
WordPress: Category sort by Latest Post Date <p>I am working in a custom WP theme.I need to show each posts under individual categories, which is working fine.But, i want to sort the categories according to the published date of posts.</p> <p>I found one answer, but its not working in my code and i cant figure how to ...
<p>You can try this to show all categories by date</p> <pre><code> &lt;?php $args = array( 'show_option_all' =&gt; '', 'orderby' =&gt; 'ID', 'order' =&gt; 'DESC', ); ?&gt; &lt;?php wp_list_categories( $args ); ?&gt; </code></pre>
buiding a dropdown with json <p><strong>Requirement :</strong> I have a json response that I would like to transform to a <code>dropdown</code>. I'm using a jade template to handle the iteration but I'm having troubles getting the values. I'd like the sys_id be passed as a value on selecting the option(u_product_name) ...
<p><strong>Try this i hope it will work :</strong></p> <p><strong>Html :</strong></p> <pre><code>&lt;select id="items"&gt;&lt;/select&gt; </code></pre> <p><strong>Script :</strong></p> <pre><code> var data={ result: [ { sys_id: '7d950856', u_product_n...
Multiply two key values for each array item <p>My code goes as:</p> <pre><code>&lt;?php $items = array( array("SKU" =&gt; "a49w8dsa", "Title" =&gt; "Socks", "Description" =&gt; "Sports socks", "Price" =&gt; "1.50", "Quantity" =&gt; "4"), array("SKU" =&gt; "ta8dla", "Title" =&gt; "T-shirt", ...
<p>Get price of each item into an array, then finally sum it up using <a href="http://php.net/manual/en/function.array-sum.php" rel="nofollow"><code>array_sum()</code></a> -</p> <pre><code>$eachPrice = array(); foreach ($items as $key =&gt; $val) { $eachPrice[] = $val['Price'] * $val['Quantity']; } $totalPrice = ar...
Pandas reorder data <p>This is probably an easy one using pivot, but since I am not adding the numbers (every row is unique) how should I go about doing this?</p> <p>Input:</p> <pre><code> Col1 Col2 Col3 0 123.0 33.0 ABC 1 345.0 39.0 ABC 2 567.0 100.0 ABC 3 123.0 82.0 PQR 4 345.0 10...
<p>You can use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.pivot.html" rel="nofollow"><code>pivot</code></a>:</p> <pre><code>print (df.pivot(index='Col1', columns='Col3', values='Col2')) Col3 ABC PQR XYZ Col1 123.0 33.0 82.0 NaN 345.0 39.0 10.0 9...
This is a practice code Its About reduse string.? <p><strong>My code Doesn't give correct output when I give "aa" or "baab" as a user input?</strong> How to solve using only c code.</p> <pre><code>char *reduce_string(char *ptr,int size) { int i,j=0; char *p=ptr; while(p[j]!='\0') { if(p[j]==p[j...
<p>This line seems to be a problem:</p> <pre><code>memmove(p+j,p+j+2,size+1); ^^^^^^ </code></pre> <p>You always move <code>size+1</code> elements even though you are iterating down the string. The number of elements to move must depend on <code>j</code>. </p> <p>I assume you want this:</p> <block...
Not able to expose the custom headers from WebAPI to client <p>I have written a program to download the pdf, word or txt file returned by web api and it's working fine. On server side I have used WebApi and client side AngularJs. Now the problem is, I also need the file name from api as well and for that I need to read...
<p>After adding below lines has solved my problem.</p> <p><code>// Add a custom header for filename and expose it to be consumed by JavaScript. response.Content.Headers.Add("Filename", zipFileName); response.Content.Headers.Add("Access-Control-Expose-Headers", "Filename");</code></p> <p>So basically adding <em>...
Angular 2 Unit testing: Can't resolve all parameters for Router <p>I use unit testing with karma with angular 2.I added Router in my service and but when I write test case for that it through me following error.</p> <pre><code> Error: Can't resolve all parameters for Router: (?, ?, ?, ?, ?, ?, ?, ?). </code></pre> <p...
<p>If you don't care to do any actual routing in the test, you can just create a mock for it</p> <pre><code>let mockRouter = { navigate: jasmine.createSpy('navigate'); } TestBed.configureTestingModule({ providers: [ { provide: Router, useValue: mockRouter } ] }) </code></pre> <p>Then in your test maybe yo...
Segmentation fault with multiple char* comparisons <p>I have a C program that makes the following comparisons:</p> <pre><code>void compare(char** args) { if (find_in_args(args, "&gt;") != -1) { printf("In &gt; block"); } else if (find_in_args(args, "&lt;") != -1) { printf("In &lt; block"); ...
<p>The problem is caused by the <code>i != 10</code> in the <code>while</code> loop. Changing the <code>while</code> loop to iterate based on the condition <code>args[i] != NULL</code> will fix the issue.</p>
Converting a JSON string to a JSON array <p>I have a CSV file like this</p> <pre><code>first_name,last_name,phone Joseph,Dean,2025550194 Elbert,Valdez,2025550148 </code></pre> <p>Using this <a href="https://gist.github.com/robflaherty/1185299" rel="nofollow">csv-to-json.php</a> from GitHub I get output like this</p> ...
<p>If you get the JSON string, then you would of course first convert it to an array with:</p> <pre><code>$arr = json_decode($json, true); </code></pre> <p>But probably you already have the array. You then apply this loop to it:</p> <pre><code>foreach($arr as &amp;$row) { if (isset($row['phone'])) { // only when...
Match text outside Parentheses <p>I have a string</p> <pre><code>string s = Hello, (L05-#301ME) I am a programmer. </code></pre> <p>I need to extract this to</p> <pre><code>string result = Hello, I am a programmer </code></pre> <p>That mean I need to get all text ouside the parentheses. How can I use RegEx to do th...
<p>This should work for you:</p> <pre><code>var input = "Hello, (L05-#301ME) I am a programmer."; var output = Regex.Replace(input, @" ?\(.*?\)", string.Empty); Console.WriteLine(output); // output would be "Hello, I am a programmer." </code></pre>
scrapy - spider module def functions not getting invoked <p>My intention is to invoke start_requests method to login to the website. After login, scrape the website. Based on the log message, I see that 1. But, I see that start_request is not invoked. 2. call_back function of the parse is also not invoking. </p> <p>W...
<p>I figured out the crapy mistake i did!!!! </p> <p><strong>I didn't place the functions inside the class. Thats why .... things didnt work as expected. Now, I added a tab space to all the fuctions and things started to work fine</strong></p> <p>Thanks @user2989777 and @Granitosaurus for coming forward to deb...
how I can remove the keyboard that appears automatically onCreate? <p>I have an edit text with custom keyboard or numpad my problem is when I open my app the android keyboard appears automatically I don't want for that to happen my apps idea is simple when i click on edit text my custom keyboard appears . so how I can ...
<p>Just do this</p> <pre><code>InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); </code></pre>
How to add extra field in datatable which is not database <p>I am trying to add <code>edit</code> and <code>delete</code> button in data table.</p> <p>I have html</p> <pre><code>&lt;table id="example" class="display" cellspacing="0" width="100%"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Theater n...
<p>You just need to add its HTML in your <code>DataTable</code> definition</p> <pre><code>$('#example').DataTable( { "processing": true, "serverSide": true, "ajax": "&lt;?php echo JRoute::_('index.php?option=com_wsmovies&amp;task=addtheatres' ); ?&gt;", "columns": [ { "targ...
Strange behavior of isset and empty function <p>I am running into strange problem. I have following simple line in PHP</p> <pre><code>&lt;?php echo "Value = ".$this-&gt;language; //outputs Value = en echo "&lt;br&gt;isset = ".isset($this-&gt;language); //Outputs isset = echo "&lt;br&gt;Is empty = ".empty...
<p>instead of 'echo' use var_dump.Will help you to understand the difference.</p> <pre><code>$language = 'en'; echo "Value = ".$language; //outputs Value = en $isset = isset($language); $empty = empty($language); echo "&lt;br&gt;isset = ";; var_dump($isset); //bool(true) echo "&lt;br&gt;Is empty = "; var_dump($emp...
Best way to provide access control on datastore entities with parent relationship <p>Suppose I have Three kind of entities- Users,Posts,Comments. Every Post has a parent User and every comment has a parent Post i.e. User->Post->comment.</p> <p><strong>My APIs looks like below:</strong></p> <p>key here is the websafe ...
<p>This is a good, restful API design (although the popular convention is to pluralize collections - <code>/users/{key}</code>, <code>/posts/{key}/comments</code>, etc).</p> <p>You should handle authorization checks explicitly. The implementation of <code>GET /users/{key}</code> should check if the caller has rights t...
ReactJs.NET and server side rendering with V8 throws exception in production <p>I am using ReactJs.NET in a ASP.NET MVC 4 project. I have disabled the fallback to MSIE javascript engine by specifying this in my ReactConfig.cs that is called on app start:</p> <pre><code>ReactSiteConfiguration.Configuration.SetAllowMsie...
<p>Are those DLL files in a ClearScript.V8 folder? They need to be at <code>bin\ClearScript.V8\ClearScriptV8-64.dll</code> for example.</p> <p>Alternatively, you can try out the release candidate of ReactJS.NET 3.0, which uses a newer version of JavaScriptEngineSwitcher that changes how V8 is loaded and no longer requ...
SSL handshake error <p>I am hitting a handshake problem with one of our servers. I cant seem to figure out how to resolve this. A few days back, I was facing a similar issue while connecting to one of our other servers and you can follow that in <a href="http://stackoverflow.com/questions/39746541/netldaps-throws-unkno...
<p>You have to specify the user certificate and the private key with the <code>-cert</code> and <code>-key</code> parameters. </p> <pre><code>openssl s_client -port 443 -CApath /usr/share/ssl/certs/ -host $host -prexit -cert your.client.certificate.cert -key your.private.key.key </code></pre>
How to move file from one folder to another folder same ftp using python <p>How move files from one folder to another folder in same ftp using python i used this code but it doesn't work out </p> <pre><code>ftp=FTP("host") ftp.login("user name","password") def downloadFiles(path,destination): try: ftp.cwd...
<p>I would suggest using the excellent python file system abstraction <a href="https://pypi.python.org/pypi/fs" rel="nofollow">pyfs</a> as you can see from the <a href="http://docs.pyfilesystem.org/en/latest/interface.html" rel="nofollow">documents</a> all of the file systems, once mounted, have <code>copy</code>, <cod...
Walkthrough-Screens in ASP.Net MVC <p>I know this question is a part from research, but I couldn't find anything, since I don't even know what this is called:</p> <p>With Android or/and iOS-Apps there is a possibility to create Walkthrough-Screens/In-App-Tutorial-Views. (the normal View, but with a gray layer in front...
<p>These are called "Web Site Tours" or "Walkthroughs" or "Guided Tour" plugins and there are quite a few of them. In no particluar order (and no affiliation with the sites):</p> <ul> <li><a href="http://introjs.com/" rel="nofollow">http://introjs.com/</a></li> <li><a href="https://www.quora.com/What-tools-can-I-use-t...
CRM : SOAP : Error in ExecuteWorkflowRequest <p>I want to Execute workflow with SOAP. I've googled all around this and tried different ways. But none of my code works. For example, two most final variants are: <strong>for 2011 Service</strong></p> <pre><code>function RunWorkflow() { var url = Xrm.Page.context.getS...
<p>I believe in first request you missed one node. Try to replace</p> <pre><code>var requestMain = " &lt;s:Body&gt;"; </code></pre> <p>with</p> <pre><code>var requestMain = "&lt;s:Envelope&gt;&lt;s:Body&gt;"; </code></pre>
conda stuck on Proceed ([y]/n)? when updating packages etc <p>I just downloaded Anaconda 4.2.0 (with python 3.5.2) for Mac OS X. Whenever I try to update any packages etc, my ipython console presents the package dependencies and displays "Proceed ([y]/n)?" but does not take any inputs. E.g. I press enter, or y-enter et...
<p>You can launch shell commands with the <code>!</code> operator in ipython, but you can't interact with them after the process has launched.</p> <p>Therefore, you could:</p> <ol> <li>execute your conda command outside of your ipython session (IOW, a normal shell); or</li> <li>pass the <code>--yes</code> flag. e.g.:...
There is already an open DataReader associated with this Command which must be closed first In Nopcommerce <p>I'm getting product images from this services getting this error in version 3.8</p> <pre><code>var defaultProductPicture=_pictureService.GetPicturesByProductId(productmodel.Id,1).FirstOrDefault(); productmodel...
<p>This can happen if you execute a query while iterating over the results from another query.</p> <p>So just add <code>MultipleActiveResultSets=True</code> to the connection string in <code>setting.txt</code> file.</p> <p>Hope this helps!</p>
entity framework perform update before delete, I want to stop this <p>I have Problem with entity framework I have two code first class Countries and Cities</p> <pre><code> [Table("dbo.Countries")] public class Country { public int CountryId { get; set; } public string CountryNameAr { get; set; } public vi...
<p>Replace your <code>City</code> model with code below, all you need to do is to <strong>tell Entity that <code>Country</code> is required for a <code>City</code> to exist</strong>:</p> <pre><code>[Table("dbo.Cities")] public class City { public int CityId { get; set; } public int CountryId { get; set; } ...
I want to write an ELF file by hand.How could I make my elf file call the c standard library <p>I want to write an ELF file by hand.How could I make my elf file call the c standard library. I know about the kernel search for the PT_INTERP program header and read "/lib/ld-linux.so.2", and I know about Global Offset Tabl...
<p><a href="http://stackoverflow.com/questions/39826380/i-want-to-write-an-elf-file-by-hand-how-could-i-make-my-elf-file-call-the-c-stan">What happens is</a>:</p> <ol> <li><p>the kernel maps the main executable and dynamic linker in the process VAS (virtual address space);</p></li> <li><p>the kernel starts the executi...
vertica sql: running sum for 1 hour <p>I know there are a lot of forum questions on running totals, but somehow I don't quite know how to apply to my example. So appreciate if somebody can help.</p> <p>I am trying to calculating the hourly running total of 'speed' partition by 'ID'. How can I proceed on this? I am usi...
<p>You should be able to partition by id and use <code>range between '1 hour' preceding and current row</code>. <code>RANGE</code> works on the value in the <code>ORDER BY</code> to limit the window frame.</p> <pre><code>select datetime, id, speed, sum(speed) over (partition by id ...
How to save GIF image in sdcard? <p>I am new android and I want to save GIF image in sdcard through android programming. Currently I had done some code from google to save GIF image in sdcard. But When I am saving that image to sdcard it will display normal image not GIF Image.</p> <p>Here this is my code to display G...
<p>I am not sure but as per your requirement you should first open your GIF and then after you convert into byte array then after you save it.i hope you will get your solution</p> <pre><code>private void saveGIF() { try { File file = new File(Environment.getExternalStoragePublicDirector...
How to display uploaded image on another page using local storage? <p>I am working with html javaScript. My issue is that I have two files index.html and output.html and fill the inputs in index.html and print the output in output.html using local storage. Everything is working fine but I am not able to display the ima...
<p>Ok, you have two ways to solve that problem. </p> <p>The first way, like mentioned in comment, to use some scripting language, to save image from input form in <code>index.html</code>.</p> <p>The another way, to use properly google, especially stackoverflow, because many newbie questions have answers here: <a href...
How to clamp camera in Unity3D <p>My code is not working, I am trying to clamp the camera, but its not working. How to clamp the camera?</p> <pre><code>using UnityEngine; using System.Collections; public class MoveCamera : MonoBehaviour { public float sensitivity = 4.0f; private Vector3 mouseOrigin;...
<p>You forgot to get the value of rotationX and rotationY from your transform after rotating it. Try this :</p> <pre><code>if (isRotating) { Vector3 pos = Camera.main.ScreenToViewportPoint (Input.mousePosition - mouseOrigin); transform.RotateAround (transform.position, transform.right, -pos.y * sensitivity); ...
Simple PHP error T_print error <pre><code>include 'connect.php'; msql_select_db("u972015033_jobss"); or die("Could not find DB"); if(isset($_POST['search'])){ $searchq = $_POST['search']; $query = msql_query("SELECT * FROM job_search WHERE job_name LIKE '%$searchq%'"); or die("Could not find"); $count = mys...
<p>There are a few different syntax errors:</p> <ul> <li>you don't need the semicolon (;) after the database functions and before "or die", remove both of them</li> <li>the closing curly brace for the if statement needs to be before the else statement, you don't have to enclose everything in that if</li> <li>you don't...
Genymotion emulator shows blank white space as shown in screenshot <p>I have followed all the steps and at last when I run the Google Nexus 5-5.1 .0 emulator it shows blank white space as shown in screenshot same with Moto X-4.4.4</p> <p><a href="http://i.stack.imgur.com/n7tn7.png" rel="nofollow"><img src="http://i.st...
<p>After clicking on that icon phone tab is open which is also blank as shown in screen shot.</p> <p><a href="http://i.stack.imgur.com/4kcSm.png" rel="nofollow">Blank phone tab after clicking</a></p>
calculating delta time between records in dataframe <p>I have an interesting problem, I am trying to calculate the delta time between records done at different locations.</p> <pre><code>id x y time 1 x1 y1 10 1 x1 y1 12 1 x2 y2 14 2 x4 y4 8 2 x5 y5 12 </code></pre> <p>I am trying to get some thing like</p> <pre...
<p>I think you need <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.drop_duplicates.html" rel="nofollow"><code>drop_duplicates</code></a> with <code>groupby</code> with <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.core.groupby.DataFrameGroupBy.diff.html" rel="nof...
C++ FTP PORT command implementation using sockets <p>I am trying to implement active mode for my cpp ftp client. </p> <p>I was trying to implement simple LISTEN server, netstat -ant said it is listening on 0.0.0.0:port (for example 1025).</p> <p>In client when I send PORT 0,0,0,0,4,1\r\n server replies with code 500 ...
<p>You're listening at 0.0.0.0, which just means 'any', but the peer needs an actual IP address, not 0.0.0.0. You need to send it a public IP address that will reach your listening socket.</p>
recursion for modular arithmetic <p>I'm trying to compute this:</p> <pre><code>x^y (mod a) </code></pre> <p>Using recursion as it works better for larger numbers. Here's what I have:</p> <pre><code>public int mod (int x, int y, int a){ if(y == 2){ return x^2%a; } if(y%2 == 1){ return a%m*mod(x , y/2, a); } if(y%...
<p>In Java, a function, which return type is not <code>void</code>, must return some value. Unfortunately, the compiler isn't smart enough to understand that your <code>if</code> statements cover all range of input parameter's values. The compiler assumes that all your conditions can evaluate to <code>false</code>, thu...
How do I retrieve synonyms of a word from WordNet using SPARQL on Jena Fuseki server? <p>I am new to SPARQL. I tried the following query after uploading wnfull.rdfs onto my Jena Fuseki server:</p> <pre><code>PREFIX wn20schema: &lt;http://www.w3.org/2006/03/wn/wn20/schema/&gt; SELECT ?aSynset WHERE { ?aSynset wn20s...
<p>The file you loaded contains just the schema, not the instance data of WordNet. (Wouldn't be the first step to looking into the file and check which data will be loaded?)</p> <p>By the way, I would prefer the RDF version that matches the latest one from here: <a href="http://wordnet-rdf.princeton.edu/" rel="nofollo...
How to set custom folder path for sub folders in vendor when installing a package <p>I want to install a package into my local project.For that I'm creating a composer.json file in my project folder is given below, it gives the total vendor folder of that package into my custom folder in my project. Its working fine......
<p>Composer is used to bring in packages to support the PHP code of a project, here is how they describe it on the Composer website:</p> <blockquote> <p>Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them fo...
Android Studio App crashe s when im starting it on handy without debuger <p>Since yesterday my app hangs when I start it without the debugger. When I debugg the app everything works fine. I don't know if I should post the code I think it's too much. I'm using the Google Maps API.</p> <h2><strong>Logcat(Error):</stron...
<p>Add these permissions to manifest.xml</p> <pre><code>&lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt; </code></pre> <p>and you are good to go..</p>
Swift 3 weird crashes (type inference) <p>I couldn't find a more appropriate title for this. This is the scenario:</p> <pre><code>final class Something : UIViewController { fileprivate var tableView: UITableView! override func viewDidLoad() { super.viewDidLoad() self.tableView = UITableView(f...
<p>This is a issue with Swift 3. </p> <p>Declare the dictionary explicitly:</p> <pre><code>let views: [String:UIView] = ["table":self.tableView] </code></pre> <p>In you're case when you create in this manner <code>let views = ["table": self.tableView]</code> you receive type that is <code>[String:UIView?]</code>...
Bean validation regex for an input string containing x or y number of digits <p>I want to check if an input string contains x or y number of digits. I am using <code>JSR-303</code> bean validation. Is it possible to check? If yes what regex would be appropriate? For. eg. "123dfn5657" or "34fdg8959413" if validating aga...
<p>You can use the regular expressions syntax as described in the <a href="https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html" rel="nofollow"><code>java.util.regex.Pattern</code> javadoc</a>.</p> <p>In your case, say you want, for instance, to define inputs of 1, 2 or 4 digits (but not 3), you can ...
Could it be possible that VOIP pushes get delayed or lost? <p>I have been working on a VOIP based application. The deployment target is 8.0.<br> I have used the <code>PUSHKit</code> framework for VOIP push notification. My application runs in the background and rely on VOIP pushes for chat &amp; call notifications. <...
<p>Make sure you set the priority.</p> <p><a href="https://github.com/node-apn/node-apn/blob/master/doc/notification.markdown#notificationpriority" rel="nofollow">https://github.com/node-apn/node-apn/blob/master/doc/notification.markdown#notificationpriority</a></p>
Can't remove plugins from IOS project <p>When I create an app with the phonegap command line it automatically adds multiple plugins I don't want ..</p> <pre><code>plugin list cordova-plugin-battery-status 1.1.2 "Battery" cordova-plugin-camera 2.1.1 "Camera" cordova-plugin-compat 1.0.0 "Compat" cordova-plugin-console 1...
<p>Create the project and find <code>config.xml</code> BEFORE you add a platform. Delete plugins from within <code>config.xml</code> then add your platform. </p>
Change text with onclick then change back <p>I trying to change the text link with particular word with a click handler. When I click again the text link should change back. How can I do this? </p> <pre><code>&lt;div class="checkLevel" id="damonkEYkEY"&gt; &lt;span data-bind="css: safeLevelClass"&gt; &lt;/span&gt;...
<p>To achieve this you can provide a function to the <code>text()</code> method and use a ternary expression to read the current text value and update it accordingly. Try this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="...
Change Task triggering but not reflecting the field values on OIM process Form <p>When I am changing any attributes of user from User Profile its changing those attributes in OIM and target also. The change Tasks are getting called when checked in the Resource History, but the updated data is not shown in the OIM Proce...
<p>Some things to double check</p> <ol> <li><p>In the process form, does the Change Task exist, does it simply copy the user attribute to the process data field?</p></li> <li><p>Does the change task exist in the Lookup.USR_PROCESS_TRIGGERS table?</p></li> <li><p>Is there an XX Updated task that was triggered? how was...
Google Auto suggestion City mismatch when using in different regions <p>I integrated the <code>GoogleMaps SDK</code> to pick Location of place by AutoSuggestion, I am using <code>GMSAutocompleteViewController</code> to get city suggestions, with this location for city selected I want to search for hotels in our databas...
<p>You can remove the filter for the country to get results everywhere. Based on the documentation <a href="https://developers.google.com/places/web-service/autocomplete" rel="nofollow">Place Autocomplete</a>:</p> <blockquote> <p><em><code>**language**</code></em> — <strong><em>The language code, indicating in whi...
How setting endianess works for DataView <p>I'm reading <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/DataView" rel="nofollow">this explanation</a> of DataView and there's an example there:</p> <pre><code>var littleEndian = (function() { var buffer = new ArrayBuffer(2); new...
<p>Suppose we create an array buffer and array like this:</p> <pre><code>var dv = new DataView(new ArrayBuffer(4)); </code></pre> <p>It means that we've got 32 bits in memory:</p> <pre><code>0000 0000 0000 0000 0000 0000 0000 0000 </code></pre> <p>Now, we want to store the number <code>0x0103</code>, which has the ...
Laravel / Eloquent order Relationship Descending without Raw SQL? <p>Is it possible to order by a relationship, so that the records in that relationship are discending without using raw SQL?</p> <p>Example:</p> <pre><code>$device = CustomerDevice::with('user')-&gt;with('customerDeviceHistory')-&gt;find($did); </code>...
<p>This will order by id in desc order of <code>customerDeviceHistory</code> id.</p> <pre><code> $device = CustomerDevice::with('user')-&gt;with(['customerDeviceHistory'=&gt;function($query) { $query-&gt;orderBy('id','desc'); ...
[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x16577e10 -> A Crash After makeKeyAndVisible <p>I get the following error when debug and found that after this line, the app crash: </p> <pre><code>[self.window makeKeyAndVisible]; </code></pre> <p>When attempt to r...
<p>Same issue with <code>iOS 10</code>,<code>xcode8</code> while loading view or initializing view from/or using <code>xib's</code>.</p> <p>You can try following solution:</p> <ol> <li><p>Go to your interface files, means <code>Xib's</code> and <code>Nib's</code>.</p></li> <li><p>On the right side, navigate to the <s...
how to push values into an array declared globally <p>Hello all am working in codeigniter and my model page look like below, I have declared the array globally is it possible to push value inside the globally declared $referrals() array </p> <pre><code> &lt;?php Class usermodel extends CI_Model { ...
<p>It is not a global variable. It is a property of a class. And it can be done like this:</p> <pre><code>array_push($this-&gt;referrals,$result); ^^^^^ </code></pre> <p>When you try to access a property of the class, you need to prepend <code>$this-&gt;</code> to it.</p>
Win32 (C++) :- How to make a list item collapsible <p>I have a listbox in which multiple list items are there. I want to implement something like if we click on the list item, it will collapse and show the summary of the clicked item:</p> <p><a href="http://i.stack.imgur.com/4O9Hy.jpg" rel="nofollow"><img src="http://...
<p>Standard <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb775146.aspx" rel="nofollow">ListBox</a> and <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb774737.aspx" rel="nofollow">ListView</a> controls do not natively support expanding/collapsing items, however it is possible to ...
Fastest way to reset all the value of a 2-D vector? <p>How to reset all the values of <code>vector&lt;vector&lt;int&gt;&gt;</code> to 0 without using loop and maintaining the size of vector.</p>
<p>You should use <a href="http://en.cppreference.com/w/cpp/algorithm/fill" rel="nofollow"><code>std::fill</code></a> in combinations with a <code>for</code> loop or <code>std::for_each</code>:</p> <pre><code>for (auto &amp;v: vec) { std::fill(v.begin(), v.end(), 0); } </code></pre> <p>Here <a href="http://en.cpp...
SQL select top if columns are same <p>If I have a table like this:</p> <pre><code>Id StateId Name 1 1 a 2 2 b 3 1 c 4 1 d 5 3 e 6 2 f </code></pre> <p>I want to select like below:</p> <pre><code>Id StateId Name 4 1 d 5 3 e 6 2 f </code></pre> <p>For example, Ids 1,3,4 have stat...
<pre><code>; WITH CTE AS ( SELECT *, ROW_NUMBER() OVER(PARTITION BY STATEID ORDER BY ID DESC) AS RN )SELECT ID, STATEID, NAME FROM CTE WHERE RN = 1 </code></pre>
Github GET on private repo with access token <p>I have a private repo in my org and I need to provide access. I want to be able to access a file through a GET request (the browser). I do NOT have a terminal or curl or any other tools.</p> <p>I created a dummy account that I linked to my org. I went to <a href="https:/...
<p>The <a href="https://developer.github.com/v3/#oauth2-token-sent-as-a-parameter" rel="nofollow">API docs</a> list that you can use the parameter <code>access_token</code> to pass in an oauth token (not <code>private_token</code> or <code>token</code>).</p> <p>Does <a href="https://raw.githubusercontent.com/ORG/REPO/...
Oracle: "sequence ID_TABLE1.CURRVAL is not yet defined in this session" - how can I obtain last values of sequence? <p>I'm doing 2 INSERT statements in Oracle DB. 1st INSERT is saved allways when my certain textbox is not empty on form. 2nd INSERT is being saved only If Datagridview 1st cell is not empty. These tables ...
<p>You create 2 different connections:</p> <p>First </p> <pre><code>cmd.Connection = OracleConn() '/////////I'm adding plenty parameters here///////// cmd.CommandText = "INSERT INTO Table1 (ID_Table1, Field1, Field2) VALUES(ID_Table1_seq.nextval,: Field1Parameter,: Field2Parameter)" </code></pre>...
issue with mySql Query? <p>I want to display data from two table all required information from <strong>Member</strong> table and photos from profile image file now i want to save profile photo address to database but i got error my php script is here</p> <pre class="lang-html prettyprint-override"><code>&lt;?php erro...
<p>There was extra double quote (") in query </p> <pre><code>mysqli_query($conn,"INSERT INTO profileimage VALUES ('','".$target_file."','') select p.imageid, p.username,p.imagepath from profileimage p innerjoin member m on m.username=p.username") or die(mysqli_error($conn)); </code></pre>
Getting string after the first _ <p>I have a String such as ABC_DEF_GHI.</p> <p>Using JavaScript I need to get everything after the first _ (that is, DEF_GHI in this case). There could be any number of _ in the String.</p> <p>If I do something like</p> <pre><code>var str = "ABC_DEF_GHI_JKL"; var n = str.lastIndexOf(...
<p>You should replace your <code>lastIndexOf()</code> by <code>indexOf()</code> which will take the first occurrence </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>var str...
Skyscanner response contains so many OutboundLegId and InboundLegId? <p>I am using <strong>Skyscanner</strong> travel api and getting response successfully.</p> <p>There are so many OutboundLegId and InboundLegId in the response. </p> <p>I just want to show flights for the selected destination. please see attachment....
<p>Add this in the query string with session key <strong>&amp;pageindex=1&amp;pagesize=10</strong></p>
How to insert div underneath list of floating divs <p>Say you have 5-20 inner boxes inside an outer box, which has a width of 300-500 pixels.</p> <pre><code>&lt;outer&gt; &lt;inner&gt;Number 1&lt;/inner&gt; &lt;inner&gt;Number 2&lt;/inner&gt; &lt;inner&gt;Number 3&lt;/inner&gt; &lt;inner&gt;Number 4&lt;/inner&gt; &lt;...
<p>I hope i got your question right, you need to change the css when needed , for example add a class that has float:none and clear:both when a condition (like click occurs.</p> <p>I did an example on fiddle:<a href="https://jsfiddle.net/ejeqs8m7/2/" rel="nofollow">https://jsfiddle.net/ejeqs8m7/2/</a> Just click on an...
How to add selected players from MyPlayerActivity and add those players into MainActivity Map as markers? <p>I would like to select few players ( highlighted in purple colors ie Player 1, Player 3 &amp; Player 5) from 'MyPlayerActivity' and add these selected players into a mapbox Map as markers (MainActivity) during o...
<p>To add a marker to the map you can use this snippet:</p> <pre><code>mapboxMap.addMarker(new MarkerViewOptions() .position(new LatLng(&lt;position of player&gt;))); </code></pre> <p>If the listview and map are in separate activities, you can pass the selected player information to the map activi...
How to configure webpack for Angular2 tests? <p>How to configure webpack for Angular2 tests ?</p> <p>I have set up webpack based configuration for testing Angular2 npm package. Anyway i keep getting errors like:</p> <blockquote> <p>Error: This test module uses the component PaginationComponent which is using a "tem...
<p>The problem was with TypeScript configuration.</p> <p><code>tsconfig.json</code>:</p> <pre><code>{ "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments"...
How to use async await as module method <p>This is a route I write, using Express</p> <pre><code>const express=require('express'); const router=express.Router(); const trackRepo=require('../model/track'); router.post('/live',function(req,res){ const time=1439832167; const list=trackRepo.getAlerts(time); ...
<p>You're getting the exception because of the syntax error <code>async(function(){ await … })</code>, which calls a function named <code>async</code> with a function expression as the argument, a function expression that uses the <code>await</code> keyword despite being tagged as <code>async</code>.</p> <p>It shoul...
Dynamic CRM - Identifying whether a Contact has been merged in a PreContactUpdate plugin <p>I've got a plugin that fires when a contact gets updated. This also gets fired when two contacts get merged. What's the easiest way to identify whether contacts have been merged within the PreContactUpdate plugin?</p> <p>code:<...
<p>Try following:</p> <pre><code>if (localContext.PluginExecutionContext.ParentContext != null &amp;&amp; localContext.PluginExecutionContext.ParentContext.MessageName == "Merge") { //When records are merged } else { //All other cases } </code></pre>
How switch localization for all Content Items and localizable strings in Orchard Cms <p>I want create <a href="http://i.stack.imgur.com/SdQa0.png" rel="nofollow">switching links</a> between cultures for changing culture of all content items and all localizable strings. How I can implement this for Orchard 1.10?</p>
<p>There is a tutorial video on youtube, have a look:</p> <p><a href="https://www.youtube.com/watch?v=t6Tt8vjlOVw" rel="nofollow">https://www.youtube.com/watch?v=t6Tt8vjlOVw</a></p> <p>Basically you need the following modules</p> <ol> <li>culture picker (to provide a culture picker)</li> <li>localization (to localiz...
Pass Parameter on Linq Query <p>Is it possible to pass the parameter after the period on a LINQ Query?</p> <p>For example on this code:</p> <pre><code>objResultFinal = objResultFinal.OrderByDescending(x =&gt; x.[iwanttopassparameterhere]).ToList(); </code></pre> <p>Is that possible? I want to declare after the "x." ...
<p>Maybe this can be done using dynamic LINQ as below - </p> <pre><code>objResultFinal.OrderBy(passYourParameterHere).ToList(); </code></pre>
Hide / show the part of code using php, if the value contains the letters <p>I have a problem with this scenario. There is a certain field (textarea) - $ COMMENTS. If the information in the $COMMENTS starts with a number (the first is a number and then any letter) - the script works fine (hide / show "some HTML and PHP...
<p>use <code>isset()</code> with <code>if()</code></p> <pre><code>&lt;?php $comments=$hm-&gt;Zb('rs:def:comments'); if (isset($comments)): ?&gt; &lt;div class="txt"&gt;&lt;?php echo $hm-&gt;Zb('rs:def:comments'); ?&gt;&lt;/div&gt; &lt;?php else : ?&gt; &lt;div class="sorry"&gt;Sorry, there is no comments&lt;/div&gt...
enable submit button when FromDate and ToDate are Selected <p>I want to enable submit button when FromDate and ToDate are Selected.</p> <p>In my Case all Form is fill-up for enable submit button.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-...
<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>$('#myform &gt; input').on('input', function () { var empty = false; $('form &gt; input[type=date], form &gt; se...
Run a PROC FREQ on var in dataset 1 computing correlations on a variable in dataset 2 <p>I'm sorry if I'm asking a stupid question, I have some experience in R and am just starting to learn SAS. In enterprise guide I'm trying to compute a correlation matrix (cramv only) for categorical variables. The problem is that ex...
<p>SAS procedures only operate against a single dataset or view. If you didn't want to create another dataset then you could create a view that appends the objvar column to dataset one.</p> <p>Creating a view can be done with either <code>proc sql; create view x as...</code> or in a data step, <code>data x / view=x.....
Sidekiq server is not processing scheduled jobs when started using systemd <p>I have a cuba application which I want to use sidekiq with.</p> <p>This is how I setup the config.ru:</p> <pre><code>require './app' require 'sidekiq' require 'sidekiq/web' environment = ENV['RACK_ENV'] || "development" config_vars = YAML....
<p>After you run <code>systemctl enable sidekiq</code> so that it starts at boot and <code>systemctl start sidekiq</code> so that it starts immediately, then you should have some logs to review which will provide some detail about any failure to start:</p> <pre><code> sudo journalctl -u sidekiq </code></pre> <p>Revie...
Error UIViewController has no member <p>Currently working on my app, to learn swift (Im completely new). And I came across an error that I just cant seem to resolve. I have two views in my storyboard with two viewcontrollers hence ViewController &amp; Settings. </p> <p>On the "Settings" view I have a <code>textfield<...
<p>To get the destination <code>viewController</code> in Swift 3 it is just <code>segue.destination</code> not <code>segue.destination.ViewController</code>.</p> <pre><code>var secondVC = segue.destination as! ViewController </code></pre> <p>For second error you have declare <code>UILabel</code> with name <code>city<...
spring boot without tomcat in a standalone jar <p>I have a project structure with three jar files. All are loaded into one classpath and then get executed. I am using the spring core, jpa and hibernate. <code>@Services</code>/<code>@Autowired</code> are working fine, as well as Entities and Repositories (all on a mysql...
<p>If you want to receive messages over HTTP(ie run a REST API) then you need a web server.<br> If you just want to send messages over HTTP then you only need a HTTP client. </p> <p>Spring-boot has the the option of running an embedded web server(tomcat by default), you don't need to run a separate application server...
Loop through DV range and send to printer <p>I have some code that loops through a Data validation list and prints the page as a PDF file, I cant figure out how to tweak it to just send the page to the printer instead of printing as a PDF.</p> <pre><code>Sub Button11_Click() Application.ScreenUpdating = False Dim ce...
<pre><code>Sub Button11_Click() Application.ScreenUpdating = False Dim cell As Range Dim rgDV As Range Dim DV_Cell As Range Dim ws As Worksheet Dim strPath As String Dim myFile As Variant Dim strFile As String Dim LA As Boolean Dim A As Integer Dim B As Integer Set DV_Cell = Range("B1") Set rgDV = Application.Rang...
Spring @Autowired on a class with the same name as the current class <p>Say I have the below class in a Spring boot application:</p> <pre><code>@Configuration public class Environment { @Autowired org.springframework.core.env.Environment environment; } </code></pre> <p>When running this I get:</p> <pre><code...
<p>You should give your configuration a name:</p> <pre><code>@Configuration(value = "myEnviroment") public class Environment {} </code></pre> <p>From the <code>@Configuration</code> docs, regarding <code>value</code>: </p> <blockquote> <p>Explicitly specify the name of the Spring bean definition associated ...
What Machine Learning operation I should use? <p>I am starting with ML and i am trying to predict if an area has a lot of people or not. To do that I have several data (Detected devices in a WLAN) but each data by it self it doesn't mean anything and I need to analyze a big part of the set to know the state of the zone...
<p>It sounds like you have a bunch of data that has a given correct value, right? Classification is for grouped results. It would help if you demonstrated your dataset structure. Either way, it seems you are doing supervised learning and need to use a rather basic regression algorithm. </p> <p>There are may things you...
WP 8.1 Push notifications - Invalid Client Secret <p>I'm following this guide (msdn.microsoft.com/library/windows/apps/hh465407) to implement push notifications on my app, but it seems to be outdated since I can't find the client secret as shown in this image (<a href="https://msdn.microsoft.com/dynimg/IC737349.png" re...
<p>You must login into the microsoft dev dashboard, create a new app (you don't have to load a .xap file, you just need to put in a name and all those stuffs...)</p> <p>After that, click on the app you just created: on the left, select "services" from the menu and then click on the "push notification" link.</p> <p>Fi...
I need to create a list containing all the sums of a list taken three at a time, ie, add first 3 elements then the next 3 <p>I need to add the first three elements of a list then add the next three elements of a list and so forth. This is the code I have got so far:</p> <pre><code>def get_triple_sums_list(a_list): ...
<p>Let's analyze your code!</p> <pre><code>def get_triple_sums_list(a_list): new_list = [] for numbers in range(0,len(a_list)): numbers = sum(a_list[:3]) #You should be using the variable #numbers here somehow. #^^^^^^^ - You are overwriting the for-loop index. ...
How to determine if a directory is a valid git directory without requiring git? <p>There are a lot of questions in stackoverflow that ask about how to determine if a directory is under git control. And the answer is using <code>git</code> command by calling command via child process.</p> <p>What I want to know is how ...
<p>It's quite hard to be exhausive.</p> <p>If you want to know if the current directory is a <code>.git</code> directory or something completly different, just check for the main folders existence (info, objects, refs).</p> <p>If you to know if git will know how to work with it, meaning it's not just zeroed files, th...
How to set/Reset the previously selected multi Select option in JavaScript/jQuery <p>In my application, User selects different teams &amp; based on teams, he selects some players. Now user is updating his team choice. Since he has selected "Royal Challengers" team &amp; some players . he is not allowed to do so, once h...
<p>this solves my issue - </p> <pre><code>for(var i=0;i&lt;selected.length;i++){ if(selected[i]!=''){ $('option:contains('+selected[i]+')').prop('selected', false); } } for(var i=0;i&lt;prevSelected.length;i++){ if(prevSelected[i]!=''){ $('option:contains('+prevSelected[i]+')').prop('selec...
C# Excel interop merge not working <p>I have defined a range with:</p> <pre><code>Range range = ws.Range[ws.Cells[7, 1], ws.Cells[7, 4]]; </code></pre> <p>and checked with </p> <pre><code>range.Interior.Color = rgbBlueViolet; </code></pre> <p>So the range is correct since I see it coloured.</p> <p>But when I do</...
<p>Ok the problem was that a range to be merged has to be selected first. And to do that the worksheet can't be minimized. Thus the code is:</p> <pre><code>Application app = new Application(); app.Visible = false; app.WindowState = XlWindowState.xlNormal; &lt;---not minimized ... Range r = ws.Range[ws.Cells[row + 7...
SQL Query: Count, Group by date and year multiple columns <p>I've got a Table Like following:</p> <pre><code>Date | Type | 2016/04/01 A 2016/04/01 B 2016/04/02 B 2016/05/07 A ... ... </code></pre> <p>I try to make a query that count each Type occurence grouped by month/year:</p> <pre><cod...
<p>So you could do something like that, using a PIVOT on GROUPED by Year / Month datas.</p> <p>Of course, you'll have to add the n desired datas for your columns, in the PIVOT and the main select</p> <pre><code>select year, month, coalesce(A, 0) as A, coalesce(B, 0) as B from (select [Ty...
How to paste image in PHP and then upload it to server? <p>I have to make a form to upload file and image and file should be copy and pasted through print screen and upload it to server.</p>
<p>You can't. This procedure is system from the computer. The only way is after 'printscreen' button, save the file and upload it to the server throw upload form.</p>
Azure Blob Storage Object reference not set to an instance of an object <pre><code> public class StorageService { CloudStorageAccount storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=leepiostorage;AccountKey=removed for this post"); public async Task Upload(st...
<p>The problem was the service was not initialized in the BlogController.</p> <p>Simply adding a </p> <pre><code>public BlogController() { service = new StorageService(); } </code></pre> <p>fixed my problem</p>
Changing a ChartType from Polar to Radar <p>I asked in a <a href="http://stackoverflow.com/questions/38940752/set-a-c-sharp-polar-diagram-to-a-specific-amout-of-rings-and-segments">previous question</a> how to set a specific number of rings and sectors for a polar diagram . I now have a button which changes the chart f...
<p><code>Polar</code> and <code>Radar</code> charts look rather similar, but they really are <strong>quite different</strong>.</p> <p>As you saw, in a <code>Polar</code> chart you can influence the number of segments by setting the relevant X-Axis properties.</p> <p>Most important are the <code>Maximum</code> and the...
Ruby - reading CSV from STDIN <p>I'm trying to read from .CSV file and create objects with attributes of every row. My code works fine:</p> <pre><code>def self.load_csv puts "Name of a file?" filename = STDIN.gets.chomp rows = [] text = File.read(filename).gsub(/\\"/,'""') CSV.parse(text, headers: ...
<p>This code is working:</p> <pre><code>require 'csv' class Call def initialize(args) end end def load_csv(filename) rows = [] text = File.read(filename).gsub(/\\"/,'""') CSV.parse(text, headers: true, header_converters: :symbol) do |row| row = row.to_h row = row.each_with_object({}){ |(k,v), h| h[...
Using elixir applications for programs that run only once <p>When starting an application the return value needs to be a pid or an error.</p> <p>Is it possible to use applications for programs that are meant to only run through there processing once. Something like.</p> <pre><code>defmodule MyApp do use Application...
<p>You're overcomplicating things @Peter. What you want is an Elixir script (exs file). Start with this example:</p> <pre><code>defmodule MyApp do def my_test_func do IO.puts "Hello world!" end end MyApp.my_test_func </code></pre> <p>Save that code as <code>test1.exs</code>. Then you can run it from the c...
View JSON in Browser with PHP <p>I have a text file (called : data.txt) content below :</p> <p><strong>My data.txt:</strong></p> <pre><code>["1","Ricky","23"],["2","Roy","24"],["3","Ryta","25"] </code></pre> <p>I want to view this data in browser with PHP, look like this:</p> <p><a href="http://i.stack.imgur.com/uP...
<p>You need to correct your json:<br> Use this:</p> <pre><code>[["1","Ricky","23"],["2","Roy","24"],["3","Ryta","25"]] </code></pre>
loop over all files in folder in R <p>I would like to import all files from a folder, convert the files and then export them with the same name, but with a different extension. In my specific case I want to convert 150 nexus files (.nex) to fasta files (.fasta)</p> <p>This is how the code looks if I do it one by one:<...
<p>You need to 1) include the value of <code>i</code> inside the character string giving the fasta filename, 2) not rewrite <code>i</code> when you're loading your nexus file.</p> <pre><code>library(ape) filenames = dir(pattern="*.nex") for (i in filenames){ dat &lt;- read.nexus.data(i) write.dna(dat, file = s...
Iterating through nested collections to find first sub-sub-sub element matching a criterion <p>I have an object with a List of other objects, each other object has a List etc. I need to find in the hierarchy the first (and unique) last element in the hierarchy that has a property matching some value. Seeing my present ...
<p>You could try flatMap like this:</p> <pre><code>Optional&lt;Postes&gt; first = millesime.getDivisions() .stream() .flatMap(m -&gt; m.getGroupes().stream()) .flatMap(m -&gt; m.getClasses().stream()) .flatMap(m -&gt; m.getSousClasses().stream()) ...
foreach loop for update multiple mysql values <p>mysql results getting failed to update values. please check the codes bellow and also the attached picture. i need to update all tables value on single submission. how can i do that? </p> <pre><code>&lt;?php if (isset($_POST['submit_update'])) { $product_id...
<p>change</p> <pre><code>"UPDATE products SET product_name='$p_name_value', WHERE product_id='$id' </code></pre> <p>to </p> <pre><code>"UPDATE products SET product_name='$p_name_value' WHERE product_id='$id' </code></pre> <p>remove <code>,</code> after setting the value. Moreover, kindly read about SQL injection, p...
Fieldset child with height 100% is too big <p>I am trying to stretch a <code>fieldset</code> child to 100%, but the child (<code>ul</code>) is too big and some overflow appears (is cut in my case). </p> <p>How can I stretch the <code>fieldset</code> child to 100%, but without overflow?</p> <p><div class="snippet" da...
<p>Use <strong>Auto Height</strong> for your <code>fields</code> and add <strong>Height, Line-height</strong> for your <code>li</code>.</p> <p>Its work clear and nicely.</p> <p><strong>EDIT:</strong> And of course you need to remove the <strong>Overflow: hidden;</strong> property;</p> <p><div class="snippet" data-l...
Delete lines containing specific character in text file <p>How to delete lines containing a specific character in a text file with PowerShell?</p> <p>Input file example:</p> <pre>12314+000000 00000000 20 300 1238238948023 A+A+000000 00000000 20 500 1238238948023</pre> <p>Output file example:</p> <pre>20 300 1238238...
<p>The simplest way is to use new file to write data in it:</p> <pre><code>Get-Content "D:\test.txt" | Where-Object {$_ -notmatch '\+'} | Set-Content "D:\out.txt" </code></pre> <p>That will give:</p> <pre><code>20 300 1238238948023 20 500 1238238948023 </code></pre> <p>In <code>out.txt</code>.</p> <p>This is used ...
Trying to Post a dictionary to my backend <p>I'm trying to Post a Dictionairy to my backend using Alamofire: </p> <p>This is my code: </p> <pre><code>func postCheckUserPhonenumbers(phonenumbers:[String], completionHandler: (([AnyObject?], AnyObject?) -&gt; Void)) { let urlString = Constant.apiUrl().stringByAppend...
<p>As the error message states, <code>phonenumbers.map({["number": $0]})</code>returns an array of type <code>[[String:String]]</code>, as you can see on the image I attached. <a href="http://i.stack.imgur.com/I2wMK.png" rel="nofollow"><img src="http://i.stack.imgur.com/I2wMK.png" alt="Playground"></a></p> <p>Alamorfi...
jQuery - Navbar hover did not show <p>I'm building simple web template from scratch. I use old style jquery to make a hover on navbar to show list <code>&lt;li&gt;</code>, but it is working only on <em>About us</em> column and isn't working on <em>Product</em> column.</p> <p>What is wrong? How should I do it?</p> <p>...
<p>Fixed your <code>&lt;/li&gt;</code> tags in the code below and also replaced <code>$("ol",this)</code> with <code>$(this).find("ol")</code>. Seems to work: <a href="http://codepen.io/8odoros/pen/wzALyq" rel="nofollow">http://codepen.io/8odoros/pen/wzALyq</a></p> <pre><code>&lt;li&gt;&lt;a href="#"&gt;About us&lt;/...