input
stringlengths
51
42.3k
output
stringlengths
18
55k
.net core package dependencies <p>I'm wanting to build a native .NET Core executable that I can deploy but when I publish the project, the compiler exports all the dependencies into the same directory and the executable needs them to run on a system that doesn't have .NET Core runtime installed. Is there a way to compi...
<p>For merging dependencies into the compiled assembly, check out Costura for Fody: </p> <p><a href="https://github.com/Fody/Fody" rel="nofollow">https://github.com/Fody/Fody</a></p> <p><a href="https://github.com/Fody/Costura" rel="nofollow">https://github.com/Fody/Costura</a></p> <p>I've used it before, and it wor...
Application authentication azure best field to reference user in local database <p>I begin to test an asp.net mvc application with authication based on azure. The application is declared in azure and work properly. Now i need to store in my application data link to the connected user. What is the best field to use in ...
<p>Sorry for the confusion.</p> <p>I find the answer. The objectid seems to be the more appropriate way to identify user and store in local database information about user. This <a href="http://stackoverflow.com/questions/32510679/getting-users-token-subject-identifier-sub-from-within-azure-ad">link</a> explain the wa...
Shell script to check if process is running everyday <p>Can someone please let me know how to complete the scenario below:</p> <p>I have 3 processes (TC_ME, PS_ME, and NM_ME) running on a machine. When these services go down, they do not send out any alert or mail.</p> <p>I would like to write a shell script based ou...
<p>you can try this; </p> <pre><code>#! /bin/bash while : do RESULT=`ps -ef | grep "TC_ME\|PS_ME\|NM_ME" | grep -v 'grep' | grep -v $0 | wc -l` if [ "$RESULT" != "3" ]; then echo `date` ": some of your processes not running" else echo `date` ": processes runs" fi sleep 1...
Compare one column data with another column data within same table in sql server <pre><code>Id1 Id2 20441 20441 20441 26397 20441 37631 20441 82693 20441 1015597 37631 20441 37631 36551 37631 37631 </code></pre> <p>I have data in a table as above, i would like to mark as <strong>IsDeleted</strong...
<p>Case should work for your requirement,unless i am missing some thing</p> <pre><code>select *, case when exists(select 1 from table t2 where t1.id2=t2.id1) then 1 else 0 end 'Deleted' from table t1 order by id1 </code></pre> <p>Your required output is also wrong( for example,1015597 not exists,so it will be zero...
Export webcal from a Facebook page I administrate <p>from my private Facebook profile I created a page for the <a href="https://www.facebook.com/slotcarfreundemagdeburg" rel="nofollow">club</a> I'm a member of. I now want to export all the events created on the page to a google calendar via the webcal-link. There are m...
<p>Based from this <a href="http://webapps.stackexchange.com/questions/22491/import-sync-google-calendar-events-with-facebook-page">thread</a>, you can get the xml link to your Gcal in the individual calendar's settings(hover over the calendar's name in the sidebar, click the arrow that shows up, and choose "Calendar s...
Getting "Auth cancel" when authenticating using password with JSch <p>I'm trying to execute a Unix command from Java. I'm using the JSch library.</p> <p>Here's my code:</p> <pre><code>try{ Session session = new JSch().getSession("*****", "****", 22); session.setPassword("****"); java.util.Properti...
<p>You have a keyboard interactive authentication set as preferred authentication method (it's the default).</p> <p>Yet, you do not implement a prompt for credentials. The <code>setPassword</code> is not (and cannot) be used for the keyboard interactive authentication.</p> <p>If you actually want to use a password au...
Is there any way I can direct focus to a specific input field on a form? <p>I have a large form and I would like when the user clicks a "new" button for the focus to be placed in a specific input field. There's a grid on the form and every field has a known id. Note it might not be the first field so not easy to use th...
<p>Here is one solution - </p> <p>Angular js gives you an advantage of using some of the extra features so that you dont have to use the jquery.</p> <p>Here is one way to implement the <strong>autofocus</strong> feature.</p> <pre><code>&lt;div class="button" input-focus&gt;{{element.idORname}}&lt;/div&gt; </code></p...
Calling a method (server code) from another's method stub (client code) <p>For performance reasons, I want to call a Meteor method from another's method stub (client-only code), but I want the called method to run on server-side too</p> <p>Seems like <code>methodBar</code> below runs only on client-side. Is this by de...
<p>Meteor seems really stubborn in separating client and server in methods! </p> <p>I could make it loose the awareness of <code>methodBar</code> being called by <code>methodFoo</code> via a Tracker dependency. Fight fire with fire and Meteor with Meteor :)</p> <pre><code>const barNeedsToRun = new Tracker.Dependency;...
Logging remote ip address in Wildfly 10 <p>How can I make wildfly 10 log the request source IP Address? I'm using the default logger. My pattern is:</p> <pre><code>%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %X{IP} [%c] (%t) %s%e%n </code></pre> <p>I tried "%a" from some old version 7 documentation but to no avail. Also that %X...
<p>You could use something like <code>%X{IP}</code>, but you'd have to set the <code>MDC</code> value before your log statement and then clear it afterwards. The majority of the logs would have an empty entry for this as they likely don't have an HTTP request associated with them.</p> <p>If you're using a logging fram...
mod_rewrite rewrite folder to domain <p>Hi I have two domains running on the same Apache server.</p> <p>What I would like to do is rewrite <code>www.domain1.com\folder</code> to <code>domain2.domain1.com</code> .</p> <p>I have have put this in the <code>.htaccess</code> file in <code>\folder</code> dirctory. </p> <...
<p>mod_rewrite assumes the redirection is external because the target is not the same virtualhost, it is external and rewrite internally does not apply for "external targets" what you really need is to reverse proxy, change the rewrite to this:</p> <pre><code>RewriteRule ^(.*) http://domain2.domain.com$1 [P,L] </code>...
Using webcam with Javascript to take snapshots <p>making a page to take snapshots with the webcam. but suddenly it stopped working on every computer. Did i make a typo i cant see myself, or does anyone has an idea too fix this??</p> <ul> <li><p>added the draw in bit aswell</p> <pre><code>// Put event listeners into p...
<p>You never draw your video to the canvas in this part of the code. </p> <p>Also, <code>navigator.getUserMedia</code> is not the "<em>standard</em>" anymore, it has been updated to <code>navigator.mediaDevices.getUserMedia</code> which will return a Promise.</p> <p><div class="snippet" data-lang="js" data-hide="fals...
Springboot + spring data Mongo <p>I'm using in my Project the springboot 1.4.0.RELEASE and I put in my pom the next dependency:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-data-mongodb&lt;/artifactId&gt; &lt;/dependency&gt; </c...
<p>I'm sure yes. These are the <a href="http://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#new-features.1-9-0" rel="nofollow">news in the 1.9</a>:</p> <blockquote> <ul> <li><p>The following annotations have been enabled to build own, composed annotations: @Document, @Id, @Field, @Indexed, @Comp...
Python - replace a line by its column in file <p>Sorry for posting such an easy question, but i couldn't find an answer on google. I wish my code to do something like this code:</p> <pre><code>lines = open("Bal.txt").write lines[1] = new_value lines.close() </code></pre> <p>p.s i wish to replace the line in a file wi...
<p>xxx.dat before:</p> <pre><code>ddddddddddddddddd EEEEEEEEEEEEEEEEE fffffffffffffffff with open('xxx.txt','r') as f: x=f.readlines() x[1] = "QQQQQQQQQQQQQQQQQQQ\n" with open('xxx.txt','w') as f: f.writelines(x) </code></pre> <p>xxx.dat after:</p> <pre><code>ddddddddddddddddd QQQQQQQQQQQQQQQQQQQ ffffffffff...
Java Reflection: Code runs fine in Debugger but not in "normal" running mode <p>I'm trying to call a static Method from an Array of Methods. This works just fine in the debugger but not in normal running mode.. Why is this? </p> <p>More description in code comments below.. </p> <p>EDIT for easier reproduction just ru...
<p>Consider the <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getMethods--" rel="nofollow">documentation of <code>Class.getMethods()</code></a>:</p> <blockquote> <p>…</p> <p>The elements in the returned array are not sorted and are not in any particular order.</p> </blockquote> <p>T...
Combinations - pairing up people from array <p>I've got a combinations question. I have designed this "Secret Santa" app that lets users join gift-groups in which they exchange gifts for a set dollar amount. When a user logs in, he can see all the groups he is in, along with the members in each group. Now, I want to de...
<p>Lets <code>n</code> - number of persons in a group So just make pairs of <code>{persons[i], persons[(i+1)%n]}</code> for all persons</p>
Displaying search results using mysqli multiquery <p>How can i display search results using mysqli multiquery. I want to display values from my listing-details table and from my user table. Here is my code:</p> <pre><code> $searchquery="SELECT * FROM `listing-details` WHERE `listing-address` LIKE '%" . ...
<p>Like many learners, you are using the wrong tool, simply because you don't know the proper one.</p> <p>You need not a multiquery (which you never actually need anyway) but a <strong>JOIN</strong>.</p> <p>Simply rewrite your two monster queries to a join like this</p> <pre><code>$searchquery="SELECT l.*, u.`user-u...
Bash script echo and no need to press ENTER <p>Edit : Current code</p> <pre><code>#!/bin/bash check=0 while [ $check -ne 1 ]; do ping -c 1 192.168.150.1 &gt;&gt; /dev/null if [ $? -eq 0 ];then echo -ne "\nClient is up! We will start the web server" touch /etc/apache2/httpd.conf...
<p>I suspect your issue is related to using <code>echo -ne '\n...'</code> instead of simply <code>echo '...'</code>. However, your whole code can be simplified greatly:</p> <pre><code>#!/bin/bash while :; do until ping -c 1 192.168.150.1 &gt; /dev/null; do echo "Waiting for client to come online" done...
jQuery displaying incorrect JSON result <p>jQuery Code:</p> <pre><code>for (var i = 0; i &lt; data.length; i++) { console.log(data); list += '&lt;div class="col-sm-12"&gt;&lt;div class="product-view row" style="border-bottom:1px solid #eee;margin-bottom:20px;padding:20px 0px 20px 0px;background:#f1f1f1"&gt;&lt...
<p>Becuase your JSON is wrong. You do not have an Array, you have a string.</p> <pre><code>"StartTime":"[\"9:00pm\"]" </code></pre> <p>It should be</p> <pre><code>"StartTime": ["9:00pm"] </code></pre>
Can not select my 'deployment projects' (VSTS projects) in Azure <p>I have successfully linked my Azure account to my Visual Studio Team Services (VSTS) account. Next I wanted to configure in Azure a deployment for one of my VSTS project (ASP.NET MVC). </p> <p>After choosing VSTS as source, Azure required to choose a ...
<p>That feature is used for git repository, so there must be a git repository in a team project of your VSTS. </p> <p>You can create a new team project with git version control system or a new git repository in a team project with TFVC version control system.</p> <p><a href="http://i.stack.imgur.com/otzVw.jpg" rel="n...
SharePoint Dispose SPWeb , SPSite and objects <p>I need an advice on sharepoint logs related to disposing objects.</p> <p>I was looking in the logs and found these : </p> <p><strong>Unexpected Detected use of SPRequest for previously closed SPWeb object.</strong> Please close SPWeb objects when you are done with all ...
<p>I would capture the ID of the item you want to delete in collection of numbers. An array or list of objects should suffice.</p> <p>Then after your foreach check if your collection contains any ID's. then do your </p> <pre><code>for(int i = 0, i &lt; collection.count(), ++i){ #get your item #delete your item #...
How to Upload iPhone Videos to server using Alamofire in iOS Swift? <p>When I record video on iPhone, I would like to press <strong>use video button</strong> to upload video and post other parameters to server using <strong>Alamofire</strong> in iOS <strong>Swift</strong>. How I can do it?</p> <p><a href="http://i.sta...
<p>try this</p> <pre><code> Alamofire.upload(.POST, API_URL, multipartFormData: { (formData:MultipartFormData) in formData.appendBodyPart(fileURL: NSURL(fileURLWithPath: filePath), name: name) }, encodingCompletion: { encodingResult in switch encodingResult { case .Success(let up...
SOAP:Cannot make call to the remote method.Remote host did not respond <p>I am accessing a <code>https</code> Webservice through a jar, the service gets created and port also get instantiated but when trying to call the remote method of the Web Service ,it throws the following error.</p> <pre><code>com.sun.xml.interna...
<p>Finally Resolved the issue, the endpoint that was getting used was different than the url where the wsdl was located.Managed to override the same with the URL that had the wsdl and it worked.(Point to note,i was using a dynamic URL to locate wsdl).Below is the code to set endpoint .</p> <pre><code>BindingProvider b...
Backbone Marionette focus event <p>I want to use focus/blur events to show/hide an area containing a textarea.</p> <p>In my template:</p> <pre><code>&lt;div class="area"&gt; &lt;textarea/&gt; &lt;div class="actions"&gt; &lt;div class="action"/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>In my ...
<p>The solution I found is to add <code>tabIndex</code> and make <code>div.area</code> as a form component:</p> <pre><code>&lt;div class="area" tabIndex="0"&gt; &lt;textarea/&gt; &lt;div class="actions"&gt; &lt;div class="action"/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre>
Detect mouse click on SELECTION Editable ComboBox JavaFX <p>The question may seem pretty easy at first, but I've already had troubles with it for a few days.</p> <p>So, my problem is that I would like to detect mouse click AND the selection when the ComboBox selection is open and the mouse click is made to choose the ...
<p>Just use a cell factory, and register a handler with the cell:</p> <pre><code>import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.ComboBox; import javafx.scene.control.ListCell; import javafx.scene.layout.StackPane; import javafx.stage.Stage; public class ComboBoxMouseClic...
Why is generic type in some expressions is matched as obj in F# pattern matching? <p>I have the following code:</p> <pre><code>type Message&lt;'a&gt; = | Message of 'a let handleMessage message = match box message with | :? Message&lt;_&gt; -&gt; printfn "Message" | _ -&gt; printfn "Not message" let hand...
<p>Whenever you see <code>_</code> as a type parameter, think of it as a fresh type parameter that you don't care about. If we tweak your first definition accordingly:</p> <pre><code>let handleMessage message = match box message with | :? Message&lt;'_a&gt; -&gt; printfn "Message" | _ -&gt; printfn "Not m...
Optimum allotment of hotel rooms based on price <p>This is not a homework question. This is a problem we are facing while building an online product. Wish if someone could tell me if this is a general algorithm problem. </p> <p>Suppose I have a configuration of 4 rooms:<br> 1st room- 2 people - 800<br> 2st room- 3 peo...
<p>As Richard correctly stated in the comments, this is similar to Knapsack. However, it's very easy to adapt the <a href="https://en.wikipedia.org/wiki/Knapsack_problem#Computational_complexity" rel="nofollow">pseudo-polynomial dynamic programming solution from it</a>.</p> <p>Say you have <em>n</em> rooms and <em>m</...
How does Unary Operator '&' work <p>How does the unary operator '&amp;' work ? </p> <p>In a test project i ran this code:</p> <pre><code>int num = 50, num2 = 100; int x = num &amp; num2; </code></pre> <p>result: x = 32 </p> <pre><code> int num = 100, num2 = 90; int x = num &amp; num2; </code></pre> <p>result :...
<p>From <a href="https://msdn.microsoft.com/en-us/library/sbf85k1c.aspx" rel="nofollow">MSDN</a>:</p> <blockquote> <p>Binary &amp; operators are predefined for the integral types and bool. For integral types, &amp; computes the logical bitwise AND of its operands. For bool operands, &amp; computes the logical AN...
How do I migrate data from one Cassandra database to another? <p>I have two Cassandra databases in two different hosts. Both have tables with the exact same definition. How do I migrate data from one to the other?</p> <pre><code>SparkConf sparkConf = new SparkConf().setAppName(App.APP_NAME) .set("spark.cassandra.c...
<p>From the <a href="http://datastax.github.io/spark-cassandra-connector/ApiDocs/2.0.0/spark-cassandra-connector/#com.datastax.spark.connector.japi.RDDAndDStreamCommonJavaFunctions$WriterBuilder" rel="nofollow">docs</a>, there is a method </p> <pre><code>def withConnector(connector: CassandraConnector): WriterBuilder ...
ObservableInt not updating in BindingAdapter <p>I have this observable int with proper setter and getter on my POJO class object:</p> <pre><code>private ObservableInt pressure = new ObservableInt(); public ObservableInt getPressure() { return pressure; } public void setPressure(ObservableInt pressure) { this...
<p>You don't really need a POJO for this. Just create your view model with the bindable property you need. <code>ObservableInt</code> does everything for you and is handled as if it was an <code>int</code>.</p> <pre><code>public class Pressure { public final ObservableInt value = new ObservableInt(); } </code></pr...
How can I return inserted ids for multiple rows in SQLite? <p>Given a table:</p> <pre><code>CREATE TABLE Foo( Id INTEGER PRIMARY KEY AUTOINCREMENT, Name TEXT ); </code></pre> <p>How can I return the ids of the multiple rows inserted at the same time using:</p> <pre><code>INSERT INTO Foo (Name) VALUES ('A'), ...
<p>This is not possible. If you want to get three values, you have to execute three INSERT statements.</p>
AngularJS : Injecting Service in app.run <p>I want to initialize a globle variable "$rootScope.SegmentSelectedGlobal" at the starting of application only. This globle variable get data from a service. If i execute service through controller, its working fine. But when i execute it from App.run, no value is being assing...
<p>It returns <code>undefined</code> because at <code>return allSegements</code> <code>allSegements</code> is undefined.</p> <p>Your using a promise, yet your forgot to return it properly</p> <pre><code>app.service("DashboardService",function($q,$http,errorMessages){ var allSegements = []; return { ...
Features are missing installing MS SQL SERVER 2016 with SQL Server R Services using web installer and command line <p>I am trying to install MS SQL SERVER 2016 with SQL Server R Services using web installer and command line. I am doing this based on this article <a href="https://msdn.microsoft.com/en-us/library/mt695...
<p>It seems your INI file asks SQLServer to install only few features like SQLEngine and analytics.</p> <p>when you specify </p> <pre><code>FEATURES=SQL,Tools </code></pre> <p><a href="https://technet.microsoft.com/en-IN/library/dd239405(v=sql.110).aspx" rel="nofollow">SQL will install</a>..</p> <blockquote> <p...
SQL Management Studio 2012 with Excel vba connection string set up <p>I would like to set up a vba code that would connect to sql management studio 2012 a run the query, which I would specify in the vba code. I have read every similar question here on stack overflow but when I try to replicate them, I always get an err...
<h3>Authentication</h3> <p>If you're connecting to SQL Server, you should prefer Windows Authentication if that's available: you create a <em>Login</em> at server level for a group of Active Directory users, and then you create a Windows-Authenticated <em>User</em> in your database using that login.</p> <p>That way...
Python regex words boundary with unexpected results <pre><code>import re sstring = "ON Any ON Any" regex1 = re.compile(r''' \bON\bANY\b''', re.VERBOSE) regex2 = re.compile(r'''\b(ON)?\b(Any)?''', re.VERBOSE) regex3 = re.compile(r'''\b(?:ON)?\b(?:Any)?''', re.VERBOSE) for a in regex1.findall(sstring): print(a) print("--...
<p>Note that to match <code>ON ANY</code> you need to add an escaped (since you are using <code>re.VERBOSE</code> flag) space between <code>ON</code> and <code>ANY</code> as <code>\b</code> word boundary <em>being a <strong>zero-width assertion</em></strong> does not consume any text, just asserts a position between sp...
Angular2 ngModel undefined with <input> tag <p>I'm using Angular2 and a forked version of Semantic-UI (that includes calendar module). I'm using <code>calendar</code> and <code>dropdown</code> features:</p> <pre><code>constructor() { setTimeout(() =&gt; { jQuery('.ui.dropdown').dropdown(); jQuery('...
<p>For some unknown reason <strong>[(ngModel)]</strong> is not getting updated. </p> <p>But if its a matter of getting date only, you could use <strong>#templateVariable</strong> as shown here.</p> <p><strong>Working DEMO : <a href="https://plnkr.co/edit/X8Gjwzd62DvYN1S8jrFv?p=preview" rel="nofollow">https://plnkr.c...
Recreate iOS 10 search bar like in the Maps application <p>I'm new to iOS development and I'm trying to recreate the look and feel of the search bar in the Maps application on iOS 10.</p> <p>I have manage to create the search bar and make it work. The problem is that I can't change the title for the little bar above t...
<p>If I understand this right, your 'title' on top of the input text field is an image ? If that's it, you should definitively change it to a label, and your problem is solved.</p> <p>EDIT:</p> <p>You should get ride of the prompt, and add your UISearchBar into a view. Then you can add an image for the bar into that ...
save image / file information in a mysql database <p>I wrote this code to upload the informations of files in my mysql database:</p> <pre><code>&lt;?php require __DIR__ . '/database.php'; $file = $_GET["item"]; $itemName = $_GET["itemName"]; $uploadDate = filectime($file); $filePathArray = pathinfo($file); $filePat...
<p>You must add the enctype attribute to your form :</p> <pre><code>&lt;form method="post" action="upload_action.php" enctype="multipart/form-data"&gt; Item Name:&lt;br&gt; &lt;input type="text" name="itemName"&gt;&lt;br&gt; File:&lt;br&gt; &lt;input type="file" name="item"&gt;&lt;br&gt; &lt;input type="su...
How do i pass raw HTML from java spring controller to jsp view <p>Im just trying something for feasibility purposes.</p> <p>I am trying to pass raw HTML code in my Spring controller to a specific view. However i want to know if its possible to convert raw html to a string and then pass the HTML string to the view. The...
<p>You can use use <code>@RestController</code> or <code>@ResponseBody</code>, which will not go thru <code>viewResolver</code></p> <pre><code>@RestController public class TestController { @RequestMapping(value = "/test") public String text1() { return "&lt;p&gt;hello world&lt;/p&gt;"; } } </code><...
How to mark each area with polygon in google map? <p>I am trying to create a map using google map or any other services.</p> <p>In this map i want to draw each area inside the city and it's details.</p> <p>This is similar to the following <a href="http://elaniah.com/test/maps.html" rel="nofollow"><strong>link</strong...
<p>You can use <a href="https://developers.google.com/maps/documentation/javascript/kmllayer" rel="nofollow">KmlLayer</a> to display the polygons (etc) from your MyMap on a Google Maps Javascript API v3 map (you will need an API key).</p> <p>The URL was obtained by exporting the KML ("Download KML") from your MyMap, c...
Missing references when porting code to ASP.NET Core <p>I'm using a <code>DropboxClient</code> object in an MVC project and is working fine, but I need to use it in ASP.NET Core, and when I try to use exactly the same code in ASP.NET Core I'm getting some compile time errors, these are the errors:</p> <ol> <li><blockq...
<p>Using package manager console I've install this package : <code>"Microsoft.NETCore.Portable.Compatibility": "1.0.1"</code> and now there are no errors. I've run this command: <code>install-package Microsoft.NETCore.Portable.Compatibility</code>. I'm copying a short descritpion about this package:</p> <blockquote> ...
Django 1.10 Using a dropdown menu to filter queries <p>I have a database with a bunch of pictures and the countries they were taken in. This is for a photo album on this site I'm making. Currently, I have all the pictures on one page. I like this. I want to now be able to search for all the pictures from a certain coun...
<p>You'll need Ajax to do that.</p> <p>Follow <a href="https://realpython.com/blog/python/django-and-ajax-form-submissions/" rel="nofollow">this</a> tutorial to help you.</p> <p>you need to download a <a href="https://raw.githubusercontent.com/realpython/django-form-fun/master/part1/main.js" rel="nofollow">script</a>...
onOptionsItemSelected not called in fragment with setDisplayHomeAsUpEnabled in AppCompatActivity <p>I searched all day through all similar question and answers, here in stackoverflow, but found no clue why it doesn't work</p> <p>here some excerpts from my code</p> <p>Fragment:</p> <pre><code> public View onCreate...
<p>Fragments have to declare that they can provide options. Have a look here:</p> <p><a href="https://developer.android.com/reference/android/app/Fragment.html#setHasOptionsMenu(boolean)" rel="nofollow">https://developer.android.com/reference/android/app/Fragment.html#setHasOptionsMenu(boolean)</a></p> <p>I think you...
Printf with AWK in Fortran D-like format "0.xxxxxD+x" <h1>Context</h1> <p>In Fortran programming language, there is a format, the "D" format, when you want to print a float. For instance, the float:</p> <pre><code>1234.56 </code></pre> <p>Will be printed as:</p> <pre><code>0.123456D+4 </code></pre> <p>Yes, with <c...
<p>you can write functions in <code>awk</code>, </p> <p>this may get you started, it doesn't handle negative exponents but can be easily added as well</p> <pre><code>$ awk 'function tovalue(x) {split(x,xa,"D"); return xa[1]*10^xa[2]} function format(x) {p=length(int(x)); ...
Replace \ with space in a file <p>In a file, I have to replace the special characters <code>\/:?|°%</code> with space. I tried the code below, but it is not replacing <code>\</code> with space:</p> <pre><code>awk '{gsub(/[\/:?|°%]/," "); print} else print}' $file </code></pre>
<pre><code>awk '{gsub(/[/:?|°%\\]/," ");print}' file </code></pre>
Docker Swarm Mode service anti-affinity <p>We are experimenting with docker v1.12 swarm mode using docker service and trying to find a way to ensure containers do not run on the same node. We have three containers and wanted to run 3 docker-engine hosts. When I initially brought them up with a replica of 2 one of the...
<p>You can use <a href="https://docs.docker.com/engine/swarm/manage-nodes/#add-or-remove-label-metadata" rel="nofollow">node labels</a> on nodes and <a href="https://docs.docker.com/engine/reference/commandline/service_create/#specify-service-constraints---constraint" rel="nofollow">service constraints</a> to influence...
Access denied error with php xampp <p>When I try to access the database with my web application I get:</p> <blockquote> <p>mysqli::mysqli(): (HY000/1045): Access denied for user 'php'@'localhost' (using password: YES) in C:\xampp\htdocs\Forum\accounts\PlayerAccount\Login.php on line 4 Error connecting to MySQL dat...
<p>Execute the following sentence via line command on your Mysql</p> <pre><code>&gt; grant all privileges on your-database-name.* to 'php'@'localhost' identified by 'your_pass_here'; &gt; flush privileges; </code></pre> <p>It will give the permission to access to the user you're using to connect.</p>
Extract pages from PDF with javascript in Acrobat Pro <p>I am trying to create a script that will extract all pages from a pdf document and name them from the number of the pdf (say the pdfs name is 5047.pdf) and then increment the name for every page of the pdf so it produces 5048.pdf, 5049.pdf etc. However my script ...
<p>Original link: <a href="https://forums.adobe.com/thread/969135" rel="nofollow">https://forums.adobe.com/thread/969135</a></p> <p>The solution, based on an answer from Adobe's forum:</p> <pre><code>/* Extract Pages to Folder */ var re = /.*\/|\.pdf$/ig; var filename = this.path.replace(re,""); var lastPage=this.n...
Phone menu - Python 3 <p>I'm trying to make some project of phone Menu, with viewing, adding and removing contacts. Which way would be better, to add contact to dictionary or by making new file and write/read from it?</p> <p>I tried first method - I had added new contact to empty dictionary and then I tried to view it...
<p>In both options you are overwriting the dictionary on every iteration. You should initilize it only once outside the loop. For the first option it will look like:</p> <pre><code>phone_contacts = {} # this line moved from inside the loop while condition == True: print("Menu") print("contacts") ...
MATLAB: Linear Indexing Multidimensions <p>I'm trying to assign some values to a matrix.In the case of 2 or 3 dimension, it is easy to use sub2ind. However the data I use has 23 dimensions. The situation could be explained better with an example. <code>A</code> is a matrix which has <code>3x4x5x6x7</code>dimensions. I ...
<p>Define the vector with the index values</p> <pre><code>x = [1 2 3 4 5]; </code></pre> <p>Then you can convert to cell (using <a href="https://es.mathworks.com/help/matlab/ref/num2cell.html" rel="nofollow"><code>num2cell</code></a>) and from that to a <a href="https://es.mathworks.com/help/matlab/matlab_prog/comma-...
How to enable DELETE request? <p>I'm not able to allow the <code>DELETE</code> request from my API server due to CORS.</p> <h3>server.js</h3> <pre><code>// enable CORS app.use(function (req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Methods", "GET", "PUT", "...
<p>Solved it by simply using npm's <a href="https://www.npmjs.com/package/cors#simple-usage-enable-all-cors-requests" rel="nofollow">cors</a> package and enabling all cors requests, by simply replacing...</p> <pre><code>// enable CORS app.use(function (req, res, next) { res.header("Access-Control-Allow-Origin", "*...
Ethereum Mobile Application <p>we are very new in Ethereum, we are going to build a mobile client application for Ethereum. We will have following features in it like wallet, transactions, smart contracts and tokens etc. We are thinking to keep a central server which will sync with Ethereum and every client application...
<p>First you probably want to look at Jaxx. Second, while you totally can implement it like that, i don't think it will be welcome by the users for 2 reasons.</p> <p>The first: the coinbase wallet kinda does that already (beside the smart contracts) and it is already available.</p> <p>But the main problem I see is t...
I set alarm every 15 min but still it sends data at random timings, not showing when app is closed <p>Whenever I start my main activity, time is fetching. I want it to happen every 15 min. </p> <p>for start service</p> <pre><code> Intent intent = new Intent(); intent.setAction("MyBroadcast"); sendBroadcast...
<p>You are running into two different issues:</p> <p>First, you are using <a href="https://developer.android.com/reference/android/app/AlarmManager.html#setInexactRepeating(int,%20long,%20long,%20android.app.PendingIntent)" rel="nofollow"><code>setInexactRepeating()</code></a>. As the name implies and the documentatio...
CBOW (Continuous Bag of Word) Understandable Code <p>Recently I have read word2vec. I wanted to understand <strong>CBOW</strong> (Continuous Bag of Word Model) completely. For this purpose I read a lecture notes and got some understandings and then decided to remove some confusions from code if a good implementation is...
<p><a href="https://www.tensorflow.org/versions/r0.11/tutorials/word2vec/index.html" rel="nofollow">Tensorflow Implementation</a> maybe. You'll probably want to use <a href="https://github.com/tensorflow/tensorflow/issues/42" rel="nofollow">docker</a> to make it work on windows though.</p>
Best way to update android database(now i am using sugarORM) <p>The question is: I need to update my database each time the app runs, now i am doing it by deleting all old database records, and saving new records. </p> <p>It works but is seeems to be realy bad realization, also it grows the database id's every time da...
<p>Have some unique key criteria in your tables. Once you again save updated record with same unique key, it will overwrite it in database. You need to update rather than 'delete and insert' everytime</p>
Angular creates a non native array <p>When I populate model.files directly in my view with </p> <pre><code>&lt;input type="file" ng-model= vm.files[0]&gt; &lt;input type="file" ng-model= vm.files[1]&gt; </code></pre> <p>my vm.files looks like this (example A):</p> <p><a href="http://i.stack.imgur.com/K3V6p.png" rel=...
<p>There are not "2 types of arrays" in JavaScript, and this is not "creating a non native array". It is creating an Object <code>files</code> with Properties <code>0</code> and <code>1</code>. This is called <code>Object Bracket Notation</code>, and it occurs in Angular because Angular treats every property as an ob...
Import big integer from SQL Server into R <p>I'm trying to import a SQL Server table into R. The first column of this table is a 17-digit ID.</p> <pre><code>library(ODBC) channel &lt;- odbcConnect("my_db", uid="my_id", pwd="my_pw") options(digits=22) sqlQuery(channel, "select ID from dbo.my_table where ID = 100000000...
<p>As joran said, using <code>as.is = TRUE</code> as an argument to <code>sqlQuery()</code> solves the problem.</p>
jQuery: Help re-activating button when limit is reduced <p>Currently I have built this simple application where you can add input boxes using a button. Then when the limits reached it prevents you adding more and it has a maximum input box message displayed. You also have the option to remove the boxes you've just adde...
<p>Instead of this:</p> <pre><code> $("#Input").on("click","#remove", function(e){ e.preventDefault(); $(this).parent('div').remove(); x--; }); </code></pre> <p>Try this:</p> <pre><code> $("#Input").on("click","#remove", function(e){ e.preventDefault(); $(this).parent('div').remove(); x--; ...
Why does pyplot display wrong grayscale image? <p>I have a grayscale image:</p> <p><a href="http://i.stack.imgur.com/TZB53.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/TZB53.jpg" alt="enter image description here"></a></p> <p>But <code>plt.inshow</code> displays a wrong image (clearly, it differs from the o...
<p><code>imshow</code> will by default stretch and normalise the data so the minimum value becomes black and the maximum becomes white. You data currently is within the range 90 to 138, so it will map <code>90-&gt;black</code> and <code>138-&gt;white</code>.</p> <p>To prevent this happening, you can give <code>imshow<...
Disabling form submit prevents button attribute from being sent <p>I have a form with two submit buttons. I'm using the 'name' attribute to see which one is being clicked to submit the form. I want to disable the buttons upon submitting using jquery with the following function: </p> <pre><code>$(document).on('submit',...
<p>You should disable the form from submitting by capturing its state. You can do this by adding a class to the form and if it has that class then stop the event.</p> <pre><code> $(document).on('submit', '.js-form', function(e) { if ($(this).hasClass('disabled')) { // Form is disabled, stop the event ...
SQL/Redshift: Querying user behaviour before first purchase <p>I have the following tables:</p> <pre><code>Table: users id | created_ts | username_str --------------------------------- Table: activity user_id | created_ts | activity_descr_str --------------------------------- Table: purchase_orders id | user_id |...
<p>You just need to break the logic into parts:</p> <ul> <li>Get the first order date for each user.</li> <li>Filter out the users that are too old.</li> <li>Join in the activities, paying attention to the dates.</li> <li>Count the number of activities per user.</li> <li>Filter and count again.</li> </ul> <p>So, one ...
How to recreate a branch from pull request? <p>I forked a project, created a new branch from master, made changes and created a pull request to the original project. But suddenly I forgot I created this pull request and deleted my fork completely from remote (GitHub) and from my PC as well. How can I recreate a branch ...
<p>There are two things you can do:</p> <p><strong>1. Contact GitHub support</strong></p> <p>While trying out my solution for you I deleted a fork where I myself had a PR still pending and had the same situation than you.</p> <p>There is currently no way to reattach to that PR, besides contacting GitHub support. The...
How to make xPage JavaScript return @Unique() in Lotus Notes format? <p>Here is the SSJS row:</p> <pre><code>var tmpID = @Unique(); </code></pre> <p>But it returns unique string in following format:</p> <pre><code>1sghsekw3hwgh hswhstky3hts0 </code></pre> <p>And the length is not consistent. It can be 11 or 12 or 1...
<p>John, </p> <p>I believe you can achieve that with <code>session.evaluate(“@Unique”)</code></p>
Generate/populate a id like a000001,a000002 without using ID INT IDENTITY sql server <p>How can i generate a000001,a000002 in a loop? (int+1) varchar(6) or char(6) without using INT IDENTITY help thanks </p> <pre><code>DECLARE @LoopCounter as INT DECLARE @MaxBranchId as INT DECLARE @id INT DECLARE @val as varchar(...
<p>It may be a partial answer, you may get some idea based on the query.</p> <p>Using this query you can create a row number and generate a auto increment id.</p> <pre><code>SELECT 'a' + REPLICATE('0', 6 - LEN(BranchId)) + CAST(BranchId AS VARCHAR) AS NewBrachId , BranchId FROM ( SELECT ROW_NUMBER() OVER (ORDER BY (S...
Concat 2 varchars in SQL <p>I am trying to produce a varchar(20) which is 4 character year + 2 character month. I would like to then use this as a parameter in my stored procedure. Im unable to concatenate 2 varchars together to produce this, any ideas?</p> <pre><code>SELECT GETDATE() AS CurrentDateTime, CONV...
<p>The simplest approach would be to use this:</p> <pre><code>SELECT Format(GetDate(), 'yyyyMM') as YearMonth </code></pre> <p>The function <code>Format()</code> was <a href="https://msdn.microsoft.com/en-us/library/hh213505.aspx">introduced with Sql Server 2012</a>.</p>
How to convert this C line into its equivalent C++? <p>This is my structure :</p> <pre><code>struct HashTable{ int tsize; int count; //No. of elements in table struct HashTableNode **Table; }; </code></pre> <p>And this is what I am trying to do : </p> <pre><code>struct HashTable *h=(struct HashT...
<p>Obviously I agree most of the comments under your question, but if you REALLY need pointers in your code the solution for your problem may look like below.</p> <p>Use typedef specifier to define a type:</p> <pre><code>typedef HashTableNode* PHashTableNode; </code></pre> <p>And then:</p> <pre><code>h-&gt;Table=ne...
pass 2 parameters jquery webservice <p>I have a webvice asmx that returns an array of item, my problem is that i cannot send some parameters,perhaps without any parameters it works</p> <pre><code> &lt;WebMethod&gt; Public Function BindMapMarker(Rcodprovincia As String, RcodCitta As String) As MAPS() &lt;scrip...
<p>In order to send json you must be use a <strong>web page</strong> (.aspx), not a web service (.asmx) just as the example I mentioned.</p> <p>You can only pass <strong>one parameter</strong> and <strong>must be an object</strong>, an instance of a class, that will be the json parameter.</p> <p>If your class is MAPS...
PHP assign one array value to another array <pre><code>array ( 0 =&gt; array ( 'label' =&gt; '1', 'index' =&gt; 1, 'product_attributes' =&gt; array ( 0 =&gt; array ( 'type' =&gt; 'product', 'id' =&gt; 1, 'label' =&gt; 'Size', 'placeholder' =&gt; 'Select...
<p>Your code is almost right, but you're acting a local variables in foreach loops. You should bind them to original array items as follows:</p> <pre><code>foreach ($data['values'] as &amp; $products) { foreach ($products['product_attributes'] as &amp; $product_choices) { if (!empty($product_choices['condi...
Getting and using return value from stored procedure <p>It's my first "system" and I'm trying to make a login in Visual Studio 2015/vb.net</p> <p>I have this procedure:</p> <pre><code>ALTER proc [dbo].[buscar_acceso] @login as varchar(50), @password as varchar(50) as declare @returnvalue int Select a...
<p>an efficient way to do that in VB.net, is create a stored procedure that SELECT a single row and column - then execute the command in VB.net as 'ExecuteScalar'</p> <p>e.g</p> <pre><code>dim LoginResult as integer = cmd.ExecuteScalar </code></pre> <p>.</p> <pre><code>ALTER proc [dbo].[buscar_acceso] @login as va...
Request telemetry - "durationMetric"? <p>When parsing exported Application Insights telemetry from Blob storage, the request data looks something like this:</p> <pre><code>{ "request": [ { "id": "3Pc0MZMBJgQ=", "name": "POST Blah", "count": 6, "responseCode": 201, "success": true, ...
<p>It doesn't match because you're seeing sampled data (meaning this event represents sampled data from multiple requests). I'd recommend starting with <a href="https://azure.microsoft.com/en-us/documentation/articles/app-insights-sampling/" rel="nofollow">https://azure.microsoft.com/en-us/documentation/articles/app-in...
Building Fixed Size List of Nat N <p>I tried to define a function that, given a <code>N &lt;: Nat</code> type parameter, builds a List with exactly 3 <code>N</code>'s.</p> <pre><code>import shapeless._ import shapeless.nat._ scala&gt; def natNOfSize3[N &lt;: Nat](n: Nat): Sized[List[N], _3] = Sized[List, _3](Li...
<p>One issue is that your <code>n</code> is typed as <code>Nat</code>, not <code>N</code>—I assume that's just a typo. Once you've fixed that, you can write the method like this:</p> <pre><code>import shapeless._, nat._ def natNOfSize3[N &lt;: Nat](n: N): Sized[List[N], _3] = Sized[List](n, n, n) </code></pre> <p>...
Using UdpClient, how do you retry UdpClient.Connect() until it succeeds? <p>My client/server programs work well with each other, but only when the server is up and running before my client starts. If the client fails to connect on the first try, I can't get it to try again.</p> <p>Here's my Client's <code>connect</cod...
<p>This is pseudoCode - you will have to move somethings to class scope to allow future send/receives (which you'd do using a different method). This is only designed to show you how to connect when the connection blocks:</p> <pre><code>bool isClientConnected = false; var connector = new System.ComponentModel.Backgrou...
Why this xpath doesn't work? <p>given docuent a.xml:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;xml&gt; &lt;listUsersResponse xmlns="http://www.algorithmics.com/schema"&gt; &lt;status&gt;OK&lt;/status&gt; &lt;users size="615"&gt; &lt;user&gt; &lt;id&gt;user1&lt;/id&gt; &lt;name&gt;J...
<p>The XPath is working correctly and selecting the element you are looking for. You have an issue displaying the node that the XPath expression found. That's going to depend on the application or tool that you use to process the results of the XPath, not on the XPath itself.</p>
Using a parameter to specify which sound file in Resources to play <p>I've got about 20 small sound effect files in my Resources section... I would like to have a method that plays a particular sound file based on a parameter I pass it... assuming that my sound files are named sound01.wav, sound02.wav, etc. </p> <pr...
<p>Ok, the answer hit me shortly after I posted this...</p> <pre><code>public static void PlayMySound(Stream soundFile) { SoundPlayer snd = new SoundPlayer(soundFile); snd.Play(); } // Then I can just call it like this... PlayMySound(Properties.Resources.sound01); PlayMySound(Properties.Resources.sound02); </co...
What is causing the sort Function serializable in spark? <p>I am getting task not serializable for below code. However if I pass the function directly I don't get any error.</p> <pre><code>abstract class MyAbstractClass[T, SortOrder](implicit ord: Ordering[SortOrder]) { def getSorterFunc(): (T) =&gt; SortOrder de...
<p>The culprit here is the <code>implicit ord: Ordering[SortOrder]</code> - since the <code>sort</code> method (called within an anonymous function that must be serialized by Spark) implicitly takes <code>ord</code> as argument, the encapsulating object <code>SampleObject</code> must be serializable.</p> <p>This is wh...
ARM linux userspace gpio operations using mmap /dev/mem approach (able to write to GPIO registers, but fail to read from them) <p>Kernel version 3.12.30-AM335x-PD15.1.1 by PHYTEC.</p> <p>If I use the /sys/class/gpio way, I can see that the button input pin (gpio103 of AM3359) value changes from 0 to 1.</p> <p>Followi...
<p>You should use GPIO_DATAIN Register (offset = 138h) to read from GPIO pin, not GPIO_DATAOUT.</p>
Shake Gesture not Working <p>I have a project set up using SWReveal for the slide out menu.</p> <p>When I place a motion ended override function it never seems to be called even though everything else in the class loads (indicated with the '<strong>loading</strong>'.</p> <p>I have had a good play around and found tha...
<p>You need to override canBecomeFirstResponder method.</p> <pre><code>override func canBecomeFirstResponder() -&gt; Bool { return true } </code></pre>
Unable to create call adapter for retrofit.Call<java.util.List<Model.Object>> <p>My request fails doing a call</p> <pre><code>Retrofit retrofit = new Retrofit.Builder() .baseUrl(MyAPI.BASE_URL) .addConverterFactory(JacksonConverterFactory.create()) .build(); // prepare call in Retrofit 2.0 MyA...
<p>You can use rxJava library, for that you have to use specific call adapter factory during Retrofit instance creation: .addCallAdapterFactory(RxJavaCallAdapterFactory.create()) . Advantage of this method is that you can easily handle request in background and be notified about errors.</p> <pre><code>Observable&lt;Li...
Limit a Django ManyToMany by id <p>I need to show in admin view a list of cars to add to parking, so far so good with this code</p> <pre><code>class Car(models.Model): name = models.CharField(max_length=200) class Parking(models.Model): name = models.CharField(max_length=200) options = models.Ma...
<p>The Django Admin is meant as a database editor for developers, it is NOT meant for users.</p> <p>With that in mind, the Cars list will always show all cars. To see which cars belong to a lot you need to go into the Parking list and edit one of the Parking objects. There you'll see the <code>options</code> displayed...
Angular 2 sending object from one component to other <p>I'm new to programming and angular2.. Here I'm trying to send object from one component to other on click event using service but i'm not getting any data..</p> <p>this is parent component...</p> <pre><code>import { Component } from '@angular/core'; import {Http...
<p>Don't add <code>SelectedItemService</code> to providers of the component. This way every component will get it's own instance. Add it to providers of <code>NgModule</code> instead, then you'll have a single instance for the whole application.</p>
LeafLet Draw, Marker Layer can't be Clicked <p>I'm using Leaflet 1.0.1 with LeafLet Draw, but the problem is Marker Layer can't be clicked with the LeafLet stable version</p> <p><a href="https://jsfiddle.net/tb0pct68/2/" rel="nofollow">https://jsfiddle.net/tb0pct68/2/</a></p> <pre><code>var osmUrl = 'http://{s}.tile....
<p>According to this <a href="https://github.com/Leaflet/Leaflet.draw/issues/602" rel="nofollow">open issue on Github</a>, the leaflet draw plugin supports only leaflet 0.7.x. It is only a matter of time before it gets fixed though (I hope!).</p>
Unable to update android app <p>I used cordova to build version 1 of my app. Now i rework the app in order to add some back-end using android. Using android studio IDE. I use the same <strong>package name</strong>, <strong>increment version number</strong> and <strong>exact key</strong> to update my app.But i get the f...
<p>Generate new SHA key as this problem arise when debug.keystore file is deleted in any build process. You can generate key using: <a href="http://stackoverflow.com/questions/15727912/sha-1-fingerprint-of-keystore-certificate">SHA-1 fingerprint of keystore certificate</a></p> <p>Update SHA key against your app API ke...
How to pass parameter from View through Ribbon in WPF/Prism? <p>I did successfully place a RibbonControl into my shell-view (I'm using PRISM) and I'm also able to navigate to a different view when a Ribbon control has been clicked. </p> <p>Now, I'm stuck with the following problem: how can I pass a parameter from one ...
<p>Use IRegionManager.RequestNavigate to navigate, and then have you ViewModels implement INavigationAware. Read the docs here:</p> <p><a href="https://github.com/PrismLibrary/Prism/blob/master/Documentation/WPF/60-Navigation.md" rel="nofollow">https://github.com/PrismLibrary/Prism/blob/master/Documentation/WPF/60-Na...
Loop over arrayfun with MATLAB <p>In MATLAB, I'd like to use <code>arrayfun</code> in a loop without using the function <code>for</code>.</p> <p>The general syntax is the following:</p> <pre><code>arrayfun(@(x,i,j) func(x), M{i,j}) </code></pre> <p>where <code>(i,j)</code> is the index of a matrix <code>M</code> app...
<p>Well, Xzibit would say <em>"Yo dawg, I heard you like everything but <code>for</code>, so we put an <code>arrayfun</code> in your <code>arrayfun</code> so you can loop while you're looping"</em></p> <pre><code>result = reshape(arrayfun( ... @(k) arrayfun(@(x) func(x), M{k}), ... 1:numel(M), ...
Adding and removing data from the db using Entity Framework <p>I have several tables in the DB and I want to remove all the data and repopulate the tables and only then perform a save changes (because in case the save fails I want to return to the old data).</p> <p>when I remove the data from the DB and then try to ad...
<p>Here you have to use Transaction.B'cos you're doing more than one atomic operation on your code base.By using Transaction where you can Combine several operations into one transaction within the same context.If there is any failure within the transaction then all will be roll-backed.</p> <p>Transaction code snippet...
AutoMapper Return an empty list when Mapping two lists <p>I want to convert one List to another using AutoMapper, but it returns an empty list</p> <p>This is my source object</p> <pre><code>public class Charge { public int ChargeID { get; set; } public string ChargeName { get; set; } public int CreatedBy ...
<p>Change </p> <pre><code>Mapper.CreateMap&lt;List&lt;Charge&gt;, List&lt;ChargeVM&gt;&gt;(); </code></pre> <p>to</p> <pre><code>Mapper.CreateMap&lt;Charge, ChargeVM&gt;(); </code></pre> <p>You don't have to explicitly create maps for list, only the objects in the list.</p>
Find specific files in subdirs using Python os.walk <p>In Windows, if I ran:</p> <p>dir NP_???.LAS</p> <p>I get 2 files:</p> <p>NP_123.LAS</p> <p>NP_1234.LAS</p> <p>Using fmatch with NP_????.LAS mask I get only NP_1234.LAS, not NP_123.LAS.</p> <p>Below, the code I´m running:</p> <pre><code>def FindFiles(directo...
<p>You could use <a href="https://docs.python.org/2/library/re.html" rel="nofollow">re</a> to give you more flexibility by allowing actual regular expressions. The regular expression "[0-9]{3,4}" matches either 3 or 4 digit numbers. </p> <pre><code>def FindFiles(directory, pattern): flist=[] for root, dirs, fi...
How to pass a HTTP parameter from a CP1251 page to a UTF-8 handler? <p>When I type a Russian word in the input of the below Perl program and click Submit, I see a nonsense instead of Russian letters.</p> <p>How to pass data from a page encoded as CP1251 to a handler script which needs UTF-8 strings? (The script below ...
<p>I can ether convert the value of <code>param()</code> from CP1251 to UTF-8 or add <code>accept-charset='utf-8'</code> attribute to <code>&lt;form&gt;</code> element.</p>
Trouble installing CDB debugger on Windows 10 <p>I'm returning to C programming after a few years of not doing it, and trying to get a debugger set up on my Windows 10 laptop. The whole first page of results on my google search for "windows debugger" eventually lead to the Windows SDK download (which is fine, since CDB...
<p>I don't believe that the debuggers are added to the PATH by default; I had to add them myself. But since you installed them through the Windows 10 SDK, they should be here or at least around here:</p> <ul> <li>32-bit systems: <code>C:\Program Files\Windows Kits\10\Debuggers\{architecture}</code></li> <li>64-bit sys...
How to create `input_fn` using `read_batch_examples` with `num_epochs` set? <p>I have a basic <code>input_fn</code> that can be used with Tensorflow Estimators below. It works flawlessly without setting the <code>num_epochs</code> parameter; the obtained tensor has a discrete shape. Pass in <code>num_epochs</code> as a...
<p>I have solved the above issue by creating a function specific to what's expected on an <code>input_fn</code>; it takes in a dense column and creates a SparseTensor without knowing shape. The function was made possible using <code>tf.range</code> and <code>tf.shape</code>. Without further ado, here is the working gen...
Postgresql nested function and transaction <p>I have a question about the postgresql nested function and transaction. As you know, each function in postgresql is in a transaction. I am curious about if the inner function failed, will all the changes made in the outer function rolled back?</p> <p>here is the one exampl...
<p>Yes, unless you set a savepoint to which you can rollback.</p> <p>In PL/pgSQL, this is implicitly done with a <code>BEGIN ... EXCEPTION ... END;</code> block, so the following won't rollback the first <code>INSERT</code>:</p> <pre><code>CREATE FUNCTION function 1() RETURNS void LANGUAGE plpgsql AS $$BEGIN in...
JavaScript function - array of image and array of answer with input type <p>I need to make a question game using random image array and its answer when the user input the correct answer. </p> <pre><code> &lt;! DOCTYPE html&gt; &lt;html&gt; &lt;title&gt; Guess the CharToon &lt;/title&gt; &lt;head&gt; ...
<p>Since you haven't really said what your specific problem is (you should have, as mentioned in <a href="http://stackoverflow.com/help">http://stackoverflow.com/help</a>), I'll try to provide some help without actually solving the problem.</p> <p>There are a number of issues with your code, including (but likely not ...
Adding Custom Button in Push notification <p>I am looking for the solution to add the Button on Push notification. I am not talking about showing alert on screen if aap is in background or active. I am talking about when my app in not in background nor active and push arrives then that push must have a button showing o...
<p>Check the <a href="https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW26" rel="nofollow">Actionable push notification docs</a>. Probably missing some configuration on the app</p>
Trying to sum part of the rows <p>So I have three tables Orders:</p> <pre><code>CustomerID,OrderID </code></pre> <p>Order Details;</p> <pre><code>OrderID,ProductId,UnitPrice,Quantity,Discount </code></pre> <p>And Products:</p> <pre><code>ProductID,ProductName </code></pre> <p>And I need to combine these 2 tables ...
<p>First, learn explicit <code>JOIN</code> syntax. Simple rule: <em>Never</em> use commas in the <code>FROM</code> clause.</p> <p>Second, you should include all non-aggregated columns in the <code>GROUP BY</code>:</p> <pre><code>SELECT o.CustomerID, p.ProductName, SUM(od.Quantity * od.UnitPrice * (1 - od.Dis...
Gems not being installed to correct directory using rbenv <p>When I try to run <code>rails console</code> it blows up and gives me this error:</p> <pre><code> Referenced from: /Users/masonry/.rbenv/versions/2.3.1/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle Reason: image not found - /Users/masonry/.rbenv/versions...
<p>I had a similar issue and it was because i had rvm installed with rbenv. i had to uninstall rvm and uninstall ruby then reinstalled ruby and rails entirely. not sure if you have rvm. but i hope this helps or gives you a clue.</p>
Getting a character to be represented by an int 0-25 <p>I'm working on a cryptography program that implements various traditional methods. For some of them it is best for my message to be represented as numbers 0-25. A is 0, B is 1, etc. This shift cipher is a case of that since you must take mod 26 for a wrap around. ...
<p>To get an integer value of 0..25 of a character you need to make sure that you only get upper- or lowercase characters in the alphabet.</p> <p>Then you can simply convert the characters to integer by subtracting the value of the 'a' character. As the character values are ordered as in the normal alphabet, this will...
if else statement stops at first IF <p>I've got some problems with my code.. C# if i run it it stops at the first If statement...</p> <p>tried and looked for some more answers but diden't find anything that works </p> <pre><code> private void Bereken_Click(object sender, EventArgs e) { // Afmetingen...
<p>I see two problems:</p> <ul> <li>All 6 calculation blocks contain the exact same formulas (as others have also pointed out).</li> <li>You are doing integer math, meaning the results are also integers, and they may all be rounded to 0 for certain inputs, e.g. if PL &lt; L. Fix: use <code>Double.Parse(...)</code> ins...
many locks on same mutex, one locks forever <p>In my program I have a single mutex and two threads. One of these threads acquires the lock very often. The other thread tries to acquire but has to wait forever.</p> <p>Could it be that the lock is acquired so quick after releasing it that the other thread does not get a...
<p>An std::mutex does not guarantee giving everyone an equal chance. So it is possible that one thread starves another. The first thing you can try is to insert <a href="http://en.cppreference.com/w/cpp/thread/yield" rel="nofollow">std::this_thread::yield()</a> and see if it helps. If this does not help, then your code...
Publishing results from shell script onto Jenkins <p>I have a regression build script which builds 90+ modules . The script maintains a list of what passed and what failed. Is there a plugin or easy waorkaround to display the status of those 94 modules?</p>
<p>Yes -- you can <strong>use the <a href="https://wiki.jenkins-ci.org/display/JENKINS/JUnit+Plugin" rel="nofollow">JUnit plugin</a></strong> to do that. Despite its name, it's not tied to unit testing alone.</p> <p>The plugin can</p> <ul> <li>display the success status of individual sub-tests</li> <li>give a "failed...
DotNenuke Razor Host RenderPage pass in dynamic variablwe <p>I'm working with DNN 8.4.2 - My partial looks like this this: </p> <pre><code>@{ if(ViewBag.loadItem != null &amp;&amp; ViewBag.loadItem) { //load my stuff } } </code></pre> <p>While my rendering looks like this: </p> <pre><code>@RenderPage("Shared/MyScri...
<p>Found the answer! There is no <code>ViewBag</code>in DNN's Razor Host module since it only works with a Model. You can use <code>PageData</code> instead. </p> <pre><code>var loadItem = PageData["loadItem"]; if (loadItem != null &amp;&amp; loadItem) { //do stuff here } </code></pre>
what special feature do have the attributes begin with @? <p>I am working on a Elasticsearch index/type with some attributes that begin with @ p.e. @timestamp, @internalValue, so I would like to know if those attributes have some special feature or if they are good for something. <br/> FYI the whole data in the index h...
<p>Elasticsearch doesn't have any special meaning for fields prefixed with <code>@</code>. </p> <p>Logstash uses <code>@</code> to define metadata fields for the log, for example <code>@timestamp</code>. Since you are not using Logstash, there is no special meaning for <code>@</code> and they have no "special feature"...