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
38,689,271
Issue creating a save as function in python
Im trying to create a function to save data taken from multiple Entry widgets in my code and create a new save file storing the data from all the entries, i made a entry list called entries and try to pull from that but cant get it quite right. It will create the file but its always blank. This is the code for my save as function using tkinter widgets. def file_save_as(self): fout = asksaveasfile(mode = 'a', defaultextension = '.txt') with open('fout', 'a') as f: for entry in self.entries: f.write("%s\n" % entry)
<python><file><tkinter><save>
2016-07-31 23:31:21
LQ_EDIT
38,689,648
React - how to pass state to another component
<p>I'm trying to figure out how to notify another component about a state change. Let's say I have 3 components - App.jsx,Header.jsx,and SidebarPush.jsx and all I'm simply trying to do is toggle a class with an onClick.</p> <p>So the Header.jsx file will have 2 buttons when clicked will toggle the states to true or false. The other 2 components App.jsx and Header.jsx will need to know about these state changes so they can toggle a class whenever those states change.</p> <h2>App.jsx</h2> <pre><code>import React from 'react'; import Header from 'Header'; import classNames from "classnames"; import SidebarPush from 'SidebarPush'; import PageWrapper from 'PageWrapper'; var MainWrapper = React.createClass({ render: function() { return ( &lt;div className={classNames({ 'wrapper': false, 'SidebarPush-collapsed': !this.state.sidbarPushCollapsed })}&gt; &lt;Header/&gt; &lt;SidebarPush/&gt; &lt;PageWrapper&gt; {this.props.children} &lt;/PageWrapper&gt; &lt;/div&gt; ); } }); module.exports = MainWrapper; </code></pre> <h2>Header.jsx</h2> <pre><code>import React from 'react'; import ReactDom from 'react-dom'; class Header extends React.Component { constructor() { super(); this.state = { sidbarPushCollapsed: false, profileCollapsed: false }; this.handleClick = this.handleClick.bind(this); } handleClick() { this.setState({ sidbarPushCollapsed: !this.state.sidbarPushCollapsed, profileCollapsed: !this.state.profileCollapsed }); } render() { return ( &lt;header id="header"&gt; &lt;ul&gt; &lt;li&gt; &lt;button type="button" id="sidbarPush" onClick={this.handleClick} profile={this.state.profileCollapsed}&gt; &lt;i className="fa fa-bars"&gt;&lt;/i&gt; &lt;/button&gt; &lt;/li&gt; &lt;li&gt; &lt;button type="button" id="profile" onClick={this.handleClick}&gt; &lt;i className="icon-user"&gt;&lt;/i&gt; &lt;/button&gt; &lt;/li&gt; &lt;/ul&gt; &lt;ul&gt; &lt;li&gt; &lt;button id="sidbarOverlay" onClick={this.handleClick}&gt; &lt;i className="fa fa-indent"&gt;&lt;/i&gt; &lt;/button&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/header&gt; ); } }; module.exports = Header; </code></pre> <h2>SidebarPush.jsx</h2> <pre><code>import React from 'react'; import ReactDom from 'react-dom'; import classNames from "classnames"; class SidebarPush extends React.Component { render() { return ( &lt;aside className="sidebarPush"&gt; &lt;div className={classNames({ 'sidebar-profile': true, 'hidden': !this.state.pagesCollapsed })}&gt; .... &lt;/div&gt; &lt;nav className="sidebarNav"&gt; .... &lt;/nav&gt; &lt;/aside&gt; ); } } export default SidebarPush; </code></pre>
<reactjs><components><state>
2016-08-01 00:47:48
HQ
38,689,937
What does an _ (underline character) on the left side of a C# lambda operator mean?
<p>What does an _ (underline character) on the left side of a C# lambda operator mean? as in:</p> <pre><code> Movment = this.FixedUpdateAsObservable() .Select(_ =&gt; { var x = Input.GetAxis("Horizontal"); var y = Input.GetAxis("Vertical"); return new Vector2(x, y).normalized; } ); </code></pre>
<c#><lambda>
2016-08-01 01:41:55
LQ_CLOSE
38,690,086
How do i get my activity time to update every minute not just on create
public class MainActivity extends ActionBarActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) {`enter code here` super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); TimeZone tz = TimeZone.getTimeZone("Atlantic/St_Helena"); Calendar c = Calendar.getInstance(tz); String timez = String.format("Year "+"%02d" , c.get(Calendar.YEAR)) Display formattedDate value in TextView TextView time = new TextView(this); time.setText("Its"+timez+" PM"+"\n\n"+"Ants stretch when they wake up in the morning."); time.setGravity(Gravity.TOP); time.setTextSize(20); setContentView(time); }}
<android>
2016-08-01 02:07:54
LQ_EDIT
38,691,495
how to get all the sequences and columns to which sequence is applied using single query in psql ? any direct or indirect way to get the list?
I want **to get all the sequences created, tables and columns to which that sequence is applied in a database** using a **single query** in **PostgreSQL**. Any direct or indirect method is helpful.
<sql><postgresql><database-sequence>
2016-08-01 05:20:43
LQ_EDIT
38,692,483
VB.NET help slicing a substring
Trying to slice a sub-string out of a string and though I have searched the site, I have found methods of both searching for a sub-string, and slicing a string but only for the first instance of the slice bound. Bellow is what I am trying to do: string = "abcdabcdabcdabcd" I want to cut out each of the b's using the bounds a and c to identify them. I am new to posting on the forum, though I have read through the site when I have needed help with solutions in the past. I am very rusty at coding, and I was hoping someone could point me in the right direction. Thanks.
<vb.net>
2016-08-01 06:43:55
LQ_EDIT
38,692,897
ViewDragHelper - Child layout changes ignored while dragging
<p>I'm trying to apply margin updates or animations to a child view which parent is dragged using a <code>ViewDragHelper</code>.</p> <p>However the updated layout properties have no effect and are not rendered while the view is dragged. Everything from adding and removing views, to layout animations or layout param updates are ignored while dragging:</p> <p>To illustrate this issue, i've created a delayed runnable which updates the height of a view (the green view) after 3 seconds:</p> <pre><code>spacer.postDelayed(new Runnable() { @Override public void run() { Log.d(TAG,"set layout params!!!!"); ViewGroup.LayoutParams spacerParams = spacer.getLayoutParams(); spacerParams.height = (int) (200+(Math.random()*200)); spacer.setLayoutParams(spacerParams); } },3000); </code></pre> <p>Check this demo screen recording: <a href="http://imgur.com/a/dDiGt">http://imgur.com/a/dDiGt</a></p>
<android><android-layout>
2016-08-01 07:11:20
HQ
38,693,259
Access email inbox using php
<p>I want to display email inbox of any free email service like yahoo or rediff using php. How can i do this ?</p>
<php>
2016-08-01 07:33:59
LQ_CLOSE
38,693,992
Notice: ob_end_flush(): failed to send buffer of zlib output compression (1) in
<p>I don't have any problem on localhost. but when i tested my codes on server, end of every page i see this notice.</p> <p>my code:</p> <pre><code>&lt;?php ob_start(); include 'view.php'; $data = ob_get_contents(); ob_end_clean(); include 'master.php'; ob_end_flush(); // Problem is this line </code></pre>
<php><buffer><zlib>
2016-08-01 08:18:10
HQ
38,694,004
Why am I being cahrged on the very first day of Blumix trial?
i signed up bluemix, so i am on trial account I have started learning Kitura along the tutorial https://developer.ibm.com/swift/2016/07/06/tutorial-deploying-a-swift-to-do-list-app-to-the-cloud/#comment-2218 I uploaded the files a several time to make the server run (actually the tutorial gave me wrong link for the files) now it works. but I saw my Runtime Cost is $289. [![enter image description here][1]][1] [![enter image description here][2]][2] I have not added any support plan although I have not put my credit card info yet, is that what is going to be charged after Trial or for every month ? Why am I being charged anyway? nearly $300 is too high for testing a server. Would you explain about the Runtime Cost that I am currently being charged please? [1]: http://i.stack.imgur.com/oeCdv.jpg [2]: http://i.stack.imgur.com/d1bT2.jpg
<ibm-cloud><trial>
2016-08-01 08:18:39
LQ_EDIT
38,694,111
Is it thread-safe when using tf.Session in inference service?
<p>Now we have used TensorFlow to train and export an model. We can implement the inference service with this model just like how <code>tensorflow/serving</code> does.</p> <p>I have a question about whether the <code>tf.Session</code> object is thread-safe or not. If it's true, we may initialize the object after starting and use the singleton object to process the concurrent requests.</p>
<python><multithreading><tensorflow><tensorflow-serving>
2016-08-01 08:24:48
HQ
38,694,645
Which Design pattern should i use to maintain pre initialized set of objects?
<p>I have some pre initialized objects of some class. These objects are heavy weight objects and each correspond to some configuration options specified by user. There will be exactly one instance corresponding to one configuration and same will be used every time.</p> <p>My question is, which design pattern suits best to handle this kind of situation?</p>
<java><design-patterns>
2016-08-01 08:54:01
LQ_CLOSE
38,695,094
Wordpress: Theme Check - Allowable exception issue on Envato
<p>Before I submit my WordPress theme to Envato, I've checked my WordPress theme using Theme Check plugin andI found these issue:</p> <pre><code>Warning: More than one text-domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs. WARNING: The theme uses the add_shortcode() function. Custom post-content shortcodes are plugin-territory functionality. We strongly recommend adding a WARNING: Found ini_set in the file library/functions/MCAPI.class.php. Themes should not change server PHP settings. Line 2829: ini_set('arg_separator.output', '&amp;'); Line 2833: ini_set('arg_separator.output', $orig_sep); WARNING: library/wp_init.php. User levels were deprecated in 2.0. Please see Roles_and_Capabilities Line 692: if ( !current_user_can( 'level_5' ) ) { WARNING: file_put_contents was found in the file library/addons/google-sign-in/cache/Google_FileCache.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls. Line 124: if (! @file_put_contents($storageFile, $data)) { WARNING: curl_init was found in the file library/addons/google-sign-in/io/Google_CurlIO.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls. Line 94: $ch = curl_init(); WARNING: curl_exec was found in the file library/addons/google-sign-in/io/Google_CurlIO.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls. Line 112: $respData = curl_exec($ch); Line 119: $respData = curl_exec($ch); WARNING: .htaccess Hidden Files or Folders found. REQUIRED: You are not allowed to hide the admin bar. REQUIRED: The theme uses the register_taxonomy() function, which is plugin-territory functionality. REQUIRED: The theme uses the register_post_type() function, which is plugin-territory functionality. REQUIRED: The theme must not used the tags. REQUIRED: The theme must not call to wp_title(). REQUIRED: The tags can only contain a call to wp_title(). Use the wp_title filter to modify the output REQUIRED: No reference to add_theme_support( "title-tag" ) was found in the theme. REQUIRED: wp_get_http() found in the file library/admin/import/class.wordpress-importer.php. Deprecated since version 4.4. Use WP_Http instead. Line 908: $headers = wp_get_http( $url, $upload['file'] ); REQUIRED: screen_icon() found in the file library/functions/class-tgm-plugin-activation.php. Deprecated since version 3.8. Line 403: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) ); Line 1599: screen_icon( apply_filters( 'tgmpa_default_screen_icon', 'themes' ) ); REQUIRED: screen_icon() found in the file library/admin/import/class.wordpress-importer.php. Deprecated since version 3.8. Line 1038: screen_icon(); REQUIRED: library/functions/class-tgm-plugin-activation.php. Themes should use add_theme_page() for adding admin pages. Line 370: add_submenu_page( $args['parent_slug'], $args['page_title'], $args['menu_ti REQUIRED: library/admin/theme-settings.php. Themes should use add_theme_page() for adding admin pages. Line 133: add_submenu_page( REQUIRED: library/admin/theme-settings.php. Themes should use add_theme_page() for adding admin pages. Line 122: add_menu_page( REQUIRED: library/admin/import/theme-import.php. Themes should use add_theme_page() for adding admin pages. REQUIRED: library/admin/export/theme-export.php. Themes should use add_theme_page() for adding admin pages. REQUIRED: bloginfo( 'url') was found in the file library/shortcodes/search-form/search-form.php. Use echo esc_url( home_url() ) instead. Line 120: '&gt; REQUIRED: Zip file found. Plugins are not allowed in themes. The zip file found was js_composer.zip ultimate_vc_addons.zip. RECOMMENDED: Screenshot size should be 1200x900, to account for HiDPI displays. Any 4:3 image size is acceptable, but 1200x900 is preferred. RECOMMENDED: Possible variable $title found in translation function in library/define.php. Translation function calls must NOT contain PHP variables. Line 333: '&gt;&lt;?php _e($title, 'text-domain');?&gt; RECOMMENDED: Possible variable $sub_title found in translation function in library/define.php. Translation function calls must NOT contain PHP variables. Line 341: &lt;?php e($subtitle, 'text-domain');?&gt; RECOMMENDED: Possible variable $portal found in translation function in templates/parts/part-add-item-step1.php. Translation function calls must NOT contain PHP variables. Line 181: ,__($portal,'text-domain') RECOMMENDED: Possible variable $offer found in translation function in library/classes/theme-directory-meta.php. Translation function calls must NOT contain PHP variables. Line 155: &lt;?php _e($offer, 'text-domain');?&gt; RECOMMENDED: Possible variable $theme_tso found in translation function in templates/parts/part-single-reviews.php. Translation function calls must NOT contain PHP variables. Line 27: &lt;?php e($themetso-&gt;get('rating_alert_content'), 'text-domain');?&gt; RECOMMENDED: Possible variable $theme_tso found in translation function in templates/parts/part-single-reviews.php. Translation function calls must NOT contain PHP variables. Line 15: &lt;?php e($themetso-&gt;get('rating_alert_header', __('Total Reviews','text-domain')) RECOMMENDED: Possible variable $theme_this_taxonomy found in translation function in tag.php. Translation function calls must NOT contain PHP variables. Line 27: &lt;?php printf( _( '{$themethis_taxonomy} Archives: %s', 'text-domain' ), '' . singl RECOMMENDED: Possible variable $theme_this_regist found in translation function in library/shortcodes/theme-item-time-line/theme-item-time-line.php. Translation function calls must NOT contain PHP variables. Line 283: , 'week' =&gt; _(datei18n( 'l', $theme_this_regist ), 'text-domain' ) RECOMMENDED: Possible variable $theme_this_regist found in translation function in library/shortcodes/theme-item-time-line/theme-item-time-line.php. Translation function calls must NOT contain PHP variables. Line 282: , 'day' =&gt; _( date( 'd', $themethis_regist ), 'text-domain' ) RECOMMENDED: Possible variable $theme_this_regist found in translation function in library/shortcodes/theme-item-time-line/theme-item-time-line.php. Translation function calls must NOT contain PHP variables. Line 281: , 'month' =&gt; _( datei18n( 'F', $theme_this_regist ), 'text-domain' ) RECOMMENDED: Possible variable $theme_this_author found in translation function in templates/parts/part-single-contact.php. Translation function calls must NOT contain PHP variables. Line 24: &lt;?php if($theme_this_author-&gt;get('user_email')!='') esc_html_e( _('Email', 'text-domain').': '.$themethis_author-&gt;get('user_email') ); RECOMMENDED: Possible variable $theme_this_author found in translation function in templates/parts/part-single-contact.php. Translation function calls must NOT contain PHP variables. Line 23: &lt;?php if($theme_this_author-&gt;get('phone')!='') esc_html_e( _('Phone', 'text-domain').': '.$themethis_author-&gt;get('phone') );?&gt;&lt;/l RECOMMENDED: Possible variable $theme_custom_item_label found in translation function in templates/parts/part-single-reviews.php. Translation function calls must NOT contain PHP variables. Line 7: echo apply_filters('theme_shortcode_title', _($themecustom_item_label-&gt;get('ratings', 'Ratings'), 'text-domain'), get_ RECOMMENDED: Possible variable $theme_custom_item_label found in translation function in library/functions/callback-get-map-brief.php. Translation function calls must NOT contain PHP variables. Line 46: &lt;?php printf('%s : %.1f /%d', _($themecustom_item_label-&gt;get('ratings', 'Ratings'), 'text-domain'), (flo RECOMMENDED: Possible variable $theme_custom_item_label found in translation function in library/dashboard/mypage-add-event.php. Translation function calls must NOT contain PHP variables. Line 71: ' class='form-control' placeholder='&lt;?php e($themecustom_item_label-&gt;get('events', 'Events').' Title', 'text-domain' RECOMMENDED: Possible variable $theme_custom_item_label found in translation function in library/dashboard/mypage-add-event.php. Translation function calls must NOT contain PHP variables. Line 48: &lt;?php echo empty($edit)? _('Add '.$themecustom_item_label-&gt;get('events', 'Events'), 'text-domain') RECOMMENDED: Possible variable $theme_custom_item_label found in translation function in library/dashboard/mypage-add-event.php. Translation function calls must NOT contain PHP variables. Line 48: &lt;?php echo empty($edit)? _('Add '.$themecustom_item_label-&gt;get('events', 'Events'), 'text-domain') : _('Edit '.$themecustom_item_label-&gt;get('events', 'Events'), 'text-domain') RECOMMENDED: Possible variable $field found in translation function in library/admin/assets/theme-settings-rating.php. Translation function calls must NOT contain PHP variables. Line 40: , __($field, 'text-domain') RECOMMENDED: Possible variable $default found in translation function in library/classes/theme-directory-meta.php. Translation function calls must NOT contain PHP variables. Line 114: $theme_return = __( $default , 'text-domain' ); RECOMMENDED: Possible variable $cvalue found in translation function in woocommerce/cart/shipping-calculator.php. Translation function calls must NOT contain PHP variables. Line 53: echo '' . _( eschtml( $cvalue ), 'woocommerce' ) .''; RECOMMENDED: wp_get_http() found in the file library/admin/import/class.wordpress-importer.php. Deprecated since version 4.4. Use WP_Http instead. Line 908: $headers = wp_get_http( $url, $upload['file'] ); INFO: Possible Favicon found in header.php. Favicons are handled by the Site Icon setting in the customizer since version 4.3. INFO: templates/tp-blogs.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, thenget_template_part() should be used instead. Line 18: INFO: library/functions/callback-theme-map.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 145: $theme_this_posts_args['include'] = (Array) $theme_this_user_favorite_posts ; INFO: library/addons/google-sign-in/contrib/Google_ShoppingService.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 34: * @opt_param string facets.include Facets to include (applies when useGcsConfig == false) Line 151: INFO: library/addons/google-sign-in/cache/Google_Cache.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 18: Line 19: INFO: library/addons/google-sign-in/auth/Google_Verifier.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 18: INFO: library/addons/google-sign-in/auth/Google_Signer.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 18: INFO: library/addons/google-sign-in/auth/Google_OAuth2.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 18: Line 19: Line 20: INFO: library/addons/google-sign-in/auth/Google_Auth.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 18: Line 19: INFO: library/addons/google-sign-in/Google_Client.php The theme appears to use include or require. If these are being used to include separate sections of a template from independent files, then get_template_part() should be used instead. Line 39: Line 43: require_once (dirname(FILE) . '/local_config.php'); Line 48: require_once 'service/Google_Model.php'; Line 49: require_once 'service/Google_Service.php'; Line 50: require_once 'service/Google_ServiceResource.php'; Line 51: require_once 'auth/Google_AssertionCredentials.php'; Line 52: require_once 'auth/Google_Signer.php'; Line 53: require_once 'auth/Google_P12Signer.php'; Line 54: require_once 'service/Google_BatchRequest.php'; Line 55: require_once 'external/URITemplateParser.php'; Line 56: require_once 'auth/Google_Auth.php'; Line 57: require_once 'cache/Google_Cache.php'; Line 58: require_once 'io/Google_IO.php'; Line 59: require_once('service/Google_MediaFileUpload.php'); INFO: iframe was found in the file library/functions/process.php iframes are sometimes used to load unwanted adverts and code on your site. Line 393: , 'html' =&gt; (!empty($theme_attachment_video)? sprintf('', $theme_attachment_v INFO: iframe was found in the file library/admin/post-meta-box.php iframes are sometimes used to load unwanted adverts and code on your site. Line 1274: Iframe Input --&gt; Line 1280: iFrame Code', 'text-domain');?&gt; Line 1879: , 'html' =&gt; (!empty($theme_attachment_video)? sprintf('', $theme_attachment_vi </code></pre> <p><strong>To avoid the theme rejection by Envato, are there some issues above that allowed by Envato reviewer?</strong></p> <p>I really appreciate any help!</p> <p>Thank you.</p>
<php><wordpress><themes>
2016-08-01 09:17:12
LQ_CLOSE
38,695,455
How Static function in C reduce memory footprints?
<p>I've recently learned that declare functions or/and variables as static can reduce footprints, but I can't figured out why. Most article online focus on the scope and readability but not mentioned any benefit about memory allocation. Does "static" really improve performance?</p>
<c>
2016-08-01 09:34:08
LQ_CLOSE
38,696,081
How to change Cookie Processor to LegacyCookieProcessor in tomcat 8
<p>My code is working on tomcat 8 version 8.0.33 but on 8.5.4 i get : An invalid domain [.mydomain] was specified for this cookie.</p> <p>I have found that Rfc6265CookieProcessor is introduced in tomcat 8 latest versions.</p> <p>It says on official doc that this can be reverted to LegacyCookieProcessor in context.xml but i don't know how.</p> <p>Please let me know how to do this.</p> <p>Thanks</p>
<java><cookies><tomcat8>
2016-08-01 10:03:21
HQ
38,696,211
Xcode does not generate dSYM file
<p>In my iOS Project, I have set the <code>Generate Debug Symbols</code> to be <code>Yes</code>, but the .dYSM file is not created in DerivedData folder. I am running this application on my iPhone. Because I need it to map it to do the time profiler, because time profiler shows all the symbols in hex address. That has to be symbolicated to identify the time taking tasks.</p> <p>Thanks in advance.</p>
<ios><xcode><instruments><build-settings>
2016-08-01 10:10:36
HQ
38,696,352
why my lisview blinks when i perform notifydata setchange
This is the below code rowView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { for(int i=0;i<getCount();i++){ getItem(i).setSelected(false); } getItem(position).setSelected(true); mSelectedOption=getItem(position); notifyDataSetChanged(); } }); my listview blinks when this code is executed.Is there any method to avoid this.
<android><android-layout><listview>
2016-08-01 10:18:30
LQ_EDIT
38,696,355
How to calculate GMT Time based on Local time in C
<p>I have a linx based system where we cannot specify timezone of the time being set. So whoever sets time on this device sets their localtime. Now I have a requirement where I need to calculate the GMT Time based on the localtime that was existing on the device. </p> <p>I guess I need to be taking the input of timezone the user is located in some variable. For Example timezone = EST-5:00EDT which means the local time is 5 hours behind the GMT Time. </p> <p>Now do we have any functions in standard C Library which will calculate the GMT Time for me when I pass the offset. </p> <p>Any help in this regard is highly appreciated. I searched through web and all I could find is only these functions in the below link: <a href="http://linux.die.net/man/3/localtime_r" rel="nofollow">http://linux.die.net/man/3/localtime_r</a>. I could not find any function which can calculate the time based on offset. </p> <p>Is there any other approach to handle this. </p>
<c><linux><time><gnu><libc>
2016-08-01 10:18:35
LQ_CLOSE
38,696,944
How to put log file in user home directory in portable way in logback?
<p>I would like to put log file into user home directory.</p> <p>How to do that in portable way, i.e. working on Windows, Linux and Mac?</p>
<java><logging><logback><portability>
2016-08-01 10:51:05
HQ
38,697,565
I want to break my monolithic to microservices but I'm still stuck on it. Need advise
<p>So far, my developing application is planned to be available on web and mobile so I decided to do it as microservice.</p> <p>What my app can do so far is listed below:</p> <ul> <li>Sign up (email, username, password, password_confirmation)</li> <li>Sign in (email, password)</li> <li>Sign in using Facebook (automatically sign in if email is exist in db, or create new record then automatically sign in when email is not exist in db)</li> <li>View articles</li> <li>Post articles</li> <li>Edit articles</li> <li>Delete articles</li> </ul> <p>As actions above, <strong>how many services should I break into</strong>? <em>I'm not sure to split every actions in to service like sign-up-service / sign-in-service or group it up as user-service is the right way.</em></p> <p>An another question, <strong>when I split services separately how can I get articles data with the authors to render on my sites?</strong> <em>Build new broker service which get articles data within article-service then get author data within user-service after that</em>? Or, broker service is no needed, just simply get articles data then author data in my web-application controller.</p>
<architecture><microservices>
2016-08-01 11:21:48
LQ_CLOSE
38,697,656
Testing Angular2 components that use setInterval or setTimeout
<p>I have a fairly typical, simple ng2 component that calls a service to get some data (carousel items). It also uses setInterval to auto-switch carousel slides in the UI every n seconds. It works just fine, but when running Jasmine tests I get the error: "Cannot use setInterval from within an async test zone".</p> <p>I tried wrapping the setInterval call in this.zone.runOutsideAngular(() => {...}), but the error remained. I would've thought changing the test to run in fakeAsync zone would solve the problem, but then I get an error saying XHR calls are not allowed from within fakeAsync test zone (which does make sense).</p> <p>How can I use both the XHR calls made by the service and the interval, while still being able to test the component? I'm using ng2 rc4, project generated by angular-cli. Many thanks in advance.</p> <p>My code from the component:</p> <pre><code>constructor(private carouselService: CarouselService) { } ngOnInit() { this.carouselService.getItems().subscribe(items =&gt; { this.items = items; }); this.interval = setInterval(() =&gt; { this.forward(); }, this.intervalMs); } </code></pre> <p>And from the Jasmine spec: </p> <pre><code>it('should display carousel items', async(() =&gt; { testComponentBuilder .overrideProviders(CarouselComponent, [provide(CarouselService, { useClass: CarouselServiceMock })]) .createAsync(CarouselComponent).then((fixture: ComponentFixture&lt;CarouselComponent&gt;) =&gt; { fixture.detectChanges(); let compiled = fixture.debugElement.nativeElement; // some expectations here; }); })); </code></pre>
<javascript><unit-testing><typescript><angular><jasmine>
2016-08-01 11:27:00
HQ
38,698,676
Andriod studio "do while" to choose the variable created in the MainActivity
I trying to do automated android program to open the website listed in the variables. Please review the program shown in the photo. my program is not success to operation due to the error on the highlighted area, not sure which code can use to combine the string. [Photo][1] [1]: http://i.stack.imgur.com/q4DNU.png
<android><do-while>
2016-08-01 12:17:59
LQ_EDIT
38,699,234
How can I view Threads window in Visual studio?
<p>In visual studio, it should be in Debug> Windows> Threads. But mine doesn't have it!</p> <p><a href="https://i.stack.imgur.com/YyLU6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/YyLU6.png" alt="enter image description here"></a></p>
<visual-studio><visual-studio-2015>
2016-08-01 12:42:44
HQ
38,699,647
Why $_GET won't work with sessions
I'am getting varriable value from other page and why it's not working. Here is the code: Page 1: <h1 align="center"> <form name="form" action="" method="get"> <input type="text" name="wonorlose" id="wonorlose" value="50"> </form> </h1> On button push: <script> function rollHead(){ var die1 = document.getElementById("die1"); var status = document.getElementById("status"); var d1 = Math.floor(Math.random() * 2) + 1; <?php $_SESSION['wonorlose'] = $_GET["wonorlose"]; ?> if(d1 == 1) { die1.innerHTML = "You lose!"; fliped.innerHTML = "Fliped Tail!"; var ajax = new XMLHttpRequest(); ajax.open('POST','lose.php',true); ajax.send(); } else if (d1 == 2) { die1.innerHTML = "You won!"; fliped.innerHTML = "Fliped Head!"; var ajax = new XMLHttpRequest(); ajax.open('POST','won.php',true); ajax.send(); } } </script> Page 2: $_SESSION['wonorlose'] = $wonorlose; echo $wonorlose; mysql_query("UPDATE `users` SET money=money+'$wonorlose' WHERE user_id=".$_SESSION['user']); P.S rool system works and I get message won or lose but nothing happens in my database...
<php><jquery><session>
2016-08-01 13:02:24
LQ_EDIT
38,699,786
Hello Word Device Tree Based device driver
<p>I have read and almost gone through all the linux kernel documentation on the device tree and device tree overlays.I am not able to understand if we have to create a new entree in the device tree of the platform or to create a new overlay for the device for a new driver based on device tree. I am looking for a simple led glowing driver example where led is connected to GPIO pin and its configuration is mentioned in the device tree overlay or device tree fragment on the board's platform.How can it be build/pushed and tested using the user space application.</p>
<linux-kernel><linux-device-driver><embedded-linux><device-tree>
2016-08-01 13:09:12
HQ
38,700,721
Reflection with generic syntax fails on a return parameter of an overridden method
<p>To avoid old-fashioned non-generic syntax when searching for attributes of a known type, one usually uses the extension methods in <a href="https://msdn.microsoft.com/en-us/library/system.reflection.customattributeextensions.aspx"><code>System.Reflection.CustomAttributeExtensions</code> class</a> (since .NET 4.5).</p> <p>However this appears to fail if you search for an attribute on the <em>return parameter</em> of an overridden method (or an accessor of an overridden property/indexer).</p> <p>I am experiencing this with .NET 4.6.1.</p> <p>Simple reproduction (complete):</p> <pre><code>using System; using System.Reflection; namespace ReflectionTrouble { class B { //[return: MyMark("In base class")] // uncommenting does not help public virtual int M() =&gt; 0; } class C : B { [return: MyMark("In inheriting class")] // commenting away attribute does not help public override int M() =&gt; -1; } [AttributeUsage(AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = false)] // commenting away AttributeUsage does not help sealed class MyMarkAttribute : Attribute { public string Descr { get; } public MyMarkAttribute(string descr) { Descr = descr; } public override string ToString() =&gt; $"MyMark({Descr})"; } static class Program { static void Main() { var derivedReturnVal = typeof(C).GetMethod("M").ReturnParameter; // usual new generic syntax (extension method in System.Refelction namespace): var attr = derivedReturnVal.GetCustomAttribute&lt;MyMarkAttribute&gt;(); // BLOWS UP HERE, System.IndexOutOfRangeException: Index was outside the bounds of the array. Console.WriteLine(attr); // old non-generic syntax without extension method works: var attr2 = ((MyMarkAttribute[])(derivedReturnVal.GetCustomAttributes(typeof(MyMarkAttribute), false)))[0]; // OK Console.WriteLine(attr2); } } } </code></pre> <p>The code may look "too long to read", but it is really just an overridden method with an attribute on its return parameter and the obvious attempt to retrieve that attribute instance.</p> <p>Stack trace:</p> <pre>Unhandled Exception: System.IndexOutOfRangeException: Index was outside the bounds of the array. at System.Attribute.GetParentDefinition(ParameterInfo param) at System.Attribute.InternalParamGetCustomAttributes(ParameterInfo param, Type type, Boolean inherit) at System.Attribute.GetCustomAttributes(ParameterInfo element, Type attributeType, Boolean inherit) at System.Attribute.GetCustomAttribute(ParameterInfo element, Type attributeType, Boolean inherit) at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](ParameterInfo element) at ReflectionTrouble.Program.Main() in c:\MyPath\Program.cs:line 38</pre> <p><strong>Am I doing anything obviously wrong?</strong></p> <p><strong>Is this a bug, and if yes, is it well-known, and is it an old bug?</strong></p>
<c#><.net><reflection><custom-attributes><base-class-library>
2016-08-01 13:54:29
HQ
38,701,115
Windows & Android: react native server crashes very often
<pre><code> ERROR EPERM: operation not permitted, lstat '...\.idea\workspace.xml___jb_old___' {"errno":-4048,"code":"EPERM","syscall":"lstat","path":"...\.idea\\workspace.xml___jb_old___"} Error: EPERM: operation not permitted, lstat 'app\.idea\workspace.xml___jb_old___' at Error (native) </code></pre> <p>After that I should again do:</p> <pre><code>npm start </code></pre> <p>How to resolve this quite annoying problem? Thanks</p>
<react-native>
2016-08-01 14:14:19
HQ
38,701,137
AttributeError: 'Figure' object has no attribute 'plot'
<p>My code</p> <pre><code>import matplotlib.pyplot as plt plt.style.use("ggplot") import numpy as np from mtspec import mtspec from mtspec.util import _load_mtdata data = np.loadtxt('262_V01_C00_R000_TEx_BL_4096H.dat') spec,freq,jackknife,f_statistics,degrees_of_f = mtspec(data=data, delta= 4930.0, time_bandwidth=4 ,number_of_tapers=5, nfft= 4194304, statistics=True) fig = plt.figure() ax2 = fig ax2.plot(freq, spec, color='black') ax2.fill_between(freq, jackknife[:, 0], jackknife[:, 1],color="red", alpha=0.3) ax2.set_xlim(freq[0], freq[-1]) ax2.set_ylim(0.1E1, 1E5) ax2.set_xlabel("Frequency $") ax2.set_ylabel("Power Spectral Density $)") plt.tight_layout() plt.show() </code></pre> <p>The problem is with the plotting part of my code.What should I change?I am using Python 2.7 on Ubuntu.</p>
<python><matplotlib>
2016-08-01 14:15:04
HQ
38,701,255
How can I Select duplicate results, insert the results to a new table and delete them from the original table? (phpmyadmin)
<p>I have 2 tables, both with the same column names that look like this</p> <p><a href="https://i.stack.imgur.com/bLkcF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bLkcF.png" alt="enter image description here"></a></p> <p>I have an app that is used for clocking in/out. A user goes up to a tablet and selects there name, the data is then inputted into table 'clocktable' as shown above. </p> <p>What I need to happen is when a user presses their name for a second time (to clock out) it detects that there is already a value in the table with the same employeename value, and moves both clocks to a different table 'oldclocks' so that a record is kept of clocking in/out times. The reason it needs to be in a separate table is I have a web page that displays the 'clocktable' table so we can determine who is in the building.</p> <p>How can I go about doing this? I can execute </p> <pre><code>SELECT DISTINCT EmployeeName, time FROM clocktable ORDER BY EmployeeName </code></pre> <p>from within myphp and then execute </p> <pre><code>INSERT INTO oldclocks SELECT Employeename, Department, time FROM clocktable; </code></pre> <p>Afterwards, but I cannot seem to execute them both at the same time in order to get them into a php script. Also is there a way I can delete the select results from the 'clocktable' at the same time? </p> <p>Help with this would be greatly appreciated. </p>
<php><mysql><phpmyadmin>
2016-08-01 14:21:00
LQ_CLOSE
38,702,032
Android Studio: Gradle Refresh Failed - Could not find com.android.tools.build:gradle:2.2.0-alpha6
<p>I've just pulled down an Android project from git, and Android Studio is giving me the following error whenever I attempt to open it;</p> <pre><code>Error:Could not find com.android.tools.build:gradle:2.2.0-alpha6. Searched in the following locations: https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.pom https://maven.fabric.io/public/com/android/tools/build/gradle/2.2.0-alpha6/gradle-2.2.0-alpha6.jar Required by: newApp_Android:app:unspecified </code></pre> <p>I've installed Gradle locally, and set up environment paths via System.</p> <p>Under Project Structure/Project, the following setup is in use;</p> <pre><code>Gradle Version : 2.10 Android Plugin Version : 2.2.0-alpha6 Android Plugin Repository : jcenter Default Library Repository : jcenter </code></pre> <p>Could anyone point me in the right direction on this?</p>
<android><android-studio><gradle>
2016-08-01 14:56:19
HQ
38,702,265
Python: List existing values in a list
<pre><code>data = [{u'class': u'A'}, {u'class': u'A'}, {u'class': u'B'}] </code></pre> <p>I want to get a list with all existing class values in data. Is there any efficient way to sort out double values?</p> <pre><code>output = [{u'class': u'A'}, {u'class': u'B'}] </code></pre>
<python>
2016-08-01 15:07:43
LQ_CLOSE
38,702,720
Why did I get error by using strchr() in C++?
<pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;cstring&gt; using namespace std; int main(){ string a="asdasd"; if(!strchr(a,'a')) cout&lt;&lt;"yes"; return 0; } </code></pre> <p>I just began to learn C++ programming and I don't know why I got error in this line </p> <pre><code>if(!strchr(a,'a')) cout&lt;&lt;"yes"; </code></pre> <p>But if I tried to code it like this, it would run very well.</p> <pre><code>if(!strchr("asdasd",'a')) cout&lt;&lt;"yes"; </code></pre> <p>I know it is a stupid question but I really don't know why.. sorry..</p>
<c++><string><char><strchr>
2016-08-01 15:30:49
LQ_CLOSE
38,703,293
document.body.style.height = "100%";
<p>I want to get a handle on the html tag to change the Background image but I'm running into: "TypeError: document.html is undefined" error.</p> <p>My code:</p> <pre><code> function init(){ document.html.style.background ="url('175541_DSC_0291.JPG') no-repeat center center"; } window.onload = function(){ init(); } </code></pre> <p>I lurked around for similar questions, closest I found was using the body tag instead. It works when I change the html object to body. </p> <p>Additionally, I can easily set the html background to what I want in my CSS file, but I want to do it with JavaScript. Any ideas as to what's going on?</p> <p>Thanks in advance, George</p>
<javascript><html><css>
2016-08-01 16:01:15
LQ_CLOSE
38,703,853
How to use google speech recognition api in python?
<p>Stack overflow might not be the best place to ask this question but i need help. I have an mp3 file and i want to use google's speech recognition to get the text out of that file. Any ideas where i can find documentation or examples will be appreciated.</p>
<google-api><google-speech-api>
2016-08-01 16:34:38
HQ
38,704,289
Python & json search
{ "note":"This file contains the sample data for testing", "comments":[ { "name":"Romina", "count":97 }, { "name":"Laurie", "count":97 }, { "name":"Bayli", "count":90 } ] } Hello everyone. This is my first question here. I need to sum the count values. how can i do this ???
<python><json>
2016-08-01 16:59:43
LQ_EDIT
38,704,353
anguar 1.5 access data in http.get without scope
i'm new here. And that's a pleasure to be with you. I use Angular 1.5. I can't access to my data, from the http.get, out the http.get. Let me explain: I have my component: (function(){ 'use strict'; class myComponent { constructor( $http, $scope) { var self = this; self.test="this is a test"; $http.get(MYAPI).then(function(response){ self.MYDATA = response.data; console.log(self.MYDATA) }); console.log(self.test) console.log(self.MYDATA) } } angular.module('myApp') .component('myApp.test', { templateUrl: 'myTemplate.html', controller: myComponent, controllerAs:'vm', }); })(); The console.Log give me: *this is a test* --> for the test *undefined* --> out the http.get *Object {id: 1…}* --> in the http.get So i can't access to my data out the http.get and this is what i want. Have Anyone an idee? Thank you.
<javascript><angularjs><get><angular-promise>
2016-08-01 17:03:59
LQ_EDIT
38,704,879
Disable VS Code Output Window (not Visual Studio)
<p>Simple Question:</p> <p>How do I keep the output window from displaying in VS Code. I don't need it and it takes up a lot of screen real estate. I don't see any options in preferences and can't find anything to help with it.</p> <p>Thanks!</p>
<visual-studio-code>
2016-08-01 17:34:10
HQ
38,705,868
'Serilog' already has a dependency defined for 'Microsoft.CSharp'
<p>I am trying to install serilog and I'm getting error</p> <blockquote> <p>PM> Install-Package Serilog<br> Install-Package : 'Serilog' already has a<br> dependency defined for 'Microsoft.CSharp'. At line:1 char:1<br> + Install-Package Serilog<br> + ~~~~~~~~~~~~~~~~~~~~~~~<br> + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException<br> + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand </p> </blockquote> <p><code>Microsoft.CSharp</code> is already referenced in my project</p>
<serilog><rollingfilesink>
2016-08-01 18:39:17
HQ
38,705,880
Formatting a CSV for a Python dictionary
<p>If I have a CSV file that looks like this:</p> <h3>Name | Value 1 | Value 2</h3> <p>Foobar | 22558841 | 96655<br> Barfool | 02233144 | 3301144</p> <p>How can I make it into a dictionary that looks like this: </p> <pre><code>dict = { 'Foobar': { 'Value 1': 2255841, 'Value 2': 9665 }, 'Barfool': { 'Value 1': 02233144, 'Value 2': 3301144 } } </code></pre>
<python><python-3.x><csv><dictionary>
2016-08-01 18:40:10
LQ_CLOSE
38,706,456
Return difference in time using php
<p>With the following line i get a DATE in Y-m-d format.</p> <pre><code>echo date('Y-m-d',strtotime($result["created_at"])); </code></pre> <p>Its the creation date of an account. now id like to calculate how old the account is so i can print it out like 5 Years, 5 Months as a example.</p> <p>any ideas?</p>
<php>
2016-08-01 19:15:11
LQ_CLOSE
38,706,496
What is the worst Time Complexity to insert a node in Binary search Tree?
What is the worst Time Complexity to insert a node in Binary search Tree?
<data-structures><time-complexity><binary-tree>
2016-08-01 19:17:47
LQ_EDIT
38,706,602
linux unix regex
Trying to extract the digit bewtween the parenthesis (AA) and modify (expl: times 300 ) and update the old value (AA) using the new value which is (AA*300) in the whole text. Exmp text: RRRR TTTTYYY (22); UUUUUUU IIIIII4 (55);
<regex>
2016-08-01 19:23:32
LQ_EDIT
38,706,984
Choice in batch script
I am trying to use the choice command in a batch script to take the default input if the user doesn't want to stop kicking off a report. I wrote the below script but instead of waiting 10 seconds and kicking off the report, it is recursively echo-ing the first line of the code over and over until I kill the script. Is there something wrong that I am doing? My Code: CHOICE /C YN /N /T 10 /D N /M "Run Report Y or N?" IF ERRORLEVEL 1 SET REPORT=RunTheReport: IF ERRORLEVEL 2 SET REPORT=DontRunIt: ECHO You chose to run %REPORT% P.S: I replaced the report commands with an echo statement but it is still not working
<windows><batch-file>
2016-08-01 19:48:35
LQ_EDIT
38,707,513
Ignoring an error message to continue with the loop in python
<p>I am using a Python script for executing some function in Abaqus. Now, after running for some iterations Abaqus is exiting the script due to an error.</p> <p>Is it possible in Python to bypass the error and continue with the other iterations?</p> <p>The error message is </p> <pre><code>#* The extrude direction must be approximately orthogonal #* to the plane containing the edges being extruded. </code></pre> <p>The error comes out for some of the iterations, I am looking for a way to ignore the errors and continue with the loop whenever such error is encountered.</p> <p>The for loop is as given;</p> <pre><code>for i in xrange(0,960): p = mdb.models['Model-1'].parts['Part-1'] c = p.cells pickedCells = c.getSequenceFromMask(mask=('[#1 ]', ), ) e, d1 = p.edges, p.datums pickedEdges =(e[i], ) p.PartitionCellByExtrudeEdge(line=d1[3], cells=pickedCells, edges=pickedEdges, sense=REVERSE) </code></pre> <p>Is this doable? Thanks!</p>
<python><loops><error-handling><abaqus>
2016-08-01 20:25:59
HQ
38,707,539
Owin middleware VS WebAPI DelegatingHandler
<p>I'm reading around articles and checking exmaples and I see Owin Middlewares are used the same as WebAPI DelegatingHandler: logging incoming requests, validating headers and so on. </p> <p>My only understanding is that Owin Middleware comes before DelegatingHandlers in the pipeline. So if you create an Owin middleware for let's say Authorization of users, you're able to deny a forbidden request faster, at a lower level.</p> <p>Is there any difference in the two, or any advantages/disadvantages using either of them? </p>
<c#><.net><asp.net-web-api><owin>
2016-08-01 20:27:33
HQ
38,707,813
Parsec: Applicatives vs Monads
<p>I'm just starting with Parsec (having little experience in Haskell), and I'm a little confused about using monads or applicatives. The overall feel I had after reading "Real World Haskell", "Write You a Haskell" and a question here is that applicatives are preferred, but really I have no idea.</p> <p>So my questions are:</p> <ul> <li>What approach is preferred?</li> <li>Can monads and applicatives be mixed (use them when they are more useful than the other)</li> <li>If the last answer is yes, should I do it?</li> </ul>
<haskell><parsec>
2016-08-01 20:44:41
HQ
38,707,822
Array elements getting lost between server and browser
<p>I have a Java Tomcat server that sends an array to a browser where it will be displayed in a table. This was all working perfectly until I added two more elements to the array, and now those two elements never make it to the browser. I can list out in the log all of the elements before they leave the server and they're all there. But when I look at the array in the browser after the ajax call, the new elements are missing. ???</p>
<javascript><java><ajax><tomcat><server>
2016-08-01 20:45:44
LQ_CLOSE
38,708,377
Select random item in cardview
Cardview you see in the image view with the touch of a downward items are displayed one at a time Now I would like to touch scroll down and one randomly selected items. [Image][1] Project link: [CardView][2] [1]: http://i.stack.imgur.com/XvOm5.png [2]: https://github.com/chiemy/CardView
<android><android-recyclerview><android-cardview>
2016-08-01 21:25:04
LQ_EDIT
38,709,729
Is there a keyspace event in redis for a key entering the database that isn't already present?
<p>I have a program that utilizes a redis key with an expire time set. I want to detect when there is a new entry to the data set. I can tell when there is a removal by listening for the "expired" event, but the "set" and "expire" events are fired every time the key is set, even if it's already in the database.</p> <p>Is there a keyspace event for a NEW key appearing?</p>
<redis>
2016-08-01 23:49:26
HQ
38,709,821
Difference between char** and char[][]
<p>I am trying to sort strings using stdlib qsort. I have created two sort functions sort1 and sort2. sort1 input argument is char** and sort2 input argument is char[][]. My program crashes when use sort1 function to sort array of strings.</p> <pre><code>#include "stdafx.h" #include &lt;stdlib.h&gt; #include &lt;string.h&gt; int compare(const void* a, const void* b) { const char *ia = (const char *)a; const char *ib = (const char *)b; return strcmp(ia, ib); } //program crashes void sort1(char **A, int n1) { int size1 = sizeof(A[0]); int s2 = n1; qsort(A,s2,size1,compare); } //works perfectly void sort2(char A[][10], int n1) { int size1 = sizeof(A[0]); int s2 = n1; qsort(A,s2,10,compare); } int _tmain(int argc, _TCHAR* argv[]) { char *names_ptr[5] = {"norma","daniel","carla","bob","adelle"}; char names[5][10] = {"norma","daniel","carla","bob","adelle"}; int size1 = sizeof(names[0]); int s2 = (sizeof(names)/size1); sort1(names_ptr,5); //doesnt work sort2(names,5); //works return 0; } </code></pre>
<c>
2016-08-02 00:00:43
LQ_CLOSE
38,709,866
Error when Using getSupportActionBar in Android Studio
I have an android project. I used android studio. In my project, I want to change the Title project with getSupportActionBar().setTitlte(), but I got an error. **Error** : 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: FATAL EXCEPTION: main 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: Process: com.mynotescode.apps.layout, PID: 16441 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mynotescode.apps.layout/com.mynotescode.apps.layout.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2326) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:147) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5264) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.mynotescode.apps.layout.MainActivity.onCreate(MainActivity.java:18) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.Activity.performCreate(Activity.java:5975) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2269) 08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2387)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.access$800(ActivityThread.java:147)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1281)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.os.Looper.loop(Looper.java:135)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5264)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:900)  08-02 06:58:48.645 16441-16441/? E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:695)  **This is my MainActivity.java :** package com.mynotescode.apps.layout; import android.os.Bundle; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ActionBar actionBar = getSupportActionBar(); actionBar.setTitle("Hotel Hilton"); actionBar.setSubtitle("Isla Nublar"); actionBar.setDisplayHomeAsUpEnabled(true); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_bookmark) { return true; } if (id == android.R.id.home){ finish(); } return super.onOptionsItemSelected(item); } } Please help me. Thank you.
<android>
2016-08-02 00:08:21
LQ_EDIT
38,709,985
Where has 'django.core.context_processors.request' gone in Django 1.10?
<p>I used to use <code>django.core.context_processors.request</code> to get the <code>request</code> for a view in template without having to pass them in.</p> <p>However, this is no longer in Django 1.10.</p> <p>How to I access the request context processor in Django 1.10?</p>
<django><django-templates>
2016-08-02 00:23:09
HQ
38,710,089
Can I use Swift to list all apps that are currently running?
<p>Am I able to use Swift code to display all apps that are currently running on an Iphone (or Ipad)? I am hoping to integrate this with an "on/off" button, but am having trouble getting the display to appear. </p>
<ios><iphone><arrays><swift>
2016-08-02 00:36:06
LQ_CLOSE
38,710,904
How do I resolve the deprecation warning "Method to_hash is deprecated and will be removed in Rails 5.1"
<p>I'm trying to update to Rails 5, I'm getting the following deprecation warning:</p> <blockquote> <p>DEPRECATION WARNING: Method to_hash is deprecated and will be removed in Rails 5.1, as <code>ActionController::Parameters</code> no longer inherits from hash. Using this deprecated behavior exposes potential security problems. If you continue to use this method you may be creating a security vulnerability in your app that can be exploited. Instead, consider using one of these documented methods which are not deprecated: <a href="http://api.rubyonrails.org/v5.0.0/classes/ActionController/Parameters.html" rel="noreferrer">http://api.rubyonrails.org/v5.0.0/classes/ActionController/Parameters.html</a> (called from column_header at /Data/Projects/portal/trunk/app/helpers/application_helper.rb:114)</p> </blockquote> <p>The line the warning is on looks like this:</p> <pre><code> link_to(name, { action: action_name, params: params.merge({ order: key, page: nil }) }, { title: "Sort by this field", }) + </code></pre> <p>As you can see, I'm not calling <code>to_hash</code>. Maybe Rails is. Maybe some other gem is. I have no way to tell, because they didn't think it was worth providing a stack trace. (Pro tip - it usually <em>is</em> worth providing a stack trace!)</p> <p>So anyway, I followed the link, planning to find a replacement, and <a href="http://api.rubyonrails.org/v5.0.0/classes/ActionController/Parameters.html#method-i-merge" rel="noreferrer">the <code>merge</code> method does not <em>appear</em> to be deprecated</a>, but maybe they simply forgot to document deprecated status, so I can't really be sure.</p> <p>So what am I supposed to do to clear this?</p>
<ruby-on-rails><ruby><ruby-on-rails-5>
2016-08-02 02:31:02
HQ
38,711,596
Runnable jar pauses when on another window
<p>I made an simple java code to control a powerPoint presentation through hand motion with the help of an device called leap motion. The code works fine in Eclipse, but whenever I switch to an actual powerPoint slide my runnable jar pauses and stops doing what it's suppose to. How do I fix this problem??</p>
<java><window><executable-jar><leap-motion>
2016-08-02 04:06:57
LQ_CLOSE
38,711,871
Load different application.yml in SpringBoot Test
<p>I'm using a spring boot app which runs my src/main/resources/config/application.yml.</p> <p>When I run my test case by :</p> <pre><code>@RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = Application.class) @WebAppConfiguration @IntegrationTest public class MyIntTest{ } </code></pre> <p>The test codes still run my application.yml file to load properties. I wonder if it is possible to run another *.yml file when running the test case.</p>
<spring-mvc><spring-boot>
2016-08-02 04:39:27
HQ
38,712,282
How to pass multiple parameters to middleware with OR condition in Laravel 5.2
<p>I am trying to set permission to access an action to two different user roles Admin, Normal_User as shown below.</p> <pre><code>Route::group(['middleware' =&gt; ['role_check:Normal_User','role_check:Admin']], function() { Route::get('/user/{user_id}', array('uses' =&gt; 'UserController@showUserDashboard', 'as' =&gt; 'showUserDashboard')); }); </code></pre> <p>This route can be accessed by either Admin or Normal_user. But in this middleware configuration, user is required to be both Admin and Normal_User. How can I add OR condition in middleware parameter passing? Or is there any other method to give permission?</p> <p>The following is my middleware</p> <pre><code>public function handle($request, Closure $next, $role) { if ($role != Auth::user()-&gt;user_role-&gt;role ) { if ($request-&gt;ajax() || $request-&gt;wantsJson()) { return response('Unauthorized.', 401); } else { return response('Unauthorized.', 401); } } return $next($request); } </code></pre> <p>Can anyone please reply?</p>
<laravel><laravel-5.2>
2016-08-02 05:22:12
HQ
38,712,772
Unable to reproduce WebKitLegacy -[_WebSafeForwarder forwardInvocation:] crash
<p>I am Getting [_WebSafeForwarder forwardInvocation:] and crash report as following on crashlytics. Unable to reproduce the same condition in my code. I added <code>webview.delegate = nil</code> and <code>[webview stopLoading]</code> in each and every <code>-(void)dealloc</code> method where ever <code>UIWebview</code> is present still getting following crash.</p> <pre><code>#0. Crashed: com.apple.main-thread 0 libobjc.A.dylib 0x24deba86 objc_msgSend + 5 1 WebKitLegacy 0x29945e17 -[_WebSafeForwarder forwardInvocation:] + 190 2 CoreFoundation 0x25624f4d ___forwarding___ + 352 3 CoreFoundation 0x2554f298 _CF_forwarding_prep_0 + 24 4 CoreFoundation 0x25626664 __invoking___ + 68 5 CoreFoundation 0x2554b8bd -[NSInvocation invoke] + 292 6 WebCore 0x28d6b84b HandleDelegateSource(void*) + 90 7 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 8 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 9 CoreFoundation 0x255e193f __CFRunLoopRun + 806 10 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 11 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 12 UIFoundation 0x29bb5837 -[NSHTMLReader _loadUsingWebKit] + 2038 13 Foundation 0x25e4e887 __NSThreadPerformPerform + 386 14 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 15 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 16 CoreFoundation 0x255e193f __CFRunLoopRun + 806 17 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 18 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 19 GraphicsServices 0x26b4caf9 GSEventRunModal + 160 20 UIKit 0x29c68435 UIApplicationMain + 144 21 MyProjectName 0x1446e5 main (main.m:14) 22 libdispatch.dylib 0x251dc873 (Missing) -- #0. Crashed: com.apple.main-thread 0 libobjc.A.dylib 0x24deba86 objc_msgSend + 5 1 WebKitLegacy 0x29945e17 -[_WebSafeForwarder forwardInvocation:] + 190 2 CoreFoundation 0x25624f4d ___forwarding___ + 352 3 CoreFoundation 0x2554f298 _CF_forwarding_prep_0 + 24 4 CoreFoundation 0x25626664 __invoking___ + 68 5 CoreFoundation 0x2554b8bd -[NSInvocation invoke] + 292 6 WebCore 0x28d6b84b HandleDelegateSource(void*) + 90 7 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 8 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 9 CoreFoundation 0x255e193f __CFRunLoopRun + 806 10 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 11 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 12 UIFoundation 0x29bb5837 -[NSHTMLReader _loadUsingWebKit] + 2038 13 Foundation 0x25e4e887 __NSThreadPerformPerform + 386 14 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 15 CoreFoundation 0x255e3569 __CFRunLoopDoSources0 + 344 16 CoreFoundation 0x255e193f __CFRunLoopRun + 806 17 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 18 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 19 GraphicsServices 0x26b4caf9 GSEventRunModal + 160 20 UIKit 0x29c68435 UIApplicationMain + 144 21 MyProjectName 0x1446e5 main (main.m:14) 22 libdispatch.dylib 0x251dc873 (Missing) #2. com.twitter.crashlytics.ios.MachExceptionServer 0 MyProjectName 0x157cdd CLSProcessRecordAllThreads + 1015005 1 MyProjectName 0x157cdd CLSProcessRecordAllThreads + 1015005 2 MyProjectName 0x157ef5 CLSProcessRecordAllThreads + 1015541 3 MyProjectName 0x14c52b CLSHandler + 967979 4 MyProjectName 0x148249 CLSMachExceptionServer + 950857 5 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 6 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 7 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #3. GAIThread 0 libsystem_kernel.dylib 0x2529b8a8 mach_msg_trap + 20 1 libsystem_kernel.dylib 0x2529b6a9 mach_msg + 40 2 CoreFoundation 0x255e36ad __CFRunLoopServiceMachPort + 136 3 CoreFoundation 0x255e1a33 __CFRunLoopRun + 1050 4 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 5 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 6 Foundation 0x25d7d42d -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268 7 Foundation 0x25dcbd75 -[NSRunLoop(NSRunLoop) run] + 80 8 MyProjectName 0x1d58c5 +[GAI threadMain:] + 1530053 9 Foundation 0x25e4e64d __NSThread__start__ + 1144 10 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 11 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 12 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #4. com.apple.NSURLConnectionLoader 0 libsystem_kernel.dylib 0x2529b8a8 mach_msg_trap + 20 1 libsystem_kernel.dylib 0x2529b6a9 mach_msg + 40 2 CoreFoundation 0x255e36ad __CFRunLoopServiceMachPort + 136 3 CoreFoundation 0x255e1a33 __CFRunLoopRun + 1050 4 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 5 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 6 CFNetwork 0x25b85c47 +[NSURLConnection(Loader) _resourceLoadLoop:] + 486 7 Foundation 0x25e4e64d __NSThread__start__ + 1144 8 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 9 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 10 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #5. com.apple.CFSocket.private 0 libsystem_kernel.dylib 0x252afeec __select + 20 1 CoreFoundation 0x255e8b51 __CFSocketManager + 572 2 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 3 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 4 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #6. AFNetworking 0 libsystem_kernel.dylib 0x2529b8a8 mach_msg_trap + 20 1 libsystem_kernel.dylib 0x2529b6a9 mach_msg + 40 2 CoreFoundation 0x255e36ad __CFRunLoopServiceMachPort + 136 3 CoreFoundation 0x255e1a33 __CFRunLoopRun + 1050 4 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 5 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 6 Foundation 0x25d7d42d -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268 7 Foundation 0x25dcbd75 -[NSRunLoop(NSRunLoop) run] + 80 8 MyProjectName 0x29d30f +[AFURLConnectionOperation networkRequestThreadEntryPoint:] (AFURLConnectionOperation.m:168) 9 Foundation 0x25e4e64d __NSThread__start__ + 1144 10 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 11 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 12 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #7. WebThread 0 libsystem_kernel.dylib 0x252af998 __psynch_cvwait + 24 1 libsystem_pthread.dylib 0x253541a5 _pthread_cond_wait + 536 2 libsystem_pthread.dylib 0x253550f9 pthread_cond_timedwait + 44 3 WebCore 0x28d57f57 SendDelegateMessage(NSInvocation*) + 678 4 WebKitLegacy 0x29978265 CallFrameLoadDelegate(void (*)(), WebView*, objc_selector*, objc_object*) + 172 5 WebKitLegacy 0x29947877 WebFrameLoaderClient::dispatchDidFinishLoad() + 158 6 WebCore 0x28d290af WebCore::FrameLoader::checkLoadCompleteForThisFrame() + 382 7 WebCore 0x28d28e75 WebCore::FrameLoader::checkLoadComplete() + 280 8 WebCore 0x28d55bf1 WebCore::FrameLoader::checkCompleted() + 316 9 WebCore 0x28d5504b WebCore::FrameLoader::finishedParsing() + 102 10 WebCore 0x28d54f59 WebCore::Document::finishedParsing() + 312 11 WebCore 0x28d5270b WebCore::HTMLDocumentParser::prepareToStopParsing() + 118 12 WebCore 0x28dddbcb WebCore::HTMLDocumentParser::resumeParsingAfterYield() + 102 13 WebCore 0x28cff4a1 WebCore::ThreadTimers::sharedTimerFiredInternal() + 136 14 WebCore 0x28cff3f5 WebCore::timerFired(__CFRunLoopTimer*, void*) + 28 15 CoreFoundation 0x255e4177 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14 16 CoreFoundation 0x255e3da9 __CFRunLoopDoTimer + 936 17 CoreFoundation 0x255e1bf5 __CFRunLoopRun + 1500 18 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 19 CoreFoundation 0x2552ffbd CFRunLoopRunInMode + 108 20 WebCore 0x28d457b7 RunWebThread(void*) + 422 21 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 22 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 23 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #8. JavaScriptCore::Marking 0 libsystem_kernel.dylib 0x252af998 __psynch_cvwait + 24 1 libsystem_pthread.dylib 0x253541a5 _pthread_cond_wait + 536 2 libsystem_pthread.dylib 0x253550b9 pthread_cond_wait + 40 3 libc++.1.dylib 0x24d7469d std::__1::condition_variable::wait(std::__1::unique_lock&lt;std::__1::mutex&gt;&amp;) + 36 4 JavaScriptCore 0x2891a781 JSC::GCThread::waitForNextPhase() + 104 5 JavaScriptCore 0x2891a7ef JSC::GCThread::gcThreadMain() + 62 6 JavaScriptCore 0x287269e1 WTF::threadEntryPoint(void*) + 148 7 JavaScriptCore 0x2872693f WTF::wtfThreadEntryPoint(void*) + 14 8 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 9 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 10 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #9. NSOperationQueue 0x15e6cc20 :: NSOperation 0x15d230e0 (QOS: USER_INTERACTIVE) 0 libsystem_kernel.dylib 0x2529b8f8 semaphore_wait_trap + 8 1 libsystem_platform.dylib 0x2534f289 _os_semaphore_wait + 12 2 libdispatch.dylib 0x251bcc6d _dispatch_barrier_sync_f_slow + 372 3 MyProjectName 0x27dd8f __69-[SDWebImageManager downloadImageWithURL:options:progress:completed:]_block_invoke98 (SDWebImageManager.m:189) 4 MyProjectName 0x275e71 __72-[SDWebImageDownloader downloadImageWithURL:options:progress:completed:]_block_invoke93 (SDWebImageDownloader.m:163) 5 MyProjectName 0x27a8fb -[SDWebImageDownloaderOperation connection:didFailWithError:] (SDWebImageDownloaderOperation.m:419) 6 CFNetwork 0x25c683a1 __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 56 7 CFNetwork 0x25c68359 -[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:] + 184 8 CFNetwork 0x25c6847d -[NSURLConnectionInternal _withConnectionAndDelegate:] + 36 9 CFNetwork 0x25c44125 _NSURLConnectionDidFail(_CFURLConnection*, __CFError*, void const*) + 84 10 CFNetwork 0x25be3203 ___ZN27URLConnectionClient_Classic17_delegate_didFailEP9__CFErrorU13block_pointerFvvE_block_invoke + 86 11 CFNetwork 0x25be1a83 ___ZN27URLConnectionClient_Classic18_withDelegateAsyncEPKcU13block_pointerFvP16_CFURLConnectionPK33CFURLConnectionClientCurrent_VMaxE_block_invoke_2 + 70 12 libdispatch.dylib 0x251b3cab _dispatch_client_callout + 22 13 libdispatch.dylib 0x251bb543 _dispatch_block_invoke + 450 14 CFNetwork 0x25b13e83 RunloopBlockContext::_invoke_block(void const*, void*) + 18 15 CoreFoundation 0x2552fc09 CFArrayApplyFunction + 36 16 CFNetwork 0x25b13d6b RunloopBlockContext::perform() + 182 17 CFNetwork 0x25b13c35 MultiplexerSource::perform() + 216 18 CFNetwork 0x25b13ac9 MultiplexerSource::_perform(void*) + 48 19 CoreFoundation 0x255e39e7 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14 20 CoreFoundation 0x255e35d7 __CFRunLoopDoSources0 + 454 21 CoreFoundation 0x255e193f __CFRunLoopRun + 806 22 CoreFoundation 0x255301c9 CFRunLoopRunSpecific + 516 23 CoreFoundation 0x25570f23 CFRunLoopRun + 98 24 MyProjectName 0x27779b -[SDWebImageDownloaderOperation start] (SDWebImageDownloaderOperation.m:117) 25 Foundation 0x25e38b0d __NSOQSchedule_f + 192 26 libdispatch.dylib 0x251bde7f _dispatch_queue_drain + 1762 27 libdispatch.dylib 0x251b6e17 _dispatch_queue_invoke + 282 28 libdispatch.dylib 0x251bf20d _dispatch_root_queue_drain + 400 29 libdispatch.dylib 0x251bf07b _dispatch_worker_thread3 + 94 30 libsystem_pthread.dylib 0x25352e0d _pthread_wqthread + 1024 31 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #10. com.apple.root.default-qos 0 libsystem_kernel.dylib 0x252af998 __psynch_cvwait + 24 1 libsystem_pthread.dylib 0x253541a5 _pthread_cond_wait + 536 2 libsystem_pthread.dylib 0x253550b9 pthread_cond_wait + 40 3 Foundation 0x25dc840f -[NSCondition wait] + 194 4 Foundation 0x25d8f40b -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 850 5 Foundation 0x25d92be1 -[NSObject(NSThreadPerformAdditions) performSelectorOnMainThread:withObject:waitUntilDone:] + 136 6 UIFoundation 0x29bb611f -[NSHTMLReader _load] + 386 7 UIFoundation 0x29bb6b21 -[NSHTMLReader attributedString] + 24 8 UIFoundation 0x29b5ac35 _NSReadAttributedStringFromURLOrData + 5304 9 UIFoundation 0x29b596f5 -[NSAttributedString(NSAttributedStringUIFoundationAdditions) initWithData:options:documentAttributes:error:] + 116 10 MyProjectName 0x19cecf -[MyStaticLibrary handleHTMLCharactersForTitle:] (MyStaticLibrary.m:3132) 11 MyProjectName 0x1a8905 __47-[MyNetworkRequest onHTTPSuccessWithResponse:]_block_invoke143 (MyNetworkRequest.m:484) 12 libdispatch.dylib 0x251b3cbf _dispatch_call_block_and_release + 10 13 libdispatch.dylib 0x251bf6a1 _dispatch_root_queue_drain + 1572 14 libdispatch.dylib 0x251bf07b _dispatch_worker_thread3 + 94 15 libsystem_pthread.dylib 0x25352e0d _pthread_wqthread + 1024 16 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #11. Thread 0 libsystem_kernel.dylib 0x252afffc __semwait_signal + 24 1 libsystem_c.dylib 0x25203bcd nanosleep + 172 2 libc++.1.dylib 0x24db38f5 std::__1::this_thread::sleep_for(std::__1::chrono::duration&lt;long long, std::__1::ratio&lt;1ll, 1000000000ll&gt; &gt; const&amp;) + 136 3 JavaScriptCore 0x28ad9b01 bmalloc::Heap::scavenge(std::__1::unique_lock&lt;bmalloc::StaticMutex&gt;&amp;, std::__1::chrono::duration&lt;long long, std::__1::ratio&lt;1ll, 1000ll&gt; &gt;) + 256 4 JavaScriptCore 0x28ad98eb bmalloc::Heap::concurrentScavenge() + 78 5 JavaScriptCore 0x28adb7b7 bmalloc::AsyncTask&lt;bmalloc::Heap, void (bmalloc::Heap::*)()&gt;::entryPoint() + 98 6 JavaScriptCore 0x28adb751 bmalloc::AsyncTask&lt;bmalloc::Heap, void (bmalloc::Heap::*)()&gt;::pthreadEntryPoint(void*) + 8 7 libsystem_pthread.dylib 0x25354c7f _pthread_body + 138 8 libsystem_pthread.dylib 0x25354bf3 _pthread_start + 110 9 libsystem_pthread.dylib 0x25352a08 thread_start + 8 #12. Thread 0 libsystem_pthread.dylib 0x253529f4 start_wqthread + 14 #13. Thread 0 libsystem_kernel.dylib 0x252b0864 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x25352e19 _pthread_wqthread + 1036 2 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #14. Thread 0 libsystem_kernel.dylib 0x252b0864 __workq_kernreturn + 8 1 libsystem_pthread.dylib 0x25352e19 _pthread_wqthread + 1036 2 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 #15. PLClientLoggingFlushQueue 0 libsystem_platform.dylib 0x2534e96a _platform_memmove + 105 1 CoreFoundation 0x2553f0c7 CFStringGetBytes + 634 2 CoreFoundation 0x2553f0c7 CFStringGetBytes + 634 3 CoreFoundation 0x25677ab9 __writeObject15 + 324 4 CoreFoundation 0x2567841d __writeObject15 + 2728 5 CoreFoundation 0x2567841d __writeObject15 + 2728 6 CoreFoundation 0x2567841d __writeObject15 + 2728 7 CoreFoundation 0x2567841d __writeObject15 + 2728 8 CoreFoundation 0x2567841d __writeObject15 + 2728 9 CoreFoundation 0x256777ad __CFBinaryPlistWrite15 + 152 10 CoreFoundation 0x255729cf _CFXPCCreateXPCMessageWithCFObject + 118 11 PowerLog 0x2707ab4f -[PLClientLogger xpcSendMessage:withClientID:withKey:withPayload:] + 86 12 PowerLog 0x2707bd85 -[PLClientLogger batchTasksCacheFlush] + 500 13 libdispatch.dylib 0x251b3cbf _dispatch_call_block_and_release + 10 14 libdispatch.dylib 0x251bd3cf _dispatch_after_timer_callback + 66 15 libdispatch.dylib 0x251c65bb _dispatch_source_latch_and_call + 2042 16 libdispatch.dylib 0x251b5bff _dispatch_source_invoke + 738 17 libdispatch.dylib 0x251bd9ed _dispatch_queue_drain + 592 18 libdispatch.dylib 0x251b6e17 _dispatch_queue_invoke + 282 19 libdispatch.dylib 0x251bf20d _dispatch_root_queue_drain + 400 20 libdispatch.dylib 0x251bf07b _dispatch_worker_thread3 + 94 21 libsystem_pthread.dylib 0x25352e0d _pthread_wqthread + 1024 22 libsystem_pthread.dylib 0x253529fc start_wqthread + 8 </code></pre>
<ios><webkit><crashlytics>
2016-08-02 05:59:42
HQ
38,712,815
sql - how to make sure one admin account in database will not get deleted
I have tblUserAccounts with columns Username, Password, and UserLevel. It currently have only one row with Admin UserLevel. And in my C# program, only admin accounts can update / delete accounts. How can I prevent someone to delete all rows from tblUserAccounts and make sure there's always at least one Admin account? Help please...
<c#><sql-server>
2016-08-02 06:02:45
LQ_EDIT
38,712,913
Search box label should change by drop down list
I am trying to do change search box label as per drop down list. like ... [![ ][1]][1] [1]: http://i.stack.imgur.com/7yeGK.png then the search box should be like Search Company Admin when is elect company admin tag.
<javascript><jquery>
2016-08-02 06:09:45
LQ_EDIT
38,713,052
Understanding "public" / "private" in typescript class
<p>In the below type script code , irrespective of whether name is "public" or "private" , java script code that is generated is same.</p> <p>So my question is, how to decide when the constructor parameter should be public or private ? </p> <pre><code>// typescript code class Animal { constructor( public name: string) { } } // generated JS code var Animal = (function () { function Animal(name) { this.name = name; } return Animal; }()); </code></pre>
<typescript>
2016-08-02 06:19:27
HQ
38,713,240
Unrecognized font family ionicons
<p>I followed the setup instructions in the <a href="http://nativebase.io/documentation" rel="noreferrer">NativeBase Docs</a> and ran <code>rnpm link</code>. I am getting this error: <a href="http://i.stack.imgur.com/DjfZB.png" rel="noreferrer">Unrecognized font family ionicons</a></p> <p>also checked by Xcode, the fonts are already in the build phase. What am I missing?</p>
<react-native><native-base>
2016-08-02 06:32:47
HQ
38,713,592
How to do audit on Hyperledger?
How to do audit on Hyperledger? In the link of below: [https://github.com/hyperledger/fabric/blob/ffbf21a5b781b938f4168def6541f6fbae792d31/docs/biz/usecases.md][1] [https://github.com/hyperledger/fabric/blob/cca26e6d9aa9e6fab2b5c17d311709130b52c46e/docs/protocol-spec.md][2] There are audit introductions, so how to do audit setting/configuration, coding , etc. [1]: https://github.com/hyperledger/fabric/blob/ffbf21a5b781b938f4168def6541f6fbae792d31/docs/biz/usecases.md [2]: https://github.com/hyperledger/fabric/blob/cca26e6d9aa9e6fab2b5c17d311709130b52c46e/docs/protocol-spec.md
<hyperledger-fabric><hyperledger><blockchain>
2016-08-02 06:53:30
LQ_EDIT
38,713,679
Where is likely the performance bug here?
<p>Many of the test cases are timing out. I've made sure I'm using lazy evaluation everywhere, linear (or better) routines, etc. I'm shocked that this is still not meeting the performance benchmarks. </p> <pre><code>using System; using System.Collections.Generic; using System.IO; using System.Linq; class Mine { public int Distance { get; set; } // from river public int Gold { get; set; } // in tons } class Solution { static void Main(String[] args) { // helper function for reading lines Func&lt;string, int[]&gt; LineToIntArray = (line) =&gt; Array.ConvertAll(line.Split(' '), Int32.Parse); int[] line1 = LineToIntArray(Console.ReadLine()); int N = line1[0], // # of mines K = line1[1]; // # of pickup locations // Populate mine info List&lt;Mine&gt; mines = new List&lt;Mine&gt;(); for(int i = 0; i &lt; N; ++i) { int[] line = LineToIntArray(Console.ReadLine()); mines.Add(new Mine() { Distance = line[0], Gold = line[1] }); } // helper function for cost of a move Func&lt;Mine, Mine, int&gt; MoveCost = (mine1, mine2) =&gt; Math.Abs(mine1.Distance - mine2.Distance) * mine1.Gold; int sum = 0; // running total of move costs // all move combinations on the current list of mines, // given by the indicies of the mines var indices = Enumerable.Range(0, N); var moves = from i1 in indices from i2 in indices where i1 != i2 select new int[] { i1, i2 }; while(N != K) // while number of mines hasn't been consolidated to K { // get move with the least cost var cheapest = moves.Aggregate( (prev, cur) =&gt; MoveCost(mines[prev[0]],mines[prev[1]]) &lt; MoveCost(mines[cur[0]], mines[cur[1]]) ? prev : cur ); int i = cheapest[0], // index of source mine of cheapest move j = cheapest[1]; // index of destination mine of cheapest move // add cost to total sum += MoveCost(mines[i], mines[j]); // move gold from source to destination mines[j].Gold += mines[i].Gold; // remove from moves any that had the i-th mine as a destination or source moves = from move in moves where move[0] == i || move[1] == i select move; // update size number of mines after consolidation --N; } Console.WriteLine(sum); } } </code></pre>
<c#><algorithm><performance><linq><optimization>
2016-08-02 06:58:29
LQ_CLOSE
38,713,764
How to replace Swagger UI header logo in Swashbuckle
<p>I am using the Swashbuckle package for WebAPI and am attempting to customize the look and feel of the swagger ui default page. I would like to customize the default swagger logo/header. I have added the following to SwaggerConfig</p> <pre><code>.EnableSwaggerUi(c =&gt; { c.InjectJavaScript(thisAssembly, typeof(SwaggerConfig).Namespace + ".SwaggerExtensions.custom-js.js"); } </code></pre> <p>The contents of custom-js.js are as follows:</p> <pre><code>$("#logo").replaceWith("&lt;span id=\"test\"&gt;test&lt;/span&gt;"); </code></pre> <p>This works for the most part but the visual is a bit jarring, in that the default swagger header is visible while the page loads and after a brief delay the jquery below kicks and the content of the #logo element is updated</p> <p>Is there a way to avoid this so that the jquery kicks in as part of the initial load/render and it appears seamless?</p>
<asp.net-web-api><swagger-ui><swashbuckle>
2016-08-02 07:03:30
HQ
38,713,852
SQL - create table
when I execute query I got this table [![enter image description here][1]][1] but i want to make new table to get this [![enter image description here][2]][2] in name of column to get value 1,2,3... Any idea? [1]: http://i.stack.imgur.com/2Rm5D.png [2]: http://i.stack.imgur.com/VFqxY.png
<sql><sql-server><ssms>
2016-08-02 07:07:58
LQ_EDIT
38,714,069
How to enable exit only backpress activity twice in Android studio?
I m using Android studio to code a Wordpress based news application. To make things faster I have bought a template which served most of needs. But in the app when i press back button on home or any first level screens it exits from the app. How can I implement Exit only when the user presses back button twice.
<android>
2016-08-02 07:18:49
LQ_EDIT
38,714,741
how to union two tables with group values
**How to union two tables with group values** ----------------------------------------- My Query: SELECT table1.holder,table1.bene_type,table1.bene_stype,employee.employee_name, count(employee.employee_name) as count,sum(table1.position) as totalshares FROM erom_kmch.table1 LEFT OUTER JOIN erom.employee ON employee.bene_type_table1=table1.bene_type AND employee.bene_stype_table1=table1.bene_stype WHERE table1.date = '2016-04-15' group by employee.employee_name UNION SELECT table2.cust_name, table2.type,table2.bo_substat,employee.employee_name, count(employee.employee_name) as count,sum(table2.shares) as totalshares FROM erom_kmch.table2 LEFT OUTER JOIN erom.employee ON employee.type_table2=table2.type AND employee.bo_substat_table2=table2.bo_substat WHERE table2.date = '2016-04-15' group by employee.employee_name ---------------------------------------------------------- I am joining and union two tables and i need to group the values of two tables ,i am getting two output i need the sum and count of two tables as one output
<mysql><sql>
2016-08-02 07:53:21
LQ_EDIT
38,714,989
How can I give some clickable points in VR panorama image view in Android?
<p>I insert a 360 degree image in <strong>VrPanoramaView</strong> then image is showing and rotating successfully but and in this library only one click event which is <strong>panoramaView.setEventListener(new VrPanoramaEventListener()</strong> . I want to give some points in that image. So I want to know how I can give some selected points in Google VR View in android ? </p>
<android><google-vr><360-panorama-viewer>
2016-08-02 08:06:03
HQ
38,715,001
How to make web workers with TypeScript and webpack
<p>I'm having some issues with properly compiling my typescript when I attempt to use web workers. </p> <p>I have a worker defined like this: </p> <pre><code>onmessage = (event:MessageEvent) =&gt; { var files:FileList = event.data; for (var i = 0; i &lt; files.length; i++) { postMessage(files[i]); } }; </code></pre> <p>In another part of my application i'm using the webpack worker loader to load my worker like this: <code>let Worker = require('worker!../../../workers/uploader/main');</code></p> <p>I'm however having some issues with making the typescript declarations not yell at me when the application has to be transpiled. According to my research i have to add another standard lib to my tsconfig file to expose the global variables the worker need access to. These i have specified like so: </p> <pre><code>{ "compilerOptions": { "lib": [ "webworker", "es6", "dom" ] } } </code></pre> <p>Now, when i run webpack to have it build everything i get a bunch of errors like these: <code>C:/Users/hanse/Documents/Frontend/node_modules/typescript/lib/lib.webworker.d.ts:1195:13 Subsequent variable declarations must have the same type. Variable 'navigator' must be of type 'Navigator', but here has type 'WorkerNavigator'.</code></p> <p>So my question is: How do I specify so the webworker uses the lib.webworker.d.ts definitions and everything else follows the normal definitions?</p>
<typescript><webpack><web-worker>
2016-08-02 08:06:46
HQ
38,715,230
WebAPI Selfhost: Can't bind multiple parameters to the request's content
<p>The below code are simplified to show the necessity. May I know what is wrong? I can't seems to retrieve two Parameters (A and B in this case) using the [FromBody] attribute.</p> <p>The error message is "Can't bind multiple parameters ('A' and 'B') to the request's content"</p> <p>It is perfectly fine if I have either A or B only.</p> <p>Web API:</p> <pre><code>[Route("API/Test"), HttpPost] public IHttpActionResult Test([FromBody] int A, [FromBody] int B) </code></pre> <p>Client:</p> <pre><code>HttpClient client = new HttpClient(); var content = new FormUrlEncodedContent( new Dictionary&lt;string, string&gt; { { "A", "123" }, { "B", "456" } }); client.PostAsync("http://localhost/API/Test", content).Result; </code></pre>
<c#><asp.net-web-api>
2016-08-02 08:19:55
HQ
38,715,934
Docker container keeps restarting
<p>I was trying rancher. I used the command: sudo docker run -d --restart=always -p 8080:8080 rancher/server to start run it. Then I stopped the container and removed it. But if I stop and restart the docker daemon or reboot my laptop, and lookup running containers using docker ps command, it will have rancher server running again. How do I stop/remove it completely and make sure it will not run again. </p>
<docker>
2016-08-02 08:54:25
HQ
38,716,105
Angular2 : render a component without its wrapping tag
<p>I am struggling to find a way to do this. In a parent component, the template describes a <code>table</code> and its <code>thead</code> element, but delegates rendering the <code>tbody</code> to another component, like this:</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Time&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody *ngFor="let entry of getEntries()"&gt; &lt;my-result [entry]="entry"&gt;&lt;/my-result&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Each myResult component renders its own <code>tr</code> tag, basically like so:</p> <pre><code>&lt;tr&gt; &lt;td&gt;{{ entry.name }}&lt;/td&gt; &lt;td&gt;{{ entry.time }}&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>The reason I'm not putting this directly in the parent component (avoiding the need for a myResult component) is that the myResult component is actually more complicated than shown here, so I want to put its behaviour in a separate component and file.</p> <p>The resulting DOM looks bad. I believe this is because it is invalid, as <code>tbody</code> can only contain <code>tr</code> elements <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/tbody" rel="noreferrer">(see MDN)</a>, but my generated (simplified) DOM is :</p> <pre><code>&lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Time&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;my-result&gt; &lt;tr&gt; &lt;td&gt;Bob&lt;/td&gt; &lt;td&gt;128&lt;/td&gt; &lt;/tr&gt; &lt;/my-result&gt; &lt;/tbody&gt; &lt;tbody&gt; &lt;my-result&gt; &lt;tr&gt; &lt;td&gt;Lisa&lt;/td&gt; &lt;td&gt;333&lt;/td&gt; &lt;/tr&gt; &lt;/my-result&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Is there any way we can get the same thing rendered, but without the wrapping <code>&lt;my-result&gt;</code> tag, and while still using a component to be sole responsible for rendering a table row ?</p> <p>I have looked at <code>ng-content</code>, <code>DynamicComponentLoader</code>, the <code>ViewContainerRef</code>, but they don't seem to provide a solution to this as far as I can see.</p>
<javascript><angular>
2016-08-02 09:02:36
HQ
38,716,168
C# array in arrays
How do you create array that would produce exactly like the output below? January April July October 2014 -- 1 2 3 4 2015 -- 5 6 7 8 2016 -- 9 10 11 12 Row [3] = 2014, 2015, 2016. Column [4] = January, April, July, October. Value [2014, January] = 1, Value [2014, April] = 2, Value [2014, July] = 3, Value [2014, October] = 4,and so on... Please help me to figure it out as I'm self-learning C# at the moment.
<c#>
2016-08-02 09:05:21
LQ_EDIT
38,716,594
Electron app cant find sqlite3 module
<p>In my electron app I have installed sqlite3 via npm</p> <pre><code>npm install sqlite3 </code></pre> <p>But once i try to interact with the database it cant find the database, here is the log:</p> <blockquote> <p>Uncaught Error: Cannot find module 'D:\play\electron-quick-start\node_modules\sqlite3\lib\binding\electron-v1.3-win32-x64\node_sqlite3.node'</p> </blockquote> <p>Here is JS code:</p> <pre><code>console.log('whooooo'); var sqlite3 = require('sqlite3').verbose(); var db = new sqlite3.Database('../db/info.db'); db.serialize(function () { db.run("CREATE TABLE lorem (info TEXT)"); var stmt = db.prepare("INSERT INTO lorem VALUES (?)"); for (var i = 0; i &lt; 10; i++) { stmt.run("Ipsum " + i); } stmt.finalize(); db.each("SELECT rowid AS id, info FROM lorem", function (err, row) { console.log(row.id + ": " + row.info); }); }); db.close(); </code></pre> <p>I also try in this way:</p> <pre><code>npm install sqlite3 --build-from-source </code></pre> <p>but it fails to install!</p> <p>Also, i am using Python3. How do you install a module to work with electron? </p>
<node.js><sqlite><npm><electron>
2016-08-02 09:26:15
HQ
38,716,747
VB coding.. Seriously need help ,please and thanks
im doing a vb with access database.. and i wanted to create a button which savebutton with checking where the data that try to insert is duplicated or not compare with my database..so thismy code ,and the problem is whatever i enter it just show the user already exists .So anyone can help?? It's urgent Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click MyConn = New OleDbConnection MyConn.ConnectionString = connString MyConn.Open() If (ComboBox2.Text = "") And (ComboBox3.Text = "") And (TextBox3.Text = "") And (ComboBox4.Text = "") Then MsgBox("Please fill-up all fields!") Else Dim theQuery As String = ("SELECT * FROM Table1 WHERE"" [Subject_Code]=@Subject_Code ,[Day]=@Day, [Times]=@Times , [Lecture]=@Lecture and [Class_Room]=@Class_Room""") Dim cmd1 As OleDbCommand = New OleDbCommand(theQuery, MyConn) cmd1.Parameters.AddWithValue("@Subject_Code", TextBox6.Text) cmd1.Parameters.AddWithValue("@Day", ComboBox2.Text) cmd1.Parameters.AddWithValue("@Times", ComboBox3.Text) cmd1.Parameters.AddWithValue("@Lecture", TextBox3.Text) cmd1.Parameters.AddWithValue("@Class_Room", ComboBox4.Text) Using reader As OleDbDataReader = cmd1.ExecuteReader() If reader.HasRows Then ' User already exists MsgBox("User Already Exist!") Else Dim Update As String = "INSERT INTO [Table1] ([Subject_Code], [Subject],[Day], [Times], [Level],[Semester], [Lecture],[Class], [Class_Room])VALUES (?,?,?,?,?,?,?,?,?)" Using cmd = New OleDbCommand(Update, MyConn) cmd.Parameters.AddWithValue("@p1", TextBox6.Text) cmd.Parameters.AddWithValue("@p2", TextBox1.Text) cmd.Parameters.AddWithValue("@p3", ComboBox2.Text) cmd.Parameters.AddWithValue("@p4", ComboBox3.Text) cmd.Parameters.AddWithValue("@p5", ComboBox1.Text) cmd.Parameters.AddWithValue("@p6", ComboBox6.Text) cmd.Parameters.AddWithValue("@p7", TextBox3.Text) cmd.Parameters.AddWithValue("@p8", ComboBox5.Text) cmd.Parameters.AddWithValue("@p9", ComboBox4.Text) MsgBox("New Data Is Saved") cmd.ExecuteNonQuery() End Using End If End Using End If
<vb.net><ms-access>
2016-08-02 09:33:05
LQ_EDIT
38,717,021
Android Alarm notification on particular date and time and app should be active
<p>I need to know step by step process to do notification</p> <p>requirement: user will register for an event and then they will notification before one day at 9 am and before half an hour.</p> <ul> <li>even if app is not active they should get notification.</li> </ul>
<android><service><notifications><alarmmanager>
2016-08-02 09:45:43
LQ_CLOSE
38,717,033
Golang, importing packages from Github requests me to remember the Github URL?
<p>I'm very new to Golang. I see that in Golang you can import packages directly from Github like:</p> <pre><code>import "github.com/MakeNowJust/heredoc" </code></pre> <p>Does that mean I have to remember this URL in order to use this package? IMHO this is not cool. What if later the author of the package removed it or changed the URL? Any ideas?</p>
<github><go><package>
2016-08-02 09:46:11
HQ
38,717,794
having difficulties on understanding java script toggle class
i want to change glyphicon-plus into glyphicon-minus when clicked on it. here is my code <pre><code>` <?php foreach (get_categories() as $category){ ?> <div class = "sidebar_menu" > <li class="<?php echo $active = ($i==1)?"active":""; ?>"><a href="<?php echo get_category_link(get_cat_ID( $category->name )); ?>" ><strong><?php echo $category->name;?> </strong></a></li> <div class = "floatright"> <li id="cool"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne<?php echo $i; ?>" aria-expanded="true" aria-controls="collapseOne<?php echo $i; ?>"> <i class="glyphicon glyphicon-plus" aria-hidden="true"></i> </a> </li> </div> </div>` and the js. <pre><code>`$('#cool').click(function(){ $(this).find('i').toggleClass('glyphicon-plus').toggleClass('glyphicon-minus'); });` problem is that the glyphicon changes for the first list item only. it should be changed for all list item. Any help will be highly appreciated.
<javascript><wordpress><twitter-bootstrap>
2016-08-02 10:22:12
LQ_EDIT
38,718,215
Expecting class path separator ';' before '\Android\android-sdk\build-tools\23.0.1\lib\shrinkedAndroid.jar' in argument number 8
<p>Using VS 2015 for Xamarin development, when I attempt to build an Android project which has Enable Multi-Dex checked, I get the following error :-</p> <blockquote> <p>Expecting class path separator ';' before '\Android\android-sdk\build-tools\23.0.1\lib\shrinkedAndroid.jar' in argument number 8</p> </blockquote> <p>Any idea why this might be happening and how to resolve it?</p>
<android><xamarin>
2016-08-02 10:41:06
HQ
38,718,682
printing token returned from strtok or strtok_r crashes
<p>I have tried a simple program on my linux machine which tokenize a string using delimiter (",") and prints all the token values. But its crashing on very first statement which tries to print the token value.</p> <p>Here is my program</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; void main() { char *query = "1,2,3,4,5"; char *token = strtok(query, ","); while(token) { printf("Token: %s \n", token); token = strtok(NULL, ","); } } </code></pre> <p>output:</p> <pre><code>Segmentation fault (core dumped) </code></pre> <p>BT in GDB:</p> <pre><code> (gdb) r Starting program: /home/harish/samples/a.out Program received signal SIGSEGV, Segmentation fault. strtok () at ../sysdeps/x86_64/strtok.S:186 186 ../sysdeps/x86_64/strtok.S: No such file or directory. </code></pre> <p>Build System:</p> <pre><code>64 bit Ubuntu, gcc 4.8.4 version. </code></pre>
<c><segmentation-fault><strtok>
2016-08-02 11:04:08
LQ_CLOSE
38,719,887
How to Do Histogram Equalization in Imagesc's 3 Parameters of Matlab?
Situation: do histogram of the presentation in `imagesc(time,potential,C)` by using `time`, `potetial` and/or `C`; do normalized histogram equalization in the histogram Proposal: I think `C` is the data for the histogram because `time` and `potential` are just equispaced-equidistant vectors for x- and y-axis, respectively Code and pseudocode time=linspace(0,50,100 + 1); potential=linspace(0,50,100 + 1); C=gallery('wilk',21); % tridiagonal matrix, eigenvalue problem, Wilkinson 1965 figure, imagesc(time,potential,C); %% Output: Tridiagonal image %% Histogram Equalization Pseudocode % Draw here the histogram of time, potential and/or C C=histogram_equalization(C,...); figure, imagesc(time,potential,C); %% Expected output: tridiagonal image after histogram equalization Observations - `C` is not an intensity image because `figure, imhist(C)` returns blank output - I may need to consider `time` and `potential` also when considering the histogram of `C`. However, they are just equally spaced vectors for the axes so it should not be necessary. Unsuccessful attempts - RockTheIT's [code][3] is based on the image handler (`hFig`) or reading .png images. You cannot just put `I=C`, although `I` is a matrix. Why? - `hist` attempt based on the thread [Difference between hist and imhist][4] gives blank image in `imagesc(x,y,C)` where I am trying to plot all contents of `C` for histogram C = hist(double(C(:)), 256); Signal Processing - Gonzales says the *normalized histogram is given* by $p(r_k) = r_k / M N$, for $k = 0,1,2,...,L-1$ where - intensity levels ranges in $[0,L-1]$, - $p(r_k)$ is an estimate of the probability of occurrence of intensity $r_k$ in an image, - $MN$ is the product of the pixel sizes in `time` and `potential`, respectively Sources 1. Gonzales, *Digital Image Processing* 3rd ed. Ch. 3 about the Mathematics of histograms. System: Linux Ubuntu 16.04 64 bit Matlab: 2016a Hardware: Macbook Air 2013-mid [1]: http://i.stack.imgur.com/3iURCs.jpg [2]: http://i.stack.imgur.com/3iURC.jpg [3]: http://www.rocktheit.com/2012/09/matlab-program-to-apply-histogram.html [4]: https://se.mathworks.com/matlabcentral/answers/146986-difference-between-hist-and-imhist
<matlab><image-processing><signal-processing><histogram><contrast>
2016-08-02 12:01:35
LQ_EDIT
38,719,892
How to concatenate string in a for loop using scanner?
<p>package exercises;</p> <p>import java.util.Scanner;</p> <p>public class SentenceBuilder {</p> <pre><code>public static void main(String[] args) { final int MAX_WORDS = 5; Scanner scan = new Scanner(System.in); String word =""; for (int i = 0; i &lt; MAX_WORDS; i++){ System.out.println("Please enter word "+(i+1)+" of "+MAX_WORDS); word = scan.nextLine(); } System.out.println(word);// im stuck on how to concatenate the result } </code></pre> <p>}</p>
<java>
2016-08-02 12:02:00
LQ_CLOSE
38,719,999
cannot read property 'apply' of undefined gulp
<p>I am trying to use the ng-factory generator to scaffold a new project to build an angularjs component. After the project has been created with the yo ng-factory command, I tried to run it using the gulp serve task but found the following error:</p> <pre><code>c:\projects\bywebclient&gt;gulp serve [11:20:51] Loading C:\projects\bywebclient\gulp_tasks\browsersync.js [11:20:52] Loading C:\projects\bywebclient\gulp_tasks\karma.js [11:20:57] Loading C:\projects\bywebclient\gulp_tasks\misc.js [11:20:57] Loading C:\projects\bywebclient\gulp_tasks\webpack.js [11:21:07] Using gulpfile c:\projects\bywebclient\gulpfile.js C:\Users\ATUL KALE\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129 gulpInst.start.apply(gulpInst, toRun); </code></pre> <p>^</p> <blockquote> <p>TypeError: Cannot read property 'apply' of undefined<br> at C:\Users\ATUL KALE\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:129: 19<br><br> at _combinedTickCallback (internal/process/next_tick.js:67:7)<br> at process._tickCallback (internal/process/next_tick.js:98:9)<br> at Module.runMain (module.js:577:11)<br> at run (bootstrap_node.js:352:7)<br> at startup (bootstrap_node.js:144:9)<br> at bootstrap_node.js:467:3<br></p> </blockquote> <p>Am I missing something? I already tried to run again the npm install</p> <p>Thanks, Atul Kale</p>
<angularjs><npm><gulp><npm-install><gulp-sass>
2016-08-02 12:07:04
HQ
38,720,026
Convert swift2 code to swift3
Here is the code I would like compatible with swift3: { let size = text.boundingRectWithSize(CGSizeMake(view.frame.width - 26, 2000), options: NSStringDrawingOptions.UsesFontLeading.union(.UsesLineFragmentOrigin), context: nil).size }
<swift><swift3><migration>
2016-08-02 12:08:25
LQ_EDIT
38,720,493
How to check Internet connection on a Cordova App?
<p>I tried some suggestions, such as <strong>navigator.onLine</strong>, but even in flight mode, my app "thinks" its online.</p> <p>I found some suggestions with ajax too, but I just want to check if I'm online to open an external web page. If not, I intend to show a message such as "Your device seems to be offline. Check your connection!".</p>
<android><ios><cordova><networking><connection>
2016-08-02 12:30:40
HQ
38,720,679
How can i concatenate string+int+string in c++
How can I concatenate i+name+letter+i ? for(int i = 0; i < 10; ++i){ //I need a const char* to pass as a parameter to another function const char* name = "mki"; //letter is equal to "A" for the first 2, "B" for the second 3, //"C" for the following 4 ... const char* final_string = ??? } I already tried using: std::to_sting(i) but I got an error saying that to_string is undefined for std. I'm using VC++. Thanks.
<c++><string><char>
2016-08-02 12:40:04
LQ_EDIT
38,721,302
shouldAutorotate() function in Xcode 8 beta 4
<p>I updated Xcode 8 beta 3 to Xcode 8 beta 4 and I am actually correcting some bugs due to swift changement.</p> <p>Function :</p> <pre><code> override func shouldAutorotate() -&gt; Bool { return false } </code></pre> <p>Print an error and Xcode told me that this function is not override. It's mean that the function does not exist anymore.</p> <pre><code>override var shouldAutorotate </code></pre> <p>This var has just get properties so I can't change the value by this way.</p> <p>So how can I work with autorotate now ?</p> <p>Thanks !</p>
<ios><swift><xcode8>
2016-08-02 13:06:51
HQ
38,721,401
Wordpress: Default sorting by column of custom post type
<p>I have a custom post type called Contact, with custom fields like first name, surname, telephone number etc.</p> <p>In the admin section they're sorted chronologically I think, but I need them to be sorted by surname by default.</p> <p>I've read all the other solutions on here and none of them work, including:</p> <pre><code>function set_post_order_in_admin( $wp_query ) { global $pagenow; if ( is_admin() &amp;&amp; 'edit.php' == $pagenow &amp;&amp; !isset($_GET['orderby'])) { $wp_query-&gt;set( 'orderby', 'surname' ); $wp_query-&gt;set( 'order', 'ASC' ); } } add_filter('pre_get_posts', 'set_post_order_in_admin' ); </code></pre> <p>But whatever field I try to sort by, nothing changes, except toggling ASC/DESC seems to change to reverse chronological ordering.</p> <p>What am I doing wrong?</p>
<wordpress><sorting>
2016-08-02 13:11:31
HQ
38,721,792
Sitecore 8: MVC or Web Forms?
<p>I am new to Sitecore but I need to develop a all new Sitecore project. Although I have some experience with ASP.Net MVC and web form but I don't which is better for Sitecore 8.0.</p> <p>Here is the only related information that I found. <a href="https://www.cmssource.co.uk/blog/2013/october/sitecore-mvc-or-webforms" rel="nofollow">https://www.cmssource.co.uk/blog/2013/october/sitecore-mvc-or-webforms</a></p> <p>What technology should i choose- MVC or Web Forms ?</p>
<asp.net><asp.net-mvc><sitecore><sitecore8>
2016-08-02 13:26:49
LQ_CLOSE
38,722,105
Format strings vs concatenation
<p>I see many people using format strings like this:</p> <pre><code>root = "sample" output = "output" path = "{}/{}".format(root, output) </code></pre> <p>Instead of simply concatenating strings like this:</p> <pre><code>path = root + '/' + output </code></pre> <p>Do format strings have better performance or is this just for looks?</p>
<python><string-formatting>
2016-08-02 13:40:07
HQ
38,722,202
How do I change the number of decimal places on axis labels in ggplot2?
<p>Specifically, this is in a facet_grid. Have googled extensively for similar questions but not clear on the syntax or where it goes. What I want is for every number on the y-axes to have two digits after the decimal, even if the trailing one is 0. Is this a parameter in scale_y_continuous or element_text or...?</p> <pre><code>row1 &lt;- ggplot(sector_data[sector_data$sector %in% pages[[x]],], aes(date,price)) + geom_line() + geom_hline(yintercept=0,size=0.3,color="gray50") + facet_grid( ~ sector) + scale_x_date( breaks='1 year', minor_breaks = '1 month') + scale_y_continuous( labels = ???) + theme(panel.grid.major.x = element_line(size=1.5), axis.title.x=element_blank(), axis.text.x=element_blank(), axis.title.y=element_blank(), axis.text.y=element_text(size=8), axis.ticks=element_blank() ) </code></pre>
<r><ggplot2>
2016-08-02 13:43:40
HQ
38,722,309
How use if condition, if first valuable is above zero, then result needs to zero
let apliekamasumma = Double(brutoalga! - socnoalgas - summaapg - 75) if (apliekamasumma < 0) { let apliekamasumma = 0 } Please help me with code.
<swift><if-statement><return-value>
2016-08-02 13:47:59
LQ_EDIT
38,722,325
FragmentManager is already executing transactions. When is it safe to initialise pager after commit?
<p>I have an activity hosting two fragments. The activity starts off showing a loader while it loads an object. The loaded object is then passed to both fragments as arguments via newInstance methods and those fragments are attached.</p> <pre><code>final FragmentTransaction trans = getSupportFragmentManager().beginTransaction(); trans.replace(R.id.container1, Fragment1.newInstance(loadedObject)); trans.replace(R.id.container2, Fragment2.newInstance(loadedObject)); trans.commit(); </code></pre> <p>The second fragment contains a android.support.v4.view.ViewPager and tabs. onResume we initialise it like follows</p> <pre><code>viewPager.setAdapter(adapter); viewPager.setOffscreenPageLimit(adapter.getCount()); //the count is always &lt; 4 tabLayout.setupWithViewPager(viewPager); </code></pre> <p>The problem is android then throws </p> <blockquote> <p>java.lang.IllegalStateException: FragmentManager is already executing transactions</p> </blockquote> <p>With this stack trace: <em>(I took <code>android.support</code> out of the package names just for brevity)</em></p> <blockquote> <p>v4.app.FragmentManagerImpl.execSingleAction(FragmentManager.java:1620) at v4.app.BackStackRecord.commitNowAllowingStateLoss(BackStackRecord.java:637) at v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:143) at v4.view.ViewPager.populate(ViewPager.java:1235) at v4.view.ViewPager.populate(ViewPager.java:1083) at v4.view.ViewPager.setOffscreenPageLimit(ViewPager.java:847)</p> </blockquote> <p>The data shows if <code>setOffscreenPageLimit(...);</code> is removed. Is there another way to avoid this issue?</p> <p>When in the lifecycle is the fragment transaction complete so that I can wait to setup my pager?</p>
<android><android-fragments>
2016-08-02 13:48:44
HQ
38,722,861
In pgadmin3 do i get U I as in Mysql workbench
Am very new to postgres Sql. I got PgAdmin3 to work with database of postgresql. Am not so good with writing queries in Sql. As in Mysql workbench there is EER UI diagram representation which help us to draw new table easily. Do we have graphical representation of EER Diagram? If it is there, please help me anyone how to write draw new table.
<mysql><postgresql><pgadmin>
2016-08-02 14:11:43
LQ_EDIT
38,723,138
matlab execute script from command linux line
<p>is there a way to run a matlab script from linux command line? For instance, I have the following simple script "test.m":</p> <pre><code>x = [1,2,3]; y = [2;3;4]; prod = x*y disp(prod) </code></pre> <p>So what I want is to be able to execute that script from the linux command line without opening the matlab GUI or the matlab command line. That is, I expect something like that:</p> <pre><code>~$ matlab test.m </code></pre> <p>and I expect to see the result of the product on the linux command line.</p> <p>I know that you can do that with python e.g.,</p> <pre><code>~$ python test.py </code></pre> <p>but was wondering if the same can be achieved with matlab. </p>
<linux><matlab>
2016-08-02 14:23:49
HQ
38,723,140
I want to use stdin in a pytest test
<p>The PyTest documentation states that stdin is redirected to null as no-one will want to do interactive testing in a batch test context. This is true, but interactive is not the only use of stdin. I want to test code that uses stdin just as it would use any other file. I am happy with stdout and sterr being captured but how to actually have stdin connected to an io.StringIO object say in a PyTest conformant way?</p>
<python><pytest>
2016-08-02 14:23:52
HQ
38,723,645
R: Explanation needed for v <- 2*x + y + 1
I am learning R Programming language.The below code says 2*x will do 2.2 times, but what I can understand is 2*x says 2 multiplied with every element of X vector. But manual says 2.2 times , why that 0.2 times coming here or may be I am looking at it in wrong way. > v <- 2*x + y + 1 generates a new vector v of length 11 constructed by adding together, element by element, 2*x repeated 2.2 times, y repeated just once, and 1 repeated 11 times. Please help understanding this expression.
<r>
2016-08-02 14:45:13
LQ_EDIT
38,723,661
How to Change a Radio Button's Image When Another Radio Button has been Clicked HTML
So I have this table and I want the radio buttons to change images to a check mark, which they do (sort of, but more on that later), and I want whenever I click one of the radio buttons the other radio buttons change into a picture of a X Mark (http://i.imgur.com/RcuPIGF.png). Here is my code so far: http://liveweave.com/4poY04. As you can see no matter which radio button you click the first one always changes to the check mark image. I have tried changing the id of the radio buttons but that only makes the 2nd one always change to the check mark image.
<javascript><html><css>
2016-08-02 14:45:53
LQ_EDIT
38,723,896
Retry connection to Cassandra node upon startup
<p>I want to use Docker to start my application and Cassandra database, and I would like to use Docker Compose for that. Unfortunately, Cassandra starts much slower than my application, and since my application eagerly initializes the <code>Cluster</code> object, I get the following exception:</p> <pre><code>com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: cassandra/172.18.0.2:9042 (com.datastax.driver.core.exceptions.TransportException: [cassandra/172.18.0.2:9042] Cannot connect)) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:233) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79) at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1454) at com.datastax.driver.core.Cluster.init(Cluster.java:163) at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:334) at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:309) at com.datastax.driver.core.Cluster.connect(Cluster.java:251) </code></pre> <p>According to the stacktrace and a little debugging, it seems that Cassandra Java driver does not apply retry policies to the initial startup. This seems kinda weird to me. Is there a way for me to configure the driver so it will continue its attempts to connect to the server until it succeeds?</p>
<java><cassandra>
2016-08-02 14:55:58
HQ