input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Moq Internal Methods <p>I am new to moq and trying to implement moq test for the below class but got stuck with a error.</p>
<pre><code>public class ClassToTest {
internal Func<string> GetConfigString =
() => ConfigurationManager.AppSettings["somekey"].ToString()
}
</code></pre>
<p><strong>Test M... | <p>If you want to test internals of classes you should use the <a href="http://stackoverflow.com/a/1809482/6248956">InternalsVisibleTo</a> attribue in the AssemblyInfo.cs as you already did.</p>
<h2>There is 2 problems I see here:</h2>
<p><strong>First Problem :</strong></p>
<p>Your GetConfigString Func is a field i... |
How to find the rows count returned from db.Query postgres <p>I am using goLang lib/pq driver and trying to fetch rows from database.</p>
<pre><code>rows, err := db.Query("select id, name from mytable limit 5")
</code></pre>
<p>I want to have a if else clause which checks if there are rows in result set and I did thi... | <p>When you work with the <a href="https://golang.org/pkg/database/sql/#Rows" rel="nofollow">Rows</a> object, there isn't any helper method that give you the total rows count in one step. </p>
<p>A simple but slower solution is to iterate through all the results using an incremental variable to store the amount of row... |
How to select specific years in a column <p><a href="http://i.stack.imgur.com/3EE7V.png" rel="nofollow">My Data.frame</a></p>
<p>Hello, I am working on a data base from the USAID. I need to clean it, but I don't know how to select a specific year. In other words, I would like to know, how to have a data.frame with jus... | <p>Filter the dataframe rows by the fiscal_year column values:</p>
<p><code>Base_Raw2[Base_Raw2$fiscal_year >= 1970 & Base_Raw2$fiscal_year <= 1991,]</code></p>
|
How to validate inputs inside form and submit button outside the form <p>Based on requirement I am trying to validate the form.</p>
<p>Actually I am passing form input elements in bootbox modal dialog and passing submit button dynamically in modal dialog.</p>
<p>When input type=submit is there it is able to validate ... | <p>Try like this </p>
<p>Add required to your input type in html</p>
<pre><code> <form id="frmPlate">
<input type="text" name="Name" required="required" />
</form>
<button type="submit" onclick="CheckValidation();"> Submit</button>
</code></pre>
<p>And you can validate in jquery lik... |
How to update the mysql database from ASPX page without using code behind loagic <p>How do I update a MySQL database from an ASPX page without using code behind the logic. I am using a <code>datepicker</code> element in the ASPX page and I need to update the <code>employmentenddate</code> value in the ASPX page itself... | <p>Use entity data model and entity data source which enables u to update insert and delete automatically from database ... however you should trigger the update function through event "textChanged" if using textbox </p>
|
why using the headerfiles in flex project and what it do? <p>why using the headerfiles in flex project and what it do ? like
import mx.controls.Alert;
import mx.events.FlexEvent;</p>
| <p>It allows you to use those classes. It tells the classes what class you specifically you mean.</p>
|
Facing issue in Shell while executing query on remote postgres database <p>I am running one shell script on my App server which will go on another machine where Postgres database is installed. It will execute query and return couple of IDs and store into variables. Please find below my shell script. </p>
<pre><code>... | <p>Finally i was able to resolve my issue by making changes in Shell </p>
<pre><code>projectid=$(ssh root@<Remote_HOST> << EOF
/usr/pgsql-9.4/bin/psql $DB_NAME -U $DB_USER -h $DB_HOST -t -c "select projectid from projects where project_Name='$projectName';"
EOF)
scenarioid=$(ssh root@<Remote_HOST> &... |
Pause/resume video based on focus <p>I have a videoview that plays as a background. How do I pause it when my app looses focus and resume the video when the app has focus again? Here is my code.</p>
<pre><code>@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
se... | <pre><code>override onPause() method and write code for pause on that method and override onResume() method and write code for resume on that method
</code></pre>
|
use of variables in lex and yacc <p>This rules section was written, I am using memory called mem[26] to store the variables. </p>
<pre><code>%%
program: variable EQ expr {mem[$1] = $3;}
| expr {printf("the answer is %d\n", $1;)}
;
expr: number
| variable {$$ = mem[$1];}
| expr PLUS expr {$$ = $... | <p>Put the variables in a hash table, mapping their names to their values. Use the semantic actions to associate a value with the left-hand side non-terminal, by looking up the value of the identifier in the hash table, if the right-hand side of the production is <code>ID</code>. More or less:</p>
<pre><code>expr : ex... |
Saving video with overlay of GIF image <p>I am working on an application in which I record a video. When recording finished I put a GIF image on it with use of <a href="https://github.com/mayoff/uiimage-from-animated-gif" rel="nofollow">Library</a>. </p>
<p>My code for playing video and putting gif image as an overla... | <p>You can try any of the below code for Screen Recording. It will merger your video and GIF.</p>
<p>You can download sample from the link below provided by Apple. <a href="https://developer.apple.com/library/mac/samplecode/AVScreenShack/Introduction/Intro.html" rel="nofollow">https://developer.apple.com/library/mac/s... |
How to compare array 1[array of objects] with array 2 in javascript <p>I want to compare with array 1 with array 2, array 1 has array of objects. whatever items available in array 2 those should be also available on array 1. If so, then, i have to push the item from array 2 to new array, then, i return newly created fi... | <p>Replace inner for-loops with</p>
<pre><code>var matches = a.filter( function(item){ return b.indexOf( item.name ) > -1 } );
</code></pre>
<p>For example</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js ... |
How can i search if argv ends with a char <p>How would i check to see if argv ends with a character? for example how would i write the program if I wanted to see if the agv[1] ends with the character z.</p>
<pre><code>if(argv[1] == ? )
printf("The input entered ends with the character z");
</code></pre>
| <pre><code>#include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
int string_length;
if(argc < 2)
printf("\n no arguments \n");
else if(argc > 1)
{
string_length = strlen(argv[1]);
if(argv[1][string_length - 1] == 'z')
printf("\n The input entered ... |
Javascript - Get the return of FileReader <p>I'm new to Javascript, how I get the return of function <code>isImage()</code> and use the result in function <code>onFileSelect()</code>. I'm trying to get the result but gives value <code>undefined</code> for <code>this.isImage()</code></p>
<pre><code>isImage(file: File) ... | <p>The reason you are not getting a value back is because isImage has some file IO logic which is asynchronous. The way to handle this is to pass isImage a callback (<code>cb</code>). When you have the result of isImage you call the callback function and then the execution happens in the block I commented in.</p>
<pre... |
How to set sbt bin path in IntellIJ? <p>I have a local sbt installed with a higher version. But the IntellIJ downloads a lower version of the sbt.</p>
<p>How/where can I update the path in the IntellIJ so that it takes up the newer version of sbt?</p>
| <p>Have you tried the settings?</p>
<p>Preferences<br>
â Build, Execution, Deployment<br>
â Build Tools<br>
â SBT </p>
<p>â Launcher (sbt-launch.jar)<br>
â Custom</p>
|
Open new Fragment screen by clicking the button in Activity android <p>I have created one activity class in android.i need to clicking button show new fragment class screen.</p>
| <p>Use the FragmentManager class:</p>
<pre><code>FragmentTransaction ft = getFragmentManager().beginTransaction()
.add(R.id.your_fragment_container, yourFragment)
.addToBackStack();
ft.commit();
</code></pre>
|
QProcess exe does not close if program finished <p>My problem is that I am starting an executable in a QProcess like the following:</p>
<pre><code>QProcess Work;
Work.start(program.exe);
</code></pre>
<p>This executable runs since it has been started in background and I can send requests to it. If I have finished I a... | <p>You should use <a href="http://doc.qt.io/qt-5/qprocess.html#terminate" rel="nofollow">void QProcess::terminate()</a> or <a href="http://doc.qt.io/qt-5/qprocess.html#kill" rel="nofollow">void QProcess::kill()</a> for it.</p>
<p><code>terminate()</code> - attempts to terminate the process.</p>
<p><code>kill()</code>... |
Attempting to add a string to one string list but end up adding a string to TWO string lists. <pre><code>public class NetworkEntry {
private String name;
private int cost;
private StringListExt predList;
private StringListExt succList;
public NetworkEntry(String nameval, int costval, String pred){
... | <p>Do not use static</p>
<pre><code>protected static ArrayList <String> list;
</code></pre>
<p>If you use static, that means that there will only be one of this variable - shared between all instances in the JVM.</p>
<p>As per <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html" rel="no... |
Securely render arbitrary user-uploaded content (from a WSYWIG editor) <p>I have a site which allows an admin to edit a section of one page of the site with arbitrary HTML (via a WSYWIG editor), and I want to figure out a way to serve this arbitrary HTML securely to other users. </p>
<p>The basic intent is to eliminat... | <p>An html editor on the client is not straightforward to protect against XSS at all. As you say, serving such content from a different domain may mitigate the risk, but gives way to other questions (like for example how will you authenticate and authorize users on the other domain to prevent downloading any user's con... |
Bad Request (#400) Missing required parameters: id in yii2 <p>Whenever I tried to create a event, after clicking on create it says:</p>
<blockquote>
<p>Bad Request (#400) Missing required parameters: id</p>
</blockquote>
<p>I had tried by doing <code>$model->save(false);</code> but when I do so, it only uploads ... | <p>It seems that <code>'id' => $model->event_id</code> is looking for <code>lastInsertID</code></p>
<p>Try this</p>
<pre><code>if($model->save())
{
$lastInsertID = $model->getPrimaryKey();
return $this->redirect(['view', 'id' => $lastInsertID]);
}
else
{
// print_r($model->getErrors()... |
Umbraco get media thumbnail url <p>Umbraco, when save an image, will create 3 files:</p>
<pre><code>originalfile.jpg
originalfile_big-thumb.jpg
originalfile-thumb.jpg
</code></pre>
<p>I used:</p>
<p><code>Umbraco.TypedMedia(mediaId)</code> or <code>Umbraco.Media(mediaId)</code></p>
<p>but it gave me the url to orig... | <p>I'm guessing that those thumbnails are obsolete and not used in Umbraco right now. There was a thread how to hack it and use it on Our: <a href="https://our.umbraco.org/forum/developers/razor/22898-How-to-get-media-thumbnail#comment-85557" rel="nofollow">https://our.umbraco.org/forum/developers/razor/22898-How-to-ge... |
MKmapView Overlay drawing shows color patches iOS 10 <p><a href="http://i.stack.imgur.com/8ZKTo.png" rel="nofollow"><img src="http://i.stack.imgur.com/8ZKTo.png" alt="enter image description here"></a></p>
<p>I am drawing MKPolyLine over MKMapView. Before iOS 10 is was working fine. In iOS 10 its showing color patches... | <p>Its look like iOS 10 bug, I spend lot of time to "hack" this bug.</p>
<p>I found only one solution when I redraw MKPolyline(remove old and add new) it should be call it in dispatch_after, it look like it should be redraw when map make shape. (imho)</p>
<p><code>dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.5 *... |
How to iterate through Array and remove an item based off a string value <p>I have a string with is a prefix. I'm iterating over an Array of String and if the value contains the prefix then I want to remove that item from the <code>Array</code>. My code is giving me the error:</p>
<blockquote>
<p>fatal error: Index ... | <p>Have you try to use <code>filter</code> for that.</p>
<pre><code>var filterArray = arrayValues.filter { !$0.contains(prefixValue) }
</code></pre>
<p>For case insensitive Swift 3</p>
<pre><code>var filterArray = arrayValues.filter { !$0.lowercased().contains(prefixValue) }
</code></pre>
<p>For case insensitive Sw... |
Token is always null in Firebase <p>I am trying to get a token to use cloud messaging in my app with the following simple code :</p>
<pre><code>String token = FirebaseInstanceId.getInstance().getToken();
</code></pre>
<p>I have tried to look everywhere on StackOverflow for people who had the same problem and couldn't... | <p>OK, I managed to find the solution by myself, it took me a lot of time to figure it out so I thought it would be a good idea to share the solution in case someone gets the same issue.</p>
<p>So the problem came from the fact that I used this line in my <code>AndroidManifest.xml</code> (inside <code><application&... |
grouping in big data without index <p>I am having a table which have many columns
i want to do group by on 1 column to get the count of unique records
it is having data around 6 crores</p>
<p>i m using query as</p>
<pre><code>select distinct lower(TITLE) , count(lower(TITLE)) as CountOf
from table_name2
where
((LE... | <p>You can try this:</p>
<pre><code>select
lower(TITLE) ,
count(lower(TITLE)) as CountOf
from table_name2
where
REGEXP_COUNT ('asdaasd ', '\s')+1 > 3
HAVING COUNT(TITLE)>1
group by TITLE
</code></pre>
|
Migrate link from mobile web browser to mobile app <p>I want that my online website link that is opened in my mobile browser checks whether my mobile app is installed or not and then opens it in my mobile app.</p>
<p>I want my functionality as I have shown in this
<a href="http://i.stack.imgur.com/vMBKt.jpg" rel="nof... | <p>This functionality is known as Mobile Deep Linking. The easiest way to get started is with a deep linking service like <a href="https://branch.io" rel="nofollow">Branch.io</a> (full disclosure: I'm on the Branch team), <a href="http://www.yozio.com" rel="nofollow">Yozio</a>, or <a href="https://firebase.google.com/d... |
subprocess.Popen: 'OSError: [Errno 2] No such file or directory' only on Linux <blockquote>
<p>This is not a duplicate of <a href="http://stackoverflow.com/questions/39777345/subprocess-popen-oserror-errno-13-permission-denied-only-on-linux">subprocess.Popen: 'OSError: [Errno 13] Permission denied' only on Li... | <p>I've tested your <code>espeak</code> Python wrapper on Linux, and it works for me.
Probably it's just an issue with Windows trailing <code>\r</code> characters.
You could try the following:</p>
<pre><code>sed -i 's/^M//' espeak4py/__init__.py
</code></pre>
<p>To enter the <code>^M</code>, type <code>Ctrl-V</code> ... |
How to locate this kind of element with Selenium <p>I'm trying to learn how to make script in python with selenium. Most of the time I was practising with "static element" but now I want to select some elements which have a dynamic id but the problem is that their id don't have a partial static part.</p>
<p>However th... | <p>You can build a cssSelector using attribute like this:</p>
<pre><code>driver.find_element_by_css_selector("Yourtag[attributeName='Your AttributeValue']");
</code></pre>
<p>For your specific case use below code snippet:</p>
<pre><code>driver.find_element_by_css_selector("div[data-shift-id='134514']");
</code></pre... |
Angular2 filter pipe on input <p>I want to add filter on the input field</p>
<pre class="lang-html prettyprint-override"><code> <input class="ibox1 rightalign" type="text"
[(ngModel)]="_note.StudentPercent"
ngControl="StudentPercent" pattern="[0-9]*"
#StudentPercent="ngForm">
</code></pr... | <p>When adding a pipe to the model you must remove the <code>()</code> from <code>[(ngModel)]</code> and use it like <code>[ngModel]</code>.</p>
<p>Like so:</p>
<pre class="lang-html prettyprint-override"><code><input class="ibox1 rightalign" type="text"
[ngModel]="_note.StudentPercent | percent:'.0-0'"
ng... |
declaring multiple objects in one property <p>Hello I'm learning IOS App Development using Objective-C on my own by watching tutorials and and following the courses one thing I noticed that everybody is declaring multiple properties separately in model like:-</p>
<pre><code>@property ( strong , nonatomic ) NSMutableS... | <p>The syntax to declare multiple (non-outlet) properties of the same type in one line is perfectly fine. The functionality is exactly the same as the standard way to declare one property per line.</p>
|
How shared library finds GOT section? <p>While I was reading <a href="http://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/#id1" rel="nofollow">http://eli.thegreenplace.net/2011/11/03/position-independent-code-pic-in-shared-libraries/#id1</a>
question came:</p>
<p>How does PIC shar... | <blockquote>
<p>I was thinking that there is only one GOT in process memory, however, see that library references GOT? </p>
</blockquote>
<p>We clearly see <code>.got</code> section as part of the library. With <code>readelf</code> we can find what are the sections of the library and how they are loaded:</p>
<pre><... |
ECONNREFUSED error on stream is not handled by error event and try catch <p>I am using npm request module to forward an incoming request to another server as:</p>
<pre><code>app.get("/somepath", function(req, res) {
var url = proxySetting.global.url + req.url;
req.pipe(request(url)).pipe(res);
});
</code></pre... | <p>It seems, you are not acting on response object in <code>"errorHandler"</code>, if you see your code block (given below), <code>res</code> is out of scope.</p>
<pre><code>function errorHandler(err) {
console.log("Error occoured while forwarding request");
console.log(err);
res.status(500).send("Error oc... |
How to compare Enums in TypeScript <p>In TypeScript, I want to compare two variables containing enum values. Here's my minimal code example:</p>
<pre><code>enum E {
A,
B
}
let e1: E = E.A
let e2: E = E.B
if (e1 === e2) {
console.log("equal")
}
</code></pre>
<p>When compiling with <code>tsc</code> (v 2.0.3) I ... | <p>There is another way: if you don't want generated javascript code to be affected in any way, you can use type cast:</p>
<pre><code>let e1: E = E.A
let e2: E = E.B
if (e1 as E === e2 as E) {
console.log("equal")
}
</code></pre>
<p>In general, this is caused by control-flow based type inference. With current typ... |
How to clear NiFi queues? <p>We are creating some flows in NiFi and there might be some cases where the queues are being build up but due to some reason the flow doesn't work as expected. </p>
<p>At the end of the day, i would like to clear the queues and somehow would like to automate it. The question is how can we d... | <p>In addition to the explicit "Drop Queue" function Bryan mentioned, a couple other features you may be interested are the "Back Pressure" and "FlowFile Expiration" settings on connections. These allow you to automatically control the the amount of data in any given connection. A simple explanation for each is below b... |
How should I use sscanf() to break the line into fields? <p>How to use <code>sscanf()</code> to separate input? here I have a <code>getline</code> to find input. I checked that input before and it is correct, which means it can read one line you input if you don't end the file. Then I was trying to separate what you in... | <p>It will crash. allocate memory for field1.</p>
<pre><code> char *field1 = NULL;
</code></pre>
|
dateBySettingUnit method of NSCalendar returns not obvious result <p>My problem is solved by NSDateComponents, but I want to understand why this method works so</p>
<pre><code>NSDate *today = [NSDate date];
NSLog(@"today is: %@", today);
NSDate *dayChanged = [calendar dateBySettingUnit:(NSCalendarUnitDay)
... | <p>As per the observation, <a href="https://forums.developer.apple.com/thread/12048" rel="nofollow">dateBySettingUnit does not return past date</a> </p>
<p>So for a quick test setting using <code>dateBySettingUnit</code> for future dates works as expected, see below code:</p>
<pre><code>NSCalendar *calendar = [[NSCal... |
Android Activity Button wont works when i use pageviewer <p>Hello I have a question about Android Activity.</p>
<blockquote>
<p>java.lang.NullPointerException:
Attempt to invoke virtual method
'void android.widget.Button.setOnClickListener
(android.view.View$OnClickListener)'
on a null object reference</p... | <p>Your current content view is activity_main and you are accessing Button sign from welcome_layout3. This is your issue. Try to study how to use viewpager from this link <a href="https://developer.android.com/training/animation/screen-slide.html" rel="nofollow">https://developer.android.com/training/animation/screen-s... |
Add carrier column to orders table in Prestashop back-office <p>I am trying add "carrier" column to orders table. I know I need to add that field in fields_list array in AdminOrdersController.php, but when I expanding array on field <code>carrier</code> I got <code>unknown collumn 'carrier'</code> error in BO. What I a... | <p>You should edit the $this->_select, $this->_join and $this->field_list variables in order to show the carrier.</p>
<p>The $this->_join should contain the following</p>
<pre><code>LEFT JOIN `'._DB_PREFIX_.'order_carrier` oc ON (a.`id_order` = oc.`id_order`)
LEFT JOIN `'._DB_PREFIX_.'carrier` carr ON (oc.`id_carrier... |
Center align fixed and scrollable div content <p>I'm wondering if the following problem can be solved with CSS only. There is a pop-up. Inside it, there is a header in a fixed position (should stay above the content) and a content body that is scrollable. </p>
<p>Please see <a href="http://codepen.io/kirill-yulamedia/... | <p>The scroll bar is occupying a space of <code>8px</code> and is pushing your content to the left, which is precisely the problem. Just add this to your css and it will work.</p>
<p>CSS:</p>
<pre><code>.content-header {
margin-left:-8px;
}
</code></pre>
<p>But this does not work for all resolutions.For which you ne... |
lxml.html parsing HTML: finding all elements that have a specific sibling <p>I have an HTML page which I have read into tree using: <code>tree = html.fromstring(page.content)</code></p>
<p>I have successfully selected a list of links using: </p>
<p><code>tree.xpath('//span[@class="txt"]/span[@class="pl"]/a[@class="hr... | <p>Answer for the first question. This xpath should select only links which are grandchildren of <code>span[@class="txt"]</code> which have price grandchildren:</p>
<pre><code>tree.xpath('//span[@class="txt" and ./span[@class="l2"]/span[@class="price"]]/span[@class="pl"]/a[@class="hrdlnk"]/text()')
</code></pre>
|
How to serialize multiple models with one Serializer using DjangoRestFramework? <p>I have these Models all of which have PointField:</p>
<pre><code>class Place(models.Model):
title = models.CharField(max_length=75, verbose_name='Ðаголовок')
category = models.ForeignKey(PlaceCategory, verbose_name='ÐÐ... | <p>This kind of use case is typical of where you'd need to drop the default auto generated things (serializer / view) and roll your own. I would gather the data by myself, run them through a <code>PointSerializer</code> - might be optional - which would inherit from <code>Serializer</code> and return the result.</p>
|
Iterate through an html string to find all img tags and replace the src attribute values <p>I have an html code as a string. I need to find all img tags in that string, read the value of each src attribute and pass it to a function, that function returns an entire img tag that needs to take the place of the img tag tha... | <p>If I understand your need correctly you can use HtmlAgilityPack for this purpose. Using regex may cause unwanted behavior. Can you try the code below ?</p>
<pre><code>public static string DoIt()
{
string htmlString = "";
using (WebClient client = new WebClient())
htmlString = client.Down... |
keep user from going to other view ui-route <p>I am trying to add some sort of resolve/promise to this to keep the user from moving on to certain pages until they have created a profile, added a friend, etc. I have an app, a controller, and a service. Any guidance would be helpful!</p>
<p><div class="snippet" data-lan... | <p>You Could use the <code>$locationChangeStart</code> event in angular js to validate the exit event of the user from a controller.</p>
<pre><code> $scope.IsUserNavigatable = function(){
var createdUsers = $scope.UserList;
var isUserCreated = createdUsers.length > 0;
return isUserCreated;
}
$s... |
Selenium java find multiple Displayed elements <p>I'm using Selenium with Java from the Mavenproject.</p>
<p>My code is working, I'm just wondering if it can be improved.
In the code below you can see I'm looking for a few elements and if they are displayed or not. </p>
<p>The issue is that I'm looking for tons of el... | <p><strong>Note: I am assuming, you are checking whether all elements are displayed or not.</strong></p>
<p>First, You find elements of the kinds:</p>
<pre><code>List<WebElement> breadCrumbList = driver.findElements(By.cssSelector("Your selector"));
</code></pre>
<p>Then iterate through your breadcrumbs and ch... |
Null pointer exception with Drools accumulate() <p>I am trying to execute a very basic example demonstrating the use of the <a href="https://access.redhat.com/documentation/en-US/JBoss_Enterprise_SOA_Platform/4.3/html/JBoss_Rules_Reference_Guide/ch05s05s02s10.html" rel="nofollow"><code>accumulate()</code></a> function ... | <p>Tried the code, the NPE is caused by </p>
<pre><code>"$value" -> "Method threw 'java.lang.NullPointerException' exception.
Cannot evaluate org.drools.core.rule.Declaration.toString()"
</code></pre>
<p>This is due to the Metric class not having any getter methods for its fields. Add the getters and the code wil... |
Getting list of child entity nested several levels with LINQ <p>I have entities that are nested in this order:</p>
<pre><code>RootDomain
Company
CompaniesHouseRecord
CompanyOfficer
</code></pre>
<p>When given a RootDomain I want to create a list of all CompanyOfficers that have an email address but I am not sure how ... | <p>Like this:</p>
<pre><code>RootDomain rd = db.RootDomains.Find(123);
List<CompanyOfficer> col = rd.Companies
.SelectMany(c => c.CompaniesHouseRecords)
.SelectMany(c => c.CompanyOfficers)
.Where(o => null != o.Email).ToList();
</code></pre>
|
Recyclerview not showning all items in Android 6 <p><strong>My recyclerview is showing all items in Android 4-5 but not showing all items in Android 6.</strong> I tried to debug it but i did'nt find anything in xml or adpater file. Anyone having same kind issue?</p>
<pre><code><?xml version="1.0" encoding="utf-8"?&... | <p>Nesting a <code>RecyclerView</code> inside a <code>ScrollView</code> is something that should be done with care.</p>
<p>Try removing the <code>ScrollView</code> and just living the <code>RecyclerView</code>.</p>
<p>Like this</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:androi... |
Spark Execution for twitter Streaming <p>Hi I'm new to spark and scala . I'm trying to stream some tweets through spark streaming with the following code:</p>
<pre><code>object TwitterStreaming {
def main(args: Array[String]): Unit = {
if (args.length < 1) {
System.err.println("WrongUsage: Properties... | <p>If your config file contains:</p>
<pre><code>SPARK_MASTER=local[2]
</code></pre>
<p>Change it to:</p>
<pre><code>SPARK_MASTER="local[2]"
</code></pre>
|
Python compute a specific inner product on vectors <p>Assume having two vectors with m x 6, n x 6</p>
<pre><code>import numpy as np
a = np.random.random(m,6)
b = np.random.random(n,6)
</code></pre>
<p>using np.inner works as expected and yields</p>
<pre><code>np.inner(a,b).shape
(m,n)
</code></pre>
<p>with every el... | <p>There seems to be an indexing based on some random indices for pairwise multiplication and summing on those two input arrays with function <code>pluckerSide</code>. So, I would list out those indices, index into the arrays with those and finally use <code>matrix-multiplication</code> with <a href="http://docs.scipy.... |
Error installing rvm 2.3.0 , installation halts <p>I am trying to install rvm 2.3.0 for 2 days but getting below error.I tried using "rvm install ruby-2.3.0" command.It did not work.Then again I did </p>
<pre><code>rvm get master
rvm install 2.3.1
</code></pre>
<p>Again got the same error.Anyone have an idea regardin... | <h1>Issue resolved.I updated my OS mac version 10.10.2 to 10.10.5.After that i tried installing rvm (rvm install 2.3.0) and it got installed.</h1>
|
find first row count and second row count using mysql <p>I have a table in mySql. I need to find how much entry in table which have entered only one time and another records which are enter for second time. please see the screenshot. count is based on shg_id.</p>
<p><a href="http://i.stack.imgur.com/Q3yn8.png" rel="no... | <p>The following should do if it has an id attribute:</p>
<pre><code>SELECT * FROM Table
HAVING COUNT(shg_id) = 1 -- Record equal to 1
</code></pre>
<p>Or</p>
<pre><code>SELECT * FROM Table
HAVING COUNT(shg_id) = 2 -- Record equal to 2
</code></pre>
<p><strong>Updated</strong> - This works well on my side:</p>
<pr... |
unable to install JQ via PIP <p>I am trying to install JQ via PIP in python.</p>
<pre><code>pip install jq
</code></pre>
<p>I am getting following error.</p>
<p><strong>Failed building wheel for jq</strong></p>
<p><a href="http://i.stack.imgur.com/ywWcL.png" rel="nofollow"><img src="http://i.stack.imgur.com/ywWcL.p... | <p>It doesn't appear that jq supports Windows; it says it requires gcc & libtool, which generally means a Unix-like environment.</p>
|
load hdfs file into spark context <p>I am new to spark/scala and need to load a file from hdfs to spark. I have a file in hdfs (<code>/newhdfs/abc.txt</code>), and I could see my file contents by using <code>hdfs dfs -cat /newhdfs/abc.txt</code></p>
<p>I did in below order to load the file into spark context</p>
<pre... | <p>This is <strong>not an error</strong>, it just says the name of the file for your RDD.</p>
<p>In the <a href="http://spark.apache.org/docs/latest/quick-start.html#basics" rel="nofollow">Basic docs</a>, there is this example:</p>
<pre><code>scala> val textFile = sc.textFile("README.md")
textFile: org.apache.spar... |
Speckle ( Lee Filter) in Python <p>I am trying to do speckle noise removal in satellite SAR image.I am not getting any package which does speckle noise removal in SAR image. I have tried pyradar but it works with python 2.7 and I am working on Anaconda with python 3.5 on windows. Also Rsgislib is available but it is on... | <p>This is a fun little problem. Rather than try to find a library for it, why not write it from the definition?</p>
<pre><code>from scipy.ndimage.filters import uniform_filter
from scipy.ndimage.measurements import variance
def lee_filter(img, size):
img_mean = uniform_filter(img, (size, size))
img_sqr_mean... |
custom decorator for class viewsets <p>I have a view set like this </p>
<pre><code>class NeProjectsViewSet(viewsets.ViewSet):
def list(self, request,org_unique_id):
''' something '''
def create(self, request,org_unique_id):
''' something '''
def retrieve(self):
''' something '''
de... | <p><em>Assuming you are using DRF.</em></p>
<p>I think you are going in wrong direction. If this is part of your permission layer you should just add custom permission class to your viewset</p>
<p><a href="http://www.django-rest-framework.org/api-guide/permissions/" rel="nofollow">http://www.django-rest-framework.org... |
Is there a way to composite Interceptors <p>I am new to ByteBuddy and have simple question. Is there any way how to composite interceptors together f.e via annotation. Something like:</p>
<pre><code>@Logging
@Transactional
public void foo() {}
</code></pre>
<p>Would add logging interceptor and also make sure it's tra... | <p>Of course, if you use a <code>ByteBuddy</code> instanace, it is up to the used <code>ElementMatcher</code> used:</p>
<pre><code>annotatedWith(Logging.class).or(annotatedWith(Transactional.class))
</code></pre>
<p>When you are using an <code>AgentBuilder</code>, you would define one instrumentation for each type wh... |
jQuery's function $(function())âs execute order when the $(function()) called more one times <p>Code like thisï¼</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>$(window.... | <p>At lines <code>3930</code> through <code>3947</code> jQuery version 3.1.1 handles <code>.ready()</code> being called after <code>document</code> has already loaded. At line 3938 <code>jQuery.ready</code> is called inside of <code>setTimeout</code> without a duration set with attached comment </p>
<pre><code>// Hand... |
Regular Expression quantifier java <pre><code>^\\p{Alpha}[\\p{Alnum}_]{8,30}$
</code></pre>
<p>As per my understanding, this expression will match word having minimum 8 characters and maximum 30 characters, that starts with alphabetic character and can contain only alphanumeric character or/and underscore.</p>
<p>But... | <p>The regex matches 9 to 31 characters.</p>
<pre><code>^\\p{Alpha}[\\p{Alnum}_]{8,30}$
| --1 --|| --- 8 to 30 ----| = > 9 to 31
</code></pre>
<p>Use</p>
<pre><code>^\\p{Alpha}[\\p{Alnum}_]{7,29}$
</code></pre>
<p>to only match 8 to 30 characters. </p>
<p>Just a note on the usage in Java:</p>
<pre><code>Stri... |
URL to `/` within a subdomain - laravel <p>I use subdomain functionality in Laravel 5.3.
My main app address has format <code>http://example.com</code>
When within a subdomain such as <code>http://dev.example.com</code>I use same templates for header.</p>
<h2>problem</h2>
<p>as a result, the head of my page, which co... | <p>I find this easier to do on the vhost/htaccess level to redirect the user to the required domain instead of trying to work in the code for this, have the webserver redirect you before any code execution happens.</p>
<p>Hope that helps</p>
<p>Thanks,</p>
<p>//P</p>
|
Can we ask same runtime permission at the different location in android? <p>I have a <strong>navigation drawer.</strong> In navigation drawer I am doing inflate the fragment. At the first fragment I ask to user for the runtime permission. but in the second fragment I want to do that it ask user for the same permission ... | <pre><code>public static boolean checkPermission(String strPermission, Context _c, Activity _a) {
int result = ContextCompat.checkSelfPermission(_c, strPermission);
if (result == PackageManager.PERMISSION_GRANTED) {
return true;
} else {
// user allowed permission. we should not ask for pe... |
Updating a client side table <p>I am reading data from a csv file and showing it in the form of table on screen. I have checkbox before every row with 'ID' saved as value in respective checkboxes. Now I want to remove fields with 'checked' checkboxes from the displayed table on the click of button - Cancel/Save</p>
<p... | <p>To remove <code>checked</code> checkboxes you can use jQuery.</p>
<p>To remove just the checkboxes:</p>
<pre><code>$('input').is(':checked').remove()
</code></pre>
<p>To do this "on a submit" of something, like a button click: </p>
<pre><code>//Specific for button with ID someButton
$('button #someButton').on('c... |
Neural Network Inception v3 doesn't create labels <p>I am facing an error with testing the Neural Network Inception v3 and Tensorflow.</p>
<p>I avtivated and trained the model this way with Python:</p>
<pre><code>source tf_files/tensorflow/bin/activate
python tf_files/tensorflow/examples/image_retraining/retrain.py -... | <p>I solved it. The error occured <strong>because the folder hadn't got enough images to train with</strong>. So after increasing the number of the images from 14 to 38 it gives me the predictions!</p>
|
CSS3 Multi-Column list with form input field <p>I have a CSS3 Multi-Column list with an input field inside that's not positioned properly.
It should align with the list-item above - even when one change the viewport.</p>
<p>Currently the input form is moving independently from the other list items when the viewport c... | <p>I think you should set the maximum width of the form and the input field like this:</p>
<pre><code>ul.subnav-links li form, ul.subnav-links li form input{
max-width:100%;
}
</code></pre>
|
Including component in another component without declaring in NgModule <p>In the latest angular release, to include one component in another component, it must be declared in NgModule(<a href="https://angular.io/docs/ts/latest/api/core/index/Component-decorator.html" rel="nofollow">angular docs</a>). </p>
<p><em>A com... | <p>Just as the docs states
You need a component to be part of a module. </p>
<p>What you can do is download angular-cli and use its scaffolding function <code>ng generate component myconponent</code>. Angular cli will automatically add that component to its parent's module in the declarations array. </p>
|
How to add a datepicker to bootstrap page? <p>I am working on a popup calender, but it is not working as i expected.<br>
I need some help to add a datetimepicker code for bootstrap.</p>
<p>The following code contains a simple <em>Hello World</em>, as well as the datetimepicker textbox, but not the picker.</p>
<pre cl... | <p>I am using <a href="https://bootstrap-datepicker.readthedocs.io/en/stable/" rel="nofollow">bootstrap-datepicker
</a> library for bootstrap.
Please check source code below. It is very simple.</p>
<p>You just need to make sure that you have added required libraries and in correct order.
You don't need to have local ... |
Portable PySide libraries? <p>Is there any way to execute python with pyside on a computer that has only python installed?</p>
<p>I need to distribute a simple tool on a lot of computers and we can't install pyside everywhere.</p>
| <p>PySide is a set of bindings for Qt, which is a library written in C++. And it is not part of the Python core.</p>
<p>If you want a GUI that is portable and that can be used with a default Python installation, consider <a href="https://docs.python.org/3/library/tk.html" rel="nofollow"><code>tkinter</code></a>.</p>
|
RTP Forwarding with RestComm <p>I'm recording an audio conference using RestComm and the Telestax MediaServer. I would like to forward the RTP data of that conference, so I could do some real-time processing with it using gstreamer. I was taking a look to the documentation but I didn't find how to do it easily with Res... | <p>Did you try joining a mute participant to the conference. This muted participant would be your SIP + gstreamer client that could do some real time processing on the media coming from the audio conference ?</p>
|
Groovy rename a file <p>I'm trying to rename files in a directory using Groovy but I can't seem to understand how it works.</p>
<p>Here is my script:</p>
<pre><code>import groovy.io.FileType
def dir = new File("C:/Users/××××/Downloads/Busta_Rhymes-Genesis-(Retail)-2001-HHI")
def replace = {
if (it == '_') {... | <p>There are a number of things wrong here:</p>
<ol>
<li><p>Your <code>dir</code> variable is not the directory; it is the file inside the directory that you actually want to change. Change this line:</p>
<pre><code>dir.eachFile (FileType.FILES) { file ->
</code></pre>
<p>to this:</p>
<pre><code>dir.parentFile.e... |
Save memory and load quickly in android <p>'A' Object have very big boolean array.
'A[]' length is at least 150.</p>
<p>I want to save 'A[]' in device, and load quickly.
It should be load at least 1 second.
I have no idea how to do.</p>
<p>Using realm(<a href="https://realm.io" rel="nofollow">https://realm.io</a>) ca... | <p>150 items of boolean are small amount of data for conventional mobile devices. You can save more than 1000 items at once within 1 second.</p>
<p><strong>Method 1</strong></p>
<p><a href="https://realm.io/docs/java/latest/#field-types" rel="nofollow">Realm already supports</a> <code>byte[]</code> as a datatype. You... |
Android : Time picker get Date in 24 hours Format <p>I am using <code>Time Picker Toolbar</code> in my project and I'm facing this problem: getting the time in Am-Pm Format always returns me the hours in 12h format. </p>
<p>How i can get time in 24 hours Format?</p>
<p><strong>This is the code I'm using:</strong></p... | <p>Use</p>
<pre><code>timePicker.setIs24HourView(true);
</code></pre>
<p>before using getting current hour.</p>
|
Like/unlike transactions in Firebase? <p>I'm trying to build a social app with Firebase. So, basically I have a <code>Post</code> class which is similar to what is given in the Firebase <a href="https://firebase.google.com/docs/database/android/save-data" rel="nofollow">docs/guides</a> </p>
<pre><code>public class Pos... | <p><code>No properties to serialize</code> in the <code>DataSnapshot.getValue()</code> method means you are missing the getter for the <code>Post</code> class' fields</p>
<pre><code>public class Post {
private String uid;
private String timeStamp;
private String author;
private String body;
private... |
JSon unexpected character encountered while parsing value: [ <p>Thanks in advance for the person who can help me with the issue below.
I am using the latest Newtonsoft.Json version from NuGet as of 2016.9.30
and this is the issue:</p>
<h2>Exception</h2>
<p><code>Unexpected character encountered while parsing value: [... | <p>You have incorrect json format here:</p>
<pre><code>"cpe": ["cpe:/a:pureftpd:pure-ftpd"],
</code></pre>
<p>You try to deserialize to string, but should deserialize it to string array.</p>
<pre><code>[DataMember(Name = "cpe", IsRequired = false)]
public string[] Cpe { get; set; }
</code></pre>
|
How to turn off auto space before '{' in VS2016 C#? <p>Everytime I write code that is followed by an opening bracket, VS2016 puts a space before the bracket.</p>
<pre><code>public void MyFunction() { };
//......................^....
</code></pre>
<p>I want it to look like</p>
<pre><code>public void MyFunction(){ };
... | <p>Did you disable pretty listing? This should stop your code auto re-formatting.</p>
<p><a href="http://i.stack.imgur.com/nsY2u.png" rel="nofollow"><img src="http://i.stack.imgur.com/nsY2u.png" alt="Screenshot of Options dialogue"></a></p>
|
AWS Cognito User authentication flow need suggestions and advices <p>I am trying to setup mobile application authentication system on AWS using its user pool service.</p>
<p>Since it's mobile only application I need only OTP / MFA confirmation option like whatsapp and here I encountered with my first challenge.</p>
<... | <p>I guess stackoverflow doesn't want suggestions or advice, so I will try to format the answer as an answer to the question I think you are asking, which is "What are the roles in the Cognito system and how to I implement my app with them". (This is a question I have been trying to answer for myself for a month or mor... |
How do I know which authorisation method git server uses? <p>I'm trying to push to git server: </p>
<pre><code>git remote add origin ssh://git@git.example.com:9922/test
git push
</code></pre>
<p>Here's the response:</p>
<pre><code>git@git.example.com's password:
</code></pre>
<p>I'm typing in the password for my s... | <blockquote>
<p>I'm typing in the password for my ssh key, but it fails. I've even checked correctness of the password using this method.</p>
</blockquote>
<p>That's part of the problem. It's not prompting you for the password of your key, it's prompting you for git@git.example.com's password. In other words, it's... |
How to set the scale value in pixel size? <p>How to set the object scale value(width and height) based on the pixel value using three.js</p>
<pre><code>object.scale.set(0.05,0.05,0.05);
</code></pre>
<p>i need to set 0.05 value pixel size</p>
<p>Please help any one.</p>
| <p>Rephrasing your question, please correct me if I got you wrong:</p>
<p>You want to use pixel values instead of the relative values to set the size of your object as it appears on screen.</p>
<p>Now, the problem here is, that three.js (or even webgl) don't really use a concept of pixels internally. </p>
<p>How lar... |
Refresh UI language on the fly <p>I'm following this <a href="https://developer.xamarin.com/guides/xamarin-forms/advanced/localization/" rel="nofollow">guide</a> to localize my app. I don't want to get system language so I don't use <code>ILocalize</code> interface and dependecy services. I have these 3 resx files for ... | <p>Keep all the Setters for the Text property on the OnAppearing() method,then after coming back from the settings page, it will take the latest values from the resx file. The OnAppearing() method will be invoked even when you are coming back to a page.
But for the same page to change language to have to either render ... |
How to fetch multiple column values using hibernate <p>I am able to fetch the single column value and access that value using controller class but what should do to fetch multiple column values?</p>
<p>DAO method</p>
<pre><code> @Transactional(readOnly = true)
public List<Social> getAllSocialData() throws Fast... | <p>You have several options:</p>
<ol>
<li><p>return entity</p>
<p>select social From Social social where social.socialId=1</p></li>
<li><p>create new DTO and then</p>
<p>select new SocialDto(social.followers,social.tweets) From Social social where social.socialId=1</p></li>
<li><p>map it to list</p>
<p>Query q = s... |
Keyboard automatically dismiss when I first tap the search bar <p>I add a search bar by adding subview into a UIView. When I tap the search bar, cancel button shows up, however the keyboard disappear immediately. I have to tap the search bar again so that I can input some text for searching.
Any thoughts?</p>
| <p>Use the following code:</p>
<pre><code>import UIKit
class ViewController: UIViewController,UISearchDisplayDelegate, UISearchBarDelegate,UITableViewDelegate, UITableViewDataSource {
@IBOutlet weak var headingLabel: UILabel!
@IBOutlet weak var countriesTableView: UITableView!
@IBOutlet weak var country... |
On a a plotted graph I will like to know the area with maximum triangular intersection <p>I have the code below to link nine different coordinates in the plotted graph:</p>
<pre><code>A1={[1, 1; 1, 5; 3, 9; 4, 2; 4, 6; 6, 2; 7, 6; 6, 9; 9, 9]};
A = cell2mat(A1);
figure
plot(A(:,1),A(:,2),'oc','LineWidth',2,'MarkerSize... | <p>The code below answered my question:</p>
<pre><code>A1={[1, 1; 1, 5; 3, 9; 4, 2; 4, 6; 6, 2; 7, 6; 6, 9; 9, 9]};
A = cell2mat(A1);
k = boundary(A);
hold on;
plot(A(:,1),A(:,2),'oc','LineWidth',2,'MarkerSize',5);
axis([0 10 0 10]);
xlabel('X-Coordinates')
ylabel('Y-Coordinates')
grid on
for ii = 1:size(A, 1) - 1
... |
Add/Remove gridlines in cells containing data in the cells <p>I am creating a work planner using Excel. The user selects a specific name from a drop down menu and it displays the projects. I want a table/gridline to be displayed. I would like it to add a gridline which automatically shows/hides when a name is selected ... | <p>Bit tricky without knowing what's in D6! - but presume it's your dropdown... in which case don't you want this an absolute reference $D$6?</p>
<p>One other thing to try is having multiple rules, so setup conditional formatting so that ISBLANK(D6) then no borders (make sure it's the first rule and to tick 'stop if t... |
How do I reference the brand color in inline (app specific) css on the index.html <p>I have a habit of putting custom css that is app specific in the inline head <code><style></code> tags of index.html. This way I can adapt SAP defined classes differently across apps. </p>
<p>Is there a way to reference the bran... | <p>Have you tried the css class "sapBrandColor" or "sapUshellShellBrand"? However, according to the docs you should use "sapThemeBrand-asColor".</p>
<p>Here is the right documentation:</p>
<ul>
<li><a href="https://sapui5.hana.ondemand.com/#docs/guide/ea08f53503da42c19afd342f4b0c9ec7.html" rel="nofollow">CSS Classes ... |
How to compare String Arrays with JUnit in Scala <p>I was trying to compare to String Arrays in a JUnit test suite in Scala using <code>assertArrayEquals</code>. It works fine for basic types like <code>Int</code> or <code>Boolean</code>, however it issues the following error when applying it to <code>String</code>:</p... | <p>My "general" answer: one only needs <em>one</em> assert; and that is <a href="http://junit.org/junit4/javadoc/latest/org/junit/Assert.html#assertThat(java.lang.String,%20T,%20org.hamcrest.Matcher)" rel="nofollow"><strong>assertThat</strong></a>. That assert works with Hamcrest matchers, so typically you write down</... |
How to translate templavoila template code to Fluid/Flux templating <p>I have a question regarding templavoila and Fluid.
I migrated my website from TYPO3 4.7.x to TYPO3 6.2.x where the TYPO3 4.7.x uses Templavoila.
I now want to translate Templavoila code to Fluid/Flux code.
for example I have a TemplaVoila Flexible ... | <p>Try out TemplaVoila to Fluid/Grid Elements <a href="https://typo3.org/extensions/repository/view/sf_tv2fluidge" rel="nofollow">https://typo3.org/extensions/repository/view/sf_tv2fluidge</a></p>
|
Nested Binding using x:Bind in UWP <p>As a beginner I found it really difficult to find any reliable source which would help me in binding data to a control with data having nested levels (3-4 levels of nesting at least). </p>
<p>For example binding to a parent Observable Collection(level 1) having a simple string and... | <p>I am just providing the xaml part here and not getting into the C# backend. Also I am assuming that you know the basics of data binding and got your hands dirty in it knowing how it works.</p>
<pre><code><Pivot ItemsSource="{x:Bind parent_element}">
<Pivot.HeaderTemplate>
... |
Authenticating to feeds with Nuget from Visual Studio <p>Have tried all the six methods in this <a href="https://www.visualstudio.com/en-us/docs/package/get-started/nuget/auth" rel="nofollow">link</a> to authenticate to nuget from visual studio and none of them are of help.</p>
<p>One of my friends has used credential... | <p>I use the easy way with the VSTS:</p>
<p><a href="https://www.visualstudio.com/en-us/docs/package/get-started/nuget/publish" rel="nofollow">https://www.visualstudio.com/en-us/docs/package/get-started/nuget/publish</a></p>
<p>And then I use another VS2015 with update 3 machine to connect to it, I could get the auth... |
How To Change Activity Preview/Screenshot in Recent tasks list <p>When the application is running, as Image 1. Then the menu button on the phone is pressed, it will invoke <code>onPause ()</code>, will display the image 2. </p>
<p>How can I change the application display as Figure 3 when <code>onPause ()</code> is cal... | <p>You have to disable the Preview on your Activity by setting</p>
<pre><code>getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
</code></pre>
<p>You can only disable the preview but you can't modify that image.</p>
|
Why should I migrate to Bootstrap 4 from Bootstrap 3? <p>I am using bootstrap 3 in my project. I see that Bootstrap 4 is a major rewrite of almost the entire Bootstrap project. But is there any necessity to migrate to bootstrap 4 from 3?</p>
| <p>To make your project a bit <em>future-proof</em>!</p>
<hr>
<p><a href="http://upgrade-bootstrap.bootply.com" rel="nofollow">http://upgrade-bootstrap.bootply.com</a> gives an overview in code for what is different from Bootstrap 3 to 4, I suggest you visit it.</p>
<p>Also it seems there are several changes, regard... |
Deleting a record in a PHP MySQL generated table <p>I am creating a system where records in a database need to be displayed in a HTML table.
The HTML table and getting data is working fine.
However I need a column with a delete icon/link for each row.
For example, row one will have a row of data and in the final colu... | <p>Your row with the action is not correct written. Change it to this:</p>
<pre><code> echo '<td><a href="SightingHome.php?d=1&id='. $rowitem['SightingID'] .'"> <img src="Images/delete.png" title="Delete This Sighting" width="25" height="24" /></a></td>';
</code></pre>
|
Spring/Maven project in Eclipse JEE: applicationContext.xml cannot be opened <p>Having received a Spring/Maven project, I:</p>
<ul>
<li>Ran <code>mvn eclipse:eclipse</code> on it,</li>
<li>Loaded it into Eclipse JEE (latest version, called Neon),</li>
<li>Added the <code>Dynamic Web Module</code> facet to it,</li>
<li... | <p><em>WEB-INF/classes</em> is a directory created by the Maven war plugin when it builds the war, it should not be a project folder. The Maven war plugin will create it for any war project so it can put compiled classes and resources there that live in your <em>src/main/java</em> and <em>src/main/resources</em> folder... |
Microsoft Access shows "Missing APSBrowsePanes.dll" error on startup. (Virtual Machine) <h2>History and situation</h2>
<p>I have been developing Access databases for my employer for some time. Initially my work PC (Windows 7) had Office XP installed so my first databases were developed in Access 2002-2003 file format.... | <p>Your problem seems to be a combination of database corruption and broken references.</p>
<p>You need to get your database to a state where you can open the VBA Editor, open the References dialog and remove everything that may cause problems. </p>
<p>See <a href="http://allenbrowne.com/ser-38.html" rel="nofollow">h... |
How to receive a JSON string in C? <p>I am trying to develop a socket client program in C language that will receive a JSON string from server.</p>
<p>How to implement the receiving side of the JSON data?</p>
<p>Is the JSON string will be received as character by character in client socket side?</p>
| <p>The best thing that you could is to use some JSON API like for example Jansson. You can follow this link for documentation.</p>
<p><a href="https://jansson.readthedocs.io/en/2.9/tutorial.html" rel="nofollow">Jansson API Documentation</a></p>
|
How can I upload an iCal file to a user's calendar <p>I tried to find solutions on how to save a iCal file to the user's calendar, but I just couldn't find it. I found things like write an iCal file and read one, but I want it to be Pushed to the user's calendar. How can I do so?</p>
<p>Goal I want to archieve: Provid... | <p>You can't 'push' a file to a users calendar. You can provide a ics url or a 'add to google' type link but it is entirely up to the user how the deal with that file and what calendar application they use to deal with it</p>
<p>For example: I would NEVER want to 'import' your url (a once off event, no updates will b... |
Creating an array with keys in Razor <p>Currently I am working on a project, and what I am trying to do is to create an array with keys in razor.</p>
<p>That's what i have now:</p>
<pre><code>string[] members = {@item.Name, @item.Url };
</code></pre>
<p>That's what I need:</p>
<pre><code>string[] members = {pageNam... | <p>You can't do this with arrays, however you can use a dictionary with string as keys.</p>
<pre><code>Dictionary<string, string> member = new Dictionary<string, string>
{
{ "pageName", item.Name },
{ "pageUrl", item.Url }
};
</code></pre>
|
Unable to load the logo of android application <p>I'm using Mac OS to development android application. I'm unable to generate the apk file.</p>
<p>the error i getting is :
Error:(14) Error: Unexpected resource reference type; expected value of type @string/ [ReferenceType]</p>
<p>my code in xml document</p>
<pre><co... | <p>The error is generated because your xml item is a string</p>
<pre><code><string name="icon_name">@mipmap/ic_lau_spt</string>
^ ^
</code></pre>
<p>and your reference is an resource/image</p>
<p>If you want to load it as the app logo (show this image in the a... |
Form and contoller action to change Users Roles when roles is enum in Rails <p>Suppose we have User ActiveRecord model.</p>
<pre><code>class User < ActiveRecord::Base
has_many :users_roles, dependent: :destroy
end
</code></pre>
<p>And Users Roles ActiveRecord model.</p>
<pre><code>class UsersRole < ActiveRec... | <p>You can use nested attributes using build
@user.roles.build</p>
<pre><code>= f.fields_for :roles do |r|
= r.select(:role, options_for_select(Role.pluck(:role)))
</code></pre>
|
Properly inject dependency in Angular2 tests <p>I'm struggling with testing an Angular2 component that has a service injected. The test code is below but basically:</p>
<p>⢠SearchComponent takes a FightService in the constrctor.</p>
<p>⢠The constructor calls a flightsService.getFlights() which fires off an HTTP... | <blockquote>
<p>My MockFlightService isn't being used, it basically fails saying there is no provider for Http (which is in the FlightService constructor)</p>
</blockquote>
<p>With the configuration you are showing, the only way I can see this happening, is if you listed the service in the <code>@Component.providers... |
How to convert HTML data attribute to JSON in JQuery? <p>I use JSON in hidden element in HTML to avoid multiple unnecessary AJAX requests. JSON is generated properly but I can't handle it using JQuery so I can work with it.</p>
<p>The problem is that <code>elem.data("json")</code> returns an object instead of string s... | <p>The problem, as it so often is, is that <a href="http://api.jquery.com/data" rel="nofollow"><code>data</code></a> isn't what most people think it is. <code>data</code> is <strong>not</strong> an accessor for <code>data-*</code> properties, it's both more and less than that. It manages jQuery's internal data cache fo... |
Set a specific date and year in a MS CRM date time field in the onchange event <p>I have two date time fields.
In the first field, if the date is set, then in the second date time field, the date should be automatically populated
with this format.</p>
<p><strong>For example</strong>:</p>
<p><strong>Start date</strong... | <p>Try following code:</p>
<pre><code>function SetOneplusyearminus1date() {
debugger;
var start = Xrm.Page.getAttribute("msdyn_startdate").getValue();
if (start != null) {
start.setDate(start.getDate() - 1);
start.setYear(start.getFullYear() + 1);
Xrm.Page.getAttribute("msdyn_enddate").se... |
SAP Fiori Launchpad - System News style popup <p>On the ONE Support Launchpad there is a small popover 'System News' section at the bottom left where notification info is clear to see.</p>
<p>I have never seen this before or within any fiori documentation etc...</p>
<p>Does anyone have any idea if this is a useable c... | <p>I think this ONE support launchpad is a pretty custom made FLP (and it pretty much looks like the standard FLP). Thus, this system message feature is also custom made. I would love to this in feature also in the standard FLP as this seems to be an important feature for clients...</p>
<p>Feel free to correct me if I... |
Is it possible to lock a row with SELECT statement in transaction in SQL SERVER <p>Is it possible to lock a row with SELECT statement in a transaction, in SQL SERVER? I want to lock the row, so other transactions from outside cannot reach that row.</p>
<p>After the transaction is committed or rollbacked, the row shoul... | <p>UPDATE lock is a special kind of lock used when an update statement is searching for rows to update. It is compatible with SHARED locks, so it increases concurrency, and also minimizes chance for a conversion deadlocks when converting to XLOCK.</p>
<p>You can use an XLOCK hint on the table in the SELECT statement, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.