input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Process a list in a Dataframe column <p>I created a DataFrame <code>neighbours</code> using <code>sim_measure_i</code> which is also a DataFrame.</p>
<pre><code>neighbours= sim_measure_i.apply(lambda s: s.nlargest(k).index.tolist(), axis =1)
</code></pre>
<p><code>neighbours</code> looks like this: </p>
<pre><code>1... | <p>You can try a nested loop:</p>
<pre><code>for i in range(neighbours.shape[0]): #iterate over each row
for j in range(len(neighbours['neighbours_lists'].iloc[i])): #iterate over each element of the list
a = neighbours['neighbours_lists'].iloc[i][j] #access the element of the list index j in cell location... |
cache object in Jersey resource? <p>I have a Jersey (version 2) resource that, during request handling, creates an object that is used throughout the request.</p>
<p>I would like to cache this object in a thread local storage so that other request handlers that use the same thread could re-use this object.</p>
<p>Is ... | <p>It is advisable to avoid caching in REST as it is supposed to be stateless. But most simple solution could be to use HttpSession object to store your object and retrieve it later and then dispose it off.</p>
<p>For details you can refer this question:<a href="http://stackoverflow.com/questions/909185/jersey-securit... |
P6 primavera thick client(EPPM) cloud connect SSO failing with database version mismatch issue <p>We are integrating the P6 primavera thick client(EPPM)with Oracle Access Manager (OAM) we have done all the configurations on both OAM and Application side as per the oracle documentation.</p>
<p>The connectivity looks OK... | <p>Check the version of Database using following SQL query:
<code>select database_version from prefer</code></p>
<p>if this is different from the expected one then applying patches should sort the issue.</p>
|
Exclude git ignore on one particular directory inside an already gitignored directory <p>My gitignore file currently looks like the following:</p>
<pre><code># Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
**/wwwroot/lib/
**/ww... | <p>First off, I am not sure why you are overusing **. If you have one directory /wwwroot/lib, you can ignore it just with:</p>
<pre><code>/wwwroot/lib/
</code></pre>
<p>As for your negation of the directory, I think you just need to specify that it IS a directory you are referring to, with the ending backslash:</p>
... |
Get files from index subdirectory (htaccess) <p>I made a routes class in php, the routes works fine but i have a problem, when i put something like:</p>
<pre><code>.ng-perfil-avatar {
display: block;
background: #eee url(/img/bg.png);
}
</code></pre>
<p>in the view, the img not is founded, my web is in subdirecto... | <p>This is a frequent problem and there are multiple solutions.</p>
<p>The easiest way to go (certainly in CSS) is to use relative paths instead of absolute paths. So lets say your CSS is in <code>web/css/style.css</code> and you want to set image <code>web/img/background.jpg</code> as your background. You want to ref... |
How to detect if date changes in select query <p>I'm using the following SQL query to select rows from through an inner join sorted by the <em>date</em>.</p>
<pre><code>SELECT *
FROM clubnights
INNER JOIN club ON clubnights.club = club.club_ID
WHERE visibility = 0
AND date >= CURDATE()
ORDER... | <p>well, local variables me be helpful for it. Use the following way!</p>
<blockquote>
<p>When you are displaying data in tables with php loop use the following algorithm</p>
</blockquote>
<p>*I am assuming the database is connected.</p>
<pre><code><?php
$date2 = sortotime("today");
$q = mysql_query("select ... |
iMessage extension App Icon not showing on iPad <p>I created an iMessage extension from the XCode 8 beta wizard and added every single icon size to the Assets.xcassets.</p>
<p>Everything looks perfect on XCode and when I run the iMessage extension on any iPhone device (simulator or real device) all my icons are perfec... | <p>After breaking my head with every single possible solution with the images, filenames, build phases... I ended up looking at the Info.plist of the extension and discovering that there was a key that was conflicting with the Assets.</p>
<p>I am not sure if that key got there from the initial creation of the project ... |
Query to find minimum value in a matrix in R <p>The query below is to find minimum value in a matrix, located in a x row and y column. For example: <code>mind</code> (the matrix below) gives you answer as <code>6 3 4</code> means min value is 6 located at row 3 and column 4. </p>
<pre><code>0 12 13 8 20
12... | <p>I would offer a simple approach:</p>
<pre><code>foo <- function (A) {
id <- which.min(A) ## 1D index of minimum
LDA <- dim(A)[1] ## Leading dimension of A
j <- as.integer(ceiling(id / LDA)) ## column index
i <- id - (j - 1L) * LDA ## row index
list(min = A[id], ind = c(row = i, col = j)... |
SMTP configuration not working in production <p>I'm trying to send an email when a form is submitted. I'm using PHPMailer to send the mail using the below configuration.</p>
<pre><code>$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'mail.example.in';
$mail->Port = 25;
$mail->SMTPAuth = true;
$mail... | <p>Your error says:</p>
<pre><code>SMTP ERROR: Failed to connect to server: Connection timed out (110)
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
</code></pre>
<p>So let's look at <a href="https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting" rel="nofollow">https://githu... |
Converting image to a 3D CAD relief model based on pixel brightness or colour <p>I'm looking for some kind of way to convert an image into a 3D CAD relief model based on the brightness or colour of each pixel. For example if you have an image that is a gradient from black to white the resulting CAD would be a rectangul... | <p>I approached this issue by using solidworks macros with VBA. Each pixel is extruded as a square prism based on its brightness determined by its rgb values. The code is still very buggy but refer to this issue if you want code to help achieve this very obscure problem I have set for myself :)
<a href="http://stackove... |
Adding ads to my android app failing <p>I am following some instructions, and I get this error. </p>
<blockquote>
<p>Error:Could not find com.google.gms:google-services:3.0.0. Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/3.0.0/... | <p>You seem to be missing <code>jCenter()</code></p>
<pre><code>repositories {
jCenter()
maven { url 'https://maven.fabric.io/public' }
}
</code></pre>
|
on OSX mongo fails to start <p>I am writing mongo in shell. but it is not starting. The error message is: </p>
<pre><code>W NETWORK [thread1] Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
</code></pre>
<p>What to do? </p>
| <p>Run <code>mongod</code> Before <code>mongo</code>. May be You forgot to do that. </p>
|
git is not ignoring files from the mentioned folder in .gitignore <p>in our project, the config files are stored into <code>/application/config/</code> folder. In the .gitignore file we have that path mentioned so that our local configuration files do not get pushed to the server. But every time we change the contents ... | <p>gitignore is not used for files that are already pushed upstream. This is used for files that are in your local folders but you don't want to commit or push them.</p>
<p>You need to first do git rm for all these files, commit them and push the delete upstream. Then create these files again in your local folders. Po... |
How to manange two different codeigniter session value in localhost? <p>I am have install Two codeigniter develope two different different site in localhost.</p>
<p>issue is that any of site login after this session value config with anther value.</p>
<p>in two site for login i am create same session it;s name is use... | <p>In you config file change the value of</p>
<pre><code>$config['sess_cookie_name'] = 'you own name for the session'
</code></pre>
<p>and this will not occur again.
This is because both are using the same session name which is mention in the config file</p>
|
hidden text is hidden and will not be displayed <p>Below is my coding for creating tabs. In each i have one drop down when i select the value india in each tabs in the hidden textbox should display on the particular tab means if i select the value india in tab1 dropdown hidden textbox should not display tab2 and tab3 a... | <p>You are using the same hidden textbox ID every time. Us the respective textbox id. Also you don't need to use ready function every time. You can use once and add all the other function in it.</p>
<pre><code>$(document).ready(function() {
$("#ddlPassport").change(function() {
if ($(this).val() == "Y") {
... |
Python how cyclic fetch a pre-fixed number of elements in array <p>I'm trying to make a function that will always return me a pre-fixed number of elements from an array which will be larger than the pre-fixed number:</p>
<pre><code>def getElements(i,arr,size=10):
return cyclic array return
</code></pre>
<p>where ... | <p>You could return </p>
<pre><code>array[i: i + size] + array[: max(0, i + size - len(array))]
</code></pre>
<p>For example</p>
<pre><code>In [144]: array = list(range(10))
In [145]: array
Out[145]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
In [146]: i, size = 1, 10
In [147]: array[i: i + size] + array[: max(0, i + size - ... |
IBM Websphere MQ Depth count for multiple queues via mail by using c#.net <p>I have 7 windows services for handling IBM Websphere message queues and by using each of them I get message and count. So now I need a windows service which handles all the queues of their services and retrieves the message count.
Now i am con... | <p>You could look at the sample programs provided with the MQ installation, specifically the sample for inquire:</p>
<p><a href="http://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q024210_.htm" rel="nofollow">http://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.dev.doc/q024210_.ht... |
router in express.js base on parameters <p>I have these router declared in express.js, I wonder why the <code>run user</code> got triggered when I open localhost:3000/myname/profile. </p>
<pre><code>router.get('/:username', function(req, res, next)
{
console.log('run user')
});
router.get('/:username/profile', fu... | <p>Just rearrange the code as shown below and your code should work fine.</p>
<pre><code>router.get('/:username/profile', function(req, res, next)
{
console.log('run user profile')
});
router.get('/:username', function(req, res, next)
{
console.log('run user')
});
</code></pre>
<p>The issue is with the order ... |
how do synced-cron job executes every 2 hour in a day <p>How do synced-cron job executes every 2 hour in a day. I'm using <code>percolate:synced-cron</code> package in meteor.
Here is my server code:</p>
<pre><code>SyncedCron.add({
name: 'Cron job will start on',
schedule: function(parser) {
// parser ... | <p>It should be <code>return parser.text('every 2 hours');</code>
Notice the <em>s</em> in hours.</p>
<p>In the <a href="http://bunkat.github.io/later/parsers.html#overview" rel="nofollow">docs</a>, the following periods are defined :</p>
<blockquote>
<p>Periods<br>
s, sec, seconds, m, min, minutes, h, hours, da... |
Getting unexpected exception while using my trackbar to adjust brightness-C# <p>Hello Experts, I will be getting images into picturebox from two comboboxes dropdown(say 15-20images) by selecting specific folders.I want to adjust their ... | <p>You have mixed up a field and a local variable:</p>
<p>the field <code>Bitmap newbitmap</code> never gets assigned. </p>
<pre><code> pictureBox1.Image = adjustbrightness (newbitmap, trackBar1.Value);
</code></pre>
<p>The method <code>adjustbrightness</code> will crash on accessing the properties here:</p>
<pre><... |
How to get rid of row numbers, pd.read_excel? <p>I am a complete beginner with Python. I am working on a assignment and I can't seem to figure out how to get rid of the <em>row numbers</em> from my excel spreadsheet, while using <code>import pandas</code>. </p>
<p>This is what I get when I run the code:</p>
<pre><cod... | <p>Internally your dataframe always needs an index. If you get rid of the integer index another column has to be your index and you should only use a data column as your index if you need to for some special purpose.</p>
<p>When you write your dataframe to a file, e.g. with the <code>to_csv()</code> method, you can al... |
PHP memory limit on line running foreach <p>Is there a more efficient way to set JSON array values than this?</p>
<pre><code> for($i=0;$i<sizeOf($json['activity']);$i++){
$json['activity'][$i]['active'] = 'false';
}
</code></pre>
<p>I want to set all sub keys named 'active' to 'false'
The arrays are no... | <p>If I understand this correctly, you created an infinite loop since everytime it runs, your array gets one more value, same as your $i-counter. Try getting the count of the array first in a seperate variable and then run the loop with that</p>
<pre><code>$c = sizeOf($json['activity']); for($i=0;$i<$c;$i++){
$js... |
Serving media content from the closest client location <p>I'm developing and application which allows users to upload and download media content: songs, videos...</p>
<p>My concern is that if my servers are located let's say in the Europe region for customer from America the application will feel very slow.
I was thin... | <p>Sounds like a problem to consider using a <a href="https://azure.microsoft.com/en-us/services/cdn/" rel="nofollow">CDN</a> to solve. I'm familiar with Azure but I'd assume the competitors have similar offerings.</p>
|
PHP, JS, and Google Maps API - Getting blank canvas when passing center values a PHP value <p>I've been doing some work with implementing Google Maps into a web app and I am having some trouble passing the PHP values to the Google Maps API JS functions. </p>
<p>The goal is to have a map that is centered on a point tha... | <p>The issue seems to be down to the format of the lat/lng values - can you show examples of them as the following code worked ok when used with predefined lat/lng values rather than from a lookup to the google api.</p>
<pre><code><?php
/*
$a = array_values( geocode( $_SESSION['address'] ) );
$longitu... |
Get path of required module in NodeJS <p>I have 2 classes, one that extends from the other. I need to have a method that can be called from extending classes but resolves the path to reflect whatever directory the extending class module is in.</p>
<p>/main.js</p>
<pre><code>class Main {
getTemplate () {
retur... | <p>/main.js</p>
<pre><code>class Main {
constructor(dirname) {
this.dirname = dirname;
}
getTemplate () {
return readFileSync(this.dirname + './template.ejs')
}
}
</code></pre>
<p>/some/path/module.js (also contains /some/path/template.ejs)</p>
<pre><code>class Module extends Main {
constr... |
chosen-select not working on bootstrap modal <p>i cant make chosen-select to work in a bootstrap modal. i tried to search for a possible solution and have tried to remove other classes/styles that may conflict with chosen-select's css. i also tried the code below:</p>
<pre><code>jQuery('body').on('shown.bs.modal', fun... | <p>found it! </p>
<p>just added </p>
<pre><code>$(".chosen-select").trigger("chosen:updated");
</code></pre>
<p>and it worked. XD
thanks to mr. koala of this post: <a href="http://stackoverflow.com/questions/18152004/chosen-dropdown-list-not-working-with-modal?rq=1">Chosen dropdown list not working with Modal</a><... |
Function to loop through a list of columns in a dataframe in R <p>I'm trying to create a function or a loop in r that can loop through a list of columns for a specific string i.e '123', and create a new column with an indicator variable i.e 0 or 1 if the string is present in the defined columns.</p>
<p>Please see exam... | <p>One possible solution (make sure 123 is <code>numeric</code>):</p>
<pre><code>df <- cbind(df,new_c = sapply(1:length(df),function(x) ifelse(123 %in% df[x,],1,0)))
> df
index df1 df2 df3 df4 df5 new_c
1 1 123 999 999 999 999 1
2 2 999 123 999 999 999 1
3 3 123 999 999 999 999 1
4 ... |
Mongoexport date range query result in Failure parsing <p>Trying to run mongoexport and having problems with my query parameter.</p>
<pre><code>mongoexport -d test-copy -c collection -o /home/ubuntu/mongodb-archiving/mongodump/collection.json --query '{"created_at": {\$lte: new Date(1451577599000) } }'
</code></pre>
... | <p>You have a <code>\</code> in your query. Please remove it.</p>
<pre><code>--query '{"created_at": {$lte: new Date(1451577599000)}}'
</code></pre>
|
How to prevent WinForm controls to get stretched and maintain a fixed size <p>I'm working on a .NET 3.5 desktop application written in C#. It's complex UI is populated dynamically. One part of it is the following group box which is contained in a FlowLayoutPanel and the FlowLayoutPanel is contained in a UserControl. Th... | <p>Make <strong>AutoScaleMode "Inherit"</strong> for all children user control.</p>
|
Android layout designer in VS dont work <p>Using Xamarin I can't solve the error when open even the default layout.</p>
<p><strong>"
Something weng wrong
The installed Android SDK it to old. Version 25.1.3 or newer is
required. Please update to the latest version.
"</strong></p>
<p>As seen in the image below I alrea... | <p>I had a similar problem. Here a solution that worked for me:</p>
<p>1) delete the one package appearing in the screenshot of the Android SDK Manager in the url below. Nota bene: At this stage VS 2015 greyed out the Android SDK manager buttons, even after a restart. </p>
<p>2) download installer_r24.4.1-windows.exe... |
How to add space between a word and underlining in iOS Swift <p>How can I add space between a word and its underlining in a <code>UIButton</code> name?</p>
<p>How should I manage button constraints for all devices (5S, 6S, 6S+) in Swift for iOS?</p>
| <p>To add space between words change Title text type in Stroryboard from Plain to Attributed and then tup three dots and change text parameters</p>
<p><a href="http://i.stack.imgur.com/vPZ0b.png" rel="nofollow"><img src="http://i.stack.imgur.com/vPZ0b.png" alt="Button parameters"></a>
<a href="http://i.stack.imgur.com... |
Url not work in codeigniter <p>I just uploaded my demo project in subfolder on godaddy. When I open a website url <strong><em>example.com/demo</em></strong> Home page works fine but when I open inner pages my url looks like <strong><em>example.com/demo/index.php?/home/overview</em></strong>.(with question marks)</p>
<... | <p>edit in htaccess file</p>
<pre><code>RewriteEngine on
RewriteBase /demo/
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
</code></pre>
<p><em>configure base url in <strong>config.php</strong> file al... |
"[CompletionException: com.impetus.kundera.loader.MetamodelLoaderException: Error while retreiving and storing entity metadata]" <p>I'm new in cassandra, trying to integrate cassandra using Kundera 3.5 with my java app on play framework(v2.3). I have gone through <a href="https://dzone.com/articles/play-nosql-building-... | <p>The error can be due to twice declaration of <code>User</code> entity in <code><class></code> tag and <code><jar-file></code> tag. </p>
<p>Try this <code>persistence.xml</code></p>
<pre><code><persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-inst... |
Custom listview in fragment error <p>I am new to Fragment in android and I create a simple list of state in fragment but it gives an error.</p>
<p>Here is my <code>list_item.xml</code></p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/... | <p>Replace your <code>getFragmentManager()</code> with <code>getSupportFragmentManager()</code> like in your code:</p>
<pre><code> MyListFragment myListFragment=new MyListFragment();
FragmentManager fragmentManager=getSupportFragmentManager();
FragmentTransaction fragment... |
MVC WCF Exception metadata was not handled by user code <p>I am programming both MVC Web application and WCF application to connect them together and both of them work perfectly,however after connecting them I get an exception in mvc application and the exception Exactly:</p>
<blockquote>
<p>"System.Data.Entity.Core... | <p>This means that the application is unable to load the EDMX.</p>
<ul>
<li><p>You might have changed the MetadataArtifactProcessing property of the
model to Copy to Output Directory.</p></li>
<li><p>The connection string could be wrong. I know you say you haven't changed it, but if you have changed other things (say,... |
Response from Google Cloud Messaging Server is OK, but Response Body says "Unrecognized IP address" <p>Response from Google cloud messaging server is "OK", but the body of response says "You have browsed from an unrecognized IP address. The proxy therefore denied access to this site or page:"</p>
<pre><code> privat... | <p>Take note of this statement from <a href="https://developers.google.com/cloud-messaging/http" rel="nofollow">Implementing an HTTP Connection Server</a>:</p>
<blockquote>
<p>If your organization has a firewall that restricts the traffic to or
from the Internet, you need to configure it to allow connectivity with... |
Introducing Immutable.js into redux/react code <p>I'm introducing Immutable.js into my redux/react project. I'm changing the likes of:</p>
<pre><code>let {id, name} = user;
</code></pre>
<p>to:</p>
<pre><code>let id = user.get('id');
let name = user.get('name');
</code></pre>
<p>That's twice as much code. Is there ... | <p>You can not use destructuring with an Immutable.js <code>Map</code>, at least not right out of the box. If your project uses Babel, you can add a plugin called <a href="https://github.com/vacuumlabs/babel-plugin-extensible-destructuring" rel="nofollow">babel-plugin-extensible-destructuring</a>.</p>
<p>After configu... |
What is the difference between running by creating a process and running through command line? <p>I have a jar file. I am running this jar file by <em>creating a process</em>. So, what is the difference between running it through <code>command prompt</code> without creating a process? Will it affect the application's p... | <p>If your application requires you to run the jar file as a command in a separate process from your java application,It's the way to go.There is no question of performance.
However when you launch command prompt through <code>Runtime.exec()</code>,command line will be executed as a sub-process or a separate process in... |
What is "__init__.php"? <p>I downloaded a library and the sample code says to use:</p>
<pre><code>require "php-webdriver/lib/__init__.php";
</code></pre>
<p>Looking in the <code>php-webdriver/lib/</code> directory, I do not see this <code>__init__.php</code> file.</p>
<p>Does this have something to do with me downlo... | <p>This work like auto-loader class in php.
Copy and paste below code in file named <strong>init</strong>.php
<a href="https://github.com/silverstripe-archive/spec-by-example/blob/master/features/support/php-webdriver/__init__.php" rel="nofollow">Github</a></p>
|
MySQL query not works (C#) <p>I try to update my MYSQL table with this code.</p>
<pre><code>string sqlquery = String.Format("if exists(select 1 from orders where id =\" {0}\" ) begin update orders set customer_id = \"{1}\", total = \"{2}\", fio = \"{3}\", adress =\" {4}\" where id = \"{0}\" end else begin insert into ... | <p>why dont you do it in more elegant way:Something like.:</p>
<pre><code>using (SqlConnection connection = new SqlConnection(connectionString))
using (SqlCommand command = connection.CreateCommand())
{
command.CommandText = "if exists(select 1 from orders where id =@id)
begin
update orders set customer_id = ... |
ZLib Compression adds unwanted characters to data <p>I have the following routine, which simply Uncompresseses a gz file, and then Compresseses back to gz. However, it is adding some extra characters at the beginning of the data. I'm wondering why this could be? </p>
<p>It seems something in the compress_string functi... | <p>I'm not going to try to debug your code (which is not a free service offered here), but I can immediately observe that your code does not do what your question claims. Your <code>inflateInit2()</code> does set you up to decompress a gzip stream. However your <code>deflateInit()</code> sets up compression to the zlib... |
UWP - Access to Isolated Storage <p>I am saving pictures into isolated storage on my phone and I need to check those pictures. I have already tried WP Power tools and it worked for first time, then the tool shows nothing.</p>
<p>I tried ISETool too, but I get Error: "Unit cannot find specified trace or area on disc."(... | <p>You can use the <code>Device portal</code>:</p>
<ol>
<li>On your phone go to <code>Settings > Update & security > For developers</code> and enable <code>Device discovery</code> and <code>Device portal</code>.</li>
<li>On your PC go to address show below the <code>Device portal</code> section.</li>
<li>Cli... |
get current cpu usage using c# in asp.net framework <p>I would like to find out the current CPU usage using the codes below(c# in asp.net framework). However it gives me "0% of CPU usage" when I try to run the program. When I check my task manager, I found out that the actual total CPU usage is more than 5%. Does anyon... | <p>The first value returned by a <code>PerformanceCounter</code> will always be <code>0</code>. You'll need a <code>Timer</code> or <code>Thread</code> that keeps monitoring the value in the background. This code for example will output the correct value every second (don't use this actual code, it's quick and dirty):<... |
No Response on NGINX when using upstream <p>I'm trying to load balance a web application through nginx, It works fine for all will my web application calls a service with sub-path.</p>
<p>for example it works</p>
<pre><code>http://example.com/luna/
</code></pre>
<p>but not for </p>
<pre><code> http://example.com/l... | <p>There are four suffixes to the <code>rewrite</code> directive and they all have specific uses. See <a href="http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite" rel="nofollow">this document</a> for details.</p>
<p>If you want the URI <code>/</code> to be mapped to <code>/luna</code> without changing ... |
how to use intents for two activities to get a value to third activity with comon variable name <p>i m using two activities which has category_id=1 and category_id=2.i used two intent with different objects.i sent the category id in that intents to the third activity and check the category id there using if else in on... | <p>Change your code like this will help</p>
<pre><code>if(category_id.equalsIgnoreCase("1")){
Toast.makeText(Getquote.this, ""+category_id, Toast.LENGTH_SHORT).show();
}
else{
Toast.makeText(Getquote.this, ""+category_id, Toast.LENGTH_SHORT).show();
}
</code></pre>
|
AngularJS: Access DOM elements of directive in its controller <p>I am writing an image carousel directive without any other libraries than the base AngularJS.</p>
<pre><code>simpleCarousel.$inject = [];
function simpleCarousel() {
var directive = {
restrict: 'E',
templateUrl: 'someurl.html',
... | <p>It is usually considered as a bad practice and discouraged to attach event handlers in controller.</p>
<p>Also, you might want to checkout ngTouch to detect swiping. </p>
<p><a href="https://docs.angularjs.org/api/ngTouch" rel="nofollow">https://docs.angularjs.org/api/ngTouch</a></p>
|
System.DirectoryServices.AccountManagement.NoMatchingPrincipalException: An error occurred while enumerating the groups. The group could not be found <p>I want to get the Groups of a User from the Active Directory by an User Principal. For this task, I wrote the following static function:</p>
<pre><code>internal stati... | <p>It seems like the method GetAuthorizationGroups() have a few limitations. This is an old Exception that have existed since 2009. And Microsoft won't fix it because "there is a reasonable workaround". <a href="https://connect.microsoft.com/VisualStudio/feedback/details/522539/clr-forum-error-calling-principal-getauth... |
SQL Server Cursor not returning multiple rows to Excel <p>I asked a few days ago about the correct ways to return multiple rows of results from a SQL Server stored procedure and it was recommended that I use the following</p>
<pre><code>select @var01, @var02
</code></pre>
<p>Which seems to work fine until I use it in... | <p>I don't see any need to use a cursor in this case. When you select like that within a cursor you return a series of individual results rather than a single table. While programmatically you could capture each of those results and merge them together I am not sure that you can do that in Excel, nor that you would wan... |
Query doesn't excecute for a select count of a particular column value <pre><code>select count(*) as allCount, sum(t.status='Approved') as approvedCount, sum(t.status='Overdue') as overdueCount,
sum(t.status='Rejected') as rejectedCount, sum(t.status='Awaiting Approval') as awaitingApprovalCount,
... | <p>Nearly there try use sum (case when</p>
<pre><code>select count(*) as allCount,
sum(case when t.status='Approved' then 1 else 0 end) as approvedCount,
sum(case when t.status='Overdue' then 1 else 0 end) as overdueCount,
sum(case when t.status='Rejected' then 1 else 0 end) as rejectedCount,
sum(case when t.stat... |
Is there any way by which Instagram images can be fetched of specific hashtag without the use of access token/client id? <p>I am trying to fetch public Instagram images using hashtag but that's to be done without the use of client id/access token. I am using the script below</p>
<pre><code><div id="instafeed">&l... | <p>The only official way to fetch all public images with a specific hashtag is to get your Instagram API client approved for the <code>public_content</code> <a href="https://www.instagram.com/developer/authorization/" rel="nofollow">API scope</a>. This requires you to submit your API client through Instagram's <a href=... |
How to read file part by part while writing it? <p>I'm working on an app that records video and I need to send already written data in videofile to server in base64 string without stopping record process. Does anyone know how to make it with less memory consumption?</p>
<p>For now I'm doing it this way</p>
<pre><code... | <p><strong>Some kind of solutions.</strong></p>
<ol>
<li>Don't use Base64 for encoding video for sending via network (even wi-fi) as it increases amount of data approximately 10 times which is not very good for battery and could kill or hang you process/service.</li>
<li>Avoid reading file that is in process of writte... |
how to stay my last position in map after every 1 min load <p>how to track the current position on map when i load map at every 1 min but right now map position redirect to default position after every 1 min. </p>
<p>here is my code.i call load function at every 1 min and i fetch data from mapajax1.php file.i want to... | <p>You should set a default location for your app. How about you use your own location? HTML5 has geolocation support. This means modern browsers can find your location by your IP address. See this <a href="https://www.pubnub.com/blog/2015-04-30-google-maps-geolocation-tracking-in-realtime-with-javascript/" rel="nofoll... |
What is going on with my nav bar and footer <p>For some reason, my nav bar and footer are messed up. I don't want the user to have to scroll down at all, I want everything to fit on one page. For some reason the footer and the image are screwing that up. The biggest problem though is that my main content is not going i... | <p>Add the following line <code>overflow:hidden</code> to the<code>#main</code> div</p>
<pre><code>#main {
width: 1300px;
margin-left: auto;
margin-right: auto;
min-height: 90%;
height: auto;
height: 89%;
margin: 0 auto -50px;
vertical-align: bottom;
overflow: hidden;
}
</code></pre... |
Is a Kotlin Liferay portlet possible? <p>As I couldn't find any example for this I am wondering if it is possible to create a Liferay Portlet which uses (pure) Kotlin instead of traditional Java.</p>
| <p>Kotlin targets the JVM - so technically: Yes. </p>
<p>Will anybody be able to help you doing so, share their findings: Probably not. </p>
<p>Do common build processes exist? Not that I know.</p>
<p>And it'll probably make a difference if you write a portlet for Liferay 6.2 or for 7 - unless you're aiming at just ... |
http://localhost:3000/microposts/new can't open <p>I'm reading 'Ruby on rails toturial' by Michael Hart.</p>
<p>I followed all the steps and did this command:</p>
<blockquote>
<p>$ rails generate scaffold Micropost content:string user id:integer</p>
</blockquote>
<p>But still can't open: <a href="http://localhost:... | <p>You have missed the _ in your command. It should be </p>
<pre><code> rails generate scaffold Micropost content:string user_id:integer
</code></pre>
<p>Destroy the scaffold using the following command.</p>
<pre><code> rails destroy scaffold Micropost
</code></pre>
<p>Create the scaffold again.</p>
<pre><code> ra... |
Fill missing date-time values in output vector <p>I performed a unique extraction on my date-time values for extracting unique seconds in my time-series data.</p>
<pre><code>unique_seconds <- unlist(unique(all_secondsDayData))
</code></pre>
<p>I have missing values in my output as follows: </p>
<p>(see "2015-12-0... | <p>Looks like you just want a regular time sequence by 1 second. You may try using <code>seq.POSIXt</code>:</p>
<pre><code>x <- c("2015-12-03 09:51:24", "2015-12-03 09:51:25", "2015-12-03 09:51:27",
"2015-12-03 09:51:28", "2015-12-03 09:51:29")
x <- strptime(x, "%Y-%m-%d %H:%M:%S")
RANGE <- range(x)
... |
How to replace a tag with another and keep attributes using jquery? <p>How to replace <code><ins></code> tag with <code><del></code> tag and keep attributes of it in javascript or jquery? like the following</p>
<pre><code><ins data-author="auth1" data-ins-username="user1">auth1 text</ins>
<!... | <p>You can use jquery <a href="http://api.jquery.com/replacewith/" rel="nofollow"><code>.replaceWith()</code></a> to replacing a tag with another. In function get <code>outerHTML</code> of element and replace tag name with another.</p>
<pre><code>$("ins").replaceWith(function(){
return this.outerHTML.replace("<... |
Docker port forwarding not working <p>I have setup Docker container for access my machine docker container to another machine in local.</p>
<p>Create a container below command:</p>
<pre><code> docker run -it -d --name containerName -h www.myhost.net -v /var/www/html -p 7000:8000 --net mynetwork --ip 172.11.0.10 --... | <p>Port <code>7000</code> on the host is redirecting to port <code>8000</code> in the container, but is anything listening on that port in the container? </p>
<p>Your <code>docker run</code> command is a bit odd: <code>-it</code> is for running a container interactively with a terminal attached; <code>-d</code> is for... |
Ansible run playbook only for hosts that match some variables <p>I have a playbook that I want to execute on RHEL 6 servers only. I know I can put</p>
<pre><code>when: ansible_distribution == "RedHat" and ansible_distribution_major_version == 6
</code></pre>
<p>Into every single task within the whole playbook, but th... | <p>Use <code>include</code> with <code>with_first_found</code>:</p>
<pre><code>- include: "{{ include_path }}"
with_first_found:
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- "default.yml"
loop_control:
loop_var: include_path
</code></pre>
<p>Update: added <code>loop_var</code>... |
Odoo v9 - onchange does not see the value of the changing field <p>I have added a field to product.template called uom_class . When it changes, I need to change other fields based upon its value. Unfortunately, Odoo is treating it like its empty, and always returns False. I have no idea why. Here is my code</p>
<p... | <p>Ok, I found the problem. It was actually an issue in the views... </p>
<p>I had accidentally copy and pasted the declaration for uom_class in modifications I made on another tab. So my variable was listed twice. Odoo saw that it was being changed, but I guess it was not handling it very well having two of the ex... |
I don't want to reload view controller <p>I'm using storyboard & segue to go from "HomeVC" to "MapVC".</p>
<p>HomeVC - > segue -> MapVC </p>
<p>And since navigation controller is embedded, MapVC automatically get back button.</p>
<p>Now when I'm again coming from HomeVC->MapVC, MapVC is getting reloaded. Whic... | <p>I'd not use a segue but an IBAction and do the push manually:</p>
<p>e.g.</p>
<ol>
<li><p>hook up a UIButton (or whatever) to trigger <code>@IBAction func buttonClicked(sender: UIButton!)</code></p></li>
<li><p>keep a reference to mapVC as an outlet: <code>@IBOutlet var mapVC:MyMapViewController!</code>
[note: yo... |
Why is my custom renderer not working? <p>I have the following class in my Droid-Project:</p>
<pre class="lang-cs prettyprint-override"><code>using MyProject.Droid;
using Xamarin.Forms.Platform.Android;
[assembly: Xamarin.Forms.ExportRenderer(typeof(Android.Widget.Button), typeof(ArrowButtonRenderer))]
namespace MyPr... | <p>After an extensive chat and looking at your sources I've seen that the PCL has version 2.3.1.114 of Xamarin.Forms installed.</p>
<p>Your Droid project has version 1.5.x installed, so it's much older!</p>
<p>Now the next part will be tricky, you need to update your Xamarin.Forms package for Android. But if you upda... |
Method that returns Task<string> <p>I need a method that returns a <code>Task<string></code> with empty string like</p>
<pre><code>public static Task<string> AsyncTest()
{
return new Task<string>(() => string.Empty); //problem here
// this method would work:
// return new WebCl... | <p>Unless you're writing your own task management system you should probably never use <code>new Task(...)</code>.</p>
<p>However, that aside, the reason why this doesn't work in this case is because a <code>new Task(...)</code> doesn't start by itself. It just constructs the task object around your delegate.</p>
<p>... |
Writing a conditional statement in compass <p>I have the following 4 classes.</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-css lang-css prettyprint-override"><code>.editor-item{@extend .popover-icons; margin:1... | <p>I haven't seen your HTML, but here is roughly how I would approach things:</p>
<ol>
<li>Set up hover on <code>.editor-item-wrapper</code>.</li>
<li>Prepare an opacity transition on <code>.editor-item-desc</code>.</li>
<li><p>Access <code>.editor-item-desc</code> within the hover and control the fade out.</p>
<pre>... |
C#: Error string query update with \ <p>Hello i have problem on c# application,error is : unrecognized escape sequence,
on this string: 'I:\Ar and this I:\S</p>
<pre><code>SqlCommand myCommandset2 = new SqlCommand("update Distinta set Immagine = replace(Immagine, 'I:\Archivio\Centoimp\Preventivi Bassi\', 'I:\Software ... | <p>You need to escape <code>\</code> with <code>\\</code></p>
<pre><code>SqlCommand myCommandset2 = new SqlCommand("update Distinta set Immagine = replace(Immagine, 'I:\\Archivio\\Centoimp\\Preventivi Bassi\\', 'I:\\Software preventivi\\')", conn2);
</code></pre>
|
Regular Expression for Email with default domain <p>I want to add to a textbox a <code>regular expression</code> to let introduce emails only with <code>@yahoo.com</code> and <code>@gmail.com</code> . All other emails to set to be errors.</p>
<p>I am using <code>DevExpress</code> TextBox for <code>ASP.NET WebForms</co... | <p>Replace your code</p>
<pre><code> <dx:ASPxTextBox ID="tbEmail" runat="server" Width="150px" Text="">
<ValidationSettings CausesValidation="true" Display="Dynamic" ErrorText="*" ValidationGroup="Users">
... |
Setting locale failed <p>I keep getting the following error message in the R Markdown log:</p>
<pre><code>cropping document_files/figure-latex/ranking_time_output-1.pdf
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LC_ALL = (unset),
LC_CTYPE = "en_NL.UTF-8",
L... | <p>LC_CTYPE is set to "en_NL.UTF-8". Such a locale does not exist on Mac OS X (and probably no other OS). Try to find where the wrong setting comes from because it will probably cause other problems, too.</p>
<p>Setting the locale with Sys.setlocale() is useless because Perl is running in a child process created wit... |
I want to change gps setting programatically in android but having crash <p>ERROR I'm Getting :</p>
<pre><code>java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.location.GPS_ENABLED_CHANGE from pid=15200, uid=10175
</code></pre>
<p>I am using this code. It's not working for me on a... | <p>The code you shown in the your question has been stopped working from Android version 4.4. Your will fire this Exception starting from Kitkat version java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.location.GPS_ENABLED_CHANGE</p>
<p>For The security purpose Google developer has... |
How can I use callback function from ajax in another function <p>How can I use callback function from ajax in another function</p>
<p>I've got function with ajax:</p>
<pre><code>function correct_date(raw_date){
return $.ajax({
method: "GET",
url: "../date/correct.php",
data: {... | <p>You must use those two functions like:</p>
<pre><code>function correct_date(raw_date){
return $.ajax({
method: "GET",
url: "../date/correct.php",
data: {
method: 'correct_date',
date: raw_date
},
cache: false,
... |
Unable to Lazy load modules in Angular2(RC-6) <p>I am trying to implement lazy loading of feature modules in my sample angular2 application.</p>
<p>My application has a root module and two feature modules.</p>
<p>Path of Root module and routing files are</p>
<pre><code>app/public/scripts/app.module.ts
app/public/scr... | <p>You need to specify the path of the module relative to <code>src/</code>:</p>
<pre><code>{path: 'ausers' , loadChildren: 'app/public/scripts/modules/user/app.users.module#UsersModule' }
</code></pre>
<p>Also lazy-loading was buggy with webpack on RC6, which was fixed in <a href="https://github.com/angular/angular/... |
Wordpress post in article alpahabetic ordering <p>Is there anyway or any plugin for in post listing a-z alphabeticly and when u click any alphabet it shows you the contents begining with that alpa. Most of plugins needs to add one by one every item that will be indexing which i dont want because i got a long list alrea... | <p>You can try this plugin for this types of ordering <a href="https://wordpress.org/plugins/multi-column-tag-map/" rel="nofollow">link</a> </p>
|
Select2 4.x: How to actually limit the search input? <p>I refer to option <code>maximumInputLength</code>: Setting this to e.g. "5" displays a message "Please delete 3 characters" in case I enter a term of length 8. Nevertheless it's possible to enter any amount of characters.</p>
<p>While this may be desired in certa... | <p>Well you can use simple jQuery to limit the input on key release in the example I also disable the input when the maximum length is reached:</p>
<pre><code>$("input").keydown(function(e){
if($("#input").val().length > 2){
$("#input").val($("#input").val().substr(0, 3));
$("#input").prop('... |
How to change date time format in a grid in asp.net mvc <p>I want to change my date time format from <code>7/20/2016 10:30:00 AM</code> to <code>20 July 2016 10:30 AM</code></p>
<p>Bellow is the image in where i want to change the format </p>
<p><a href="http://i.stack.imgur.com/E9V9R.jpg" rel="nofollow"><img src="ht... | <p>you can use the following</p>
<pre><code>@(string.Format("{0:dd MMMM yyyy hh:mm tt}",dr[1]))
</code></pre>
<p>in case dr[1] was string, you need to parse it as datetime then apply formatting like this:</p>
<pre><code>@(string.Format("{0:dd MMMM yyyy hh:mm tt}",DateTime.Parse(dr[1])))
</code></pre>
<p>please no... |
typo3 extremly slow what could be a reason <p>I've go a ubuntu 14.04lts vserver with 2 vcores and 4GB ram (only 200MB used)</p>
<p>on this server are running 4 typo3 instances but all are test installations so they don't have lots of visits.</p>
<p>my problem is that they are very very slow.</p>
<p>cpu usage 2%
ram ... | <p>My solution was to increase the php memory for the server!</p>
|
IE: Object doesn't support property or method 'closest' <p>I am getting "Object doesn't support property or method 'closest'" error in IE. I am using MooTools. Can anyone help me..</p>
<pre><code>var li = $$('.list')[0].clone(true, true);
var NewContainer = li.getElement('div.tile');
NewContainer.removeProperty('sty... | <p>MooTools doesn't have <code>closest</code>. You may have wanted <a href="http://mootools.net/core/docs/1.6.0/Element/Element#Element:getParent" rel="nofollow"><code>getParent</code></a> (which accepts a selector for finding an ancestor), but unlike jQuery's <code>closest</code> it doesn't look at the current element... |
Are there any hidden workitem-types in the TFS? <p>I'm trying to specify all required fieldentrys for all used workitems-types on my TFS. I'm getting many workitem-types via C#-Code, but when I'm trying to create new workitems via the TFS-Webapplication, there are some workitem-types, which seems to be not there. I jus... | <p>Yes, there are. You can hide a Work Item Type by <strong>modifying the Categories</strong> in Process Template. Such as </p>
<pre><code><CATEGORY name=âHidden Types Categoryâ refname=âMicrosoft.HiddenCategoryâ>
</code></pre>
<p>More details please refer <a href="https://msdn.microsoft.com/en-us/libra... |
Show if value is same as Time.now <p><code><%= user.last_seen_at.strftime("%I:%M UTC") %></code> will give me a date of when the user last took an action on my website. </p>
<p>Doing <code><%=Time.now.strftime("%I:%M UTC") %></code> will give the current time. </p>
<p>I want it set up where it will show <... | <p>try this:</p>
<pre><code><% = content_tag('h1','online') if (user.last_seen_at + 5.minutes) >= Time.current %>
</code></pre>
|
Link statically stdlib.so <p>Following this <a href="http://blog.ralch.com/tutorial/golang-sharing-libraries/" rel="nofollow">blog post</a> I tried to compile stdlib.so to link other code with it. Unfortunately, stdlib.so itself is a dynamically linked binary:</p>
<pre><code># ldd /usr/local/go/pkg/linux_amd64_dynlin... | <p>Here is another blog post about statically compiling Go programs that use CGo:
<a href="http://blog.hashbangbash.com/2014/04/linking-golang-statically/" rel="nofollow">Linking Golang Statically</a></p>
<p>It says:</p>
<blockquote>
<p>But for that example, we just have to add the '-static' flag to gcc (and ensure... |
HTML Form sending values with jQuery Ajax to PHP <p>i have this HTML form that sends input values using jquery ajax to php. The process went well, but only if i see it when i right-click>inspect element>network>header .unfortunately the real page stays still.</p>
<p>is there anyway i did it wrong? please help. Thanks ... | <p>Ok i got it. </p>
<p>I've added </p>
<pre><code>$this->_filter($input_data);
return json_encode($this->_data_template['product']);
</code></pre>
<p>on the PHP part and added,</p>
<pre><code>success: function (response) {
var json = $.parseJSON(response);
for (idx= 0; idx&l... |
Bootstrap input padding <p>This Bootstrap code gives you a date input field. However it gives me a huge area to the right of the input field that is not used and can't be used. How can I get rid of that unused area ?</p>
<p><a href="http://i.stack.imgur.com/oY7cM.png" rel="nofollow"><img src="http://i.stack.imgur.com/... | <p>One way could be to add a fixed width to the 'input-group' div, like </p>
<pre><code><div class="form-group has-feedback has-error">
<label for="date_born">Date naissance</label>
<div class="input-group date" id="date_born" style="width: 150px;">
<input name="date_born" class=... |
Jenkins diamond dependency with 3 upstream jobs triggers only 2 times <p>We have one jenkins job (A) that triggers 3 other jobs (B1,B2,B3).
These 3 jobs all trigger the same job (C).
When triggering job A, the job C is executed twice (I expected 3 times). </p>
<p><strong>Question: Can someone please explain why C is t... | <p>It's the way how Jenkins triggers jobs. If concurrent builds are not allowed in C (I suppose they aren't), then the following happens:</p>
<ol>
<li>A finishes and triggers B1,B2,B3</li>
<li>B1 (for example, could be B2 or B3 as well) finishes and triggers C, build #1 (C#1). </li>
<li>B2 finishes and triggers C. The... |
Bitwise operation compare result is wrong <p>I must be doing something wrong here : I have this enum </p>
<pre><code>enum OperetionFlags
{
NONE = 0x01,
TOUCHED = 0x02,
MOVE_RIGHT = 0x04,
MOVE_LEFT = 0x08,
GAME_START = 0x10,
GAME_END = 0x20
};
int curentState ;
</code></... | <p>With bitwise operations, <code>|</code> is like bitwise addition and <code>&</code> is like bitwise multiplication (dropping carry bits if there are any).<br>
(It's very easy to think that <code>a & b</code> is "the one bits from a and the one bits from b", but it's "the bits that are one in both a and b".)<... |
Open a jquery ui dialog box for the layer selected when clicking a button outside the map <p>I have a leaflet map with multiple layers. I can draw polylines, delete and edit them for a particular layer and then, send some informations with a jquery ui dialog box, to my postGis db.</p>
<p>No problem for drawing and del... | <p>I would suggest something like this, where the dialog is defined and later adjusted when the save action is needed.</p>
<p>Working Example: <a href="https://jsfiddle.net/Twisty/f1gvo1h6/" rel="nofollow">https://jsfiddle.net/Twisty/f1gvo1h6/</a></p>
<p><strong>HTML</strong></p>
<pre><code><div>
<div cla... |
Ruby: Until loop doesn't work as expected <p>I just wrote this simple script: </p>
<pre><code>#!/bin/env ruby
begin
print "Continue? [Y/n] "
key = gets
end until key == 'n'
</code></pre>
<p>I expect that if I hit "n" key, the loop will end. But that's not happening. No matter what key I send, loop always con... | <p><code>gets</code> also captures the <kbd>ENTER</kbd> you press after the <em>n</em>.</p>
<p>Try <code>key = gets.chomp</code> instead (see the explanation here: <a href="http://ruby-doc.org/docs/Tutorial/part_02/user_input.html#newline" rel="nofollow">http://ruby-doc.org/docs/Tutorial/part_02/user_input.html#newlin... |
EJB pooling in JBoss EAP 6 - Are there any downsides to just setting a really large value for max-pool-size? <p>We have a large knowledge management application that we are migrating from JBoss EAP 4.3 to EAP 6.4. We had some issues with a parallel MDB-driven process failing (with the error message referenced in <a hre... | <p>As to the <code>max-poo-size</code> of 20, it is really hard to come up with a default value. If this were set to 100, then a user on a single core system could easily overwhelm the CPU. It comes down to how many cores are available, what the MDB workload looks like, and how much else is going on in the applicatio... |
PHP Fatal error out of memory while building tree <p>I got trouble with bulding tree of categories in php.
It's builds tree for very long time and after that i got error:</p>
<blockquote>
<p>Fatal error: Out of memory (allocated 637796352) (tried to allocate
208666926 bytes) in
D:\OpenServer\domains\site.local\C... | <p>that is not a code issue. set memory_limit in php.ini file to more than 128m,
you should also increase post meta data to something like 10000</p>
|
Can't access third party repo using yum in Azure RHEL node <p>We have provisioned a RHEL server from Azure. I understand that our infrastructure guys are a bit strict on access. </p>
<p>We need to install Oracle JDK in this machine and it looks like <code>wget</code> is not an option on getting rpms, only yum. However... | <p>Per my experience, i think the issue may be caused by the VM network. But, this has not problems when you run yum update. So i suggest that you can run ping www.microsoft.com in the VM terminal to inspect whether your VM can connect to extranet.</p>
<p>For your first question, we can use an alternative method to i... |
Refused to connect to URL because of violation of Content Security Policy <p>This is the error in my console:<br>
<a href="http://i.stack.imgur.com/lK5rm.png" rel="nofollow"><img src="http://i.stack.imgur.com/lK5rm.png" alt="this is the error in my console"></a> </p>
<p>This is the actual code of the meta:</p>
<pre><... | <p>The Content-Security-Policy restricts <a href="https://www.w3.org/TR/CSP/#directive-connect-src" rel="nofollow"><code>connect-src</code></a> to <code>self</code>, <code>data:</code>, <code>gap:</code> (is that a Cordova thing?), and <code>https://ssl.gstatic.com</code> â this means that any attempt at loading a re... |
clang-tidy: How to suppress warnings? <p>I recently started experimenting with the <code>clang-tidy</code> tool of llvm. Now I am trying to suppress false warnings from third party library code. For this I want to use the command line options</p>
<p><code>-header-filter=<string></code> or <code>-line-filter=<... | <p>I solved the problem by adding <em>// NOLINT</em> to line <em>1790</em> of <em>gmock-spec-builders.h</em></p>
<p>Here is the diff:</p>
<pre><code>--- gmock-spec-builders.orig.h 2016-09-17 09:46:48.527313088 +0200
+++ gmock-spec-builders.h 2016-09-17 09:46:58.958353697 +0200
@@ -1787,7 +1787,7 @@
#define ON... |
Encrypting username/password files (app.config) and Unit Tests on Visual Studio Team Services <p>I have some unit tests which target some overriden app.config files. Each config file has encrypted password/username using <code>DataProtectionConfigurationProvider</code> via <strong>aspnet_regiis.exe</strong></p>
<p>Thi... | <p>The encryption key for this uses the machine key which will differ up on the azure server to your local box. Set a machine key manually so it will always be the same in the web.config</p>
<p>See this article on setting your machine key..
<a href="https://technet.microsoft.com/en-gb/library/cc755177(v=ws.10).aspx" ... |
CAS: Content encryption header (enc) not set <p>I got this exception when I tried to log in. As you can see i successfully got the ticket granting ticket. However, for somereason I get the "CAS is Unavailable" screen. Down in the stack trace I can see <code>org.jose4j.lang.InvalidAlgorithmException: Content encryption ... | <p>Turns out you have to add keys in the <code>cas.properties</code> for the TGC encryption:</p>
<pre><code># The encryption secret key. By default, must be a octet string of size 256.
tgc.encryption.key=***
# The signing secret key. By default, must be a octet string of size 512.
tgc.signing.key=***
</code></pre>
<... |
how to add a href link to a toggle button? <p>I have a toggle button, in which i would like to add a href link to it, so that when i point the toggle button to left it should open a link and vice versa.. </p>
<p>so far this is my code::</p>
<pre><code><html>
<head>
<style>
.switch {
position: fixed;... | <p>I am not a css expert. In javascript we can give you a solution like this. You can bind an event for on click. in onclick function you can check whether has that unique class will help you to easily identify left for right.</p>
<pre><code><input type="checkbox" onclick="loadNewPage();">
</code></pre>
<p>jav... |
Find all instances of a specific day of the week between two dates in SQL <p>I'm trying to find all instances of a day of a week between two given dates. The day of the week can change. I've seen a similar question posted on here, but it doesn't seem to work for variables</p>
<pre><code>SET DATEFIRST 1;
DECLARE @earli... | <p>The line</p>
<pre><code>SELECT DATEADD(day, @weeklyCoursesStartDay, dt) FROM CTE
</code></pre>
<p>should actually be:</p>
<pre><code>SELECT DATEADD(day, 1, dt) FROM CTE
</code></pre>
<p>This means that the recursive CTE will generate <em>every day</em> between <code>@earliestStartDate</code> and <code>@latestSta... |
How can I make a class conform to an interface <p>When I say <code>class Foo implements IFoo</code> it enforces that <em>instances</em> of the class follow the contract. </p>
<p>e.g. </p>
<pre><code>interface IFoo { foo: number }
class Foo implements IFoo {
foo: number
}
const foo = new Foo();
// Guaranteed that th... | <p>Simply do the check with an assignment: </p>
<pre><code>interface IFoo { foo: number }
class Foo {
static foo: number
}
const ensureCompatible:IFoo = Foo; // Check
</code></pre>
|
php won't insert into mysql. no errors <p>I create php and mysql database and table. This is my code:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><form action="pr... | <p>You have made some few mistakes so that the query might not be inserting datas into the phpmyadmin database. The basic error you have made is in the insert query by not concatenating the values that you want in the <code>VALUES</code> section and the insert statement syntax will be like this.</p>
<p><strong>Insert ... |
CSS truncate strings past two lines <p>I have an item "gallery" with the name of the item above the image. I am loading all information from an xml file so I need the strings to be modified dynamically at two lines adding "..." to the end of the strings that are too long. is there a way to do this? I'd prefer an answer... | <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.text-limiter {
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
width:400px;
}</code></pre>
<pre cl... |
Symfony 3 Bootstrap form theme <p>Default bootstrap field was rendered like this : </p>
<pre><code><div class="checkbox">
<label>
<input type="checkbox" id="form_checkbox" name="form[checkbox]" required="required" value="1" /> Checkbox
</label>
</div>
</cod... | <p>Make your own template for the form and re-define how it will be rendered.</p>
<pre><code>twig:
exception_controller: twig.controller.exception:showAction
form_themes:
- MyBundle::form.html.twig
</code></pre>
<p>In <code>form.html.twig</code></p>
<pre><code>{% use "bootstrap_3_layout.html.twig" %... |
How to get nested json object with php mysql <p>I am trying to fetch parent categories and subcategories from same table. I'm using php rest api for the same.</p>
<p>This is my table. </p>
<pre><code>id parent category
--------------------
1 | 0 | Fruits
2 | 0 | Cars
3 | 1 | Orange
4 | 1 | Apple
5 ... | <p>I think this will solve your issue</p>
<pre><code> function buildTree(array $elements, $parentId = 0) {
$branch = array();
foreach($elements as $element)
{
if ($element['parent'] == $parentId)
{
$children = buildTree($elements, $element['id']);
if ($ch... |
How to test toast messages in Appium Test Case? <p>I know appium does not support testing of toast messages so far but if anyone has use any out of the box solution to for testing toast messages then please guide me.</p>
| <p>Unfortunately, <strong>UIAutomator does not detect toast messages</strong> displayed in the Android app app internally finds element using UIAutomator only.</p>
<p>And its difficult to verify toast message through image recognition also because toast messages usually disappear after 1-2 seconds.</p>
<p>We can expe... |
Data structure to store key-value pairs with duplicate keys <p>Which data structure can I use in Go to store key-value pairs with duplicate keys? For eg: </p>
<pre><code>key | value
1 one
2 two
1 three
</code></pre>
<p>and If I try to fetch values corresponding to key <code>1</code> I should get an arr... | <h3>With slice value type</h3>
<p><code>map</code> is a good choice if you need fast lookup, but since you want to store multiple values for the same key, that warrants for a slice as the value type:</p>
<pre><code>m := map[int][]interface{}{}
m[1] = append(m[1], "one")
m[2] = append(m[2], "two")
m[1] = append(m[1], ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.