query_id stringlengths 4 64 | query_authorID stringlengths 6 40 | query_text stringlengths 66 72.1k | candidate_id stringlengths 5 64 | candidate_authorID stringlengths 6 40 | candidate_text stringlengths 9 101k |
|---|---|---|---|---|---|
07ae311f1c44cb1ea7173aa786f638f52b6d8fe3f39c244c0f265a04bc103c4d | ['5d0d1a857539495db1ce477ed0afcb47'] | From Msdn :
"
This method sets a bit in the object header, which the system checks when calling finalizers. The obj parameter is required to be the caller of this method.
Objects that implement the IDisposable interface can call this method from the IDisposable.Dispose method to prevent the garbage collector from calling Object.Finalize on an object that does not require it.
"
So it prevents an extra call from the GC. If it is called from within the the finalizer method, when object is being finalized, then it wont do anything, as it is already being finalised.
Otherwise, the GC is allowed to reclaim memory, without finalisation of the object, thus making things faster.
| 3d1e331f45e98f544b799e1023409d99dcae286a53e6dc752c818c7d3bcbd731 | ['5d0d1a857539495db1ce477ed0afcb47'] | Ended up with same issue. Run my own benchmarks to find out if you can place everything in the same folder vs. having multiple folders. It appears you can and it's faster!
Ref: https://medium.com/@hartator/benchmark-deep-directory-structure-vs-flat-directory-structure-to-store-millions-of-files-on-ext4-cac1000ca28
|
f29b82b2c8b80a9de99b85cd2ccd56903bf689d853550a399d0617705088cfe9 | ['5d2f5e51689c4d96b97552ce67810baa'] | So when I turn on my computer now the windows booting sound is all distorted almost like it's stretched or crackling, when I log in the mouse lags, and everything seems to load a bit longer. It can see all wifi connections but it says only limited connectivity when i try one, which really just means no connectivity. This is all happening after ignoring an error that kept popping up over the last month, where after the message appeared I would be practically unable to do anything until I restarted the computer. The message was “Instruction at referenced memory could not be read”. That message doesn't really show up anymore but that might be just cause I'm not on long enough to trigger it (no reason to stay on a pc you can't use). I'm on windows 7, I have an AMD FX-8350 Processor, and 16GB ram (was 8GB, I literally just installed the other 8 after this issue started hoping it might help). I have also ran it in safe mode where none of these issues seem to occur.
Thank you for any help.
| 37cc2554953b5d123264dc038388b729a306d650b4394f01be933b12b216ce83 | ['5d2f5e51689c4d96b97552ce67810baa'] | Thanks for the advice. I have tried removing the old ram but it didn't help, I also ran a memtest but it couldn't find any problem. The only things left I can think of is that it's either being caused by a program, a driver, or my processor is getting buggy. |
ec996054fa32aaf7a73105dc012be8f42fcfcaa9c9fdbb7487ffeb7f36f0a426 | ['5d47bc4989a048ca80ef913c8ec252b5'] | Case 1)
machine: kinit
machine: <EMAIL_ADDRESS>'s password: (inputted my password)
machine: ssh machineB
production.xxx.com
Successfully sshd.
Case 2)
machine: ssh machineB
production.xxx.com
password: (input the same pw)
password not right. ssh failed. logs says AM: authentication error for xxx from x.x.x.x
what does this tells me about the machine? i am confused.
| e4a1b9bc8a6c4890b2f214d10b8aaac3601e62fadf1bd5a5b1ac122d232a4d93 | ['5d47bc4989a048ca80ef913c8ec252b5'] | I am having this problem with a brand new project. This problem happens with both RestKit and Facebook SDK. Strangely SwiftyJSON works just fine. I create a brand new swift project and a Podfile with:
source 'https://github.com/CocoaPods/Specs.git'
use_frameworks!
target 'test-fb-swift4' do
pod "FBSDKCoreKit"
pod 'SwiftyJSON', '~> 2.1'
pod 'RestKit', :inhibit_warnings => true
end
target 'test-fb-swift4Tests' do
end
After creating that file I run pod install and reopen xcode with the test-fb-swift4.xcworkspace file.
Now inside my controller I put a import RestKit and I get the error No such module 'RestKit'. I have tried many different ways to format the Podfile even down to very simple versions like:
source 'https://github.com/CocoaPods/Specs.git'
pod 'RestKit'
I have tried adding and removing the use_frameworks, with and without the target. With and without the :inhibit_warnings.
I am running CocoaPods 0.36.4 and tried the latest rc build, same deal. The Objective-C version from another project runs fine. This is my first project using Swift and I am stuck on this issue.
|
2a60c5c6eba82de532b749e8605b4501cc6de269b7a808ccb60cc88de364fe31 | ['5d51c04f75eb4905b25462096e3a0d96'] | what if you modeled each key/value pair as first class objects? e.g. :
class MyKeyValue {
static mapping={
id generator:'assigned'
}
String id
String value //i guess this could be an object of some sort, as long as it is a valid property (like Date)
def getKey = {
return id;
}
}
class User {
//...other properties
//you'd put this property where the hashmap was originally.
List MyKeyValue
}
The generate-all command will create a rather plain UI for this, but its usable, and is a starting point for customization. You could then write your own constraints, and leverage the GORM's built in validation etc.
However, its a bit hacky imo - and the performance won't be great, but if you only have a few, i dont think thats gonna matter.
| 05f8a46ccf0ca28856b1c5405539796a9524ced6f11351608a130403d68b21cf | ['5d51c04f75eb4905b25462096e3a0d96'] | you cannot access a java method or property from javascript. Javascript is purely client side.
one way you can do this is to print the property into a block, and then you can access it from javascript, e.g.:
<script>
var selectedProdLineAssociationKey = '<%= SelectProdLineAssociationForm.selectProdLineAssociationForm.toString();=%>';
//...you can then use this variable else where in your script block
</script>
But you will not be able to change the value, unless you POST it back (and have the logic to change it on the serverside).
|
2cb5f7c8f6265aec3a5c3cf5958dae0470f719b82347a22a5deb9e6e422a3b74 | ['5d576fa7d40c4c7280c5a1107c5566b2'] | I'm using Polymer 1.0 to make an API request using iron-ajax based on the user's location.
In app.js I have the following block.
app.addEventListener('dom-change', function() {
console.log('Our app is ready to rock!');
var working = Polymer.dom(document).querySelector('#refresh-button');
var locationToast = Polymer.dom(document).querySelector('#toast');
var sightingsAjax = Polymer.dom(document).querySelector('iron-ajax#sightings');
var hotspotsAjax = Polymer.dom(document).querySelector('iron-ajax#hotspots');
function getLocation() {
working.setAttribute('class', 'spin');
function success(position) {
app.initialPosition = [position.coords.latitude,position.coords.longitude];
console.log(app.initialPosition);
app.apiRecent = 'http://ebird.org/ws1.1/data/obs/geo/recent?fmt=json&back=2' +
'&lat=' + app.initialPosition[0] + '&lng=' + app.initialPosition[1];
console.log(app.apiRecent);
app.apiHotspots = 'http://ebird.org/ws1.1/ref/hotspot/geo?dist=20&back=2&fmt=json' +
'&lat=' + app.initialPosition[0] + '&lng=' + app.initialPosition[1];
console.log(app.apiHotspots);
locationToast.text = 'Location acquired!';
locationToast.show();
working.removeAttribute('class');
sightingsAjax.url = app.apiRecent;
hotspotsAjax.url = app.apiHotspots;
}
function error() {
working.removeAttribute('class');
working.setAttribute('icon', 'error');
locationToast.text = 'Unable to determine location.' +
'Please check your settings and try again.';
locationToast.duration = 0;
locationToast.show();
}
navigator.geolocation.getCurrentPosition(success,error,{enableHighAccuracy: true});
}
getLocation();
app.refreshLocation = function() {
console.log('Refreshing user location...');
getLocation();
};
});
And in my index.html file, I have the iron-ajax element with an empty url property. The url is created and added based on the user's location coordinates.
<section data-route="sightings">
<template is="dom-bind">
<iron-ajax
id="sightings"
auto
url=""
handle-as="json"
last-response="{{response}}"></iron-ajax>
<iron-list>
<template is="dom-repeat" items="{{response}}">
<div class="row">
<h4 class="title">[[item.comName]]</h4>
<div class="latin">[[item.sciName]]</div>
<div class="loc">Last spotted at <span>[[item.locName]]</span></div>
<div class="time">[[item.obsDt]]</div>
</div>
</template>
</iron-list>
</template>
</section>
This works very well in Chrome and Opera (Blink browsers) but fails in Safari and Firefox (both lastest versions; not yet tested in IE). The result is an empty iron-list so basically the browser is failing to request/return the API data in the affected browsers.
Safari gives me this error: TypeError: Attempted to assign to readonly property.
success app.js:63
Firefox says: TypeError: sightingsAjax is undefined
Notably the geolocation, interface, routing, and toasts all work fine in all browsers. Also, setting the iron-ajax url property manually also works just fine. It's just the dynamic setting of the url property that seems to fail in Firefox and Safari.
| 1598cac5e68741ec485b4258557d9c05ea158fbce61fc73b7c702aa9beb8c25c | ['5d576fa7d40c4c7280c5a1107c5566b2'] | Very late reply but I have a similar problem with an Ionic 5 app.
I had some limited success in minimizing the issue by reloading the HTML on a change event.
You could try adding <div class="audio-area" hidden> and using (ionSlideDidChange)="tryThis()" on ion-slides.
tryThis() {
setTimeout(() => {
let elems = <NodeList>(
document.querySelectorAll(".audio-area")
);
for (var i = 0; i < elems.length; i++) {
let elem = <HTMLAnchorElement>elems[i];
let inner = elem.innerHTML;
elem.innerHTML = inner;
elem.children[0].setAttribute("controls", "true");
elem.children[0].setAttribute("preload", "metadata");
elem.removeAttribute("hidden");
}
}, 300);
}
This greatly reduced the issue for me, though it does seem to pop back up eventually, usually after leaving the app idle for a while. Curious if you ever found a good solution.
(I would have left this as a comment but don't have the rep)
|
b8218c28e313b5dfe4f297dd9afe437d8992b14f37d8ec420906f22cfa8bbebf | ['5d5972d0aae0487f95363a1fab178f13'] | I work on the Google Consumer Surveys API -- the current version of the API does not offer the ability to pull publisher stats & there are no plans to add this functionality at this time. Your request has been noted and if we have enough demand for this feature we'll consider it in the future.
| 2c2e630a778382f8eae70a8984c61aeb016a5641107165eb2f3eda186a18f0e4 | ['5d5972d0aae0487f95363a1fab178f13'] | This issue has been resolved. We'll new return the UK 'country' in the 'audience.countrySubdivision' for those surveys.
The cause was that for a few countries (US, CA, UK) the GCS UI allows surveys to be targeted by macro-region (e.g. US-WEST, CA-PRAIRIES, UK-ENGLAND) in addition to state (US), province(CA), or Nuts-1 region (UK) which are targeted in the API via the 'audience.countrySubdivision' property.
To provide a consistent API across all countries, we do not offer macro-region targeting in the API and that will not change with this fix. However, to allow you to access your data which was created that way through the UI we will now return Surveys that are targeted to macro-regions by putting the region into the 'audience.countrySubdivision' property.
|
43897bd1ddd20dbd1346dc645d0bb7a7492ae92f692681dcdf8865634ed54301 | ['5d6771bdd4d345d4998b41a74430ae41'] | If you could live with a JSON result, the following should work:
public class ServicesController : Controller
{
public ActionResult GetFoo(int id)
{
var dbResult = SomeDbUtil.GetFoo(id);
return this.Json(dbResult);
}
}
This would give you pretty a basic JSON query result. However, if you want your services to be discoverable SOAP XML services etc., setting up another project/website that acts as the web service would seem to be the better idea to me.
| b20e62e9e1e31ccafdc10df76d724350cedf43e237ea23d8c87f0219974655a2 | ['5d6771bdd4d345d4998b41a74430ae41'] | Have you tried setting the SystemTime to exactly the scheduled time or a bit after that? Your SystemTime value does not change and if Quartz.Net tries to check whether the job should be run using that delegate, it will actually never be the right time to run it in your test.
|
66b489127ee8af9155adae200329dff1171a0b61ab8cc4132a14aa699bb78890 | ['5d69511b8fdd4f78877900ff1411badf'] | i read some Stackoverflow posts about my htaccess problem but i didn't resolve anything.
I have this:
RewriteEngine On
RewriteRule ^(.+?)/(.+?)/(.+?)/$ /index.php?page=$1&p1=$2&p2=$3 [L]
RewriteRule ^(.+?)/(.+?)/$ /index.php?page=$1&p1=$2 [L]
RewriteRule ^(.+?)/$ /index.php?page=$1
Every my site path needs the last slash (e: www.site.com/test/). If not, they go wrong.
How can i remove last slash without errors and both redirect to this format (in case there was the last slash)?
Thanks
| 7250f806e8146fdd0d2cabd63d3630b44d262da9599d5631bdcac12ab54326d7 | ['5d69511b8fdd4f78877900ff1411badf'] |
Hi everybody,
i have some problem with phpunit coverage html component.
I installed correctly components and launch command:
vendor/bin/phpunit --coverage-html tests
Tests works correctly, but no html reports generated. Attached the terminal result.
The classic "Generating code coverage report in HTML format ... done" doesn't appear.
Can you help me?
Thanks
|
b74c14f4f47334003fc66ec27b7fe9c60ddf3758fa70daec82c51ca352866813 | ['5d7ba5d15a5b452c87a7b85caaf588fa'] | We have an API platform which allows user to create and manage a certain type resource.
Client is expected to provide a callback url where our server will send notification to when the resource is updated.
So far all our notification types don't require any response from client. However, we plan to have a new type of notification which requires certain response from client, for example, someone else wants to update the resource and we need to ask client to accept or reject the update.
I see there are 2 options here:
Client get the notification, then send out a new request to our server posting its decision. We'd need to have new endpoints to handle different type of actions.
We ask client to provide http response with action in the body for this type of notification. No new API endpoint required on our side.
I'm leaning toward #2 because I don't expect client to take long time to make a decision, so completing everything in 1 round trip is more efficient then having client making another call.
The downside I see is that server won't have a chance to validate response and tell client if there's any error with the format, as client is free to put anything in the response.
Anything else I should consider? It seems #2 is the most popular option when it comes to API design, not sure if #1 is anti pattern here.
| 146a11e2f0f5040bb6255fd6406ccd19745ed09362f20e5be364b9caa1c4e934 | ['5d7ba5d15a5b452c87a7b85caaf588fa'] | * a client can hold connection open no matter if we require a response or just 202
* client goes down is similar for 202
* the use case demand immediate response anyway, shouldn't have human involved
* this one is a good point, server won't have a chance to validate response and notify client on any error
I see your point, i'm thinking since the current case is simple enough, no need polling, not much validation, and don't expect delay response etc. thinking to just go with sync path and as situation comes up we go to async?
can avoid premature optimization this way i think |
67ea089b46fc41f51faf1331d701fc513a61767d3a691e3d9dba1643715f8640 | ['5d87cf71916446dc9be292dc6a29d52c'] | I ended up doing it this way
$('.web-icon-container > a > .search-icon').parent().on('click',function() {
$('.web-icon-container').find('.search-box').toggleClass('is-active');
$(document).mouseup(function(e){
if(!$(e.target).is('.web-icon-container > a > .search-icon') &&
$('.web-icon-container').find('.search-box').has(e.target).length === 0){
if($('.web-icon-container').find('.search-box').hasClass('is-active')) {
$('.web-icon-container').find('.search-box').removeClass('is-active');
}
}
});
});
| cf0500978b6b33383b9ef41cb3a23951224c932b26ef0d47bf3ab77e9ba1bfbf | ['5d87cf71916446dc9be292dc6a29d52c'] | Try this
* {
margin: 0;
padding: 0;
list-style: none;
text-decoration: none;
}
html {
min-height: 100%;
}
.nav {
margin-bottom: 20px;
margin-left: 0;
background-color: #fff;
height: 60px;
width: 100%;
position: fixed;
box-shadow: 0px 5px 5px #696969;
z-index: 1;
}
.nav > li > a {
display: block;
}
.pull-right {
float: right;
}
.pull-left {
float: left;
}
.nav a {
font-family: 'ABeeZee', sans-serif;
color: #b3b3ff;
padding: 14px 10px;
-webkit-transition: color 0.2s ease-in-out;
-moz-transition: color 0.2s ease-in-out;
-o-transition: color 0.2s ease-in-out;
transition: color 0.2s ease-in-out;
}
.nav a:hover {
color: #5a5a5a;
}
.nav li {
display: inline;
}
.nav .active a {
color: #5a5a5a;
cursor: default;
}
.nContainer {
margin-top: 20px;
}
.collapse {
background-image: url('http://placehold.it/1280x720');
background-size: cover;
background-repeat: no-repeat;
height: 600px;
position: center bottom;
left: 0;
right: 0;
text-align: center;
}
.collapse h1 {
color: #fff;
font-family: 'Shift', sans-serif;
font-size: 72px;
}
.content {
background-color: #fff;
position: relative;
}
.content h1 {
color: #393c3d;
font-size: 24px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.container {
width: 90%;
margin-right: auto;
margin-left: auto;
}
.container:before,
.container:after {
display: table;
line-height: 0;
content: "";
}
.container:after {
clear: both;
}
.container h1 {
margin-top: 4%;
font-family: 'Oswald', sans-serif;
font-weight: 700;
}
.container p {
font-family: 'Lato', sans-serif;
}
.footer{
position: relative;
padding-top: 20px;
height: 50px;
z-index: 2;
bottom: 0;
}
<!-- Navigation -->
<div class="nav">
<div class="nContainer">
<ul class="pull-left">
<li class="active"><a>home</a></li>
<li><a href="#">about us</a></li>
<li><a href="#">contact us</a></li>
</ul>
<ul class="pull-right">
<li><a href="#">sign up</a></li>
<li><a href="#">log in</a></li>
</ul>
</div>
</div>
<!-- Collapse -->
<div class="collapse">
<h1 style="position: relative; top: 50%; transform: translateY(-50%);">Lorem ipsum dolor sit amet.</h1>
</div>
<!-- Content -->
<div class="content">
<div class="container">
<h1><PERSON>>
<p>Lorem ipsum dolor...</p>
</div>
</div>
<div class="footer">
<p class="copyright">© 2015 <PERSON>>
</div>
|
99ede1629af093a06d35cd95c971682c088d2c66fe30c038566c5ab6b6bedd70 | ['5da883ed821746838a783b5b0730b15f'] | I am working on a simulation model, part of which requires having a point queue model that implements following equation:
dl1(t)/dt=max{q1(t)+q3(t)-C1,-l1(t)/Delta_T}
dl2(t)/dt=max{q2(t)-q3(t)-C2,-l2(t)/Delta_T}
I know to implement it I need having a function that takes q(t)'s as input and outputs into two separate state-space blocks to generate each l(t). Can anyone help please?
| cb762894e54abee11bb1f1df280444ef7e04c711e37a7aa8fbf71bf75fcd68a1 | ['5da883ed821746838a783b5b0730b15f'] | I have coded a transport assignment problem using Non-liner complementary modeling in GAMS. The code runs perfect for single OD (Origin-Destination), and multi-O Single-D cases. However, when I switch to solve a Grid network with Multiple OD pairs, something goes wrong.
I have tried fixing some of the variables, but still it asks for fixing more of them.
SET N NODES /1*9/;
ALIAS (I,N), (J,N), (K,N), (L,N);
SET DEST(J) IDENTIFICATION OF DESTINATION NODES,
ACTIVE(I,J,K) IDENTIFIES THE SET OF ACTIVE ARCS,
A(N,N) ARCS;
SET PARAM /A, B, K/
TABLE ARC_COST(I,J,PARAM) Arc cost data
A B K
1.5 4 0.6 28
5.2 2 0.3 33
2.3 5 0.75 22
3.9 5 0.75 24
1.6 2 0.3 29
6.7 4 0.6 33
7.8 3 0.45 27
8.9 5 0.75 26
5.4 3 0.45 22
4.8 4 0.6 22
6.4 3 0.45 25
4.3 5 0.75 25;
Parameter COEF_A(I,J), COEF_B(I,J), COEF_K(I,J);
COEF_A(I,J) = ARC_COST(I,J,"A");
COEF_B(I,J) = ARC_COST(I,J,"B");
COEF_K(I,J) = ARC_COST(I,J,"K");
TABLE DMD(I,J) Trip matrix
1 2 3 4 5 6 7 8 9
1 0 0 0 0 0 0 0 0 40
2 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0
5 0 0 20 0 0 0 0 0 0
6 0 0 0 0 0 0 0 25 0
7 0 0 0 0 0 0 0 0 0
8 0 0 0 0 0 0 0 0 0
9 0 0 0 0 0 0 0 0 0;
* Identify arcs using flow cost parameter:
A(I,J) = YES$COEF_A(I,J);
* Identify destination nodes using the trip table:
DEST(J) = YES$SUM(I, DMD(I,J));
ACTIVE(A,K) = YES$DEST(K);
ACTIVE(I,J,I) = NO;
ACTIVE(I,I,J) = NO;
Display ACTIVE, COEF_A, COEF_B, COEF_K ;
VARIABLES T(I,J) TIME TO GET FROM NODE I TO NODE J,
X(I,J,K) FLOW TO K ALONG ARC I-J,
F(I,J) AGGREGATE FLOW ON ARC I-J;
EQUATION RATIONAL(I,J,K) COST MINIMIZATION
BALANCE(I,J) MATERIAL BALANCE
FDEF(I,J) AGGREGATE FLOW DEFINITION;
* The time to reach node K from node I is no greater than
* the time required to travel from node I to node J and then
* from node J to node K.
RATIONAL(I,J,K)$ACTIVE(I,J,K).. COEF_A(I,J) + COEF_B(I,J) * POWER(F(I,J)/COEF_K(I,J),4) + T(J,K)=G= T(I,K);
* The flow into a node equals demand plus flow out:
BALANCE(I,K)$T.UP(I,K)..SUM(A(I,J)$ACTIVE(A,K),X(A,K)) =G=SUM(A(J,I)$ACTIVE(A,K),X(A,K)) + DMD(I,K);
* Flow on a given arc constitutes flows to all destinations K:
FDEF(A)..F(A) =E= SUM(K$ACTIVE(A,K), X(A,K));
* Here is the MCP model:
MODEL TRAFFIC /RATIONAL.X, BALANCE.T, FDEF.F/;
* Initial levels for arc flows are needed so that we can
* properly evaluate the nonlinear functions:
F.L(A) = COEF_K(A);
X.L(A,K) = 0.0;
T.L(I,J) = COEF_A(I,J)$A(I,J) + SMIN(K$A(I,K),COEF_A(I,K))$(NOT A(I,J));
* Lower bounds are zero for flows, positive for times:
X.LO(A,K) = 0.0;
T.LO(I,J) = 0.0;
* Fixing values causes corresponding equilibrium conditions
* to be dropped:
T.FX(I,I) = 0;
T.FX(I,J)$(NOT A(I,J)) = 0;
F.FX(I,J)$(NOT A(I,J)) = 0;
option mcp=miles;
SOLVE TRAFFIC USING MCP;
|
3cc60d8ce86b65f86d6b533c8f7fd025c9d31a447fa6b57a1064cb544c031607 | ['5dc43581a390494197a31175151e3ad4'] | I am trying to display a formatted string directly from a breakpoint action in eclipse-cdt (when programming in C).
I have configured a conditional breakpoint and associated 2 actions to it :
- a log action (I have checked the "evaluate as expression" checkbox)
- a resume action to prevent the debugger from actually stopping at that breakpoint
I haven't found any documentation on the expected log action expression syntax : I have tried a couple of variations but I have only been able to display a single variable content. From these attempts I have found that it expects neither C statements such as printf("i = %d",i); nor gdb printf syntax.
I would have liked to print a string like "i = 12 and sum = 34".
Thanks in advance.
| 0f0c2bab05057eb2534e0870f94ba3ab0127413a00dfa259fc98b00d6d9ff78b | ['5dc43581a390494197a31175151e3ad4'] | I am trying to compute the number of occurrences of pairs of values. When running the following code the numpy version (pairs_frequency2) is more than 50% slower than the version relying on collections.Counter (it gets worse when the number of points increases). Could someone please explain the reason why.
Is there a possible numpy rewrite to achieve better performance ?
Thanks in advance.
import numpy as np
from collections import Counter
def pairs_frequency(x, y):
counts = Counter(zip(x, y))
res = np.array([[f, a, b] for ((a, b), f) in counts.items()])
return res[:, 0], res[:, 1], res[:, 2]
def pairs_frequency2(x, y):
unique, counts = np.unique(np.column_stack((x,y)), axis=0, return_counts=True)
return counts, unique[:,0], unique[:,1]
x = np.random.randint(low=1, high=11, size=50000)
y = x + np.random.randint(1, 5, size=x.size)
%timeit pairs_frequency(x, y)
%timeit pairs_frequency2(x, y)
|
04befc3d77bd0f97801cbc26864012b3ee4900d98caef2d846816cfb44f8e303 | ['5dc452a8c63d42f094b210d1e23443fd'] | If your struggling for inspiration try one of the name generators: http://www.seventhsanctum.com/index-name.php
They generate names for people, places and things that come out logical. They have different generators and you can customize to an extent. Even if you don't use them, they may inspire you.
| e8f907390661bdd45c0c88f6add970e22ba820ee05f487eb4cf48a01813216c8 | ['5dc452a8c63d42f094b210d1e23443fd'] | Pelo seu exemplo temos a seguinte estrutura:
O objeto $data onde o mesmo tem um atributo chamado return que é um array de objetos. Para acessar o atributo return utilizamos $data->return.
Pelo fato do return ser um array podemos percorre-lo dinamicamente utilizando o foreach($data->return, $veiculo) onde o primeiro parâmetro é o array a ser percorrido(no nosso caso o $data->return) e o segundo é o elemento retornado em cada iteração(Damos a este parâmetro o nome que queremos, neste caso achei conveniente dar o nome de $veiculo pois a cada iteração ele retornara um objeto com dados de veículos).
Baseado na explicação acima o código para solucionar o seu problema é o seguinte:
foreach ($data->return as $veiculo) {
echo $veiculo->placa;
}
|
42ea8d8113b2e06990a4f27ac53c40f8b23d2f925025a1eff77fa7430ec54bde | ['5dcbd7bd270646629a737b359a3ebdfd'] | pip install multiprocessing
import multiprocessing
import time
def random_stuff_to_do():
time.sleep(1)
print("Slept 1 second")
task1 = multiprocessing.Process(target = random_stuff_to_do)
task2 = multiprocessing.Process(target = random_stuff_to_do)
task1.start()
task2.start()
task1.join() #This part is usefull only if you want to wait for your tasks to end
task2.join() #before the program to continue.
print("Task 1 and 2 done at the same time")
| c6f289c76639b058d3562a760f8e0cffc70427d153242cf71d329bcc4d1a524e | ['5dcbd7bd270646629a737b359a3ebdfd'] | """Import these modules"""
import gspread
from oauth2client.service_account import ServiceAccountCredentials
"""Import the sheet"""
scope = [
'https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/drive'
]
creds = ServiceAccountCredentials.from_json_keyfile_name("Path to your
credentials.json", scope)
client = gspread.authorize(creds)
sheet = client.open("Your sheet").sheet1
"""The cell on Top of a column is for the title of the column """
sheet.updatecell(1, 1, "Sales")
"""Reading the file where the data is stored and writing it in the sheet"""
with open("Path to the file where the sales are stored", "r") as l:
data = l.readlines()
for e, i in enumerate(data):
i = i[:-1]
sheet.updatecell(len(e+2), 1, i)
I hope this helps, I can't do more since I don't know how the data is stored and organized.
|
08ebfb00cf50ac9aed1ff28e9a41ea452008aa6c0ce969b87b6b2560a81b620a | ['5de67eae63e74e33b7371a82b7b41a8b'] | I would recommend this process (I guess you do this with root, right?):
Step 1: check whether the executable exists on your filesystem. Use updatedb to update the location database, then execute locate mbr
Step 2: After you found it, try starting it by using its full path. If you get denied, the error will show you what is wrong.
| 74609768068ec5a52e9f4dce1c09ff16b9b284b5628aa87353cdf83f5946511a | ['5de67eae63e74e33b7371a82b7b41a8b'] | What I sometimes found was that the OS was making some large downloads from the vendor's sites and this simply blocked other traffic due to bandwidth limitations.
To diagnose you could try to monitor connections on your router - given that it has that function. This way you could see that some traffic is actually happening and which. And to stop it (at least for testing) it then could be an idea to block that kind of traffic within the router.
|
7bceacb46cfc7a6f7208d2d2b3325c220ca87112a7af6f450f7b0df778e504ee | ['5deac1e2a7c941129dca87e44219943d'] | How does app like Uber do real time tracking of Cabs? Let me put it across in detail:-
Cabs Position to the server.
Server then communicates that positionto the another user app which is trying to book a Cab.
I have gone through many blogs, after that I could think of the solution below to solve the 2 issues:
Cabs will communicate there lat/long to server after some time gap using http request.
The user app will establish a socket with the server and any change in the server will be communicated to the user app through that socket.
Is there a better way to do it? Please give your insight about the issue.
| 7db0e446b180e766b3324f211c5e61b7505cf16d328896cd0189e7ea0a804be3 | ['5deac1e2a7c941129dca87e44219943d'] | You can use ListPopupWindow to get what you want to achieve. You can set the more option icon or menu icon as anchor for the popup window.
ListPopupWindow mListPopupWindow;
mListPopupWindow = new ListPopupWindow(this, null);
mListPopupWindow.setWidth(300);
mListPopupWindow.setAnchorView(menuIcon);
mListPopupWindow.setHeight(200);
mListPopupWindow.setAdapter(yourAdapter);
mListPopupWindow.show();
You will get what you want.
|
9b66db56197fbca5d9743ea1e646cf24987dc47d591d8807dccb215162bb7db2 | ['5e25940c642648729a7968e6cf605a03'] | So after a fair amount of googling I managed to piece this one together. The data I was looking at was space separated so I used the fixed file width read method in pandas, following that I looked at the indices of a few known elements in the list and used them to break up the data into two dataframes that I could merge and process after. I removed the lines and NaN values as they were not of interest to me. Following that the fun began on actually using the data.
import pandas
widths = [28, 27 ]
df = pd.read_fwf(filename, widths=widths, names=["Times", "Items"])
data = df["Items"].astype(str)
index1 = data.str.contains('Data 1').idxmax()
index2 = data.str.contains('Data 2').idxmax()
df2 = pd.read_fwf(filename, widths=widths, skiprows=index1, skipfooter = (len(df)-index2), header = None, names=["Times", "Prin. Stress 1"])
df2 = pd.read_fwf(filename, widths=widths, skiprows=index2, header = None, names=["Times", "Prin. Stress 2"])
df2["Prin. Stress 2"] = df3["Prin. Stress 2"]
df2 = df2[~df2["Times"].str.contains("---")] # removes lines ----
df2.dropna(inplace = True)
| 04e97511471c216f2b4e047b044185088e98629196a51c1ecfa4fd7ab35d8add | ['5e25940c642648729a7968e6cf605a03'] | I have a txt file that is an output from another modelling program where it is looking at parameters of a modeled node at a time. The data output is similar to the following below. My problem is the data is coming as a single column and is broken occasionally by a new header and then the first section of the column repeats (time), but the second portion is new. There are two things I would like to be able to do:
1) Break the data into the two columns time and data for the node. Then add the node label as the first column.
2) Later there is another parameter for the node, not immediately under where the information would be in the form Data 2 Node (XX,XX) that is the same as one previous.
This would give me 4 columns in the end with the first being the node id repeated, the second being the time, third being data parameter 1, and fourth being the matched data parameter 2.
I've included a small sample of the data below, but the output is nearly over 1,000,000 lines so it would be nice to use pandas or another python functionality to manipulate the data.
Thanks for the help!
Name 20 vs 2
----------------------------------
time Data 1 Node( 72, 23)
--------------------- ---------------------
4.1203924E-003 -3.6406431E-005
1.4085015E-002 -5.8257871E-004
2.4049638E-002 6.8743013E-004
3.4014260E-002 8.2296302E-005
4.3978883E-002 -1.2276627E-004
5.3943505E-002 1.9813024E-004
....
Name 20 vs 2
----------------------------------
time Data 1 Node( 72, 24)
--------------------- ---------------------
4.1203924E-003 -3.6406431E-005
1.4085015E-002 -5.8257871E-004
2.4049638E-002 6.8743013E-004
3.4014260E-002 8.2296302E-005
4.3978883E-002 -1.2276627E-004
5.3943505E-002 1.9813024E-004
|
9910177f407b08aae72e02eb57705c50be587bf19dc279dcc246dd19a0597d98 | ['5e286ed22fe4407a8b1186a8dbe0ec3d'] | I've been using playing around with jUnit previously. Now I want to use Mockito for learning purposes.
I have a REST WS that looks like this:
@Path("postservice")
public class PostWebService {
private static final Logger logger = Logger.getLogger(PostWebService.class);
//Inject of the stateless post session bean for persisting purposes
@EJB
private PostServiceInterface postService;
/*Webservice for persisting of posts*/
@POST
@Path("postmessage")
@Produces(MediaType.TEXT_PLAIN)
public String insertPost(
@FormParam("post") String post,
@Context HttpServletRequest request
) {
logger.info("insertPost called");
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
User user = (User) request.getSession().getAttribute("user");
logger.info("Got user from session.");
if (user != null) {
postService.insertPost(post, user);
return "true";
} else {
return "false";
}
}
}
This following test case is probably wrong:
@RunWith(MockitoJUnitRunner.class)
public class PostWebServiceTest {
@InjectMocks
PostWebService pws;
@Mock
PostServiceInterface mockedPostService;
@Mock
HttpServletRequest request;
@Mock
User user;
@Mock
HttpSession session;
@Before
public void setUp() throws Exception {
Logger mockedLogger = mock(Logger.class);
}
@Test
public void testInsertPost() throws Exception {
PostWebService pws = mock(PostWebService.class);
String post = "Some post";
when(pws.insertPost(post, request)).thenReturn("true");
assertTrue(pws.insertPost(post, request) == "true");
}
}
I've gotten several errors and I decided to "remove" or make that specific part to pass to see what other errors I have:
First error:
java.lang.NullPointerException
at se.chas.fakebook.webservices.PostWebService.insertPost(PostWebService.java:41)
at se.chas.fakebook.webservices.PostWebServiceTest.testInsertPost(PostWebServiceTest.java:42)
Line 41 is: User user = (User) request.getSession().getAttribute("user");
Line 42 is: when(pws.insertPost(post, request)).thenReturn("true");
I initliazed the user object to null to see what happens and I got this error this time:
org.mockito.exceptions.base.MockitoException:
'setCharacterEncoding' is a *void method* and it *cannot* be stubbed with a *return value*!
Voids are usually stubbed with Throwables:
doThrow(exception).when(mock).someVoidMethod();
Then i removed the setCharacterEncoding method and the test passed. Why did it not pass before?
| 230306af61557b4afb402b7fe1d048f674498cc60c17b18bddbdfdbd06636f59 | ['5e286ed22fe4407a8b1186a8dbe0ec3d'] | I'm doing a school project where we are supposed to tap into an existing database using web services. I'm trying to figure out what best practice is when calling a web service from back end. I've been working with Servlets before and I know them pretty well.
This is my web service that front end uses and I need to know what the best practice is when calling an external web service within my application:
@GET
@Path("requestAccess")
public void getAccessToken(@Context HttpServletRequest request, @Context HttpServletResponse response)
{
String code = request.getParameter("code");
String clientId = "4_4inr3rkl04ys44kowwgoo0w4g8gow0s84cw0o0cg48kogsosc0";
String clientSecret = "4cxgpduio8isgcc8oggsw8wkcokcksk8wc8cc088w4w40owg4s";
String redirectUrl = "http://localhost:8080/salesgoals/rest/oauth/requestAccess";
try {
URL url = new URL("https://.../oauth/v2/token?client_id="+clientId+"&client_secret="+clientSecret+"&grant_type=authorization_code&redirect_uri="+redirectUrl+"&code="+code);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(url.openStream()));
String strTemp = "";
while(null != (strTemp = bufferedReader.readLine())){
System.out.println(strTemp);
}
} catch(Exception e){e.printStackTrace();}
}
This returns me an access token and the results from the external web service are JSON objects and the url object with inputstreamReader is something temp. I used to see if I was successful receiving access token.
Now I need to use the access token to invoke external web services but I dont know what best practice is when it comes to calling it within the application. I'm used to HttpServletRequest/Response objects. As I said all the data is returned as json.
|
30c794335a082c7d2b6df4b14bfc5896bf648ca468808b2c884d1921c83c1507 | ['5e31a1c70de04a36ae55d469ebff6f3a'] | извините за метку "wget" ничего другого я не нашёл и у меня нет достаточного количество репутации чтобы сделать свои метки. Я использую программу HTTrack Website Copier и там я не нашёл способ как узнать размер сайта перед скачиванием и хотелось бы узнать есть ли какой нибудь другая программа или что нибудь ещё чтоб узнать такую информацию? | 7ed43bee3ef3643456b1d7f42e6b4f7b1e68ed19462a241cddb21d46ec605ed8 | ['5e31a1c70de04a36ae55d469ebff6f3a'] | I have a PDE question that I am struggling to get started on. Suppose we have a function $u\in \mathcal{C}^2\Big(U\times(0,\infty)\Big)\cap \mathcal{C}\Big(\overline{U}\times[0,\infty)\Big)$ which solves
$$\begin{cases}
u_t-\Delta u=\sin(u)& U\times(0,\infty)\\
u=0& \partial U\times (0,\infty)\\
u=g& \partial U\times\{t=0\}
\end{cases}.$$
If $g(x)\le 1$, I want to show that $u(x,t)\le e^t$ for all $x\in U$ and $t>0$. What is a good approach I can employ to solve this question?
|
1961f902b7a54e738c11a3aad66f0a19c0eec77c6c807b25da5ad7c53ff8908f | ['5e372038451f479b834b668563686e5b'] | I accidentally entered the pattern on my android phone wrong too many times. It now wants a backup pin to unlock. I remember the pattern and can get into my google account, but have forgotten my backup pin. I then locked it with Android Device Manager, and can see that lock screen, but it doesn't seem to give me a password entry field. If I click the back button it takes me to the backup pin entry field. I would really like to avoid resetting my phone. How can I reset my phone?
| 58a59ddd9c37d9b9bd94efbee8218842523e401c030426caaf366cf0ab1e466a | ['5e372038451f479b834b668563686e5b'] | Let V=$P_5$(R) = all the polynomials with real coefficients of degree at most 5.
Let U={rx+rx^4|rϵR}
(1) Prove that U is a subspace.
(2) Find a subspace W such that V=U⊕W
For the first proof, I know that I have to show how this polynomial satisfies the 3 conditions in order to be a subspace but I don't know how to show this.
I am utterly confused with both of the problems. I read the textbook which confused me even more. Any help would be appreciated. Thanks in advanced!
|
c400ca80dbb2e5ec46f972565d3b2393edc665f7e4b78195d4f00e04180fe7c0 | ['5e3e09d599ce42b5b6215c0ddea94faf'] | I found the answer i started working with different ways to open i went through the ipynb file type on more time i understand that it is an html file written in json format so we can use html method to read it.
import codecs
f=codecs.open("DTR IMEI - VAS.ipynb", 'r')
print(f.read())
| 3be752add2eb53d20c255625533a7074943499a12eb4682e31f6749b4bac8a6c | ['5e3e09d599ce42b5b6215c0ddea94faf'] |
def request_sender(i):
request to the database with api calls
dict1 = {"file1":"id1,id2,id3",
"file2":"id4,id5,id6"}
for i in dict1.keys():
for j in dict1[i]:
request_sender(i)
currently my script automatically run when all the ids of a single file are updated and each file is an ipynb file i can import using %run the code is working perfectly.
The only problem here is i have to manually enter the file and ids the id's are inside the file also if am able to read the file into my python code and process the code using regex function or string manipulation i can find and fetch the keys.
but i don't know how to read an ipynb file into my python code
|
b15d9d411c8d3f24b5ae2eb9fc2599f3d714515428b945b98ccb1e88d04582f5 | ['5e3e940b49bb4dd0a50a878a45c8c866'] | I have been using the code here - https://www.wpbeginner.com/wp-tutorials/create-custom-taxonomies-wordpress/ - to create a custom taxonomy. But now I want that custom taxonomy info to be included in the site's default RSS feed. I dont want to create a new feed for the custom taxonomy, but merely include the custom taxonomy info in the default feed.
| 6241cd1c08d185dc2724f3b0d4da6f0dd0d8c4c177c950ee70ec4ab995a06897 | ['5e3e940b49bb4dd0a50a878a45c8c866'] | Essentially: Probably not.
<PERSON> actually comes directly from Latin, and comes from the same root as father.
<PERSON> comes from Latin, but from Patina instead. It's sometimes also referred to as "Patine", and in Italian it refers to the plural of patina. It's also akin to French Patene.
Either way, they both seemingly come from different roots. I wouldn't be surprised if they are related in Latin. But from the information available, it seems that they've always been still separate.
|
a8369bc24e91af0fe8dbc437e0d01a1576bf429f867df313a6c3491189fb6b07 | ['5e422d3dceb54124a259e9b6592e61c6'] | I'm trying to route messages from AWS SQS to AWS Dynamo DB using Apache Camel using the following route definition:
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="aws-sqs://my_queue?accessKey=${aKey}&secretKey=RAW(${sKey})&maxMessagesPerPoll=10&deleteAfterRead=true"/>
<unmarshal>
<camel:json library="Jackson"/>
</unmarshal>
<to uri="aws-ddb:my_table?accessKey=${aKey}&secretKey=RAW(${sKey})&readCapacity=15&writeCapacity=100&operation=PutItem"/>
</route>
</camelContext>
But on execution <PERSON> complains that the Dynamo Db URI is missing some required parameters:
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: aws-ddb://table?amazonDDBClient=%23ddbClient&amazonDdbEndpoint=ap-southeast-2&readCapacity=10&writeCapacity=10 due to: Status Code: 400, AWS Service: AmazonDynamoDB, AWS Request ID: KHA79STK78SHC2BG2R8HLPF7RJVV4KQNSO5AEMVJF66Q9ASUAAJG, AWS Error Code: ValidationException, AWS Error Message: 2 validation errors detected: Value null at 'keySchema.hashKeyElement.attributeName' failed to satisfy constraint: Member must not be null; Value null at 'keySchema.hashKeyElement.attributeType' failed to satisfy constraint: Member must not be null
The fun part is, these 2 parameters are not described anywhere in Camel DDB doc. I spent some time browsing the Camel source and found 2 undocumented URI parameters: keyAttributeName & keyAttributeType, which worked perfectly for me. (I hope this find of mine helps someone as well).
Now even more fun is that these should not be requested for inserting items into Dynamo DB, but I can no longer reproduce this error when I remove the 2 undocumented params from the URI.
So my questions are:
Why did AWS request hash key data for PutItem requests?
Why can't I reproduce this behaviour any longer?
I could not find any hints either in Camel or AWS documentation, googling only uncovers a handful of irrelevant results.
| 6adbfb6644bfe5d1b20faa571339b87cb099b52ce760421e861c54af14379bdb | ['5e422d3dceb54124a259e9b6592e61c6'] | It's an old enough question, but I'll add my answer for those who like me google this issue.
You must inherit your filter from GenericFilterBean and mark it as a Spring @Component
@Component
public class MyFilter extends GenericFilterBean {
@Autowired
private MyComponent myComponent;
//implementation
}
And then register it in Spring context:
@Configuration
public class MyFilterConfigurerAdapter extends WebMvcConfigurerAdapter {
@Autowired
private MyFilter myFilter;
@Bean
public FilterRegistrationBean myFilterRegistrationBean() {
FilterRegistrationBean regBean = new FilterRegistrationBean();
regBean.setFilter(myFilter);
regBean.setOrder(1);
regBean.addUrlPatterns("/myFilteredURLPattern");
return regBean;
}
}
This properly autowires your components in the filter.
|
b2c580bacc8be39f6bd9d933cb5d2ca3a3590cfdfb6854f0f43a928ad1d92009 | ['5e4b64e69fe54368ade8294e20efbc3e'] | @Joshua Witter
SELECT DISTINCT doc.id, c_user.contractor_name, c_user.company_id,doc.status,
doc.date_submission, dim.name div_name, gt.grade_name, dept.name dept_name
FROM contractor_user_master_ipms c_user, document_metadata dmd,
division_master dim, document doc
LEFT OUTER JOIN selected_grade_map sgm ON doc.id = sgm.doc_id
LEFT OUTER JOIN selected_grade_details sgd ON sgm.selected_grade_id =
sgd.selected_grade_id LEFT OUTER JOIN code_master cm ON sgd.sub_code_id =
cm.code_id LEFT OUTER JOIN department_master dept ON cm.department_id =
dept.id LEFT OUTER JOIN grade_master gm ON sgd.grade_id =
gm.grade_id LEFT OUTER JOIN grade_type gt ON
gm.grade_type_id = gt.grade_type_id WHERE doc.contractor_user=c_user.id AND
dmd.document_metadata_id = doc.md_id AND dmd.division_id = dim.id
AND sgd.last_grade_id is null AND doc.status != 'Forked' AND doc.status in ('Registration Initiated') AND c_user.reservation_category ='NULL' i did not make any changes to hibernate config files and same code is excuting successfully on other machine. It is returning Object array list, so i did not need to make any changes to bean files.
| a89505773706726a6c23a38405c3eaa0b31535ef10fea017e926a6b5e7ff9ba8 | ['5e4b64e69fe54368ade8294e20efbc3e'] | I need to prove that:
$$\left|\frac{d}{dt}\left\langle \varphi(t) , \varphi(t)\right\rangle\right| \le 2L \left\|\varphi(t)\right\|^2$$
and
$$\left\|x_0\right\|e^{-L(t-t_0)} \leq \left\|\varphi(t)\right\| \le \left\|x_0\right\|e^{L(t-t_0)}.$$
Where $\varphi(t)$ is solution of $x'=f(t,x),$ $x(t_0)=x_0,$ $f:[t_0,\infty)\times D \to \mathbb{R}^n$ is <PERSON> ($|f(t,x)-f(t,y)|\leq L|x-y|$) and $f(t,0)=0$.
For the first inequality i use use Cauchy-Schwarz and get $\left|\frac{d}{dt}\left\langle \varphi(t) , \varphi(t)\right\rangle\right| \le 2L \left\|\varphi(t)\right\|,$ but not the inequality to prove.
For $\left\|\varphi(t)\right\| \le \left\|x_0\right\|e^{L(t-t_0)},$ i used <PERSON>'s inequality, but $\left\|x_0\right\|e^{-L(t-t_0)} \leq \left\|\varphi(t)\right\|$ i do not know how to do it, and i have not used the hypothesis $f(t,0)=0$.
Could you tell me how can i demonstrate this?.
Thank you
|
34fa1e6988c0c060401250db8483a56b56d14114e6c8815bb916380f9c0dca3a | ['5e58d4c8334b4a7ab4512742b8bb9188'] | I'm renting a house in Washington DC but the house is going to be empty all of December since I am going home for Christmas. I'm very concerned about the pipes bursting. I would just leave the house at 55 degrees, but the thermostat doesn't work. I can turn on the heat, but it won't go to any specific temperature, it just keeps getting hotter and hotter. So obviously I don't want to be paying a ridiculous gas bill when no one is going to be here anyway.
So I think my best option is to just shut off the water to the house. I recently had a new water heater installed and I had the repairman show me where the main water valve is. The only thing I'm worried about now is whether or not I need to turn off the water heater? I'd rather not, since I'm not sure I would be able to get pilot light re-lit. I'm just not super handy. I was planning on setting it to lowest heat setting. Will this cause any problems if the water is shut off for a whole month? No one is going to be using the water. It is a natural gas water heater if that's important.
Thanks in advance for any advice!
| e543b9e94a04b4c21bb6b492bc9d14eb9d276a148a73f722a0f1c4eb420f7465 | ['5e58d4c8334b4a7ab4512742b8bb9188'] | I would just make it lightweight and fast loading as possible, with prominent links to a site map and the home page. As soon as I realize I've hit a 404, I usually dive for the back button, or just try to hit the home page of the site if I'm interested enough in whatever it is I was looking for. I almost never actually read what was on the 404 page. Maybe not a good habit, but I bet most site visitors are about as impatient as I am.
|
baf665735272c3c72f6ac8e2bcd8cee999ef7a7c5cdf6b0d59df81488ec3267d | ['5e803b9731424ea9a1c1feb41147fcf0'] | I believe that IP address is dynamic on Heroku.
When we first deployed our project there, we pinged the hostname that Heroku gave to us and used this IP in DNS record. Very quickly (in about a week) it became outdated and our project went down until we realized where's the problem.
So, you should use hostname that heroku assigns to every app if possible, otherwise you should probably invent some proxied solution using another node with known IP...
| f28e94f3fa2866aca7eaa65854932a1b3fbcd25148ad3805b9fd4f8c9c6d50f2 | ['5e803b9731424ea9a1c1feb41147fcf0'] | You should use git reset HEAD~1 (without --hard option)
It will do exactly what you want and HEAD~1 means here that you'd like to reset one commit, counting from the head (top) of the history.
This will not touch any files on the file system, so git will now see your edited files as changed but not committed.
|
7bf760fc5cc4ed153735112d35b12752fe079ac5b80aa10a2b33736af50631f3 | ['5e89499027244ae3a29371a5ab7f2f6d'] | Ex. Set of Coins - {1,2,5,10} ; MaxSum -20
We have to find a set of coins with minimum coins which can make any number up to 20.
I came up with a greedy approach depending on division of the max sum by largest coin gives remainder 0 or 1.
20/10 = 2 -- remainder =0 ; In case of zero remainder, reduce the quotient by 1 to get number of 10 coins(2-1=1) and continue with Maxsum =10(same as coin) and set{1,2,5}
Answer Set={10} (only 1 coin of 10 added - quotient-1)
10/5=2 -- remainder =0 ; Answer Set={10,5} (add only 1(quotient-1) 5-coins) MaxSum=5
Answer Set= {10,5}
set={1,2}
5/2= 2 -- remainder =1; In case of non zero remainder, add coins equal to quotient(add 2 coins of 2 ) and set Maxsum= Subtract one from Coin chosen from set(here it is 2) = 2-1 = 1.
Answer Set = {10,5,2,2} ( coins added =quotient )
Set={1}
Maxsum=1 (one subtracted from coin chosen from set)
Base Case- Set={1} and MaxSum =1 . So we need only 1 coin of 1.
Answer Set= {10,5,2,2,1}
I have tried the same logic on a number of cases. It works but is it correct?
| a4e0f080c422d75d4276fea53f087e956b20cfdd0edfb5e0bb552b03c8fdc320 | ['5e89499027244ae3a29371a5ab7f2f6d'] | Think how can Network Flow can be applied to this problem.
It should be something like that a flow passes from head of the crab to its feet. And flow coming to the head should be having a value equivalent to number of feet and each edge from head to feet of crab should have capacity one.
How can we achieve that?
It is definitely tough to come to this by oneself but I hope after seeing the example multiple times you can get the hang of this.
We have to create a new graph where original vertices are duplicated.
One set can give every vertex to have a chance of being head and other set can act as feet.
Keeping this in mind, the precise algo can be written as following:-
1. We create a new graph where original vertices are duplicated (vertex i becomes 2*i (head set) and 2*i+1 (feet set) ).
2.For i and j vertices connected in original graph make sure that 2*i and 2*j+1 plus 2*j and 2*i+1 gets connected in new graph with capacity 1.
3.source vertex (S) is connected to each 2*i vertex(head set) with capacity min(T, degree).
4. Each 2*i+1(feet set) vertex is connected to target vertex (T) with capacity 1
5. Maxflow is the answer.
The image below can give a decent idea of how the graph forms.
New Graph formation
Explanation of point 3:- every vertex in the headset should be connected with source with capacity min(t, degree) because if we would to like to have a max flow at this edge to be as large as T, not more than that because because crab cannot have more than t feet and value of capacity here is also limited by degree of vertex to which 0 is connected. A head cannot have more feet than its degree.
Explanation of point 4:- To ensure pairs are disjoint so that each vertex come only in one crab, every feet is connected with capacity 1 to the target 10 in figure.
I can post the code if it is required.
|
f080164e35a50c5facb34fb65c55ef9fad446b8b01e219d1b02fe95bddb70840 | ['5ea9ce2d1d14440998caee1927ceb936'] | I would store the value in an array and add and remove values from it and then write the array to the output instead of trying to parse the text each time:
var estadosS = [];
$(".checkboxEstados").live("click", function(){
var index;
if($(this).is(":checked")){
// append the id to the list
estadosS.push($(this).attr("id"));
}else{
index = estadosS.indexOf($(this).attr("id"));
if(index > -1) {
estadosS.splice(index, 1);
}
}
$("#holdEstados").val(estadosS.join(separador));
});
| f4f025d6434492a888287a717f0e6cb91d3c474c09210446ae9a7d4d1048f0bf | ['5ea9ce2d1d14440998caee1927ceb936'] | Ha, you posted the answer below before I could submit this one. I'm going to leave it hear anyway :)
original post -->
are you trying to store multiple form elements in the object, or are you trying to store multiple values from the same list box in object?
you can add properties to selectBoxChanges the same way you're currently adding them to your obj object:
selectBoxChange[this.id] = $(this).val();
however, if you're trying to do this for the same object repeatedly you would need to be able to use something other than the element id that would be able to be used by backbone.
if you wanted to append all of the different items a user selected from the drop down you could store an array of items:
if(selectBoxChange[this.id]) {
selectBoxChange[this.id].push($(this).val());
} else {
selectBoxChange[this.id] = [$(this).val()];
}
|
651ec124aaa316710dd66dcbac58663749876592cdf92f23b596535cae4a353f | ['5eaed672205b459894f2c96dd17a55b2'] | This happened to me with a custom component for Wear, but is a generic piece of advice. If you're using a Stub (such as I was using WatchViewStub), you can't just put the call to findViewById() anywhere. Everything inside the stub must be inflated first, which doesn't just happen after setContentView(). Thus, you should write something like this in order to wait for that to happen:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_wear);
final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
@Override
public void onLayoutInflated(WatchViewStub stub) {
myCustomViewInst = (MyCustomView) findViewById(R.id.my_custom_view);
...
| e5f08c67caf7a7419363658880d6063de1ccda5273b4e34176db80615c6ada67 | ['5eaed672205b459894f2c96dd17a55b2'] | Try this:
/^(([A-Za-z]+[\-\']?)*([A-Za-z]+)?\s)+([A-Za-z]+[\-\']?)*([A-Za-z]+)?$/
It expects optionally [at least 1 alphabetical character followed by a ' or -] an indefinite number of times. There must be at least one alphabetical character before a required space to ensure we are getting at least the first and last name. This entire pattern is grouped to accept indefinite repetition (for people who like to use all their names, such as <PERSON>), but must appear at least once, by means of the + sign right in the middle. Finally, the last name is treated the same way as the other names, but no trailing space is allowed. (Unfortunately this means we are violating DRY a little bit.)
Here is the outcome on several possible pieces of input:
"<PERSON>": true
"<PERSON>": true
"<PERSON>": true
"<PERSON>": true
"<PERSON>": true
"<PERSON>": false
"<PERSON>": true
"<PERSON>": true
"This-Is-A-Crazy-Name <PERSON>": true
"---- --------": false
"'''' ''''''''": false
"'-'- -'-'-'-'": false
"a-'- b'-'-'-'": false
"'-'c -'-'-'-d": false
"e-'f g'-'-'-h": false
"'ij- -klmnop'": false
Note it still doesn't handle Unicode characters, but it could possibly be expanded to include those if needed.
|
794687480a18ea73359f4bf1c8938547c2fd8f95368f8de1b180b01337ef10c6 | ['5ec0e96ecdd44c0eaaac9c44a330ab8c'] | If you do not want to use a library, one solution to showing 'written' months would be to create an array containing all month names:
var monthName = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
From there, you can use this array to display the month name in a string:
var d1 = new Date(milliseconds),
d = d1.getDate(),
m = d1.getMonth(),
y = d1.getFullYear();
var dateString = monthName[m] + " " + d + " " + y; // Oct 4 2013
| 6e9d014def985a9927a7ed6087ff7ae73eca12c422299859173972bd0ddb555d | ['5ec0e96ecdd44c0eaaac9c44a330ab8c'] | The best way to achieve this would be to have your horizontal nav bar behave as a table by using display: table on your ul; and display: table-cell on your li.
I would be able to give you some better instructions if you posted some code; but here's an example:
nav {
width: 500px; /* This would be set to the width of the existing container */
}
nav ul {
list-style: none;
margin:0;
padding:0;
display: table;
width: 100%;
}
nav li {
text-align: center;
display: table-cell;
}
nav a {
display: block;
text-align: center;
}
|
22225ae7257d94c497a406d89bb85a9e569abc3cf7d193e77983b012dacddb53 | ['5ecd3d8ecf6345418333c0e185d1a948'] | In documentation I have seen, To add multiple events they used:
$('#calendar').fullCalendar({
events: [
{
title : 'event1',
start : '2010-01-01'
},
{
title : 'event2',
start : '2010-01-05',
end : '2010-01-07'
},
{
title : 'event3',
start : '2010-01-09 12:30:00',
allDay : false // will make the time show
}
]
});
But I am unable to insert multiple event on this where event date will be provied by db. So One loop is necessary for multiple event. Can somebody help me to this ?
| 76aa7659e2fe2c9ca51e886b235b3050cb928cebf78c68efc33527af120bdb3e | ['5ecd3d8ecf6345418333c0e185d1a948'] | I need some help to show multiple data by clicking a radio button.
My code: html
<input type="radio" ng-model="opportunity" name="buy" value="buy">Buy
<input type="radio" ng-model="opportunity" name="services" value="services">Services
<input type="radio" ng-model="opportunity" name="social" value="social">Social
<div ng-show="isShown('buy')"> Test1 </div> // when radio button 1 is active
<div ng-show="isShown('services')"> Test2 </div> // when radio button 2 is active
<div ng-show="isShown('social')"> Test3 </div> // when radio button 3 is active
<div ng-show="isShown('buy')"> Test4 </div> // when radio button 1 is active
<div ng-show="isShown('services')"> Test5 </div> // when radio button 2 is active
<div ng-show="isShown('social')"> Test6 </div>// when radio button 3 is active
Angular Js:
$scope.opportunity = '';
$scope.isShown = function(opportunity) {
return opportunity === $scope.opportunity;
};
When I run this code Test1 or Test2 or Test3 is shown. But Test4, Test5, Test6 will not show. How can I solve this problem
|
0cb81d7eae6b85c9b235b19ef308d3a9a38c457d95e7b9cec123ea199ef59b60 | ['5ecd6fd49d2e41a6a595f1ae7d03e508'] | I was having a similar issue to you, and I found that modifying my headers and including RobustFactory() to deal with 'bad' HTML solved the problem.
`br = mechanize.Browser(factory=mechanize.RobustFactory())
br.set_handle_robots(False)
br.addheaders = [('User-agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:<IP_ADDRESS>) Gecko/20070725 Firefox/<IP_ADDRESS>')]`
This was after a lot a fiddling around with them. This solution works for the general case as well as the specific URL I was using, but adding:
br.addheaders.append(['Accept-Encoding', 'gzip'])
may be necessary if the URL you are trying to access is GZipped. You can check if this is the case here: http://checkgzipcompression.com/
| 5016100aab1ec326f593fabc6cf848a00790271b99888bf69699380ea621f020 | ['5ecd6fd49d2e41a6a595f1ae7d03e508'] | I find that this is easier to do with the method below:
private String getXPath(String xml) throws XPathExpressionException {
String xPathResult= "";
InputSource source = new InputSource(new StringReader(xml));
XPath xpath = XPathFactory.newInstance().newXPath();
Object jaxBObject = xpath.evaluate("/customers", source, XPathConstants.NODE);
xPathResult= xpath.evaluate("name", jaxBObject);
return xPathResult;
}
This should give you the value inside the name element. I hope this is useful!
|
fcfa00aa9d1c9d2d0ba91b0066ed0868156dac76e25512f188eaf90dce50933a | ['5ece6e3acbe24bb2a794e4abe0137faa'] | HTML, this is a short piece of the list
<div id="navigation"><div id="navHorizCont">
<ul>
<li><a href="#">CAMP</a>
<ul class="listhieght">
<li><table width="200" cellpadding="2">
<tr>
<td><a href="link">Tents</a></td>
<td><a href="link">Books</a></td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
CSS this is the style for the box that goes around the two columns of text
#products {
background-color: #0F0;
width: 750px;
margin-right: auto;
margin-left: auto;
background-image: url(images/product_background.gif);
background-position: center 1px;
background-repeat: no-repeat;
}
| ecae37d7c6c95ab274b7a95082405869f9e60eaa2ae8e5150bed62c520695a5e | ['5ece6e3acbe24bb2a794e4abe0137faa'] | I have been working on the Eric Meyer CSS Reset. I have a site that is text heavy. The reset works for the margins. But it hasn't been working for font and font size. Firefox seems to make all text smaller even though I have a reset in place. Is there any way to fix this in the CSS code?
Or are there any Firefox hacks that would work? If you want to see what my problem is load my page in chrome, and then load it in Firefox and compare: http://emilymagnuson.com/mynews/index.html
Also, I am a beginner, so if there is something I'm blatantly missing, please tell me. It would be so appreciated.
Thank you!
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
#box {
background-color: #0F3;
margin: 0px;
float: left;
height: 200px;
width: 300px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
font-family: "Courier New", Courier, monospace;
font-size: 1em;
color: #F00;
}
|
e2844b4dd2b8ebf7c0992bbfc64b757b65692125e1eed9ea420f0583a9779111 | ['5ed424ab802345fe867f571ed02d575e'] | ela representa a medida semanal de uma substancia em plantas ao longo de um ano e quero encontrar os intervalos iguais para saber em que semanas ocorreram. não sei como refazer essa logica de outra forma e pensei em Excel(VBA) pois os dados estão nesse formato. se tiver alguma sugestao ficarei agradecida! | ef70aca0430ef9121d03e69e896b2e6d8b446702c3a01f1fab7637aa769b2a39 | ['5ed424ab802345fe867f571ed02d575e'] | Final code(this works OK):
rankall <- function(outcome, num = "best"){
if (outcome == "heart attack"){
col <- 11
}else if(outcome == "heart failure"){
col <- 17
}else if(outcome == "pneumonia"){
col <- 23
}else{
stop("invalid outcome")
}
data <- read.csv("outcome-of-care-measures.csv", colClasses = "character")
data <- data[, c(2, 7,col)]
colnames(data) <- c("Hospital", "State", "value")
data$value <- as.numeric(data$value)
data <- data[complete.cases(data),]
data <- split(data, data$State)
N <- length(data)
data2 <- vector("list", N)
for(i in 1:N){
data[[i]] <- data[[i]][order(data[[i]]$value, data[[i]]$Hospital),]
if(num =="best"){
t <- 1;
}else if(num == "worst"){
t <- nrow(data[[i]])
}else{
t <- num
}
data2[[i]] <- data[[i]][t,]
}
return(data2)
}
|
4da9521a76b564bc241f9807552eea57bbf2546d4b461a3402787e5779ebe6db | ['5edb44b6e8c541c8bff6cba42026d31a'] | I am running a mixed-effects model with the lme4 package. The model specifications are: log(dv) ~ 1 + A*B*C + (1+A*B|random1) + (1+A|random2), where A and B are within-group conditions and C is a between-group condition.
The first problem is that the coefficients for fixed effects are on the log scale and only the intercept makes sense when I do exp(coef) (see below).
The second problem is even if I do an exponentiation transform, how should I account for the random-effects structure? As I understand it, the random-effects structure affects the fixed-effects coefficients (I might be wrong here).
This is a sample output of my fixed-effects coefficients:
Estimate
(Intercept) 6.533079
A1 0.062171
A2 0.077409
B1 -0.184366
B2 -0.154115
C 0.152238
A1:B1 -0.015494
A2:B1 -0.017655
A1:B2 0.001674
A2:B2 -0.003641
A1:C 0.013021
A2:C 0.038995
B1:C 0.010087
B2:C 0.013721
A1:B1:C 0.016025
A2:B1:C 0.<PHONE_NUMBER>
A1:B2:C 0.012746
A2:B2:C 0.003113
Now, exp(6.533079) gives 687.5118, which makes sense in the original scale, but the rest of the numbers do not make sense once transformed.
I want to see effect sizes in the original scale. For instance, the group difference between the means of two levels of C is 135. I know that the estimates from the model will not exactly match this number, but I want to see what is the estimated effect size that the model gives.
| 55a8c2662401eb4cb2d8e93e67c4390b02e3c9e865c67b28def1934d7076a454 | ['5edb44b6e8c541c8bff6cba42026d31a'] | Thanks. This seems to work. I do the following:
`> exp(6.533079) #Intercept
<PHONE_NUMBER>
> exp(6.533079+0.152238) #intercept + coefficient for C
<PHONE_NUMBER> #this seems to large
> 800-687 #need to subtract
[1] 113 #this looks close to the expected effect size`
I think my contrast coding is wrong here, so I get a smaller value (113) then expected (~135). |
2e214f6f7571207b8cfd397617a093900890f392a724339ce0e6619bf35e0735 | ['5ede51dcde4640fe834ec7b94b038194'] | My question was really twofold:
can you pull off having more than one style of layout (for instance, a bubble graph inside a force-directed graph) in a sensible way with D3, or is D3 the wrong tool for such a thing, and
Can you use D3 layouts for each of these layouts, or do you have to do everything custom.
In the end, the design changed, and no longer called for this odd scenario. Being much more familiar with D3, though, I think I can answer.
Yes. It can be done. Each layout is its own discrete object, with its own data on which to work, and can be given its own DOM elements to populate. Creating two layouts that even shared the same data and DOM outputs would probably work, if you could manage the interaction between the two (making sure one only overrode changes from the other when desired).
What I know you can do for sure is manually manipulate anything that D3 is doing. At one point during development, actually, I did have two layouts on the same page, come to think of it. I was laying out half the graph with pre-determined x/y coordinates, and allowing the rest to be laid out by the force directed layout. That first set, the manually placed nodes, could have been placed by some other logic than pre-determined coordinates, and the functionality would have been roughly the same.
| de9b1896863e34f11cc0ffa14248e82d817cdc0cd38e744a64dc1db981cdd49a | ['5ede51dcde4640fe834ec7b94b038194'] | I'm trying to build a force-directed layout, wherein the connected nodes have their own internal layout that is not simply a recursive force-directed layout (which, I believe, would be possible with the hierarchy layout). The "inner" layout would be custom, but, for illustration let's say I wanted the nodes, internally, to have a partition layout. Is this possible?
|
7ac1e2455bdaebd9c20da59acdcd2931cea385218de5cb3b8fc4f484a21f28b6 | ['5edf83e15613427ca42751f0961a9256'] | I decided problem. I need to destroy object which I deleted from array because it is used in rendering.
I add
this.movieclip.destroy();
this.movieclip = null;
in Monster.prototype.updatePosition
So I have
Monster.prototype.updatePosition = function () {
if (this.movieclip.x > Position.END_X - this.movieclip.width / 2) {
this.movieclip.x -= Position.STEP_X;
} else {
this.hideEnemy = true;
this.movieclip.destroy();
this.movieclip = null;
}
};
| 8c04d6e603c2879e5335a9c4df3e5f32cb7a6fcbf556673155a95d8f349a2f82 | ['5edf83e15613427ca42751f0961a9256'] | I'm writing a game on PIXI.js. The bottom line is that everything works as intended. But at some point in the console pops up a warning "WebGL: INVALID_ENUM: activeTexture: texture unit is out of range" and textures in the game a little flash.
This error appears in a strange time and at the same time lost
There is a class for creating a monster and his method that moves a monster:
function Monster (monsterImages, startX) {
this.hideEnemy = false;
var frames = [];
for (var i = 0; i < monsterImages.length; i++) {
var texture = Texture.fromImage(monsterImages[i]);
frames.push(texture);
}
this.movieclip = new PIXI.extras.AnimatedSprite(frames);
this.movieclip.scale.x = -1;
this.movieclip.anchor.set(0.5);
this.movieclip.width = 170;
this.movieclip.height = 140;
this.movieclip.x = startX;
this.movieclip.y = getRandomIntValue(Position.START_Y + this.movieclip.height / 2, Position.END_Y + this.movieclip.height / 2);
this.movieclip.animationSpeed = 0.4;
this.movieclip.play();
gameScene.addChild(this.movieclip);
}
Monster.prototype.updatePosition = function () {
if (this.movieclip.x > Position.END_X - this.movieclip.width / 2) {
this.movieclip.x -= Position.STEP_X;
} else {
// this.hideEnemy = true;
this.movieclip.x = Position.START_X;
this.movieclip.y = getRandomIntValue(Position.START_Y + this.movieclip.height / 2, Position.END_Y + this.movieclip.height / 2);
}
};
I create 4 monsters:
for (var i = 0; i < 4; i++) {
enemy[i] = new Monster(monsterSprites[i], 1920 + 170 + gapBetweenBirds);
gapBetweenBirds+=500;
}
Then I move them by method "updatePosition", and if it is out of the scene, then I cut out of an array of this monster, and to insert the new.:
for (var i = 0; i < enemy.length; i++) {
enemy[i].updatePosition();
if (enemy[i].hideEnemy) {
enemy.splice(i, 1, new Monster(monsterSprites[getRandomIntValue(0,monsterSprites.length - 1)], 1920 + 170));
}
}
The problem came when I began to replace the monster in the array. I think the problem is out there, but due to the little experience I can not catch her.
|
6df183f163c04603f498d261ca941225240d361a2c86b20123a3de5f2156a8cd | ['5ee3058e76c8492a8b747408a6418700'] | Hi <PERSON>, I recently installed the Ubuntu on my laptop on Lenovo T440 Thinkpad laptop. Wifi on Windows 10 works fine but on Ubuntu 18.04.2 it's not working despite providing id/password.
output of commands you shared are stated below
nmcli d=
Device Type State Connection
wlp3s 0 wifi disconnected --
enp0s25 ethernet unavailable --
lo loopback unmanaged -- | b631df88e01a26b9ec44abda7805f5b549c5dec5a7a440547695f742b9d90d2b | ['5ee3058e76c8492a8b747408a6418700'] | I'm fairly new with creating a web application and would like to seek help regarding dojo and zend framework. I'm having problems with validation on form submission and also need to create dynamic element when a button inside the form (add new moderator button) is clicked.
What I need is:
A dialog that pops up which includes the zend form.
Form should have validation.
Form should create dynamic text element when "new moderator" is clicked.
On form submission.
If an error occurs during validation show the errors on the
popped up dialog and let user fix the error.
On success redirect the user to the parent page that calls the popup dialog.
What I have right now:
A form where I put validations on element creation.
A view element that has a declarative dijit dialog where I "echoed"
the zend form.
A button that will fire and show the dijit dialog.
A controller that validates form data and add form errors if any.
Problem
Validation set on element creation is not being fired and shown in form.
Where and how will I add the creation of new element when the "new moderator" button is clicked.
Here are my trimmed out code:
Form
class Form_Test
{
public $processed = false;
public function init()
{
parent<IP_ADDRESS>init();
$this->setAttribs(array('name'=>'test'));
$this->setAction('/myapp/new')->setMethod('
$this->addElement('ValidationTextBox', 'topic', array(
'label' => 'Topic: ',
'required' => true,
'trim' => true,
'validators' => array("alnum"),
'filters' => array(new Zend_Filter_StringToLower(),
new Zend_Filter_StringTrim()
)
)
);
$this->addElement('SimpleTextArea', 'desc', array(
'label' => 'Description: ',
'trim' => true
)
);
$this->addElement('ValidationTextBox', 'moderator', array(
'label' => 'Moderator: ',
'required' => true,
'trim' => true,
'validators' => array("EmailAddress"),
'filters' => array(new Zend_Filter_StringToLower(),
new Zend_Filter_StringTrim()
)
)
);
$this->addElement('SubmitButton', 'submit', array(
'label' => 'Create'
));
}
}
View
<button class="myButton" type="button" onclick="dijit.byId('formDialog').show()">
New Topic
</button>
<div dojoType="dijit.Dialog" id="formDialog" title="Topic" style="width:500px; height:300px;">
<?php echo $this->form; ?>
</div>
Controller
public function newAction()
{
$form= new Form_Test();
$this->view->form = $form;
$form->submit->setLabel('Create');
$values = $form->getValues();
if( $this->_request->isPost())
{
if($form->isValid($_POST)){
$topic = new Application_Model_Topic();
$result = $topic->createNewTopic($_POST);
if($result == false){
$form->addError($result->error);
}
}
}
$this->view->form = $form;
// How to redirect to form if there's error?
$this->_redirect('/myapp/index');
}
I've seen some post with creating a dynamic element that uses ajax but it is not using a dijit dialog box on a form and mostly are in jquery where I also don't have any background.
I've already searched on the net but to no avail. Please help me out. Thanks in advance.
|
676089be0ab62542a109df52d35ce5b530f8276042ed14084dd976f3008e44f6 | ['5efd5c832b2b4d8480875e5a9deba2dc'] | I am new to WordPress and I'm wondering if anyone could help me understand how I should go for rendering the output of a plugin when a form of a widget is submitted in the front-end.
I'm developing a plugin that has two "views" and one widget. The widget is just a form with a dropdown menu to select a value from a list. When a value is selected, the form should submit this value to a page where the first view of the plugin is rendered. This first view should print links that take the visitor to the second view, like the first view is a list of rows, and the second view is the details of the row selected from the first view. This is the goal.
I've been reading the Plugin API, but I don't seem to have found a proper solution. My question is: should I only rely on the Shortcodes put on certain pages to render the plugin in the front-end? Is this the only way?
I tried to submit a custom action with the form of my widget (with action get_admin_url().'admin-post.php'), and hook it in the plugin with:
add_action('admin_post_customaction', 'handle_customaction');
add_action('admin_post_nopriv_customaction', 'handle_customaction');
function (handle_customaction) {
//do something
}
but the page admin-post.php truncates the execution, so I guess this practice is only for executing tasks and then redirect, not to display content within a page in the front-end.
Is there a solution beside using Shortcodes? Because then my question would be "which action attribute should I use in the form of the widget?", like how do I know which pages use the Shortcode I need?
Maybe by creating a custom post type? Do you know any plugins that do something similar that I could check? Any hints would be much appreciated!
| 83219575bcc6fd66bf5fb8987112358d24e82fe81b7abdb42a801dcb5a4bb1c9 | ['5efd5c832b2b4d8480875e5a9deba2dc'] | I am using Sublime Text 3, build 3114. It should be the latest version available today. Before installing this update, the JavaScript code was highlighted correctly when using PHP in this context. Now I am losing all the syntax highlight functions for JavaScript unless I close and re-open the tag <script>in the flow.
Here is a screen shot of the issue I'm having (I just wrote a few random lines to give the idea):
The last call of the removeClass method in the function myFuncTwo has lost the syntax highlighter because I used <?php echo $id; ?> in the line above. Any lines of JS code below the PHP, even outside the JS function, will not be highlighted. If I closed the </script> tag and I re-opened it, the syntax highlighter would start working again.
Has anyone faced this issue? Is there anything I can do for the PHP Highlighter? I haven't modified any theme files and I am using the default theme Twilight. Also, the syntax highlighting is set to PHP because the file contains mostly PHP code, JS and HTML. If I set it to 'JavaScript', then the syntax highlighter would ignore the PHP code by giving it the green color of "test" there in that line.
Thanks a lot for sharing your thoughts!
|
5d75ccdc680be8b67c4c4dce1ceeee596210c2fec8ee376a5078ebf16b9393e7 | ['5f0ba4c05bcd4887902b5a0dd0e31c97'] | you could try placing all the contents of the text file in a list, and iterate through that list to delete that particular file.
import os
file_list = [x.strip("\n") for x in open("file_containing_pys.txt","r")]
for file in file_list:
os.system("sudo kill $(ps aux | grep 'python %s.py' | awk '{ print $2 }')"%file)
/ogs
| fad9d0797388d13c6da58a006dfa1c1c0ae53e3061e5235bad61dc7459c6faee | ['5f0ba4c05bcd4887902b5a0dd0e31c97'] | You could try saving your data as a list and dump it into a json file, given that you already imported json.
z = [x for x in data1]
with open('your_data.json', 'w') as out:
json.dump(z,out)
alternatively, you could write z = [x for x in data1] as:
z = list()
for x in data1:
z.append(x)
/ogs
|
47eecc6e0b64d33aaf76aa0cab1197ce09b33aa650fefc3f4b54ab4a3a88c599 | ['5f0bc31efd9d4a6897b755989aa1a068'] | When I try to run that code, that error appears: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
And I have no idea of what is the problem, someone can help me?
CODE:
<?php include_once("includes/head.php"); ?>
<?php require_once("includes/connect/connect.php"); ?>
<?php require_once("includes/functions.php"); ?>
<?php require_once("includes/jquery.php"); ?>
<?php function friend_request_notification(){
global $db;
global $userid;
$userid = $_SESSION['userid'];
$query_id_see = "SELECT user_id FROM friend_requests WHERE user_id={$userid}";
$result_set3 = mysql_query($query_id_see, $db) or die(mysql_error());
$insert_table = "INSERT INTO friend_requests_notificated (id, user_id, user_id_requester)";
$change_table2 = mysql_query($insert_table) or die(mysql_error());
$select_table = "SELECT id, user_id, user_id_requester FROM friend_requests WHERE user_id={$userid}";
$change_table1 = mysql_query($select_table) or die(mysql_error());
if ($id_requests = mysql_fetch_array($result_set3)){
if ($id_requests2 = mysql_fetch_array($change_table2))
{
}
if ($id_requests1 = mysql_fetch_array($change_table1))
{
}
}
else
{
}
}
friend_request_notification();
?>
| ff4eb26e5c8d78f248f00b7585097af7a5982006b4a312e8cc8b43b42f1468b6 | ['5f0bc31efd9d4a6897b755989aa1a068'] | So what is happening is a little bit weird and I have no clue what is causing it.
After some minutes after I login into my account on my website and I refresh the page it changes to the last user that logged in so I have full access to that user account just by refreshing it, because it changes to that user.
So if I'm logged in with User1 account and I refresh after some minutes I end up on User2 account and have full access to the account just like I had logged in into that account.
I think it's something to do with the Session but I have no clue what it is.
I have this on the beggining of pretty much every page:
<?php
set_time_limit(0);
session_start();
include_once("includes/global.php");
db_connection();
if (!is_login())
{
header("location: login");
}
else
{
?>
And here it is the function that checks the login:
function is_login()
{
if (isset($_SESSION['userId']) && ($_SESSION['username']) && ($_SESSION['regDate']))
{
return true;
}
else
{
@session_destroy();
return false;
}
}
If you need any more code let me know, because I have no clue what is the problem so don't know what code to show.
|
9c6d79683d77c7d609a75e3db908ddf7f5efb21581ec670873ef632ae6338efa | ['5f0e29712ba244a98dde9b0c87ba39a9'] | It is another way :
public static void main(String[] args) {
System.out.println("Enter the three letter name of triangle:");
Scanner in = new Scanner(System.in);
String threeName = in.nextLine();
String firstName = threeName.trim().substring(0, 1);
String secondName = threeName.trim().substring(1, 2);
String lastName = threeName.trim().substring(2, 3);
System.out.println(firstName);
System.out.println(secondName);
System.out.println(lastName);
System.out.println("Enter coordinates of vertex " + firstName.toUpperCase());
//And continue this code
}
| e1e3b0936997623a62693b2f59d59fab3e0fd16eee5bbf55c711ae5925b48066 | ['5f0e29712ba244a98dde9b0c87ba39a9'] | Maybe it can help you :
http://zetcode.com/tutorials/javaswingtutorial/resizablecomponent/
Disadvantage of code
In this code we do not layout manager. So if we have a component in center of jframe when this jframe is re-sizing this component maybe display in corner of jframe. You can solve this problem but it is a little complex. We can talk about this problem if you want.
|
d181a6081ab3ed37d7d7a8f6cb0d115dc0ad1af2e88afcac896833031be5a250 | ['5f1139ad9eac4735bad6d4ab54e77287'] | Yes, I could recover that document. Here are the steps:
a) Open the recycle bin, find the .asd file with the right title and modification date, and restore it. Write down its file path (or copy it into a text file). (This worked for me.)
b) Search your user directory for any .asd files with the right title and modification date. Note the file path.
Open Word. Go to File > Info > Manage Document > Recover Unsaved Documents
Navigate to the restored file, highlight it, and click Open
Save it in a location where you can find it again.
I got this approach (except for step 1) from EaseUS.
| 4a69debee237bbccb79d05177eb3a0febbe27c13e99760f44375487597c78682 | ['5f1139ad9eac4735bad6d4ab54e77287'] | Many ASUS laptops have a suffix added to their model number. I'm wondering what this stands for and what the differences between machines with different suffixes can be?
For instance on my laptop, it says BU401LA-FA273G. According to the ASUS website, BU401LA is the model number. Then what does the FA273G mean? In general what can be the differences between my BU401LA-FA273G and, say, a BU401LA-FA366G?
(In particular I'd like to know whether the charging port can differ but please give a general answer so it may be of use to others.)
|
0d1df53818d5bf02eb62d31824608fc8c4be46e4a82a564c44af80e9b1333e08 | ['5f194b2854e7474c844e3a1d6cf3d859'] | I'm using a UITableViewDiffableDataSource with my UITableView and it works as expected. However I'm having trouble updating an item in the snapshot. I have a simple sample where;
enum Section {
case one
}
struct Item: Hashable {
let identifier: Int
let text: String
public func hash(into hasher: inout Hasher) {
hasher.combine(identifier)
}
public static func == (lhs: Item, rhs: Item) -> Bool {
return lhs.identifier == rhs.identifier
}
}
with the initial snapshot created using
var snapshot = NSDiffableDataSourceSnapshot<Section, Item>()
snapshot.appendSections([.one])
snapshot.appendItems([
Item(identifier: 1, text: "One"),
Item(identifier: 2, text: "Two"),
Item(identifier: 3, text: "Three")
])
dataSource.apply(snapshot)
If I were to attempt updating an item using
var snapshot = dataSource.snapshot()
snapshot.reloadItems([
Item(identifier: 2, text: "Foo")
])
dataSource.apply(snapshot)
nothing happens. My expected result is for the text of item with identifier = 2 to be updated to "Foo". Note I have not included the table view cell provider code here.
I have read similar posts such as
How to update a table cell using diffable UITableView
and
Can UITableViewDiffableDataSource detect an item changed?
but the answer isn't clearly obvious.
| dde0a1b58e4bf4fae029d177a19a4cd0af815dda250fecbce0f1785fb0d3b098 | ['5f194b2854e7474c844e3a1d6cf3d859'] | I have a need to specify different value and display values in an option row (PushRow and MultipleSelectorRow). By display values I mean the values that are displayed in the option selection view controller (not the concatenated list of selected values displayed in the form).
I know this can be done by using a custom class that conforms to Hashable and setting the options property of the row to an array of such class instances.
$0.options = [
MyStruct(value: "1", displayValue: "one"),
MyStruct(value: "2", displayValue: "two"),
MyStruct(value: "3", displayValue: "three")]
However this results in the value of the so configured row being of type MyStruct when getting the form values using form.values as opposed to the actual value I'm interested in being MyStruct.value. This creates the needless complexity of having to map the form values accordingly.
I was wondering if there is a more desirable approach to achieve this? I.e. the values of the row remain a simple data type (say String or Int) but the displayed values in the option selection view controller can be customised.
|
90888d3a96c0727d36b1060d83df0aa92ca59db80543c5c1de048a85d258ed1e | ['5f2b5c0560874fb9811b590ce30b8372'] | Is there a version of poolmon available for Windows Server 2008 64-bit? This KB article says it only applies to versions up to Server 2003. Is this tool (or something equivalent) available for Server 2008?
(I'm new to the Windows Server world, and looking for tools to help track down an apparent kernel-space memory leak on some servers running particular web services. I would also welcome any suggestions for other tools to use.)
| d0b08c1d52cae599d810ea4e5479b0d88f126b6730f8e0b264bfb7b7046b4c27 | ['5f2b5c0560874fb9811b590ce30b8372'] | I'm trying to gauge the progress on a 4gb truecrypt volume I'm putting on my idisk. The progress indicator only has one item and perpetually stays at 0%. Is there any way to know how much of the file I've uploaded?
Is iDisk capable of resuming this upload? I move between the office and because of the size of the file I haven't had a continuous upload session.
DropBox does a much better job of this. Should have just gone with that ;)
|
042075165db27a1bd533ac03e743f881983650e89a4213a8040da4e43d11064b | ['5f4234cc06ca44d3bf757e2e18d2d46f'] | I added a field to a view model for a Document that should allow the user to associate it with a Tenant. It works fine if the user does assign a tenant, but if they select the null option from the dropdown, then the validation tells me that "The ItemID field is required.", where ItemID is a field on TenantViewModel.
It occurs to me that perhaps I'm using editor templates wrong - I'm trying to select from a list of tenants, not edit a tenant. If that's wrong, let me know, and maybe suggest a better way to get the dropdown.
namespace TenantPortal.Models
{
public class DocumentViewModel
{
...
[UIHint("SelectTenant")]
public TenantViewModel Tenant { get; set; }
}
public class TenantViewModel
{
private Tenant _ten = null;
public int ItemID { get; set; }
public string Display_Name { get; set; }
public string Legal_Name { get; set; }
...
}
}
Editor Template: SelectTenant.cshtml
@using CMS.DocumentEngine.Types.Tenantportal
@using TenantPortal.Models
@model TenantViewModel
@{
Layout = null;
var opts = new SelectList(TenantProvider.GetTenants(), "ItemID", "Display_Name");
}
@Html.DropDownListFor(model => model.ItemID, opts, "(none)")
| 1f5de05ad724d1ad91282892c0ecb657952ece556df96b4760eef51649e856ae | ['5f4234cc06ca44d3bf757e2e18d2d46f'] | I have site where editors may use a [display_phone] shortcode to insert a phone number into text. The number varies based on cookies the viewer may have; we make an AJAX call to get the desired number.
I'm trying to replicate this on an AMP page. I've done it successfully with an amp-list element, however, that's a block element. I want an inline element that will inherit font size and other styles from its parent. I tried forcing the amp-list to inline or inline-block, but it applies styles to elements inside its template that can't be overridden.
I looked into using other elements for display and using amp-state as a data source, but amp-bind doesn't run without user input, and I need this phone number to show before any input. I could conceivably create an amp-list for every block-level section where an editor could insert the shortcode, but that seems like a bad idea.
Does anyone have any better ideas?
|
61f7793c303d8760b2cd1a584d539fd4e897d47c6bf8966160d5d3454496d7bc | ['5f47395469c5467c8b398ac9f99c4b58'] | нужно по заданному пользователем N вывести N членов этой последовательности.
на данный момент реализована сумма такой последовательности. но увы, не знаю, как вывести элементы должным образом.
сперва была идея в сумму записывать каждый раз +1, потом делать вложенный цикл, который бы мог по числу определить, сколько раз надо вводить данный элемент (то есть, например, есть 2, соответственно, мне требуется 2 раза ввести данное число в строку) и выводить его. также такому подходу нужно ограничение, чтобы не выйти за допустимое число, введенное пользователем.
не могу сложить в голове последовательность реализации, хочется все-таки разобраться
#include <stdio.h>
#include <stdlib.h>
int reccur(int d)
{
int sum = 0;
int j = 0;
if (d == 1)
return (1);
else
for (int i = 1; sum < d; i++)
{
sum += i;
j = i;
}
return (reccur(--d) + j);
}
void main()
{
int n;
printf("enter the number ");
scanf_s("%d", &n);
printf("\n%d",reccur(n));
puts("\nrecursion has been done\n");
}
| e87d9ab4625164f5d516d86c7d6e172687c029eb62c0f837872f89797273c8d7 | ['5f47395469c5467c8b398ac9f99c4b58'] | сперва я решила определять, каким днем недели является 1 ноября
воспользовававшись формулой Зеллера для расчета дня недели для любой даты получила, что после первого же високосного года сбивается вся нумерация на -2(то есть вместо выведения вторника (1 ноября 2005), он выводит воскресение
нужно как-то написать кусок, который в диапазоне от 2001 года до заданного определит количество високосных лет и будет прибавлять +2 дня недели, чтобы нумерация восстановилась
плюсом потом нужно сделать так, чтобы вместо понедельника уже выводились вторники, но с этим уже попроще будет
вот кусочек корявенького кода (простите, только учусь)
#include <stdio.h>
#include <iostream>
#include <math.h>
int get_election_date(int year)
{
int month = 10, day = 1;
int d = day;
int m = month;
int k = year % 100;
int j = year / 100;
int result = d + 13 * (m + 1) / 5 + k + k / 4 + j / 4 + 5 * j;
result = result % 7;
switch (result)
{
case 6: printf("Saturday \n");
break;
case 0: printf("Sunday \n");
break;
case 1: printf("Monday \n");
break;
case 2: printf("Tuesday \n");
break;
case 3: printf("Wednesday \n");
break;
case 4: printf("Thursday \n");
break;
case 5: printf("Friday \n");
break;
}
return result;
}
int main()
{
int year, month, day;
printf("enter the year ");
scanf_s("%d", &year);
month = 10;
day = 1;
printf("%d", get_election_date(year));
return 0;
}
|
eb99098efda4254d7f955f3472697972d6bc06f14f6d8b2ee7b3acc2c86a7537 | ['5f481def1cac4e61a31b042205f1eb84'] | How can I consolidate these 3 event handlers into 1? There is only one property in my action which is different.
clickHandler1 () {
this.props.dispatch({type: 'updateMenuFave', current: '1' });
}
clickHandler2 () {
this.props.dispatch({type: 'updateMenuFave', current: '280' });
}
clickHandler3 () {
this.props.dispatch({type: 'updateMenuFave', current: '268' });
}
Relevant React/JSX
<div id = 'arc_hold'>
<img className='arcs' id="arc_arc" src="../_images/arc_arc.svg" onClick={this.clickHandler1.bind(this)} ></img>
<img className='arcs' id="arc_news" src="../_images/arc_news.svg" onClick={this.clickHandler2.bind(this)} ></img>
<img className='arcs' id="arc_sw" src="../_images/arc_sw.svg" onClick={this.clickHandler3.bind(this)} ></img>
</div>
| 6f37edcca64b70baf30f3a06c80db0b2d6ee084b14dbbcf701448cde6b4a282b | ['5f481def1cac4e61a31b042205f1eb84'] | or better, is this good practice?
I would like to store bookmarks, each bookmark a row. I want a tag column that is an array in string format that hold the hierarchy of tags that define it. For example:
url | tag
'stackoverflow.com', '[faves, internet, QandA]'
My current table is below, and I just want to modify the tag column to hold the array in string form.
|
7d3ab8202fa85691a687751e16bdbd808445c0b283b2ee5db005d1f5d125b3bc | ['5f4c072a63e64664afd5eabe14c2cf5c'] | It looks like you're creating a brand new HttpRequest to "currentPageUrl". This is essentially the same thing as opening a new browser and requesting that URL: it is a brand new request, with no viewstate. That is why it returns you a brand new response, with no values filled in.
Sure, you're firing the request from within the page's own code behind. However, the webserver doesn't know that - it will do exactly what you requested: serve up a brand new version of the requested page.
EDIT - more info:
One thing that might work (though admittedly I haven't tried it) would be to grab the HttpResponse after Render() has executed, and read the page's full content from Response.Output stream.
| 4b9ae92bfcf9bbb5dbab864a17f6ef1dd475a77c12d879fb82d9a2e7e1e1f249 | ['5f4c072a63e64664afd5eabe14c2cf5c'] | Using RegisterAsyncTask makes the asp.net page lifecycle asynchronous, but from the browser's perspective, the HttpRequest is still synchronous. Essentially, when you use AsyncTasks in your asp.net page, it behaves exactly as any other asp.net page, except that during those async operations, the thread is returned to IIS so it can be used by other requests.
Therefore, your async operation shouldn't necessarily return HTML, because its caller isn't the browser; you're still within the lifecycle of the original asp.net page call. I believe your async callback can apply the DB results directly to the various controls on the page, same as you would if you hadn't implemented the operation asynchronously.
|
920fd797e9da8ad05b81169d4f1b5c5806319c44b75745b60271280dda0efafa | ['5f4c1c5345d3456bb0a69096c36345fa'] | I have a question concerning the derivatives of approximate matrix inverses. I have a system, $$Ax = b$$ which I solve approximately (and with an iterative method) with: $$\Delta x = x - \tilde{A}^{-1}b$$ I would like to take the derivative of this process, i.e. find $$\frac{d\Delta x}{dD} = \frac{dx}{dD} - \frac{d\tilde{A}^{-1}}{dD}b - \tilde{A}^{-1}\frac{db}{dD}$$ I know that if I had an ideal inverse, my expression would be without tildes as I'd have the exact result: $$\frac{d\Delta x}{dD} = \frac{dx}{dD} - {A}^{-1}\frac{dA}{dD}{A}^{-1}b - \tilde{A}^{-1}\frac{db}{dD}$$ But for this, I cannot start with the typical assumption that $$AA^{-1} = I$$ and instead have $$A\tilde{A}^{-1} = C \neq I$$ Does anyone have any ideas for resources or techniques for such problems?
Thank you.
| d0cbc5db804beff4c861a2468fd432fd0d7f5bb6100baabf13ed084d90a2a838 | ['5f4c1c5345d3456bb0a69096c36345fa'] | I have two curves, $f_1(x)$ and $f_2(x)$ in $R^2$. I want to define an $f_c(x)$ such that if I travel orthogonal to the curve at each point the other two curves are equidistant. I.e. if i travel in the orthogonal direction in the direction of the center of curvature its a distance of d to $f_1(x)$ and if I travel away from the center of curvature its the same distance d to $f_2(x)$. Hope this clarifies it. |
71a11b3b1e3399ba290ebaf64c0231f484c822bd597d5c98a346826792bc6216 | ['5f4e8e5af60a41c18f081a531de053e9'] | <PERSON> Thank you very much for the great answer. I am so excited to learn it from you. I can step forward to understand my system better. I expected from this pilot test to get a mixture of methane-hydrogen-carbon dioxide and monoxide, but never oxygen. It was quite surprising to me. I thought I got a false result. It's still a mystery of production of the oxygen, though. I carefully guess that steam reacted with the metal oxide/metal catalyst (gas reformer) and split to hydrogen and oxygen. I got to figure it out. Thank you again. This excitement won't put me asleep tonight. | 34650e93135841cd25923755d0c807888a5881759af542b21da02a0f50ad9abd | ['5f4e8e5af60a41c18f081a531de053e9'] | <PERSON> I actually tried to measure them at the second round running. I asked for an institute to analyze the syn gases after it cooled down (~300 degree Celsius). They failed to analyze them. Their GC couldn't read the gases. They said that the GC coould read the standard samples but not my gas samples. They made errors to read. However, I found that the reactor produced alcohols (I guess it's methanol) condensed on the bottom. I think that the methanol might be a mixture with H2O. |
4c6af18af90be53e225afd86a48c61843aa71dfb7ad66be34b456d08077f2c54 | ['5f59344ae2d9408ab80c8375e235bca7'] | Need to import following in app.module.ts file:
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
formGroup is a selector for the directive named FormGroupDirective which is part of ReactiveFormsModule, is used to bind FormGroup data to a component element.
Then add it in imports array of the module like the following:
imports: [
BrowserModule,
AppRoutingModule,
FormsModule,
ReactiveFormsModule,
HttpClientModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
| 5e55a1b6dbd718a272e2f3a7dd74b8e91471c907f00ca200682fc4bc23d8b17f | ['5f59344ae2d9408ab80c8375e235bca7'] | Any changes in Database packages and procedure does require datasource reset to take effect of the change.
Changing the initial capacity and minimum capacity to 0, does it require to reset the Weblogic Datasource.
Please share your thoughts.
I want to avoid reset process in Weblogic and share your views.
|
f7fd32caefd77d34893b8e454be1e27b7508cbd7282e3c0cdd6de2c4348e5c92 | ['5f6fbe243576413ba5f58ad1f6e634cb'] | I'm been research on SendToKindle function, currently I'm using the Chrome SendToKindle Plugin. I want to implement this kind of function by using a web-service.
From what I see, the "SendToKindle" is analyzing the webpage by send the page to the amazon server, and then it will return a new url which will only contain the main article(Without any other elements).
e.g.
I reading this article:
http://www.nicholascarr.com/?page_id=21
use Chrome SendToKindle:
I got following new url:
https://www.amazon.com/gp/sendtokindle/reader?article=1392945012941
Dose anyone know how it this been implemented ?
Any help will be highly appreciated
Thank you
| c6c112f6d0f48923f3b392030cedfd61f857a960b426a12766ee24ba7dd6cba9 | ['5f6fbe243576413ba5f58ad1f6e634cb'] | I found out the issue and I was able to get it resolved.
Majority comment pointed out the setFirstResult(int firstResult) is the wrong version of class it been using. they are correct.
Bascially, the GlobalMessageLogProvider was been changed, but the latest verison of jar has never been pushed to the Nexus sever(our own private third party dependency server). so, whenever I pull the jar down, it always reference the old one.
After manually push the latest jar to the Nexus server and i was able to successfully build the project with gradle without error.
So Take-away from this question:
We need create a build process that will automatically build/push latest version of jar to the Nexus server. I'm thinking about create the build/push process through our TeamCity build server with some customized command/script. (Please feel free to provide any better suggestion/practice tips if there are).
Thank you everyone for the kindness help, I sincerely appreciated.
|
decead1e7653f5bf0ca67280fc93c572504f2247166b47f4142310f907130394 | ['5f75467d27844698b01dde5639d26fa2'] | Normally to post form data to a server without refreshing you need to use JavaScript. In JavaScript you catch the "submit" event and use AJAX to send the data to the server. This is easy with jQuery.
<script>
$( "#contact-form" ).submit(function( event ) {
var data = {
name: $('#name').val(),
email: $('#email').val(),
textMessage: $('#text-message').val()
}
$.post('contact.php', data);
event.preventDefault();
});
</script>
| c8e70f3a2f4398097aef9390bd2dc5449608414367bd8bc000aecdf7aedcd9b5 | ['5f75467d27844698b01dde5639d26fa2'] | I am new to Aurelia and Typescript. I am trying to use a the aurelia-dialog plugin inside of my project. I have follow all the necessary steps and am getting an error "cannot find module "aurelia-dialog". The offending line is
import {DialogService, DialogController} from "aurelia-dialog";
I am pretty sure all of the config is set up correctly because this is my only error. I have
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin('aurelia-dialog');
Do I need to create a typescript definition file for this to work, if so how? Or am I missing something and this should work as-is?
|
810ab67ac124469497f520ce0db78f409e3c0c9b7d91d3e713a11cabb403b3f1 | ['5f7eeb1fe7cb407f8989c058858362b4'] | I'm new to Ember.js and I'm trying to update a status variable in a model, but the view doesn't update when I do change it.
This is the javascript code for what I'm trying to do:
App = Ember.Application.create({});
App.EventBus = Ember.Object.extend({
eventBus: null,
connect: function() {
Ember.run.later(this, function() {
App.Sessiondata.connection.status = "Online";
console.log("status: " + App.Sessiondata.connection.status)
}, 2000)
}.on('init')
});
App.Router.map(function() {
this.resource('home', { path: '/' });
});
App.Sessiondata = {
connection : {
status: 'Offline',
statusClass: 'alert-error',
retryInterval: 20000,
maxAttempts: 5
},
user : {
fullname: 'Dummy User',
email: '<EMAIL_ADDRESS>'
},
};
App.ApplicationRoute = Ember.Route.extend({
model: function() {
return App.Sessiondata;
}
});
App.ApplicationController = Ember.ObjectController.extend({
eventbus: App.EventBus.create()
})
And here is the jsfiddle: http://jsfiddle.net/k82Lhj0j/
The idea is to update the connection status once the eventbus is open.
For this small test I'm ignoring the real eventbus code (it does work, but not really relevant for this test) and simply using a run.later to simulate similar behaviour.
As you can see, the result is always "Status: Offline" while it should become "Status: Online" after 2 seconds.
I'm probably doing something wrong in the spirit of how Ember.js works, but I don't see it.
| f0f94fa675ed1a56917a5062df2d71587121fe3b71fad5b7e51fe504253e25ca | ['5f7eeb1fe7cb407f8989c058858362b4'] | Until recently I always used Gulp to compile/uglify/minify my Ember.js code and it worked great.
This was up to Ember 1.11
Now I wanted to upgrade to Ember 1.12 and noticed that Ember-cli is now the preferred and recommended way to install/upgrade Ember.js
Does this mean it's not recommended anymore to download the individual Ember libraries and compile everything myself via gulp?
My main concerns in using ember-cli are the following:
[1] It feels like I don't have enough control anymore over what's happening.
E.g. I need to have two html files in my frontend - 1 publicly accessible and 1 protected - and ember-cli seems to look explicitly for an index.html file.
I can work around it by placing the other html file in the "public" folder, but this feels more like a hack rather that a final solution.
[2] ember-cli is taking a lot of time to compile my application.
With Ember 1.11 and gulp it took only 2 or 3 seconds, while with ember-cli (using Ember 1.12) it's taking a lot more time for an even simpler application.
(Actually it currently only contains the login/registration part of the application whereas the app with Ember 1.11 and gulp also contained the application logic)
$ time ember build
version: 0.2.7
0.2.7
Could not find watchman, falling back to NodeWatcher for file system events.
Visit http://www.ember-cli.com/#watchman for more info.
Building..
services/websocket.js: line 39, col 31, 'SockJS' is not defined.
services/websocket.js: line 298, col 13, 'observerFunction' is defined but never used.
2 errors
services/util.js: line 6, col 9, Bad line breaking before '+'.
services/util.js: line 7, col 9, Bad line breaking before '+'.
services/util.js: line 8, col 9, Bad line breaking before '+'.
services/util.js: line 9, col 9, Bad line breaking before '+'.
4 errors
===== 2 JSHint Errors
Built project successfully. Stored in "dist/".
real 0m55.876s
user 0m35.935s
sys 0m2.643s
As you can see it takes almost 1 minute to build this very simple Ember code.
[3] With gulp I can update my live app on the fly using gulp-watch. With ember-cli something similar is available via "ember serve",
but this expects the application to run standalone, which is not the case with my app. I have to serve it from my backend app, which is written in java.
|
1525f6d7b0ada5b55c21a313f209815fa086bec49b1f0c5b7e6ae7093530c4b4 | ['5f8dd61d8a19480cae7bc52955818573'] | I don't understand the following differential equation which has the argument t in the numerator as well as in the denominator:
$$
R*C*(dv_2(t)/dt)+v_2(t)=v_1(t)
$$
How do you rewrite it to the form underneath so that I can find the general solution?
$$
y'+P(t)*y(t)=Q(t)
$$
It has to satisfy $$t\geq0$$
R and C are meant to hold values for resistance and capacitance.
| a4b48d83f1c487b13e7df258e40a9eca60c88af7f5e77481abe6ed5efa364dc5 | ['5f8dd61d8a19480cae7bc52955818573'] | @user247327
Ohh yeeahh. Hmm, is there in some way a method to do the gcd of two numbers and already being sure before doing the calculation that it equals 1? Or is it just something you have to try a couple of times on different numbers knowing that odd numbers often have a GCD of 1 until you find gcd=1? |
13e2d4837757050b338ff9e0d5d837d03cc28c43cdb364989bfd254379a49033 | ['5f909d95c9464a64805a7313df8a7e8a'] | Error Identified and solved
You said that content does not load in app.blade.php but you have extends the home page.
Update your script like this->
@extends('layouts.app')
@section('content')
Test text
@endsection
I think you got where you made the wrong. Let me know about the updates
| 2e726f739116898a7ae3bfd389a34eca80831cca8f3f78c3ab629f65c3f2bdf4 | ['5f909d95c9464a64805a7313df8a7e8a'] | //Write a program to check the number whether it is palindrome or not
#include <stdio.h>
int
main(void){
//Put variables for the further proceed
int number, quotient=1, remainder,i=0;
//To declare a character array
char text[100];
//To show the message to the user
printf("Enter an integer number :");
//Taking input from the user
scanf("%d",&number);
//For finding escape the integer number in the reverse order specifically
int number_update=number;
//To find out the integer number in the reverse order
while(quotient!=0){
quotient=number_update/10;
remainder=number_update%10;
number_update=quotient;
text[i] = remainder + '0';//Converts integer to character and store to the array
i++;
}
//Converts the string to a whole integer
int result_of_reverse=atoi(text);
//Check the result of reverse order with the given integer number
if(result_of_reverse==number){
//To display the result
printf("This is a palindrome number");
}
else{
//To display the result
printf("This is not a palindrome number");
}
}
Eventually, I have solve my problem. Thank you all for your suggestions.
|
15b63010734a7ffb51099c0a8c8389c9b75c849a9f77a030fc36883462b6d04c | ['5f9c416f06ef462785dda6995369d797'] | what im trying to accomplish is to add a marker on a location in which i clicked and if i clicked on a location that isnt marked that it will be marked, in addition i would like to add a mark from a text box which gets input from the user on the map , the map will open automatically on the location from the text box and all the other mark places will be save in a data base , after wards when i open the map i want the previous location to marked automatically from the database.
eg:https://developers.google.com/maps/documentation/javascript/adding-a-google-map
thank you in advance,
<PERSON>.
| 8244935e274610be99d58f309dd93def594a04e3083b08fd81713ce7a54765ad | ['5f9c416f06ef462785dda6995369d797'] | this is my code i don't understand how i can add this code in my code ?
<p><button class="w3-btn w3-blue" onclick="getLocation()">Try It</button></p>
<div id="mapholder"></div>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition,showError);
}
else{x.innerHTML="Geolocation is not supported by this browser.";}
}
function showPosition(position)
{
lat=position.coords.latitude;
lon=position.coords.longitude;
latlon=new google.maps.LatLng(lat, lon)
mapholder=document.getElementById('mapholder')
mapholder.style.height='100%';
mapholder.style.width='100%';
var myOptions={
center:latlon,zoom:17,
mapTypeId:google.maps.MapTypeId.ROADMAP,
mapTypeControl:false,
navigationControlOptions:{style:google.maps.NavigationControlStyle.SMALL}
};
var map=new google.maps.Map(document.getElementById("mapholder"),myOptions);
var marker=new google.maps.Marker({position:latlon,map:map,title:"You are here!"});
}
function showError(error)
{
switch(error.code)
{
case error.PERMISSION_DENIED:
x.innerHTML="User denied the request for Geolocation."
break;
case error.POSITION_UNAVAILABLE:
x.innerHTML="Location information is unavailable."
break;
case error.TIMEOUT:
x.innerHTML="The request to get user location timed out."
break;
case error.UNKNOWN_ERROR:
x.innerHTML="An unknown error occurred."
break;
}
}
window.google.maps.event.addListener(gmap, "click", yourHandler);
window.google.maps.event.add
</script>
|
6fdab253857e6c4eacaff7e249dff46f367e46009ddec6772985f843f4ea788b | ['5fb743dd794542fea1001a7843ba3e92'] | Recently I made an Audio Visualizer in Processing. From there I wanted to render the animation created in Processing into a mp4 file. I am on a windows computer, and am using ffmpeg to convert my TIF files produced in Processing into mp4.
When I do this I am able to render the images into an mp4 file, but when I playback this file the animation is sped up compared to the animation when I play it on Processing. Because of this the animation does not sync with the audio when I combine the mp4 file and audio on a video editing program.
When I set my frame rate to 25 and have the limit on the number of frames to be 250 and render it into a mp4 file it is 10 seconds long like it should be, but it contains more than 10 seconds of the animation when compared to the animation played directly in Processing.
I have no idea why this is so any help will be much appreciated.
My Processing code:
import ddf.minim.*;
import ddf.minim.analysis.*;
Minim minim;
AudioPlayer player;
PImage img;
FFT fft;
void setup() {
size(728, 546);
minim = new Minim(this);
// this loads mysong.wav from the data folder as a stream with a internal buffer of size 1024
player = minim.loadFile("new_years_good.mp3");
fft = new FFT(player.bufferSize(), player.sampleRate());
player.play();
img= loadImage("cat-in-shades-.jpg");
frameRate(25);
}
void draw() {
image(img, 0, 0);
//tint(0, 100, 150);
stroke(255);
strokeWeight(4);
float a = 0;
float angle = (2*PI) / 200;
fft.forward(player.mix);
for(int i=0; i < player.bufferSize() - 1; i++) {
//player.mix.get(i) is a value between [-1,1]
float x = 250 + cos(a) * (20 * player.mix.get(i) + 100);
float x2 = 540 + cos(a) * (20 * player.mix.get(i) + 100);
float y = 230 + sin(a) * (20 * player.mix.get(i) + 100);
float y2 = 240 + sin(a) * (20 * player.mix.get(i) + 100);
float xFinal = 250 + cos(a+angle) * (20 * player.mix.get(i+1) + 100);
float x2Final = 540 + cos(a+angle) * (20 * player.mix.get(i+1) + 100);
float yFinal = 230 + sin(a+angle) * (20 * player.mix.get(i+1) + 100);
float y2Final = 240 + sin(a+angle) * (20 * player.mix.get(i+1) + 100);
line(x,y,xFinal,yFinal);
line(x2,y2,x2Final,y2Final);
a += angle;
}
noStroke();
fill(255, 0, 0, 128);
for(int i = 0; i < 250; i++)
{
float b = fft.getBand(i);
float yAxis = random(-b, b) + 480;
float xAxis = i*3;
ellipse(xAxis, yAxis, b, b);
}
saveFrame("frame-####.tif");
if(frameCount>250)
{
noLoop();
stop();
}
}
void stop() {
player.close();
minim.stop();
super.stop();
}
What I input into the command line (as one line) on the cmd:
C:\Users\Robert\Documents\Processing\AudioVisulizer>ffmpeg -i C:\Users\Robert\Do
cuments\Processing\AudioVisulizer\frame-%04d.tif -r 25 -pix_fmt yuv420p smallVid
.mp4
What it outputted:
ffmpeg version N-77836-g62dfe1d Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --
enable-lzma --enable-decklink --enable-zlib
libavutil 55. 13.100 / 55. 13.100
libavcodec 57. 22.100 / 57. 22.100
libavformat 57. 21.101 / 57. 21.101
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 23.100 / 6. 23.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, image2, from 'C:\Users\Robert\Documents\Processing\AudioVisulizer\fram
e-%04d.tif':
Duration: 00:00:10.04, start: 0.000000, bitrate: N/A
Stream #0:0: Video: tiff, rgb24, 728x546, 25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 00000092cd5e3700] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 00000092cd5e3700] profile High, level 3.0
[libx264 @ 00000092cd5e3700] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pski
p=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 deci
mate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_
adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=2
5 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.6
0 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'smallVid.mp4':
Metadata:
encoder : Lavf57.21.101
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 728x54
6, q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc57.22.100 libx264
Side data:
unknown side data type 10 (24 bytes)
Stream mapping:
Stream #0:0 -> #0:0 (tiff (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame= 52 fps=0.0 q=28.0 size= 77kB time=00:00:00.00 bitrate=N/A speed=
frame= 74 fps= 65 q=28.0 size= 127kB time=00:00:00.88 bitrate=1178.0kbits/
frame= 93 fps= 57 q=28.0 size= 164kB time=00:00:01.64 bitrate= 820.0kbits/
frame= 113 fps= 52 q=28.0 size= 201kB time=00:00:02.44 bitrate= 676.3kbits/
frame= 136 fps= 51 q=28.0 size= 245kB time=00:00:03.36 bitrate= 596.3kbits/
frame= 157 fps= 49 q=28.0 size= 282kB time=00:00:04.20 bitrate= 550.2kbits/
frame= 178 fps= 48 q=28.0 size= 324kB time=00:00:05.04 bitrate= 527.2kbits/
frame= 199 fps= 47 q=28.0 size= 362kB time=00:00:05.88 bitrate= 504.1kbits/
frame= 219 fps= 46 q=28.0 size= 403kB time=00:00:06.68 bitrate= 494.2kbits/
frame= 242 fps= 46 q=28.0 size= 452kB time=00:00:07.60 bitrate= 486.8kbits/
frame= 251 fps= 38 q=-1.0 Lsize= 623kB time=00:00:09.96 bitrate= 512.3kbits
/s speed=1.52x
video:619kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing o
verhead: 0.607807%
[libx264 @ 00000092cd5e3700] frame I:2 Avg QP:21.74 size: 56596
[libx264 @ 00000092cd5e3700] frame P:66 Avg QP:23.36 size: 2523
[libx264 @ 00000092cd5e3700] frame B:183 Avg QP:31.50 size: 1932
[libx264 @ 00000092cd5e3700] consecutive B-frames: 0.8% 4.0% 6.0% 89.2%
[libx264 @ 00000092cd5e3700] mb I I16..4: 10.9% 72.6% 16.5%
[libx264 @ 00000092cd5e3700] mb P I16..4: 0.0% 0.0% 0.2% P16..4: 4.4% 2.3
% 3.3% 0.0% 0.0% skip:89.7%
[libx264 @ 00000092cd5e3700] mb B I16..4: 0.0% 0.0% 0.5% B16..8: 3.2% 2.0
% 2.3% direct: 1.3% skip:90.7% L0:50.9% L1:42.2% BI: 7.0%
[libx264 @ 00000092cd5e3700] 8x8 transform intra:50.2% inter:10.1%
[libx264 @ 00000092cd5e3700] coded y,uvDC,uvAC intra: 83.4% 32.6% 14.2% inter: 3
.5% 0.2% 0.0%
[libx264 @ 00000092cd5e3700] i16 v,h,dc,p: 22% 8% 8% 62%
[libx264 @ 00000092cd5e3700] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 12% 19% 6% 9%
9% 9% 9% 9%
[libx264 @ 00000092cd5e3700] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 14% 22% 6% 9%
8% 8% 5% 6%
[libx264 @ 00000092cd5e3700] i8c dc,h,v,p: 74% 12% 12% 2%
[libx264 @ 00000092cd5e3700] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 00000092cd5e3700] ref P L0: 41.8% 3.9% 24.3% 30.0%
[libx264 @ 00000092cd5e3700] ref B L0: 64.5% 25.0% 10.5%
[libx264 @ 00000092cd5e3700] ref B L1: 82.2% 17.8%
[libx264 @ 00000092cd5e3700] kb/s:504.56
| badb1560a5505ac110d2b57dfd225ae386eb3f3d097038b202b1de704ab96e03 | ['5fb743dd794542fea1001a7843ba3e92'] | #include <stdio.h>
//needed so we can use the built in function strcpy
#include <string.h>
int main()
{
char* foo()
{
char* test="Hello";
printf("value of test: %p\n",test);
return test;
}
//why does this work? is test off the stack, but Hello in mem is still there?
work=foo();
printf("value of work after work has been initalized by foo(): %p\n",work);
printf("%s\n",work);
}
In the above code, 'work=foo()', works I noticed that the value of 'test' and 'work' are the same. Meaning that they are pointing to the same point in memory, but after the function call 'test' is out of scope and not allowed to be accessed. Why is 'test' not allowed to be accessed, but its value/ memory location is? I'm assuming 'test' is not allowed to be accessed due to being off the stack after the function call? I'm new to pointers so if my terminology or anything is off please correct me.
|
9d3e503a964035c2643b531bf195909b503af1c7673a9641c0e8237ae3a4c757 | ['5fbe0cafd0734da4a30a1cccc318b41d'] | I'm trying to figure out where the exception is and I can't really figure it out in my program. What the program list does is find nodes and delete them. Here is my header file:
#ifndef DOUBLYLIST_H
#define DOUBLYLIST_H
#include <string>
#include <iostream>
using namespace std;
class Node
{
public:
Node() : data(0), previousLink(NULL), nextLink(NULL) {}
Node (int theData, Node *previous, Node *next)
: data(theData), previousLink(previous), nextLink(next){}
Node *getNextLink( ) const { return nextLink; }
Node *getPreviousLink( ) const { return previousLink; }
int getData( ) const { return data; }
void setData(int theData) { data = theData; }
void setNextLink(Node *newNext) { nextLink = newNext; }
void setPreviousLink(Node *newPrev) { previousLink = newPrev; }
~Node(){}
private:
int data;
Node *nextLink;
Node *previousLink;
};
class DoublyList
{
public:
DoublyList();
void insertBack(int newData);
bool search(int searchData) const;
void deleteNode(int deleteData);
void print() const;
void reversePrint() const;
void destroyList();
~DoublyList();
private:
Node *first; // pointer to the first node on the list
Node *last; // pointer to the last node on the list
int count; // number of nodes in the list
};
#endif
And here's the cpp file:
/*
Huynh, Dex
CS A250
October 9, 2016
Lab - 7 Dll Error
*/
#include "DoublyList.h"
DoublyList<IP_ADDRESS>DoublyList()
{
first = NULL;
last = NULL;
count = 0;
}
DoublyList::~DoublyList()
{
destroyList();
}
void DoublyList<IP_ADDRESS>insertBack(int newData)
{
Node *newNode = new Node(newData, last, NULL);
if (first == nullptr)
first = newNode;
else
{
last->setNextLink(newNode);
newNode->setPreviousLink(last);
}
}
bool DoublyList<IP_ADDRESS>search(int searchData) const
{
Node *current = first;
while (first != nullptr)
{
if (current->getData() == searchData)
return true;
else
current = current->getNextLink();
}
}
void DoublyList<IP_ADDRESS>deleteNode(int deleteData)
{
if (first == nullptr)
{
cerr << "Cannot delete from an empty list." << endl;
}
else
{
Node *current;
if (first->getData() == deleteData)
{
current = first;
first = first->getNextLink();
if (first == NULL)
last = NULL;
delete current;
current = NULL;
}
else
{
bool found = false;
current = first;
while (current != NULL || !found)
{
if (current->getData() == deleteData)
found = true;
else
current = current->getNextLink();
}
if (current == NULL)
cerr << "The item to be deleted is not in the list." << endl;
else
{
if (current != last)
current->getPreviousLink()->setNextLink(current->getNextLink());
else
last = current->getPreviousLink();
--count;
delete current;
current = NULL;
}
}
}
}
void DoublyList<IP_ADDRESS>print() const
{
if (first == nullptr)
cerr << "List is empty. Cannot print." << endl;
else
{
Node *temp = first;
while (temp != NULL)
{
cout << temp->getData() << " ";
temp = temp->getNextLink();
}
cout << endl;
}
}
void DoublyList<IP_ADDRESS>reversePrint() const
{
if (first == nullptr)
cerr << "List is empty. Cannot print." << endl;
else
{
Node *temp = last;
while (temp != NULL)
{
cout << temp->getData() << " ";
temp = temp->getPreviousLink();
}
cout << endl;
}
}
void DoublyList<IP_ADDRESS><IP_ADDRESS>~DoublyList()
{
destroyList();
}
void DoublyList::insertBack(int newData)
{
Node *newNode = new Node(newData, last, NULL);
if (first == nullptr)
first = newNode;
else
{
last->setNextLink(newNode);
newNode->setPreviousLink(last);
}
}
bool DoublyList::search(int searchData) const
{
Node *current = first;
while (first != nullptr)
{
if (current->getData() == searchData)
return true;
else
current = current->getNextLink();
}
}
void DoublyList::deleteNode(int deleteData)
{
if (first == nullptr)
{
cerr << "Cannot delete from an empty list." << endl;
}
else
{
Node *current;
if (first->getData() == deleteData)
{
current = first;
first = first->getNextLink();
if (first == NULL)
last = NULL;
delete current;
current = NULL;
}
else
{
bool found = false;
current = first;
while (current != NULL || !found)
{
if (current->getData() == deleteData)
found = true;
else
current = current->getNextLink();
}
if (current == NULL)
cerr << "The item to be deleted is not in the list." << endl;
else
{
if (current != last)
current->getPreviousLink()->setNextLink(current->getNextLink());
else
last = current->getPreviousLink();
--count;
delete current;
current = NULL;
}
}
}
}
void DoublyList::print() const
{
if (first == nullptr)
cerr << "List is empty. Cannot print." << endl;
else
{
Node *temp = first;
while (temp != NULL)
{
cout << temp->getData() << " ";
temp = temp->getNextLink();
}
cout << endl;
}
}
void DoublyList::reversePrint() const
{
if (first == nullptr)
cerr << "List is empty. Cannot print." << endl;
else
{
Node *temp = last;
while (temp != NULL)
{
cout << temp->getData() << " ";
temp = temp->getPreviousLink();
}
cout << endl;
}
}
void DoublyList::destroyList()
{
Node *temp;
while (first != NULL)
{
first = temp;
temp = temp->getNextLink();
delete first;
first = NULL;
}
last = NULL;
count = 0;
}
| 3a3b9a87890f475f99daac8af54fcd849f126d3a4b6b1020ff3ba862b3cb45d9 | ['5fbe0cafd0734da4a30a1cccc318b41d'] | I am doing a Java exercise for my class and encountered an error. It says "incompatible types: unexpected return value". It would also be nice if someone could check if I am doing this code right. My instructions were to create a varaiable maxValue that is to be intialized to the first element. Then I have to compare the element that maxValue stores with another element in my list. And if an element in the array is larger than the one stored in maxValue, it is suppose to store/update maxValue with the larger element.
public class MyArray
{
public static void main(String[] args)
{
int[] ArrayLargestElement = {
45, 38, 27,
46, 81, 72,
56, 61, 20,
48, 76, 91,
57, 35, 78
};
int maxValue = ArrayLargestElement[0]
for (int i=0; i<ArrayLargestElement.length; i++) {
if (maxValue > ArrayLargestElement[i]) {
maxValue = ArrayLargestElement[i];
}
}
return maxValue;
}
}
|
da1c52c3e5fd6bd7af5d5ef85acf66e87269c5000523eab531f529dc6210f701 | ['5fc7c77277b64a3b9b08357ace17fd62'] | Im using a select box with the multiple attribute to give me a box options where i can choose many of them. It works but not in the way i want it. As in, i can ctrl click multiple choices, but i want to have it that i can just click (without ctrl) and have multiple choices remain selected. As of now normal clicks only selects one option from the box (as in, only one option remains highlighted).
Should i use javascript to keep the options selected on single clicks? I've tried this but it has not worked:
<select id="selecter" multiple='multiple' size='6'>
<option value="1">user1</option>
<option value="2">user2</option>
<option value="3">user3</option>
<option value="3">user4</option>
<option value="3">user5</option>
<option value="3">user6</option>
</select>
none of these work:
$('#selecter option').click(function(){
$(this).attr('selected', 'selected');
//$(this).attr('selected', 'true');
//$(this).prop('selected', 'selected');
//$(this).prop('selected', 'true');
});
https://jsfiddle.net/6u14h4oe/
| 392b49f89fa68ca0e0764d2f376d6d10025b558acf4fa9da1139f4d4c223496f | ['5fc7c77277b64a3b9b08357ace17fd62'] | I am trying to pull changes into a repo. The repo's origin was originally located on a different git server, now the origin has moved to another server. On the new server we have a generic user called 'app', on other machines we have added the app user private key and a config file like so:
# in /root/.ssh/config
Host gitlab-app
HostName git.ist
User git
IdentityFile /root/.ssh/id_rsa_app
IdentitiesOnly yes
and could use a command like this to clone the repo:
git clone gitlab-app:software-development/my_repo.git
Which works. The problem is that on the particular server im talking about the repo had already been cloned from the previous location. I've changed the remote url of the repo to the new location but when trying to pull over ssh I am asked for a password. I guess because there is no key from this server on the gitlab host. Hence the generic 'app' user.
My question is, how do I configure my repo to use the app user key for ssh when I am running the pull command as root user?
In some other threads I saw this:
git config core.sshCommand 'ssh -i ~/.ssh/id_rsa_app -F /dev/null'
But it had no effect for me.
|
a23d8e7cd001b138bdea85a112f841860540a71ee5bf9e197784b8ea3f906df1 | ['5fd24b566d234161a5d1867efa6e41fe'] | Following the this web site,
it seems that apart from has two meanings which contradict each other
Except for.
In addition to; as well as.
When it is used as the 1st meaning, it includes the object that follows the apart from
But it does not include the object when it comes to being used as 2nd meaning.
How can I distinguish them? Is there any difference in usage?
| 744a56ef24d5e9f401205b9d30e203641aa0afc15cd781c984463cb27c31b54b | ['5fd24b566d234161a5d1867efa6e41fe'] | Update/clarification: I can gain access to the booting portion of the disk, and I can unlock the encrypted drive with my password. Once I do, however, the mount option for the encrypted portion disappears and I'm left with only the 255 MB boot section mounted. Under disk utility, all partitions of the 320 GB drive are visible, with the encrypted portion listed as /dev/mapper/luks-793cd2e3-73b4-439b-aef7-25fe1e2b04d4, an LVM2 pv. When I try to mount from the terminal, I get an error: unknown filesystem type 'LVM2_member'. That's where I am so far. |
d05bd8aa527fdbd90c95c54c4e6e8f5a9d3f366ec70f7d22cbb243f15edc1671 | ['5fd800ab834044a48c9780737be74ac2'] | What do you mean by this is just filler?
Anyhow since turning on `Debug Mode` I started seeing the same errors that you are seeing and they are being related to SF components. Just like you the errors and the stack trace have nothing to do with my components. I just ignore those errors. If you turn off the Debug Mode those errors will likely disappear from your console. | 83d259a70ca44900f5225f8c2c253a22a330b43c3bc2e7d8405c38d960be0bca | ['5fd800ab834044a48c9780737be74ac2'] | I am not sure if this will matter but try changing the src to `src: url('resource/FontAwesome/fontawesome-free-5.13.0-web/fonts/font-awesome-webfont.woff') format('woff');`
See in the original example I had `resource/fontAwesome`, camelcase. Try to change that to `FontAwesome` like the name you gave your static resource. |
fc1de0b3595d5786155412347c3761137ebf86b13b74a704eaad01eb58804e26 | ['5ffbcfacaa854b38b15ec0d3a7134622'] | I have followed the steps for my Debian machine to run Emulator
Open Bios option, Mostly its by pressing f1 key or f1+delete or Alt + f4 (At the time of machine boot up) all it depends on which company's desktop or laptop you are using.
Go to Advance option
CPU setup
Enable two option there
intel(R) virtualisation tech
VT-d
| 7c2bbed3b61aae54889495904ed2cbe2a2eb46e36942fa09bfb60b42f9e733e6 | ['5ffbcfacaa854b38b15ec0d3a7134622'] | I have create ViewPager where one tab has QR code reader one tab show the result of scanned qr code. by default result of qr code screen will pop up so when i tab on scan qr code tab I only see the layout of that fragment but the scanner screen doesn't show up.
When I make default tab to scanner then only it show the scanner screen.
below is my code of view pager..
tabLayout = (TabLayout) findViewById(R.id.bottomNavigation);
viewPager =(ViewPager)findViewById(R.id.viewPagerHome);
tabLayout.setupWithViewPager(viewPager);
viewPager.setOffscreenPageLimit(2);
view1= (View)findViewById(R.id.view1);
view2= (View)findViewById(R.id.view2);
view3= (View)findViewById(R.id.view3);
//Adding the tabs using addTab() method
tabLayout.addTab(tabLayout.newTab().setText("Scan"));
tabLayout.addTab(tabLayout.newTab().setText("Candidate"));
tabLayout.addTab(tabLayout.newTab().setText("Setting"));
viewPager = (ViewPager) findViewById(R.id.viewPagerHome);
//Creating our pager adapter
adapter = new Pager(getSupportFragmentManager(), tabLayout.getTabCount());
//Adding adapter to pager
viewPager.setAdapter(adapter);
//Adding onTabSelectedListener to swipe views
tabLayout.setOnTabSelectedListener(this);
//setUptabIcon();
tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
switch(position){
case 0:
/* ViewPager viewPager = (ViewPager)findViewById(R.id.viewPagerHome);
viewPager.setCurrentItem(0);*/
view1.setBackgroundResource(R.color.red );
view2.setBackgroundResource( R.color.white );
view3.setBackgroundResource(R.color.white );
break;
case 1:
view1.setBackgroundResource( R.color.white );
view2.setBackgroundResource( R.color.red );
view3.setBackgroundResource( R.color.white );
break;
case 2:
view1.setBackgroundResource( R.color.white );
view2.setBackgroundResource( R.color.white );
view3.setBackgroundResource( R.color.red );
break;
default:
view1.setBackgroundResource(R.color.white );
view2.setBackgroundResource( R.color.red );
view3.setBackgroundResource( R.color.white );
break;
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
if(tab.getPosition() == 0){
Fragment childF = new CandidateScanChildFragment();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.child_scanfragment_container, childF).commit();
}
}
ViewPagerAdpater.class
public class Pager extends FragmentStatePagerAdapter {
int tabCount;
FragmentManager mFragmentManager;
private Fragment mFragmentAtPos0;
//FirstPageListener listener = new FirstPageListener();
public Pager(FragmentManager fm, int tabCount) {
super(fm);
this.tabCount = tabCount;
}
public Pager(FragmentManager fragmentManager) {
super(fragmentManager);
mFragmentManager = fragmentManager;
}
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
ScanFragment scanTabFragment = new ScanFragment();
return scanTabFragment;
case 1:
CandidateFragment candidateTabFragment = new CandidateFragment();
return candidateTabFragment;
case 2:
SettingFragment settingtabFragment = new SettingFragment();
return settingtabFragment;
default:
return null;
}
}
@Override
public int getCount() {
return tabCount;
}
@Override
public int getItemPosition(Object object)
{
return POSITION_NONE;
}
}
|
5c98b0fc5c3afa305e2cb78007c91d277b93e8a6a971e874e84d19d43512fc95 | ['60127f0886c14e1cacab2835379bbc6b'] | The square saturation-brightness picker has two gradients:
White to black from top to bottom
Transparent to opaque hue from left to right
I'm trying to make this as a circular picker which should look like this:
Ref: https://paletton.com/
I tried to draw the circular picker like the square one but I lose the colors around the corner. It looks like this:
So what can I do to make the circular saturation-brightness gradient?
| 4fafdaf91c6463fe44ba7b58d3a63ff0675205c542c4f17d24a4c1d0f762372a | ['60127f0886c14e1cacab2835379bbc6b'] | I'm trying to load a pre trained torch (.t7) model in OpenCV. The model is a CycleGAN which converts horse images into zebra images. The model can be found here: https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/models/
I've used both horse2zebra.t7 and horse2zebra_cpu.t7 models but they both return a tiled black and white image instead of a zebra image.
This is a sample input image:
And this is the output:
Code:
import cv2
import numpy as np
model = cv2.dnn.readNetFromTorch('./cyclegan_horse2zebra_cpu.t7')
image = cv2.imread('./images/1.jpg')
blob = cv2.dnn.blobFromImage(image, 1, (256, 256))
model.setInput(blob)
out = model.forward()[0,:,:,:]
out = np.reshape(out, (256, 256, 3))
cv2.imshow('image', out)
cv2.waitKey(0)
cv2.imwrite('out.png', out)
|
b6ac4259a2b595f964f2e7936f660720e5abe7e4ad5bdc534c08ee7adf7df244 | ['601ac22f23a64713a6ef8ee42eed4a58'] | I am trying to replace users description with a substring of his description. I want it to be just the first 10 letters. I try like this:
Get-ADUser abc -Properties description | Set-ADUser -Description "($($PSItem.Description).substring(0,10))"
Can you give me a hint how to make it work?
| e3ee51325e10ee6340f83fd42aad084e54b18f8cb612b7ddd6528b91e4d3b43e | ['601ac22f23a64713a6ef8ee42eed4a58'] | this one gives good output:
Get-ADUser abc -Properties Description | foreach { Write-Output "$($PSItem.Description.SubString(0,10))" }
But this one not:
Get-ADUser abc -Properties Description | Set-ADUser -Description "$($PSItem.Description.SubString(0,10))"
it is giving error like this:
You cannot call a method on a null-valued expression. At line:1
char:71
+ ... on | Set-ADUser -description "$($PSItem.description.SubString(0,10))"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull Set-ADUser : replace At line:1 char:44
+ ... scription | Set-ADUser -description "$($PSItem.description.SubString( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (CN=abc...C=DOMAIN,DC=com:ADUser) [Set-ADUser],
ADInvalidOperationException
+ FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.SetADUser
|
c45415de99d191d9122e275f889a6d80ab8075bc907c4cd86eec32872ec4df2b | ['601f594fb863400383fa6445bb517454'] | If you want quick and easy solution (why else would you want to use Perl?), then just use
my $find = qr|<book name=""\s+author="">|s;
my $replace = '<magazine>';
And as you want to replace something across multiple lines, you cannot read line by line, instead you should slurp file in scalar (if your file is small enough to fit into memory)
local $/; # undefines input lines separator
# open your file with open(FILE, '<', $filename);
my $text = <FILE>;
$text =~ s/$find/$replace/g;
# do with $text what you want now, print it or anything
# don't forget to close your FILE
This is quick and dirty, but works well. If your file does not fit into memory, or you want to be sure that everything works ok, use XML parsers, but remember
do not use XML<IP_ADDRESS>Simple, it is broken, really
for large files you need stream XML parsers, like XML<IP_ADDRESS>Parser
| 3e825334f24dd51d6f77ee4caad38dba26fdb8a2244744ff6702e53ba0abdda8 | ['601f594fb863400383fa6445bb517454'] | Say, your string is stored in $str. You can do the following to extract stuff from it:
my ($cond, $set, $then, $else) = ($str =~ /^If (.*) Then (.*?=\s+)(.*) else \2(.*);$/);
Now you have your condition in $cond, a = in $set and what should be in that variable in $then and $else.
Replace "or" and "and" in your condition
$cond =~ s/\sOr\s/ || /g;
$cond =~ s/\sAnd\s/ && /g;
and print your desired output
print "$set($cond ? $then : $else);
Those regular expressions work with your string: I got
a = (((Myvalue.xyz == 1) || (Frmae_1.signal_1 == 1)) ? 1 : 0)
but can fail if your actual strings have "Then" written as "then", will explode if your "Myvalue.xyz" in some string is "Myvalue.And" or something like that. Also this will not work if there are no spaces somewhere around = or Or. But the code can be easily modified to work with all these inputs. Be careful with regular expressions, they are powerful.
|
bf9f6bdbb6ee858beeab6adf5482b34eb86bd3f6852c7348b97a64e1381b230f | ['60288a6691234c77902d45d7c7b472a0'] | During an experiment I had to measure the speed of light $c$ (it's an indirect measurement, because i had $c(x,y,z)$ as a function of some quantities $x,y,z$ I could measure).
I took several measures $c_1,c_2, \dots , c_n$ and I calculated the mean value $c_{mean}$.
Now i would like to find the error associated with $c_{mean}$.
If each quantity $x,y,z$ is affected by an error $\sigma_x,\sigma_y,\sigma_z$ , then each measurement $c_i$ is affected by and error $$\sigma_{c_i}=\sqrt{\biggl( \frac{\partial c}{\partial x} \biggr) ^2 \cdot \sigma_x ^2 \ + \ \biggl( \frac{\partial c}{\partial y} \biggr) ^2 \cdot \sigma_y ^2 \ + \ \biggl( \frac{\partial c}{\partial z} \biggr) ^2 \cdot \sigma_{z} ^2 }$$
that i can calculate.
So now I have $n$ different errors $\sigma_{c_i}$, how can I use them to calculate the error associated with the $c_{mean}$ ?
| ef7c5fc9f3f790d7db0b0383ffbd349dc00dc9963d680b0a9b40a71144bd4d0d | ['60288a6691234c77902d45d7c7b472a0'] | There are two extensions which should help you.
There is the Extension:MultiUpload. If you upload files directly to the server using FTP or SCP or whatever, you have to import them into MediaWiki to make them work wiki-style, by using the maintenance/importImages.php file but it requires shell access.
There is also the Extension:UploadLocal which is good.
|
8588cd4e884c881ead8f769f92a3874a19e8e2275000a0b75cb5d7c0faac8486 | ['60369822a58b4db3ad1217c8d5d68010'] | If we look at the equation for national Savings = S(priv) + S(pub) = [Y-C+Tran-T] + [T-G-Tran] = Y - C - G . We see that Tax falls out of the equation. Therefore, does that mean changes in taxation policy don't directly affect the Supply of Loanable funds? If this is the case, and we assume consumption isn't constant, then giving individuals massive tax cuts should influence them to consume and/or save more money. This should increase total savings and shift the supply right and interest rates down, allowing for greater investment in capital, leading to growth in economy. Looking at this, why is it that tax cuts are seen as being bad for economic growth?
| bc4f0dc265cd173138fb19cc85dd3460ea27de35ff04ee643c4c53fbeb250501 | ['60369822a58b4db3ad1217c8d5d68010'] | At first, I nearly posted `function(x)[0,-1,5,-1,-1,2,9,-1,8,6][x]`, also thanks to Firefox. I wasn't going to win anyway, so I decided I'd just stick with the highest-compatibility answer. If I start switching languages for brevity, then I'll eventually start defining my own language for every challenge I do. But I'll go ahead and mention the ECMAScript 6 version anyway, since you suggested it |
01919275fabde7d40379b2b4669e1a05887682fc1962d5d4b62b9b2dcde0f2ea | ['60391bc5217e47d4b0df823b13892fd7'] | I am using CKEditor to get HTML from the user. The user will use HTML tags and it will be saved in the database. I need a functionality for the user to see how the page will be displayed when open as .html before saving in the database.
Is it possible to do that using CKEditor and if yes.....then how?
Thanks-in-Advance
| 2575e66dd726bf8dce3dfe75906e1f9a6187eed661b91322f999bc221310bdbe | ['60391bc5217e47d4b0df823b13892fd7'] | I am new to Facebook APIs. I am using Graph Search API and want to get public post such as comments, status updates who are having conversation about an object (could be a thing, location, personality etc).
I have valid access token with me.
Is it possible? How?
Any solution is welcome.
Thanks in Advance
|
9da7cbb337ce1a16975e841adb065cc010e3772b620e173449a45cf697e0f28c | ['6041cb60992446229debb99dfeec216b'] | The solution marked as right is good and right to the point. My only concern is that nextUid is a var that any other method in the class can update. If you want more secure (and even reusable) solution, you can do something like this:
class HashableIdGenerator {
private var nextId = 0
func generate() -> Int {
nextId += 1
return nextId
}
}
class AClass: Hashable {
private static let idGenerator = HashableIdGenerator()
let uid: Int
init() {
uid = AClass.idGenerator.generate()
}
var hashValue: Int { return uid }
// implement Equatable here
}
| 29735f22c8498b7bb98c4ca9cd30034527bfd4a49538664a075ec6880fd051b7 | ['6041cb60992446229debb99dfeec216b'] | I've faced these problems some time ago and it ended up that I had done 2 mistakes:
Never, ever, copy a MCPeerID object: Once I was storing MCPeerID objects that I received in MCNearbyServiceBrowserDelegate's foundPeer calls as the key of a Dictionary, which copied the object. Then when later I used that peer ID to invite a peer via MCNearbyServiceBrowser the connection would fail because the MCPeerID was a copy.
If one of your devices is a iOS Simulator, make sure your firewall is not blocking external connections at the OS level.
I feel your pain... MCFramework logs don't help.
I hope this can help. Good luck.
|
fce8bebafef0d1295e956480e328cd02d07c48d207fed2ca683d38a103758ac7 | ['604aaef3bac44081b0dfc6282ee9a724'] | I am trying to run some PowerShell commands and my script is failing on the following line:
$ipsr = New-Object Microsoft.Azure.IpSecurityRestriction
The error is:
Cannot find type [Microsoft.Azure.IpSecurityRestriction]: verify that the assembly containing this type is loaded
I am trying to run this “inline” in an Azure PowerShell task as part of my deployment pipeline. Is this supported or do I need to first import an assembly?
| 784a360c14fdc3b9839d092fa87fe8949472455eadcd7cabc889f70e0079c476 | ['604aaef3bac44081b0dfc6282ee9a724'] | I am looking to use Azure B2C with a classic asp.net web application. This doesn’t use any OWN middleware so I was hoping to use the Global.asax to inject the relevant tenant, client and policy info via the Application_PreSendRequestHeaders method. Can anyone tell me if this would work and if so, what names should be used when adding these values.
|
0369d2843b95c9af8b5d14ffe907e281af4ad49e506eaf8ff67ca78fc879d8a8 | ['604cec97ee9e4ae19ded0ed56098e80e'] |
This is one LinearLayout. I set this layout alpha to 0.6.
I want to set transparency only background, But it set inner values too.. Is there any solution to solve this problem?
<LinearLayout
android:alpha="0.6"
android:background="@mipmap/ic_launcher"
android:layout_width="match_parent"
android:layout_height="250dp">
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true"
android:background="#33B99F">
<Button
android:id="@+id/goBackButton"
android:textSize="15dp"
android:textColor="#FFFFFF"
android:background="@drawable/back"
android:layout_width="25dp"
android:layout_height="25dp"
android:layout_marginTop="30dp"
android:layout_marginLeft="10dp" />
<TextView
android:text="register(1/3)"
android:textSize="20dp"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:textAlignment="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginRight="30dp"
android:id="@+id/textView" />
</LinearLayout>
</LinearLayout>
Here is my code.
| 6f0177ee77fb553b8814e9a784a56b118d23b34ab9249f42efcf2e57caa42406 | ['604cec97ee9e4ae19ded0ed56098e80e'] | I want to change textView(in mainActivity)'s property like textSize, or textColor.
Then I tried to use it at setting activity.
View view = getLayoutInflater().inflate(R.layout.activity_main, null);
readTextView = view.findViewById(R.id.textView);
And It doesn't work.
Also, I tried to How to update a TextView of an activity from another class this answer. But isn't it can only change the text? If I need to change much property, I have to make a method in my activity.
|
73167ccadc9c5e06a7481f235b952b16361f00a1e91b7ca34d362584a520e175 | ['60503479c14e418da18ed1fb14322ba7'] | Maybe this will help someone.
The player from Sharepoint 2013 supports only certain formats(for HTML5 : asf, avi, mpg, mp3, mp4, ogg, ogv, webm, wma, wmv ; classic Silverlight Media Web Part supports: asf, mp3, mp4, wma, wmv).
I had to support swf files so I searched for other options. I found this one https://code.google.com/p/youplayer/downloads/detail?name=mediaplayer.swf and it works for me.
| 55a383b5bbf0d99ff934c59bb1122af7e1a22be580f918d624afd4cc874b3b50 | ['60503479c14e418da18ed1fb14322ba7'] | I'm evaluating OpenTok for a text and video chat app.
The Xamarin.OpenTok.iOS library works for the video chat, but I have an issuee with the text functionality.
I'm trying to send a message from an iPhone to another.
For sending messages from the first iphone I use:
Session.SignalWithType("signal", message, Session.Connection,true, out err);
I don't receive the event ReceivedSignalType on the second iphone connected to the same session.
Thank you.
|
1dda293e1cf4cf551119bb8d17993428cdc87c1e2410846fa1089b4fae048ef2 | ['6056c83f3d5a40d889994f91016dde6e'] | I have a problem while making my skype resolver, when it resolves an ip the text comes out like this ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,SERVER 1: <IP_ADDRESS> - Skype4Resolver.com" (btw the "," are spaces... stackoverflow doesn't show them.) when this happeneds it makes the text go unseen and out of the textbox. can anyone help? i want to filter out the spaces and anything that isnt part of the ip.
here is my code:
Imports System.Net
Public Class Form2
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
WebRequest.Create("http://api.skype4resolver.com/api.php?key=free&username=" + TextBox1.Text + "&server=1")
TextBox2.Text = New System.Net.WebClient().DownloadString("http://api.skype4resolver.com/api.php?key=free&username=" + TextBox1.Text + "&server=1")
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
End Sub
End Class
| 5073249e883749a9f7f2b5c03b4cd7eea3d2f0e06d90fbb3bd55cb6781472d4b | ['6056c83f3d5a40d889994f91016dde6e'] | So I'm doing an assignment for school and am having troubles using an API in java script. When I use XMLHttpRequest I receive the status code "0". After being frustrated from trying with XML I tried using fetch, I now get the error "Fetch failed loading: OPTIONS 'https://api-us.faceplusplus.com/facepp/v3/detect'"
To put it in context I have converted an image to base64 and need to parse that base64 as a parameter to face++ in order to do some face recognition stuff, should be cool when it works!
Here is the XML code:
function getInfo(base64) {
var request = new XMLHttpRequest();
request.open("POST", "https://api-us.faceplusplus.com/facepp/v3/detect");
request.setRequestHeader('api_key', 'my key');
request.setRequestHeader('api_secret', 'my secret');
request.setRequestHeader('image_base64', toString(base64));
request.send(null);
request.onload = function() {
console.log(request.status());
}
}
And here is the same thing attempted with fetch:
function getInfo(base64) {
var url = "https://api-us.faceplusplus.com/facepp/v3/detect"
var data = {
"api_key":"my key",
"api_secret":"my secret",
"image_base64":toString(base64)
}
var params = {
headers:{
"Content-Type":"application/json; charset=UTF-8"
},
body:data,
method:"POST"
}
fetch(url, params).then(data=>{return data.json()}).then(res=>{console.log(res.statusText)}).catch(error=>console.log(error))
}
I'm obviously missing something here and would really appreciate any help! Hope I've formatted this correctly.
|
dc22b56ec0e7d390980bc90102bbbdb19b58adb35ddf60e4c015806e1fea2cec | ['605baac1146d47958b04706d8c773ae0'] | You can accomplish this using a nested for loops and do something simial to:
count = 0;
String results = "";
for(int i=0;i<userString.length();){
char begin = userString.charAt(i);
//System.out.println("begin is: "+begin);
for(int j=i+1; j<userString.length();j++){
char next = userString.charAt(j);
//System.out.println("next is: "+next);
if(begin == next){
count++;
}
else{
System.out.println("Breaking");
break;
}
}
i+= count+1;
if(count>0){
String add = begin + "";
int tempcount = count +1;
results+= tempcount + add;
}
else{
results+= begin;
}
count=0;
}
System.out.println(results);
I tested this output with Hello and the result was He2lo
also tested with hellooopppppp result he2l3o6p
| d0c26f26e81b19d40b763bde7aa1b6651b568c8b7fbd8d744576c897f61347b0 | ['605baac1146d47958b04706d8c773ae0'] | So first thing that i noticed was that you have an infinate loop. You leave dontStop allways == 1 so your code will never exit the while loop. Second System.arraycopy(anArray, difSymbols, patternArray, 0, symbolsPerLine);
will get an out of bound error when you use an number that is greater than anArray.length, so you will need to remove this code. Here is a proposed solution:
char [] patternArray = new char[symbolsPerLine];
int length = symbolsPerLine;
int spot = 0;
if(symbolsPerLine<anArray.length){
symbolsPerLine = anArray.length;
}
while(dontStop==1){
for(int i= (anArray.length - difSymbols);i<anArray.length-1;i++){
if(length==0){
dontStop =0;
break;
}
patternArray [spot]= anArray [i];
spot++;
length--;
}
}
for(int j=0;j<patternArray.length;j++){
System.out.print(patternArray[j]);
}
System.out.println("\npatternArray.length is: "+ patternArray.length);
The output for this solution is:
Output Run1:
13
Dif symbols are: 13
Enter amount of symbols per row:
20
Amount of symbols per line are: 20
Finished Loop
@#$%^&+=~<>@#$%^&+
patternArray.length is: 20
Output Run2:
Enter the amount of symbols to use:
5
Dif symbols are: 5
Enter amount of symbols per row:
20
Amount of symbols per line are: 20
Finished Loop
=~<>=~<>=~<>=~<>=~<>
patternArray.length is: 20
This is what i am assuming you were trying to accomplish.
|
f23de7c5596713c2ce5a82cb2e80ac7b4857236187965a614f290a74bf43fd80 | ['605c95a2f1894dd2bb25fcfda441ec20'] | Thanks, teecee. It does seem like someone's accessing computers methodically, immediately checking PayPal to see if you happen to be signed in to that.
My password was NOT used anywhere else, like many other users reported, which makes it very plausible that TV's database was hacked. However, I've since enabled 2FA, which is a pretty good security feature, and haven't had any other issues.
It's just a shame that a company as big as TV refuse to admit their own mistake and notify their users of the breach and steps on how to secure their account better, at least until after the fact. | 1191c121f9bcba08d025ca04649b92aab8bb4fc8e50cb2436a1863d65b026f65 | ['605c95a2f1894dd2bb25fcfda441ec20'] | Thanks. I own a multimeter, and I know how to set it to AC mode, and even know how to adjust the range. However, I'm not sure where and why to place the contacts in order to figure out out to identify the C vs. Load side. If I had to guess, I'd test the upper wire (supposedly a C wire) against a red thermostat wire, which I assume is attached to Load. But I'm not very bright. Any advice? |
071f563e8ef084113a52451bf7173076b4959a897b07114c172862fbc54f1c66 | ['605fb8040b89488ebd1e3495ee7a5ee0'] | I am doing a mobile app which use the slider function in Jssor.
There are 4 pages and I would like to stop the page flow while it is the end of the page.
i.e. After keep swipe to left, from page1 to page4, while page4 reached, it won't go back to page1.
Thanks for your help.
| 172fe2ce8f9dcf389791c6c444c01ef956c0b7f832a56107a500989764075f40 | ['605fb8040b89488ebd1e3495ee7a5ee0'] | I would like to perform a xml data exchange as below:
The incoming xml data have some tags i don't know about the tag name.
Can i read those tag without knowing the tag name?
Also how can i get the tag name as the data attribute?
For example:
i want to read different patients record. Every patient have different disease. Such as 'Heart Disease', 'cancer'.
<heart disease>serious</heart disease>
<cancer>normal</cancer>
I don't know both tags before. but i want to read the tag name and present it.
Finally, i can get data:
heart disease: serious
cancer normal:
|
63f04b9694d0c64d5942ba72186b3963a545ebb5a0295d4266bc3c5cdeca74ce | ['606131862585489bbe6e2a1d6305e847'] | I used the sudo service lightdm stop to install a driver, (it was unsuccessfull, but it doesn't mather), then a rebooted, and since than, I'm unabel to chamnge the resolution of my laptop. I've tried so many ways, but all of them were seless.
Thanks a lot
<PERSON>
| d0abc3d28aed31e541f4844e05042b2756b8f682fed132ee9a5454a1c5c4f9e4 | ['606131862585489bbe6e2a1d6305e847'] | <PERSON> a programar en Java(nivel novato) y estoy haciendo una clase que se llama Persona; pero al compilar me arroja el siguiente error:
Persona.java:31: error: illegal start of expression
if (sexo != 'H') && (sexo != 'M'); s = "Desconocido";
Como lo puedo corregir ?, este es <PERSON>:
class <PERSON> {
private String nombre;
private String <PERSON>;
private int edad;
private char sexo;
public String getNombre() {
return nombre;
}
public void setNombre(String txt) {
nombre = txt;
}
public String getApellido() {
return apellido;
}
public void setApellido(String txt) {
apellido = txt;
}
public int getEdad() {
return edad;
}
public void setEdad(int n) {
edad = n;
}
public String getSexo() {
String s;
if (sexo == 'H') s = "<PERSON>";
if (sexo == 'M') s = "<PERSON>";
if (sexo != 'H') && (sexo != 'M'); s = "<PERSON>";
return s;
}
public void setSexo(char s) {
sexo = s;
}
}
|
20c29fcd78bf68adc73146994daa8a8ff2aedd48f9d2f3b97cca40ca6d017566 | ['609b9bade3e24a7c80a930fdb3265fc7'] | I noticed you're using ASPNET, if you're using the ASPNETCORE version, since 2.x, you can have background services that you could run every X hours to resubscribe (update) the subscriptions. That's what we're using (and we're on Azure). I would guess webjobs could do the trick, but I have not used them yet. You could also have an external service that calls one of your endpoints every X hours (like a CRON job) .
hope this helps!
JS
| e6ea7eb8d021d2ae94b4f2c1554472c3535aceb0f8bbe6fd92390a10d444d291 | ['609b9bade3e24a7c80a930fdb3265fc7'] | I also found no easy way around this.
The following might make it simpler...
public static void Reset(this DbContext context)
{
var entries = context.ChangeTracker
.Entries()
.Where(e => e.State != EntityState.Unchanged)
.ToArray();
foreach (var entry in entries)
{
switch (entry.State)
{
case EntityState.Modified:
entry.State = EntityState.Unchanged;
break;
case EntityState.Added:
entry.State = EntityState.Detached;
break;
case EntityState.Deleted:
entry.Reload();
break;
}
}
}
Hope this helps!
JS
|
ac1ac4185af8c1133a2b892ae8ff55a9abf7bbc14ce0e1f2f2e182e1ddb0c002 | ['609c19a6e31848a395f84b87ed8d01df'] | during my Camel routes, I query a server (a HTTP GET) and as a result, I receive a 200 OK with a XML body looking similar like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<userProfiles xmlns="http://www.mycompany.com/AEContext/xmldata">
<userProfile name="guest">
<userProfileAttributes>
<userProfileAttribute name="parameter1" value="data1" nameVisibility="ALL"/>
<userProfileAttribute name="parameter2" value="data2" nameVisibility="ALL"/>
<userProfileAttribute name="parameter3" value="data3" nameVisibility="ALL"/>
</userProfileAttributes>
</userProfile>
</userProfiles>
Any idea how I would be able to get the value of "parameter2" in the XML part (in my example 'data2') and store that value in an exchange property ? I guess by using an xpath expression ? Or ...
Thanks for your help.
| 4bf38c667373c7d1ce388159b766da84662ce11546fa7468797116ce41b9bc28 | ['609c19a6e31848a395f84b87ed8d01df'] | We are using Apache Camel as an orchestration engine. Typically, the following scenario:
client sends HTTP request <-> CAMEL code <-> external server(s)
The ball starts to roll when our client sends a HTTP request to our CAMEL code.
The Camel code will trigger external servers via REST HTTP calls.
Eventually, the Camel code will send a reply back to the client.
The last action before sending the response back to the client, the Camel code sends a HTTP GET towards an external server. So a TCP connection is setup first, then the data sent. After some time (this might take up 5 to 10 seconds), the external server replies with a 200 OK.
Problem: Camel does not send a TCP FIN to the external server after receiving the 200 OK. As a result, the TCP connection remains open ... (the external server then closes the TCP connection itself after a timeout of 200 seconds, but this means a TCP resource lost during 200 seconds).
So, at TCP level, it goes like this:
Camel <----------> external server
TCP SYN -->
<-- TCP SYN,ACK
TCP ACK -->
HTTP GET -->
<-- 200 OK
TCP ACK -->
<200 seconds later>
<-- TCP FIN,ACK
TCP ACK -->
Any idea how I can have Camel close the TCP connection after it has received the 200 OK ?
Note: I tried adding the "Connection: close" header, but Camel did not add the header ?! It seemed to ignore it ...
This was the code to add the header:
exchange.getOut().setHeader("Connection","Close");
I am using Camel 2.9.1 in a Spring framework with Eclipse IDE.
|
9c79f03394d2b5b606d2b6b97ce5f2fd1e2b83c9667bff019626b2e99480722d | ['60a08297ca664d28bb0451e5d7d765de'] | I'm getting the following communication exception for my wcf service making cal to another wcf service:
"The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element."
I resolved this by increasing the size as below:
maxReceivedMessageSize="50000000"
But, here I want to know whether any side effects of increasing message size to such big level.
| 695ff9e23f81021c63d79690f6e7ff91ab0cc22815b327996ba5496d7fd3a1c6 | ['60a08297ca664d28bb0451e5d7d765de'] | We are getting the below exception while reading data using JsonTextReader
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.
JsonTextReader jsonReader - parameter
while (hasRecords(jsonReader, JsonToken.StartObject, null, null)) //Row
{
...
//it's ok to read this all into memory - it's just one row's worth of data
JArray values = (JArray)JToken.ReadFrom(jsonReader);
Also, including the code for HttpPost implementation for better clarity
HttpClientHandler handler = new HttpClientHandler() { Credentials = taskProfileInfo.Credential };
HttpClient httpClient = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(taskProfileInfo.CommandTimeout) };
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response;
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url);
request.Content = new StringContent(postBody, Encoding.UTF8, "application/json");
response = await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);
response.EnsureSuccessStatusCode();
//using (var responseStream = await response.Content.ReadAsStreamAsync())
//{
// using (var reader = new StreamReader(responseStream))
// {
// responseFromAPI = reader.ReadToEnd();
// }
//}
return new JsonTextReader(new StreamReader(await response.Content.ReadAsStreamAsync()));
Appreciate if any one can help us ..
Edit: Please note that we are able to debug it locally and works fine. Only problem when we run this as Worker Role in Azure Cloud service.
|
abaa72a2819f6103583e25d20fb57554dc74e23f391258f05a9e387c86df4d8e | ['60b22a37fbb9486b84d068dc11965ac7'] | The simplest way to achieve what you want is to create an instance of the data module for each form, and pass it to the form so it can be freed when the form is closed:
var
Data: TDataModule;
begin
Data := T<YourDataModule>.Create(Self);
try
Form := T<YourForm>.Create(Self);
Form.DataModule := Data;
Data.Name := '';
except
Data.Free;
raise;
end;
Form.Show;
end;
Setting the DataModule's Name to an empty string is done to ensure that the VCL's logic for hooking up data aware controls to their datasource/dataset is done using the newly created instance, instead of the first ever instance.
In the Form's OnClose handler (or its destructor) make sure to free the data module.
| cc4fe0f858d3646fa2b1d1d1749b8b875a83ab7165920e3545565045971e8ddc | ['60b22a37fbb9486b84d068dc11965ac7'] | Three component sets I am aware of that will take care of the nitty gritty technical aspects of client server applications for you:
kbmMW: http://components4developers.com/
Asta: http://www.astatech.com/index.asp
RemObjects: http://www.remobjects.com/
You may have to rework your applications to take advantage of the way these component sets work, but assuming you have properly separated layers that shouldn't be too much of a hassle and will buy you the advantage of well tested and widely used code for your client server work.
|
533e38296d9cfd95f11552375f7a30af3aea25f9cc226ecdf1f826888d1d1a9e | ['60b76d2ea0bd406da36237137b93b2b5'] | I'm saving the Zoom and Location of the Google Map API setting in cookies as the user adjusts his map. When they come back the map is at the same place. The function works most of the time:
var h = JSON.stringify(map.getCenter(), null, 2);
jQuery.cookies.set("YD44635center",h,cookieOptions);
On the decode side using:
locationVar = jQuery.cookies.get("YD44635center");
var temp = "";
// for testing:
for(var x in locationVar){
temp += x + "\n";
}
alert(temp);
To see what I'm getting, most of the time, is:
Qa;
Pa;
So I set my code to load the map with those variables and everything is fine. Then one day
the page stops working and the parameters returned do not have a "Q" anymore like in Qa but an "O" like in Oa. So I changed the code and it worked for a day and then what Google was sending changed back to the Qa. I changed it back.
Time goes by. Now today the code start working intermittently and I put that debug thing back in and now instead of "Pa" on the second variable I'm getting "Ra". Not continuously but mostly. What's up. It's happening on two different browsers the same way.
| 7d47b9badfc709de8f709fa826155eb55fc141c4ecb0a6049a2cbbcc8b17976a | ['60b76d2ea0bd406da36237137b93b2b5'] | I'm using phpMailer on a Linode server. The DNS records are set to allow sending through the gmail mail server which is hosing my mail account <EMAIL_ADDRESS>. I just added DKIM to try to get the SPF rating up. The DKIM apparently is fine but I still get SPF Neutral.
The sender set up is:
$mail = new PHPMailer();
$mail->isSMTP();
$mail->SMTPKeepAlive = true;
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls"; // sets the prefix to the server
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port
$mail->Username = "<EMAIL_ADDRESS>"; // GMAIL username
$mail->Password = "*******************"; // GMAIL password
$mail->isHTML(true); // send as HTML
$mail->WordWrap = 100; // set word wrap
$mail->Sender = "<EMAIL_ADDRESS>";
$mail->addReplyTo($_SESSION['se-reply'],$_SESSION['se-from']);
$mail->setFrom($_SESSION['se-reply'],$_SESSION['se-from']);
$mail->DKIM_domain = "oiyc.org";
$mail->DKIM_private = "*********/rsa.private"; //path to file on the disk.
$mail->DKIM_selector = "mainkey";// change this to whatever you set during step 2
$mail->DKIM_passphrase = "";
$mail->DKIM_identity = $mail->Sender;
Here is the source received from an email sent through my linode server.
Delivered-To: ********@gmail.com
Received: by 10.46.25.85 with SMTP id p82csp1388830lje;
Sun, 4 Feb 2018 11:11:56 -0800 (PST)
X-Received: by 10.98.196.204 with SMTP id h73mr11556131pfk.143.1517771515865;
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1517771515; cv=none;
d=google.com; s=arc-20160816;
b=*****
qrIA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=content-transfer-encoding:mime-version:list-unsubscribe:message-id
:subject:reply-to:to:date:from:dkim-signature
:arc-authentication-results;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=********
iuTg==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass <EMAIL_ADDRESS> header.s=20150623 header.b=ytsz7YWm;
spf=neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of <EMAIL_ADDRESS>) <EMAIL_ADDRESS>
Return-Path: <<EMAIL_ADDRESS>>
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41])
by mx.google.com with SMTPS id i3sor1037208pgs.91.2018.02.04.11.11.55
for <********@gmail.com>
(Google Transport Security);
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
Received-SPF: neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of <EMAIL_ADDRESS>) client-ip=209.85.220.41;
Authentication-Results: mx.google.com;
dkim=pass <EMAIL_ADDRESS> header.s=20150623 header.b=ytsz7YWm;
spf=neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of <EMAIL_ADDRESS>) <EMAIL_ADDRESS>
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oiyc-org.20150623.gappssmtp.com; s=20150623;
h=from:date:to:reply-to:subject:message-id:list-unsubscribe
:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*********
SsBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:date:to:reply-to:subject:message-id
:list-unsubscribe:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*************
r+zA==
X-Gm-Message-State: AKwxytcQCxD/95gmJfS/DyCC4XOh8K3K+Jj9QONeHmVyCH5ebJDtxvIl tQwyBjpS9etVQopYODbtnZZ2Kw0k1Pc=
X-Google-Smtp-Source: AH8x227kdTn+9Ee7QoJFUYDPq/ax7LmKHzsDAtCNr/5cL0MidmAB3GWuEw4RU28Zb3jl8Kx0uAnegw==
X-Received: by 10.99.96.80 with SMTP id u77mr6305435pgb.401.1517771515191;
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
Return-Path: <<EMAIL_ADDRESS>>
Received: from oiyc.org ([2600:3c01::f03c:91ff:fe56:5129])
by smtp.gmail.com with ESMTPSA id m65sm14046167pfc.150.2018.02.04.11.11.54
for <********@gmail.com>
(version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
Sun, 04 Feb 2018 11:11:54 -0800 (PST)
From: Bob Brunius <<EMAIL_ADDRESS>>
X-Google-Original-From: Bob Brunius <********@gmail.com>
Date: Sun, 4 Feb 2018 11:11:53 -0800
To: ********@gmail.com
Reply-To: Bob Brunius <********@gmail.com>
Subject: A different sort of test 123d
Message-ID: <<EMAIL_ADDRESS>>
X-Mailer: PHPMailer 6.0.3 (https://github.com/PHPMailer/PHPMailer)
List-Unsubscribe: <<EMAIL_ADDRESS>>, <https://<EMAIL_ADDRESS><IP_ADDRESS>;
Authentication-Results: mx.google.com;
dkim=pass header.i=@oiyc-org.20150623.gappssmtp.com header.s=20150623 header.b=ytsz7YWm;
spf=neutral (google.com: 209.85.220.41 is neither permitted nor denied by best guess record for domain of membership@oiyc.org) smtp.mailfrom=membership@oiyc.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oiyc-org.20150623.gappssmtp.com; s=20150623;
h=from:date:to:reply-to:subject:message-id:list-unsubscribe
:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*********
SsBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:date:to:reply-to:subject:message-id
:list-unsubscribe:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*************
r+zA==
X-Gm-Message-State: AKwxytcQCxD/95gmJfS/DyCC4XOh8K3K+Jj9QONeHmVyCH5ebJDtxvIl tQwyBjpS9etVQopYODbtnZZ2Kw0k1Pc=
X-Google-Smtp-Source: AH8x227kdTn+9Ee7QoJFUYDPq/ax7LmKHzsDAtCNr/5cL0MidmAB3GWuEw4RU28Zb3jl8Kx0uAnegw==
X-Received: by 10.99.96.80 with SMTP id u77mr6305435pgb.401.1517771515191;
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
Return-Path: <membership@oiyc.org>
Received: from oiyc.org ([<IP_ADDRESS>f03c:91ff:fe56:5129])
by smtp.gmail.com with ESMTPSA id m65sm14046167pfc.150.2018.02.04.11.11.54
for <********@gmail.com>
(version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
Sun, 04 Feb 2018 11:11:54 -0800 (PST)
From: <PERSON> <membership@oiyc.org>
X-Google-Original-From: <PERSON> <********@gmail.com>
Date: Sun, 4 Feb 2018 11:11:53 -0800
To: ********@gmail.com
Reply-To: <PERSON><IP_ADDRESS> with SMTP id p82csp1388830lje;
Sun, 4 Feb 2018 11:11:56 -0800 (PST)
X-Received: by <IP_ADDRESS> with SMTP id h73mr11556131pfk.143.1517771515865;
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
ARC-Seal: i=1; a=rsa-sha256; t=1517771515; cv=none;
d=google.com; s=arc-20160816;
b=*****
qrIA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=content-transfer-encoding:mime-version:list-unsubscribe:message-id
:subject:reply-to:to:date:from:dkim-signature
:arc-authentication-results;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=********
iuTg==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@oiyc-org.20150623.gappssmtp.com header.s=20150623 header.b=ytsz7YWm;
spf=neutral (google.com: <IP_ADDRESS> is neither permitted nor denied by best guess record for domain of membership@oiyc.org) smtp.mailfrom=membership@oiyc.org
Return-Path: <membership@oiyc.org>
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [<IP_ADDRESS>])
by mx.google.com with SMTPS id i3sor1037208pgs.91.2018.02.04.11.11.55
for <********@gmail.com>
(Google Transport Security);
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
Received-SPF: neutral (google.com: <IP_ADDRESS> is neither permitted nor denied by best guess record for domain of membership@oiyc.org) client-ip=209.85.220.41;
Authentication-Results: mx.google.com;
dkim=pass header.i=@oiyc-org.20150623.gappssmtp.com header.s=20150623 header.b=ytsz7YWm;
spf=neutral (google.com: <IP_ADDRESS> is neither permitted nor denied by best guess record for domain of membership@oiyc.org) smtp.mailfrom=membership@oiyc.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oiyc-org.20150623.gappssmtp.com; s=20150623;
h=from:date:to:reply-to:subject:message-id:list-unsubscribe
:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*********
SsBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:date:to:reply-to:subject:message-id
:list-unsubscribe:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*************
r+zA==
X-Gm-Message-State: AKwxytcQCxD/95gmJfS/DyCC4XOh8K3K+Jj9QONeHmVyCH5ebJDtxvIl tQwyBjpS9etVQopYODbtnZZ2Kw0k1Pc=
X-Google-Smtp-Source: AH8x227kdTn+9Ee7QoJFUYDPq/ax7LmKHzsDAtCNr/5cL0MidmAB3GWuEw4RU28Zb3jl8Kx0uAnegw==
X-Received: by <IP_ADDRESS><PHONE_NUMBER>; cv=none;
d=google.com; s=arc-20160816;
b=*****
qrIA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
h=content-transfer-encoding:mime-version:list-unsubscribe:message-id
:subject:reply-to:to:date:from:dkim-signature
:arc-authentication-results;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=********
iuTg==
ARC-Authentication-Results: i=1; mx.google.com;
dkim=pass header.i=@oiyc-org.20150623.gappssmtp.com header.s=20150623 header.b=ytsz7YWm;
spf=neutral (google.com: <PHONE_NUMBER> is neither permitted nor denied by best guess record for domain of membership@oiyc.org) smtp.mailfrom=membership@oiyc.org
Return-Path: <membership@oiyc.org>
Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. <PHONE_NUMBER>])
by mx.google.com with SMTPS id i3sor1037208pgs.91.2018.02.04.11.11.55
for <********@gmail.com>
(Google Transport Security);
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
Received-SPF: neutral (google.com: <PHONE_NUMBER> is neither permitted nor denied by best guess record for domain of membership@oiyc.org) client-ip=<PHONE_NUMBER>;
Authentication-Results: mx.google.com;
dkim=pass header.i=@oiyc-org.20150623.gappssmtp.com header.s=20150623 header.b=ytsz7YWm;
spf=neutral (google.com: <PHONE_NUMBER> is neither permitted nor denied by best guess record for domain of membership@oiyc.org) smtp.mailfrom=membership@oiyc.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=oiyc-org.20150623.gappssmtp.com; s=20150623;
h=from:date:to:reply-to:subject:message-id:list-unsubscribe
:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*********
SsBA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:date:to:reply-to:subject:message-id
:list-unsubscribe:mime-version:content-transfer-encoding;
bh=ptVvqh2PiSco0+Kb7wjBXHUijnbEm43LU4E+zStVvb0=;
b=*************
r+zA==
X-Gm-Message-State: AKwxytcQCxD/95gmJfS/DyCC4XOh8K3K+Jj9QONeHmVyCH5ebJDtxvIl tQwyBjpS9etVQopYODbtnZZ2Kw0k1Pc=
X-Google-Smtp-Source: AH8x227kdTn+9Ee7QoJFUYDPq/ax7LmKHzsDAtCNr/5cL0MidmAB3GWuEw4RU28Zb3jl8Kx0uAnegw==
X-Received: by 10.99.96.80 with SMTP id u77mr6305435pgb.401.1517771515191;
Sun, 04 Feb 2018 11:11:55 -0800 (PST)
Return-Path: <membership@oiyc.org>
Received: from oiyc.org ([2600:3c01::f03c:91ff:fe56:5129])
by smtp.gmail.com with ESMTPSA id m65sm14046167pfc.150.2018.02.04.11.11.54
for <********@gmail.com>
(version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128);
Sun, 04 Feb 2018 11:11:54 -0800 (PST)
From: Bob Brunius <membership@oiyc.org>
X-Google-Original-From: Bob Brunius <********@gmail.com>
Date: Sun, 4 Feb 2018 11:11:53 -0800
To: ********@gmail.com
Reply-To: Bob Brunius <********@gmail.com>
Subject: A different sort of test 123d
Message-ID: <MR3sDgtyN4siuc2vYCZLxL34VuLFlexvK0WbbcEH7FA@oiyc.org>
X-Mailer: PHPMailer 6.0.3 (https://github.com/PHPMailer/PHPMailer)
List-Unsubscribe: <information@oiyc.org>, <https://oiyc.org/membershipDatabaseForms/unsubscribe.php?email=********@gmail.com&member=242>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="b1_MR3sDgtyN4siuc2vYCZLxL34VuLFlexvK0WbbcEH7FA"
Content-Transfer-Encoding: 8bit
--b1_MR3sDgtyN4siuc2vYCZLxL34VuLFlexvK0WbbcEH7FA
Content-Type: text/plain; charset=us-ascii
Hello 12345678-abcd
--b1_MR3sDgtyN4siuc2vYCZLxL34VuLFlexvK0WbbcEH7FA
Content-Type: text/html; charset=us-ascii
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<body>
Hello 12345678-abcd
</body>
</html>
--b1_MR3sDgtyN4siuc2vYCZLxL34VuLFlexvK0WbbcEH7FA--
|
e0fa0dcaa52b63fd1b9e45334048c8d4f592cab6ca5fc6d00fe61e7e1ab7ecb6 | ['60b94caf45864dddb67fcc25894f83bb'] | I'm creating an asp.net web api. Many of the routes all do the same thing, just with different node objects. I'd like to create a base model from a BaseRepository class and simply have the child class cast and return the object(s).
For example. GET api/{controller}
The only thing that changes in this cypher query is the Label of the node which is easily provided as a parameter.
I've tried many, many ways to do this such as.
var query = client
.Cypher
.Match(string.Format("(node:{0})", label))
.Return(node => node.As<Node<object.GetType()>>())
.Limit(10)
.Results;
But the lambda will not accept that. I've tried
.Return(node => node.As<Node<string>>())
and converting it to the object type and dynamic but it says I can't do that either.
Is there anyway to do what I'm trying here or maybe another avenue could be suggested so that I don't have to write dozens of GET api/{controller} methods exactly the same way?
Thanks!
| 23922d41acec5bccf774eb27440686c0c82637b183ae053544352e0e4d2e247a | ['60b94caf45864dddb67fcc25894f83bb'] | Server side I'm using WCF returning properly formatted json. I'm able to receive the expected data when I use a jquery $.ajax function, so let's assume (unless there's a nuance with jqWidgets) that the WCF side is correct.
What I can't get to work is loading a jqx dataAdapter with the same data. I've tried a dozen different ways and always end up with no records. Here's the javascript.
<script type="text/javascript">
$(document).read(function() {
var source = {
type: "GET",
data: "",
dataType: "json",
dataFields: [
{ name: "ID" },
{ name: "Name" }
],
url: "TestService.svc/GetAttributes",
root: 'GetAttributesResult'
};
var dataAdapter = new $.jqx.dataAdapter( source );
$("#jqxGrid").jqxGrid(
{
source: dataAdapter,
columns: [
{ text: 'ID', datafield: 'ID', width: 200},
{ text: 'Name', datafield: 'Name', width: 200}
]
});
});
</script>
For reference the data being returned from my WCF service looks like this
{"GetAttributesResult":[{"ID":"1","Name":"Make"},{"ID":"2","Name":"Model"}]}
If I try something as simple as
var dataAdapter = new $.jqx.dataAdapter(source);
I get an empty recordset while debugging with VS2012.
Any help is greatly appreciated. I'm open to taking a different design direction altogether as this is still early enough in the project to do so.
Thank you!
|
d188a535e9edd38157a9c86bb56040f45439a1047cb81784f3172bd6d37b2614 | ['60c4e732194149f3a972ded9d090af32'] | Un archivo parcelable sólo puede tener un 1MB de tamaño, por lo que si quieres pasar datos entre activities, una solución recurrente es usar un Repositorio singleton.
Si estás trabajando con Kotlin puedes emplear object y si usas Java pues el patrón de diseño Singleton. Si estás usando un inyector de dependencias o un service locator, también puedes emplearlo para que el repositorio sea singleton.
Entre activities puedes compartir una lista de id y que la activity secundaria los recupere del repositorio creado.
| 2b99d1eb9b61bdd1ad5a1de536db3536e3ddd961a30ea0464a159cd9f3e2c1b8 | ['60c4e732194149f3a972ded9d090af32'] | Si estás usando "unas imágenes que son círculos" probablemente te interese ver el componente TabLayout ya que son marcadores de las páginas del ViewPager y cambian automáticamente cuando el usuario lo hace.
Si no es el caso, ViewPager dispone de un listener llamado addOnPageChangeListener que captura el cambio de tab:
viewPager.addOnPageChangeListener(new OnPageChangeListener() {
public void onPageScrollStateChanged(int state) {}
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}
public void onPageSelected(int position) {
// Do your logic
}
});
En el método onPageSelected(int position), puedes comprobar el número de la página y si quieres notificárselo al fragment en ese momento, la comunicación puedes hacerla con una interfaz como te han comentado o con un ViewModel compartido si ya lo estás usando.
|
ef07e90282dba1ee9597abe5e46a2c3df512d4fda7bebf1d6447c2558f9eed73 | ['60c9d12ab74442d6a94c99e9f1772bdf'] | Let's say, I have many spheres drawn with surf/mesh function in MATLAB.
I want to display customize data values rather than x,y,z. All values will be different for different spheres and clicking on any point on a particular sphere should display the same data. Refer figure. How do I achieve it?
So far, I'm thinking of using Surface property 'tag' to assign unique string to each sphere. Is there any better way to do it?
[x,y,z] = sphere;
a=[3 1 3 1];
s1=surf(x*a(1,4)+a(1,1),y*a(1,4)+a(1,2),z*a(1,4)+a(1,3),...
'FaceColor', [1 0 0],'FaceLighting','flat','EdgeColor','none');
s1.Tag = '1';
How should I proceed with custom datacursor function for custom functionality ?
| 9abe82744ef1456faaf79e47fcfced2dd5c09447db69c86ee6dca0a6fd7c2643 | ['60c9d12ab74442d6a94c99e9f1772bdf'] | In the CMakeLists.txt, if I define the .lib (static library) file path as absolute path, it's working correctly. But if I define the same as relative path, an error is thrown. How do I solve it without hard coded ?
File structure:
|--D
| |--Rohit
| | |--Sandbox
| | | |--demo
| | | | |--src
| | | | | |--abc
| | | | | | |--build
| | | | | | |--CMakeLists.txt
| | | | | | |--lib
| | | | | | | |--foo.lib
.
.
| | | | |--workspace
| | | | | |--xyz
| | | | | | |--foo2.lib
This way is working fine:
add_library(foo STATIC IMPORTED)
set_property(TARGET foo PROPERTY IMPORTED_LOCATION D:/Rohit/Sandbox/demo/src/abc/lib/foo.lib)
This way is throwing error:
add_library(foo STATIC IMPORTED)
set_property(TARGET foo PROPERTY IMPORTED_LOCATION "/lib/foo.lib")
My CMakeLists.txt path: D:\Rohit\Sandbox\demo\src\abc\CmakeLists.txt
This is error I'm getting: LINK : fatal error LNK1104: cannot open file '\lib\foo.lib'
Also if I want to include .lib file from some other folder (let's say foo2.lib file is present in xyz folder of workspace), How to define it ?
|
b50ef446a46f612331a4365abaa00bf38aaa627db45011f97bb3aa1550d1381f | ['60e29c3613e24c29811ac76098d0203a'] | I am currently displaying an RSS feed and I am grabbing the title, link and date for each article. I would also like to grab the media:thumbnail for each article. Here is the PHP code I am using to retrieve the RSS feed.
<?php
$rss = new DOMDocument();
$rss->load('http://www.avfc.co.uk/rss/ptv/page/CustomArticleIndex/0,,10265~2282152,00.xml');
$feed = array();
foreach ($rss->getElementsByTagName('item') as $node) {
$item = array (
'title' => $node->getElementsByTagName('title')->item(0)->nodeValue,
'link' => $node->getElementsByTagName('link')->item(0)->nodeValue,
'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue,
);
array_push($feed, $item);
}
$limit = 2;
for($x=0;$x<$limit;$x++) {
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$link = $feed[$x]['link'];
$date = date('l F d, Y', strtotime($feed[$x]['date']));
echo '<div id="feed"><a target="_blank" href="'.$link.'" title="'.$title.' ">'.$title.'</a><br />';
echo '<a class="date">Posted on '.$date.'</a></div>';
}
?>
The RSS feed I am displaying is: http://www.avfc.co.uk/rss/ptv/page/CustomArticleIndex/0,,10265~2282152,00.xml
I'm not that good with PHP so does anybody know how I can go about doing this? Thanks.
| fbeb5c6b4985503a0929b5de57fe13a39c26204b17185a2451c383849f610ce5 | ['60e29c3613e24c29811ac76098d0203a'] | I posted a similar question last week when having a problem and wasn't sure if I could re-ask in the same question or not so I have created a new one just incase.
I've got two columns, one floated left and one floated right, and I am using clear:both to clear the floats but it is not working. I have checked to make sure all my DIV tags are closed and they are (this was the issue last time) and moving the clear:both to different parts but still it decides not to work. Code is below but if you would like to see what it looks like it can be seen here http://www.richardawarner.co.uk/portfoliov2
Any help is appreciated.
HTML
<div id="sectiontwowrapper">
<div id="header">
<h1>About Me</h1>
</div><!--Header-->
<div id="contentwrapper">
<div id="aboutmeleft">
<h3>About Me</h3>
<br>
<a>My name is <strong><PERSON>> and I am a young web designer from Birmingham, United Kingdom. I have recently graduated from Manchester Metropolitan University having studied BSc(Hons) Multimedia Computing. Whilst having an interest in studying different aspects to computers, it was here where I developed a passion for web design. I have learnt various languages such as HTML, CSS and PHP aswell as experienced using Adobe Photoshop, Adobe Dreamweaver and other Adobe products.</a>
<p>
<h3>Skills and Expertise</h3>
<br>
<ul>
<li><a>HTML and CSS</a></li>
<li><a>PHP</a></li>
<li><a>MySQL</a></li>
<li><a>Wordpress</a></li>
<li><a>Adobe Photoshop</a></li>
<li><a>Adobe Dreamweaver</a></li>
</ul>
</div><!-- About me left -->
<div id="aboutmeright">
<h3>Hobbies</h3>
<br>
<a>Hobbies will appear here</a>
<p>
<h3>My CV</h3>
<br>
<a>You can download my CV by clicking here.</a>
</div><!-- About Me right -->
</div><!--Content Wrapper -->
</div><!--Section Two Wrapper -->
<div class="clear"></div>
<div id="sectionthreewrapper">
this line should be underneath this sections border line below
</div> <!--Section three wrapper -->
CSS
#sectiontwowrapper {
position: relative;
top: 100px;
min-height: 550px;
min-width: 960px;
text-align: left;
border: solid 1px #000;
#contentwrapper {
width: 960px;
margin: 0 auto;
text-align: left;
}
#aboutmeleft {
width: 450px;
height: 400px;
/*border: 1px solid #000;*/
position: relative;
top: 40px;
float: left;
}
#aboutmeright {
width: 450px;
height: 220px;
/*border: 1px solid #000;*/
position: relative;
top: 40px;
float: right;
}
.clear {
display: block;
clear: both;
}
|
d9d5d0fc7ac3e70fe448b9231218b8a86511356fe62159eb6cb2fac53d2b4d5a | ['60ea78c5b5894874bc8880a0bcc2e152'] | Hey I'm trying to create a incremental game and am stuck.
You press one button and get a currency which is called "Evos". With these "Evos" you can buy a storyteller who will start to generate "Evos" on his own.
this is the code:
$(document).ready(function() {
"use strict";
var evoAmount = 0;
var storytellerAmount = 0;
var evoIncrement = 1;
var storyteller = {
Amount: 0,
Cost: 10,
Increment: 1
};
var tick = 1000;
var runstoryteller = setInterval(function () {
evoAmount = evoAmount + (storyteller.Increment * storyteller.Amount);
updateValues();
}, tick);
function updateValues(){
$('#evoAmount').html(evoAmount);
$('#storytellerAmount').html(storyteller.Amount);
}
/* Buy storytellers */
$('#storytellerBuy').click(function () {
if (evoAmount >= storyteller.Cost) {
evoAmount = evoAmount - storyteller.Cost;
storyteller.Amount++;
storyteller.Cost = (storyteller.Cost / 100) * 20;
updateValues();
}
});
$('#click').click(function(){
evoAmount = evoAmount + evoIncrement;
document.getElementById("evoAmount").innerHTML = evoAmount;
});
});
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://bootswatch.com/slate/bootstrap.min.css">
<link rel="stylesheet" href="style.css">
<meta charset="utf-8">
<title>Evo-Clicker v1.0.0</title>
</head>
<body>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/click.js"></script>
<div class="main">
<button id="click" class="btn btn-default">Click</button>
<span id="evoAmount">0</span> EVOs <br><br>
<button id="storytellerBuy" class="btn btn-danger">Buy Storyteller</button><span id ="storytellerAmount">0</span> Storytellers
</div>
</body>
</html>
Basically i can buy the first storyteller for 10 Evos. But i want to increase the cost with each bought storyteller by 20%. But if i change the code it either goes into negative "Evos" or in this example you only have to pay once and then buy storytellers for free.
/* Buy storytellers */
$('#storytellerBuy').click(function () {
if (evoAmount >= storyteller.Cost) {
evoAmount = evoAmount - storyteller.Cost;
storyteller.Amount++;
updateValues();
}
});
This works but the stays the same. (Which i want to increase by 20% each time)
| 32dba33c4255b84b717bfd173d19710857010572d885281b165cde0a7845ad03 | ['60ea78c5b5894874bc8880a0bcc2e152'] | im trying to figure out how to call something from a json file without using for loops.
% for projekte in liste:
<tr>
<td>${projekte['id']}</td>
<td>${projekte['projektnummer']}</td>
<td>${projekte['bezeichnung']}</td>
<td>${projekte['beschreibung']}</td>
<td>${projekte['bearbeitungszeitraumA']} bis ${projekte['bearbeitungszeitraumB']}</td>
<td>${projekte['budget']}</td>
<td>${projekte['kundenverweis']}</td>
<td>${projekte['mitarbeiterverweis']}</td>
<td>${projekte['aufwand']}</td>
<td>
<ul class="buttons">
<li><a href="edit?key=${projekte['id']}">Bearbeiten</a></li>
<li><a href="delete?key=${projekte['id']}">Löschen</a></li>
% for orga in liste3:
<li><a href="/orga/edit?key=${orga['id']}">${orga['bezeichnung']}</a></li>
% endfor
</ul>
</td>
</tr>
% endfor
orga has id's of the projects. The issue is that i cant figure out how to inluce them without a loop because this one will give me a link for every project i have inside very single entry.
I want it to send me to another form with the projects ID to continue there.
|
e3e40d04de29f74192a9f071f929de7a081250f2be8f6ca2b6afe2f8eccf908d | ['6104f951129d4043997a817b75306583'] | My code:
Box = (function() {
function Box(options) {
this.id = options.id;
$('#box-reload-' + this.id).click(function() {
this.reload();
});
}
Box.prototype.reload = function() {
alert('test');
};
return Box;
})();
b = new Box({'id': '0'})
The click event is correctly registered, but when i click the reload button, i get this error:
TypeError: this.reload is not a function
How can i fix this error?
| 63d39f192c691d866d6bc2f99f0fb576676d9380497852aa7e2dc816929aa6c2 | ['6104f951129d4043997a817b75306583'] | After installing Ruby + Rails on Windows with RailsInstaller, i couldn't install any gems that required to build native extensions. Error:
C:\Users\Admin>gem install rdiscount
Building native extensions. This could take a while...
ERROR: Error installing rdiscount:
ERROR: Failed to build gem native extension.
C:/Rails/Ruby1.9.2/bin/ruby.exe extconf.rb
Gem files will remain installed in C:/Rails/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/r
discount-1.6.8 for inspection.
Results logged to C:/Rails/Ruby1.9.2/lib/ruby/gems/1.9.1/gems/rdiscount-1.6.8/ex
t/gem_make.out
Content of gem_make.out:
C:/Rails/Ruby1.9.2/bin/ruby.exe extconf.rb
I already went through this troubleshooting page, but it didn't fix this error.
It seems that Ruby can't spawn child processes, because when i run extconf.rb manually, it works.
PATH:
C:\Rails\DevKit\bin;C:\Rails\DevKit\mingw\bin;C:\Rails\Git\cmd;C:\Rails\Ruby1.9.2\bin;C:\Program Files\AMD APP\bin\x86;C:\Program Files\NVIDIA Corporation\PhysX\Common;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\nodejs\
I hope someone can help me with this issue.
|
b54c7c03fbea129971b486a2f40e1dcd726c74826d23e4fb58a9dc56b5576ab3 | ['6105d827440643b59806b48cc95873a8'] | the rule is
"//Reference[matches(@literal, \"^\$[^!]+\") and ./preceding-sibling<IP_ADDRESS>Text and ./following-sibling<IP_ADDRESS>Text]"
for your convenient I will provide the project and you can mvn-test it.
the whole project is at https://github.com/XenoAmess/p3c/tree/1605f4d1b9c6a505074be5328953af26f578e190/p3c-pmd
the Rule class is com.alibaba.p3c.pmd.lang.vm.rule.other.UseQuietReferenceNotationRule
I tried to look through your update log, and found nothing related.
Thanks for help.
| 6fd8a3e863c0af485dde81f9e158a737c7f9b10ccd376d128dcc92f40cef8e00 | ['6105d827440643b59806b48cc95873a8'] | Finally I just abandoned jdk 9.
I don't want to figure out which part of jdk 9 have bug or how to let maven put some useless files into jars just for pushing jdk9 to build it, no any more.
Maybe I shall make this decision earlier, thus I can enjoy a good night with some good movies or board games with friends...
Anyway thanks for your help guys...
|
58ea00d73d9716181f90e83c54aa7cc1c63e7ed2526905e449620deeb3ba0964 | ['610c284127524312a78821a2ed5c4634'] | Хочу написать проверку на три одинаковых переменных. При этом если встречается две одинаковые переменные все равно выдает истину. Написал для примера только для одной переменной.
a = 3
b = 2
c = 4
d = 1
e = 3
if (a == (b and c) or (c and d) or (d and e) or (b and d) or (b and e) or (c and e)):
print ('Good!')
else:
print ('Bad!')
| 21ea6b15efa35812ed8b0928b368309e05679c439ebc8c4b9a37bf73fe604acf | ['610c284127524312a78821a2ed5c4634'] | i want to buy a new laptop and my budget allows me to buy one with an i3 processor and 4gb of RAM. i will install win8 on it. what i'll be doing is mostly work with visual studio 2013, doing WPF desktop apps and maybe i'll get into Win8 apps and Windows mobile apps. i would also like to be able to do some android development (i know that the emulator has some requirements). Considering that, should I buy this configuration (is it enough for my needs) or wait and save up some more and buy a laptop with an i5 cpu?
|
55a19b53d86af14a12314c352123683f5a4e75e1a6d3ea0cb40c4c977a8ce82f | ['610cfb9e31574cbc8c0ddd5b8c27e670'] | I know very little about html programing. I am running a Minecraft server with my friends, and I found a neat program that renders out the entire map in a overview style. This application creates a bunch of files, and then to open the map, you open a file called "index.html". All I want to do, is to open this file with Flask, so that I can send out a link, and if you open said link, Flask will return that "index.html" file.
This is my Flask code:
from flask import Flask, redirect, url_for, render_template,request
app = Flask(__name__)
@app.route("/map")
def home():
return render_template("index.html")
if __name__ == "__main__":
app.run(host= '<IP_ADDRESS>', port=9000, debug=False)
and this is index.html:
<!DOCTYPE html>
<html>
<head>
<title>Minecraft Overviewer</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Minecraft-Overviewer 0.16.3 (4c0a69d)" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="static/overviewerConfig.js"></script>
<script type="text/javascript" src="static/overviewer.js"></script>
<script type="text/javascript" src="static/baseMarkers.js"></script>
<link rel="stylesheet" href="static/leaflet.css" />
<script src="static/leaflet.js"></script>
<link rel="stylesheet" href="static/overviewer.css" type="text/css" />
</head>
<!-- Generated at: Thu, 20 Aug 2020 01:33:04 FLE Daylight Time -->
<body onload="overviewer.util.initialize()">
<noscript style="color:white; background-color:black">
If you can see this message, there is likely a problem loading the Overviewer JavaScript components.
Check the JavaScript console for error messages.
</noscript>
<div id="mcmap"></div>
</body>
</html>
Ive tried moving stuff to a "static" folder, while keeping only the "index.html" file in the "templates" folder, while changing the "index.html" file slighly. I added the "static/" part to line 11 and others, and that made it load some parts of the webpage.
Before, it couldnt load any of the "script type" files that it refers to in index.html, but after doing these changes it now loads them.
BUT, now it cant find the image files, and it errors out like this:
compass_upper-left.png:1 GET http://<IP_ADDRESS>:9000/compass_upper-left.png 404 (NOT FOUND)
I think the problem is that its not looking in http://<IP_ADDRESS><PHONE_NUMBER>', port=9000, debug=False)
and this is index.html:
<!DOCTYPE html>
<html>
<head>
<title>Minecraft Overviewer</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Minecraft-Overviewer 0.16.3 (4c0a69d)" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="static/overviewerConfig.js"></script>
<script type="text/javascript" src="static/overviewer.js"></script>
<script type="text/javascript" src="static/baseMarkers.js"></script>
<link rel="stylesheet" href="static/leaflet.css" />
<script src="static/leaflet.js"></script>
<link rel="stylesheet" href="static/overviewer.css" type="text/css" />
</head>
<!-- Generated at: Thu, 20 Aug 2020 01:33:04 FLE Daylight Time -->
<body onload="overviewer.util.initialize()">
<noscript style="color:white; background-color:black">
If you can see this message, there is likely a problem loading the Overviewer JavaScript components.
Check the JavaScript console for error messages.
</noscript>
<div id="mcmap"></div>
</body>
</html>
Ive tried moving stuff to a "static" folder, while keeping only the "index.html" file in the "templates" folder, while changing the "index.html" file slighly. I added the "static/" part to line 11 and others, and that made it load some parts of the webpage.
Before, it couldnt load any of the "script type" files that it refers to in index.html, but after doing these changes it now loads them.
BUT, now it cant find the image files, and it errors out like this:
compass_upper-left.png:1 GET http://92.35.96.72:9000/compass_upper-left.png 404 (NOT FOUND)
I think the problem is that its not looking in http://92.35.96.72:9000/static/compass_upper-left.png, but I have no idea of how to change that. Is there any way to just make it be able to look in ANY folder?
I really need help with this, and ill gladly try to elaborate or give more info if needed.
| 5d6b79fa91da58578d6fad902edf58b88f891c41940336e90e3b6f9a7f7f926a | ['610cfb9e31574cbc8c0ddd5b8c27e670'] | I am learning C# in school, and I am already used to coding in Python.
Trying to take what I have learned in Python and apply it in C# has worked pretty well so far, but I have ran into an issue. I just CANT wrap my head around how lists work in C#
Say I'm working on a simple game, Tic Tac Toe.
In python, I would make a list, with 3 lists inside, and then have THOSE lists contain the playing field, like this:
# First I generate the lists within a list:
screenMatrix = []
for y in range(3):
temp = []
for x in range(3):
temp.append(" ")
screenMatrix.append(temp)
# Then I can just change the board at specific X and Y coordinates
screenMatrix[0][2] = "1" #This is top right
screenMatrix[1][1] = "2" #This is the middle
# And then I could print it out like this:
for row in screenMatrix:
print(f"{screenMatrix[row][0]}{screenMatrix[row][1]}{screenMatrix[row][2]}")
This is a very simple way of doing this, but that is besides the point. How would I write in C# to get this exact same functionality? (being able to change items based on X,Y coords)
If someone could translate the code I wrote into C#, that might help me understand the structure.
|
04012585a235be6f15cb56c4d5605aac269d93e3ac44148c9ed67b17dbe8eec5 | ['611ea73cc44e4ada9c0d18b089a7baab'] | If I have user object and user has one basicinfo. In user show action I have:
def show
@user = User.find params[:id]
authorize @user
end
And in show.html.erb I must show user's basicinfo, such as:
User name is: <%= @user.basicinfo.name %>
In this case should I also authorize basicinfo in user show action?
def show
@user = User.find params[:id]
authorize @user
authorize @user.basicinfo, :show?
end
| eb34312b39b04432838ff6b687d4987035fd6a3204658ae5bcf9b6e342a7624b | ['611ea73cc44e4ada9c0d18b089a7baab'] | I implemented a flash(message) view inside application template, it use application's msg attribute to show site wide message:
<div class='application-main container'>
{{#if msg}}
{{view Yu.FlashView}}
{{/if}}
{{outlet}}
</div>
Part of my router:
Yu.Router.map ->
@resource 'user', { path: '/users/:user_id' }
And user route:
Yu.UserRoute = Em.Route.extend
model: (params) ->
Yu.User.find(params.user_id)
setupController: (controller, model) ->
@_super controller, model
@controllerFor('avatar').set 'model', model.get('avatar')
@controllerFor('basicinfo').set 'model', model.get('basicinfo')
renderTemplate: (controller, model) ->
@_super controller, model
@render 'avatar', into: 'user', outlet: 'avatar'
@render 'basicinfo', into: 'user', outlet: 'basicinfo'
As you can see when enter user route I setup basicinfo controller and put it into outlet.
Here is the question: I "needs" application controller in basicinfo controller but I seems not work:
Yu.BasicinfoController = Em.ObjectController.extend
needs: 'application'.w()
update: ->
@content.save()
@content.on('becameInvalid', ->
window.console.log(Em.inspect(@get('controllers.application'))) !-> prints "undefined"
@get('controllers.application').set 'msg', 'please refresh' !-> msg did not show
)
@set 'inEditModel', false
And I am very confused with needs api, What is wrong here? Thanks!
|
6c1231a05f3ba512114e20aba29effacf09973a3eef7cbeab73dd9ffa2e027b4 | ['612c70c2162f47ee8852cbf4cad1c619'] | I have generated a Nuxt.js and checked the BootstrapVue option in the CLI. When I run npm run build and then npm start, when I check the source code there is a huge junk of <style> code which is for BootstrapVue. How can I put it in a separate CSS file?
| 675e27bc3c07fc76055165899af2e9a65c56d197adfbfdb0d14dac6c03988616 | ['612c70c2162f47ee8852cbf4cad1c619'] | I have a CustomPainter that looks like this:
class MyPainter extends CustomPainter {
Offset left, top, right, bottom;
MyPainter({this.left, this.top, this.right, this.bottom});
@override
void paint(Canvas canvas, Size size) {
Paint pp = Paint()
..color = Colors.blue
..strokeCap = StrokeCap.round
..strokeWidth = 10;
Paint p = Paint()
..color = Colors.red
..style = PaintingStyle.stroke
..strokeWidth = 2;
Path ph = Path();
ph.moveTo(left.dx, left.dy);
ph.quadraticBezierTo(top.dx, top.dy, right.dx, right.dy);
canvas.drawPoints(PointMode.points, [left, top, right, bottom], pp);
canvas.drawPath(ph, p);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return true;
}
}
And this is the result: https://imgur.com/a/m4i6WEA
However I want the curve line, pass the control point. Something like this: https://imgur.com/a/cumbAVz
How can I do that?!
|
78f9fbf9848c9068444dca967aefa66254a6a95f1ab059c41e07e202408d0fa2 | ['61373b94011a476ab32cece8505c7a57'] | I have a pipeline with a copy activity to move data from csv file stored in the Data lake store to Azure SQL database.
The user needs to specify which file to move then execute the copy activity and this to be done from our web application. So to be done programmatically I used the Azure Rest API to update the pipeline through Create or Update pipeline.
The problem that it re-intializes the whole pipeline again which increases time dramatically,is there any way to just change the dataset and re-run the pipeline(without re-intializations) ?
| 4e47eaa381444df49c2bd8b7430e373b8adbc0944e5287459a044a4f758478b4 | ['61373b94011a476ab32cece8505c7a57'] | When trying to call my azure data lake store space and list all directories , It fails to return any results during to missing CORS .The problem that I can't find any way to give the Azure DatalakeStore the CORS policy ( Not the same as Azure Storage )
Any workaround or solution for this ?
|
09da90b9f5ef28cfe9f61bcc3a50ee6a1f2824caf181b413b10bc658e07e3d8e | ['61373d0ad1e44728b212ecf1b6870392'] | She's deaf, and doesn't realize that her 'voice' is excessively loud. She probably screamed a few times just by chance because she couldn't hear herself, and then by understandably rushing to do whatever seemed to make the annoying noise stop, your family has inadvertently taught her "the more and louder I do this, the faster I get what I want!"
In general, punishment doesn't work very well when it comes to training cats, and since she can't hear verbal instructions and reprimand, your only really good option if this is a pure training/behavior issue is to totally ignore her when she's loud, and fuss over and reward her with attention, petting, maybe even treats, when she is quiet or using appropriate volume. Be aware that she might get worse before she gets better, as some cats will just escalate and escalate, ramping up the behavior that 'worked before' for some time before they actually realize that it's not working anymore and trying harder won't help. Once they hit this point of realization things should start to get better.
Since this is a big problem at night and increased after she moved to a new home, it might not just be a behavior thing. She could be experiencing some stress or disorientation and attempting to summon help or reassurance. Nightlights throughout the house and Feliway hormone plugins could help with this, as could an intense and energetic playtime and then a feeding right before bed, to get her on a better sleep cycle where she's more likely to be quiet and grooming or resting when the humans want to sleep.
| 952205fbc47252792457aae7ed70d6b6c2e883f398aa6a2dfaf874798478bf2f | ['61373d0ad1e44728b212ecf1b6870392'] | Your best simple bet is to ask your uncle what the cat was eating before it was given to you and buy some of that. Many cats have a hard time with change, and the change to a new home and new food at the same time is likely too much for her to process all at once. Besides, changing foods or feeding schedule suddenly can cause stomach upset in some cats.
Try returning to whatever food she was eating before, and then once she's been eating normally a while, gradually transition to the food you want her to eat long term, by replacing a little more of the old brand of food with the new brand each day. You should do this slowly over several days, or even several weeks if the cat is very sensitive.
If going back to her original food brand doesn't do the trick right away, you should have her checked by the vet; cats can go only a short time without eating before they get very ill.
|
95e08d4a8640a358a14db75e8722c0f22ea2429deae0ea9fa22e625fbbe7007e | ['6149ee6a28084e5a9cd49904f662c03c'] | I successfully installed the "actionssdk-smart-home-nodejs" and it works well if i launch it using the command "node index.js" within the folder "...actionssdk-smart-home-nodejs\smart-home-provider".
I need now to debug some part of the code, thus i tried to debug it using VS Code as editor and with the launch.json configured like
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${file}"
}
]
}
When i launch the debugger all seems to start fine, but when i use the Google Chrome browser to access the main page (http://localhost:3000/) i get as response only "Cannot GET /".
It seems like the static route defined in the file "smart-home-provider-cloud.js" app.use('/', express.static('./frontend'));
isn't matched.
So i can't figure out why launching without debugging all works fine and if a start the debugger express returns only "Cannot GET /".
I would be grateful for any help or clue for further investigation !
| 785b9048dace6dd8882a42a7f2f76ff1b359e984406a83052e9d529ad80f7edc | ['6149ee6a28084e5a9cd49904f662c03c'] | After long digging i found my issue. The config file for debugging was missing a config line.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"program": "${file}",
"cwd":"${workspaceRoot}/smart-home-provi
}
]
}
|
0980b6a86d769c7171c661e28718c28737f8fc040087d99fed4031d9f03c02bb | ['6156617b0797422bade4c7f74c1dca42'] | Can someone tell me what is the use of last 'Y' in the " end = 'Y') "
( case
when a = 'STAGE PAYMENT' then
'Y'
when b not IN ('To be Received', 'Received') then
'N'
when c != (d - NVL(e, 0) - NVL(f, 0) - NVL(g, 0)) then
'Y'
when NVL(h, 0) + NVL(i, 0) + NVL(j, 0) <> 0 then
case
when c != k then
'Y'
when (-l != NVL(e, 0) + NVL(f, 0) + NVL(g, 0) + NVL(m, 0)) then
'Y'
else 'N'
end
else 'N'
end = 'Y')
Also, is there any way of optimizing this?
Thanks!
| 90845f2feb47c9fd7dc62441616195f22f40d0c4be8af0626bafe9b270c381e1 | ['6156617b0797422bade4c7f74c1dca42'] | I am quite new to PL/SQL.
I am using the following nested CASE statement in a SELECT query. This follows the WHERE clause.
However, the query takes about 6 minutes to complete because of this nesting. If at least one CASE block is removed the query only takes about 1 minute to complete.
Is there any way to optimize this query?
(case
when a = 'STAGE PAYMENT' then
'Y'
when b not IN ('To be Received', 'Received') then
'N'
when c != (d - NVL(e, 0) - NVL(f, 0) - NVL(g, 0)) then
'Y'
when NVL(h, 0) + NVL(i, 0) + NVL(j, 0) <> 0 then
case
when c != k then
'Y'
when (-l != NVL(e, 0) + NVL(f, 0) + NVL(g, 0) + NVL(m, 0)) then
'Y'
else 'N'
end
else 'N'
end = 'Y')
I have tried using IF-ELSE blocks, but it did not do any good.
|
e81904d3c5c5ddd419fe0de82ac4f16b1c65412c6690e047641479a9a2be3833 | ['6156f616e3dc4e3f89f88abc6f613461'] | I'm trying to create a tooltip inside a scrollable div-element:
.tooltip {
display: none;
position: absolute;
background-color: #000;
color: #fff;
}
.parent:hover .tooltip {
display: block
}
#list {
height: 40px;
overflow: auto;
width: 80px
}
<div id="list">
<div class="parent">
Element1<span class="tooltip">Tip1</span>
</div>
<div class="parent">
Element2<span class="tooltip">Tip2</span>
</div>
<div class="parent">
Element3<span class="tooltip">Tip3</span>
</div>
<div class="parent">
Element4<span class="tooltip">Tip4</span>
</div>
</div>
The tooltip becomes visible when hovering over the parent but if I scroll down the list, the tooltip does not scroll up with the associated parent.
If I change the style of tooltip to position: relative, they follow their parents but they displace the other parents.
How can I make my tooltip scrollable, while still making it appear above its surrounding?
| 91f530fdb933e95e424680c74410ff8ce0835fd49b8e88d210b18be578df2ab1 | ['6156f616e3dc4e3f89f88abc6f613461'] | I'm not quite sure what parameter it is, that you want to be expandable, so I recreated your code with two parameters N=2 is the number of vectors you want in the end, M=4 is the size of the chunks you want copied together:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define N 2 // split in N=2 arrays
#define M 4 // always copy M=4 items together
int main()
{
int array[16] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
int *parts[N];
for (int i=0;i<N;i++)
{
parts[i] = malloc(16 * sizeof(int) / N);
}
for (int i=0;i<16/N/M;i++)
{
for (int j=0;j<N;j++)
{
memcpy(parts[j]+i*M, array + i*M*N + j*M, M * sizeof(int));
}
}
for (int i=0;i<8;i++)
{
printf("First %d\n",parts[0][i]);
} for (int i=0;i<8;i++)
{
printf("Second %d\n",parts[1][i]);
}
}
You should definitely change M, N to meaningful names and insert names for M*N etc. accordingly to the context and pay extra attention if your numbers aren't divisible as in this example.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.