_id
stringlengths 2
6
| partition
stringclasses 3
values | text
stringlengths 4
46k
| language
stringclasses 1
value | title
stringclasses 1
value |
---|---|---|---|---|
d17201 | val | Yes it's possible.
Take a look of this example:
<body>
<div class="container">
<div class="wrapper">
<a class="btn btn-primary btn-lg" id="open-modal-button" data-target=".mymodal" data-toggle="modal">Open Me </a>
</div>
<div aria-hidden="true" aria-labelledby="myModalLabel" class="modal fade mymodal" role="dialog" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="carousel slide" data-interval="false" data-ride="carousel" id="carousel">
<div class="carousel-inner">
<div class="item active">
<div class="row">
<div class="col-md-12">
<%= image_tag("image1.png") %>
<button aria-label="Close" class="btn btn-primary" data-dismiss="modal">Close Window </button>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= image_tag("image2.png") %>
<button aria-label="Close" class="btn btn-primary" data-dismiss="modal">Close Window </button>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= image_tag("image3.png") %>
<button aria-label="Close" class="btn btn-primary" data-dismiss="modal">Close Window </button>
</div>
</div>
</div>
<div class="item">
<div class="row">
<div class="col-md-6 col-md-offset-3">
<%= image_tag("image4.png") %>
<button aria-label="Close" class="btn btn-primary" data-dismiss="modal">Close Window </button>
</div>
</div>
</div>
<a class="left carousel-control" data-slide="prev" href="#carousel" role="button"><span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" data-slide="next" href="#carousel" role="button"><span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
</div>
</div>
</div>
</div>
</body>
Some Css:
body {
margin: 0 auto;
text-align: center;
}
.wrapper {
text-align: center;
}
#open-modal-button {
position: absolute;
top: 30%;
}
Just be sure tu put a conditional statement before the carousel in order to validates the presence of the images.
Note: Just use bootstrap.js and bootstrap.css | unknown | |
d17202 | val | As hinted out by Naveh, It works those functions are present only in MATLAB 2014 version and not in older versions.
Older versions do not have that example as well when I try to open edit TextDetectionExample
A: This example first appears in release R2014a. helperGrowEdges is a helper function, which goes with the example. Unfortunately it does not get published in the documentation. The only way for you to see it is to get access to an installation of MATLAB R2014a with the Computer Vision System Toolbox, and do edit helperGrowEdges. | unknown | |
d17203 | val | You don't need 4 conditions and need to have them ANDed together:
RewriteEngine on
RewriteBase /amit/public/
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond ${REQUEST_FILENAME} !-d
RewriteRule ^(.+?)/?$ $1.php [L]
A: Thanks to @anubhava. I've just realized that my code uses $ for all the server variables. It should be %. A silly typo had hacked my brain for close to 24 hours... So the 'ultimate' code with the suggestions made by @anubhava would be:
Options +FollowSymlinks
RewriteEngine on
RewriteBase /amit/public/
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*[^/])/?$ $1.php [NC,L]
Works like a charm. | unknown | |
d17204 | val | i too came up with the same issue. seems like android studio seeking to update the kotlin plugin as well.
go to Tools > Kotlin > Configure Kotlin Plugin Update and update the plugin.
then restart studio, and it will sync the gradle on restart.
A: I found the answer. I changed the versions of gradle plugins.I am adding my Gradle files below
Project Level
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.1.1'
classpath 'com.loopj.android:android-async-http:1.4.9'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App Level build.gradle file
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
applicationId 'app.ecopon.com'
minSdkVersion 15
targetSdkVersion 25
versionCode 33
versionName "1.1.30"
useLibrary 'org.apache.http.legacy'
// Enabling multidex support.
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
}
}
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public'
}
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':android-async-http-1.4.9')
// compile 'com.daimajia.androidanimations:library:1.0.3@aar'
compile project(':PayTabs_SDK_NOSCAN')
compile('com.twitter.sdk.android:twitter:1.14.1@aar') {
transitive = true;
}
compile('org.apache.httpcomponents:httpmime:4.3') {
exclude module: "httpclient"
}
compile files('libs/signpost-core-1.2.1.2.jar')
// Discovery and Outlook services
compile('com.microsoft.services:discovery-services:1.0.0@aar') {
transitive = true
}
compile('com.microsoft.services:outlook-services:1.0.0@aar') {
transitive = true
}
compile 'org.sufficientlysecure:html-textview:3.3'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'cz.msebera.android:httpclient:4.3.6'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'me.dm7.barcodescanner:zxing:1.8.4'
compile 'com.google.android.gms:play-services:9.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.gms:google-services:3.0.0'
compile 'com.google.android.gms:play-services-ads:9.0.0'
compile 'com.google.android.gms:play-services-auth:9.0.0'
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile 'org.codepond:wizardroid:1.3.1'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.google.zxing:core:3.2.0'
compile 'io.card:android-sdk:5.3.0'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'me.dm7.barcodescanner:zbar:1.8.2'
compile 'com.journeyapps:zxing-android-embedded:3.0.2@aar'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.cloudrail:cloudrail-si-android:2.11.0'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.ss.bannerslider:bannerslider:1.8.0'
compile 'com.marshalchen.ultimaterecyclerview:library:0.7.3'
compile 'com.github.barteksc:android-pdf-viewer:2.8.2'
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.1'
}
}
}
}
Now, everything is working perfectly
A: Found a solution to this. You need to add google() to the buildscript and allprojects repository section as below:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
A: 1- Go to http://services.gradle.org
2- Go to Distributions
3- Click on the latest one to download it (I downloaded "gradle-4.6-rc-2-all.zip")
4- Unzip or Extract it
5- In Android Studio go to File > Settings > Build, Execution, Deployment > Gradle > Use local gradle distribution > then choose the file (that you just download and unzip it) from your computer
6- Click Ok
7- Inside "build.gradle(Module:app)" make sure that compileSdkVersion and targetSdkVersion are same
8- Click Sync Now
Resource: https://www.youtube.com/watch?v=q_qWUQNbFLY
A: Change your Buildscript part of your build.gradle To this , Actully Remove google() & jcenter(). This Worked for me.
buildscript {
repositories {
maven { url 'https://jitpack.io' }
mavenCentral()
maven { url "https://maven.google.com" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
}
}
A: You could try updating your Kotlin version and maybe add https://maven.google.com to the repositories tag of allProjects.
Your project level build.gradle should look something like this afterwards:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.30'
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0'
classpath 'com.google.gms:google-services:3.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.loopj.android:android-async-http:1.4.9'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Besides that, try cleaning the project and maybe removing your .gradle folders manually
A: Try to invalidate cache(did it a few times) or reinstall studio, or check gradle-wrapper.properties distributionUrl should be like this:
distributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip | unknown | |
d17205 | val | I figured it out. I was confused between the development.key and the config/credentials/development.yml.enc. The latter is the encrypted credential file. | unknown | |
d17206 | val | Just download it to ${basedir}/target/classes before packaging phase. You don't need it to be in sources in order to include it to JAR.
A: Solved!
I changed the phase to process-resources..
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>download-files</id>
<phase>process-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<get src="https://downloadUrl"
dest="${project.resources.dir}/commons/error.json"
verbose="true"
usetimestamp="true"/>
</tasks>
</configuration>
</execution>
</executions>
</plugin> | unknown | |
d17207 | val | I have a solution for the question that i have posted. Try starting the Spring XD single node too. Then you won't face any stream creation failure. Status will be in deployed (when we try create stream to fetch mysql data for example). But stream creation will be in failed, if we are pointing to gemfire. I am looking into it. | unknown | |
d17208 | val | The "special file" mentioned by Walter White is:
META-INF/services/javax.enterprise.inject.spi.Extension
That file should contain the fully-qualified name of your Extension class.
ie:
org.mydomain.extension.MyExtension
A: Thanks to Pete Muir, the solution was to implement the Extension interface. Once I did that, along with creating a special file, it worked perfectly.
The thing to remember is, if you want to observe (or act on) container events, you must implement the extension interface as it is a special event.
https://docs.jboss.org/weld/reference/latest/en-US/html/extend.html#d0e4984
Walter | unknown | |
d17209 | val | Are you debugging using "Attach to Process"?
First determine the w3wp.exe process:
For IIS6
*
*Start > Run > Cmd
*Go To Windows > System32
*Run cscript iisapp.vbs
*You will get the list of Running
Worker ProcessID and the Application
Pool Name.
For IIS7
*
*Start > Run > Cmd
*Go To Windows > System32 > Inetsrv
*Run appcmd list wp
Note the Process ID (PID).
Next in Visual Studio:
*
*Debug > Attach to Process...
*Find the w3wp.exe with the right PID and attach
Your breakpoints should work. | unknown | |
d17210 | val | collinksmith did answer your question but didn't explain that you cannot change the colour of a .svg file with CSS. You need to add the SVG inline then you can apply CSS to it.
A: You need to use the fill property of the svg's path. Assuming an svg html element, with a class set on the svg element itself:
.class-name path {
fill: red;
}
EDIT Here's an example: https://jsfiddle.net/4447zb7o/
EDIT 2 To set the css inline, change the style attribute of the path element inside the svg:
<svg class="my-svg" height="210" width="400">
<path style="fill: green" d="M150 0 L75 200 L225 200 Z" />
</svg> | unknown | |
d17211 | val | Like a two-factor (TOTP) code, but based on your GUID instead of a timestamp?
// userData should be populated with whatever immutable user data you want
// applicationSecret should be a constant
public string ComputeCode(byte[] userData, byte[] applicationSecret, int length)
{
using var hashAlgorithm = new HMACSHA256(applicationSecret);
var hash = hashAlgorithm.ComputeHash(userData);
return BitConverter.ToString(hash).Replace("-", "").Substring(0, length);
}
A: I can't speak to the EF-related aspects of your question, but I recently had to figure out a way to generate unique, user-friendly IDs for a personal project.
What I eventually settled on was the following:
*
*Start with a 32-bit integer. (In my case it was an incrementing database ID.)
*"Encrypt" the integer using RC5 with a block size of 32 bits. This scrambles the key space. You'll probably have to write your own RC5 implementation, but it's a simple algorithm. (Mine was <100 lines of python.)
*Encode the resulting 4 bytes in Base32. I recommend z-base-32 for the most user-friendly alphabet. You might have to write your own Base32 implementation, but again, it's quite simple.
This algorithm produces a reversible mapping similar to the following:
1 <-> "4zm5cna"
2 <-> "5ytgepe"
3 <-> "e94rs4e"
etc. | unknown | |
d17212 | val | The solution is to maintain a persistent connection.
You want to open a table that is very small (maybe just one record) and keep that open. Then everything else responds quickly.
You can also open a form that has a small table as its recordset, as long as it keep the connection open/persistent. | unknown | |
d17213 | val | Based on the code in my answer to your previous question
You can simply create an array of arrays and put each array into its own section in the collection view:
struct City {
var name: String
var imageName: String
}
class firstViewController: UIViewController // Or UICollectionViewController
let cities = [City(name:"City00", imageName:"city_00"),
City(name:"City01", imageName:"city_01"),
City(name:"City02", imageName:"city_02")]
let towns = [City(name:"Town00", imageName:"town_00"),
City(name:"Town01", imageName:"town_01"),
City(name:"Town02", imageName:"town_02")]
let villages = [City(name:"Village00", imageName:"village_00"),
City(name:"Village01", imageName:"village_01"),
City(name:"Village02", imageName:"village_02")]
let allPlaces = [cities, towns, villages]
func numberOfSections(in collectionView: UICollectionView) -> Int {
return self.allPlaces.count
}
func collectionView(_ collectionView: UICollectionView,
numberOfItemsInSection section: Int) -> Int {
let places = self.allPlaces[section]
return places.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell{
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "cell", for: indexPath)
as! CollectionViewCell
let places = self.allCities[indexPath.section]
let city = places[indexPath.item]
cell.imageView?.image = UIImage(named:city.imageName)
return cell
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "showOptions" {
if let indexPaths = self.collectionView!.indexPathsForSelectedItems {
if let cityVC = segue.destination as? CitySelectViewController {
var selectedCities = [City]()
for indexPath in indexPaths {
let places = self.allPlaces[indexPath.section]
selectedCities.append(places[indexPath.item])
}
cityVC.selectedCities = selectedCities
}
}
}
}
A: first of all your selectedImage is never filled (or at least in the code you provide) so its always an empty dictionary. secondly why you downcast IndexPath to NSIndexpath in cellForItemAt?
cell.imageView?.image = imageSelected[(indexPath as NSIndexPath).row]
also your dictionary is type of [String : UIImage] and you're treating it as [Int : UIImage].
also when you are going to use indexpath you can use array instead of [Int, UIImage]. | unknown | |
d17214 | val | probably in this line of code
this.products.remove(this.products.get(rowIndex)
rowIndex return null or zero value because check and debug this line my friend
A: The code I posted if fine and it works. The problem was due to a shadow reference -that is I was having two instances of my table.This answers why I was getting -1 when calling getSelectedRow()-the possible reason to my question why I was having this value yet I was adding rows to my table.In simple terms - I was adding rows to myTable1OnTheScreenand calling deleteSelectedRow()on myTable2ThatHasNoRowsAddedToIt hence, getSelectedRow()would return -1 because it was refering to myTable2ThatHasNoRowsAddedToIt. | unknown | |
d17215 | val | select R.ReportID,
D.V as DateString
from #ReportSpecs as R
cross apply (select cast(R.ReportSpec as xml)) as X(R)
cross apply X.R.nodes('//@*, //*/text()') as T(X)
cross apply (select T.X.value('.', 'varchar(max)')) as D(V)
where charindex('/20', D.V) > 0
Result:
ReportID DateString
----------- --------------------------
136 8/16/2002
136 8/23/2002
136 8/16/2002
136 8/23/2002
311 3/25/2002
311 4/4/2002
311 3/25/2002
311 4/4/2002
1131 " CREATEDATE="12/7/2009"> | unknown | |
d17216 | val | It works if you add it to the children of properties rather than the property node-list. Ie change:
site.properties.property.add( 0, newNode )
To
site.properties[0].children().add( 0, newNode ) | unknown | |
d17217 | val | Just use pool.banks in the iteration of your view. Your controller is wrong because you try to find banks of multiple pools.
<% @pools.each do |pool| %>
<li><%= pool.name %> </li>
<ul>
<% pool.banks.each do |bank| %>
<%= bank.name %>
<% end %>
</ul>
<% end %> | unknown | |
d17218 | val | Create date object:
var currentdate = new Date("01-"+currentmonth)
Set last day of month using setFullYear, getFullYear and getMonth methods:
currentdate.setFullYear(test.getFullYear(), test.getMonth()+1, 0) | unknown | |
d17219 | val | The behaviour you describe, using a pl/sql process which references a page item from another page will work fine, but there are some things to take into account. Not sure if this list is exhaustive, others might comment:
*
*Personally I try to avoid references to items on other pages within a page, because that makes developing harder - when working on page x, you'll usually search for item occurences within page only . If there are occurences on other pages the application becomes less clean. I try to follow this as a best practice. The cleaner the app, the easier to maintain. When you have to work in this app 2 years from now, you won't remember that P1_SOME_VALUE is referenced on page 2. Or that other developer who works on it will hate you forever ;)
*This can possibly make debugging a lot harder. Suppose page is accessed via a url or branch that has the option "clear cache for pages" set to "page 1", then the value of P1_SOME_VALUE will be cleared because that item is defined on page 1. Debugging this issue will be a challenge.
*Passing a value in a url is very secure. If you use checksums, there is no way for a user to manipulate the value of the page item manually.
*Note that the DOM of the page only contains the page items that are defined on that page. This implies that you cannot use javascript on page 2 that references P1_SOME_VALUE or set the value of P1_SOME_VALUE using javascript on page 2. This doesn't matter in your use case.
An alternative to referencing page items in another page than the page they belong to is storing the data in a collection - that will exist for the duration of the session. | unknown | |
d17220 | val | Maybe try to use in_array() method
php.net in_array()
A: Try to use references like this:
$rank0 =& $hand[0]['rank'];
$rank1 =& $hand[1]['rank'];
if (
($rank0 == "A" && $rank1 == "A")
|| (...)
Just, as the first step to code minimization | unknown | |
d17221 | val | : is same as slice(None, None, None)
A[0, -1, :] is same as
obj = (0, -1, slice(None, None, None))
A[obj] | unknown | |
d17222 | val | I created a sample progress bar with Bootstrap, jQuery & momentjs. Hope this will help you.
$(document).ready(function(){
var start = moment('2020-02-21 05:38:33');
var end = moment('2020-02-21 20:00:00');
var formattedPercentage = 0;
var interval = setInterval(function(){
var now = moment();
var percentage = now.diff(start) / end.diff(start) * 100;
if (percentage > 100) {
formattedPercentage = 100;
clearInterval(interval);
} else {
formattedPercentage = percentage.toFixed(2);
}
// Use formattedPercentage as you need
$('#example-progress-bar .progress-bar').width(formattedPercentage+'%').html(formattedPercentage+'%')
}, 500);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet"/>
<div id="example-progress-bar" class="progress">
<div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div> | unknown | |
d17223 | val | Short answer: it's not possible to do what you're asking for, as array keys must be unique.
I would suggest, during your combining logic, to create an array of AssesmentQuestions and AssesmentAnswers, e.g.:
Array
(
[0] => Array
(
[id] => 1,
[AssesmentQuestions] => Array
(
[0] => 1,
[1] => 2
),
[AssesmentAnswers] => Array
(
[0] => 0,
[1] => 2
)
)
)
A: You can use foreach loop to achieve this :
$main_arr = array
(
array
(
'AssessmentQuestion' => 1,
'AssessmentAnswer' => 0,
'id' => 1
),
array
(
'AssessmentQuestion' => 2,
'AssessmentAnswer' => 2,
'id'=> 1
),
array
(
'AssessmentQuestion' => 3,
'AssessmentAnswer' => 4,
'id' => 2
),
array
(
'AssessmentQuestion' => 5,
'AssessmentAnswer' => 6,
'id'=> 1
)
);
foreach ($main_arr as $arr) {
$new_arr[$arr['id']]['id'] = $arr['id'];
$new_arr[$arr['id']]['AssessmentQuestions'][] = $arr['AssessmentQuestion'];
$new_arr[$arr['id']]['AssessmentAnswers'][] = $arr['AssessmentAnswer'];
}
var_dump($new_arr); | unknown | |
d17224 | val | Possible explanations:
*
*You have your warning level turned right down.
*You're using precompiled headers that are including the right files.
A: The declaration of your tolower() is in fact included. It could be so in one of the following ways:
*
*<cctype> or <ctype.h> is included in one of the headers (even standard headers) that you have included. The standard does not forbid standard headers to include other standard headers
*one of the headers you have included has the declaration of that funciton. For example, <algorithm> could have int tolower(int); somewhere in its code.
You cannot forbid this behavior. What you can do is learn where the function has to be defined/declared and never rely on inclusion of that header by other headers. You know where tolower is declared, so do include <cctype> every time you use this function. | unknown | |
d17225 | val | You can find all leds of your device under
/sys/class/leds/
In my case, I have the following leds
amber
button-backlight
flashlight
green
lcd-backlight
If I have a look inside "green", I see
> cd green
> ls
blink
brightness
currents
device
lut_coefficient
max_brightness
off_timer
power
pwm_coefficient
subsystem
trigger
uevent
These files are interfaces to the kernel module, which controls leds. In this case, I think they are char-devices. You can use the command "echo" and "cat" to communicate with the kernel module. Here an example..
echo 1 > brightness # Turn on led
echo 0 > brightness # Turn off led
For implementing a "heartbeat" pulse as you mentioned, I would have a look into "blink". If you not want to perform reverse engineering, this could be a good entry point to check what happens in the kernel leds-gpio.c | unknown | |
d17226 | val | mainloop() should be called on a tk.Tk object but in your code app is a tk.Frame object. So, try ...
root.mainloop() | unknown | |
d17227 | val | As the error is indicating, you need to transform your array from 3-d to a 2-d. You can do this by using thereshape function passing the total amount of pixels to one axis (430*430).
np.random.seed(42)
four_img_concat = np.random.randint(0,255,size=(430,430,3))
print(four_img_concat.shape) # (430, 430, 3)
four_img_concat = np.reshape(four_img_concat, (430*430, -1))
print(four_img_concat.shape) # (184900, 3)
ans = np.array(four_img_concat)
headers = np.array(['r','g','b'])
df = pd.DataFrame(ans)
df.to_csv("answ.csv",index=False,header=headers)
answ.csv file
r,g,b
102,179,92
14,106,71
188,20,102
121,210,214
74,202,87
...
... | unknown | |
d17228 | val | Their is one easiest way to develop multi language app by using string file. only you need to make different string file for each languages and then use NSLocalizedString to use current language. For Ex:
UIlabel *label;
label.text= NSLocalizedString(@"Key", nil);
and in Localizable.strings (english) string file it will be defined as
"Key"="English Name";
and in Localizable.strings (german) string file it will be defined as
"Key"="german Name";
It will automatically set the value of current language on uilabel from device.
And you can localize the xib directly , it will create different xib for each language and set the text accordingly. | unknown | |
d17229 | val | If you really want to have it working on all devices, I suggest you this approach:
*
*Set up Firebase messaging
*Subscribe all devices to specific topic e.g. "UPDATE_LOCATION"
*Extend FirebaseMessagingService and implement onMessageReceive()
*If your data message contains instruction to update location, call the method to update location from onMessageReceive()
*Trigger recurring messages to "UPDATE_LOCATION" topic from Firebase (CRON job or scheduled tasks)
It's a little more work that methods you have already tried, but it works on all phones and also after device restart and system update.
Additional plus is that you have control over the location updater from your backend (not per device which relies on app update). | unknown | |
d17230 | val | Since it's a GET request, this should work:
var busqueda = document.getElementById('search_keywords').value;
xmlhttp.open("GET","{{ path('searchCorreos', {'page': thisPage}) }}&search=" + busqueda,true);
xmlhttp.send();
A: If you run into this problem more often (needing to append javascript variables to symfony generated paths/urls) you can make use of the FOSJsRoutingBundle: https://github.com/FriendsOfSymfony/FOSJsRoutingBundle
This allows you to do the following in your javascript source:
var busqueda = document.getElementById('search_keywords').value;
var path = Routing.generate('searchCorreos', { page: 'thisPage', search: busqueda });
xmlhttp.open("GET", path, true);
xmlhttp.send(); | unknown | |
d17231 | val | Group coordinator Unavailability is the main cause of this issue.
Group coordinator is Unavailable --
This issue is already raised in the KAFKA Community (KAFKA-7017).
You can fix this by deleting the topic _offset_topics and restart the cluster.
You can go through the following to get few more details.
https://www.stuckintheloop.com/posts/my_first_kafka_outage/
A: @Rohit Yadav, Thanks for the answer, I have replaced a consumer group for the time being and I am working very well. But now the client has another problem, continuous output:
2019-11-05 14:11:14.892 INFO org.apache.kafka.clients.FetchSessionHandler - [Consumer clientId=consumer-1, groupId=fs-sales-be] Error sending fetch request (sessionId=2035993355, epoch=1) to node 4: org.apache.kafka.common.errors.DisconnectException.
2019-11-05 14:11:14.892 INFO org.apache.kafka.clients.FetchSessionHandler - [Consumer clientId=consumer-1, groupId=fs-sales-be] Error sending fetch request (sessionId=181175071, epoch=INITIAL) to node 5: org.apache.kafka.common.errors.DisconnectException.
What is this caused by this? 4, 5 node status is OK | unknown | |
d17232 | val | I suspect you haven't used the enum anywhere in the contract. Unless you have, there is no reason that it would be included in the graph that it builds by walking members from the root contract type. It will not be included just because it is nested: it needs to be actually used somewhere. | unknown | |
d17233 | val | Try changing in your routes.rb file to this:
authenticate :user do
mount Sidekiq::Web, at: "/sidekiq"
end
Also notice that :user refers to your app user model. If your user model has another name, let's say :admin, you should replace :user to :admin in the snipped code above.
A: try this inside of your routes:
Sidekiq::Web.use Rack::Auth::Basic do |username, password|
username == USERNAME && password == PASSWORD
end if Rails.env.production?
mount Sidekiq::Web, at: "/sidekiq" | unknown | |
d17234 | val | We figured out what went wrong and how to fix it.
First off, since the app is sandboxed it's technically impossible that we caused this with our code. However, according to a user, there was a plist file (named after our app) in the LauchAgents directory that caused the restarting of our app. After deleting that file, everything was fine again. As to why this entry existed in the first place and how it got there: ¯\ _(ツ)_/¯
Hope this helps anyone who has the same problem.
A: We haven't seen this exact issue, but something similar where we overrode the - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender method.
And in certain circumstances we were returning NSTerminateLater or 'NSTerminateCancelinstead ofNSTerminateNow`. In turn, the application would continue running even after the user told us to quit. | unknown | |
d17235 | val | You have to use aggregation framework.
Check this:
db.mongo.aggregate(
{ $unwind: '$scores' },
{ $match: {
'scores.categoryList': 'Bar'
}},
{ $sort: {
'scores.weight': -1
}}
) | unknown | |
d17236 | val | That exception is lost in ActiveMQ at the moment (don't know about Mule) but it is reported to the log as error.
It would make a good enhancement, remembering the string form of the exception in the ActiveMQConsumer and passing it back to the broker with the poison Ack that forces it to go to
the DLQ. In that way, it could be remembered as a message property in the resulting DLQ message.
How would you like to handle the exception, have it reported to a connection exception listener or have it recorded in the DLQ message? | unknown | |
d17237 | val | You could use @QueryParam. Take a look here | unknown | |
d17238 | val | sed 's#\?version.*\"#\?versionMyVersionHere\"#g'
Demo :
$echo -e '<script src="js/script.js?versionSomeVersionHere"></script>
<script src="js/messages.js?version"></script>' | sed 's#\?version.*\"#\?versionMyVersionHere\"#g'
<script src="js/script.js?versionMyVersionHere"></script>
<script src="js/messages.js?versionMyVersionHere"></script>
$
A: You may use:
sed -i 's/?version"/?versionMyVersionHere"/' index.html
Details:
*
*? doesn't need to be escaped in default BRE.
*Make sure to match trailing " in order to avoid matching partial word.
A: If you want to substitute all all occurrences of ?version for substitute in your file index.html, then execute the following command:
sed -i 's/?version"/?versionMyVersionHere"/' index.html | unknown | |
d17239 | val | In the docs readOnly you can set the config to readOnly
config.readOnly = true;
There is also an example that shows setting it via a method
editor.setReadOnly( true);
A: try with following lines,
<textarea id="editor1" name="editor1" ></textarea>
<textarea id="editor2" name="editor2" ></textarea>
<input type="button" onclick="EnableEditor2()" value="EnableEditor2" />
<script>
$(document).ready(function () {
//set editor1 readonly
CKEDITOR.replace('editor1', {readOnly:true});
CKEDITOR.replace('editor2');
//set editor2 readonly
CKEDITOR.instances.editor2.config.readOnly = true;
});
function EnableEditor2() {
CKEDITOR.instances.editor2.setReadOnly(false);
}
</script>
A: have you tried
this
?
they say, that this should work
var editor;
// The instanceReady event is fired, when an instance of CKEditor has finished
// its initialization.
CKEDITOR.on( 'instanceReady', function( ev )
{
editor = ev.editor;
// Show this "on" button.
document.getElementById( 'readOnlyOn' ).style.display = '';
// Event fired when the readOnly property changes.
editor.on( 'readOnly', function()
{
document.getElementById( 'readOnlyOn' ).style.display = this.readOnly ? 'none' : '';
document.getElementById( 'readOnlyOff' ).style.display = this.readOnly ? '' : 'none';
});
});
function toggleReadOnly( isReadOnly )
{
// Change the read-only state of the editor.
// http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.editor.html#setReadOnly
editor.setReadOnly( isReadOnly );
}
and html
<form action="sample_posteddata.php" method="post">
<p>
<textarea class="ckeditor" id="editor1" name="editor1" cols="100" rows="10"><p>This is some <strong>sample text</strong>. You are using <a href="http://ckeditor.com/">CKEditor</a>.</p></textarea>
</p>
<p>
<input id="readOnlyOn" onclick="toggleReadOnly();" type="button" value="Make it read-only" style="display:none" />
<input id="readOnlyOff" onclick="toggleReadOnly( false );" type="button" value="Make it editable again" style="display:none" />
</p>
</form>
A: In version 5 i do this:
ClassicEditor
.create( document.querySelector( '.editor' ), {
removePlugins: ['Title'],
licenseKey: '',
} )
.then( editor => {
window.editor = editor;
editor.isReadOnly = true;
} )
.catch( error => {
console.error( 'Oops, something went wrong!' );
console.error( 'Please, report the following error on https://github.com/ckeditor/ckeditor5/issues with the build id and the error stack trace:' );
console.warn( 'Build id: efxy8wt6qchd-qhxgzg9ulnyo' );
console.error( error );
} );
A: Sources :
http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html#.readOnly
http://rev.ckeditor.com/ckeditor/trunk/7657/_samples/readonly.html
CKEDITOR.config.readOnly = true;
A: Check this one out. The idea is if a user logs in a system with a classification other than 'BPPA', the CK editor shall be disabled and read-only. If the classification of a user is BPPA, thus the CK editor is editable. Note that these code fractions are actually in PHP. They need a working database to work but I figured you might get the idea and be able to work your own magic.
<?php
//This line is to disable PART A if classification != 'BPPA'
$bppa = mysql_query("SELECT * from roles WHERE username = '$_SESSION[username]'");
$bppa_row = mysql_fetch_array($bppa);
if($bppa_row['classification'] != 'BPPA'){
$disabled = 'disabled = "disabled"';
}else{
$disabled = "";
}
//ends here
?>
Then, apply $disable to your text area:
<?php
echo '<textarea class="ckeditor" '.$disabled.' name="content' . $n . '" id="content' . $n . '">' . $saved . '</textarea>';
?>
A: with version 4.5.4 you can do it with:
$('#idElement).ckeditorGet().setReadOnly(true);
A: In case you have several editors on the same page and you want to disable all of them on the page display :
CKEDITOR.on('instanceReady', function (ev) {
ev.editor.setReadOnly(true);
});
Documentation | unknown | |
d17240 | val | The obvious thing one would like to do is define cascade deletes on the association in the context. But trying it I found out that either sql server does not support it or EF needs help:
*
*Defining cascade delete on the foreign key constraint (using code-first) throws a sql server exception:
Introducing FOREIGN KEY constraint 'xxx' on table 'yyy' may cause cycles or multiple cascade paths. (See here.)
*Cascade delete in EF model: now when deleting a parent the child records are not deleted. Even worse: the FK fields are not nullified and the foreign key constraint violation will throw an exception. The remedy is to load the child collection before deleting the parent.
Especially when deleting a tree of navigationitems this is not a very attractive option, but I'm afraid it's all you've got at the moment. | unknown | |
d17241 | val | You have to put the code in your function.php between <?php and ?> tags.
As additional note: you can put all of these gallery' effects or only few of them on your site. For example if performance of your site is degrading you can delete or put // to
add_theme_support( 'wc-product-gallery-zoom' );
or to other effects. | unknown | |
d17242 | val | I would just check the time when you get to your conditional. This way it will check the time right before you are checking to see if an alarm should be raised. In my opinion this will be much simpler than having it run in the background the whole time. You don't need to make a new variable it would just look like this:
if time.ctime() == dataValue:
print("alarm Raise") | unknown | |
d17243 | val | Just found a solution for this.
Click on the branches tab shown below -
Delete your published banch from the list - | unknown | |
d17244 | val | Change your image to video to include a silent audio track:
-loop 1 -i image.jpg -f lavfi -i anullsrc -c:v libx264 -t 5 -pix_fmt yuv420p -crf 25 -s 1280x720 Out.mp4.
Concat filter requires paired inputs. | unknown | |
d17245 | val | But, using G1.subgraph(matching.keys()).edges is slower than the long way:
in_time = time.perf_counter()
g1_edge_list = []
for m in matchings:
m2 = {y: x for x, y in m.items()}
for e1, e2 in G2.edges:
g1_edge_list.append((m2[e1], m2[e2]))
out_time = time.perf_counter() - in_time
print(out_time)
in_time2 = time.perf_counter()
g1_edge_list = []
for m in matchings:
g1_edge_list += graph.subgraph(m.keys()).edges
out_time_2 = time.perf_counter() - in_time2
print(out_time_2)
It is approximately 12 times slower. @Timus | unknown | |
d17246 | val | i got here and still couldnt figure it out
so i ended up moving my vault code into my own lib which i include in the recipe so i couldnt mock it out during ChefSpec run.
so i have under my-cookbook/libraries/my_vault.rb with this code:
require 'vault'
module MyVault
module Helpers
def get_vault_secret(secret)
Vault.configure do |config|
config.address = "#{node[:vault_url]}"
config.token = "#{node[:vault_token]}"
end
Vault.logical.read(secret)
end
end
end
and in my recipe:
Chef::Recipe.send(:include, MyVault::Helpers)
creds = get_vault_secret("secret/jmx")
user = creds.data[:user]
password = creds.data[:password]
template "/etc/app/jmx.password" do
source "jmx.password.erb"
mode 0600
owner "dev"
group "dev"
variables({
:user => user,
:password => password
})
end
and my spec test:
require 'chefspec'
require 'chefspec/berkshelf'
describe 'app::metrics' do
platform 'ubuntu', '14.04'
before do
response = Object.new
allow(response).to receive_messages(:data => {
:user => "benzi",
:password => "benzi"
})
allow_any_instance_of(Chef::Recipe).to receive(:get_vault_secret).and_return(response)
end
describe 'adds jmx.access to app folder' do
it { is_expected.to create_template('/etc/app/jmx.access')
.with(
user: 'dev',
group: 'dev',
mode: 0644
) }
end
A: I responded to your email already, you want allow_any_instance_of(::Vault) and similar, and you may have to create the module (const_set(:Vault, Module.new)) if it doesn't exist already. | unknown | |
d17247 | val | I'll put my comments into an answer:
Can we open more than 2 websockets from the same page? Because i need
more as well to show some more live updates on my page.
Yes, you can, but you shouldn't need to. Why open more than one webSocket? It's just a communications channel. You can send different messages related to different topics over that one channel. You really shouldn't need multiple webSockets between the same page/server.
The general idea is that you don't just send data, but you send a message name and some data. Then, all receiving code can decide what to do based on the message name. You might be interested in socket.io which creates this format for you on top of webSocket, or you can do it yourself with webSocket as shown here.
If I get answer to my first two questions my last question is, right
now when a user uses a chat functionality the message goes to all the
users on that page irrespective of the event they are attending. So a
user attending an event1 send a message and user in the event2 gets
that message as well which is incorrect. Ideally users from event1 can
only seen messages from users attending event1. I other words, people
in the same chat room should only be able to chat with each other and
their messages should not go outside the chat room. How can I bind my
event id in the websocket with the people attending that event so that
the messages within the same event chat room remains within.
webSockets themselves don't have the "attending the event" capability you are asking for. With plain webSockets, you would have to keep track of which socket was in which event and when you want to send to an event, you send to only the connected webSockets associated with that event. It would be all your own code that would do that. Again, the socket.io library I mentioned above has this capability built-in. It sounds like what you really want. There is Java server support for socket.io too. socket.io has built-in chat rooms and the ability to broadcast to those in a given chat room. | unknown | |
d17248 | val | Thanks to Travis' innovation teams' efforts numba is a great and powerful tool for scientific computing. One shall however take a due care to use it where feasible and where jit-compilation can bring some fruit to our hard and fast lives.
Numba Documentation states this explicitly, saying:
2.4.1.1. Constructs
Numba strives to support as much of the Python language as possible, but some language features are not available inside Numba-compiled functions:- Function definition-
Class definition-
Exception handling (try .. except, try .. finally)-
Context management (the with statement)-
Comprehensions (either list, dict, set or generator comprehensions)-
Generator delegation (yield from)
The raise statement is supported in several forms:
raise (to re-raise the current exception)
raise SomeException
raise SomeException(<arguments>): in nopython mode, constructor arguments must be compile-time constants
Similarly, the assert statement is supported with or without an error message. | unknown | |
d17249 | val | Take a look at this setup https://github.com/kurtzace/python-spark-avro-query (dockerfile within it)
*
*This solution loads avro jar into spark jars
*sets up spark home
*also exposes the avro file as an API (main.py) | unknown | |
d17250 | val | AFAIK this is still an issue and plotly will fail in such situation. There is still an open issue at github: Support for Pandas Time spans as index col.
As proposed in the comments one of the solution is to use to_timestatmp conversion, see this.
*
*Create MWE (this is just for reproducibility since there is no data provided in the question)
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.offline as pyo
df = pd.DataFrame({"one": np.random.random(10)}, index=pd.period_range("2020-03-01", freq="M", periods=10))
# Out:
# one
# 2020-03 0.302359
# 2020-04 0.919923
# 2020-05 0.673808
# 2020-06 0.718974
# 2020-07 0.754675
# 2020-08 0.731673
# 2020-09 0.772382
# 2020-10 0.654555
# 2020-11 0.549314
# 2020-12 0.101696
data = [
go.Scatter(
x=df.index,
y=df["one"],
)
]
fig = go.Figure(data=data)
pyo.iplot(fig)
# -> will fail ("TypeError: Object of type Period is not JSON serializable")
*Use to_timestamp conversion (-> df.index.to_timestamp())
data = [
go.Scatter(
x=df.index.to_timestamp(), # period to datetime conversion
y=df["one"],
)
]
fig = go.Figure(data=data)
pyo.iplot(fig)
Or, if you do not need datetime format you can convert this to string as well:
data = [
go.Scatter(
x=df.index.strftime("%Y-%m"), # You can define your own format
y=df["one"],
)
]
fig = go.Figure(data=data)
pyo.iplot(fig)
You can of course do this conversion right on the original dataframe (so you do not need to do it iteratively inside go.Scatter), but this is just minor stuff. There might be also a way of using custom encoder instead of the default one, but I think it's not worthy of trying and afaik there is no better solution than using one of possible conversion from Period to datetime or string. | unknown | |
d17251 | val | as mentioned in the documentation: you will need to use tostring on the internal property bag.
i.e. parse_json(tostring(parse_json(customDimensions).CurrentPluginContext))
A: traces | order by timestamp desc
| project CurrentContext = parse_json(customDimensions.CurrentPluginContext)
| extend Source = parse_json(tostring(CurrentContext)).source
| project Source | unknown | |
d17252 | val | Try this
boolean use24HourClock = DateFormat.is24HourFormat(getApplicationContext());
Returns true if user preference is set to 24-hour format.
See more about DateFormat here
A: Try this
public static boolean usesAmPm(Locale locale)
{
String pattern = DateTimeFormatterBuilder.getLocalizedDateTimePattern(
FormatStyle.MEDIUM, FormatStyle.MEDIUM, IsoChronology.INSTANCE, locale);
return pattern.contains("a");
} | unknown | |
d17253 | val | I'd recommend implementing a URL-shortener API (ie: bit.ly). Even further, there are API wrappers available for most of these popular services (ie: Python API wrapper for bit.ly - http://code.google.com/p/python-bitly/). | unknown | |
d17254 | val | Since my storage mechanism has failed, can SES provide me with a history of email addresses to which an email was sent to?
No unfortunately, unless you previously configured it to do so.
Checking anything at a granular level within SES - including email sending/delivery - can only be done using event publishing.
Also, event publishing cannot be backdated so if you enable it now, it will also only work for emails sent from this point onwards. | unknown | |
d17255 | val | You can try use xpath selectors, for example
within(:xpath, "//table/tr[1]/td") do
page.should have_content('First row content')
end
within(:xpath, "//table/tr[2]/td") do
page.should have_content('Second row content')
end | unknown | |
d17256 | val | You have to order the rows accordingly:
DataRow dRow = dsMain.tblStudentMaster.AsEnumerable()
.OrderByDescending(r => r.Field<int>("StudentRollNo"))
.FirstOrDefault();
(assuming that the type of the column StudentRollNo is int)
A: You can also try MaxBy extension method from MoreLINQ
dsMain.tblStudentMaster.MaxBy(item => item.FieldYouWantMaxFrom); | unknown | |
d17257 | val | Is that true?
Yes.
Is there any step I can take to further understand the structure of the data sent from my device to the remote server?
The captured packet includes an Ethernet Ⅱ header and an IPv4 header and a UDP header as follows:
Ethernet Ⅱ: from 20:e5:2a:4f:b9:4f (NETGEAR) to 44:80:eb:ea:ef:9b (Motorola)
IPv4: from 169.55.244.58 to 192.168.1.12, not fragmented
UDP: from port 14242 to port 48818, payload length=1406 bytes
The right chunk of the 3rd line (i.e. bb 19 43 4f 02 c8 2b a3) is the start of the application data.
To analyze the application data, you need to know what protocol the application used to send the packet and to learn the protocol. | unknown | |
d17258 | val | OK, apparently I needed to call "web->deleteLater();" before calling
"this->close();". The "delete web;" was uneeded. Still, I'd like to know why delete doesn't work in this case...
A: You are creating QWebEngineView with parent "this" (owner) so you don't have to delete it yourself, it will be automatically deleted when it parent will. See Qt documentation about memory management :
http://doc.qt.io/qt-5/objecttrees.html
it is also dangerous doing that, because if you don't create the QWebEngineView object using doWeb(QString link), you will try to delete something that doesn't exist and therefore it can lead you to undefined behavior.
remove delete web from your destructor and see if you always have the problem.
Edit :
The reason why it is not destroyed : you aren't destroying SubWindow Object (the owner of QWebEngineView Object). You can Verify it yourself by printing something in the destructor.
If you were destroying SubWindow object, the second time you push the button in MainWindow, your application will crashes. Since you aren't creating the SubWindow object inside your function on_push_button, but inside MainWindow::init. Your SubWindow Object is only hidden and not destroyed. It is destroyed only when you close the MainWindow. You are also Creating an instance of QWebEngineview each time you show sub (SubWindow Object), so if you show sub 3 times you will have 3 QWebEngineView inside your Subwindow.
the changes i would do to the code :
main.cpp
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
mainWindow.h
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "subwindow.h"
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_pushButton_clicked();
private:
Ui::MainWindow *ui;
SubWindow* sub;
};
#endif
mainWindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow), sub(new SubWindow(this))
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
sub->show();
sub->doWeb(ui->lineEdit->text());
}
subWindow.h
#ifndef SUBWINDOW_H
#define SUBWINDOW_H
#include <QMainWindow>
#include <QtWebEngineWidgets/qwebengineview.h>
#include <QTimer>
namespace Ui
{
class SubWindow;
}
class SubWindow : public QMainWindow
{
Q_OBJECT
public:
explicit SubWindow(QWidget *parent = 0);
void doWeb(QString link);
~SubWindow();
private:
Ui::SubWindow *ui;
QWebEngineView *web;
private slots:
void on_pushButton_clicked();
};
#endif // SUBWINDOW_H
subWindow.cpp
#include "subwindow.h"
#include "ui_subwindow.h"
SubWindow::SubWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::SubWindow),
web(new QWebEngineView(this))
{
ui->setupUi(this);
ui->verticalLayout->addWidget(web);
}
void SubWindow::doWeb(QString link)
{
web->load(QUrl(link, QUrl::TolerantMode));
}
SubWindow::~SubWindow()
{
delete ui;
}
void SubWindow::on_pushButton_clicked()
{
this->close(); //Artifact for testing purposes.
}
Note that i am also not destroying subWindow object, but i m not creating QWebView each time i call the method SubWindow::doWeb(String).
If it was up to me i would use a Subclassed Dialog that is not a member of MainWindow, the object would be created inside MainWindow::on_pushButton_clicked() and destroyed when i finish using it.
A: Looks like something was not closed correctly.
I was using Qt 5.15 using the kit MSVC2019 32bit compiler. But Visual Studio 2017 (and not 2019) was installed on my computer. Thus, the compiler detected in Qt creator -> project -> manage kit -> compiler was the one of MSVC2017 i.e : Microsoft visual C++ compiler 15.8 (x86).
The solution is to install visual Studio 2019 and then replace Qt creator by the correct compiler (2019) i.e: Microsoft visual c++ compiler 16.7 (X86).
Then I could compile without any leak of memory anymore. | unknown | |
d17259 | val | I don't believe that it's possible. If you compare Express to Standard, expand the Reporting node, you will see Model Support is unchecked for Express. Report Builder 1.0 only worked on prebuilt models so by extension, I'm assuming that bullet continues to address models and the report builder.
I never install Express so I can't dig around and verify it.
If the Report Builder button is not showing, verify the accessing account has Report Builder role or better. Predefined SSRS Roles in 2008 R2
A: I can confirm that this feature is not available in the express edition - you will also not be able to create a report model. | unknown | |
d17260 | val | There are mainly 3 different types of executables:
*
*A console application is reading from stdin or a file and writing to stdout or a file and outputs error messages to stderr.
The processing of a batch file is halted on starting a console application until the console application terminated itself. The correct term is therefore: calling a console application.
The exit code of the console application is assigned to environment variable ERRORLEVEL and can be also directly evaluated for example with if errorlevel X rem do something
Many *.exe in System32 directory of Windows are such console applications, like find.exe, findstr.exe, ping.exe, ...
*A GUI (graphical user interface) application is started as new process which means the Windows command processor does not halt batch processing until the GUI application terminates itself.
It is not easily possible to get something from within a command process from such applications. GUI applications are designed for interacting via a graphical user interface with a user and not via standard streams or files with a command process.
A typical example for such applications is Windows Explorer explorer.exe in Windows directory.
*A hybrid application supports both interfaces and can be therefore used from within a command process as well as by a user via GUI.
Hybrid applications are rare because not easy to code. The behavior of hybrid applications on usage from within a batch file must be find out by testing.
Example for such applications are Windows Registry Editor regedit.exe or shareware archiver tool WinRAR WinRAR.exe.
It is best to look on simple examples to see the differences regarding starting/calling all 3 types of applications from within a batch file.
Example for console application:
@echo off
cls
%SystemRoot%\System32\ping.exe 127.0.0.1 -n 5
echo.
echo Ping finished pinging the own computer (localhost).
echo.
pause
The command processing is halted until ping.exe terminated itself which takes 4 seconds. There is no need for start or call for such applications, except the console application should be intentionally executed in a separate process.
Example for a GUI application:
@echo off
cls
%WinDir%\Explorer.exe
echo.
echo Windows Explorer opened and is still running!
echo.
pause
This batch file outputs the text and message prompt to press any key immediately after starting Windows Explorer indicating that Windows Explorer was started as separate process and Windows command processor immediately continued on the next lines of the batch file. So although Windows Explorer was started and is still running, the batch processing continued, too.
Example for a hybrid application:
@echo off
cls
"%ProgramFiles%\WinRAR\WinRAR.exe"
echo.
echo User exited WinRAR.
echo.
pause
This batch file starts WinRAR without any parameter (usually not useful from within a batch file) if being installed at all in default installation directory. But batch processing is halted until the user exited WinRAR for example by clicking on X symbol of the WinRAR´s application window.
But opening a command prompt window and executing from within the window
"%ProgramFiles%\WinRAR\WinRAR.exe"
results in getting immediately the prompt back in command window to type and execute the next command. So WinRAR finds out what is the parent process and acts accordingly.
Windows Registry Editor shows the same behavior. Executing from within a command prompt window
%WinDir%\regedit.exe
results in opening Windows Registry Editor, but next command can be immediately entered in command prompt window. But using this command in a batch file results in halting batch processing until GUI window of Windows Registry Editor is closed by the user.
Therefore hybrid applications are used from within a batch file mainly with parameters to avoid the necessity of user interaction.
Okay, back to the question after this brief lesson about various types of applications.
First suggestion is using
Result\TextFileName.txt
instead of
Result/TextFileName.txt
as the directory separator on Windows is the backslash character, except the executables require forward slashes as directory separator because of being badly ported from Unix/Linux to Windows.
Second suggestion is finding out type of application. Is command start really necessary because the applications don't start itself in a separate process and need user interaction to terminate itself?
Note: Command start interprets first double quoted string as title string. Therefore it is always good to specify as first parameter "" (empty title string) on starting a GUI or hybrid application as a separate process. On starting a console application as a separate process it is in general a good idea to give the console window a meaningful title.
And last if the started applications really would need user interaction to terminate, it would be definitely better to either start and kill them after waiting 1 or more seconds between start and kill or start them all, wait a few seconds and finally kill them all at once.
Example for first solution with starting and killing each application separately:
@echo off
setlocal
set TimeoutInSeconds=3
call :RunApp IEPassView
call :RunApp MailPassView
call :RunApp MessenPass
call :RunApp RouterPassView
call :RunApp ProtectedStoragePassView
call :RunApp DialUpPassView
endlocal
goto :EOF
:RunApp
start "" "%~1.exe" /stext "Results\%~1.txt"
set /A RetryNumber=TimeoutInSeconds + 1
%SystemRoot%\System32\ping.exe 127.0.0.1 -n %RetryNumber% >nul
%SystemRoot%\System32\taskkill.exe /f /im "%~1.exe"
goto :EOF
It is also possible to use timeout instead of ping for the delay if the batch file is only for Windows Vista and later Windows versions.
Example for second solution with starting all applications, wait some seconds and kill them finally all:
@echo off
call :StartApp IEPassView
call :StartApp MailPassView
call :StartApp MessenPass
call :StartApp RouterPassView
call :StartApp ProtectedStoragePassView
call :StartApp DialUpPassView
%SystemRoot%\System32\ping.exe 127.0.0.1 -n 6 >nul
call :KillApp IEPassView
call :KillApp MailPassView
call :KillApp MessenPass
call :KillApp RouterPassView
call :KillApp ProtectedStoragePassView
call :KillApp DialUpPassView
goto :EOF
:StartApp
start "" "%~1.exe" /stext "Results\%~1.txt"
goto :EOF
:KillApp
%SystemRoot%\System32\taskkill.exe /f /im "%~1.exe"
goto :EOF
For understanding the used commands and how they work, open a command prompt window, execute there the following commands, and read entirely all help pages displayed for each command very carefully.
*
*call /?
*echo /?
*endlocal /?
*goto /?
*ping /?
*set /?
*setlocal /?
*start /?
*taskkill /?
See also the Microsoft article about Using command redirection operators.
PS: The last two batch code blocks were not tested by me because of not having available the applications.
A: I suggest killing all tasks at once, at the end of the very end, possibly after a timeout command with a amount of time appropriate to your system's speed. That may help the issue. | unknown | |
d17261 | val | use filter.
a='A B C D \n EF G'
b=" ".join(list(filter(None,a.split(" "))))
print(b)
A: You could use a pattern to match 2 or more whitespace chars without the newline, and in the replacement use a single space.
[^\S\r\n]{2,}
Regex demo | Python demo
For example
import re
s = 'A B C D \n EF G'
print(re.sub(r"[^\S\r\n]{2,}", " ", s))
Output
A B C D
EF G
A: Try using regex.
Split the string by '\n' and then combine multiple whitespace into 1 whitespace.
import re
comb_whitespace = re.compile(r"\s+")
for i in s.split('\n'):
print(comb_whitespace.sub(" ", i))
A B C D
EF G
A: It’s need to add \n split
s = 'A B C D \n EF G'
print(s)
s = " ".join(s.split())
s = " ".join(s.split('\n'))
print(s)
Outs
A B C D
EF G
A B C D EF G | unknown | |
d17262 | val | Provided that test also has a column of the variable you are predicting you can just run something like
test$prediction <- prob
Then both the actual outcome as well as your prediction are in the same data.frame and you can easily plot them
test <- test[order(test$prediction, decreasing = TRUE),]
test$id = seq(nrow(test),1)
library(ggplot2)
ggplot(data = test) +
geom_line(aes(x = id, y = prediction)) +
geom_point(aes(x = id, y = direction))
Naturally this is a less beautiful graph than in an ordinary regression model because your dependant variable is binary. | unknown | |
d17263 | val | In VBScript you could do it like this:
src = "C:\source\folder"
dst = "C:\destination\folder"
Set fso = CreateObject("Scripting.FileSystemObject")
mostRecent = Array(Nothing, Nothing)
For Each f In fso.GetFolder(src).Files
If LCase(fso.GetExtensionName(f.Name)) = "sch" Then
If mostRecent(0) Is Nothing Then
Set mostRecent(0) = f
ElseIf f.DateLastModified > mostRecent(0).DateLastModified Then
Set mostRecent(1) = mostRecent(0)
Set mostRecent(0) = f
ElseIf mostRecent(1) Is Nothing Or f.DateLastModified > mostRecent(1).DateLastModified Then
Set mostRecent(1) = f
End If
End If
Next
For i = 0 To 1
If Not mostRecent(i) Is Nothing Then mostRecent(i).Copy dst & "\"
Next
Edit: The above code isn't too extensible, though. If you need more than just the most recent 2 files you may want to take a slightly different approach. Create an array the size of the number of files you want to handle, and do a sorted insert as long as you have free slots or the current file is newer than the oldest file already in the array.
src = "C:\source\folder"
dst = "C:\destination\folder"
num = 2
last = num-1
Function IsNewer(a, b)
IsNewer = False
If b Is Nothing Then
IsNewer = True
Exit Function
End If
If a.DateLastModified > b.DateLastModified Then IsNewer = True
End Function
Set fso = CreateObject("Scripting.FileSystemObject")
ReDim mostRecent(last)
For i = 0 To last
Set mostRecent(i) = Nothing
Next
For Each f In fso.GetFolder(src).Files
If LCase(fso.GetExtensionName(f.Name)) = "sch" Then
If IsNewer(f, mostRecent(last)) Then Set mostRecent(last) = Nothing
For i = last To 1 Step -1
If Not IsNewer(f, mostRecent(i-1)) Then Exit For
If Not mostRecent(i-1) Is Nothing Then
Set mostRecent(i) = mostRecent(i-1)
Set mostRecent(i-1) = Nothing
End If
Next
If mostRecent(i) Is Nothing Then Set mostRecent(i) = f
End If
Next
For i = 0 To num-1
If Not mostRecent(i) Is Nothing Then mostRecent(i).Copy dst & "\"
Next
An alternative would be shelling out to the CMD-builtin dir command and reading its output:
num = 2
Set fso = CreateObject("Scripting.FileSystemObject")
Set sh = CreateObject("WScript.Shell")
cmd = "cmd /c dir /a-d /b /o-d """ & sh.CurrentDirectory & """\*.*"
Set dir = sh.Exec(cmd)
Do While dir.Status = 0
WScript.Sleep 100
Loop
i = num
Do Until i = 0 Or dir.StdOut.AtEndOfStream
f = dir.StdOut.ReadLine
fso.CopyFile f, dst & "\"
i = i - 1
Loop | unknown | |
d17264 | val | Using an invisible view is definitely not something you want to do. Look into the addGlobalMonitorForEventsMatchingMask:: class method on NSEvent.
For example, here's how you would add a monitor for a movement of the mouse:
[NSEvent addGlobalMonitorForEventsMatchingMask:NSMouseMovedMask handler:^(NSEvent *mouseMovedEvent) {
//do something with that event
}]; | unknown | |
d17265 | val | If your form1 is already present in the page, then why do you need to initialize it again? Just set the visible status to false to hide it.
mainFrm.Visible = false;
A: without seeing more of the code it's hard to answer, but you definitely need to reference the the old Form1 that is already visible and hide it. You are creating a new form and hiding it.
A: You have to define your Form2 class to store the reference to the main form.
public partial class Form2 : Form
{
/* reference to the main form will be stored here */
private Form1 _mainForm;
public Form2(Form1 mainForm)
{
InitializeComponent();
/* Initialize the main form field */
this._mainForm = mainForm;
}
private void button1_Click(object sender, EventArgs e)
{
/* Set the main form visibility to false */
_mainForm.Visible = false;
}
}
Now when you are creating the Form2 instance just add the main form to the constructor:
/* Show the form2 */
_form2 = new Form2(this);
_form2.Show();
Note: this will refer to the form that creates the Form2 object.
A: You could create a static form type property in your Form1 and set it when Form1 is Shown, and then use it to hide your form
Here is a code that worked for me.
private void button1_Click(object sender, EventArgs e)
{
var objForm1 = new Form1();
Form1.Fom1ref = objForm1;
objForm1.Show();
}
private void button2_Click(object sender, EventArgs e)
{
Form1.Fom1ref.Hide();
}
Here is the property that should be set in Form1.
public static Form Fom1ref { get; set; } | unknown | |
d17266 | val | Assuming that you'd like to redirect to some.xhtml which is placed in web root folder:
*
*You can just continue using plain HTML.
<a href="#{request.contextPath}/some.xhtml">go to some page</a>
For conditional rendering, just wrap it in an <ui:fragment>.
*Or use <h:link> with implicit navigation.
<h:link outcome="/some" value="go to some page" />
Note: no need to prepend context path nor to include FacesServlet mapping.
*Or use <h:commandLink> with ?faces-redirect=true.
<h:commandLink action="/some?faces-redirect=true" value="go to some page" />
Note: no need to prepend context path nor to include FacesServlet mapping.
*Or use <h:outputLink>, but you need to specify context path.
<h:outputLink value="#{request.contextPath}/some.xhtml" value="go to some page" />
Redirecting to an external URL is already answered in this duplicate: Redirect to external URL in JSF.
See also:
*
*How to navigate in JSF? How to make URL reflect current page (and not previous one)
*When should I use h:outputLink instead of h:commandLink?
*JSF implicit vs. explicit navigation | unknown | |
d17267 | val | Use
x = ((double) w[i]) / l[i];
As it is, you're dividing two integers using integer division, and assigning the resulting int to a double. Casting one of the operands to a double makes it do a double division instead.
A: If you divide an int by another int you get an int not a double. Try
x = (double) w[i] / l[i];
A: System.out.printf("%10.4f", x);
Mind, only BigDecimal has precise precision. Doubles are approximations. | unknown | |
d17268 | val | I'm not sure why you are importing SimpleSlider/simple-slider.html, you should import ../bower_components/polymer-simple-slider/src/simple-slider.html
I have created example project where it's working:
https://github.com/mkubenka/polymer-simple-slider-example | unknown | |
d17269 | val | The method's parameter has no generic so all classes are allowed.
You may google 'type erasure' for more information.
If you add the generic type to your method you will get a compiler error:
private static ArrayList<String> tricky(ArrayList<String> list) { // ...
By the way, you do not need to return the list because you modify the same instance.
A: Here's why:
The reason you can get away with compiling this for arrays is because
there is a runtime exception (ArrayStoreException) that will prevent
you from putting the wrong type of object into an array. If you send a
Dog array into the method that takes an Animal array, and you add only
Dogs (including Dog subtypes, of course) into the array now referenced
by Animal, no problem. But if you DO try to add a Cat to the object
that is actually a Dog array, you'll get the exception. Generic
Methods (Exam Objectives 6.3 and 6.4) 615 616 Chapter 7: Generics and
Collections
But there IS no equivalent exception for generics, because
of type erasure! In other words, at runtime the JVM KNOWS the type of
arrays, but does NOT know the type of a collection. All the generic
type information is removed during compilation, so by the time it gets
to the JVM, there is simply no way to recognize the disaster of
putting a Cat into an ArrayList and vice versa (and it becomes
exactly like the problems you have when you use legacy, non-type safe
code)
Courtesy : SCJP Study guide by Kathy Sierra and Bert Bates
A: When you declare you ArrayList like ArrayList list = ... you do not declare the type of object your list will contain. By default, since every type has Object as superclass, it is an ArrayList<Object>.
For good practices, you should declare the type of your ArrayList<SomeType> and, thereby, avoid adding inconsistant elements (according to the type)
A: Because you haven't defined the generic type of your list it defaults to List<Object> which accepts anything that extends Object.
Thanks to auto-boxing a primitive int is converted to an Integer, which extends Object, when it is added to your list.
Your array only allows int's, so String's are not allowed.
A: This is because in your method parameter you did not specify a particular type for ArrayList so by default it can accept all type of objects.
import java.util.ArrayList;
public class Test {
//Specify which type of objects you want to store in Arraylist
private static ArrayList tricky(ArrayList<String> list) {
list.add(12345); //This will give compile time error now
return list;
}
public static void main(String[] args) {
int i = 0;
ArrayList<String> list = new ArrayList();
list.add("String is King");
Test.tricky(list);
}
}
A: When you use the tricky method to insert data into your ArrayList Collection, it doesn't match the specified type i.e String, but still This is compatible because of Generics compatibility with older Legacy codes.
If it wouldn't have been for this i.e if it would have been the same way as of arrays, then all of the pre-java generic code would have been broken and all the codes would have to be re-written.
Remember one thing for generics, All your type-specifications are compile time restrictions, so when you use the tricky method to insert data in your list reference, what happens is the compiler thinks of it as a list to which ANYTHING apart from primitives can be added.
Only if you would have written this:
...
public class Test {
private static ArrayList tricky(ArrayList<String> list) {
list.add(12345); //Error, couldn't add Integer to String
return list;
}
...
}
I have written a documented post on this, Read here. | unknown | |
d17270 | val | I think in ios it not posible to get which apps are running in background, because in ios the which one is foreground this one the active running apps and other which one you are getting these all are background appps.
so, excluding your application name others are background apps.
A: I don't think it's ment to be possible, but others like you have been very involved in the same topic and come up with some workarounds. Read this blogpost for more info: http://www.amitay.us/blog/files/how_to_detect_installed_ios_apps.php | unknown | |
d17271 | val | Most frameworks use a Front-Controller instead of mod_rewrite. This controller splits apart the URL and routes accordingly.
While not the only solution, this is more flexible. Consider when you have the URL plugin/controller/view/id or controller/view/param1/param2.
If you want to adopt the Front-Controller architecture, I'd recommend using FallbackResource to keep your htaccess file trim.
FallbackResource /front-controller.php
From there it should be fairly straightforward to split apart the url with functions like parse_url().
A: use this:
RewriteRule ^([^\./]*)$ index.php?route=$1 [L,NC,QSA]
then
$route = explode('/', $_GET['route']);
$id = array_pop();
$controller = array_shift($route);
$method = implode('_', $route);
$controller = new $controller;
$controller->$method(); | unknown | |
d17272 | val | Yes! I stumbled on the answer inside another answer. Adding import std; at the top of the script stopped the error.
vcl 4.0;
import std;
sub vcl_init {
# ...
# Normalize query arguments
set req.url = std.querysort(req.url);
} | unknown | |
d17273 | val | I had a similar issue, and indeed, Sails should be loading services, controllers, etc.
There were some debug tools that helped when lifting Sails:
Sails.lift({
log: {
level: 'verbose'
},
appPath: '../',
// explicitly load almost everything but policies
//loadHooks: ['moduleloader', 'userconfig', 'orm', 'http', 'controllers', 'services', 'request', 'responses', 'blueprints']
}
I also did a live debug of Mocha (though I won't go into steps on that here).
What I found out through debugging and a log level of verbose (you could also try silly if verbose doesn't answer a question) is that I was loading Sails from the wrong directory - the test directory. Once I changed appPath to '../', I could tell from the log messages that it was loading the proper content, and voila, my sails.services.myService object was now there!
Hope that helps! | unknown | |
d17274 | val | It looks like the coordinates of World Bank barrier JSON don't have a winding order that vega-lite interprets properly. I suspect this makes it think some islands are lakes, and puts the land outside them rather than inside.
Using https://github.com/mapbox/geojson-rewind fixed it:
geojson-rewind --clockwise WB_countries_Admin0_lowres.geojson > WB_countries_Admin0_lowres-clockwise.geojson | unknown | |
d17275 | val | I see that IE, Edge, Safari, and Opera are skipped (which is to be expected). After starting the WebDriver manager, go to http://localhost:4444/grid/console and check what has been registered.
Check out Setting Up the Browser for Protractor. | unknown | |
d17276 | val | Ajax is a great alternative to do just that.
jQuery has built-in support for Ajax. I would start out with simple examples from the API Docs and work up from there.
You can use the change event of Sortable to know when you need to save the sort order again:
http://api.jqueryui.com/sortable/#event-change | unknown | |
d17277 | val | Button is a ContentControl, which also uses a DataTemplate for its Content. A default DataTemplate ends up in recursively creating Buttons to display the "outer" Button's Content.
You should set the ListBox's ItemTemplate explicitly:
<ListBox ItemsSource="{Binding CausesStackOverflow}">
<ListBox.ItemTemplate>
<DataTemplate>
<Button Content="{Binding}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox> | unknown | |
d17278 | val | This is a config setting. See this or this doc for all available settings in Spay config.
This setting turns it on:
spray.can.host-connector.pipelining = off
And this one has to be > 1 to effectively enable it:
spray.can.server.pipelining-limit = 1
By default pipelining is off.
Relevant description of each setting:
# The maximum number of requests that are accepted (and dispatched to
# the application) on one single connection before the first request
# has to be completed.
# Incoming requests that would cause the pipelining limit to be exceeded
# are not read from the connections socket so as to build up "back-pressure"
# to the client via TCP flow control.
# A setting of 1 disables HTTP pipelining, since only one request per
# connection can be "open" (i.e. being processed by the application) at any
# time. Set to higher values to enable HTTP pipelining.
# Set to 'disabled' for completely disabling pipelining limits
# (not recommended on public-facing servers due to risk of DoS attacks).
# This value must be > 0 and <= 128.
pipelining-limit = 1
# If this setting is enabled, the `HttpHostConnector` pipelines requests
# across connections, otherwise only one single request can be "open"
# on a particular HTTP connection.
pipelining = off | unknown | |
d17279 | val | If you will try to call a function using base class ptr , everytime base class version gets called as long as function is not virtual .
so simpler solution to your problem would be to make main virtual as below :
#include <iostream>
#include<pthread.h>
#include<unistd.h?
using namespace std;
void* callback(void* obj);
class Thread {
public:
virtual int main()
{
cout << "Hi there Base class" << endl;
return(0);
}
void run()
{
pthread_create(&thread, 0, &callback, this);
}
pthread_t thread;
};
class otherThreadClass : public Thread{
public:
virtual int main()
{
cout << "Hi there other class" << endl;
return(0);
}
void writeToDiskAsync(string str){
//spawn a thread to carry the write without blocking execution
run();
}
};
class Thread;
void* callback(void* obj)
{
static_cast<Thread*>(obj)->main();
return(0);
} // callback
int main() {
// your code goes here
otherThreadClass thr;
thr.writeToDiskAsync(string("aS"));
sleep(10);//it is neccessary as main thread can exit before .
return 0;
}
output : Hi there other class
Whereas if main is not virtual , it will always call base class version of main as you are calling through a base class ptr (static binding will happen ) | unknown | |
d17280 | val | Ok I got you,
The problem is with your image view lockViewOutlet.
in your code : [lockViewOutlet setFrame:CGRectMake(0, 20, 320, 548)];
You try to resize your background imageView. Resizing only the imageView does not solve your problem. Real problem is with the size of lockViewOutlet.image.
Best way is design a new image with the size 320, 568. Then set the image for iphone 5 after resizing your imageview.
if(screenSizeHeight==568)
{
[lockViewOutlet setFrame:CGRectMake(0, 20, 320, 548)];
[lockViewOutlet setImage:[UIImage imageNamed:@"iPhone5LockNackground.png"]];
[unlockImageView setFrame:CGRectMake(24, 500, 68, 43)];
[unlockText setFrame:CGRectMake(105, 500, 182,43)];
} | unknown | |
d17281 | val | It is possible that you have expired as a member of your org if you created the service (and thereby the org) via the Bluemix dashboard. When you log into Bluemix, you get a 24 hour pass as a guest. You can then go into the IoTF dashboard and add yourself as a permanent member.
Do this by launching the IoTF dashboard from your Bluemix IoT service and then go to the Access tab. You should see yourself as a "guest" user, and you can add yourself as a permanent member. From the Access tab, add yourself as a permanent member of the org.
A: Yeah, maybe just API attempts for trial are out?
CHeck in Bluemix panel | unknown | |
d17282 | val | See,you are defining the cases--- if the checkboxes have been selected, but what about them if they aren't selected!These might be picking some Garbage values as per your bottom piece of code!
So,you better provide an else statement along with each if-statement. Also,there is no need to write actionPerformed() for each of the Checkboxes! It would be achieved even using a single JButton.Else you'll have several problems implementing that as to how to set Default values and all!
You can try this.I think it'll work fine. :-
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
Double cb1,cb2,cb3,cb4,cb5,cb6;
Double total=0d;
if (jCheckBox1.isSelected() == true) {jCheckBox1.setText("50");}
else jCheckBox1.setText("");
if (jCheckBox2.isSelected() == true) {jCheckBox2.setText("50");}
else jCheckBox2.setText("");
if (jCheckBox3.isSelected() == true) {jCheckBox3.setText("50");}
else jCheckBox3.setText("");
if (jCheckBox4.isSelected() == true) {jCheckBox4.setText("50");}
else jCheckBox4.setText("");
if (jCheckBox5.isSelected() == true) {jCheckBox5.setText("50");}
else jCheckBox5.setText("");
if (jCheckBox6.isSelected() == true) {jCheckBox6.setText("50");}
else jCheckBox6.setText("");
cb1=Double.parseDouble((jCheckBox1.getText().equals(""))?"0":"50");
cb2=Double.parseDouble((jCheckBox2.getText().equals(""))?"0":"50");
cb3=Double.parseDouble((jCheckBox3.getText().equals(""))?"0":"50");
cb4=Double.parseDouble((jCheckBox4.getText().equals(""))?"0":"50");
cb5=Double.parseDouble((jCheckBox5.getText().equals(""))?"0":"50");
cb6=Double.parseDouble((jCheckBox6.getText().equals(""))?"0":"50");
total=cb1+cb2+cb3+cb4+cb5+cb6;
jLabel1.setText("The total comes out to be :- "+total);
}
A: Use an else in your Ifs and set the text to "0" if it's not selected.
Also, when you initialize your checkboxes, set a default text of "0". | unknown | |
d17283 | val | #! is a shebang. On UNIX/UNIX like operating systems it basically tells your shell which executable (python in your case) to execute the script with. Without it, the shell is executing the script directly and since it does not understand Python code, it raises an error. | unknown | |
d17284 | val | No in my opinion it's not safe. The Apple documentation clearly states: "UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy. If you need to present a sheet with more customization than provided by the UIActionSheet API, you can create your own and present it modally with presentViewController:animated:completion:."
In this case you're not adding subviews but you're actually retrieving the ones that are already there and customising them - which from an Apple perspective I assume is quite similar.
I would suggest creating your own ActionSheet if the UIActionSheet API is too restrictive for what you need. (I recommend having a look on Git Hub as there are different solutions that might be a good fit for you). | unknown | |
d17285 | val | Your code is wrong,
targetClass on ElementCollection is for specifying an Embeddable class (if generics are not used), so should be not used.
You also need a @MapKeyJoinColumn if you want the Map key to be another object (or @MapKeyClass if it is an Embeddable.
Most databases do not have a Boolean type, so booleans are normally stored as numbers, 0/1. So you may be missing a conversion somehow. You can define an @Convert with a @TypeConverter for this, although it should be getting defaulted, so you may log a bug for that. | unknown | |
d17286 | val | Also, see here: Manually Loading the Factory Extension into the Ninject Kernel
Under some circumstances it may be necessary to manually load the extension. The solution in my case was to add the following code during kernel construction:
if (!kernel.HasModule("Ninject.Extensions.Factory.FuncModule"))
{
kernel.Load(new FuncModule());
}
A: Why this was happening is specified here: http://kozmic.net/2009/03/20/castle-dynamic-proxy-tutorial-part-viii-interface-proxy-without-target/
Krzysztof explains that you Castle can resolve even an interface, and Windsor will create a class for you. However if you want to use an interceptor and call a invocation.Proceed() method you need to specify what happens inside that method (for ex. using lambda expression)
Solution:
In my case solution was to put all installers into one, except of the interceptor installer. That one could stay alone, and eveything was fine.
A: If you have this problem by Update method so change it like this :
var myObj = _dbContext.Set<T>().Find(entity.Id);
_dbContext.Entry(myObj).CurrentValues.SetValues(entity);
_dbContext.SaveChanges(); | unknown | |
d17287 | val | You could try this, add the Value property to your trigger and set it to true. Also need to add the target name to tell it to change the properties of border which is in your control template.
<Trigger Property="IsMouseOver" Value="true" >
<Setter Property="BorderThickness" TargetName="Border" Value="1"></Setter>
<Setter Property="BorderBrush" TargetName="Border" Value="Orange"></Setter>
</Trigger>
A: I think you need to specify border element name
<Trigger Property="IsMouseOver" Value="true" >
<Setter TargetName="Border" Property="BorderThickness" Value="1"></Setter>
<Setter TargetName="Border" Property="BorderBrush" Value="Orange"></Setter>
</Trigger> | unknown | |
d17288 | val | Each context should be a single Unit of Work, therefore I would highly recommend you have 1 context per operation (unless you relly have to).
For more info on what EF is currently tracking checkout Context.ChangeTracker | unknown | |
d17289 | val | It should be @extends('app') not @extends 'app'. For Laravel what you did now was like writing: @extends() 'app' So it tries to call the function make with an empty first parameter (because you didn't pass anything to @extends) and hence you get that syntax error. | unknown | |
d17290 | val | GetGithubData is an async function, meaning it implicitly returns a Promise. You are saving the Promise object into the githubData state.
useEffect(() => {
setGithubData(GetGithubData());
}, []);
You are correct that you need to await it resolving.
You can chain from the returned promise and call setGithubData in the .then block with the returned value:
useEffect(() => {
GetGithubData()
.then(data => {
setGithubData(data);
});
}, []);
Or create an async function in the useEffect hook and await the value.
useEffect(() => {
const getGitHubData = async () => {
const data = await GetGithubData();
setGithubData(data);
};
getGitHubData();
}, []); | unknown | |
d17291 | val | Based on helping others with similar situations I would say the problem is that the response from the server isn't just the string "Yes". Most likely there is some whitespace before and/or after the text. Perhaps a stray newline or two.
Try this:
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];
NSLog(@"Result = '%@'", serverOutput); // look for space between quotes
serverOutput = [serverOutput stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | unknown | |
d17292 | val | on ios 6 the mail composer is its own app (inside yours)
:: http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/
the code looks good to me if you are using ARC else it leaks and on ios6 that might result in x XPC remotes
if all is good there, Id blame it on a bug in apple's new handling of XPC
A: there's another possible solution:
Remove custom fonts from the appearance methods, if you have any
https://stackoverflow.com/a/19910337/104170 | unknown | |
d17293 | val | Although I haven't had any experience with IME, I took a quick look at the documentation : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/IME.html
Can it be that it's not enabled application wise? That, maybe what returns true is only valid for the component you are tracing from?
A: Obvious questions first:
Are you certain the TextInput is a member of cbx_text? I know this seems silly, but it's best to eliminate the obvious first.
Do you have an IME enabled on your computer? For example, do you regularly type in hiragana on your computer and have the appropriate language pack enabled?
Are you sending the IME the string appropriately? IME.setCompositionString() for windows computers?
Does your OS support the use of IMEs? Linux only supports the following methods:
*
*Capabilities.hasIME
*IME.enabled <= Can set or return value.
Try tracing hasIME and see if it's installed. Again, we're shotgunning here – trying to track down any possibility of a problem.
When all else fails, go to the source:
*
*http://livedocs.adobe.com/flex/3/html/help.html?content=18_Client_System_Environment_6.html | unknown | |
d17294 | val | // Check if we're running on GingerBread or above
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
// do somthing
// if not
} else {
// do somthing
} | unknown | |
d17295 | val | You're working with percentage heights. For example:
.blackbox { min-height: 23%; }
You're also not defining a height on parent elements, which some browsers require in order to render a percentage height on the child.
You can expect rendering variations among browsers with this method.
For a reliable, cross-browser solution, give the body element:
height: 100vh;
Or, if you want the body to expand with content:
min-height: 100vh;
More details here:
*
*Working with the CSS height property and percentage values
*Chrome / Safari not filling 100% height of flex parent | unknown | |
d17296 | val | Are you looking to be able to export a parameter to environment variables using PHP? If so, the exec command may be what you're looking for: PHP: exec - Manual.
You'd execute something similar to this I believe:
<?php
echo exec('export phpdriver=value');
?>
EDIT: Due to misunderstanding of the question.
To correctly answer the question, we are going to create a script to set some environment variables before executing some PHP from the command line.
Here is our example shell - php_runner.sh
#!/bin/bash
export progsdir=$1
export phpdriver=$2
php -c path/to/php/ini
Once this is created (remember to set correct permissions as well), we can execute it from command line as such:
/path/to/php_runner.sh path1 path2 | unknown | |
d17297 | val | Did you try
$.cookie("name", null);
$.removeCookie('filter', { path: '/' });
A: It might depend on what path your cookie is using. If you goto the chrome developer tools and check the path column under Resources > Cookies > Path.
You might be using the generic / for your path instead of /Home/. Give the code below a try.
To delete a cookie with jQuery set the value to null:
$.removeCookie('filter', { path: '/' });
A: What works for me is setting the cookie to null before removing it:
$.cookie("filter", null);
$.removeCookie("filter);
A: I was having the same issue with jquery version 1.7.1 and jquery cookie version 1.4.1
This was driving me crazy so I decided to dive into the source code and I figured out what is wrong.
Here is the definition of $.removeCookie
$.removeCookie = function (key, options) {
if ($.cookie(key) === undefined) { // this line is the problem
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
As you can see when the function checks if the cookie exists it doesn't take the options object into account. So if you are on a different path than the cookie you're trying to remove the function will fail.
A Few Solutions:
Upgrade Jquery Cookies. The most recent version doesn't even do that sanity check.
or add this to you document ready
$.removeCookie = function (key, options) {
if ($.cookie(key, options) === undefined) { // this line is the fix
return false;
}
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return !$.cookie(key);
};
or when removing cookies do something like this:
$.cookie('cookie-name', '', { path: '/my/path', expires:-1 });
A: If you use a domain parameter when creating a cookie, this will work
$.removeCookie('cookie', { path: '/' , domain : 'yourdomain.com'});
A: This simple way it works fine:
$.cookie("cookieName", "", { expires: -1 }); | unknown | |
d17298 | val | To avoid overspecifying, you can use OnCall to allow them to be called 0-N times (optionally with argument checks, order checks and so on). | unknown | |
d17299 | val | If you are trying to Install Websphere Application Server through Installation Manager then you need to select IBM SDK provided with Websphere Application Server.
If you don't choose the IBM SDK you will be need to enter the JAVA Path in next steps. | unknown | |
d17300 | val | You need below library ,
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.5.0</version>
</dependency>
If you are not using pom just download it from
https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui/2.5.0
https://mvnrepository.com/artifact/io.springfox/springfox-swagger2/2.5.0
To get more insight you can follow here
https://github.com/mayurbavisiya/Spring4Swagger
In your spring file you need to write
<mvc:resources mapping="/swagger-ui.html" location="classpath:/META-INF/resources/swagger-ui.html"/>
Hope this will help you out. | unknown |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.