input
stringlengths
51
42.3k
output
stringlengths
18
55k
Modifying elements with same directive <p>I have several elements in a container. One of the rows has two icons in it: zoom in and zoom out. When you click Zoom In, I'd like all the row's widths to grow. </p> <pre><code>&lt;div id="events"&gt; &lt;year&gt;year 1&lt;/year&gt; &lt;year&gt;year 2&lt;/year&gt; ...
<p>You are overwriting the scope every time. So each instance of your <code>year</code> directive is clobbering the <code>zoomIn</code> and <code>zoomOut</code> methods each time it is instantiated.</p> <p>Normally you could solve this by using a new or isolate scope in your directive definition object:</p> <pre><cod...
Create multiple arrays using a for loop <p>I would like to make a program where the user can input the number of variables and fill every variable with certain values. For example, the User inputs that he/she wants to make 10 arrays, then the User inputs that the first array should have 5 elements and the User fills th...
<p>The problem is that each time you are creating the array. try this:</p> <pre><code>Scanner s = new Scanner(System.in); System.out.println("Enter the numbers of variables: "); int i = s.nextInt(); int[][] var = new int[i][]; for(int j = 0;j &lt; i;j++){ System.out.println("Enter the number of values: "); in...
PostgresQL, only contain not null values <p>I'm trying to output a query where if any of the following columns contains NULL value (or for current sheet does not contain an empty string), then output the results, but it is still outputting results with null values. What am I doing incorrectly?</p> <pre><code>select *...
<p>Replace <code>OR</code> with <code>AND</code> to make sure all columns in <code>where</code> clause does not have any <code>NULL</code> value</p> <pre><code>SELECT * FROM PUBLIC._http_requests WHERE (_http_requests.currentsheet IS NOT NULL OR _http_requests.currentsheet != '') AND _http_requests.session_i...
Unit test IOException for InputStream <p>Is there a way to unit test the following code without using <strong>PowerMock</strong>? We have sonar unit test code coverage and it does not recognise code tested via PowerMockRunner. So I was looking for a way to simulate <strong>IOException</strong> or use Mockito somehow to...
<p>A <code>ByteArrayInputStream</code> will never throw an Exception so subsequently your <code>try</code> / <code>catch</code> is pointless. Just create the <code>ByteArrayInputStream</code> and use it directly and dump the exception handling. If you check the method signatures of <code>ByteArrayInputStream</code> y...
Why doesn't this work? Is this a apscheduler bug? <p>When I run this it waits a minute then it prints 'Lights on' then waits two minutes and prints 'Lights off'. After that apscheduler seems to go nuts and quickly alternates between the two very fast. </p> <p>Did i just stumble into a apscheduler bug or why does th...
<p>You are flooding the scheduler with events. You are using the BackgroundScheduler, meaning that scheduler.start() is exiting and not waiting for the event to happen. The simplest fix may be to not use the BackgroundScheduler (use the BlockingScheduler), or put a sleep(180) on your loop.</p>
TeamCity NuGet package build for different .NET Frameworks <p>I've been doing updates to .NET Framework targeted versions of projects updating to latest .NET (4.6.2).</p> <p>Some of these projects are NuGet packages, built in TeamCity 9.0.2.</p> <p>I've use the steps in <a href="http://shazwazza.com/post/multi-target...
<p>Ok I ended up solving this through trial and error and learning about NuSpec. Note, I didn't find a way to do this using purely TeamCity settings but this is equally good.</p> <p>I was correct that you need extra build steps to build the assemblies in the solution/project level build configurations and point each <...
XSLT: Add attribute to all descendants of rootnode <p>I have the following xml document:</p> <pre><code>$ cat data.xml &lt;rootnode&gt; &lt;section id="1" &gt; &lt;outer param="p1"&gt; &lt;inner /&gt; &lt;inner /&gt; &lt;/outer&gt; &lt;outer param="p1"&gt; &lt;inner /&gt; &lt;/outer&gt; &lt;outer /...
<p>I would suggest you do it this way:</p> <p><strong>XSLT 1.0</strong></p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/&gt; &lt;xsl:strip-space elements="*"/&gt; &lt;!-- identity transform -...
PHP echoing in wrong location of html <p>I'm attempting to make a template based system to deliver content but I've run into a problem that I just can't seem to solve. When I try to echo out variables that have data from includes it gets outputted in the wrong section of my html.</p> <p>Below is 'newstuff.php' which i...
<p>You're using includes wrong.</p> <pre><code>$php = include "templates/content/newstuff/phpCode.php"; </code></pre> <p>is <em>immediately</em> outputting the output of that file, and setting <code>$php</code> to <code>1</code> (i.e. "it worked!").</p> <blockquote> <p>Handling Returns: include returns <code>FALSE...
ASP.NET MVC 5 Model Navigation Properties Error <p>So I have two models that I am trying to get working,</p> <pre><code>public class Contract { [Key] public int Id { get; set; } public string AwardId { get; set; } [ForeignKey("Id")] public virtual ICollection&lt;ContractHistory&gt; contractHistory { ge...
<p>As far as I see you want to implement one-to-many relationship, if so you have to remove the foreginkey attribute from the contract history collection in the contract class, and add contractId property as foreignkey in the contract history class as below:</p> <pre><code>public class Contract { [Key] public int Id {...
MS-Access using Dlookup to pull results from query into textbox on form <p>I am very new to access and I am using the Dlookup function to pull the results from a query into a text box to appear on a form. I have the following expression in the Data Control Source field for the text box and it is pulling in the very fi...
<p>If <code>Company</code> is text:</p> <pre><code>=DLookUp("SumOfSales","qTtlSalesbyComp","Company = '" &amp; Company &amp; "'") </code></pre> <p>If it is numerical:</p> <pre><code>=DLookUp("SumOfSales","qTtlSalesbyComp","Company = " &amp; Company ) </code></pre>
How to properly write my .htaccess to ignore a folder <p>I've been searching arround for anwsers about what I am trying to do. I have an Angular.js application with the html5mode seted to true. So I created a .htaccess file to be able to run.</p> <p>So far I have this.</p> <p></p> <pre><code># Rewrite Engine Rewrite...
<p>Try with:</p> <pre><code>RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond %{REQUEST_FILENAME} -d [OR] RewriteCond %{REQUEST_URI} ^/backend/ RewriteRule ^ - [L] # If the requested resource doesn't exist, use index.html RewriteRule ^ /index.html </code></pre>
Trying to you =COUNT on 30 sheet workbook for exel <p>I am trying to put a count in to a 30 sheet workbook to track if a time is put in a cell, how would I go about writing the the formal for that ?</p> <p>I think it may be <code>=COUNT(‘1:31’!I12)</code> with <code>I12</code> being the cell that I need the count ...
<p>Consider using <em>COUNTA()</em> instead:</p> <pre><code>=COUNTA('1:31'!I1) </code></pre> <p>as this will handle both numbers and text.</p> <p><a href="https://i.stack.imgur.com/uqWAo.png" rel="nofollow"><img src="https://i.stack.imgur.com/uqWAo.png" alt="enter image description here"></a></p>
How do I actually write/end an async method in c#? <p>I get that I need to await thing in an <code>async</code> marked method to make it asynchronous, but I don't get how to actually end the hole it makes. </p> <pre><code>static async void Example() { int t = await getIntAsync(); WriteLine($"computer: {t}"); }...
<p>What is confusing here is that you don't really do something <em>asynchronous</em>. <code>Console.ReadLine()</code> is a synchronous method. Simply typing <code>async</code> or <code>await</code> somewhere does not magically make this asynchronous.</p> <p>Since this code is only for testing and learning, one way to...
Django add field to auth_user <p>I am trying to implement the above to add a field 'posts' to the user model using the first option, extended it.</p> <p>models.py</p> <pre><code> from django.contrib.auth.models import User class NewUserModel(models.Model): user = models.OneToOneField(User, on_delete=mo...
<p><code>users_model</code> doesn't reference <code>NewUserModel</code>, it references <code>User</code>. You need to access the related model in your template like so:</p> <pre><code>{% for item in users_model %} &lt;tr&gt; &lt;td&gt;&lt;a href="{% url 'profile' item.id %}"&gt;{{ item.username }}&lt...
Stopping a CancellationTokenSource which times out after a given TimeSpan to keep its state? <p>I have a method that accepts a <code>CancellationToken</code> which allows a user of the method to cancel what it is doing. Within the method I used this <code>CancellationToken</code> along with a <code>CancellationTokenSou...
<blockquote> <p>Is there a way to stop a CancellationTokenSource so that it does not timeout?</p> </blockquote> <p>Wrong question. (BTW, it's not possible to stop one).</p> <p>The correct question would be "How do I determine if the loop cancelled as a result of a timeout, it was cancelled, or if the target value w...
Get all XElement parents with a recursive function <p>I'm trying to get all the parents of a given XElement. I tried to write this function but it does not work. the page loads endlessly.</p> <pre><code>public List&lt;XElement&gt; GetParents(XElement element) { List&lt;XElement&gt; parentList = new List&lt;XElemen...
<p>Just call the <a href="https://msdn.microsoft.com/en-us/library/bb353466"><code>.Ancestors()</code> extension method</a>.</p>
How to count or group relations from two colums with SQL <p>I know the basics of SQL but is not more than a beginner, so I have no idea how to search for this question the right way. </p> <p>Question: How do I count matching relations in a two column set up? Example: </p> <p>I use: </p> <pre><code>SELECT "from", "t...
<p>MySQL - Use <code>least</code> and <code>greatest</code> to get only one combination in case symmetric pairs exist.</p> <pre><code>SELECT least("from", "to"), greatest("from", "to"), COUNT(*) Count FROM "LocationDestination" GROUP BY least("from", "to"), greatest("from", "to") HAVING COUNT(*) &gt; 1 ORDER BY COUNT(...
Process run in loop not logging every time <p>I have a class in which I can run rsync commands from a shell script.</p> <p>It all works as it should, except when logging the process output (instream and error stream) to file.</p> <p>I have a loop in my class which allows 5 runs if the process fails, and in each run e...
<p>i don't ever see your printstream object "out" ever being used besides it getting initialized. If you want to write to the file you should call the printstream object.</p> <pre><code>System.out.println("ExitValue: " + exitVal); //now call the printstream object out.print("ExitValue: " + exitVal); //flushing will fo...
Macro to Save as from Excel to .txt file with same file name and same location as original file <p>I am trying to write a macro to save as excel file to a .txt file but with the same original filename as the excel file and the same path as the excel file. If i record a macro it has me pick a path and a file name and wh...
<p>Code below will work with any file extension and saves the workbook as text file.</p> <pre><code>Sub saver() Dim fn As String Dim l As Long Dim wb As Workbook Set wb = ActiveWorkbook fn = wb.FullName l = InStrRev(fn, ".") fn = Left(fn, l) fn = fn &amp; "txt" wb.SaveAs Filename:=fn, FileFormat:=xlText wb.Close En...
Delphi: How to set TWebResponse to contain gzip and read it in Android App? <p>I'm building a WebServer for Android App.(WebBroker->VC).</p> <p>How can I compress my response string to gzip, I tried this:</p> <pre><code> a:=[{.......}];//json data srcbuf := BytesOf(a.ToString); ZCompress(srcbuf, destbuf, zcDefault)...
<p>I found the solution:</p> <p><strong>Delphi:</strong></p> <pre><code>//------------------------------------------------------------------------------ procedure doGZIP(Input, gZipped: TMemoryStream);//helper function const GZIP = 31;//very important because gzip is a linux zip format var CompactadorGZip: TZComp...
Integrate Google Maps MarkerClusterer with infowindow <p>I'm trying to put InfoWindow in multiple markers grouped with MarkerClusterer, but without sucess. I only can generate maps with infowindows OR with cluster; not both at same time. Searching over web makes me more confuse....</p> <p>The start point was <a href="...
<p>Add the "unique information" for each marker to your locations array (like the answer to this question: ). </p> <p>Add a click listener to each marker which opens the InfoWindow with that unique content.</p> <pre><code>var infoWin = new google.maps.InfoWindow(); var markers = locations.map(function(location, i) {...
Handling a form with Spring MVC without using the Spring <form:form> tag? <p>All is in the question. Is it possible to handle a form using Spring annotation @ModelAttribute without using the Spring tag . I saw this <a href="https://spring.io/guides/gs/handling-form-submission/" rel="nofollow">way to do</a> but it see...
<p>If you build your form using Spring tags, it will be converted to HTML. Run your project and check the source code of your JSP site. Spring tags just make things a bit easier for a coder. For example</p> <pre><code>&lt;form:form modelAttribute="newUser" action="/addUser" method="post"&gt; &lt;form:input path="fi...
How to wait for all pending completion handlers to be executed before stopping io_service? <p>I'm writing a server using <a href="http://www.boost.org/doc/libs/1_62_0/doc/html/boost_asio.html" rel="nofollow">boost::asio</a>. I have multiple threads each owning it's own <code>io_service</code> object. I'm using <code>io...
<p>Just reset the <code>work</code>.</p> <p>Any <code>io_service::run()</code> will return when all pending work has been completed.</p> <p>The common pattern is to use <code>optional&lt;work&gt;</code> so you can clear it. If it is a frequent thing, you could reduce some mental overhead by wrapping it in a RAII-enab...
Efficient way of getting last value in a specific column <p>I wrote a function to get the last value in a single column in a Google Sheet.</p> <pre><code>// Returns the row number of the first empty cell // Offset should be equal to the first row that has data function getLastRowInColumn(sheet, column, rowOffset) { ...
<p>See the answer here to a similar question. It is about getting the first empty row, you are just one higher. <a href="http://stackoverflow.com/questions/6882104/faster-way-to-find-the-first-empty-row/27179623#27179623">Faster way to find the first empty row</a></p>
How to create a before or after Trigger that can catch DUP_VAL_ON_INDEX on Oracle PL/SQL <p>I have a table like this</p> <pre><code>KD_C KD_PLA KD_T GABUNG BERAKHIR GAJI_PL BUYOUT ---- ------ ---- ---------- ---------- ---------- ---------- C001 MA001 T006 2003 2014 50000 5200000 C002...
<p>The <code>EXCEPTION</code> block from your trigger will never be executed since your trigger doesn't contain any <code>INSERT</code> or <code>UPDATE</code> statements. You have to consider <code>INSTEAD OF</code> Trigger instead.</p>
Will promoting aws rds read replica to db instance maintain the replication for new DB instance? <p>I am trying to understand if promoting a read replica to DB instance will maintain the replication/mirroring on the newly create DB instance? Wondering if the newly created DB instance will go out of sync with master.</p...
<p>Yes, it will immediately and permanently be out of sync from the master. Once promoted, you can't undo.</p> <p>That is the reason you promote a replica -- to disconnect it from the master and make it an independent instance.</p> <blockquote> <p>The Read Replica, when promoted, stops receiving WAL communications...
svg pseudo background-image file not showing on live site but works on localhost why? <p>I have simple svg arrow but it doesn't show when I use as pseudo background-image online but it works fine on my localhost: any idea?</p> <pre><code>span a:after { content: ""; background-image: url(arrow_right.svg); width: ...
<p>Add content-type=image/svg+xml to your .htaccess file at the root instead of content-type=text/xml</p>
Apache Spark update a row in an RDD or Dataset based on another row <p>I'm trying to figure how I can update some rows based on another another row.</p> <p>For example, I have some data like</p> <pre><code>Id | useraname | ratings | city -------------------------------- 1, philip, 2.0, montreal, ... 2, john, 4.0, mon...
<p>A clean way to do this would be to use <code>dense_rank()</code> from <code>Window</code> functions. It enumerates the unique values in your <code>Window</code> column. Because <code>city</code> is a <code>String</code> column, these will be increasing alphabetically.</p> <pre><code>import org.apache.spark.sql.func...
redirect another action with params in controller <p>When I post to delete action in below:</p> <pre><code>public function deletenews($newsid) { $news = News::where('id',$newsid)-&gt;first();//find($comment_id) $message = 'a string'; $msgstatus = 'another string'; ... return...
<pre><code>public function deletenews($newsid) { $news = News::where('id',$newsid)-&gt;first();//find($comment_id) $message = 'a string'; $msgstatus = 'another string'; ... return redirect()-&gt;route('usernews' ['message'=&gt;$message,'msgstatus'=&gt;$msgstatus]); } public function usernews(Reques...
Extracting available time slots from a scheduled time frame <p>I'm trying to create a view that will output me all available time slots from a Scheduling calendar table, having the already booked time slots on another table.</p> <p>Given the tables:</p> <pre><code>Table Calendar ID Date StartTime EndTi...
<p>Assuming your input columns are all strings:</p> <pre><code>with calendar ( id, dt, starttime, endtime ) as ( select 56, '18-OCT-16', '10.00.00', '18.00.00' from dual union all select 62, '21-OCT-16', '11.00.00', '20.30.00' from dual union all select 72, '27-OCT-16', '09.30.00', '17.00.00'...
Count Pageviews in MVC and log in Database <p>First let me thank everyone who has contributed in my education, it has helped a great deal and I have learned a lot in 7 months.</p> <p>I have been requested to count every pageview when someone visits a details page. I updated my database to add a pageview column but I ...
<p>I ended up just making a method in my repository to add a counter to the page-views column in my database every time an id was hit.</p> <pre><code>public void AddView(int id) { var view = _context.Tests.Single(i =&gt; i.Id == id); view.PageViews++; _context.SaveChanges(); } </code></...
Can't call function with onclick attribute <p>Why doesn't this work?</p> <p>html : </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;button onclick="test21()"&gt;test&lt;/button&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>javascript:</p> <pre><code...
<p>You can create a single function that calls both of those, and then use it in the event.</p> <pre><code>function myFunction(){ pay(); cls(); } </code></pre> <p>And then, for the button:</p> <pre><code>&lt;input id="btn" type="button" value="click" onclick="myFunction();"/&gt; </code></pre>
how do I get the User's previous photo? <p>The problem is that previous_modal method is returning the previous photo in the database, not <strong>@user</strong> previous photo.</p> <p>For example, if @user has photos with id's 10, 9, 8, 7, 6, 1 and I open the modal for photo id 6 and I click previous, it sets the hre...
<p>On your previous_modal method, instead of searching by id, you could search by created_at... something like:</p> <pre><code>def previous_modal if self.class.approved.where("created_at &lt; ?", self.created_at).last == nil return self else return self.class.approved.where("created_at &lt; ?", self.crea...
How to automatically display a user email in an HTML form field using Google Apps Script and JavaScript <p>I've created an HTML form using Google HTML service. How do I automatically display the user's email in the email field when they open the form? I already have a function for <code>onload</code> for the date. I t...
<p>I guess, you read <a href="https://developers.google.com/apps-script/guides/html/communication" rel="nofollow">this</a> but still worth mentioning.</p> <p>How does <code>google.script.run</code> work? It just runs a function on "server" side. This server side function can <code>return</code> some result (which was ...
Pass commandline args into another script <p>I have couple of scripts which call into each other. However when I pass </p> <p>Snippet from buid-and-run-node.sh</p> <pre><code>OPTIND=1 # Reset getopts in case it was changed in a previous run while getopts "hn:c:f:s:" opt; do case "$opt" in h) u...
<p>You need double quotes around <code>$test_command</code> in buid-and-run-node.sh, otherwise that variable is being split on the white space and appears to contain arguments for buid-and-run.sh. Like this:</p> <pre><code>$DIR/build-and-run.sh -n $container_name -c "$test_command" -s $src -f $DIR/../dockerfiles/dock...
What is the difference between app engine and cloud endpoints when developing with Android studio? <p>I've been trying to do this for a while, but I'm confused as to the difference between the two applications. </p> <p>I know that endpoints helps you expose an API and generate the client libraries that allow you to in...
<p>The endpoints backend API is just a piece of a GAE app functionality. </p> <p>If you only have that functionality in your app you can extend it by adding the desired stuff to the existing <code>app.yaml</code> file (and the related app code), you don't <strong>have to</strong> create a new app. Especially if the en...
Changing labels with logo images <p>I'm trying to build a graph with <a href="http://www.chartjs.org/" rel="nofollow">chart.js</a> and i would like to replace the labels with logtype small images.</p> <p>Is it possible ? Can't find the way to do it. Thanks.</p> <p>This is my chart options:</p> <pre><code>var horizon...
<p>Adding an image to the labels is a tricky adjustment, and will require fiddling with chart.js code, as it isn't natively supported. My best suggestion is to avoid attempts to add your images to the labels themselves.</p> <p>Best solution for using icons would be one of:</p> <ol> <li><p>Use images of your own, but ...
Successful compiling the Node module and "Module did not self-register." <p>I decided to write a native module for Node using VS2015 compiler and node-gyp under Windows 8.1 32bit. I worked with the instructions from <a href="https://github.com/nodejs/node-gyp" rel="nofollow">this page</a>. I searched the internet (incl...
<p>node-gyp (the tool used to build node addons) tends to make some assumptions, at least when it comes to compiling your source files. For example, it will automatically choose the "right" compiler based on the source file's extension. So if you have a '.c' file it uses the C compiler and if you have a '.cc' file (or ...
Is RectF.centerpoint wrong? <p>I do not understand something. If I have a <code>TRectF</code> with a width of 4 pixels:</p> <pre><code>aRectF := TRectF.Create(TPointF.Create(0,0),4,1); </code></pre> <p></p> <pre><code>X = 0 1 2 3 4 * * * * </code></pre> <p>Why does <code>aRectF.centerpoint.x</code> return 2 i...
<p>The X coordinates span from 0.0 to 4.0 inclusive in the first example. The half way point is at 2.0.</p> <p>For the second example they span from 0.0 to 5.0. The half way point is therefore 2.5. </p> <p>Your mistake is in your belief that the right hand edge is one pixel to the left of where I have described. </p>...
Method call chaining with generic types (Curiously Recurring Generic Pattern) <p>I'm getting a compile error that I don't understand the reason for.</p> <p>I'm trying to create a builder that extends another builder, all using generic types.</p> <p>The problem is that the return type of some generic methods is the pa...
<p>You use raw types, so in first case <code>builder.withChildStuff("childStuff")</code> returns value of <code>BuilderChildStatic</code> (from type parameter bounds) and this value has parent' method <code>withParentId</code>; in the second case <code>builder.withParentId(1)</code> returns value of <code>BuilderParent...
Nil value for latitude when writing to local file <p>In a swift app, I need to write to a local file the latitude of the user. Here is the function is use to write to a local file:</p> <pre><code> func writeToFile(content: String) { let contentToAppend = content+"\n" //Check if file exists ...
<p>The part causing the "unexpectedly found nil" is the force-unwrapping of <code>locations.last</code>. Avoid using <code>!</code> to force unwrap.</p> <p>Your <code>if</code> statement should just check to see if <code>locations.last</code> is <code>nil</code>:</p> <pre><code>if locations.last != nil { writeToF...
sql: how to add a constraint about 'always contains something' <p>I just wanted to know, how to write the constraint on sql server, where it should always contain a <code>'@'</code> sign and a <code>'.'</code>. Should I use check or what? It's about an email actually. </p>
<p>You can create a <code>CHECK</code> constraint like this</p> <p>Using <code>LIKE</code> operator </p> <pre><code>ALTER TABLE Yourtable ADD CHECK (email_col like '%@%.%') </code></pre> <p>Using <code>CHARINDEX</code> function</p> <pre><code>ALTER TABLE Yourtable ADD CHECK (Charindex('@',email_col)&gt;0 AND Cha...
InvalidCastException Casting Dictionary Values <p>I'm trying to load a list of values from a Dictionary. I can iterate through the list and get the values, but get an InvalidCastException </p> <blockquote> <pre><code> Additional information: Unable to cast object of type 'WhereListIterator`1[PumpTubing.Tubing]' to...
<p>I'm not so good at VB syntax (coming from c#), but I guess you meant to use <code>SelectMany</code> instead of <code>Select</code>:</p> <pre><code>Dim tb2 As List(Of Tubing) = pd.pumps.Values. SelectMany(Function(f) f. Where(Function(t) t.Tube.Equals("Tube3"))...
php sendmail doesn't work after I changed the router <p>I'm running a web server that uses PHP sendmail function, which is directly connected to a router and after I replaced my old router to a new router it doesn't work anymore.</p> <p>Old router - Cisco RV082 - regular firmware New router - Netgear R7000 - DD-WRT v3...
<p>Marc B is correct in his comment. This is not the best site for you to be asking this kind of question on. Try the <a href="http://networkengineering.stackexchange.com">Network Engineering Stack Exchange</a> or something similar.</p> <p>Now if this is a PHP issue then yes you have posted to the correct site but nee...
show blog Author , title , label and time in a specific div blogger <hr> <p>For SEO purposes I wanted to copy this blog post design <a href="http://www.th3professional.com/2016/10/blog-post_14.html" rel="nofollow">this website</a> the specific part I want to copy is the div with id="enter-posts" which has the title, t...
<p>You can't use blogger data tags like <code>&lt;data:post.author/&gt;</code> inside the post body or outside widgets. please read <a href="https://support.google.com/blogger/answer/47270" rel="nofollow">Layouts Data Tags</a></p>
Line Counting Function no longer works in Swift 3.0 <p>I had a function that I was using in Swift 2.2 that I never had any problems with, now I'm getting an error when I try to use it.</p> <p>The code is to change the number of lines a UILabel has to accommodate the size of the string.</p> <pre><code>func countLabelL...
<p>It's the <em>font</em>. The problem is this line:</p> <pre><code>let attributes = [NSFontAttributeName: label.font] </code></pre> <p>Try writing this:</p> <pre><code>let attributes = [NSFontAttributeName: label.font!] </code></pre> <p>I think the exclamation mark should fix it.</p>
django urlpattern wrong? need to accept 2 different parameters <p>I'm working on building a django app for a small little game I'm building to integrate it. Instead of re-writing my app to use django's membership system I've added my small little game login system to the django site. My issue is with my ChangePassword ...
<p>Your regex pattern for the token:</p> <pre><code>(?P&lt;token&gt;/?$) </code></pre> <p>Will match an optional forward slash <code>/</code> that <em>ends</em> the url. In other words it will match <code>/members/ChangePassword/11/</code> or <code>/members/ChangePassword/11//</code>.</p> <p>You will need to modify ...
reference and literals in C++ <p>I know that "literals" (c strings, int or whatever) are stored somewhere (in a read only data section apparently .rodata) maybe this is not accurate...</p> <p>I want to understand why this code causes a runtime error:</p> <pre><code>#include &lt;iostream&gt; using namespace std; cons...
<p>I see why this is confusing so I will try to break it down.</p> <p><strong>First case:</strong></p> <pre><code>const int&amp; foo() { return 2; } </code></pre> <p>The return statement makes a <em>temporary object</em> which is a <strong>copy</strong> of the literal <code>2</code>. So its address is either <em...
Only allow site to be viewed through its proper domain <p>I'm hosting multiple sites on the same Apache server (and IP address) using the standard method of virtual hosts. So I have folders like the following: <code>/var/www/website1.com/</code>, <code>/var/www/website2.com/</code>, and so on.</p> <p>I know how to cha...
<p>You need to add a redirect which sends clients to your 'canonical' domain name</p> <pre><code>RewriteCond %{HTTP_HOST} !^example\.com [NC] RewriteRule ^/(.*) https://example.com/$1 [R=301,L] </code></pre> <p>(I don't know anything about 'Laravel', but storing config/private files in web accessible direct...
How to exit the program when a user enters a negative value - Java <p>Scanner input = new Scanner(System.in);</p> <pre><code> System.out.print("How much can you afford for meals per day? Enter it now "); double mealAmount = input.nextDouble(); </code></pre>
<p>This because your tests are performed <strong>only after getting the 3 double values</strong>. You should move the tests corresponding to each variable just after getting its value thanks to <code>input.nextDouble()</code>.</p> <p><strong>Your code should rather be:</strong></p> <pre><code>System.out.print("How mu...
excel 2013 vba range names count not working <p>I am using Excel 2013 and cannot get the count nor a listing of range names. I can open the Names Manager dialog box and the names and ranges are listed. I added the names (List1,List2, and List3) to the workbook using VBA (Set rngTable = c.CurrentRegion.ListObjects.Add)....
<p>Are your named ranges scoped to the worksheet, or the workbook? If they're not limited to a single worksheet, you'll need to reference the workbook.Names collection instead.</p> <pre><code>Set namedRanges = ActiveWorkbook.Names </code></pre>
Mongo DB and Names with special characters <p>I am processing a large text file that has names with an occasional special character. An example would be "CASTAÂ¥EDA, JASON". When I process the file the line comes across as UTF-8. However when the insert to Mongo is about to happen, it shows error:</p> <pre><code>[Mong...
<p>I'd recommend converting all user-input strings <a href="https://nodejs.org/api/buffer.html" rel="nofollow">into a Buffer</a>. Or check for insert/update errors by using <a href="http://stackoverflow.com/questions/21588871/check-if-there-is-an-error-in-update-insert-mongodb-java-driver">ACKNOWLEDGED</a></p> <p><em>...
Change DateFormat from DatePickerDialog using SimpleDateFormat in Android <p>I'm new to Java and Android. I took the following code from different Tutorials on DatePickerDialog (mainly the official one). Now I want the selected date to be in a specific format ("EE, DD.MM.YY") and tried to do this with SimpleDateFormat ...
<p>Try this:</p> <pre><code>SimpleDateFormat simpledateformat = new SimpleDateFormat("EE, dd.MM.yy"); Calendar newDate = Calendar.getInstance(); newDate.set(year, month, day); String selectedDate = simpledateformat.format(newDate.getTime()); </code></pre>
Multiple string search in txt file (java) <pre><code>BufferedReader br2 = new BufferedReader( new InputStreamReader(new FileInputStream(id_zastavky), "windows-1250") ); for (int i = 0; i &lt; id_linky_list.size(); i++) { while ((sCurrentLine2 = br2.readLine()) != null) { String pom = id_link...
<p>during the first iteration of for loop, the whole file will be read and <code>br2.readLine()</code> will always return null for next iterations.</p> <p>Instead of that if the file size is small you could build a map and you can use that map to check the content </p> <pre><code> File file = new File("filename");...
getting null value while parsing json data in android <p>i am trying to parse json data in android app i am able to get title of the book and author but i am not able to parse publisher i am getting null value at publisher </p> <pre><code> "kind":"books#volumes", "totalItems":997, "items":[ ...
<p>It seems that the <code>publisher</code> is contained by <code>volumeInfo</code>. Try:</p> <pre><code>String publisher = volumeInfo.getString("publisher"); </code></pre>
Can i program games with unity by python ?? I don't know c# <p>I want to start 3d games programming , should I start 2d first ? please give me useful course . Does unity accept python ? If not , what do you prefer( directpython, openlg,panda3d ) Please give me useful course . I'm beginner Sorry about my bad English...
<p>If you need pure Python then you have 2D or 3D modules PyGame, Pyglet, PySDL2, Panda3D, etc.</p> <p>But there is also <a href="https://godotengine.org/" rel="nofollow">Godot Engine</a> which has many tools (like Unity) but it doesn't use Python - it use own language similar to Python.</p>
Asterisk AMI tracking the inbound call <p>I have an assignment, and need help in these two points.</p> <p>There is ubuntu 16.04 server, the following task needs to be in PHP</p> <ol> <li><p>tracking the inbound call using Asterisk AMI, when the incoming calls is in place, you need to track how long the conversatio...
<p>Simplest way is issue in dialplan UserEvent with all params you want submit to AMI and track ami event UserEvent.</p>
stacking divs -- mix of vertical and horizontal layout <p>I would like to accomplish a mix of horizontal and vertical layouts.</p> <pre><code>&lt;div&gt; &lt;div&gt; &lt;span&gt;A&lt;/span&gt; &lt;span&gt;B&lt;/span&gt; &lt;span&gt;C&lt;/span&gt; &lt;/div&gt; &lt;div&gt; &lt;span&gt;D&lt;/span&gt...
<p>Give a width of 75 px to the parent div so that after placing 3, 25px elements the next element will be forced to be on the new line. <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override...
rle command counting changes in vector <pre><code>n &lt;- length(rle(sign(z))) </code></pre> <p>z contains 1 and -1. n should indicate the number of how many times the sign of z changes. </p> <p>The code above does not lead to the desired outcome. If I expand the command to</p> <pre><code>length(rle(sign(z))[[1]...
<p><code>rle</code> returns a list consisting of two components: <code>lengths</code>, and <code>values</code>. As such, its own <code>length</code> is always 2. By contrast, you want to know the length of either of those components (they obviously have the same length). So either <code>length(rle(…)[[1]])</code> or ...
geckodriver executable needs to be in path <p>I have read previous questions asked on this topic and tried to follow the suggestions but I continue to get errors. On terminal, I ran </p> <pre><code>export PATH=$PATH:/Users/Conger/Documents/geckodriver-0.8.0-OSX </code></pre> <p>I also tried</p> <pre><code> export...
<p>First we know that gekodriver is the driver engine of Firefox,and we know that <code>driver.Firefox()</code> is used to open Firefox browser, and it will call the gekodriver engine ,so we need to give the gekodirver a executable permission. so we download the latest gekodriver uncompress the tar packge ,and p...
How can I send requests to JSON? <p>I'm coding a mobile application with ionic. I have to get a data (daily changing data) from a web page with JSON, but I want to get old data too. For example:</p> <pre><code>data.json?date=2016-11-10 data.json?data=2016-12-10 </code></pre> <p>How can I send request to JSON?</p>
<p>To send data from PHP, once you get your data from the database, the array will apply <code>json_encode($array);</code> and to return you put <code>return json_encode ($ array);</code></p> <p>Try this!</p> <pre><code>var date = '2016-11-10'; $http({ method: 'GET', url: data.php, params: {date:...
Create anchor tag within unordered list elements with d3js? <p>I wanted to dynamically create anchor tags within an undordered list:</p> <p>Mannually this works:</p> <pre><code>&lt;h2&gt; Without d3 &lt;/h2&gt; &lt;ul id="anotherList"&gt; &lt;li&gt; &lt;a href="http://www.google.com"&gt; &lt;text&gt...
<p>xlink:href is meant for svg use (though it looks like it might be deprecated), if you are adding an href to an a tag just use <code>href</code> <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href" rel="nofollow">https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/xlink:href</a></p> ...
'helloworld.pyx' doesn't match any files <p>I am a beginner in python and I have just got familiar with cython as well. I am using Anaconda on Windows 64-bit. I am trying to run the "helloworld" example as follows:</p> <p>1- I build a helloworld.pyx file containing:</p> <pre><code> print("Hello World") </code></pr...
<p>From here: <a href="https://github.com/cython/cython/wiki/enhancements-distutils_preprocessing" rel="nofollow">https://github.com/cython/cython/wiki/enhancements-distutils_preprocessing</a></p> <pre><code>from distutils.core import setup from Cython.Build import cythonize setup( name = 'MyProject', ext_modules...
Kendo UI Column with Detail Table <p>I am currently displaying a Kendo UI chart with a standard HTML table underneath it. Does anyone know of a way where I can specify each category to be displayed with a specific width? The reason why I would like to do this is because I would like that the category labels match up ex...
<p>Set a width on the <code>td</code>'s of your HTML table equal to the column width of your graph. </p> <p>For example if the columns of your graph are 35px wide, then in your css:</p> <pre><code>td.tableDataBelowMyGraph{ width: 35px; } </code></pre> <p>As it stands, your <code>td</code>'s width are being set by th...
Multiple PouchDB to single CouchDB <p>I need to submit data from multiple mobile apps. in my mobile app I am planning to use pouchdb to store the document, later I want this document to sync to couchdb one-way only. what will happen if I submit data from multiple devices ? will pouch db create same document ID and over...
<p>The document ID will not be the same, assuming you're letting PouchDB create them (the likelihood of PouchDB generating the same ID twice is extremely low)</p>
SQL EXISTS returns all rows, more than two tables <p>I know similar questions like this have been asked before, but I have not seen one for more than 2 tables. And there seems to be a difference.</p> <p>I have three tables from which I need fields, <code>customers</code> where I need <code>customerID</code> and <code>...
<p>You don't have to repeat <code>customers</code> table in the <code>EXISTS</code> subquery. This is the idea of correlation: use the table of the outer query in order to correlate.</p> <pre><code>SELECT COUNT(DISTINCT custID) FROM customers c WHERE EXISTS( SELECT * FROM orders O JOIN lineitems L ON O.or...
(Javascript) Bouncing balls clip into wall <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>document.addEventListener("DOMContentLoaded", function(event){ var context, width ...
<p>I hope this helps. the tricky part is making a convincing "stop".</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>function getCoordinates(event) { return { x: event.offs...
Hive - insert values in array from file (comma and semicolon separated) <p>I have a file with columns separated by semicolons. I want to add a <code>type</code> column as an <code>Array&lt;String&gt;</code>. What I have now is that I store my values raw, just like this (the <code>type</code> column is text):</p> <pre>...
<p>Same data will work. Create table :</p> <pre><code>CREATE TABLE array_data_type( age int, type array&lt;string&gt;, contry varchar(100)) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\;' COLLECTION ITEMS TERMINATED BY ','; </code></pre> <p>Load same data in this table.</p> <p>If this data is in a local ...
Clear Div Content Inside Function <p>I have use 2 functions i want when i click on button it should clear the output of first function result but it doesnot work when i use .innerHTML = ""; how to do it?</p> <pre><code>function HalfRightTriangle() { for (var i = 1; i &lt;=7; i++) { for (var j = 1; ...
<p>If you're only using text, it may be better to just work with a variable, and then set it to innerHTML when done.</p> <p>Something like this:</p> <pre><code>function HalfRightTriangle() { var inner = document.getElementById("result").innerHTML; for (var i = 1; i &lt;= 7; i++) { for (var j = 1; j &l...
Excel macro, search by row return next cell's value <p>I have this Macro already working:</p> <pre><code> Sub ListSheetsValuesAreOn() Dim X As Long, Data As Variant, Uniques As String, SH As Worksheet, NewSH As Worksheet With CreateObject("Scripting.Dictionary") For Each SH In Worksheets Data = Applic...
<p>Few caveats of below solution, I'm using columns A and B as sources, my data is not in need of transposition. </p> <pre><code>Sub Answer() Dim dict As Object Dim Data As Variant Dim ws As Worksheet Dim rng As Range Set dict = CreateObject("Scripting.Dictionary") With dict For Each SH In ...
Any way for tornado handler to detect closure on other end? <p>I have a tornado coroutine hander that looks in part like:</p> <pre><code>class QueryHandler(tornado.web.RequestHandler): queryQueues = defaultdict(tornado.queues.Queue) @tornado.gen.coroutine def get(self, network): qq = self.queryQue...
<p>You want a "queue with guaranteed delivery" which is a hard problem in distributed systems. After all, even if "self.write" succeeds, you can't be certain the other end really received the message.</p> <p>A basic approach would look like this:</p> <ul> <li>each entry in the queue gets an id greater than all previo...
PySpark: How to group a column as a list when joining two spark dataframes? <p>I want to join the following spark dataframes on Name:</p> <pre><code>df1 = spark.createDataFrame([("Mark", 68), ("John", 59), ("Mary", 49)], ['Name', 'Weight']) df2 = spark.createDataFrame([(31, "Mark"), (32, "Mark"), (41, "John"), (42, "...
<p>A DataFrame is equivalent to a relational table in Spark SQL. You can groupBy, join, then select.</p> <pre><code>from pyspark import SparkContext from pyspark.sql import SQLContext from pyspark.sql.functions import * sc = SparkContext() sql = SQLContext(sc) df1 = sql.createDataFrame([("Mark", 68), ("John", 59), ...
Spring mvc, RedirectAttributes not working <p>I am trying RedirectAttributes in my webapp, But some how its not picking up my error message, here is my code and error messages.</p> <p>its MyUtil class </p> <pre><code> @Component public class MyUtil { @Autowired public MyUtil(MessageSource mes...
<p>It looks like the cause is just a typo <code>registerError</code> vs <code>regiterError</code></p> <p><strong>new stacktrace same problem</strong></p> <p>again, you have the same problem: <code>registerError</code> vs <code>regsiterError</code> (wrong order of <code>i</code> and <code>s</code>)</p>
Mongoose & MongoDB: Retrieve results narrowed by multiple parameters <p>I need to get data from MongoDB that is first narrowed by one initial category, say '{clothing : pants}' and then a subsequent search for pants of a specific size, using an array like sizes = ['s','lg','6', '12'].</p> <p>I need to return all of th...
<p>The mongoose queries can receive object like Mongodb would. So you can pass the search parameters separated by <code>,</code></p> <pre><code>Product.find({categories:req.body.category, size:{$in:['s','lg','6', '12']}}) </code></pre> <p>For more information on $in, check <a href="https://docs.mongodb.com/manual/ref...
Running a program in linux (debian) on startup <p>I would like to point out that I tried A LOT of different tutorials from the internet but they don't seem to work...</p> <p>Adding stuff to init.d, rc.local etc. for some reason it doesn't work.</p> <p>I'm really desperate to get this done, but I'm a total noob when i...
<p>The simplest way is to drop in a new cronjob (a cronjob is a task that is scheduled to run at a particular time):</p> <pre><code>crontab -e </code></pre> <p>This allows you to edit your cron file. Instead of putting in a time, use <code>@reboot</code>. So you should have a new line in your cronjob file that looks ...
Which fopen() mode should i use when working with a .wav file? <p>I am using <code>fPointInput = fopen(fileName, "r");</code>, when trying to access the data chunk inide the .WAV file but never getting any comprehensible results. (Data array is filled mostly with zeroes except the first few hundred indices). Can this b...
<p>This <a href="http://truelogic.org/wordpress/2015/09/04/parsing-a-wav-file-in-c/" rel="nofollow">article</a> indicates that using <code>rb</code> works well. Note that nothing in this answer is <code>Windows</code> specific. Just standard <code>C</code> IO.</p>
Session variable is not sent in Laravel 5 <p>I have a Laravel Application, and something strange is happening related to the session variables. I have a method in a controller that checks some inputs and depending of some conditions it decides if continues or just return back (and right here where is my problem), when ...
<p>Its' working for me when I tested. Maybe your session is not storing data. Please check whether your session is working or not. My tested output</p> <pre><code> @if ( Session::has('msg') ) {{ session('msg') }} @endif </code></pre> <p><a href="https://i.stack.imgur.com/tiLys.png" rel="nofollow"><img s...
Running ASP.NET app in VS 2015 debugger with firefox throws login failed for user: NT AUTHORITY/ANONYMOUS LOGON <p>The debug session with VS2015 on my developer workstation works with chrome and connects to the external SQL Server 2012 database from my web app. I cannot figure out why firefox causes this error while i...
<p>I found in another post that someone set impersonation to false in their web.config.</p> <p>I just changed the impersonate setting from true to false and now its working on firefox in the debugger</p> <p></p> <p>I am baffled....Does anyone know why this would be the case? thanks! Kevin</p>
Reusing cell doesn't work well - TableView <p>I have a problem about my cell's button. In my tableView each row is composed by: an image, some labels and a button. The button has a checkmark image. When it is clicked, the button's image changes. The problem is that also another button's image changes without reason. Th...
<p>From the information in your post, this looks like a cell reuse issue. The problem is that the <code>tableView</code> reuses the cells rather than creating new ones, to maintain performance. If you haven't reset the cell's state, the reused cell will be remain configured in the old state.</p> <p>For a quick fix, yo...
Can I use native mqtt to connect to my mqtt broker without the use of websockets? <p>I have a mqtt broker which does not support websocket connection. I need to write an HTML webpage that will connect to the broker and publish a message string on it. Is it possible to not use websockets through my web page and still co...
<p>No, you can not connect to anything from with in a browser with anything other than HTTP or WebSockets.</p> <p>A possible solution is to set up a separate WebSockets to MQTT bridge between the web page and the broker.</p>
Ionic2 ion-slides change navbar title <p>I'm trying to change the navbar title using the slides. When swiping through a next slide, how can I achieve this? I tried:</p> <pre><code>onSlideChangeStart(slider) { this.app.setTitle('title1'); } </code></pre> <p>But it just sets the title in the browser, not in the ion-tit...
<p>What about using a variable to set the title?</p> <pre><code>import { ViewChild } from '@angular/core'; @Component({ templateUrl:"home.html" }) export class YourAwesomePage { @ViewChild('mySlider') slider: Slides; public title: string; // ... constructor() { this.title = 'Initial title'; // ......
Attempt to invoke interface method on a null object reference <p>I have class <strong>LoadJSONTask</strong>. In this class I am getting the error below. My application is running but when I try to add progress bar in the code its not working.</p> <pre><code>E/AndroidRuntime: FATAL EXCEPTION: main Process...
<p>I think your issue is on this line</p> <pre><code>dwBar = (ProgressBar) activity.findViewById(R.id.progress_bar); </code></pre> <p>because you are using the activity class instance to obtain a reference to your ProgressBar View widget</p> <p>You should inflate a layout that contains the ProgressBar widget and use...
Image format dropdown when using <input type=“file”>? <p>I'd like to restrict the type of file that can be chosen from the native OS file chooser when the user clicks the Browse button in the element in HTML. I have a feeling it's impossible, but I'd like to know if there is a solution. I'd like to keep solely to ...
<p>You can only do something like this</p> <pre><code>&lt;form:input path="image" type="file" accept="image/gif, image/jpeg, image/png" style="display: none;"/&gt; </code></pre> <p>But this won't give you the list you're looking for.</p> <p>Note that this only provides a hint to the browser as to what file-types to ...
Animating UIScrollView rightwards <p>How to create an animation that moves/scrolls a seeable image section at an uniform speed rightwards? OR rather: How to animate UIScrollView rightwards?</p> <p>Example: The image width is 4968 px. The image is used as a fullscreen background image. Only the first 1242px of the 4968...
<p>You can animate its <code>contentOffset</code> property</p> <pre><code>@IBOutlet weak var scrollView: UIScrollView! override func viewDidAppear(animated: Bool) { // This code scrolls to the point (x: 4000, y:0) in 5 seconds UIView.animateWithDuration(5) { [unowned self] in self.scrollView.contentOf...
Why would a function output different results when executing as a SQL Server CLR UDF? <p>I'm using a .Net DLL to hash strings so later I can compare them.</p> <p>I've wrapped the call to that function inside a SQL Server CLR UDF and published on the server.</p> <p>Now, when I execute the function the output is differ...
<p>Once I managed to debug the UDF running on SQL Server I was finally able to figure out that the algorithm I'm using to hash a given string relies on .net's <strong>GetHashCode</strong> method.</p> <p>And at least for the <strong>String</strong> class, as per <a href="http://stackoverflow.com/questions/15174477/how-...
change an object variable from other object(delegation) <p>I am using python to implement something like following. </p> <p>sample1.py</p> <pre><code>Class D: def __ini__(self): return def disconnect(self): ## I want to change isConnected in A, but I can not do something like A.isConnected ...
<p>I'm unclear on your objective. Sounds like you want to edit a variable before it is created. </p> <p>If that is not the case, you should be able to change A.isConnected with the following code: </p> <p><code>A.isConnected = True</code></p>
how can I construct my mongoose query so that at least one of two statements is always taken under consideration? <p>In my application user can add entry that is visible </p> <p>This is my mongoose query:</p> <blockquote> <p>Mongoose: test.find({updated_at: { '$gte': new Date("Fri, 14 Oct 2011 00:00:00 GMT"), '$l...
<p>You should try both queries inside $or as below:</p> <pre><code>test.find({'$or': [ { myFlag: false }, {updated_at: { '$gte': new Date("Fri, 14 Oct 2011 00:00:00 GMT"), '$lte': new Date("Fri, 14 Oct 2016 20:12:14 GMT") }, username: { '$in': [ 'XXXXXXXXX', 'YYYYYYYYYYYYYY' ] } ] }) </code></pre> <p>Hope this hel...
Php block access without redirected .htaccess <p>With htaccess im redirecting:</p> <pre><code>RewriteRule ^secure/ login.php [NC,L] </code></pre> <p>I only want people to be allowed to visit: <code>website.com/secure/</code> But not: <code>website.com/login.php</code></p> <p>Anyone got an idea how to do this? Possi...
<p>You can use:</p> <pre><code>RewriteEngine On # block direct access to /login.php # RewriteRule ^ - [F] line sends status 403 when RewriteCond succeeds. RewriteCond %{THE_REQUEST} /login\.php[\s?/] [NC] RewriteRule ^ - [F] # internally rewrite /secure to /login.php RewriteRule ^secure/?$ login.php [NC,L] </cod...
Getting an error in a Do Loop <p>This is a small bit of code which has the error I am having. The SQL Statement at the begginning is this</p> <pre><code>sqlStr = "SELECT Computer, Room_Num, Speed, Num_CPUs, OS_Type, HDD_Size FROM Computers WHERE Num_CPUs = 1 OR Speed &lt; 2.1 OR HDD_Size &lt; 300 ORDER BY Room_Num" ...
<p>In your query:</p> <pre><code>sqlStr = "SELECT Computer, Room_Num, Speed, Num_CPUs, OS_Type, HDD_Size FROM Computers WHERE Num_CPUs = 1 OR Speed &lt; 2.1 OR HDD_Size &lt; 300 ORDER BY Room_Num" </code></pre> <p>You bring through the following fields, <code>computer, room_num, speed, num_cpus, os_type, and hdd_siz...
Vue JS use array to filterBy another array? <p>Yep, it's me again. I'm trying to filter an array based on an array of strings. So while a single string filter is easy with Vue...</p> <p><code>&lt;div v-for="item in items | filterBy 'words' in 'property'"&gt;</code></p> <p>...multiple search strings becomes more compl...
<p>I would use a computed property instead of a filter and a method.</p> <p>I'd go through each cast member and if any of their groups is in <code>selected_groups</code> I'd allow it through the filter. I'd so this using <code>Array.some</code>.</p> <pre><code>results: function() { var self = this return self.cas...
How to display values with decimal places in Grafana with elasticsearch datasource? <p>I am trying to visualize time series data stored in elastic search using grafana. I have the legend setup to show 2 decimal places but it does not reflect in the UI. <p> The decimal places show up for other dashboard panels with a ts...
<p>Just found out that elastic search does not allow displaying values without some sort of aggregation and in my case aggregation is resulting in values getting rounded.</p> <p>There was a related request which seemed to not get much traction in kibana. <a href="https://github.com/elastic/kibana/issues/3572" rel="nof...
Cannot set bartintcolor on iPhone 6 plus <p>So my problem is that I cannot set the bar tint color on an iPhone 6 plus. I can set the bar tint color for all other devices but for the iPhone 6 plus the bar tint won't change. Here is the code for the view controller. Additionally, this VC is being pushed onto the stack by...
<p>Ok so I solved the issue. For some reason, iPhone 6 plus calls </p> <pre><code>override func viewWillLayoutSubviews() { super.viewWillLayoutSubviews() navigationController?.navigationBar.barTintColor = .primaryGrayColor() navigationController?.navigationBar.translucent = false navigationController?....
Painting on a JPanel from a different class in Swing <p>I am currently working on a test driven interactive 2D fluid dynamics simulation for my Bachelor thesis. The basic idea is that the user can draw shapes on his screen and the program will simulate how a fluid will flow around these shapes. So far I have only start...
<p>You need to do all the of painting in the various Swing paint methods that are designed to be overridden for custom painting (such as <code>paintComponent</code>). Only Swing will know when it's done drawing, or when a new frame needs to be drawn to.</p> <p>What it really seems like you need to do, is to have your ...
Drupal 8.2.x text editor stripping-removing "div classes" <p>I have a problem with Druapl 8.2.1 text editor and CKeditor, system keeps stripping - removing classes from " <p>And example of this:</p> <pre><code>&lt;div class="social clearfix"&gt;&amp;nbsp;&lt;/div&gt; </code></pre> <p>System renders:</p> <pre><code>...
<p>Ok, well after breaking my head thinking and re thinking in all I have already done I just did what it was left to do.</p> <p>Since there is no way to modify the allowedContent in Drupal version 8.2.x... what I did before it was to create a "New text format and editor" but I had selected the option "Limit allowed H...
Dependency injection inconsistency in differing ViewControllers in Swinject, post Swift 3.0 update: why? <p>I am registering some <code>Swinject</code> singleton-with-a-small-s (.container) services thus:</p> <pre><code>defaultContainer.register( SomeService.self ) { _ in SomeService() }.inObjectScope( .container...
<p>In order for <code>registerForStoryboard</code> to be invoked you need to instantiate given controller from <code>SwinjectStoryboard</code>, not just <code>UIStoryboard</code>:</p> <pre><code>let anotherViewController = SwinjectStoryboard.create(name: "Main", bundle: nil) .instantiateViewController(withIdentifi...
How is this C++ code working with an unusual single boolean statement? <p>Why and how does this code work?</p> <pre><code>#include &lt;iostream&gt; using namespace std; void nothing() { false; } int main() { cout &lt;&lt; "Working" &lt;&lt; endl; nothing(); cout &lt;&lt; "It worked!" &lt;&lt; endl; ...
<pre><code>false; </code></pre> <p>is a valid statement in C++. It doesn't do anything useful but it is still valid. Most compilers will probably remove that line from the object code they create for the function.</p> <p>Some compilers, with the right compiler flags, will let you know that the statement has no effect...
How to be changed this code <div></div data-isloaded="true"> <p>i'm new in jquery plz help me to change this code</p> <pre><code> &lt;div&gt;&lt;/div data-isloaded="true"&gt; </code></pre> <p>to this code </p> <pre><code> &lt;div&gt;&lt;/div data-isloaded="false"&gt; </code></pre> <p>with jquery</p>
<pre><code>$('div[data-isloaded="true"]').attr('data-isloaded',false) </code></pre>
UISplitViewController should be root, so how to "push" the real starting view on top? <p>My app design is very simple, at least with respect to describing the intended user-facing views:</p> <p>The starting view is initially empty. Pressing a "Select" button in the navigation bar transitions to a split view. On the le...
<p>If all you want is to pass back to the starting view controller the array of images, than why not just declare a protocol in the Split ViewController that the starting controller can adopt? </p>
asp.net mvc redirecttoaction does not shows another page <p>I am writing a simple MVC application in which I use a form to put some data, and after I submit the form, if a particular condition is <code>false</code> I would like to show the form again, otherwise I would show another page. When the condition is false, I...
<p>If you want to show the same form, you should not return a <code>RedirectResult</code>. you should call the <code>View</code> method. Also you should do the condition checking inside the http post action method which handles the form submission.</p> <pre><code>[HttpPost] public ActionResult CheckCondition(FormColle...
How do I store the shifted bit in a bitwise operation in C? <p>I was trying to make a simple function to check how many bits set to 1 were in an int.</p> <p>What I achieved at first was </p> <pre><code>#include &lt;stdio.h&gt; int bitsOne (int x){ int r=0; while (x &gt; 0){ if (x % 2 == 1) r++; ...
<p>Get the bit in the last slot before you do the shift using a mask:</p> <pre><code>int bit = (x &amp; 1); </code></pre> <p>Then do the shift on x.</p>