Id int64 34.6M 60.5M | Title stringlengths 15 150 | Body stringlengths 33 36.7k | Tags stringlengths 3 112 | CreationDate stringdate 2016-01-01 00:21:59 2020-02-29 17:55:56 | Y stringclasses 3 values |
|---|---|---|---|---|---|
39,613,838 | it happen red caution:"Cannot resolve symbol 'mBlockLayoutRequests'"when i open ListView source code" | it happen red caution:"Cannot resolve symbol 'mBlockLayoutRequests'"when i open ListView source code,look it picture:http://i.stack.imgur.com/8K2Dw.png
.but i can find it in AdapterView that is inherited by ListView,look it picture http://i.stack.imgur.com/3uVW7.png
boolean mBlockLayoutRequests = false;
when i click it ,it tip "Cannot find declaration to go to ",
is it a error ? if it is a error ,what should i do for fix this error ? | <java> | 2016-09-21 10:21:53 | LQ_EDIT |
39,614,137 | Convert PHP Code Block (fsockopen, fputs, feof, fgets) into C# | <p>I need someone to convert this php code block into equivalent C#. We are working on MT4 to register user via asp.net web application. We have been given the php version of the site to post the user information. every things is setup accordingly. however the following code block need to be converted. I tried to search online solution but could not find any documentation thanks.</p>
<pre><code>function MQ_Query($query)
{
$ret='error';
//---- open socket
$ptr=@fsockopen(T_MT4_HOST,T_MT4_PORT,$errno,$errstr,5);
//---- check connection
if($ptr)
{
//---- send request
if(fputs($ptr,"W$query\nQUIT\n")!=FALSE)
{
//---- clear default answer
$ret='';
//---- receive answer
while(!feof($ptr))
{
$line=fgets($ptr,128);
if($line=="end\r\n") break;
$ret.= $line;
}
}
fclose($ptr);
}
//---- return answer
return $ret;
}
</code></pre>
<p>please </p>
| <c#><php><code-conversion><mt4> | 2016-09-21 10:34:50 | LQ_CLOSE |
39,614,268 | How do you change the colour of a section title in a tableview? | <p>Here is what I have at the moment.</p>
<p><a href="https://i.stack.imgur.com/JYNrd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JYNrd.png" alt="enter image description here"></a></p>
<p>How do I refer to this so that I can change the text colour to match my index list? The <strong>sectionForSectionIndexTitle</strong> worked well for adding in the correct section title but how exactly does one access the title element? </p>
<p>Or is it impossible and I need to redraw the view and add it with <strong>viewForHeaderInSection</strong>?</p>
| <ios><swift><tableview><uitableviewsectionheader> | 2016-09-21 10:40:40 | HQ |
39,614,489 | Java 2D arrayList - copy last element, update it and add the updated version at the end of the list | The problem is kinda weird. I have a 2D arrayList. Where each element has an int called x and other called y. What i am trying to do is get the last element of 2DarrayList and update the x and y values and add the updated element right at the end of 2d arrayList.
The problem is when i update the last element, it also updates the element from where it is retrieving info from. I don't want the info. of the element to change from where the info is being derived from. | <java><arraylist> | 2016-09-21 10:51:11 | LQ_EDIT |
39,614,938 | Why do we need TensorFlow tf.Graph? | <p>What is the purpose of:</p>
<pre><code>with tf.Graph().as_default()
</code></pre>
<p>I have some tensorflow code that uses the above.
However, the code has only one graph, so why do we need this?</p>
| <tensorflow> | 2016-09-21 11:11:28 | HQ |
39,615,216 | WAMP Server working with Laravel on Windows 7 Ultimate | <p>Hellow, My OS is Windows 7 Ultimate 64bit. I need install WAMP Server higher than php version 5.6.4 latest WAMP did not support with this OS. can you any body give me working download link to get suitable wamp server.</p>
| <php><windows><wamp> | 2016-09-21 11:23:48 | LQ_CLOSE |
39,615,619 | mail attachments downloading in any mail server through programming | what i am trying to achieve is to download mail attachments of particular type from Gmail or yahoo or any other server through code.is it possible or any idea regarding this will be of great help | <c#><.net><email> | 2016-09-21 11:42:30 | LQ_EDIT |
39,615,697 | Cloud connectivity for MQTT and AMQP? | <p>What is the difference between MQTT and AMQP in terms of cloud connectivity?
I need to compare these two protocols in terms of connecting to the cloud and I found more evidence that AMQP works better but I am still need to find out the differences.</p>
| <cloud><amqp><mqtt> | 2016-09-21 11:46:25 | HQ |
39,615,780 | 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 table. I want to make the whole thing a form with a add all button at the end like this:</p>
<pre><code><form #form="ngForm">
<div *ngFor="item in items">
<input name="product-{{item.id}}"
[(ngModel)]="item.qty"
#????="ngModel"
validateQuantity>
<button (click)="addItemToCart(item)"
[disabled]="!????.valid">Add to cart</button>
</div>
<button (click)="addAll()"
[disabled]="!form.valid">Add all</button>
</form>
</code></pre>
<p>But how can i generate a new variable name per row for the ngModel?</p>
| <forms><angular><ngfor> | 2016-09-21 11:50:14 | HQ |
39,616,160 | How to generate swagger.json using gradle? | <p>I want to use swagger-codegen to generate REST clients and possibly static HTML documentation.</p>
<p>However, swagger-codegen needs swagger.json for input.</p>
<p>I am aware, that I can get this from a running REST server equipped with Swagger.</p>
<p>But is there a way to obtain swagger.json directly from my Java code - i.e. to generate it with gradle from the source code - without the need to run the application in a web container, and pointing <code>curl</code> or a browser to it?</p>
| <java><swagger><swagger-codegen> | 2016-09-21 12:07:16 | HQ |
39,616,238 | How to sum two elements of the array ? | ***NSMutableArray *array = [NSMutableArray arrayWithObjects:
@"22,343", @"44,323",@"34,5678",@"22,725", nil];***
i have this array and I want to sum two values this array.
like this array[0] + array [1]
how to sum this elements?
thanks !! | <objective-c><arrays><sum><elements> | 2016-09-21 12:12:01 | LQ_EDIT |
39,616,596 | CSS buttom align bottom | I'm developing a webapp mobile using the Bootstrap. I have a screen with a text and a button. When the text is small the button should be on the bottom of the page, but when the text is large the button should be after to the end of text.
How to do this with CSS? | <css><twitter-bootstrap-3><vertical-alignment> | 2016-09-21 12:30:05 | LQ_EDIT |
39,616,997 | javascript - call function before declaration | I have this function inside test.js:
function testing(){
document.write("<p>Tes1</p>");
}
And then a basic html page.
Is possible to call the function before being declared and add to the page the:
> <p>Test1</p>
Because if I include the test.js at the bottom of the page, is not working. Is there a way to make it work (with .js file being included at the bottom of the html page)?
Thanks | <javascript><html> | 2016-09-21 12:47:35 | LQ_EDIT |
39,617,017 | I'm new to android development field and was making a MusicApp. Getting stuck with the following | private OnClickListener onButtonClick = new OnClickListener() {
// @Override
public void OnClick(View v) {
switch (v.getId()) {
case R.id.play: {
if (player.isPlaying()) {
handler.removeCallbacks(updatePositionRunnable);
player.pause();
playButton.setImageResource(android.R.drawable.ic_media_play);
} else {
if (isStarted) {
player.start();
playButton.setImageResource(android.R.drawable.ic_media_pause);
updatePosition();
} else {
startPlay(currentFile);
}
}
break;
}
case R.id.next: {
int seekto = player.getCurrentPosition() + STEP_VALUE;
if (seekto > player.getDuration())
seekto = player.getDuration();
player.pause();
;
player.seekTo(seekto);
player.start();
break;
}
case R.id.prev: {
int seekto = player.getCurrentPosition() - STEP_VALUE;
if (seekto < 0)
seekto = 0;
player.pause();
player.seekTo(seekto);
player.start();
break;
}
}
}
};
private MediaPlayer.OnCompletionListener onCompletion = new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
stopPlay();
}
};
private MediaPlayer.OnErrorListener onError = new MediaPlayer.OnErrorListener() {
// @Override
public boolean OnError(MediaPlayer mp, int what, int extra) {
return false;
}
};
private SeekBar.OnSeekBarChangeListener seekBarChanged = new SeekBar.OnSeekBarChangeListener() {
//@Override
public void OnStopTrackingTouch(SeekBar seekBar) {
isMoveingSeekBar = false;
}
//@Override
public void OnStartTrackingTouch(SeekBar seekBar) {
isMoveingSeekBar = true;
}
//@Override
public void OnProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
if (isMoveingSeekBar)
{
player.seekTo(progress);
Log.i("OnSeekBarChangedListener", "OnProgressChanged");
}
}
};
}
I'm getting this after gradle build.
Error:(189, 67) error: <anonymous com.example.shubham.hymnattune.MainActivity$2> is not abstract and does not override abstract method onClick(View) in OnClickListener
Error:(248, 85) error: <anonymous com.example.shubham.hymnattune.MainActivity$4> is not abstract and does not override abstract method onError(MediaPlayer,int,int) in OnErrorListener
Error:(255, 100) error: <anonymous com.example.shubham.hymnattune.MainActivity$5> is not abstract and does not override abstract method onStopTrackingTouch(SeekBar) in OnSeekBarChangeListener
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
Please Help.
Thanks in Advance. | <java><android> | 2016-09-21 12:48:14 | LQ_EDIT |
39,617,051 | My image doesn't get displayed, why? (Java) | I have an exercise in school where you are meant to change the code so that the image moves. The problem is that the image doesn't show in the first place and I don't know why. Here is the code:
public void exercise1e() {
Random rand = new Random();
ImageIcon image = new ImageIcon("images/gubbe.jpg");
PaintWindow_GU1.showWindow(600, 400, "P1", Color.WHITE);
PaintWindow_GU1.addSound("Skor", "sounds/trasiga_skor.mp3");
PaintWindow_GU1.playSound("Skor");
int width = PaintWindow_GU1.getBackgroundWidth();
int height = PaintWindow_GU1.getBackgroundHeight();
int dx = -2;
int dy = 1;
int x = 250;
int y = rand.nextInt(height-100);
PaintWindow_GU1.addIcon("Gubbe", image, 250, y, true);
while(true) {
PaintWindow_GU1.setIconXY("Gubbe",x,y);
PaintWindow_GU1.pause(20);
x += dx;
y += dy;
if(x<0) {
dx = -dx;
}
}
} | <java><eclipse> | 2016-09-21 12:49:43 | LQ_EDIT |
39,617,400 | Several special IP connect to server with ssh | <p>I want Several special IP connect to my server with ssh and block any another ip</p>
<p>what do you think about solve this questionΨ</p>
<p>i have centos 7</p>
<p>firewall is CSF</p>
<p>I use cpanel & whm</p>
| <linux><ssh><server><centos><cpanel> | 2016-09-21 13:04:47 | LQ_CLOSE |
39,617,875 | How long would Apple support Swift 2.2? | <p>I am in a middle of a big project and we are 60% on the progress.</p>
<p>We are using XCode 7.3.1 with Swift 2.2 for our project and the estimated finished time is in 5 months</p>
<p>How long would Apple support this? </p>
| <ios><swift><swift2> | 2016-09-21 13:24:17 | LQ_CLOSE |
39,617,938 | Angular2 component with clipboardData property | <p>I have an Angular2 component with a method to paste data from the clipboard:</p>
<pre><code>inputPaste(event){
let clipboardData = event.clipboardData;
...
</code></pre>
<p>}</p>
<p>This way doesn't work for IE10+, but IE have a window object with a property clipboardData, but typescript compilator throws an error:</p>
<pre><code>inputPaste(event){
let clipboardData = event.clipboardData
|| window.clipboardData; //error 'clipboardData' does not exist on type Windows
...
</code></pre>
<p>}</p>
<p>I have found a solution, that we must use angular2-clipboard directive, but I wan't to use it.</p>
<p>How can I use <code>'windows.clipboardData'</code> in typescript?</p>
| <angular><typescript> | 2016-09-21 13:27:08 | HQ |
39,618,095 | Can I restrict the type that a function throws in Swift? | <p>When calling a function in Swift 3 that <code>throws</code>, you have to be exhaustive in catching all possible errors, which often means you have an unnecessary extra <code>catch {}</code> at the end to handle errors that won't happen.</p>
<p>Is it possible to say <code>throws MyErrorType</code> so that the compiler can know you have indeed been exhaustive when you handle all cases from that enumeration?</p>
| <swift><swift3> | 2016-09-21 13:33:24 | HQ |
39,618,208 | How to get struct name in elixir? | <p>Let say I have a struct, <code>struct = %MyApp.MyModel{ filled_with_data: "true }</code>.</p>
<p>How can I get struct name (<code>MyApp.MyModel</code> in my case)?</p>
| <elixir> | 2016-09-21 13:38:06 | HQ |
39,618,553 | Max size of the vector | I'm trying to read in numbers from a file and take the average of all the numbers but i'm unsure how to include the data.reserve() part into my code. How exactly do I use it to set the maximum size of the vector?
// 1) Read in the size of the data to be read (use type size_t)
// 2) Use data.reserve() to set the maximum size of the vector
// 3) Use a for loop to read in the specified number of values,
// storing them into the vector using data.push_back()
void reserve(vector<int> &data) {
cout << "Using reserve!" << endl;
if (cin){
size_t max_size;
//max_size = 12;
data.reserve(max_size);
cout << "max_size = " << max_size << endl;
for (size_t i = 0; i < max_size; i++){
cin >> data[i];
data.push_back(data[i]);
cout << data[i] << " ";
}
} | <c++><algorithm><data-structures> | 2016-09-21 13:51:56 | LQ_EDIT |
39,619,003 | Creating multiple bundles using angular-cli webpack | <p>When i build the project using angular-cli, it bundles all project files into one big main bundle.</p>
<p>I have used lazy routing in the application and i can navigate fine once application loads up.</p>
<p>Is there a way in which main bundle is divided into multiple files based upon lazy loaded routes modules?</p>
<p>below is the configuration in <code>angular-cli.json</code></p>
<pre><code> {
"project": {
"version": "1.0.0-beta.15",
"name": "maddy-test-project"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": "styles/content",
"index": "default.htm",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "",
"mobile": false,
"styles": [
"styles.less"
],
"scripts": [
"styles/wfa-myriad-pro-typekit.js"
],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"addons": [],
"packages": [],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "less",
"prefixInterfaces": false
}
}
</code></pre>
<p>below is package.json</p>
<pre><code>{
"name": "maddy-test-project",
"version": "0.0.1",
"license": "MIT",
"angular-cli": {},
"scripts": {
"start": "ng serve",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor"
},
"private": true,
"dependencies": {
"@angular/common": "2.0.0",
"@angular/compiler": "2.0.0",
"@angular/core": "2.0.0",
"@angular/forms": "2.0.0",
"@angular/http": "2.0.0",
"@angular/platform-browser": "2.0.0",
"@angular/platform-browser-dynamic": "2.0.0",
"@angular/router": "3.0.0",
"d3": "^4.2.3",
"jquery": "^3.1.0",
"lodash": "^4.15.0",
"moment": "^2.15.0",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"toastr": "^2.1.2",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23",
"bootstrap-daterangepicker": "^2.1.24"
},
"devDependencies": {
"@types/d3": "^3.5.35",
"@types/google-maps": "^3.1.27",
"@types/jasmine": "^2.2.30",
"@types/jquery": "^1.10.31",
"@types/lodash": "^4.14.34",
"@types/toastr": "^2.1.29",
"angular-cli": "1.0.0-beta.15",
"codelyzer": "~0.0.26",
"jasmine-core": "2.4.1",
"jasmine-spec-reporter": "2.5.0",
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1",
"protractor": "4.0.5",
"ts-node": "1.2.1",
"tslint": "3.13.0",
"typescript": "2.0.2"
}
}
</code></pre>
<p>Thanks in advance!!</p>
| <angular><angular-cli><angular2-cli> | 2016-09-21 14:09:38 | HQ |
39,619,119 | ITMS-90682: "Invalid Bundle. | <p>Today I update my Xcode vision to 8.0. When I submit a app.ipa file to Apple store,i get an error feedback that ITMS-90682: "Invalid Bundle. The asset catalog at '$path' can't contain 16-bit or P3 assets if the app is targeting iOS releases earlier than iOS 9.3."].</p>
<p>I search the answer on the Internet and get a similar answer,but it not fit.</p>
<p>Because their question is not completely the same as mine.Their question contain 'Payload/****.app/Assets.car' ,but mine contain '$path'.</p>
<p>Their method is as follows:</p>
<p>First step : modify the file' name of app.ipa to app.zip </p>
<p>Second step : decompressing app.zip</p>
<p>Third step : undo command line and $ cd app.app file</p>
<p>Forth step: $ find . -name 'Assets.car'</p>
<p>Fifth step : $ sudo xcrun --sdk iphoneos assetutil --info /path/to/a/Assets.car > /tmp/Assets.json</p>
<p>Sixth step : open /tmp/Assets.json</p>
<p>Seventh step : search "P3" and "16-bit" in file named "Assets.json"</p>
<p>Eighth step : record the "Name"</p>
<p>Ninth step : open Xcode and find out the image that names have been record in eighth step. change the image form to 8 and sRGB </p>
<p>These are not use for mine ,because the different is "$path".i can't get the name of imaged which form is P3 or 16-bit in my project because i can't get a right method to get a property Assets.json file on fifth step. </p>
| <ios><xcode> | 2016-09-21 14:14:53 | HQ |
39,619,121 | Why am I getting 'Terminated due to timeout' error here? | <p>I'm solving <a href="https://www.hackerrank.com/challenges/circular-array-rotation" rel="nofollow">this problem</a> on Hackerrank.</p>
<p>John Watson performs an operation called a right circular rotation on an array of integers, [a[0],a[ 1]......a[n]].After performing one right circular rotation operation, the array is transformed from [a[0],a[ 1]......a[n]] to [a[n- 1],a[0]......a[n-2]].</p>
<p>Watson performs this operation 'k' times. To test Sherlock's ability to identify the current element at a particular position in the rotated array, Watson asks 'q' queries, where each query consists of a single integer, 'm', for which you must print the element at index in the rotated array (i.e., the value of a[m] ).</p>
<p>Input Format</p>
<p>The first line contains 3 space-separated integers,'n' ,'k' , and , 'q' respectively.
The second line contains 'n' space-separated integers, where each integer 'i' describes array element a[n] (where 0<=i
<p>Output Format</p>
<p>For each query, print the value of the element at index 'm' of the rotated array on a new line.</p>
<pre><code>#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int n,k,q,temp;
cin>>n>>k>>q; //Input of n,k,q;
int arr[n],qur[q];
for(int i=0;i<n;i++) //Input of array
{
cin>>arr[i];
}
for(int i=0;i<q;i++) //Input of query numbers
{
cin>>qur[i];
}
for(int z=0;z<k;z++)
{
temp = arr[n-1];
for(int i=n-1;i>0;i--)
{
arr[i]=arr[i-1];
}
arr[0]=temp;
}
for(int i=0;i<q;i++)
{
cout<<arr[qur[i]]<<endl;
}
return 0;
}
</code></pre>
<p>The code's logic seems to be flawless. I'm a newbie.Thanks in advance.</p>
| <c++><arrays><algorithm> | 2016-09-21 14:14:57 | LQ_CLOSE |
39,619,280 | Instant run issue on Android Studio 2.2 | <p>I have updated my android studio to 2.2, Since then I get this strange issue when running the studio gives me error Instant Run requires that the platform corresponding to your target device (Android 1.0) is installed. I am using Note 4 on android 6.0.1. Why is this error happening ? </p>
<p><a href="https://i.stack.imgur.com/cHF51.jpg"><img src="https://i.stack.imgur.com/cHF51.jpg" alt="Instant run issue"></a></p>
| <android><android-studio> | 2016-09-21 14:21:00 | HQ |
39,619,353 | How to perform a left join in SQLALchemy? | <p>I have a SQL query which perfroms a series of left joins on a few tables:</p>
<pre><code>SELECT
<some attributes>
FROM table1 t1
INNER JOIN table2 t2
ON attr = 1 AND attr2 = 1
LEFT JOIN table3 t3
ON t1.Code = t2.Code AND t3.Date_ = t1.Date_
LEFT JOIN tabl4 t4
ON t4.Code = t1.code AND t4.Date_ = t1.Date_
</code></pre>
<p>So far, I have:</p>
<pre><code>(sa.select([idc.c.Code])
.select_from(
t1.join(t2, and_(t1.c.attr == 1, t2.c.attr2 = 1))
.join(t3, t3.c.Code == t1.c.Code)))
</code></pre>
<p>but I can't figure out how to make the join a <code>LEFT JOIN</code>.</p>
| <python><sql><sqlalchemy> | 2016-09-21 14:24:26 | HQ |
39,619,788 | RecyclerView "cannot resolve symbol" errors - Android Studio | <p>I am getting cannot resolve symbol errors on all my RecyclerView's. What is going on? Because I have an error with RecyclerView, I also have errors on LayoutManager. My last four Override statements are in the wrong place and I don't know where they go. I am a beginner and have a very basic knowledge of programming so I don't know how to fix this. I am taking a class but the professor isn't helpful at all.</p>
<pre><code>package com.bignerdranch.android.criminalintent;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;
import java.util.List;
public class CrimeListFragment extends Fragment {
private RecyclerView mCrimeRecyclerView;
private CrimeAdapter mAdapter;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_crime_list, container, false);
mCrimeRecyclerView = (RecyclerView) view
.findViewById(R.id.crime_recycler_view);
mCrimeRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
return view;
}
@Override
public void onResume() {
super.onResume();
updateUI();
}
private void updateUI(){
CrimeLab crimeLab = CrimeLab.get(getActivity());
List<Crime> crimes = crimeLab.getCrimes();
if (mAdapter == null) {
mAdapter = new CrimeAdapter(crimes);
mCrimeRecyclerView.setAdapter(mAdapter);
} else {
mAdapter.notifyDataSetChanged();
}
}
private class CrimeAdapter extends RecyclerView.Adapter<CrimeHolder> {
private List<Crime> mCrimes;
public CrimeAdapter(List<Crime> crimes) {
mCrimes = crimes;
}
}
private class CrimeHolder extends RecyclerView.ViewHolder
implements View.OnClickListener {
private TextView mTitleTextView;
private TextView mDateTextView;
private CheckBox mSolvedCheckBox;
private Crime mCrime;
public CrimeHolder(View itemView) {
super(itemView);
mTitleTextView = (TextView)
itemView.findViewById(R.id.list_item_crime_title_text_view);
mDateTextView = (TextView)
itemView.findViewById(R.id.list_item_crime_date_text_view);
mSolvedCheckBox = (CheckBox)
itemView.findViewById(R.id.list_item_crime_solved_check_box);
}
public void bindCrime(Crime crime) {
mCrime = crime;
mTitleTextView.setText(mCrime.getTitle());
mDateTextView.setText(mCrime.getDate().toString());
mSolvedCheckBox.setChecked(mCrime.isSolved());
}
@Override
public CrimeHolder onCreateViewHolder(ViewGroup parent, int viewType) {
LayoutInflater layoutInflater = LayoutInflater.from(getActivity());
View view = layoutInflater.inflate(R.layout.list_item_crime, parent, false);
return new CrimeHolder(view);
}
@Override
public void onBindViewHolder(CrimeHolder holder, int position) {
Crime crime = mCrimes.get(position);
holder.bindCrime(crime);
}
@Override
public int getItemCount() {
return mCrimes.size();
}
@Override
public void onClick(View v) {
Intent intent = CrimeActivity.newIntent(getActivity(), mCrime.getId());
startActivity(intent);
}
}
}
</code></pre>
| <android><android-recyclerview> | 2016-09-21 14:44:35 | HQ |
39,619,859 | control the :after of a div when hover on another element |
I wanna control after of box2 when hovering on box1.
I test this code but it didn't work.so...whats the problem?
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-css -->
.box1:hover .box2:after{SOME CSS}
<!-- end snippet -->
| <css> | 2016-09-21 14:47:56 | LQ_EDIT |
39,620,225 | Elasticsearch show all results using scroll in node js | <p>I am basically trying to show all records of an index type. Now, if you use match_all() in query elasticsearch shows 10 results by default. One can show all results using scroll. I am trying to implement scroll api, but can't get it to work. It is showing only 10 results, my code:</p>
<pre><code>module.exports.searchAll = function (searchData, callback) {
client.search({
index: 'test',
type: 'records',
scroll: '10s',
//search_type: 'scan', //if I use search_type then it requires size otherwise it shows 0 result
body: {
query: {
"match_all": {}
}
}
}, function (err, resp) {
client.scroll({
scrollId: resp._scroll_id,
scroll: '10s'
}, callback(resp.hits.hits));
});
}
</code></pre>
<p>Can anyone help, please?</p>
| <node.js><elasticsearch><express-4> | 2016-09-21 15:05:26 | HQ |
39,620,313 | how to change the color of a text inside li and make it override? | hey i have a newbe question i have this code i am using framework7
<div class="list-block">
<ul>
<?php for($i =0; $i < 5; $i++){?>
<li>
<a href="<?php echo $_SESSION['$tablelink2'][$i]; ?>" target="_blank" title="<?php echo $_SESSION['$tabletitle2'][$i]; ?>" class="external item-content" >
<div id="div1" class="item-media" style="display:block" ><img src=<?php if($_SESSION['checkme'] == 'checked') {echo $_SESSION['$tableimg2'][$i];}else {echo '"about:blank"';} ?> onerror="this.style.display='none'" width="44" height ="44" ></div>
<div class="item-inner">
<div class="item-title-row">
<div class="item-title" ><?php echo $_SESSION['$tabletitle2'][$i]; ?></div>
</div>
<div class="item-subtitle"></div>
</div></a></li>
<?php }?>
</ul>
</div>
the color of the item-title is blue i want to make it red,bold and override any previous rule ? i cant get it done the css code included in the framework is too complicated for me thank you | <css><html-framework-7> | 2016-09-21 15:09:07 | LQ_EDIT |
39,620,317 | How can solve JSON column in H2 | <p>I use in application MySQL 5.7 and I have JSON columns. When I try running my integration tests don't work because the H2 database can't create the table. This is the error:</p>
<pre><code>2016-09-21 16:35:29.729 ERROR 10981 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : HHH000389: Unsuccessful: create table payment_transaction (id bigint generated by default as identity, creation_date timestamp not null, payload json, period integer, public_id varchar(255) not null, state varchar(255) not null, subscription_id_zuora varchar(255), type varchar(255) not null, user_id bigint not null, primary key (id))
2016-09-21 16:35:29.730 ERROR 10981 --- [ main] org.hibernate.tool.hbm2ddl.SchemaExport : Unknown data type: "JSON"; SQL statement:
</code></pre>
<p>This is the entity class.</p>
<pre><code>@Table(name = "payment_transaction")
public class PaymentTransaction extends DomainObject implements Serializable {
@Convert(converter = JpaPayloadConverter.class)
@Column(name = "payload", insertable = true, updatable = true, nullable = true, columnDefinition = "json")
private Payload payload;
public Payload getPayload() {
return payload;
}
public void setPayload(Payload payload) {
this.payload = payload;
}
}
</code></pre>
<p>And the subclass:</p>
<pre><code>public class Payload implements Serializable {
private Long userId;
private SubscriptionType type;
private String paymentId;
private List<String> ratePlanId;
private Integer period;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public SubscriptionType getType() {
return type;
}
public void setType(SubscriptionType type) {
this.type = type;
}
public String getPaymentId() {
return paymentId;
}
public void setPaymentId(String paymentId) {
this.paymentId = paymentId;
}
public List<String> getRatePlanId() {
return ratePlanId;
}
public void setRatePlanId(List<String> ratePlanId) {
this.ratePlanId = ratePlanId;
}
public Integer getPeriod() {
return period;
}
public void setPeriod(Integer period) {
this.period = period;
}
}
</code></pre>
<p>And this converter for insert in database:</p>
<pre><code>public class JpaPayloadConverter implements AttributeConverter<Payload, String> {
// ObjectMapper is thread safe
private final static ObjectMapper objectMapper = new ObjectMapper();
private Logger log = LoggerFactory.getLogger(getClass());
@Override
public String convertToDatabaseColumn(Payload attribute) {
String jsonString = "";
try {
log.debug("Start convertToDatabaseColumn");
// convert list of POJO to json
jsonString = objectMapper.writeValueAsString(attribute);
log.debug("convertToDatabaseColumn" + jsonString);
} catch (JsonProcessingException ex) {
log.error(ex.getMessage());
}
return jsonString;
}
@Override
public Payload convertToEntityAttribute(String dbData) {
Payload payload = new Payload();
try {
log.debug("Start convertToEntityAttribute");
// convert json to list of POJO
payload = objectMapper.readValue(dbData, Payload.class);
log.debug("JsonDocumentsConverter.convertToDatabaseColumn" + payload);
} catch (IOException ex) {
log.error(ex.getMessage());
}
return payload;
}
}
</code></pre>
| <java><spring><hibernate><h2><mysql-5.7> | 2016-09-21 15:09:18 | HQ |
39,620,497 | Golang: json Unmarshal fails to unpack simple example | <p>I cannot get my head around this problem. I have a simple struct, and another struct that uses it twice:</p>
<pre><code>type Range struct {
Position int `json:"position"`
Length int `json:"length"`
}
type TwoRanges struct {
From Range `json:"from"`
To Range `json:"to"`
}
</code></pre>
<p>and the following json sample in file "ranges.json":</p>
<pre><code>{
"from:": {
"position": 348,
"length": 15
},
"to": {
"position": 737,
"length" : 10
}
}
</code></pre>
<p>I try unmarshalling the sample in the following code:</p>
<pre><code>func main() {
buffer, err := ioutil.ReadFile("ranges.json")
if err != nil {
log.Fatal(err)
}
var sample TwoRanges
if err = json.Unmarshal(buffer, &sample); err != nil {
log.Fatal(err)
}
fmt.Printf("%v\n", sample)
}
</code></pre>
<p>The output is</p>
<pre><code>{{0 0} {737 10}}
</code></pre>
<p>Somehow, only the half of the struct is unpacked.</p>
<ol>
<li>Is it a bug, or am I doing something wrong?</li>
<li>Is there a "verbose mode" for the encoding/json package which would tell me what went wrong with the unmarshaller? It's not the first time that I've had mysterious problems with that package. </li>
</ol>
| <go> | 2016-09-21 15:17:08 | LQ_CLOSE |
39,620,739 | Android Studio CMake - shared library missing libc++_shared.so? Can CMake bundle this? | <p>Now that Android Studio 2.2 is released officially, I'm migrating from my old ndk-build process to try and use CMake within AS. As I'm incorporating several codebases from within my company (that I can't edit) that make heavy use of C++11 code (including the dreaded std::to_string() method), the only way I can compile is with a select few configuration options - all of which I discovered earlier when beginning work with ndk-build. (see below)</p>
<p>So everything compiles again and builds into the APK - and I 100% verify that my output shared library exists in the APK, but I'm unable to successfully use <code>System.loadLibrary('mylibrary')</code> - and it turns out this is because the dependency <em>libc++_shared.so</em> is missing. </p>
<p>As in, I get the following error:</p>
<pre><code>java.lang.UnsatisfiedLinkError: dlopen failed: library "libc++_shared.so" not found
</code></pre>
<p>In my old ndk-build process, I always wound up with the 2 libraries (<em>mylibrary.so</em> and <em>libc++_shared.so</em>) in my output folder, which thereby got bundled together into the app. It seems the CMake toolchain isn't bundling <em>libc++_shared.so at all</em> (indeed, it's not found in the APK). </p>
<p>I've been banging my head on this for 6 hours. Can I somehow get the CMake toolchain to bundle this missing library? Any clues?</p>
<p>.</p>
<p>.</p>
<p><strong>My settings:</strong></p>
<p>In gradle.build:</p>
<pre><code>externalNativeBuild {
cmake {
arguments '-DANDROID_STL=c++_shared', '-DANDROID_TOOLCHAIN=gcc', '-DANDROID_PLATFORM=android-16'
}
}
</code></pre>
<p>And my CMakeLists.txt (filenames cut out for brevity):</p>
<pre><code>cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=gnu++11")
include_directories(.)
include_directories(./other)
set(my_SRCS jniInterface.cpp
etc.cpp)
add_library(mylibrary SHARED ${my_SRCS})
target_link_libraries(mylibrary atomic log)
</code></pre>
| <android><c++11><android-ndk><cmake><std> | 2016-09-21 15:27:45 | HQ |
39,620,905 | How can i generate a random large image file using c# code? | <p>I have a requirement to generate 100s of thousands of random but unique image files (.jpeg/tiff/png) with the following criteria and drop it into a folder of choice :</p>
<p>Generated file to be with a given resolution, size (eg. 100mb each) but can be any dummy randomised colours/patterns etc...</p>
<p>Is there any way i can generate this using c# or any other programming technique ? </p>
| <c#><.net><image> | 2016-09-21 15:34:59 | LQ_CLOSE |
39,621,263 | Jenkins fails when running "service start jenkins" | <p>I installed jenkins on Cnetos 7 using the following:</p>
<pre><code>sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins.io/redhat-stable/jenkins.repo
sudo rpm --import http://pkg.jenkins.io/redhat-stable/jenkins.io.key
yum install jenkins
</code></pre>
<p>as <a href="http://pkg.jenkins-ci.org/redhat-stable/" rel="noreferrer">described on the official documentation</a></p>
<p>However when I run:</p>
<pre><code>service start jenkins
</code></pre>
<p>I get the following error message:</p>
<pre><code>Starting jenkins (via systemctl): Job for jenkins.service failed because the control process exited with error code. See "systemctl status jenkins.service" and "journalctl -xe" for details.
[FAILED]
</code></pre>
<p>Running <code>systemctl status jenkins.service</code> gives me this:</p>
<pre><code>β jenkins.service - LSB: Jenkins Continuous Integration Server
Loaded: loaded (/etc/rc.d/init.d/jenkins)
Active: failed (Result: exit-code) since Wed 2016-09-21 16:45:28 BST; 3min 59s ago
Docs: man:systemd-sysv-generator(8)
Process: 2818 ExecStart=/etc/rc.d/init.d/jenkins start (code=exited, status=1/FAILURE)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.of(JavaVMArguments...04)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.current(JavaVMArgu...92)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.daemonize(Daemon.java:106)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.all(Daemon.java:88)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: ... 6 more
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service: control process exited, code=exited s...s=1
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Failed to start LSB: Jenkins Continuous Integration Server.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Unit jenkins.service entered failed state.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service failed.
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: [FAILED]
Hint: Some lines were ellipsized, use -l to show in full.
</code></pre>
<p>and running <code>journalctl -xe</code> gives me this:</p>
<pre><code>Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.of(JavaVMArguments.java:
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.JavaVMArguments.current(JavaVMArguments.
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.daemonize(Daemon.java:106)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: at com.sun.akuma.Daemon.all(Daemon.java:88)
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: ... 6 more
Sep 21 16:45:28 webstack.local.caplib runuser[2819]: pam_unix(runuser:session): session closed for user jenkin
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service: control process exited, code=exited status=
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Failed to start LSB: Jenkins Continuous Integration Server.
-- Subject: Unit jenkins.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit jenkins.service has failed.
--
-- The result is failed.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: Unit jenkins.service entered failed state.
Sep 21 16:45:28 webstack.local.caplib systemd[1]: jenkins.service failed.
Sep 21 16:45:28 webstack.local.caplib jenkins[2818]: [FAILED]
Sep 21 16:45:28 webstack.local.caplib polkitd[1392]: Unregistered Authentication Agent for unix-process:2813:8
Sep 21 16:45:28 webstack.local.caplib dhclient[1390]: DHCPREQUEST on eno16777984 to 192.168.15.254 port 67 (xi
Sep 21 16:45:28 webstack.local.caplib dhclient[1390]: DHCPACK from 192.168.15.254 (xid=0x2ab6e6bc)
Sep 21 16:45:30 webstack.local.caplib dhclient[1390]: bound to 192.168.15.120 -- renewal in 865 seconds.
Sep 21 16:45:36 webstack.local.caplib systemd[1]: Starting Cleanup of Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has begun starting up.
Sep 21 16:45:36 webstack.local.caplib systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit systemd-tmpfiles-clean.service has finished starting up.
--
-- The start-up result is done.
</code></pre>
<p>Both of which is really unhelpful. How do I fix this issue?</p>
| <jenkins> | 2016-09-21 15:52:32 | HQ |
39,621,297 | Get a Java string of form (num/num), to become two double values | <p>For example, if I have a string (24/25), how would I go about being left with two double values of 24 and 25. My objective to to eventually, given a set of number of that form, divide each of them, and add to get the average. I'm fairly new to Java and I honestly am so confused as where to even begin. Thank you!</p>
| <java><string><double> | 2016-09-21 15:54:53 | LQ_CLOSE |
39,621,821 | Cannot call a method within a class it defined it in ES6 in Node.js | <p>I am making an app using Node.js, Express.js and MongoDB.
I am using a MVC pattern and also have separate file for routes.
I am trying me make a Controller class, in which a method calls another method declared within it. But I cannot seem to be able to do this. I get "Cannot read property '' of undefined".</p>
<p>index.js file</p>
<pre><code>let express = require('express');
let app = express();
let productController = require('../controllers/ProductController');
app.post('/product', productController.create);
http.createServer(app).listen('3000');
</code></pre>
<p>ProductController.js file</p>
<pre><code>class ProductController {
constructor(){}
create(){
console.log('Checking if the following logs:');
this.callme();
}
callme(){
console.log('yes');
}
}
module.exports = new ProductController();
</code></pre>
<p>When I run this I get following error message:</p>
<pre><code>Cannot read property 'callme' of undefined
</code></pre>
<p>I have ran this code by itself with little modification as following and it works.</p>
<pre><code>class ProductController {
constructor(){}
create(){
console.log('Checking if the following logs:');
this.callme();
}
callme(){
console.log('yes');
}
}
let product = new ProductController();
product.create();
</code></pre>
<p>Why does one work and not the other?
HELP!</p>
| <javascript><node.js><express><ecmascript-6><es6-class> | 2016-09-21 16:24:31 | HQ |
39,621,995 | How to instantiate fragment class using class name instead of index | <p>I have two fragment class named <code>SessionTab</code> and <code>BillingTab</code>and i am trying to create instance of those class using</p>
<pre><code>SessionTab sessionTab = (SessionTab) getSupportFragmentManager().getFragments().get(1);
</code></pre>
<p>but sometimes index for those classes are reversed and then it causes <code>ClassCastException</code> </p>
<p>How can i get instance of those fragment class by passing class name instead of index or any way to make sure that index of those class stays the same everytime so it doesn't cause <code>ClassCastException</code></p>
| <java><android><android-fragments> | 2016-09-21 16:33:57 | HQ |
39,622,528 | Understanding the use of Task.Run + Wait() + async + await used in one line | <p>I'm a C# newbie, so I'm struggling to understand some concepts, and I run into a piece of code that I'm not quite understanding:</p>
<pre><code>static void Main(string[] args)
{
Task.Run(async () => { await SomeClass.Initiate(new Configuration()); }).Wait();
while (true) ;
}
</code></pre>
<p>As I understand, this runs a task which initiates a method. This method runs, and then, once it finished, it gets into an infinite loop waiting. It feels that either the code doesn't make sense, or that I'm not understanding right.</p>
<p>Thanks</p>
| <c#><async-await> | 2016-09-21 17:04:34 | HQ |
39,623,636 | Forcing R output to be scientific notation with at most two decimals | <p>I would like to have consistent output for a particular R script. In this case, I would like all numeric output to be in scientific notation with exactly two decimal places.</p>
<p>Examples:</p>
<pre><code>0.05 --> 5.00e-02
0.05671 --> 5.67e-02
0.000000027 --> 2.70e-08
</code></pre>
<p>I tried using the following options:</p>
<pre><code>options(scipen = 1)
options(digits = 2)
</code></pre>
<p>This gave me the results:</p>
<pre><code>0.05 --> 0.05
0.05671 --> 0.057
0.000000027 --> 2.7e-08
</code></pre>
<p>I obtained the same results when I tried:</p>
<pre><code>options(scipen = 0)
options(digits = 2)
</code></pre>
<p>Thank you for any advice.</p>
| <r><decimal><scientific-notation> | 2016-09-21 18:07:09 | HQ |
39,624,745 | Capture only ssl handshake with tcpdump | <p>I have a server to which many clients connect using SSL. Recently I'm observing SSL handshake errors in the server logs (ex SSL MAC error). The error itself is not important, but I want to see why some clients are able to connect while others are failing, and also need to identify which clients are failing.</p>
<p>For debugging this issue, I want to capture all SSL handshakes happening at server and since I don't know when the problematic clients connect, I don't want to capture all the traffic till that happens. I just want to capture all the SSL handshakes and later analyze them with Wireshark. Assume that I only have access to tcpdump and no other tools for capturing.</p>
| <ssl><networking><tcp><tcpdump> | 2016-09-21 19:11:50 | HQ |
39,624,749 | How to build multiple applications with angular-cli? | <p>The property <code>apps</code> in the <code>angular-cli.json</code> file is of array type. If I add a second element into this array, how can I instruct <code>ng build</code> to build both elements?</p>
| <angular-cli> | 2016-09-21 19:12:01 | HQ |
39,624,945 | Multiplying by width/height in processing | In processing I keep getting 0 when I multiply width or height by a number for example:
int x = width*2;
I get x = 0
Why??? | <processing> | 2016-09-21 19:23:23 | LQ_EDIT |
39,625,506 | Set object property key to variable value | <p>I am creating an object dynamically and would like to set a property (also an object) to be the value of a variable. </p>
<p>My code:</p>
<pre><code>var guid, block, lot, muni, county, owner, prop_loc;
guid = 'Some unique value';
//code to set the other variable values here...
var menuItem = new MenuItem({
id: 'basic',
label: 'Report',
onClick: lang.hitch(this, function () {
topic.publish('basicReportWidget/reportFromIdentify', {
guid : { //set this to the guid string value
block: block,
lot: lot,
muni: muni,
county: county,
owner: owner,
prop_loc: prop_loc,
type: 'basic'
}
});
})
});
</code></pre>
| <javascript><dojo> | 2016-09-21 19:57:51 | LQ_CLOSE |
39,625,767 | c++ farenheit or celsius converter | Hi Just wondering why this is not working, as of right now it prints out just the farenehit one no matter if i select c or f. plz help
#include <iostream>
using namespace std;
int main()
{
char unit;
float degrees = 0.0;
float Farenheit, Celsius;
cout << "Enter the temperature unit you are currently in (f or c): ";
cin >> unit;
cout << "Enter the temperature in degrees: ";
cin >> degrees;
if ( unit == 'c' || 'C')
{
Farenheit = (degrees - 32) / 9 * 5.0;
cout << "The degrees in Farenheit are: " << Farenheit << endl;
}
else if ( unit == 'f' || 'F')
{
Celsius = (degrees - 32) * 5.0/9;
cout << "The degrees in Celsius is: " << Celsius << endl;
}
return 0;
}
| <c++> | 2016-09-21 20:13:08 | LQ_EDIT |
39,626,194 | Should I avoid using Dependency Injection and IoC? | <p>In my mid-size project I used static classes for repositories, services etc. and it actually worked very well, even if the most of programmers will expect the opposite. My codebase was very compact, clean and easy to understand. Now I tried to rewrite everything and use <code>IoC</code> (Invertion of Control) and I was absolutely disappointed. I have to manually initialize dozen of dependencies in every class, controller etc., add more projects for interfaces and so on. I really don't see any benefits in my project and it seems that it causes more problems than solves. I found the following drawbacks in <code>IoC</code>/<code>DI</code>:</p>
<ul>
<li>much bigger codesize</li>
<li>ravioli-code instead of spaghetti-code</li>
<li>slower performance, need to initialize all dependencies in constructor even if the method I want to call has only one dependency</li>
<li>harder to understand when no IDE is used</li>
<li>some errors are pushed to run-time</li>
<li>adding additional dependency (DI framework itself)</li>
<li>new staff have to learn DI first in order to work with it</li>
<li>a lot of boilerplate code, which is bad for creative people (for example copy instances from constructor to properties...)</li>
</ul>
<p>We do not test the entire codebase, but only certain methods and use real database. So, should Dependency Injection be avoided when no mocking is required for testing?</p>
| <c#><dependency-injection><inversion-of-control><ioc-container> | 2016-09-21 20:39:37 | HQ |
39,626,337 | Can someone explain descendantFocusability = afterDescendants? | <p>I'm having hard time understanding <code>descendantFocusability</code>. Very particulary <code>afterDescendants</code>.</p>
<p>Could someone show me an example of when this would be useful?</p>
| <android> | 2016-09-21 20:48:39 | HQ |
39,626,579 | Is there a way to combine Docker images into 1 container? | <p>I have a few Dockerfiles right now.</p>
<p>One is for Cassandra 3.5, and it is <code>FROM cassandra:3.5</code></p>
<p>I also have a Dockerfile for Kafka, but t is quite a bit more complex. It is <code>FROM java:openjdk-8-fre</code> and it runs a long command to install Kafka and Zookeeper.</p>
<p>Finally, I have an application written in Scala that uses SBT. </p>
<p>For that Dockerfile, it is <code>FROM broadinstitute/scala-baseimage</code>, which gets me Java 8, Scala 2.11.7, and STB 0.13.9, which are what I need.</p>
<p>Perhaps, I don't understand how Docker works, but my Scala program has Cassandra and Kafka as dependencies and for development purposes, I want others to be able to simply clone my repo with the <code>Dockerfile</code> and then be able to build it with Cassandra, Kafka, Scala, Java and SBT all baked in so that they can just compile the source. I'm having a lot of issues with this though. </p>
<p>How do I combine these Dockerfiles? How do I simply make an environment with those things baked in?</p>
| <docker><dockerfile><docker-image> | 2016-09-21 21:04:33 | HQ |
39,627,017 | Error during WebSocket handshake: Unexpected response code: 403 | <p>I have implemented <strong>WebSockets</strong> with <strong>Spring Boot Application</strong> and have the below error message when trying to test the ws connection with the chrome extension '<strong>Smart websocket client</strong>'.
However, I have no problem when run the Spring Boot Application locally.</p>
<pre><code>WebSocket connection to 'ws://192.168.X.XYZ:8080/test' failed:
Error during WebSocket handshake: Unexpected response code: 403
</code></pre>
<p>The only difference which I see is in the Request headers:</p>
<p>In the one it works - Origin:<a href="http://192.168.X.XYZ:8080" rel="noreferrer">http://192.168.X.XYZ:8080</a></p>
<p>In the one it does not work - Origin:chrome-extension://omalebghpgejjiaoknljcfmglgbpocdp</p>
<p>What I did in the <strong>WebSocketConfig</strong> class is below:</p>
<pre><code>@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(myHandler(), "/test").setAllowedOrigins("http://192.168.X.XYZ:8080");
}
</code></pre>
<p>and still does <strong>not</strong> work.</p>
<p>Could you please advise what the reason for that error might be and how to fix it? </p>
<p>Thank you in advance.</p>
| <java><spring><websocket><cors><spring-websocket> | 2016-09-21 21:41:28 | HQ |
39,627,029 | Julia - how does @inline work? When to use function vs. macro? | <p>I have many small functions I would like to inline, for example to test flags for some condition:</p>
<pre><code>const COND = UInt(1<<BITS_FOR_COND)
function is_cond(flags::UInt)
return flags & COND != 0
end
</code></pre>
<p>I could also make a macro: </p>
<pre><code>macro IS_COND(flags::UInt)
return :(flags & COND != 0)
end
</code></pre>
<p>My motivation is many similar macro functions in the C code I am working with:</p>
<pre><code>#define IS_COND(flags) ((flags) & COND)
</code></pre>
<p>I repeatedly timed the function, macro, function defined with @inline, and the expression by itself, but none are consistently faster than the others across many runs. The generated code for the function call in 1) and 3) are much longer than for the expression in 4), but I don't know how to compare 2) since <code>@code_llvm</code> etc. don't work on other macros.</p>
<pre><code>1) for j=1:10 @time for i::UInt=1:10000 is_cond(i); end end
2) for j=1:10 @time for i::UInt=1:10000 @IS_COND(i); end end
3) for j=1:10 @time for i::UInt=1:10000 is_cond_inlined(i); end end
4) for j=1:10 @time for i::UInt=1:10000 i & COND != 0; end end
</code></pre>
<p>Questions: What is the purpose of <code>@inline</code>? I see from the sparse documentation that it appends the symbol <code>:inline</code> to the expression <code>:meta</code>, but what does that do, exactly? Is there any reason to prefer a function or macro for this kind of task?</p>
<p>My understanding is that a C macro function just substitutes the literal text of the macro at compile time, so the resulting code has no jumps and is therefore more efficient than a regular function call. (Safety is another issue, but let's assume the programmers know what they're doing.) A Julia macro has intermediate steps like parsing its arguments, so it's not obvious to me whether 2) should be faster than a 1). Ignoring for the moment that in this case the difference in performance is negligible, what technique results in the most efficient code?</p>
| <julia> | 2016-09-21 21:42:32 | HQ |
39,628,387 | Count bits starting from the ones, then tens and so on | <p>Coding in C++.</p>
<p>I'm trying to print out only a specified digit from a binary code in the form of a string. The user can specify a certain digit position, and the number in that position must be printed. </p>
<p>Eg. string c = "11011001" and the user wants the 1st position. The output has to be 0.</p>
<p>Count indices start at 0 and from the 'ones' digit meaning a request of the 1st position is the number in the 'tens' digit position.</p>
<p>I have no idea how to start counting from the ones column. I tried c.at() but that starts from the left most digit and counts towards the right.</p>
| <c++><count><binary><bits> | 2016-09-22 00:20:25 | LQ_CLOSE |
39,628,637 | Convert data on AlterField django migration | <p>I have a production database and need to keep safe the data. I want to change a Field in model and convert all data inside that database with this change.</p>
<p>Old field</p>
<pre><code>class MyModel(models.Model):
field_name = models.TimeField()
</code></pre>
<p>Changed field</p>
<pre><code>class MyModel(models.Model):
field_name = models.PositiveIntegerField()
</code></pre>
<p>Basically I want to convert the TimeField value (that has a Time object) in minutes.</p>
<p>Example: I have in an object <code>time(hour=2, minute=0, second=0)</code> and I want to convert that field value in all database table to <code>120</code> when I apply the migrate.</p>
| <django><django-models><django-migrations> | 2016-09-22 00:55:53 | HQ |
39,628,885 | How convert LocalDateTime to Date in Java 8 | <p>I'm using timezone Brazil by default, but when caught one LocalDateTime of New York and convert to <strong>java.tim.Instant</strong> the <strong>instant</strong> is filled correctly. The problem is when I try to generate a <strong>Date</strong> with <strong>Date.from (instantValue)</strong>, instead of being generated a <strong>date</strong> of New York, I end up getting the current date from Brazil.</p>
<pre><code>ZoneId nyZone = ZoneId.of("America/New_York");
ZoneId brazilZone = ZoneId.of("America/Recife");
LocalDateTime ldtBrazil = LocalDateTime.now(brazilZone);
LocalDateTime ldtNY = LocalDateTime.now(nyZone);
Instant instantBrazil = ldtBrazil.toInstant(ZoneOffset.UTC);
Instant instantNY = ldtNY.toInstant(ZoneOffset.UTC);
System.out.println("-------LocalDateTime-------");
System.out.println("ldtBrazil : "+ldtBrazil);
System.out.println("ldtNY : "+ldtNY);
System.out.println("\n-------Instant-------");
System.out.println("instantBrazil: "+instantBrazil);
System.out.println("instantNY : "+instantNY);
long milliBrazil = instantBrazil.toEpochMilli();
long milliNY = instantNY.toEpochMilli();
System.out.println("\n----------Milli----------");
System.out.println("miliBrazil : "+milliBrazil);
System.out.println("miliNY : "+milliNY);
Date dateBrazil = Date.from(instantBrazil);
Date dateNY = Date.from(instantNY);
System.out.println("\n---------Date From Instant---------");
System.out.println("dateBrazil: "+dateBrazil);
System.out.println("dateNY : "+dateNY);
System.out.println("\n---------Date From Milli---------");
System.out.println("dateBrazil: "+new Date(milliBrazil));
System.out.println("dateNY : "+new Date(milliNY));
</code></pre>
<p><strong>Result</strong></p>
<pre><code>-------LocalDateTime-------
ldtBrazil : 2016-09-21T22:11:52.118
ldtNY : 2016-09-21T21:11:52.118
-------Instant-------
instantBrazil: 2016-09-21T22:11:52.118Z
instantNY : 2016-09-21T21:11:52.118Z
----------Milli----------
miliBrazil : 1474495912118
miliNY : 1474492312118
---------Date From Instant---------
dateBrazil: Wed Sep 21 19:11:52 BRT 2016
dateNY : Wed Sep 21 18:11:52 BRT 2016 //this data must be related to NY LocalDateTime, but reiceved a same date of Brazil.
---------Date From Milli---------
dateBrazil: Wed Sep 21 19:11:52 BRT 2016
dateNY : Wed Sep 21 18:11:52 BRT 2016
</code></pre>
| <java><date><time><java-8> | 2016-09-22 01:30:00 | HQ |
39,628,982 | I want to make this using bootstrap 3, anyone help me how i start and divide it in columns? | <p><a href="http://i.stack.imgur.com/7y55F.png" rel="nofollow">This is the website i want to make it using bootstrap</a></p>
| <twitter-bootstrap><twitter-bootstrap-3> | 2016-09-22 01:42:56 | LQ_CLOSE |
39,629,343 | How do you test the effects of dns-prefetch and preconnect | <p>I'm trying out the <code><link rel="dns-prefetch"></code> and <code><link rel="preconnect"></code> tags and I'm trying to see whether they help for my site. I can't find any online resources about how verify if these hints are working using browser dev tools, extensions, or other software. It seems like you just evaluate whether they may be useful to you based on some criteria and then drop them in and hope for the best.</p>
<p>In my case, I have a single page app that renders the entire contents of the <code><body></code> in the browser, so the browser can't really scan the initial HTML to lookahead for domains to resolve so it seemed like this might be useful for me.</p>
| <http><dns><prefetch> | 2016-09-22 02:33:56 | HQ |
39,629,402 | Because when I search with child is null? | I have this code:
String email = FirebaseAuth.getInstance().getCurrentUser().getEmail();
myRef = database.getReference("reserva/");
myRef.orderByChild("email").equalTo(email).addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
String value = dataSnapshot.child("reserva/1/status").getValue(String.class);
String status;
TextView textview2 = (TextView) findViewById(R.id.TextView2);
if (value != null) {
status = dataSnapshot.getKey() + getString(R.string.statusreservafeita);
textview2.setText(status + value);
} else
textview2.setText(R.string.statusreservafail );
}
@Override
public void onCancelled(DatabaseError error) {
TextView textview2 = (TextView) findViewById(R.id.TextView2);
textview2.setText(R.string.statusreservafail );
}
});
My bank :
"reserva" : {
"1" : {
"email" : "teste@teste.com",
"status" : "check in"
},
"2" : {
"email" : "fabio@ciaf.com.br",
"status" : "check out"
},
"123" : {
"email" : "fbaoo07@gmail.com",
"status" : "reservado"
}
}
When I put an email teste@teste.com returns null. I need it returns the status and he is coming null. I need to help me, I think he To him this missing child. | <java><android><firebase><firebase-realtime-database> | 2016-09-22 02:39:29 | LQ_EDIT |
39,630,120 | Spark 2.0 deprecates 'DirectParquetOutputCommitter', how to live without it? | <p>Recently we migrated from "EMR on HDFS" --> "EMR on S3" (EMRFS with consistent view enabled) and we realized the Spark 'SaveAsTable' (parquet format) writes to S3 were ~4x slower as compared to HDFS but we found a workaround of using the DirectParquetOutputCommitter -[1] w/ Spark 1.6.</p>
<p>Reason for S3 slowness - We had to pay the so called Parquet tax-[2] where the default output committer writes to a temporary table and renames it later where the rename operation in S3 is very expensive</p>
<p>Also we do understand the risk of using 'DirectParquetOutputCommitter' which is possibility of data corruption w/ speculative tasks enabled.</p>
<p>Now w/ Spark 2.0 this class has been deprecated and we're wondering what options do we have on the table so that we don't get to bear the ~4x slower writes when we upgrade to Spark 2.0. Any Thoughts/suggestions/recommendations would be highly appreciated.</p>
<p>One workaround that we can think of is - Save on HDFS and then copy it to S3 via s3DistCp (any thoughts on how can this be done in sane way as our Hive metadata-store points to S3?)</p>
<p>Also looks like NetFlix has fixed this -[3], any idea on when they're planning to open source it?</p>
<p>Thanks.</p>
<p>[1] - <a href="https://github.com/apache/spark/blob/21d5ca128bf3afd5c2d4c7fcc56240e28443474f/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/DirectParquetOutputCommitter.scala" rel="noreferrer">https://github.com/apache/spark/blob/21d5ca128bf3afd5c2d4c7fcc56240e28443474f/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/DirectParquetOutputCommitter.scala</a></p>
<p>[2] -
<a href="https://www.appsflyer.com/blog/the-bleeding-edge-spark-parquet-and-s3/" rel="noreferrer">https://www.appsflyer.com/blog/the-bleeding-edge-spark-parquet-and-s3/</a></p>
<p>[3] -
<a href="https://www.youtube.com/watch?v=85sew9OFaYc&feature=youtu.be&t=8m39s" rel="noreferrer">https://www.youtube.com/watch?v=85sew9OFaYc&feature=youtu.be&t=8m39s</a>
<a href="http://www.slideshare.net/AmazonWebServices/bdt303-running-spark-and-presto-on-the-netflix-big-data-platform" rel="noreferrer">http://www.slideshare.net/AmazonWebServices/bdt303-running-spark-and-presto-on-the-netflix-big-data-platform</a></p>
| <hadoop><apache-spark><amazon-s3><amazon-emr><parquet> | 2016-09-22 04:11:24 | HQ |
39,630,247 | Swift 3: Cannot convert value of type 'NSMutableDictionary' to expected argument type '[AnyHashable : Any]!' | <p>This code worked before Swift 3. (Curse you Swift 3!)</p>
<p>Now it's showing this error against the <code>Flurry.logEvent(eventName, withParameters: userData!)</code> line:</p>
<blockquote>
<p>Cannot convert value of type 'NSMutableDictionary' to expected
argument type '[AnyHashable : Any]!'</p>
</blockquote>
<p>Casting <code>userData!</code> to <code>[AnyHashable : Any]</code> produces this error:</p>
<blockquote>
<p>Cannot convert value of type 'NSMutableDictionary' to type
'[AnyHashable : Any]' in coercion</p>
</blockquote>
<pre><code>func logEvent(_ eventName: String, userData: NSMutableDictionary?) {
// Use <userData> or create new one?
var userData = userData
if userData == nil {
userData = NSMutableDictionary()
}
// Set base properties
userData!.setObject(gUser.tofus.count, forKey: "Num Tofus" as NSCopying)
userData!.setObject(gUser.getLifetimeTofus(), forKey: "Num Lifetime Tofus" as NSCopying)
// Call Flurry
DispatchQueue.main.async {
Flurry.logEvent(eventName, withParameters: userData! as [AnyHashable:Any])
}
}
</code></pre>
<p>What's the right syntax for Swift 3?</p>
| <swift><swift3> | 2016-09-22 04:25:02 | HQ |
39,630,620 | React-Intl How to use FormattedMessage in input placeholder | <p>I'm unsure how to get the values from </p>
<pre><code><FormattedMessage {...messages.placeholderIntlText} />
</code></pre>
<p>into a placeholder format like input:</p>
<pre><code><input placeholder={<FormattedMessage {...messages.placeholderIntlText} />} />
</code></pre>
<p>as it would return [Object object] in the actual placeholder. Is there a way to get the actual correct value?</p>
| <reactjs><react-intl><react-starter-kit> | 2016-09-22 05:00:31 | HQ |
39,630,886 | How to extract a specific data range form multiple sheets in excel | I have an excel sheet with four additional sheets
sheet1
sheet2
sheet3
summary (sheet4)
The first three sheets have a column of age. At the summary sheet i want to age data as age group ( 18 to 25, 26 to 33 etc..). I know how to get age group range from single sheet, but don't know how to get (exmp:18 to 25 from sheet1+sheet2+sheet3)a range from multiple sheet.
Please try to understand my question and please answer without VB code.
Thanks | <excel><range> | 2016-09-22 05:26:30 | LQ_EDIT |
39,631,186 | Not able to run this php code? | <?PHP
$connection = mysqli_connect("localhost", "akdnaklnd", "lfnlfns","faknfns");
$game = $_POST['game'];
$post_rating = $_POST['rating'];
$find_data = mysqli_query( "SELECT * FROM rates WHERE game='$game'");
while($row = mysqli_fetch_assoc($find_data)){
$id=$row['id'];
$current_rating = $row['rating'];
$current_hits=$row['hits'];
}
$new_hits = $current_hits + 1;
$update_hits= mysqli_query("UPDATE rates SET hits = '$new_hits' WHERE id='$id'");
$pre_rating= $current_rating + $post_rating;
$new_rating = $pre_rating / $new_hits;
$update_rating = mysqli_query("UPDATE rates SET rating ='$new_rating' WHERE id='$id'");
header("location : average.php");
?>
Discription I am trying to insert rating in database and calling average of that given rating from data base
| <php><mysql><joomla3.0> | 2016-09-22 05:51:04 | LQ_EDIT |
39,631,829 | two dimential array declaration | This question is given in my assignment, but I am very confused in the **array declaration.**
*Given a two dimensional array A[2:3, 9:18] stored in column major order with base address 100 and size of each element is 4 bytes, Find the address of A[4,12]* | <c><arrays><multidimensional-array><data-structures> | 2016-09-22 06:32:52 | LQ_EDIT |
39,631,895 | How to set image width to be 100% and height to be auto in react native? | <p>I am trying to display list of images in a scrollview. Width should be 100%, while height should be automatic, keeping aspect ratio.</p>
<p>The searches I did pointed to various solutions which give fullscreen background style.</p>
<pre><code>const styles = StyleSheet.create({
image: {
width: null,
height: 300,
resizeMode: 'cover'
}
});
<ScrollView style={{flex: 1}}>
<Image style={styles.image} source={require('../../../images/collection-imag1.png')}/>
<Image style={styles.image} source={require('../../../images/collection-imag2.png')}/>
</ScrollView>
</code></pre>
<p>I have tried various combinations of width: null, height: null, flex: 1, alignSelf etc. The above solution is almost working, except the height is not dynamic. Parts of the image are not visible.</p>
| <javascript><image><reactjs><react-native> | 2016-09-22 06:37:17 | HQ |
39,632,713 | how can i deserialize the above jason string to datatable in c# | {"m_MaxCapacity":2147483647,"Capacity":1888,"m_StringValue":"<table border=3><tr><th>Master ID</th><th>Tag ID</th><th>Plant ID</th><th>Machine Name</th><th>Sap ID</th><th>Log</th></tr><tr><td>2296</td><td>567</td><td>567</td><td>hjhnh</td><td>567</td><td>17-09-2016 15:03:04</td></tr><tr><td>2297</td><td>55555</td><td>567</td><td>hjhnh</td><td>567</td><td>17-09-2016 15:04:27</td></tr><tr><td>2298</td><td>55555</td><td>567</td><td>hjhnh</td><td>0000</td><td>17-09-2016 15:04:53</td></tr><tr><td>2299</td><td>55555</td><td>567</td><td>hjhnh</td><td>0000</td><td>17-09-2016 15:05:11</td></tr><tr><td>2300</td><td>6678</td><td>6754</td><td>nnn</td><td>789</td><td>17-09-2016 15:20:51</td></tr><tr><td>2301</td><td>6678</td><td>6754</td><td>AF</td><td>789</td><td>17-09-2016 15:23:57</td></tr><tr><td>2302</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>17-09-2016 15:33:22</td></tr><tr><td>2303</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>17-09-2016 15:43:10</td></tr><tr><td>2304</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>17-09-2016 15:43:23</td></tr><tr><td>2305</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>17-09-2016 15:43:50</td></tr><tr><td>2306</td><td>6678</td><td>6754</td><td>lmno</td><td>789</td><td>17-09-2016 15:49:25</td></tr><tr><td>2307</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>22-09-2016 11:23:16</td></tr><tr><td>2308</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>22-09-2016 11:40:07</td></tr><tr><td>2309</td><td>6678</td><td>6754</td><td>ccccc</td><td>789</td><td>22-09-2016 11:40:18</td></tr><tr><td>2310</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>22-09-2016 11:45:53</td></tr><tr><td>2311</td><td>6678</td><td>6754</td><td>ttttttt</td><td>789</td><td>22-09-2016 12:00:48</td></tr><tr><td>2312</td><td>6678</td><td>6754</td><td>mmmmmmmmmm</td><td>789</td><td>22-09-2016 12:00:52</td></tr></table>","m_currentThread":0}
how can i deserialize the above jason string to datatable in c# plz help | <c#><json.net> | 2016-09-22 07:22:34 | LQ_EDIT |
39,632,811 | Cannot read property 'bind' of undefined. React.js | <p>I'm making list using onsenui and react.
but I cannot call a bind from onchanged.</p>
<p>I couldn't figure out.... Does anyone can solve this?</p>
<p>this is my code.
I'd like to call handlechanged method from input item.
But then, Cannot read property 'bind' of undefined is raised.</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>export default class MainPage extends React.Component {
constructor(props) {
super(props);
this.state = {
selectedValue: "myself",
destinations: ["myself","somebody"],
};
}
handleChange(value) {
this.setState({selectedValue: value});
}
renderRadioRow(row) {
return (
<ListItem key={row} tappable>
<label className='left'>
<Input
inputId={`radio-${row}`}
checked={row === this.selectedValue}
onChange={this.handleChange.bind(this, row)}
type='radio'
/>
</label>
<label htmlFor={`radio-${row}`} className='center'>
{row}
</label>
</ListItem>
)
}
render() {
return (
<Page renderToolbar={this.renderToolbar}>
<p style={{textAlign: 'center'}}>
test
</p>
<List
dataSource={this.state.destinations}
renderRow={this.renderRadioRow}
/>
</Page>
);
}
}</code></pre>
</div>
</div>
</p>
| <javascript><reactjs><ecmascript-6><monaca> | 2016-09-22 07:27:43 | HQ |
39,632,975 | Xcode 8 (Swift 3) Command failed due to signal: Killed: 9 | <p>After upgrading to Xcode 8 and converting all my code to Swift 3, I have troubles compiling swift resources. It takes a very long time, and my computer gets super laggy and after about 30 minutes I get this</p>
<p>CompileSwift normal arm64 /Users/choojayson/Dropbox/BottomsUp/Thirst/UserDrank.swift
cd /Users/choojayson/Dropbox/BottomsUp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/choojayson/Dropbox/BottomsUp/Thirst/PendingVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/NotificationCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ProfileCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/NotificationsVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/UserPendingAction.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ChooseDrinkVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/AppDelegate.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/UserCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/FirebaseReferences.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ProfileStatsCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/UserDrankTime.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/MyProfileVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ProfileStatsFooterCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/WeeklyDrank.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/DrinkList.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/DrinkCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/User.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/HeaderCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/EndorseVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/GlobalScore.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/Username.swift /Users/choojayson/Dropbox/BottomsUp/HomeVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/LoginVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/LeaderBoardVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/CollectionViewHeaderCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/Global.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/CircularTransition.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/Drink.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/WeeklyBestVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/DrinkStatus.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/LeaderBoardCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/PendingCell.swift -primary-file /Users/choojayson/Dropbox/BottomsUp/Thirst/UserDrank.swift -target arm64-apple-ios8.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk -I /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos -F /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos -F /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos/SDWebImage -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseAnalytics/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseAuth/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseDatabase/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseInstanceID/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseMessaging/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseStorage/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleIPhoneUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleInterchangeUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleNetworkingUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleParsingUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleSymbolUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp -enable-testing -g -module-cache-path /Users/choojayson/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-generated-files.hmap -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-own-target-headers.hmap -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-project-headers.hmap -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos/include -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Firebase/Analytics/Sources -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/Firebase -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseAnalytics -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseAuth -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseDatabase -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseInstanceID -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseMessaging -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseStorage -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleIPhoneUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleInterchangeUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleNetworkingUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleParsingUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleSymbolUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleUtilities -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/DerivedSources/arm64 -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/choojayson/Dropbox/BottomsUp -emit-module-doc-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank~partial.swiftdoc -Onone -module-name Thirst -emit-module-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank~partial.swiftmodule -serialize-diagnostics-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.dia -emit-dependencies-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.d -emit-reference-dependencies-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.swiftdeps -o /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.o -embed-bitcode-marker</p>
| <ios><swift><xcode> | 2016-09-22 07:35:22 | HQ |
39,633,131 | SQL convert date to string in custom format | I need to SELECT a date field but export it as STRING. Not date formatted in a specific way but pure STRING. for example if I have a date 06-May-2016 I need it to be exported as "06.2016". I tried something like:
SELECT convert ( "Application_Date", 'MM.YYYY')
but that's just rubbish. It seems like a simple issue but I've been searching for an answer for sometime now and nothing. | <sql> | 2016-09-22 07:43:30 | LQ_EDIT |
39,633,313 | Got an error when trying to get the geolocation in safari on iOS 10 | <p>[blocked] Access to geolocation was blocked over insecure connection to <a href="http://www.hnsjb.cn" rel="noreferrer">http://www.hnsjb.cn</a>.</p>
<p>Should I change my website to the https protocol?</p>
| <geolocation><ios10> | 2016-09-22 07:53:02 | HQ |
39,633,623 | Linux: how do i add few seconds to an old times temp bash? | for example :, i have tile as veritable like: tt="Thu 09/22/2016 11:03:55 AM" and i need to add few seconds to this time stamp in bash
current status :Thu 09/22/2016 11:03:55
requested status: Thu 09/22/2016 11:04:02 + var
in this case the var will be 7 seconds
thanks for your comments .
| <bash> | 2016-09-22 08:10:48 | LQ_EDIT |
39,634,047 | Date() javascript string inserted in DB showed in a pretty way | <p>Is there any way to print a date string stored in db with this format:
2016-09-13T18:18:08.518Z
into a pretty way like this: 13 September 2016
thanks!!</p>
| <javascript><angularjs> | 2016-09-22 08:33:35 | LQ_CLOSE |
39,634,166 | After update Mac OS Sierra, Can not use ssh login remote system,how can I fix this? | <p>when I use <code>user@ip</code> to login remote system, it report like this:</p>
<pre><code>debug1: /etc/ssh/ssh_config line 17: Applying options for *
/etc/ssh/ssh_config: line 20: Bad configuration option: gssapikeyexchange
/etc/ssh/ssh_config: line 21: Bad configuration option: gssapitrustdns
/etc/ssh/ssh_config: terminating, 2 bad configuration options
</code></pre>
| <macos><ssh> | 2016-09-22 08:39:28 | HQ |
39,634,833 | I want to develop browser app but i am getting errors help me please | Hi I am new to android i want to develop a browser app now i am trying to develop it in this i am getting errors. i tried in another method also on that it's asking on which browser you have to open like that but for me i want to open in my app only please help me any one thanks stack over flow .
#WebviewActivity.java
package com.example.admin.fristapp;
import android.app.Activity;
import android.os.AsyncTask;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebResourceRequest;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class WebviewActivity extends Activity {
WebView webview1;
// String url = "http://www.google.com";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_webview);
webview1 = (WebView) findViewById(R.id.webview1);
// webview1.loadUrl(url);
//MyBrowser my ;
new Background().execute();
}
public class MyBrowser extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
}
public class Background extends AsyncTask<String,String,String>
{
@Override
protected void onPostExecute(String s)
{
super.onPostExecute(s);
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
}
@Override
protected String doInBackground(String... strings)
{
search();
return null;
}
}
public void search()
{
webview1.setWebViewClient(new WebviewActivity.MyBrowser());
String url = "http://www.google.com";
webview1.getSettings().setJavaScriptEnabled(true);
webview1.loadUrl(url);
}
}
#logcat
java.lang.Throwable: A WebView method was called on thread 'AsyncTask #4'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {180a245b} called on null, FYI main Looper is Looper (main, tid 1) {180a245b})
at android.webkit.WebView.checkThread(WebView.java:2290)
| <android><android-asynctask><android-webview> | 2016-09-22 09:10:11 | LQ_EDIT |
39,634,954 | nvm uninstall doesn't actually uninstall the node version | <p>So I'm trying to clear out older versions of node.js.</p>
<p>I start with:</p>
<pre><code>$ nvm ls
v0.10.30
v4.2.3
-> v6.6.0
system
</code></pre>
<p>I don't want the older versions, so I then do:</p>
<pre><code>$ nvm uninstall 4.2.3
Uninstalled node v4.2.3
</code></pre>
<p>I then verify that it's done what I wanted, but it gives the <em>same</em> list of installed versions as before:</p>
<pre><code>$ nvm ls
v0.10.30
v4.2.3
-> v6.6.0
system
</code></pre>
<p>Specifically, <code>v4.2.3</code> is still there.</p>
<p>Any ideas what I might be doing wrong? Any other way to force the uninstall? I'm using the Cloud 9 IDE.</p>
| <node.js><nvm> | 2016-09-22 09:16:33 | HQ |
39,635,755 | what is the $row variable in php? and whats the duty of $row variable in php? | function getCats() {
global $con;
$get_cats = "select * from categories"; //select from database
$run_cats = mysqli_query($con, $get_cats); //
while($row_cats = mysqli_fetch_array($run_cats)) {
$cat_id = $row_cats['cat_id'];
$cat_title = $row_cats['cat_title'];
echo"<li><a href='#'>$cat_title</a></li>";
}
} | <php><mysqli> | 2016-09-22 09:50:21 | LQ_EDIT |
39,635,861 | Unable to contact local DTServiceHub to bless simulator connection | <p>When I run my basic Xcode project in simulator, I got the below issue:-</p>
<blockquote>
<p>Failed to initiate service connection to simulator. </p>
<p>Unable to contact local DTServiceHub to bless simulator connection</p>
</blockquote>
<p>Xcode 8.0</p>
<p>OS 10.11.6</p>
<p>SWIFT 3</p>
<p><a href="https://i.stack.imgur.com/N0nIp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N0nIp.png" alt="enter image description here"></a></p>
| <ios><xcode8> | 2016-09-22 09:54:23 | HQ |
39,637,588 | C# How to add a property setter in derived class? | <p>I have a requirement where I have a number of classes all derived from a single base class. The base class contains lists of child classes also derived from the same base class.</p>
<p>All classes need to be able to obtain specific values which may be obtained from the class itself -OR- it's parent depending on what the derived class is.</p>
<p>I looked at using Methods rather than properties however I also want to make the values available to a .NET reporting component which directly accesses exposed public properties in the reporting engine so this excludes the use of methods.</p>
<p>My question is what would be the 'best practices' method of implementing a setter in DerivedClass without having a publicly available setter in BaseClass</p>
<pre><code>public class BaseClass
{
private BaseClass _Parent;
public virtual decimal Result
{
get { return ((_Parent != null) ? _Parent.Result : -1); }
}
}
public class DerivedClass : BaseClass
{
private decimal _Result;
public override decimal Result
{
get { return _Result; }
// I can't use a setter here because there is no set method in the base class so this throws a build error
//set { _Result = value; }
}
}
</code></pre>
<p>I can't add a protected setter (as follows) in BaseClass as I cannot change access modifiers in DerivedClass.</p>
<pre><code>public class BaseClass
{
private BaseClass _Parent;
public virtual decimal Result {
get { return ((_Parent != null) ? _Parent.Result : -1); }
protected set { }
}
}
public class DerivedClass : BaseClass
{
private decimal _Result;
public override decimal Result
{
get { return _Result; }
// This setter throws a build error because of a change of access modifiers.
//set { _Result = value; }
}
}
</code></pre>
<p>I don't want to add a member variable in BaseClass with a setter as I do not want the ability to set the property from the BaseClass or other classes that derive from base.</p>
<pre><code>public class BaseClass
{
private BaseClass _Parent;
protected Decimal _Result; // This could result in a lot of unnecessary members in BaseClass.
public virtual decimal Result {
get { return _Result; }
// Empty setter ahead :) This does nothing.
// I could also throw an exception here but then issues would not be found until runtime
// and could cause confusion in the future with new developers etc.
set { }
}
}
public class DerivedClass : BaseClass
{
public override decimal Result
{
get { return base.Result; }
set { base._Result = value; }
}
}
</code></pre>
<p>Other suggestions ?</p>
| <c#><inheritance> | 2016-09-22 11:19:19 | HQ |
39,637,675 | What is the difference between @types.coroutine and @asyncio.coroutine decorators? | <p>Documentations say:</p>
<blockquote>
<p>@asyncio.coroutine</p>
<p>Decorator to mark generator-based coroutines. This enables the generator use yield from to call async def coroutines, and also
enables the generator to be called by async def coroutines, for
instance using an await expression.</p>
</blockquote>
<p>_</p>
<blockquote>
<p>@types.coroutine(gen_func) </p>
<p>This function transforms a generator
function into a coroutine function which returns a generator-based
coroutine. The generator-based coroutine is still a generator
iterator, but is also considered to be a coroutine object and is
awaitable. However, it may not necessarily implement the <code>__await__()</code>
method.</p>
</blockquote>
<p>So is seems like purposes is the same - to flag a generator as a coroutine (what <code>async def</code>in Python3.5 and higher does with some features).</p>
<p>When need to use <code>asyncio.coroutine</code> when need to use <code>types.coroutine</code>, what is the diffrence?</p>
| <python><asynchronous><python-3.5> | 2016-09-22 11:23:13 | HQ |
39,638,042 | simulate for onClick not working in enzyme | <p>This is a cancel button</p>
<pre><code><div className="cancelFileBtn" onClick={this.props.cancelFileSending}>
</code></pre>
<p>I need to simulate its click,I tried the following test </p>
<pre><code>wrapper.find('.cancelFileBtn').simulate('click');
</code></pre>
<p>But the click function is still undefined...Did I miss anything else?
and it will be very helpful if anyone can mention any changes if exist in simulating</p>
<pre><code><SendMessageButton onClick={this.props.handleClickSendMessage} loadingFile={this.props.loadingFile}/>
</code></pre>
| <reactjs><mocha><chai><enzyme> | 2016-09-22 11:41:27 | HQ |
39,638,329 | Remove last value in an array elements | <?php
$values = "aaa,bbb,ccc,ddd,";//Remove last comma
$values = "aaa,bbb,,,";//Remove all commas before bbb like aaa,bbb
?>
How to remove commas in this example | <php> | 2016-09-22 11:53:47 | LQ_EDIT |
39,638,525 | function openDialog() set width and set height Google Spreadsheete | i need set width in this dialog
[enter image description here][1]
[1]: http://i.stack.imgur.com/iXskO.png
the code it's:
// Use this code for Google Docs, Forms, or new Sheets.
function onOpen() {
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.createMenu('Cadastro')
.addItem('Open', 'openDialog')
.addToUi();
}
function openDialog() {
var html = HtmlService.createHtmlOutputFromFile('index');
SpreadsheetApp.getUi() // Or DocumentApp or FormApp.
.showModalDialog(html, 'Dialog title');
}`enter code here`
| <javascript><html><css><google-apps-script><google-sheets> | 2016-09-22 12:02:19 | LQ_EDIT |
39,638,718 | After mac os sierra update facing scrolling issue with Java applications like Intellij | <p>After the recent update, Mac os Sierra, to my Macbook pro, I'm facing scrolling issues with all Java applications like Intellij IDEA community edition.</p>
<p>The scrolling in the editor panes are extremely fast. The unit of
scroll increments seem to be large.</p>
<p>Intellij IDEA Version is 2016.2.3.
Java version is Java 8 Update 10.1.</p>
<p>I see the same behavior even in the "System Preference" -> "Java" -> "Advanced" tab .</p>
| <swing><intellij-idea><java-8><jscrollpane><macos-sierra> | 2016-09-22 12:11:27 | HQ |
39,638,751 | Swift 3: Can not convert value of type 'int' to expected argument type 'DispatchQueue.GlobalQueuePriority' | <p><strong>Swift 3.0:</strong> Receiving error <code>Can not convert value of type 'int' to expected argument type 'DispatchQueue.GlobalQueuePriority'</code> on creating dispatch async queue </p>
<pre><code>DispatchQueue.global(priority: 0).async(execute: { () -> Void in
})
</code></pre>
| <ios><iphone><swift><swift2><swift3> | 2016-09-22 12:12:58 | HQ |
39,640,405 | want to get the php executable result? | I have two files name test.txt that will contains the template code i need to evalute this template according to the php..I tried to evalute it using php eval() function but cant get the result ...thanks in advance
test.txt
@$firmware_path=true;
@$DIALPLAN=1312321;
@$MAX_LINES=3;
@$data=array();
@$OPERATOR_IP='';
@$enabled=true;
@ if ($firmware_path)
@{
firmware server: http://{$OPERATOR_IP}{$firmware_path}
@ }
@ for ($i = 1; $i <= $MAX_LINES; $i++)
@ {
@ $enabled = isset($LINES[$i - 1]);
@ if ($enabled)
@{
@ $data = $LINES[$i -1];
@ if ($data['USER_FULLNAME'])
@{
@ if ($PHONE_LABEL)
@{
@ $screenName = $data['USER_FULLNAME'] . ' ' . $data['TELNUM'];
@ $screenName2 = $PHONE_LABEL;
@ }
@else
@{
@ $screenName = $data['USER_FULLNAME'];
@ $screenName2 = $data['TELNUM'];
@ }
@ }
@else
@{
@ $screenName = $data['TELNUM'];
@ $screenName2 = $PHONE_LABEL;
@ }
@ }
@ }
index.php
<?php
$file = fopen("test.txt","r");
$arr=array();
while(! feof($file))
{
$arr[]=fgets($file);
}
$format='';
foreach($arr as $key=>$value)
{
if(substr(ltrim($value), 0, 1) === '@')
{
$result=str_replace('@','',$value);
$format.=$result.PHP_EOL;
}
else
{
$format.='$final="'.$value.'";';
}
}
$format.=' return $final;';
echo eval($format);
?>
the result should be generated according to php | <php><eval><templating> | 2016-09-22 13:27:17 | LQ_EDIT |
39,641,097 | Concantenate two string and convert to datetime pandas python | I am using latest version of pandas and python 3.5
I have a CSV file with two columns DATE and TIME both are string
DATE: 07Jan2015
TIME: 0:00:00
I need to concatenate DATE and TIME and convert the result to datetime or timestamp but the DATE must be in following format
DATE FORMAT: 01/07/2015
So the result should look like this: 01/07/2015 0:00:00
I am using pandas to import the CSV
Your help is always appreciated
Thanks | <python-3.x><date><csv><datetime><pandas> | 2016-09-22 13:56:10 | LQ_EDIT |
39,641,305 | How can i increase the performance of this function | how can i increase the performance of following function in `phalcon` framework.there are thousands of records in the table. i have trying to make different ways but i am stuck the point. how can i increase the efficiency and reduce the execution time. kindly guide me. thanks following are two methods. kindly review both and give me best tips and techniques.
public function currentmonthAction()
{
$payload = $this->request->getJsonRawBody();
$this->setDB();
$ticketsmodel = new Tickets();
$fromcitycondition = "";
if( isset($payload->city->id) )
{
$fromcitycondition = "and fromcity='{$payload->city->id}'";
}
try{
$date = new \Datetime($payload->date);
$year = $date->format('Y');
$month = $date->format('m');
$month = '08';
$daysInMonth = cal_days_in_month(CAL_GREGORIAN, $month, $year);
/* result for all cities passenger */
$result = array();
// get all cities permutations
$tmpcitiesdata = array();
$rawresultset = Tickets::find (
array(
'columns' => 'fromcity,tocity',
'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (1) ". $fromcitycondition,
'group' => 'fromcity,tocity'
));
foreach ($rawresultset as $rawresult) {
$tmpcitiesdata[$rawresult->fromcity.'-'.$rawresult->tocity]['fromcity'] = $rawresult->fromcity;
$tmpcitiesdata[$rawresult->fromcity.'-'.$rawresult->tocity]['tocity'] = $rawresult->tocity;
}
//var_dump($rawresultset);
// get tickets sold based on cities combinations
$total = 0;
foreach ($tmpcitiesdata as $tmpcities) {
$rawresultset = Tickets::find (
array(
'columns' => 'customer',
'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (1) and fromcity=". $tmpcities['fromcity']." and tocity=".$tmpcities['tocity'],
'group' => 'customer'
));
$totalsoldRaw = count($rawresultset);
// get ticket cancellations
$rawresultset = Tickets::find (
array(
'conditions' => "departure between '{$year}-{$month}-01' and '{$year}-{$month}-$daysInMonth' and tickettype in (3) and fromcity=". $tmpcities['fromcity']." and tocity=".$tmpcities['tocity']
));
//make sure cancellations are tickets cancellations not booking cancellations
foreach($rawresultset as $rawresult)
{
$resultNumber = Tickets::find("departure='$rawresult->departure' and seatno={$rawresult->seatno} and id < {$rawresult->id} and tickettype = 1" );
if( count($resultNumber) > 0 ){
$totalsoldRaw = $totalsoldRaw-1;
}
}
$total += $totalsoldRaw;
array_push($result, array('total' => $totalsoldRaw, 'fromcity' => Cities::findFirstById($tmpcities['fromcity'])->name, 'tocity' => Cities::findFirstById($tmpcities['tocity'])->name));
}
//sort result based on counts
arsort($result);
//cut result to max 6 cities
$result = array_slice($result, 0, 6);
$this->response->setContentType('application/json')
->setJsonContent(
array( 'totaltickets' => $total, "allcities" => $result )
);
$this->response->send();
return;
}
catch(\PDOException $e)
{
$this->response->setStatusCode('422','Invalid Payload');
$this->response->setContentType('application/json')
->setJsonContent(array(
'flash' => array(
'class' => 'danger',
'message' => $e->getMessage()
)
));
$this->response->send();
return;
}
}
| <php><performance><phalcon> | 2016-09-22 14:04:30 | LQ_EDIT |
39,641,771 | Very basic javascript problm :( | I have been designing webpages using html and css for about 6 months now, For the past week, I started diving into php, mysql, javascript etc... Although I now a lot about these languages now "such as arrays and functions", I'm having a basic problem to getting this javascript to run, here is the issue
_______________________________________________________________________________
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<input type="submit" value="submit" onclick="click()"/>
<script>
function click() {
alert ("hey");
}
</script>`
</body>
</html>
__________________________________________________-
Why is it not running??? :( | <javascript><html> | 2016-09-22 14:25:10 | LQ_EDIT |
39,642,322 | Why does developer tools have a different server response time to a profiler? | I have enabled a PHP profiler, well magento, but it is still a profiler.
The results show pretty decent server response times, but on the chrome developer tools the time is much higher.
Profiler:
[![magento-profiler-server-response][1]][1]
Developer tools:
[![TTFB-chrome-developer-tools][2]][2]
[1]: http://i.stack.imgur.com/13kag.png
[2]: http://i.stack.imgur.com/ltfPC.png | <php><magento><server-response> | 2016-09-22 14:49:59 | LQ_EDIT |
39,642,480 | XCode 3 Error - Type Any has no subscript members | I recently converted to Xcode3 and these errors have popped up. I have no clue what it means by "Type 'Any' has no subscript members". I have tried to change [String: AnyObject] to other types but it has not worked. Any help is appreciated![![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/XDKRp.png | <xcode><swift3> | 2016-09-22 14:58:09 | LQ_EDIT |
39,642,772 | Unable to create a constant value of type 'System.Char' | <p>I'm getting the following error trying to group and sum some values via LINQ in EF6:</p>
<blockquote>
<p>Unable to create a constant value of type 'System.Char'. Only primitive types or enumeration types are supported in this context.</p>
</blockquote>
<p>I've looked at half a dozen similar questions on StackOverflow and can't find my issue. Here's the query:</p>
<pre><code>var q = from c in _context.HoursProviderCosts
where c.PatientInsuranceCompanyName == insuranceName
&& c.HoursDate >= startDate
&& c.HoursDate <= endDate
group c by new { c.ID, c.PatientFirstName, c.PatientLastName } into g
select new Models.InsuranceCostListItem
{
PatientID = g.Key.ID,
PatientName = g.Key.PatientFirstName + ' ' + g.Key.PatientLastName,
Total = g.Sum(x => x.ProviderRate)
};
return q.ToList();
</code></pre>
<p>Is it something in my grouping (which I'm new to)? The underlying EF6 model is fine (I can expand the results view of <code>_context.HoursProviderCosts</code> and look at the data just fine).</p>
<p>Thanks</p>
<p>Edit: method signature:</p>
<pre><code>public List<Models.InsuranceCostListItem> InsuranceCostsListItems(DateTime periodStart, string insuranceName) {
</code></pre>
| <c#><linq> | 2016-09-22 15:11:30 | HQ |
39,643,257 | Prevent duplicate objects in classes/instance access with singleton | <p>The use is to provide .instance access, also to prevent duplicate objects of those classes.</p>
<p>Is this a good code implementation of a singleton?</p>
<pre><code>template <typename T> class singleton
{
public:
static T *ms_singleton;
singleton()
{
assert(!ms_singleton);
long offset = (long)(T *) 1 - (long)(singleton <T> *)(T *) 1;
ms_singleton = (T *)((long) this + offset);
}
virtual ~singleton()
{
assert(ms_singleton);
ms_singleton = 0;
}
static T &instance()
{
assert(ms_singleton);
return (*ms_singleton);
}
static T &Instance()
{
assert(ms_singleton);
return (*ms_singleton);
}
static T *instance_ptr()
{
return (ms_singleton);
}
};
template <typename T> T *singleton <T>::ms_singleton = NULL;
</code></pre>
<p>How I use it:</p>
<pre><code>class test1: public singleton<test2>
{
// Something
};
</code></pre>
<p>If not, what is wrong here? What should i rewrite here?</p>
| <c++><singleton> | 2016-09-22 15:34:36 | LQ_CLOSE |
39,643,454 | Postgres: check if array field contains value? | <p>I'm sure this is a duplicate question in the sense that the answer is out there somewhere, but I haven't been able to find the answer after Googling for 10 minutes, so I'd appeal to the editors not to close it on the basis that it might well be useful for other people. </p>
<p>I'm using Postgres 9.5. This is my table:</p>
<pre><code> Column β Type β Modifiers
ββββββββββββββββββββββββββΌββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
id β integer β not null default nextval('mytable_id_seq'::regclass)
pmid β character varying(200) β
pub_types β character varying(2000)[] β not null
</code></pre>
<p>I want to find all the rows with "Journal" in <code>pub_types</code>.</p>
<p>I've found the docs and googled and this is what I've tried:</p>
<pre><code>select * from mytable where ("Journal") IN pub_types;
select * from mytable where "Journal" IN pub_types;
select * from mytable where pub_types=ANY("Journal");
select * from mytable where pub_types IN ("Journal");
select * from mytable where where pub_types contains "Journal";
</code></pre>
<p>I've scanned <a href="https://www.postgresql.org/docs/9.1/static/arrays.html" rel="noreferrer">the postgres array docs</a> but can't see a simple example of how to run a query, and StackOverflow questions all seem to be based around more complicated examples. </p>
| <postgresql> | 2016-09-22 15:45:00 | HQ |
39,643,507 | Convert Graphql to SQL? | <p>We have existing SQL Server database and we are using C#. Lets say our mobile client send a graphql to server. How can I convert this SQL, so that my client get the data what he expect?</p>
| <c#><sql-server><graphql> | 2016-09-22 15:47:37 | HQ |
39,643,850 | unicode character color issue | <p>Can't change color on the following characters:</p>
<pre><code><div style="font-size: 25px; color:red;">&#128269;</div>
<div style="font-size: 25px; color:red;">&#128227;</div>
</code></pre>
<p>while some other unicode chars accept color property:</p>
<pre><code><div style="font-size: 25px; color:red;">&#9881;</div>
</code></pre>
<p>Is there any way to change color on the previous chars?</p>
<p><a href="https://jsfiddle.net/cs5053ka/" rel="noreferrer">https://jsfiddle.net/cs5053ka/</a></p>
| <css><unicode> | 2016-09-22 16:03:56 | HQ |
39,644,366 | git clone with different username/account | <p>This is a stupid question, but I've looked it up for ages, and I can't find anything, so I have to ask it.</p>
<p>How do you <code>clone</code> something on <code>git</code> with a different account?</p>
<p>e.g if I am logged in to <code>abcdef</code>, and I want to clone something on the account <code>12345</code>, how do I do so?</p>
<p>I remember doing this before like this: <code>git clone url -l username</code>.
Then it would ask me for a <code>password</code> and I would type it in.
But this either does not work anymore, or my brain is messing with me!</p>
<p>Thanks for the help.</p>
| <git><clone> | 2016-09-22 16:31:42 | HQ |
39,644,467 | how to plot a scatter plot(month vs area) | I have the data below and am trying to plot a scatter plot for month VS Area.
Month Area
feb 13.05
oct 13.7
mar 13.99
sep 14.57
aug 15.45
sep 17.2
sep 19.23
sep 23.41
oct 24.23
aug 26
sep 26.13
mar 27.35
when i plot the scatter plot, the plot is something like the attached image. what i am trying to do is to plot the x axis in chronological order(Jan-December) in order. I tried using ggplot2, but i was not able to do so. if someone could please help me it would be great.[Area VS Month][1]
[1]: http://i.stack.imgur.com/sCEa4.png | <r><ggplot2><scatter> | 2016-09-22 16:37:08 | LQ_EDIT |
39,644,544 | Can I generate script of a migration with EF code first and .net core | <p>I'm building a MVC application with .Net Core and I need to generate the script of a migration.</p>
<p>With EF6 I did run the command </p>
<pre><code>update-database -script
</code></pre>
<p>but when I try to do the same with .net Core is throwing the next exception:</p>
<blockquote>
<p>Update-Database : A parameter cannot be found that matches parameter
name 'script'</p>
</blockquote>
<p>Do you know if there is an equivalent for EF7?</p>
| <.net><entity-framework><asp.net-core><asp.net-core-mvc><entity-framework-core> | 2016-09-22 16:41:15 | HQ |
39,644,646 | Running validations when using `update_all` | <p>According to the Rails docs <a href="http://guides.rubyonrails.org/active_record_validations.html#skipping-validations" rel="noreferrer">here</a> and <a href="http://apidock.com/rails/ActiveRecord/Relation/update_all" rel="noreferrer">here</a>, using <code>update_all</code> does not do the following -</p>
<ul>
<li>It skips validations</li>
<li>It does not update the <code>updated_at</code> field</li>
<li>It silently ignores the <code>:limit</code> and <code>:order</code> methods</li>
</ul>
<p>I'm trying to go through my code base and remove instances of <code>update_all</code>, particularly because of the first point.</p>
<p>Is there a way to still have the convenience of <code>update_all</code> and still run validations? I understand that I can loop through each record and save it, but that's not only messier visually but also more more inefficient because it executes N SQL statements instead of 1</p>
<pre><code># before
User.where(status: "active").update_all(status: "inactive")
# after
User.where(status: "active").each { |u| u.update(status: "inactive") }
</code></pre>
<p>Thanks!</p>
<p><strong>Edit:</strong> I'm using Rails 4.2</p>
| <ruby-on-rails><validation><activerecord> | 2016-09-22 16:46:53 | HQ |
39,645,141 | WebSocket server does not work with SSL | <p>I have a working chat application using websockets. I want to go one step further and enable encryption on my connections, however when I switch up the http server with a https one my connections start failing.</p>
<p>I have generated a self-signed certificate that I use on all of my websites (under the same TLD, which implies it is a wildcard certificate). I can confirm it is a valid certificate, so the problem should not be there.</p>
<p>This is what works (unencrypted)</p>
<pre><code>var webSocketServer = require('websocket').server;
var http = require('http');
var server = http.createServer(function() {});
server.listen(webSocketsServerPort, function () {
log("system", "Server is listening on port " + webSocketsServerPort);
});
var wsServer = new webSocketServer({
httpServer: server
});
</code></pre>
<p>Using this I can now connect to <code>ws://my.domain:port</code>. </p>
<p>This is what does <strong>not</strong> work</p>
<pre><code>var webSocketServer = require('websocket').server;
var http = require('https');
var fs = require('fs');
var server = http.createServer({
key: fs.readFileSync("path/to/host.key"),
cert: fs.readFileSync("path/to/host.pem")
});
server.listen(webSocketsServerPort, function () {
log("system", "Server is listening on port " + webSocketsServerPort);
});
var wsServer = new webSocketServer({
httpServer: server
});
</code></pre>
<p>With this code the server starts as well, I see the log message "Server is listening.." but when I try to connect at <code>wss://my.domain:port</code> the connection can not be established.</p>
<p>I have added an exception in my browser for the certificate because my client page and websocket server address are under the same tld and sub-domain.</p>
<p>What could be the problem?</p>
| <node.js><http><ssl><websocket> | 2016-09-22 17:17:16 | HQ |
39,645,201 | Android - DatePickerDialog - Old APIs | <p>I am trying to create a <code>DatePickerDialog</code> in my app in Android but when I create a <code>DatePickerDialog</code> I receive the following message: <code>Call requires API level 24 (current min is 14): android.app.DatePickerDialog#DatePickerDialog</code></p>
<p>How can I use a <code>DatePickerDialog</code> in old API versions?</p>
| <android><datepickerdialog> | 2016-09-22 17:20:48 | HQ |
39,645,297 | for loop doesn't work for image selector | i'm trying to make a picture selector but the loop doesn't work.
It should make the selected div orange, and turn the other divs white
function ClickPic(id)
{
document.getElementById("pic"+id).style.backgroundColor='orange';
for(var i = 0; i < 310; i++)
{
if(!i == id)
{
document.getElementById("pic"+i).style.backgroundColor='white';
}
}
} | <javascript><html><image><for-loop><select> | 2016-09-22 17:26:43 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.