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 |
|---|---|---|---|---|---|
35,858,052 | zsh: command not found: mysql | <p>Trying to use MySQL for rails app and downloaded it from dev.mysql.com.</p>
<p>After successfully installing the package and seeing the option to start and stop the server from Preference Pane, if I go ahead and execute following command in my terminal</p>
<pre><code>mysql --version
</code></pre>
<p>I end up with error as -</p>
<pre><code>zsh: command not found: mysql
</code></pre>
<p>I've been looking for this error and understand that this has something to do with my <code>$PATH</code> variable and if display the value by <code>echo $PATH</code> I get following output - </p>
<pre><code>/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.2.1/bin:/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.2.1@global/bin:/Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/Users/aniruddhabarapatre1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/opt/ImageMagick/bin:/usr/local/MacGPG2/bin:/Users/aniruddhabarapatre1/.rvm/bin
</code></pre>
<p>How do I resolve this error to get Mysql up and running.</p>
| <mysql><ruby-on-rails><macos><zsh> | 2016-03-08 02:53:30 | HQ |
35,858,347 | I write a project with tornado,but this is always a exception in my log file | This is the error log:
[I 160308 11:09:59 web:1908] 200 GET /admin/realtime (117.93.180.216) 107.13ms
[E 160308 11:09:59 http1connection:54] Uncaught exception
Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/tornado/http1connection.py", line 238, in _read_message
delegate.finish()
File "/usr/local/lib/python3.4/dist-packages/tornado/httpserver.py", line 290, in finish
self.delegate.finish()
File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 1984, in finish
self.execute()
File "/usr/local/lib/python3.4/dist-packages/blueware-1.0.10/blueware/hooks/framework_tornado/web.py", line 480, in _bw_wrapper__RequestDispatcher_execute
future = wrapped(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 2004, in execute
**self.handler_kwargs)
File "/usr/local/lib/python3.4/dist-packages/blueware-1.0.10/blueware/hooks/framework_tornado/web.py", line 448, in _bw_wrapper_RequestHandler___init___
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 185, in __init__
self.initialize(**kwargs)
File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 2714, in wrapper
self.redirect(url)
File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 671, in redirect
self.finish()
File "/usr/local/lib/python3.4/dist-packages/blueware-1.0.10/blueware/hooks/framework_tornado/web.py", line 309, in _bw_wrapper_RequestHandler_finish_
return wrapped(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 934, in finish
self.flush(include_footers=True)
File "/usr/local/lib/python3.4/dist-packages/tornado/web.py", line 870, in flush
for transform in self._transforms:
TypeError: 'NoneType' object is not iterable
[I 160308 11:10:00 web:1908] 200 GET /admin/order?order_type=1&order_status=1&page=0&action=allreal (49.89.27.173) 134.53ms
who can tell me how to sovle solve this problem , thank you very much~~
| <python><tornado> | 2016-03-08 03:25:03 | LQ_EDIT |
35,858,608 | How to convert time to " time ago " in android | <p>My server. It return time : </p>
<pre><code>"2016-01-24T16:00:00.000Z"
</code></pre>
<p>I want </p>
<p>1 : convert to String.</p>
<p>2 : I want it show " time ago " when load it from server.</p>
<p>Please. Help me!</p>
| <android><datetime><time><calendar> | 2016-03-08 03:51:10 | HQ |
35,859,140 | Remove transparency/alpha from any image using PIL | <p>How do I replace the alpha channel of any image (png, jpg, rgb, rbga) with specified background color? It must also work with images that do not have an alpha channel.</p>
| <python><python-imaging-library><pillow><alphablending> | 2016-03-08 04:44:17 | HQ |
35,860,150 | Your requirements could not be resolved to an installable set of packages in laravel 5.2 quickadmin | [enter image description here][1]
[1]: http://i.stack.imgur.com/JEj9f.jpg
please solve my problem.,., asup | <laravel><composer-php> | 2016-03-08 06:04:38 | LQ_EDIT |
35,860,436 | Create empty conda environment | <p>I can create a new conda environment, with program <code>biopython</code> with this:</p>
<pre><code>conda create --name snowflakes biopython
</code></pre>
<p>What if I do not want to install any program? It seems I can not do that:</p>
<pre><code>» conda create --name tryout
Error: too few arguments, must supply command line package specs or --file
You can specify one or more default packages to install when creating
an environment. Doing so allows you to call conda create without
explicitly providing any package names.
To set the provided packages, call conda config like this:
conda config --add create_default_packages PACKAGE_NAME
</code></pre>
| <python><anaconda> | 2016-03-08 06:23:18 | HQ |
35,860,977 | sublime how to trigger snippet on arrow '>>' | I want to create a `sublime snippet` for `ES6 lambda`
but the snippet not trigger on arrow **'>>'**, how to make this work?
[![enter image description here][1]][1]
[1]: http://i.stack.imgur.com/3krrM.png | <sublimetext2><sublimetext3> | 2016-03-08 06:59:06 | LQ_EDIT |
35,861,594 | onclick = return confirm () not working in me | hy Im new in php,please help me,
<td><a onclick='return confirm('Are you sure?') href='Delete_Vendor.php?ID=$row[ID]' ;> Delete </a> </td>
this code working in me but the alert of " Are you sure? " are not showing up. can someone help me? thanks alot
regards | <php><jquery><html><css> | 2016-03-08 07:36:52 | LQ_EDIT |
35,862,251 | What is the difference between != and <> operators in php? | <p>I am new to the php and what is the main difference between those operators </p>
| <php><mysql> | 2016-03-08 08:17:59 | LQ_CLOSE |
35,862,360 | Answer from Function is incorrect | <p>The answer of this function is returned into the main function of the program, and that works fine. The issue is that any value where the cosine should be 0, it turns out to give a weird irrational number (something like 1.30431912*10^-13). So, 90, 450, and so on, all turn out irrational answers. What's the matter?</p>
<pre><code> float cosineDegrees() {
string i;
double iDouble;
cout << "Give me a number to find the value of degrees in. ";
getline(cin, i);
iDouble = stod(i);
double PI = 3.14159265359;
float answer = cos((PI/180)*iDouble);
return answer;
}
</code></pre>
| <c++><trigonometry> | 2016-03-08 08:25:17 | LQ_CLOSE |
35,862,573 | Share article from webapp to native facebook | <p>If I want to share some string from a mobile web page, is there any way to launch user's native facebook app to share ?</p>
| <javascript><html><facebook><facebook-javascript-sdk> | 2016-03-08 08:37:18 | LQ_CLOSE |
35,863,082 | Pandas html: Don't truncate long values | <p>I understand that pandas does cut-off long elements. However, why does it do that in the html output?</p>
<pre><code>import pandas as pd
df = pd.DataFrame(columns=['url'], index=[0])
df['url'] = 'd12dn1928d1n298dn18d9n219d8n18n118219d8n21e12903e21kj9012j9301j2391023j209d12dn1928d1n298dn18d9n219d8n18n118219d8n21e12903e21kj9012j9301j2391023j209d12dn1928d1n298dn18d9n219d8n18n118219d8n21e12903e21kj9012j9301j2391023j209d12dn1928d1n298dn18d9n219d8n18n118219d8n21e12903e21kj9012j9301j2391023j209d12dn1928d1n298dn18d9n219d8n18n118219d8n21e12903e21kj9012j9301j2391023j209'
In [2]: df
Out[2]:
url
0 d12dn1928d1n298dn18d9n219d8n18n118219d8n21e129...
In [3]: df.to_html()
Out[3]: u'<table border="1" class="dataframe">\n <thead>\n <tr style="text-align: right;">\n <th></th>\n <th>url</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <th>0</th>\n <td>d12dn1928d1n298dn18d9n219d8n18n118219d8n21e129...</td>\n </tr>\n </tbody>\n</table>'
</code></pre>
<p>even in the html output (where it is obvious that it won't fit the screen width), the column value is truncated. How can I force <code>pandas</code> to not truncate, both with and without html?</p>
| <python><pandas> | 2016-03-08 09:04:41 | HQ |
35,863,608 | Shared library in containers | <p>For two processes A and B, the both use the library libc.so, libc.so is loaded into memory only once. This is a normal situation when A and B both run on the same host and the same rootfs.</p>
<p>When it comes to container, if A and B are running in different containers, are A and B sharing same memory area?</p>
<p>for example</p>
<p>imageA</p>
<p>--libc.so</p>
<p>--programA</p>
<p>imageB</p>
<p>--libc.so</p>
<p>--programB</p>
<p>we use <strong>chroot</strong> to run A and B in different rootfs. The two libc.so are same. Will libc.so be loaded into memory twice?</p>
| <docker><containers><shared><chroot> | 2016-03-08 09:30:55 | HQ |
35,863,795 | Why was I not able to access window or console in a javascript file without prefixing with .this? | <p>I was working in a javascript file where I was unable to use <code>window</code> or <code>console</code> to find out the value of variables. I had to write <code>this.window</code> or <code>this.console</code> instead.</p>
<p>What was going on here? I thought that window was always possible?</p>
<p>PS. This was within a function passed in angular.extend.</p>
| <javascript><angularjs> | 2016-03-08 09:39:09 | LQ_CLOSE |
35,864,287 | "REST API Client" option in Visual Studio for ASP.NET Core projects? | <p>I've got a ASP.NET REST API up and running in Azure. From an older .NET 4.5 project in Visual I've generated a client using this menu option:</p>
<p><a href="https://i.stack.imgur.com/8eHGA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/8eHGA.png" alt="Old .NET 4.5 project"></a></p>
<p>But when I create a new ASP.NET Core (ASP.NET 5) project, and want to generate the client there is no such option:</p>
<p><a href="https://i.stack.imgur.com/BdTYE.png" rel="noreferrer"><img src="https://i.stack.imgur.com/BdTYE.png" alt="New ASP.NET Core project"></a></p>
<p>What is the intended way to generate the client for my REST api in ASP.NET Core projects?</p>
| <.net><azure><asp.net-web-api> | 2016-03-08 10:02:24 | HQ |
35,864,617 | Are you writing opencv programs in ubuntu? | I need your help!
I have been troubled by the problem these days. I want to write opencv-3.0.0 programs with c language in the terminal of my ubuntu 14.04 in the VM.
Could you please give me an example of yours? | <opencv><ubuntu><gcc> | 2016-03-08 10:17:15 | LQ_EDIT |
35,864,671 | cont of teachers and students for each subject | I have 3 tables, user_table to classify as a teacher or student,
subject_table to mention different subject,
and enroll table stating who registered as teacher/student and for which subject.
I want to have count of student, teacher count for each subject
user_table
user_id
user_name
contact_no
password
flag
6
Abhis
123456788
123
s
5
Abhish
123456789
123
s
8
Sneha
1111111111
123
s
7
Snehil
1111112222
123
s
1
Narsingh
1234567890
123
t
2
Abhinav
1234567891
1234
t
3
Abhi
1234567892
123
s
4
Abhishek
1234567893
123
s
subject_table
sub_id
sub_name
3
CSS
1
HTML
2
JQUERY
enrolled_table
enr_id
sub_id
user_id
date
start_time
end_time
1
1
1
2016-04-01
09:00:00
10:00:00
2
2
1
2016-04-01
10:00:00
11:00:00
3
3
1
2016-04-01
11:00:00
12:00:00
4
1
5
2016-04-01
09:00:00
10:00:00
5
1
6
2016-04-01
12:00:00
13:00:00
6
1
7
2016-04-01
12:00:00
13:00:00
7
1
2
2016-04-01
13:00:00
14:00:00
8
2
2
2016-04-01
13:00:00
14:00:00 | <php><sql> | 2016-03-08 10:19:17 | LQ_EDIT |
35,864,994 | Variable array for alternating outcomes (javascript) | Hi im making a small javascript drinking game just for abit of fun n to learn certain aspects of javascript, iv looked over the code i have wrote n cant see why it doesnt work
Im trying to show a random array taken from the 2 variable arrays and alternate between them both, i dnt care for storage as the game wont need to be reloaded n there is no links to other pages so that is not a problem.
Please can people give me some pointers on what im doing wrong
<!DOCTYPE HTML5>
<html>
<head>
<script>
var boy = ["have a shot","item 2","item 3"];
var girl = ["have a shot","item 2","item 3"];
var selector = 1;
function rbg()
if (selector == 1)
{
document.getElementById("ppp").innerHTML = boy [Math.floor(Math.random() * boy.length)];
selector = 2;
}
else if (selector == 2)
{
document.getElementById("ppp").innerHTML = girl [Math.floor(Math.random() * girl.length)];
selector = 0;
}
else
{
document.getElementById("ppp".innerHTML = "have a shot each";
selector = 1;
}
</script>
<title>Home</title>
</head>
<body>
<div id="random" onclick="rbg()">Random</div>
<p id="ppp">outcome</p>
</body>
</html> | <javascript><arrays><variables> | 2016-03-08 10:34:09 | LQ_EDIT |
35,865,078 | How do i connect second database if my first database connection faild using eval in perl | <p>I want connect to database using perl but if my database connection is faild then i want connect to my second database using eval function. </p>
| <mysql><perl> | 2016-03-08 10:37:19 | LQ_CLOSE |
35,865,308 | why am i getting null pointer exception when trying to set a value to "rating" in my rating bar? | <p>I can see that the exception occurs at "rtb.setRating(8.0f);"
Also, i am able to set the rating manually in the xml file and that produces the intended outcome, e.g. android:rating="3.7"</p>
<pre><code>static String ingredients[] = {"Ingredient1","Ingredient2","Ingredient3","Ingredient4","Ingredient5","Ingredient6","Ingredient7","Ingredient8","Ingredient9","Ingredient10","Ingredient11","Ingredient12","Ingredient13","Ingredient14","Ingredient15","Ingredient16","Ingredient17","Ingredient18","Ingredient19","Ingredient20"};
static String steps[] = {"Step1","Step2","Step3","Step4","Step5","Step6","Step7","Step8","Step9","Step10"};
String url = "http://192.168.1.2/cricketjson.txt";
private ListView mDrawerList;
private ArrayAdapter<String> mAdapter;
static int[] ids = {1,2,3,4,5};
/**
* Fragment managing the behaviors, interactions and presentation of the navigation drawer.
*/
private NavigationDrawerFragment mNavigationDrawerFragment;
/**
* Used to store the last screen title. For use in {@link #restoreActionBar()}.
*/
private CharSequence mTitle;
private CharSequence mStep;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RatingBar rtb = (RatingBar) findViewById(R.id.rb);
rtb.setRating(8.0f);
setContentView(R.layout.activity_recipe);
mDrawerList = (ListView)findViewById(R.id.navList);
//set visual features
//set string values
TextView[] txtStep = {(TextView) findViewById(R.id.txtStep1), (TextView) findViewById(R.id.txtStep2)};
//txtStep1.setText("ftUr");
//set font Title
TextView mRecipeTitle = (TextView) findViewById(R.id.Title);
Typeface face = Typeface.createFromAsset(getAssets(),
"Italianno-Regular.ttf");
mRecipeTitle.setTypeface(face);
mRecipeTitle.setTextSize(TypedValue.COMPLEX_UNIT_SP, 77);
// set scrollview as transparent
findViewById(R.id.recipScrollView).setBackgroundColor(getResources().getColor(android.R.color.transparent));
// PD = new ProgressDialog(this);
// PD.setMessage("Loading.....");
mNavigationDrawerFragment = (NavigationDrawerFragment)
getSupportFragmentManager().findFragmentById(R.id.navigation_drawer);
mTitle = getTitle();
// Set up the drawer.
mNavigationDrawerFragment.setUp(
R.id.navigation_drawer,
(DrawerLayout) findViewById(R.id.drawer_layout));
mDrawerList.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(RecipeActivity.this, "Time for an upgrade!", Toast.LENGTH_SHORT).show();
}
});
//here*#8*#* put in the steps to the func.jsonrq
// Funcs.makejsonobjreq(ingredients, url, this,steps,id);
Funcs.makejsonobjreq(ingredients, url, this);
Funcs.makejsonobjreqrecipe(ingredients, url, this, steps, ids[0], txtStep);
}
@Override
public void onNavigationDrawerItemSelected(int position) {
// update the main content by replacing fragments
FragmentManager fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.container, PlaceholderFragment.newInstance(position + 1))
.commit();
}
public void onSectionAttached(int number) {
switch (number) {
case 1:
mTitle = getString(R.string.title_Recipe);
break;
case 2:
mTitle = ingredients[0];
break;
case 3:
mTitle = ingredients[1];
break;
case 4:
mTitle = ingredients[2];
break;
case 5:
mTitle = ingredients[3];
break;
case 6:
mTitle = ingredients[4];
break;
case 7:
mTitle = ingredients[5];
break;
case 8:
mTitle = ingredients[6];
break;
case 9:
mTitle = ingredients[7];
break;
case 10:
mTitle = ingredients[8];
break;
case 11:
mTitle = ingredients[9];
break;
case 12:
mTitle = ingredients[10];
break;
case 13:
mTitle = ingredients[11];
break;
case 14:
mTitle = ingredients[12];
break;
case 15:
mTitle = ingredients[13];
break;
case 16:
mTitle = ingredients[14];
break;
case 17:
mTitle = ingredients[15];
break;
case 18:
mTitle = ingredients[16];
break;
case 19:
mTitle = ingredients[17];
break;
case 20:
mTitle = ingredients[18];
break;
case 21:
mTitle = ingredients[19];
break;
}
}
public void restoreActionBar() {
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
actionBar.setDisplayShowTitleEnabled(true);
actionBar.setTitle(mTitle);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (!mNavigationDrawerFragment.isDrawerOpen()) {
// Only show items in the action bar relevant to this screen
// if the drawer is not showing. Otherwise, let the drawer
// decide what to show in the action bar.
getMenuInflater().inflate(R.menu.recipe, menu);
restoreActionBar();
return true;
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
/**
* A placeholder fragment containing a simple view.
*/
public static class PlaceholderFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
private static final String ARG_SECTION_NUMBER = "section_number";
/**
* Returns a new instance of this fragment for the given section
* number.
*/
public static PlaceholderFragment newInstance(int sectionNumber) {
PlaceholderFragment fragment = new PlaceholderFragment();
Bundle args = new Bundle();
args.putInt(ARG_SECTION_NUMBER, sectionNumber);
fragment.setArguments(args);
return fragment;
}
public PlaceholderFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_recipe, container, false);
return rootView;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
((RecipeActivity) activity).onSectionAttached(
getArguments().getInt(ARG_SECTION_NUMBER));
}
}
}
</code></pre>
<p>And the coressponding XML:</p>
<p>
</p>
<pre><code><!-- As the main content view, the view below consumes the entire
space available using match_parent in both dimensions. -->
<FrameLayout android:id="@+id/container" android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:background="@drawable/background8"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="20dip"
android:layout_gravity="right|center_vertical"
android:weightSum="1">
<TextView
android:layout_marginTop="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/Creator"
android:layout_alignLeft="@id/title"
android:textSize="20dp"
android:layout_gravity="center_horizontal" />
<TextView
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="@+id/Title"
android:layout_below="@id/Creator"
android:layout_gravity="center_horizontal" />
<ScrollView android:layout_width="match_parent"
android:layout_marginTop="0dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_height="198dp"
android:background="#ffffff"
android:id="@+id/recipScrollView">
<LinearLayout
android:layout_marginLeft="30dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="20dip"
android:weightSum="1">
<TextView
android:layout_marginTop="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Txt"
android:id="@+id/txtStep1" />
<TextView
android:layout_marginTop="30dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Txt"
android:id="@+id/txtStep2"
android:layout_below="@id/txtStep1"/>/>
</LinearLayout>
</ScrollView>
<RatingBar
android:layout_marginTop="30dp"
android:layout_marginLeft="30dp"
android:id="@+id/rb"
style="?android:attr/ratingBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:max="10"
android:numStars="10"
android:rating="3.7"
android:stepSize="0.0" />
</LinearLayout>
</FrameLayout>
<!-- android:layout_gravity="start" tells DrawerLayout to treat
this as a sliding drawer on the left side for left-to-right
languages and on the right side for right-to-left languages.
If you're not building against API 17 or higher, use
android:layout_gravity="left" instead. -->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<fragment android:id="@+id/navigation_drawer"
android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent"
android:layout_gravity="start" android:name="com.example.finnb.rcp.NavigationDrawerFragment"
tools:layout="@layout/fragment_navigation_drawer" />
<ListView
android:id="@+id/navList"
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="left|start"
android:background="#ffeeeeee"/>
</code></pre>
<p></p>
<p>And the LogCat error:</p>
<pre><code>03-08 04:52:30.350 1946-1946/com.example.finnb.rcp D/dalvikvm﹕ Not late-enabling CheckJNI (already on)
03-08 04:52:30.460 1946-1946/com.example.finnb.rcp D/AndroidRuntime﹕ Shutting down VM
03-08 04:52:30.460 1946-1946/com.example.finnb.rcp W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb0ca2b20)
03-08 04:52:30.460 1946-1946/com.example.finnb.rcp E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.finnb.rcp, PID: 1946
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.finnb.rcp/com.example.finnb.rcp.RecipeActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.example.finnb.rcp.RecipeActivity.onCreate(RecipeActivity.java:62)
at android.app.Activity.performCreate(Activity.java:5231)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
at android.app.ActivityThread.access$800(ActivityThread.java:135)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>
| <java><android><xml><nullpointerexception><ratingbar> | 2016-03-08 10:47:43 | LQ_CLOSE |
35,866,360 | Automatic page refresh once per day | <p>I want to refresh the page automatically once per day. I tried the following code:</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><meta http-equiv="refresh" content="86400"></code></pre>
</div>
</div>
</p>
<p>and tried with some javascript code also.But nothing is working. So anybody guide me to do this.</p>
| <php> | 2016-03-08 11:39:26 | LQ_CLOSE |
35,868,215 | Mysql, get data from another row in the same column | <p>I'm a beginner in mySQL and php. <a href="http://i.stack.imgur.com/Us7We.png" rel="nofollow">my database</a></p>
<p>I would like to know, how to get someones email address based on his username. So for instance if I know the username is: iamtheboss, how could I get his email?</p>
| <php><mysql><database> | 2016-03-08 13:05:35 | LQ_CLOSE |
35,868,551 | Laravel Distinct Count | <p>Any way to make this query work using laravel? DB::raw or Eloquent usage doesn't matter.</p>
<pre><code>SELECT count(DISTINCT name) FROM tablename;
</code></pre>
<p>Here's what i've tried but cannot get the proper output:</p>
<pre><code>EloquentTableName::select(DB::raw('count(DISTINCT name) as name_count'))->get();
</code></pre>
<p>This returns something like this and i'd like to fix that:</p>
<pre><code>([{"name_count":"15"}])
</code></pre>
<p>I just want to get count 15.</p>
| <php><database><laravel><eloquent> | 2016-03-08 13:20:46 | HQ |
35,868,817 | How to Hide API_KEY in browzer's Source Code? | Can anyone help me? Suppose i'm sending **API_KEY** from Server to Client Side and at client side i'm using JavaScript/jquery. How can i protect my API_KEY so that no one can see this API_KEY by "Right Click-> View Page Source" in js Part. | <javascript> | 2016-03-08 13:31:58 | LQ_EDIT |
35,869,406 | Angular2 detect change in service | <p>I have one component in Angular2 which is changing a "lang" class variable in my service translate.service.ts. In another component I am fetching a dict with the translation on init. If the first component changes the services language later, I want to refetch the dict in the second component automatically. How do I do that?</p>
<p>First component:</p>
<pre><code> setLang(lang) {
this._translateService.setLang(lang);
}
</code></pre>
<p>Service:</p>
<pre><code>dict = { "en": {}};
lang = "en";
setLang(lang) {
this.lang = lang;
}
getLang() {
return this.dict;
}
</code></pre>
<p>Second component:</p>
<pre><code>ngOnInit() {
this.dict = this._translateService.getDict();
}
</code></pre>
| <angular> | 2016-03-08 14:00:20 | HQ |
35,869,985 | datetime.datetime is not JSON serializable | <p>I have a class in Python for retrieving all the columns in a table and return a JSON with this data.</p>
<p>The problem is at least one of those columns is a datetime and I can't seem to understand how to serialize the columns so I can generate a valid JSON.</p>
<p>My class is as follows:</p>
<pre><code>class GetTodos(Resource):
def get(self):
con = cx_Oracle.connect('brunojs/bdpf5@127.0.0.1/orcl')
cur = con.cursor()
cur.execute("select * from organite_repository")
r = [dict((cur.description[i][0], value) \
for i, value in enumerate(row)) for row in cur.fetchall()]
cur.connection.close()
return (r[0] if r else None) if None else r
</code></pre>
<p>Any hints on this?</p>
| <python><datetime> | 2016-03-08 14:27:42 | HQ |
35,870,607 | background invalid property | <p>The page only accepts colors in the backgroud, images not</p>
<pre><code> background: url (img/fondo-ingresar.jpg);
</code></pre>
<p>I even tried to put it in the HTML but still the same error of <strong>"Invalid Property Value"</strong></p>
| <css><background-image> | 2016-03-08 14:53:30 | LQ_CLOSE |
35,871,851 | Syntax Erro Python | Estou iniciando python pouco tempo. Não estou conseguindo resolver esse erro.
import pygame, sys
from pygame.locals import *
pygame.init()
DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('Hello World!')
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
pygame.display.update()
[enter image description here][1]
[1]: http://i.stack.imgur.com/PsYSU.png | <python><pygame> | 2016-03-08 15:49:02 | LQ_EDIT |
35,872,505 | Get the width of the parent layout | <pre><code>Android Studio 2.0 beta 6
</code></pre>
<p>I am trying to use ViewPropertyAnimator to move a <code>ImageView (ivSettings)</code> inside a toolbar so that it is 20dp from the right and 20dp from the top, from is current location. And move the <code>ImageView (ivSearch)</code> 20dp from the left and top.</p>
<p>The imageViews are contained in a <code>Toolbar</code>.</p>
<p>This is the initial state and I want to move the icons into the upper corners inside the toolbar.</p>
<p><a href="https://i.stack.imgur.com/H01bh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H01bh.png" alt="enter image description here"></a></p>
<p>The code I am using is this to get the width and then subtract a value to get the ivSettings to be 20dp from the right.</p>
<pre><code>final DisplayMetrics displayMetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displayMetrics);
final float widthPx = displayMetrics.widthPixels;
ivSearch.animate()
.setInterpolator(new AccelerateInterpolator())
.x(20)
.y(20)
.setDuration(250)
.start();
ivSettings.animate()
.setInterpolator(new AccelerateInterpolator())
.x(widthPx - 160)
.y(20)
.setDuration(250)
.start();
</code></pre>
<p>However, having tried this on different screen size I can't get the exact width calculation. Is there a better way of doing this?</p>
<p>Many thanks for any suggestions</p>
| <android><animation><viewpropertyanimator> | 2016-03-08 16:19:00 | HQ |
35,872,863 | Blue/Green Deployments with Azure ServiceFabric | <p>I'm currently building an application using the ReliableActors framework on Azure ServiceFabric. As we scale up, I'm looking at doing blue/green deployments. I can see how to do this using a stateless system. Is there's a way to do this using statefull actors?</p>
| <azure><azure-service-fabric><blue-green-deployment> | 2016-03-08 16:35:27 | HQ |
35,874,461 | Using the contents of a Textbox as arguments for Process.Select | I'm a new programmer who is just getting into Visual Basic. I'm trying to create a simple application that would let me mount ISO files using the built in Windows PowerShell.
My Code is here:
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
TextBox1.Text = OpenFileDialog1.FileName
Me.ErrorProvider1.SetError(Me.TextBox1, "Looks Valid")
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If ErrorProvider1.GetError(TextBox1) = "Looks Valid" Then
Process.Start("powershell", "Mount-DiskImage 'C:\ISO\MY Magic ISO.iso'")
Else
Me.ErrorProvider1.SetError(Me.TextBox1, "Please Select a Valid File")
End If
End Sub
My program is simple, you pick a file from the dialog, and if the file is valid, it is mounted with powershell.
My question is how I would go about dynamically changing the "C:\ISO\MY Magic ISO.iso" filepath, using the contents of Textbox1. Is this possible? Any help would be greatly appreciated, and I am incredibly sorry if this has been asked before!
Cheers!
| <vb.net><powershell> | 2016-03-08 17:51:30 | LQ_EDIT |
35,874,494 | Play Song displayed in the table view in x Code (Swift) | I have displayed all Songs of the iTunes Music Library in a table view. Now I would like to play the selected song in the table view as soon as the user taps on it.
Here's my Code:
import UIKit
import MediaPlayer
class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
@IBOutlet var table: UITableView!
//Create an array with some elements for the table view rows
var myMusicPlayer = MPMusicPlayerController()
var allSongsArray: [MPMediaItem]!
let songsQuery = MPMediaQuery.songsQuery()
var abcArray = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", "#"]
//Define the amount of sections in table view
func numberOfSectionsInTableView(tableView: UITableView) -> Int {
return abcArray.count
}
//Assign the amount of elements in the array to the amount of rows in one section
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return allSongsArray.count
}
//Set up each element in abcArray as title for section
func tableView(tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
return self.abcArray[section] as String
}
//Set up the Index Search
func sectionIndexTitlesForTableView(tableView: UITableView) -> [String]? {
return abcArray
}
//Assign each element in the array a row in table view
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
var cell = tableView.dequeueReusableCellWithIdentifier("cell")
var items = allSongsArray[indexPath.row]
cell?.textLabel?.text = items.title
cell?.detailTextLabel?.text = items.artist
var imageSize = CGSizeMake(100, 100)
cell?.imageView?.image = items.artwork?.imageWithSize(imageSize)
return cell!
}
override func viewDidLoad() {
super.viewDidLoad()
self.allSongsArray = songsQuery.items! as [MPMediaItem]
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
} | <ios><swift><uitableview><mpmediaitem> | 2016-03-08 17:53:02 | LQ_EDIT |
35,874,673 | How can I change Sourcetree theme? | <p>I use all my development's tools in the dark theme except Source Tree.</p>
<p>It has not option in its configuration to change theme.</p>
<p>Is there any other way to change for a dark theme?</p>
| <themes><atlassian-sourcetree> | 2016-03-08 18:02:41 | HQ |
35,876,508 | Evaluate multiple scores on sklearn cross_val_score | <p>I'm trying to evaluate multiple machine learning algorithms with sklearn for a couple of metrics (accuracy, recall, precision and maybe more).</p>
<p>For what I understood from the documentation <a href="http://scikit-learn.org/stable/modules/model_evaluation.html#" rel="noreferrer">here</a> and from the source code(I'm using sklearn 0.17), the <a href="http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.cross_val_score.html#sklearn.cross_validation.cross_val_score" rel="noreferrer">cross_val_score</a> function only receives one scorer for each execution. So for calculating multiple scores, I have to :</p>
<ol>
<li>Execute multiple times</li>
<li><p>Implement my (time consuming and error prone) scorer</p>
<p>I've executed multiple times with this code :</p>
<pre><code>from sklearn.svm import SVC
from sklearn.naive_bayes import GaussianNB
from sklearn.tree import DecisionTreeClassifier
from sklearn.cross_validation import cross_val_score
import time
from sklearn.datasets import load_iris
iris = load_iris()
models = [GaussianNB(), DecisionTreeClassifier(), SVC()]
names = ["Naive Bayes", "Decision Tree", "SVM"]
for model, name in zip(models, names):
print name
start = time.time()
for score in ["accuracy", "precision", "recall"]:
print score,
print " : ",
print cross_val_score(model, iris.data, iris.target,scoring=score, cv=10).mean()
print time.time() - start
</code></pre></li>
</ol>
<p>And I get this output: </p>
<pre><code>Naive Bayes
accuracy : 0.953333333333
precision : 0.962698412698
recall : 0.953333333333
0.0383198261261
Decision Tree
accuracy : 0.953333333333
precision : 0.958888888889
recall : 0.953333333333
0.0494720935822
SVM
accuracy : 0.98
precision : 0.983333333333
recall : 0.98
0.063080072403
</code></pre>
<p>Which is ok, but it's slow for my own data. How can I measure all scores ?</p>
| <python><machine-learning><scikit-learn> | 2016-03-08 19:37:33 | HQ |
35,876,804 | Automatically run javascript function | <p>I have an html file on my desktop that looks like this:</p>
<pre><code><html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
function sendCalls(){
//Network calls
}
</script>
</head>
<body>
</body>
</html>
</code></pre>
<p>(I replaced my network calls with //Network calls) I want the sendCalls function to automatically get called everday. This their a way to do this without deploying it to a server? Thanks.</p>
| <javascript> | 2016-03-08 19:54:10 | LQ_CLOSE |
35,876,939 | Frameless window with controls in electron (Windows) | <p>I want my app to have no title bar but still be closeable, draggable, minimizable, maximizable and resizable like a regular window. I can do this in OS X since there is a <a href="https://github.com/atom/electron/blob/master/docs/api/frameless-window.md" rel="noreferrer"><code>titleBarStyle</code></a> option called <code>hidden-inset</code> that I can use but unfortunately it's not available for Windows, which is the platform that I'm developing for. How would I go about doing something like this in Windows?</p>
<p><a href="https://cloud.githubusercontent.com/assets/2175645/10311824/0f1bebae-6c51-11e5-9194-07cecebfbab3.gif" rel="noreferrer">Here's an example</a> of what I'm talking about. </p>
| <windows><electron><titlebar> | 2016-03-08 20:01:13 | HQ |
35,878,066 | Reading Input from file | <p>How would I read in input from a file and save it to an array?
For example the file contains:</p>
<p>2</p>
<p>1 1 2 3</p>
<p>2 4 5</p>
<p>Where the first number (2) represents the number of arrays need.
The first number in the second line is the array ID followed by whatever should be in the array (1 2 3). Same for third line, so array 2 should contain 4 and 5.</p>
<p>So the two arrays should be:</p>
<p>array1: [1][2][3]
array2: [4][5]</p>
<p>Java please! thanks!</p>
| <java><arrays><input> | 2016-03-08 21:10:11 | LQ_CLOSE |
35,878,178 | Jupyter notebook permission error | <p>I'm having some issues with opening Jupyter. I just installed Anaconda, but got the same error as before when I try to write "Jupyter notebook" in terminal.</p>
<pre><code>Johans-MBP:~ JDMac$ Jupyter notebook
Traceback (most recent call last):
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 501, in get
value = obj._trait_values[self.name]
KeyError: 'runtime_dir'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/JDMac/anaconda3/bin/jupyter-notebook", line 6, in <module>
sys.exit(notebook.notebookapp.main())
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-7>", line 2, in initialize
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/config/application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 1021, in initialize
self.init_configurables()
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/notebook/notebookapp.py", line 815, in init_configurables
connection_dir=self.runtime_dir,
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 529, in __get__
return self.get(obj, cls)
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/traitlets/traitlets.py", line 508, in get
value = self._validate(obj, dynamic_default())
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/jupyter_core/application.py", line 99, in _runtime_dir_default
ensure_dir_exists(rd, mode=0o700)
File "/Users/JDMac/anaconda3/lib/python3.5/site-packages/ipython_genutils/path.py", line 167, in ensure_dir_exists
os.makedirs(path, mode=mode)
File "/Users/JDMac/anaconda3/lib/python3.5/os.py", line 241, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users/JDMac/Library/Jupyter/runtime'
</code></pre>
<p>As I'm close to clueless with all of this, I need some assistance over here :)</p>
| <python><ipython><anaconda><jupyter> | 2016-03-08 21:16:50 | HQ |
35,878,297 | Can't connect to Docker containers on OSX | <p>I'm new to Docker, and I can't seem to connect to any containers.</p>
<p>I installed <a href="https://docs.docker.com/engine/installation/mac/" rel="noreferrer">Docker Toolbox</a>. Now I'm trying to get <a href="http://shipyard-project.com/docs/deploy/automated/" rel="noreferrer">Shipyard</a> to work. I followed the steps inside of a Docker Quickstart Terminal. The instructions say:</p>
<blockquote>
<p>Once deployed, the script will output the URL to connect along with credential information.</p>
</blockquote>
<p>The Shipyard installer ended with:</p>
<pre><code>Shipyard available at http://10.0.2.15:8080
Username: [elided] Password: [elided]
</code></pre>
<p>However, I went to <code>http://10.0.2.15:8080</code> on my browser and it didn't connect.</p>
<p>In another Docker Quickstart Terminal, I did a <code>docker ps</code> to see what the container was and to get its IP Address and I got:</p>
<pre><code>$ docker inspect a4755 | grep IPAddress
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.8",
"IPAddress": "172.17.0.8",
</code></pre>
<p>I'm not sure why the IP was different, but I tried to connect to <code>http://172.17.0.8:8080</code> and this didn't work either. <code>http://localhost:8080</code> also failed.</p>
<p>This also happened when I tried to run <a href="https://github.com/rehabstudio/docker-gunicorn-nginx" rel="noreferrer">docker-gunicorn-nginx</a> - everything started, but I couldn't connect to the machine.</p>
<p>What gives?</p>
| <macos><docker> | 2016-03-08 21:23:49 | HQ |
35,879,287 | Did I make a mistake with my first binary search? what is wrong in my codes? | <pre><code>public static void main(String[] args){
}
public final static int NOT_FOUND = -1;
public int binarySearch (int[] number, int searchValue){
int low = 0,
high = number.length - 1,
mid = (low + high) / 2;
while(low <= high && number[mid] != searchValue){
if(number[mid] < searchValue){
low = mid + 1;
} else {
high = mid -1;
}
mid = (low + high) / 2;
}
if(low > high){
mid = NOT_FOUND;
}
return mid;
}
}
</code></pre>
<p>I made a binary search but it didn't run. what is the problem in the codes?
There is no error but when I run it theres nothing.</p>
| <java><binary-search> | 2016-03-08 22:28:33 | LQ_CLOSE |
35,879,372 | pyspark matrix with dummy variables | <p>Have two columns:</p>
<pre><code>ID Text
1 a
2 b
3 c
</code></pre>
<p>How can I able to create matrix with dummy variables like this:</p>
<pre><code>ID a b c
1 1 0 0
2 0 1 0
3 0 0 1
</code></pre>
<p>Using pyspark library and its features?</p>
| <python><apache-spark><pyspark> | 2016-03-08 22:33:20 | HQ |
35,879,780 | Creating game, currently using SQL Server to store data, looking for better alternatives | <p>I have been using SQL Server 2014 to store a DB for the game to use with multiple tables...it's a football game so there are quite a few tables...players, coaches, owners, GMs, scouts, teams, etc...</p>
<p>The question I have is will end users need to have SQL server installed to utilize the DBs in the game? If so, I need to switch to a different option and am wondering what the best option would be for storing large amounts of data which will not require end users to have something special installed to utilize them? </p>
<p>CSV seems the obvious easy answer but I think that would be too much data for a CSV file to handle well.</p>
| <c#><sql-server><vb.net> | 2016-03-08 23:02:27 | LQ_CLOSE |
35,879,939 | how to write method for sequential search through array? | <p>I am writing a java method which runs through an array and if a value is present, then it returns the index of the value. It is not compiling, but I don't know what part of my code isn't comprehensive.</p>
<pre><code>import java.util.*;
import static java.lang.System.out;
public class Lab26 {
public static void main(String[] args) {
}
public static int simpleSearch(int[] nums, int value) {
int nul = 0;
for (int i = 0; i < nums.length; i++) {
if (nums[i] == value) {
return i;
}
}
}
}
</code></pre>
| <java><arrays><methods> | 2016-03-08 23:14:20 | LQ_CLOSE |
35,880,227 | Method for displaying binary number [C] | <p>Not sure why, but the number being outputted is:</p>
<pre><code>101101
</code></pre>
<p>Instead of </p>
<pre><code>1011010
</code></pre>
<p>Any ideas why?</p>
<p>Here's my code:</p>
<pre><code>typedef unsigned short bitSet;
int main() {
bitSet bits = makeBitSet();
displayBitSet(bits);
}
bitSet makeBitSet() {
bitSet bits = 90;
return bits;
}
displayBitSet(bitSet bs) {
int i;
for (i = 0; i < 16; i++) {
printf("%d", ((bs & (int)pow(2, (16-1))) >> (16-i)));
}
}
</code></pre>
| <c> | 2016-03-08 23:39:04 | LQ_CLOSE |
35,880,996 | Strange output (C++) | (C++) I have written the following code, but the output is displaying weird values along the lines of 011512EE. I have no idea where this is coming from or how to fix it. [code][1]
[1]: http://i.stack.imgur.com/UDUhr.png | <c++> | 2016-03-09 00:55:18 | LQ_EDIT |
35,883,263 | What is the purpose of "pm2 save"? | <p>I am using pm2 to manage my node.js processes. Very happy with it so far.</p>
<p>What is the purpose of <code>$ pm2 save</code>? What is the purpose of saving a process list? I don't quite understand from the documentation.
<a href="https://github.com/Unitech/pm2" rel="noreferrer">https://github.com/Unitech/pm2</a></p>
| <node.js><pm2> | 2016-03-09 05:02:00 | HQ |
35,883,311 | Why is this happening? (javaScript's reverse method) | <p>repl.it : <a href="https://repl.it/BuXR/3">https://repl.it/BuXR/3</a></p>
<pre><code>var str = "abc";
var str2 = str.split(" ").join("").split("");
var tmp = str2;
console.log(str2);
// => ['a','b','c']
console.log(tmp.reverse());
// => ['c','b','a']
console.log(str2);
// => ['c','b','a']
</code></pre>
<p>My question is why str2 is being changed even though it is not being reversed?</p>
<p>This is very upsetting to me, but I have a guess as to why this is happening. The tmp is just a pointer to the original str2, and when I call reverse() on tmp, it actually reverses str2. </p>
<p>Even if that really is what's happening, I still feel like it is a very counterintuitive way for a language to work. </p>
| <javascript><arrays><reverse> | 2016-03-09 05:05:28 | HQ |
35,883,361 | android studio logcat error ... how to resolve the following error | Could not find method android.widget.LinearLayout$LayoutParams.<init>, referenced from method android.support.design.widget.AppBarLayout$LayoutParams.<init> | <android><android-logcat> | 2016-03-09 05:09:07 | LQ_EDIT |
35,883,588 | Device orientation issue | <p>I have an issue with android device orientation. When the device's auto rotation is on, the device screen goes to landscape mode, while it is in portrait(vertical). And it goes into portrait mode, while the device is in landscape(horizontal). And when the device's rotation is locked, the device always locks into landscape and never into portrait.</p>
| <android> | 2016-03-09 05:25:51 | LQ_CLOSE |
35,883,926 | i have to make sum of values using php | i have a database table having date and amount column, i have to make the some of them monthly, so how can i do it.
[Please refer image for database table][1]. actually i wanted the output as
in this month this much is the total, eg if we have 5 entries in the month of jan then i wanted the sum of all the 5 entries in the month of jan, how can i do it........................................................................................................
[1]: http://i.stack.imgur.com/pSMdL.png | <php><mysql> | 2016-03-09 05:50:14 | LQ_EDIT |
35,884,139 | How to create a custom Spinner in Android | <p>I want to create custom spinner like below :</p>
<p><a href="https://i.stack.imgur.com/0X9te.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0X9te.png" alt="enter image description here"></a></p>
<p>Thanks</p>
| <android><spinner> | 2016-03-09 06:04:34 | LQ_CLOSE |
35,884,922 | How to Write string format in angularjs like as c#? | <p>This is my code</p>
<pre><code>$http.get("/Student/GetStudentById?studentId=" + $scope.studentId + "&collegeId=" + $scope.collegeId)
.then(function (result) {
});
</code></pre>
<p>In the above code use http service for get student details based on id. but i want to write the above service string.format like in c#.net</p>
<pre><code>(eg:- string.format("/Student/GetStudentById/{0}/collegeId/{1}",studentId,collegeId)
</code></pre>
| <javascript><angularjs> | 2016-03-09 06:55:11 | HQ |
35,885,846 | In Htpp url openConnection() show error plz help any body | btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) { new JsonParse().execute("http://jsonparsing.parseapp.com/jsonData/moviesDemoItems.txt");}});}
public class JsonParse extends AsyncTask<String,String,String>
@Override
protected String doInBackground(String... params) {
HttpURLConnection connection = null;
BufferedReader reader = null;
try { URI url = new URI(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.connect();
InputStream stream = connection.getInputStream();
reader = new BufferedReader(new InputStreamReader(stream));
StringBuffer stringBuffer = new StringBuffer();
String linge = "";
while ((linge = reader.readLine()) != null) {
stringBuffer.append(linge);}
return stringBuffer.toString();
`} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} finally {if (connection != null){connection.disconnect();try {
if (reader != null) { reader.close();}} catch (IOException e) {e.printStackTrace(); }}return null } @Override
protected void onPostExecute(String result{super.onPostExecute(result);
tv.setText(result);} }} | <android> | 2016-03-09 07:50:30 | LQ_EDIT |
35,886,554 | Memory map of what happens when we use command line arguments? | <p>What I understand is argc holds total number of arguments. Suppose my program takes 1 argument apart from program name. Now what does argv hold? Two pointer eg: 123,130 or ./hello\0 and 5. If it holds 123 how does it know it has read one argument? Does it know because of \0.</p>
<p>If all the above is wrong, can someone help me understand using memory map.</p>
| <c++><c><pointers> | 2016-03-09 08:33:57 | LQ_CLOSE |
35,887,690 | Convert string to ArrayList of String in Java | <p>I have this string -</p>
<pre><code>"["222.222.222.222", "21.21.21.21"]"; //Plain String which is actually an JSON Array
</code></pre>
<p>I want the output 222.222.222.222 and 21.21.21.21 in a ArrayList.</p>
<p>Please assist.</p>
<p>Thanks</p>
| <java><arrays><json><string> | 2016-03-09 09:31:42 | LQ_CLOSE |
35,887,877 | authorizenet not working in live server | I am using this code to create customer profile
http://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile
this is working fine locally but not working in live server. Showing 500 server error when execute the line no 58. (see sample code in above link)
My php version 5.4+ in server and met all requirement mentioned in https://github.com/AuthorizeNet/sdk-php
even all dependent library available in server which is required for this SDK
** working on sandbox | <php><codeigniter><authorize.net> | 2016-03-09 09:39:47 | LQ_EDIT |
35,888,183 | Why hash maps in Java 8 use binary tree instead of linked list? | <p>I recently came to know that in Java 8 hash maps uses binary tree instead of linked list and hash code is used as the branching factor.I understand that in case of high collision the lookup is reduced to O(log n) from O(n) by using binary trees.My question is what good does it really do as the amortized time complexity is still O(1) and maybe if you force to store all the entries in the same bucket by providing the same hash code for all keys we can see a significant time difference but no one in their right minds would do that.</p>
<p>Binary tree also uses more space than singly linked list as it stores both left and right nodes.Why increase the space complexity when there is absolutely no improvement in time complexity except for some spurious test cases.</p>
| <java><hashmap><java-8><theory> | 2016-03-09 09:54:13 | HQ |
35,888,748 | PHP- Combine child element of an array into an array | <p>i had an array of data like this<br>
<pre>
array(3) {
[0]=>
array(5) {
["cate_title"]=>
string(30) "Printer Line - Round With Date"
["attr_id"]=>
string(2) "15"
["attr"]=>
string(6) "asdasd"
["option"]=>
string(6) "asdasd"
["data_name"]=>
array(0) {
}
}
[1]=>
array(5) {
["cate_title"]=>
string(1) "w"
["attr_id"]=>
string(2) "14"
["attr"]=>
string(4) "asda"
["option"]=>
string(5) "sdasd"
["data_name"]=>
array(0) {
}
}
[2]=>
array(5) {
["cate_title"]=>
string(1) "w"
["attr_id"]=>
string(2) "13"
["attr"]=>
string(3) "aaa"
["option"]=>
string(8) "checkbox"
["data_name"]=>
array(1) {
[0]=>
string(3) "bbb"
}
}
}
</pre></p>
<p>i want to combine 2 elenment that has the same <code>cate_title = w</code> into 1 array like this</p>
<pre class="lang-html prettyprint-override"><code><pre>
array(3) {
[0]=>
array(5) {
["cate_title"]=>
string(30) "Printer Line - Round With Date"
["attr_id"]=>
string(2) "15"
["attr"]=>
string(6) "asdasd"
["option"]=>
string(6) "asdasd"
["data_name"]=>
array(0) {
}
}
[1]=>
array(2) {
["cate_title"]=>string(1) "w"
["data-child"]=>array(2){
[0]=>array {
["attr_id"]=>string(2) "14"
["attr"]=>string(4) "asda"
["option"]=>string(5) "sdasd"
["data_name"]=> array(0) { }
}
[1]=>array {
["attr_id"]=>string(2) "13"
["attr"]=>string(4) "aaa"
["option"]=>string(5) "checkbox"
["data_name"]=> array(1) {
[0]=>
string(3) "bbb"
}
}
}
}
</pre>
</code></pre>
<p>please help me, i've searched everywhere but still no answers </p>
| <php><arrays> | 2016-03-09 10:18:54 | LQ_CLOSE |
35,888,817 | Load image and css in Golang | <p>I setup a route in <code>server.js</code> in package <code>main</code> in root directory of project</p>
<p><code>http.HandleFunc("/",route.IndexHandler)</code></p>
<p>The <code>IndexHandler</code> is implemented in package <code>route</code> like this:</p>
<pre><code>func IndexHandler(w http.ResponseWriter, r *http.Request) {
data:=struct{
Name string
}{
"My name",
}
util.RenderTemplate(w, "index", data)
}
</code></pre>
<p>The <code>RenderTemplate</code> function is implemented in package <code>util</code> like this:</p>
<pre><code>func RenderTemplate(w http.ResponseWriter, tmpl string, data interface{}) {
cwd, _ := os.Getwd()
t, err := template.ParseFiles(filepath.Join(cwd, "./view/" + tmpl + ".html"))
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
err = t.Execute(w, data)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
</code></pre>
<p>Directory structure in project like this:</p>
<pre><code>/
/public/css
/public/images
/public/js
/route
/view
</code></pre>
<p><code>index.html</code> view is located in folder <code>view</code>, router is in folder <code>route</code></p>
<p>In <code>index.html</code> I include resources like these:</p>
<p><code><link rel="stylesheet" type="text/css" href="../public/css/style.css"></code></p>
<p><code><img src="../public/images/img_landing_page_mac.png"></code></p>
<p>When request the appropriate path, <code>index.html</code> is still rendered, but images and stylesheet are not loaded. How can I do to include them in Golang html template engine?</p>
| <html><css><image><go><template-engine> | 2016-03-09 10:21:43 | HQ |
35,888,818 | Why are my breakpoints not hit in CLion? | <p>I'm trying to debug an executable which has been created with CMake configuration</p>
<pre><code>SET(CMAKE_BUILD_TYPE Debug)
</code></pre>
<p>However, CLion does not hit any breakpoints. What could be the problem?</p>
| <debugging><breakpoints><clion> | 2016-03-09 10:21:46 | HQ |
35,890,991 | Ruby <=> (spaceship) operator , Revoke method | I'm trying to revoke certificate from apple development portal using
Ruby <=> (spaceship) operator
most of the methods are working fine expect the revoke
example :
[52] pry(main)> Spaceship::Portal::Certificate::DevelopmentPush.all
will list to me all developmentpush certficate ,
there is revoke method but i couldn't figure out the right syntax for it
tested couple of syntax such :
[52] pry(main)> Spaceship::Portal::Certificate::revoke_certificate!('id', 'type')
NameError: wrong constant name RevokeCertificate!
from /var/lib/gems/2.1.0/gems/spaceship-0.22.0/lib/spaceship/base.rb:153:in `const_defined?'
anyone knows the right syntax as this spaceship has no good docs or reference at all ,
thanks in advance
| <ruby> | 2016-03-09 11:59:10 | LQ_EDIT |
35,891,147 | How can I fix this error in my code? | getting error on expecting key word
class Listing < ActiveRecord::Base
if Rails.env.development?
has_attached_file :image, :styles => { :medium => "200", :thumb => "100x100>" }, :default_url => "default.jpg"
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
else
has_attached_file :image, :styles => { :medium => "200", :thumb => "100x100>" }, :default_url => "default.jpg",
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/
:storage => :dropbox,
:dropbox_credentials => Rails.root.join("config/dropbox.yml"),
:path => ":style/:id_filename"
end
validates :name, :description, :price, :address, :phone, presence: true
validates :price, numericality: { greater_than: 0}
validates :phone, length: { maximum: 14 }
validates_attachment_presence :image
belongs_to :user
end
| <ruby-on-rails> | 2016-03-09 12:06:43 | LQ_EDIT |
35,891,491 | Why do external functions get executed immediately? | <p>I have a declared function in my code. I want to call this function whenever I click on an item. When I bind it to this item, it gets executed immediately, and the on click event does not trigger.</p>
<p>However, when I declare the function in the on click binding, it works fine.</p>
<p>I want to declare the function somewhere else first, and then call it when the click event happens</p>
<pre><code>function test2() {
alert('test2');
}
$('body').on('click', '#test1', function() { alert('test1'); });
$('body').on('click', '#test2', test2());
</code></pre>
<p><a href="https://jsfiddle.net/ag66r950/" rel="nofollow">https://jsfiddle.net/ag66r950/</a></p>
| <javascript><jquery> | 2016-03-09 12:22:42 | LQ_CLOSE |
35,892,110 | Error:1046 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax | I am newbie to php and sql. I was creating a website for myself and needed some help with Mysql.
When I run the following query,I get the error 1046. I googled for solution and tried some solutions but failed to solve the issue. Please help me with this.
CREATE TABLE BKMUV (MVNM VARCHAR2(30), LIKES VARCHAR2(30), THETR VARCHAR2(30), CITY VARCHAR2(30);
CREATE TABLE CUMV (CMV VARCHAR2(30), UMV VARCHAR2(30);
CREATE TABLE SEAT (DATE1 VARCHAR2(30), BOOKED VARCHAR2(30), USERNAME VARCHAR2(30), MVNM VARCHAR2(30), CITY VARCHAR2(30), CLASS VARCHAR2(30);
INSERT INTO BKMUV VALUES((yeh jawani hai diwani,90,ANSAL,Greater Noida),(fukrey,50,spice, Noida),(Raanjhna,80,INNOX,Delhi));
INSERT INTO CUMV VALUES((images/fukrey.jpg,images/ce.jpg),(images/ranj.jpg,images/dhoom.jpg),(images/yjhd.jpg,images/gc.jpg),(images/gc.jpg,images/bmb.jpg));
| <php><mysql><sql> | 2016-03-09 12:51:28 | LQ_EDIT |
35,892,151 | Echo a variable's value inside a variable? | I need to echo the value of $sourceName.
Searched a lot and tried this way but didn't work for me:
$sourceName = '<p class="description">123'.$query.'</p class="description">';
<?php
echo '<div id="listings" class="listings">
<strong></strong> '.$$sourceName.'
</div>';
It can't get $query value and the code only echos: "123" | <php> | 2016-03-09 12:53:22 | LQ_EDIT |
35,892,378 | Regex for partial match of word? | <p>Is it possible to perform the following match?</p>
<p><code>^do something$</code></p>
<p>.. where matches are possible for a partially typed 'something'.</p>
<p>For example:</p>
<pre><code>^do s$
^do so$
^do som$
^do some$
^do somet$
^do someth$
^do somethi$
^do somethin$
^do something$
</code></pre>
<p>Is it possible to do this with regex without having to string a bunch of logical ORs?</p>
| <regex> | 2016-03-09 13:02:03 | LQ_CLOSE |
35,893,508 | PHP String to variables | <p>I have </p>
<pre><code>$string = "temp";
</code></pre>
<p>I want extract string value and make new variable (array) :</p>
<pre><code>$temp = array();
</code></pre>
<p>is possible?</p>
| <php> | 2016-03-09 13:52:02 | LQ_CLOSE |
35,894,387 | please help me... There is already an open DataReader associated with this Command which must be closed first | **i have written code to filter data from database(filteration is done by 2 dropdownlist and between 2 dates) i am getting "There is already an open DataReader associated with this Command which must be closed first." error please help.. **
[this is my front end][1]
public partial class data : System.Web.UI.Page
{
SqlConnection con;
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnshow_Click(object sender, EventArgs e)
{
if ((ddldept.SelectedValue == "all") && (ddldesig.SelectedValue!="all") )
{
con = new SqlConnection(constring);
con.Open();
string desig = ddldesig.SelectedValue;
DateTime mydate;
mydate = Convert.ToDateTime(tbfrom.Text);
string from = Convert.ToString(mydate);
mydate = Convert.ToDateTime(tbto.Text);
string to = Convert.ToString(mydate);
SqlCommand cmddeptall = new SqlCommand("select * from registration where Department IN('Computer Science Engineering','Mechanical Engineering','Electrical And Electronics','Electronics And Communication','Civil Engineering','Science And Humanity') AND PostAppliedFor='"+desig+"' AND (RegisteredDate BETWEEN '"+from+"' AND '"+to+"')",con);
cmddeptall.ExecuteReader();
SqlDataAdapter da = new SqlDataAdapter(cmddeptall);
DataSet ds = new DataSet();
da.Fill(ds, "registration");
GridView1.DataSource = ds.Tables["registration"];
GridView1.DataBind();
con.Close();
}
else if ((ddldept.SelectedValue == "all") && (ddldesig.SelectedValue == "all"))
{
SqlConnection con;
string constring = System.Configuration.ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString;
con = new SqlConnection(constring);
try
{
con.Open();
DateTime mydate;
mydate = Convert.ToDateTime(tbfrom.Text);
string from = Convert.ToString(mydate);
mydate = Convert.ToDateTime(tbto.Text);
string to = Convert.ToString(mydate);
string query = "select * from registration where Department IN('Computer Science Engineering','Mechanical Engineering','Electrical And Electronics','Electronics And Communication','Civil Engineering','Science And Humanity') AND PostAppliedFor IN('Principal','Professor','Associate Professor','Assistant Professor','Placement Officer','SoftSkills Trainer','Administrative Officer','Office Superintendent','Lab Technician') AND (RegisteredDate BETWEEN '" + from + "' AND '" + to + "')";
SqlCommand cmd = new SqlCommand(query, con);
cmd.ExecuteReader();
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds, "registration");
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
catch (Exception ex)
{
throw ex;
}
finally
{
con.Close();
}
}
else if ((ddldept.SelectedValue != "all") && (ddldesig.SelectedValue != "all"))
{
con = new SqlConnection(constring);
con.Open();
string desig = ddldesig.SelectedValue;
string dept = ddldept.SelectedValue;
DateTime mydate;
mydate = Convert.ToDateTime(tbfrom.Text);
string from = Convert.ToString(mydate);
mydate = Convert.ToDateTime(tbto.Text);
string to = Convert.ToString(mydate);
SqlCommand cmddeptall = new SqlCommand("select * from registration where Department='"+dept+"' AND PostAppliedFor='"+desig+"' AND (RegisteredDate BETWEEN '" + from + "' AND '" + to + "')", con);
cmddeptall.ExecuteReader();
SqlDataAdapter da = new SqlDataAdapter(cmddeptall);
DataSet ds = new DataSet();
da.Fill(ds, "registration");
GridView1.DataSource = ds.Tables["registration"];
GridView1.DataBind();
con.Close();
}
con.Close
}
[1]: http://i.stack.imgur.com/Mvsvf.png
| <c#><asp.net><.net> | 2016-03-09 14:30:11 | LQ_EDIT |
35,894,613 | python: how to disable all file permissions | I am trying to disable a user from opening a file.
The porpuse is that when a user will try to open a specific file, he would not be able to.
Also, i want to be able to return the permissions and letting the user open the file.
I tried to use $os.chmod but i can not undestand how to disable permissions.
| <python> | 2016-03-09 14:39:24 | LQ_EDIT |
35,894,799 | trying to get user input value to use in a variable JavaScript | im pretty new to this and im pretty new to using JS. im working through the basics and really getting in to it. however i am having an issue with trying to use a users input to help me in other areas..
i have a little CSS to create an input id="cars" and a button id="submit" i want to use those inputs in a switch statement.. this is what i have so far, i will add more to my switch statement once i have managed to get the input value to work...
<h1>What is your car?</h1>
<input id="cars" type="text"></input>
<button id="submit">Submit</button>
<script type="text/javascript">
var clickedCar = document.getElementById("cars").value
switch(clickedCar){
case "Honda":
document.write("Honda are nice cars to drive");
break;
} | <javascript><css> | 2016-03-09 14:47:24 | LQ_EDIT |
35,896,318 | Split string into array based on delimiters, using Regex? | <p>I am trying to split the following string:</p>
<pre><code>s = "Whyy noot this thing? Noot!"
</code></pre>
<p>into an array using the following delimiters:</p>
<pre><code>delimiters = [
' ',
'?',
'!'
];
</code></pre>
<p>I believe that I can use this type of expression:</p>
<pre><code>var array = string.split();
</code></pre>
<p>and that I can use RegEx.</p>
<p>But I don't know what to write between the parentheses in split().</p>
| <javascript> | 2016-03-09 15:51:30 | LQ_CLOSE |
35,897,566 | java.lang.NullPointerException error with adapter how to fix it? | <p>I'm getting a fatal exception / null pointer exception
i dont know what is the problem and why this error is happen </p>
<p>If any additional information is required please let me know.</p>
<p>LOGCAT</p>
<pre><code>> 03-09 18:18:52.423 3765-3765/com.mosabalzouby.myapplication
> E/AndroidRuntime: FATAL EXCEPTION: main
> java.lang.NullPointerException
> at
> com.mosabalzouby.myapplication.IndianMoviesAdapter.onBindViewHolder(IndianMoviesAdapter.java:38)
> at
> com.mosabalzouby.myapplication.IndianMoviesAdapter.onBindViewHolder(IndianMoviesAdapter.java:16)
> at
> android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:5217)
> at
> android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:5250)
> at
> android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4487)
> at
> android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:4363)
> at
> android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:1961)
> at
> android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1370)
> at
> android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1333)
> at
> android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:562)
> at
> android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2900)
> at
> android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3071)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.RelativeLayout.onLayout(RelativeLayout.java:925)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at
> android.support.design.widget.CoordinatorLayout.layoutChild(CoordinatorLayout.java:1037)
> at
> android.support.design.widget.CoordinatorLayout.onLayoutChild(CoordinatorLayout.java:747)
> at
> android.support.design.widget.ViewOffsetBehavior.onLayoutChild(ViewOffsetBehavior.java:42)
> at
> android.support.design.widget.AppBarLayout$ScrollingViewBehavior.onLayoutChild(AppBarLayout.java:1156)
> at
> android.support.design.widget.CoordinatorLayout.onLayout(CoordinatorLayout.java:760)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
> at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
> at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1628)
> at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1486)
> at android.widget.LinearLayout.onLayout(LinearLayout.java:1399)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.widget.FrameLayout.onLayout(FrameLayout.java:431)
> at android.view.View.layout(View.java:11180)
> at android.view.ViewGroup.layout(ViewGroup.java:4203)
> at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1468)
> at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2418)
> at android.os.Handler.dispatchMessage(Handler.java:99)
> at android.os.Looper.loop(Looper.java:137)
> at android.app.ActivityThread.main(ActivityThread.java:4340)
> at java.lang.reflect.Method.invokeNative(Native Method)
> at java.lang.reflect.Method.invoke(Method.java:511)
> at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
> at dalvik.system.NativeStart.main(Native Method)
</code></pre>
<p>MainActivity :</p>
<pre><code> List<IndianMovies> movies=new ArrayList<>();
int posters[]={R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers,R.mipmap.avengers};
String moviename[]={"aaaaa","bbbbbb","ccccc","vvvvvv","eeeeeee","wwwwww"};
String movierate[]={"9.9","5.5","2.3","4.4","5.1","6.2"};
String moviestory[]={"aaaaaaaaaaa","aaaaaaaaa","wwwwwwwwwww","eeeee","rrrrrrr","qqqqq"};
for (int i=0;i<posters.length;i++){
IndianMovies movie=
new IndianMovies(moviename[i],movierate[i],moviestory[i],posters[i]);
movies.add(movie);
}
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
IndianMoviesAdapter adapter = new IndianMoviesAdapter(movies);
recyclerView.setAdapter(adapter);
</code></pre>
<p>My Adapter :</p>
<pre><code>public class IndianMoviesAdapter extends RecyclerView.Adapter<IndianMoviesAdapter.IndianMovieHolder>{
List<IndianMovies> moviesList;
public IndianMoviesAdapter(List<IndianMovies> moviesList){
this.moviesList=moviesList;
}
@Override
public IndianMovieHolder onCreateViewHolder(ViewGroup parent, int viewType) {
View row = LayoutInflater.from(parent.getContext()).inflate(R.layout.indian_movie_row,parent,false);
IndianMovieHolder holder = new IndianMovieHolder(row);
return holder;
}
@Override
public void onBindViewHolder(IndianMovieHolder holder, int position) {
IndianMovies movie =moviesList.get(position);
holder.movietitle.setText(movie.moviename);
holder.movierat.setText(movie.movierate);
holder.moviesdesc.setText(movie.moviestory);
holder.poster.setImageResource(movie.posterimage);
}
@Override
public int getItemCount() {
return moviesList.size();
}
class IndianMovieHolder extends RecyclerView.ViewHolder{
TextView movietitle,movierat,moviesdesc;
ImageView poster;
public IndianMovieHolder(View itemView) {
super(itemView);
movietitle =(TextView) itemView.findViewById(R.id.movietitleTV);
movietitle =(TextView) itemView.findViewById(R.id.movieratTV);
moviesdesc =(TextView) itemView.findViewById(R.id.moviedescTV);
poster =(ImageView) itemView.findViewById(R.id.movieposteIMG);
}
}
}
</code></pre>
<p>How to fix it ??</p>
| <android> | 2016-03-09 16:45:12 | LQ_CLOSE |
35,898,584 | list comprehension error and algorithm | <p>There is a couple questions about the list comprehension in python. The first is I do not know why there is error in the code below:</p>
<pre><code>alist = [1,2,3,4,5,6,0,9,9,4,5,0,0,2,3,0,9,6]
test = [x++ for x in alist if x != 0]
File "<stdin>", line 1
test = [x++ for x in list1 if x != 0]
^
SyntaxError: invalid syntax
</code></pre>
<p>Another question is I want to write a list comprehension to count non-zero element. Use <code>alist</code> as an example, I want to return a list called <code>count</code> containing 1 or 0: 1 if the element in <code>alist</code> is not zero and zero is the element in <code>alist</code> is zero. So the result should be:</p>
<pre><code>alist = [1,2,3,4,5,6,0,9,9,4,5,0,0,2,3,0,9,6]
count = [1,1,1,1,1,1,0,1,1,1,1,0,0,1,1,0,1,1]
</code></pre>
<p>Thank you very much. </p>
| <python><list><list-comprehension> | 2016-03-09 17:31:30 | LQ_CLOSE |
35,900,737 | Support Multiple Label Printers | <p>We develop a desktop business application where we are going to add support to label printing.</p>
<p>As there are lots of different printer makes and models out there, I want to discuss here what would be the best approach to manage all these different models/makes.</p>
<p>Considering some printers use the windows spool (Brother, Dymo, etc) and other ones uses ZPL, EPL, etc. (Zebra, Argox, etc) or anything else, what would be the best approach to support different models.</p>
<p>I was thinking about getting the printer description after the user selects its desired printer, and from them, my code will look for the specific implementation and if does not find it, alert the user.</p>
<p>However, the user can change label description if I understand. </p>
<p>How can I manage this?</p>
<p>Thank you,</p>
<p>Igor.</p>
| <c#><wpf> | 2016-03-09 19:22:00 | LQ_CLOSE |
35,900,752 | Simple java calculator always outputs 0 | <p>I am new to java, i am trying to make a little calculator that takes the input of two numbers and an operator. This data is then taken into an if statement to calculate the answer. Then output into the console. I am having a problem though because with the:</p>
<p>operator = Calc.next();</p>
<p>Because i thought that the above line of code was correct for inputting a string but it doesn't work, whatever the numbers input to the calculator are, the answer seems to be output as zero.</p>
<p>Please take the code from the pastebin link and look at it because i'm not sure what is going wrong. I would appreciate someone letting me know where i went wrong. </p>
<p><a href="http://pastebin.com/B5PjkXwX" rel="nofollow">http://pastebin.com/B5PjkXwX</a></p>
<p>Thanks</p>
| <java> | 2016-03-09 19:22:48 | LQ_CLOSE |
35,901,297 | How do I replace the words in a list with the position of that word? It should be pretty basic please, like GCSE level | Sentence = input("type in sentence:"). split()
#The above stores the individual words in Sentence, into a list
# But now how do I replace each word in Sentence with the position of that word
| <python> | 2016-03-09 19:51:38 | LQ_EDIT |
35,902,302 | Discarding alpha channel from images stored as Numpy arrays | <p>I load images with numpy/scikit. I know that all images are 200x200 pixels.</p>
<p>When the images are loaded, I notice some have an alpha channel, and therefore have shape (200, 200, 4) instead of (200, 200, 3) which I expect.</p>
<p>Is there a way to delete that last value, discarding the alpha channel and get all images to a nice (200, 200, 3) shape?</p>
| <python><numpy><math> | 2016-03-09 20:50:39 | HQ |
35,902,361 | Realm & React Native - Best practice to implement auto-updates? | <p>What are the best practices/patterns make realm a reactive datasource in a react native app? Especially for <a href="https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0#.drlaug899">presentational and container components pattern</a>? </p>
<p>Here is an example which I'd like to make reactive: <a href="https://gist.github.com/Thorbenandresen/fc4bb5fb0ef6554d3ce5">Realm with React Native</a></p>
<p>The <a href="https://realm.io/docs/react-native/latest/#change-events">docs on auto-updates/change-events</a> are a bit thin and the <a href="https://realm.io/docs/react-native/latest/#examples">official example</a> does not make use of this feature (to my knowledge).</p>
| <react-native><realm> | 2016-03-09 20:53:01 | HQ |
35,902,485 | Connection to SQL Workbench/J gets disconnected frequently | <p>The connection to SQL Workbench/J gets disconnected very frequently. Where can I change the settings so that it does not lose the connections for atleast an hour.</p>
<p>Thanks</p>
| <database-connection><sql-workbench-j> | 2016-03-09 20:59:36 | HQ |
35,902,847 | What C++ standard has better of COM? | <p>I have see such answer:</p>
<blockquote>
<p>COM is a technique of it's own. It fulfills some special needs but
violates a lot of good engineering principles. E.g solid. The standard
has better ways than using COM. – mkaes</p>
</blockquote>
<p>Very interesting to know what is that "better ways"?</p>
<p>We use in our project IUnknown base class, but not COM technology itself.
IUnknown allows us:</p>
<ol>
<li>have nice specified interface abstract classes;</li>
<li>use its add()/release() as basis for intrusive smart ptrs;</li>
<li>use mechanism of QueryInterface() to be more effective than dynamic_cast;</li>
</ol>
<p>Okay, exists boost::intrusive_ptr but it is not in the standard so far. And even if it was there, this will be separate class to solve task of intrusive smart ptr. Assuming it is there, yes I could do something as</p>
<pre><code>interface ITable : intrusive_ptr {}
interface IField : intrusive_ptr {}
</code></pre>
<p>But what about QueryInterface() mechanism?</p>
<p>P.S. This question is NOT about COM at all.</p>
| <c++><standards> | 2016-03-09 21:20:33 | LQ_CLOSE |
35,904,055 | How do I convert string to list in Python? | <p>How do I convert <strong><em>def stringParametre(x)</em></strong> x to a list so that if x is hello then it will become a list like ["H","E","l","l","O"] . Capitals don't matter .</p>
| <python> | 2016-03-09 22:34:23 | LQ_CLOSE |
35,906,040 | Hartl Rails Tutorial Ch9, "test_should_redirect_destroy_when_not_logged_in" | Working through Hartl's tutorial, in Chapter 9, Listing 9.56 produces the following error, showing 'admin?' as an undefined method.
I've checked (and rechecked) the 2 sections of code that have been revised since the last green test. Stumped.
ERROR["test_should_redirect_destroy_when_not_logged_in", UsersControllerTest, 2016-02-26 21:29:01 -0500]
test_should_redirect_destroy_when_not_logged_in#UsersControllerTest (1456540141.41s)
NoMethodError: NoMethodError: undefined method `admin?' for nil:NilClass
app/controllers/users_controller.rb:73:in `admin_user'
test/controllers/users_controller_test.rb:48:in `block (2 levels) in <class:UsersControllerTest>'
test/controllers/users_controller_test.rb:47:in `block in <class:UsersControllerTest>'
app/controllers/users_controller.rb:73:in `admin_user'
test/controllers/users_controller_test.rb:48:in `block (2 levels) in <class:UsersControllerTest>'
test/controllers/users_controller_test.rb:47:in `block in <class:UsersControllerTest>'
39/39: [==========================================================] 100% Time: 00:00:00, Time: 00:00:00
Finished in 0.97767s
39 tests, 152 assertions, 0 failures, 1 errors, 0 skips
Note that the admin field was added to the database during a migration, which I understand *should* automatically produce a boolean admin? method
class AddAdminToUsers < ActiveRecord::Migration
def change
add_column :users, :admin, :boolean, default: false
end
end
users_controller_test.rb is where the problem apparently resides, specifically in the lines:
test "should redirect destroy when not logged in" do
assert_no_difference 'User.count' do
delete :destroy, id: @user
...while the complete file looks like this:
require 'test_helper'
class UsersControllerTest < ActionController::TestCase
def setup
@user = users(:michael)
@other_user = users(:archer)
end
test "should redirect index when not logged in" do
get :index
assert_redirected_to login_url
end
test "should get new" do
get :new
assert_response :success
end
test "should redirect edit when not logged in" do
get :edit, id: @user
assert_not flash.empty?
assert_redirected_to login_url
end
test "should redirect to update when not logged in" do
patch :update, id: @user, user: { name: @user.name, email: @user.email }
assert_not flash.empty?
assert_redirected_to login_url
end
test "should redirect edit when logged in as wrong user" do
log_in_as(@other_user)
get :edit, id: @user
assert flash.empty?
assert_redirected_to root_url
end
test "should redirect update when logged in as wrong user" do
log_in_as(@other_user)
patch :update, id: @user, user: {name: @user.name, email: @user.email }
assert flash.empty?
assert_redirected_to root_url
end
test "should redirect destroy when not logged in" do
assert_no_difference 'User.count' do
delete :destroy, id: @user
end
assert_redirected_to login_url
end
test "should redirect destroy when logged in as a non-admin" do
log_in_as(@other_user)
assert_no_difference 'User.count' do
delete :destroy, id: @user
end
assert_redirected_to root_url
end
end
and here's the contents of users.yaml
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
michael:
name: Michael Example
email: michael@example.com
password_digest: <%= User.digest('password') %>
admin: true
archer:
name: Sterling Archer
email: duchess@example.gov
password_digest: <%= User.digest('password') %>
lana:
name: Lana Kane
email: hands@example.gov
password_digest: <%= User.digest('password') %>
mallory:
name: Mallory Archer
email: boss@example.gov
password_digest: <%= User.digest('password') %>
<% 30.times do |n| %>
user_<%= n %>:
name: <%= "User #{n}" %>
email: <%= "user-#{n}@example.com" %>
password_digest: <%= User.digest('password') %>
<% end %>
| <ruby-on-rails><ruby><railstutorial.org> | 2016-03-10 01:38:24 | LQ_EDIT |
35,906,066 | Comparing a date between two date ranges i.e,.fromDate and toDate in java | <p>How to check whether a given date is between two dates but it should not check with the time in given date.</p>
<p>I have tried with after but it checks for time range too.</p>
<p>Could anyone help me to know about this ?</p>
<p>TIA.,</p>
| <java> | 2016-03-10 01:40:54 | LQ_CLOSE |
35,906,584 | C programming language , Making useful programs | <p>I have learned C for 2 months, I understand all the basics.<br>
Pointers, Structs,Unions. all the basics in short. <br>
But the only problem is.. that all the tutorials online just show how to make console program.<br>
How do I start writing a useful program ?
<br>
Thanks !</p>
| <c> | 2016-03-10 02:38:58 | LQ_CLOSE |
35,908,543 | How do I make a basic c++ calculator calculate decimals | <p>I have a decent grasp with c++, and I made a basic calculator that can add, subtract, multiply, and divide. but I am having a hard time trying to get it to calculate decimals. Help please???</p>
| <c++> | 2016-03-10 05:45:46 | LQ_CLOSE |
35,909,935 | What is wrong with this program? It runs but nothing shows up on output screen. Python 2.7 | The program runs fine. But with no output on output screen. Its just blank. Its Python 2.7. And I have added Python to Environment Variables as well but nothing shows up on shell as well.
#Code for Rock Paper and Scissors
import random
import time
rock = 1
paper = 2
scissors = 3
names = { rock: "Rock" , paper: "Paper" , scissors: "Scissors" }
rules = { rock: scissors , paper :rock , scissors: paper }
player_score = 0
computer_score = 0
def start():
print "Let's play a game of rock paper and scissors"
while game():
pass
scores()
def game():
player = move()
computer = random.randint(1,3)
result(player, computer)
return play_again()
def move():
while True:
print
player = raw_int("Rock = 1\nPaper = 2\nScissors =3\nMake a move: ")
try:
player = int(player)
if player in (1,2,3):
return player
except ValueError:
pass
print "Oops! I didn't understand that. Please enter 1,2 or 3."
def result(player, computer):
print "1..."
time.sleep(1)
print "2..."
time.sleep(1)
print "3..."
time.sleep(0.5)
print "Computer threw {0)!".format(names[computer])
global player_score,computer_score
if player == computer:
print "Tie game."
else:
if rules[player] == computer:
print "Your victory has been assured."
player_score += 1
else:
print" The computer laughs as you realise you have been defeated."
computer_score += 1
def play_again():
answer = raw_input("Would you like to play again? y/n: ")
if answer in ("Y", "Y" , "yes" , "Yes" , "Of course!"):
return answer
else:
print "Thank you very much for playing our game.See your next time!"
def scores():
global player_score,computer_score
print "High Scores"
print "Player:" , player_score
print "Computer:", computer_score
if _name_ == '_main_':
start() | <python><python-2.7> | 2016-03-10 07:14:44 | LQ_EDIT |
35,911,200 | how to use the same theme that you bought? | im new in wordpress and i bought a theme from tavern and i want to use the same theme pictures and everything but when i install the theme i dont see the same pictures.
[this is the theme that i bought][1]
[this how it looks like when i install it][2]
[1]: http://i.stack.imgur.com/TOhHf.jpg
[2]: http://i.stack.imgur.com/t4hgC.png
thank you guys | <wordpress><wordpress-theming><wordpress-thesis-theme> | 2016-03-10 08:29:57 | LQ_EDIT |
35,911,730 | If array item is empty | <p>I've this array : </p>
<pre><code>Array ( [0] => test1 [1] => test2 [2] => test3 [3] => [4] => test4 )
</code></pre>
<p>I want to check if any array item is empty or not, as you can see, there's en empty item into my array : <code>[3] => [4] => test4</code></p>
<p>So I wrote this condition :</p>
<pre><code> foreach ($array1 as $value) {
if(!isset($value)) {
echo "EMPTY";
} else {
echo "Not empty";
}
}
</code></pre>
<p>But it echo <code>Not empty</code> every time, there must have <code>empty</code> for one item</p>
<p>Thanks for your help !</p>
| <php><arrays> | 2016-03-10 08:58:34 | LQ_CLOSE |
35,912,250 | How to install KVM(kernal virtual machine) without any OS in a PC? | <p>Can we install KVM in a machine directly, with out any OS? if possible can you please suggest how to do this?</p>
| <linux><linux-kernel><virtualization><openstack><kvm> | 2016-03-10 09:22:24 | LQ_CLOSE |
35,912,860 | jquery dropdown menu cant figure it out | <p>I cant figure out what is wrong in my code im trying to make a jquery dropdown menu. I have enclosed my html, css and javascript. please take a look and help me out, thank you.</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() {
$("li").hover(function(){
$("this").find('ul > li').fadeToggle(500);
});
});</code></pre>
<pre class="snippet-code-css lang-css prettyprint-override"><code>ul{
margin: 0;
padding:0;
list-style: none;
}
ul li{
float: left;
width: 250px;
height: 30px;
line-height: 30px;
background-color: #099;
text-align: center;
}
ul li li {
background-color: #099;
color: #000;
display: none;
}
ul li a {
text-decoration:none;
color: #000;
}
ul li li:hover{
background:#03F;
}
ul li li a {
text decoration: none;
color: #000;
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="css/main.css">
<meta charset="utf-8">
<title>untitled</title>
</head>
<body>
<div class="page">
<header>
<a class="logo" href="#"></a>
<nav class="nav_menu">
<ul class="dropmenu">
<li><a href="#">Link 1</a>
<ul>
<li><a href="#">Sub Link 1-1</a></li>
<li><a href="#" class="selected">Sub Link 1-2</a></li>
<li><a href="#">Sub Link 1-3</a></li>
</ul>
</li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a>
<ul>
<li><a href="#">Sub Link 2-1</a></li>
<li><a href="#">Sub Link 2-2</a></li>
<li><a href="#">Sub Link 2-3</a></li>
</ul>
</li>
<li><a href="#">Link 4</a>
<ul>
<li><a href="#">Sub Link 4-1</a></li>
<li><a href="#">Sub Link 4-2</a>
<ul>
<li><a href="#">Sub Link 4-2-1</a></li>
<li><a href="#">Sub Link 4-2-2</a></li>
<li><a href="#">Sub Link 4-2-3</a></li>
</ul>
</li>
<li><a href="#">Sub Link 4-3</a></li>
</ul>
</li>
</ul>
</nav>
</header>
</div>
<script type="text/javascript" src="js/plugin/jquery-1.12.1.min.js"></script>
<script type="text/javascript" src="js/application.js"></script>
</body>
</html></code></pre>
</div>
</div>
I cant figure out what is wrong in my code im trying to make a jquery dropdown menu. I have enclosed my html, css and javascript. please take a look and help me out, thank you.</p>
| <javascript><jquery> | 2016-03-10 09:47:11 | LQ_CLOSE |
35,914,081 | Group arrays according to their keys and remove duplicates (2 dimensional arrays PHP) | I have three arrays as follow:
$a=Array ( [0] => 'member0' [1] => 'member1' [2] => 'member2' [3] => 'member1');
$b=Array ( [0] => 'id0' [1] => 'id1' [2] => 'id2' [3] => 'id1');
$c=Array ( [0] => 'tf0' [1] => 'tf1' [2] => 'tf2' [3] => 'tf1');
I would like to group their values according to their keys in a 2 dimensional array to output the following:
$2dim_array=array(array('member0','id0','tf0'),array('member1','id1','tf1'),array('member2','id2','tf2'),array('member1','id1','tf1'));
After, I would like to remove any duplicate array inside of the previous 2 dimensional array and output something like this:
$remove_duplicates=array(array('member0','id0','tf0'),array('member1','id1','tf1'),array('member2','id2','tf2'));
How can I do this?. Thanks.
Note: The arrays of this example only contain 3 elements each, but the length of my arrays can be variable (undefined number of keys). | <php><multidimensional-array><duplicates><grouping> | 2016-03-10 10:39:06 | LQ_EDIT |
35,915,565 | How to fix this code ? PHP PDO | Hi all how to fix this code ??
` function userExists($pdow, $login)
{
$userQuery = "SELECT * FROM login u WHERE login=:user;";
$stmt = $pdow->prepare($userQuery);
$stmt->execute(array(':user' => $login));
return !!$stmt->fetch(PDO::FETCH_ASSOC);
}
$login = 'user';
$exists = userExists($pdow, $login);
if('$login')
$user= var_dump((bool) 'Exists');
{
echo "Login exsists!";
}`
I have two problems whit my code.
First error:
Error with communique 'login exsists!'. I see this echo all the time in browser.
sequent error:
If i get communique 'login exsists!' my code still writes data to base. | <php><mysql><pdo><mariadb> | 2016-03-10 11:44:33 | LQ_EDIT |
35,915,584 | SQL Server Management Studio Setting | <p>How to enable the more accurate help, please ?</p>
<p>Because I have this :</p>
<p><a href="https://i.stack.imgur.com/2DsgH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2DsgH.png" alt="enter image description here"></a></p>
| <sql-server> | 2016-03-10 11:45:31 | LQ_CLOSE |
35,916,128 | Operator '&&' cannot be applied to operands of type 'System.Collections.Generic.IEnumerable<char>' and 'System.Collections.Generic.IEnumerable<char>' | While executing below code, getting this error:
>Operator '&&' cannot be applied to operands of type 'System.Collections.Generic.IEnumerable(char)' and 'System.Collections.Generic.IEnumerable(char)'
public ActionResult HolidayIndex()
{
IEnumerable<HOLIDAY_MASTER> hdms = null;
hdms = db.HOLIDAY_MASTER.ToList().Where(h => h.HOLIDAY_NAME.Except("Sunday") && h.HOLIDAY_NAME.Except("Saturday") && h.HOLIDAY_DEL.Equals(0) && h.REGION_ID.Equals(RegionID)).OrderBy(h => h.DOH);
return PartialView("HolidayIndex", hdms);
}
Error shows under `h.HOLIDAY_NAME.Except("Sunday") && h.HOLIDAY_NAME.Except("Saturday")`.
| <c#><entity-framework><linq><asp.net-mvc-4> | 2016-03-10 12:09:56 | LQ_EDIT |
35,916,602 | jQuery: how to get the number/position of an element | In my HMTL page I have this list
<ul>
<li id=a></li>
<li id=b></li>
<li id=c></li>
...
</ul>
How can I do in jQuery to get the "position" (meant as n-th son) of a tag knowing its id? For example something like:
$(#c).position() = 3
meant that $(#c) is the 3-rd son of <ul>. Is it possible? | <javascript><jquery><html> | 2016-03-10 12:32:33 | LQ_EDIT |
35,916,837 | How to find all open windows running on separate thread WPF | <p>In my WPF application, I have to show some windows on UI thread and some on separate thread. I can access all windows running on UI thread using System.Windows.Application.Current.Windows, but unable to find windows that are running on separate thread.</p>
<p>Can any one knows how can i achieve this ?</p>
<p>Thanks</p>
| <c#><wpf> | 2016-03-10 12:42:54 | LQ_CLOSE |
35,916,902 | PHP project: Telnet connction to Nokia Equipements(MSS) with PHP and data interaction with database throught telnet | As part of my graduation project, I have to make a web application that connects to a Nokia proprietary equipment.
This is the architecture of my project.
1-Is it possible to do this project with to language PHP: Can I connect to the equipment with php throught telnet
2-and for the hand "1" Can the database through php interacat with the equipment with telnet
Just to know I had never developed any thing in php ,even with devolopping web applications [enter image description here][1]
Thank you in advance
[1]: http://i.stack.imgur.com/hKmy1.png | <php><database><telnet> | 2016-03-10 12:45:44 | LQ_EDIT |
35,917,973 | Unable to trace the error for a function any help as in where i have gone wrong? | I am having trouble in debugging the error in this code, and not understanding where exactly i am going wrong? Can you please help?
#include <iostream>
using namespace std;
class man
{
int age;
int height;
int weight;
public:
int data(void);
void initialize(int,int,int);
};
int man::data(void)
{
return (age*height)/weight;
};
void man::initialize(initial_age,initial_height,initial_weight)
{
age = initial_age;
height = initial_height;
weight = initial_weight;
};
int main()
{
man tim,crook;
tim.initialize(19,178,55);
crook.initialize(28,171,71);
cout << "THE DATA IS AS SHOWN FOR tim" << tim.initialize(19,178,55) << endl;
cout <<"THE DATA IS AS SHOWN FOR crook" << crook.initialialize(28,171,69) << endl;
}
| <c++><function><class><oop> | 2016-03-10 13:31:57 | LQ_EDIT |
35,919,480 | Complicated logic that Nodejs is not good at | <p>I've heard that nodejs is not good for applications that apply complicated logic. Can I get an example of this?</p>
<p>I've also heard the same thing about cpu intensive tasks. Can I get a basic example of this too?</p>
| <node.js> | 2016-03-10 14:38:58 | LQ_CLOSE |
35,919,555 | Mainactivity appears to exist twice or more after restarting app | I have an app with an activity sending a broadcast to another activity.
Everything appears to be fine. But if I close my app and open it again,
this broadcasts seems to get send more than once. In fact it gets send
as often I reopened the app. If I print out "this" right before sending the broadcast I get different instances.
Why could this happen? Why is the activity not dying? I checked, onDestroy get's called. BUT I have a background-service, which I dont stop, when the app is closed. Is it therefore? Can I reopen the old activity, when starting the app instead of opening a new one?
Setting launchmode in the Manifest to singleTask or singleInstance didn't work either.
Thanks! | <java><android><android-activity> | 2016-03-10 14:41:49 | LQ_EDIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.