input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Using `textField:shouldChangeCharactersInRange:`, how do i found that characters are mismatch? <p>I'm using the code below for setting validation of textfield as it should not enter above 15 character length .</p>
<pre><code> let limitLength = 15
func textField(textField: UITextField, shouldChangeCharactersInRange r... | <p>try like this </p>
<pre><code>func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -> Bool {
// set maximum length for password and confirm password
if textField == txtPassword { // if textfield password is editing
guard let text = textField... |
Pandas: Change values chosen by boolean indexing in a column without getting a warning <p>I have a dataframe, I want to change only those values of a column where another column fulfills a certain condition. I'm trying to do this with <code>iloc</code> at the moment and it either does not work or I'm getting that annoy... | <p>You are chaining you're selectors, leading to the warning. Consolidate the selection into one.<br>
Use <code>loc</code> instead</p>
<pre><code>DF.loc[DF['A'] == 1, 'B'] = 'X'
DF
</code></pre>
<p><a href="http://i.stack.imgur.com/HX26a.png" rel="nofollow"><img src="http://i.stack.imgur.com/HX26a.png" alt="enter im... |
Bluetooth socket doesn't work Android <p>I am trying to make an app that send audio over Bluetooth socket .So far I reached at the point that i get the paired devices and start the connect thread (client) but it dose not work probably i will ((right now i am just trying to send a text )).
this my code :</p>
<pre><code... | <p>Make sure your UUID in your client code is as same as the one in server code. The problem maybe because of your current UUID. You can get the UUID using the following in your server code:</p>
<pre><code>TelephonyManager mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
String s_uui... |
log4j: How can I direct logs into different files for a cron and for a webservice? <p>I have a Cron and a Webservice, both implemented using spring. The cron and the webservice use a set of classes A, B and C to achieve their objective. </p>
<p>In each class, I use log4j 2 as the logging mechanism as so:</p>
<pre><co... | <p>You can use below mentioned configuration if you want to log into different files using same class.</p>
<pre><code><Appenders>
<Console name="CONSOLE" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</Console>
... |
SystemJS import fails silently on bundled Angular2 app <p>I am having trouble with SystemJS.</p>
<p>I have a typical Angular2 application written in Typescript.
I am trying to bundle all my application .js into a single file to optimize load time.</p>
<p>The bundle is created by gulp using systemjs-builder like this ... | <p>I assume that you are quite advanced and you have good angular2 understanding.</p>
<p>I had similar issue with <code>@angular/upgrade</code> component. After serious headache, I have found out that some of the error messages are lost inside angular2 (even in currently stable package).</p>
<p>The possible source of... |
Umbraco back office menu doesn't show up <p>I am trying to install Umbraco 7.5.3 on an empty project but the back office has no items in the menus. It doesn't also load anything in the content tree.</p>
<p><a href="http://i.stack.imgur.com/UiJjK.png" rel="nofollow"><img src="http://i.stack.imgur.com/UiJjK.png" alt="en... | <p>Ok, I made it work. It sounds a bit strange, but it worked! I don't know why it wasn't on the how to page. and I still don't know what could be wrong :|</p>
<p>I had to set up the site on IIS and then accessing it using the domain address that I created.</p>
<p>So if anyone has the same problem do this:</p>
<p>1-... |
Customize Navigationview menu UI Android <p>I am using NavigationView control of android to create sliding drawer.
All is fine except spacing between Menu Items in navigation view as shown in image.</p>
<p>Thank you in advance guys<a href="http://i.stack.imgur.com/Oa2ds.jpg" rel="nofollow"><img src="http://i.stack.img... | <p>create a style with </p>
<pre><code> <style name="NavigationViewStyle">
<item name="android:listPreferredItemHeightSmall">25dp</item><!-- menu item height-->
</style>
</code></pre>
<p>and apply this style to NavigationView </p>
<pre><code> app:theme="@style/NavigationViewStyle"... |
Error in conversion from Swift 2 to Swift 3 <p>This is the second and last section I am battling with converting Swift 2 to Swift 3</p>
<p>The old working code was</p>
<pre><code>func calculateSegmentDirections(index: Int,
time: NSTimeInterval, routes: [MKRoute]) {
let request: MKDirectionsRequest = MKDirect... | <p><code>NSError</code> was renamed to <code>Error</code> in Swift 3.0 This may fix your issue.
This code compiles for me:</p>
<pre><code>func calculateSegmentDirections(index: Int,
time: TimeInterval, routes: [MKRoute]) {
let request: MKDirectionsRequest = MKDirectionsRequest()
re... |
Custom shortcode in Wordpress Nav Bar <p>I just want to add a shortcode button to my wordpress theme menu bar for handle the <code>bootstrap modal view</code> function. </p>
<p>I tried '<code>Shortcodes in Menus</code>' plugin, but it doesn't work. I couldn't find alternative plugin for shortcodes in menu so I install... | <p>If you share your shortcode generate markup or what markup you want to wrap with your shortcode that would be best to others understand clearly.</p>
<p>anyway try this it will work smoothly (Tested)</p>
<pre><code>add_filter( 'wp_nav_menu_items', 'wpse3967385_custom_menu_link', 10, 2 );
function wpse3967385_custo... |
JPA executes the query but data not inserted <p>I am using play 2.3 and tying to persist an object the console shows the query but data is not inserted in db.</p>
<pre><code>@Entity
@Table(name = "confrence_group")
public class ConfrenceGroup {
@Id
@Column(name = "id", length = 50, unique = true, nullable = fa... | <p>It seems your id generation is automatic by Mysql so you need
change <code>@GeneratedValue(strategy = GenerationType.AUTO)</code> to <code>@GeneratedValue(strategy=GenerationType.IDENTITY)</code></p>
|
graphite: how to get per-second metrics from batch metrics? <p>I'm trying to measure a online mini-batch processing system with a per-second metrics (total query per second). For every batch, a metric (e.g. <code>"stats.gauges.<host>.query.count"</code>) will be send to graphite. batches are processed in several ... | <p>You should use carbon-aggregator service to add several metrics together as they come in. There is an example which fits your case at <a href="http://graphite.readthedocs.io/en/latest/config-carbon.html#aggregation-rules-conf" rel="nofollow">http://graphite.readthedocs.io/en/latest/config-carbon.html#aggregation-rul... |
get data from android app and store it in sql database using php <p>I want to get data from my android app and put in sql database,which is in phpmyadmin(wampp server).
this is my code:</p>
<pre><code>package com.example.sara.myapplication;
import android.app.ProgressDialog;
import android.os.AsyncTask;
import androi... | <p>You are not using the values passed into the <code>register</code> method. Change this line:</p>
<pre><code>String urlSuffix = "?nome=nome&autore=autore&isbn=isbn";
</code></pre>
<p>to:</p>
<pre><code> String urlSuffix = "?nome="+nome+"&autore="+autore+"&isbn="+isbn";
</code></pre>
<p>And then ch... |
Division that rounds down rather than truncates <p>I need to align real values divided by some positive constant to nearest lower integer, regardless of their sign. Example are ( here the backslash represents my desired operator)</p>
<pre><code>21,5 \ 2 = 10
-21,5 \ 2 = -11
52,3 \ 2 = 26
-52,3 \ 2 = -27
</code></pre>
... | <p><code>std::floor</code> will solve your problem.</p>
<pre><code>#include <iostream>
#include <cmath>
using namespace std;
int main() {
// your code goes here
float i = -21.5,b=2;
int c = std::floor(i/b);
cout << c << endl;
i = 21.5,b=2;
c = std::floor(i/b);
cout... |
Django Set custom field in form not required <p>ModelAdmin</p>
<pre><code>class InstrumentAdmin(admin.ModelAdmin):
def get_form(self,request, obj=None, **kwargs):
if obj:
return UpdateForm
else:
return CreateForm
</code></pre>
<p>Update Form</p>
<pre><code>class Update... | <p>Fixes:</p>
<ol>
<li>initial=pk instead of name</li>
<li>Add required=False</li>
</ol>
|
Can I anchor nested FloatingActionButton to the viewport? <p>I have a layout which is nested as follows (I'm using pseudocode and skipping some tags for brevity)</p>
<p><strong>Activity Layout</strong>:</p>
<pre><code>CoOrdinatorLayout
- AppBarLayout
- FragmentOne
- FragmentTwo
</code></pre>
<p><str... | <p>The solution I used was to Programmaticaly create the FAB inside the Fragment (so the fragment is still the one correctly responsible for implementing it's listeners etc.) and then attach it to the Activity's CoOrdinator layout (which I found using a getter interface on the activity because it seems like the cleaner... |
android NDK HOWTO get stack trace without backtrace <p>I want to get stack trace when my progrom crash in my .so library, in fact, i call the interface in .so from JNI.</p>
<p>And I follow a old question, but not worked.
All I get in the dumpBacktrace is the signal handler itself.
Here's <a href="http://stackoverflow.... | <p>you should definitely check out coffecatch: <a href="https://github.com/xroche/coffeecatch" rel="nofollow">https://github.com/xroche/coffeecatch</a></p>
|
How to format decimals in Clustered column chart in PowerBI? <p>This is the problem I am facing, Picture depicts it much clear :</p>
<p><a href="http://i.stack.imgur.com/KhNov.png" rel="nofollow"><img src="http://i.stack.imgur.com/KhNov.png" alt="enter image description here"></a></p>
<p>I want to set the precision p... | <p>Choose your field first on Fields Pane, and then in the modeling tab, you can choose how many decimal places you wanna show:</p>
<p><a href="http://i.stack.imgur.com/Q7jar.png" rel="nofollow"><img src="http://i.stack.imgur.com/Q7jar.png" alt="enter image description here"></a></p>
<p>In your case, you might create... |
How to remove default date in mvc4 textbox? <p>I have one Textbox in mvc4 application as below.</p>
<pre><code>@Html.TextBoxFor(x=>x.dateofAction, ViewBag.filterdateTime as string, new { @id = "dateofAction", @placeholder = "Date Of Action", @class = "txtBox form-control calender validate[required]" })
</code></pr... | <p>In order to display an empty textbox with the placeholder, you need to make your property nullable. If also want a date to be selected, then you can also decorate the property with the <code>[Required]</code> attribute.</p>
<p>Note also that your <code>[DisplayFormat]</code> is unnecessary and is ignoted by the <co... |
R - cannot use variable generated by for loop as argument in table() <p>I'm trying to extract prop.test p-values over a set of columns in a dataframe existing in the global environment (df) and save them as a dataframe. I have a criteria column and 19 variable columns (among others)</p>
<pre><code>proportiontest <-... | <p>Currently in your function x is just a string. If you want to use a column from your data frame df you can do this in your for loop:</p>
<pre><code>x <- df[,i]
</code></pre>
<p>You'll then need to change z or you'll be cbinding a column to a single p value, maybe just change to this:</p>
<pre><code>z <- cbi... |
php check if file exist on multiple folders at the same time <p>when i want to check if a file exist and if exist add a suffix i use the following code which is working fine</p>
<pre><code> $increment = ''; //start with no suffix
while(file_exists($_SERVER["DOCUMENT_ROOT"]."/".$file_name . $increment . '.' . $e... | <p>I'll agree with @arkascha 's view that if the file is for internal use, using file name with unique hash will be better.</p>
<p>But if it's necessary,
Try use foreach() to check those prefix in your array at once.</p>
<pre><code>function files_suffix_exists($file_name, $folders){
$root = $_SERVER["DOCUMENT_ROO... |
What does this icon mean <p>What does this icon mean. I know my question must be answer even without the image but how hahaha, Im creating a database, do I need additional code in my php to create connection with my database? "fcm" and "fcm_db" are my databases, I created it and I think somehow it auto generated that "... | <p>It is a Group icon.</p>
<p>It displays when two or more databases start with the same name (prefix).
It has no effect on the database connection or anything.</p>
|
Spock: How to clear checkbox if already checked <p>How to uncheck a checkbox using Navigator object?
I have </p>
<pre><code>def checkboxes = $("input",class:"targetMltChk", name:"facility")
</code></pre>
<p>which is a group of checkboxes and some of them are checked. I want to uncheck all of them.</p>
<p>UPDATE:
I t... | <p>Have you tried:</p>
<pre><code>checkboxes*.value(false)
</code></pre>
<p>I believe that should uncheck them all...</p>
|
Edit text field to recycler View <p>I am trying to send the <code>editText</code> field to <code>recycler list</code> in next <code>activity</code> but I can't obtain it. The problem is I can't see the list of <code>editText</code> field I have added in the list. For example: when i add mercury from <code>editText</cod... | <p>change</p>
<pre><code>ArrayList<String> nameList = new ArrayList<String>();
</code></pre>
<p>to</p>
<pre><code>ArrayList<String> nameList;
</code></pre>
<p>and inside <strong>onCreate(..)</strong> add below line before listener</p>
<pre><code>nameList = new ArrayList<String>();
</code></... |
sum of more than two fields value and return it as new field in solr <p>Hi i have multiple docs in my solr having some fields of type integer. i want to summ these fields and return its value in new field. how can i do these. here following is example code.</p>
<pre><code><doc>
<field type="String" name="... | <p>Use fl parameter and add <code>totalCost</code> which takes sum of <code>extra</code> and <code>food</code> values. like below</p>
<pre><code>localhost:8983/solr/collection1/select?indent=on&q=*:*&wt=json&fl=name,totalCost:sum(food,extra)
</code></pre>
<p>Hope this helps</p>
|
SSH in to EB instance launched in VPC with NAT Gateway <p>I have Launched an Elastic Beanstalk application in a VPC with Amazon RDS (postgresql) using NAT Gateway (because I want to route my application traffic through a fix public ip address) following these instructions:</p>
<p><a href="http://docs.aws.amazon.com/el... | <p>You will have to have a server with a public IP (in a public VPC subnet) that you can connect to from outside your VPC. I recommend setting up a t2.nano server as a <a href="https://en.wikipedia.org/wiki/Bastion_host" rel="nofollow">bastion host</a>.</p>
|
how to get boolean value of XML data in oracle procedure <p>I am calling a SOAP webService from oracle which is returning xml response like:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<boolean xmlns="http://SOAPwebservice.com/WebServices/Methods">
false
</boolean>
</code></pre>
<... | <pre><code>WITH test_data AS
(SELECT xmltype('<boolean xmlns="http://SOAPwebservice.com/WebServices/Methods">false</boolean>') data
FROM dual
)
SELECT extractValue(data,'/boolean','xmlns="http://SOAPwebservice.com/WebServices/Methods"')
FROM test_data
</code></pre>
|
Prepend each element to its own parent only <p>I need help with jQuery. I am trying to move one element (author) from left column to right within its parent using <code>prepend</code>.
I need each author to be moved inside its own <code>post</code> container but right now all author elements moves to every parent conta... | <p>The behaviour you're seeing is because you're selecting all the <code>.author</code> elements and appending them together to all the <code>.col-right</code> elements. </p>
<p>Instead you need to loop through the <code>.author</code> elements and traverse the DOM to find it's related <code>.col-right</code>. Try thi... |
Displaying Results from Prepared Statements <p>I have the following table:</p>
<pre><code>| id | name | age |
|----|-------|-----|
| 1 | Peter | 23 |
| 2 | Amie | 34 |
| 3 | Eddy | 45 |
| 4 | Peter | 56 |
| 5 | Eddy | 67 |
</code></pre>
<p>I now want to retrieve the age of all users with the name <code>... | <p>just add this into your php function. this means you want to return json into this page </p>
<pre><code>header('Content-Type: application/json');
</code></pre>
<p>change your return $arr to echo json_encode($arr); to convert your array into a json object also remove your echo "Yes";</p>
<pre><code>echo json_encod... |
ISNUMERIC function with Tab char(9) <p>I was working with ISNUMERIC function in SQL Server, when I encountered a strange trouble.</p>
<p>Check text including below characters ISNUMERIC function return 1(true). Why?</p>
<pre><code>Tab char(9)
Line feed char(10)
Carriage return char(13)
</code></pre>
<p>Thanks</p>
| <p>Not only Char(9),it does for all of the values below..</p>
<pre><code>SELECT [Ascii Code] = STR(Number),
[Ascii Character] = CHAR(Number),
[ISNUMERIC Returns] = ISNUMERIC(CHAR(Number))
FROM Master.dbo.spt_Values
WHERE Type = 'P'
AND Number BETWEEN 0 AND 255
AND ISNUMERIC(CHAR(N... |
Angular ng-repeat on dynamic numeric keys not working <p>I am trying to loop over on below data
<code>
[{"5+":[2,1,3]},{"3-5":[0,1,0]},{"1-3":[1,0,3]},{"0.5":[0,0,0]},{"<30":[0,0,0]}]
</code></p>
<p>using below code piece</p>
<pre><code><tr ng-repeat='sessionLength in [{"5+":[2,1,3]},{"3-5":[0,1,0]},{"1-3":[1,0... | <p>You could have three <code>ng-repeat</code> one for <code>tbody</code> then tr & td respectively, But for larger collection this approach would make performance imact.</p>
<p>In such case you should create custom filter which will return a formatted data which will reduce you <code>ng-repeat</code>'s.</p>
<p><... |
New to Android App / Java development, working through some abnormalities <p>As the title says I am just getting started writing an Android smartphone application and it is the first time I have written in Java as well. I do have some experience with <strong>C/C++/Swift/iOS</strong> app development. </p>
<p>I have bee... | <p>Your code, corrected:</p>
<pre><code>public class MainActivity extends AppCompatActivity {
private boolean connect_btn_pressed = false;
private ImageButton btn_up;
private ImageButton btn_connect;
private TextView ble_status;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(saved... |
MySql > select record only form yesterday <p>I want to select all record form yesterday </p>
<p>I use the following </p>
<pre><code>date > CURDATE() - INTERVAL 1
</code></pre>
<p>but this select today records as will</p>
<p>I just want to select yesterdays records</p>
<p>any ideas ?</p>
| <p>Your condition is wrong. It should be the following:</p>
<pre><code>date >= CURDATE() - INTERVAL 1 DAY AND date < CURDATE()
</code></pre>
<p><code>CURDATE() - INTERVAL 1 DAY -> date of yesterday.</code> </p>
<p>In order to select records of yesterday only you can use the condition given above or the cond... |
c# receive udp broadcast packets with xml content (windows 7) <p>I want to receive udp packages in a c# program. the contents of several packages combined, are a XML Status Log. Which repeats after one status log is complete. See image below. I am using <a href="https://gist.github.com/zmilojko/5055246" rel="nofollow">... | <p>This is a general purpose receiver I made in class</p>
<pre><code>public class UdpBroadcastReceiver
{
private IBroadcastInterpreter _interpreter;
private volatile bool _shouldReceive = true;
/// <summary>
/// Will listen on all ports for udp broadcasts - Will handle input with interpreter
... |
extracting images from pdf in C# <p>I am working on a project where we have to extract images from pdf files provided by user dynamically in .Net Platform project.
Currently I am using the Aspose Pdf library which is a 3rd party library.It is having some options to extract images like ImagePlacementAbsorber here is the... | <p>Another 3rd party library you can try is the LEADTOOLS SDK. It has <a href="https://www.leadtools.com/sdk/pdf" rel="nofollow">PDF classes</a> that you can use to extract PDF objects from the PDF files including the embedded images. Please note that I am an employee of this product.</p>
<p>The entire process of extr... |
Method was expected to be of type virtual <p>I've tried to initialize <code>AWSMobileClient.defaultMobileClient()</code> from my AWS Mobile Hub sample project into my test project using this code:</p>
<pre><code>if (AWSMobileClient.defaultMobileClient() == null) {
Log.e("MainActivity", "Initializing AWS Mobile... | <p>I have changed my Google Play Services library version from 9.0.0 to 9.0.1 and it solved it.</p>
|
Expected expression error in Swift 3.0 <p>I am having issues with this block of code:</p>
<pre><code>private static func replaceAnimationMethods() {
//replace actionForLayer...
method_exchangeImplementations(
class_getInstanceMethod(self, #selector(UIView.actionForLayer(_:forKey:))),
... | <p>Have you tried like below syntaxes.</p>
<pre><code>class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:)))
class_getClassMethod(self, #selector(UIView.animate(withDuration:animations:completion:)))
</code></pre>
|
XSLT works in IE, but nowhere else <p>I've seen variations of this question all over the place but none of the solutions provided seem to be working. Which means there's probably some other issue in my code/setup I can't see.</p>
<p>I'm trying to make a site for a relative and I'm having trouble with the XSLT styleshe... | <p>I think the problem is probably</p>
<pre><code>type="text/xml"
</code></pre>
<p>The form that works reliably is</p>
<pre><code>type="text/xsl"
</code></pre>
|
strange gaussianBlur result offset of kernel multiplication unwantedly padded. <p>You can see the result in the image below. The original image is just a grey pixel, the result should be that but blurred. </p>
<p>Opencv is not using the immediate neighboring pixels for the Gaussian Blur, I'm guessing it's doing some s... | <p>Fixed, it has all to with my how i ordered my vector, i had column major, cv::Mat assumes it is row major ordering.</p>
<p><a href="http://i.stack.imgur.com/scQQP.png" rel="nofollow"><img src="http://i.stack.imgur.com/scQQP.png" alt="enter image description here"></a></p>
|
OpenSSL support for Client Certificate URLs <p>I am try to determine if <a href="http://www.ietf.org/rfc/rfc4366.txt" rel="nofollow">Client Certificate URLs from RFC 4366</a> is supported by OpenSSL library. I can not find any information in the OpenSSL documentation.</p>
<p>In file <code>tls.h</code> I can see follow... | <p>No, this extension is not supported in any OpenSSL version.</p>
|
Can we have different bundle identifiers for a sticker pack extension and the existing iOS app? <p>We are about to release a stickers pack extension to our existing iOS app.
This is how I've added the sticker extension to the existing iOS project in xCode 8.
File -> New -> Target -> Sticker Pack Extension.</p>
<p>Bund... | <p>As long as your apps are bundled, you need to use the parent app to carry the sticker pack. So I'm guessing not. If you're stuck with an existing App ID, create a wildcard App ID and provisioning profiles to connect child apps to your project. </p>
|
How do I add the moment.js library to Cloudant NoSQL Design Doc on Bluemix <p>Just learning Cloudant NOSQL on Bluemix. I have been successful adding my weather data to the database, simple queries, and even pulling it out to a mobile app using Kinetise. I am not a SW developer,but I am an engineer.</p>
<p>I need to ac... | <p>you may want to review/follow the instructions here:</p>
<p><a href="http://www.swarmforest.com/blog/how-to-use-js-libs-like-underscorejs-in-your-couchdb-views/" rel="nofollow">http://www.swarmforest.com/blog/how-to-use-js-libs-like-underscorejs-in-your-couchdb-views/</a></p>
<p>there are also multiple answers her... |
Read picture taken with camera Intent <p>I'm trying to read and display the picture taken using camera Intent.
My code is based on examples found in android docs:</p>
<pre><code> public void takeSidePhoto(View view) {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent... | <p>in your try block do something like this to get the path</p>
<pre><code>if(photoFile.exists()){
String path = photoFile.getAbsolutePath()
}
</code></pre>
|
SQL Query to assign value to temp column based on condition <p>I am having Table1 with Column A and Table2 with Column B.</p>
<p>When I use join, (Table1.A = Table2.B) I need to create a temp column 'Flag' and set Flag value as '1' for matching records and for remaining records(Table1.A != Table2.B) should have flag... | <p>Try with <code>FULL OUTER JOIN</code> .</p>
<pre><code>SELECT *,CASE WHEN t1.A = t2.B THEN 1 ELSE 0 END Flag
FROM Table1 t1
FULL OUTER JOIN Table2 t2 ON t1.A=t2.B
</code></pre>
|
reload kendo after search mvc <p>Heello,
Kendo grid cannot reload results after search .I'm posting results with code below. After that nothing is happend.What is wrong here.Thanks</p>
<pre><code> @using (Html.BeginForm(null, null, FormMethod.Post, new { id = "invoice-form" }))
{
</code></pre>
<p>to controller and... | <p>In the line below, <strong>replace</strong> <code>result</code> with the actual variable that holds the received data:</p>
<pre><code>grid.dataSource.data(result);
</code></pre>
<p>In your code, <code>result</code> is the <a href="http://api.jquery.com/jquery.ajax/" rel="nofollow">jqXHR object, not the actual resp... |
vbscript to prompt message on a file execution <p>I am looking for a VBscript code that will prompt a message box whenever a user opens any application/ a particular application. And, the vbscript should always be running.
I am new to coding. Please help!!</p>
| <pre><code>Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\CIMV2")
Set objEvents = objWMIService.ExecNotificationQuery _
("SELECT * FROM Win32_ProcessStopTrace")
Do
Set objReceivedEvent = objEvents.NextEvent
msgbox objReceivedEvent.ProcessName
If l... |
How to change file attributes by Itamae that exists alreasy in server <p>I want to change file attributes by <code>Itamae</code> that exists already in server.</p>
<p>I tried like:</p>
<pre><code>file '/usr/local/bin/jobber' do
action :nothing
owner 'jobber_client'
end
</code></pre>
<p>and</p>
<pre><code>file '... | <p>I think that you should use the :edit action instead of the :nothing one to change the file owner.</p>
<pre><code>file '/usr/local/bin/jobber' do
action :edit
owner 'jobber_client'
end
</code></pre>
|
Adding the elements of an array to another array using perl <p>Please, I want to know how to add the elements of an array to another one using perl.
And if there's a loop i can use to make a counter for the X array.</p>
<pre><code>#!/usr/local/bin/perl
$line = <STDIN>;
@array = split(/ /,$line);
print"$array[4]\... | <blockquote>
<p>Â I want to how to add the elements of an array to another one using Perl.</p>
</blockquote>
<p>If you have</p>
<pre><code>my @data = ( 'a', 'b', 'c' );
my @addition = ( 'x', 'y', 'z' );
</code></pre>
<p>then you can use <code>push</code> to add the contents of <code>@addition</code> to <code>@... |
how to give z-index property in react native android app <p>I searched lot but i did find that how to give z-index property in react native, if i use zIndex in react native it shows me error that this is not valid style prop type.</p>
<p>here is my code in render. as you can see below that i want to make visible to au... | <p>Did you try <code>elevation</code> style property?</p>
<pre><code>autoContainer: {
...,
elevation: 3,
}
</code></pre>
<p>Checkout the following links:</p>
<ol>
<li><p><a href="https://facebook.github.io/react-native/docs/view.html" rel="nofollow">View</a></p></li>
<li><p><a href="https://developer.android... |
cakephp fails to save entities in loop with MSSQL <p>Using Microsoft SQL Server 2012 (MSSQL), it is impossible to loop over entity results and save them. The same code was previously working fine with MySQL. </p>
<p>The server will immediately throw this error after the first entity is modified:</p>
<p><strong>Error:... | <p>I've had similar issues in the past. </p>
<p>Try this instead:</p>
<pre><code>foreach($priceRows as $query) {
$pricesTable->patchEntity($query, ['comment' => 'new value');
$pricesTable->save($query);
}
</code></pre>
|
"Could not find installable ISAM" using OLEDB <p>I am trying to connect to an Access database and get the data to CSV but I received the error</p>
<blockquote>
<p>Could not find installable ISAM</p>
</blockquote>
<p>This is my connection string: </p>
<pre><code>string connectionStringMSAccess = @"Provider=Microsof... | <p>Remove the <code>;Extended Properties=text;HDR=Yes;FMT=Delimited</code> parameters from your connection string. They are not applicable when opening a connection to an .mdb file.</p>
|
pass params from one component to another angular2 <p>I have many components. I declare my components in module. app.module.</p>
<pre><code> import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { Htt... | <p>There are 3 ways of sharing data between component</p>
<ul>
<li>Parent component to child Component: Use <code>@Input()</code> and <code>@Output()</code> to achieve</li>
<li>Child component to parent component: Use <code>@ViewChild()</code> to achieve this</li>
<li>Between any two component: Use <code>Service</code... |
importing json file to elasticsearch <p>I have used</p>
<p><code>curl -XPOST "http://localhost:9200/<my_index_name>" -d @<absolute_path_to_my_json_file></code></p>
<p>Then when I tried to get the data using</p>
<p><code>curl -XGET "http://localhost:9200/<my_index_name>"</code> </p>
<p>its giving m... | <p>Could you share your json structure ? In your example you just set a index name.
To inject data without type and id value into the URI, you have to define them on the json file.</p>
<p>For more info:
<a href="http://stackoverflow.com/questions/15936616/import-index-a-json-file-into-elasticsearch">Import/Index a JS... |
How to check whether a craftyjs entity has fallen out of crafty area? <pre><code> <script>
Crafty.init(450,350, document.getElementById('game'));
var sledge= Crafty.e('Floor, 2D, Canvas, Color')
.attr({x: 0, y: 250, w: 150, h: 10})
.color('green');
var hero =Crafty.e('Canvas, 2D, Image, Twoway... | <p>The simplest way would be to compare the entities position each frame, like this:</p>
<pre class="lang-js prettyprint-override"><code>hero.bind("EnterFrame", function(e) {
if (hero.x < 0
|| hero.y < 0
|| hero.x > Crafty.viewport._width
|| hero.y > Crafty.viewport._height) {
... |
Show Facebook Feeds in Cross Platform App Without Login <p>I'm new in mobile development so I started with Xamarin.Forms</p>
<p>I'm part of organization which wants me to develope an Telephone Directory App (which is ready) and include their Facebook Page in it so that events can be shown in app itself</p>
<p>I tried... | <p>I solved my problem with help of CBroe (See Comments to my Question).</p>
<p>Here are steps if anybody needs</p>
<ol>
<li><p>Create a Developer Account on Facebook using <a href="https://developers.facebook.com/" rel="nofollow">https://developers.facebook.com/</a></p></li>
<li><p>Create a Facebook App and Make it ... |
EntityManager Native Query Syntax? <p>The following method uses the <a href="http://docs.oracle.com/javaee/6/api/javax/persistence/EntityManager.html" rel="nofollow">createNativeQuery()</a> method of the Java entity manager:</p>
<pre><code> public List<Dog> findDogById(String id) {
List<Dog> res... | <p>Your syntax is correct but you have other problems in your code.</p>
<p>You are silently ignoring the exception. You are probably getting an exception, ignoring it and then returning the empty list:</p>
<pre><code> try {
resultList = persistence.entityManager().createNativeQuery(" SELECT * FROM DOG WHER... |
segmentation fault: 11, when using Alamofire.upload <p>I updated Alamofire to 4.0 for swift 3. (before i was using AFNetworking).</p>
<p>My Code:</p>
<pre><code>func uploadImage(_ image: Data, withURLRequrest urlRequest: URLRequestConvertible, responseCallback: ((NetworkResponse) -> ())? = nil) {
Alamofire.u... | <p>The API of <code>multipartFormData</code> has changed.</p>
<p>The <code>append</code> method now look like this (Note that it doesn't return any value):</p>
<p><code>func append(_ data: Data, withName name: String, fileName: String, mimeType: String)
</code></p>
<p>Here is the example from the Alamofire's README:... |
PhpStorm isset function not working? <pre><code><?php
$con=mysqli_connect("localhost","root","","ok_db")or die(mysqli_connect_error());
$output = 'arslan';
// collect
if (isset($_POST['search'])) {
$searchq = $_POST['search'];
$searchq = preg_replace("#[^0-9a-z]#i","",$searchq);
$query = mysqli_query($... | <p>PHP STORM is an IDE for writing your code and has no effect on this.</p>
<p>I would suggest doing</p>
<pre><code>print_r($_POST['search']);
</code></pre>
<p>and making sure it is actually filled in, possibly a typo.</p>
|
What is the differences between GoogleSignInApi.signOut and FirebaseAuth.signOut and more <p>What is the the more detail workflow difference between </p>
<pre><code>GoogleSignInApi.signOut
FirebaseAuth.signOut()
GoogleSignInApi.revokeAccess.
</code></pre>
<p>Going trough many tutorials and codelabs like <a href=... | <p>There are different auth functionalities that you can provide to your app users.</p>
<p>All are working as a authentication. You can either choose any one of the techniques to authenticate user in your app.</p>
<p>Authentication with google plus requires <code>GoogleSignInApi.signOut</code>and <code>GoogleSignInAp... |
echo output to be saved as param <p>I have a requirement where I have to pickup the latest file from the folder and do the further stuff in the database. So I was able to get the recent file from the folder as shown below</p>
<pre><code>.os cd "C:\Users\krishha\Desktop\latest\"
.os for /f "delims=" %%x in ('dir /od /a... | <p>You should just be able to echo the environment variable where you want it by enclosing it in percentage signs as you did before:</p>
<pre><code>echo .import vartext ' ' file = C:\Users\krishha\Desktop\latest\%recent%' >>C:\Users\krishha\Desktop\latest\h.txt
</code></pre>
<hr>
<p>Executing the following on... |
Angular2 TypeScript Error: TS7017:Index signature of object type implicitly has an 'any' type <p>myData is defined as:</p>
<pre><code>myData:any = {'foo': 'bar'};
</code></pre>
<p>in the component and I've the following method:</p>
<pre><code>private whatever (param:string) {
console.log (this[param]); // param = ... | <pre><code>....
(this as any) [param]
....
</code></pre>
<p>is the current work-around</p>
|
Ionic windows Support <blockquote>
<p>Sorry for being stupid. But I am looking for these answers.</p>
</blockquote>
<ol>
<li>Does Ionic 2 supports Windows 10 Mobile (Phone) and Windows 10
Universal App? If yes then how to proceed with windows phone and universal app execution with one windows folder being creat... | <blockquote>
<p>Does Ionic 2 supports Windows 10 Mobile (Phone) and Windows 10 Universal App?</p>
</blockquote>
<p>Yes, like you can see <a href="http://blog.ionic.io/announcing-windows-support-in-ionic-2/" rel="nofollow">here</a> since Ionic2 beta.3 Universal Windows Platform Apps are officially supported.</p>
<bl... |
Typoscript Condition: backend_layout (with slide) <p>I use this condition</p>
<p><code>[globalVar = GP:colPos==0]&&[page|backend_layout = pagets__MainTemplate]</code></p>
<p>My problem is that my âsubpageâ has no backend_layout selected because the parent pages "Backend Layout (subpages of this page)â i... | <p>Not as far as I know, as you can only access the current page record with the "page" condition.</p>
<p>Instead you could </p>
<p>a) Write your own condition (see <a href="https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference/Index.html#custom-conditions" rel="nofollow">https://docs.typo3.org/typ... |
How to display the Horizantal Access value from dataset field in rdlc report line chart <p>what property need to set the for the displaying this value in line chart in Rdlc report<a href="http://i.stack.imgur.com/ecj94.png" rel="nofollow"><img src="http://i.stack.imgur.com/ecj94.png" alt="enter image description here">... | <p>It looks like you have specified interval and also the minimum and maximum limits so remove all those or set it to auto and it will come
Just try it</p>
|
ActionSheetOption Example? <p>I have a requirement where i am suppose to design a pop-up window with some icons, for example share button which will open a small window from the bottom which holds list of all social network platforms along with their icons.I am using Xamarin Forms and need to do this for iOS and Andro... | <p>you can do it without library</p>
<pre><code> <RelativeLayout>
<StackLayout
RelativeLayout.WidthConstraint = "{ConstraintExpression Type=RelativeToParent, Property=Width, Factor=1}"
RelativeLayout.HeightConstraint = "{ConstraintExpression Type=RelativeToParent, Property=Height, Factor=1}"&... |
Hubot Slack attachment fields <p>Basically,
<a href="http://i.stack.imgur.com/rwvvp.png" rel="nofollow">this</a> is what I want to achieve in Slack using Hubot. I've tried using </p>
<pre><code> attachment =
fields: [
{
title: "User info"
value: json.user
... | <p>Solved it by using</p>
<pre><code>$attachments = [
'text' => "Active codebases: (total = $total)",
'attachments' => [
[
'color' => '#3333ff',
'fields' => [
]
]
]
];
</... |
Initializing a SessionManager in Alamofire 4.0 <p>Just upgraded to Alamofire 4.0. Having issues with the session manager. Firstly actually initialising it:</p>
<p>Previously:</p>
<pre><code>let alamoManager = Alamofire.SessionManager(configuration: configuration)
</code></pre>
<p>Now:</p>
<pre><code>let alamoManage... | <pre><code>let configuration = URLSessionConfiguration.default
var alamofireManager = Alamofire.SessionManager(configuration: configuration)
</code></pre>
|
Override ASP.NET MVC EditorFor <p>Is it possible to override ASP.NET MVC's <code>EditorFor</code> and <code>DisplayFor</code>.</p>
<p>I want to apply some logic as to whether or not to actually display the content or simply output "".</p>
<p>So I want to do something like this (pseudocode):</p>
<pre><code>public sta... | <p>It sound like you want an extension:</p>
<pre><code>public static MvcHtmlString MyEditorFor<TModel, TValue>(this HtmlHelper<TModel> html, Expression<Func<TModel, TValue>> expression) {
if(ICanRender)
{
return System.Web.Mvc.Html.EditorExtensions.EditorFor(html, expression);
... |
css shorthand for padding/margin: 2em 2em 2em 8em; <p>Is there a shorthand for</p>
<pre><code>padding: 2em 2em 2em 8em;
</code></pre>
<p>results in:</p>
<pre><code>padding-top: 2em;
padding-right: 2em;
padding-bottom: 2em;
padding-left: 8em;
</code></pre>
<p>And</p>
<pre><code>padding: 2em 2em 8em;
</code></pre>
... | <p>You can't. There simply isn't a way to shorten that any further. </p>
<p>The MDN <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties" rel="nofollow">explains it well</a> with this:</p>
<p><a href="http://i.stack.imgur.com/UUqm2.png" rel="nofollow"><img src="http://i.stack.imgur.com/UUqm2... |
Change bootstrap navbar sidebar a element color on first-child <p>The following CSS successfully changes the first child's background color and border of my sidebar nav:</p>
<pre><code>nav.sidebar .navbar-nav > li:first-child{
border-bottom: 1px #c9c9c9 solid;
background: #2980b9;
}
</code></pre>
... | <blockquote>
<p>I want the first child's font color on the a element to be white, but this code changes all the font colors to white for the whole sidebar.</p>
<pre><code>nav.sidebar .navbar-nav > li > a:first-child{
</code></pre>
</blockquote>
<p>Of course it does, because now you are not selecting the LI th... |
cannot find findViewById() in CustomListView using Fragments <p>I am designing an UI where my app has 3 tabs and i have created it using fragments and i third tab i need to display listview with text and images.I can able to display the list but when i wrote click listener to each item the app start to crash and now I ... | <p>Use <code>getView()</code> to fetch your view. This method returns the root view for the fragment. With this you can call <code>findViewById()</code>. Or do as follows</p>
<pre><code>ListView mylistview;
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceSt... |
App works fine when running from Android Studio but crashes when signed apk installed <p>I have an app that pulls data from a PHP file and then parses the JSON return and puts the data in a list. When running the app from Android studio on my phone plugged in via USB, the app works 100%. However, when I built a signed ... | <p>In most cases the reason is the <code>Proguard</code>.
You have to check you proguard file and classes you use.</p>
|
Inline output using query_to_xml in postgres <p>Running following query in postgresql</p>
<pre><code>select REPLACE(
REPLACE(
REPLACE(
REPLACE(
query_to_xml(
'select 1 "col1",2 "col2",3 "col3"
union all
... | <p>You need to remove the newline character from the result. To remove new line you can use <code>regexp_replace(column_or_result, E'[\\n\\r]+', ' ', 'g' )</code>.</p>
<p>Your query should look like this:</p>
<blockquote>
<p>select regexp_replace(
REPLACE(REPLACE(REPLACE(REPLACE(query_to_xml('select 1 ... |
Loop through image gallery on Android device <p>Is there a way of looping through the default image gallery on an android device?
In my app I have managed to pass a selected picture from the default gallery to an imageView by this code: </p>
<pre><code>public void onImageGalleryClicked(View v){
//Invoke image gall... | <p>There are billions of Android devices, spread across thousands of device models. These will have hundreds of different "default image gallery" apps, as those are usually written by device manufacturers. The user does not have to use any of those apps to satisfy your <code>ACTION_PICK</code> request.</p>
<p>There is... |
Making side-effect free methods static <p>A few days ago I made a code review and I noticed that several <code>static</code> methods have been introduced. When I talked to the colleague who opened the pull request, he told me that he makes side-effect free (<a href="http://www.braveclojure.com/functional-programming/#P... | <p><code>static</code> methods are only indirectly related to the concern of side effects. In the case of a private method, it can be made <code>static</code> if it doesn't dereference <code>this</code>. One of <em>many</em> consequences is that such a method does not mutate the object's state, which precludes one narr... |
Change Nivo Slider to fade transition only <p>I'm having some issues with a prepackaged nivo slider on my wordpress theme installation. I'd like to set the transition to fade only with no directional fade. At the moment it seems to be set to random. </p>
<p>The code is below, sorry it is minified (added unminfied vers... | <p>Use fade effect <code>instead</code> of <code>random</code></p>
<pre><code>$('#slider').nivoSlider({effect:'fade'})
</code></pre>
|
How to create a prescription pill count like pain management facilities use? <p>I don't understand why this code won't work. I want to create some code to help me know exactly how many pills need to be taken back to pain management. If you don't take the right amount back, then you get kicked out of pain management. ... | <p>In this line:</p>
<pre><code>date1 = datetime.date(datetime.strptime((str(year) + "-" + str(starting_Month) + "-" + str(starting_Month) + "-" + str(starting_Day)), '%Y-%m-%d'))
</code></pre>
<p>You're telling <code>datetime.strptime</code> to parse a string of the form "year-month-day", but the string you give it ... |
SSRS - Check if a substring is contained in a string by code <p>I have a report and a vb function in the code. I would like to know how can I check if a string is contained in a string. For example:</p>
<p>I want to check if "over" is contained in "stackoverflow". How can I do this by code in reporting services (ssrs)... | <p>you can check substring in string using below expression,it's return either true or false.</p>
<p>Fields!MainString.Value.ToLowerInvariant().Contains("what are you looking")</p>
|
php curl localhost is slow when making concurrent requests <p>I find an interesting issue which I am not sure about the root cause. I have a server and two virtual hosts A and B with port on 80 and 81 respectively. I write a simple php code on A which looks like this</p>
<pre><code><?php
echo "from A server\n";
</... | <p>Ok, after so many days of trying to solve this issue, I finally find out why. And It's not name resolving. I can't believe that it takes so many days to track down the root cause which is the number of <code>pm.start_servers</code> in php-fpm's <code>www.conf</code>. Initially, I set the number of pm.start_servers t... |
is there any way to remove or hide the controller name in url? codeigniter <p>I developed a project in php codeigniter. The project is almost complete but now my manager wants me to completely remove or hide the controller names in the URL. My current URL looks like this:</p>
<blockquote>
<p><a href="http://www.site... | <p>You can do this using <code>$route</code>.</p>
<p>If you have only one <code>Controller</code> and in that controller you all the <code>functions</code> you can write something like this:</p>
<pre><code>$route['(:any)'] = "Controller_Name/$1";
</code></pre>
<p>If you have many <code>Controllers</code> you need to... |
Mailbox unavailable. The server response was: Please turn on SMTP Authentication in your mail client <p><strong>The server response was: Please turn on SMTP Authentication in your mail client.</strong></p>
<p>I am using SMTP details of some other server and my code is hosted on some other server. When I am trying to s... | <p>Try the basic method and work up from there:</p>
<pre><code> using System;
using System.Windows.Forms;
using System.Net.Mail;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, ... |
Getting Spring property @Value without PropertyPlaceholderConfigurer <p>I am not able to get property defined in spring application.properties with @Value annotation. Somehow I know that we have to register propertysourcesplaceholderconfigurer bean in rootConfig and this registering method is <strong>static</strong>.</... | <p><strong>application.propertes</strong></p>
<pre><code>application.angular.rooturl = http://localhost:8080/test
</code></pre>
<p><strong>Java Class where I use @value</strong></p>
<pre><code>@Configuration
@PropertySource(value="classpath:application.properties")
public class ApplicationPropertyConfig {
publi... |
how to copy default constraints of columns in temp table? <p>I tried to create a temp table with the following script</p>
<pre><code>select *
into #Product
from (select * from SalesLT.Product) as data
</code></pre>
<p>Temp table got created and all the values inserted in new table. Now i am trying to insert a row in... | <p><code>Select into</code> won't copy any constraints like Primarykeys,foreign Keys..The only way to get them in destination table is to script them out manually..</p>
<p>The only thing copied by <code>select into</code> is Identity </p>
<pre><code>select * into dbo.test/#test from test1--only copies identity
</cod... |
the fetched data from documentum (dm_acl Object Table) turns out to be null ? why? <p>I'm working on a Java project which is connected to documentum . I am trying to fetch some data from my dm_acl object table using the following : </p>
<pre><code>String fetchAclsInfoQuery = "select * from dm_acl where description = '... | <p>You forgot to set DQL statement to query object.<br>
add <code>aclDetailsFetching.setDQL(fetchAclsInfoQuery);</code></p>
|
ClojureScript Reagent Component Constantly Refreshed Resulting in Many POST Calls <p>I have been trying to fix this error for a while but it eludes me. The problem has something to do with the for loop because when I remove it the calls to the component are limited to one but with it it keeps being called. This results... | <p>Two things to address, given the context presented:</p>
<p><code>for</code> returns a lazy sequence. You probably want the result to be a vector, so try this:</p>
<pre><code>(POST "/get" {:handler #(reset! response %)})
(into [:div]
(vec (for [item @response]
[:div
[:h3 (first item)]
... |
Select Sum from 1 table <p>Hello i want to sum values from 1 column but some values from this table i want to multiply with -1. For example i have this table: </p>
<p><a href="http://i.stack.imgur.com/MT04u.png" rel="nofollow">pictab1</a></p>
<p>I want sum column B but where in column A is - i want to subtract those... | <p>Use <code>CASE</code> expression:</p>
<pre><code>SELECT SUM(CASE WHEN A='-' THEN -B ELSE B END)
FROM Table
</code></pre>
|
Google App Engine import error, for django.urls <p>I'm trying to learn Django, so I completed their multi-part tutorial (Python 2.7) and ran it locally. I got it working fine on my PC.</p>
<p>I need the following import, in a views.py file:</p>
<p>from django.urls import reverse</p>
<p>When I upload it to GAE, it gi... | <p><code>reverse()</code> was moved from <code>django.core.urlresolvers</code> to <code>django.urls</code> in Django 1.10. The error suggests that you are using an older version of Django.</p>
<p>You need to import <code>reverse()</code> from the old location:</p>
<pre><code>from django.core.urlresolvers import rever... |
ui-router can't change value from $scope after view was called <p>I'm starting using angularjs for my new websites, so I'm a beginner.
I have a problem, which I can't change the value from my $scope inside my controller after the view was called.
I'm using ui-router to multiple views.
I explain in this example:</p>
<p... | <p>Use the <code>$state</code> service instead of <code>$location</code> and get the URL as following :</p>
<pre><code>$state.url
</code></pre>
<p>Then, try to create a dedicated controller for each route. This will avoid using extensively conditions just to match specific route's template requirements.</p>
|
Validator event dispatched before Entity validation starts <p><strong>Question</strong></p>
<p>Is it possible in Symfony 2.8+ / 3.x+ to dispatch event before starting entity validation?</p>
<p><strong>Situation:</strong></p>
<p>Let's say we have 100 entities, they have @LifeCycleCallbacks, they have @postLoad Event ... | <hr>
<p>Hello Voult,</p>
<p><em>Edit: first method is deprecated in symfony 3 as the thread op mentioned in a comment. Check the second method made for symfony 3.</em></p>
<hr>
<p><strong>Symfony 2.3+,Symfony < 3</strong></p>
<p>What I do in this cases, since symfony and most other bundles are using parameters ... |
Wordpress Multisite: Subsites are getting the main site name <p>My multisite worked fine, but suddenly it does not load the names of the subsites. Instead it displays only the name of the main site.</p>
<p>I tried to disable plugins, reinstall WP etc. Maybe it is caused by 4.6.1?</p>
<p>When I go to /wp-admin/options... | <p>The problem was an outdated version of the WPML plugin. Installed a new one and works now.</p>
|
setLocation in actionPerformed change button location only if there are no integer incrementation <pre><code>import javax.swing.*;
import java.awt.event.*;
public class SimpleGUI3 implements ActionListener {
JButton button;
private int numClick;
public static void main(String[] args) {
SimpleGUI3... | <p>When you change the value of numClick the text of the button also changes when you use the <code>setText()</code> method. </p>
<p>When a property of the button changes then Swing will automatically invoked <code>revalidate()</code> and <code>repaint()</code> on the component.</p>
<p>The <code>revalidate()</code> w... |
In spark streaming, what is the difference between foreach and foreachRDD <p>For example, how would </p>
<pre><code>x.foreach(rdd => rdd.cache())
</code></pre>
<p>be different from</p>
<pre><code>x.foreachRDD(rdd => rdd.cache())
</code></pre>
<p>Note that <code>x</code> is a <code>DStream</code> here.</p>
| <p>There is no difference in work, foreach() <a href="https://github.com/apache/spark/blob/v1.6.1/streaming/src/main/scala/org/apache/spark/streaming/dstream/DStream.scala#L641" rel="nofollow">uses</a> foreachRDD. foreach() was deprecated and in Spark 2.0 this function is removed</p>
|
doc2vec - Input Format for doc2vec training and infer_vector() in python <p>In gensim, when I give a string as input for training doc2vec model, I get this error : </p>
<blockquote>
<p>TypeError('don\'t know how to handle uri %s' % repr(uri))</p>
</blockquote>
<p>I referred to this question <a href="https://stacko... | <p><code>TaggedLineDocument</code> is a convenience class that expects its source file (or file-like object) to be space-delimited tokens, one per line. (That is, what you refer to as 'Case 1' in your 1st question.)</p>
<p>But you can write your own iterable object to feed to gensim <code>Doc2Vec</code> as the <code>d... |
Where do page layouts fit into the react (redux) presentational vs container pattern? <p>I've read Dan Abramov's article on <a href="https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0" rel="nofollow">Presentational and Container Components</a>. In it he explains a pattern where you separate componen... | <p>Don't over-think the "container" and "presentational" aspects too much. It's a useful distinction, but there's no hard-and-fast rule saying you <em>must</em> break apart components in an absolutely strict way. It's totally fine to put some layout and presentational rendering in a container component, and it's tota... |
Machine to machine REST authentication <p>If you have multiple RESTful web services running on different subdomains (accounts.site.com, training.site.com, etc) what is a good authentication mechanism when one service needs to consume another?</p>
<p>Human authentication is easy because they supply their login credenti... | <p>It depends on... From the service perspective the other service is just a REST client, so let's stick with these terms.</p>
<ul>
<li>If you want access different user accounts with your REST client, then you must register your client by the service and you will get an API key. The user can give privileges to that A... |
Pandas: create word cloud from a column with strings <p>I have a following <code>dataframe</code> with <code>string</code> values:</p>
<pre><code> text
0 match of the day
1 euro 2016
2 wimbledon
3 euro 2016
</code></pre>
<p>How can I create a <code>word cloud</code> from this column?</p>
| <p>I think you need <a href="http://stackoverflow.com/a/39172275/2901002">tuple of tuples</a> with frequencies, so use <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.value_counts.html" rel="nofollow"><code>value_counts</code></a> with <code>list comprehension</code>:</p>
<pre><code>tuples... |
Hierarchical SQL Query WITH parent child items <pre><code>Category (id, name, parent_id);
1 Electronics NULL
2 Computers 1
3 Notebooks 2
4 Desktops 2
Products (id, name, category_id);
1 NotebookX 3
2 NotebookY 3
... | <p>Give it a try (<strong>SQL Server</strong> solution):</p>
<pre><code>DECLARE @category int = 3
;WITH rec AS (
SELECT *
FROM Category c
WHERE c.id = @category
UNION ALL
SELECT c.*
FROM rec r
INNER JOIN Category c
ON c.parent_id = r.id
)
SELECT p.*
FROM Products p
INNER JOIN rec r
ON r.id = p.category_id
</... |
xml2js parsing - how to extract metadata attribute value? <p>I am trying to create a custom json by extracting data with xml2parsing. So far I have this:</p>
<pre><code>function createCustomJson(d{
let dataFromXml = "";
parseString(d, {trim: true}, function (err, result) {
dataFromXml = JSON.stringi... | <p>just try</p>
<pre><code>metadataForJson.item[0].$.name
</code></pre>
<p>OR</p>
<pre><code>metadataForJson.item[0]['$'].name
</code></pre>
<p>This related post may help <a href="http://stackoverflow.com/a/22028956/730733">http://stackoverflow.com/a/22028956/730733</a></p>
|
Datapicker in django data input <p>I tried to implement <a href="http://stackoverflow.com/questions/16356289/how-to-show-datepicker-calender-on-datefield">this</a> solution to create a form field with a data picker. The field appears, but it does not show a calendar. It is a regular input field. I don't know if I'm mis... | <p>Be sure to place the inline javascript right before the closing <code></body></code> tag. It should be after the <code>html</code> it is supposed to effect and after the <code>js</code> files it relies on.</p>
|
Ruby example with exclamation mark <p>I am writing a script with different options in ruby, and I can't understand how the OptionParser could help me.</p>
<p>In particular, there is an example in the documentation: <a href="https://docs.ruby-lang.org/en/2.1.0/OptionParser.html" rel="nofollow">https://docs.ruby-lang.or... | <p>To answer your questions:</p>
<blockquote>
<p>I can understand the exclamation mark on the "end.parse" line (but I expected a parameter after that)</p>
</blockquote>
<p><a href="https://docs.ruby-lang.org/en/2.1.0/OptionParser.html#method-i-parse-21" rel="nofollow">The documentation</a> states that <code>parse!<... |
Angular 2 template driven form with ngFor inputs <p>Is it possible to create input fields with a ngFor in a template driven form and use something like #name="ngModel" to be able to use name.valid in another tag?</p>
<p>Right now we have a dynamic list of products with a quantity field and a add to cart button in a ta... | <p>There's no need for this, just do it like this:</p>
<pre><code><form #form="ngForm">
<div *ngFor="item in items">
<input name="product-{{item.id}}"
[(ngModel)]="item.qty"
validateQuantity
#qtyInput>
<button (click)="addItemToCart(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.