input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Use dialog is very complicated <p>It's very complicate to add this new dialog, it's the only component I'm not able to add myself. </p>
<ol>
<li>I don't know if I need to add something to my app.module.ts </li>
<li>How create this dialog? I really don't understand there is a lot information Dialogreference</li>
</ol>
... | <p>You were close to the solution! It is important to specify a ViewContainerRef where the dialog is attached to. Please have a look at this working plnkr (<a href="http://plnkr.co/edit/HgAvCnzkWAmK1NVxfEUM?p=preview" rel="nofollow">http://plnkr.co/edit/HgAvCnzkWAmK1NVxfEUM?p=preview</a>) in the app.component.ts:</p>
... |
How to count and access all the elements of a RecyclerView in appium android <p>I have a <code>recyclerview (id=com.sinepulse.greenhouse:id/room_list)</code>. Every child item has a <code>EditText(id=com.sinepulse.greenhouse:id/room_title)</code>, an <code>edit button(id=com.sinepulse.greenhouse:id/room_edit_icon)</cod... | <p>In this case you have to do something like this. </p>
<pre><code>for(int i=0;i<list.size();i++){
View view = recyclerView.getChildAt(i);
EditText ed = (EditText)view.findViewById(R.id.room_title);
.
.
}
</code></pre>
<p>By using this way you can access each item in recyclerView</p>
|
Assign query value to variable <p>Having real trouble assigning the return value of a query to a variable in a stored procedure, here is what I have:</p>
<pre><code>ALTER PROCEDURE [dbo].[sp_CreateTaskFromProposalStatusUpdate]
@proposalstatusupdateid uniqueidentifier
AS
BEGIN
DECLARE @owninguser uniqueidentifier
SET... | <p>You need to either RETURN that value or make a resultset</p>
<pre><code>ALTER PROCEDURE [dbo].[sp_CreateTaskFromProposalStatusUpdate]
@proposalstatusupdateid uniqueidentifier
AS
DECLARE @proposalid uniqueidentifier
--SET @proposalid = (SELECT new_propstatusupdateid FROM new_proposalstatusupdate WHERE New_proposal... |
Hash table update value in c <p>I am using Glib for hash table. I need to update value from key. Is there a way without delete and insert to hash table for update.</p>
<p>I found <code>g_hash_table_replace ()</code></p>
<pre><code>gboolean
g_hash_table_replace (GHashTable *hash_table,
gpointer k... | <p>The usage of the function <code>g_hash_table_replace</code> is quite easy:</p>
<p>It takes 3 arguments:</p>
<ul>
<li><code>hash_table</code>: It is of course you hashtable, so in your case <code>hash_operation</code></li>
<li><code>key</code>: The key you want to edit. (I belive your key is <code>a</code>)</li>
<l... |
How to select XML node with different XML namespace? <p>I have a XML document which looks like : </p>
<pre><code><stReq xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<EvalRes>
<RenDtSrc xmlns="http://fakeurl.com/somthing/facade/params">
... | <pre><code>XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("D:\\Test\\Doc1.xml");
var nsm = new XmlNamespaceManager(xmlDoc.NameTable);
nsm.AddNamespace("s", "http://fakeurl.com/somthing/facade/params");
XmlNodeList nodeList = xmlDoc.SelectNodes("//s:RenDtSrc", nsm);
</code></pre>
|
How to deal with one column of two formats and single class? <p>I have one column with two different formats but the same class 'factor'.</p>
<pre><code>D$date
2009-05-12 11:30:00
2009-05-13 11:30:00
2009-05-14 11:30:00
2009-05-15 11:30:00
42115.652
2876
8765
class(D$date)
factor
</code></pre>
<p>What I need is to c... | <p>The problem is that you are mixing up classes in the true/false halves of your ifelse. You can fix this by adding <code>as.character</code> like this</p>
<pre><code>D$date = ifelse(!is.na(as.numeric(D$date)),
as.character(as.POSIXct(as.numeric(D$date) * (60*60*24), origin="1899-12-30", tz="UTC")),
... |
change button image when play completes swift <p>sender button changes when i click play button but when i click another button in the tableview the button first button image not changes to play</p>
<pre><code> @IBAction func playSound(sender: UIButton) {
if self.player != nil && self.player.playing {
... | <pre><code>**Try this code ...**
Declare one variable for get index.
var songnamearray : NSArray = NSArray()
var audioPlayer = AVAudioPlayer()
var selectedindex : Int?
var isFristtime : Bool = false
override func viewDidLoad() {
super.viewDidLoad()
songnamearray = ["Saiyaan (Sanam) 320Kbps(... |
How can I create an overlay with slider? <p>I want to create something like that with <strong>slick slider</strong>:</p>
<p><img src="http://i.stack.imgur.com/P02EZ.png" alt="layout"></p>
<p>This overlay with slider should appear after clicking on button. I think that i should use the slick slider's center mode. I kn... | <p>There are multiple way to achieve this, following is a example I created using lightbox, you can get the idea from here, check the <a href="http://jsfiddle.net/sanjeevks121/99guewhk/" rel="nofollow">JSfiddle</a></p>
<p><strong>CSS</strong></p>
<pre><code>#pageOverLay {
background: #fff none repeat scroll 0 0;
... |
Set dynamic line break in an Android TextView <p>I have a TextView where I show an e-mail that I take from JsonObject.</p>
<p>If this e-mail is too long it will use a second line for a single character too.
For example:</p>
<blockquote>
<p>example.email@email.co<br />m</p>
</blockquote>
<p>To avoid it I would like... | <p>Suppose your maximum length is 5.. </p>
<pre><code>int maxLength = 5;
String jsonReturnedData = "Hello World"
</code></pre>
<p>Before inserting it into the TextView directly, </p>
<pre><code>jsonReturnedData = jsonReturnedData.substring(0, maxLength) + "\n" + jsonReturnedData.substring(maxLength, jsonReturnedData... |
What happens with the Gatt Characteristic after it has been read? <p>I am using an android device with Android 5.1 (Bluetooth 4.0) and a MCU Board which has Bluetooth 4.2.</p>
<p>On my MCU side i am updating my Gatt Characteristic in a Loop just to make sure, that i know if the data i am writing inside is consistent. ... | <p>Did you follow the procedures at <a href="https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#notification" rel="nofollow">https://developer.android.com/guide/topics/connectivity/bluetooth-le.html#notification</a> in order to enable notifications?</p>
<p>When you issue <code>readCharacteristic... |
How to create a javascript object with multiple AJAX properties? <p>I have a javascript project with legacy code. There is creating an object with properties via synchronous ajax. Something like this:</p>
<pre><code>function App() {
this.users = $.parseJSON(
$.ajax({
url: '/users'
datatype: "json"
... | <p>Your idea is very close. It's not so much a <em>chain</em>, the ajax calls can run in parallel, but you need to know when they've all finished. jQuery has just the thing for you: <a href="http://api.jquery.com/jQuery.when" rel="nofollow"><code>$.when</code></a>:</p>
<pre><code>function App() {
var t = this;
... |
How to clear data grid view after each selection of comboBox to retrive new data <p>In my <strong>View Items Form</strong> I have comboBox that have two items "Packet and Piece" when I select index 0 it should retrive Packet data or select index 1 to retrive Piece data .. what should happen every time of different sele... | <p>You are removing Columns of DataGridView, you need to remove columns of datatable (dt) as well.</p>
<p>Add </p>
<blockquote>
<p>dt.Columns.Clear();</p>
</blockquote>
<p>Before </p>
<blockquote>
<p>dt.Clear();</p>
</blockquote>
|
ruby Compare values between hashes in different arrays <p>I have two different arrays, each consisting of different hashes. </p>
<pre><code>new_array1 = [
{:index=>4, :column=>0, :ID=>"ABC"},
{:index=>4, :column=>1, :ID=>"XYZ"},
{:index=&... | <p>This will return an array of matching hashes:</p>
<pre><code>res = new_array1.inject([]) { |memo, hash| memo << hash if new_array2.any? { |hash2| hash[:ID] == hash2[:ID] && hash[:index] == hash2[:index] && hash[:column] == hash2[:column] }; memo }
# => [{:index=>4, :column=>0, :ID=&g... |
PHP - Do a search using two search terms from two drop-down menus <p>I am trying to use two drop-down boxes to search my database. ($k) Services and ($t) for Town. But only one of the term is working I'm new too PHP. I know I'm know using mysqli I just want to get it working and update this later.</p>
<pre><code>$k = ... | <p>Perhaps something like this might work?</p>
<pre><code>if( isset( $_GET['k'], $_GET['t'] ) ){
$term1 = explode( " ", $_GET['k'] );
$term2 = explode( " ", $_GET['t'] );
$result = array_merge( $term1, $term2 );
$clauses=array();
$query ="select * from `clients`";
foreach( $result as $word... |
How to search or filter in current folder by typing? <p>For example, in my current folder, have following files/folders:</p>
<pre><code>myimage
myfolder
mytextfile
</code></pre>
<p>when I type: "tex", it moves the selection highlight to "mytextfile". Is that possible with finder?</p>
<p>The problem is that, I have m... | <ul>
<li>Select the folder in the parent folder or press <kbd>ââ</kbd></li>
<li>Type <kbd>âF</kbd></li>
<li><p>Click on the name of your folder in Search Options (here <code>"Documents"</code>)</p>
<p><a href="http://i.stack.imgur.com/REFMJ.png" rel="nofollow"><img src="http://i.stack.imgur.com/REFMJ.png" alt="e... |
Scipy minimize a scalar with Brent method throws an Overflow 34 <p>I'd like to find a local minimum of the function <code>f(x) = x^3 + x^2 + x - 2</code>
where <code>x</code> is between <code><-10; 10></code>. I use Anaconda 3 on Windows 64bit.</p>
<p>My scipy python code throws an error:</p>
<pre><code>from sc... | <p>When using local boundaries, changing <code>method</code> to <code>'bounded'</code> is required</p>
<pre><code>from scipy import optimize
def f(x):
return (x**3)+(x**2)+x-2
x_min = optimize.minimize_scalar(f, bounds=[-10, 10], method='bounded')
print(x_min)
</code></pre>
|
SUMIFS Formula not working correctly <p>I have a SUMIFS formula below and it does not seem to be working correctly any help would be greatly appreciated. </p>
<p>The formula is below </p>
<pre><code>=SUMIFS(C4:N4,C4:N4,C4<=11,C4:N4,F4<=1,C4:N4,I4<=1,C4:N4,L4<=1)
</code></pre>
<p>From the picture you can ... | <p>Using <code>SUMIFS</code> means that you want to add the values in <code>C4:N4</code> only if all conditions are TRUE. If this is correct use this formula.</p>
<p><code>=IF(AND(C4<=11,F4<=1,I4<=1,L4<=1),SUM(C4:N4),0)</code></p>
<p>'SUMIFS' is intended for operations with ranges in which one column is a... |
How to sort on basis of multiple keys using underscore.js? <p>Lets say I have a table "employeeTbl_1" </p>
<p>If I run the below query</p>
<pre><code> select * from employeeTbl_1
</code></pre>
<p>the output is </p>
<pre><code> 1 Adam 23000
2 Adam 22000
3 Annabel 13500
4 Abraham 13000
5... | <p>Underscore's sortBy accepts an iteratee function as well, if you pass it a function that first checks the name and if they're equal compares the salary, you'll get the desired sort.</p>
<pre><code>comparator(v1, v2){
return ((v1.name - v2.name) || (v1.value - v2.value))
}
</code></pre>
<p>If the names are equa... |
Delay in playing video which is obtained from Wowza streaming engine <p>When I am playing back the video which is running in <strong><code>wowza</code></strong> streaming engine </p>
<p>(i.e when I am trying to load the url
<a href="http://192.168.10.55:1935/live/myStream/playlist.m3u8" rel="nofollow">http://192.168.... | <p>Delays are normal in HLS streaming and can occur on player side where there is usually some buffer, but the chunking nature of HLS also requires some delay. You can lower the chunk size in Wowza config to 3 seconds if you want. Does that help?</p>
|
Passing string 'by value' change in local value reflect in original value <p>Why is the change of my local variable's value getting reflected into original variable? I am passing it <em>by value</em> in C++.</p>
<pre><code>#include <string>
#include <iostream>
void test(std::string a)
{
char *buff =... | <p>As soon as you wrote </p>
<pre><code>buff[2] = 'x';
</code></pre>
<p>and compiled your code all bets were off. Per [string.accessors]</p>
<blockquote>
<pre><code>const charT* c_str() const noexcept;
</code></pre>
<ol>
<li><code>Returns:</code> A pointer <code>p</code> such that <code>p + i == &operato... |
Moving laravel 5.3 from local to live <p>What files do I need to change to get it running on live? </p>
<p>Right now this is my structure:</p>
<p><code>website.com/barber_base</code></p>
<p>In barber_base I have all the laravel files except public.</p>
<p><code>website.com/public_html/barber</code></p>
<p>In barbe... | <p>You need to change in below files</p>
<p><strong>\config\app.php</strong></p>
<pre><code>'url' => 'http://localhost:8888',
</code></pre>
<p><strong>\config\session.php</strong></p>
<pre><code>'domain' => null, // default will be null but sometimes session creates problem. If So then need to change in this ... |
Send multiple email for each user from database specific column <p>I'm using PHPMailer.</p>
<p>I record user e-mails at <code>users</code> table in <code>email</code> column. Also I have <code>category</code> column in my table. I want to send e-mail to these users. For example, I want to send e-mail to users who has ... | <p>I edited my previous code from your updated code.</p>
<pre><code>require_once("class.phpmailer.php");
if($_POST['message']){
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->IsHTML(true);
$mail->Host = "host.name.net";
$mail->Port = 587;
$mail->SMTPAuth = true;
$mail... |
Setting and unsetting cookies <p>I have a button that can be toggled on and off by adding and removing classes, when clicked to off, I need it to stay in that state and vice versa, the cookie I assigned to the 'off' state works but when I want to toggle it back to on I can't remove the cookie.</p>
<pre><code>$(documen... | <p>Use removeCookie to remove a cookie</p>
<pre><code>$.removeCookie('setting1');
</code></pre>
<p>for newer version of jquery.cookie use</p>
<pre><code>Cookies.remove('setting1');
</code></pre>
|
How to insert NaN array into a numpy 2D array <p>I'm trying to insert an arbitrary number of rows of NaN values within a 2D array at specific places. I'm logging some data from a microcontroller in a .csv file and parsing with python.</p>
<p>The data is stored in a 3 column 2D array like this</p>
<pre><code>[(122.0, ... | <p>From the <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.insert.html" rel="nofollow">doc of <code>np.insert()</code></a>:</p>
<pre><code>import numpy as np
a = np.arrray([(122.0, 1.0, -47.0), (123.0, 1.0, -47.0), (125.0, 1.0, -44.0)]))
np.insert(a, 2, np.nan, axis=0)
array([[ 122., 1., -47.],... |
Stop setting up several AVAudioPlayers with playAtTime() in a for loop <p>When selecting a row the following code sets up a set of <code>AVAudioPlayer</code>s to playback at a certain date (in this case, 50 players playing in the interval of 1 second).
Since I want the whole process to restart when touching again I nee... | <p>I'm a little bit confused about your statement of the problem, but I'll try to give a suggestion anyway.
You say that you set up the players when selecting a row, but the code to set them up is in cellForRowAtIndexPath. So it's set up and playing starts when a cell is returned and displayed in your table view. </p>... |
Threads execution unpredictable <p>I am starting two threads T1 prints 1,3,5,..... and thread two T2 prints 2,4,6.... below is the code that does it.</p>
<pre><code> public class T1T2Print {
public static void main(String[] args) {
Counter c = new Counter();
c.count = 1;
printThread t1 =... | <p>Let us add <code>System.out.println(name + " :: waits");</code> before <code>count.wait()</code> call.</p>
<p>Then the first case log:</p>
<pre><code>T2 :: waits
T1 :: 1
T1 :: waits
T2 :: 2
T2 :: waits
T1 :: 3
T1 :: waits
T2 :: 4
T2 :: waits
T1 :: 5
T1 :: waits
T2 :: 6
T2 :: waits
T1 :: 7
T1 :: waits
T2 :: 8
T2 ::... |
How Integrate HTML Theme In Elgg? <p>I am new in Elgg.</p>
<p>I Have A One Html Theme, </p>
<p>That Theme I Want to Integrate in Elgg,</p>
<p>How To Integrate Theme?</p>
<p>Using Coding.</p>
| <p>There is no well defined steps to do that. basically you can not not integrate any external theme to a framework, like Elgg, or Wordpress. Each has its own CSS file and their they defined classes for button,s header, tabs etc. names are also different.<br>
So in short, the whole effort is like developing new them... |
Can I Enrol One Micro services at 2 Different eureka <p>I don't know whether it is possible or not. I want to know whether I can enroll one microservice at two different eureka server at once.</p>
<p>I have one MS let say API-GATEWAY:
I want to enrol it on two different eureka registry server running on 8761 and 8762.... | <p>You can have only one defaultZone. You need peer replication. So that your 8761/eureka is synchronized with 8762/eureka. When the application is registered to 8761 it is also available in 8762. To do this see <a href="http://stackoverflow.com/users/2730527/spencergibb">@spencergibb</a> answer <a href="http://stacko... |
I cannot initialize date picker with init() or update() method in Android <p>I have a <code>DatePicker</code> and I am trying to initialize it as follows:</p>
<pre><code> DatePicker dp_up = (DatePicker) findViewById(R.id.datePicker);
String inputPattern = "MMM dd, yyyy";
String outputPattern = "dd/MM/yyyy";... | <p>I use the below code accordingly, and it works fine. I put it in onCreate after the setContentView.</p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
DatePicker dp_up = (DatePicker) findViewById(R.id... |
how to create this type of auto play multi image slider <p>I have little problem,</p>
<p>I want to create multi-image slider like this :</p>
<p><a href="http://www.sunrisegroupofschools.org/" rel="nofollow">link</a></p>
<p>If u have any reference site or any plugin or any code please provide me.</p>
<p>thanks in ad... | <p>You can use JQuery to achieve something like that slider. I'm only using one image auto slider in the example, this can be changed for your own needs. </p>
<p>I didn't just want to hand you the complete answer on the spoon and feed you with it. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-con... |
Collapse expander, when one list item is in open- Windows uwp <p>I am using an expand panel to expand/collapse a list.</p>
<p>My problem is, at a time only one item only in expanded state. In my case if i expand one item without collapsing and i expand other item, then both the list items are in expanded state only, p... | <blockquote>
<p>How to collapse one item if i click on other item. Any help will be highly appreciated. </p>
</blockquote>
<p>The easiest way is to register an <code>ExpandStateChanged</code> event for your custom control and collapse other <code>ExpandPanel</code> when any <code>ExpandPanel</code> expands. </p>
<p... |
Uncaught TypeError: Cannot read property 'opened' of null ; iron-collapse not open ; <p>I am using polymer iron-collapse element inside iron-list as demonstrated in git-hub sample <a href="https://github.com/PolymerElements/paper-card/blob/master/demo/index.html" rel="nofollow">sample link</a> everything is working fin... | <p>I think you seem to forget that iron-list is in effect a repeating template and so there is NOT just one element that you can find with that id (itself not a good thing to repeat the same id over and over.</p>
<p>I had a similar problem trying to locate an item in a dom-repeat template, so asked this question and t... |
How to reconnect to a up vagrant box <p>This is probably a really simple question - but after I have run vagrant up, and connected to the box via SSH etc - if I close the terminal, how can i reconnect to the instance? </p>
<p>Any command do if I have done this seems to fail, seemingly as it is running but I am not att... | <p>you can run <code>vagrant global-status</code>, check the <code>id</code> of the VM that you want to connect and run <code>vagrant ssh <vm_id></code> it will ssh into the VM you want</p>
|
SQLite collapse using group by and ignore null <p>I got <code>users</code> table</p>
<pre><code>id |name |email
-------------------------
1 |sam |null
-------------------------
2 |sammy|qqq@example.com
-------------------------
3 |samy |sam@example.com
-------------------------
4 |sammy|null
------------------... | <p>Aggregation functions ignore NULL values, so you can use MIN() or MAX():</p>
<pre><code>SELECT 1,
id,
name,
COALESCE(email, (SELECT min(email) FROM users))
FROM users
ORDER BY id
LIMIT 1;
</code></pre>
|
Creating Filter Form in Views <p>So i am trying to filter the data that is presented in my Index action by using scope.</p>
<p>I have defined it as so in <code>profile.rb</code></p>
<pre><code>scope :fees_to, -> (fees_to) { where("fees_to <= ?", "#{fees_to}") }
</code></pre>
<p>It works perfectly fine in rails... | <p>Usually when creating forms in rails you use form_for to create a form is bound to a single model instance for example: <code>form_for(@thing)</code>.</p>
<p>However when constructing something like a search query or filters you just want a plain old form without any data binding since the goal is not to create or ... |
Play: Unit test for controller class method w/ injections <p>I'm trying to write tests for methods of a controller class that contains injected dependencies</p>
<p>This is my test class implementation:</p>
<pre><code>public class MyTestClass {
private static Application app;
@BeforeClass
public static void ... | <p>My suggestion is to derive the test class from the WithApplication instead of handling manually the application life-cycle. This will look something like this</p>
<pre><code>public class MyTestClass extends WithApplication {
@Test
public void testSomething() {
Helpers.running(Helpers.fakeApplication... |
Angular 2 router v3 observable guard with ngrx <p>I'm trying to create an "auth app" with redux(ngrx) and I'm trying to use my app state in the secret guard. Here you can see my github: <a href="https://github.com/tamasfoldi/ngrx-auth/tree/router" rel="nofollow">https://github.com/tamasfoldi/ngrx-auth/tree/router</a>
T... | <p>You can synchronously get value from store, don't need to "stream everything" (:</p>
<p><a href="https://github.com/ngrx/store#getstate-getvalue-and-value" rel="nofollow">https://github.com/ngrx/store#getstate-getvalue-and-value</a></p>
<pre><code>import 'rxjs/add/operator/take';
function getState(store: Store<... |
Inserting multiple json element in MongoDB using Java <p>I would like to have my mongoDB document in this structure... </p>
<pre><code>{
"_id" : ObjectId("578f547790ee5304306404ea"),
"status" : " que faire?",
"Likes" : 0,
"created_at" : ISODate("2016-07-20T08:49:39Z"),
"UniqueID" : "456511553",
... | <p>from your Gist i found that you are appending <code>original_tweet_info</code> into <code>original_status</code>. Where the <code>original_tweet_info</code> is a string Array. What you have to do is, Append the values into <code>retweet_status</code> document. </p>
<p>Example:</p>
<pre><code> retweet_st... |
Why does add(Component) in a loop not work? <p>I have the following code in a method:</p>
<pre><code>public panel(){
aHoles = new JTextField(2);
aBears = new JTextField(2);
aPenguins = new JTextField(2);
aHolesLabel = new JLabel("Amount of holes:");
String[] Vars = {"aHoles", "aBears", "aPenguins"... | <blockquote>
<p>It also gives me an error, because you can't have variables in an array.</p>
</blockquote>
<p>No, it gives you an error because you cannot store <code>Component</code> objects in an array of <code>String</code>s. If you use an array of an appropriate type, you can have variables in its initializer:</... |
What uses up more space in FLASH? static variable or global variable <p>As the title says, what uses up more space in FLASH (in an STM32 µC for example)? Declaring a global variable or declaring a static variable inside a function? Or do they take equal space? Both variables are available throughout the whole runtime ... | <p>You can have 0-initialized global and static variables. Those normally take up no flash, because they are placed in memory location which is allocated and zeroed when program starts and does not come from flash.</p>
<p>You can initialize the variables with value too. In that case they are placed in the initalized d... |
what are the possible Impact of changing column collate in sql server? <p>I'm using MSSQL 2012,</p>
<p>To handle special character in searching through LINQ, i found to change COLLATE of the column to *_CI_AI, but before changing it i would like to know what and where its impact.</p>
| <p>This might be not so easy...</p>
<p>If this column takes part in indexes and constraints you will have to drop them, change the collation and recreate them.</p>
<p>One very painfull point with collations is the fact, that the temp-db uses - by default - the default-collation of the server-instance. We once had a p... |
Xamarin AndroidGameView : can't figure out why VertexShader / FragmentShader does not compile <p>I'm trying to work with shaders with this Xamarin Sample (I have already work a bit on shaders with SFML):
<a href="https://developer.xamarin.com/samples/monodroid/GLTriangle20/" rel="nofollow">https://developer.xamarin.com... | <p>Well, </p>
<p>The trick was quite simple :</p>
<p>Don"t forget to add the following line in CreateFrameBuffer :</p>
<pre><code>ContextRenderingApi = GLVersion.ES2;
</code></pre>
<p>Problem solved.</p>
|
Why does this List<T> update when I modify a separate variable? <p>So I'm currently writing a function to load some data from a folder of text files.</p>
<pre><code>public void loadPatterns()
{
string[] files = Directory.GetFiles("patterns/");
Level pattern = new Level();
List<char> row = new List<... | <p>you are clearing your list via <code>row.Clear()</code>. You should create a new <code>row</code> with <code>row = new List<char>()</code></p>
<pre><code>public void loadPatterns()
{
string[] files = Directory.GetFiles("patterns/");
Level pattern = new Level();
List<char> row = new List<c... |
Convert PHP Array to Javascript Array [PHP FILE_GET_CONTENTS] <p>I had a question, how can I convert php array that I read using php <code>file_get_contents</code> to javascript array.</p>
<p>Here is how my array look,<a href="http://i.stack.imgur.com/Dz9Pj.png" rel="nofollow"><img src="http://i.stack.imgur.com/Dz9Pj.... | <p>return your array with <code>json_encode($array)</code> it will return a JSON Object.</p>
|
Can't authenticate user "ambari" in ambari-server setup in PostgreSQL <p>I am setting up the Hortonworks Hadoop stack on a single instance RHEL 7 node. I am stuck in the part where I am setting up my <code>ambari-server</code>, using my PostgreSQL 9.2.15 database (not default, not embedded).</p>
<p>I also intend to us... | <p>The problem is your <code>pg_hba.conf</code> file.</p>
<p>It is parsed from top to bottom, and the first matching line is used.<br>
In your case, the line chosen is</p>
<pre><code>host all all 127.0.0.1/32 ident
</code></pre>
<p>(you seem to connect from localhost) which is not what you want.</p>
<... |
How to write to SD Card in Android 6.0 without asking runtime permission? <p>I want to ask - can the app write data to external SD Card in Android 6.0 without asking runtime permissions? I know the the right way is to check, if the user granted such permission for my app. I made small research, and find out that most o... | <p>You can achieve that when you set in your project's Gradle file the compileSdkVersion not bigger than 22.<br>
<strong>Important! When you deploy a version of your app to Google Play store which was compiled against a version bigger than 22, you can never ever switch back to a version below 23. You cannot even switch... |
Regex only match multiline Comments <p>I'm trying to come up with a Regular Expression that matches all multiline comments within a String. The problem is, i'm not allowed to match single line comments in the same format.</p>
<p><strong>Match:</strong></p>
<pre><code>/* This
is a
multiline
comment
*/
</code></pre... | <p>Something like that (with addidional corrections depending on the language you are using):</p>
<pre><code>\/\*((?!\*\/)[^\r\n])*[\r\n]((?!\*\/)[\s\S\r\n])*\*\/
</code></pre>
<p>Test:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<... |
How to remove class error from select field while validation <p>Below is a sample code. Whenever i validate i don't want to highlight the select field in red. But just want to show the error beside the select field in Red. </p>
<p><strong>HTML after click submit</strong></p>
<pre><code><select name="event" class="... | <p>if you are using jquery validate library.. <a href="http://www.formvalidator.net/#configuration_styling" rel="nofollow">Doc</a> says just add valid class on elements where you don't want the border styling. </p>
<p>hope this will help.. </p>
|
Restart BehaviorSubject after an error <p>Wanted behavior:</p>
<pre><code>subject = BehaviorSubject.create(1);
subject.subscribe(number -> print(number), error -> print(error));
subject.onNext(2);
subject.onNext(3);
subject.onError(new RuntimeException("I'm an error"));
subject.onNext(4);
subject.onNext(5);
</c... | <p>If you want <code>onError</code> and <code>onComplete</code> to be disregarded there is the <a href="https://github.com/JakeWharton/RxRelay" rel="nofollow">RxRelay</a> library.</p>
<p>Description:</p>
<blockquote>
<p>Subjects are useful to bridge the gap between non-Rx APIs. However, they are stateful in a damag... |
dotnet pack not including build artifacts <p>I'm trying to publish my project to a nuget package using dotnet pack from within visual studio 2015. My project.json is as follows: </p>
<pre><code>{
"version": "1.0.6.6-*",
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.EntityFra... | <p>it turns out that it's because I changed the output directory in the xproj file, when I changed it back it started creating the package correctly</p>
|
why typeof(Inf) is double? <p>In R, why typeof(Inf) is double ?
Is Infinity can be considered as real numbers or just a number ?</p>
<pre><code>x=1
xx=0
y=x/xx
typeof(y)
</code></pre>
<p>the answer is <code>"double"</code></p>
<p>Thank you </p>
| <p>Well generally, because <em>any</em> number literal in R has type <code>double</code>, unless it ends by <code>L</code>:</p>
<pre><code>> typeof(1)
double
> typeof(NA_real_)
double
> typeof(1L)
integer
</code></pre>
<p>And more specifically, because <a href="https://en.wikipedia.org/wiki/IEEE_754-1985#Pos... |
When to use Thread.currentThread().getContextClassLoader() in webapplications <p>Hi can someone tell me when to use <code>Thread.currentThread().getContextClassLoader()</code>
in web application .Please provide me some real life example. Please do not mark it as duplicate question(My question is when to use Thread.curr... | <p>First of all, please note that this method is not something <code>Java EE</code> related, it is a method of <code>Java SE</code> so it is not something that is meant to be used in web applications only but potentially in any Java applications.</p>
<p>We generally use this method with <code>Thread.currentThread().se... |
What does this code do? <pre><code>// @flow
import { compose, createStore } from 'redux';
import thunk from 'redux-thunk';
const composedStore = compose(
applyMiddleware(thunk),
__CLIENT__ && window.devToolsExtension ? window.devToolsExtension() : f => f
)(createStore)
</code></pre>
<p>This code is a f... | <blockquote>
<p>Unless I am mistaken, this is the vanilla JS equivalent of</p>
<pre><code>function(f){
return f;
}
</code></pre>
</blockquote>
<p>Pretty much, since the function body doesn't use <code>this</code> or <code>arguments</code>; a couple of notes:</p>
<ol>
<li><p>The arrow function (<code>f => f</c... |
Jboss GC not freeing up memory <p>We have an an enterprise application deployed in wildfly 8.2 with min & max heap set to 1.5 GB. One of the actions is causing too much objects to be loaded into the heap. Although the object is dereferenced after the action, the jvm heap usage is not coming down.</p>
<p>But, if I ... | <p>What you trigger from the outside is Major/Full GC, which is not triggered automatically unless absolutely necessary. The JVM tries to make a living with garbage in the Old Generation for as long as it can, in order to avoid the infamous GC pause.</p>
|
How to select each module to run in JMeter 3.0 <p>In JMeter 2.11, I use Module Controller to run each module in WorkBench.</p>
<p><a href="http://i.stack.imgur.com/IidoF.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/IidoF.jpg" alt="enter image description here"></a></p>
<p>But in JMeter 3.0, I not found modu... | <p>Steps to select the controller to run:</p>
<ol>
<li>In module controller, <strong>expand</strong> the Test Plan under "Module To Run", displays all the controllers under the Test Plan. </li>
<li><strong>Click</strong> (or select) the controller you want to run, which highlights the controller to run. </li>
</ol>
<... |
Swift 3 migration error in my code <p>I am getting error in my code</p>
<pre><code>func dataFromHexadecimalString(_ key:String) -> NSString? {
let trimmedString = key.trimmingCharacters(in: CharacterSet(charactersIn: "<> ")).replacingOccurrences(of: " ", with: "")
let regex: NSRegularExpression?
... | <p>From what I can tell your code...</p>
<pre><code>//I am Getting error here i.e C-style for statement has been removed in Swift 3
for var index = trimmedString.startIndex; index < trimmedString.endIndex; index = Collection.index(after: Collection.index(after: index)) {
let byteString = trimmedString.substring... |
Swift - ImagePicker not executing delegate <p>I just want to display an image taken with the iPhone camera in a <code>ImageView</code>. That was the first step of the project but it doesn't work...</p>
<p><strong>Here is my code :</strong></p>
<pre><code>import UIKit
import MobileCoreServices
class ViewController: U... | <p>The type of info is changed to <code>[String : Any]</code> in Swift 3 instead of <code>[String : AnyObject]</code> also you have not added <code>_</code> as first parameter label, so change your method like this.</p>
<pre><code>func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithI... |
Return a data from callback <pre><code> var myVar;
myModule.myFunction().then(function(data){
myVar = data;
});
console.log(myVar);
</code></pre>
<p>I have a module named <code>myModule</code> which exports a function <code>myFunction</code> with some promise. Now when I assign the data ... | <p>You may have to reconsider your structure, but to achieve what you're asking for is to have the <code>console.log</code> inside the promise.</p>
<pre><code> var myVar;
myModule.myFunction().then(function(data){
myVar = data;
console.log(myVar);
});
</code></pre>
|
How to center superfish menu <p>I have found this templatedemo: <a href="http://sunflower62.pas-solutions.ch/index.php?id=10" rel="nofollow">http://sunflower62.pas-solutions.ch/index.php?id=10</a></p>
<p>Givs a change to center the menuitems? I have found a few tutorials, but the menu is allways left.</p>
| <p>You can just use the text-center, display: inline-block trick and remove the floats.</p>
<pre><code>.sf-menu {
text-align: center;
}
.sf-menu li {
text-align: center;
display: inline-block;
float: none;
}
</code></pre>
<p>Of course, if you have sub-menu items you will need to position them correct... |
Why doesnât $(window) work in Chrome? <p>I have the following code, but not work in chrome</p>
<pre><code>var win = $(window);
($(document).height() - win.height() == win.scrollTop())
</code></pre>
<p>I searched the Internet and found with the 'body' now works however are run at the top of the page, how do I run t... | <p>You need call your functionality after document ready.</p>
<pre><code>$(document).ready(function(){
var win = $(window);
($(document).height() - win.height() == win.scrollTop())
})
</code></pre>
|
Gradle build or clean not working just after installing Android Studio <p>I have just installed android studio on Ubuntu 14.04 and created a blank activity just for testing out. Now whenever i try to build the project the following error happens, </p>
<pre><code>Error:Execution failed for task ':app:mergeDebugResource... | <p>Delete the <code>build</code> folders from <code>project root directory</code> and the <code>app</code> directory. The project should build fine after that.</p>
|
Get set of hashes from array of hashes between two date values <p>I have an array of hashes that contains a date and total key.</p>
<p>For example:</p>
<pre><code>hash = [{
"Date"=>"01/01/2016",
"Total"=>10
},{
"Date"=>"02/01/2016",
"Total"=>20
},{
"Date"=>"03/01/2016",
"Total"=>30
},{
... | <pre><code>def get_data(start_date, end_date, hash)
hash.select{|entry| entry["Date"].to_date.between?(start_date.to_date, end_date.to_date) }
end
</code></pre>
|
How to capture a column values form SHOW SLAVE STATUS <p>I need to capture a value of "seconds_behind_master" column.</p>
<blockquote>
<p>SHOW SLAVE STATUS;</p>
</blockquote>
<p>How to achieve it ?</p>
| <p>In a shell script or on the command line on Linux you could:</p>
<pre><code>SECONDS_BEHIND=$(mysql -usome_user -psome_pass -e "show slave status" -E | grep "Seconds_Behind_Master:" | cut -d: -f2)
</code></pre>
|
Python: Monkeypatching a method of an object <p>I'm hitting an API in python through requests' Session class. I'm making GET & POST method call using requests.Session().</p>
<p>On every call(GET/POST) failure, I want to notify another process. I can do this by creating a utility method as follows:</p>
<pre><code>... | <p>This should resolve this. You basically save the old function with different name and give your function as the default post.</p>
<pre><code>setattr(requests, 'old_post', requests.post)
def post(url, data=None, json=None, **kwargs):
try:
requests.old_post(url, data, json, kwargs)
except:
no... |
The value of session variable changed to 'js' or 'css' Codeigniter <p>I have controller called 'projects' show all projects saved in db throught view and beside each project link to view its details which is send project id to the controller to select the clicked project and show its details.
I need to store the projec... | <p>You are setting session variable name: 'project_id'</p>
<p>but in method "view_project_details_session", you are trying to get 'pid'
variable names different.</p>
|
Syntax of importing multiple classes from a module <p>I'm reading some code which contains the following import statement:</p>
<pre><code>from threading import local as thread_local, Event, Thread
</code></pre>
<p>At first this syntax puzzled me, but I think it is equivalent to:</p>
<pre><code>from threading import ... | <p>You can check this on the official documentation. Here's the <a href="https://docs.python.org/3/reference/simple_stmts.html#import" rel="nofollow">documentation for the <code>import</code> syntax</a>:</p>
<blockquote>
<pre><code>import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*
... |
How to pass an Array and access it within React Lifecycle <p>I'm using Mongo/Meteor 1.3/React. In my simple example I use an wrapper React component to query the Mongo collection and create an Array. When passing to the Child component, it seems like the Array object is not ready when constructor is called - meaning I ... | <p>You should use the <a href="https://facebook.github.io/react/docs/component-specs.html#mounting-componentdidmount" rel="nofollow">componentDidMount</a> function to get the data and then set a new state with the resulting data.</p>
<pre><code>class GetData extends React.Component {
constructor(props) {
super(pr... |
How does one populate a row in pandas python <p>I have initialised a dataframe in python to simulate a matrix</p>
<pre><code> llist = ["this", "is", "a","sentence"]
df = pd.DataFrame(columns = llist, index = llist)
</code></pre>
<p>Now I want to populate a row as follows </p>
<pre><code> test = [1,0,0,0]
df.iloc[[... | <p>I think you need remove one <code>[]</code>:</p>
<pre><code>test = [1,0,0,0]
df.iloc[1] = test
print (df)
this is a sentence
this NaN NaN NaN NaN
is 1 0 0 0
a NaN NaN NaN NaN
sentence NaN NaN NaN NaN
</code></pre>
|
Case within join's "ON" caluse <p>I'm trying to do something like this...</p>
<pre><code>SELECT lc.Location, count(h.empID) as 'Count', lu.LBL
FROM swam.lookup lu
LEFT JOIN swam.empTable h
ON CASE
WHEN lu.sac is null
THEN lu.POS = h.POS
ELSE (
lu.POS = h.POS
... | <p>Don't use <code>case</code>. Just use direct boolean logic:</p>
<pre><code>FROM swam.lookup lu LEFT JOIN
swam.empTable h
ON lu.POS = h.POS AND
(lu.sac is null OR lu.sac = h.sac) INNER JOIN
swam.Locations fs
ON h.LocationID = lc.LocationID
</code></pre>
<p>As a bonus, the database engin... |
Android camera2 tap to focus <p>Trying to implement tap to <code>focus</code> using <code>camera2api</code>.</p>
<pre><code> CaptureRequest.Builder afBuilder = mPreviewBuilder;
Rect newRect=new Rect(0,0,200,200);
MeteringRectangle meteringRectangle=new MeteringRectangle(newRect,METERING_WEIGHT_DONT_CARE);
... | <p>For one, you're not actually setting an AF region - you're just reusing the default region from mPreviewBuilder. </p>
<p>Second, even if you set the region to [(0,0,200,200), METERING_WEIGHT_DONT_CARE], that's the top-left corner of the image, and probably not what you want?</p>
<p>Third, and most importantly, yo... |
Why ContentView Width automatically change and scroll Horizontal in iOS(Xamarin) <p>I am new to iOS and Xamarin. I have Created <code>ScrollView</code> and it scroll on Both <code>Horizontal</code> and <code>Vertical</code>. But I want only <code>Vertical</code> scroll. Let me explain in Brief.</p>
<p>This is my Views... | <p>After Spending 1 Hour finally I get Solution I change my Constraint to below and it work with only <code>Vertical</code> scroll as I wanted.</p>
<p><strong>ScrollView Constraint :</strong> </p>
<pre><code>Top Space to SuperView : 0
Trailing Space to SuperView : 0
Leading Space to SuperView : 0
Bottom Space to Supe... |
Disable buttons on GUI in Swing <p>I have buttons on a GUI that execute tests when clicked on in Selenium. They can only be run serially and are currently added to <code>EventQueue</code>. I would like it so that if a button is clicked on and a test is executed, then it will disable the other buttons so that other test... | <p>You should add <code>ActionListener</code> to your button. What's even more important, you should use naming conventions what also means that your objects' names should start with a small letter. Capital letters are reserved for Classes and static fields (all upper case). The following code adds an <code>ActionListe... |
zend docroot does not change <p>Just now I have start with zend framework, I have succesfully install zend framework, I followed the <a href="https://framework.zend.com/manual/1.12/en/learning.quickstart.create-project.html" rel="nofollow">quick start guide</a> I am stuck with doc root.</p>
<p><strong>Short descripti... | <p>You need to edit /etc/hosts file and add below line then do apache2 restart..</p>
<blockquote>
<p>127.0.0.1 zend.gworks.mobi</p>
</blockquote>
|
NSPersistentContainer is only available in 10.0 or newer : error <p>It's because My deployment target is less than 10.</p>
<p>how to resolve for deployment target lower to 10.0 ?</p>
<p><a href="http://i.stack.imgur.com/hfx7d.png" rel="nofollow"><img src="http://i.stack.imgur.com/hfx7d.png" alt="enter image descripti... | <p><em>Not available</em> means not available.</p>
<p>There are two options:</p>
<ul>
<li>Use only the <em>old</em> <code>NSPersistentStoreCoordinator / NSManagedObjectModel</code> pattern.</li>
<li>Use both patterns and write the code with availability checking <code>if #available(iOS 10, *)</code></li>
</ul>
|
Index value in for loop with Twig <p>I'd like to store the iteration value to use in <code>data-target</code> so it would be <code>#question0</code>, <code>#quesion1</code>, <code>#question2</code> and so on...</p>
<p>I tried using <code>{{item.id}}</code> but this didn't work.</p>
<pre><code>{% for item in post.get_... | <p>You can use the variable loop.index0 (for zero based indexing).</p>
<pre><code>data-target="#question{{loop.index0}}"
</code></pre>
<p>should do what you want. See the <a href="http://twig.sensiolabs.org/doc/tags/for.html#the-loop-variable" rel="nofollow">for loop documentation</a> for more info for more informat... |
PHP: looking for something like Java Stream API <p>Is there a way to convert array of <strong>objects</strong> into an <strong>array of strings</strong> using some custom mapping in PHP. Like:</p>
<pre><code>$objs = array(o1, o2, o3);
...
$strings = conv($objs, function($o) -> $o->fieldXYZ);
</code></pre>
<p... | <p>I think what you are looking for is the <a href="http://php.net/manual/en/function.array-map.php" rel="nofollow">array_map()</a> function. For example, this should work:</p>
<pre><code>$strings = array_map(function($o) {
return $o->fieldXYZ;
}, $objs);
</code></pre>
|
Set <h2> text based on table cells - jQuery <p>I'm trying to loop through 8 <strong>h2's</strong> of class <strong>.attr-lbl</strong>, and set their text to a corresponding top 8 <strong>td's</strong> of class <strong>.t0_rhc</strong> in a table. So basically the 1st instance of a <strong>h2</strong> needs to be set to... | <p>You should be context sensitive. Use <code>this</code>:</p>
<pre><code>var count = 0;
$('h2.attr-lbl').each(function() {
var title = $('td.t0_rhc').eq(count).text();
$(this).text(title);
count++;
});
</code></pre>
|
Partial Pivoting in PostgreSQL or Rails <p>Assume I have 3 tables, and I can't change any DDL</p>
<pre><code>Class
id: integer
name: string
</code></pre>
<p>and</p>
<pre><code>Student
id: integer
name: string
class_id: integer //Foreign key to Class table
</code></pre>
<p>and</p>
<pre><code>Score
id: integer
stude... | <p>You can do this with joins and aggregation:</p>
<pre><code>select s.student_id, s.student_name, c.class_name,
avg(case when sc.subject = 'Math' then sc.score end) as Math,
avg(case when sc.subject = 'Physics' then sc.score end) as Physics,
avg(case when sc.subject = 'Chemistry' then sc.score en... |
Laravel Chat Message. Saving Image send in chat? <p>I am using Laravel 5.3 and developing an app for IOS developer. I have been working on a user-user chat. I have already designed the database and backend logic in laravel. Everything is working fine for now. </p>
<p>Now my client wants to send images and videos in ch... | <p>You have to store image in some folger eg. <code>public_path("uploads/")</code> in laravel</p>
<p>create new image_path field in your existing table and store the image name in that field, name the image like this timestamp + random</p>
<p>eg. <code>date("YmdHis").str_random(6).'.jpg'</code></p>
<p>This is the mo... |
Disable wrapping in Psql output <p>When using Psql in Linux, if the result of my SQL query contains many columns or long strings of data, it will wrap the initial view and only once I scroll to the side will it stop wrapping and show each row on a separate line.</p>
<p>I've tried various <a href="https://www.postgresq... | <p><code>Psql</code> uses a system viewer to show its output in the console. In <code>bash</code> it likely uses <code>less</code> for the scrollable/page-able features it provides. To use a different viewer or use different settings, you just need to set the <code>PAGER</code> environment variable. </p>
<p>Running <c... |
how to give multiple values to a select-option tag? <p>Here,i am trying to get multiple values from one select tag, as a user selecting an option then one value we should give but in case of two or multiple values how we can deal with it?</p>
<pre><code><?php
include 'database.php';
$queryy = mysqli_query($co... | <p>Try this:</p>
<pre><code><!-- here name is of array type, so that it can hold multiple values in it -->
<select name="my_select[]">
...
</select>
$selectedOptions = $_REQUEST['my_select'];
// It contains the user selection in an array
</code></pre>
|
Extracting data from multiple files with python <p>I'm trying to extract data from a directory with 12 .txt files. Each file contains 3 columns of data (X,Y,Z) that i want to extract. I want to collect all the data in one df(InforDF), but so far i only succeeded in creating a df with all of the X,Y and Z data in the sa... | <pre><code>df = pd.read_table(filedata, delim_whitespace=True, names={'X','Y','Z'})
</code></pre>
<p>this line replace <code>df</code> at each iteration of the loop, that's why you only have the last one at the end of your program.</p>
<p>what you can do is to save all your dataframe in a list and concatenate them at... |
What version of TypeScript does Angular2 require? <p>What is the minimum version of TypeScript that Angular2 requires? Specifically, is TypeScript 1.8 sufficient, or do you have to have TypeScript 2.0?</p>
<p>We want to use TypeScript, but have a big project using 1.8 that is not completely trivial to upgrade.</p>
| <p>Typescript 1.8 works fine, We have been using typescript 1.8 with the final Angular 2.0 and there's no problem at all.</p>
<p>Would that be true for future versions? Probably not.</p>
<p>The Angular team is developing with typescript 2.0.2 as you can see in this <a href="https://github.com/angular/angular/commit/2... |
Unable to set up Export Handler in Solr <p>I have followed the instructions here for setting up an Export Handler for Solr and I am having issues when trying to retrieve the data:</p>
<pre><code>Java.io.IOException: org.apache.solr.search.SyntaxError: xport RankQuery is required for xsort: rq={!xport}
at org.apache.so... | <p>I found out that if the Solr Index has no data, you receive the error above. I populated it, and it worked.</p>
|
If I update memory cache using the Set method, with an absolute expiry, will this mean the expiry is extended? <p>I'm using <a href="https://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache(v=vs.110).aspx" rel="nofollow">MemoryCache</a> to store a data table, which contains about 60 rows. Sometimes I... | <p>Yes it will update expiration time. What you can do is store expiration time together with item itself, in cache. So</p>
<pre><code>class CachedDataSet {
public DateTime ExpiresAt {get;set;}
public DataSet DataSet {get;set;}
}
</code></pre>
<p>Then when refreshing, you first get this item from cache and us... |
TryFind method in Guava throw NullPointerException <p>I get a NullPointerException while running my webapplication, I save a logs and start server again and this error no longer there appeared, but i want protect method to NullPointer never appeared. I sure this line is responsible for this error</p>
<pre><code>Vehicl... | <p>Check the following statements:</p>
<ul>
<li><code>aFactory</code> - Because of the <code>getVehicle()</code> call.</li>
<li><code>aFactory.getVehicle()</code> - Because Iterables.tryFind expects a non-null Iterable</li>
<li><code>vehicle</code> - Because of the <code>getVehicleBrand()</code> call</li>
<li><code>aV... |
Android Studio 2.2 and Jack are getting blocked by Avira Antivirus <p>So I update my project to use the new jack compiler, but for some unknown reason my AntiVir blocks the task <code>transformClassesWithPreJackPackagedLibrariesForDebug</code>
It works if I disable AntiVir real-time protection. I really don't want to d... | <p>While compiling disable real-time protection in your anti-virus package. It is the only workaround that is reliable at this time.</p>
|
How to remove a div after a second and make other one change in width in jquery <p>I need remove a div from DOM after 1 second, I found out how to hide using CSS, but the problem this divs stay in the DOM.</p>
<p>So how can remove this Div from DOM and make the other one be <code>width:100%</code> ?</p>
<p><strong>cs... | <p>Use <code>setTimeout()</code> and apply the <code>animate()</code> as per your need.</p>
<pre><code>setTimeout(function(){
$('.header').remove();
$('.sub-header').animate({
width: '100%',
marginLeft: '40%'
});
}, 1000);
</code></pre>
<p><div class="snippet"... |
ASP.Net redirecting to local host after authentication <p>I just created a webform that is hosted in my Azure subscription. I set it up with authenication via my works Azure directory for authenticating users. In debug this works fine and I am able to login with my work credentials and then view the website via local h... | <p>I have solved this issue. Since it was such a pain I will keep this up as I couldn't find any answers on this. It was actually quite simple. </p>
<p>You have two options. The one I did and which worked was changing the publish profile as below:</p>
<p><a href="http://i.stack.imgur.com/1OaHh.png" rel="nofollow"><im... |
Is it possible to use the selected lines of a one2many list in a function? <p>Ive been using the module â<code>web_o2m_delete_multi</code>â that lets me select multiple lines in <code>one2many</code> list view and delete them all.</p>
<p>Is there a way to use the selected lines in a python function? I tried <code>... | <p>You can get these selected record ids in <code>ids</code> instead of <code>active_ids</code>.</p>
|
System calls in C (File Descriptor) <p>follwing code has written to open a file and write data to terminal using sysyem calls in linux. </p>
<p>To read the value of the file descriptor (fd) it should assign a value. As we know in if else statement, from if part else part or else if part one part will implement at a ... | <p>Following happens here:</p>
<p>Let's suppose the program is started with <em>xyz.txt</em> on the command line and let's suppose the <em>xyz.txt</em> file does exist:</p>
<pre><code>if(argc != 2)
{
// we don't get here because argc == 2
printf("USAGE : %s\n",argv[0] );
... |
Calling a setuptools entry point from within the library <p>I have a setuptools-based Python (3.5) project with multiple scripts as entry points similar to the following:</p>
<pre><code>entry_points={
'console_scripts': [
'main-prog=scripts.prog:main',
'prog-viewer=scripts.prog_viewer:main'
]}
... | <p>You could run a python command with Popen, for example:</p>
<pre><code>Popen('python -c "from scripts.prog import main; main()"', shell=True)
</code></pre>
|
Reducing Map by using Java 8 Stream API <p>I have a Map in the following form:</p>
<pre><code>Map<Integer, Map<String,Double>> START
</code></pre>
<p>Let INNER be the inner map, i.e. </p>
<pre><code>Map<String,Double>
</code></pre>
<p>For example, I'd like to reduce START map in a new one</p>
<pr... | <p>This should be a good example:</p>
<pre><code>public class Main {
public static void main(final String[] args) {
final Map<Integer, Map<String, Double>> tmp = new HashMap<>();
tmp.put(1, new HashMap<String, Double>() {{
put("1", 3.45);
put("2", 1.... |
Bootstrap dropdown not closing on clicking outside <p>In my application I have added close button side bootstrap dropdown.
Clicking on that close button I have to close that dropdown.
This is working properly, but when I click anywhere outside dropdown, dropdown is not closing
Here is Fiddle : <code>goo.gl/3RAkBw</co... | <p>You can try this:</p>
<pre><code>$(document).on('click',function(){
$('#layers').hide();
})
</code></pre>
|
Group in way between some values <p>I have following data:</p>
<pre><code>Event Event Start DateTime Event End DateTime edd ed Pr Avg
700073A 9-9-16 10:44 9-9-16 10:49 NULL small 25
700073A 9-9-16 10:50 9-9-16 10:51 -1 small 22.5
201015A 9-... | <p>This returns the required output based on the sample data:</p>
<pre><code>declare @t table (Event char(7), EventStartDateTime datetime, EventEndDateTime datetime, edd int, ed char(5), PrAvg decimal(15,8))
insert @t values
('700073A', '9-9-16 10:44', '9-9-16 10:49', NULL, 'small', 25),
('700073A', '9-9-16 ... |
C# Get list od running Apps and their paths for string scan <p>I'm developing a very simple 3rd party anti-cheat app in C#. I've managed to create a code that will scan any .exe for forbidden strings like "aimbot" and "hack". But the way I did it is, you browse for a file to scan and click a button to scan it - and thi... | <p>If you already know the process names you want to go for, you can go with this.</p>
<pre><code> Process[] processMame = Process.GetProcessesByName("yourProcess");
if (processMame.Length > 0)
{
/// You got your process here
/// Do whatever you want
}
Process[] processlist = P... |
Overwrite master with delete action from feature branch in GIT? <p>I've forked a feature branch named #ftr from master named #master. With time we commit in both separately. Now *how can i push everything from #ftr to #master with deletion of extra files in master and overwrite of all other files in master *</p>
<p>No... | <p>It sounds like what you want is the equivalent of <code>-s theirs</code> (basically what Jeff Puckett II <a href="http://stackoverflow.com/questions/39851490/overwrite-master-with-delete-action-from-feature-branch-in-git#comment66990993_39851490">suggested in a comment</a>). Unfortunately, this does not existâbut... |
UCanAccess cannot read query with "... FROM TableName IN 'FileSpec'" <p>I need to read data from a view of MS Access with UCanAccess. I have two databases in <strong>C:\DataBases</strong></p>
<ol>
<li><strong>DBa</strong> (Contains the table: <strong>TableOfDBa</strong>).</li>
</ol>
<p><img src="http://i.stack.imgur.... | <p>Currently (as of version 3.0.6), UCanAccess does not support the syntax</p>
<pre class="lang-sql prettyprint-override"><code>SELECT * FROM TableName IN 'C:\Path\To\DbFile.mdb'
</code></pre>
<p>If you try to open DBb.mdb using the UCanAccess console (console.bat or console.sh) you will see</p>
<pre class="lang-non... |
How to use online payment using credit/debit card in java web application? <p>I am using a java web application and in that i want to do online payment using credit/debit card. please suggest me how to proceed in details?</p>
| <p>Contract a payment provider like Paypal, and they'll provide you with the details on how to use their service and what the conditions are.<br/>
There's no one size fits all solution, and you DEFINITELY will NOT be accepting credit cards yourself, the handling agencies are never going to allow it unless you are a wel... |
How to set a flag properly <p>I have a timer class, inside the class there is a flag. When we did not call init(), flag is 0. After we call init(), it will be set to 1. After we call end(), it will be set back to 0.</p>
<pre><code>class TimerHao
{
private:
double seconds;
int flag=0; //0: Have not start a... | <p>You can add an enumeration and use that value in your code so the code is self-explanatory:</p>
<pre><code>class TimerHao
{
private:
enum flag_states
{
FLAG_STATE_NOT_STARTED = 0,
FLAG_STATE_IN_ACCUMULATION,
// etc
};
double seconds;
flag_states flag = FLAG_STATE_NOT_S... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.