input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Chatbot for Amazon Alexa <p>I am looking for beginners tutorial for building an chatbot for Amazon Alexa. </p>
<p>How it works, I am sending to the API from Amazon a text message and Alexa read this?</p>
<p>Are there some tips how a chat bot should be prepared. Is the way of communication the same like a slack bot?</... | <p>If you haven't found any help, you may consider these very first steps : </p>
<p>Alexa is calling the bots "skills" and basically you develop a function that you set up in either their servers or yours and connect to Echo devices through a developer portal. Amazon has written some tutorials to help you quick start ... |
IIS Rewrite module - how to redirect maintaining path and querystring but adding an extra querystring parameter? <p>I've been banging my head against a brick wall attempting to get some IIS redirect rules to work. I've searched and read stuff here on Stack Overflow and on IIS.net but it just doesn't work at all.</p>
<... | <p>Before I give the answer, a shout out to Yuk Ding at Microsoft who responded to a copy of this post on the iis.net forums and provided most of the answer.</p>
<p>So here we go, if you want rewrite rules that redirects from 1 URL to another maintaining the path and querystring if they exist whilst at the same time a... |
constant like PHP_EOL for tabulation php <p>Please help,
how can i find the constant like PHP_EOL for tabulation
My code wrote file which has a lot of generated tabulations and new lines
new lines wrote correctly, but i have a lot of "\t\t"
see example:</p>
<pre><code>common.app \t/loader \t/growl \t\t/error \t/form
<... | <p>PHP_EOL is a Constant from Core PHP. You could simply define your own Constants and use them. For example:</p>
<pre><code><?php
defined("TAB1") or define("TAB1", "\t");
defined("TAB2") or define("TAB2", "\t\t");
defined("TAB3") or define("TAB3", "\t\t\t");
defined("TAB4") or define("TAB4", "\t\t... |
MySQL - LOAD DATA LOCAL INFILE - Problems if DB tablename has hyphen <p>I use in php a script to import a csv into a database table by </p>
<pre><code>$sqlQueryImport = "LOAD DATA LOCAL INFILE '".$fileNewDataImportInDB."' INTO TABLE " .$sqlTableName
. " CHARACTER SET UTF8"
. " FIELDS TERMINATED BY ';'"... | <p>You can try escaping the table name with backticks. So your <code>LOAD DATA</code> statement would look like this:</p>
<pre><code>LOAD DATA LOCAL INFILE someFile.csv INTO TABLE `tbl-test`
CHARACTER SET UTF8
FIELDS TERMINATED BY ';'
ENCLOSED BY '\"'
LINES TERMINATED BY '\n'
</code></pre>
<p>The full code:</p>
<pr... |
How can i set flag in a sql query <p>My query:</p>
<pre><code>CREATE OR REPLACE VIEW Basic
AS
SELECT id FROM my_post
UNION
SELECT id FROM scrap_post
</code></pre>
<p>If the row is from <code>my_post</code> then I want to set the flag <code>p</code>, otherwise <code>s</code>.</p>
| <p>Add a hard-coded value</p>
<pre><code>CREATE OR REPLACE VIEW Basic
AS
select id,'p' as flag from my_post
UNION
select id,'s' from scrap_post
</code></pre>
<p><strong>Note :</strong> If you don't care about duplicates in result then change <code>UNION</code> to <code>UNION ALL</code> which runs faster </p>
|
Symfony 2.8 Form Button isClicked <p>I have Symfony in version 2.8.11. I'm creating form with two buttons and I just want to do something like "If button 1 is clicked, redirect to some route, if button 2 is cicked, redirect to another route". In <a href="http://symfony.com/doc/2.8/form/multiple_buttons.html" rel="nofol... | <p>Function <code>$form->getForm()</code> in general returns object which implements interface <code>FormInterface</code> - and methods of this interface you have in your autocomplete.</p>
<p>But some of this objects can have additional methods, and <code>\Symfony\Component\Form\SubmitButton</code> implements <code... |
Jenkins Git Plugin - stderr: plink: unknown option "-o" <p>I'm attempting to set up a build in Jenkins using SSH credentials for Git as we are using submodules in the repository. Currently seeing the following error:</p>
<p><a href="http://i.stack.imgur.com/ISwrd.png" rel="nofollow"><img src="http://i.stack.imgur.com/... | <p>I had this error recently. In my case it turned out to be Jenkins being run as a service under the Local System account and picking up a system environment variable GIT_SSH which was set to plink.exe (my user account uses this setup so that TortoiseGit via Git for Windows can access a GitLab server). The use of pl... |
probleme to stock data in database <p>i'm working on a survey generator. everythng is empty. the client enter one or many questions, and add one or many answers for each questions. These are send in my database.
i reach to code in js/jquery the dynamical generation of question and answers. my problem is that i don't kn... | <p>The table structure should be something like this </p>
<p><strong>questions_master</strong> table should be there to store all the questions and one column for every question whih is to store <strong>right answe</strong>r, then <strong>answer_master</strong> table should be there to store all the answers for given ... |
Some text area persistently highlighted in Eclipse IDE <p>When I use eclipse if neon to type javascript file ,I often come to white color which covers the words I typing as this pictures:
<a href="http://i.stack.imgur.com/7zn6l.png" rel="nofollow"><img src="http://i.stack.imgur.com/7zn6l.png" alt="enter image descripti... | <p>It seems to be some hover for a previous Search request. Open the <code>Search</code> view, and clear the active search to remove highlights.</p>
|
Jquery find next input, select on keypress but not button <p>I want to select the next input:visible and select:visible when the user press "enter". My code work except it finds the next <code>button</code> element and I don't want that.</p>
<pre><code>$(document).on('keypress', 'input, select', function (e) {
if (e.... | <p>You could use <code>:not</code> to exclude some elements:</p>
<pre><code>var inputs = $(this).closest('form').find(':input:not(button,[type="button"],[type="submit"]):visible, select:visible');
</code></pre>
<p>This gets quite verbose though. A better solution may be to put a common class on the <code>input</code>... |
Karma, coverage report combined with webpack <p>I have karma set up along with the coverage tool which is working - but as I'm also using webpack, the coverage report is using the bundled code that webpack has created.</p>
<p>For example:
I have a Typescript file that includes an external library, so in order for that... | <p>You can try to use <a href="https://github.com/deepsweet/istanbul-instrumenter-loader" rel="nofollow">https://github.com/deepsweet/istanbul-instrumenter-loader</a> to resolve your problem, a webpack loader to generate coverage report from the non-bundled source js file.</p>
<p>But the plugin doesn't support es6, yo... |
AngularJS Get result of of a http service when it done <p>Im using AngularJS to get data from an API
I make a Service and Controller by Angular. I get data from service and use it from controller.
I have a Validation function for data input to check duplicated Key, and the service will do this by sending key entered to... | <p>In validate also you need to add callback function - </p>
<pre><code> function validate(){
var deferredRequest = checkExistedKey ();
deferredRequest.then(function (success) {
return true;
}
}
</code></pre>
<p>See this - <a href="http://jsfiddle.net/17r0mhp6/" rel="nofollow">example<... |
RestSharp android upload multiple lines <p>I can use RestSharp very well sending "mono-line" things like:</p>
<p>"user, password, email, telephone, ... "</p>
<p>But I can't understand how to send multiple lines, for example, all the values in this table:</p>
<pre><code>+-----------+-----------+-------+
| Dog |... | <p>Try use this. JsonHelper 1.0.2 You can download by NuGet or <a href="https://www.nuget.org/packages/NuGet.Modules.JsonHelper/" rel="nofollow">here</a></p>
<pre><code> public class YourModel
{
public string Doggy { get; set; }
public string Race { get; set; }
... |
Ace editor + Angular 2 => protractor cannot synchronize <p>I'm developing an app using Angular 2 (2.0.0 release), angular-cli (1.0.0-beta.14).</p>
<p>I've integrated Ace editor using an Angular 2 directive, following <a href="https://github.com/fxmontigny/ng2-ace-editor" rel="nofollow">https://github.com/fxmontigny/ng... | <p>Ok, finally found the issue.
It looks like Angular is lost tracking changes in the Ace Editor, hence thinks there are always ongoing changes. So </p>
<pre><code>window.getAngularTestability($('app-root'))
.whenStable(functââion(){
console.log('sââtable')
})
</code></pre>
<p>Does not return ... |
Iterate Rows with wrong Results <p>I tried to use GridView in Master/Details Mode to get data from MongoDb Server.</p>
<p>And as the pic shows, I get the Id and the name from a Collection of Users, then I Iterate the parent Rows to get the Id and I fetch in the 2nd Collection of Product to get the details of each user... | <p>You can do it with binding.</p>
<pre><code>private GridViewTemplate CreateChildTemplate()
{
GridViewTemplate childTemplate = new GridViewTemplate();
GridViewTextBoxColumn column = new GridViewTextBoxColumn("WID");
childTemplate.Columns.Add(column);
column = new GridViewTextBoxColumn("Name");
ch... |
Unable to get an Oracle connection <p>Unable to get an Oracle connection.</p>
<p>I am using the following piece of code in order to get an oracle connection in a custom smart service plugin :-</p>
<pre><code>public static Connection openNewConnection(String url, String username, String password) throws ClassNotFoundE... | <p>According to "Display Name is missing's" answer on this <a href="http://stackoverflow.com/questions/27281407/error-casting-t4cconnection-to-oracleconnection">Error casting T4CConnection to OracleConnection</a> , ojdbcN.jar causes a conflict that you have to resolve by re-referencing correctly.</p>
|
How to Pass Parameters to JS HTTP Adapters in MobileFirst 8 <p>Adapter JS</p>
<pre><code>function getCitiesByCountry(countryName)
{
var request =
var request=
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET">
<soapenv:Header/>... | <p>A 415 is "Unsupported media type". This means that the server decided that the request you sent does not contain the type of data that the server thinks it should.</p>
<p>The reason you are getting this is because you are sending a POST request without a body and with query parameters. What you can do to solve this... |
What is the proper way of implementing form input validation with stateless components <p>So I've recently started working with react-native and I would obviously like to use best practices to work on my apps. That's why I decided to use redux and follow the advice to write stateless, functional components.</p>
<p>Onc... | <p>OK, I mentioned this was pretty much a meta question, but for me was a significant one, as I learned a lot while fiddling with it.</p>
<p>Hopefully what I learned will help someone running into same issue and save him time needed to research this topic with so little online resources:</p>
<ol>
<li>You can't and pr... |
I am building a Cart system, Added items displaying , i want same items in a group/addition <p>Here is My Code </p>
<p>Please have a look. It is displaying a single Item every time when a product is added to Cart, all I wants is to display single item once, and its total cost.<br>
Please guide...</p>
<pre><code> &l... | <p>you are not comparing the existing cart items with the new coming item in you method <code>addtoCart</code></p>
<p>use and array of id's which are already in cart and compare new id if it is already in the array then skip adding.</p>
<p>code should be like following:</p>
<pre><code><script>
var qty =0;
var ... |
How to remove Knockout.js ObservableArray-object after ajax call <p>I'm trying to remove an object from an ObservableArray after an ajax-call. It works with the '.pop' function, but not when I'm using the custom knockout.js '.remove'-function. </p>
<p>If I move the call to the '.remove' function outside the ajax-compl... | <p>You have replaced "data" variable object in the context of response handler:</p>
<p>was:</p>
<pre><code>self.removeItem = function(data) { // <- data
$.ajax({
type: 'POST',
url:'/echo/js/?js=hello%20world!',
dataType: 'json',
contentType: 'application/json',
data: nul... |
Liquibase + JPA: Run order <p>I have a Java Project in which I use JPA for persistence.
Now I want to integrate LiquiBase in my project, but I don't know how to change the order JPA/Liquibase are executed.</p>
<p>For clarity:
Until now my persistence.xml looks like this:</p>
<pre><code><property name="javax.persis... | <p>If you want to run Liquibase as part of your application I recommend to use one of the options documented in the "Automated" section:</p>
<p><a href="http://www.liquibase.org/documentation/running.html" rel="nofollow">http://www.liquibase.org/documentation/running.html</a></p>
<ul>
<li><a href="http://www.liquibas... |
Allow European Format input in ShieldUI NumericTextBox <p>By default ShieldNumericTextBox doesn't allow typing commas and format the entered number automatically to American format (e.g. after typing 10000, it will be 10,000).</p>
<p>I want to change the default format to European format, I found (textTemplate) option... | <p>ShieldUI uses Globalize JS to handle culture-specific formatting of values.</p>
<p>In your case, you should first set the culture to one that separates integer from decimal digits of a number with a comma instead of a period. Then you can set a format for the textTemplate to display it as a numeric value with 2 dec... |
Merging complex 2D arrays into one <p>I am fetching a row from a table on UI.Below is just one row
Values from table UI on my console : </p>
<pre><code>[ ' 0',
'ALPHA NUMERIC(100)\nPG_8_2670\nSt.Athens.,Pt\n1062645\nAutomation-if add row is editable\nALPHA NUMERIC(20)\nTIMESTAMP(19)\nYYYY-MM-DD(19)\n0' ]
</code></p... | <p>Fundamentally it doesn't look like you need these lines</p>
<pre><code> str = str.replace(/\n/g,",");
values = str.split(',').toString();
</code></pre>
<p>It may be far more effective to just split on the \n directly; thus</p>
<pre><code> values = str.split('\n');
</code></pre>
<p>You may want to manage the ... |
Visual Studio Add In template not showing on Visual Studio 2015 <p>I'm trying to create an add-in for Sql Server Management Studio following the steps in <a href="https://sqljudo.wordpress.com/31-days-of-sql-server-management-studio/ssms-day-27-building-a-custom-add-in-extension/" rel="nofollow">this tutorial</a>. Howe... | <p>Most likely you have to install <a href="https://msdn.microsoft.com/en-us/library/bb166441.aspx" rel="nofollow">Visual Studio SDK</a>. With this SDK you can extend Visual Studio features. And since SSMS is built on top of VS you will be able to create SSMS plugins as well.</p>
|
How to add git hook to the remote repository? <p>I've created a pre-commite hook and it works on my local machine, but I don't know how can I share this hook with my collegs </p>
<p>I will be grateful for any help.</p>
<p>Thanks in advance Denis</p>
| <blockquote>
<p>Itâs important to note that client-side hooks are not copied when you
clone a repository.</p>
</blockquote>
<p>On Server side, the 1st hook is <a href="https://git-scm.com/book/it/v2/Customizing-Git-Git-Hooks#Server-Side-Hooks" rel="nofollow">pre-receive</a>.</p>
<p>Not everything is possible in... |
configuring docker in mac <p>I want to configure docker(which is running on mac) with <code>DOCKER_OPTS</code> variable pointing to my server ip addresses .</p>
<p>In linux we can configure the docker file present in <code>/etc/default</code>.</p>
<p>How can we achieve the same thing in mac?</p>
| <p>You could export <code>DOCKER_OPTS</code> as</p>
<pre><code>DOCKER_OPTS="-g $(readlink -f /path/to/your/config/file)"
</code></pre>
<p>Since <a href="http://stackoverflow.com/a/4031502/6309">Mac does not have <code>readlink -f</code></a>, use greadlink instead</p>
<pre><code>export DOCKER_OPTS="-g $(greadlink -f ... |
css background image not loading, can't see the property in firebug at all <p>I am trying to create a simple landing page and my css backrgound-image is not loading.
This is the code I'm using</p>
<pre><code>landing_container {
display: inline-block;
width: 100%;
height: 100%;
background: rgba(255, 255... | <p><code><landing_container></code> is a very bad custom tag. However, I see your problem that you are not shared here in your question, the problem is that your CSS files start with a <code><style></code> tag. That's totally wrong!</p>
<p>You have:</p>
<pre><code><style>
landing_container {
..... |
JavaFx text movement animation <p>Hi I want to do something like this:<br>
I have text and I want the text to be moving from right to left all the time. I want to set bounds to moving text is a pane bounds. Now I have this but it doesn't work the way I want it to work</p>
<pre><code> public static void start(Text msg... | <p>You dont need <code>KeyValue endKeyValue</code> and <code>KeyFrame endFrame</code> <strong>--></strong> remove them. Add <code>timeline.setAutoReverse(true);</code> before <code>timeline.play();</code>.</p>
<p><code>Timeline timeline = new Timeline(initFrame, endFrame);</code> <strong>--></strong> <code>Timeline t... |
openpyxl: Gives error on load_workbook() <p>The following code was executing fine, until I setup the development environment on a different computer. </p>
<pre><code>workbook_obj = load_workbook(filename=xl_file, data_only=True, use_iterators=True)
</code></pre>
<p>I get the following error: </p>
<pre><code>TypeErro... | <p>The <code>use_iterators</code> keyword <a href="https://openpyxl.readthedocs.io/en/default/changes.html?highlight=use_iterators#id14" rel="nofollow">was removed</a> since 2.4.0. Use <code>read_only=True</code> instead.</p>
|
What's the replacement for history's useBeforeUnload to show a confirmation dialog in react-router? <p>In the <a href="https://github.com/ReactTraining/react-router/blob/master/docs/guides/Histories.md#examples" rel="nofollow">example here</a> and in this <a href="https://github.com/ReactTraining/react-router/issues/31... | <p>Taking a look at the code for <a href="https://github.com/mjackson/history" rel="nofollow">history</a>'s createBrowserHistory, it looks like the <code>block</code> function does what you need. From the docs:</p>
<pre><code>// Register a simple prompt message that will be shown the
// user before they navigate away ... |
Does ng-repeat logic fire if its wrapped in a ng-if <p>So I have a ng-repeat that i want to show conditionally. If I wrap it with ng-if does that stop it from looping? Im trying to be careful about resources </p>
| <p><code>ng-if</code> will include the DOM node only if the expression is valid. If it is not valid, then the <code>ng-repeat</code> will <strong>not</strong> fire, if it is within an <code>ng-if</code></p>
<blockquote>
<p>The ngIf directive removes or recreates a portion of the DOM tree based on an {expression}. If... |
Reduce/Shrink Git repository on Windows <p>I am using Git on Windows 10, along with Netbeans 8.1, also testing Smartgit. Once the repository was created, I have accidentally committed binaries and other-than-source files and the repository size whopped to 680MB!
Although I have created a .gitignore file and manually in... | <p>Well, <code>.gitignore</code> only ignores certain files located in the work tree; it certainly not does anything to whatever <em>had already been committed</em> and is thus stored in the repository's object store.
In other words, <code>.gitignore</code> is sort-of a filter helping you visually weed out irrelevant s... |
How do you save additional parameters using Reform <p>Here is my main Reform Form object;</p>
<pre><code>class CardHolderSupplierForm < ApplicationForm
property :supplier_id, validates: { presence: true }
property :standing_order, form: StandingOrderForm
end
</code></pre>
<p>And the StandingOrderForm is;</p>
... | <p>How about using Reform's default value setting?</p>
<pre><code>property :amount_currency, default: "GBP"
</code></pre>
|
springMVC : No message found under code 'com.info.write.text' for locale 'en_US' <p>While reading properties file from folder <code>com.resources</code> I got following error</p>
<p><code>javax.servlet.jsp.JspTagException: No message found under code 'com.info.write.text' for locale 'en_US'.</code></p>
<p>I am not us... | <p>Either use full name in <code>dispatcherServlet-servlet.xml</code>
like </p>
<pre><code><property name="basename" value="src/com/resources/message" />
</code></pre>
<p>or use <code>ClassPath</code> like</p>
<pre><code><property name="basename" value="classpath*:resources/message" />
</code></pre>
|
Trim zeros from decimal part php <p>My exact requirement is, if the second decimal of the value is zero,
the value should only have one decimal. For others, it should have two decimal.<br></p>
<pre><code>eg 1. 150.00 to 150.0
eg 2. 150.10 to 150.1
eg 3. 150.76 to 150.76
</code></pre>
<p>What I need to know is whe... | <p>You can use substr() function also to remove last char if it is 0. May be the below code will help you</p>
<pre><code>function roundit($string)
{
$string = number_format($string,2);
if (substr($string, -1, 1) == '0')
{
$string = substr($string, 0, -1);
echo $string;
}
else
echo $string;
}
roundit('150.00'... |
Show all commits with diff for a file <p>I'm looking for a cleaner way to accomplish the following:</p>
<pre><code>for a in $(git log --abbrev=commit --pretty=format:'%H' -- '**/MyFile.java'); do git show $a -- '**/MyFile.java'; done
</code></pre>
<p>I want to <code>git show</code> all changes to a file for all commi... | <p>Does this help you ?</p>
<pre><code>git log -p **/MyFile.java
</code></pre>
|
How to run multiple WebClients at the same time? <p>Here's my code</p>
<pre><code>try
{
for (int i = 0; i < RichTextbox2.Lines.Length; i++)
{
var length = urlwebapi.Lines.Length;
{
WebClient f = new WebClient();
dynamic read = f.DownloadString(urlwebapi.Lines[(i % len... | <p>Here is sample code for how to do it:</p>
<pre><code>public async Task<string[]> DownloadStringsAsync(string[] urls)
{
var tasks = new Task<string>[urls.Length];
for(int i=0; i<tasks.Length; i++)
{
tasks[i] = DownloadStringAsync(urls[i]);
}
retu... |
Check Puppet module files source exists before copy <p>I'm using Puppet for certificates transfer from Puppet Server to Windows node. Puppet Server has a folder where new certificates are being copied from my CA (another server). So, sometimes Puppet may not find a certificate (it wasn't transferred from CA to source d... | <blockquote>
<p>How can I make it check certificate presence in module files directory (puppet:///modules/modulename/) before I try to copy it?</p>
</blockquote>
<p>You could write a <a href="https://docs.puppet.com/guides/custom_functions.html" rel="nofollow">custom function</a> that checks for a file in the module... |
Load on Click Javascript or jquery <p>I have a page with several different iframes which are delaying my loading time so I'd like them to load only when I click on a separate button. </p>
<p>As I have it set up now, there are "window blocks" and inside each one of these divs there are two siblings, the "app link" and ... | <p>I think what you need is AJAX. A button click sends a request to the server and writes the response HTML into the window. The <a href="http://www.w3schools.com/ajax/default.asp" rel="nofollow">W3Schools tutorial</a> is pretty straightforward.</p>
|
Angular variable not updating on Blur-admin template <p>I'm using Blur-admin template but I can not figure out why when I update angular variable it is not updating inside ba-panel. for example:</p>
<pre><code><div class="widgets">
<div class="row">
<div class="col-md-12">
<div ba-panel ba-pan... | <p>Issue could be related to scope nesting.
try using dot access to variable inside templates and controllers like</p>
<pre><code>$rootScope.obj.foodTableData = [{title: '123'}];
$rootScope.obj.foodTableData[0].title;
</code></pre>
<p>easiest way to protect agains these errors - controllerAs syntax</p>
|
Split rows by name <p>My stored procedure gets info from SQL DB. Now I want to add the info to a crystal report and display the PDF with all the details. </p>
<p>I use Visual Studio with Crystal reports installed, coding in C# using Dataset to get my info from SQL. The info is a list of names with 3 other details that... | <p>The solution that I have ended up with was to create a sub report, place it on top of the table I have created in my second picture. Then added the columns to the sub-report, took away any borders. And then between the container size on the report and with the paragraph options of the container I adjusted the line s... |
How to set Placeholder and PlaceHolder Color <p><strong><em>How to set Placeholder and PlaceHolder Color in editor in xamarin.forms it has no default Functionality how to customize it?</em></strong></p>
| <p>You will need a custom renderer for that (Here is the Android Custom Renderer) you will need another renderer for iOS:</p>
<pre><code>public class PlaceholderEditor : Editor
{
public static readonly BindableProperty PlaceholderProperty =
BindableProperty.Create<PlaceholderEditor, string>(view =>... |
Transferring information from input sheet to master sheet <p>I am trying to move data from one workbook 'input worksheet' to another workbook 'master workbook'. Both sheets are in the same file and if possible, it would be great if both files didn't have to be open at the same time in order to transfer the data but the... | <ol>
<li>Use the macros <a href="http://www.rondebruin.nl/win/s9/win005.htm" rel="nofollow">here</a> to get the last row in the master sheet.</li>
<li>Then simply write the values from the input sheet to the corresponding cell in the master sheet.</li>
<li><p>That is all. This is how you refer cells:</p>
<p>tbl_master... |
Translator using Antlr4 <p>I want to create a translator from SQL to XQuery.<br>
I want to parse SQL and generate an intermediate structure and then use it to generate the XQuery query.<br>
(Note- I want to use an intermediate representation because i'm looking forward to translating SQL to other Query languages in fut... | <p>This depends on what you want to do and in what language you want to do it. Now you have your grammar you should be looking into what language you wish to develop a parser for that language in. Antlr4 has runtimes for Java,javascript and python. </p>
<p>So you can <strong>compile your grammar</strong> to one of tho... |
make image thumbnail before upload - php codeigniter <p>I want to resize the image to 160 x 160 and make thumbnail of it and then store that thumbnail in the folder. I don't want to store the real image, but the thumbnail of it only. Below is my code:</p>
<pre><code> $this->load->library('upload');
$this-&... | <pre><code>$config['image_library'] = 'gd2';
$config['source_image'] = $_FILES['image']['tmp_name'];
$config['new_image'] = $target_path
$config['maintain_ratio'] = TRUE;
$config['width'] = 160;
$config['height'] = 160;
$this->load->library('image_lib', $config);
if (!$this->image_lib->resize()) {
... |
Unable to render anything using angular js on RoR <p>I am following this tutorial <a href="https://thinkster.io/angular-rails" rel="nofollow">https://thinkster.io/angular-rails</a> to setup angular js on RoR. I am stuck here as it is not rendering home.html partial present with in assets/javascripts/home/_home.html. br... | <p>So, if I read your post, and the original tutorial correctly, it looks like you are pulling out some of the code that the tutorial had originally put in the application file, and trying to put it into a partial entitled _home.html</p>
<p>The major problem is that you don't tell application to render the partial any... |
Changing the Height of a wxToolBar <p>I want to set the height of a toolbar to the same height as it's neighboring tool bar. I'm setting these toolbars up with an .xrc file. Here's what I'm seeing:</p>
<p><a href="http://i.stack.imgur.com/5cuQG.png" rel="nofollow"><img src="http://i.stack.imgur.com/5cuQG.png" alt="ent... | <p>Well an ugly solution seems to be to actually draw the bitmap <em>and</em> the text, but have the bitmap be 0 width and use a transparent 1x1 bitmap: <a href="http://i.stack.imgur.com/tXZKH.png" rel="nofollow">http://i.stack.imgur.com/tXZKH.png</a></p>
<p>I was able to validate this works by:</p>
<ol>
<li>Removing... |
there is some way to change the text of the days in a calendar? <p>By default, in the days of calendar it is shown the day of the month, but I would like to modify the calendar to be able to show more text, like the events of the day.</p>
<p>I have serach on internet and I have found examples how to create a new contr... | <p>If you want to customize the Data displayed in a Datepicker- or Calendarcontrol you need to modify its control template.</p>
<p>This is the way to go if you want to extend any WPF Control.
You can find information on how to specifity modify the calendar control <a href="https://msdn.microsoft.com/de-de/magazine/dd8... |
Is it possible to use Jupyter Notebook in Google Cloud Shell? <p>What I have tried:</p>
<p>Start Google Cloud shell</p>
<pre><code>sudo pip install jupyter
jupyter notebook --generate-config
</code></pre>
<p>Add the following to <code>~/.jupyter/jupyter_notebook_config.py</code></p>
<pre><code>c.NotebookApp.ip = 'l... | <p>Yes. Google Cloud Shell is not meant to stand up a web socket service and is not configured for that. In addition, there are service limits that you'll likely hit if you try to do this, check the Usage Limits and Outgoing Connections sections <a href="https://cloud.google.com/shell/docs/limitations" rel="nofollow">h... |
Format percentage with optional decimal places in Excel <p>I have some cells in Excel with decimal places in, which I want to format as percentages. However, I only want decimal places to appear if the decimals are non-zero. For example, I have many cells which contain numbers such as:</p>
<p><code>0.09</code></p>
<p... | <p>Format your column as percentage with your desired number of decimal places.
Then, to eliminate decimal places for those percentages that have only two significant numbers after the decimal point, use conditional format:</p>
<p>Rule Formula: (substitute your range to format for C1, or copy/paste the formatting fro... |
Is it possible to create an Dialog with TabLayout and viewPager in Android? <p>I want to create an AlertDialog with scrollable tabs and viewpager like the screenshot below. I tried implementing but facing a runtime error, please find the below code. Thanks in Advance.</p>
<p><a href="http://i.stack.imgur.com/dT9Ql.png... | <p>Creating alert dialog with viewpager / tab might take severe load because its within activity and process adapters very time it creates a dialog.
You can use <strong>dialog activity</strong> instead and activity for results to get the results back.</p>
|
VBA - Load event code not running <p>I have a very simple form that, when loaded, should create a new object <code>Thing</code> that is defined in a specific Class Module. The UF also has several buttons associated to different functions.</p>
<p>This is the UF's code associate to the load event:</p>
<pre><code>Option... | <p>Write your code within </p>
<pre><code>Private Sub UserForm_Initialize()
End Sub
</code></pre>
<p>UserForm_Load is in VB.Net while in VBA its UserForm_Initialize.</p>
|
On allow permission in AndroidFragment causes application to crash? <p>Hi I am asking camera permission in android from my fragment using following code :</p>
<pre><code> ActivityCompat.requestPermissions(getActivity(),
new String[]{Manifest.permission.CAMERA,
... | <p>If your target sdk is below 23. The permission result will always return 0(PERMISSION_GRANTED). Change the target sdk version to 23 and try.</p>
<p>Ref: <a href="http://stackoverflow.com/questions/33407250/checkselfpermission-method-is-not-working-in-targetsdkversion-22">CheckSelfPermission method is not working in... |
Logstash custom matching <pre><code> AppliedProperty_PurchaseStatus = (string) <SOLD>
AppliedProperty_UrlText = (string) <http://www.dummyurl.com>
MA_Number= (decimal) [123456789]
</code></pre>
<p>I'm trying to figure out how to do some matching with grok while importing logs for applications. But to ... | <p>A regular Expression for that number, assuming there each line is processed one-by-one, with grok, would be: </p>
<pre><code>MA_Number= \(decimal\) \[%{NUMBER}\]
</code></pre>
<p>NUMBER is a pattern defined by grok, alongside a lot of patterns that can help you: </p>
<p><a href="https://github.com/elastic/logstas... |
How to Handing sub-links --"stale element reference: element is not attached to the page document" <p>Objective : Script to click on sub-links one by one and verify page existence</p>
<p>scenario :
when i mouse hover onto the Category Link -- It display the Sub category Links(List) on the right : </p>
<p>as i take b... | <p>You get stale element when you search for an element and before doing any action on it the page has changed/reloaded.</p>
<p>Make sure the page is fully loaded before doing any actions in the page.
First wait for the page to be loaded -> then find the element and execute action.</p>
<p>If you save all links in an ... |
Detect how many items an object collided with / negating more than one object <p>In creating a small breakout clone using Cocos2d-JS, I've managed to get the ball to bounce whenever it hits a block by negating (or multiplying by -1) either the X or the Y values.</p>
<p>This works, at least until the ball (which is rea... | <p>Without knowing how you're initiating that collision check (I assume you or the engine under the hood are using requestAnimationFrame, or setInterval, and then you're just iterating over every single brick and testing against the ball), it's hard to give you a perfect solution. But assuming that's what you're doing,... |
Why std::vector::insert failed when insert duplicated element in VS2010? <pre><code>class RawPixElement{
public:
CRawPixElement(int iRes) : m_iResolution(iRes) {
m_szRawData = new unsigned char[iRes * iRes];
};
~CRawPixElement() { if(m_szRawData) delete[] m_szRawData; };
CRawPixElement(const C... | <p>Need to realloc in "operator=" when the m_res bigger than the value of the old element.</p>
|
unity Draw directly to a Canvas from Script <p>In Unity3D I want to draw a GUI in world Space.
Its needed that the UI isnt static. It have to be created from a script.</p>
<p>But I cant figure out how to do this.
Calling GUI:Box() just adds the box to the screen UI.</p>
<p>Edit:</p>
<p>I did some Research and figure... | <p>Okay I got this to work, no need for a captain here.</p>
<p>Include this</p>
<pre><code>using UnityEngine.UI;
</code></pre>
<p>and then u hava access to the UI Components.
For example a Text</p>
<pre><code>o.AddComponent<CanvasRenderer>();
o.AddComponent<Text>();
o.GetComponent<Text>().text = "... |
Use a loop to draw plot in R <p>I'm just wondering how I can use a loop to go through some models and draw graphs for them?</p>
<p>I've got lots of mixture models by age groups, with each age group I've fitted 2, 3, 4, 5 component models. I've named them using the following method:</p>
<pre><code> ag1.mix2
ag1.mix... | <p>You can try use <code>get</code></p>
<p>like </p>
<pre><code>for(j in 2:5) {
data_to_plot=get(paste0("ag", i, ".mix", j ))
plot(data_to_plot, which = 2, las = 1, breaks = 100,
main2 = paste(j, "components"))
}
</code></pre>
<p>small working example :</p>
<pre><code>data1=1:10
data2=2:20
for... |
Saving game progress files at path /storage/emulated/0/namefolder is this really allowed to do? <p>I'm developing a game in Unity for android and I am using a standard different folder Application path.<strong>persistentDataPath</strong> to save my game progress, coins etc. I'm doing this because if anyone uninstall th... | <p>yes android device allows to read and write the data from external storage. your requirement also if game is deleted,but game state should not lost. so you should write the data in external storage (not in sd card, because sd card may be removed after some days also).</p>
<ol>
<li>Environment.getExternalStorageDire... |
AJAX requests not working in cordova? <p>From what I've gathered every piece of communication with the database should go through ajax requests in cordova application. So i've set up a localhost, made a database, created my php files somewhere there and started setting up cordova. I've developed it in browser first and... | <p>Use IP address of your computer instead of <code>localhost</code>.Then it will work.
No need to copy those files.It will automatically copy when you build your application.</p>
|
Applying gradient background for UIView using auto layout <p>I extended UIView to add a addGradientWithColor() method to get the gradient background:</p>
<pre><code> extension UIView {
func addGradientWithColor() {
let gradient = CAGradientLayer()
gradient.frame = self.bounds
gradient.colors = [gradi... | <p>you could save a reference to the layer, and adjust it's frame in the views <code>layoutSublayersOfLayer</code> method. this could be outsourced in an UIView subclass:</p>
<pre><code>class GradientView: UIView {
private let gradient : CAGradientLayer = CAGradientLayer()
/**
displays a gradient on the view
*/
fu... |
Requested: http://www.w3.org/2000/svg Found: https://www.w3.org/2000/svg <p>We are using <code>apache batik</code> to render svg files,
Security reasons all the urls are converted to http</p>
<p>Now, when we are rendering the svg files, we get this issue.</p>
<p>original svg is: </p>
<pre><code>svg xmlns=\"http://ww... | <p>Don't change the URLs for namespace definitions. These are the attributes starting with <code>xmlns</code>, optionally followed by a <code>:</code> and a more detailed name.</p>
<p>For SVG, the namespace must be <code>http://www.w3.org/2000/svg</code>, see <a href="https://www.w3.org/TR/SVG/intro.html#NamespaceAndD... |
Not sure which view to use for one button scannable interface <p>I need to create an interface that supports scanning over buttons like <a href="https://youtu.be/8LZzx0wwdFc?t=1m39s" rel="nofollow">the Windows on-screen-keyboard does</a>. The interface should look like a Gridview. With items supplied by an Adapter. </p... | <p>If no adapter exists that can handle 2d arrays, you can make your own by extending BaseAdapter and implementing your own logic for mapping a regular int index to a position in your 2d array.</p>
|
How to create root folder for team project <p>I wanted to delete version control for a team project so I could restart with a new solution. I used ts destroy command to delete everything. But now I don't have a root folder anymore in my source control for an existing team project.</p>
<p>I don't want to delete the tea... | <p>The destroy action cannot be reversed. If you want to clean up version control systems, we recommend that you first <a href="https://www.visualstudio.com/en-us/docs/tfvc/delete-restore-files-folders" rel="nofollow">delete the files</a> you want to destroy. After you delete the files you can synchronize the Team Foun... |
hibernate criteria query order by join table field <p>I use mysql database and have two tables <code>chapter</code> and <code>chapter_title_1</code>, there is a fk <code>chapter_id</code> in table <code>chapter_title_1</code> reference to table <code>chapter</code>.</p>
<p><a href="http://i.stack.imgur.com/saFxp.png" ... | <p>You can simply do :</p>
<pre><code>ChapterEntity.class
@OneToMany(fetch=FetchType.EAGER , mappedBy="ChapterEntity")
@OrderBy("sequence Desc")
List<ChapterTitle1Entity> chapterTitle1EntityList;
</code></pre>
<p>But the code will become globle for the list.</p>
|
Collosus Hello World Example <p>I want to use Colossus to make a REST server. However I have a difficulty running the hello world example shown here <a href="http://tumblr.github.io/colossus/docs/quickstart/" rel="nofollow">http://tumblr.github.io/colossus/docs/quickstart/</a>.</p>
<p>I want to use maven so I created ... | <p>It looks like you've only added <code>colossus-metrics_2.10</code> as a dependency, however that actually has no dependency on colossus itself, so you're not actually pulling in colossus.</p>
<p>I haven't tried to reproduce myself, but I think if you add another dependency for <code>colossus_2.10</code> it should f... |
Getting worse search performance with a replica shard <p>To increase search performance, I tried to add a replica to my cluster.
Initially, I measured a response time of around 700ms for a specific request with a single node with a primary shard.
After adding a node and a replica shard to the cluster, it takes averagel... | <p>There are a lot of elements that can affect the performance of your cluster and query speeds.</p>
<p>I suggest you follow Elasticsearch's <a href="https://www.elastic.co/guide/en/elasticsearch/guide/current/deploy.html" rel="nofollow">Production Deployment</a> document, this will give you a lot of insight on how to... |
How to get the id of the sorted item of the spinner? <p>I am getting data from the json. I have sorted the country name accordingly alphabetically.but when i click on the spinner item i am getting the worng id of the item.can anyone tell me how can i get the id of the sorted item of the spinner.</p>
<p>This is my json... | <p>Save your parsed values(ID and Country name) in a Hashmap. Then sort the hashmap using the code below.</p>
<pre><code>public LinkedHashMap<Integer, String> sortHashMapByValues(
HashMap<Integer, String> passedMap) {
List<Integer> mapKeys = new ArrayList<>(passedMap.keySet());
... |
Hide "non-element" using css <p>Following code:</p>
<pre><code><li>
<a href="...">bla</a>
<span>blabla</span>
hidethistext
</li>
</code></pre>
<p>How could I hide the "non-element" "hidethistext" with <code>display:none</code> using CSS without affecting everything else... | <p>You can't. With css you can only select elements. The <code>:not</code> selector is used to select an element that is not of class <code>x</code>, does not have id <code>y</code> or is not element <code>z</code>. But <code>hidethistext</code> is just a textnode, which cannot be selected. The only solution is to wrap... |
iOS Xcode: How to keep one background image for launch screen storyboard which will work for both orientations on iPad <p>I am designing my app's launch image using "Launch Screen" storyboard. My idea is to add a <code>UIImageView</code> to the canvas, make it fill the screen and apply auto-layout to fit for different ... | <p>Try using size classes with 2 imageViews.</p>
<p>Select iPad -> make orientation landscape. Then make 1st imageView installed for landscape and at the same time disable the 2nd imageView, then switch to portrait and do the opposite what you have done.</p>
<p>Edit:</p>
<p>The solution I posted would help if you wa... |
How to find all category with the help of attribute for menu purpose in magento? <p>I need category list with the help of attribute for creating custom menu visible in all pages.</p>
<p>I can display the attribute on the category page but i need to be able to echo the list on all the pages.</p>
<p><a href="http://i.s... | <pre><code><?php
$product = Mage::getModel('catalog/product');
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilte... |
selectize.js : Preselect more than one value (default tagging values) <p>This HTML Code:</p>
<pre><code><select id="mySelect" name="mySelect" placeholder="Beruf">
<option value="">-- Bitte wählen -- </option>
<option value="1">Koch</option>
<option value="2" selected="selected">Fis... | <p>You forgot the multiple attribute :</p>
<pre><code><select id="mySelect" multiple name="mySelect" placeholder="Beruf">
<option value="">-- Bitte wählen -- </option>
<option value="1">Koch</option>
<option value="2" selected="selected">Fischer</option>
<option va... |
How to handle button click from iOS and Android par separately from Xamarin iOS and Xamarin Android app using Xamarin Forms using PCL <p>I am new in C# and Xamarin I am creating a Xamarin Forms App and want o create an button that can handle different task from different platform (i.e. iOS & Android).
Suppose I wan... | <p>use <a href="https://developer.xamarin.com/api/member/Xamarin.Forms.Device.OnPlatform/" rel="nofollow">Device.OnPlatform()</a></p>
<pre><code>public void OnButtonClicked (object sender, EventArgs args)
{
Device.OnPlatform (iOS: () => { // do iOS stuff; },
Android: () => { // do And... |
ASP.NET MVC 5 Service Unavailable <p>I have been working on a VS2015 solution for the last year and a half until suddenly I can't debug my ASP.NET MVC 5 application any more. As I hit F5, the application opens a new tab in the browser and only renders this:</p>
<blockquote>
<p>The service is unavailable.</p>
</block... | <p>There is a lot of things in ASP.NET MVC 5 project which can make trouble to your code.</p>
<ol>
<li><p>Remove the .vs folder. In my case I got code from someone else and it's set path as her machine so it's won't work until I remove it.</p></li>
<li><p>Remove the "IISExpress" folder from Document folder. Maybe it's... |
Cassandra Unable to gossip with any seeds <p>At first I downloaded Cassandra 3.7 and installed it on a remote machine (still in the same network) But I wanted to run this as a service so I downloaded and installed the <code>DataStax_DDC_Server 3.7.0</code></p>
<p>But when I try to connect remotely to the service I get... | <p>To join new node in cluster you should change cassandra.yaml of that one:</p>
<ol>
<li><p>Specify cluster name (should be the same for all cluster nodes):</p>
<p>cluster_name: 'MyCluster'</p></li>
<li><p>Specify seed nodes of cluster (on seed node this own ip or/and other seeds):</p></li>
</ol>
<p>seed_provider: ... |
How to access elements of an array of an array of objects? <pre><code>public class arrayOfArrays{
public Object[] array1;
public int size;
arrayOfArrays(){
array1 = new Object[10];
array1[0] = new arrayOfInts();
}
}
class arrayOfInts{
public Integer[] ... | <p>I don't really understand why you creates those classes.</p>
<p>You can simply store any kind of things in an Object array.</p>
<pre><code>Object[] array1 = new Object[ 5 ];
Random rd = new Random();
for( int i = 0; i<5; i++ )
array1[ i ] = new int[ rd.nextInt( 5 ) + 1 ];
System.out.println( Arrays.deepToSt... |
JavaFX image loading memory leak? <p>I'm trying to build an application for "gesture drawing", which is basically just a slideshow of images in set intervals. I noticed that whenever I load a new image that's for instance less than 1MB the memory usage of my app increases by over 20MB, every time a new image loads.</p>... | <p>This is normal behavior. When you load a new image, it will consume approximately 4 bytes per pixel. As long as you don't accidentally keep references to images you are no longer using, they will become eligible for garbage collection in the normal way. You have little control over when the garbage collector will re... |
How to fire an event on option element click or a workaround in Chrome, Safari and Opera <p>So i already done some research and know that Chrome, Opera and Safari don't fire event on option click like FF and IE. I have read some suggestions to use on change to achieve the outcome that i want, but was not able to get i... | <p>You can get the select value on change and work with this value. Like this:</p>
<pre><code><script>
$(document).ready(function () {
$("#topic").on('change', function() {
var selectValue = $(this).val();
if (selectValue == '1') {
$("#a02").hide();
$("#a01").show();
} else if (se... |
upload excel to server <p>i work on a website and have a small problem.
i want an upload an excel file on my Server.
I did something like that before with pictures (upload profilpicture). Is it possible to change that code for excel files?</p>
<pre><code><form enctype="multipart/form-data" action="Profil.php" metho... | <p>change this string</p>
<pre><code>if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"&& $imageFileType != "gif" )
</code></pre>
<p>to be something like this</p>
<pre><code>if($file_ext != "xls" && $file_ext != "xlsx" && $file_ext != "csv")
</co... |
responsive image and the tile not scaling properly in highresolution monitor and retina display <p>I have large image similar to <a href="http://kdmedia.kanald.ro/kfetele/image/201411/w650/media_141552418646507200.jpg" rel="nofollow">this</a>. I need to put there images in bootstrap and align these to get layout simila... | <p>Remove pull-right, min-width and put the image inside a bootstrap div with img-responsive class. </p>
<pre><code><div class="container">
<div class="row">
<div class="col-sm-4">
<img src="" alt="" class="img-responsive">
</div>
<div class="co... |
Subscribe to incoming mails for all users (MTA/EWS API or else?) <p>My goal is to develop an Exchange listener that will intercept the organization mail box for new mails and for each mail it would do some logic. </p>
<p>After i've researched the subject online - i saw that there are two primary ways to do that:</p>
... | <p>You can use a Transport Agent on Exchange <a href="https://technet.microsoft.com/en-us/library/bb125012(v=exchg.150).aspx" rel="nofollow">https://technet.microsoft.com/en-us/library/bb125012(v=exchg.150).aspx</a> which allows you to capture/proces messages while they are in the Transport pipeline. The advantage of t... |
what is classSet? <p>please explain it...</p>
<pre><code><div className={classSet({
'Cell': true,
'Cell--highlighted': highlighted,
'Cell--hovered': hovered
})}></div>
</code></pre>
| <p>The key in object classSet is a name of css class. The value is a logical expression - if is true - class will be added to DOM element, if false, will not.</p>
<p>This library is now deprecated, look at this:
<a href="https://github.com/JedWatson/classnames" rel="nofollow">https://github.com/JedWatson/classnames</a... |
How do I get the filepath of an uploaded file? <p>I'm having difficulty passing the path of a file to a library called Textract.</p>
<pre><code>def file_to_string(filepath):
text = textract.process(filepath)
print text
return text
</code></pre>
<p>Here is my upload form in views.py</p>
<pre><code>if requ... | <p>Try using <code>file_to_string(file.name)</code>.</p>
<p>Docs: <a href="https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.fields.files.FieldFile.name" rel="nofollow">https://docs.djangoproject.com/en/1.10/ref/models/fields/#django.db.models.fields.files.FieldFile.name</a></p>
|
how to have a new value for each new user for time function in jmeter <p>I just wanted that <code>${__time(yyyyMMddHHmmss)}</code> should have its new value for each new user in Http samplers</p>
<p>What I have tried is:
* Used loop controller
* Used counter config element
etc. but still unable to produce a new valu... | <p><a href="https://jmeter.apache.org/usermanual/functions.html#__time" rel="nofollow">__time()</a> function returns current timestamp either in milliseconds since <a href="https://en.wikipedia.org/wiki/Unix_time" rel="nofollow">Unix epoch start</a> or according to pattern you specify. The function respects <a href="ht... |
Differences between jQuery .on() data argument and using javascript bind()? <p>In response to <a href="http://stackoverflow.com/q/15904243/814206" title="jQuery .on() method - passing argument to event handler function - Stack Overflow">jQuery .on() method - passing argument to event handler function</a> two ap... | <h2>Differences:</h2>
<ul>
<li><p><a href="http://api.jquery.com/on/" rel="nofollow" title=".on() | jQuery API Documentation">jQuery <code>on()</code></a> supplies the element from which the event originated as <code>this</code>.</p>
<p>With Javascript <a href="https://developer.mozilla.org/en-US/docs/Web/Jav... |
C++ getline(); displays one below <p>I have a strange problem here. I'm getting 2 strings as input using the code below:</p>
<pre><code>std::string input1, input2;
std::cout<<"Please enter name:";
std::getline(std::cin, input1);
std::cout<<"Address: ";
std::getline(std::cin,input2);
</code></pre>
<p>The i... | <p>Try using cin.ignore() before getline // ignores \n that has been left after user pressed enter key</p>
|
Align field names to right using iTextSharp <p>I use iTextSharp to generate pdf & after generate pdf I want to display text in following format </p>
<pre><code> First Name : sandip
Company : ABC
Mobile Number : 2222222222
</code></pre>
<p>My code is</p>
<pre><code>var MName = new Phrase();
MName.Add(new ... | <p>A structure as described by the OP can easily be created using a table with two or three columns (depending on whether one wants to put the colons into a column of their own or not) using right aligned content in the first column and left aligned content in the last one.</p>
<p>Even if the structure already is the ... |
Dirty Reads in SQL Server AlwaysOn <p>I have a pair of SQL Server 2014 databases set up as a synchronous AlwaysOn availability group.</p>
<p>Both servers are set to the <code>Synchronous commit</code> availability mode, with a session timeout of 50 seconds. The secondary is set to be a <code>Read-intent only</code> re... | <p>There is no way you can get dirty reads unless you are using no-lock hint..</p>
<p>When you enable Read Only secondaries in AlwaysOn..Internally SQL uses rowversioning to store Previous version of the row..</p>
<p>further you are using Synchronous commit mode,this ensures log records are committed first on seconda... |
GMS round icons <p>I'm implementing a map with google maps and for every marker I have an image. My question is: how can I make the icon round?
I try with classical layer.cornerRadius but it didn't work.</p>
<p>viewDidLoad</p>
<pre><code>self.artistImageView = [[UIImageView alloc] init];
self.artistImageView.layer.co... | <p>you can easy use this for any image operations :
<a href="https://github.com/gavinbunney/Toucan" rel="nofollow">Toucan Swift</a></p>
<p>My example :</p>
<pre><code> marker.icon = Toucan(image: marker.icon!).maskWithEllipse(borderWidth: 2, borderColor: UIColor.whiteColor()).image
</code></pre>
<p><a href="http://... |
libcheck test fails to link <p>I'm trying to build a simple example using <a href="https://github.com/libcheck/check" rel="nofollow">libcheck</a> but it fails to build while using the flags reported by pkg-config.</p>
<p>My file: tests/test.c</p>
<pre><code>#include <stdlib.h>
#include <check.h>
START_TE... | <p>Try adding the flags reported by pkg-config after the compilation command as this <a href="http://stackoverflow.com/questions/9716704/building-the-library-for-check-test-c-framework">answer</a> and the documentation for <a href="https://linux.die.net/man/1/pkg-config" rel="nofollow"><code>pkg-config</code></a> sugge... |
How to open a new tab in separate thread with JavaScript? (chrome) <p>Is it possible to open a new popup tab that would run in a separate thread? To be more specific, if I create a new popup tab and start debugging in that new tab, tab which contains link will also pause javascript until I click resume in a new tab. W... | <p>Usually chrome forces new window to run on the same Process ID.
But, there are techniques which allows sites to open a new window without forcing it into the same process:</p>
<p>Use a link to a different web site that targets a new window without passing on referrer information. </p>
<pre><code><a href="http:... |
JS wrap every text row into span <p>How can i wrap every text row into span?</p>
<p>From this code:</p>
<pre><code><p>
jkhkjh kjhjh jkhj
hghghjg hjg hj gh
hghkj jk kk
</p>
</code></pre>
<p>Desired result:</p>
<pre><code><p>
<span>jkhkjh kjhjh jkhj</span>
<span>hghghjg hjg hj gh&l... | <p>vanilla JS</p>
<pre><code> var p = document.getElementsByTagName('p')[0];
p.innerHTML = '<span>' + p.innerHTML.split('\n').join('</span><span>') + '</span>';
</code></pre>
|
Making an S shape with flexbox <p>I'm trying to reproduce this layout structure using flex.</p>
<pre><code>ooo
o
ooo
o
ooo
o
ooo
</code></pre>
<p>I can achieve this with regular display block/inline-block but I'm wrapping some elements just for positioning, and it feels hackish.</p>
<p><div class="snippet" data-... | <h2>This can be achieved using flexbox and <code>nth-child</code></h2>
<p>You can use <code>nth-child</code> to mark which elements are to align to the left and right and flexboxes <code>order</code> property means you do not need any nesting.</p>
<p>The following changes are required:</p>
<ul>
<li>Add <code>display... |
.htaccess redirect: wordpress multsite root domain http://example.com redirect to http://www.example.com ONLY ON ROOT <p>Basically, i still need the root domain to work in all sub-directories and can't use an apache VirtualHosts redirect because it will invalidate the multisite admin domain, but I don't want users to s... | <p>If you are using Apache 2.4 or newer you could use IF cases within your .htaccess file, test the following:</p>
<pre><code><If "%{HTTP_HOST} == 'yourdomain.com'">
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\. [NC]
... |
How to ensure that a Node.js style callback it is called only once <p>I am looking for a utility that will ensure that only first call of the callback is executed.</p>
<p>I know you can do something like code below, but I am looking for this functionality in some popular utility like lodash/underscore/async that does ... | <p>Underscore provides <a href="http://underscorejs.org/#once" rel="nofollow"><code>_.once</code></a></p>
<p>Lodash provides <a href="https://lodash.com/docs/4.15.0#once" rel="nofollow"><code>_.once</code></a></p>
<p>If you're using this for asynchronous code, you may find that promises provide a better abstraction.<... |
UndefinedFunctionException Attempted to call function xxx from namespace xxx <p>I have this error (under silex 2.0):</p>
<blockquote>
<p>UndefinedFunctionException in app.php line 88: Attempted to call function "postIndexArticle" from namespace "SocialWall\Controller".</p>
</blockquote>
<pre><code>in app.php line 8... | <p>You should use classes not functions, I would use </p>
<p>my app.php</p>
<pre><code><?php
use SocialWall\Controller;
$app['home.controller'] = function($app) {
return SocialWall\Controller\HomeController($app);
};
</code></pre>
<p>my route.php</p>
<pre><code><?php
// Home page
$app->get('/', 'hom... |
PHP array to csv string <p>I am NOT! a php developer and still this task ended on my desk. Creating some report for distributor.
I have made my query and getting my data out. But I am having troubles of converting the array into a CSV formatted string I can serve the clients.</p>
<p>The result I get:</p>
<pre><code>a... | <p>First it looks like you already have <code>array</code> so you don't need to <code>fetch()</code>, second you try access object property (<code>$row->id</code>) as array element (<code>$row['id']</code>). Here's example that should work:</p>
<pre><code>foreach($results as $row){ ... |
PHP csv string parsing <p>I have a PHP CSV file that looks like this:</p>
<pre><code>'numberOfProducts' 'lastUpdated'
'28' '2016-09-19 06:55'
</code></pre>
<p>I tried to do like this:</p>
<pre><code>print_r( str_getcsv( $csv, "\n", "\t" ) );
print_r( str_getcsv( $csv, "\t", "\n" ) );
</code></pre>
<p>It's just ... | <p>The documentation is quite clear</p>
<blockquote>
<p><code>array str_getcsv ( string $input [, string $delimiter = "," [, string $enclosure = '"' [, string $escape = "\\" ]]] )</code></p>
</blockquote>
<p>Your delimiter is neither <code>\n</code>, nor <code>\r</code> - which both represents line breaks. Your del... |
Google Testing Framework and Qt <p>I want to start using the Google C++ Testing Framework, but I don't understand how it use with Qt?</p>
<p>What should I do to start? How to link GTF to my project and use it? If possible, I'd like a detailed guide.</p>
| <p>There is nothing special about testing Qt in particular, just familiarize yourself with google testing and Qt, then write your test cases. You'd test Qt code like you'd test anything else. </p>
<p>Good places to start:</p>
<ul>
<li><a href="http://www.ibm.com/developerworks/aix/library/au-googletestingframework.ht... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.