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 |
|---|---|---|---|---|---|
15416ba4a65d66ed1ea7cb43084c1e84dffeda1d233684f54e41444dc564df86 | ['83ee372052bd418c9bed1e6ae81169c8'] | When I did it using an online tutorial, it kept telling me that there was an error with quotations, but after editing, I still don't see the problem. CAn you please help?
import csv
with open("CSV_birthdays.txt") as csv_file:
csv_converter = csv.reader(csv_file, delimiter=',') # This suggests that commas seperate classes
linenum = 0
for row in csv_converter:
if linenum == 0:
print("There are 4 family members I have dealt with so far")
linenum +=1 # go to the next line
else: # for the actual columns printing out my sentences
print(f"\t{row[0]} is {row[1]} years old, and they were born on the {row[2]}th) of {row[3]}{row[4]}.")
linenum += 1 # print the next line
print(f"I have the birthdays of {linenum} people")
This is the csv file I'm referring to
name, age, birthday ,birthday month, birth year
me, 15, 17, March, 2005
my sister, 13 , 1 , 8, 3006
<PERSON>, 10, 22, 11, 2009
<PERSON>, 15, 7, 6, 2004
| 5740d945a011a7da9fed87dce6b6b12d1b1574995228a03c29d914cffdd06eff | ['83ee372052bd418c9bed1e6ae81169c8'] | I have written a program which will determine if a password is strong(has 10+ letters, 1+ capital letters and numbers) and if not, it will ask for a stronger password. To do this, I have chosen to use boolean but IDLE says that there is incorrect syntax and highlights my boolean names. Is the issue with the name or is there something else that I should correct/
def length(long):
while len(long) < 10:
print("Please make your password longer, up to at least 10 characters.")
print("Your password is only " + str(len(long)) + " characters long")
print("Welcome to this student interface")
username = input("Please enter a username")
password = input("Please enter a strong password")
length(password)
bool Capcheck = False
bool DigCheck = False
serrors = []
while CapCheck = False or CapCheck = False:
length(password)
if not any(x.isupper() for x in password):
serrors.append("Your password needs at least 1 capital.")
else:
CapCheck = True
break
if not any(x.islower() for x in password):
serrors.append("......... Why?")
if not any(x.isdigit() for x in password):
serrors.append("You need to have at least 1 digit")
else:
DigCheck = True
break
if serrors:
print(" ".join(serrors))
password = input("Please enter a stronger password")
|
9d096521bbd3d3d0231b247103bcf819dc4a2eab4af45703a3bbd214cc7ac254 | ['83f2bf2aff574647ac95e849e5f2a113'] | I am trying to use formsets in Django but encounter a problem I don't understand. The error I get is
[{'id': ['This field is required.']}, {}]
Here is the background: In models.py I have
class Ledighet(models.Model):
person = models.ForeignKey(Personal,on_delete=models.CASCADE)
start_date = models.DateField()
end_date = models.DateField()
In forms.py I have the single line
LedighetFormset = inlineformset_factory(Personal,Ledighet,fields = ('start_date', 'end_date'),extra=1)
In views.py I have
def rapportera_ledighet(request,person_id):
person = get_object_or_404(Personal,id = person_id)
if request.method == 'POST':
formset = LedighetFormset(request.POST,instance=person)
if formset.is_valid():
formset.save()
formset = LedighetFormset(instance=person)
context={'person' : person, 'formset' : formset}
return render(request, 'schema/rapportera_ledighet.html', context)
and the key code in the html-file is
<form method="post">{% csrf_token %}
{{ formset.management_form }}
<table class="table table-striped">
{% for f in formset %}
<tr><td>{{ f.start_date }}</td><td>{{ f.end_date}}</td><td>{{ f.fraction }}</td><td>{{ f.typ }}</td></tr>
{% endfor %}
</table>
<input type="submit" value="Updatera" />
</form>
The form looks the way I want it to be, but I get the error above.
What am I doing wrong?
| 7e200191dc0c15941a30946fac2cfd93eb8091fd47408456f23aba8ece393a7f | ['83f2bf2aff574647ac95e849e5f2a113'] | In a django-project I have the following line:
person_lista = Personal.objects.annotate(tjgtid=Sum('personyear__tjgtim'))
When the class PersonYear contained the variable
tjgtim = models.FloatField(default=0)
this worked fine. But now I have changed it so that it is a function:
def tjgtim:
return .....
and now it does not work. Why is that? What should I do differently?
Thanks in advance,
-anders
|
62131a7d40b276f1836efc4a0fe8390586b760c80775a81c5d1de06d054442c0 | ['84014c13d8e740568c7d66e259e38504'] | class Complex(object):
def __init__(self, real, imaginary):
self.real=real
self.imaginary=imaginary
def __add__(self, no):
self.real=self.real+no.real
self.imaginary=self.imaginary+no.imaginary
def __str__(self):
if self.imaginary == 0:
result = "%.2f+0.00i" % (self.real)
else:
result = "%.2f+%.2fi" % (self.real, self.imaginary)
I want to print the sum of two complex numbers inside add function in the format defined in str method without manipulating the str function.
Meaning how can I access the result variable defined in the str method from the add method.
| c25beb9f1b89906fa81dfa116f708d9575fe0c82a7e25ab90d4de44b74c7fceb | ['84014c13d8e740568c7d66e259e38504'] | I have written the following docker-compose file to create 3 containers. Bugzilla container exits with code 0 after creation. Could you suggest what am I missing. It's not even showing any error, is there any way I look into exited containers log?
version: "3.2"
services:
bugzilla:
build: './bugzilla/'
container_name: bugzilla
networks:
- bugzilla-network
volumes:
- ./bugzilla/:/var/www/html/
depends_on:
- mysql
restart: on-failure
apache:
build: './apache/'
container_name: bugzilla-apache
depends_on:
- bugzilla
- mysql
networks:
- bugzilla-network
ports:
- "8080:80"
volumes:
- ./apache/:/var/www/html/
restart: unless-stopped
mysql:
container_name: bugzilla-mysql
env_file:
- ./mysql/mysql.env
networks:
- bugzilla-network
image: mysql
command: --default-authentication-plugin=mysql_native_password
restart: unless-stopped
networks:
bugzilla-network:
driver: bridge
Here's my bugzilla Dockerfile.
FROM ubuntu:18.04
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -q -y supervisor gcc \
apache2 mysql-client\
libapache2-mod-perl2 libmysqlclient-dev libmath-random-isaac-perl \
liblist-moreutils-perl libencode-detect-perl libdatetime-perl \
msmtp msmtp-mta libnet-ssleay-perl libcrypt-ssleay-perl \
libappconfig-perl libdate-calc-perl libtemplate-perl build-essential \
libdatetime-timezone-perl libdatetime-perl libemail-sender-perl libemail-mime-perl \
libemail-mime-modifier-perl libdbi-perl libdbd-mysql-perl libcgi-pm-perl \
libmath-random-isaac-perl libmath-random-isaac-xs-perl \
libapache2-mod-perl2 libapache2-mod-perl2-dev libchart-perl libxml-perl \
libxml-twig-perl perlmagick libgd-graph-perl libtemplate-plugin-gd-perl \
libsoap-lite-perl libhtml-scrubber-perl libjson-rpc-perl libdaemon-generic-perl \
libtheschwartz-perl libtest-taint-perl libauthen-radius-perl libfile-slurp-perl \
libencode-detect-perl libmodule-build-perl libnet-ldap-perl libauthen-sasl-perl \
libfile-mimeinfo-perl libhtml-formattext-withlinks-perl \
libgd-dev graphviz python-sphinx patch && \
rm -rf /var/lib/apt/lists/*
RUN cd /var/www/html && mkdir bugzilla
COPY . /var/www/html/bugzilla
WORKDIR /var/www/html/bugzilla
CMD perl ./checksetup.pl
ENTRYPOINT perl ./testserver.pl http://localhost/bugzilla
|
20c733f66343d03fb861da6c156837702891a98cdec328adbe60f039d8295303 | ['8422fdf13d954e56a58ff01859b4523c'] | This article describes how to improve startup time for WCF client applications by pre-generating serialization code for assemblies by the use of svcutil.exe (or sgen.exe). However, it only mentions improving performance for serialization/deserialization using XmlSerializer.
The default serializer for WCF is DataContractSerializer, and my question is: for a WCF client talking only to WCF services, is there any advantage of generating the *.XmlSerializers.dll assemblies? The only source of information I could find regarding this specific question, was this thread on MSDN. The answer given may suggest that generating XmlSerializers only affects serialization by XmlSerializer, but it doesn't say clearly.
| 4e1a64ce3f3354e3e965f7f0383014b8f46f1b4be32c7e4af2a644b4d83daff6 | ['8422fdf13d954e56a58ff01859b4523c'] | When using Moq with Verify, to assert that a certain method has been called with specified parameters, different kind of syntax is possible; one is the "It" syntax, like this
mock.Verify(c => c.SomeMethod(It.Is<string>(s => s == ExpectedString)));
What happens here is that the parameter that SomeMethod is called with, is checked for equality with ExpectedString. Another possible syntax is without "It":
mock.Verify(c => c.SomeMethod(ExpectedString));
which should give the same result. From what I have been able to find on different forums, the difference is that the latter is an identify check (reference equals) (except for value types).
However, my question is when the parameter is of a type Collection type. In .NET, Equals on Collection<T> is just inherited from object, so the following verify:
mock.Verify(c => c.SomeMethod(new Collection<string> { ExpectedString }));
should not be possible to pass, given that the collection is instantiated in the verify, and thus cannot possibly be the same instance that is instantiated in the production code. Nevertheless, it works, which indicates that Moq does a CollectionAssert or something like that, contrary to what information I could find.
Here is a code example that illustrates the behaviour, the test passes, but I think it should fail if Moq had used reference equals comparison.
[TestMethod]
public void Test()
{
var mock = new Mock<IPrint>();
const int ExpectedParam = 1;
var test = new TestPrinter { Printer = mock.Object, Expected = ExpectedParam };
test.Do();
mock.Verify(c => c.Print(new Collection<int> { ExpectedParam }));
}
public interface IPrint
{
void Print(Collection<int> numbers);
}
public class TestPrinter
{
public IPrint Printer { get; set; }
public int Expected { get; set; }
public void Do()
{
Printer.Print(new Collection<int> { Expected });
}
}
Does anyone know if this is expected behaviour of Moq (version 4.1)? Was the behaviour changed at some version level?
|
61b6aac012f3b00a1723f95d293af5b20c3595a6722fd83afaaeaa50d8b56575 | ['842899048dbd443aa8f246b2ba42d0be'] | I'm trying to create a new profile for snakemake to easy run workflows on our cluster system. I followed the examples available in the Snakemake-Profiles repo, and have the following directory structure:
project/
- my_cluster/
-- config.yaml
-- cluster-submit.py
-- jobscript.sh
- Snakefile
- (other files)
Thus, the my_cluster directory contains the cluster profile. Excerpt of config.yaml:
cluster: "cluster-submit.py {dependencies}"
jobscript: "jobscript.sh"
jobs: 1000
immediate-submit: true
notemp: true
If I try to run my workflow as follows:
snakemake --profile my_cluster target
I get the following error: sh: command not found: cluster-submit.py, for each rule snakemake tries to submit. Which may not be super surprising considering the cluster-submit.py script lives in a different directory. I'd have thought that snakemake would handle the paths when using profiles. So am I forgetting something? Did I misconfigure something? The cluster-submit.py file has executable permissions and when using absolute paths in my config.yaml this works fine.
| 5edbe1bd4872c7f7fdecad4a62ba19e361cfffbc9334fc2c5b615ec9f1b739e6 | ['842899048dbd443aa8f246b2ba42d0be'] | I'm trying to display some data from the database in a table with the possibility to edit the data, using Qt (more specific, PyQT). A QSqlTableModel can be used for this. But with a QSqlTableModel is is not possible to easily reorder the columns, or maybe exclude a column.
I know it is possible to move columns using QSqlTableModel.horizontalHeader.moveSection but this function depends on the index of the columns, and that is not really convenient, especially if I want to add another column in the future.
What is the easiest way to accomplish this? Thanks in advance.
|
22242681bf6e8b40c21d7dfd3e21d0fda148f898b6a83632c72d4b36f17a04b1 | ['842afb5d7e1a4f5394805b78390bf48a'] | The answer is most likely one of two possibilities:
They don't feel that the investment of preparing and producing the DVD will be justified by its sales
The copyright of various elements of the movie is ambiguous or widely distributed, and resolving that situation legally is cost prohibitive, if it's even completely possible
For the first one, regardless of what it costs to produce the DVD, if they project that only a few hundred or a few thousand people will ever buy it, they may not feel too rushed to get the job done for what amounts to a few thousand bucks to the bottom line. Doesn't mean it will never happen, but that no one has strong incentive to make it happen.
For the second, copyright can be a complicated beast, and any number of people involved in the original project could own copyright interest in the final product (depending on how the contracts were set up originally). That is further complicated by people who have sold their interest or who have died and left it to potentially numerous beneficiaries, the details of which are difficult and expensive and, potentially, intractable to work out. This matters because a work is licensed to be released only in certain media, when a new medium arrives (such as DVD), it needs to be re-licensed for the new medium. If a particular movie suffers from this problem, it's unlikely to ever be released in its original form, what they'll do is identify the portions of the work for which they can't identify or secure the appropriate rights, and somehow remove or replace them. You'll see this most often in TV shows that were current prior to the advent of DVD, where the popular music played as a soundtrack couldn't be licensed, or not at a reasonable cost, and so is replaced by a royalty-free soundtrack instead.
If I had to guess for the particular situation you bring up, the first situation is probably the primary influence behind whether it happens or not.
| d25c6977aec177e23c41d89d69347cb5c9e7fb1b1631e3a0864558152a6777b3 | ['842afb5d7e1a4f5394805b78390bf48a'] | Yes the ring will move toward (be attracted to) the field when the flux drops, but the ring will tend to repel more than attract overall (the explanation is complex, however). See http://www.youtube.com/watch?v=dw73DcwIX-A for a similar example: you get more repulsion on average. |
7841f0e0a331d70373c09938ac3419c3f8961e1de4c2f5ecf83e3a3fb0902f19 | ['842dcc3e3e1b4218bea69ed01d9cdc34'] | I have read and tried most of the blogs and tutorials regarding implementation of stripe in laravel 5.2 but none of them work out or none of them had proper explanation. Can somebody please provide me some simple to understand tutorial link. or can guide in simple language.
I'm new to laravel
| 03f01df0a3f8ac70d2ad4e4430f89d5694a11849308ccf5136eed87f13e38287 | ['842dcc3e3e1b4218bea69ed01d9cdc34'] | Basically what I'm trying to do is to create a array in a session so that a guest user in my e-commerce website can have its own wishlist and I can gradually push data selected by the guest.
below is the code I have written for that :-
if(Session<IP_ADDRESS>has('guest.id')) {
Session<IP_ADDRESS>push('guest.tname', $tname);
Session<IP_ADDRESS>push('guest.pid', $pid);
}
else {
Session<IP_ADDRESS>set('guest.id',$guest_id);
Session<IP_ADDRESS>set('guest.tname', $tname);
Session<IP_ADDRESS>set('guest.pid', $pid);
}
But the above code is consistently giving me this error :-
FatalThrowableError in Store.php line 411: [] operator not supported for strings
|
bd09175d69e43b67f740af943957284e7de15e61de72a67fd5dd88d1e97a5e92 | ['8438b89fa70f442880416bb60f06e864'] | Try this, string the index and then use the join function to join the list into a string.
def PatternMatching(Genome, Pattern):
index = []
for i in range(len(Genome)-len(Pattern)+1):
if Genome[i:i+len(Pattern)]==Pattern:
index.append(str(i))
return " ".join(index)
Genome = "GATATATGCATATACTT"
Pattern = "ATAT"
print(PatternMatching(Genome, Pattern))
| 4a3afb0009ffabb00f398d60f734bca3a4989507cd5ea4d22ebecb7ed4d56d48 | ['8438b89fa70f442880416bb60f06e864'] | You have a number of problems in your code but to fix your current error you need to index the array with integers as said in the error and not a char, you could do int(char) and then return the result.
def expression(r, possition , char):
return 1-r[possition, int(char)]
|
fe673ea47a3e9b3b67a7042765fce89add705ff3fa1c95f409211621f5019219 | ['843e599c56d042a89ba5ec43524ebf8a'] | I am using following query to query DB which have order by on two columns.
SELECT a,b,c from Table1 Order By a asc, b asc;
My question is, Is the sorting guaranteed to be stable (by Standards) or not. Though it doesn't make any sense for it to be, not be stable, But i ask this because I read on net that
The standard does not prevent the use of a stable sort, but it also
does not require it.
| 845761571a63e2f8c05af271d01ed58811770970b17485ac690dbeb3225a08c0 | ['843e599c56d042a89ba5ec43524ebf8a'] | I am getting TRUST_E_NO_SIGNER_CERT from WinVerifyTrustEx. error code is "0x80096002" and message is "The certificate for the signer of the message is invalid or not found."
I checked that certificate is fine and it is trusted. Exporting and opening up signing certificate I can see that Certificate is okay. Can somebody help me understand what can cause WinVerifyTrustEx to return TRUST_E_NO_SIGNER_CERT?
WINTRUST_FILE_INFO fileInfo;
ZeroMemory(&fileInfo, sizeof(fileInfo));
fileInfo.cbStruct = sizeof(fileInfo);
fileInfo.pcwszFilePath = filePath;
CERT_STRONG_SIGN_PARA strongSignParam;
ZeroMemory(&strongSignParam, sizeof(strongSignParam));
strongSignParam.cbSize = sizeof(strongSignParam);
strongSignParam.dwInfoChoice = CERT_STRONG_SIGN_OID_INFO_CHOICE;
strongSignParam.pszOID = szOID_CERT_STRONG_SIGN_OS_1;
WINTRUST_SIGNATURE_SETTINGS signatureSettings;
ZeroMemory(&signatureSettings, sizeof(signatureSettings));
signatureSettings.cbStruct = sizeof(signatureSettings);
signatureSettings.pCryptoPolicy = &strongSignParam;
WINTRUST_DATA_WIN8 wintrustData;
ZeroMemory(&wintrustData, sizeof(wintrustData));
wintrustData.cbStruct = sizeof(wintrustData);
wintrustData.pSignatureSettings = &signatureSettings;
wintrustData.dwUIChoice = WTD_UI_NONE;
wintrustData.fdwRevocationChecks = WTD_REVOKE_WHOLECHAIN;
wintrustData.dwUnionChoice = WTD_CHOICE_FILE;
wintrustData.pFile = &fileInfo;
wintrustData.dwStateAction = WTD_STATEACTION_VERIFY;
wintrustData.dwProvFlags = WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT;
GUID guidGenericVerifyV2 = WINTRUST_ACTION_GENERIC_VERIFY_V2;
HRESULT hr = WinVerifyTrustEx(static_cast<HWND>(INVALID_HANDLE_VALUE), &guidGenericVerifyV2, &wintrustData);
|
b7d739bd569ceaca805ab82f6b625a94b883b6fa3e931cc76f16834a8ab7a1f3 | ['8448d8bf6c104fc6b86884a6d83c90cd'] | I've managed to solve this situation and here is the solution if anyone is interested. Here are the steps to make this happen:
Prepare a request model
import Foundation
import PassKit
struct StripeTokenRequest: Encodable {
let pkToken: String
let card: Card
let pkTokenInstrumentName: String?
let pkTokenPaymentNetwork: String?
let pkTokenTransactionId: String?
init?(payment: PKPayment) {
guard let paymentString = String(data: payment.token.paymentData, encoding: .utf8) else { return nil }
pkToken = paymentString
card = .init(contact: payment.billingContact)
pkTokenInstrumentName = payment.token.paymentMethod.displayName
pkTokenPaymentNetwork = payment.token.paymentMethod.network.map { $0.rawValue }
pkTokenTransactionId = payment.token.transactionIdentifier
}
}
extension StripeTokenRequest {
struct Card: Encodable {
let name: String?
let addressLine1: String?
let addressCity: String?
let addressState: String?
let addressZip: String?
let addressCountry: String?
init(contact: PKContact?) {
name = contact?.name.map { PersonNameComponentsFormatter.localizedString(from: $0, style: .default, options: []) }
addressLine1 = contact?.postalAddress?.street
addressCity = contact?.postalAddress?.city
addressState = contact?.postalAddress?.state
addressZip = contact?.postalAddress?.postalCode
addressCountry = contact?.postalAddress?.isoCountryCode.uppercased()
}
}
}
Use JSONEncoder and set keyEncodingStrategy to .convertToSnakeCase.
Create a POST request against https://api.stripe.com/v1/tokens endpoint where you need to url encode parameters. If you are using Alamofire, you need to set encoding to URLEncoding.default.
Parse response. I use JSONDecoder with the following model:
import Foundation
struct StripeTokenResponse: Decodable {
let id: String
}
Create a payment
StripeTokenResponse.id is the thing you need to pass to the backend where the payment will be processed. This is the same step as you'll do when using the SDK.
| 5b35fbd630562c868341f98b47b44b104eeb09b2749d77176899d4a887a72015 | ['8448d8bf6c104fc6b86884a6d83c90cd'] | I've made a NSString category for hashing:
- (NSString *)MD5 {
// Create pointer to the string as UTF8
const char *ptr = [self UTF8String];
// Create byte array of unsigned chars
unsigned char md5Buffer[CC_MD5_DIGEST_LENGTH];
// Create 16 byte MD5 hash value, store in buffer
CC_MD5(ptr, strlen(ptr), md5Buffer);
// Convert MD5 value in the buffer to NSString of hex values
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
[output appendFormat:@"%02x",md5Buffer[i]];
}
return output;
}
I dont know why would you like to add two hashes together but this might help you.
|
24e71d0fcdec2797e58ad3d1079906c76c7a431505299ad00cfd7fb628852f74 | ['844f99466f3b42f4907ce0202786c8b3'] | From my experience, Disk I/O is the bane of any sane user experience under Linux.
Things that make it worse:
Using a laptop(2.5") disk, especially a 5k rpm disk
Using wubi or LVM/Encryption.
This is because normally, reads/writes to disk are quite optimized to your hardware,
but having that enabled creates a layer of indirection that mess this up.
Reasons for the slowdown:
Most things on your linux-system need to touch disk quite often, they write logs, cache-files and sometimes they synchronize things through the file-system.
When the disk is busy, everything grinds to a halt, waiting for their check on the cache-file etc will complete. This is especially noticeable with gui-applications.
So, in general. Anything you can do to avoid touching disk is good.
You can change your firefox cache-directory to /run/shm
This is a ram-disk. It is very fast, but anything you store there will
eat your ram
be gone after a reboot.
Tutorials for this can be done by using google.
| 77d1712f284c3ed5f296880ec3ee3d71cee500af6b0e45c1274be0349c3a8df2 | ['844f99466f3b42f4907ce0202786c8b3'] | When using my Pi on a regular TV or computer monitor via HDMI, everything performs as expected. When I connected it to a Cisco Spark board via HDMI, I anticipated no change. However after the initial boot instead of the desktop (or specifically a program that is supposed to run after boot), I get a command line (and a kind of oddish looking one, things aren't exactly where they should be, but it's 99% correct looking).
I was able to eventually get it to boot to the desktop by changing the GL option to full in raspi-config, however it's as if it's a secondary desktop. My program that runs full screen at boot isn't visible, and if I try and start it, I get an error that it's already running.
Any idea?
|
cb1d7b36334242b5d713dd9467772e7107ac677ada2c75cb4b0aad169b45abb9 | ['84575fb8c2894ab0b2c63b0c31ccc12e'] | Have a look at this while facing some error I came across this article.
I'm sharing this hoping it will be helpful for others also.
http://www.tsheffler.com/blog/?p=428
Also refer this:
http://www.ciiycode.com/0JiNiqePUejg/origin-httplocalhost-is-not-allowed-by-accesscontrolalloworigin-rails-3
| f49549f2d49f12b0b480b2517d0652b2347b4acc326d60bf612a6557afc7a13e | ['84575fb8c2894ab0b2c63b0c31ccc12e'] | You could also try this code:
Create a service.
app.service("angularService", function ($http) {
this.AddValues= function (showValues) {
var response = $http({
method: "post",
url: "api/values/YourmethodName",
data: showValues
});
return response;
}
});
In your controller: Inject your Service here in this way to implement its method/service
app.controller('WorkingCtrl', ['$scope','angularService',function ($scope, angularService) {
$scope.submitForm = function () {
$scope.form = {};
$scope.form.userid = "some_id";
$scope.form.username = "username";
$scope.form.fname = "some_name";
$scope.form.lname = "some_surname";
$scope.form.iurl = "url_here";
$scope.form.type = "some_type";
$scope.showValues = JSON.stringify($scope.form);
angularService.AddValues(showValues ).then(function (result) {
}
}]);
|
59fa24181f342ad78f908b14a3fbb8e506b20419af5ce51b8ce8646a60052b23 | ['845a66742d774e568f8314c6f6d7931d'] | Absolutely positioning might be a good way to go, since all those elements are the same height (buttons, and the line of text after the buttons). Just add a container div around those elements.
wrapper {
postition: relative;
padding-bottom: 150px;
}
container {
position:absolute;
bottom: 40px;
}
The other option would be just setting a min-height on the paragraph tag before the button, so the elements above the button are all the same height.
| cdc780b7f2261f130e4283c57f568fb295edda65f22f87de01bf44f4f4df9371 | ['845a66742d774e568f8314c6f6d7931d'] | Yeah, as I web designer who has had to work with asp.net in the past I completely feel your pain. It's not easy to get a modern look mostly because asp.net isn't a modern tool and kind of has a visual vocabulary all its own.
That said, I found I could get decent results by sticking as close to CSS based solutions as I possibly could. You can see some of those results in the following links:
http://www.design-experiments.com/
http://www.troyjnorris.com/shoppingcart/
I found that a minimalist approach tends to come with the best results.
A good process to follow:
- Build what you want to build.
- Add container divs to make selecting elements easier around your controls. This will greatly improve your ability to position elements the way you want.
- Use your browser inspector to figure out the auto generated element names as they appear on the screen. Getting good selectors is half the battle in CSS.
- Rip out the styling you don't like. Standard reset style sheets won't do here. You'll have to build your own to zero everything out on the elements you want to style so you're not fighting the out of the box look of the controls. Again you have to rely heavly on your inspector in a web browser to see what styles everything is inheriting.
- Use google fonts to define visual style of the page.
- Stick to mostly black or white backgrounds.
- Bootstrap is helpful for a responsive grid, but won't do much good attempting to style most of the elements on a page as they're not meant for that.
- As you might have noticed in the examples above the visual interest comes from elements that are unrelated to the asp.net structure and limitations. So have something like that, even a background image or some paralax so it feels like something is going on on the page.
Hope that helps.
|
71c315d32d0064bb36054c0f7a0c69480c995534365858f6bbd19a7ac2cb3f97 | ['8467002a250444ed8202133eb8182593'] | I am trying to run a project with objective C and with a private SDK
and I get the error
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_DetectionSDK", referenced from:
objc-class-ref in ViewController.o
objc-class-ref in AppDelegate.o
objc-class-ref in SecondViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Is weird (for me) because in the real iphone runs (and in xcode 11), but in the simulator does not
| 62932681ac66a730aed780becc1403884b29b59e1aabfcad15098b47667f639f | ['8467002a250444ed8202133eb8182593'] | I have a simple login (username and password) and I set data in NSUserDefaults for the next login time with touchID the user can access fastly, and the way is, verify the touchID and make a login with data from NSUserDefaults, so I need to encrypt the password... save the password encrypted and when the touchID would be correct decrypt the password and make the login
|
6db4669de5a2668c14f328cd7a50ca5696193c241295a952281b6ca000e35441 | ['846d100cf59f440d99ea787c421cecf5'] | @ChrisH You'd think that, right? But in several recipes I've done in the past that use melted chocolate, you cool it to room temperature - and it is still a paste like consistency, not solid. That said, adding it to the cool (well, room temperature, you don't make cheesecake with cold ingredients) ingredients *before* adding the eggs makes sense. | d0551e39aee98150ee8bc1445cf66d10c576300d6f80529354aad1fb2007a534 | ['846d100cf59f440d99ea787c421cecf5'] | I'm trying to add OCMock to my iOS 4 project. To test it out, I have a class Person with one method, -hello. When I run this test:
- (void) testMock {
id mock = [OCMockObject mockForClass:[Person class]];
[[mock expect] hello];
[mock hello];
[mock verify];
}
Everything is fine, and the build succeeds. If I take away the hello call, like this:
- (void) testMock {
id mock = [OCMockObject mockForClass:[Person class]];
[[mock expect] hello];
[mock verify];
}
I'd expect to get an error message telling me that my expected method wasn't called on the mock. Instead I get a cryptic message about the test rig crashing:
/Developer/Tools/RunPlatformUnitTests.include:451:0 Test rig '/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/Developer/usr/bin/otest' exited abnormally with code 134 (it may have crashed).
Is this crash normal when an expected method isn't called? Do I have a bad configuration?
|
b1b19c3b0b31f7f12357bce4f001453585eb812decfffd62c13f1d4a5f9573fa | ['84771b79852a42a2bdfc96fd3522e9b8'] | Well if $(\nabla \times)$ is one operator, how is _it_ defined? I understand that if $\textbf F = P\textbf i + Q\textbf j + R\textbf k$ then $\text{curl}\textbf F = (\frac{\partial R}{\partial y} - \frac{\partial Q}{\partial z})\mathbb i + (\frac{\partial P}{\partial z} - \frac{\partial R}{\partial x})\mathbb j + (\frac{\partial Q}{\partial x} - \frac{\partial P}{\partial x})\mathbb k$, but doesn't that come _from_ the $\nabla \times \textbf F$ definition? | e138cc0c038c95efe2db831c3ca3fb6c44753e68f3b84ffbab845f2acc4d694a | ['84771b79852a42a2bdfc96fd3522e9b8'] | Thank you for this wonderful answer, but <PERSON>'s comment seemed to help my confusion more, however this answer explains abuse of notation for $\nabla$ by using [abusive of notation](https://en.wikipedia.org/wiki/Abuse_of_notation#Cross_product) for the determinant. I'll accept it as a warning that not everything in the textbook is formally correct. And, you're right; it's easier to remember than the formal definition. |
1531d6db4de9f4d42c5c5d5c35e9966ccd2b8fb2b409a3db9351cea217ce4796 | ['84925c0069c640e38a621067c893d775'] | So I want to integrate html index.html, webflow.js, jpgs and some css files that are organised into folders js, css and images. So how to put everything into .NET Core MVC project so it has all the animations and css for html index.html? I use .NET because there should be some logic afterwards with some models etc.
| 529f21bba07cdc031420e1588acaf3fbccdba850b20e85d55125d4c1f30a72fb | ['84925c0069c640e38a621067c893d775'] | I'm creating an Android app and in MainActivity class I've come to a problem with implementation of a part of algorithm. My problem is how to make xml file id visible in MainActivity with navigation bar layout being the xml layout file added in method "setContentView()" because the app is organised as Navigation bar layout with inside layouts and one of those layouts contains EditText classes?
I really need access to that text box in MainActivity class and can't find a way to do so.
In provided code, I want to access them by calling methods finViewById() marked in comment with 1. and 2.
XML files are activity_main, input_layout and setting_layout.
Activity_main is a navigation bar layout and other layouts are showed with fragment calling.
I've tried including it into the main activity xml file and it did help solving the problem even though it is not a solution I want.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
input = findViewById(R.id.text1); //1.
output = findViewById(R.id.text_output); //2.
input.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
BottomNavigationView navigation = (BottomNavigationView) findViewById(R.id.navigation);
navigation.setOnNavigationItemSelectedListener(mOnNavigationItemSelectedListener);
}
|
f0491b41231157c85f19848304a0eab080cbc59d2fad305ea0615a02717867a9 | ['8493fa6d08ec42dda22506fdbb2a14e4'] | Thanks for your answer. However, I am wondering what steps you have followed in order to get those results. For example, "Just write $F_Z(z)=\mathrm P\{X+Y\leq z\}=\int_{-\infty}^\infty \int_{-\infty}^{z-y}...$" is not clear to me. Also, for the CDF in 2nd part, I have $F_{Z,W}(z,w) = P(X+Y\leq z, \min\{X,Y\}\leq w)$, but what else?. The support is $(0,2)\times(0,1)$. | f61c0a02aac1a6661ecabe505d05e2d90b17e7f3d392aacd4c11af2fd4f8e23d | ['8493fa6d08ec42dda22506fdbb2a14e4'] | If it is just as a hobby, you could try some workarounds. Try to play with a home made setup, 9x does not seem extreme:
if you want to use one, educational microscopes, the ones that meant for children or schools, can be kind of inexpensive.
You will need to attach to it the camera somehow, maybe with the adition of some spacer rings to be able to focus at shorter distances.
Polarized light is only an option, but if you want it, you can try with a polarized source, like the screen of your phone (probably not very powerful), or filtering any light with some polarized glass. You can use a photography filter or even sunglasses or any other polarized thing (like the inside of the old floppy disk, but will probably be too dark).
I have tried comparable setups in different applications, and even if the results are not comparable to using the real things, they were good enough to get relevant scientific data
|
5e7c193def473f78e13f67d7f983ea2972468dcc684c74c0eb86df7567a0a60a | ['84a7bc40d4d94e69a9cf93f2c267313d'] | Right, I'm trying to read a file and have that data stored in a arraylist(primaryList in primaryList.class). The data is just lines of countries, cities and their population. Heres an example: USA;Chicago=2695000;
After the data is stored, I have methods called setPopulation and getPopulation in a second class(secondaryList.java) that seperate the population number and store it in its own arraylist, namely secondaryList in secondaryList.java.
Everything works fine if the arraylists are in the same class. But when I separate the lists, the primaryList gets emptied at one point. I've been reading around and there seems to be an issue with how I'm calling the constructors if I got it right, but I'm not entirely sure how to implement it in my code.
Main.java - class that runs the methods from other two classes
public class Main {
public static void main(String[] args) throws Exception {
primaryList primaryList = new primaryList();
secondaryList secondaryList = new secondaryList();
primaryList.ReadFile();
secondaryList.setPopulation(0);
String country = secondaryList.getPopulation(0);
System.out.println(country);
}}
secondaryList.java - class responsible for extracting the population part of the string and storing it in secondaryList
public class secondaryList {
primaryList primaryList = new primaryList();
private String country;
private ArrayList<String> secondaryList;
public secondaryList() {
secondaryList = new ArrayList<String>();
}
public void setPopulation(int i) {
System.out.println("starting setPopulation");
int listSize = primaryList.GetInputListSize();
System.out.println("primaryList size is: " + listSize);
country = primaryList.GetInputList(i);
System.out.println("setPopulation got:" + country);
String resultPopulation = country.substring(country.indexOf("=") + 1);
secondaryList.add(resultPopulation);
}
public String getPopulation(int i) {
country = secondaryList.get(i);
return country;
}}
primaryList.java - Class that reads the file and is responsible for storing it's contents in the primaryList list.
public class primaryList {
private List<String> primaryList; // List for entire row
private String country;
public primaryList() {
primaryList = new ArrayList<String>();
}
public void ReadFile() throws IOException {
FileReader reader = new FileReader("FileToRead.txt");
BufferedReader bufferedReader = new BufferedReader(reader);
// Read file FileToRead.txt and add to countries list
while ((country = bufferedReader.readLine()) != null) {
SetInputList(country);
}
bufferedReader.close();
System.out.println(primaryList.size());
}
public String GetInputList(int i) {
country = primaryList.get(i);
return country;
}
public void SetInputList(String country) {
primaryList.add(country);
}
public int GetInputListSize() {
int i = 0;
i = primaryList.size();
return i;
}}
Output: When I run the program, I get the following output:
primaryList size is: 11
starting setPopulation
primaryList size is: 0
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at testing.primaryList.GetInputList(primaryList.java:32)
at testing.secondaryList.setPopulation(secondaryList.java:22)
at testing.Main.main(Main.java:10)
Notice how after I try to get the size of the primaryList from primaryList.java by calling it from secondaryList, the list is empty.
What am I doing wrong? Any help is appreciated!
| e0e16aa49224e68aefb7ada42564cbd1949dc2437fcef60cc6d65446238d8932 | ['84a7bc40d4d94e69a9cf93f2c267313d'] | Not sure if I'm phrasing the question properly nor how to best explain what I'm trying to have answered so bear with me.
When defining a microcontroller register, you would write something like this:
#define io_register (*(volatile unsigned char *)0x25)
I also found this line of code here: Pass a hex address to a Pointer Variable
int *pointer = (int *) 0x00010010;
I understand that a pointer that points at an int is being declared left of the = sign, but why is there a typecast *(int ) right of it?
Same with the #define, I understand that the value at 0x25 is being dereferenced but why am I not able to write it like this:
#define io_register *(0x25)
or
int *pointer = 0x25;
What am I missing here? Please feel free to rephrase or correct any mistakes I've made, still trying to wrap my head around pointers and registers.
|
d3eafe4341baeabd68a8f23ea77af6ec932413c334b5f79fb09210edd304dbe1 | ['84b96550b16144538a6eceed5ae3d208'] | I know that it is a standard fact that multiplication is not sequentially jointly WOT continuous. However, can we find a sequence $A_n$ of self-adjoint bounded operators on a Hilbert space converging WOT to $A$, but $$A_n^2 \not\rightarrow A^2$$ in WOT?
From my experience, counterexamples to the WOT-continuity of multiplication are not given by the squaring function, but instead by two different sequences $A_n, B_n$. Thank you for any help, self-studying the weak operator topology is proving unintuitive to say the least.
| dc2c07a6eff3a37cbf12a73a09862e234733499191afb50bf8f4f2cbf022c713 | ['84b96550b16144538a6eceed5ae3d208'] | Actually, in the case of the disk, there does not have to be any ambiguity because we could take $\gamma_z =[0,z]$, the straight line segment from $0$ to $z$. This gives a definitive curve. But, if the domain was more complicated (not star convex or something), then you can use <PERSON>'s integral theorem, provided that $D$ is nice enough (disk is sufficient, but really simple connectedness).
To see this, if $\gamma_z$ and $\sigma_z$ were two such paths, then the path $\gamma_z$ followed by the reverse of $\sigma_z$ is a closed path. The integral over the holomorphic $f$ is thus zero by <PERSON>. But this is the same thing as the integrals being equal.
|
6ee93440c339997709025626a9b9f6267b3f6ce228911a4782df07288f805153 | ['84e49933f89d47d4be9ae923f35adc5e'] | I am trying to recreate the following background in CSS:
Each hexagon should have navigation link inside (6 sections) and this background with nav links should follow the user through all sections in one-page (displaying on the right side of browser). Currently, I am using it as a background image with fixed position attribute and all works well but the only way to display links for me is to place them in fixed width container on fixed width background image.
I know about clip-path, SVG but it is not supported in all browsers so my question is what is the best way to recreate the following background while maintaining RWD and ensuring each link will be placed exactly in the center of the hexagon?
| 150adc0ab925bf0da9e6b49a1194ce0cb9b8a9b5ceb861f98a15ffdb0e93c80c | ['84e49933f89d47d4be9ae923f35adc5e'] | Looks like fullpage.js automatically changed my h1 and other fonts font-weight to bolder when I implemented it. I've tried adding !important rule on font-weight to override it but no results so far. I'm using Lato font and everything worked perfectly fine before I added fullpage.js.
Another matter is making dot on the welcome site the only element visible (now there are footer and navigation also). Footer and navigation (static on all sites) shouldn't appear on the welcome page, only on the rest of the sites. Help appreciated!
Hyperlink: Workspace. You can check fonts when u scroll down a page.
CODE:
HTML:
<!DOCTYPE html>
<html class="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<link rel="stylesheet" href="css/main.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<link rel="stylesheet" href="js/jquery-ui-1.11.4.custom/jquery-ui.min.css">
<script src="js/jquery-ui-1.11.4.custom/external/jquery/jquery.js"></script>
<script src="js/jquery-ui-1.11.4.custom/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/fullPage.js-master/jquery.fullPage.min.js"></script>
<script src="js/script.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#fullpage').fullpage({
//Navigation
menu: true,
lockAnchors: false,
anchors:['firstPage', 'secondPage'],
navigation: false,
navigationPosition: 'right',
navigationTooltips: ['firstSlide', 'secondSlide'],
showActiveTooltip: false,
slidesNavigation: true,
slidesNavPosition: 'bottom',
//Scrolling
css3: true,
scrollingSpeed: 700,
autoScrolling: true,
fitToSection: true,
fitToSectionDelay: 1000,
scrollBar: false,
easing: 'easeInOutCubic',
easingcss3: 'ease',
loopBottom: false,
loopTop: false,
loopHorizontal: true,
continuousVertical: false,
normalScrollElements: '#element1, .element2',
scrollOverflow: false,
touchSensitivity: 15,
normalScrollElementTouchThreshold: 5,
//Accessibility
keyboardScrolling: true,
animateAnchor: true,
recordHistory: true,
//Design
controlArrows: true,
verticalCentered: true,
resize : false,
sectionsColor : ['#fff'],
paddingTop: '',
paddingBottom: '',
fixedElements: '#main-nav, #main-footer',
responsiveWidth: 0,
responsiveHeight: 0,
//Custom selectors
sectionSelector: '.section',
slideSelector: '.slide',
//events
onLeave: function(index, nextIndex, direction){},
afterLoad: function(anchorLink, index){},
afterRender: function(){},
afterResize: function(){},
afterSlideLoad: function(anchorLink, index, slideAnchor, slideIndex){},
onSlideLeave: function(anchorLink, index, slideIndex, direction, nextSlideIndex){}
});
});
</script>
</head>
<body>
<div id="fullpage">
<div class="section">
<div class="wrapper">
<a href="hello.html"><img id="dot" class="wrapper__dot" src="images/random_pulsing_dot.svg" alt="Click to enter site"></a>
</div>
</div>
<div class="section">
<nav id="main-nav" class="side-bar__nav">
<ul>
<li><a href="hello.html" class="nav__link current">hello</a><img class="small_dot pink" src="images/link_dot_small_pink.svg"></li>
<li><a href="zespol.html" class="nav__link">zespół</a><img class="small_dot black" src="images/link_dot_small_black.svg"></li>
<li><a href="onas.html" class="nav__link">o nas</a><img class="small_dot black" src="images/link_dot_small_black.svg"></li>
<li><a href="misja.html" class="nav__link">misja</a><img class="small_dot black" src="images/link_dot_small_black.svg"></li>
<li><a href="oferta.html" class="nav__link">oferta</a><img class="small_dot black" src="images/link_dot_small_black.svg"></li>
<li><a href="wspolpraca.html" class="nav__link">współpraca</a><img class="small_dot black" src="images/link_dot_small_black.svg"></li>
<li><a href="brief.html" class="nav__link">wypełnij brief</a><img class="small_dot black" src="images/link_dot_small_black.svg"></li>
<li><a href="kontakt.html" class="nav__link">kontakt</a><img class="small_dot black" src="images/link_dot_small_black.svg"></li>
</ul>
</nav>
<div class="main-container">
<h1 class="main-header">Hipster Ipsum Amet.</h1>
</div>
<footer id="main-footer">
<h2 class="footer__text">dolor.</h2>
</footer>
</div>
</div>
</body>
</html>
CSS:
html {
width:100%;
height:100%;
}
body {
height: 100%;
width: 100%;
margin:0 auto;
padding: 0;
font-size: 1em;
}
* {
box-sizing: border-box;
-webkit-font-feature-settings: "liga" 0;
font-variant-ligatures: none;
-webkit-font-variant-ligatures: no-common-ligatures;
}
/*
* index.html page
*/
.wrapper {
position: absolute;
max-width: 45%;
max-height:45%;
top:50%;
left:50%;
}
#dot {
position:relative;
max-width:100%;
max-height:100%;
margin-top:-50%;
margin-left:-50%;
}
/* Dot animation */
@keyframes pulse {
from {
width: 70px;
height: 70px;
}
to {
width: 90px;
height: 90px;
}
}
#dot {
animation: pulse 1200ms ease-in-out infinite alternate;
}
/*
* Hello.html Page
*/
.main-container {
display: flex;
height: 100vh;
width: 100vw;
justify-content: center;
align-items: center;
}
/*
* before/after img inline
* Navigation
*/
.nav__link a{
visibility: hidden;
}
.small_dot {
vertical-align:middle;
padding-left: 10px;
}
.side-bar__nav{
position: absolute;
padding: 10px;
right: 0;
top: 50%;
transform: translateY(-50%);
}
.side-bar__nav ul li{
list-style: none;
text-align: right;
margin-right: 50px;
padding-top: 15px;
}
.side-bar__nav ul li img {
margin-bottom: 5px;
}
.small_dot:hover {
}
.side-bar__nav a {
text-decoration: none;
color: rgba(0,0,0,0);
font-family: 'Lato', sans-serif;
font-size: 1.1em;
-webkit-transition: all 1s ease-in;
-moz-transition: all 1s ease-in;
-o-transition: all 1s ease-in;
transition: all 1s ease-in;
}
.side-bar__nav:hover a {
color: rgba(0, 0, 0, 1);
}
.main-header {
text-align: center;
}
footer {
position: absolute;
bottom: 0;
left: 0;
right: 0;
}
.footer__text {
text-align: center;
}
.languages {
}
/*
* Typography
*/
h1 {
font-weight: 100;
font-size: 5.5em;
font-family: 'Lato', sans-serif;
}
h2 {
font-family: 'Noto Serif', serif;
font-weight: 700;
font-size: 3.5em;
}
img {
max-width: 100%;
}
@media (max-width: 600px) {
h1 {
font-size: 3em;
}
h2 {
font-size: 2.5em;
}
.side-bar__nav {
display: none;
}
}
@media (max-width: 1228px) {
.side-bar__nav {
display: none;
}
}
|
7db8d6465670eca3035fd46243967f1f94dbf1b28ca97605a627a55cf659fb6a | ['84eb7b7ca78249bc81be804bc7c04784'] | As the title says, i tried to use Eclipse for android programming.I installed ADT plugin and set SDK directory.When i open SDK Manager in eclipse it recognizes and shows every SDK version that i'm expecting, but as it appears the IDE doesn't recognize the SDKs and i see this error in console:
Unable to resolve target 'android-19'
I even tried to set SDK target version in my project's "Properties". But there, in the "Android" window's "Project Bundle Target" box, i have only API 23 Option(that was default in the Eclipse's version that i installed).
Now what is the problem and why i get that error and all API 19 classes can't be found in repository even though the SDK Manager recognize the SDK ?
Thank you in advance.
| ea88906607471395fe1d864d1f73cfbc501c91ec4a351c19a6ffc39e68dda605 | ['84eb7b7ca78249bc81be804bc7c04784'] | I want to read a file's contents and split every time that I reach to a whitespace and do "action 1" on the splitted string if there was an "space" before it, "action 2" if there was a "tab" before it and "action 3" if there was a "newline" before it.
Actions are not important. My question is how can i read the file such that i can determine the type of the whitespace i read?
Thanks in advance!
|
ace15b6b70844622445e9d8685cc20f6833d0bb66b461783182d2f20bec062ae | ['84eccab092e94edf8a12253e120ff21e'] | Given the following object defined and initialized in a wrapper class:
// (thread-safe) List of Requests made by users
private static List<Request> requests = Collections.synchronizedList(new ArrayList<Request>());
The following code is being called constantly in an update loop:
// <-- (Thread 1 executes the following code @ Runtime=1.0000000ms)
synchronized(requests) {
for (Request request : requests)
request.handle();
requests.clear();
}
And this also happens "simultaneously".
// (Thread 2 executes the following code also @ Runtime=1.0000000ms)
synchronized(requests) {
(requests.add(new Request());
}
It is my understanding that the following is guaranteed to happen in this situation: one of the threads will successfully lock the requests List, perform its respective task, and release its lock upon exiting the synchronous block.
Here is where things get weird for me in my understanding of "thread-safety". Let's say that Thread 1 has achieved its lock on the requests List and has entered its synchronous block first, despite Thread 2 attempting to do the same.
1) What happens to the code inside of a synchronous block that cannot be called due to the synchronicity of an object not being achieved? (In this case, with Thread 2 and the new Request() that this thread is attempting to add to the List - what happens to it? - does the request just poof and is never added to the requests List since Thread 1 has locked the object?
2) Is Thread 2 literally waiting for Thread 1 to release its lock and upon that happening Thread 2 gets a fresh look at the object and adds the request? (Hypothetical pitfall) If this is the case - what if Thread 1 takes 60 seconds to perform handle() on all of the Request objects in the List - causing Thread 2 to be waiting for those 60 seconds?
(bonus question) Do the answers for 1&2 with respect to Collections.synchronizedList follow the same behavior as ConcurrentHashMap?
| ef919c214d426cc919837ede3eb9b8f6497015b939861ae79c28a7e302032416 | ['84eccab092e94edf8a12253e120ff21e'] | The simple architecture and summary of dilemma:
Entry Point: Client successfully authenticates itself to a singleton LoginServer (via TCP the connection supplies valid username+password). LoginServer is the only Server with access to the salted login database.
LoginServer intelligently selects a single GameServer from a list of GameServer(s) to assign this Client. After being assigned to a GameServer, Client will send I/O requests to said GameServer exclusively, which will be processed internally by nature of game design.
Dilemma: GameServer contains no data of Client and is unaware of the "handshake" that took place between LoginServer and Client. GameServer is incapable of putting the piece of authentication from LoginServer to the appropriately mapped Client ... because what does it have to work with?
Potential Solution: After successfully authenticating with LoginServer, Client is given a unique token to validate itself with GameServer(s).
Side note: I'm assuming using anything IP-based is a security concern due to potential IP spoofing.
|
ce6004bb082cd0080e55b45da4ccdd8d372c41b2b3f1a53ec8e137a19ed407d0 | ['84eef3953bd54adebb0458a23612797b'] |
1) Is there any way i can have a button or custom navbar on top of loaded webpage in my window? Currently I've made another child window with height and width same as that of button and placed it on top but it doesn't look/sound good.
Yes, this is definitely possible. The two ways that I can think of to do this include using the preload preference (see webPreferences) to preload some JavaScript before loading the actual page and through the webContents.executeJavaScript() function.
The latter method would look something like this:
win.webContents.executeJavaScript(`
document.body.insertAdjacentHTML('beforeend', '<p>Add your <span>sticky</span> button code here</p>');
`);
This method essentially injects HTML by using the webContents.executeJavaScript() function where win is your BrowserWindow.
2) Is there any way to load a file of mine (say xyz.html) and then just have a section where that URL is loaded, since websites don't allow their webpages to be loaded in iframe any more.
I bet there's some workaround to directly inject HTML but the methods I mentioned above (preloading or using executeJavaScript) would be much easier to accomplish this same task.
Hopefully, my answer could be of help.
Good luck!
| 7977ccd3b03379f988ee38a333fe8fd99056777b87a0bc0c82383008d9947f9c | ['84eef3953bd54adebb0458a23612797b'] | I'm building a web browser in a C# .NET Windows Form Application and wanted to add support for fullscreen usage (mainly on HTML5 videos).
So that when users press the fullscreen button on a video like a youtube video, the video would take up the full screen.
The browser uses a GeckoFx control to view the interweb. How would I go about doing this?
|
b951f19d57dc7b561f40152a08af6801d3b484c8c3ef4d01c1bd054179539327 | ['84f46128f64e4a8ea9c0d4b829062c99'] | I do not recommend logging into the root user, it can harm your system.
You can enable it by executing this in the command line:
sudo sh -c 'echo "greeter-show-manual-login=true" >> /etc/lightdm/lightdm.conf'
It may ask for the password, you can change that this way:
sudo passwd root
| 8d05931c9d4367493d0c54731140d1a710be66f193b7a6caf08eeb769a206cc0 | ['84f46128f64e4a8ea9c0d4b829062c99'] | You can turn off Automatic Updates in the Control Panel. When turned off you will be prompted every time with a message like "Windows Updates are installed, when would you like to restart?".
When you are running Windows 7 you can customize the update process, I dont know how well that works with Windows 8/10.
|
5c6ff0329e9c440155f979fb5c8ac484ce13843cb3c1f51680328d52622f9563 | ['84fd24285a8a4a37be491d9918c4a069'] | I am using maven 3.2.2 and jdk-1.7.0_60. I am executing mvn compile for a particular project, the compilation succeeds. But when I run mvn clean install on the same component, I get the following error-
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/projects/myProject/src/mainTest.java:[105,56] cannot find symbol
symbol: method getIdFromName(java.lang.String)
location: class java.lang.Object
What could be the reason behind this? Doesn't mvn compile actually compile everything? As far as I know, the only difference between mvn compile and mvn clean install is that the latter command copies the required jar.
| 983ae38d1092a4e4d344c81d83a3c38c4395bd39223e4d7106987881c062503b | ['84fd24285a8a4a37be491d9918c4a069'] | I'm writing a script which runs the following command
mysql -u root -e "show databases"
and this will display a list of databases.
If this table doesn't contain a database by name "userdb", it should do the following-
if [ ... ]; then
echo "error"
exit
fi
What do i write in the if [ ... ] condition?
|
ff83e8ca687e9baf6fc6a58c3f6fcef98dc0d5d9d2bac61377458694b4cdede3 | ['8526a507a7ca4b419b0b9ad5fb5ee3a0'] | Yes, SSDs are safe to use for backup purposes. (Although, I can't imagine why you would want to, but that's a different subject.)
A few lessons we should learn from this:
SSDs are not less reliable than HDDs
Modern SSDs are still unproven technology
Multi-layer cell memory is more reliable (but costs more)
Most importantly, any kind of drive can fail. If the data matters, plan accordingly.
| dbf5a82e7e32164ba8387368288e54dd006495945bbd2a7f81f5d6e735ce8bbd | ['8526a507a7ca4b419b0b9ad5fb5ee3a0'] | Yes, Intel Smart Response Technology's caching supports up to 64 GB.
A larger cache means more of your data can be stored on the SSD, and when used (i.e. read), will open faster. The difference between cache sizes isn't something you can benchmark in the traditional sense. It would depend entirely on you've previously been using; whether or not what you're opening next has been used before, or whether you've used too many other things since then that resulted in it being flushed out.
|
544988f3a0f6975c3fb8581d9b917e234328891c83566ae740890b1c126a76bd | ['854e1868c9d54d15894ffca70502fb46'] | The code of @ThePracticalOne is great for showing the usage except for one thing:
Somtimes the output would be incomplete.(session.recv_ready() turns true after the if session.recv_ready(): while session.recv_stderr_ready() and session.exit_status_ready() turned true before entering next loop)
so my thinking is to retrieving the data when it is ready to exit the session.
while True:
if session.exit_status_ready():
while True:
while True:
print "try to recv stdout..."
ret = session.recv(nbytes)
if len(ret) == 0:
break
stdout_data.append(ret)
while True:
print "try to recv stderr..."
ret = session.recv_stderr(nbytes)
if len(ret) == 0:
break
stderr_data.append(ret)
break
| 5f4ce07571f575bc72aff1fdd6292769c0eab3c5660f9a7d4ffe0c78eb8277a0 | ['854e1868c9d54d15894ffca70502fb46'] | can you run cepn-mon -i <your-mon-id>, I solve this by :
(I am at the same situation as yours, I am based on firefly & I compile & make install from the cource code.)
#!/bin/bash
fsid=`uuidgen`
host="your-mon-host"
ipaddr="your-mon-ip-addr"
echo "[global]" > ./ceph.sample.conf
echo "fsid = ${fsid}" >> ./ceph.sample.conf
echo "mon initial members=${host}" >> ./ceph.sample.conf
echo "mon host = ${ipaddr}" >> ./ceph.sample.conf
cat ./popular_settings.txt >> ./ceph.sample.conf
cp ./ceph.sample.conf /etc/ceph/ceph.conf
rm -rf /var/lib/ceph/mon/ceph-${host}/done
sudo ceph-authtool --create-keyring /var/lib/ceph/tmp/ceph-${host}.mon.keyring --gen-key -n mon. --cap mon 'allow *'
sudo ceph-authtool --create-keyring /etc/ceph/ceph.client.admin.keyring --gen-key -n client.admin --set-uid=0 --cap mon 'allow *' --cap osd 'a llow *' --cap mds 'allow'
sudo chmod +r /var/lib/ceph/tmp/ceph-${host}.mon.keyring
sudo chmod +r /etc/ceph/ceph.client.admin.keyring
sudo ceph-authtool /var/lib/ceph/tmp/ceph-${host}.mon.keyring --import-keyring /etc/ceph/ceph.client.admin.keyring
monmaptool --create --add ${host} ${ipaddr} --fsid ${fsid} /tmp/monmap --clobber
#rm -rf /var/lib/ceph/mon/ceph-${host}
sudo ceph-mon --mkfs -i ${host} --monmap /tmp/monmap --keyring /var/lib/ceph/tmp/ceph-${host}.mon.keyring
touch /var/lib/ceph/mon/ceph-${host}/done
touch /var/lib/ceph/mon/ceph-${host}/upstart
ps aux | grep "ceph-mon" #there should be no ceph-mon
ceph-mon -i ${host}
ps aux | grep "ceph-mon" #there we've got a ceph-mon running
ceph osd tree
|
046302b2a4a44cfa2048fce9482a386be753f0bbd960cf698df684991cf09c0b | ['85663379ce4849b4802bb31915e082fb'] | For those who struggled the same as me with laravel artisan console command that makes a lot of requests to same wsdl of external soap server and then after some time fails with Could not connect to host error.
The problem was because I was creating new SoapClient instance each time before request was made. Do not do that. Create it once and make each request from the same client.
Hope it helps.
| 62e92287dc870c0f13738af27ff7d384e7b0d06df6d9be31f26822d6192431ea | ['85663379ce4849b4802bb31915e082fb'] | Ok, guys so I figured it out. Thanks for all support and answers. So I have tried manually set object for push in mutation.
createTask(state, task) {
const taskObj = {id: task.id, text: task.text, done: false};
state.tasks.push(taskObj);
}
And It worked, the problem was because of done field that was coming as null from server. I think I should read more info about vuex, but it is very strange...
|
e83ebf732214bb482f9e27622b08f7d73136722cce0c1d66592e94411e11cd7c | ['85750d722c60465b994ac0ba07943cb1'] | # lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.10 (Final)
Release: 6.10
Codename: Final
# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit
Loading mirror speeds from cached hostfile
* base: mirror.web-ster.com
* elrepo: repos.lax-noc.com
* epel: mirror.pnl.gov
* extras: mirror.web-ster.com
* updates: mirror.web-ster.com
repo id repo name status
WANdisco-git WANdisco Distribution of git 407
WANdisco-svn19 WANdisco SVN Repo 1.9 - x86_64 162
base CentOS-6 - Base 6,713
elrepo ELRepo.org Community Enterprise Linux Repository - el6 263
epel Extra Packages for Enterprise Linux 6 - x86_64 12,504
extras CentOS-6 - Extras 35
updates CentOS-6 - Updates 257
repolist: 20,341
# yum --enablerepo=elrepo-kernel install kernel-ml
Loaded plugins: fastestmirror, refresh-packagekit
Setting up Install Process
Loading mirror speeds from cached hostfile
* base: mirror.web-ster.com
* elrepo: repos.lax-noc.com
* elrepo-kernel: repos.lax-noc.com
* epel: mirror.pnl.gov
* extras: mirror.web-ster.com
* updates: mirror.web-ster.com
No package kernel-ml available.
Error: Nothing to do
Any workarounds?
| 6a89d3c607c42d10b43bf22bb1e070e705eced696482cebe1fca72350e422ce4 | ['85750d722c60465b994ac0ba07943cb1'] | Ну например:
const mongoose = require("mongoose");
// подключение
mongoose.connect("mongodb://localhost:27017/tgbot_test", { useNewUrlParser: true, useUnifiedTopology: true });
...
const Schema = mongoose.Schema;
// установка схемы
const userScheme = new Schema({
username: {
type: String,
required: true
},
chat_id: {
type: String,
required: true
}
}, {
collection: 'users'
});
// создание модели
const User = mongoose.model("User", userScheme);
...
router.get('/', wrap(async function(req, res, next) {
let query = User.find()
const searchName = req.query.name
if (searchName) {
query = query.where('username').regex(new RegExp(`${searchName}`))
}
const foundUsers = await query.exec();
res.json(foundUsers)
}));
router.post('/', wrap(async function(req, res, next) {
const userProps = req.body
const user = new User(userProps);
try {
const newUser = await user.save();
res.status(200).json(newUser);
} catch (err) {
res.status(500).send(err);
}
}));
router.put('/:id', wrap(async function(req, res, next) {
const userProps = req.body
const userId = req.params.id
try {
const user = await User.findById(userId).exec();
user.set(userProps)
await user.save()
res.status(200).end();
} catch (err) {
res.status(500).send(err);
}
}));
|
71ada528f3f4aa52358045b2af5b21e854c128ccbef7d2c422d746a784b9d43a | ['85794efec969418a91567bee1a4c44af'] | I wish to know how to delete a many-to-many association via a REST call. I am able to create records, and associated them, but do not understand how to delete.
I have a Spring Boot project where i'm using REST and HATEOAS to by pass Services and Controllers and expose my Repository directly.
I have a User Model/Domain class
@Entity
@Table(name = "usr")
public class User implements Serializable {
private static final long serialVersionUID = 1L;
@Version
private long version = 0;
@Id
@GeneratedValue(generator="optimized-sequence")
private Long id;
@Column(nullable = false, unique = true, length = 500)
@Size(max = 500)
private String userName;
@Column(nullable = false, length = 500)
@Size(max = 500)
private String firstName;
@Column(nullable = false, length = 500)
@Size(max = 500)
private String lastName;
@ManyToMany( fetch = FetchType.LAZY, cascade = CascadeType.ALL)
@JoinTable( name="user_role",
joinColumns={ @JoinColumn( name = "user_id",
nullable = false
)
},
inverseJoinColumns={ @JoinColumn( name="role_id",
nullable=false
)
}
)
private Set<Role> roles = new HashSet<Role>(0);
...Getters/Setters Below...
As as you can see, I have a roles member that is Many-To-Many association with Role class, of which the code is such:
@Entity
public class Role {
@Id
@GeneratedValue(generator="optimized-sequence")
private Long id;
@Column(nullable = false)
private String name;
@Column(nullable = false)
private String description;
...Getters/Setters Below...
My repositories look like so:
UserRepository
public interface UserRepository extends
JpaRepository<User, Long>, JpaSpecificationExecutor<User> {
List<User> findByUserName(String username);
}
RoleRepository
public interface RoleRepository
extends JpaRepository<Role, Long> {
}
Now, all is well. When I access the project root from a browser, I get the repository index/directory in JSON+HAL format. Wonderful.
(Note I'm remove the http:// part from the test below because StackOverflow is counting it towards my links quota)
I, using WizTools REST Client, HTTP.POST to the Role ( localhost:8080/resttest/roles ) repository and create a new Role. Success, Role ID #4 created.
Then I POST to the User repository to create a User ( localhost:8080/resttest/users ). Success, User ID #7 created.
Then I PUT to the User repository to create an association with the role:
PUT localhost:8080/resttest/users/7/roles
Content-type: uri-list
Body: localhost:8080/resttest/roles/4
Great! Association made. User 9 is now associated with Role 4.
Now I can't for the life of me figure out how to DELETE this association.
I'm sending an HTTP DELETE instead of PUT with the same command as above.
DELETE localhost:8080/resttest/users/7/roles
Content-type: uri-list
Body: localhost:8080/resttest/roles/4
I get back: HTTP/1.1 405 Method Not Allowed
{
"timestamp":1424827169981,
"status":405,
"error":"Method Not Allowed",
"exception": "org.springframework.web.HttpRequestMethodNotSupportedException",
"message":"Request method 'POST' not supported"
}
| 1d87a0009d4f38584e73c0836a1464c1edbec1ba76e1505b807a0e185d7f17ba | ['85794efec969418a91567bee1a4c44af'] | I have a nightly process that takes around 18 hours to run. The gist of the operation is that an up-stream service is polled, the data then is applied to my own database - not as 1-to-1, but massaged, compared and snapshotted if necessary (so there's comparison, and bit of other functions involved in going form flat-files into a relational structure).
The upstream has agreed to provide us with a single, rather large csv file nightly, cutting out on the polling times.
I'm thinking of using Spark/hdfs to distribute this process of nightly sync/merge. However I'm wondering how best to do this? Since my own database will get hammered if I query it frequently to compare, insert, etc.
What is the best approach in this case? I've thought about downloading my own data into memory along with the upstream data to make the comparisons faster, but with these databases growing rapidly on a monthly bases, I need a scalable approach.
|
7f5145fe9b0e1d94336980982d464665422a166935392b537a627d48cef1c7d1 | ['857da40de8d54ec4876835d3085168ab'] | Given a curious setup, my desktop computer is now far from an accessible connection to the internet as it lacks WiFi, yet I do have a spare laptop lying around with WiFi capabilities. Is it possible to use the available WiFi connection in my desktop, through the laptop?
I've seen a couple of these questions thus far, but none have been specific to Windows 8.1, the operating system on both computers.
Thanks!
| a24361b3e4a96a935d37e251650e1ebd83b687e17e7ff6d03a996636432d4aee | ['857da40de8d54ec4876835d3085168ab'] | You might have misinterpreted the function of Wildcard certificate. Wildcard SSL Certificate issued on *.example-private.com will only secure single level, for example;
*.example-private.com will secure,
example-private.com
abc.example-private.com
def.example-private.com
ghi.example-private.com
Now if you want to secure second level sub-domains, you should go with Multi-Domain Wildcard certificate. This certificate will secure domains as under:
*example-private.com
www.example-private.com
shop.example-private.com
staging.example-private.com
*.staging.example-private.com
photos.staging.example-private.com
news.staging.example-private.com
blog.staging.example-private.com
I suggest you to browse this article to know more how Wildcard SSL can be helpful to secure sub-domains.
|
be4891b2c0fe3f6119ec5d7830f5d75a57aece17834be391f5a53710acb50713 | ['857ea8bd27594b2b9f263b3ed0433bab'] | Polak, mentioned docs code snippet refer to previously created instance to get it's pre-configured PNConfiguration instance and change required field. This practice can be used in case if you need change something at run-time.
If you have data for authKey at the moment of client initialization, you can set it:
var pubnubClient: PubNub = {
let configuration = PNConfiguration(publishKey: UCConstants.PubNub.publishKey, subscribeKey: UCConstants.PubNub.subscribeKey)
configuration.authKey = "my_auth_key"
return PubNub.clientWithConfiguration(configuration)
}()
Also, I've tried exact your code and don't have any issues with setting of authKey, because I can see it with subscribe request.
If you still will have troubles with PAM and auth key usage, please contact us on <EMAIL_ADDRESS><PERSON>, mentioned docs code snippet refer to previously created instance to get it's pre-configured PNConfiguration instance and change required field. This practice can be used in case if you need change something at run-time.
If you have data for authKey at the moment of client initialization, you can set it:
var pubnubClient: PubNub = {
let configuration = PNConfiguration(publishKey: UCConstants.PubNub.publishKey, subscribeKey: UCConstants.PubNub.subscribeKey)
configuration.authKey = "my_auth_key"
return PubNub.clientWithConfiguration(configuration)
}()
Also, I've tried exact your code and don't have any issues with setting of authKey, because I can see it with subscribe request.
If you still will have troubles with PAM and auth key usage, please contact us on support@pubnub.com
| 2afc94b829130469d995fc6d5486b25f76847e3723e1289f12e8b1e65d3aa7a2 | ['857ea8bd27594b2b9f263b3ed0433bab'] | Create your UIImageView subclass, add some methods which will allow to add point's on user touch (will draw them in drawRect: and also place into C-array) and one method to "commit" line. Commit line will simply go through C-array and draw them in context with CG methods.
|
3df41a8fafed0ea1179c87702352bb0c1e06870b6b208afc2b3012626b46f30a | ['8586cd805f2147a18a944e5184bd8dd6'] | I prefer designing the API in a way that makes it harder or impossible for the consumer to make mistakes. For example, instead of having MediaPlayer.play() and MediaPlayer.stop(), you could provide MediaPlayer.playToggle() which toggles between "stopped" and "playing". This way, the method is always safe to call - there's no risk of going into an illegal state.
Of course, this is not always possible or easy to do. The example you gave is comparable to trying remove an element that was already removed from the list. You can either be
pragmatic about it and not throw any error. This certainly simplifies a lot of code, e.g., instead of having to write if (list.contains(x)) { list.remove(x) } you only need list.remove(x)). But, it can also hide bugs.
or you can be pedantic and signal an error that the list doesn't contain that element. The code can become more complicated at times, as you constantly have to verify if the pre-conditions are satisfied before calling the method, but the upside is that eventual bugs are easier to track down.
If calling MediaPlayer.stop() when it's already stopped has no harm in your application, then I'd let it run silently because it simplifies code and I have a thing for idempotent methods. But if you're absolutely certain that MediaPlayer.stop() would never be called in those conditions, then I'd throw an error because there might an bug somewhere else in the code and the exception would help track it down.
| dae6da44f2a2ab09136ad18c1171d287276f28d33e4ccabda6fde5527d28d93f | ['8586cd805f2147a18a944e5184bd8dd6'] | I noticed that the release notes for service pack 1 for Windows Server 2008 R2 says that it enables Bluetooth support.
I've apply the upgrade but I could not figure out how to get my Bluetooth devices to work. Do you still need to copy the Windows 7 drivers like the pre-SP1 blogs and articles say?
This is on a Dell Precision M4500 and Dell Precision T3500 with a Bluetooth dongle attached.
|
48bb54abde758ccbef42905f6bf1707b3e5b20aa49bf565f609fef3a8e76ab27 | ['8586df4c0af946dfba19e1dde0193be0'] | You can do something like this:
@Entity()
@Exclude()
export class User {
@Expose()
@PrimaryGeneratedColumn("uuid")
id: string;
@Column({nullable: true, default: null})
public email: string;
public connectedUser: string?;
@Expose({ name: 'email'}) // Only if logged user
public get hideableEmail(): string? {
if(this.email === this.connectedUser) {
retun this.email;
}
return null;
}
@Expose()
@Column({nullable: true, default: null})
public username: string;
@Column({nullable: true, default: null})
public password: string;
@CreateDateColumn()
public create_at: Date;
@UpdateDateColumn()
public update_at: Date;
}
| b4202ecbf653d0742affcddfb604aab719c6762fc00c2ba5520640b2f33c2f1d | ['8586df4c0af946dfba19e1dde0193be0'] | as you write in your example, get method return AxiosResponse<> and contains circular reference.
So if you want to proxify webservice https://api.github.com/users/januwA, you should return AxiosResponse.data :
import { Get, Controller, HttpService } from '@nestjs/common';
import { AxiosResponse } from 'axios'
import { Observable } from 'rxjs'
@Controller()
export class AppController {
constructor(private readonly http: HttpService) {}
@Get()
root(): Observable<any>{
return this.httpClient.get('https://api.github.com/users/quen2404')
.pipe(map(response => response.data));
}
}
|
11412c15d417129e6acd82b32309f60d10776d00ff3cbe3b7b4641ab8df0f675 | ['85b669e2e67f45078f529284df6844f9'] | Since you have a duplicated target, the issue is that the second target uses the same entitlements file as the original one (check the official documentation for more info).
You can do a quick fix, which would be to duplicate the entitlements file and update the Code Signing Entitlements (CODE_SIGN_ENTITLEMENTS) value under Build Settings.
A long term solution would be to migrate the project to using xcconfig files, having a single target with different configuration pairs (Debug and Release) for each environment (Enterprise and Company in your case). A good starting point would be the Let's Set Up Your iOS Environments blog post.
Also, note that the values in the entitlement files must correspond to the values in the App ID configuration on the developer portal.
| 04a19967ae59e525d9e985f2ee29bbd190d91fa40f82c62460c081de03dc694f | ['85b669e2e67f45078f529284df6844f9'] | If you are using NSCoding compliant classes for your objects, then I suggest writing and reading the data using [NSKeyedArchiver archiveRootObject:toFile:] and [NSKeyedUnarchiver unarchiveObjectWithFile:], respectively.
The data can be saved as an XML or a binary property list by using the setOutputFormat method.
For more info, check Apple's Archives and Serializations Programming Guide and NSHipster's article on NSCoding.
|
6b7d61b913b4e96efbe6bb2ef94e272e6d70f2665282a62b1b9919050e853e29 | ['85bdaf018c654dcbab3a7df7c8f735fe'] | I'm looking for a way to remove unnecessary information (like prepositions) from a column of texts. E.g. "The", "and", "is", etc. Each cell has information like product description or feedback, etc. So it's like a paragraph in each cell.
Find and Replace function will remove the words even if they are characters within a text. E.g. Remove "the" and "these" will become "se". Don't want that. Substitute function doesn't work either.
Is there any function or formula that can help with this?
| ecb58c71d25b4d391f58162e17e12d86e422c2467231252a76c638369c4c903f | ['85bdaf018c654dcbab3a7df7c8f735fe'] | I need to automate the process of collecting information from multiple clients via email and having them stored in a SharePoint list. I was thinking of using SharePoint forms and having it embedded in emails targeting a specific group of clients. And once the data has been filled in, they will be stored in a SharePoint list.
I am looking for customizable methods that doesn't involve much coding or atleast not the complicated type.
Appreciate it if anyone can point me in the right direction.
|
fea7e95136463e86c827e7d31bb2edc4a64c44e83795af2282024cde0ac91300 | ['85cc7d38da5d4b139f1fc02acabd1740'] | Two possible issues seem to have come to light:
Slightly broken DNS record (too long?)
Ubuntu's systemd DNS resolver not being very nice
The DNS records we'd created were split on the 255 byte boundary. Dropping this to 248 bytes seems to have fixed the issues.
The Ubuntu resolver has expected behaviour where it doesn't offer a local TCP resolution service by default so host falling back to TCP to do the lookup was failing -- I think! https://github.com/systemd/systemd/issues/6520
| 24fb37cd02b99df4b7ae2e4d561a6018fe8eb472eb7973cb2854ee4d376df0a5 | ['85cc7d38da5d4b139f1fc02acabd1740'] | Почему android studio не дает мне доступ к элементам Game_Activity из других классов ? Из-за чего я не могу кастонуть переменные к Button или другим элементам. Как для примера написал в классе ButtonHandlerOnBottom универсальный слушатель для 9 кнопок и чтобы проверить его работу пытаюсь назначить Textview text с именем gorot , но класс ButtonHandlerOnBottom видит его название , но не видит его методов, но в то же время в классе Game все в порядке. Так же в ButtonHandlerOnBottom при попытке назначить на переменные bt1 ,bt2 и т.д. каждую кнопку запрещает каст , т.к. bt_1 и bt_2 и т.д. это для класса ButtonHandlerOnBottom тип Int , тогда как в классе Game этой проблемы нет и все получается на отлично.
Видимо проблема в видимости о который я не знаю(это мое первое приложение) , этого всего можно избежать если писать код только в одной activity , но мне нужно написать приложение разбивая код по классам.
Android studio в классе Game подсвечивает import kotlinx.android.synthetic.main.activity_game.* , тогда как в классе ButtonHandlerOnBottom - нет. Думаю , проблема здесь .
package com.example.ps_4.sudoku
import android.support.v7.app.AppCompatActivity
import android.support.v7.app.ActionBar
import android.os.Bundle
import android.view.Menu;
import android.view.View
import android.widget.Button
import android.widget.Toast
import kotlinx.android.synthetic.main.activity_game.*
class Game : AppCompatActivity() {
val buttonsonbottom : ButtonHandlerOnBottom = ButtonHandlerOnBottom()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_game)
gorot.text = "sdfsfds"
val example : Button = bt_1
}
}
package com.example.ps_4.sudoku
import android.widget.Button
import android.view.View.OnClickListener
import com.example.ps_4.sudoku.R.id.bt_1
import com.example.ps_4.sudoku.R.id.gorot
import com.example.ps_4.sudoku.R.id.*
import com.example.ps_4.sudoku.R.id.gorot
import kotlinx.android.synthetic.main.activity_game.*
class ButtonHandlerOnBottom() {
val bt1 : Button
val bt2 : Button
val bt3 : Button
val bt4 : Button
val bt5 : Button
val bt6 : Button
val bt7 : Button
val bt8 : Button
val bt9 : Button
var currentbutton : String
init {
currentbutton = ""
//SAM constructor to reuse event handler
val listener = OnClickListener { view ->
val text = when(view.id){
bt_1 -> "1"
bt_2 -> "2"
bt_3 -> "3"
bt_4 -> "4"
bt_5 -> "5"
bt_6 -> "6"
bt_7 -> "7"
bt_8 -> "8"
bt_9 -> "9"
else -> "unknown button"
}
gorot.Text = text
currentbutton = text
}
// why bt_1 is Int ???????
bt1 = bt_1
bt2 = bt_2 as Button
bt3 = bt_3 as Button
bt4 = bt_4 as Button
bt5 = bt_5 as Button
bt6 = bt_6 as Button
bt7 = bt_7 as Button
bt8 = bt_8 as Button
bt9 = bt_9 as Button
bt1.setOnClickListener(listener)
bt2.setOnClickListener(listener)
bt3.setOnClickListener(listener)
bt4.setOnClickListener(listener)
bt5.setOnClickListener(listener)
bt6.setOnClickListener(listener)
bt7.setOnClickListener(listener)
bt8.setOnClickListener(listener)
bt9.setOnClickListener(listener)
}
}
|
f4594ccb5f6fdf078c72a50e6ef25f997f8d2af061067fe51838bcecd5848348 | ['85d017953ff94d94b351be1d8324515b'] | I've had this issue in Rails 3.1 when CSRF verification fails. This can happen if you use a tag manually rather than generate it via one of the built-in methods provided by Rails.
Search your log file for "csrf" (case insensitive search). If you see a log entry showing a csrf failure, it's likely Rails is resetting your session.
| 32b4ad5976f083d21e37afd1b60c0e8864d1a15344a1f2da81e876f2ec9657b1 | ['85d017953ff94d94b351be1d8324515b'] | I don't have a working example for you nor do I have a very clean solution, but let me tell you what I've found.
If you look at the javascript code for TypeAhead it looks like this:
items = $.grep(this.source, function (item) {
if (that.matcher(item)) return item
})
This code uses the jQuery "grep" method to match an element in the source array. I didn't see any places you could hook in an AJAX call, so there's not a "clean" solution to this.
However, one somewhat hacky way that you can do this is to take advantage of the way the grep method works in jQuery. The first argument to grep is the source array and the second argument is a function that is used to match the source array (notice Bootstrap calls the "matcher" you provided when you initialized it). What you could do is set the source to a dummy one-element array and define the matcher as a function with an AJAX call in it. That way, it will run the AJAX call just once (since your source array only has one element in it).
This solution is not only hacky, but it will suffer from performance issues since the TypeAhead code is designed to do a lookup on every key press (AJAX calls should really only happen on every few keystrokes or after a certain amount of idle time). My advice is to give it a try, but stick with either a different autocomplete library or only use this for non-AJAX situations if you run into any problems.
|
bc1734588615f5392d6bb528578c1c5a5d906f21861230563ba11b028ca0c2d8 | ['85e150c1a18644a8b569e82050641da1'] | I am trying to achieve two different views: one for registration purpose and one for login purpose.
Now, the registration process works perfectly but the authentication process does not.
Here's the code:
in forms.py the first form called UserForm is used to sign up users, the second form called LoginForm is used to log in users.
from django.contrib.auth.models import User
from django import forms
class UserForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = User
fields = ['first_name', 'last_name', 'username', 'email', 'password']
class LoginForm(forms.ModelForm):
password = forms.CharField(widget=forms.PasswordInput)
class Meta:
model = User
fields = ['username', 'email', 'password']
in views.py
from django.shortcuts import render, get_object_or_404, redirect
from .models import Step, Cycle, Program, MotorSetting, GeneralSetting
from django.views import generic
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.core.urlresolvers import reverse_lazy
from django.contrib.auth import authenticate, login
from django.views.generic import View
from .forms import UserForm
from .forms import LoginForm
class UserFormView(View):
form_class = UserForm
template_name = 'programs/registration_form.html'
# display blank form
def get(self, request):
form = self.form_class(None)
return render(request, self.template_name, {'form': form})
#process form data
def post(self, request):
form = self.form_class(request.POST)
if form.is_valid():
#storing the data but NOT SAVING them to db yet
user = form.save(commit=False)
#cleaning and normalizing data
username = form.cleaned_data['username']
password = form.cleaned_data['password']
user.set_password(password)
#saving to db
user.save()
#if credentials are correct, this returns a user object
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
return redirect('programs:index')
return render(request, self.template_name, {'form': form})
class LoginFormView(View):
form_class = LoginForm
template_name = 'programs/login_form.html'
# display blank form
def get(self, request):
form = self.form_class(None)
return render(request, self.template_name, {'form': form})
#process form data
def post(self, request):
form = self.form_class(request.POST)
if form.is_valid():
#storing the data but NOT SAVING them to db yet
user = form.save(commit=False)
#if credentials are correct, this returns a user object
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
return redirect('programs:index')
return render(request, self.template_name, {'form': form})
in app/urls.py
from django.conf.urls import include, url
from . import views
app_name = 'programs'
urlpatterns = [
#register page
url(r'^register/$', views.UserFormView.as_view(), name='register'),
#login page
url(r'^login/$', views.LoginFormView.as_view(), name='login'),
]
The registration process goes smoothly, the authentication/login does not. When I fill in the form to login and press send, nothing happens apart from the form getting blank again.
Is there any error I'm not seeing in the code?
Many thanks!
| e3390b13a3fdea4c8bcaa098b664faf01c3bf4b97a70df681ac508e568d02545 | ['85e150c1a18644a8b569e82050641da1'] | In a django app I've created different models and everything looks okay until I try using data from two different models inside the same table.
To sum it up: in the homepage, I need to create a table that contains data from both the models, ordered by date.
The two models I need to display are the following.
models.py
class Document(models.Model):
number = models.CharField(max_length=10)
description = models.CharField(max_length=50)
assigned = models.BooleanField
validity_date = models.DateField
is_issued = models.BooleanField
class Program(models.Model):
name = models.CharField(max_length=25)
description = models.CharField(max_length=100)
validity_date = models.DateField
Then, I tried to create a view that would allow me to work with different models.
This is my view.py:
class BaseView(generic.ListView):
template_name = 'base/base_list.html'
context_object_name = 'base_list'
def get_queryset(self):
queryset = Document.objects.order_by('due_date')
return queryset
def get_context_data(self, **kwargs):
context = super(BaseView, self).get_context_data(**kwargs)
context['Programs'] = Program.objects.all()
context['Employees'] = Employee.objects.all()
return context
Now how can I create inside the template a table that shows both the models at once, ordering each entry by validity date (no matter if the entry belongs to Program or to Document)?
Thank you in advance!
|
99aa07194cd8f708d54df4533055b04b43e26b674e1f397e235688dff400133d | ['85f044b03c6e45028c6322ad73835e3c'] | Here is my function that I have written so far.
alreadyGuessed = []
def changeCharToUnderScore(eachLetter):
stringDisplay = ""
for x in eachLetter:
stringDisplay += x
stringDisplay += " "
print (stringDisplay)
print("Already guessed: " + ', '.join(alreadyGuessed))
When this prints my hangman array, it prints something like this
_ )
_ _)
_ _ _)
_ _ _ _)
_ _ _ _ _)
Instead of printing
_ _ _ _ _) I am using the ")" because the underscores by themselves change the formatting in here
I have tinkered with this and I can get it to print only one, but it prints the first letter and only that.
I understand I have some sort of logic error but I have had a really difficult time figuring out where I am going wrong here.
Here is my full hangman code currently, but it's a work in progress.
import time
from sys import stdout
import random as ran
wordList = ["potato", "tomato", "ramen", "moana", "disney", "veil", "space", "bowie", "russia", "chair", "couch", "glasses", "orange", "apple", "carrot", "bread", "head", "beer", "pasta", "soda", "pizza", "eggs", "noodle", "coffee", "soup", "feet", "hands", "ears", "hoodie", "pencil", "sorbet", "juice", "fan", "pan", "cup", "boba", "cheese", "chair", "purse", "knife", "spoon", "steak", "netflix", "lemon", "grape", "weed", "phone", "tire", "liar", "bench", "thirst"] # Dictionary
alreadyGuessed = [] # alpha characters already chosen
word = wordList[ran.randint(0, len(wordList) - 1)]
stringSplit = list(word) # Creates an array from the characters within the string.
stringInput = ["_"] * len(stringSplit)
def guessInput():
printWordHint = ("The word is " + str(len(word)) + " letters long.\n")
# Causes a delay inbetween each character being printed so that is creates the illusion of typing.
for char in printWordHint:
stdout.write(char)
stdout.flush()
time.sleep(0.03)
return input("Guess a letter!")
### Have had issues getting this loop to print only the final array
# Prints the guessed characters, without the array brackets.
def changeCharToUnderScore(eachLetter):
stringDisplay = ""
for x in eachLetter:
stringDisplay += x
stringDisplay += " "
print (stringDisplay)
print("Already guessed: " + ', '.join(alreadyGuessed))
#replace hidden character from "_" to the "alpha character".
def replaceUnderScore(split, userInp):
inputForGuess = guessInput()
alreadyGuessed.append(inputForGuess)
changedCharacter = True
for x in range(len(split)):
if inputForGuess == split[x]:
userInp[x] = stringSplit[x]
changedCharacter = False
return(userInp, changedCharacter)
# Starting Game and calling Functions
changeCharToUnderScore(stringInput)
amtOfWrongGuesses = 0
correctGuess = True
while(not("_" not in stringInput or amtOfWrongGuesses >= 7)):
stringInput, correctGuess = replaceUnderScore(stringSplit, stringInput)
if not correctGuess:
amtOfWrongGuesses += 1
print("Oh no, that is not in this word!")
changeCharToUnderScore(stringInput)
if(amtOfWrongGuesses >= 7):
print("Blast Off! You LOSE! \nThe correct word was " + word)
else:
print("Congratulations! You prevented the MoonMans death!")
# winningString = ("Congratulations! You prevented the MoonMans death!")
I'm also not sure how to get my game to loop, if they want to play again.
| 4f9f640fd6d41d6610a60e14aac5bfad73f863c9fdfb6303bc6564bdb6a0dcf8 | ['85f044b03c6e45028c6322ad73835e3c'] | So I'm trying to get my webpage to have a two tone look, one side plain and the other with a radial gradient.
I currently tried making it into an SVG and that failed horrible but I am not entirely sure how to get a triangle that goes from the top left, bottom left, and top right of the page, while also scaling to the browser size.
When I use the SVG as a background, there is a large white block around the top and bottom, and when I just simply don't use a background and just put in the svg code into the HTML it's so giant and I can't manage to get it to scale.
This photo was something I made in sketch but I am new to frontend and I've just had a rough time getting the angles color.
I can get everything else if I could just get the background to do that :c
|
59911c3733d3ef8be4781b4dd39352d1e26a15ce2f74a7bb0aef328602236440 | ['85f3d998a2a449afa5872ba07d1b0f2a'] | Please refer to example packet:
2010-08-22 21:35:<PHONE_NUMBER>:50:56:9c:69:38 (oui Unknown) > Broadcast,
ethertype Unknown (0xcafe), length 74
0x0000: 0200 000a ffff 0000 ffff 0c00 3c00 0000 ............<...
0x0010: 0000 0000 0100 0080 3e9e 2900 0000 0000 ........>.).....
0x0020: 0000 0000 ffff ffff ad00 996b <PHONE_NUMBER> ...........k...P
0x0030: 569c 6938 0000 0000 8e07 0000 V.i8........
| a237e5f293a32586b79d68413fce98e255acf9243ebcf5876e81df75352a30cf | ['85f3d998a2a449afa5872ba07d1b0f2a'] | To Enable the memory you can try out the below command directly.
setpci -s <BUS_ADDR> COMMAND=0x02
-s : Used for device selection
COMMAND : Asks for the word-sized command register, 0x02 is to enable memory
lspci Output :
0000:01:00.0 RAM memory: Xilinx Corporation Default PCIe endpoint ID
0001:02:00.0 Memory controller: Xilinx Corporation Device 8011
Example : setpci -s 0001:02:00.0 COMMAND=0x02
|
76e65f68473fda51a89c1674192f26f8a6db14d3117126285d2db84e9eda53bc | ['86000639e97a423e96413175e24685a8'] | I'm trying to display blog posts underneath the 'about us' paragraph on an about page by using the code below in a template part. However, it's only returning the title of the actual page and the date info as the date I've edited the page.
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<article class="post">
<header>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<div class="post-details">
<i class="fa fa-user"></i><?php the_author_posts_link(); ?>
<i class="fa fa-calendar"></i> <?php the_time( 'F jS, Y' ); ?>
<i class="fa fa-folder-open-o"></i> <a href=""><?php the_category( ', ' ); ?></a>
<i class="fa fa-comments"></i><a href=""><?php comments_popup_link( 'No Comments »', '1 Comment »', '% Comments »' ); ?></a>
</div><!-- post details -->
</header>
<div class="post-excerpt">
<p><?php the_excerpt(); ?> <a href="post.html">continue reading</a></p>
</div><!-- post-excerpt -->
<hr>
</article><!-- end article -->
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>
What code do I need to pull my actual blog posts into this section?
| b7a5c5a0b35cd9674a5d7da0046a533394a7760e56788850b7d08ca2a9904cee | ['86000639e97a423e96413175e24685a8'] | I've added anchor scrolling to my website, however because I've used anchors for elements in my carousel, every time I click on the carousel indicators, the page scrolls down a bit.
How can I disable those anchors from being included? This is my jquery:
$(document).ready(function(){$('a[href^="#"]').on("click",function(a){a.preventDefault();
var b=this.hash,c=$(b);
$("html,body").stop().animate({scrollTop:c.offset().top},900,"swing",function(){window.location.hash=b})})});
Appreciate your help.
|
b5dacd7fe024c7eb2ad3717b979a9747759ea5cc9696bd67a8400227279feb98 | ['8614849e183a4674a804e198ef4332e7'] | Всем привет. Подскажите пожалуйста, как изменить цвет в Qt QTableView для текущей позиции в таблице по нажатию на кнопку?
Задача такая:
Пользователь добавляет в таблицу запись и она выделена допустим жёлтым, администратор БД по нажатию на кнопку должен подтвердить, что запись корректна и изменить цвет на обычный.
Я реализовал создание и загрузку Бд, могу менять цвет по условию через кастомный делегат, но ещё сильно туплю и не могу понять как вывести изменение цвета на кнопку.
Также могу определить выбранную ячейку.
| bcf19bc1cf063f0dfd16c8d2386390dd5890ebcef3837d2da683de5db1069fcc | ['8614849e183a4674a804e198ef4332e7'] | Taking a look at the remainders of an integer $n\pmod{k}$, where $k$ ranges from $1$ to $n$, I noticed that it follows a pattern. It's probably already known but I couldn't find anything about it on internet so I thought it was worth sharing. The pattern follows like this:
Let $M$ denote the group of integers ranging from $1$ to $\sqrt{n}$, $M_{i}$ is the $ith$ element of this group (where $M_{1} = 1$); Let $Q_{i}$ denote the quotient of $n/M_{i}$. Then: $$n \equiv r\pmod{M_{i}},$$
and, for all integer values of $j$, ranging from $0$ to $(Q_i-Q_{(i+1)}-1)$, the following congruence holds:
$$n \equiv r+(j*i)\pmod{Q_{i}-j}$$
|
5648698f955b933a7530e5380f60a538707f9fbd2fe6823904c2ab4c58c9cf16 | ['862f3bd2ef064cf5b3c02c944c7d67eb'] | I have a listview that is populated via an adapter. I need one of the items (which are just bits of text) in the listview to have a different background compared to the others (to mark it as the currently selected one).
I have all of the background logic, I just need a way to say listview.setBackgroundById(int position)
or something like that.
How do I do this?
This needs to be as simple as possible, 'cause all of the other things done in the Activity are currently working perfectly. :)
As asked, this is my Adapter that I'm using:
public class SampleAdapter extends ArrayAdapter<SampleItem> {
private String title;
public SampleAdapter(Context context) {
super(context, 0);
}
public View getView(final int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.row_station, null);
}
TextView title = (TextView)convertView.findViewById(R.id.station_name);
font.setFont(title, 2, getActivity());
title.setText(getItem(position).title);
RelativeLayout info = (RelativeLayout)convertView.findViewById(R.id.info_relative_button);
info.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
MainActivity.setCurrentTab(41);
MainActivity.setBackDisabled(true);
Log.e("current tab:",String.valueOf(MainActivity.getCurrentTab()));
Fragment fragment = new StationInfo();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
UserManager.getInstance().setStationId(getItem(position).id);
}
});
return convertView;
}
}
The SampleItem has 2 String fields, title and id, it's very simple.
| e158ef03437737adf94df5f70a96e3a23c8b7c3bbd43b030dc694a39478cc3b6 | ['862f3bd2ef064cf5b3c02c944c7d67eb'] | I have an activity that on click of a button contacts the server, waits for the response and then changes to a different activity according to the response. I have that covered, but the waiting time is a bit long, so I want to have a way to tell the user that his info is being processed and that the app is not stuck, but that it's working. I was thinking of making a spinning circle appear to indicate work is being done. How do I make this happen on click? :)
(I didn't include any code, because it's mostly irrelevant, everything I have so far is working, I just need to add this small feature)
|
7b82e564b94ef377caf5e29efa62eb7acfa6e7134352d6f3e8d92d8236410585 | ['863155cbcd2e45788a7124004f1f3064'] | I'm using VS and SQL Server. I have problem with query:
SELECT *
FROM dbo.ul_dok
WHERE (dok_id_fk = @dok_id_fk)
When I run query in SQL Server, everything is working great, window pops to ask me for dok_id_fk, and I insert it manually.
I have entered this code in c#:
conn.Open();
cmd = new SqlCommand("select ul_dok_id, ul_dok_dat, dok_id_fk, fil_model_no_fk, kol_ul_dok " +
" from ul_dok where dok_id_fk = @dok_id_fk", conn);
cmd.Parameters.AddWithValue("@dok_id_fk", txt_Dokument.Text);
cmd.ExecuteNonQuery();
grb_Stavke_Dok.Show();
conn.Close();
Everything else is working, I just can't show product items of the invoice document.
Have set on Invoice DataGridView that when I click on cell to load ID of the invoice to TextBox (txt_Dokument), and then re-use it in the query that is listing products with the same Invoice ID.
If this isn't enough info, pls tell me to provide more. At the moment I cant be more specific about my problem.
| 66ab4acdb95298dfb1d9869ffd9620ef847e84d3f158d5cfede728d39b3c8ad8 | ['863155cbcd2e45788a7124004f1f3064'] | This was a solution to my problem, and here is the code.
private void DisplayData_Sa_istom_Sifrom()
{
conn.Open();
DataTable dt_Stavke = new DataTable();
da = new SqlDataAdapter("select ul_dok_dat as [Datum], fil_model_no_fk as [Oznaka filtera], kol_ul_dok as [Kolicina] " +
" from ul_dok where dok_id_fk = @dok_id_fk", conn);
da.SelectCommand.Parameters.AddWithValue("@dok_id_fk", txt_Dokument.Text);
da.SelectCommand.ExecuteScalar();
da.Fill(dt_Stavke);
dgv_stavke.DataSource = dt_Stavke;
conn.Close();
}
|
b947d100ea329fa615d9aa99fca3c05d6dea5fdec890b2da4f72fb3d2bb26c7f | ['8634ae85946a44ae8209cacbde1eaef7'] | This is the Java EE7 @Startup annotation for reference. I am using the latest GlassFish server and IntelliJ to run the server.
I need to instantiate this service so that it can send packets of data periodically to a websocket for processing, but the fact that I use
session.getBasicRemote().sendObject(message);
in the end forces me to throw IOException and EncodeException.
This is bad as @Startup or @Singleton disallows usage of Exceptions when instantiating:
war exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while deploying the app [keyBoard_war_exploded] : The lifecycle method [printSchedule] must not throw a checked exception.
Here is my code:
package site.xxxx.models;
import site.xxxx.message.Message;
import site.xxxx.message.TextMessage;
import site.xxxx.modules.Packet;
import site.xxxx.websocket.MainServerEndpoint;
import javax.annotation.PostConstruct;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.json.Json;
import javax.json.JsonObject;
import javax.websocket.EncodeException;
import javax.websocket.Session;
import java.io.IOException;
import java.util.Set;
@Startup
@Singleton
public class Service {
private static Service service;
Set<Session> peers = MainServerEndpoint.peers;
@PostConstruct
public void mainLoop() throws IOException, EncodeException, InterruptedException {
sendSpamPacket();
}
private void sendSpamPacket() throws IOException, EncodeException {
JsonObject ret = Json.createObjectBuilder()
.add("type", "textMessage")
.add("text", "ayyyy")
.build();
Packet packet = new Packet(new TextMessage(ret));
MainServerEndpoint.sendPacket(packet);
//results in calling session.getBasicRemote().sendObject(message);
}
}
| 8d6e12df3187246415a9e05a03e8f9ef6dc626692a1c12949f5149eb8da53989 | ['8634ae85946a44ae8209cacbde1eaef7'] | IntelliJ is acting odd with its redeployment settings.
In the "updating applications" tab it has on the bottom for debugging:
,
I have tried to use all of the update options in order to update my application (update classes, update classes resources, restart), and NONE work to update my server. I have even closed and rebooted IntelliJ and the updates still don't appear.
The update is a simple alert message that is triggered when the index.html is loaded. It works when I load the html manually, but when I run the server, it does not alert, meaning it is still using a previous iteration of my server? This is really frustrating as I can't see any of my changes and don't know how to fix my server.
I am using the latest Glassfish server and latest IntelliJ IDE. It does update my resources EVENTUALLY, but not through some defined pattern as far as I can tell.
|
611dd5f49ca5e9a4383f81a9105bd8a6e505773b2c133de070fcc5c462d5f6da | ['8645e2425432457ea71307354cbcbb6b'] | I have a dataframe which contain a column 'trade_dt' like this
2009/12/1
2009/12/2
2009/12/3
2009/12/4
I got this problem
benchmark['trade_dt'] = pd.to_datetime(benchmark['trade_dt'], format='%Y-&m-%d')
ValueError: time data '2009/12/1' does not match format '%Y-&m-%d' (match)
how to solve it? Thanks~
| c9bed6f9b37f102b617cd5f4fb33c04b5bc91c0c8456b6544cec3186129e2e89 | ['8645e2425432457ea71307354cbcbb6b'] | When I use groupby().apply() function to calculate some data like wighted average. I found that the first group is always calculated twice. For example:
def test(dataframe):
df = dataframe.copy()
a = df['a'].iloc[0]
b = df['b'].mean()
result.append([a,b])
df = pd.DataFrame({'a':[1,1,1,2,2,2,2,3,3,3],'b':[1,2,3,4,5,6,7,8,9,10]})
df.groupby('a').apply(test)
result = pd.DataFrame(result, columns=['a', 'b'])
then I get:
As you can see, the first group is calculated twice. I don't know why.
|
8bbb9740f42087f535d7a56566cf1d615254ca433a911cd49608d248a740b6ff | ['865c24dbe51246e58c858ee272870675'] | I Have a function that i want to use it in web-service ... for wsdl and nusoap
another users that connect to me with php havent any problem on nusoap .but whos connect me with asp can add my web-service and see my 2 classes for example enqueue and get credit but cant work with this 2 method ... i didnt work with asp.....
here is my functions and my web-service how i change this files to whos work with asp can connect to me and where is the problem
here is my index.php
<?php header('Content-Type: text/xml');
require(dirname(__FILE__).'/gw.interface.php');
$server = new SoapServer('gw.wsdl', array('uri' => 'uri:SMSServer','encoding'=>'UTF-8'));
$server->setClass("gwi");
$server->handle();
// i think here i must register my functions??
?>
and here is my functions in gw.interface.php
public static function getstatus(&$batchid, &$unique_id)
{
$uname = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];
if(!isset($_SERVER['PHP_AUTH_USER']) || !<IP_ADDRESS>exists('`users`', '`uname`="'.$uname.'" AND `upass`="'.$pass.'"'))
{
return array('state' => 'error', 'message' => 'Username or/and Password doesnt match.', 'errnum' => '102', 'cost' => '-1', 'msgid' => '-1');
}
$number = sms_send<IP_ADDRESS>number_info($uname, $from);
<IP_ADDRESS>update('`users`', '`sents`=`sents`+1', '`uname`="'.$uname.'"');
$gate = SMSGate($number['gateway'], $number['gwuname'], $number['gwpass'], $number['company']);
$sents = sms_send<IP_ADDRESS>get_sents($msg_id);
if($sents[0]['state'] == 'working')
{
return array('state' => 'error', 'message' => 'Message is still in sending procces, try after the proccess is done.', 'errnum' => '107', 'rcpts' => array());
}
$sent_rcpts = sms_send<IP_ADDRESS>get_sent_rcpts($msg_id, $sents[0]['batchid']);
return array('state' => 'done', 'message' => 'Each recieptor\'s state fetched successfully.', 'errnum' => '100', 'rcpts' => $sent_rcpts);
}
| 5b4d6233c34072da47a0a5c1133730725465b2f9c2704ef3e8e1c65058f0a07e | ['865c24dbe51246e58c858ee272870675'] | I have an agent i defined a job for that php agent file .but if second agent run after 1 minutes and previous agent work not finished yet .its make a problem .....
i want to flag selected rows in every agent that if another agent runs new query they haven't interference
how i change this query is the best way is make a field in that table for selected or not ?and update that field ?
<IP_ADDRESS>query("SELECT 1000 FROM web-service WHERE `state`= 1 AND `fetch_id`="fetchid" ")//
1-state = 1 is condition for my products
2-i use fetch id to imputation id to each agent what is the best way ?
|
3bd4b2a61869794438c9c14eec03c4b79af18583c227bda525936d9a189b2a7c | ['8660f994952b45ffa0e7f5accfdcc04c'] | The texnical perspective aside, I wonder if you should do that. IIRC, print vs online counts as different editions and should therefore probably be cited separatedly. While kind of a nuisande, it *can* be important if e.g. page numbers differ, or the electronic version receives an update without a new printing (would it get a new ISBN?). That is, it may be important which version you cite. | 593b15b054f011c6ca2b52e1fda112e49360cea26d187d0530c76409502f8949 | ['8660f994952b45ffa0e7f5accfdcc04c'] | I'm apparently too dumb for `sed`, but in Ruby it would be `text.gsub(/\{\\defun\s+([^\}]*)\}/, "{\\defun{\\1}}")`; see [here](http://ideone.com/NrisQT). Of course, you will never be able to catch all (La)TeX intricacies with a single (readable) regexp (which is one indicator that (La)TeX sucks as a programming language) but if the original author adhered to *some* coding standard, you'll need only a few runs to get most things right. It definitely beats loading even more wicked (La)TeX on top. |
f7ece55dacfe1b5482c468e33649cb2957c462ec93f5503fd6b8ebcfb97dff35 | ['86664e449ab64a89bf602fcdf434c8cf'] | I am trying to use a UIAlertView essentially as a label (no title or buttons, just display text) for aesthetic purposes. I want to be able to continue to use everything else in the app (touch other buttons, etc.) while the alert view is being shown. Unfortunately, I cannot seem to invoke touchesBegan or a selector using a UITapGestureRecognizer while the alert view is shown. These both work when the alert view is not shown, but it seems like the alert view disables detection of any touches (other than touching its own buttons if it had them).
Does anyone know a way I could work around this? Even if I was to create a UILabel and set its background to the alert view image that would work.
Thanks for your help.
| 3bac139affbd6789d27a0045fe7cf308e165cdc74fb22162d88d0487e2eb4f5f | ['86664e449ab64a89bf602fcdf434c8cf'] | This is actually the most time saving and useful thing to know here, and in my view is THE ONLY REASON why expose is not complete junkware. I can't believe I've been using a mac for 4 years and this has not come up. I can move my finger 1cm and solve the problem? Conversation closed (for me). |
063c171b49cce666790cf547cbb2f2fc9e8cb4f81932864b51a865c35fae1732 | ['867241ce7aee4cceab8aeb9fea30323e'] | Biggest issue with WPF is that the toolset is lame and learning curve is huge. So far uptake on WPF has been very low mostly because of the issues I just mentioned. According to Microsoft WPF is the future and they have invested heavily in it. Infact next version of Visual Studio is written in WPF (http://www.onedotnetway.com/writing-visual-studio-2010-shell-in-wpf-reflects-confidence/)
However it still remains to be seen if WPF will ever become mainstream. The framework is awesome and it can do really cool stuff mostly related to eye-candy. Microsoft calls it UX but in plain English it is eye-candy. Most of the applications don't need it.
| 1679006c10b262dcf951d84579c7fb762e8ad242e649128de0f998d913709a65 | ['867241ce7aee4cceab8aeb9fea30323e'] | For example, one can apply $\cos x$ to number $a$ one time to get $\cos a$, two times $\cos \cos a$, three times $\cos \cos \cos a$, and so on. Is there a way to define fractional application for $\cos$? Or for any other function? Maybe exists general theory for that?
|
4c5375d2b3e8bb1fd2972874a935f7bc7065f1cdc79a2af59faafd24856a1144 | ['868fb071593d414cbcd9ab883db4ac45'] | I'm currently working on a Xamarin MvvmCross ios app. I have it set to display a UIAlertView popup to inform the user when their internet is disabled (the app requires an internet connection).
The problem is that when this popup shows, the user can't swipe up the Control Center to activate their internet...
var dlg = new UIAlertView(config.Title ?? String.Empty, config.Message, null, config.CancelText, config.OkText);
dlg.Clicked += (s, e) =>
{
var ok = (dlg.CancelButtonIndex != e.ButtonIndex);
_activeDialog.DismissAlertDialog();
config.OnConfirm(ok);
};
dlg.Show();
They then have to either click OK and race the popup reappearing, or home the app, reactivate internet, then come back to the app...
Anyone any suggestions?
| 8a81de8b24dc5298234eddf3f4b0bd2c7125343e108ce192ea39cf3eb924256d | ['868fb071593d414cbcd9ab883db4ac45'] | I made this helper class in C# (Xamarin) to programmatically set the text property. It which works pretty well for me:
internal static class FontAwesomeManager
{
private static readonly Typeface AwesomeFont = Typeface.CreateFromAsset(App.Application.Context.Assets, "FontAwesome.ttf");
private static readonly Dictionary<FontAwesomeIcon, string> IconMap = new Dictionary<FontAwesomeIcon, string>
{
{FontAwesomeIcon.Bars, "\uf0c9"},
{FontAwesomeIcon.Calendar, "\uf073"},
{FontAwesomeIcon.Child, "\uf1ae"},
{FontAwesomeIcon.Cog, "\uf013"},
{FontAwesomeIcon.Eye, "\uf06e"},
{FontAwesomeIcon.Filter, "\uf0b0"},
{FontAwesomeIcon.Link, "\uf0c1"},
{FontAwesomeIcon.ListOrderedList, "\uf0cb"},
{FontAwesomeIcon.PencilSquareOutline, "\uf044"},
{FontAwesomeIcon.Picture, "\uf03e"},
{FontAwesomeIcon.PlayCircleOutline, "\uf01d"},
{FontAwesomeIcon.SignOut, "\uf08b"},
{FontAwesomeIcon.Sliders, "\uf1de"}
};
public static void Awesomify(this TextView view, FontAwesomeIcon icon)
{
var iconString = IconMap[icon];
view.Text = iconString;
view.SetTypeface(AwesomeFont, TypefaceStyle.Normal);
}
}
enum FontAwesomeIcon
{
Bars,
Calendar,
Child,
Cog,
Eye,
Filter,
Link,
ListOrderedList,
PencilSquareOutline,
Picture,
PlayCircleOutline,
SignOut,
Sliders
}
Should be easy enough to convert to Java, I think. Hope it helps someone!
|
e78f101f34d95a54d8d6b7fe21570cc664b8238fdc14a58bf1a5e7ef1a5524ae | ['869e0c94e82d4bbfbb4d1301d34ef473'] | I would like to display the data I get from a search, personalized for my taste. At this moment, It is just plain text.
For example, I am searching for "Titanic", and I get the name, a few links, and some information from IMDB.
I have the following code:
search.html
<!DOCTYPE HTML>
<html xmlns:th="https://www.thymeleaf.org">
<head>
<title>Getting Started: Handling Form Submission</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>Form</h1>
<form action="#" th:action="@{/search}" th:object="${search}" method="post">
<p>Message: <input type="text" th:field="*{content}" /></p>
<p><input type="submit" value="Submit" /> <input type="reset" value="Reset" /></p>
</form>
</body>
</html>
result.html
<!DOCTYPE HTML>
<html xmlns:th="https://www.thymeleaf.org">
<head>
<title>Getting Started: Handling Form Submission</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<h1>Result</h1>
<p th:text="'content: ' + ${main.content}"></p>
<a href="/search">Submit another message</a>
</body>
</html>
SearchController.java
@Controller
public class SearchController {
@GetMapping("/search")
public String greetingForm(Model model) {
model.addAttribute("search", new Main());
model.addAttribute("main", new Main().getContent());
return "search";
}
@PostMapping("/search")
public String greetingSubmit(@ModelAttribute Main main) {
return "result";
}
}
and Main.java
private String content;
private List<Result> finalList;
private List<Result> resultList;
public void setContent(String content) throws IOException {
//code to compute finalList
}
public List<Result> getContent() {
return this.finalList;
}
The main problem is that I have no ideea where to being with. finalList is a list of objects of type "Result", which have fields such as
private List<String> link = new ArrayList<>();
private String name;
private TitleProp titleProp;
and TitleProp has
private String trailer;
private String rating;
private String description;
private String genre;
I would like to manipulate each field to show it on a different way, such as a table with more rows, etc.
Any link or sample of code would help me a lot to understand Thymeleaf and Spring Boot more.
| 844fbd26264f75c59b08d0cf005a384981621f111e59cbc1db67375b74a627ab | ['869e0c94e82d4bbfbb4d1301d34ef473'] | I am coming with an answer to my question. I managed to get the result I wanted using Ajax, as SnakeDoc suggested. It was a long road, mostly because even if I had a working code, I spent a few hours searching for the Forbidden 403 error on ajax post request.
So, for the js part:
function ajaxPost() {
// Here we prepare data for the JSON
var formData = {
moviename: $("#moviename").val()
}
$.ajax({
type: "POST",
contentType: "application/json",
url: "MYURL",
data: JSON.stringify(formData),
dataType: 'json',
success: function (result) {
{
$.each(result,
function (i, title) {
// do whatever you want with what you got from the server
});
console.log("Success: ", result);
}
console.log(result);
},
error: function (e) {
console.log("ERROR: ", e);
}
});
}
If this seems confusing, I access the fields you can see in my question by
title.name, title.link, title.titleProp.description, etc, inside function (i, title)'s body.
For the HTML,
<label for="moviename" style="margin-right:5px">Title:</label>
<input type="text" class="form-control" id="moviename" placeholder="Enter a title"/>
Where moviename is the variable name you get from the input.
Now, on the backend, we have to configure our path
@PostMapping("/MYURL")
public ResponseEntity<Object> addSearch(@RequestBody SearchCriteria searchCriteria)
throws IOException {
// do whatever you want to get a result. I used a custom class "SearchCriteria"
// which has a getter and a setter for the field
// **private String moviename;**
return ResponseEntity.ok(THIS GETS SENT TO AJAX);
}
The main problem was that I have web.security, and you have two choices. First one, you disabling csrf. You have to add this line to your security config.
http.csrf().disable();
in protected void configure(HttpSecurity http) method.
Or, you add csrf to the ajax request. More info on this topic was discussed here
|
488de86989b0955537a43ca5b7c3982c3a54c98ddfa97963462053a715b1af40 | ['86a0d454b83641f298383f5dfbf62e05'] | I am using this liabray for swipe gestures. https://github.com/nikhilpanju/RecyclerViewEnhanced.
Activity:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_panel);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
unclickableRows = new ArrayList<>();
unswipeableRows = new ArrayList<>();
dialogItems = new String[25];
for (int i = 0; i < 25; i++) {
dialogItems[i] = String.valueOf(i + 1);
}
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
mAdapter = new MainAdapter(this, getData());
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.setLayoutManager(new LinearLayoutManager(this));
onTouchListener = new RecyclerTouchListener(this, mRecyclerView);
onTouchListener
.setIndependentViews(R.id.rowButton)
.setViewsToFade(R.id.rowButton)
.setClickable(new RecyclerTouchListener.OnRowClickListener() {
@Override
public void onRowClicked(int position) {
util.shortToast(getApplicationContext(), "Row " + (position + 1) + " clicked!");
}
@Override
public void onIndependentViewClicked(int independentViewID, int position) {
util.shortToast(getApplicationContext(), "Button in row " + (position + 1) + " clicked!");
}
})
.setSwipeOptionViews(R.id.add, R.id.edit, R.id.change)
.setSwipeable(R.id.rowFG, R.id.rowBG, new RecyclerTouchListener.OnSwipeOptionsClickListener() {
@Override
public void onSwipeOptionClicked(int viewID, int position) {
String message = "";
if (viewID == R.id.add) {
message += "Add";
} else if (viewID == R.id.edit) {
message += "Edit";
} else if (viewID == R.id.change) {
message += "Change";
}
message += " clicked for row " + (position + 1);
util.shortToast(getApplicationContext(), message);
}
});
mRecyclerView.addOnItemTouchListener(onTouchListener);
In below code, i want to hide a Relativelayout when in onSwipeOptionclicked() function the viewID == R.id.add. I modified code to get reference but don't know what to do next.
.setSwipeOptionViews(R.id.add, R.id.edit, R.id.change)
.setSwipeable(R.id.rowFG, R.id.rowBG, new RecyclerTouchListener.OnSwipeOptionsClickListener() {
@Override
public void onSwipeOptionClicked(int viewID, int position) {
if (viewID == R.id.add) {
}
}
});
Modified code:
.setSwipeOptionViews(R.id.add, R.id.edit, R.id.change)
.setSwipeable(R.id.rowFG, R.id.rowBG, new RecyclerTouchListener.OnSwipeOptionsClickListener() {
@Override
public void onSwipeOptionClicked(int viewID, int position) {
if (viewID == R.id.add) {
RelativeLayout username = (RelativeLayout) view.findViewById(R.id.add);
}
}
});
Relativelayout XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/rowBG"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:orientation="horizontal">
<RelativeLayout
android:id="@+id/add"
android:layout_width="@dimen/swipeWidth"
android:layout_height="match_parent"
android:background="@color/swipeoption_blue"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="?android:selectableItemBackground"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/ic_add_black_24dp"
android:tint="@android:color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="Add"
android:textColor="@android:color/white"
android:textSize="12sp"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/edit"
android:layout_width="@dimen/swipeWidth"
android:layout_height="match_parent"
android:background="@color/swipeoption_green"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="?android:selectableItemBackground"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/ic_mode_edit_black_24dp"
android:tint="@android:color/white"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="Edit"
android:textColor="@android:color/white"
android:textSize="12sp"/>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/delete"
android:layout_width="@dimen/swipeWidth"
android:layout_height="match_parent"
android:background="@color/swipeoption_purple"
android:clickable="true"
android:focusable="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="?android:selectableItemBackground"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:tint="@android:color/white"
app:srcCompat="@drawable/ic_build_black_24dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:id="@+id/delete_user"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="4dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:text="Delete"
android:textColor="@android:color/white"
android:textSize="12sp"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/rowFG"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:clickable="true"
android:elevation="4dp"
android:focusable="true"
android:orientation="horizontal"
android:visibility="visible">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:orientation="horizontal"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingTop="16dp">
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight="6"
android:orientation="vertical">
<TextView
android:id="@+id/mainText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxLines="1"
android:text="No Calls Found"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Row 1"/>
<TextView
android:id="@+id/subText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:maxLines="1"
tools:text="Some text ..."/>
</LinearLayout>
<Button
android:id="@+id/rowButton"
style="?attr/buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|center_vertical"
android:gravity="right|center_vertical"
android:text="Button"/>
</LinearLayout>
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="#67676767"
android:elevation="5dp"/>
</RelativeLayout>
| bc582a704f20c144d71219dd6a43a35c8e8d770a7bffec00a5998e98bf58d4c9 | ['86a0d454b83641f298383f5dfbf62e05'] | I want to enable broadcast for incoming messages just for which contacts are saved in my mobile. I retrieved all contacts number using this code.
// Search Number from phone book
public String getContactsPhoneNumber(Context context, String originatingAddress) {
ContentResolver cr = context.getContentResolver();
Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, Uri.encode(originatingAddress));
Cursor cursor = cr.query(uri, new String[]{ContactsContract.PhoneLookup.NUMBER}, null, null, null);
if (cursor == null) {
return null;
}
String phoneNumber = null;
if (cursor.moveToFirst()) {
phoneNumber = cursor.getString(cursor.getColumnIndex(ContactsContract.PhoneLookup.NUMBER));
}
if (cursor != null && !cursor.isClosed()) {
cursor.close();
}
return phoneNumber;
}
The BroadcastReciever class is:
public class IncomingSms extends BroadcastReceiver {
static String messageString = "";
Blocklist blocklist = new Blocklist();
@Override
public void onReceive(Context context, Intent intent) {
ComponentName receiver = new ComponentName(context, IncomingSms.class);
PackageManager pm = context.getPackageManager();
boolean checks = false;
SmsManager smsManager = SmsManager.getDefault(); // get object and subscription id of SmsManager
Bundle bundle = intent.getExtras(); //get data from incoming Broadcast
try {
if (bundle != null) {
final Object[] pdusObj = (Object[]) bundle.get("pdus"); //get pdus messages from bundle, cast it to an Object[]
for (int i = 0; i < pdusObj.length; i++) {
SmsMessage currentMessage = SmsMessage.createFromPdu((byte[]) pdusObj[i]); //create message from pdu object
// get message contents from incoming message
String originatingAddress = currentMessage.getOriginatingAddress();
String messageBody = currentMessage.getMessageBody();
long timestampMillis = currentMessage.getTimestampMillis();
Log.i("SmsReceive", "Sender number: " + originatingAddress + ";message: " + messageBody + " time" + String.valueOf(timestampMillis)); // log all result
Kindly tell me how to do this.
Note: Permission granted on AndroidManifest file for broadcast.
|
7c68567fa8da7c998a0d66587f210fd9c012d33d5b14b10fadbb6f1cffde5712 | ['86a52635534743b585211d6a8944a9a8'] | I have an array of sorted numbers from 001 to 999, and there is an unknown value x that I am trying to find within these numbers, and when the number is found, the algorithm will stop and return the number. I realize that I could use linear search or binary search to achieve this, but I would like to use Jump Search instead. Is there a way to do a jump search to find an unknown value, rather than a known value?
Thanks!
note: I'm trying to do this in JavaScript.
| dd368cb10e6bb8d39202c9441d0b5688949224ec760024163c9004b7116f6d23 | ['86a52635534743b585211d6a8944a9a8'] | You need to change pElem.className = '' to pElem.classList = ''.
var selectElem = document.getElementById('select')
var pElem = document.getElementById('one')
// When a new <option> is selected
selectElem.addEventListener('change', function() {
//get value text
var colorValue= document.getElementById('select').options[document.getElementById('select').selectedIndex].text;
pElem.classList = '';
// Add that class to the <p>
pElem.classList.add(colorValue);
})
.weiss {fill: white;}
.grün {fill: green;}
.gelb {fill: yellow;}
.blau {fill: blue;}
.rot {fill: red;}
.pink {fill: pink;}
<svg id="one" width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="black" stroke-width="2" />
</svg>
<p id="p">Element</p>
<select id="select">
<option selected>grün</option>
<option>gelb</option>
<option>blau</option>
<option>rot</option>
<option>pink</option>
</select>
This should fix your problem.
Links: className docs, classList docs
Related tags: css, html, classname
|
d45cfb08d8d4a2f4211aaa346dd5b0dd2616c121ecd82c12a472b687fbfeec28 | ['86c38a42e0f14adeaa97ae76c94cf977'] | I have a time-consuming operation to modify the database which is triggered by request the route,So I want to perform the operation asynchronously without waiting for it to end,and return the state directly. I tried to use threading module in the route,but got this error:
The following is the code:
define a model:
class Plan(db.Model):
__tablename__ = 'opt_version_plans'
planid = db.Column(db.Integer,primary_key=True)
planname = db.Column(db.String(255))
jobname = db.Column(db.String(255))
branch = db.Column(db.String(32))
define function:
def test():
time.sleep(20)
p = Plan.query.get(1)
print p.planname
route:
@app.route('/')
def index():
t = threading.Thread(target=test)
t.start()
return "helloworld"
How can I achieve my needs in this way?
| 295dd3c99b198ec159ceafa0df116e164655a466a3376eb63878259f18986bc6 | ['86c38a42e0f14adeaa97ae76c94cf977'] | Here is the official document about constantly print out the position of the mouse cursor:
import pyautogui, sys
print('Press Ctrl-C to quit.')
try:
while True:
x, y = pyautogui.position()
positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
print(positionStr, end='')
print('\b' * len(positionStr), end='', flush=True)
except KeyboardInterrupt:
print('\n')
Here is mine which get the incorrect result:
import pyautogui
try:
while True:
x, y = pyautogui.position()
print(f'X: {x} Y: {y}', end='')
print('\r', end='', flush=True)
except KeyboardInterrupt:
print('\n')
My Screen resolution is (1920, 1080), with my code ,I may get the mouse cursor coordinate like (X: 498 Y: 93150).
Why this happended? and why should I use rjust()?
|
fc0bc96e3404284985ddf94f2a6d724e9f2e89b44e013961da395e65107d237c | ['86c572b28f8240749e7311579c8916d3'] | You don't need to make a docker-compose.yml file, but it certainly will make your life easier if you have one, because then you can just run docker-compose up every time to run the container instead of having to run
docker run -p 3000:3000 admin-web:v1
every time you want to start your applicaton.
Btw here is one of the ultimate docker cheatsheets that I got from a friend, might help you: https://gist.github.com/ruanbekker/4e8e4ca9b82b103973eaaea4ac81aa5f
| cb889c1b3db75cd4f1d406c5ca65861a9c6c1c025d100288c312a43b44c8f3e0 | ['86c572b28f8240749e7311579c8916d3'] | Are you doing this in docker by any chance?
I sometimes have to restart the docker service on Mac when I get these kind of networking issues.
I did a check and everything looks fine at: https://www.ssllabs.com/ssltest/analyze.html?d=pypi.python.org
Is your time set properly on your machine? These kind of errors can occur if the system time is out of sync.
|
ba8a58a82aa770e335c7b61762d50723f83b35d15856cd2b7e3da5c450fa56c2 | ['86e61da514124c5fb0a801983ae258f6'] | I have a XML input
<field>
<name>id</name>
<dataType>string</dataType>
<maxlength>42</maxlength>
<required>false</required>
</field>
I am looking for a library or a tool which will take an XML instance document and output a corresponding XSD schema.
I am looking for some java library with which I can generate a XSD for the above XML structure
| 6219f31c8fd2af1aa271c34f475292a8e13489f3718201a2260f5f006764ff70 | ['86e61da514124c5fb0a801983ae258f6'] | I want to generate the following XSD Schema using JAXB and ObjectFactory class of org/w3/_2001/xmlschema
<xs:element name="result">
<xs:complexType>
<xs:sequence>
<xs:element name="sfobject" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="type"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
But I am getting XSD as :
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="result">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element name="sfobject" maxOccurs="unbounded" minOccurs="0">
<xs:complexType>
<xs:sequence/>
</xs:complexType>
</xs:element>
<xs:element type="xs:string" name="id"/>
<xs:element type="xs:string" name="type"/>
</xs:schema>
I am not able to add one element inside other element. How do I do that in Java using JAXB and ObjectFactory methods.
Sample Code:
List schemaElementList = schema.getSimpleTypeOrComplexTypeOrGroup();
TopLevelElement resultElement = xsdObjFactory.createTopLevelElement();
resultElement.setName("result");
LocalComplexType resultCompType = xsdObjFactory.createLocalComplexType();
resultElement.setComplexType(resultCompType);
resultCompType.setSequence(expGroup);
Element sfElement = (Element)xsdObjFactory.createLocalElement();
sfElement.setName("sfobject");
sfElement.setMaxOccurs("unbounded");
sfElement.setMinOccurs(new BigInteger("0"));
LocalComplexType sfCompType = xsdObjFactory.createLocalComplexType();
sfElement.setComplexType(sfCompType);
schemaElementList.add(resultElement);
|
c3cf8a6e4b0e23aab0dbded0a9db2412878b33b4f5e4565fe0afffd80332fe95 | ['86f9e51a8c87410a9fbf7cfa796771b8'] | MS-ADAL is using to get authenticate a particular user , plugin will return a token after successful authentication.
We can authenticate the user in active directory against office 365 products like yammer or our custom API's which are hosted in cloud.
Either you can make a graph API call separately or use some tool to extract the claims from token .
| 8950a83a0d426c129abefac709df9c63f3289ca4f3805293b7dafc664e0822cf | ['86f9e51a8c87410a9fbf7cfa796771b8'] | Windows mobile multitasking is not working perfectly in CF 3.5. When I run Multitask, remaining functions are not working perfectly.Here is my code
Thread internetStatusDisplayThread = new Thread(startInternetCheck);
internetStatusDisplayThread.Start();
private void startInternetCheck()
{
while(isTreadRunning)
{
bool internetAvailable = new SecurityManager().IsInternetIsAvailable();
if (internetAvailable)
{
this.Invoke(controlUpdator, noInternetImage, false);
}
else
{
this.Invoke(controlUpdator, noInternetImage, true);
}
internetStatusDisplayThread.IsBackground = true;
internetStatusDisplayThread.Priority = ThreadPriority.Lowest;
Thread.Sleep(5000);
}
}
private delegate void InternetStausUpdator(Control uiControl, bool status );
|
9a0696039f500a54e1519e9bc75c4f5c303b58ce3216417c317c90203e5cadcd | ['870f1a0acd5541d7a3172c06e74d0088'] | Im sorry for the wrong answer. Indeed, in estimating $\sum M(y)$ we have to use a lemma which states that for any given $p>1 $ there exists a positive constant $b$ such that $\sum_{n\leq x^{1/p } } x/n^p \exp(-c \sqrt{\log x/n^p}) \ll x\exp(-b\sqrt{ \log x} )$. Note that the product term on the second equality is sufficient to use this statement twice. | b337eef1f38f2cd63ffba8c76f4deaf7a9ea30f55c9413c244ada055124b104b | ['870f1a0acd5541d7a3172c06e74d0088'] | $ \ \ $ I want to ask an estimation of $\sum_{1 \leq n\leq x} \mu(n)n^{-1}$. According to a paper: http://arxiv.org/pdf/0908.4323v5.pdf of <PERSON> (See the theorem 1.3 on page 4 if you want), for an arbitrary set $\mathcal{P}$ which consists of primes (finite of infinite),
$$ \sum_{n \in \mathcal{P} \atop n\leq x}\frac{\mu(n)}{n}=\bigg(\prod_{p \in \mathcal{P}}1-\frac{1}{p}\bigg)+o(1),$$
where the part of small-o depends on the set $\mathcal{P}$. But the part of product be $0$ when $card (\mathcal{P})=\infty$, so the equation depends on the part of small-o.
$ \ \ $ Then, if we choose the set as the set of the primes,
\begin{align} \sum_{n \in \mathcal{P} \atop n\leq x}\frac{\mu(n)}{n}&=c_1\bigg(\prod_{p \leq x}1-\frac{1}{p}\bigg) \ \ \ ? \\
\text{i,e.}\\
&=\frac{c_2}{\log x}+o\Big(\frac{1}{\log x} \Big) \ \ ? \ \ (\text{for some constant $c_1, c_2$.})
\end{align}
|
e52bb243e942e96be5d29f06162c1c983e4620edf80a58cc6d4412c1757e7f4e | ['8712586bc1834b60a2c2380fed67a8ec'] | Thanks, this seems to match my observations - I tried to apply some lube in the meantime, and as I was trying to work it in, I noticed that it was only stiff sometimes - when it was perfectly straight, it had no problem moving. So apparently the new joint just has a lower tolerance for sideways flex. | c8e9f5060c31dd146ad96874f79cbc9ec81d6587d2ee09a1a66e48f699d77a67 | ['8712586bc1834b60a2c2380fed67a8ec'] | Yah it's misfiring 50 misfires in the first 5 min but after that Everytime it will run just fine I can check the codes it has when I'm out driving it and it only shows one code and that's fuel trim is lean. It runs perfect no hesitation no stamor it's perfect. |
18e3a49b618222c71d233bcfa3ece8ff8a774c16cefa5afd2dfcc760491a7aa4 | ['872f33734dc842bab2d5fffbf6b4bad4'] | I have this query running on a postgres 11.2 db:
SELECT relname
FROM pg_stat_user_tables
WHERE n_mod_since_analyze=0 AND relname LIKE '%'
AND relname NOT IN (SELECT relname FROM pg_class WHERE array_length(reloptions,1)>0);
That returns a list of tables I need to disable autovacuum for. I'm trying to come up with a way to run ALTER TABLE pg_stat_user_tables.relname SET (autovacuum_enabled = false); on all tables returned by my query statement. Googling keeps bringing me back to altering table columns. Is it possible to just take the table names returned from this query and pass it to ALTER TABLE?
| 177ea267762d56d5bed0a1469046fb850649bad932f03d51446461ea8a2fb314 | ['872f33734dc842bab2d5fffbf6b4bad4'] | I ran into this issue as well and found this post. Ultimately none of these answers solved my problem, instead I had to put in a rewrite rule to strip out the location /rt as the backend my developers made was not expecting any additional paths:
┌─(william@wkstn18)──(Thu, 05 Nov 20)─┐
└─(~)──(16:13)─>wscat -c ws://WebsocketServerHostname/rt
error: Unexpected server response: 502
Testing with wscat repeatedly gave a 502 response. Nginx error logs provided the same upstream error as above, but notice the upstream string shows the GET Request is attempting to access localhost:12775/rt and not localhost:12775:
2020/11/05 22:13:32 [error] 10175#10175: *7 upstream prematurely closed
connection while reading response header from upstream, client: WANIP,
server: WebsocketServerHostname, request: "GET /rt/socket.io/?transport=websocket
HTTP/1.1", upstream: "http://127.0.0.1:12775/rt/socket.io/?transport=websocket",
host: "WebsocketServerHostname"
Since the devs had not coded their websocket (listening on 12775) to expect /rt/socket.io but instead just /socket.io/ (NOTE: /socket.io/ appears to just be a way to specify websocket transport discussed here). Because of this, rather than ask them to rewrite their socket code I just put in a rewrite rule to translate WebsocketServerHostname/rt to WebsocketServerHostname:12775 as below:
upstream websocket-rt {
ip_hash;
server <IP_ADDRESS><IP_ADDRESS>:12775/rt/socket.io/?transport=websocket",
host: "WebsocketServerHostname"
Since the devs had not coded their websocket (listening on 12775) to expect /rt/socket.io but instead just /socket.io/ (NOTE: /socket.io/ appears to just be a way to specify websocket transport discussed here). Because of this, rather than ask them to rewrite their socket code I just put in a rewrite rule to translate WebsocketServerHostname/rt to WebsocketServerHostname:12775 as below:
upstream websocket-rt {
ip_hash;
server 127.0.0.1:12775;
}
server {
listen 80;
server_name WebsocketServerHostname;
location /rt {
proxy_http_version 1.1;
#rewrite /rt/ out of all requests and proxy_pass to 12775
rewrite /rt/(.*) /$1 break;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://websocket-rt;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
|
6a070ee58237d5124e4fc60827e6023882a07833326f248fdc56f5e8d16be85a | ['8733a04e2e7e41b58b8d595b00078e18'] | I have to load the incremental load to my base table (say table_stg) everyday once. I get the snapshot of data everyday from various sources in xml format. The id column is supposed to be unique but since data is coming from different sources, there is a chance of duplicate data.
day1:
table_stg
id,col2,col3,ts,col4
1,a,b,2016-06-24 01:12:27.000532,c
2,e,f,2016-06-24 01:12:27.000532,k
3,a,c,2016-06-24 01:12:27.000532,l
day2: (say the xml is parsed and loaded into table_inter as below)
id,col2,col3,ts,col4
4,a,b,2016-06-25 01:12:27.000417,l
2,e,f,2016-06-25 01:12:27.000417,k
5,w,c,2016-06-25 01:12:27.000417,f
5,w,c,2016-06-25 01:12:27.000417,f
when i put this data ino table_stg, my final output should be:
id,col2,col3,ts,col4
1,a,b,2016-06-24 01:12:27.000532,c
2,e,f,2016-06-24 01:12:27.000532,k
3,a,c,2016-06-24 01:12:27.000532,l
4,a,b,2016-06-25 01:12:27.000417,l
5,w,c,2016-06-25 01:12:27.000417,f
What could be the best way to handle these kind of situations(without deleting the table_stg(base table) and reloading the whole data)
| 60296e7289af2d105663765f9baa5ff4fa1e0d71bd0e8a0662743bc87394c0b4 | ['8733a04e2e7e41b58b8d595b00078e18'] | I am new to Java and trying to learn by myself. I wrote the below code and I was wondering why the output is not as I expect. Below is the code I have written:
public class Roughwork {
public static int classVar = 25;
public void getValue(int a){
classVar = a;
System.out.println(classVar);
}
public static void main(String[] args) {
Roughwork test = new Roughwork();
System.out.println(classVar);
test.getValue(30);
System.out.println(classVar);
}
}
and the output of this program is:
25
30
30
I expected the output to be
25
30
25
What exactly is happening and What I have to do to get my expected output?
|
5f8c2ebb844ff6014d61d8fe9a87bd515c173f89dbdf10a2f28896381560858a | ['873786a5792e4f0ab3d4a2d4da4398c1'] | I have applied the JSON-LD structured data for Product schema. I have just checked that a few fields are required by Google Guidelines. ( https://share.getcloudapp.com/7Ku09XQQ )
Will it be accepted by Google? Or will there be any penalty or any issue with such errors/warnings/recommended fields?
| c8c3462b5bb0ed407f64b14f29078fdc3f4022b1416fa7216f62f1a1ce628ee2 | ['873786a5792e4f0ab3d4a2d4da4398c1'] | Is it possible to share/pass the data between different domains inside the browser?
Note:
I can have a code control on all the data sharing domains.
I can not predict how many domains can be opened inside the browser to share the data.
I have tried a solution with Window.postMessage() but it requires destination site origin.
Can anyone suggest the way if any?
|
5e1307699509352270b52c3fa3694d261c25bb910dfbf9fde270069bca144cc3 | ['87385f65744a4f55a5dc0ce199f59448'] | Iam working on a webshop thats going to display the cart before the checkout. like now it is the checkout before the cart.
I cant get this to work.
I got a problem that the plugin always shows on the top of the content.
i fixed this a wihle ago. Now i updated the plugin and tryed same thing agien as you can read at the buttom hear.
The code is original like this:
public function __construct() {
add_action('init', array( &$this, 'start_session' ), 1);
add_shortcode( 'woocommerce_klarna_checkout', array(&$this, 'klarna_checkout_page') );
//add_action( 'woocommerce_proceed_to_checkout', array( &$this, 'checkout_button' ), 12 );
add_filter( 'woocommerce_get_checkout_url', array( &$this, 'change_checkout_url' ), 20 );
}
// Set session
function start_session() {
$data = new WC_Gateway_Klarna_Checkout;
$enabled = $data->get_enabled();
if(!session_id() && $enabled == 'yes') {
session_start();
}
}
// Shortcode
function klarna_checkout_page() {
$data = new WC_Gateway_Klarna_Checkout;
$data->get_klarna_checkout_page();
}
and i have tryed this:
ob_start();
$data->get_klarna_checkout_page();
$output_string=ob_get_contents();;
ob_end_clean();
return $output_string;
Than the hole plugin dispear and only thing that shows is /*
As i wrote at the top this solution worked on an erlier version of the plugin but not now.
And all i can find at the webb is this solution. So if anyone have any idea i would love it.
<PERSON> the problem is that the shortcode isnt in the funktion where i put ob_start(); ?
Iam like a newbie on php and cant seems to get this to work by my self.
| c6a1aeaef281a52a136fb6ba88c3dd8f7552695862e3b1d08f7b64a343088c28 | ['87385f65744a4f55a5dc0ce199f59448'] | My php skills is very low. I need some help this this function.
What it should do: When a order is marked as "failed" it should redirect to the woocommerce cart with an error message.
But problem is that this code redirect ALL status to the cart with the error message (even if payment is approved).
add_action( 'woocommerce_thankyou', function(){
global $woocommerce;
$order = new WC_Order();
if ( $order->status != 'failed' ) {
wp_redirect( $woocommerce->cart->get_cart_url() ); // or whatever url you want
wc_add_notice ( __( 'Payment Failed', 'woocommerce' ), 'error');
exit;
}
});
|
a7f5c8da885db327a6a97c836e30e02cc167ce5423134ff154376d2b3c1d30bb | ['873db8bf85bf4472b737e3c23ee8861f'] | Well, we're trying to understand how Wordpress is delivering this information, and how we need to adjust Wordpress to control it - after all, the content is managed and delivered by Wordpress? It's a gray area, but the answer needs to be related specifically to Wordpress and it's inherent controls for delivering content. | 96444a0ede547e518a5fa1a94b749cf809abac06e8c2d27715d901caa7e65e26 | ['873db8bf85bf4472b737e3c23ee8861f'] | I have a Postfix SMTP server that sends transactional emails from a web service. These messages use VERP for the return path, so bounces go back to an address like this:
<EMAIL_ADDRESS>
This postfix server running on e.mydomain.com is used exclusively to send email, there are no local mailboxes, POP or IMAP access, and so forth. Only systems on the local network can relay mail through it.
I then have a separate custom SMTP application that only processes bounces running on the same server (e.mydomain.com), but on a different port (8025). It drops any messages that aren't going to a properly formatted bounce address. Emails with properly formatted bounce addresses are accepted.
When a bounce is accepted, this custom application looks up the proper user in the database based on the bounce email address, and increments a bounce counter. The main web service will only send transactional email to users who's bounce count isn't over a threshold.
My questions are these:
Would it be better to set up my bounce handling SMTP (bounces.mydomain.com) server to handle bounces directly (and run on port 25)? Or is it better to have all bounces go to my postfix server, and then have postfix forward only the bounces to the bounce SMTP application?
If it is better to have postfix handle all incoming messages, how do I configure it to forward only messages formatted like the above address to another SMTP server, running on an unprivileged port (8025)?
|
a391001e56840ae9f347ee8ba2c10b6d6c7e91f5cc4e761c31fdffe917d4163a | ['874b46b74f9946f2a22a3fdc1eff5c9a'] | I am trying to categorize the blog content using Topic Modeling. Using LDA transformation, I couldn't find the correlation b/w topics. Say, cricket is a sub topic of Sports topic. However, I come to know that it could be achieved using HLDA. Could some one help me how to implement the HLDA transformation in python gensim package?
| 522acebb944c70e020917d77b6433538cbbed2e2cef3ae04b77e2d20b0fd5d5a | ['874b46b74f9946f2a22a3fdc1eff5c9a'] | You need to set the CURLOPT_USERAGENT to make it work! Following code will work.
<?php
function curlRequest($url){
$curl = curl_init();
$time = microtime(true);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($curl, CURLOPT_USERAGENT,'Mozilla/5.0 (compatible; Windows; U; Windows NT 5.1; en-US; rv:<IP_ADDRESS>) Gecko/20080311 Firefox/<IP_ADDRESS>');
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_MAXREDIRS, 10);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($curl);
curl_close($curl);
return $data;
}
echo curlRequest('https://www.reddit.com/api/info.json?url=http://google.com');
?>
|
1ede0ba9d70191f62f160ad5aa52b79a683bf154223b480c02497a84d8a76c2a | ['874b592067214c629c4bced005ad5388'] | Hello I am relatively new to appium.
The problem i am facing here is little strange. I am unable to tap on Get started button, but while manually i can tap on the button.
Following are the details of appium inspector
content-desc:
type: android.widget.RelativeLayout
text:
index: 0
enabled: true
location: {0, 0}
size: {720, 1184}
checkable: false
checked: false
focusable: false
clickable: false
long-clickable: false
package: com.sample.spark
password: false
resource-id: com.sample.spark:id/rlIntro
scrollable: false
selected: false
xpath: //android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.support.v4.view.ViewPager[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]
| 5eb39062970bc07a076f95221e6c13f7d57b520cd682d2f19ca41ae1acbd064e | ['874b592067214c629c4bced005ad5388'] | I had successfully installed nltk from this site. And just to validate i am able to import it from the terminal. But when i execute my python script from the Spyder it gives me following error in Spyders terminal
File "/Prateek/Python/RC_ISSUES/algorithm_RC.py", line 9, in <module>
import nltk
ImportError: No module named nltk
Below output is from the terminal
I know there might be similar questions but i thought it is different from rest of the other questions
|
fa2614d40643d809a11b6b2faa840a408794136e5f84f2935c325eb5d4740cd8 | ['874df15a40304c43b8ac5f406a8f7fa3'] | First a note of clarification: the UK Consulate in Chicago, a Premium Application Centre, does not accept Standard or Priority Visa applicants.
Such applications are begun online, fees paid, and biometrics done at at US Department of Homeland Security application support center. Only then is the application sent to the British Consulate General in New York for processing.
Minor children do not need to be accompanied interviews, but must provide the consent to travel of their parent(s) and, as appropriate, their legal guardian(s). As a minor and a third-country national applying in the United States for a UK visit visa, consent of both the parent(s) and the legal guardian(s) should be provided. The ECO has a statutory duty to protect children and would expect such documentation.
Gov.UK Standard Visitor Visa if you're under 18:
You can apply for a standard visitor visa if you’re under 18 and:
you’ve made suitable arrangements for your travel and stay in the UK
you have consent from your parent or guardian to travel to the UK
you’re able to pay for your return or onward journey
you have enough money to support yourself without working or getting help from public funds, or you have family and friends that can support you
Travelling alone
You can travel to the UK without an adult (someone over the age of 18).
Your parent or guardian will need to provide their:
written consent for you to travel to the UK
full contact details
They’ll also need to provide proof that you have somewhere suitable to live during your stay in the UK, including:
the name and date of birth of the person that you will be staying with
an address where you will be living
details of your relationship to the person who’ll be looking after you
consent in writing so they can look after you during your stay in the UK
Travelling with an adult
When travelling to the UK with an adult (someone over the age of 18), you’ll need to identify them in your visa application.
If the person you’re travelling with isn’t your parent, you’ll need to provide specific information about them in your application.
Their name will appear on your visa, and you’ll be refused entry to the UK if you arrive in the UK without them.
You can identify up to 2 adults in your visa application, and your visa will only be valid if you travel with at least one of them.
The adult can apply for a visa at the same time, but you must each complete separate applications.
| e42d96f9f16701f2e6300a76c55d6a27a80e2b16ac53626cb4241869a3e2427f | ['874df15a40304c43b8ac5f406a8f7fa3'] | You're expected to include evidence of accommodations for your entire trip, so the easiest resolution would be for your friend to have your name added to the reservations.
If that is not possible, you might follow the guidance in its VFS Global checklist (although Italy is not part of your itinerary):
Proof of accommodation for the entire stay in the Schengen area. All bookings must be made in the applicant’s name, otherwise the person who made the booking needs to produce a written statement in English (dated, signed and accompanied by PhotoID) to confirm that the applicant is covered in the bookings provided.
It's not uncommon for one person to book shared accommodations, as you did for the two of you. However, should one not be issued a visa, the other would have a problem.
|
d6c212ca1581be57739d55470a3fe754a4fe338d79210071b47ad5c478f76a20 | ['8768581e8a9142efa0d541b7a7db27bd'] | I am writing a Login page using MU with wxPython. (I am very new to Python)
The following is what I want to do:
Have a Login frame which allows user to enter username and password, after that the user click the login button
The Login frame will then be destroyed so that the main body of the program can get the Username and Password from the Login frame
The main program will pass the Username and Password to a function to check whether the Username and Password are valid or not.
After checking, the program will start a Loading frame to simulate a checking process (which is fake), this frame will be destroy after 0.5 second.
After the Loading frame destroyed, if the Username or Password is wrong, then the Login frame will be established again to ask the user to enter the information again, and then repeat the above step until the Username and Password are valid.
The below link is the video showing the right process of what I am talking about:
https://drive.google.com/file/d/12ZMkbZ6phcurO22Qk3RVYkGyYcidpKE2/view?usp=sharing
However, a problem suddenly appeared, by chance, the system will suddenly exit with exit code -1073741819, when this happened, the situation is like this:
https://drive.google.com/file/d/12_8nwG31kpGsWGndeqFYl5aJ2zHXwQje/view?usp=sharing
And when this happened, it didn't leave any Traceback for me to debug, all it left is just like this:
https://drive.google.com/file/d/1olyRki1UeiCw0GpBLdrP7FhXXXoE0Xub/view?usp=sharing
Moreover, as I mentioned, this situation happens by chance, I can't even repeat this error intentionally.
The below is the code I established the Login frame, I tried to simplify it for everyone to read easily:
Login_status = False
while Login_status == False:
Login_page_app = []
Login_page_app = wx.App()
Login_page = Login()
Login_page_app.MainLoop()
Login_Username = Login_page.getUsername()
Login_Password = Login_page.getPassword()
Login_status = Check_login_status(Login_Username, Login_Password)
After countless time of tracking (using the debug mode in Mu), I discovered that when the system exited suddenly, the program ended here:
Login_page_app.MainLoop()
I found that, when the program came to this, it will refer to the code in core.py:
def MainLoop(self):
"""
Execute the main GUI event loop
"""
rv = wx.PyApp.MainLoop(self)
self.RestoreStdio()
return rv
Then it will stop at:
rv = wx.PyApp.MainLoop(self)
After that, the system will exit suddenly with exit code -1073741819.
With my little knowledge of programing, I don't know what to do next... so can anyone help me please!
(If the above information is not enough to provide a full picture of the problem, please let me know, I will try my best to give more details)
| abd2ca6e769d561b062c6a8e8f63caca823deafac351262cd0737677633e8988 | ['8768581e8a9142efa0d541b7a7db27bd'] | After trying, I discovered that, because I use wx.Timer to destroy the Loading frame after 0.5 second, but after the Loading frame has been destroyed, I haven't stop the wx.Timer, so the Timer keep running and destroy the Loading frame for every 0.5 second. Therefore, when the Timer destroyed the Loading frame second time, there is no Loading frame there and causing the system crash.
Now, I solved the problem when I stop the Timer after destroying the loading frame.
Orginal code:
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.onClose, self.timer)
self.timer.Start(5000)
def onClose(self, event):
self.Destroy()
New code:
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.onClose, self.timer)
self.timer.Start(5000)
def onClose(self, event):
self.Destroy()
self.timer.Stop()
|
eed0f9b59e0df5d3511de5d30fcdcb53818555587728e75f5c6a2deb5503c6a2 | ['876e4051f58848c79eed46b9a2f571fc'] | Specific solution:
You can always change the existing html with a userscript. To activate userscripts you need an addon like GreaseMonkey or Tampermonkey.
// ==UserScript==
// @name Fix direct.com login issue
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Find all elements with the autocomplete attribute (at the login page) and change that attribute to "on".
// @author Carolus
// @match https://www.direct.com/index.cfm
// @grant none
// ==/UserScript==
(function() {
'use strict';
var allElements, thisElement;
allElements = document.evaluate(
'//*[@autocomplete]',
document,
null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
null
);
for (var i = 0; i < allElements.snapshotLength; i++) {
thisElement = allElements.snapshotItem(i);
thisElement.setAttribute("autocomplete", "on");
}
})();
This is my first ever userscript, cobbled together in 30 min, so it is not perfect. But it does enable you to choose the name and password as a dropdown option when you click on the input box and then follow it with another click or a downward arrow press. I couldn't figure out how to make it be filled out when you land on the page. But maybe someone can edit this answer to have an even better user script.
| 9368d7fd87ece9bee71921edbd7cb4c2ad7a01435dcbf6e43bc1ccabd847ff63 | ['876e4051f58848c79eed46b9a2f571fc'] | <PERSON> This makes sense. But I also don't want all my other tasks to run as sudo (by running the playbook as sudo). Only those that have `become: yes`. So IIUC my options to 1. Change `src` file permissions or ownership with some `become: yes` task before the `copy` task (and restore original state again). 2. Specify for all other tasks to run as non-sudo somehow and run the playbook as sudo? |
c06d96e86baa94b737cc1516c931a831785260b8bc99f021e5d7ec2afd7e717a | ['877a660beb6940ecb5dea3ee24a377a5'] | I am trying to read the audio data using MIC, and I am able to successfully read and save it to a file (wav format) returned by the AudioRecord class.
Now the real problem is that the file I am creating is too big. say Audio with duration of 5 minutes is taking upto 25MB.
Can anyone suggest me how to reduce the size. I am open to other file formats as well.
Thanks in advance.
| 5e25bcbe180867a64e38d5751deaaa7df2aac030fa68f4920552c16bfed90cbc | ['877a660beb6940ecb5dea3ee24a377a5'] | Let say I have 4 seekbars and there values are initially set to 25 each. If I change the value of any one seekbar, then this change should reflect on the other 3 seekbars as well, like if I increase the value then all the other seekbars should decrease and vice versa..
I know this requires a mathematical formula which I am unable to figure out...
Thanks in advance
|
5532e80f2a9eef3a6277d52b0da50ec9217afd3d9011613afa1a624ce292cd93 | ['877d29e9b50248e2befa5256dd3243dc'] | I am developing microservices stack using spring cloud and database is mysql. for easily explain lets take one service and one mysql database.
my questions what is the best way to deploy mysql database to production for container based enviorment.
I can use mysql docker and mount host local file system to docker using
-v /local/path:/var/lib/mysql
install mysql to host where docker engine runs and access that from docker. for that I can use
--add-host="localhost:<IP_ADDRESS>"
however as far as i know i need to update mysql grants and to allow connect through this IP like
GRANT ALL PRIVILEGES ON databasename.* TO 'username'@'<IP_ADDRESS>';
but since I am using AWS EC2 instance I dont know this IP is fixed or not.
is it good practice to update these grants?
from above two (or other ) what is the recommended way to use mysql for microservices in production.
| 34c3bcbbbce3ce8a37fba69ad3237c3296c5c3b88b5a5d60a8d0305cbd077690 | ['877d29e9b50248e2befa5256dd3243dc'] | my problem is this. ill try to make it simple.
I am using spring data jpa +spring boot (hibernate config) with mysql.
I have a class (entity) like this.
public class A {
@EmbeddedId
Aid id;
@OneToMany(fetch = FetchType.EAGER, mappedBy = "a")
@OrderBy("order ASC")
@MapKey(name = "b.bid")
Map<String, B> b;
//id class
@Embeddable
public static class Aid implements Serializable {
private String agent;
private String id;
}
//some other fields/methods
}
here other class
public class B {
private Integer x;
private String code;
@Transient
private String value;
//B embedable id class goes here
}
Note
you can assume all missing annotations / method / id are there and this is perfectly working code. I did not added those here to avoid being complicate the question.
this is my question.
when I fetch this A object from database I adding it to map [storageMap] and during the program from A object which is in storageMap read and its B objects value field (B object in Map of A object) get update.
but my problem is when i fetch again A from database it give me previously fetched and dirty (modified) object. but I need fresh copy from database to reset all modifications. hibernate does not know its dirty because its @Transient ? how I can solve this. ( I know if I deep copy what return from database before adding to my storageMap would solve the problem. any other better way to do?)
|
94c265e2ca5b3bf51ae6d50e40aaf634b0b68292a82e6086591bff247e4d5e08 | ['878253852264473892fcae425e0c78b9'] | Not a real solution but something you can look for:
You can do:
for item in user_account.drafts.all().order_by('subject'):
print(item) #Copy Text into Notepad++ and search for user1/ <EMAIL_ADDRESS>
item.sender = '<EMAIL_ADDRESS>'
item.account = '<EMAIL_ADDRESS>'
user_account.drafts.save(update_fields=['sender', 'account'])
print(item) #Copy Text in another Notepad++ tab to see if every user1 entry has been replaced
exit("Done")
You should be able to compare the .txts and find the missing item (if there is one)
WARNING: depending on how much mails there are there will be a huge wall of text
| 4eb83ea0fe37665ac7e5363ee751b8fc619c2d1d6a5926ddd35cf943ba154112 | ['878253852264473892fcae425e0c78b9'] | I'm using exchangelib in a Windows/Exchangeserver environment, this is my login code:
import getpass
from exchangelib import Configuration
from exchangelib import Credentials, Account
def login():
email = '<EMAIL_ADDRESS>'
passwd = getpass.getpass(prompt='Password: ')
user_credentials = Credentials(email, passwd)
config = Configuration(server='exchangeserver',
credentials=user_credentials)
account = Account(primary_smtp_address=email, config=config,
credentials=user_credentials, autodiscover=False) #maybe try =True
return account
def main():
user_account = authenticate()
print(user_account.root.tree()) #printing the inbox
main()
input('Press enter to exit')
|
7f9665a0c72593e282ea2123613e091c58ce2c8df043ff4e7849822963c080ae | ['879097a8946e48a7a971e4ce976067e4'] | after resizing the user avatar with intervention image ,i try to store it in the octobercms database like this code:
if (Input<IP_ADDRESS>hasFile('avatar')) {
$file= Input<IP_ADDRESS>file('avatar');
$filenamewithextension = $file->getClientOriginalName();
//get filename without extension
$filename = pathinfo($filenamewithextension, PATHINFO_FILENAME);
//get file extension
$extension = $file->getClientOriginalExtension();
//filename to store
$filenametostore = $filename.'_'.time().'.'.$extension;
Storage<IP_ADDRESS>put('public/profile_images/'. $filenametostore, fopen($file, 'r+'));
Storage<IP_ADDRESS>put('public/profile_images/thumbnail/'. $filenametostore, fopen($file, 'r+'));
//Resize image here
$thumbnailpath ='storage/app/public/profile_images/thumbnail/'.$filenametostore;
$img = Image<IP_ADDRESS>make($file->getRealPath());
$img->crop(request('w'), request('h'), request('x1'), request('y1'));
$img->save($thumbnailpath);
$user->avatar= $filenametostore;
}
i get this error:
The avatar must be an image.
C:\wamp643\www\october3\vendor\october\rain\src\Database\Traits\Validation.php line 340
i really don't know what to do ,i'm a beginner.
please help me!!
| 4cf1213c5554f124148f114417ccbc851125d29cff4589fc953826ae0f4d87e8 | ['879097a8946e48a7a971e4ce976067e4'] | I have a form, and I would like it when I submit it, that it redirects me
in another page,
knowing that the redirection path must be dynamic,
it means that I use a javascript function that takes the user's choice and return a string
the ajax handler data-request-redirect only accept a string and execute not javascript code:
title = "test"
url = "/test"
layout = "default"
is_hidden = 0
==
<?php
function onStart()
{
$this['example'] = Session<IP_ADDRESS>get('example-key');
}
function onTest()
{
Session<IP_ADDRESS>put('example-key', input('my-input'));
}
?>
==
<form method="POST" data-request="onTest" data-request-redirect="......" name="formu" accept-charset="UTF8" enctype="multipart/form-data">
<input type="text" name="my-input">
<button type="submit">Submit</button>
</form>
{% if example %}
<strong>Example: {{ example }}</strong>
{% endif %}
<script type = "text/javascript">
$(function() {
var $buttonBien = $('.bien');
$buttonBien.on('click',function (event) {
event.preventDefault();
});
});
function type_bien(x){
switch( x) {
case 0:
return "formulaire_villa";
break;
case 1:
return "formulaire_villa";
break;
case 2:
return "formulaie_riad";
break;
case 3:
document.getElementById(3).checked="true";
/* document.forms["formu"].action="formulaire_appartement";*/
return "formulaire_appartement";
break;
default:
alert('local_commerce est selected');
}
}
</script>
so what to do in the data-request-redirect
I am really blocked
please help
|
575facd83d2e327f1f2f49669d1b733947b2676cff1d1c5e4c30260792efd0dd | ['8796afdf8f214faf82ec7447808f2297'] | I created a Rails API (using the rails-api gem) to be consumed by my Ember app (using ember-cli).
My problem is that the associations I have set in my API don't seem to yield exactly what my Ember app is looking for, and I don't have an idea about what needs to be changed or done differently.
Below, describes where I currently am and the steps I took to get here.
I generated two scaffolds:
rails g scaffold movement name:string movement_type:string
<PERSON> scaffold record max_effort:integer max_type:string movement:references
Which produced:
Models
class Movement < ActiveRecord<IP_ADDRESS>Base
end
class Record < ActiveRecord<IP_ADDRESS>Base
belongs_to :movement
end
Serializers
class MovementSerializer < ActiveModel<IP_ADDRESS>Serializer
attributes :id, :name, :movement_type
end
class RecordSerializer < ActiveModel<IP_ADDRESS>Serializer
attributes :id, :max_effort, :max_type
has_one :movement
end
Migrations
class CreateMovements < ActiveRecord<IP_ADDRESS>Migration
def change
create_table :movements do |t|
t.string :name
t.string :movement_type
t.timestamps null: false
end
end
end
class CreateRecords < ActiveRecord<IP_ADDRESS>Migration
def change
create_table :records do |t|
t.integer :max_effort
t.string :max_type
t.references :movement, index: true, foreign_key: true
t.timestamps null: false
end
end
end
I ran bundle exec rake db:migrate
Which produced:
Schema
ActiveRecord<IP_ADDRESS>Schema.define(version: 20150514184239) do
create_table "movements", force: :cascade do |t|
t.string "name"
t.string "movement_type"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "records", force: :cascade do |t|
t.integer "max_effort"
t.string "max_type"
t.integer "movement_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "records", ["movement_id"], name: "index_records_on_movement_id"
end
I created seed data (using the faker gem) and run bundle exec rake db:seed
Seeds (rails/app/db/seeds.rb)
movements = Array.new
10.times do |movement|
movement = Movement.create(
name: Faker<IP_ADDRESS>Lorem.word(),
movement_type: ['pushing', 'pulling', 'squatting'].sample()
)
movements.push(movement)
end
30.times do
Record.create(
movement: movements.sample(),
max_effort: Faker<IP_ADDRESS>Number.between(1, 100),
max_type: ['rep', 'sec'].sample()
)
end
When I run rails s, the respective URLs show:
At http://localhost:3000/movements
{
movements: [
{
id: 1,
name: "dolor",
movement_type: "pushing"
},
{
id: 2,
name: "suscipit",
movement_type: "squatting"
}
...
]
}
At http://localhost:3000/records
{
records: [
{
id: 1,
max_effort: 90,
max_type: "rep",
movement: {
id: 7,
name: "quia",
movement_type: "pushing"
}
},
{
id: 2,
max_effort: 26,
max_type: "sec",
movement: {
id: 3,
name: "non",
movement_type: "pushing"
}
}
...
}
I set up my Ember adapter, serializer, and router for AMS compatibility
Adapter
export default DS.ActiveModelAdapter.extend({
});
Serializer
export default DS.ActiveModelSerializer.extend({
});
Router
var Router = Ember.Router.extend({
location: 'auto'
});
export default Router.map(function() {
this.resource('movements', function() {
this.resource('movement', {path: ':id'}, function() {
this.route('records');
});
});
});
I set the same associations as in Rails to my Ember models
Movement
export default DS.Model.extend({
name: DS.attr('string'),
movementType: DS.attr('string'),
records: DS.hasMany('record')
});
Record
export default DS.Model.extend({
maxEffort: DS.attr('number'),
maxType: DS.attr('string'),
movement: DS.belongsTo('movement')
});
I set up the respective Ember routes
Movement (app/routes/movement.js)
export default Ember.Route.extend({
model: function(params) {
return this.store.find('movement', params.id);
}
});
Records (app/routes/movement/records.js)
export default Ember.Route.extend({
model: function() {
return this.modelFor('movement').get('records');
}
});
I run ember s --proxy http://localhost:3000
Results:
All the movements are populated and behaving as expected in the app's UI. However, this is not the case for their associated records. Ember Inspector reveals no records have been loaded.
Concluding thoughts:
It seems to me that the movements JSON returned by rails should show some reference to records. I attempted this by adding the explicit association to both the movement model and serializer:
class Movement < ActiveRecord<IP_ADDRESS>Base
has_many :records
end
class MovementSerializer < ActiveModel<IP_ADDRESS>Serializer
attributes :id, :name, :movement_type
has_many :records
end
This only created an error when I tried to run the Rails server.
My other hunch is that my seeds.rb code is the problem. It is my first time using Faker, and I'm still no expert in Ruby.
I am stuck, and sure that it is do to my lack of experience with one of, or both, Ruby/Rails and Ember.
I hope with everything I have included here that it will be an easy mistake for someone more experienced to spot.
Thank you.
| e2dcf3eb6a21922849908f614052ae114682565534673513211b882a4172dcdb | ['8796afdf8f214faf82ec7447808f2297'] | I have an array of "event" objects that contain a "startDate" property. I've written a custom filter, "occursToday", that is expected to return an array of events that have a startDate property matching the "today" variable as defined in the filter function. The code below is my attempt to test my custom filter. No events are displayed, yet there are expected matches. No errors are thrown in the console either. What am I missing or misunderstanding? Thank you.
JS:
var myApp = angular.module('myApp', []);
myApp.filter('occursToday', function () {
return function (events) {
var today = new Date('12/1/2014');
var filtered = [];
for (var i = 0; i < events.length; i++) {
var evnt = events[i];
if (evnt.startDate === today) {
filtered.push(evnt);
}
}
return filtered;
};
});
myApp.controller('MainCtrl', function($scope){
$scope.greeting = 'Hello world!';
$scope.events = [
{"name": "An Event", "venue": "A Park", "startDate": new Date('12/1/2014'), "startTime": new Date('12/1/2014'), "endDate": new Date('12/1/2014'), "endTime": new Date('12/1/2014'), "website": "www.example.org", "description":"Yada yada.", "details": "Blah blah."},
{"name": "An Event", "venue": "A Park", "startDate": new Date('12/1/2014'), "startTime": new Date('12/1/2014'), "endDate": new Date('12/1/2014'), "endTime": new Date('12/1/2014'), "website": "www.example.org", "description":"Yada yada.", "details": "Blah blah."},
{"name": "An Event", "venue": "A Park", "startDate": new Date('12/2/2014'), "startTime": new Date('12/2/2014'), "endDate": new Date('12/2/2014'), "endTime": new Date('12/2/2014'), "website": "www.example.org", "description":"Yada yada.", "details": "Blah blah."},
{"name": "An Event", "venue": "A Park", "startDate": new Date('12/2/2014'), "startTime": new Date('12/2/2014'), "endDate": new Date('12/2/2014'), "endTime": new Date('12/2/2014'), "website": "www.example.org", "description":"Yada yada.", "details": "Blah blah."},
{"name": "An Event", "venue": "A Park", "startDate": new Date('12/3/2014'), "startTime": new Date('12/3/2014'), "endDate": new Date('12/3/2014'), "endTime": new Date('12/3/2014'), "website": "www.example.org", "description":"Yada yada.", "details": "Blah blah."},
]
});
HTML:
<!DOCTYPE html>
<html lang="en" ng-app="myApp">
<head>
<meta charset="utf-8">
<title>myApp</title>
<link rel="stylesheet" href="css/main.css">
</head>
<body ng-controller="MainCtrl">
<div class="upcoming_events">
<h2>Today</h2>
<ul class="event_list">
<li ng-repeat="event in events | occursToday">
<div class="event">
<div class="event_date">
<span class="day_of_week">{{event.startDate | date: 'EEEE'}}</span><br>
{{event.startDate | date: 'mediumDate'}}
</div>
<div class="event_content">
<a class="summary" href="#">{{event.name}}</a>
<time class="start-time">{{event.startTime | date: 'shortTime'}}</time>
–
<time class="end-time">{{event.endTime | date: 'shortTime'}}</time>
<a class="location" href="#">{{event.venue}}</a>
</div>
</div>
</li>
</ul>
</div>
|
216b30d401b19dfd6dcda397de8f4d9b90497a93e8a57d6b50c816f8ad58dd43 | ['87a48645ef324c2f9f53849e6030cea0'] | There is an English term illustrating the situation where the police conspired to collect fines by intentionally capturing on a security camera speeding vehicles passing through an area that few people know is readily subject to speeding if not paid extra attention to.
Can someone please help me out here? Any contributing response would be greatly appreciated.
| c96ab051853ebb3b6b81238d5ae858ac89fee21f2ae49f0e068c3741829ec5e3 | ['87a48645ef324c2f9f53849e6030cea0'] | Adding \newgeometry{top=1in} before and \newgeometry{top=2in} after is giving me two issues. I get a blank page before the table of contents and another after. Also the first page of the TOC only has a 1in margin where I want the first page to have 2in and the subsequent pages to have 1in. <PERSON> |
df57f7624adc7c976465267c206c8f3433ccd220c3cf902601ad73d9d664985b | ['87b31cb8618d422f967789634d636aca'] | There are two ways to do it:
Picture[] pictures = new Picture[5]; //This will make an array of 5 pictures
pictures[0] = pictureAdded;
You can also use a pre-made class in Java - ArrayList. This way you don't have to worry about array size:
ArrayList<Picture> pictures = new ArrayList<Picture>();
pictures.add(new Picture());
Picture pic = pictures.get(0);
| d5957ba0f4d8fd256bdc814c68043ce6fa4a41f16b6aecd42d0cb5bb056a3989 | ['87b31cb8618d422f967789634d636aca'] | I'm working on a native activity app for Android 2.3.3. I've copied the code from the code samples, I have include paths set, but Eclipse (Indigo) still can't find this constant.
EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); //Type 'EGL_DEFAULT_DISPLAY' could not be resolved
However the compiler shows no error:
Compile++ thumb : NativeTest <= NativeTest.cpp
Any ideas why?
|
3ba0af23802000ed26e22af4d29551fa6738162c4324150cabd57013ecaca05b | ['87dd93b7120a4f979778287bebfe6f1e'] | string body = "{\n" +
" \"clientReferenceInformation\": {\n" +
" \"code\": \"TC50171_3\"\n" +
" },\n" +
" \"processingInformation\": {\n" +
" \"commerceIndicator\": \"internet\"\n" +
" },\n" +
" \"orderInformation\": {\n" +
" \"billTo\": {\n" +
" \"firstName\": \"john\",\n" +
" \"lastName\": \"doe\",\n" +
" \"address1\": \"201 S. Division St.\",\n" +
" \"postalCode\": \"48104-2201\",\n" +
" \"locality\": \"Ann Arbor\",\n" +
" \"administrativeArea\": \"MI\",\n" +
" \"country\": \"US\",\n" +
" \"phoneNumber\": \"999999999\",\n" +
" \"email\": \"<EMAIL_ADDRESS>\"\n" +
" },\n" +
" \"amountDetails\": {\n" +
" \"totalAmount\": \"10\",\n" +
" \"currency\": \"USD\"\n" +
" }\n" +
" },\n" +
" \"paymentInformation\": {\n" +
" \"card\": {\n" +
" \"expirationYear\": \"2031\",\n" +
" \"number\": \"5555555555554444\",\n" +
" \"securityCode\": \"123\",\n" +
" \"expirationMonth\": \"12\",\n" +
" \"type\": \"002\"\n" +
" }\n" +
" }\n" +
"}";
| 0321d3eaf362aa3146b145a21061463620cc352773961737d949cf384824ccfb | ['87dd93b7120a4f979778287bebfe6f1e'] | I have gotten the geoJson to work with d3.js, dc.js and crossfiler.
var width = 300;
var height = 400;
var zaMapData = [];
//geoChoroplethChart
var zaChart = dc.geoChoroplethChart("#map");
d3.json("https://s3-us-west-2.amazonaws.com/s.cdpn.io/<PHONE_NUMBER>/layer1.json", function(json) {
var zaMap = JSON.stringify(json);
console.log(zaMap);
for (var i = 0; i < json.features.length; i++) {
console.log("ndx2 province data " + json["features"][i]["properties"]["PROVINCE"]);
zaMapData.push({
province: json["features"][i]["properties"]["PROVINCE"],
donation: i*1000
})
};
//crossfilter instance
var ndx2 = crossfilter(zaMapData);
//dimensions and group for dc/d3
var provinceDim = ndx2.dimension(function(d) {console.log("province d " + d["province"]); return d["province"];});
var donationsByProvince = provinceDim.group().reduceSum(function(d) {
return d["donation"];
});
var max_province = donationsByProvince.top(1)[0].value;
// create a first guess for the projection
var center = d3.geo.centroid(json)
var scale = 150;
var offset = [width/2, height/2];
var projection = d3.geo.mercator().scale(scale).center(center)
.translate(offset);
// create the path
var path = d3.geo.path().projection(projection);
// using the path determine the bounds of the current map and use
// these to determine better values for the scale and translation
var bounds = path.bounds(json);
var hscale = scale*width / (bounds[1][0] - bounds[0][0]);
var vscale = scale*height / (bounds[1][1] - bounds[0][1]);
var scale = (hscale < vscale) ? hscale : vscale;
var offset = [width - (bounds[0][0] + bounds[1][0])/2,
height - (bounds[0][1] + bounds[1][1])/2];
// new projection
projection = d3.geo.mercator().center(center)
.scale(scale).translate(offset);
path = path.projection(projection);
//create dc.js chart
zaChart.dimension(provinceDim)
.group(donationsByProvince)
.width(width)
.height(height)
.colors(["#E2F2FF", "#C4E4FF", "#9ED2FF", "#81C5FF", "#6BBAFF", "#51AEFF", "#36A2FF", "#1E96FF", "#0089FF", "#0061B5"])
.colorDomain([0, max_province])
.projection(d3.geo.mercator()
.center(center)
.scale(scale)
.translate(offset))
.overlayGeoJson(json["features"], "PROVINCE", function (d) {
return d.properties.PROVINCE;
})
.title(function (p) {
return "Province: " + p["key"]
+ "\n"
+ "Total Donations: R " + Math.round(p["value"])
});
dc.renderAll();
});
My codepen here.
|
a445d91694740b248b070036514c158ce4491c0930bda5481f4911f1593c93ad | ['87e1427dff334c4785fb4de136408015'] | @R.. If the device is faulty and creates a short, it doesn't matter how much current it's designed to draw, it only matters how much current is required to trip the fuse. If you plug it into a socket on a 16 A circuit, you're going to need more than 16 A to trip the fuse. | 7a04b7b5da1e5277a2a30cdbcc5ce1e1fc939f3171944ffc65b0cf3f4e3d4d69 | ['87e1427dff334c4785fb4de136408015'] | I have a small linux server. I have data on several HFS+ drives that I'd like to consolidate to another HFS+ drive. The drives will be connected to the server via a USB HDD dock. I'm running Ubuntu 12.10 on the server.
If I copy files from HFS+ to HFS+ with linux in the middle, will resource forks be preserved?
P.S. I'm assuming the best tool for this is rsync 3, but if someone has a better suggestion please let me know.
|
b606d027c9409e285798c1b4d576737ac32ca62f4b12ef6675d10673360ae20a | ['87e4bc7a800e45378ee3f3515799d9af'] | If you're in git bash, just type PATH="path to php goes here"
It might be useful to copy the existing path and modify it, so you don't lose other useful paths. Type in export to see the path.
The new path is only valid for the session.
| ccea902e1b2a676eddf669842cc37b59e902a0403da08d1a802301a690d61a86 | ['87e4bc7a800e45378ee3f3515799d9af'] | i was unable to find a way to access the artifact remotely before the pipeline had completed. <PERSON>.
i have a workaround though - i moved the deploy stage to a separate pipeline. so the first pipeline just executes the build (generating the artifacts) and then triggers the second pipeline. the second pipeline is then able to access the artifacts of the first pipeline and it just executes a deploy stage. <PERSON>.
|
04421cad932cf737f889e131262238ca4cafdedebadedf6742abf2bfa4226aee | ['87ed6f26c6794b7bb2dfff182587b388'] | Use consent
https://consent.live.com/Delegation.aspx?
ps = Passport service you want (Contacts.update|Contacts.index....)
ru = Return URL
pl = Policy url
app = your appid+timestamp+signature
If you link your users to this, Microsoft Live Service will authenticate your app then send a token as a base64 encrypted parameter to Return URL, you can parse that to get the Delegated Token for the user, their live id, the life-expectancy of the token, the permissions available and various other bits of information
Have a look here for more information
http://msdn.microsoft.com/en-us/library/cc287637.aspx
| 81a8b84e9b1c679d80346711a92bd5a616653a60148093dc072f816e10f8af30 | ['87ed6f26c6794b7bb2dfff182587b388'] | If you need to grep ALL the files multiple times (as you said, running a script) I would suggest looking into ram disks, copy all files there and then grep the files the multiple times, this will speed up your search by a factor of at least 100x.
You just need enough ram.
Else, you should look into indexing the files, eg. into lucene or a nosql database and then running queries upon that.
|
a13a8d6a8ae81fe1ef0748355bd91a264829457ba5bd0179f0bbba0435b7b348 | ['87f1e294864e474cb803839e94a22cf8'] | My default Google Calendar timezone is "(GMT-05:00) Eastern Time". The event time displays correctly on the calendar and in the initial pop-up window, but if a viewer who is NOT logged in to Google Calendar clicks the "more details>>" link in the pop-up window, the next screen displays the time in "GMT (no daylight saving)". So, for example, an event that displayed as "8:45am Eastern" on the calendar and in the pop-up now displays as "12:45pm GMT (no daylight saving)" on this "more details" page. Could you please let me know to resolve this.
| c453fc28b2b939278b8d0fecc1d89a1310f10bf8f8119140006fd1964d67afa7 | ['87f1e294864e474cb803839e94a22cf8'] | I have already been using font-awesome 3.2.1 in my project. Now I wish to upgrade to font-awesome 4.2. Could you please guide me how to start with? I add font-awesome 4.2 css file to my project and now its seems to be like am not able to view any fonts in my project. Any idea on what should I have to do to get 4.2 version fonts in my project.
|
42de928e468def9ab0be61f96e505ee55e602719d9e360d902f538cb66a73245 | ['87f75d28d9dc4b4ea247f2532a6313ea'] | may i know how can fit the image into the designed border?
below are the code that i've done.
<Border Grid.Row="1" BorderThickness="1" BorderBrush="LightGreen" Margin="20" CornerRadius="30">
<Border.Background>
<LinearGradientBrush EndPoint="0.504,1.5" StartPoint="0.504,0.03">
<GradientStop Color="#F9FFF0" Offset="0"/>
<GradientStop Color="#F3FFE2" Offset="0.567"/>
</LinearGradientBrush>
</Border.Background>
<Image Source="/LBKIOSK;component/Resources/Images/Background/klhoho.jpg" Opacity="0.3" Stretch="UniformToFill"/>
<Border.Effect>
<DropShadowEffect ShadowDepth="5" Color="#599204"></DropShadowEffect>
</Border.Effect>
</Border>
but output show as below , the image didn't fit inside the border
| badbd9ba1957ca27b41040741b0e3bbcfe91840bb8f2096c6066891f0713d906 | ['87f75d28d9dc4b4ea247f2532a6313ea'] | perhaps you can try these solutions. Hope it helps.
<jsp:include> tag inside <form> tag
<form name="frm" method="POST" action="<%=servletURL%>/page">
<jsp:include page="<%=header%>" flush="true">
<jsp:param name="id" value="1234"/>
</jsp:include>
</form>
or CSS control
<form style="margin:0px;" name="frm" method="POST" action="<%=servletURL%>/page">
|
0e53d9db983ff617608e6dae28d54dc66a8117881587c79b421b9085764286c2 | ['87fc19640e934c6998b06ddbc603102e'] | enum userType{
student,
teacher;
}
class MyData {
userType type;
//other data
}
// now here i assume that "json" string contains your pre-filter data
Gson gson = new Gson()
MyData data = gson.fromJson(json, MyData.class);
if (data.type==userType.teacher){
String json = jsonParser.makeHttpRequest(CC.GETINCIDENTS_TEACHER, "GET",
null);
String details = json.toString();
Log.d("List of Incidents", details);
}
else {
String json = jsonParser.makeHttpRequest(CC.GETINCIDENTS_STUDENT, "GET",
null);
String details = json.toString();
Log.d("List of Incidents", details);
}
| cf82dbeb8bf59136f8d45aca118e82a47d73f340e5d6b6cb5f604393ad9cb2a3 | ['87fc19640e934c6998b06ddbc603102e'] | Android comes with the apache commons http library included. Setting up a https post request is quite easy:
HttpPost post = new HttpPost("https://yourdomain.com/yourskript.xyz");
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("postValue1", "my Value"));
nameValuePairs.add(new BasicNameValuePair("postValue2", "2nd Value"));
post.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(post);
HttpEntity entity = response.getEntity();
String responseText = EntityUtils.toString(entity);
Android uses a version 4.x of the commons http library as all versions below 4.0 are out of their lifecycle.
I can't tell exactly how to register a self-signed certificate to the HttpClient, but mybe the commons http documentation helps:
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/connmgmt.html#d4e506
|
2cda7fe7c795957d4f681b9398432fde2e8ca64f623ddce26fb1cc5f8116417d | ['87fffc753a134d2d81e5667f1496c1cb'] | I recently started using jruby. In normal ruby's irb, I get vi readline support due to the .editrc file
.editrc file
bind -v
But jruby doesn't seem to use that file, and doesn't get the vi readline from the .inuptrc file either.
Is there a way to get vi readline support in jirb?
| 8498b56ec1239d38c645fe200dedfa8f555f7d2a30db75f911b4d0a425c5bd79 | ['87fffc753a134d2d81e5667f1496c1cb'] | I want to use the ruby's -F option to define a field separator (tab, for instance). I have tried various expressions like -F:\t and -F='\t' etc. but can't seem to get the correct syntax. Does anyone know the correct syntax? Can you please show me? Thanks in advance.
|
70a6df2c00e95ce19e15227ad5d07f8d240db9436a63b3a799e6813eac905487 | ['881bc7ebeca5414ca40cae801a6ce121'] | <PERSON> Thank you for the clarification and the notes! I have only had the time to skim the document so far and I noticed many terms that we have not been introduced to yet. Could you let me know where exactly the proof of this is so I can focus my efforts on understanding that part? Sorry for the trouble. | cfc0f83934b7b8bdf4c945f0186307f1e3a63b5f8de0f5f8a61adb5ae6239ec6 | ['881bc7ebeca5414ca40cae801a6ce121'] | I am asked to describe the defining representation of $\mathfrak{sp}_4$ in terms of highest weights, and then I am asked to repeat this process for the defining and adjoint representations of $\mathfrak{so}_5$
To start with, I noted that the subalgebra of diagonal matrices in $\mathfrak{sp}_4$ gave a Cartan Subalgebra $\mathfrak{t}$ that is spanned by the two diagonal $4\times 4$ matrices, $t_1 = diag(1,0,1,0)$ and $t_2 = diag(0,1,0,1)$.
Knowing this, suppose we take any vector $v = (a,b,c,d) \in \mathbb R^4$, then:
$t_1v = (a,0,c,0)$ and $t_2v = (0,b,0,d)$.
Hence, if $v$ were in the $\omega$ weight space of $V = \mathbb R^4$, then:
Either $\omega(t_1) = 0$ or $ b = d = 0$, and:
Either $\omega(t_2) = 0$ or $a = c = 0$.
Putting these two things together I concluded that $V = V_0$ is the $0$-weight space, and hence $V$ has highest weight $0$.
Second, noting that $\mathfrak{so}_5 \cong \mathfrak{sp}_4$, I argued that the defining representation of $\mathfrak{so}_5$ would behave in the same way, and thus would all be the $0$-weight space.
However, I feel like I must have made a mistake here somewhere because this doesn't seem right to me.
Additionally, I am unsure how to proceed to answer the part about the adjoint representation.
I think I will be taking the Cartan subalgebra $\mathfrak{t}$ of diagonal matrices in $\mathfrak{so}_5$, with some basis $t_1, t_2$.
Then I suppose I would take a general matrix $x \in \mathfrak{so}_5$ and compute $t_1x - xt_1 $ and $t_2x - xt_2$ to see if these are non-trivial scalar multiples of $x$. If so then $x$ can belong to some non-zero weight space of $V = \mathbb R^5$.
I wanted to ask though if there would be a better way to do questions of this kind.
|
b6506c891e01063e03ff610b307231e7b5c4f224cef255cad74afa5d5005eb8c | ['88226a235bb144f5a58142aab2712c10'] | There is an error in your if statement, where you are assigning a value, not ccomparing it (= vs == or ===).
For the purpose of your function, I don't think you need to know the key, because you're already in the array. eg.
function championInfo($i, $users){
foreach($users['data'] as $index => $user){
if($i == $user['id']){
return $user['name'];
}
}
}
| 117744038dfb3b07a7c8bf75665e169281d216e5439eeba33ed0cb454367bafe | ['88226a235bb144f5a58142aab2712c10'] | This seemed to work:
function extractArray(array $source, array &$destination, $originalIndex)
{
foreach($source as $index => $value)
{
if(is_array($value))
extractArray($value, $destination, $index);
else
$destination[$originalIndex][$index] = $value;
}
}
$test = array(
60002 => array
(
50001 => array
(
50002 => array
(
10001 => array
(
'flag' => 'B',
'qty' => 1
),
10002 => array
(
'flag' => 'B',
'qty' => 1
),
10003 => array
(
'flag' => 'B',
'qty' => 2
),
'flag' => 'M',
'qty' => 1
),
'flag' => 'M',
'qty' => 1
),
'flag' => 'G',
'qty' => 1
),
10001 => array
(
'flag' => 'B',
'qty' => 1
)
);
$new = array();
foreach($test as $index => $value)
extractArray($value, $new, $index);
var_dump($new);
die();
|
d0d622381226e87ffbef8cba7d86f77d5ed73d28edd6e5ce45422ab841c4f736 | ['88335ab5c6de43a19db648f6d2f4ef3f'] | Maybe it can be of help to anyone landing here : I just experienced this same issue, and in my case it was that I had a (composite) unique constraint set on the foreign key column BEFORE the foreign key constraint. I resolved the issue by having the "unique" statement placed AFTER the "foreign" statement.
Works:
$table->foreign('step_id')->references('id')->on('steps')->onDelete('cascade');
$table->unique(['step_id','lang']);
Doesn't work:
$table->unique(['step_id','lang']);
$table->foreign('step_id')->references('id')->on('steps')->onDelete('cascade');
| f5bbb3d1ea1727c9fcba73fd3f5e99c72024906a60b088898921ce107b0ab26f | ['88335ab5c6de43a19db648f6d2f4ef3f'] | In a nutshell, as <PERSON> as mentionned, the problem very few resources on the internet touch on is the fact that your apache configuration must contain an AllowOverride FileInfo directive for wordpress rewrites to work without /index.php/.
Since Apache 2.4, AllowOverride default setting is "None", which is often a roadblock in making "pretty urls" work (in this case ditching the index.php). As <PERSON> mentionned, you should read carefully this resource : https://wordpress.org/support/article/using-permalinks/.
Make sure to have mod_rewrite enabled
-> (to be sure create an info.php you will remove later containing the line <?php phpinfo();?>) at the root of your blog and call https://domainofyourb.log/info.php)
Make sure your .htaccess is writable by wordpress. (permission and ownership should be allowing your webserver (often with the username "apache") to edit the file.
Change your wordpress permalinks settings, and check that .htaccess file is correctly written.
Check that your apache configuration (etc/httpd/conf/httpd.conf in some linux distros) contains the directive AllowOverride FileInfo within your blog's <Directory></Directory> section
Options directive to FollowSymLinks should be the default, but if Options directive is mentionned, add FollowSymLinks for good measure.
when all that is done, don't forget to restart your Apache server. (sudo service httpd restart in my case, ymmv).
P.S : wrote this answer because I can't comment (don't have rep) on cnu's answer, and wanted to correct 1. allowoverride doesn't need to be set to ALL, it can be set to simply "FileInfo", 2. update the link to wordpress doc, and 3. provide background on the change in apache 2.4 that causes this issue.
|
b14ff54f308e1af6be465af3841b876458e3c84aca22bda398151563a97db804 | ['8834c42e0d1442e3aef14419fc6450e1'] | I'm trying to create a form handling 4 models at once with 2 nested pairs... Got an error: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.
Is there someone to guide me with this one? For your info I'm using rails 3.0. and I need to handle the 4 models in the same view... Thanks a lot for your help because this one is driving me nuts for days :)
Here is the controller's code:
def new
@pinvoice = Pinvoice.new
@journal = Journal.new
@compte = Compte.find(:all)
if Journal.last.nil?
then
@internal = 'Pinv1'
else
@internal = 'Pinv' + (Journal.last.id + 1).to_s
end
1.times {@pinvoice.pinvlines.build}
4.times {@journal.lignes.build}
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @pinvoice }
end
end
The models code:
class Pinvoice < ActiveRecord::Base
has_many :pinvlines, :dependent => :destroy
accepts_nested_attributes_for :pinvlines
end
class Pinvline < ActiveRecord::Base
belongs_to :pinvoice
belongs_to :compte
belongs_to :pinvoice
end
class <PERSON> < ActiveRecord::Base
belongs_to :journal
belongs_to :compte
attr_accessor :should_destroy
def should_destroy?
should_destroy.to_i == 1
end
end
class <PERSON><IP_ADDRESS>Base
has_many :pinvlines, :dependent => :destroy
accepts_nested_attributes_for :pinvlines
end
class Pinvline < ActiveRecord<IP_ADDRESS>Base
belongs_to :pinvoice
belongs_to :compte
belongs_to :pinvoice
end
class Ligne < ActiveRecord<IP_ADDRESS>Base
belongs_to :journal
belongs_to :compte
attr_accessor :should_destroy
def should_destroy?
should_destroy.to_i == 1
end
end
class Journal < ActiveRecord<IP_ADDRESS>Base
has_many :lignes, :dependent => :destroy
accepts_nested_attributes_for :lignes, :reject_if => lambda { |a| a[:montant].to_s == "0"}
attr_accessor :taux
attr_accessor :compte_tva
validates_presence_of :date
validates_presence_of :texte
validates_presence_of :montant_HTVA
validates_presence_of :banque
validates_presence_of :compte
before_update :delete_lignes
def delete_lignes
@lignes.each do |l|
if l.new_record?
l.save
else
l.destroy
end
end
end
end
and the big one the form:
<%= javascript_include_tag 'javascript_pinvlines_fields_new' %>
<%= form_for @pinvoice do |f| %>
<% if @pinvoice.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@pinvoice.errors.count, "error") %> prohibited this pinvoice from being saved:</h2>
<ul>
<% @pinvoice.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<%= f.label :internal %>
<%= f.text_field :internal, :value => @internal %><br />
<%= f.label :contact %>
<%= f.text_field :contact, :id => 'test' %>
<%= f.label :date_facture %>
<%= f.date_select :date_facture %>
<%= f.label :montant_total %>
<%= f.text_field :montant_total %>
</p>
<h2>Details</h2>
<%= f.fields_for :pinvlines do |builder| %>
<%= render "pinvline_fields", :f => builder %>
<%end%>
<p><%= link_to_add_fields "Ajouter une ligne", f, :pinvlines%></p>
<h2>Jounal</h2>
<%= fields_for @journal do |j| %>
<%= j.label :date %><br />
<%= j.text_field :date, :size => 10 %> <i> au format YYYY-MM-DD </i><br />
<%= j.label :texte %><br />
<%= j.text_field :texte%><br />
<%= j.label :banque %><br />
<%= j.text_field :banque %><br />
<%= j.label :montant_hors_tva %><br />
<%= j.text_field :montant_HTVA%><br />
<%= j.label :tva_id %><br />
<%= j.text_field :tva_id %><br />
<%= j.label :taux %><br />
<%= j.text_field :taux %><br />
<%= j.label :compte_tva %><br />
<%= j.text_field :compte_tva %><br />
<%= j.label :montant_TVA %><br />
<%= j.text_field :montant_TVA%><br />
<%= j.label :montant %><br />
<%= j.text_field :montant %><br />
<%= j.label :compte %><br />
<%= j.text_field :compte %><br />
<%= j.label :internal %><br />
<%= j.text_field :internal, :value => @internal%><br />
<%= j.label :source %><br />
<%= j.text_field :source%>
<br />
<h2>Lignes</h2>
<div class='container'>
<div class="duplicate">
<%= j.fields_for :lignes do |j| %>
<%= j.label :date %>
<%= j.text_field :date, :size=> 8 %>
<%= j.label :compte_id %>
<%= j.text_field :compte_id, :size=> 8 %>
<%= j.label :montant %>
<%= j.text_field :montant, :size=> 8 %>
<%= j.label :debit %>
<%= j.text_field :debit, :size=> 8 %>
<%= j.label :credit %>
<%= j.text_field :credit, :size=> 8 %>
<br />
<% end %>
</div>
</div>
<%end%>
<p><%= f.submit %></p>
<% end %>
| 7370ceeb788e8cca5dc2abb4b9f345549e64e51e25d771570f3d44fe8bc07d7c | ['8834c42e0d1442e3aef14419fc6450e1'] | I'm locked with a stupid issue in Rails 3... In fact, I'm building the css to design my application and I've a div called banner in which I want to integrate a logo (that is a png file). So I'm working on the views/layouts/application.html.erb.
I've put the image.png into the public/images folder.
In my css I use:
background-image: url("images/rails.png");
And nothing displays... It drives me nuts. Is there someone to help me with this basic question? Does it has something to do with Rails?
Thanks
|
29b3fb9c5892e16ed6f82acf20166ffe5464f9691c28439397f1f4d2cbb6f6b1 | ['8835f42693724a83a9d13e703b98a614'] | I am trying to make a website which tracks links deployed on other sites by different users of my site, Kind of like:
I dont know where to start, I just need someone to point me in right direction.
I see two ways with my little knowlage;
1) making a unique link like mywebsite/?id=userid&linkid=linkid
for each user, get the clicker to my site, increase the specific click counter and redirect user to the required site.
2) Use tools like google analytics.
What should I do? where to take the start? Thankyou so much.
| f5d7d743ef407cc8937954a6b1c49435954f857f26cbaf497e877675cd8abe59 | ['8835f42693724a83a9d13e703b98a614'] | I am new to python and trying to make a Tkinter label which would change its image at run time. Here is my code:
from Tkinter import *
from PIL import ImageTk, Image
import os
import time
#time.sleep(1)
class projector:
def __init__(self):
self.root = Tk()
self.frame = Frame(self.root)
self.label = Label(self.frame )
self.number = 1
def callback(self,e):
self.changeimage()
def check(self):
scr_height = self.root.winfo_screenheight()
scr_width = self.root.winfo_screenwidth()
image_src = "img/pattern/1.png"
im_temp = Image.open(image_src)
im_temp = im_temp.resize((scr_width, scr_height), Image.ANTIALIAS)
im_temp.save("ArtWrk.ppm", "ppm")
photo = PhotoImage(file="artwrk.ppm")
self.label.configure(image=photo)
self.label.pack()
self.frame.pack()
self.root.bind("<Return>", self.callback)
self.root.geometry("{0}x{1}+0+0".format(scr_width, scr_height))
#self.root.overrideredirect('true')
self.root.mainloop()
def nextpattern(self):
abc=''
def changeimage(self):
self.number= self.number+1;
path = "img/pattern/"+str(self.number)+".png"
self.image = ImageTk.PhotoImage(Image.open(path))
self.label.config(image = self.image)
print "loaded image "+ str(self.number)
def main():
projector().check()
if __name__ == "__main__":
main()
it works well if changeimage() method is attached to event listener and give sequence of images when enter is pressed. But when I try to change the label image using a loop it just shows me last image. Any suggestions how I can use changeimage() im loop ??
Help would be really appriciated.
|
57783161a9cee15d98077927e71ea25efedeb2c49bb0772bcd0cc5315321a83e | ['883a421302fd4c499d74125818f0f336'] | <PERSON> is right, but just so you know, it doesn't make sense to filter on an id unless you use info.object.filet(id__in=a) and a is a list of some sort. If you filter on a single id, you should be using objects.get(**kwargs) first of all, and it will return that specific Info instance instead of a QuerySet.
| 206f4b0162b724e69299ceffc6c39df6aa3c0d7a60d0af596d8e6b1970aae783 | ['883a421302fd4c499d74125818f0f336'] | Whoa whoa whoa. You should never ever have to put your project name in any of your app code. You should be able to reuse app code across multiple projects with no changes. Pinax does this really well and I highly recommend checking it out for a lot of django best practices.
The worst thing you could do here is to hard code your absolute path into your app or settings. You shouldn't do this because it will break during deployment unless you do some import local_settings hacking.
If you have to access the project root directory, try what pinax has in settings.py...
import os.path
PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
The thing is that it looks like you are trying to access the models module within the same app and this is waaay easier.
To import models.py inside scraper.py in the same directory just use import models or import models as app_models if you already have something named models in scraper.py (django.db.models for instance). Are you familiar with Python module conventions?
However, the best way is probably to stick with the django idiom, from ... import ... statement:
from app import models
If this doesn't work automatically, then something is wrong in your settings.py.
|
9196a31e53cefcee54614338085ce34d17d0ade511dd0d19803481dacce2671f | ['88494bc6b02a41b7b27abf65d89ce131'] | I'm making a game using Ren'py (based on python) and most errors aren't shown, especially the errors in python code. Is there a possibility to check for possible errors at compile time and how do I get where some errors occur? If there are errors the game normally doesn't run or breaks at the a errors appearance without a message.Is there maybe a file, where they are written in or something like that? Or do I have to debug using logs everywhere?
| 43a016c6e2af71a7be24033355338216eec01f7109ff6ed390c1488016af082f | ['88494bc6b02a41b7b27abf65d89ce131'] | I write some vertex data inside a shader to SSBO. Then I want to use the data written to the SSBO as VBOs. These will be used for the next draw call. How can this be done?
Here is, how I do it now, but it still segfaults:
int new_vertex_count = …;
int new_index_count = …;
int* new_indices = …;
GLuint ssbo[3];
glGenBuffers(3, ssbo);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo[1]);
glBufferData(GL_SHADER_STORAGE_BUFFER, new_vertex_count * 3 * sizeof(float), nullptr, GL_DYNAMIC_DRAW);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, ssbo[1]);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo[2]);
glBufferData(GL_SHADER_STORAGE_BUFFER, new_vertex_count * 2 * sizeof(float), nullptr, GL_DYNAMIC_DRAW);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 1, ssbo[2]);
glBindVertexArray(vao); //bind the original VAO
glPatchParameteri(GL_PATCH_VERTICES, 16);
glEnable(GL_RASTERIZER_DISCARD); //disable displaying
glDrawElements(GL_PATCHES, index_count, GL_UNSIGNED_INT, 0); //don't draw, just
glMemoryBarrier(GL_SHADER_STORAGE_BARRIER_BIT); //sync writing
glFinish();
glDisable(GL_RASTERIZER_DISCARD); //reanable displaying for next draw call
glBindVertexArray(0); //unbind original VAO in order to use new VBOs
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ssbo[0]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, index_count * sizeof(uint), indices, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, ssbo[1]); //bind SSBO as VBO, is this even possible?
//or should I use new VBOs and copy? How would I copy then?
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, ssbo[2]);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
glDrawElements(GL_PATCHES, new_index_count, new_indices, GL_UNSIGNED_INT, 0); //here the real drawing
|
5c223aa3918ccc15e1d7ce5a54642e42a1846eecb30c6afe71f887d8ed0b3f65 | ['8860bb672e264a0e8d86449924935d9e'] | I figured out the issue, It appears that angular doesn't work when you use the design view with ionic. I ended up creating a new blank project with app designer disabled and did everything from scratch and it works. If anyone else is having this issue with app designer let me know.
| 976e00a3c774d4ad0595d171a3c7a81b9b0d78ce27d21445ad392d1c8330497a | ['8860bb672e264a0e8d86449924935d9e'] | Here is the solution written in c++
#include <opencv2\opencv.hpp>
#include <iostream>
#include <vector>
#include <cmath>
using namespace cv;
using namespace std;
int main(int argc, char** argv) {
// Mat Declarations
// Mat img = imread("white.jpg");
// Mat src = imread("Rainbro.png");
Mat src = imread("multi.jpg");
// Mat src = imread("DarkRed.png");
Mat Hist;
Mat HSV;
<PERSON>;
Mat Grey;
vector<vector<Vec3b>> hueMEAN;
vector<vector<Point>> contours;
// Variables
int edgeThreshold = 1;
int const max_lowThreshold = 100;
int ratio = 3;
int kernel_size = 3;
int lowThreshold = 0;
// Windows
namedWindow("img", WINDOW_NORMAL);
namedWindow("HSV", WINDOW_AUTOSIZE);
namedWindow("Edges", WINDOW_AUTOSIZE);
namedWindow("contours", WINDOW_AUTOSIZE);
// Color Transforms
cvtColor(src, HSV, CV_BGR2HSV);
cvtColor(src, Grey, CV_BGR2GRAY);
// Perform Hist Equalization to help equalize Red hues so they stand out for
// better Edge Detection
equalizeHist(Grey, Grey);
// Image Transforms
blur(Grey, Edges, Size(3, 3));
Canny(Edges, Edges, max_lowThreshold, lowThreshold * ratio, kernel_size);
findContours(Edges, contours, CV_RETR_LIST, CV_CHAIN_APPROX_NONE);
//Rainbro MAT
//Mat drawing = Mat::zeros(432, 700, CV_8UC1);
//Multi MAT
Mat drawing = Mat::zeros(630, 1200, CV_8UC1);
//Red variation Mat
//Mat drawing = Mat::zeros(600, 900, CV_8UC1);
vector <vector<Point>> ContourPoints;
/* This code for loops through all contours and assigns the value of the y coordinate as a parameter
for the row pointer in the HSV mat. The value vec3b pointer pointing to the pixel in the mat is accessed
and stored for any Hue value that is between 0-10 and 165-179 as Red only contours.*/
for (int i = 0; i < contours.size(); i++) {
vector<Vec3b> vf;
vector<Point> points;
bool isContourRed = false;
for (int j = 0; j < contours[i].size(); j++) {
//Row Y-Coordinate of Mat from Y-Coordinate of Contour
int <PERSON> = int(contours[i][j].y);
//Row X-Coordinate of Mat from X-Coordinate of Contour
int MatCol = int(contours[i][j].x);
Vec3b *HsvRow = HSV.ptr <Vec3b>(MatRow);
int h = int(HsvRow[int(MatCol)][0]);
int s = int(HsvRow[int(MatCol)][1]);
int v = int(HsvRow[int(MatCol)][2]);
cout << "Coordinate: ";
cout << contours[i][j].x;
cout << ",";
cout << contours[i][j].y << endl;
cout << "Hue: " << h << endl;
// Get contours that are only in the red spectrum Hue 0-10, 165-179
if ((h <= 10 || h >= 165 && h <= 180) && ((s > 0) && (v > 0))) {
cout << "Coordinate: ";
cout << contours[i][j].x;
cout << ",";
cout << contours[i][j].y << endl;
cout << "Hue: " << h << endl;
vf.push_back(Vec3b(h, s, v));
points.push_back(contours[i][j]);
isContourRed = true;
}
}
if (isContourRed == true) {
hueMEAN.push_back(vf);
ContourPoints.push_back(points);
}
}
drawContours(drawing, ContourPoints, -1, Scalar(255, 255, 255), 2, 8);
// Calculate Mean and STD for each Contour
cout << "contour Means & STD of Vec3b:" << endl;
for (int i = 0; i < hueMEAN.size(); i++) {
Scalar meanTemp = mean(hueMEAN.at(i));
Scalar sdTemp;
cout << i << ": " << endl;
cout << meanTemp << endl;
cout << " " << endl;
meanStdDev(hueMEAN.at(i), meanTemp, sdTemp);
cout << sdTemp << endl;
cout << " " << endl;
}
cout << "Actual Contours: " << contours.size() << endl;
cout << "# Contours: " << hueMEAN.size() << endl;
imshow("img", src);
imshow("HSV", HSV);
imshow("Edges", <PERSON><IP_ADDRESS>zeros(432, 700, CV_8UC1);
//Multi MAT
Mat drawing = Mat<IP_ADDRESS>zeros(630, 1200, CV_8UC1);
//Red variation Mat
//Mat drawing = Mat<IP_ADDRESS>zeros(600, 900, CV_8UC1);
vector <vector<Point>> ContourPoints;
/* This code for loops through all contours and assigns the value of the y coordinate as a parameter
for the row pointer in the HSV mat. The value vec3b pointer pointing to the pixel in the mat is accessed
and stored for any Hue value that is between 0-10 and 165-179 as Red only contours.*/
for (int i = 0; i < contours.size(); i++) {
vector<Vec3b> vf;
vector<Point> points;
bool isContourRed = false;
for (int j = 0; j < contours[i].size(); j++) {
//Row Y-Coordinate of Mat from Y-Coordinate of Contour
int MatRow = int(contours[i][j].y);
//Row X-Coordinate of Mat from X-Coordinate of Contour
int MatCol = int(contours[i][j].x);
Vec3b *HsvRow = HSV.ptr <Vec3b>(MatRow);
int h = int(HsvRow[int(MatCol)][0]);
int s = int(HsvRow[int(MatCol)][1]);
int v = int(HsvRow[int(MatCol)][2]);
cout << "Coordinate: ";
cout << contours[i][j].x;
cout << ",";
cout << contours[i][j].y << endl;
cout << "Hue: " << h << endl;
// Get contours that are only in the red spectrum Hue 0-10, 165-179
if ((h <= 10 || h >= 165 && h <= 180) && ((s > 0) && (v > 0))) {
cout << "Coordinate: ";
cout << contours[i][j].x;
cout << ",";
cout << contours[i][j].y << endl;
cout << "Hue: " << h << endl;
vf.push_back(Vec3b(h, s, v));
points.push_back(contours[i][j]);
isContourRed = true;
}
}
if (isContourRed == true) {
hueMEAN.push_back(vf);
ContourPoints.push_back(points);
}
}
drawContours(drawing, ContourPoints, -1, Scalar(255, 255, 255), 2, 8);
// Calculate Mean and STD for each Contour
cout << "contour Means & STD of Vec3b:" << endl;
for (int i = 0; i < hueMEAN.size(); i++) {
Scalar meanTemp = mean(hueMEAN.at(i));
Scalar sdTemp;
cout << i << ": " << endl;
cout << meanTemp << endl;
cout << " " << endl;
meanStdDev(hueMEAN.at(i), meanTemp, sdTemp);
cout << sdTemp << endl;
cout << " " << endl;
}
cout << "Actual Contours: " << contours.size() << endl;
cout << "# Contours: " << hueMEAN.size() << endl;
imshow("img", src);
imshow("HSV", HSV);
imshow("Edges", Edges);
imshow("contours", drawing);
waitKey(0);
return 0;
}
|
bb9d52729a5f8737b58218dcbf42dd977555fd5adbc6ade8c451ce8103adee5a | ['8863a2f29f3a442d97cda6a441124bd9'] | There no straight solution how to do this, but some tricks can be used:
Use interactive console, follow same steps as in scenario, use assertions which fail - selenium stay open, so you can debug and evaluate what happens.
Use trick with wait. In cest file add "__fail" method where place "wait(300)" (for 5 min). Than on test launch your browser will stay open for 5 min
| afdec090c29c952ac63c612ea2cce3fd036661d78f9c32f28270dc919c93479d | ['8863a2f29f3a442d97cda6a441124bd9'] | I think the best way for you will be usage of "grabMultiple" ( PhpBrowser)
$p = $I->grabMultiple('.article-body p');
codecept_debug($p);
>> [
0 => "P1 text",
1 => "P2 Text",
2 => "P3 Text"
]
will give you back array of matched elements, so you can test how much of them you have, and check what text they have.
|
2a5727e7b3f6f43a6675364a9aa9fc6b850825df3510227cde566ec64e536af4 | ['886cfd985b6f4ccaac791682329c6d47'] | Is there any way to clear "Find what" (Ctrl+F) search parameter when after a search using "Find and Replace" on Excel? I realized it is not possigble to use Ctrl+A to select all the text inside the "Find what" box, so every time I need to clear this parameter I need to manually delete each character.
The best solution would be to automatically reset the Find and Replace to default after every search.
Second best solution would be to enable Ctrl+A inside Find and Replace box.
Any help would be appreciated.
| 0cc8ca622ca7df797c929661289f7c95d2fd5620ac03f4675d0d5612ab33c16f | ['886cfd985b6f4ccaac791682329c6d47'] | For batch image resizing I’ve looked at many packages and finally found one with a usable interface – converseen. Once you discover that the important settings are somewhat hidden on the scrollable left pane, all is well.
Not sure if this meets all of the OPs use cases, but you may not have to look at the quirky UIs of imagemagick or phatch.
Oddly, photo management packages like digikam, f-spot, fotoxx or shotwell don't seem to recognize the need for copying/resizing batches of images before uploading to online services like photobucket or (gag) flickr. These services want us to do things their way only so I do not trust them for backing up originals.
|
08c6f15fb12b1e2897eefc069facacd44bc7eebf4b4f5af7449978d452b1d0e9 | ['8870c1df81844941866d52283a81a9c4'] | Note that the issue on which the person is undecided has to be the truth/falsity of some proposition. So that example only "works" to the extent the reader understands you to be talking about the issue of whether "one should [or ethically can] eat meat". If the speaker was instead talking about their own eating, it would be either a misuse of 'agnostic' in place of 'undecided' (e.g. "I haven't decided whether to go vegetarian") or a rather unusual way of speaking about something the truth of which they controlled (e.g. "I take no position on whether I'm about to pick a vegetarian entree"). | 4262366f800d3bd43e30a8751b5a4a0f9e4e9f9b3a1d66f3f971176d7566e6ce | ['8870c1df81844941866d52283a81a9c4'] | Ah Thx! looks better, but now i see 2 spikes (0,20) and at (-20,0) where they spike high up to 8000? The actual output for both is actually 20. Strange. The flat sheet on the bottom makes sense since those values all equate to ~1.41 level. So are all the imaginary parts not shown at all then? Again: I also like to display integer-outputs only if possible |
fb5ea8eff952a9d24262c2cf4096a4641fbaf17317c3dd8b1d5dcde3932ebd9a | ['8877c5ac01ea44709ae47356a8932251'] | As already pointed out by <PERSON>, CUDA compiler does not generate proper assembly for infinite loops. And of course there are certain situations when it's a perfect solution, e.g. running a background service kernel, which receives updates from host, pushed over host-mapped memory.
One workaround, which works as of CUDA 9.2:
volatile int infinity = 1;
while (infinity)
{
...
}
Doing infinite loop inside a divergent branch is obviously not a good idea. Other than that, improper handling of while (1) construct IMO is definitely a bug.
| 0b05b9f84d4ce3cfecd7c8fdf23419484702925125bf8d9ff4a03dff311f2359 | ['8877c5ac01ea44709ae47356a8932251'] | CoreMediaIO framework has two backend plugins: VDC (for USB-based cameras), and AppleCamera - for Apple's know-how ISP over pcie camera sensors. The VDC camera reports the current exposure value as expected, while AppleCamera always returns 0.0 for the current exposure.
I've traced this phenomena in AppleCamera down to the point where the framework receives the values from the sensor. Actually, regardless of what minimum/maximum/current exposure value is requested, they all always come out as a single vector of floats. Different offsets denote specific values:
-> 0x10049b2c0 <+2293>: movss 0x60(%rdi), %xmm0 ; xmm0 = mem[0],zero,zero,zero
(lldb) p *(float*)&$xmm0
(float) $30 = -3
-> 0x10049b2cc <+2305>: movss 0x64(%rdi), %xmm0 ; xmm0 = mem[0],zero,zero,zero
(lldb) p *(float*)&$xmm0
(float) $33 = 3
(lldb) image lookup -a $pc
Address: AppleCamera[0x000000000000310c] (AppleCamera.__TEXT.__text + 7036)
Summary: AppleCamera`GetSuspendedByUser + 1857
-> 0x10049b110 <+1861>: movss 0x58(%rdi), %xmm0 ; xmm0 = mem[0],zero,zero,zero
(lldb) p *(float*)&$xmm0
(float) $37 = 0
Here, -3 and 3 are min/max allowed values for exposure, but the current value is always zero. Here is how they look as a vector altogether:
(float) [20] = 0
(float) [21] = 0
(float) [22] = 0
(float) [23] = 0
(float) [24] = -3
(float) [25] = 3
(float) [26] = 0
(float) [27] = 0.<PHONE_NUMBER>
(float) [28] = 0
(float) [29] = 0
(float) [30] = 0
(float) [31] = 0
Here, 0.05 is something else, which does not change - maybe the focal distance.
Every camera sensor obviously can report the current exposure, which is essential for many image processing techniques. The VDC plugin does it. So what's the problem with the AppleCamera? A driver bug?
|
1afde11fa1a58970fb46de2b0217422a9e640ac67ff9383abd8b2dd54b34c602 | ['8883d5eaf3aa478d8b96983c50d7361f'] | you need to just select sticky post option form your post.
Then automatically work your scenario.
Example:
if you have selected one sticky post and you have set post per page 4 then wp_query will fetch the sticky post first and then show the other 3 posts.
if you have not selected sticky post and you have set post per page 4 then wp_query will fetch the only 4 posts without a sticky post.
It is WordPress default behaviour.
| bb0371f6b62ea4c137c4f6efd56d3a41c0a904917c074158e5192ad4412b0608 | ['8883d5eaf3aa478d8b96983c50d7361f'] | There are many ways to change the greyed out URL.
Here I have shared all 3 methods for the same.
1) Change WordPress Site URLs from Admin Area
This is the easiest method to change the greyed out URL.
Simply login to your WordPress website and go to Settings » General page. From here you can change WordPress site URLs under the ‘WordPress Address’ and ‘Site Address’ options.
2) Change WordPress Site URLs Using functions.php File
Please follow below path and open functions.php file
go to /wp-content/themes/your-theme-folder/.
Next, you need to add the following code at the bottom:
update_option( 'siteurl', 'https://example.com' );
update_option( 'home', 'https://example.com' );
3) Change WordPress Site URLs Using wp-config.php File
Simply open wp-config.php file from your root directory
You need to add the following code just above the line that says ‘That’s all, stop editing! Happy publishing’.
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );
Also, you do with the database but I am not recommended.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.