input
stringlengths
51
42.3k
output
stringlengths
18
55k
CSV separated by ';' have semicolons in some of their attributes and can't parse correctly <p>I've been downloading Tweets in the form of a <code>.csv</code> file with the following schema: <code> username;date;retweets;favorites;text;geo;mentions;hashtags;permalink </code></p> <p>The problem is that some tweets have ...
<p>Your CSV file is not properly formatted: the problem is not the separator occurring in character fields, it's rather the fact that the <code>"</code> are not escaped.</p> <p>The best thing to do would be to generate a new file with a proper format (typically: using <a href="https://tools.ietf.org/html/rfc4180" rel=...
Calculate the maximum number of consecutive elements without repetitions in a vector. c++ <p>Hi guys i've to calculate the longest sequence of numbers without any repetitions and return the size of the sub-segment.</p> <p>The point is that im missing something at some point but I don't know where.</p> <pre><code>int ...
<p>The problem is with</p> <pre><code> else { a.erase(var); a[var] = i; } </code></pre> <p>You need to do more here. Try the sequence <code>1 3 4 2 3 4 2 8 9 10 11</code>.</p>
How you organize workflow in Jira in game development projects? <p>How to setup workflow in Jira for a game development project.</p> <p>Following are the tasks in my Project</p> <ol> <li>3D modelling</li> <li>Screenplay writing</li> <li>Animation</li> <li>Sound creating </li> <li>Coloring paper creating</li> <li>scen...
<p>My gut feeling is: you do not need any special workflow.</p> <p>I would model items 1-6 as Tasks of a User Story/Backlog Item or as Sub-Tasks of a Task: when all are completed the parent is complete also.</p>
Haskell split string on last occurence <p>Is there any way I can split String in Haskell on the last occurrence of given character into 2 lists? For example I want to split list "a b c d e" on space into ("a b c d", "e"). Thank you for answers.</p>
<p>I'm not sure why the solutions suggested are so complicated. Only <strong><s>one</s> two traversals</strong> are needed:</p> <pre><code>splitLast :: Eq a =&gt; a -&gt; [a] -&gt; Either [a] ([a],[a]) splitLast c' = foldr go (Left []) where go c (Right (f,b)) = Right (c:f,b) go c (Left s) | c' ==...
Navbar Coding using Bootstrap 3/Responsive Design <p>Hello I have been given two examples when for coding a navbar in bootstrap3. I am not sure what the difference is I know example 1 is fixed and responsive but ex 1 is in a <code>&lt;div&gt;</code> and ex 2 is set in a header. Confusing as they both work, but which is...
<p>The difference is quite clear. Second snippet of code belongs to a simple Navbar using bootstrap. Whereas the first one is the fixed Navbar that you'd mostly seen on top of websites. It includes dummy navigational data in the form of list items. </p> <p>You can use online editors like <a href="https://jsfiddle.net/...
Differences between UINavigationController's Left Edge Swipe and Back Button behaviour <p>I'm trying to figure out the difference between a navigation controller's left edge swipe and back button behavior. I have a bug that only occurs when the you navigate back through a left edge swipe. If you press the back button i...
<p>Does this bug manifest itself all the time, or does it manifest itself if and only if you start a left edge swipe and cancel it? The reason I ask is that we used to write code that assumed that <code>viewWillAppear</code> of the prior VC and <code>viewWillDisappear</code> of the current one would always precede <cod...
How to validate array(matrix) format? <p>I am making page for array multiplication, and I need to validate array format before action. Textbox should accept only arrays in this format: <code>[[1,2,3],[4,5,6],[7,8,9]]</code> - the matrix array of row arrays.</p> <p>I tried with regex, but I really can't do it. Is there...
<p>try the regex given below</p> <pre><code>^ +\[ ([\[[ +\d+ +,]+ +] +,)+ +\[[ +\d+ ,]+ +] +]$ </code></pre> <p>all in one final solution...</p> <p>can manage spaces...</p>
Can I build a docker image from an existing database container? <p>I am new to docker. I am using docker compose to manage containers. </p> <p>My goal is to have a database container persists or not persist data, which can be pulled by other developers without many manual steps (pg_dump and pg_store etc) to run their ...
<p>In docker you can save data in two places basically:</p> <ol> <li>Inside the container (default)</li> <li>A volume</li> </ol> <p>The database containers are configured to save data in volumes, because in this way the data can survive a container deletion. Also it is faster. When you create an image from a containe...
How to run a react app on tomcat <p>I'm trying to run the following example: <a href="https://github.com/ceolter/ag-grid-react-example" rel="nofollow">https://github.com/ceolter/ag-grid-react-example</a></p> <p>(ag-grid react example)</p> <p>But, instead of doing <code>npm run</code> I want to run it on tomcat. How t...
<p>Even though I did not do this with Tomcat I deployed it with IIS. So you can adapt the method to Tomcat.</p> <ol> <li>I created an Empty MVC application with a Default Controller and a Default view to get all the MVC magic that Microsoft provides.</li> <li>I built the React + Redux application with webpack and sent...
Using 'if' and 'for' to distinguish between numbers <p>There is a list called "G" and i am trying to replace any numbers above 5 with smile ":)" symbol and any number below 5 with ":(". i wrote this code, and expecting to only have five smiles however, the result is totally different and smile appears for all numbers. ...
<p>The following points will help with the question and understanding of R for the future. </p> <ol> <li>Lists vs. Vectors</li> <li>For loops vs. Vectorization</li> <li><code>print</code> with assignment</li> </ol> <p><strong>Lists</strong></p> <p>In R, the <code>list</code> object is a special object that can hold ...
CSS: Normalizing transparency for overlapping, blended divs <p>Suppose I have divs that represent a person's available times. Different persons' availabilities may overlap. I want to represent this with overlapping colored divs where overlapping regions will sum sensibly, in that regions representing the overlap of ALL...
<p>you could maybe use absolute positioning and opacity together? so give each div the same opacity and place one div over the other to effectively sum the backgrounds. </p> <pre><code>.container { position: relative; height: 200px; } .box { height: 100px; width: 100px; background: #000099; border: 1p...
Concatenating multiple lines of a text file together in perl <p>I'm working with some sizable data files - 90012 lines each. Each file contains weather data from 7,501 weather stations for each day of the year. There are 12 lines for each weather station, one for each month. A sample of the data is below (truncated ...
<pre><code>perl -ape 'chomp if $. % 12; $G &amp;&amp; s/^$G//; $G=$F[0]' file </code></pre> <p>Deletes newlines except for every 12th newline. Deletes the first field if it is the same as the first field on the previous line.</p> <hr> <p>Earlier suggestion:</p> <pre><code>perl -pe 'chomp if $. % 12' file </code></p...
Query sub collection - majority mutual ids that contains in list <p>Consider the following list:</p> <pre><code>List&lt;long&gt; listOfIDs = new List&lt;long&gt; { 1, 2, 3, 4 }; </code></pre> <blockquote> <p>[(Product) 1 Pineapple - (Supplier) Fruit Inc / Marketplace Inc]> </p> <p>[2 Strawberry - Fruit Inc]> <...
<p>I think I finally got what's the issue.</p> <p>So you have a two entities with <code>many-to-many</code> relationship like this:</p> <pre><code>public class Product { public long Id { get; set; } public string Name { get; set; } public ICollection&lt;Supplier&gt; Suppliers { get; set; } } public class...
Ordering an ArrayList with duplicate Strings <p>Well i have an ArrayList with some strings in it and i want to get the number of duplicates that each string has and order them from the highest number to the lowest like this : </p> <pre><code>ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("a...
<p>To map a string to an int (letter to frequency) you can use a Map object:</p> <pre><code>ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;(); list.add("a"); list.add("b"); list.add("c"); list.add("d"); list.add("b"); list.add("c"); list.add("a"); list.add("a"); list.add("a"); Collections.sort(list); Map&lt...
Use dub to output C++ linkable static library <p>I want to statically link my D library (which uses dub) with my C++ app.</p> <p>I've followed <a href="http://wiki.dlang.org/Building_a_mixed_C%2B%2B_and_D_project" rel="nofollow">the instructions on the wiki</a> to successfully manually link the example.</p> <p>But, I...
<p>After some trouble I figured it out.</p> <p>It turns out, <code>-m32mscoff</code> is important, and it's required for 32-bit. Compiling and linking for 64-bit works fine as-is.</p> <p>Add into <code>dub.json</code>:</p> <pre><code>"dflags-windows-x86-dmd": [ "-m32mscoff" ] </code></pre> <p>Even though <code>...
How can I Replace using the sql wildcard '%'? <p>So this is the data I am pulling in from powershell (there's actually more, but it all follows the same pattern):</p> <pre><code>Name : SULESRKMA 1 Location : Leisure Services - Technology Services 2 DriverName : KONICA MINOL...
<p>you can try </p> <pre><code>SELECT * FROM #ReadCmd WHERE Result LIKE '%:%' and Result like 'Name %'; </code></pre> <p>if you want select only the info after the : then you should use </p> <pre><code>SUBSTRING(Result, CHARINDEX(':',Result) +2, 255) from #ReadCmd WHERE Result LIKE '%:%' and Result like 'Name %'; ...
Extending the page in Django <p>Hi everyone I create my first page extension in Django-cms I save the info buy I can obtain it again</p> <p>my model is like this</p> <pre><code>class PageDescriptionExtension(PageExtension): description_page = models.TextField('description', default = None, help_text =...
<p>To show the page extension in the menus (for example, to enable page icons shown in the menu), you first need to add the icon information to the <a href="http://docs.django-cms.org/en/release-3.3.x/how_to/menus.html" rel="nofollow">navigation node</a>. In the snippet below, I am adding ability to fetch <code>pagemen...
How create a Func<T, bool> when the T is unknown <p>I have an object that his instance is created on runtime like this:</p> <pre><code>var type = GetTypeFromAssembly(typeName, fullNameSpaceType); var instanceOfMyType = Activator.CreateInstance(type); ReadObject(instanceOfMyType.GetType().GetProperties(...
<p>You pass an <code>object</code> to your <code>Func&lt;&gt;</code>, but access the <code>Id</code> property defined on other type.</p> <p>The easiest fix is to cast the <code>object</code> to a type <code>T</code> and then access its properties, like you would do in C# <code>((T)obj).Id</code>:</p> <pre><code>var p...
How to use first/head and rest/tail with Swift? <p>In order to use Swift in a functional style, how should we be dealing with <code>head</code> and <code>tail</code>s of lists? Are <code>Array</code>s and <code>ArraySlice</code>s appropriate (seems like it since an <code>ArraySlice</code> is an efficient mechanism to g...
<p><a href="https://developer.apple.com/reference/swift/array" rel="nofollow"><code>Array</code></a> has an initializer (<a href="https://developer.apple.com/reference/swift/array/1538750-init" rel="nofollow"><code>init(_:)</code></a>) that can produce an <code>Array</code> from any <a href="https://developer.apple.com...
java multi-thread acquire lock not working <p>I'm trying to write a small snippet of code to lock and unlock a block of code. the acquire_lock and release_lock functions are as below:</p> <pre><code> public static void acquire_lock(long timestamp) { synchronized(operations) { // put the timestamp into q...
<p>It is very tricky here. The anomalous happens because the latter thread enter the acquire_lock first. And when the earlier thread goes into the acquire_lock, it will not be blocked, because the code block the threads based on their timestamp. So the two thread go to the same <em>protected</em> code area. </p>
Python expected an indented block on sublime text 3 <p>This is an example excerpt from a bigger code, I have no idea why is this not properly idented</p> <p>Code example :</p> <pre><code>if True: for i in range(1, 10): print(i) print("Inside the if") print("But outside the loop") </code></pre> <p...
<p>It is improperly indented because you're mixing tabs and spaces. Don't do that. Python doesn't like it when you do that. Every time you do that, a puppy cries</p>
Python Watchdog Measure Time Events <p>I'm trying to implement a module called <a href="https://github.com/gorakhargosh/watchdog" rel="nofollow">Watchdog</a> into a project. I'm looking for a way I can measure time between event calls within Watchdog.</p> <pre><code>if timebetweenevents == 5 seconds: dothething() ...
<p>You can modify your Handler class to have a record of the time of the last call.</p> <p><strong>init</strong> method just initialises the value to the current time. You will also need to make the method on_any_event a non static method</p> <pre><code>class Handler(FileSystemEventHandler): event_time=0 def...
remove formula links in excel using c# <p>I am copying worksheet from book1 to book2. The worksheet contains cells with formulas. On worksheet 'sheet1' in book2 the cell contains a link back to <code>book1.sheet1 ='Y:\temp\\[book1.xls]sheet1'!A1</code></p> <p>My question is how to I strip out the <code>Y:\temp\\[bo...
<p>Try a verbatim string:</p> <pre><code>@"'Y:\temp\[book1.xls]sheet1'" </code></pre> <p>instead of</p> <pre><code>"'Y:\temp\[book1.xls]sheet1'" </code></pre> <p>In a verbatim string, all those special characters are interpreted literally.</p>
Open New Tab with Results from JavaScript function <p>This doesn't work:</p> <pre><code>&lt;a href='javascript:void(0)' target='_blank' onclick='do_stuff()' &gt;Open&lt;/a&gt; </code></pre> <p>And neither does this</p> <pre><code>&lt;a href='javascript:void(0)' target='_blank'onclick='window.open(do_stuff(), "_blank...
<p>Open new window (tab) and save it to a variable, then change it's content to your function output:</p> <pre><code>&lt;button onclick="clicked()"&gt;Test&lt;/button&gt; &lt;script&gt; var clicked = function () { var new_page = window.open(); new_page.document.write("output"); } &lt;/script&gt; </code></pre> ...
constexpr and function body = delete: what's the purpose? <p>According to the <a href="http://eel.is/c++draft/dcl.constexpr#3" rel="nofollow">[dcl.constexpr/3]</a>:</p> <blockquote> <p>The definition of a constexpr function shall satisfy the following requirements:<br> [...]<br> - its function-body shall beÂ...
<p>This was based on <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1199" rel="nofollow">CWG 1199</a>. Daniel Krügler wrote:</p> <blockquote> <p>it could be useful to allow this form in a case where a single piece of code is used in multiple configurations, in some of which the function is <c...
Create a list of object usable in more activity <p>I want to create a list of object that is accessible by more activity. I thought to create a class with the list of object (not array). I used this...</p> <pre><code>public class List{ Object object1 = new Object("this", 59, true) ... } </code></pre> <p>An...
<p>you can store your data in settings like this: settingsservice:</p> <pre><code>public class SettingsService { private static String KEY = Constants.SETTINGS_KEY; private static Context mContext; public static SettingsModel settings; public SettingsService(){ mContext = YourApplicationClass...
Unable to install sami on laravel 5.2.3 for api documentation <p>I am trying to write documentation for a laravel 5.2.3 project and I intend to use Sami to acheive this. </p> <p>I followed the the git hub link <a href="https://github.com/FriendsOfPHP/Sami" rel="nofollow">https://github.com/FriendsOfPHP/Sami</a> and I ...
<p>Seems that the latest official release v3.3 doesnt support symfony3 components which are used by laravel 5.3.<br> You can try to install the dev-master branch which supports symfony3.</p> <pre><code>composer require sami/sami dev-master </code></pre> <p>The dev-master branch is under development so it might have s...
log4j2 with 3rd party appenders <p>I'm trying to set up some third party appenders in a java app (which is a web API) - the appenders are libraries which are added as dependencies. This is a maven app, and those libraries are Raven (via Sentry) and Logentries. They accept logs and provide GUIs to view them.</p> <p>Th...
<p>Try <code>&lt;Configuration packages="com.getsentry.raven.log4j2"&gt;</code> somewhere near the top of your log4j2.xml</p> <p>(posting this for completeness, though Brett answered this in the comments)</p>
On double click get the id <p>If I have many divs around page all with different ids and some with same classes. How can I say on double click anywhere on the page I need to get id or class or anything from element where I double clicked?</p> <p>Like when I Say:</p> <pre><code>$('div').dblclick(function(){ var x = $...
<p>You can get the event target, which is the element that the event was triggered on, and then get the closest DIV to that</p> <pre><code>$('body').dblclick(function(e){ var x = $(e.target).closest('div').attr('id'); }); </code></pre> <p><a href="https://jsfiddle.net/adeneo/goawwtau/" rel="nofollow"><strong>FIDD...
Avoid Sitecore Lucene/Solr Indexing of System Folder <p>I just setup my Solr search functionality in Sitecore and it indexed the site. I can do a search and I get back results. Unfortunately, it indexed TOO much, and is returning system specific things such as templates and analytics nodes in teh content tree. I type i...
<p>You can create a custom index and restrict it to just the content you want in that index by setting the <code>root</code> node:</p> <pre class="lang-xml prettyprint-override"><code>&lt;contentSearch&gt; &lt;configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch"&gt; &lt;...
xsl code does not return all cities <p>The xsl code is just returning one city for each country. Any idea why? Because I was expecting get all the cities for each country. </p> <p>You can see the code and the result that Im getting:</p> <p><strong>RESULT</strong></p> <pre><code>&lt;html&gt; &lt;ul&gt; &lt;l...
<p>In XSLT 1.0, the <code>xsl:value-of</code> instruction returns the string-value of the <strong>first</strong> node in the selected node-set. To get all the values, you need to use (another) <code>xsl:for-each</code>, for example:</p> <pre><code>&lt;html xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xsl:version="...
zsh alias not recognizing : command not found <p>Hellor everybody, i wanted to add an alias in my .zshrc file but please have a look at this i really don't understand </p> <pre><code>[23:29:36] charvet:~ $ expressvpn NAME: expressvpn - ExpressVPN command line interface USAGE: expressvpn command [arguments.....
<p>Try <code>alias vpn=expressvpn</code>?</p> <p>Try <code>help alias</code> for help with alias syntax.</p>
Why is the absolute positioned DIV not inheriting the width of parent? <p>Why is the absolute positioned DIV not inheriting the width of its parent? Div has </p> <pre><code>div { position: absolute; top:100px; } &lt;html&gt; &lt;body&gt; &lt;div&gt;This DIV&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>...
<p>Read @DaniP docs link for the answer.</p> <p>Add style width : inherit for inheriting the width of its parent</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>#divParen...
Render Chinese characters from encoded CSV <p>I have a CSV file whose fields contain encoding for chinese characters:</p> <pre><code>example cell value: \u53ef\u7231\u7684\u7cd6\u679c\u5c0f\u5e97 </code></pre> <p>How can I save this file (as .xlsx or xls) to properly render the characters?</p>
<p>First I input the data into cell <strong>A1</strong><br>Then use <em>Text-to-Columns</em> to split the data into <strong>B1</strong> through <strong>H1</strong>.</p> <p>Then in <strong>B2</strong> enter the formula:</p> <pre><code>=chrr(MID(B1,2,9999)) </code></pre> <p>and copy across.</p> <p>This uses this VBA ...
Android Marquee Wait duration <p>How to make a Marquee TextView wait for a specific time until it starts to scroll horizontally? Because when I open an Activity it starts straight to scroll. So you have to wait until its back on startposition to read it.</p>
<p>in the xml i simply added textView like this</p> <pre><code>&lt;TextView android:id="@+id/textView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Hello World!, Hello World!, Hello World!, Hello World!, Hello World!, Hello World!, Hello World!, Hello World!" ...
If I add a WHERE 0 = 1 clause, does SQL Server know how to optimize? <p>If I have a query like</p> <pre><code>SELECT * FROM vwComputationallyComplexQueryThatTakesALongTimeToRun WHERE 0 = 1 </code></pre> <p>is SQL Server smart enough to see the <code>WHERE 0 = 1</code> and not actually execute the query in the view <c...
<p>YES, The SQL Server smart enough to see the WHERE 0 = 1 and not actually execute the query in the view.</p> <p><strong><em>The Logical Processing Order of the SELECT statement</em></strong></p> <p>is as following:</p> <pre><code>FROM ON JOIN WHERE GROUP BY WITH CUBE or WITH ROLLUP HAVING SELECT DISTINCT ...
Swift: error: use of undeclared type 'T' <p>Swift 3.0 and getting this error, unsure why:</p> <p>Code:</p> <pre><code>func rest(_ list: ArraySlice&lt;T&gt;) -&gt; ArraySlice&lt;T&gt; { return list.dropFirst() } </code></pre> <p>Error:</p> <pre><code>error: repl.swift:1:48: error: use of undeclared type 'T' func...
<p>You need to specify the generic parameter of <code>ArraySlice</code>, just using as <code>ArraySlice&lt;T&gt;</code> does not declare <code>T</code>:</p> <pre><code>func rest&lt;T&gt;(_ list: ArraySlice&lt;T&gt;) -&gt; ArraySlice&lt;T&gt; { return list.dropFirst() } </code></pre> <p>Or:</p> <pre><code>class M...
How to detect when a maximum number is rolled? <p>This question seems like it would be easily answered by just making an if statement for my maximum in the range, BUT please take a second to read before calling me an idiot. I am making a program that lets the user choose between many different dice. I am wondering if t...
<p>first change <code>inphandle</code></p> <pre><code>def inphandle(choice): return random.randint(1,choice) </code></pre> <p>and then change</p> <pre><code> while cont=="y" or cont=="Y": roll = inphandle(choice) dice(roll,choice) ... def dice(roll,max_val): if roll == max_val:prin...
applescript to move files in numeric order <p>i started a project for a friend, that involved moving large quantities of files into specific folders. i was using automator as I'm handling the project on my mac, however automator does not have a feature to move section of files that are numbered numerically. for instanc...
<p>I am not sure tu fully understand your naming convention, but overall , yes, with Applescript, you can move files into folders based on names, eventually adding sequence numbers.</p> <p>Because I am not sure about your requirements, at least, here are some sample of syntax for main operations :</p> <p>Get list of ...
how to wrap text while keeping border in CSS <p>so I've created a snippet of layout that I'd like to re-use in various places in my code. JSFiddle with what it looks like normally with the following dom structure: <a href="https://jsfiddle.net/64x9udcr/" rel="nofollow">https://jsfiddle.net/64x9udcr/</a></p> <pre><code...
<p>Used flex method with few little changes in your code. </p> <p><a href="https://jsfiddle.net/64x9udcr/2/" rel="nofollow">https://jsfiddle.net/64x9udcr/2/</a></p> <p><div class="snippet" data-lang="js" data-hide="true" data-console="true" data-babel="false"> <div class="snippet-code snippet-currently-hidden"> <pr...
Trouble with StringTokenizer using two lines of text <p>I have a program that is supposed to take a text file specified in the run arguments and print it one word at a time on separate lines. It is supposed to omit any special characters except for dashes (-) and apostrophes (').</p> <p>I have basically finished the p...
<p>You are only calling <code>readLine()</code> once! So you are only reading and parsing through the first line of the input file. The program then ends.</p> <p>What you want to do is throw that in a while loop and read every line of the file, until you reach the end, like so:</p> <pre><code>while((s = br.readLine()...
Suffix for ordinal indicator <p>Any suggestions for providing the suffix for the numbers?</p> <p>I'm working on providing the following output for my code:</p> <p>Example</p> <p>Enter an integer (1-46): 6 The 6th number in the Fibonacci sequence is: 8</p> <p>Below is what I have completed thus far:</p> <pre><code>...
<p>This is what I came up with:</p> <pre><code>public static void main(String[] args) { Scanner kbd = new Scanner(System.in); //Variable Declaration int number; long Fibnumber; Boolean accepted, limit; //Beginning of user input for the Fibonacci sequence System.out.print("Enter an in...
How to delete an object based on a specific property that is nil <p>I have three models, a parent, child, grandchild. I have been able to save and link the data correctly. Now I would like to be able to delete the child and grandchild objects, when I delete the parent.</p> <p>The parent has a property of the child a...
<p>There is no support for cascading deletes in Realm currently, so you have to manually remove child instances. You can use <code>LinkingObjects</code> to remove all children before deleting the parent or just query all child instances where <code>parent == nil</code> after parent is deleted and delete them. See more ...
PHP - Why is session still being created? <p>Good day, while doing my project, I did stuck on Login page.</p> <p>This might be really trivial question or maybe even duplicate, but I can't find any solution online.</p> <p>For some reason, my php script simply skips my login form and keeps making session and redirectin...
<p>Problem is in your logic not your code. $check_user is 0 or more there is no difference for your code. it always reach the <em>$_SESSION['email'] = $email</em>; line. Try this:</p> <pre><code>&lt;?php session_start(); include'functions/dbconfig.php'; if(isset($_POST['login'])) { require 'functions/connect.php'...
Golang SSL authentication <p>I have certificate.pem that I use to perform client authentication with a remote server. When I access the server, normally Chrome pops up, asks if I want to use that certificate, I say yes, then I'm authenticated. I'm trying to figure out why it's not sending the certificate with the diale...
<p>I usually do the following for using a client certificate with http.Client.</p> <pre><code>cert, err := tls.LoadX509KeyPair(`/path/ClientCert.pem`, `/path/Key.pem`) tlsconfig := &amp;tls.Config{ Certificates: []tls.Certificate{cert}, InsecureSkipVerify: true, } </code></pre> <p>I'm not sure ...
Powershell .Replace RegEx <p>RegEx for Replace is kicking my butt. I am trying find: </p> <blockquote> <p>value="COM8"/></p> </blockquote> <p>in a text file and replace "COM8" with another com port (ie "COM9", "COM13", etc).</p> <pre><code>(Get-Content 'C:\Path\File.config').Replace('/".*?"', '"COM99"') | Set-Con...
<p><code>Get-Content</code> produces a list of strings. <code>Replace()</code> is called on each string via <a href="https://blogs.msdn.microsoft.com/powershell/2012/06/13/new-v3-language-features/" rel="nofollow">member enumeration</a>. Meaning, you're calling the <a href="https://msdn.microsoft.com/en-us/library/fk49...
How to use mmap in c <p>I've search and I can't seem to find a way on how to use mmap. This is what I have..</p> <pre><code>char *pchFile; if ((pchFile = (char *) mmap (NULL, fileSize, PROT_READ, MAP_SHARED, fd, 0)) == (char *) -1){ fprintf(stderr, "Mmap Err: \n"); exit (1); } </code></pre> <p>So, how do I fr...
<p><code>pchFile</code> is just a plain old <code>char *</code> (with <code>fileSize</code> valid bytes accessible). So if you want a pointer to the data at an offset of 400 bytes, you can just use <code>&amp;pchFile[400]</code> or <code>pchFile + 400</code> for implicit or explicit pointer arithmetic.</p> <p>How you ...
java programming dead code <p>I just need someone to tell me why index++ is a dead code so I can try to fix it myself. </p> <p>heres my code for one class </p> <pre><code>public class ManagementCompany { private String name; private String taxID; private Property[] properties; private double mgmFeePer...
<p>You have a <code>return</code> in the loop. By unrolling the for you will see why it is dead code:</p> <pre><code>FOR INITIALIZATION: int index = 0; FOR PRE-LOOP CHECK: index &lt; properties.length FOR BODY EXECUTION: properties[index] = property; return (index + 1); FOR POST-LOOP UPDATE: inde...
Git pull before rebasing <p>So I <a href="http://stackoverflow.com/q/40009820/4114128">asked a question yesterday</a> about rebasing in git and got some good answers on what to do. However When I proceeded, I ran into issues that I dont understand 1 bit.</p> <p>To give a quick overview:</p> <p>I branched out (<code>B...
<blockquote> <p>When I do git status in <code>Branch2</code> it lists all the files that I have changed (which seems right). </p> </blockquote> <p>A branch is a pointer to a commit. <code>git status</code> shows the files that are modified but not committed. Maybe it seems right to you but until you commit the chang...
Numbers in the column of the mysql table are not inserting in correct order <p>I am using MySQL Workbench 6.3. I have a table with two columns id and ingredient. But the id values are not getting inserted properly. Check the images for reference. I have tried both below queries</p> <pre><code>create table ingredients(...
<p>The order the rows are presented in is arbitrary, though typically it <em>might</em> be in order of insertion. If you want them in some particular order:</p> <pre><code>SELECT * FROM ingredients ORDER BY id </code></pre>
CSS - "height 100%" scrolls further than the viewport? can i prevent? <p>I'm constructing a preloader for my website. before the site is loaded there is a plain white div on top of everything, that i later fade out to show the content.</p> <p>i make this div height 100%, but the problem is that this div then gets a na...
<p>As Phil mentioned, you could use position absolute (or position fixed). This will take it out of the flow of the rest of the document and won't affect the stuff around it. </p> <pre><code>.cover { position:fixed; top:0; left:0; bottom:0; right:0; } </code></pre>
Combined Charts in iOS-Chart - Negative values for Line Chart are not rendered <p>I am using io-Charts (<a href="https://github.com/danielgindi/Charts/" rel="nofollow">https://github.com/danielgindi/Charts/</a>). I will have to show a bar chart and a line chart in the combined chart. The xAxis will reflect values from ...
<p>Fixed this by reordering the line chart data set with x values from -12 to 12 , in my original question , the data set was mixed and not in a proper order for the line chart.</p>
Using Get-ChildItem to retrieve folder,name,fullname <p>I'm currently using this script to pull the Name,Folder,Foldername from a given path:</p> <pre><code> Get-ChildItem "C:\user\desktop" | Select Name, ` @{ n = 'Folder'; e = { Convert-Path $_.PSParentPath } }, ` @{ n = 'Foldername'; e = { ($_.PSPath -split '...
<p><a href="https://msdn.microsoft.com/en-us/library/system.io.directoryinfo%28v=vs.110%29.aspx" rel="nofollow"><code>DirectoryInfo</code></a> objects (the output of <code>Get-ChildItem</code> for folders) have properties <code>Name</code> and <code>FullName</code> with the name and full path of the folder. They also h...
Not all Spark Workers are starting: SPARK_WORKER_INSTANCES <p>I have my spark-defaults.conf configuration like this. my node has 32Gb RAM. 8 cores. I am planning to use 16gb and 4 workers with each using 1 core.</p> <pre><code>SPARK_WORKER_MEMORY=16g SPARK_PUBLIC_DNS=vodip-dt-a4d.ula.comcast.net SPARK_WORKER_CORES=4 S...
<p>Memory and core properties are for every executor. So when you say SPARK_WORKER_CORES=4 this is every executor with 4 cores.</p> <p>Also you cant use all memory in your server for executors. If you want 4 executors with total 16gb memory, your properties should be like this</p> <pre><code>SPARK_WORKER_MEMORY=4g SP...
SQL Query: Find the name of the company that has been assigned the highest number of patents <p><img src="https://i.stack.imgur.com/WTqKu.png" alt="Following is the schema of Database"></p> <p>Using this query I can find the Company Assignee number for company with most patents but I can't seem to print the company na...
<p>Applying an aggregate function on another aggregate function (like <code>max(count(*))</code>) is illegal in many databases but I believe using the <code>ALL</code> operator instead and a join to get the company name would solve your problem.</p> <p>Try this:</p> <pre><code>SELECT COUNT(*), p.assignee, c.compname ...
Ionic (or AngularJS) blocks google maps autocomplete <p>I'm just trying to add a simple autocomplete form to my Ionic app. So first I tried it <a href="http://jsfiddle.net/GVdK6/265/" rel="nofollow">there</a>, it works perfectly fine. So I tried in my app (in the browser first).</p> <p>I put this in my controller, and...
<p>Since <code>Place Autocomplete</code> is a part of <a href="https://developers.google.com/maps/documentation/javascript/places" rel="nofollow">Google Maps Places Library</a> you probably forgot to include the loading of this library via <code>libraries</code> parameter, for example:</p> <pre><code>&lt;script src="/...
Selecting all elements that meet a criteria using selenium (python) <p>Using selenium, is there a way to have the script pick out elements that meet a certain criteria? </p> <p>What I'm exactly trying to do is have selenium select all Twitch channels that have more than X viewers. If you inspect element, you find this...
<p>First of all, you can find all twitch channel links. Then, filter them based on the view count.</p> <p>Something along these lines:</p> <pre><code>import re from selenium import webdriver THRESHOLD = 100 driver = webdriver.Firefox() driver.get("url") pattern = re.compile(r"(\d+)\s+viewers on") for link in dr...
create index of column when same row cell of another column has today's date <p>I would like to create an index when cell in another column matches <strong>today's</strong> date. Here is my try for D2:</p> <pre><code>=index($A2:$B14, match(today(),$A2:$A14,false ),1) </code></pre> <p>What am I doing wrong? <img src="...
<p>If you want to retrieve the Group of items with <code>Created Time = Today()</code> then enter this formula in <code>E2:E14</code>:</p> <pre><code>=IF(A2=TODAY(),B2,"") </code></pre> <p>Now if what you need is just a list of the Groups with today date enter this formula in <code>F2:F14</code>:</p> <pre><code>=IFE...
SQL XML find and replace <p>So I'm dealing with a field in a table that contains XML data and from line to line the number of parameters in the XML field will vary (as will the name of the variables).</p> <p>I need to be able to search a field containing XML for my <code>&lt;variablename&gt;tminus1&lt;/variablename&gt...
<h2>One- or Two-step replacement</h2> <p>As others pointed out, there is a problem, if you want to replace the text value of a node given as <code>&lt;ValueAsString /&gt;</code>. The <code>.modify(N'replace value of...</code> demands for a <code>/text()</code> at the end as target for the replacment, but there isn't.....
Generating Plots from .csv file <p>I'm trying to make several plots of Exoplanet data from NASA's Exoplanet Archive. The problem is nothing I do will return the columns of the csv file with the headers on the first line of the csv file.</p> <p>The Error I get is</p> <pre><code> NameError: name 'pl_orbper' is not d...
<p>Change the following line:</p> <pre><code>plt.plot(pl_orbper,pl_bmassj) </code></pre> <p>to </p> <pre><code>plt.plot(data['pl_orbper'],data['pl_bmassj']) </code></pre> <p>With the following data:</p> <pre class="lang-none prettyprint-override"><code>rowid,pl_orbper,pl_bmassj 1, 326.03, 0.320 2, 327.03, 0.420 3,...
Dart Angular2 in WebStorm: "Attribute [(ngModel)] is not allowed her ..." <p>G'Day,</p> <p>Trying to follow the Angular2 'Heros Editor' tutorial using Dart in WebStorm:</p> <pre><code>import 'package:angular2/core.dart'; @Component( selector: 'my-app', styleUrls: const ['app_component.css'], template: '&lt;i...
<p>WebStorm doesn't support AngularDart at the moment an you may get some false warnings in injected HTML. Also you may miss Angular specific code completion, highlighting, code navigation, etc. Watch <a href="https://youtrack.jetbrains.com/issue/WEB-11590" rel="nofollow">https://youtrack.jetbrains.com/issue/WEB-11590<...
55 line C++ code crashing on debug <p>Good afternoon,</p> <p>I am playing around with C++ and right now I'm trying to create a deck of cards. I've done what I believe has created 52 cards and then tried to call out a random one to see what number and suit it holds. When I do it builds the project and then I get a popu...
<p>You need to initialize j in <code>for (int j; j &lt;=4; j++ )</code>, i.e. <code>int j = 1</code>. Another issue i see is that you're overwriting <code>deck[i]</code> for all values of j.</p>
R: Select first and last rows of a group of emissions (one visit) and distinguish between different visits at same location <p>Working with some data on a migratory species of birds, zarapitos (genus <em>Numenius</em>), that go from Alaska, USA to Maullín, Chile. They stop to rest and feed on a group of islands in Chi...
<p>This is probably simpler to do through <code>data.table</code>, though it would certainly be possible in base R as well. </p> <pre><code>library(data.table) setDT(df) df[, rleid := rleid(site)][site!="o", if(.N &gt; 1) .SD[c(1,.N)], by=rleid] # rleid time site #1: 3 03:21 s2 #2: 3 05:39 s2 #3: 5 ...
how to tell sphinx that source code is in this path and build in that path <p>I want to run sphinx on a library in a conda virtual environment with path</p> <pre><code>/anaconda/envs/test_env/lib/site-packages/mypackage </code></pre> <p>and put the html files in the path</p> <pre><code>/myhtmlfiles/myproject </code>...
<p><code>make</code> is not a sphinx command. That command actually runs either a <code>make</code> with a Makefile or <code>make.bat</code> (depending on your operating system), which then locates the relevant files before invoking <code>sphinx-build</code>. You will need to modify the make files and/or set the proper...
Show/hide visibility based on form values <p>I want to hide/show a form div based on the selection I make. I already done this, but I need a different code because I have two forms in the same code and the scripts are in conflict.</p> <p>Please see below the code that already works, but I need a second script which wi...
<p>First of all, you should not use the same id name on elements(divs, forms and selectors) for both forms.</p> <p>Instead of, you may use class attribute to tailor your needs. Always refering jquery selector by parent form.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="...
How to set Git config options for all subdomains? <p>Similar to how you can set <a href="http://stackoverflow.com/a/23807432/1233435">Git config options for a specific URL</a> like</p> <p><code>git config http."https://code.example.com/".sslVerify false</code></p> <p>I'd like to set them for all subdomains. How can I...
<p>The analysis of the <a href="https://github.com/git/git/blob/master/urlmatch.c#L457" rel="nofollow">host matching part</a> in git's url matching procedure suggests that wildcards are not supported:</p> <blockquote> <pre><code>/* check the host and port */ if (url_prefix-&gt;host_len != url-&gt;host_len || strnc...
Why is my phone's IP address reported differently (depending on the site) and how can I programmatically obtain a consistent one in ASP.Net? <p>On my phone, using LTE (not wifi), if I go to whatismyipaddress.com, it reports the IP address as 166.216.xxx.xxx. But if I go to whatismyip.com, it is reported as 107.77.xxxx...
<p>Your carrier is using CGN. That means your iPhone does not have a public IP address. The carrier whose tower you are connected to has public IP addresses, and that is what gets reported to you by a public web site.</p> <p>The public IP address which gets reported will vary for different reasons:</p> <ul> <li>If yo...
Npm gulp grunt difference? <p>a bit confused over those 3. Are they the same thing? I guess not since they are all in the same solution. So what do they do exactly and the relations among them? Thanks for any clarification.</p>
<p><code>npm</code> refers to <strong>Node Package Manager</strong>. It's a package manager for node modules. You can use it form the command line to install any package registered on npm registry. People use npm to distribute packages. It host packages related to nodejs and front-end frameworks and libraries.</p> <p>...
How to Extract body request node.js <p>I have just started learning node.js (Express) and I created a simple application that communicate with a very simple mongo database. I have a collection called 'Users' in a database called 'testDB'. I created my skeleton in my node.js application and I followed 'separation of con...
<blockquote> <p>How to extract the body from the request. I tried to dig into 'req' but I couldn't find what I am looking for?</p> </blockquote> <p>This should be done with a simple <code>req.body</code>. From the <a href="http://expressjs.com/en/api.html" rel="nofollow">express docs</a> on <code>req.body</code>: "C...
Telegram Bot getUpdates VS setWebhook <p>I want to develop a bot for a business! I don't know that using <a href="https://core.telegram.org/bots/api/#getupdates" rel="nofollow">getUpdates</a> method for develop a windows desktop application and run that on vps (by <a href="https://github.com/MrRoundRobin/telegram.bot" ...
<p>It does not matter you want to use which kind of server side applications. Typically <code>getUpdates</code> used for debugging. For publishing your bots, you need to using the <code>Webhook</code>. <a href="https://core.telegram.org/bots/webhooks" rel="nofollow">See this</a>.</p> <blockquote> <p>getUpdates is a ...
avoid for loops in a large matrix in R <p>I have a very large matrix that requires some computation. As a for loop is notoriously slow in R, I would like to replace it with some smarter function, such as apply. However, I am scratching my head without being able to do it.</p> <p>Here is the for loop that I wrote with ...
<p>How about this</p> <pre><code>d[lower.tri(d)] &lt;- (t(d)[lower.tri(d)] == 1) </code></pre> <p>This gives you a symmetric matrix. Note that I'm taking the lower triangle of the transpose instead. You want to read the upper triangle row wise but <code>d[upper.tri(d)]</code> will return the column wise values. On th...
Pandas Grouping - Values as Percent of Grouped Totals Not Working <p>Using a data frame and pandas, I am trying to figure out what each value is as a percentage of the grand total for the "group by" category</p> <p>So, using the tips database, I want to see, for each sex/smoker, what the proportion of the total bill i...
<p>You can add another grouped by process after you get the <code>sum</code> table to calculate the percentage:</p> <pre><code>(df.groupby(['sex', 'smoker'])['total_bill'].sum() .groupby(level = 0).transform(lambda x: x/x.sum())) # group by sex and calculate percentage #sex smoker #Female No 0.622350...
How do I invoke the OnReceive() function when a set alarm goes off? <p>I have been trying all day to invoke the BroadcastReceiver.OnReceive() function on the Android. I am using Android AIDE for my projects, but nothing seems to work. I am using...</p> <pre><code> Intent openNewAlarm = new Intent(AlarmClock.ACT...
<p>Try this</p> <pre><code> Intent startIntent = new Intent("BROADCAST"); PendingIntent startPIntent = PendingIntent.getBroadcast(context, 0, startIntent, 0); AlarmManager alarm = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); alarm.set(AlarmManager.RTC_WAKEUP, triggerTime, startPIntent)...
Sorting a list of Strings in Alphabetical order (C) <p>Ok, here is my problem. A teacher has to randomly select a student (from the students she has) to earn a special bonus in the final score and in order to do that she puts N pieces of paper numbered from 1 to N in a bag and randomly select a number K; the award-winn...
<p>Sorting an array of strings are real simple. Just use <code>qsort</code> and the existing compare function (i.e. <code>strcmp</code>)</p> <p>Example:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt; #define NAMES 5 #define NAME_LEN 10 void print_names(char names[][10]) ...
Ember SyntaxError Unexpected Token; NodeJS Module Related <p>I am having an issue with Ember building. I have tried doing <code>npm clean cache</code>, deleting the <code>node_modules</code> folder, and then <code>npm install</code>. I have also tried copying the <code>ember-cli</code> and <code>ember-cli-htmlbars-inli...
<p>After searching and searching, I ran across <a href="http://discuss.emberjs.com/t/server-wont-start-syntaxerror-unexpected-identifier-at-exports-runinthiscontext-vm-js-53-16/9012" rel="nofollow">this question</a>. It turns out that my /config/environment.js was corrupt, which was resulting in this error.</p>
Labeling y-axis with multiple x-axis' <p>I've set up a plot with 3 x-axis' on different scales, however when i attempt to use a Y-label i get the error: </p> <p>AttributeError: 'function' object has no attribute 'ylabel'</p> <p>I've tried a number of options, however I am not sure why this error appears.</p> <p>My c...
<p>you are typing ax.set.ylabel, you should be doing ax.set_ylabel</p>
Android manipulating Listview items outside screen throws nullpointer exception <p>I'm making an mp3 player app. </p> <p>In order to better highlight which song is playing, I change the background color of the current song's listitem.</p> <p>Everything works fine when I click on the actual list items using the onItem...
<p>If I do, I update view in PlayListAdpater.<br> I'm adding variable for selected position in adapter.<br> And I'm changing it when next song play.</p> <p>If you call 'updateSongColor' in Service, you can use broadcast or AIDL. </p> <p>Example)</p> <pre><code>public class PlayListAdapter extends ArrayAdapter&lt;Son...
Reading from and writing to registers of an IMU via UART <p>I have an IMU that has a UART interface. The manufacturer has provided a Windows based program that get all the data from the IMU and displays it in real time. (The device is connected to the PC via the USB). I need to write my own software that does this in o...
<p>You need not any kernel headers to talk over a serial port with any device connected to that serial port. </p> <p>You would get a 'connection' to your device by simply opening a file <code>/dev/ttyUSB0</code> with <code>open()</code> call (the actual name could be found by looking into <code>dmesg</code> for releva...
Iterate through list, adding to array <p>I have a <code>List&lt;PaymentObject&gt;</code></p> <p>A Payment Object consists of:</p> <blockquote> <p>DateTime PaymentDate; Decimal Amount;</p> </blockquote> <p>What I need to do is create an array that ends up like this:</p> <pre><code> s.Data = new Data(new obj...
<p>One way might look like:</p> <pre><code>var paymentObjectList = new List&lt;PaymentObject&gt;(); // assuming the above gets populated at some point object[,] dataArray = new object[paymentObjectList.Count, 2]; int listIndex = 0; foreach (var paymentObject in paymentObjectList) { dataArray[listIndex, 0] = paym...
Import os doesn't not work in linux <p>I just want to install the <a href="https://pypi.python.org/pypi/suds" rel="nofollow">suds library</a>, but suddenly it wasn't proceeding because it was not finding the <code>os</code> library, so I tried to open my python and it results me an error. When I import the <code>os</co...
<p>You need to <a href="https://www.python.org/downloads/" rel="nofollow">install a more recent version of Python - version 2.7.12 or later</a>. <a href="http://www.snarky.ca/stop-using-python-2-6" rel="nofollow">All versions of Python 2.6 have been end-of-lifed and any use of Python 2.6 is actively discouraged</a>.</p...
Making a PHP Button Clickable <p>Firstly, thanks so much for your help.</p> <p>I am creating a Wordpress site for a client which you can see here: <a href="http://christchurchhelicopters.co.nz/new" rel="nofollow">http://christchurchhelicopters.co.nz/new</a></p> <p>Essentially, for user experience, we want to make eac...
<p>I'm reading from mobile, so hope I'm not missing something on the code above, but seems that the function <strong>travel_time_thumb_rollover</strong> is responsible of printing the link. Try looking for it with a recursive full text search in your project folder. Basically you should unwrap the <code>&lt;a&gt;</code...
Yii2 Custom / Shorter Namespace <p>I have a nested 'mail' module in my yii2 (basic template) at this location:</p> <blockquote> <p>@app/modules/admin/modules/mail</p> </blockquote> <p>How do I create shorter namespaces in all of the modules files. So instead of this namespace in my controller files:</p> <blockquot...
<p>you must set alias to directory at bootstrap to custom namespace.</p> <p>First, create a <code>bootstrap.php</code> in <code>config/</code> folder:</p> <pre><code>//bootstrap.php Yii::setAlias('mail', dirname(dirname(__DIR__)) . '/modules/admin/modules/mail'); </code></pre> <p>Add run <code>bootstrap.php</code> a...
All Unique Permutations - Stack overflow issue <p>I am trying to solve the following problem:</p> <blockquote> <p>Given a collection of numbers that might contain duplicates, return all possible unique permutations.</p> </blockquote> <p>Here is my code:</p> <pre><code>public class Solution { public ArrayList...
<p>Well, I don't like to ruin good job interview questions, but this question was fun to think about, so...</p> <p>Here's a super-L337 answer for generating all unique permutations very quickly and without using much memory or stack. If you use this in a job interview, the interviewer will ask you to explain how it w...
Random increase in div height for dynamic content <p>I'm adding html tags dynamically into a div, unless the div's height has reached 700px, after which I'm adding new tags to a separate div, like this:</p> <pre><code>while (index &lt; contents.length) { var content = contents.eq(index).clone(); var pr...
<p>I'm thinking this is the css display values at play here.</p> <p>Some elements come with a few built in styles..for example some browsers give h1 and h4 tags "display: block;" styling by default.</p> <p>The gist of the difference is that inline elements can be side by side and block is designed so the elements get...
Error in expected output: Loop is not correctly working <p>I am still struggling to link the second 'for' variable in this together. The first 'for' loop works correctly, but the second half is stuck on a single variable, which is not allowing it to function correctly in a later repeatable loop. How might I write this ...
<p>I think you need to specify global inside the <code>servy</code> function and not outside, but even better would be to pass inez as a parameter to <code>servx</code>:</p> <pre><code>def servy(): global inez fh.seek(0); #veryyyyy important qust = input('Find another Enzyme? [Yes/No]: ') qust = qust....
How should i fix with ng-invalid and ng-pristine in angular validation? <p>i have a issue about angular validation.</p> <p>My case point:</p> <ol> <li>I have 2 textfields and 1 button in a form.</li> <li>When page load, the button is by ng-disabled with ng-invalid status.</li> <li>Then type something text in a textfi...
<p>I consider you don't want to user "Required" Attribute for both textfield and as below you can use </p> <pre><code>&lt;div ng-app="appX"&gt; &lt;div ng-controller="validationCtrl"&gt; &lt;form name="xyzForm" novalidate&gt; &lt;input type="tex...
responsive div blocks don't align properly on mobile device <p>I have a shift calendar for a local fire department that I built using foundation5 responsive css framework. Everything works great when viewing in my browser and resizing the window.<br> <strong>example:</strong></p> <p><a href="https://i.stack.imgur.com...
<p>It's difficult to debug without being able to inspect the site first hand. From first glance though, I would try adding a float and clear to the .calRow class, provided it is what it sounds like (the rows that make up the calendar).</p> <pre><code>.calRow { float: left; clear: both; width: 100%; } </cod...
How to access page by address in APEX <p>In the interactive report I developed with Apex, the table on the home page shows the information of a list of projects, including project name, owner etc. And the project name field of each project is a click which redirect to another page that shows more detailed project's inf...
<p>I got the answer from APEX forum, so I am gonna write the answer here so that it might be of some help. </p> <p>The url has a session id, which belongs to the app. By default, if you copy and paste this address to another browser, a new session will be created and the old id will not be valid anymore and the url wi...
verilog fwrite output bytes <p>I know that if I am outputting a binary file in verilog, then I can use the following verilog IO standard function:</p> <pre><code>$fwrite(fd,"%u",32'hABCDE124); </code></pre> <p>But the above command writes 4-byte data into the file. What if the binary data that I want to write is onl...
<p>You can use <code>%c</code> to write out a single byte. You can use a bit-stream cast to convert your data into an array of bytes, then do</p> <pre><code>foreach(array_of_bytes[i]) $fwrite(fd,"%c",array_of_bytes[i]); </code></pre> <p>If you have a large amount of data, you may want to optimize this by writing out ...
Setting the JS dropdown selection checkmark in an appropriate position and make dropdown list look better <p>I am trying to implement a dropdown/selection list in JS and here is what I have written:</p> <pre><code>//some js code #startJobDialog (A dialog box in JS) // js code var markUp = "&lt;ul id='topMenu' clas...
<p>My suggestion would be to remove the css from your markup and put them in a css file.</p> <p>From there, try absolute positioning your elements.</p> <p>I have provided an example snippet of your code in this post, just to look at and play around with. You can see a bunch of <code>&lt;br&gt;</code>'s being added t...
Computing average from relation with null values in SQLite <p>I'm having a hard time computing the average in SQL when I have null fields in a table. I want to include fields which have null and replace them with the number 10 before calculating the average. Suppose I have the following relation:</p> <pre><code>x | ...
<p>Use <code>coalesce()</code>:</p> <pre><code>select avg(coalesce(cap, 10)) from courses; </code></pre>
angularjs - ng-repeat inside ng-included partial not working <p>In my parent page I include a partial using ng-include. Within that partial I use a ng-repeat to echo out form elements.</p> <p>As you can see, the array for ng-repeat has 4 items (elements.length), but for whatever reason, angularjs skips ng-repeat compl...
<p>Turns out, ng-repeat fails inside a <code>&lt;textarea&gt;</code>, while other variable substitution works as expected.</p> <p>The partial.html is inside a <code>&lt;textarea&gt;</code>. Once I removed it from the <code>&lt;textarea&gt;</code>, everything worked.</p>
Eclipse no "Design" pane? <p>Basically the issue is, that I no longer have a design tab in Eclipse. This issue appeared just now, when I was about to very happily work on some stuff.</p> <p>I already had Swing Designer installed, and I've been working in the Design pane for a whole week. But today when I opened up Ecl...
<p>Found the solution. Had to put the .java file in the "src" folder.</p>
Confusion on async file upload in python <p>So I want to implement async file upload for a website. It uses python and javascript for frontend. After googling, there are a few great posts on them. However, the posts use different methods and I don't understand which one is the right one.</p> <p>Method 1: Use ajax...
<p>Asynchronous behavior applies to either side independently. Either side can take advantage of the capability to take care of several tasks as they become ready rather than blocking on a single task and doing nothing in the meantime. For example, servers do things asynchronously (or at least they should) while client...
Angular Authentication <p>The problem is on every $routeChangeStart if user is not found it still directs me to pages if I just type the url.</p> <p>Now I have rewrite the rules on the server.</p> <pre><code>Options +FollowSymlinks RewriteEngine On # Don't rewrite files or directories RewriteCond %{REQUEST_FILENAME} ...
<p>move this portion of code into your application's run block. </p> <pre><code>$rootScope.$on('$routeChangeStart', function(event){ $scope.loggedIn = Auth.isLoggedIn(); console.log(Auth.isLoggedIn()); Auth.getUser().then(function(response){ console.log(response); $scop...
Pandas timeseries resampling and interpolating together <p>I have timestamped sensor data. Because of technical details, I get data from the sensors at <em>approximately</em> one minute intervals. The data may look like this:</p> <pre><code> tstamp val 0 2016-09-01 00:00:00 57 1 2016-09-01 00:01:00 ...
<pre><code>d = df.set_index('tstamp') t = d.index r = pd.date_range(t.min().date(), periods=24*60, freq='T') d.reindex(t.union(r)).interpolate('index').ix[r] </code></pre> <p><a href="https://i.stack.imgur.com/E8HOF.png" rel="nofollow"><img src="https://i.stack.imgur.com/E8HOF.png" alt="enter image description here">...
Node JS Scoping <p>There's something wrong with my scoping that I'm not quite understanding here. I have the following sample code:</p> <pre><code>/** * Created by David on 10/9/2016. */ var public = {}; //REQUIRES var fs = require('fs'); var rl = require('readline'); //======================================== va...
<p>I think your issue isn't with "scoping", but you don't understand how to use promises. I highly recommend both the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise" rel="nofollow">Mozilla documentation</a> and <a href="https://davidwalsh.name/promises" rel="nofollow">...
How to run two spring boot application on a same jvm? <p>The problem is what the title has described.</p> <p>I have googled a lot.But the solution I found are a little old and not very useful for me.</p> <p>I want to see the demo code and know the principle.</p> <p>Any one can help? Really Thx.</p>
<h3>(1) Deploy 2 WARs in a web container</h3> <p>You could build both spring boot projects as WARs and deploy them in the same web container. Take a look at:</p> <ul> <li><a href="http://stackoverflow.com/a/39233933/641627">How to deploy spring-boot WAR in a container</a></li> <li>and <a href="https://spring.io/guide...
Placing form input into an ordered list with Javascript <p>I'm new to javascript. I am trying to grab the answer the user submits through the form and then place it in an ordered list in the HTML document. I know how to do this in PHP but my assignment requires me to use javascript and I'm not sure what to do after I g...
<p>You can do this easily by use get <code>ElementbyId.value</code>, then display by <code>innerHTML</code>.</p> <pre><code>&lt;textarea placeholder="Type somethings..." id="input"&gt;&lt;/textarea&gt; &lt;input type="button" id="btn" value="Change"/&gt; &lt;div id="result" style="text-align:left"&gt;&lt;/div&gt; &l...
Matlab - Find points in vicinity <p>Lets say I have a dataset like below.</p> <p>X = [170,85; 165,75; 180,100; 190,120; 160,80; 170,70];</p> <p>a distance vector</p> <p>Y = [10,20];</p> <p>a data point</p> <p>Z = [166,77];</p> <p>I want to find all the points of X that fall within the distance Y from the point Z<...
<pre><code>a= X(abs(X(:,1)-Z(1))&lt;=Y(1) &amp; abs(X(:,2)-Z(2))&lt;=Y(2),:) </code></pre> <p><strong>EDIT</strong></p> <p>Multidimensional solution can look like this:</p> <pre><code>a= X(all(abs(X-ones(size(X,1),1)*Z) &lt;= ones(size(X,1),1)*Y,2),:) </code></pre>