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,868,975
Concept of vptr and vtable in C++
<p>Why only default constructor only able to create vptr(Virtual Table Pointer) and vtable(Virtual Table)? Why parameter constructor not able to</p>
<c++><default-constructor><vtable><vptr>
2016-10-05 08:29:37
LQ_CLOSE
39,869,129
Laravel JWT Auth get user on Login
<p>Is it possible with <a href="https://github.com/tymondesigns/jwt-auth" rel="noreferrer">https://github.com/tymondesigns/jwt-auth</a> to get the <code>current user</code>? Because right now I can only generate a token (when a user sign in). </p> <pre><code>public function login(Request $request) { $credentials = $request-&gt;only('email', 'password'); try { if (! $token = JWTAuth::attempt($credentials)) { return response()-&gt;json(['error' =&gt; 'invalid_credentials'], 401); } } catch (Tymon\JWTAuth\Exceptions\JWTException $e) { return response()-&gt;json(['error' =&gt; 'could_not_create_token'], 500); } return response()-&gt;json(compact('token')); } </code></pre>
<php><laravel-5><jwt>
2016-10-05 08:37:29
HQ
39,869,216
Can I lose "constness" in the return type of an override virtual function?
<p>The following code compiles and runs, and no warning is emitted by either gcc or clang:</p> <pre><code>#include &lt;iostream&gt; struct Base { virtual ~Base() = default; virtual std::string const&amp; get() = 0; }; struct Derived: Base { virtual std::string&amp; get() override { return m; } std::string m; }; int main() { Derived d; d.get() = "Hello, World"; Base&amp; b = d; std::cout &lt;&lt; b.get() &lt;&lt; "\n"; } </code></pre> <p>Is <code>std::string&amp;</code> covariant with <code>std::string const&amp;</code> then?</p>
<c++>
2016-10-05 08:41:44
HQ
39,869,739
Modify existing Excel File using node.js
<p>Is there any way to modify existing excel file in node.js? I've looked into exceljs but it does not provide any functionality that will just modify the existing data. It seems like it will write to a new stream.</p> <p>Or did I miss something on exceljs?</p> <p>Thanks in advance.</p>
<node.js><exceljs>
2016-10-05 09:06:31
HQ
39,869,853
how to apply floating lable to edit text in android in java file instead of xml
I want to know is there any way we can apply floating lable for edit text using java instead of xml. If yes please tell me the way how to do the same.
<android><material-design>
2016-10-05 09:11:27
LQ_EDIT
39,870,183
How to refresh/reload an activity in android without losing the data in that activity
I am developing an android application i which i want to refresh the current activity without losing the data but when i use the following code the activity gets restarted but the selected values in edittext gets lost.So can anyone tell me how to refresh the current activity without losing data in that activity. Intent i=getIntent(); finish(); startActivity(i);
<android><gridview>
2016-10-05 09:25:53
LQ_EDIT
39,871,250
AWS Application Load Balancer transforms all headers to lower case
<p>I've a REST API application running in two EC2 instance and was using AWS Classic Load Balancer for a long time. The clients of REST API rely on the response headers (e.g. such as <code>Location</code>). </p> <p>I know that HTTP headers are case-insensitive by definition, however (unfortunately) some clients are ignoring this and checking the headers in a case-sensitive way (e.g. they expect <code>Location</code> to start with upper case).</p> <p>Recently I've changed to AWS Application Load Balancer and now I see that it transforms all response headers to lower case, as a result clients are failing to handle the response properly.</p> <p>I've couple of questions here.</p> <ol> <li>Is it expected behavior of Application Load Balancer?</li> <li>Is there a way to configure it to return headers as they have been built by the application?</li> </ol>
<amazon-web-services><amazon-ec2><http-headers><amazon-elb>
2016-10-05 10:14:32
HQ
39,871,345
How can I check a column in oracle which is black and datatype is NUMBER
I have a table which name is HARDWARE_ISSUE . it has two column div_code and branch code . Datatype of div_code is NUMBER and branch_code is varchar2. I want to select branch_code when the value of div_code is blank. My query is below: select (case when div_code= null then to_char(branch_code) else to_char(div_code) end) as brordiv from HARDWARE_ISSUE But It could not select branch_code when div_code is empty. I also run the query below: select * from HARDWARE_ISSUE where div_code= null It also not produce any row. but there 15 rows which contain empty div_code. I am using oracle 11g. Please help me.
<oracle>
2016-10-05 10:18:54
LQ_EDIT
39,871,376
"No component factory found for" Error When trying to push from one Page to another
<p>I get an error when trying to push from one page to another. When I try to push to same page, it won't give that error. Only i get error when pushing from one page to another. 'setRoot()' also not giving an error. </p> <pre><code>this.navCtrl.push( Page7 ); </code></pre> <p>I have added the Page7 to app.module.ts.</p> <pre><code>import { NgModule } from '@angular/core'; import { IonicApp, IonicModule } from 'ionic-angular'; import { MyApp } from './app.component'; import { Page1 } from '../pages/page1/page1'; import { Page2 } from '../pages/page2/page2'; import { Page3 } from '../pages/page3/page3'; import { Page4 } from '../pages/page4/page4'; import { Page5 } from '../pages/page5/page5'; import { Page6 } from '../pages/page6/page6'; import { Page7 } from '../pages/page7/page7'; @NgModule({ declarations: [ MyApp, Page1, Page2, Page3, Page4, Page5, Page6, Page7 ], imports: [ IonicModule.forRoot(MyApp) ], bootstrap: [IonicApp], entryComponents: [ MyApp, Page1, Page2, Page3, Page4, Page5, Page6, Page7 ], providers: [] }) export class AppModule {} </code></pre> <p>This is a ionic 2 Application. It Gives this error. </p> <pre><code>EXCEPTION: Error in ./Page6 class Page6 - inline template:21:56 caused by: No component factory found for Page7 </code></pre> <p><a href="http://i.stack.imgur.com/QAcQo.png">console error</a></p>
<angular><ionic2>
2016-10-05 10:20:42
HQ
39,871,830
List comprehension variable not defined? (Python)
<p>I have a list of dicts sortd, i want to add the first three dicts in the list to a new list. </p> <p>I tried using a list comp for the first time but when doing:</p> <pre><code>new_dict = [pair for pair[0:3] in sortd] </code></pre> <p>i get the error "pair is not defined", what am i doing wrong here? </p>
<python><list><list-comprehension>
2016-10-05 10:43:06
LQ_CLOSE
39,871,883
systemctl status shows inactive dead
<p>I am trying to write my own (simple) systemd service which does something simple.( Like writing numbers 1 to 10 to a file, using the shell script). My service file looks like below.</p> <pre><code>[Unit] Description=NandaGopal Documentation=https://google.com After=multi-user.target [Service] Type=forking RemainAfterExit=yes ExecStart=/usr/bin/hello.sh &amp; [Install] RequiredBy = multi-user.target </code></pre> <p>This is my shell script.</p> <pre><code>#!/usr/bin/env bash source /etc/profile a=0 while [ $a -lt 10 ] do echo $a &gt;&gt; /var/log//t.txt a=`expr $a + 1` done </code></pre> <p>For some reason, the service doesn't come up and systemctl is showing the below output. </p> <pre><code>root@TARGET:~ &gt;systemctl status -l hello * hello.service - NandaGopal Loaded: loaded (/usr/lib/systemd/system/hello.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: https://google.com </code></pre> <p>Been trying to figure out what went wrong for the last 2 days. Could anyone please help me here?</p> <p>Regards, nandanator</p>
<linux><sh><systemd><systemctl>
2016-10-05 10:45:37
HQ
39,871,939
Free Basics Platform(internet.org)
<p>Free Basics has a policy that you need to disable Javascript code in your website now I have a desktop version website and I want to register it on Free Basics platform should I responsive the same website and disable or hide the Javascript using some Php scripts or css or I have to make a new responsive website with not even a single line of Javascript code? help will be much appreciated thanks </p>
<javascript><php><css><facebook>
2016-10-05 10:48:32
LQ_CLOSE
39,872,179
templates causing Segmentation Fault in c++
there is a problem in the simple code snippet below that i can't uncover even with a debugger. Thanks for your help in advance. Command.h class word{ private : static int next_word; private : int word_id; public : word(); public : void grabIt(); public : void raiseIt(); public : void putItDown(); }; class Command{ public : typedef void(word::*Method)(); private : word* w; private : Method m; public : Command(word *w, Method m); public : void execute(); }; template<typename T> class Queue{ private : enum{ SIZE=9 }; private : T* commandArray[SIZE]; private : int m_added = 0, m_removed = 0; public : void enqueue(T* t){ commandArray[m_added] = t; m_added = (m_added + 1) % SIZE; } public : T* dequeue(){ int temp = m_removed; m_removed = (m_removed + 1) % SIZE; return commandArray[temp]; } }; Command.cpp int word::next_word = 0; word::word(){ this->word_id = next_word++; } void word::grabIt(){ std::cout << "Grabbed it" << std::endl; } void word::raiseIt(){ std::cout << "Raised it" << std::endl; } void word::putItDown(){ std::cout << "Put it down" << std::endl; } Command::Command(word *w, Method m){ w = w; m = m; } void Command::execute(){ (w->*m)(); // -------------->>>>> Causing Seg-Fault } Main.cpp Queue<Command> queue; Command *commandArray[9]; Command command1(new word, &word::grabIt); commandArray[0] = &command1; Command command2(new word, &word::raiseIt); commandArray[1] = &command2; Command command3(new word, &word::putItDown); commandArray[2] = &command3; Command command4(new word, &word::grabIt); commandArray[3] = &command4; Command command5(new word, &word::raiseIt); commandArray[4] = &command5; Command command6(new word, &word::putItDown); commandArray[5] = &command6; Command command7(new word, &word::grabIt); commandArray[6] = &command7; Command command8(new word, &word::raiseIt); commandArray[7] = &command8; Command command9(new word, &word::putItDown); commandArray[8] = &command9; for( int i=0 ; i < 9; i++){ queue.enqueue(commandArray[i]); } for( int i=2 ; i < 6 ; i++){ queue.dequeue()->execute(); } some word objects inside the queue appear NULL in the debugger, so cause Seg-Fault.
<c++><templates>
2016-10-05 11:00:01
LQ_EDIT
39,872,458
I have a pst file as default mail box, i want to copy structure of Pst file to new pst file thru VBA macro
I want to split my default PST file year wise thru VBA macro Such as New Pst File Name may be Year-2015.pst. It should contain the all the mails which are belongs to year 2015 ( all folders ). Regards
<vba><outlook>
2016-10-05 11:14:34
LQ_EDIT
39,872,655
everytime i run my code i get the error. "JSON.typeMismatch(JSON.java:111)". how can I parse a JSON object wrapped with an array? here is my code
> package com.communications.dell.pullbw; > > import android.content.Context; import android.os.AsyncTask; import > android.support.v7.app.AppCompatActivity; import android.os.Bundle; > import android.view.LayoutInflater; import android.view.View; import > android.view.ViewGroup; import android.widget.ArrayAdapter; import > android.widget.ListView; import android.widget.TextView; > > import com.squareup.okhttp.OkHttpClient; import > com.squareup.okhttp.Request; import com.squareup.okhttp.Response; > > import org.json.JSONArray; import org.json.JSONException; import > org.json.JSONObject; > > import java.io.IOException; import java.util.ArrayList; > > public class FeedActivity extends AppCompatActivity implements > OnFeedListener { > > ListView listView; > FeedAdapter adapter; > ArrayList<Post> posts; > > @Override > protected void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.activity_feed); > > listView = (ListView)findViewById(R.id.listView); > > adapter= new FeedAdapter(getApplicationContext(), R.layout.layout_feed_item); > > listView.setAdapter(adapter); > > FeedTask task= new FeedTask(this); > > task.execute("http://www.botswanayouth.com/wp-json/wp/v2/posts"); > } > > @Override > public void onFeed(JSONArray array) > { > posts= new ArrayList<>(); > int length = array.length(); > for (int i = 0; i < length; ++i) > { > JSONObject object = array.optJSONObject(i); > > Post post = new Post(object.optString("title"),object.optString("excerpt"),object.optString("featured_media")); > > posts.add(post); > > } > adapter.addAll(posts); > > } > > public class FeedTask extends AsyncTask<String, Void, JSONArray> > { > private OnFeedListener listener; > public FeedTask(OnFeedListener listener) > { > this.listener= listener; > } > @Override > protected JSONArray doInBackground(String... params) { > > String url = params[0]; > OkHttpClient client= new OkHttpClient(); > Request.Builder builder= new Request.Builder(); > > Request request= builder.url(url).build(); > > try { > Response response= client.newCall(request).execute(); > > String json= response.body().string(); > > try > { > JSONObject object= new JSONObject(json); > JSONArray array = object.optJSONArray("posts"); > > return array; > } > catch (JSONException e) > { > e.printStackTrace(); > } > > } > catch (IOException e) > { > e.printStackTrace(); > } > return null; > } > > @Override > protected void onPostExecute(JSONArray array) { > super.onPostExecute(array); > > if (null== array) > return; > > if (null != listener) > listener.onFeed(array); > } > } > > public class FeedAdapter extends ArrayAdapter<Post> > { > private int resource; > public FeedAdapter(Context context, int resource) > { > super(context, resource); > this.resource=resource; > } > > @Override > public View getView(int position, View convertView, ViewGroup parent) { > > if (null==convertView) > { > LayoutInflater inflater=LayoutInflater.from(getContext()); > convertView=inflater.inflate(resource, null); > } > > Post post = getItem(position); > > TextView title = (TextView) convertView.findViewById(R.id.title); > TextView desc = (TextView) convertView.findViewById(R.id.description); > title.setText(post.title); > desc.setText(post.description); > > return convertView; > } > } > > public class Post{ > public String title; > public String description; > public String thumbnail; //URL > > public Post(String title, String desc, String thumbnail) > { > this.title=title; > this.description=desc; > this.thumbnail=thumbnail; > } > } > > > }
<java><android><json>
2016-10-05 11:23:28
LQ_EDIT
39,873,002
How do you provide the user the choice to try my program once again like after typing yes , the user can use my program once again?
print ("Welcome to my Area Calculator") i=raw_input("Please enter the shape whose Area you want to calculate(square/rectangle/right angled triangle/rhombus/parallelogram): ") my_list=["square","rectangle","triangle","right angled triangle","rhombus","parallelogram"] if i in my_list: if i=="square": s=float(input("What is the side of the square: ")) print "Area of the square is : ", s**2 elif i=="rectangle": l=float(input("What is the length of the rectangle: ")) b=float(input("What is the breadth of the rectangle: ")) print "Area of the rectangle is : ", l*b elif i=="right angled triangle": base1=float(input("What is the base of the triangle: ")) height1=float(input("What is the height of the triangle: ")) print "Area of the triangle is : ", 0.5*base1*height1 elif i=="rhombus": d1=float(input("What is the length of the 1st diagnol of the rhombus: ")) d2=float(input("What is the length of the 2nd diagnol of the rhombus: ")) print "Area of the rhombus is : ", 0.5*d1*d2 elif i=="parallelogram": base=float(input("What is the length of 1 side of the parallelogram: ")) height=float(input("What is the length of the other side: ")) print "Area of the parallelogram is : ", height*base print "Thank you so much for using my area calculator"
<python>
2016-10-05 11:40:24
LQ_EDIT
39,874,737
If it is possible to focus the hidden input field
How to trigger the hidden input field when we click the parent element.When i use the hidden field is not worked. here is my html code: <table> <th colspan="2">Date</th> <td id="dateContainer" > currentData </td> <td><input id="thedate" type="text" type="hidden" /></td> <table> jquery code: $(function(){ $(this).click(function() { $(this).children().children().find('.datepicker-input').focus(); }); });
<jquery><html><jquery-ui><datepicker><html-table>
2016-10-05 13:02:30
LQ_EDIT
39,875,271
How can i validate smtp host in asp.net MVC
public int Smtp_Id{ get; set; } [Display(Name="Mail From")] [Required(ErrorMessage = "Please enter senders mail address.")] [EmailAddress(ErrorMessage = "Invalid Email Address")] public string Smtp_mailfrom { get; set; } [Display(Name = "SMTP Host")] [Required(ErrorMessage = "Please enter host name.")] public string Smtp_Host { get; set; } [Display(Name = "User Name")] [Required(ErrorMessage = "Please enter username.")] [MaxLength(50,ErrorMessage="Username Should not be more than 50 charachters.")] public string Smtp_username { get; set; } [Display(Name = "Password")] [MaxLength(50, ErrorMessage = "Password Should not be more than 50 charachters.")] [Required(ErrorMessage = "Please enter password.")] public string Smtp_password { get; set; } [Display(Name = "SMTP Port")] [Required(ErrorMessage = "Please enter Port.")] public int Smtp_Port { get; set; } i want to validate smtp host and port Please let me know how can i do this? i want to smtp.gmail.com or smtp-mail.outlook.com But now my code is allowing numbers also Please help me buddy
<c#><asp.net><asp.net-mvc>
2016-10-05 13:26:42
LQ_EDIT
39,875,691
Is there a PHP equivalent of JavaScript's Array.prototype.some() function
<p>In JavaScript, we can do:</p> <pre><code>function isBiggerThan10(element, index, array) { return element &gt; 10; } [2, 5, 8, 1, 4].some(isBiggerThan10); // false [12, 5, 8, 1, 4].some(isBiggerThan10); // true </code></pre> <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some" rel="noreferrer">https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some</a></p> <p>Is there a PHP equivalent of the some() function?</p>
<javascript><php><functional-programming>
2016-10-05 13:45:04
HQ
39,875,863
my wordpress css stopped working overnight
hi guys I am having a massive issue with wordpress at the moment.. last night and this morning, my website was working fine. Until earlier on my css stopped working properly. when you hover over some menu a nested under some li, a hover effect with a transition is supposed to happened. That stopped working... my owl carousel when the page load doesn't show up until the scroll function gets activated. I am suspecting that its a problem with my cache, but i even tried using Stackpath CDN to solve that and it didn't change anything. I urgently need help, i got a client complaining at the moment and I am truly lost as to what to do. on the customize menu, the controls for the hover colors dont work for the menu links either this is my website stylehercloset.co.uk and this is my javascript file: jQuery(document).ready(function(){ // owl caroussel jQuery(".owl-carousel").owlCarousel({ items:1, navRewind:true, center:true, autoplay:true, autoplayTimeout:3000 }); /* end of owl caroussel */ // adobe typekit try{ Typekit.load({ async: true }); } catch(e){} // end of typekit jQuery(window).scroll(function(){ if(window.pageYOffset > 394){ jQuery("#access").css({"position":"fixed", "z-index":"2", "left":"0px", "top":"0px", "border":"0px", "border-width":"1px", "border-bottom-style":"solid", "margin-top":"auto" /*"padding-top":"2.5em" */}); } if(window.pageYOffset < 394){ jQuery("#access").css({"position":"initial", "padding":"0px", "border-top":"1px", "border-bottom":"1px", "border-top-style":"solid", "border-bottom-style":"solid", "margin-top":"0.5em" }); } }); // end of scroll function // code for the footer area jQuery("#first,#second,#third,#fourth").addClass("col-xs col-sm-1 col-md-3 col-3"); jQuery("#footer-widget-area").addClass("row"); jQuery("#primary, #secondary").addClass("col-xs col-sm-3"); jQuery(".small-nav i").click(function(){ jQuery("div.menu").slideToggle("slow"); }); }); and this is the relevant css from my style.css: #access .menu ul a:hover { background-color: #40E0D0 !important; } and this is from my functions.php file function customizer_css(){ ?> <style type="text/css"> *h1 { <?php echo get_theme_mod('h1_font'); ?>; } * h2 { <?php echo get_theme_mod('h2_font'); ?>; } *h3 { <?php echo get_theme_mod('h3_font'); ?>; } *h4 { <?php echo get_theme_mod('h4_font'); ?>; } *h5 { <?php echo get_theme_mod('h5_font'); ?>; } * p { <?php echo get_theme_mod('p_font'); ?>; } *a { <?php echo get_theme_mod('a_font'); ?>; } #site-title { <?php echo get_theme_mod('title_position'); ?> font-size:<?php echo get_theme_mod('title_size'); ?>em !important; } #primary a, #secondary a { <?php echo get_theme_mod('widget_a_font'); ?>; } #small-menu, #access, #wrapper,#footer #colophon{ background-color:<?php echo get_theme_mod('website_colour') ?> !important; } #header-bg { background-image: url('<?php echo get_header_image(); ?>'); background-color: <?php echo get_theme_mod('header_colour'); ?> ; background-position: <?php echo get_theme_mod('header_bg_position_x_lg','0%'); ?> <?php echo get_theme_mod('header_bg_position_y_lg','0%'); ?> !important; } #main a, #footer-widget-area a { color: <?php echo get_theme_mod('link_colour'); ?> !important ; } .current_page_item a, #access .menu ul a:hover { background-color: <?php echo get_theme_mod('hover_colour'); ?> !important ; } #access .el:hover { color: <?php echo get_theme_mod('hover_colour'); ?> !important ; } h1#site-title a{ <?php echo get_theme_mod('title_font_style'); ?>; } @media screen and (max-width:767px) { #header-bg { background-position: <?php echo get_theme_mod('header_bg_position_x_xs','0%'); ?> <?php echo get_theme_mod('header_bg_position_y_xs','0%'); ?> !important; } #site-title { <?php echo get_theme_mod('title_position_xs'); ?> font-size:<?php echo get_theme_mod('title_size_xs'); ?>em !important; } } /* end of mobile size */ @media screen and (min-width:768px) and (max-width:991px){ #header-bg { background-position: <?php echo get_theme_mod('header_bg_position_x_sm','0%'); ?> <?php echo get_theme_mod('header_bg_position_y_sm','0%'); ?> !important; } #site-title { <?php echo get_theme_mod('title_position_sm'); ?> font-size:<?php echo get_theme_mod('title_size_sm'); ?>em !important; } } /* end of small*/ @media screen and (min-width:992px) and (max-width:1199px){ #header-bg { background-position: <?php echo get_theme_mod('header_bg_position_x_md','0%'); ?> <?php echo get_theme_mod('header_bg_position_y_md','0%'); ?> !important; } #site-title { <?php echo get_theme_mod('title_position_md'); ?> font-size:<?php echo get_theme_mod('title_size_md'); ?>em !important; } } // end of medium </style> <?php } //add actions add_action('wp_enqueue_scripts','style_n_scripts'); //theme customizer api add_action( 'customize_register', 'customizer_api' ); //theme support add_action('init', 'shc_theme_support'); // theme customizer css add_action( 'wp_head', 'customizer_css');
<php><jquery><html><css><wordpress>
2016-10-05 13:51:41
LQ_EDIT
39,876,416
MultiIndex Slicing requires the index to be fully lexsorted
<p>I have a data frame with index (<code>year</code>, <code>foo</code>), where I would like to select the X largest observations of <code>foo</code> where <code>year == someYear</code>.</p> <p>My approach was </p> <pre><code>df.sort_index(level=[0, 1], ascending=[1, 0], inplace=True) df.loc[pd.IndexSlice[2002, :10], :] </code></pre> <p>but I get</p> <pre><code>KeyError: 'MultiIndex Slicing requires the index to be fully lexsorted tuple len (2), lexsort depth (0)' </code></pre> <p>I tried different variants of sorting (e.g. <code>ascending = [0, 0]</code>), but they all resulted in some sort of error.</p> <p>If I only wanted the <code>xth</code> row, I could <code>df.groupby(level=[0]).nth(x)</code> after sorting, but since I want a set of rows, that doesn't feel quite efficient.</p> <p>What's the best way to select these rows? Some data to play with:</p> <pre><code> rank_int rank year foo 2015 1.381845 2 320 1.234795 2 259 1.148488 199 2 0.866704 2 363 0.738022 2 319 </code></pre>
<python><pandas>
2016-10-05 14:16:22
HQ
39,876,536
How to merge two dataframes in Spark Hadoop?
I am trying to join two dataframes. data: DataFrame[_1: bigint, _2: vector] cluster: DataFrame[cluster: bigint] result = data.join(broadcast(cluster)) The strange thing is, that all the executors are failing on the joining step. I have no idea what I could do. The data file is 2.8 gb on HDFS and the cluster data only 5 mb. The files are read using Parquet.
<python><apache-spark><hadoop><apache-spark-sql><parquet>
2016-10-05 14:21:04
LQ_EDIT
39,877,156
How to extend String Prototype and use it next, in Typescript?
<p>I am extending String prototype chain with a new method but when I try to use it it throws me an error: <code>property 'padZero' does not exist on type 'string'</code>. Could anyone solve this for me?</p> <p>The code is below. You can also see the same error in Typescript Playground.</p> <pre><code>interface NumberConstructor { padZero(length: number); } interface StringConstructor { padZero(length: number): string; } String.padZero = (length: number) =&gt; { var s = this; while (s.length &lt; length) { s = '0' + s; } return s; }; Number.padZero = function (length) { return String(this).padZero(length); } </code></pre>
<typescript>
2016-10-05 14:46:12
HQ
39,877,608
C# paste T model class dynamically as variable
<p>I want to store my model class as a variable and use it in all my code dynamically. For example I have something like this:</p> <pre><code>IEnumerable&lt;Student&gt; students = GetAllStudents(); </code></pre> <p>Normally I must always declare and retype Student class. But I need to declare it only once and after that use it dynamically in my code. Simply I want to do something like this:</p> <pre><code>Student dynamicType; </code></pre> <p>So after that can be possible:</p> <pre><code>IEnumerable&lt;dynamicType&gt; students = GetAllStudents(); </code></pre> <p>Can you help me to find right solution? Is it possible to do something like this? Thank you</p>
<c#><class><dynamic><declare>
2016-10-05 15:04:34
LQ_CLOSE
39,877,649
Switch Statements for Grades Javascript
<p>So I have to get the grade from a prompt then produce an alert box that says something about the grade using switch statements. This is what i have so far but it just tells me back the grade I have given it if i add an alert box at the bottom</p> <pre><code> var grade = prompt("What grade did you get for the assessment?"); switch(grade) { case 0: "A" = ("Excellent"); break; case 1: "B" = "Very Good"; break; case 2: "C" = "Good"; break; case 3: "D" = "Pass"; break; case 4: "E" = "Almost a pass"; break; case 5: "F" = "Fail"; break; default : "Please enter a grade from A-F"; } </code></pre>
<javascript>
2016-10-05 15:06:26
LQ_CLOSE
39,877,678
Filter by method on model in ActiveAdmin with parameters passed in
<p>Using Rails 4.2.1 and Active Admin 1.0.0.pre2</p> <p>I have an Apartment model which has many Occupancies. I want admins to be able to see whether an apartment in index overlaps with dates passed in as params. I have a method on Apartment</p> <pre><code> def available_during(start_date, end_date) return !self.occupancies.any? { |occ| occ.date_range_overlap(Date.parse(start_date), Date.parse(end_date)) } end </code></pre> <p>Which returns true if the apartment has any occupancies that overlap with two given dates. The method <code>date_range_overlap</code> on occupancy is pretty self explanatory. I can't seem to figure out how to make ActiveAdmin's DSL to filter by that method or even make a form to input random params.</p> <p>I was able to put a column that shows the boolean return value of the available_during method in the index. </p> <pre><code>if params[:from] &amp;&amp; params[:until] column "available?" do |apt| apt.available_during(params[:from], params[:until]) end end </code></pre> <p>But I can only seem to get this to work by manually inputting the from and until params in the url. </p> <p>How might I place an arbitrary search form to send the user to the right params? Or better yet, make a filter in that sidebar that uses that method? </p>
<ruby-on-rails><ruby><activeadmin>
2016-10-05 15:07:36
HQ
39,877,764
Overriding Equals/GetHashCode for class in order to use hashset Contains/ExceptWith/UnionWith
<p>I currently have a C# class that appears as follows:</p> <pre><code> namespace DBModel { using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Data.Entity.Spatial; public partial class ConnSrv { public int ID { get; set; } [Required] [StringLength(14)] public string Service { get; set; } [Required] [StringLength(14)] public string ConnectsToService { get; set; } public virtual Service Service1 { get; set; } public virtual Service Service2 { get; set; } } } </code></pre> <p>In my main program, I'm creating hashsets to work with these objects. The problem I'm encountering is that I would like to be able to use operators such as Contains, Except, ExceptWith, UnionWith, and so on on these hashsets.</p> <p>For an object of the ConnSrv to be considered "equal", the Service and ConnectsToService values have to be equal. As such, I realize that in some way, I will have to override the Equals and GetHashCode operators for the class. I'm just not sure how to do so, whether it's through a straight override of the object class, by implementing IEquatable or IEquatable, or through some other method. Below are a couple simple examples of what I would expect the end result to be once implemented. If I'm way out in left field, please let me know. Thanks in advance for your time.</p> <pre><code> var testHS1 = new HashSet&lt;ConnectingService&gt;(); testHS1.Add(test1); testHS1.Contains(test2); // Returns true var testHS2 = new HashSet&lt;ConnectingService&gt;(); testHS2.Add(test1); testHS2.Add(test2); testHS2.Add(test3); testHS2.Except(testHS1); // Expect end result to only contain test3 </code></pre>
<c#><linq>
2016-10-05 15:11:52
LQ_CLOSE
39,878,485
Android 7 WebView with wrap_content
<p>I have a <code>WebView</code> with <code>android:layout_height="wrap_content"</code> inside a <code>ScrollView</code>. Prior to Android 7 this resulted in the WebView resizing to the height of the local html content I set with <code>loadData</code>. On my Nexus 5X with Android 7 though, the WebView height seems to be unreliable, sometimes it only shows parts of the first text line, sometimes there's a big gap at the end of the content.<br> I think it could be due to Google now using Chrome for WebViews starting with Nougat. Does anyone have an explanation or fix/workaround for this issue? </p> <p>It might also be important that the views are contained in the cells of a <code>RecyclerView</code> .</p>
<android><html><google-chrome><webview><scrollview>
2016-10-05 15:46:06
HQ
39,878,611
How to sniff HTTP response headers in Chrome? for "attachment" content?
<p>Usually I'm able to sniff my HTTP requests using Chrome Dev Tools - network tab.</p> <p>But it's not happening for download-files (i.e. when <code>Content-Dsiplosition</code> is set to <code>Attachment;filename=xxx</code>) - then Chrome just downloads the file and nothing is shown on the network tab.</p> <p>How do I see those? I mean, in Chrome, without any 3rd party tools like PostMan.</p> <p>PS. I need to see the headers my server sends, there's some debugging info I need.</p>
<google-chrome><google-chrome-devtools>
2016-10-05 15:52:38
HQ
39,878,819
c++ printing the complete square numbers in an array
<p>How can i print all complete square numbers available in the array</p> <p>this is my array:</p> <pre><code>int main() { int array[6]; cout&lt;&lt;"Enter 6 #'s: "&lt;&lt;endl; for(int i=0; i&lt;6; i++) { cin&gt;&gt;array[i]; } </code></pre>
<c++>
2016-10-05 16:02:18
LQ_CLOSE
39,879,045
C++: Semi-Colon placed before opening bracket in a while loop
while(condition);{ statement; } The semi-colon before the opening bracket of the while loop shouldn't be there. The question I'm having is why the program gets stuck at the while loop during run time. As far as I'm aware the semi colon is a terminating punctuator that lets the compiler know that it has come to the end of the statement. Since it doesn't read the opening bracket of the while loop shouldn't it then move on to the next line and perform the action? If you run the debugger and move step by step, it stops moving at the while statement and will not go further. I'm just looking for some insight as to why this is the case. If it is the case that the while has to be followed by a condition and then the opening bracket why does it compile when the semi-colon is placed in between? Shouldn't some sort of error be thrown? The IDE being used is Dev c++. I'm not sure if this is a IDE specific issue as I've not tested this in other IDEs.
<c++><while-loop><syntax>
2016-10-05 16:14:09
LQ_EDIT
39,879,056
How to find attribute data-comp value usign jquery find()
<pre><code>&lt;div id="container"&gt; &lt;div data-comp="component"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want it to find from the selector container something like $('#container').find('[data-comp]'); I want the output like 'component' </p>
<jquery>
2016-10-05 16:14:43
LQ_CLOSE
39,879,074
hexadecimal in typedef enum ios objectivec
today i was searching for the reason behind using hexadecimal in typedef enum in objectivec. I followed the following link, but there are two answers: http://stackoverflow.com/questions/8414188/c-obj-c-enum-without-tag-or-identifier LearnCocos2D says that, "there's no gain to use hex numbers and in particular there's no point in starting the hex numbers with a through f (10 to 15). " Sulthan says that, "Hexadecimal numbers are commonly used when the integer is a binary mask". I searched for binary mask and came to understand that, its a technique used in bitmap gaming from following link https://en.wikipedia.org/wiki/Mask_(computing) If sulthan is right, kindly help me understand it. I don't have enough reputation to comment, so I created this as new question.
<c><enums>
2016-10-05 16:16:07
LQ_EDIT
39,879,378
Swift 3 - find the item with the biggest value in a dictionary
I'm implementing some logic to get the to get the closest beacon and to do that I created a dictionary where I insert some measures. My problem is that I don't know how to get the item with the biggest value. Some code below: struct objBeacon { var accuracy : Float var rssi : Float var positionInList : Float } var readBeacons = [String:objBeacon]() My goal is to get the item (objBeacon) with the biggest rssi value, how can I do that without looping through the list? Thanks for any help
<swift><dictionary><swift3>
2016-10-05 16:32:41
LQ_EDIT
39,880,531
python 2.5.4 str.endwith() return False in valid check
**I don't need alternate solution.** I want know why this happen. I write source parser for makefiles. ff = open("module.mk") f = ff.readlines() ff.close() for i in f: if ".o \\" in i[-5:]: print "Is %s for str: %s" %(i.endswith('.o \\'), i) I got: Is False for str: bitmap.o \ and so for every check. You can get module.mk from [github][1] [1]: https://github.com/scummvm/scummvm/blob/master/engines/access/module.mk
<python><parsing><windows-xp>
2016-10-05 17:44:05
LQ_EDIT
39,881,381
Looking for a CMS with a Template and Content Element-System like Typo3 and Concrete5
<p>Community!</p> <p>I know, these questions shouldn't be opinion-based and I'm certainly not asking "What's the best CMS???". I'm just at a point of having tried out so many different CMS that I want to know if there does exist one which meets the following criteria:</p> <h2>Very flexible template system, content elements, content columns</h2> <p><strong>I don't really like the complexity of designing with Fluid in TYPO3</strong>. I'm not a complete newbie in this area but it strikes me as being pretty complex, you have to know all these functions and knowledge in TypoScript doesn't have much use outside of TYPO3.</p> <p><strong>On the other hand, I feel the templating is with Fluid is done pretty well</strong>. You have your backend layouts where you define your content columns (name and number), where in your fluid layouts you specify which content column (here, the number is used) is rendered where. Inside the backend you apply your backend layout to your root page (it is inherited which I love because it makes changes easier than having to change the template of every single page!) and you can add your content to the column defined in this backend layout. I love this idea!</p> <p><strong>The point I like</strong> is that content can exist outside this structure - you can create a content element and have it just not being rendered because it has no layout column specified. Also if you ever want to change your layout, you can do so by provoding the same column numbers in a new backend layout. The name of the columns can be changed without problems - that's the problem with Concrete5.</p> <p><strong>In Concrete5</strong>, all content resided inside of the "areas" (quasi content columns) on the individual pages. But because Concrete5 has only inline-editing, you can't just change your area names (and they're visible for your editors so maybe you want to change them to a better name, even though there are some standards like 'main' this doesn't fit for Non-English speaking people who just edit content in their language). If you do, you can't access your content inside these areas anymore because it is coupled with the area names (I wonder why there's no ID-system and just a public visibly area name).</p> <p><strong>Another point is crappy code</strong> - I really don't like the output of some CMS very much, even if you can control it somehow, sometimes there are things like many lines of whitespace - really weird. Concrete5's inline-editing-feature is pretty cool, especially the ability to work with Bootstrap and visually layout your blocks to have two thirds to one third width or something like that. But on the other hand you have to have these header- and footer-includes to use Concrete5, so you HAVE to change the output on your site and have to use the div-wrapper to use inline-editing. I don't really have anything against it as long as it doesn't clutter the final output too much (and I think, Concrete5 is pretty ok in this regard).</p> <p><strong>I LOVE ModX in this regard</strong> because after experimenting just a little bit I actually got ONLY my html and the things I put in the page editor in the final source code. <strong>The problem with ModX is</strong>: there are no content elements/blocks, there are no content columns/areas - all you have is one big editor field. I know, you can adjust that pretty heavily, but in the end as far as I think it's not really meant to offer you the ability to define multiple areas where you can put different kind of elements inside, is it? Like "Header", "Text &amp; Media" or "Slider" in TYPO3/Concrete5, which you can hide (at least in TYPO3) and move on their own.</p> <p>(And if there is some good kind of version control, that would be great as well, but that's just a thing I like in TYPO3 and I don't like that much in Concrete5 because you can't really roll back changes to individual elements, just to the whole site - and you can't hide part of your content (hide some blocks like you hide content elements in TYPO3) to "save" an alternative version of, say, a header or a normal text element.)</p> <hr> <p><strong>Long story short</strong>, I'm looking for a <em>very flexible template system</em> which let's me design the way I want. It should have <em>individual content elements</em> (elements of different types, which I can create on my own as well) and <em>content areas</em> (/columns), so that I can place my content in different places which I can style individually. It should output only my code if possible (like ModX) and be open to changes (like renaming content columns/areas).</p> <p>Just to recap my problems I have with the named CMS:</p> <ul> <li>TYPO3: too complex to enjoy layouting with Fluid in my regard</li> <li>Concrete5: too tightly coupled (content is gone when you rename the areas in your layout, you can't access it anymore at all)</li> <li>ModX: Not really built for multiple content elements which reside in multiple content columns</li> </ul> <p>To not counteract the purpose of stackoverflow, I want to clarify that I'm not looking for every CMS in which the named things are POSSIBLE. Someone might say "You can totally do that in Drupal, just install these 200 modules and you're good to go!") but are actually intended (like content columns and content elements in TYPO3/Concrete5, especially in Concrete5 it feels very natural to work that way, you don't get a sense of having to hack the system for days just to have a good base for developing your site.</p> <p>I'm asking if there's a CMS available (it should be open-source/free) that actually supports these developing principles by it's nature. I hope you can help me and everyone looking for a CMS which supports this style of working! Thank you! :)</p>
<templates><content-management-system><typo3><concrete5>
2016-10-05 18:35:41
LQ_CLOSE
39,881,717
Mockito - thenCallRealMethod() on void function
<p>Hello I have been ran into a problem when trying to write a JUnit test case and am relatively new to Mockito.</p> <p>I have a function of a class that I am mocking, this function happens to be of a void return type. When calling this function from my mocked class it is my understanding (and debugging experience) that it does NOT call the original function. In order to overcome this I have attempted to use a "when" with a "thenCallRealMethod()".</p> <pre><code> when(instance.voidFunction()).thenCallRealMethod(); </code></pre> <p>The "voidFunction" is full of logic that I do NOT want to fire. I have extracted these into when statements to avoid that. I have read that I should use the format of <code>doReturn().when().voidFunction()</code>, however doing this does not call the real method.</p> <p>It was also my understanding that I could not use a Spy here, due to the fact that I do not want the voidFunction() called before the "when" statements. Any help is appreciated I apologize if this is a very easy solution as my understanding of mockito isn't very great despite reading quite a bit. Thanks!</p>
<mockito>
2016-10-05 18:58:49
HQ
39,882,645
How to grab headers in python selenium-webdriver
<p>I am trying to grab the headers in selenium webdriver. Something similar to the following:</p> <pre><code>&gt;&gt;&gt; import requests &gt;&gt;&gt; res=requests.get('http://google.com') &gt;&gt;&gt; print res.headers </code></pre> <p>I need to use the <code>Chrome</code> webdriver because it supports flash and some other things that I need to test a web page. Here is what I have so far in Selenium:</p> <pre><code>from selenium import webdriver driver = webdriver.Chrome() driver.get('https://login.comcast.net/login?r=comcast.net&amp;s=oauth&amp;continue=https%3A%2F%2Flogin.comcast.net%2Foauth%2Fauthorize%3Fclient_id%3Dxtv-account-selector%26redirect_uri%3Dhttps%3A%2F%2Fxtv-pil.xfinity.com%2Fxtv-authn%2Fxfinity-cb%26response_type%3Dcode%26scope%3Dopenid%2520https%3A%2F%2Flogin.comcast.net%2Fapi%2Flogin%26state%3Dhttps%3A%2F%2Ftv.xfinity.com%2Fpartner-success.html%26prompt%3Dlogin%26response%3D1&amp;reqId=18737431-624b-44cb-adf0-2a85d91bd662&amp;forceAuthn=1&amp;client_id=xtv-account-selector') driver.find_element_by_css_selector('#user').send_keys('XY@comcast.net') driver.find_element_by_css_selector('#passwd').send_keys('XXY') driver.find_element_by_css_selector('#passwd').submit() print driver.headers ### How to do this? </code></pre> <p>I have seen some other answers that recommend running an entire selenium server to get this information (<a href="https://github.com/derekargueta/selenium-profiler">https://github.com/derekargueta/selenium-profiler</a>). How would I get it using something similar to the above with Webdriver?</p>
<python><selenium>
2016-10-05 19:57:26
HQ
39,882,865
recieving error "Out of memory. The likely cause is an infinite recursion within the program." in MatLab
<p>I am trying to implement quick sort in MatLab. I have two functions, one which splits a given list into two smaller lists, one greater and one smaller than the pivot. The second function recursively calls the quick sort and iterates to the next smaller list, calling quick sort again. My code is below. When I go to run the code with my list of 300 randomly generated numbers, I get the error "Out of memory. The likely cause is an infinite recursion within the program.".</p> <pre><code>function [ less, pivot, greater ] = SplitList( list, pivotindex ) %List Splitting Function %In order to preform quick sort you firts must be able to split the list %into two, one which is greater than, and one which is less than the pivot. pivot = list(1,pivotindex); greater = []; less = []; for l = 1:length(list) if list(1,l) &gt; pivot greater = [greater list(1, l)]; else if list(1,l) &lt;= pivot less = [less list(1, l)]; end end end end function [ qs_list ] = quick_sort( list ) %Recursive Quick Sort % quick sort algorithm to sort a list of numbers %set (0,'RecursionLimit',1000); pivotindex = round(length(list)/2); %sets pivot at the median value of the array if length(list) &gt; 1 [ less, pivot, greater ] = SplitList( list, pivotindex ); %calls the SplitList function qs_list = [quick_sort(less) pivot quick_sort(greater)]; %calls quick_sort within the function else qs_list = list; end end </code></pre>
<matlab><recursion><quicksort><infinite-recursion>
2016-10-05 20:11:32
LQ_CLOSE
39,883,648
Initialize a Point2D in List<>
<p>If I have a simple List&lt; Point2D > declared.</p> <p>Example:</p> <pre><code>List&lt;Point2D&gt; listOfPoints; /* What I tried */ Point2D point1; listOfPoints.add(point1); </code></pre> <p>But, how does one initialize <code>point1</code> so that I can have a coordinate of let's say <code>(3,2)</code>?</p>
<java><list><sorting><2d><points>
2016-10-05 21:04:20
LQ_CLOSE
39,883,915
INTERVIEW Test - Please help me solve
I got a really interesting question at a company, and I can't seem to find an answer at all. It really bothers me, please help me. [code] #include <cstdio> int main() { int num = 123456789; int res = 0; for (int i = 0; i<111111111; i++) { res=(res+num)%1000000000; } printf("06 %09d", res); return 0; } [/code] I should declare num so the output is my mobile number, 305089171. Any idea how to do that?
<c++>
2016-10-05 21:23:28
LQ_EDIT
39,884,515
Render a view in Rails 5 API
<p>I generated an API-only rails app with Rails 5 via <code>rails new &lt;application-name&gt; --api</code>. I've decided I want to include a view for testing some things and am having issues getting a view to load. </p> <p>I created a users/index.html.erb file with some text and my controller is now simply <code>def index; end</code> but there is nothing appearing when I hit the /users URL. I also tried commenting out the <code># config.api_only = true</code> in config/application.rb but that didn't affect anything. Any suggestions on how to proceed? </p>
<ruby-on-rails><ruby><ruby-on-rails-5>
2016-10-05 22:11:45
HQ
39,885,288
Unable to Execute Rails console command Ruby
<pre><code>/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `require': dlopen(/Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle, 9): Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib (LoadError) Referenced from: /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle Reason: image not found - /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/x86_64-darwin15/readline.bundle from /Users/parkerharris/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/irb/completion.rb:10:in `&lt;top (required)&gt;' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `require' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/console.rb:3:in `&lt;top (required)&gt;' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:138:in `require_command!' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:68:in `console' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!' from /Users/parkerharris/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/commands.rb:18:in `&lt;top (required)&gt;' from bin/rails:4:in `require' from bin/rails:4:in `&lt;main&gt;' </code></pre> <p>This is my error screen after trying to execute the command. I've tried to uninstall and reinstall readline and that did not help. I am just learning rails and do not 100% know what I am doing (just following a guide) so this type of error is past my understanding. Thanks!</p>
<ruby-on-rails><ruby>
2016-10-05 23:35:33
HQ
39,885,346
Youtube-dl add metadata during audio conversion
<p>Sorry if this question is misguided. I'm using youtube-dl to download song videos as mp3's before adding them to itunes. The problem is that the videos dont seem to contain the metadata in there. I read what i could about --add-metadata option but from what i understand this option is only used to add the ids if they are already in the video? I know the artist and song title so Id like a way to add it in directly if possible. Something to the effect --add-metadata-artist "Pink Floyd" Is that possible with the current configuration options?I saw this related issue but it didnt really help <a href="https://github.com/rg3/youtube-dl/issues/1570" rel="noreferrer">https://github.com/rg3/youtube-dl/issues/1570</a> Here are my current configuration settings:</p> <pre><code>options = { 'format':'bestaudio/best', 'extractaudio':True, 'audioformat':'mp3', 'outtmpl':'%(id)s.%(ext)s', #name the file the ID of the video 'noplaylist':True, 'nocheckcertificate':True, 'proxy':"", 'addmetadata':True, 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192', }] } </code></pre>
<python><mp3><youtube-dl>
2016-10-05 23:44:25
HQ
39,886,131
Jack compiling taking forever
<p>After upgrading my project to enable Jack and Java8 features, my 16gb macbook can't seem to build my project anymore. I see the memory usage getting higher and higher but the process gets stuck at the same point always.</p> <p>My Gradle console:</p> <pre><code>Executing tasks: [:app:assembleDebug] Configuration on demand is an incubating feature. Incremental java compilation is an incubating feature. :app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE :app:compileDebugNdk UP-TO-DATE :app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE :app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE :app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE :app:prepareComAndroidSupportCardviewV72421Library UP-TO-DATE :app:prepareComAndroidSupportCustomtabs2340Library UP-TO-DATE :app:prepareComAndroidSupportDesign2421Library UP-TO-DATE :app:prepareComAndroidSupportRecyclerviewV72421Library UP-TO-DATE :app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE :app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE :app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE :app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE :app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE :app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE :app:prepareComBluelinelabsConductor203Library UP-TO-DATE :app:prepareComFacebookAndroidFacebookAndroidSdk4160Library UP-TO-DATE :app:prepareComGithubJkwiecienEasyImage130Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAuth940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesAuthBase940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBasement940Library UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesTasks940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseAnalytics940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseAnalyticsImpl940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseAuth940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseAuthCommon940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseAuthModule940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseCommon940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseCore940Library UP-TO-DATE :app:prepareComGoogleFirebaseFirebaseIid940Library UP-TO-DATE :app:prepareComHannesdorfmannMosbyMvp201Library UP-TO-DATE :app:prepareComHannesdorfmannMosbyMvpConductor082Library UP-TO-DATE :app:prepareComHannesdorfmannMosbyViewstate201Library UP-TO-DATE :app:prepareComHannesdorfmannMosbyViewstateConductor082Library UP-TO-DATE :app:prepareComJakewhartonButterknife840Library UP-TO-DATE :app:prepareComJakewhartonRxbindingRxbinding040Library UP-TO-DATE :app:prepareComJakewhartonRxbindingRxbindingAppcompatV7040Library UP-TO-DATE :app:prepareComJakewhartonRxbindingRxbindingDesign040Library UP-TO-DATE :app:prepareComJakewhartonRxbindingRxbindingRecyclerviewV7040Library UP-TO-DATE :app:prepareComJakewhartonRxbindingRxbindingSupportV4040Library UP-TO-DATE :app:prepareComJakewhartonTimberTimber431Library UP-TO-DATE :app:prepareComKelvinappsRxfirebase0015Library UP-TO-DATE :app:prepareComSquareupLeakcanaryLeakcanaryAndroid14Library UP-TO-DATE :app:prepareIoReactivexRxandroid121Library UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE :app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugResValues UP-TO-DATE :app:processDebugGoogleServices Parsing json file: /Users/leonardo/AndroidStudioProjects/Kluster/app/google-services.json :app:generateDebugResources :app:mergeDebugResources UP-TO-DATE :app:processDebugManifest UP-TO-DATE :app:processDebugResources :app:generateDebugSources :app:unzipJacocoAgent :app:transformClassesWithPreJackPackagedLibrariesForDebug :app:transformClassesWithPreJackRuntimeLibrariesForDebug </code></pre> <p>My build:</p> <pre><code>apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "24.0.3" dexOptions { maxProcessCount 2 javaMaxHeapSize "2g" } defaultConfig { jackOptions { enabled = true } applicationId "com.kluster" minSdkVersion 16 targetSdkVersion 24 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.facebook.stetho:stetho:1.3.1' compile rootProject.ext.supportV4 compile rootProject.ext.supportDesign compile rootProject.ext.supportAnnotations compile rootProject.ext.supportAppCompat compile rootProject.ext.supportRecyclerView compile rootProject.ext.supportCardview compile(rootProject.ext.butterknife) { exclude group: "com.android.support" } compile rootProject.ext.conductor compile(rootProject.ext.easyImage) { exclude group: "com.android.support" } compile rootProject.ext.glide compile rootProject.ext.dagger compile rootProject.ext.rxJava compile rootProject.ext.rxAndroid compile rootProject.ext.mosby compile rootProject.ext.mosbyViewState compile rootProject.ext.mosbyConductor compile rootProject.ext.mosbyViewStateConductor compile rootProject.ext.rxBinding compile rootProject.ext.rxBindingV4 compile rootProject.ext.rxBindingV7 compile rootProject.ext.rxBindingDesign compile rootProject.ext.rxBindingRecyclerView debugCompile rootProject.ext.leakCanary compile rootProject.ext.timber compile rootProject.ext.firebaseAuth; compile rootProject.ext.googleAuth compile rootProject.ext.rxFirebase compile rootProject.ext.facebook provided rootProject.ext.butterknifeCompiler provided rootProject.ext.daggerCompiler provided rootProject.ext.javaxAnnotation androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:24.2.1' testCompile 'junit:junit:4.12' } apply plugin: 'com.google.gms.google-services' </code></pre> <p>gradle.properties:</p> <pre><code># Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx2048m # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true </code></pre> <p>Before using Jack the compiler would build in less than 20s or so, what might be wrong ?? Thanks </p>
<android><android-gradle-plugin><build.gradle><android-jack-and-jill>
2016-10-06 01:31:58
HQ
39,886,146
kubectl attach: Unable to use a TTY - container es-node did not allocate one
<p>I am trying to attach to a running container in Kubernetes, however I get the error message below. </p> <pre><code>&gt;kubectl attach -it es-client-2756725635-4rk43 -c es-node Unable to use a TTY - container es-node did not allocate one If you don't see a command prompt, try pressing enter. </code></pre> <p>How do I enable a TTY in my container yaml?</p>
<containers><kubernetes><tty>
2016-10-06 01:34:22
HQ
39,886,670
Lisp finding all even numbers and adding them to new list
<p>Given a list (3 b 6 7 8), I'm trying to find all the even numbers and add them to a new list and then print this list. I am using a do loop to cdr through my list. Then using (if (evenp (car mylist))) and now I want to save the first even number onto a new list and then restart the if statement. The final print should be (6 8).</p>
<lisp><common-lisp>
2016-10-06 02:41:46
LQ_CLOSE
39,887,430
How to compare datetime.now with a certain date?
<p>Let's say i have a variable of datetime type; varA = '2016-06-10 12:28:36.697'. What is the best way and how i can compare it with <code>datetime.now</code> to make sure the date is the same regardless of the year?</p>
<c#><c#-4.0>
2016-10-06 04:17:06
LQ_CLOSE
39,887,733
Purpose of PreAuthenticatedAuthenticationToken in Spring Security?
<p>I am authenticating a User using <a href="http://docs.spring.io/spring-security/site/docs/3.2.2.RELEASE/apidocs/org/springframework/security/authentication/UsernamePasswordAuthenticationToken.html" rel="noreferrer">UsernamePasswordAuthenticationToken</a> in SpringBoot.</p> <p>I am generating a token using <a href="https://github.com/jwtk/jjwt" rel="noreferrer">JJWT</a> for that User and returning it back.</p> <p>Now the User uses that token to send any further requests to me. After decrypting the token should I be using <a href="http://docs.spring.io/spring-security/site/docs/3.2.2.RELEASE/apidocs/org/springframework/security/web/authentication/preauth/PreAuthenticatedAuthenticationToken.html" rel="noreferrer">PreAuthenticatedAuthenticationToken</a> and set it to <code>SecurityContextHolder.getContext().setAuthentication()</code>?</p> <p>What is the purpose of <code>PreAuthenticatedAuthenticationToken</code>?</p>
<java><spring-security><spring-boot><jwt>
2016-10-06 04:49:51
HQ
39,888,507
How to move all files and folder from one folder to another of S3 bucket in php with some short way?
<p>I have to move all files and folders from one folder or another of S3 bucket in php. I know a way to do the same thing is - <strong>1) get all objects list from the source folder 2) copy all objects into destination folder 3) delete all objects from source folder</strong></p> <p>Is there any other short way to do the same. If so then please share with me, It would be appreciated, Thanks in advance</p>
<php><amazon-web-services><amazon-s3>
2016-10-06 05:55:15
HQ
39,889,827
How do I use the python continue keyword as a string literal in a python script?
<p>I'm writing a python script wherein I need to use the <em>continue</em> word.</p> <p>I know that it is a python keyword.</p> <p>So how should I write my script so that python will not complain that I am using a keyword as a string literal.</p> <p>Thanks in advance for your time.</p>
<python><keyword><interpreter><continue>
2016-10-06 07:17:53
LQ_CLOSE
39,890,230
List all installed programs on windows using PHP
<p>How can I list all installed programs in windows using php or how can I search for a installed program in windows using php?</p>
<php><windows>
2016-10-06 07:38:31
LQ_CLOSE
39,890,885
Error message is (#12) bio field is deprecated for versions v2.8 and higher
<p>I used version 2.0.3.RELEASE of spring-social-facebook and Facebook app api v2.8. I called Facebook login but returned this message. "(#12) bio field is deprecated for versions v2.8 and higher" How can i fix this?</p>
<spring-social-facebook>
2016-10-06 08:14:23
HQ
39,890,993
How to show check box text if it is not next to check box using Jquey
[click to see the image][1] I am tying to achive checked value text should visible like shown in the image.without refresh or any click can anyone help me out.? This is my php dynamic from : <div class="products-row"> <?php $tq=$conn->query("select * from os_tiffen where tiffen_status=1 order by id_tiffen ASC"); while ($tiffen = $tq->fetch_assoc()) { ?> <div class="col-md-3"> <div class="foodmenuform row text-center"> <input multiple="multiple" type="checkbox" id="<?php echo $tiffen['tiffen_image']; ?>" name="tifeen" hidden> <label for="<?php echo $tiffen['tiffen_image'];?>"><img src="img/tiffen/<?php echo $tiffen['tiffen_image']; ?>" class="img img-responsive" /></label> <h3 class="FoodName"><?php echo $tiffen['tiffen_name'];?></h3> </div> </div> <?php } ?> </div> This is my sript to show the text: <script type="text/javascript" language="JavaScript"> $( document ).ready(function() { var FoodMenu = $('input[type=checkbox]:checked').map(function(){ return $(this).next('.FoodName').text(); }).get().join("<br>"); $("#selectedfood").html(FoodMenu); }); </script> [1]: http://i.stack.imgur.com/NMuuZ.png Out put id: `<a id="selectedfood"></a></li>`
<javascript><php><jquery><ajax><checkbox>
2016-10-06 08:19:53
LQ_EDIT
39,891,889
How can i import a tables into microsoft sql sever 2008?
I had 5 tables with a values which is exported from other system. Now i want to import that 5 tables into my database. Is it any possibles to import ?
<sql-server-2008>
2016-10-06 09:04:33
LQ_EDIT
39,892,503
Fatal error: Class 'App\Http\Controllers\Redirect' not found
<p>when i run below command in my terminal it shows below code instead of routes</p> <pre><code>php artisan route:list &lt;html&gt; &lt;head&gt; &lt;meta charset="UTF-8" /&gt; &lt;meta http-equiv="refresh" content="1;url=http://localhost/login" /&gt; &lt;title&gt;Redirecting to http://localhost/login&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Redirecting to &lt;a href="http://localhost/login"&gt;http://localhost/login&lt;/a&gt;. &lt;/body&gt; &lt;/html&gt; </code></pre> <blockquote> <p>[Symfony\Component\Debug\Exception\FatalThrowableError] Fatal error: Class 'App\Http\Controllers\Redirect' not found</p> </blockquote>
<laravel><laravel-5><laravel-5.2><laravel-5.1>
2016-10-06 09:35:51
HQ
39,892,809
Can I use Java 7 with Vert.x any version ?
I need to use Vert.x as per requirement. Need to implement vert.x + java 7 . Is it Just want to know , Can I Implement Vert.X with Java 1.7, as Vert.X haveΒ lambda expressionΒ (i.e. not supported by Java 7) ,Β So Is it compulsory Vert.X + Java 8 or Vert.X provided some alternative of Lambda Expression or lower version of Vert.X is Compatible with Java 7. Thanks in advance.
<java><vert.x>
2016-10-06 09:50:56
LQ_EDIT
39,893,177
Sort object in array with dynamic object keys
<p>I have an array with a single object populated like so:</p> <pre><code>valueArr = [{ 485: 201.5897, 487: 698.52, 598: 351.85, ... year: '2016' }]; </code></pre> <p>Now, i want to rearange / sort the object from largest - smallest value. The Ouptput i'm looking for would be something like this:</p> <pre><code>valueArr = [{ 487: 698.52, 598: 351.85, 485: 201.5897, ... year: '2016' }]; </code></pre> <p>NOTE: The "year"-property should be excluded in the sorting. There is only one property of this inside the object. </p> <p>Is it possible to rearange/sort an object like this? </p>
<javascript><sorting><object>
2016-10-06 10:08:08
LQ_CLOSE
39,893,193
cassandra cql shell window got disappears after installation in windows
<p>cassandra cql shell window got disappears after installation in windows? this was installed using MSI installer availalbe in planet cassandra.</p> <p>Why this happens ? please help me..</p> <p>Thanks in advance.</p>
<cassandra><datastax><datastax-enterprise><cqlsh>
2016-10-06 10:08:51
HQ
39,893,617
Is it possible to create an app with only swift ?
<p>I've started to learn swift and it is told to be a very fast language who takes over the Objective-C. But at many times, I saw it is not enough to write only with Swift and it was need others languages. So I would know if with my MacBook, Xcode and Swift only, it's possible to create app like Snapchat, Instagram WhatsApp or other.</p> <p>Thanks you.</p>
<swift><swift2>
2016-10-06 10:29:05
LQ_CLOSE
39,893,829
DO YOU NEED ANY LANGUAGE TO LEARN TABLEAU OTHER THAN SQL?
DOES TABLEAU,QLIKVIEW AND PANORAMA REQUIRES ANY PROGRAMMING LANGUAGE TO LEARN ?
<tableau-api><qlikview><360-panorama>
2016-10-06 10:39:50
LQ_EDIT
39,893,890
Dutuch flag for 4 colors
I went trough solution for 2 and 3 colors but I am unable to get it for 4 colors. I am unable to do it for fo four colors.Please help. Will it be rrbb????yyyggg how will we swap the green flag. I tried the solution but it is not working swapping ;last yellow with green public class count123 { // Java program to sort an array of 0, 1 and 2,3 static void sort0123(int a[], int arr_size) { int lo = 0; int hi = arr_size - 1; int mid = 0,temp=0; int h2=arr_size - 1; while (mid <= hi) { switch (a[mid]) { case 0: { temp = a[lo]; a[lo] = a[mid]; a[mid] = temp; lo++; mid++; break; } case 1: mid++; break; case 2: { temp = a[mid]; a[mid] = a[hi]; a[hi] = temp; hi--; h2=hi; break; } case 3:{ temp = a[mid]; a[mid] = a[h2]; a[h2] = temp; // h2--; //hi=h2; break; } } } } /* Utility function to print array arr[] */ static void printArray(int arr[], int arr_size) { int i; for (i = 0; i < arr_size; i++) System.out.print(arr[i]+" "); System.out.println(""); } /*Driver function to check for above functions*/ public static void main (String[] args) { int arr[] = {0, 1, 0,1,2,2,0,3,3,0,0,1}; int arr_size = arr.length; sort0123(arr, arr_size); System.out.println("Array after seggregation "); printArray(arr, arr_size); } } /*This code is contributed by Devesh Agrawal*/
<java><arrays><sorting><dutch-national-flag-problem>
2016-10-06 10:43:19
LQ_EDIT
39,894,630
How to get front camera, back camera and audio with AVCaptureDeviceDiscoverySession
<p>Before iOS 10 came out I was using the following code to get the video and audio capture for my video recorder:</p> <pre><code> for device in AVCaptureDevice.devices() { if (device as AnyObject).hasMediaType( AVMediaTypeAudio ) { self.audioCapture = device as? AVCaptureDevice } else if (device as AnyObject).hasMediaType( AVMediaTypeVideo ) { if (device as AnyObject).position == AVCaptureDevicePosition.back { self.backCameraVideoCapture = device as? AVCaptureDevice } else { self.frontCameraVideoCapture = device as? AVCaptureDevice } } } </code></pre> <p>When iOS 10 finally came out, I received the following warning when I was running my code. Note that my video recorder was still working smoothly for about 2 weeks.</p> <blockquote> <p>'devices()' was deprecated in iOS 10.0: Use AVCaptureDeviceDiscoverySession instead.</p> </blockquote> <p>As I was running my code this morning, my video recorder stopped working. xCode8 does not give me any errors but the previewLayer for the camera capture is completely white. When I then start recording I receive the following error:</p> <blockquote> <p>Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x17554440 {Error Domain=NSOSStatusErrorDomain Code=-12780 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-12780)}</p> </blockquote> <p>I believe that has something to do with the fact that I am using the deprecated approach <code>AVCaptureDevice.devices()</code>. Hence, I was wondering how to use <code>AVCaptureDeviceDiscoverySession</code> instead?</p> <p>Thank you for your help in advance!</p>
<ios><swift><avfoundation><avcapturedevice>
2016-10-06 11:20:27
HQ
39,894,749
You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type
<p>I'm getting the following error from a few different libraries in my project, after adding the <code>"stage-2"</code> preset to my <code>.babelrc</code>. (Thats my assumption atm)</p> <p>e.g. from the DatePicker class in React Native: </p> <pre><code>node_modules/react-native/Libraries/Components/DatePickerAndroid/DatePickerAndroid.android.js: You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type </code></pre> <p>How can I resolve this error? </p> <p>I'm using React Native 0.31 and </p> <pre><code> "devDependencies": { "babel-preset-react-native-stage-0": "^1.0.1", "babel-preset-stage-2": "^6.17.0" }, </code></pre>
<react-native><babeljs>
2016-10-06 11:26:33
HQ
39,895,274
node.js multiple app without multiple server
<p><strong>I want my app to be example.com but the dashboard to be dashboard.example.com</strong>, how do I do that with one server running? I can easily spin up 2 express app and connect to the same db, and configure ngix config but I feel that is not a proper way to do things.</p> <p>Any clue? I'm using express.js anyway.</p>
<javascript><node.js><express>
2016-10-06 11:52:16
LQ_CLOSE
39,895,298
insert multi array to database in loop
<p>i have below array</p> <pre><code>Array ( [user_id] =&gt; Array ( [0] =&gt; 1 [1] =&gt; 1 [2] =&gt; 1 [3] =&gt; 1 ) [menu_id] =&gt; Array ( [0] =&gt; 1 [1] =&gt; 1 [2] =&gt; 1 [3] =&gt; 1 ) [submenu_id] =&gt; Array ( [0] =&gt; 1 [1] =&gt; 2 [2] =&gt; 3 [3] =&gt; 4 ) ) </code></pre> <p>my MySQL Database is like below :</p> <pre><code>user_id | menu_id | submenu_id | | </code></pre> <p>i want to insert above array to my database like below :</p> <pre><code>user_id | menu_id | submenu_id 1 | 1 | 1 1 | 1 | 2 1 | 1 | 3 1 | 1 | 4 </code></pre> <p>how can i insert data like above ? Thank you.</p>
<php><mysql><arrays><multidimensional-array><insert>
2016-10-06 11:53:29
LQ_CLOSE
39,895,346
Activity in androidTest not getting launched by ActivityTestRule
<p>I want to test a fragment in test activity. I added <code>TestTragmentActivity</code> to <code>androidTest</code> along with <code>AndroidManifest.xml</code> file. But when I try to use this activity via an <code>ActivityTestRule</code> it gives following error:</p> <pre><code>java.lang.RuntimeException: Could not launch activity at android.support.test.runner.MonitoringInstrumentation.startActivitySync(MonitoringInstrumentation.java:371) at android.support.test.rule.ActivityTestRule.launchActivity(ActivityTestRule.java:219) at com.bbm.ui.fragments.StickerPackListFragmentTest.testEmpty(StickerPackListFragmentTest.java:29) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at android.support.test.internal.statement.UiThreadStatement.evaluate(UiThreadStatement.java:55) at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:270) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:59) at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1887) Caused by: java.lang.RuntimeException: Unable to resolve activity for: Intent { act=android.intent.action.MAIN flg=0x14000000 cmp=com.bbm.debug/com.bbm.TestFragmentActivity } at android.app.Instrumentation.startActivitySync(Instrumentation.java:391) at android.support.test.runner.MonitoringInstrumentation.access$201(MonitoringInstrumentation.java:90) at android.support.test.runner.MonitoringInstrumentation$5.call(MonitoringInstrumentation.java:351) at android.support.test.runner.MonitoringInstrumentation$5.call(MonitoringInstrumentation.java:348) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:818) </code></pre> <p>The <code>TestFragmentActivity</code> is just an empty activity. Below is the <code>AndroidManifest.xml</code> in the <code>androidTest</code> folder.</p> <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.bbm"&gt; &lt;application android:label="@string/app_name" tools:replace="android:label"&gt; &lt;activity android:name=".TestFragmentActivity"&gt;&lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; </code></pre> <p>I tried to get some data about why this is happening. Below is my test:</p> <pre><code>@RunWith(AndroidJUnit4.class) public class TestFragment { @Rule public ActivityTestRule&lt;TestFragmentActivity&gt; rule = new ActivityTestRule&lt;&gt;(TestFragmentActivity.class, false, false); @Test public void testEmpty() { // Just for logging purpose printActivities(InstrumentationRegistry.getTargetContext(), "APP_TARGET_CONTEXT"); printActivities(InstrumentationRegistry.getContext(), "APP_CONTEXT"); // The launch fails.... rule.launchActivity(null); } private void printActivities(Context context, String tag) { try { ActivityInfo[] infos = context.getPackageManager().getPackageInfo(context.getPackageName(), PackageManager.GET_ACTIVITIES).activities; for(ActivityInfo info : infos) { Log.d(tag, info.name); } } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } Log.d(tag + "_PACKAGE_NAME", context.getPackageName()); } } </code></pre> <p>The output of above is:</p> <pre><code>10-06 18:46:45.419 13030-13052/com.example.achhatra.myapplication D/APP_TARGET_CONTEXT: com.example.achhatra.myapplication.MainActivity 10-06 18:46:45.419 13030-13052/com.example.achhatra.myapplication D/APP_TARGET_CONTEXT_PACKAGE_NAME: com.example.achhatra.myapplication 10-06 18:46:45.419 13030-13052/com.example.achhatra.myapplication D/APP_CONTEXT: com.example.achhatra.myapplication.TestFragmentActivity 10-06 18:46:45.419 13030-13052/com.example.achhatra.myapplication D/APP_CONTEXT_PACKAGE_NAME: com.example.achhatra.myapplication.test </code></pre> <p>As you can see the <code>TestFragmentActivity</code> is in the <code>androidTest</code> context and not in the target context. That is the reason <code>ActivityTestRule</code> is not able to launch it. </p> <p>I would like to know how can I launch this <code>TestFragmentActivity</code> in this test.</p>
<android><unit-testing><android-espresso><android-instrumentation><junit-runner>
2016-10-06 11:55:49
HQ
39,896,382
ActivityLifecycleCallbacks are not triggered when activity is killed through "Don't keep activities"
<p>In my Android app I have two activities:</p> <ul> <li><code>DemoActivity</code> with a button to start the <code>SearchActivity</code> with an <code>Intent</code></li> <li><code>SearchActivity</code></li> </ul> <p>The button is a custom ViewGroup:</p> <ul> <li><code>SearchButton</code></li> </ul> <p>As soon as the <code>SearchButton</code> comes to life it registers for lifecycle events (of the corresponding <code>SearchActivity</code>):</p> <pre><code>public class SearchButton extends CardView implements Application.ActivityLifecycleCallbacks { @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); Context applicationContext = getContext().getApplicationContext(); if (applicationContext instanceof Application) { ((Application) applicationContext) .registerActivityLifecycleCallbacks(this); } } // ... </code></pre> <p>The events are consumed as follows:</p> <pre><code>// ... @Override public void onActivityStarted(Activity activity) { if (activity instanceof SearchActivity) { SearchActivity searchActivity = (SearchActivity) activity; searchActivity.addSomeListener(someListener); } } @Override public void onActivityStopped(Activity activity) { if (activity instanceof SearchActivity) { SearchActivity searchActivity = (SearchActivity) activity; searchActivity.removeSomeListener(someListener); } } </code></pre> <p>Once the <code>SearchActivity</code> has been launched I put the app into background and get it back into foreground. The following call stack can be seen:</p> <pre><code>1. SearchButton.onActivityStarted // triggered by DemoActivity 2. DemoActivity.onStart 3. SearchButton.onActivityStarted // triggered by SearchActivity 4. SearchActivity.addSomeListener 5. SearchActivity.onStart </code></pre> <p>As you can see the listener is added. This works fine.</p> <hr> <h3>The problem</h3> <p>As soon as I enable <code>Don't keep activities</code> in the developer options the call stack looks like this when I get the app foreground again:</p> <pre><code>1. DemoActivity.onCreate 2. SearchButton.init // Constructor 3. DemoActivity.onStart 4. SearchActivity.onStart 5. SearchButton.onAttachedToWindow 6. DemoApplication.registerActivityLifecycleCallbacks </code></pre> <p>Here the listener is <strong>not added</strong>. The desired <code>onActivityStarted</code> callback triggered by <code>SearchActivity.onStart</code> is <strong>missing</strong>.</p>
<android><android-activity><callback><activity-lifecycle>
2016-10-06 12:45:30
HQ
39,896,716
Can I perform multiple assertions in pytest?
<p>I'm using pytest for my selenium tests and wanted to know if it's possible to have multiple assertions in a single test?</p> <p>I call a function that compares multiple values and I want the test to report on all the values that don't match up. The problem I'm having is that using "assert" or "pytest.fail" stops the test as soon as it finds a value that doesn't match up.</p> <p>Is there a way to make the test carry on running and report on all values that don't match?</p>
<python><selenium><pytest>
2016-10-06 13:00:22
HQ
39,898,556
Content URI passed in EXTRA_STREAM appears to "To:" email field
<p>I am creating a file in the cache directory that I'd like to share with others (via Gmail / WhatsApp etc). I am able to do this using FileProvider, and it works OK for WhatsApp. When choosing to share on Gmail the photo is correctly attached, but the Uri that I pass via Intent.EXTRA_STREAM also ends up being parsed by Gmail as an address in the "To:" field of the newly composed email, along with the address(es) that I pass via Intent.EXTRA_EMAIL.</p> <p>So the user is required to delete the bogus (Uri) email address before sending. Any idea how to prevent this from happening?</p> <pre><code>Uri contentUri = FileProvider.getUriForFile(getActivity(), "com.mypackage.fileprovider", cacheFile); Intent intent = new Intent(Intent.ACTION_SEND); intent.setDataAndType(contentUri, "image/jpeg"); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.putExtra(Intent.EXTRA_EMAIL, new String[] {"some_address@gmail.com"}); intent.putExtra(Intent.EXTRA_SUBJECT, "Photo"); intent.putExtra(Intent.EXTRA_TEXT, "Check out this photo"); intent.putExtra(Intent.EXTRA_STREAM, contentUri); if(intent.resolveActivity(getActivity().getPackageManager()) != null) { startActivity(Intent.createChooser(intent, getString(R.string.share_file))); } </code></pre>
<android><email><android-fileprovider>
2016-10-06 14:22:24
HQ
39,898,951
Regex \s\s matches `return + place`
<p>I have constructed a string as follows</p> <pre><code>let str = String.fromCharCode(13) + ' '; </code></pre> <p>Next, I would like to know if the string contains two spaces</p> <pre><code>str.match(/\s\s/) </code></pre> <p>The weird thing is that it is a match. But if I do</p> <pre><code>str.match(/ /) </code></pre> <p>it isn't. Can someone explain to me why this is happening ?</p>
<javascript><regex><ascii>
2016-10-06 14:40:13
LQ_CLOSE
39,899,801
How I can iterate array with type NSString and type int. And get NSString element with lowest int?
I have some array with employees and their salary, I need iterate array and output one employee with lowest salary in all array. //array @property(strong,nonatomic) NSMutableArray<Employee *> *employees; -(void) addEmployeeWithName:(NSString *)employeesName andLastName:(NSString *) employeesLastName andSalary:(int)employeesSalary; //implementation of method -(void) addEmployeeWithName:(NSString *)employeesName andLastName:(NSString *)employeesLastName andSalary:(int)employeesSalary { Employee *myEmp =[[Employee alloc] initWithFirstName:employeesName lastName:employeesLastName salary:employeesSalary]; [self.employees addObject:myEmp]; } //In main() function something like this: Employee *emp1 = [[Employee alloc] initWithFirstName:@"Bob" lastName:@"Lan" salary:1]; Employee *emp2 = [[Employee alloc] initWithFirstName:@"Ivan" lastName:@"Pal" salary:22];
<objective-c><arrays><nsstring>
2016-10-06 15:17:37
LQ_EDIT
39,900,095
PHP add target="_blank
<p>I hope everyone doing great, I need help how I can add target blank to a specific code </p> <p>this is the code:</p> <pre><code>if( !empty($social_fb) ){ $result .= '&lt;a href="'.esc_attr($social_fb).'"&gt;&lt;i class="fa fa-facebook"&gt;&lt;/i&gt;&lt;/a&gt;'; } </code></pre> <p>I try to add this:</p> <pre><code>if( !empty($social_fb) ){ $result .= '&lt;a href=" target="_blank'.esc_attr($social_fb).'"&gt;&lt;i class="tana-social tana-size-26 tana-facebook tana-circle fa fa-facebook"&gt;&lt;/i&gt;&lt;/a&gt;'; } </code></pre> <p>but not work!</p> <p>I hope someone can help me, many thanks in advances! Regards Manny</p>
<php><target>
2016-10-06 15:31:34
LQ_CLOSE
39,900,654
Facebook API Error: "User does not have sufficient administrative permission for this action on this page."
<p>I'm using a Facebook app (in development mode) to generate a page access token so that my personal web app can schedule/edit/delete posts on a Facebook fan page.</p> <p>I'm using the Graph Explorer to generate the token while logged in as the <strong>admin</strong> of the fan page. </p> <p>When I use that token, I'm able to GET a list of the scheduled posts, but whenever I try to edit or delete a post, I get this error: </p> <p><em>"User does not have sufficient administrative permission for this action on this page."</em></p> <p>Here is the debug of the token: </p> <p><a href="https://i.stack.imgur.com/VdX8T.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/VdX8T.jpg" alt="enter image description here"></a></p> <p>Any ideas on how to fix this? </p>
<facebook><facebook-graph-api>
2016-10-06 15:59:05
HQ
39,901,028
wrap code in R Studio text editor
<p>How can one wrap commands within a lengthy line of code in the text editor in RStudio such that RStudio recognizes it as the continuation of a single piece of code? Currently, my code is 1 incredibly long line that is difficult to manage. With my current RStudio configuration, "Enter" seems to establish a new and separate line of code (without an indent) that RStudio doesn't process correctly because it begins with a "+".</p> <p>Soft wrap (auto wrap based upon width of the text editor window) is not what I'm looking for.</p> <p>Example what what I'm trying to achieve:</p> <pre><code>ggplot(C, aes(x=Tenure, y = Count, color=Gender, shape=Gender)) + geom_point(size=1) + geom_smooth(aes(fill=Gender)) + labs(x="Tenure", y="Closeness") + ggtitle("Title") </code></pre> <p>Shift + Enter and Control + Enter are not doing the trick.</p>
<r><rstudio>
2016-10-06 16:18:19
HQ
39,901,134
Why is the method strikethrough?
<p>I have defined a class like this:</p> <pre><code>internal class C { internal func method() -&gt; Void { print("method called") } } </code></pre> <p>If I declare a closure from that method, the method is shown strikethrough</p> <pre><code>let closure = C.init().meth let closure2 = C.meth </code></pre> <p>The same happens if I use it in the autocasting paranthesis <code>\(...)</code></p> <pre><code>print("\(C.init().meth)") </code></pre> <h3>Xcode examples:</h3> <p><a href="https://i.stack.imgur.com/jKVzH.png" rel="noreferrer"><img src="https://i.stack.imgur.com/jKVzH.png" alt="example1"></a> <a href="https://i.stack.imgur.com/v8BQj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/v8BQj.png" alt="example2"></a> <a href="https://i.stack.imgur.com/4PwwM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/4PwwM.png" alt="enter image description here"></a></p>
<xcode8>
2016-10-06 16:24:13
HQ
39,901,311
Docker - Ubuntu - bash: ping: command not found
<p>I've got a Docker container running Ubuntu which I did as follows:</p> <pre><code>docker run -it ubuntu /bin/bash </code></pre> <p>however it doesn't seem to have <code>ping</code>. E.g.</p> <pre><code>bash: ping: command not found </code></pre> <p>Do I need to install that?</p> <p>Seems a pretty basic command to be missing. I tried <code>whereis ping</code> which doesn't report anything.</p>
<ubuntu><docker><ping>
2016-10-06 16:33:07
HQ
39,901,899
Android error "java.lang.NullPointerException" setImageBitmap
Android get error "java.lang.NullPointerException" assign setImageBitmap Can you help me, please? **"result"** is a valid bitmap. Here is my code: protected void onPostExecute(Bitmap result) { super.onPostExecute(result); try { ImageView imageView1; imageView1 = (ImageView) findViewById(R.id.imgbanner); imageView1.setImageBitmap(result); return; } catch (Exception e) { logMensajes("Error imageload onPostExecute: "+e.toString()); } } XML <ImageView android:id="@+id/imgbanner" android:layout_width="match_parent" android:layout_height="100dp" android:layout_below="@+id/txtTitulo"/>
<android><android-asynctask>
2016-10-06 17:07:40
LQ_EDIT
39,903,013
how to make select drop down list read only and unchangeable
Here is a link of js fiddle [select drop down example][1] i make select dropdown read only but when i click on it it shows me the drop down option which should not show and it is changeable Can you suggest a solution [1]: https://jsfiddle.net/7Lcf533c/1/
<javascript><jquery><html><user-interface><drop-down-menu>
2016-10-06 18:16:42
LQ_EDIT
39,903,426
How can I read a webpage in R and made a data table out of it
<p>Here is the website and there are 5 properties </p> <p><a href="http://cpdocket.cp.cuyahogacounty.us/SheriffSearch/results.aspx?q=searchType%3dZipCode%26searchString%3d44106%26foreclosureType%3d%26dateFrom%3d10%2f6%2f2016+12%3a00%3a00+AM%26dateTo%3d4%2f6%2f2017+11%3a59%3a59+PM" rel="nofollow">http://cpdocket.cp.cuyahogacounty.us/SheriffSearch/results.aspx?q=searchType%3dZipCode%26searchString%3d44106%26foreclosureType%3d%26dateFrom%3d10%2f6%2f2016+12%3a00%3a00+AM%26dateTo%3d4%2f6%2f2017+11%3a59%3a59+PM</a></p> <p>How I can read this website into R and make a table like this out of it</p> <pre><code>Address Prorated_Tax 1462 EAST 115TH STREET $0.00 10531 37 LEE AVE $0.00 10526 ORVILLE AVENUE $0.00 1116 ASHBURY AVENUE $0.00 2780 EAST OVERLOOK $0.00 </code></pre> <p>or Can I do it in Python? </p>
<python><r>
2016-10-06 18:39:54
LQ_CLOSE
39,904,153
Front end "micro services" with Angular 2
<p>I'm looking for a solution for a bit of an odd situation. Let's take a quick look at the angular2-seed project so I can better explain: <a href="https://github.com/mgechev/angular2-seed/tree/master/src/client/app" rel="noreferrer">https://github.com/mgechev/angular2-seed/tree/master/src/client/app</a>.</p> <p>In that project, we have 3 isolated modules - about, home, shared. What I am looking for is a way to isolate development of these, so we're ultimately able to release each piece independently. For example, say Team A is working on the about section, and Team B is working on home. Work is complete for each, and we're ready to release, however we realize the about section is missing a critical piece of functionality, however we still want to release the change to the home section. What we're looking for is a way to achieve this.</p> <p>Here are some solutions already explored, but I'm not really happy with:</p> <ul> <li>Have completely different applications for home/about (in my eyes, this eliminates many of the benefits of a SPA).</li> <li>Have each module (about, home, shared) roll up into it's own NPM package. When we go to deploy, we would have some way to orchestrate pulling in all the published NPM packages for these modules.</li> </ul>
<javascript><angular>
2016-10-06 19:26:44
HQ
39,904,326
How to store UNIX timestamps with MySQL
<p><strong>Some background:</strong></p> <p>My website depends heavily on coordinating users across all kinds of different time zones.</p> <p>I am using Carbon to handle my time zone conversions and calculations on the server side and moment.js on the client.</p> <p>As a result the design choice was made that all date times (e.g. the start time of an event) would be stored as unix timestamps.</p> <p><strong>Problem</strong></p> <p>I am a bit confused by the definition of a "timestamp". In PHPMyAdmin the timestamp is not a unix timestamp but rather a date format:</p> <pre><code>2016-10-06 20:50:46 </code></pre> <p>So if you want to have a default field of the current timestamp then you get the current date in GMT.</p> <p>This makes things more complicated to convert back into a users timezone compared to a unix timestamp integer...</p> <p><strong>Question:</strong></p> <p>What field type should I store my unix timestamps as, currently I am using <code>int(11)</code> with a default of <code>none</code>. By extension... is there a way to store the current unix timestamp (e.g. 1475971200) by default in MySQL?</p>
<php><mysql><date><datetime><unix>
2016-10-06 19:37:27
HQ
39,904,351
Why does proposed `std::shared_ptr::operator[]` take `std::ptrdiff_t` as an argument
<p><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4562.html#memory.smartptr.shared.obs">According to the N4562 proposal, the newly proposed <code>std::shared_ptr::operator[]</code> takes in <code>std::ptrdiff_t</code>, which is a signed type</a>.</p> <p>This is inconsistent with every indexing operator in standard library. Even <code>std::unique_ptr::operator[]</code> takes <code>std::size_t</code>.</p> <p>What's the rationale for this decision?</p>
<c++><c++17>
2016-10-06 19:39:02
HQ
39,904,458
Should my Django site's main page be an app?
<p>I have finished reading the Django official tutorial which teaches how to create a simple polls app, which is the way they chose to teach beginners the Django basics. My question is, now that I know how to make a simple app and want to create my own website (using Django), should the main (front) page of my website, be an app as well? If so, how do people usually call it and configure it? I mean, it should do nothing but render a html template, so why make it so complicated? If not, where do I put all the static files and how do I reference them? I am a bit confused and could use your help. Maybe I misunderstood Django's main use?</p>
<django>
2016-10-06 19:46:02
HQ
39,904,813
Can I write PowerShell binary cmdlet with .NET Core?
<p>I'm trying to create a basic PowerShell Module with a binary Cmdlet internals, cause writing things in PowerShell only doesn't look as convenient as in C#.</p> <p>Following <a href="https://msdn.microsoft.com/en-us/library/dd878342(v=vs.85).aspx">this</a> guide, it looks like I have to:</p> <ul> <li>add <a href="https://powershell.myget.org/feed/powershell-core/package/nuget/Microsoft.PowerShell.SDK">Microsoft.PowerShell.SDK</a> to my <code>project.json</code></li> <li>mark my cmdlet class with required attributes</li> <li>write manifest file, with <code>RootModule</code>, targeting my <code>.dll</code></li> <li>put that <code>.dll</code> nearby manifest</li> <li>put both under <code>PSModulePath</code></li> </ul> <p>but, when I'm trying to <code>Import-Module</code>, PowerShell core complains on missing runtime:</p> <pre><code>Import-Module : Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. At line:1 char:1 </code></pre> <p>Am I doing something wrong, or such tricky things are not supported yet as well?</p>
<c#><powershell><.net-core><cmdlets>
2016-10-06 20:08:43
HQ
39,905,388
Component unit test: By.css() does not match when in SVG namespace
<p>In short, I'm looking for a way to make the predicate <code>By.css([css-selector])</code> (see <a href="https://angular.io/docs/ts/latest/api/platform-browser/index/By-class.html">https://angular.io/docs/ts/latest/api/platform-browser/index/By-class.html</a>) work in Angular2 (v2.0.1+) component unit tests when a namespace (SVG) is involved.</p> <p>(The related predicates <code>By.all()</code> and <code>By.directive(DirectiveClass)</code> work fine.)</p> <p>Below is a self-contained spec to demonstrate the issue. The result is</p> <pre><code>DivComponent class specs: βœ” NG should evaluate component and template. βœ” Div should be locatable by tag. βœ” Div should be locatable by id. βœ” Div should be locatable by class. βœ” Match should fail a negative. ShapesComponent class specs: βœ” NG should evaluate the component and template. βœ– Circle should be locatable by tag. βœ– Circle should be locatable by ns:tag. βœ– Circle should be locatable by id. βœ– Circle should be locatable by class. </code></pre> <p>Spec:</p> <pre><code>import {TestBed, ComponentFixture} from '@angular/core/testing'; import {Component, DebugElement} from '@angular/core'; import {By} from '@angular/platform-browser'; /* * A simple component in HTML namespace */ @Component({ selector: '[app-div]', template: '&lt;div class="myDivClass" id="myDivId"&gt;Hello World&lt;/div&gt;' }) export class DivComponent { } /* * A simple component in SVG namespace */ @Component({ selector: '[app-shape]', template: '&lt;svg:circle class="myCircleClass" id="myCircleId" ' + 'cx="80" cy="80" r="20"&gt;&lt;/svg:circle&gt;' }) export class ShapesComponent { } function dumpElements(elements: DebugElement[]) { console.log('Matcher found ' + elements.length + ' elements.'); for (let i = 0; i &lt; elements.length; i++) { console.log('element[' + i + '] = ' + elements[i].nativeElement.tagName + ': ' + elements[i].nativeElement.outerHTML); } } /* * Test "By.css()" on the DivComponent. */ describe('DivComponent class specs:', () =&gt; { let divComponent: DivComponent; let fixture: ComponentFixture&lt;DivComponent&gt;; let de: DebugElement; beforeEach(() =&gt; { TestBed.configureTestingModule({ declarations: [ DivComponent ] }); TestBed.compileComponents(); fixture = TestBed.createComponent(DivComponent); fixture.detectChanges(); de = fixture.debugElement; }); it('NG should evaluate component and template.', () =&gt; { // Dump elements if needed: // dumpElements(de.queryAll(By.all())); expect(de.queryAll(By.all()).length).toBe(1); }); it('Div should be locatable by tag.', () =&gt; { expect(de.queryAll(By.css('div')).length).toBe(1); }); it('Div should be locatable by id.', () =&gt; { expect(de.queryAll(By.css('#myDivId')).length).toBe(1); }); it('Div should be locatable by class.', () =&gt; { expect(de.queryAll(By.css('.myDivClass')).length).toBe(1); }); it('Match should fail a negative.', () =&gt; { expect(de.queryAll(By.css('#negative')).length).toBe(0); }); }); /* * Use the same "By.css()" syntax on the ShapeComponent. */ describe('ShapesComponent class specs:', () =&gt; { let divComponent: ShapesComponent; let fixture: ComponentFixture&lt;ShapesComponent&gt;; let de: DebugElement; beforeEach(() =&gt; { TestBed.configureTestingModule({ declarations: [ ShapesComponent ] }); TestBed.compileComponents(); fixture = TestBed.createComponent(ShapesComponent); fixture.detectChanges(); de = fixture.debugElement; }); it('NG should evaluate the component and template.', () =&gt; { // Dump elements if needed: // dumpElements(de.queryAll(By.all())); expect(de.queryAll(By.all()).length).toBe(1); // pass }); it('Circle should be locatable by tag.', () =&gt; { expect(de.queryAll(By.css('circle')).length).toBe(1); }); it('Circle should be locatable by ns:tag.', () =&gt; { expect(de.queryAll(By.css('svg:circle')).length).toBe(1); }); it('Circle should be locatable by id.', () =&gt; { expect(de.queryAll(By.css('#myCircleId')).length).toBe(1); }); it('Circle should be locatable by class.', () =&gt; { expect(de.queryAll(By.css('.myCircleClass')).length).toBe(1); }); }); </code></pre>
<svg><angular>
2016-10-06 20:50:15
HQ
39,905,577
c - compile main file with source files and header
<p>I'm trying to compile a main file that uses a header. I have all of the files in my directory: card.c, deck.c header.h, and main.c <a href="https://i.stack.imgur.com/q9qBe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q9qBe.png" alt="enter image description here"></a></p> <p>The issue is that when i do gcc main.c I get this: <a href="https://i.stack.imgur.com/jJUq4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jJUq4.png" alt="enter image description here"></a></p> <p>It seems like it's not recognizing the source and header files so my compiling commands are missing something. Thanks</p>
<c><compilation>
2016-10-06 21:02:56
LQ_CLOSE
39,906,120
Inserting html tags on image at specific positions in html and css
<p>I have this image Map.png. i want to write text these location boxes using html. so that i can change it dynamically. I just do not know how to that.. please give me a direction. <a href="https://i.stack.imgur.com/rrFzo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rrFzo.png" alt="enter image description here"></a></p>
<javascript><jquery><html><css><png>
2016-10-06 21:48:07
LQ_CLOSE
39,906,316
go build with multiple tags
<p>As seen <a href="https://golang.org/pkg/go/build/#hdr-Build_Constraints" rel="noreferrer">here</a>, go build accepts a "tags" flag that will include files that are "tagged," i.e.</p> <pre><code>// +build foo package main .... </code></pre> <p>will be excluded from </p> <pre><code>go build </code></pre> <p>but included in </p> <pre><code>go build -tags=foo </code></pre> <p>Is there a way to include multiple tags? I.e.</p> <pre><code>go build -tags=foo &amp;&amp; bar </code></pre>
<go><build><tags>
2016-10-06 22:03:50
HQ
39,906,815
Vector with 1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9 with the commands rep() and seq()?
I'm having problem to create the vector `1 2 3 4 5 2 3 4 5 6 3 4 5 6 7 4 5 6 7 8 5 6 7 8 9` with the commands `rep()` and `seq()`. Could anyone be able to give me a hint?
<r>
2016-10-06 22:51:15
LQ_EDIT
39,906,893
How does function.apply.bind work in the following code?
<p>So I get that an array of [200,599] is returned from the promise and the callback function inside spread is being passed into Function.apply.bind, but now I'm lost. How is the array of [200,599] split into x and y? How exactly does the apply.bind work?</p> <pre><code>function getY(x) { return new Promise( function(resolve,reject){ setTimeout( function(){ resolve( (3 * x) - 1 ); }, 100 ); } ); } function foo(bar,baz) { var x = bar * baz; // return both promises return [ Promise.resolve( x ), getY( x ) ]; } function spread(fn) { return Function.apply.bind( fn, null ); } Promise.all( foo( 10, 20 ) ) .then( spread( function(x,y){ console.log( x, y ); // 200 599 } ) ) </code></pre>
<javascript><promise><ecmascript-6><bind><apply>
2016-10-06 22:59:29
HQ
39,907,526
Testing abstract classes with arguments on constructor
<p>I'm trying to learn about tests but I'm facing some problems whilst testing abstract classes. I know I could create a concrete subclass that inherit from Dog, like ConcreteDog, but if I add a new abstract method to Dog, I would have to add a empty method to ConcreteDog so. That would not be so cool I guess.</p> <pre><code>public abstract class Dog { private final int id; public Dog(int id) { this.id = id; } public int getId() { return id; } public abstract void makeSound(); } ... public class DogTest { @Test public void testGetId() { int id = 42; // How to pass id to Dog constructor ? Dog dog = Mockito.mock(Dog.class, Mockito.CALL_REAL_METHODS); assertTrue(dog.getId() == id); } } </code></pre> <p>What I'm trying to do is somehow call the Mock with the constructor, like</p> <pre><code>Mockito.mock(Dog(id).class, Mockito.CALL_REAL_METHODS); </code></pre> <p>I don't know if it's possible with mockito, but there is a way of doing that using mockito or another tool ?</p>
<java><mockito>
2016-10-07 00:18:21
HQ
39,907,988
how to make an array of NSStrings?
<p>If anyone knows how to make an array filled with NSStrings i could really use some help with this can't find a good example of this anywhere on the net, this isn't home work because its not due but it is a question that is on a pdf of questions my teacher gave me to study, just can't seem to figure this one out. so if anyone knows an example with some explanation would be great, thanks for taking your time on this.</p>
<ios><objective-c><arrays><nsstring>
2016-10-07 01:24:13
LQ_CLOSE
39,908,163
How to get PyTest fixtures to autocomplete in PyCharm (type hinting)
<p>I had a bear of a time figuring this out, and it was really bugging me, so I thought I'd post this here in case anyone hit the same problem...</p> <p>(and the answer is so dang simple it hurts :-)</p> <p><strong>The Problem</strong></p> <p>The core of the issue is that sometimes, not always, when dealing with fixtures in PyTest that return objects, when you use those fixtures in a test in PyCharm, you don't get autocomplete hints. If you have objects with large numbers of methods you want to reference while writing a test, this can add a lot of overhead and inconvenience to the test writing process. </p> <p>Here's a simple example to illustrate the issue:</p> <p>Let's say I've got a class "event_manager" that lives in:</p> <pre><code>location.game.events </code></pre> <p>Let's further say that in my conftest.py file (PyTest standard thing for the unfamiliar), I've got a fixture that returns an instance of that class:</p> <pre><code>from location.game.events import event_manager ... @pytest.fixture(scope="module") def event_mgr(): """Creates a new instance of event generate for use in tests""" return event_manager() </code></pre> <p>I've had issues sometimes, (but not always - I can't quite figure out why) with classes like this where autocomplete will not work properly in the test code where I use the fixture, e.g.</p> <pre><code>def test_tc10657(self, evt_mgr): """Generates a Regmod and expects filemod to be searchable on server""" evt_mgr.(This does not offer autocomplete hints when you type ".") </code></pre> <p>So the answer is actually quite simple, once you review type hinting in PyCharm: <a href="http://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html" rel="noreferrer">http://www.jetbrains.com/help/pycharm/2016.1/type-hinting-in-pycharm.html</a></p> <p>Here's how to fix the above test code so that autocomplete works properly:</p> <pre><code>from location.game.events import event_manager ... def test_tc10657(self, evt_mgr: event_manager): """Generates a Regmod and expects filemod to be searchable on server""" evt_mgr.(This DOES offer hints when you type "." Yay!) </code></pre> <p>Notice how I explicitly type the fixture as an input parameter of type event_manager.</p>
<pytest>
2016-10-07 01:51:08
HQ
39,908,666
Property is missing in type error
<p>I am having an issue with working through a demo React project. Most of the issues stem from me trying to implement it in Typescript where they are using Javascript. This gist is my app.tsx file.</p> <p><a href="https://gist.github.com/jjuel/59eed01cccca0a7b4f486181f2a14c6c" rel="noreferrer">https://gist.github.com/jjuel/59eed01cccca0a7b4f486181f2a14c6c</a></p> <p>When I run this I get errors pertaining to the interface. </p> <blockquote> <p>ERROR in ./app/app.tsx (38,17): error TS2324: Property 'humans' is missing in type 'IntrinsicAttributes &amp; IntrinsicClassAttributes &amp; AppProps &amp; { children?: ReactElement |...'.</p> <p>ERROR in ./app/app.tsx (38,17): error TS2324: Property 'stores' is missing in type 'IntrinsicAttributes &amp; IntrinsicClassAttributes &amp; AppProps &amp; { children?: ReactElement |...'. webpack: bundle is now VALID.</p> </blockquote> <p>I have no idea what is going on with this. Does anyone know what my issue could be? Thanks!</p>
<reactjs><typescript>
2016-10-07 02:57:00
HQ
39,909,015
What is Type in angular 2?
<p>I have come across the <code>Type</code> keyword at many places in the documentation. For example <a href="https://angular.io/docs/ts/latest/api/core/index/ComponentRef-class.html#!#componentType-anchor" rel="noreferrer">as seen here</a> <code>ComponentRef</code> has the <code>componentType</code> property. It is said to be of type <code>Type&lt;any&gt;</code>. On further searching I find <a href="https://angular.io/docs/ts/latest/api/core/index/Type-decorator.html" rel="noreferrer">this entry</a> about it on the docs. It says: <em>Invoke as ES7 decorator</em>.</p> <p>Also on looking <a href="https://github.com/angular/angular/blob/2.0.1/modules/%40angular/core/src/type.ts#L19-L19" rel="noreferrer">up the source</a> on github , I find these comments :</p> <pre><code>/** * @whatItDoes Represents a type that a Component or other object is instances of. * * @description * * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by * the `MyCustomComponent` constructor function. </code></pre> <p>However I am still not clear as to what <code>Type</code> does. Am I missing something basic ?? </p>
<angular><typescript>
2016-10-07 03:44:18
HQ
39,909,805
How to properly implement the Equatable protocol in a class hierarchy?
<p>I'm trying to implement the <code>==</code> operator (from <code>Equatable</code>) in a base class and its subclasses in Swift 3. All of the classes will only be used in Swift so I do not want to involve <code>NSObject</code> or the <code>NSCopying</code> protocol.</p> <p>I started with a base class and a subclass:</p> <pre><code>class Base { var x : Int } class Subclass : Base { var y : String } </code></pre> <p>Now I wanted to add <code>Equatable</code> and the <code>==</code> operator to <code>Base</code>. Seems simple enough. Copy the <code>==</code> operator signature from the documentation:</p> <pre><code>class Base : Equatable { var x : Int static func == (lhs: Base, rhs: Base) -&gt; Bool { return lhs.x == rhs.x } } </code></pre> <p>So far so good. Now for the subclass:</p> <pre><code>class Subclass : Base { static override func == (lhs: Base, rhs: Base) -&gt; Bool { return true } } </code></pre> <p>But this results in an error:</p> <blockquote> <p>Operator function overrides a 'final' operator function</p> </blockquote> <p>OK. After some research (still learning Swift 3) I learn that <code>static</code> can be replaced with <code>class</code> to indicate the type method can be overridden.</p> <p>So I attempt to change <code>static</code> to <code>class</code> in <code>Base</code>:</p> <pre><code>class Base : Equatable { var x : Int class func == (lhs: Base, rhs: Base) -&gt; Bool { return lhs.x == rhs.x } } </code></pre> <p>But that results in a new error:</p> <blockquote> <p>Operator '==' declared in non-final class 'Base' must be 'final'</p> </blockquote> <p>Ugh. This is far more complicated than it should be.</p> <p>How do I implement the <code>Equatable</code> protocol and the <code>==</code> operator properly in a base class and a subclass?</p>
<swift><subclass><swift3><equatable>
2016-10-07 05:08:10
HQ
39,909,945
try exception inside a for loop
i trying to build a for loop with an exception, this is the code: for( $i = 1; $i <= $contxf; $i++) { try{ if($i = $icheck) { throw new Exception('Current Page'); } echo '<a href="?pag='.$i.'">'. $i .'</a>&nbsp'; } catch (Exception $cp) { echo $i; $i = $i + 1; } But with this code the loop don't continue to add 1 to $i
<php>
2016-10-07 05:20:00
LQ_EDIT
39,910,357
generation of postscript and merging using fop and java
how to generate PS file using fop and java, i want to merge multiple PS file into a single PS file using java. I have tried to generate PS file using fop but i am getting font embedded like some hex code such as: currentfile eexec 743F8413F3636CA85A9FFEFB50B4BB27302A5A63F932884E18BF5153AD36053037D1C6CD04294AF6 A35612DB9108AC8514CB5C4A8469971B75A09F9E662068B0685490EA8C73F2DE2FBBCF85D15AB938 5E529DAB15A40D408002E88D0C107F711BC66BF0F2E92FDDC6B188F91EEB6B86050D5032E6ABCB11 E343C6D795217B5973972E99A9420651ACF3B8FD4CAD1DA4B00642AD077A5B86240F89F2BC011009 CB2CF173FF68E9A88F0018F187D5E036FE8D904F211842FF01AA7CAADDEB9E5A534FA3F90BDB8F6F FE24F7AC6E7BD0A74CF29EBBA568F06579E7B94525361F129F4F81EE9D544CFEFB99016F6E9A016E B88F88C24726C9A599025E44462A175261626CE6EBAFB69756CC45D96FA04CF97B4A02B39C9F19C2 877B8CE3851E452934959B271BE3E0B169FC27C16FD23870F5BD117BADD10D56110795B27E4C18B8 FC1D4F2E23D69F032AD8BD2BA0DD229DF0F7531E572FA98036D5B425C4014559DEBFE1A4E7751D76 9A35ED5B80952DCA3908E603FC74D8EAFDCEC4F7485178235EDD900910F0DAFA48A518EBFF47CAE5 DEDDE9F4CD4D7C145E4B251BCBAFE60D78443E0644A37FB449E0FC66563DF4C8A55D73D939F86D1F 1D034B251E7F0EA3F68A549B809EF2C2A2DEAE6BD87BA1911799C6D56B59EA08B6BB183DB097481B 6A3DBEDCAC24C85DD2E082C79227338E9231AD1DF384DB40D108413FFE0DA0192ABE57D70170871C 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 cleartomark Thanks for help in advance.
<java><postscript><apache-fop>
2016-10-07 05:55:21
LQ_EDIT
39,910,444
Difference between Number and Integer in SQL Datatypes?
<p>i want to know the basic difference between sql datatype Number and Integer. </p>
<sql>
2016-10-07 06:03:53
LQ_CLOSE