Id
int64
34.6M
60.5M
Title
stringlengths
15
150
Body
stringlengths
33
36.7k
Tags
stringlengths
3
112
CreationDate
stringdate
2016-01-01 00:21:59
2020-02-29 17:55:56
Y
stringclasses
3 values
39,284,490
How to install a library from github?
<p>Trying to install this library.</p> <p><a href="https://github.com/pib/PyBrowser" rel="nofollow">https://github.com/pib/PyBrowser</a></p> <p>with the command </p> <pre><code>pip install git+https://github.com/pib/PyBrowser.git </code></pre> <p>and run into this error </p> <pre><code>setup.py </code></pre> <p>So I just cloned the repo in my sites-packages folder, but it still isnt seeing it as installed in python...</p> <p>Thanks!</p>
<python>
2016-09-02 04:46:50
LQ_CLOSE
39,284,563
How to set up a systemd service to retry 5 times on a cycle of 30 seconds
<p>I want systemd to start a script and retry a maximum of 5 times, 30s apart. Reading the systemd.service manual and searching the Internet didn't produce any obvious answers.</p>
<service><systemd>
2016-09-02 04:56:24
HQ
39,284,594
When I float the div to the right the screen messes up...I've tried clear and some other options...
I'm having an issue in general when it comes to floats. I'll be doing fine with the layout but once I start floating the whole page does weird stuff. I think I need a better understanding of the concept of what goes on. Here is my code for html and css. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html> <head> <title>This is it</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="wrapper"> <div id="heading">Heading</div> <div id="navigation">Navigation</div> <div id="leftSide">Left Side</div> <div id="rightSide">Right Side</div> <div id="footer">Footer</div> <div style="clear: right;"></div> </div> </body> </html> <!-- end snippet --> <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> * { margin: 0; } #heading { background-color: black; height: 150px; } #navigation { background-color: green; height: 30px; } #leftSide { background-color: blue; width: 400px; height: 700px; } #rightSide { background-color: red; width: 400px; height: 700px; float: right; } #footer { background-color: black; } <!-- end snippet -->
<css><html><css-float><footer>
2016-09-02 05:00:36
LQ_EDIT
39,284,686
convert associate array to normal array
<p>This is my array </p> <pre><code>$array = array( 1 =&gt; 'A', 2 =&gt; 'B', 3 =&gt; 'C', 4 =&gt; 'D', 5 =&gt; 'E', ); </code></pre> <p>I want to Convert it like this </p> <pre><code>array('A','B','C','D','E'); </code></pre>
<php><arrays><associative-array>
2016-09-02 05:10:50
LQ_CLOSE
39,284,924
how to Get date from input form within Mysql in PHP
how to Get date from input form within Mysql in PHP <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <tr> <td> <div class="field-row"> <label class="form-label" for="dateOfBirth">Date of birth</label> <input type="date" id="dob" class="field date-field dob-field" min="1900-01-01" max="2016-12-31" required> <span class="message"></span> </div> </td> </tr> <!-- end snippet -->
<php><mysql><forms>
2016-09-02 05:31:53
LQ_EDIT
39,285,205
hi friends how to write convert xml file to xsl file. below code is xml file
xml file: how to taken by row tag fields _id,_uuid,_position,_address in xsl formate <response> <row> <row _id = "1570186" _uuid = "D284E0E9-9807-491F-9A1D-21CB47ABED10" _position = "1570186" _address = "http://data.montgomerycountymd.gov/resource/_4mse-ku6q/1570186"> <date_of_stop> 2014 - 09 - 30 T00: 00: 00 </date_of_stop> </row> </row> </response> how to convert xml file to xsl file. please send solution as early as possible. thank you
<java><xml><csv><xslt>
2016-09-02 05:54:42
LQ_EDIT
39,286,030
How to split the strings in angular js
<p>I wanted to split a string and get the string in two parts.</p> <p>for example:</p> <pre><code>www.medicoshere.com/register.html?23457cedlske234cd </code></pre> <p>i wish to split the string in the above url and store the string that is after the ? to a variable. How can i do that.</p>
<javascript><angularjs>
2016-09-02 06:52:19
LQ_CLOSE
39,286,487
facing issue in session with the upgrade of my Application to Spring 4.1.9 and Hibernate 4.3.11
facing issue in session with the upgrade of my Application to Spring 4.1.9 and Hibernate 4.3.11..Logs are below:[org.springframework.orm.hibernate4.HibernateTemplate] - <Could not retrieve pre-bound Hibernate session> org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread at org.springframework.orm.hibernate4.SpringSessionContext.currentSession(SpringSessionContext.java:134) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:1014) at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:325) at org.springframework.orm.hibernate4.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:308) at org.springframework.orm.hibernate4.HibernateTemplate.findByCriteria(HibernateTemplate.java:1011) at org.springframework.orm.hibernate4.HibernateTemplate.findByCriteria(HibernateTemplate.java:1003)
<java><spring><hibernate>
2016-09-02 07:19:05
LQ_EDIT
39,286,785
html/CSS how to make a div always center when the window is resized
<p>I have a navigation bar which I want it to always stay centered when the window is resized. The bar is on top of a picture which serves as the background of the website. Here's the code:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!doctype html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;style&gt; body { font-family: Trebuchet MS; } .containermain { margin: auto; } .navibar { z-index: 1; position: absolute; background-color: #000000; border-radius: 5px; /*text-align: center;*/ left: 200px; right: 80px; top:140px; width: 870px; /*max-width: 100%;*/ margin: auto; } &lt;/style&gt; &lt;/head&gt; &lt;body style="margin:0px;"&gt; &lt;div class="containermain"&gt; &lt;img class="bg" src="bg.png" alt="background"&gt; &lt;/div&gt; &lt;div class="navibar"&gt; &lt;a class="button btnhome" href="x.html#home" target="_blank"&gt;home&lt;/a&gt; &lt;a class="button" href="x.html#portfolio" target="_blank"&gt;portfolio&lt;/a&gt; &lt;a class="button" href="x.html#blog" target="_blank"&gt;blog&lt;/a&gt; &lt;a class="button" href="x.html#contact" target="_blank"&gt;contact&lt;/a&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p> <p>I've tried several approach like "margin: auto", but nothing works, the navi bar is pinned to the place. Please help, thanks in advance!</p>
<html><css>
2016-09-02 07:34:23
LQ_CLOSE
39,287,609
Django Rest Framework debug post and put requests
<p>I use DRF extension to se json list for model, and there i can debug with <code>debug-toolbar</code> that <code>GET</code> request, but how can i debug <code>POST</code> and <code>PUT</code> requests?</p> <p>I have this for settings in debug mode:</p> <pre><code>INSTALLED_APPS += ('debug_toolbar',) MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',) DEBUG_TOOLBAR_PATCH_SETTINGS = False INTERNAL_IPS = ( '127.0.0.1' ) </code></pre> <p>Now, when i try with <code>Intercept redirects</code> in debug-toolbar, it doesn't show me toolbar when i do <code>POST</code>.</p>
<django><django-rest-framework><django-debug-toolbar>
2016-09-02 08:21:31
HQ
39,287,729
Filter rows by distinct values in one column in PySpark
<p>Let's say I have the following table:</p> <pre><code>+--------------------+--------------------+------+------------+--------------------+ | host| path|status|content_size| time| +--------------------+--------------------+------+------------+--------------------+ |js002.cc.utsunomi...|/shuttle/resource...| 404| 0|1995-08-01 00:07:...| | tia1.eskimo.com |/pub/winvn/releas...| 404| 0|1995-08-01 00:28:...| |grimnet23.idirect...|/www/software/win...| 404| 0|1995-08-01 00:50:...| |miriworld.its.uni...|/history/history.htm| 404| 0|1995-08-01 01:04:...| | ras38.srv.net |/elv/DELTA/uncons...| 404| 0|1995-08-01 01:05:...| | cs1-06.leh.ptd.net | | 404| 0|1995-08-01 01:17:...| |dialip-24.athenet...|/history/apollo/a...| 404| 0|1995-08-01 01:33:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:35:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:36:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:36:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:36:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:36:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:36:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:36:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:37:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:37:...| | h96-158.ccnet.com |/history/apollo/a...| 404| 0|1995-08-01 01:37:...| |hsccs_gatorbox07....|/pub/winvn/releas...| 404| 0|1995-08-01 01:44:...| |www-b2.proxy.aol....|/pub/winvn/readme...| 404| 0|1995-08-01 01:48:...| |www-b2.proxy.aol....|/pub/winvn/releas...| 404| 0|1995-08-01 01:48:...| +--------------------+--------------------+------+------------+--------------------+ </code></pre> <p>How I would filter this table to have only distinct paths in PySpark? But the table should contains all columns.</p>
<apache-spark><dataframe><pyspark><apache-spark-sql><spark-dataframe>
2016-09-02 08:27:41
HQ
39,288,595
Why not just use random_device?
<p>I am a bit confused about the c++11 random library.</p> <p>What I understand: we need two separate concepts:</p> <ul> <li>random engine (which can be pseudo (need seed) or real)</li> <li>distribution: it maps the numbers obtained from the engine to a specific interval, using a specific distribution.</li> </ul> <p>What I don't understand is why not just use this:</p> <pre><code>std::random_device rd; std::uniform_int_distribution&lt;int&gt; dist(1, 5); // get random numbers with: dist(rd); </code></pre> <p>As far as I can tell this works well.</p> <p>Instead, this is what I found on most examples/sites/articles:</p> <pre><code>std::random_device rd; std::mt19937 e{rd()}; // or std::default_random_engine e{rd()}; std::uniform_int_distribution&lt;int&gt; dist{1, 5}; // get random numbers with: dist(e); </code></pre> <p>I am not talking about special use, e.g. cryptography, just your basic getting started articles.</p> <p>My suspicion is because <code>std::mt19937</code> (or <code>std::default_random_engine</code>) accepts a seed, it can be easier to debug by providing the same seed during a debug session.</p> <p>Also, why not just:</p> <pre><code>std::mt19937 e{std::random_device{}()}; </code></pre>
<c++><c++11><random>
2016-09-02 09:11:00
HQ
39,288,706
jinja2 load template from string: TypeError: no loader for this environment specified
<p>I'm using Jinja2 in Flask. I want to render a template from a string. I tried the following 2 methods:</p> <pre><code> rtemplate = jinja2.Environment().from_string(myString) data = rtemplate.render(**data) </code></pre> <p>and</p> <pre><code> rtemplate = jinja2.Template(myString) data = rtemplate.render(**data) </code></pre> <p>However both methods return:</p> <pre><code>TypeError: no loader for this environment specified </code></pre> <p>I checked the manual and this url: <a href="https://gist.github.com/wrunk/1317933" rel="noreferrer">https://gist.github.com/wrunk/1317933</a></p> <p>However nowhere is specified to select a loader when using a string.</p>
<python><flask><jinja2>
2016-09-02 09:15:29
HQ
39,288,915
Detect previous path in react router?
<p>I am using react router. I want to detect the previous page (within the same app) from where I am coming from. I have the router in my context. But, I don't see any properties like "previous path" or history on the router object. How do I do it?</p>
<reactjs><react-router>
2016-09-02 09:25:19
HQ
39,289,285
How to create a Image Dataset just like MNIST dataset?
<p>I have 10000 BMP images of some handwritten digits. If i want to feed the datas to a neural network what do i need to do ? For MNIST dataset i just had to write</p> <pre><code>(X_train, y_train), (X_test, y_test) = mnist.load_data() </code></pre> <p>I am using Keras library in python . How can i create such dataset ?</p>
<python><image-processing><dataset><neural-network><keras>
2016-09-02 09:42:25
HQ
39,289,300
app with eclipse ,botton not work
i m new on java programmer i follow some book about java program and particulary eclipse. i write on easy program but the function of botton not work well, this is my code MainActivity.java import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.os.Build; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.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(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } } activity.java import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.content.Intent; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.Button; import android.os.Build; public class activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b = (Button) findViewById(R.id.btnRecipe); b.setOnClickListener(new OnClickListener(){ @SuppressWarnings("unused") public void onclick(View v){ startActivity(activity.this, recipe.class); } private void startActivity(activity activity, Class<recipe> class1) { // TODO Auto-generated method stub } @Override public void onClick(View arg0) { // TODO Auto-generated method stub } }); } private void setContentView(int activityMain) { // TODO Auto-generated method stub } private Button findViewById(int btnrecipe) { // TODO Auto-generated method stub return null; } recipe.java import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; public class recipe extends MainActivity { @Override protected void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.recipe); } } activity_main.xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.helloandroidword.MainActivity" tools:ignore="MergeRootFrame" /> fragment_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.helloandroidword.MainActivity$PlaceholderFragment" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:id="@+id/btnRecipe" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:layout_marginRight="20dp" android:text="Button" /> </RelativeLayout> recipe.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="27dp" android:layout_marginTop="54dp" android:text="ingredinti" android:textAppearance="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="81dp" android:text="acqua" android:textAppearance="?android:attr/textAppearanceSmall" /> <TextView android:id="@+id/textView3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView2" android:layout_centerVertical="true" android:text="sale" android:textAppearance="?android:attr/textAppearanceSmall" /> </RelativeLayout> AndroidManifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.helloandroidword" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <activity android:name="com.helloandroidword.MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity-alias android:name=".recipe"/> </application> </manifest> thank all
<java><android><eclipse>
2016-09-02 09:43:09
LQ_EDIT
39,289,705
what is diffrence between instert into tblname()values() and instert tblname()values() in sql
what is diffrence between instert into tblname()values() and instert tblname()values() in sql
<sql>
2016-09-02 10:03:31
LQ_EDIT
39,290,300
ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations:
<p>I am developing an Universal app for Iphone and IPad using xamarin, and I am trying to deploy the app to app store using Xamarin Studio while deployment I am facing the error</p> <blockquote> <p>ERROR ITMS-90474: "Invalid Bundle. iPad Multitasking support requires these orientations: 'UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight'. Found 'UIInterfaceOrientationPortrait,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationLandscapeRight' in bundle "bundle_Name"</p> </blockquote> <p>I have spend lots of time on google but I did not get any solution for this how to resolve it using Xamarin Studio.</p>
<ios><xamarin><xamarin.ios>
2016-09-02 10:34:39
HQ
39,290,841
Best approach to make a single page application
<p>I have seen many sites rendering json data in string format along with html in their page response:</p> <p>Take an instance of this for example: view-source:<a href="https://www.netflix.com/in/" rel="nofollow noreferrer">https://www.netflix.com/in/</a></p> <p><a href="https://i.stack.imgur.com/bDU7X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bDU7X.png" alt="enter image description here"></a></p> <p>What is the benefit of rendering JSON in string format in page response itself. One can render the page and can load data via ajax too when the page has rendered.</p> <p>I am thinking to build a SPA website totally on Angular with no server controls on my page, all data coming via REST API.</p> <p>What should be my approach on page rendering:</p> <ol> <li><p>Load the page (kind of blank) and then do a hit via ajax calls via Angular and fill the data into the page. This could have loading effect initially.</p></li> <li><p>Load everything in html form page initially via server side code. No ajax request on load of the page this time. If a user wants some more data I can do an ajax request via Angular further.</p></li> <li><p>Load JSON, the data for the page (in stringify format in script tags) + some html. The JSON data will be used to by Angular for templating and render the html there only. No ajax request is made this time too on page load since I rendered the data in json format along with page source. This is the case I posted earlier with Netflix url.</p></li> </ol> <p>What should be the best approach based on usability issue. I know Angular is great, but what is the best approach here to make a SPA.</p>
<javascript><angularjs><json><ajax><single-page-application>
2016-09-02 11:03:10
LQ_CLOSE
39,291,223
Django: Not Found static/admin/css
<p>I just deployed my first Django app on Heroku but I notice that it doesn't have any CSS like when I runserver on the local machine. I know there's something wrong with static files but I don't understand much about it even when I already read <a href="https://docs.djangoproject.com/en/1.10/howto/static-files/#serving-static-files-in-development" rel="noreferrer">the docs</a>. I can do</p> <p><code>python3 manage.py collectstatic</code></p> <p>to create a static folder but I don't know where to put it and how to change the DIRS in settings.py. I really need some help to get rid of it.</p> <p><a href="https://i.stack.imgur.com/1NtBa.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1NtBa.png" alt="root directory"></a></p> <p>settings.py:</p> <pre><code>DEBUG = True INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'household_management', ] TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] STATIC_ROOT = 'static' STATIC_URL = '/static/' </code></pre> <p>heroku logs:</p> <pre><code>2016-09-02T10:42:09.461124+00:00 heroku[router]: at=info method=GET path="/" host=peaceful-earth-63194.herokuapp.com request_id=33fc071d-344c-47e7-8721-919ba6d5df65 fwd="14.191.217.103" dyno=web.1 connect=2ms service=53ms status=302 bytes=400 2016-09-02T10:42:09.760323+00:00 heroku[router]: at=info method=GET path="/admin/login/?next=/" host=peaceful-earth-63194.herokuapp.com request_id=c050edcd-02d9-4c39-88ba-8a16be692843 fwd="14.191.217.103" dyno=web.1 connect=1ms service=45ms status=200 bytes=2184 2016-09-02T10:42:10.037370+00:00 heroku[router]: at=info method=GET path="/static/admin/css/login.css" host=peaceful-earth-63194.herokuapp.com request_id=ec43016a-09b7-499f-a84b-b8024577b717 fwd="14.191.217.103" dyno=web.1 connect=2ms service=9ms status=404 bytes=4569 2016-09-02T10:42:10.047224+00:00 heroku[router]: at=info method=GET path="/static/admin/css/base.css" host=peaceful-earth-63194.herokuapp.com request_id=6570ee02-3b78-44f4-9ab9-0e80b706ea40 fwd="14.191.217.103" dyno=web.1 connect=1ms service=16ms status=404 bytes=4566 2016-09-02T10:42:10.030726+00:00 app[web.1]: Not Found: /static/admin/css/login.css 2016-09-02T10:42:10.043743+00:00 app[web.1]: Not Found: /static/admin/css/base.css 2016-09-02T10:48:56.593180+00:00 heroku[api]: Deploy d1d39dc by huyvohcmc@gmail.com 2016-09-02T10:48:56.593290+00:00 heroku[api]: Release v21 created by huyvohcmc@gmail.com 2016-09-02T10:48:56.803122+00:00 heroku[slug-compiler]: Slug compilation started 2016-09-02T10:48:56.803127+00:00 heroku[slug-compiler]: Slug compilation finished 2016-09-02T10:48:56.893962+00:00 heroku[web.1]: Restarting 2016-09-02T10:48:56.894722+00:00 heroku[web.1]: State changed from up to starting 2016-09-02T10:48:59.681267+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2016-09-02T10:49:00.418357+00:00 app[web.1]: [2016-09-02 17:49:00 +0000] [9] [INFO] Worker exiting (pid: 9) 2016-09-02T10:49:00.418377+00:00 app[web.1]: [2016-09-02 17:49:00 +0000] [10] [INFO] Worker exiting (pid: 10) 2016-09-02T10:49:00.418393+00:00 app[web.1]: [2016-09-02 10:49:00 +0000] [3] [INFO] Handling signal: term 2016-09-02T10:49:00.477684+00:00 app[web.1]: [2016-09-02 10:49:00 +0000] [3] [INFO] Shutting down: Master 2016-09-02T10:49:00.594623+00:00 heroku[web.1]: Process exited with status 0 2016-09-02T10:49:00.607775+00:00 heroku[web.1]: Starting process with command `gunicorn assignment.wsgi --log-file -` 2016-09-02T10:49:02.911936+00:00 app[web.1]: [2016-09-02 10:49:02 +0000] [3] [INFO] Starting gunicorn 19.6.0 2016-09-02T10:49:02.912529+00:00 app[web.1]: [2016-09-02 10:49:02 +0000] [3] [INFO] Listening at: http://0.0.0.0:18162 (3) 2016-09-02T10:49:02.917427+00:00 app[web.1]: [2016-09-02 10:49:02 +0000] [9] [INFO] Booting worker with pid: 9 2016-09-02T10:49:02.912655+00:00 app[web.1]: [2016-09-02 10:49:02 +0000] [3] [INFO] Using worker: sync 2016-09-02T10:49:02.980208+00:00 app[web.1]: [2016-09-02 10:49:02 +0000] [10] [INFO] Booting worker with pid: 10 2016-09-02T10:49:04.228057+00:00 heroku[web.1]: State changed from starting to up 2016-09-02T10:53:41.572630+00:00 heroku[router]: at=info method=GET path="/" host=peaceful-earth-63194.herokuapp.com request_id=68c0b216-2084-46c8-9be5-b7e5aacaa590 fwd="14.191.217.103" dyno=web.1 connect=0ms service=42ms status=302 bytes=400 2016-09-02T10:53:41.880217+00:00 heroku[router]: at=info method=GET path="/admin/login/?next=/" host=peaceful-earth-63194.herokuapp.com request_id=17b91dc2-ba06-482c-8af0-e7b015fe2077 fwd="14.191.217.103" dyno=web.1 connect=0ms service=41ms status=200 bytes=2184 2016-09-02T10:53:42.156295+00:00 heroku[router]: at=info method=GET path="/static/admin/css/base.css" host=peaceful-earth-63194.herokuapp.com request_id=40dec62d-8c4a-4af6-8e0f-8053fe8379b9 fwd="14.191.217.103" dyno=web.1 connect=0ms service=9ms status=404 bytes=4566 2016-09-02T10:53:42.157491+00:00 heroku[router]: at=info method=GET path="/static/admin/css/login.css" host=peaceful-earth-63194.herokuapp.com request_id=3a29f200-c185-4344-a6e1-5af35e5d120e fwd="14.191.217.103" dyno=web.1 connect=0ms service=17ms status=404 bytes=4569 2016-09-02T10:53:42.164162+00:00 app[web.1]: Not Found: /static/admin/css/base.css 2016-09-02T10:53:42.177480+00:00 app[web.1]: Not Found: /static/admin/css/login.css 2016-09-02T11:01:19.031353+00:00 heroku[api]: Deploy 2beb15a by huyvohcmc@gmail.com 2016-09-02T11:01:19.031444+00:00 heroku[api]: Release v22 created by huyvohcmc@gmail.com 2016-09-02T11:01:19.262522+00:00 heroku[slug-compiler]: Slug compilation started 2016-09-02T11:01:19.262528+00:00 heroku[slug-compiler]: Slug compilation finished 2016-09-02T11:01:19.426837+00:00 heroku[web.1]: Restarting 2016-09-02T11:01:19.427455+00:00 heroku[web.1]: State changed from up to starting 2016-09-02T11:01:22.141325+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2016-09-02T11:01:22.545379+00:00 heroku[web.1]: Starting process with command `gunicorn assignment.wsgi --log-file -` 2016-09-02T11:01:22.754067+00:00 app[web.1]: [2016-09-02 18:01:22 +0000] [9] [INFO] Worker exiting (pid: 9) 2016-09-02T11:01:22.754077+00:00 app[web.1]: [2016-09-02 18:01:22 +0000] [10] [INFO] Worker exiting (pid: 10) 2016-09-02T11:01:22.757599+00:00 app[web.1]: [2016-09-02 11:01:22 +0000] [3] [INFO] Handling signal: term 2016-09-02T11:01:22.763197+00:00 app[web.1]: [2016-09-02 11:01:22 +0000] [3] [INFO] Shutting down: Master 2016-09-02T11:01:22.880977+00:00 heroku[web.1]: Process exited with status 0 2016-09-02T11:01:24.628348+00:00 app[web.1]: [2016-09-02 11:01:24 +0000] [3] [INFO] Starting gunicorn 19.6.0 2016-09-02T11:01:24.628921+00:00 app[web.1]: [2016-09-02 11:01:24 +0000] [3] [INFO] Listening at: http://0.0.0.0:34235 (3) 2016-09-02T11:01:24.629075+00:00 app[web.1]: [2016-09-02 11:01:24 +0000] [3] [INFO] Using worker: sync 2016-09-02T11:01:24.636198+00:00 app[web.1]: [2016-09-02 11:01:24 +0000] [9] [INFO] Booting worker with pid: 9 2016-09-02T11:01:24.722355+00:00 app[web.1]: [2016-09-02 11:01:24 +0000] [10] [INFO] Booting worker with pid: 10 2016-09-02T11:01:26.271435+00:00 heroku[web.1]: State changed from starting to up 2016-09-02T11:01:27.930795+00:00 heroku[router]: at=info method=GET path="/" host=peaceful-earth-63194.herokuapp.com request_id=a844ef4b-a2d1-44fe-af0e-09c76cb0e034 fwd="14.191.217.103" dyno=web.1 connect=0ms service=46ms status=302 bytes=400 2016-09-02T11:01:28.363163+00:00 heroku[router]: at=info method=GET path="/admin/login/?next=/" host=peaceful-earth-63194.herokuapp.com request_id=31c0823a-466f-4363-b550-3c81681305f5 fwd="14.191.217.103" dyno=web.1 connect=0ms service=171ms status=200 bytes=2184 2016-09-02T11:01:28.716801+00:00 heroku[router]: at=info method=GET path="/static/admin/css/base.css" host=peaceful-earth-63194.herokuapp.com request_id=2d1b8bb2-9ab3-49f7-b557-a54eed996547 fwd="14.191.217.103" dyno=web.1 connect=0ms service=8ms status=404 bytes=4566 2016-09-02T11:01:28.693936+00:00 heroku[router]: at=info method=GET path="/static/admin/css/login.css" host=peaceful-earth-63194.herokuapp.com request_id=24aa1eed-aa87-4854-ab35-1604e8393b9d fwd="14.191.217.103" dyno=web.1 connect=0ms service=18ms status=404 bytes=4569 2016-09-02T11:01:28.681948+00:00 app[web.1]: Not Found: /static/admin/css/base.css 2016-09-02T11:01:28.692958+00:00 app[web.1]: Not Found: /static/admin/css/login.css 2016-09-02T11:12:43.686922+00:00 heroku[api]: Deploy 63085e6 by huyvohcmc@gmail.com 2016-09-02T11:12:43.687037+00:00 heroku[api]: Release v23 created by huyvohcmc@gmail.com 2016-09-02T11:12:43.951987+00:00 heroku[slug-compiler]: Slug compilation started 2016-09-02T11:12:43.951998+00:00 heroku[slug-compiler]: Slug compilation finished 2016-09-02T11:12:43.926959+00:00 heroku[web.1]: Restarting 2016-09-02T11:12:43.929107+00:00 heroku[web.1]: State changed from up to starting 2016-09-02T11:12:46.931285+00:00 heroku[web.1]: Starting process with command `gunicorn assignment.wsgi --log-file -` 2016-09-02T11:12:47.860591+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2016-09-02T11:12:48.729601+00:00 app[web.1]: [2016-09-02 18:12:48 +0000] [10] [INFO] Worker exiting (pid: 10) 2016-09-02T11:12:48.729617+00:00 app[web.1]: [2016-09-02 18:12:48 +0000] [9] [INFO] Worker exiting (pid: 9) 2016-09-02T11:12:48.729623+00:00 app[web.1]: [2016-09-02 11:12:48 +0000] [3] [INFO] Handling signal: term 2016-09-02T11:12:48.775112+00:00 app[web.1]: [2016-09-02 11:12:48 +0000] [3] [INFO] Shutting down: Master 2016-09-02T11:12:48.890301+00:00 heroku[web.1]: Process exited with status 0 2016-09-02T11:12:48.839674+00:00 app[web.1]: [2016-09-02 11:12:48 +0000] [3] [INFO] Starting gunicorn 19.6.0 2016-09-02T11:12:48.840093+00:00 app[web.1]: [2016-09-02 11:12:48 +0000] [3] [INFO] Listening at: http://0.0.0.0:20001 (3) 2016-09-02T11:12:48.840166+00:00 app[web.1]: [2016-09-02 11:12:48 +0000] [3] [INFO] Using worker: sync 2016-09-02T11:12:48.843687+00:00 app[web.1]: [2016-09-02 11:12:48 +0000] [9] [INFO] Booting worker with pid: 9 2016-09-02T11:12:48.939210+00:00 app[web.1]: [2016-09-02 11:12:48 +0000] [10] [INFO] Booting worker with pid: 10 2016-09-02T11:12:50.565750+00:00 heroku[web.1]: State changed from starting to up 2016-09-02T11:13:00.439745+00:00 heroku[router]: at=info method=GET path="/" host=peaceful-earth-63194.herokuapp.com request_id=c30b47e6-fbb8-4412-9242-5fe37217026a fwd="14.191.217.103" dyno=web.1 connect=0ms service=49ms status=400 bytes=199 2016-09-02T11:14:01.686661+00:00 heroku[api]: Deploy c149525 by huyvohcmc@gmail.com 2016-09-02T11:14:01.686965+00:00 heroku[api]: Release v24 created by huyvohcmc@gmail.com 2016-09-02T11:14:02.189063+00:00 heroku[slug-compiler]: Slug compilation started 2016-09-02T11:14:02.189073+00:00 heroku[slug-compiler]: Slug compilation finished 2016-09-02T11:14:02.466456+00:00 heroku[web.1]: Restarting 2016-09-02T11:14:02.467005+00:00 heroku[web.1]: State changed from up to starting 2016-09-02T11:14:04.713176+00:00 heroku[web.1]: Stopping all processes with SIGTERM 2016-09-02T11:14:05.259388+00:00 app[web.1]: [2016-09-02 18:14:05 +0000] [10] [INFO] Worker exiting (pid: 10) 2016-09-02T11:14:05.260345+00:00 app[web.1]: [2016-09-02 11:14:05 +0000] [3] [INFO] Handling signal: term 2016-09-02T11:14:05.265937+00:00 app[web.1]: [2016-09-02 18:14:05 +0000] [9] [INFO] Worker exiting (pid: 9) 2016-09-02T11:14:05.317647+00:00 app[web.1]: [2016-09-02 11:14:05 +0000] [3] [INFO] Shutting down: Master 2016-09-02T11:14:05.411311+00:00 heroku[web.1]: Process exited with status 0 2016-09-02T11:14:06.581314+00:00 heroku[web.1]: Starting process with command `gunicorn assignment.wsgi --log-file -` 2016-09-02T11:14:10.282506+00:00 heroku[web.1]: State changed from starting to up 2016-09-02T11:14:10.187781+00:00 app[web.1]: [2016-09-02 11:14:10 +0000] [3] [INFO] Starting gunicorn 19.6.0 2016-09-02T11:14:10.188490+00:00 app[web.1]: [2016-09-02 11:14:10 +0000] [3] [INFO] Listening at: http://0.0.0.0:27446 (3) 2016-09-02T11:14:10.188627+00:00 app[web.1]: [2016-09-02 11:14:10 +0000] [3] [INFO] Using worker: sync 2016-09-02T11:14:10.211822+00:00 app[web.1]: [2016-09-02 11:14:10 +0000] [9] [INFO] Booting worker with pid: 9 2016-09-02T11:14:10.231978+00:00 app[web.1]: [2016-09-02 11:14:10 +0000] [10] [INFO] Booting worker with pid: 10 2016-09-02T11:14:29.714607+00:00 heroku[router]: at=info method=GET path="/" host=peaceful-earth-63194.herokuapp.com request_id=947ed6b9-b48a-48b1-8860-36846248acea fwd="14.191.217.103" dyno=web.1 connect=0ms service=153ms status=302 bytes=400 2016-09-02T11:14:30.522664+00:00 heroku[router]: at=info method=GET path="/admin/login/?next=/" host=peaceful-earth-63194.herokuapp.com request_id=b74c55bf-913c-4e0d-8d16-2b1f4f0cea13 fwd="14.191.217.103" dyno=web.1 connect=0ms service=561ms status=200 bytes=2184 2016-09-02T11:14:30.879732+00:00 heroku[router]: at=info method=GET path="/static/admin/css/base.css" host=peaceful-earth-63194.herokuapp.com request_id=769f989a-f051-4a89-a079-1d6acea3c185 fwd="14.191.217.103" dyno=web.1 connect=0ms service=86ms status=404 bytes=4566 2016-09-02T11:14:30.865971+00:00 heroku[router]: at=info method=GET path="/static/admin/css/login.css" host=peaceful-earth-63194.herokuapp.com request_id=b271b831-a4fb-4bdb-9f6a-e4d66297db88 fwd="14.191.217.103" dyno=web.1 connect=0ms service=75ms status=404 bytes=4569 2016-09-02T11:14:30.865501+00:00 app[web.1]: Not Found: /static/admin/css/login.css 2016-09-02T11:14:30.871110+00:00 app[web.1]: Not Found: /static/admin/css/base.css </code></pre>
<python><django><heroku><deployment>
2016-09-02 11:26:25
HQ
39,291,343
How do i change custom url links in Druapl 7?
Am using druapl 7 website. My default page url is website.com/category/4 I want to change this url like website.com/category/title Pls suggest me to change syntax.
<url><drupal-7><seo><alias><custom-url>
2016-09-02 11:31:53
LQ_EDIT
39,291,515
Exception Handling regarding nesting of try
<p>This was the objective type question which was asked me in one of my interview that .. Can we have try inside the try block? I think the answer is no. But I have to confirm the answer. So please tell me the correct answer. </p>
<c#>
2016-09-02 11:40:22
LQ_CLOSE
39,292,195
Angular2 Html inside a Component
<p>I want create a component like a template. For example, instead of writing this everywhere: </p> <pre><code>&lt;div class="myClass"&gt; &lt;div class="myHeader" id="headerId"&gt; Title &lt;/div&gt; &lt;div class="myContent" id="contentId"&gt; &lt;&lt;Some HTML code&gt;&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want to use a component like:</p> <pre><code>&lt;my-component title="Title" headerID=headerId contentID=contentID&gt; &lt;&lt;Some HTML code&gt;&gt; &lt;/my-component&gt; </code></pre> <p>How can I implement something like these in Angular2?</p>
<javascript><html><angular>
2016-09-02 12:14:35
HQ
39,292,691
how can i fetch json array from php code and display it in textview? using webclient
i am using xamarin.android at visual studio 2015 with c# language also i am using Mysql as a server and used `webclient` for connecting xamarin.android to Mysql this is my php code : ` $sql = "SELECT * FROM DoctorMaster WHERE DoctorId = '1'"; $result = $conn->query($sql);} i am pasting 2 images. [php code][1] [1]: http://i.stack.imgur.com/oZpbK.png and my Activity code is ` mClient = new WebClient(); mUrl = new Uri("http://www.olympicfitness.us/home.php"); //Call the PHP file mClient.DownloadDataAsync(mUrl); mClient.DownloadDataCompleted += MClient_DownloadDataCompleted; } private void MClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { string json = Encoding.UTF8.GetString(e.Result); mtextviwe3 = JsonConvert.DeserializeObject<TextView>(json); }` i am working on android and connected to server using webclient .i just want to know that my php code passes a list of array which i want to display array on textview .i have used "DeserializeObject()" but it give me an error "Newtonsoft.Json.JsonSerializationException: Unable to find a constructor to use for type Android.Widget.TextView. A class should either have a default constructor, one constructor with arguments or a constructor marked with the JsonConstructor attribute. Path '0', line 1, position 5." so my que is if i cant use "DeserializeObject()" for displaying it on textview den what function should i use and also i want to know that if i cant use textview den what can i use to display jsoon array. please guys help me.
<mysql><visual-studio-2015><json.net><xamarin.android><webclient>
2016-09-02 12:40:19
LQ_EDIT
39,293,718
Print a circular array c#
I have this situation: int[] array = new int[] {7, 5, 6} The value of my index i is 1 and he is pointing at the head of my hypothetical circular list, the value "7" at the zero position is the tail. My aim is to print: 5,6,7 Do I need a specific structure or can I do it with a simple array ?
<c#><arrays>
2016-09-02 13:32:34
LQ_EDIT
39,294,049
angular2-jwt No provider for AuthConfig
<p>I am struggling with the angular2-jwt documentation for rc5 </p> <p>Here is my NgModule</p> <pre><code>import { AuthHttp } from 'angular2-jwt'; @NgModule({ imports: [ BrowserModule, routing, HttpModule, FormsModule, ], declarations: [ AppComponent, LoginComponent, NavbarComponent, DashboardComponent, ModelsComponent ], providers: [AuthGuard, ModelService, AuthHttp ], bootstrap: [ AppComponent ] }) export class AppModule { } </code></pre> <p>Here Is my service </p> <pre><code>import { Injectable } from '@angular/core'; import {Http} from '@angular/http'; import 'rxjs/add/operator/map'; import { Model } from './model'; import { AuthHttp } from 'angular2-jwt'; import {Observable} from "rxjs/Rx"; @Injectable() export class ModelService { private _url = "http://127.0.0.1:8050/test/model"; constructor(private _http: Http,private _authHttp: AuthHttp){ //this.jwt = localStorage.getItem('id_token'); } getPollModles(){ return Observable.interval(5000).switchMap(() =&gt; this._authHttp.get(this._url)).map(res =&gt; res.json()); } } </code></pre> <p>How do I get angular2_jwt working with rc5 ? </p> <p>When I add my service to the construtor I get the below erorr.</p> <pre><code>constructor(private route: ActivatedRoute, public router: Router, private modelService: ModelService) core.umd.js:5995EXCEPTION: Uncaught (in promise): Error: Error in ./ModelsComponent class ModelsComponent_Host - inline template:0:0 caused by: No provider for AuthConfig! </code></pre>
<angular><angular2-jwt>
2016-09-02 13:49:44
HQ
39,294,583
powershell script to zip users home folder and move it to share drive
I want to move users home folder to share drive who has left the company but before that I want to ZIP it using powershell script. Could you please suggest me or write me quick powershell script which ZIPs the folder and move to share drive creating a same folder name with zip file also same name in destination folder. For instance if source folder is C:\test and destination is \\share\test\ Thanks in Advance,
<powershell><powershell-2.0><powershell-3.0><powershell-4.0>
2016-09-02 14:16:33
LQ_EDIT
39,294,859
require_tree argument must be a directory in a Rails 5 upgraded app
<p>I just upgraded my app from <code>Rails 4.2.7</code> to <code>Rails 5.0.0.1</code>. I used <a href="http://railsdiff.org/4.2.7/5.0.0.1" rel="noreferrer">RailsDiff</a> to make sure I had everything covered and I believe I did. So far everything has worked well up until the loading of my app. </p> <p>Now I am seeing this error:</p> <pre><code>Sprockets::ArgumentError at / require_tree argument must be a directory </code></pre> <p>This is my <code>application.css</code>:</p> <pre><code>/* * This is a manifest file that'll be compiled into application.css, which will include all the files * listed below. * * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. * * You're free to add application-wide styles to this file and they'll appear at the bottom of the * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS * files in this directory. Styles in this file should be added after the last require_* statement. * It is generally better to create a new file per style scope. * *= require_tree . *= require_self */ </code></pre> <p>This is my <code>application.js</code></p> <pre><code>// This is a manifest file that'll be compiled into application.js, which will include all the files // listed below. // // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. // // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the // compiled file. JavaScript code in this file should be added after the last require_* statement. // // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details // about supported directives. // //= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . </code></pre> <p>This is what the server log looks like:</p> <pre><code>Started GET "/" for ::1 at 2016-09-02 09:08:19 -0500 ActiveRecord::SchemaMigration Load (1.5ms) SELECT "schema_migrations".* FROM "schema_migrations" User Load (1.7ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 ORDER BY "users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]] Processing by ProfilesController#index as HTML Rendering profiles/index.html.erb within layouts/application Profile Load (1.6ms) SELECT "profiles".* FROM "profiles" Rendered profiles/index.html.erb within layouts/application (45.8ms) Completed 500 Internal Server Error in 367ms (ActiveRecord: 6.3ms) DEPRECATION WARNING: #original_exception is deprecated. Use #cause instead. (called from initialize at /.rvm/gems/ruby-2.3.1@myapp/gems/better_errors-2.1.1/lib/better_errors/raised_exception.rb:7) DEPRECATION WARNING: #original_exception is deprecated. Use #cause instead. (called from initialize at /.rvm/gems/ruby-2.3.1myapp/gems/better_errors-2.1.1/lib/better_errors/raised_exception.rb:8) Sprockets::ArgumentError - require_tree argument must be a directory: sprockets (3.7.0) lib/sprockets/directive_processor.rb:182:in `rescue in block in process_directives' sprockets (3.7.0) lib/sprockets/directive_processor.rb:179:in `block in process_directives' sprockets (3.7.0) lib/sprockets/directive_processor.rb:178:in `process_directives' </code></pre> <p>I am using no plugins of any kind. It is a fairly simple/vanilla app. The only styling is from the default <code>scaffold.scss</code>.</p> <p>What could be causing this?</p>
<ruby-on-rails><asset-pipeline><ruby-on-rails-5><sprockets>
2016-09-02 14:30:07
HQ
39,294,895
How to in Notepad ++ Short Case to Large Case Words?
I just want to use this method.... Short Case to Large Case Words.... ie: I have an email list....looks like... > abcdefg@example.org > abcde@example.org > abc@example.org2 > abcdefgh@example.org > abcdef@example.org > abcdefghi@example.org I want convert this list looks like... > abc@example.org > abcde@example.org > abcdef@example.org > abcdefg@example.org > abcdefgh@example.org > abcdefghi@example.org Please help me...
<list><notepad++>
2016-09-02 14:31:34
LQ_EDIT
39,295,200
Can I use functions imported from .py files in Dask/Distributed?
<p>I have a question about serialization and imports. </p> <ul> <li>should functions have their own imports? <a href="https://docs.continuum.io/anaconda-scale/howto/spark-basic#modify-std-script" rel="noreferrer">like I've seen done with PySpark</a></li> <li>Is the following just plain wrong? Does <code>mod.py</code> need to be a conda/pip package? <code>mod.py</code> was written to a shared filesystem.</li> </ul> <p></p> <pre><code>In [1]: from distributed import Executor In [2]: e = Executor('127.0.0.1:8786') In [3]: e Out[3]: &lt;Executor: scheduler="127.0.0.1:8786" processes=2 cores=2&gt; In [4]: import socket In [5]: e.run(socket.gethostname) Out[5]: {'172.20.12.7:53405': 'n1015', '172.20.12.8:53779': 'n1016'} In [6]: %%file mod.py ...: def hostname(): ...: return 'the hostname' ...: Overwriting mod.py In [7]: import mod In [8]: mod.hostname() Out[8]: 'the hostname' In [9]: e.run(mod.hostname) distributed.utils - ERROR - No module named 'mod' </code></pre>
<python><distributed-computing><dask>
2016-09-02 14:46:49
HQ
39,295,214
I WANT TO KNOW WHY IS THIS CODE NOT TAKING INPUTS FOR "DESIGNATION"?
[WHY IS IT NOT TAKING INPUTS FOR "DESIGNATION"][1] IF U CAN SEE THE OUTPUT FROM THE SCREENSHOT, THE fgets() function is running only once to take in the string "name", but it is not accepting the "designation" string and is skipping onto the "salary" input. What is intriguing me even more is the fact that this same code is running perfectly well in TurboC3....I am getting problems only with GCC compiler based IDE such as DevCPP and now in GCC itself in Linux. #include<iostream> #include<conio.h> #include<stdio.h> #include<string.h> using namespace std; class emp { private: char name[20],desig[20]; int id; float salary; public: void getdata() { cout<<"ENTER NAME:\n"; fgets(name,20,stdin); cout<<"ENTER ID:\n"; cin>>id; cout<<"ENTER DESIGNATION:\n"; fgets(desig,20,stdin); cout<<"ENTER SALARY:\n"; cin>>salary; } void showdata() { cout<<"NAME:- "<<name<<"\n"; cout<<"ID:- "<<id<<"\n"; cout<<"DESIGNATION: "<<desig<<"\n"; cout<<"SALARY: "<<salary<<"\n"; } }; int main() { emp ins[3]; int i; cout<<"ENTER DETAILS:\n"; for(i=0;i<3;i++) ins[i].getdata(); cout<<"*****************************DETAILS***************************\n"; for(i=0;i<3;i++) ins[i].showdata(); return 0; } [1]: http://i.stack.imgur.com/jG8LI.png
<c++><class><gcc>
2016-09-02 14:47:42
LQ_EDIT
39,296,020
How to install sagemath kernel in Jupyter
<p>I could use Python Kernel with Jupyter. I am looking for a way to use sagemath inside Jupyter.I couldnt see a way for installing it. How to do that?</p>
<jupyter><jupyter-notebook><sage>
2016-09-02 15:31:19
HQ
39,296,587
In which case does TaskCompletionSource.SetResult() run the continuation synchronously?
<p>Initially I thought that all continuations are executed on the threadpool (given a default synchronization context). This however doesn't seem to be the case when I use a <code>TaskCompletionSource</code>.</p> <p>My code looks something like this:</p> <pre><code>Task&lt;int&gt; Foo() { _tcs = new TaskCompletionSource&lt;int&gt;(); return _tcs.Task; } async void Bar() { Console.WriteLine(Thread.Current.ManagedThreadId); Console.WriteLine($"{Thread.Current.ManagedThreadId} - {await Foo()}"); } </code></pre> <p><code>Bar</code> gets called on a specific thread and the <code>TaskCompletionSource</code> stays unset for some time, meaning the returned tasks <code>IsComplete = false</code>. Then after some time, the same thread would proceed to call <code>_tcs.SetResult(x)</code>, which by my understanding should run the continuation on the threadpool.</p> <p>But what I observed in my application is that the thread running the continuation is in fact still the same thread, as if the continuation was invoked synchronously right as <code>SetResult</code> is called.</p> <p>I even tried setting a breakpoint on the <code>SetResult</code> and stepping over it (and having a breakpoint in the continuation), which in turn actually goes on to call the continuation synchronously.</p> <p><strong>When exactly does <code>SetResult()</code> immediately call the continuation synchronously?</strong></p>
<c#><multithreading><asynchronous><async-await>
2016-09-02 16:02:33
HQ
39,296,990
Grant Android USB Permission Automatically without a popup in Xamarin
I was sent to the following stackoverflow topic to have this occur from Xamarin forums (thanks David Hunt!): http://stackoverflow.com/questions/13647547/android-usb-automatically-grant-permission This appears that I would have to be have this completed in Java with Android and then a Jar file will have to be created so this can be utilized in Xamarin correct?
<c#><xamarin>
2016-09-02 16:26:59
LQ_EDIT
39,297,210
preg_match with first instance
<p>I'm trying to grab a word(s) between the word "in" and "with" inside of a string. The problem is that I have another instance of "with", it will extend the wildcard.</p> <p>Here is an example:</p> <pre><code>$item = 'This is a car in red with new tires and with a radio'; $pattern = = '/in (.*) with/i'; preg_match($pattern, $item, $matches); </code></pre> <p>Returns:</p> <pre><code>array(2) { [0]=&gt; string(30) "in red with new tires and with" [1]=&gt; string(22) "red with new tires and" } </code></pre> <p>What I would like $matches[1] to be is 'red'</p>
<php><regex>
2016-09-02 16:41:56
LQ_CLOSE
39,297,221
Multiple indexes vs single index on multiple columns in postgresql
<p>I could not reach any conclusive answers reading some of the existing posts on this topic.</p> <p>I have certain data at 100 locations the for past 10 years. The table has about 800 million rows. I need to primarily generate yearly statistics for each location. Some times I need to generate monthly variation statistics and hourly variation statistics as well. I'm wondering if I should generate two indexes - one for location and another for year or generate one index on both location and year. My primary key currently is a serial number (Probably I could use location and timestamp as the primary key). </p> <p>Thanks.</p>
<postgresql><database-indexes>
2016-09-02 16:42:38
HQ
39,297,703
Change sheet on multiple Excel documents from "Visible" to "Very Hidden"
<p>I need help modifying one sheet from multiple documents, the sheets the same name in between all the documents, from visible to becoming "Very Hidden". I know how to do this in VBA only for one document at a time but I do not know how to do it to many. </p> <p>I need to do this over 100 times so it would be great if anyone knew how to code this either using VBa or Python (maybe using "openpyxl" in Python 2?)</p> <p>Thank you</p>
<python><excel><vba>
2016-09-02 17:16:35
LQ_CLOSE
39,297,828
WHMCS with django 1.9 python?
<p>I just want to know if it's possible to use WHMCS with Django framework ?</p> <p>Thank in advance !</p>
<python><django><whmcs>
2016-09-02 17:25:17
LQ_CLOSE
39,297,953
Undefined variable codeigniter model
guys i need to understand why the country_id variable isn't defined in **Model :** public function getCountry($country_id) { $this->db->select()->where('country_id', $country_id); $this->db->from('country'); $query = $this->db->get(); return $query->result(); } **Controller :** $country_info = $this->country->getCountry($country_id); Result : Message: Undefined variable: country_id Filename: localisation/Countries.php Line Number: 12
<php><codeigniter>
2016-09-02 17:33:19
LQ_EDIT
39,297,979
How to set connection timeout for Mongodb using pymongo?
<p>I tried setting <code>connectTimeoutMS</code> and <code>socketTimeoutMS</code> to a low value but it still takes about 20 seconds before my script times out. Am I not using the options correctly? I want the script to exit after 5 seconds.</p> <pre><code>def init_mongo(): mongo_connection = MongoClient('%s' %MONGO_SERVER, connectTimeoutMS=5000, socketTimeoutMS=5000) if mongo_connection is None: return try: &lt;code&gt; except: &lt;code&gt; </code></pre>
<mongodb><pymongo><pymongo-3.x>
2016-09-02 17:34:56
HQ
39,298,604
I have a dobut about VBA - EXCEL
Firstly, Good afternoon to all I have a doubt about my program to the VBA/EXCEL I made a file called "MASTER WORKSHEET" with various data from a client, my goal is: To create a VBA to open any file in Excel and that I import chosen cells to fill out all data of the "MASTER WORKSHEET", for example, all excel file I open with the button "IMPORT DATA", it will automatically capture only those cells that I choose, but my program it captures but is with configuration problems on VALUE or NUMBER.
<vba><excel>
2016-09-02 18:20:25
LQ_EDIT
39,298,665
Use of unresolved identifier 'GGLContext'
<p>I am integrating Google Sign-In in my ios Swift app. I am following the official instructions on the google developer page here(<a href="https://developers.google.com/identity/sign-in/ios/sign-in?ver=swift" rel="noreferrer">https://developers.google.com/identity/sign-in/ios/sign-in?ver=swift</a> )</p> <p>Here is my Bridging Header: </p> <pre><code>#ifndef Header_h #define Header_h #endif /* Header_h */ #import &lt;CommonCrypto/CommonCrypto.h&gt; #import &lt;FBSDKCoreKit/FBSDKCoreKit.h&gt; #import &lt;FBSDKLoginKit/FBSDKLoginKit.h&gt; #import &lt;GoogleSignIn/GoogleSignIn.h&gt; </code></pre> <p>When I call the line in my <code>AppDelegate.swift</code> function that has </p> <pre><code> GGLContext.sharedInstance().configureWithError(&amp;configureError) </code></pre> <p>in it. It says </p> <pre><code> Use of unresolved identifier 'GGLContext' </code></pre> <p>Any help is appreciated. </p>
<ios><google-signin>
2016-09-02 18:24:21
HQ
39,299,719
Why do they call it a player?
<p>Dont get the reason behind why they call it a player in build settings.</p> <p><a href="https://i.stack.imgur.com/Q9qSC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q9qSC.png" alt="enter image description here"></a></p>
<unity3d>
2016-09-02 19:45:24
LQ_CLOSE
39,299,726
Can't find package on Anaconda Navigator. What to do next?
<p>I am trying to install "pulp" module in Anaconda Navigator's Environment tabs. But when I search in "All" packages I can't find it. It happened with other packages too. </p> <p><a href="https://i.stack.imgur.com/JqYIF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JqYIF.png" alt="enter image description here"></a></p> <p>Is there any way to install my package to the desired environment?</p> <p>I tried to install it by opening a terminal in the environment, but I see that afterwards it won't show up in the list. </p> <p>What am I missing here?</p>
<python><numpy><scipy><anaconda><pulp>
2016-09-02 19:46:00
HQ
39,300,167
How to use @ComponentScan together with test-specific ContextConfigurations in SpringJunit4TestRunner?
<p>I am testing a Spring Boot application. I have several test classes, each of which needs a different set of mocked or otherwise customized beans.</p> <p>Here is a sketch of the setup:</p> <p>src/main/java:</p> <pre><code>package com.example.myapp; @SpringBootApplication @ComponentScan( basePackageClasses = { MyApplication.class, ImportantConfigurationFromSomeLibrary.class, ImportantConfigurationFromAnotherLibrary.class}) @EnableFeignClients @EnableHystrix public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } package com.example.myapp.feature1; @Component public class Component1 { @Autowired ServiceClient serviceClient; @Autowired SpringDataJpaRepository dbRepository; @Autowired ThingFromSomeLibrary importantThingIDontWantToExplicitlyConstructInTests; // methods I want to test... } </code></pre> <p>src/test/java:</p> <pre><code>package com.example.myapp; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = MyApplication.class) @WebAppConfiguration @ActiveProfiles("test") public class Component1TestWithFakeCommunication { @Autowired Component1 component1; // &lt;-- the thing we're testing. wants the above mock implementations of beans wired into it. @Autowired ServiceClient mockedServiceClient; @Configuration static class ContextConfiguration { @Bean @Primary public ServiceClient mockedServiceClient() { return mock(ServiceClient.class); } } @Before public void setup() { reset(mockedServiceClient); } @Test public void shouldBehaveACertainWay() { // customize mock, call component methods, assert results... } } package com.example.myapp; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = MyApplication.class) @WebAppConfiguration @ActiveProfiles("test") public class Component1TestWithRealCommunication { @Autowired Component1 component1; // &lt;-- the thing we're testing. wants the real implementations in this test. @Autowired ServiceClient mockedServiceClient; @Before public void setup() { reset(mockedServiceClient); } @Test public void shouldBehaveACertainWay() { // call component methods, assert results... } } </code></pre> <p>The problem with the above setup is that the component scan configured in MyApplication picks up Component1TestWithFakeCommunication.ContextConfiguration, so I get a mock ServiceClient even in Component1TestWithRealCommunication where I want the real ServiceClient implementation.</p> <p>Although I could use @Autowired constructors and build up the components myself in both tests, there is a sufficient amount of stuff with complicated setup that I would rather have Spring TestContext set up for me (for example, Spring Data JPA repositories, components from libraries outside the app that pull beans from the Spring context, etc.). Nesting a Spring configuration inside the test that can locally override certain bean definitions within the Spring context feels like it should be a clean way to do this; the only downfall is that these nested configurations end up affecting all Spring TestContext tests that base their configuration on MyApplication (which component scans the app package).</p> <p>How do I modify my setup so I still get a "mostly real" Spring context for my tests with just a few locally overridden beans in each test class?</p>
<spring><spring-boot><spring-test>
2016-09-02 20:20:17
HQ
39,300,476
Angular2 TypeScript Directive error TS2345
<p>When I compile my app with tsc I get this error TS2345:</p> <pre><code>error TS2345: Argument of type '{ selector: string; template: string; directives: (typeof Title | any[])[]; providers: typeof Goo...' is not assignable to parameter of type 'ComponentMetadataType'. </code></pre> <p>And here is my code:</p> <pre><code>import { Component, Input } from "@angular/core"; import { Title } from "./components/title"; import { Timeline } from "./components/timeline"; @Component({ selector: "edu", template: ` &lt;div id="Edu" class="Edu content section scrollspy"&gt; &lt;title [icon]="titleIcon" [title]="titleTitle"&gt;&lt;/title&gt; &lt;timeline [data]="edu"&gt;&lt;/timeline&gt; &lt;/div&gt; `, directives: [Title, Timeline] }) export class Edu { private titleIcon = "graduation-cap"; private titleTitle = "Education"; @Input("data") edu: Array&lt;Object&gt;; } </code></pre> <p>I don't see anything wrong in my code, also it used to work. Can anyone see what's wrong with this?</p> <p>Note: I'm using Angular2-rc6 and TypeScript 1.8.10, hope these info helps</p>
<angular>
2016-09-02 20:46:22
HQ
39,300,880
How to find wrong prediction cases in test set (CNNs using Keras)
<p>I'm using MNIST example with 60000 training image and 10000 testing image. How do I find which of the 10000 testing image that has an incorrect classification/prediction?</p>
<python><machine-learning><theano><convolution><keras>
2016-09-02 21:22:13
HQ
39,303,180
Kotlin: How can I create a "static" inheritable function?
<p>For example, I want to have a function <code>example()</code> on a type <code>Child</code> that extends <code>Parent</code> so that I can use the function on both.</p> <pre><code>Child.example() Parent.example() </code></pre> <p>The first "obvious" way to do this is through the companion object of <code>Parent</code>, but this doesn't allow <code>example()</code> for <code>Child</code>.</p> <p>The second way I tried was defining an extension function on <code>Parent.Companion</code>, which is inconvenient because you are forced to define a companion object. It also doesn't allow <code>example()</code> for <code>Child</code>.</p> <p>Does anybody know how I can do this?</p>
<function><kotlin>
2016-09-03 04:17:00
HQ
39,303,530
Is this correct in PHP
<p>I was wondering if below is correct, I have tested it is working, I just want an opinion.</p> <p>file a.php:</p> <pre><code>namespace MyNamespace; class MyClass { public function ShowMessage($s) { echo $s; } } </code></pre> <p>file b.php</p> <pre><code>require_once 'a.php'; use MyNamespace\MyClass as MyAlias; $class = new MyAlias; $class-&gt;ShowMessage('Hello World!'); /* I have same results if I use this */ $class2 = new MyNamespace\MyClass(); $class2-&gt;ShowMessage('Hello World!'); </code></pre> <p>Thank you.</p>
<php><namespaces>
2016-09-03 05:22:24
LQ_CLOSE
39,303,608
How can i verify a user registartion using sms verification?
<p>i want to create a user registration by sms verification. after entering mobile number in my website(php) will send(and also will be stored to database against user id) a random 4 or 6 digit code to users number. then user will have to enter that code to my websites confirmation page. then it will check that code with the stored code in the database. if it matches then user is verified. <strong>I want to know what will be the cheapest sms service i can use in india ?</strong> <strong>if there are any free ervice like this then it will be good(atleast for testing).</strong></p>
<php><sms><sms-gateway>
2016-09-03 05:36:17
LQ_CLOSE
39,303,951
How should I use ArrayList<HashMap<String, String>> for adding text data as well as images?
Please help me out guys! What I am trying to do is create an android application to store and retrieve user details. I had completed developing the logic for storing the details. But while retrieving I am a bit confused regarding how to add images as well as other text data into a single ArrayList<HashMap<String, String>>.
<java><android><arraylist><hashmap>
2016-09-03 06:31:28
LQ_EDIT
39,304,188
how to add string to variable in php?
<p>i just need on small info i want just add '@' to one variable and and put add thing into one variable. i am adding small php code to here please suggest me.</p> <pre><code> &lt;?php $email34 = $row['email']; $rem = '@gmail.com'; $trim_email = str_replace($rem ,'', $email34); $tag_name ="@".$trim_emial.; echo $tag_name; ?&gt; </code></pre> <p>but i am getting only @ as output; but my out should be "@mahesh1" if any have idea about this code please help me. thank you advanced. </p>
<php>
2016-09-03 07:00:43
LQ_CLOSE
39,304,445
trying to get the selected items string out of a materialbetterSpinner but it shows can't resolve symbol getSelectedItem();(Which is for spinner).
MaterialBetterSpinner university; university = (MaterialBetterSpinner) findViewById(R.id.university); and my select code is--- university.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> arg0, View arg1, int position, long arg3) { String seluniversity = (String) university.*getSelectedItem();*--here is the issue
<android><android-spinner>
2016-09-03 07:32:48
LQ_EDIT
39,305,174
what does x = tf.placeholder(tf.float32, [None, 784]) means?
<p>I know basic use for tf.placeholder:</p> <pre><code>x = tf.placeholder(tf.float32, shape=(1024, 1024)) y = tf.matmul(x, x) with tf.Session() as sess: print(sess.run(y)) # ERROR: will fail because x was not fed. rand_array = np.random.rand(1024, 1024) print(sess.run(y, feed_dict={x: rand_array})) # Will succeed. </code></pre> <p>I know the second parameter is about <strong>shape</strong>. However I don't know what is that mean when the first one is <strong>None</strong> in the shape. ex:[None,784].</p>
<tensorflow>
2016-09-03 09:05:27
HQ
39,305,556
Google Rio 2016 Like Animation
<p>I'm currently building a new website, in which I would like to corporate something that Google is doing as well with some of their widgets (I'm sure other websites do as well.) </p> <p>I would like to have the website to have an animation to another tab, a little like the Google GIF I included. I know how to do the animation, but it has to get to another tab without having to go to another tab while it shouldn't be clear it's reloading, which I don't know how to do. </p> <p>Do any of you have any idea which framework or something I have to use? Should I use jQuery, or what else? I can look things up myself, but I would like to know how to get started with it, since I have no idea...</p> <p><a href="http://i.stack.imgur.com/U0Em9.gif" rel="nofollow">Link to GIF with example</a></p> <p>Thanks in advance,</p> <p>R. Baauw</p>
<jquery><animation>
2016-09-03 09:49:44
LQ_CLOSE
39,305,722
How to create a directory in plunker?
<p>How do you create a directory in a plunker ? or if there is a directory how do you create a new file/move in that directory ?</p> <p>Do you need to use an external tool for this ?</p> <p><code>Ex :</code> I have edited this existing <a href="http://plnkr.co/edit/ZfeAwx8ye3xRWjAUSIyn?p=options">angular2 plunker</a>, I have created <strong>myFile.ts</strong> file, I would like to move it in the <strong>app folder</strong>.<br> <a href="http://plnkr.co/edit/ZfeAwx8ye3xRWjAUSIyn?p=options">http://plnkr.co/edit/ZfeAwx8ye3xRWjAUSIyn?p=options</a></p>
<plunker>
2016-09-03 10:10:23
HQ
39,305,992
Converting dat file into array
<p>I am having a dat file which contains data of the form:</p> <p>0.23548 0.34938 0.54311 0.20902 0.52414 0.323418 1</p> <p>for each observation and separated by each line. How would one convert this into an array with the first 6 variables as X's and the last variable as Y?</p> <p>Thank you again!</p>
<python>
2016-09-03 10:40:05
LQ_CLOSE
39,306,590
Match list of incrementing integers using regex
<p>Is it possible to match a list of comma-separated decimal integers, where the integers in the list always increment by one?</p> <p>These should match:</p> <pre><code>0,1,2,3 8,9,10,11 1999,2000,2001 99,100,101 </code></pre> <p>These should not match (in their entirety - the last two have matching subsequences):</p> <pre><code>42 3,2,1 1,2,4 10,11,13 </code></pre>
<regex><pcre>
2016-09-03 11:52:50
HQ
39,306,618
How do I set the value in a command shell for dotnet core
<p>Running dotnet core command <strong>dotnet run</strong> in a command line I found this</p> <p><em>You can opt out of telemetry by setting a DOTNET_CLI_TELEMETRY_OPTOUT environment variable to 1 using your favorite shell.</em></p> <p><a href="https://i.stack.imgur.com/qFH9C.png" rel="noreferrer"><img src="https://i.stack.imgur.com/qFH9C.png" alt="DOTNET_CLI_TELEMETRY_OPTOUT"></a></p> <p>How do I set this variable? </p> <p>Thanks for your time.</p>
<.net><shell><visual-studio-2015><asp.net-core>
2016-09-03 11:57:08
HQ
39,306,688
Any way to install app to iPhone 4 with Xcode 8 beta?
<p>When trying to run app on my iPhone 4, Xcode 8 beta shows me this message:</p> <p><code>This iPhone 4 is running iOS 7.1.2 (11D257), which may not be supported by this version of Xcode.</code></p> <p>My app must support iOS 7. I read many answers they say that app build with Xcode 8 beta still can run on iOS 7 devices. So is there a way to install app to iPhone 4 with Xcode 8 beta? Like building the app first, then use a command line to install <code>.app</code> file to the iPhone?</p>
<ios><xcode><ios7>
2016-09-03 12:05:02
HQ
39,306,951
OpenGL/C++ How to get cross point from perpendicular line (B->A) and (middleBC->C)
I can not put questions in one line also here they are: How to draw a curve which is part of the circle(depending on the end point) Let: - A=(Ax,Ay) be the first point (A) - B=(Bx,By) be the second point (B) - C=(Cx,Cy) be the end point (mouse location) (C) - MBC(MBCx, MBC.y) are middle between B and C - p2 and p2 are line AB - p4 and p3 are line CD Question: - How to get cross(Mx,My) point from perpendicular line (B->A) and (middleBC->C) -[![enter image description here][1]][1] [1]: http://i.stack.imgur.com/z7cYS.png Any ideas how to code it? This question is relatet to [this](http://stackoverflow.com/questions/39274174/opengl-how-to-draw-curves-being-part-of-circle-depends-of-last-point-location-wi) topic
<c++><algorithm><trigonometry>
2016-09-03 12:35:40
LQ_EDIT
39,306,953
Define function / method if not defined before c++
<p>I don't use C++11 yet, so I wrote the functions <code>to_string(whatever)</code> by myself. They should only be compiled if they don't exist. If I switch to C++11, they should be skipped. I have something like this:</p> <pre><code>#ifndef to_string string to_string(int a){ string ret; stringstream b; b &lt;&lt; a; b &gt;&gt; ret; return ret; } string to_string(double a){ string ret; stringstream b; b &lt;&lt; a; b &gt;&gt; ret; return ret; } #endif </code></pre> <p>This doesn't work apparently. Is something like this possible and if yes, how?</p>
<c++><function><c++11><methods><precompile>
2016-09-03 12:35:42
HQ
39,307,129
difficulty with prob.3 on project euler (in c++)
<p>so, I've been trying to solve this problem for a few hours now. shortly I arrived to a solution that logically - should work and is working, but only for numbers no bigger than 10^7. I guess I could just const the specific number they asked for (600851475143) but I would really love to know - why my code isn't working with big numbers?</p> <p>this is my code for the solution :</p> <pre><code>#include &lt;iostream&gt; #include &lt;stdlib.h&gt; #include &lt;cmath&gt; using namespace std; //enter any number and its largest prime factor will be detected. int main() { long largest(1),num(0); bool primecheck; cout&lt;&lt;"enter the desired number :"&lt;&lt;endl; cin&gt;&gt;num; if (num%2==0) largest=2; cout&lt;&lt;"the relevant factors are: "; for (int i=3;i&lt;=int((sqrt(num))/2);i+=2) { primecheck=true; for(int j=2;j&lt;i;j++) { if(i%j==0) primecheck=false; } if(primecheck) if(num%i==0) { largest=i; cout&lt;&lt; largest&lt;&lt;"\t"; } } cout&lt;&lt;endl&lt;&lt; "the largest prime factor of the number you have entered is: " &lt;&lt;largest; return 0; } </code></pre> <p>thanks in advance! :)</p>
<c++>
2016-09-03 12:55:14
LQ_CLOSE
39,307,798
RestTemplate RestTemplate is empty
I created a REST Web Service with the tutorial "http://www.journaldev.com/2552/spring-rest-example-tutorial-spring-restful-web-services", but I am getting a 404 Error running the client. Debugging I found out that in class RestTemplate, method doWithRequest at line 504 List<MediaType> allSupportedMediaTypes = new ArrayList<MediaType>(); allSupportedMediaTypes is empty. The URI is http://localhost:8080/FIRST_REST; in tne pom.xml I have <artifactId>FIRST_REST</artifactId> and <name>FIRST_REST</name>, but maybe the URI is wrong. I don't know how I will get a response; I am going to keep watching this link. Your help will be greatly appreciated, Alejandro Barrero handro1104@gmail.com
<java>
2016-09-03 14:06:30
LQ_EDIT
39,308,011
Convert react JSX object to HTML
<p>I have a react application that generates HTML output based on some configuration. Like this:</p> <pre><code>export const getHtml = (config) =&gt; { const {classes, children} = config return (&lt;div className={classes.join(' ')}&gt;{children}&lt;/div&gt;); } </code></pre> <p>Inside the react app I can easily display the resulting DOM objects, but I want to save the HTML code to DB, to display it on a different page (without loading react/parsing the config again)</p> <p>I could not find a way to convert the JSX object to plain HTML...</p>
<javascript><reactjs>
2016-09-03 14:29:04
HQ
39,308,028
Beautifuelsoup - Python
I was hoping to ask a pretty simple question. I have come across the below code and have not been able to find a decent explanation as to i) what exactly does the .attrs function do in this cose ii) what is the function of the ['href'] part at the end i.e. what exactly does that part of the code execute. thanks very much for any help! from urllib.request import urlopen from bs4 import BeautifulSoup html = urlopen("url") bsObj = BeautifulSoup(html) for link in bsObj.findAll("a"): if 'href' in link.attrs: print (link.attrs['href'])
<python>
2016-09-03 14:30:28
LQ_EDIT
39,308,941
How to optimize this c program to find th eprime factorisation of a number
I have written a code for prime factorization of a number but i dont know how to optimize it to get better result for larger digits can anyone have idea about that? #include<stdio.h> int prime(int p, int q, int r); int main(){ int n,c=0; scanf("%d",&n); for(int j=2;j<=n;j++){ int t=0; for(int i=1;i<=j;i++){ if(j%i==0){ t++; } } if(t==2){ // printf(" %d ",j); c=prime(n,j,0); if(c!=0){ printf(" %d ",j); printf(" %d \n",c); } } } return 0; } int prime(int p,int q,int r){ if(p%q==0){ r++; prime(p/q,q,r); } else{ return r; } }
<c++><primes><prime-factoring>
2016-09-03 16:17:26
LQ_EDIT
39,309,449
android studio download for android phone
<p>Looking for a android studio / sdk that will download to a smartphone. Have been to the android site and selected download but it does not seem to complete and it does not download. Please assist.</p>
<android>
2016-09-03 17:15:52
LQ_CLOSE
39,309,583
What's the first byte in memory?
<p>I'm writing an operating system, and I need an address where the value is NULL. I was thinking a really far address, but, does the BIOS use the first byte in memory? My kernel won't use it for anything besides the constant char NULL, so I was thinking the first byte might not be used, where a really far address might be, if you'd need to allocate a lot of memory.</p>
<memory><assembly><operating-system><osdev>
2016-09-03 17:32:53
LQ_CLOSE
39,309,843
How do you create multiple forms on the same page with redux-forms v6?
<p>I have a simple todo app in which my redux store contains an array of 'todos'. My 'Todo' component maps over every 'todo' in the store and renders a 'TodoForm' component that uses redux-forms v6.</p> <p>As it is now, every 'todo' shares the same form name/key, so every time I input something in the 'title' Field, it changes the 'title' of every todo. I found a work around by using unique Field names, but I fear it's going to over complicate things as the app grows, and would prefer to use unique Form names so every field can have the same name without interfering with the other forms </p> <p>(TodoForm1, TodoForm2, TodoForm3 can all have a unique 'title' Field instead of TodoForm containing 'title1', 'title2', 'title3' Fields).</p> <p>I tried accessing the TodoForm's props so I could set each form's key as the component's unique id, but it doesn't seem like the component receives props that early. </p> <p>I also tried making an immediately invoked function where it spits out a random number, and using that number as the form's name, but that also didn't work.</p> <p>How can I can map through all my todos and render a v6 redux-form with a unique form key?</p> <p>Here's a picture of the app, console, and redux devtools. There's 3 'todos', but there's only one form that connects them all, todo-926, even though each form key should have been randomly generated in an immediately invoked function:</p> <p><a href="https://i.stack.imgur.com/fWSij.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fWSij.png" alt="Todo Conundrums"></a></p> <p>HomePageMainSection.index.js</p> <pre><code>renderTodos(todo) { if (!todo) { return &lt;div&gt;No Todos&lt;/div&gt;; } return ( &lt;div key={todo.get('id')}&gt; &lt;Todo todo={todo} updateTodo={this.props.updateTodo} deleteTodo={this.props.deleteTodo} /&gt; &lt;/div&gt; ); } render() { if (!this.props.todos) { return &lt;div&gt;No Todos&lt;/div&gt;; } return ( &lt;div className={styles.homePageMainSection}&gt; &lt;h1&gt;Hey I'm the Main Section&lt;/h1&gt; &lt;div&gt; {this.props.todos.get('todos').map(this.renderTodos)} &lt;/div&gt; &lt;/div&gt; ); } </code></pre> <p>Todo.index.js:</p> <pre><code> renderTodo() { if (this.state.editMode) { return ( &lt;TodoForm todo={this.props.todo} changeTodoEditMode={this.changeTodoEditMode} updateTodo={this.props.updateTodo} /&gt; ); } return ( &lt;div className={styles.Todo} onClick={this.changeTodoEditMode}&gt; &lt;div className="card card-block"&gt; &lt;h4 className="card-title"&gt;{this.props.todo.get('author')}&lt;/h4&gt; &lt;p className="card-text"&gt;{this.props.todo.get('title')}&lt;/p&gt; &lt;i className={`${styles.deleteIcon} btn btn-danger fa fa-times`} onClick={this.deleteTodo} &gt;&lt;/i&gt; &lt;/div&gt; &lt;/div&gt; ); } render() { return ( &lt;div className="col-xs-6 col-sm-4"&gt; {this.renderTodo()} &lt;/div&gt; ); } </code></pre> <p>TodoForm.index.js:</p> <pre><code>class TodoForm extends React.Component { // eslint-disable-line react/prefer-stateless-function constructor(props) { super(props); this._handleSubmit = this._handleSubmit.bind(this); } _handleSubmit(formData) { console.log(''); console.log('OG: ', this.props.todo) console.log('formData: ', formData); const data = this.props.todo.update('title', formData.get('title')); console.log('data: ', data); console.log(''); // this.props.updateTodo(data); } render() { const { handleSubmit, pristine, submitting } = this.props; return ( &lt;form className={`${styles.todoForm} card`} onSubmit={handleSubmit(this._handleSubmit)}&gt; &lt;div className="card-block"&gt; &lt;label htmlFor="title"&gt;{this.props.todo.get('title')}&lt;/label&gt; &lt;div className={'form-group'}&gt; &lt;Field name={`title`} component="input" type="text" placeholder="Enter new title" className="form-control" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;div className="card-block btn-group" role="group"&gt; &lt;button className="btn btn-success" type="submit" disabled={pristine || submitting} &gt; Submit &lt;/button&gt; &lt;button className="btn btn-danger fa fa-times" onClick={this.props.changeTodoEditMode} &gt; &lt;/button&gt; &lt;/div&gt; &lt;/form&gt; ); } } const randomNum = (() =&gt; { const thing = Math.floor(Math.random() * 1000) + 1; console.log('thing: ', thing); console.log('notThing: ', TodoForm.props); return thing; })(); export default reduxForm({ form: `todo-${randomNum}`, })(TodoForm); </code></pre>
<javascript><forms><reactjs><redux><redux-form>
2016-09-03 17:58:15
HQ
39,309,850
Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
<p>I am sure this used to work. </p> <p><code>SELECT first_name, surname, id, time, MIN(timeinmilliseconds) FROM users WHERE team= '$key</code>'</p> <p>I don't know where or why I would use a GroupBy Clause.</p>
<mysql><sql><group-by>
2016-09-03 17:58:59
LQ_CLOSE
39,309,990
Read a file of unknown size/length, strip non-alphabetic chars, and change uppercase to lower
<p>then it has to be printed to the screen 80 chars per line.</p> <p>this is done in c.</p> <p>My coding is super weak and don't know where to begin.</p> <p>Any help is appreciated</p>
<c><arrays><uppercase><lowercase><alphabetic>
2016-09-03 18:12:49
LQ_CLOSE
39,310,147
Upload a base64 image with Firebase Storage
<p>I'm making this app where users can have a profile picture (but only one picture each). I got everything set up, but when the pictures are 2mb+, it takes some time to load and actually I just need the pictures to be 50kb or so (only small display of pictures, max 40 pixels). I made some code to put the images directly into the realtime database (convert to canvas and make them a 7kb base64 string). However, this is not really clean and it's better to use Firebase Storage. </p> <p>Since the new update 3.3.0 you can upload Base64 formatted strings to Storage, using the putString() method. However, when I upload my canvas image (which starts with "data:image/jpeg;base64,"), I get the error:</p> <p><strong>v {code: "storage/invalid-format", message: "Firebase Storage: String does not match format 'base64': Invalid character found", serverResponse: null, name: "FirebaseError"}</strong>.</p> <p>Does this error occur because of string of the canvas image in the beginning? I've searched all over Stack, but I can't seem to find the answer. </p>
<javascript><image><canvas><firebase><firebase-storage>
2016-09-03 18:32:11
HQ
39,310,821
How to get out of man command in terminal
<p>How to get out of <code>man command</code> ?</p> <p>I pressed <code>man ls</code> command in mac and it is lot letting me enter other commands.</p> <p>As I am learning Linux , so please do not downvote me</p>
<linux><bash><terminal>
2016-09-03 19:56:38
LQ_CLOSE
39,311,341
divide a string into two halves in python
<p>this is my question:</p> <pre><code>F. front_back # Consider dividing a string into two halves. # If the length is even, the front and back halves are the same length. # If the length is odd, we'll say that the extra char goes in the front half. # e.g. 'abcde', the front half is 'abc', the back half 'de'. # Given 2 strings, a and b, return a string of the form # a-front + b-front + a-back + b-back </code></pre> <p>and this is my answer:</p> <pre><code>def front_back(a, b): s = "" if len(a) % 2 == 0: s = s + a[:len(a) / 2] if len(b) % 2 == 0: s = s + b[:len(b) / 2] s = s + a[len(a) / 2:] s = s + b[len(b) / 2:] else: s = s + b[:len(b) / 2 + 1] s = s + a[len(a) / 2 + 1:] s = s + b[len(b) / 2 + 1:] else: s = s + a[:len(a) / 2 + 1] if len(b) % 2 == 0: s = s + b[:len(b) / 2] s = s + a[len(a) / 2:] s = s + b[len(b) / 2:] else: s = s + b[:len(b) / 2 + 1] s = s + a[len(a) / 2 + 1:] s = s + b[len(b) / 2 + 1:] return s </code></pre> <p>this answer isn't work on all strings and i don't understand what is the problem.</p>
<python>
2016-09-03 21:07:57
LQ_CLOSE
39,311,507
802.1X Mac El Capitan profile delete
<p>How to delete 802.1x profile on Mac? </p> <p><a href="https://i.stack.imgur.com/JbYbr.png" rel="noreferrer"><img src="https://i.stack.imgur.com/JbYbr.png" alt="enter image description here"></a>Because I have no ability to connect to the "eduroam" wifi.</p>
<macos>
2016-09-03 21:28:22
HQ
39,311,651
Logic doesn't work in this method overloading example.
I'm sudying java from the Pluralsigh.com. Code below is written by me to follow the video lessons. The topic is method overloading. The code seem to not increment the passenger count as soon as I implement the hasCarryOnSpace method. I call this method inside the add1Passanger(int bags, int carryOns) method after the if statement. I also call it inside the add1Passenger(Passanger p, int carryOns) method. Please tell me what's wrong with my logic... public class Flight { //fields public int passengers; private int seats = 150; private int checkedBags; private int maxCarryOns = checkedBags*2, totalCarryOns; private int freeCheckedBags; //getter/setters public int getSeats(){return 150;} public int getCheckedBags() {return this.checkedBags;} //constructors public Flight (){} public Flight(int freeCheckedBags){ this.freeCheckedBags=freeCheckedBags;} public Flight(int freeCheckedBags, int checkedBags){ this(freeCheckedBags); this.checkedBags=checkedBags;} //methods public void addPassengers(Passenger... list){ if(hasSeats(list.length)){ passengers += list.length; for(Passenger passanger: list){ checkedBags += passanger.getCheckedBags(); } } else tooMany(); } public void add1Passenger(){ if(hasSeats()) passengers +=1; else tooMany(); return; } public void add1Passanger(int bags){ if(hasSeats()){ add1Passenger(); this.checkedBags+=bags; } } public void add1Passenger(Passenger p){ add1Passanger(p.getCheckedBags()); } public void add1Passenger(int bags, int carryOns){ if(hasSeats() && hasCarryOnSpace(carryOns)){ add1Passanger(bags); totalCarryOns+=carryOns; } } public void add1Passenger(Passenger p, int carryOns){ add1Passenger(p.getCheckedBags(), carryOns); } public boolean hasCarryOnSpace(int carryOns){ return totalCarryOns+carryOns < maxCarryOns; } public boolean hasSeats(){ return passengers < getSeats(); } private boolean hasSeats(int count) { return passengers+count <= seats; } private void tooMany(){ System.out.println("no more seats available"); } //main method public static void main(String[] args ){ Flight usAir = new Flight(); //i have a separate Passenger class created w/ freeBags as first //parameter and checkedBags as the second in its constructors Passenger bob = new Passenger(); Passenger jean = new Passenger(0, 1); Passenger nick = new Passenger(0, 2); Passenger dan = new Passenger(2,2); usAir.addPassengers(bob, jean); usAir.add1Passenger(dan); usAir.add1Passenger(); usAir.add1Passanger(2); //calls below don't increment the passenger count usAir.add1Passenger(nick, 2); usAir.add1Passenger(1, 1); System.out.println("usAir has " + usAir.passengers + " passengers " + "with " + usAir.getCheckedBags()+ " checked bags,"+" "+usAir.freeCheckedBags +" free bags, and "+usAir.totalCarryOns+" carryOns on board"); } }
<java><overloading>
2016-09-03 21:51:18
LQ_EDIT
39,312,058
Why cast to a pointer then dereference?
<p>I was going through this example which has a function outputting a hex bit pattern to represent an arbitrary float. </p> <pre><code>void ExamineFloat(float fValue) { printf("%08lx\n", *(unsigned long *)&amp;fValue); } </code></pre> <p>Why take the address of fValue, cast to unsigned long pointer, then dereference? Isn't all that work just equivalent to a direct cast to unsigned long?</p> <pre><code>printf("%08lx\n", (unsigned long)fValue); </code></pre> <p>I tried it and the answer isn't the same, so confused. </p>
<c++><c><casting>
2016-09-03 23:04:18
HQ
39,313,136
How can I get single integer number using edittext
I set edittext inputtype properties to number and maxlength to 1 I have tried some options EditText u1 = (EditText) findViewById(R.id.show_EditText); Int check = integer. Parseint(u1.getText().toString());
<java><android-studio>
2016-09-04 02:56:39
LQ_EDIT
39,314,086
What does it mean to bind() a socket to any address other than localhost?
<p>I don't understand what it <em>means</em> to <code>bind</code> a socket to any address other than 127.0.0.1 (or ::1, etc.).<br> Am I not -- <em>by definition</em> -- binding the socket to a port on <strong>my own</strong> machine.. which is localhost?<br> What sense does it make to bind or listen to <em>another</em> machine or IP address's port?<br> Conceptually, it just doesn't make sense to me!</p> <p>(This has proven surprisingly hard to Google... possibly because I'm not Googling the right terms.)</p>
<sockets><networking><ip><ip-address>
2016-09-04 06:18:05
HQ
39,314,620
Angular UI - set active tab programmatically
<p>I using AngularUI with this code:</p> <pre><code>&lt;uib-tabset type="pills"&gt; &lt;uib-tab heading="Tab 1"&gt;Tab 1 content&lt;/uib-tab&gt; &lt;uib-tab heading="Tab 2"&gt;Tab 2 content&lt;/uib-tab&gt; &lt;/uib-tabset&gt; </code></pre> <p>I want to programmatically change the current active tag from my angular-controller code. For example, select tab "2" to be the active. </p> <p>How this can be done?</p>
<angularjs><angular-ui-bootstrap><angular-ui><angular-ui-tabset>
2016-09-04 07:36:37
HQ
39,314,833
Google API Client "refresh token must be passed in or set as part of setAccessToken"
<p>I am currently facing a very strange problem, indeed I've been following this very same guide (<a href="https://developers.google.com/google-apps/calendar/quickstart/php" rel="noreferrer">https://developers.google.com/google-apps/calendar/quickstart/php</a>) from Google API documentation. I tried it twice, at the first time it work like a charm but after the access token had expire the script provided straight by Google API Doc was unable to refresh it.</p> <p>TL;DR</p> <p>Here is the error message:</p> <pre><code>sam@ssh:~$ php www/path/to/app/public/quickstart.php Fatal error: Uncaught exception 'LogicException' with message 'refresh token must be passed in or set as part of setAccessToken' in /home/pueblo/www/path/to/app/vendor/google/apiclient/src/Google/Client.php:258 Stack trace: #0 /home/pueblo/www/path/to/app/public/quickstart.php(55): Google_Client-&gt;fetchAccessTokenWithRefreshToken(NULL) #1 /home/pueblo/www/path/to/app/public/quickstart.php(76): getClient() #2 {main} thrown in /home/pueblo/www/path/to/app/vendor/google/apiclient/src/Google/Client.php on line 258 </code></pre> <p>Here is the part of the php script from google I've modified:</p> <pre><code>require_once __DIR__ . '/../vendor/autoload.php'; // I don't want the creds to be in my home folder, I prefer them in the app's root define('APPLICATION_NAME', 'LRS API Calendar'); define('CREDENTIALS_PATH', __DIR__ . '/../.credentials/calendar-php-quickstart.json'); define('CLIENT_SECRET_PATH', __DIR__ . '/../client_secret.json'); </code></pre> <p>I also modified the <code>expandHomeDirectory</code> so I could "disable" it without modifying too much code:</p> <pre><code>function expandHomeDirectory($path) { $homeDirectory = getenv('HOME'); if (empty($homeDirectory)) { $homeDirectory = getenv('HOMEDRIVE') . getenv('HOMEPATH'); } return $path; // return str_replace('~', realpath($homeDirectory), $path); } </code></pre> <p>So to check if I was wrong or if Google was, I did an experiment: yesterday night I launch the quickstart script from ssh to check if it was working, and indeed it was, so I decided to check this morning if it still working just as it was before I slept and it wasn't so I think there's something wrong with Google's <code>quickstart.php</code>.</p> <p>I hope someone could help me, I already checked all the other posts about the subject but they are all outdated.</p>
<php><google-api><google-calendar-api><access-token><google-api-php-client>
2016-09-04 08:05:47
HQ
39,315,250
Why is null+null = 0 in javascript
<p>I was doing some test for fun when noticed <code>null+null</code> is equal to <code>0</code>in javascript. Is there any reason for it ?</p>
<javascript><null>
2016-09-04 09:02:28
HQ
39,315,461
RxJava- RxAndroid form validation on dynamic EditText
<p>I have form that can have variable number of <code>EditText</code> that needs to be validated before form submission. I can perform validation check if <code>EditText</code>s are fixed in number like following - </p> <pre><code>Observable&lt;CharSequence&gt; emailObservable = RxTextView.textChanges(editEmail).skip(1); Observable&lt;CharSequence&gt; passwordObservable = RxTextView.textChanges(editPassword).skip(1); mFormValidationSubscription = Observable.combineLatest(emailObservable, passwordObservable, (newEmail, newPassword) -&gt; { boolean emailValid = !TextUtils.isEmpty(newEmail) &amp;&amp; android.util.Patterns.EMAIL_ADDRESS.matcher(newEmail).matches(); if(!emailValid) { emailInputLayout.setError(getString(R.string.error_invalid_email)); emailInputLayout.setErrorEnabled(true); }else { emailInputLayout.setError(null); emailInputLayout.setErrorEnabled(false); } boolean passValid = !TextUtils.isEmpty(newPassword) &amp;&amp; newPassword.length() &gt; 4; if (!passValid) { passwordInputLayout.setError(getString(R.string.error_invalid_password)); passwordInputLayout.setErrorEnabled(true); } else { passwordInputLayout.setError(null); passwordInputLayout.setErrorEnabled(true); } return emailValid &amp;&amp; passValid; }).subscribe(isValid -&gt;{ mSubmitButton.setEnabled(isValid); }); </code></pre> <p>But now as there are variable number of inputs I tried creating a list of <code>Observable&lt;CharSequence&gt;</code> and <code>Observable.combineLatest()</code> but I'm stuck as to proceed with that. </p> <pre><code>List&lt;Observable&lt;CharSequence&gt;&gt; observableList = new ArrayList&lt;&gt;(); for(InputRule inputRule : mMaterial.getRules()) { View vInputRow = inflater.inflate(R.layout.item_material_input_row, null, false); StyledEditText styledEditText = ((StyledEditText)vInputRow.findViewById(R.id.edit_input)); styledEditText.setHint(inputRule.getName()); Observable&lt;CharSequence&gt; observable = RxTextView.textChanges(styledEditText).skip(1); observableList.add(observable); linearLayout.addView(vInputRow); } Observable.combineLatest(observableList,......); // What should go in place of these "......" </code></pre> <p>How can I perform checks for a valid charsequence for each input field. I looked into <code>flatMap()</code>, <code>map()</code>, <code>filter()</code> methods but I don't know how to use them. </p>
<android><validation><rx-java><rx-android>
2016-09-04 09:26:48
HQ
39,315,486
Python use your own commands in py
<p>My question is something like in batch</p> <pre><code>:A set /p cmd= Command: %cmd% goto a </code></pre> <p>so when program throws exception I can use my own commands in the middle to test other xpath's or forms.</p>
<python><batch-file><cmd><command>
2016-09-04 09:29:21
LQ_CLOSE
39,316,164
Genymotion - /usr/lib64/libX11.so.6: undefined symbol: xcb_wait_for_reply64
<p>I installed Genymotion on openSUSE Leap 42.1 and don't have success to execute. I'm getting the following error:</p> <pre><code>genymotion/genymotion: symbol lookup error: /usr/lib64/libX11.so.6: undefined symbol: xcb_wait_for_reply64 </code></pre> <p>I have no idea what may have caused the problem. Anyone else seen this?</p>
<android><x11><genymotion>
2016-09-04 10:56:45
HQ
39,316,948
TypeError: login() takes 1 positional argument but 2 were given
<p>i have written a login view using buid in auth ,django auth.login() gives above error my code with error code o 500</p> <pre><code>from rest_framework.response import Response from rest_framework import status from rest_framework.decorators import api_view from django.contrib.auth.models import User from django.contrib.auth import authenticate,logout,login @api_view(['POST']) def register(request): user=User.objects.create_user(username=request.POST['username'],email=request.POST['email'],password=request.POST['password']) return Response({'ok':'True'},status=status.HTTP_201_CREATED) @api_view(['POST']) def login(request): user=authenticate( username=request.POST['username'], password=request.POST['password'] ) if user is not None: login(request,user) return Response({'ok':'True'},status=status.HTTP_200_OK) else: return Response({'ok':'False'},status=status.HTTP_401_UNAUTHORIZED) </code></pre>
<django><django-authentication>
2016-09-04 12:32:07
HQ
39,316,951
Can I move a DOM element to an arbitrary position without mutating the DOM?
Is it possible to move an element to a position in a variable without changing a value in the DOM?
<javascript><html><css>
2016-09-04 12:32:27
LQ_EDIT
39,317,252
What functions do Arrays in Google Apps Script support?
<p>I keep on finding that Array functions are missing in GAS, eg calling <code>find</code> gives the error: <code>Cannot find function find in object</code> </p> <p>The only docs I can find on this are somewhat ambiguous: <a href="https://developers.google.com/apps-script/guides/services/#basic_javascript_features" rel="noreferrer">https://developers.google.com/apps-script/guides/services/#basic_javascript_features</a></p> <blockquote> <p>Apps Script is based on JavaScript 1.6, plus a few features from 1.7 and 1.8. Many basic JavaScript features are thus available in addition to the built-in and advanced Google services: you can use common objects like Array, Date, RegExp, and so forth, as well as the Math and Object global objects. However, because Apps Script code runs on Google's servers (not client-side, except for HTML-service pages), browser-based features like DOM manipulation or the Window API are not available.</p> </blockquote> <p>How can I see what exact methods are available on Array?</p>
<google-apps-script>
2016-09-04 13:09:49
HQ
39,317,840
Uncaught SyntaxError: missing, ) after argument list
<p>im bulding a search box for movies using an API any time onkeyup event takes place a function is called which in turn prepare an ajax and display the responsed json in li tags. of course it displays 20 results i want to be able to store the result the user clicked on and displayed on div id="target" here is my code:</p> <p><a href="http://jsfiddle.net/bkj2z39y/" rel="nofollow">http://jsfiddle.net/bkj2z39y/</a></p> <p>every thing is working except the clicking </p> <pre><code> function func(str) { $('#here').html(''); document.getElementById("here").style.border = "0px"; $('#movie').val(''); alert(str); $('#target').html(str); console.log(str); } </code></pre> <p>i have tried several methods, this last one gives me an error </p> <p>Uncaught SyntaxError: missing ) after argument list</p>
<javascript><jquery><json>
2016-09-04 14:14:24
LQ_CLOSE
39,317,887
How to implement a method of a base class for every possible combination of its derived types
<p>I have the following Shape interface which is implemented by multiple other classes such as Rectangle, Circle, Triangle ...</p> <pre><code>interface IShape{ bool IsColliding(IShape other); } </code></pre> <p>The method IsColliding is supposed to check whether a Shape is colliding with another or not, regardless of their concrete type. However, each couple of shape (Rectangle/Rectangle, Rectangle/Circle, Circle/Triangle etc...) have its own implementation for this collision check.</p> <p>I'm trying to find a good design solution for this problem.</p> <p>The naive method would be to switch over the type of the "other" shape to call the correct implementation :</p> <pre><code>class Rectangle : IShape{ bool IsColliding(IShape other){ if(other is Rectangle){ return CollisionHandler.CheckRectangleVsRectangle(this,(Rectangle)other); }else if(other is Circle){ return CollisionHandler.CheckRectangleVsCircle(this,(Circle)other); } else // etc ... } } </code></pre> <p>But adding a new shape would mean modifying the method in every derived class to add the new case.</p> <p>I also thought of calling a unique static method like this one :</p> <pre><code>static bool IsColliding(IShape shapeA, IShape shapeB); </code></pre> <p>But even if it centralizes everything, it doubles the number of type-test to perform and I'd still have to add a new case in each first-level "if".</p> <pre><code>if(shapeA is Rectangle){ if(shapeB is Rectangle){ // Rectangle VS Rectangle }else if(shapeB is Circle){ // Rectangle VS Circle }else{ // etc ... } }else if(shapeA is Circle){ if(shapeB is Rectangle){ // Rectangle VS Circle }else{ // etc ... } } // etc ... </code></pre> <p>So, how could it be better designed ?</p>
<c#><oop><inheritance>
2016-09-04 14:20:05
HQ
39,318,059
Calculate business days, Insert Keys and Diagrams
Hi everybody i'm working on a problem in C++ Builder, i have to create a task management software for a company, but i have too much trouble with some concepts. So my 1st problem is a simple one but i don't see the error: I have on my form a TrStringGrid which is a modified TStringGrid and i want that each time the user clicks on insert on the keyboard that a row is filled automatically. The app starts with a tstringgrid with 2 rows, one is fixed and can't be modified and the second one is empty. That's what it look like: [![Grid][1]][1] [1]: http://i.stack.imgur.com/K4cSl.png So what i want to do is that the first time the user press the insert key the row n°2 is filled (the row that is not grey). The second and subsequent times the user press the insert key a row is added and filled automatically. I can't get it work and i don't know if i'm doing it the good way or not. //method called each time a key is pressed void __fastcall TForm1::rStringGridEd1KeyDown(TObject *Sender, WORD &Key, TShiftState Shift) { int counter = 1; switch(Key) { case VK_INSERT: //VK_INSERT for the insert button if(counter < 2) { for (int i = 0;i< rStringGridEd1->RowCount; i++) { rStringGridEd1->Cells[0][i] = "a"; rStringGridEd1->Cells[1][i] = "b"; rStringGridEd1->Cells[2][i] = "c"; rStringGridEd1->Cells[3][i] = "d"; rStringGridEd1->Cells[4][i] = "e"; counter++; } } if(counter >= 2){ for (int i = 0;i< rStringGridEd1->RowCount; i++) { rStringGridEd1->RowCount++; // this is used to add a row rStringGridEd1->Cells[0][i] = "a"; rStringGridEd1->Cells[1][i] = "b"; rStringGridEd1->Cells[2][i] = "c"; rStringGridEd1->Cells[3][i] = "d"; rStringGridEd1->Cells[4][i] = "e"; counter++; } } } } My next problem is how to add only business days to a specific date that the user entered. I can't get it work correctly. //Method I used to calculate date is the start date and the variable days are the days to add to date to get the new date TDate __fastcall TForm1 ::calulatenewdate( TDate date, int days) { TDate tmp; //tmp is used inside this method as date tmp = date; // j is used for to get the day of the week (Monday, Tuesday, Wesdnesday, etc..) int j; if (days == 1){ return date;} if (days == 2){ tmp= +1; j = DayOfWeek(tmp); // the day of the week is given in numbers from 1 to 7 ( 1 = Sunday, 2 = Monday, 3 = Wesdnesday,etc…) if (j == 7) { //So if j =7 which is Saturday add two days to get to monday tmp = tmp+2; return tmp; }else{ return tmp; } } if(days > 2){ // if the user enter a day greater than 2 for(int i =0; i < days;i++) { tmp=tmp+1; j = DayOfWeek(tmp); if (j == 7) { tmp =+2; } } return tmp; } and my third and last problem is that i want to draw horizontal diagrams,are there any good ones out there? Can anyone recommend me one? I'm really sorry for my bad english, it's not my mothertongue.
<c++><algorithm><c++builder>
2016-09-04 14:37:27
LQ_EDIT
39,318,167
How to compile and run haskell program in ubuntu linux system?
<p>I am new in ubuntu platform, i don't have idea how i can compile and run haskell code in ubuntu system, haskell is in my syllabus so i have to configure my system for haskell. Please show me the way.</p>
<linux><ubuntu><haskell><linux-mint><haskell-platform>
2016-09-04 14:50:40
LQ_CLOSE
39,318,191
Unrecognized selector UIDeviceRGBColor countByEnumeratingWithState:objects:count:
<p>I know this is kind of a dupe, but I don't have enough reputation yet to comment on the original post and, while I don't have an answer, I do have more useful information (a concrete example). Moderators, feel free to move this to the proper location.</p> <p>When compiling my code using the latest XCode 8 beta 6 (iOS 10 SDK), I get an exception "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIDeviceRGBColor countByEnumeratingWithState:objects:count:]: unrecognized selector sent to instance 0x600000071340'"</p> <p>This happens during the call:</p> <pre><code> auto viewController = [[[UIViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease]; </code></pre> <p>I have isolated the problem by whittling down my project to the bare minimum that will compile and still exhibit the problem. You can download it here:</p> <p><a href="https://www.dropbox.com/s/b7jggae97889xka/Bugtest.zip?dl=0" rel="noreferrer">Example project</a></p> <p>Note that I took out lots of code, nearly all classes are gone, which results in a lot of warnings (not errors) for nonexistent classes referenced from the xib. But that doesn't matter, the code still compiles and runs just fine with the iOS 9 SDK. After compiling with the iOS 10 sdk, however, it crashes both in the simulator and on devices running iOS 9.</p> <p>You can work around the problem by changing "#if 0" into "#if 1" in the file "HackForUnrecognizedSelectorInIOS10.m". This adds a category defining the missing selectors for UIColor. But obviously you can't add that to shipping code, it's just a temporary stopgap measure to continue developing.</p> <p>I filed a bug report (28153870). But if anyone has any more information on how to avoid this problem without ugly hacks, any information is welcome.</p> <p>Thanks</p> <p>Michel Colman</p>
<ios><objective-c><xcode><ios10><xcode8-beta6>
2016-09-04 14:52:37
HQ
39,318,239
Combine Unequal length list in c#
There are 2 lists with the unequal length , i want to combine into single list. var dataresource = (from det in dbobj.tbls1 where det.WorkTypeId == 1 select new { resnum = sowdet.number, }).ToList(); var datafixed = (from det123 in dbobj.tbls1 where det123.WorkTypeId == 2 select new { fixednum = det123.number, }).ToList(); dataresource contains values (A,B,C) datafixed contains values (D,E,F,G,H) Result expected is Resultlist = A D B E C F null G null H Tried using .ZIP() but unable to handle the listt with unequal size Thanks in Advancce
<c#><linq>
2016-09-04 14:58:15
LQ_EDIT
39,319,070
is "from flask import request" identical to "import requests"?
<p>In other words, is the flask request class identical to the requests library?</p> <p>I consulted:</p> <p><a href="http://flask.pocoo.org/docs/0.11/api/" rel="noreferrer">http://flask.pocoo.org/docs/0.11/api/</a></p> <p><a href="http://docs.python-requests.org/en/master/" rel="noreferrer">http://docs.python-requests.org/en/master/</a></p> <p>but cannot tell for sure. I see code examples where people seem to use them interchangeably.</p>
<python><flask><python-requests>
2016-09-04 16:26:46
HQ
39,320,445
" textarea " multilines PHP/ HTML
I am using php and html codes in same file for contact form. When I write multilines in html form (textarea): (name="TBody" cols="100" rows="10" class="largertextarea" required="required" placeholder="Leave A Message Here"), the php received the information and put all of them in same line : $body = $_POST["TBody"]; $msgbody = "- Message is about:" . "<br>" . $body; For example : Hi, Hope all are fine. Bye. What I receive in email is like this : Hi, Hope all are fine. Bye. So, how can I put them in multilines ? Thanks in advance for your help.
<php><html>
2016-09-04 18:58:07
LQ_EDIT
39,320,461
Error message in c invalid binary
hi I am a college student working on a c program i have most of it done but with one error msg in c Im getting a error Type invalid operands to binary & (have 'int *' and 'int') here is my program problem occurs line 34 or the fscanf num1 #include <stdio.h> #include <stdlib.h> FILE *infile; FILE *prnt; main() { int num1, num2, nums; char complex; float fcost; char name [11]; infile = fopen ("F:/DATA.txt", "r"); prnt = fopen ("F:/income.txt", "w"); if (infile == 0) { printf ("FILE NOT ON DISK\n"); system("pause"); return 0; } fprintf (prnt, "%-15s %-23s %6s\n\n", "ABAHLMAN", "Program 1", "PAGE 1"); fprintf (prnt, "\n"); fscanf (infile, " %i %i %i %f %c", &nums &num1 &num2 &fcost &name); while (!feof (infile)) { int area = (nums * 200) + (num1 * 300) + (num2 * 450); float cost = fcost + (area * 75.00); double income = 12 * ((nums *450) + (num1 * 550) + (num2 *700)); float payback = cost/ income; fprintf (prnt, "%-10s %5f %7c %9.2f\n", name, payback, area, cost); fscanf (infile, " %d %d %d %f %c", &nums &num1 &num2 &fcost &name); } fclose (infile); fclose (prnt); return 0; }
<c>
2016-09-04 19:00:25
LQ_EDIT
39,320,620
PHP Fatal error: Call to a member function query() on null
<p>I am new in php, and wonder why I getting this, need expert to guide. Thanks.</p> <p>PHP Fatal error: Call to a member function rowCount() on resource in C:\inetpub\wwwroot\xxx\xxx.php on line 9</p> <pre><code>&lt;?php include 'connect_db.php'; $conn = null; $sqlGetFeedback = "Select * from t_abc"; $resFB = $conn-&gt;query($sqlGetFeedback); $rows = array(); if($resFB-&gt;rowCount()){ echo json_encode($resFB-&gt;fetchAll(PDO::FETCH_ASSOC)); } else { echo '[{}]'; } ?&gt; </code></pre>
<php>
2016-09-04 19:20:04
LQ_CLOSE
39,320,825
POJO to org.bson.Document and Vice Versa
<p>Is there a simple way to convert Simple POJO to org.bson.Document?</p> <p>I'm aware that there are ways to do this like this one:</p> <pre><code>Document doc = new Document(); doc.append("name", person.getName()): </code></pre> <p>But does it have a much simpler and typo less way?</p>
<java><mongodb-java>
2016-09-04 19:43:40
HQ