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 |
|---|---|---|---|---|---|
1001f05b9412540e31d81a0ebaf2abea88fa81292a578390e9f01b798035fd82 | ['0081ef0f96ab47ae930b0df926395662'] | This sounds like an async problem, is not the best idea to make AJAX calls in a loop, you can replicate a loop with recursivity though, have the function only make one call, and call the function again when each call is finished, and add a breakpoint with an if that checks if you're finished.
| 309ebf98b3df1cb3094f71bef6091c42c2b3b33129f85f630dc88f6752321fff | ['0081ef0f96ab47ae930b0df926395662'] | I'm having an issue where the whitelist plugin won't work for Android, which causes every AJAX call to return a 404, this breaks my app since I can't connect to my backend server. iOS works fine because it doesn't require this plugin, if I check the plugins list in http://build.phonegap.com it does appear, what could be happening here?
Here's my config.xml (this project uses XDK by the way, so my config.xml is built by it:
<?xml version="1.0" encoding="UTF-8" ?>
<widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:android="http://schemas.android.com/apk/res/android" android-versionCode="7" ios-CFBundleVersion="7" version="1.0.7" id="com.project.app" >
<!-- This file was generated by the Intel XDK Cordova Package Build tool. -->
<name>PROJECT NAME</name>
<description>PROJECT DESCRIPTION</description>
<author>COMPANY</author>
<content src="index.html"/>
<preference name="android-build-tool" value="gradle" />
<platform name="android" >
<allow-intent href="tel:*"/>
<allow-intent href="geo:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="http://app.project.com/"/>
<allow-intent href="maps:*"/>
<allow-intent href="http://maps.google.com/"/>
<access origin="*"/>
<access origin="http://app.project.com/"/>
<access origin="tel:*"/>
</platform>
<platform name="ios" >
<allow-intent href="tel:*"/>
<allow-intent href="geo:*"/>
<allow-intent href="mailto:*"/>
<allow-intent href="http://app.project.com/"/>
<allow-intent href="https://www.google.com/maps"/>
<allow-intent href="https://*.google.*"/>
<access origin="*"/>
<access origin="http://app.project.com/"/>
<access origin="tel:*"/>
</platform>
<preference name="phonegap-version" value="cli-6.5.0" />
<preference name="xwalkMultipleApk" value="false" />
<plugin name="cordova-plugin-device" spec="1.1.6"/>
<plugin name="ionic-plugin-keyboard" spec="2.2.1"/>
<plugin name="phonegap-plugin-push" spec="1.4.3"/>
<plugin name="cordova-plugin-inappbrowser" spec="1.7.1"/>
<plugin name="cordova-plugin-splashscreen" spec="4.0.3"/>
<plugin name="cordova-plugin-statusbar" spec="2.2.3"/>
<plugin name="cordova-plugin-whitelist" spec="https://github.com/apache/cordova-plugin-whitelist"/> <!-- If available via Cordova registry; consider changing to an NPM reference. -->
<platform name="android" >
<preference name="android-minSdkVersion" value="16"/>
<preference name="android-targetSdkVersion" value="23"/>
<preference name="android-installLocation" value="auto"/>
<preference name="android-signed" value="true"/>
<preference name="AndroidLaunchMode" value="singleTop"/>
</platform>
<platform name="ios" >
<preference name="deployment-target" value="9.0"/>
<preference name="ios-configuration" value="production"/>
</platform>
<splash platform="android" src="package-assets/splashs/ANDROID/320x426.png" density="ldpi" width="320" height="426" orientation="portrait"/>
<splash platform="android" src="package-assets/splashs/ANDROID/320x470.png" density="mdpi" width="320" height="470" orientation="portrait"/>
<splash platform="android" src="package-assets/splashs/ANDROID/480x640.png" density="hdpi" width="480" height="640" orientation="portrait"/>
<splash platform="android" src="package-assets/splashs/ANDROID/720x960.png" density="xhdpi" width="720" height="960" orientation="portrait"/>
<splash platform="ios" src="package-assets/splashs/ios/640x960.png" width="640" height="960" orientation="portrait"/>
<splash platform="ios" src="package-assets/splashs/ios/640x1136.png" width="640" height="1136" orientation="portrait"/>
<splash platform="ios" src="package-assets/splashs/ios/750x1334.png" width="750" height="1334" orientation="portrait"/>
<splash platform="ios" src="package-assets/splashs/ios/768x1024.png" width="768" height="1024" orientation="portrait"/>
<splash platform="ios" src="package-assets/splashs/ios/1242x2208.png" width="1242" height="2208" orientation="portrait"/>
<splash platform="ios" src="package-assets/splashs/ios/1536x2048.png" width="1536" height="2048" orientation="portrait"/>
<splash platform="ios" src="package-assets/splashs/ios/2048x2732.png" width="2048" height="2732" orientation="portrait"/>
<icon platform="android" src="package-assets/iconos/android/project48.png" density="mdpi" width="48" height="48"/>
<icon platform="android" src="package-assets/iconos/android/project72.png" density="hdpi" width="72" height="72"/>
<icon platform="android" src="package-assets/iconos/android/project96.png" density="xhdpi" width="96" height="96"/>
<icon platform="ios" src="package-assets/iconos/ios/project29.png" width="29" height="29"/>
<icon platform="ios" src="package-assets/iconos/ios/project58.png" width="58" height="58"/>
<icon platform="ios" src="package-assets/iconos/ios/project87.png" width="87" height="87"/>
<icon platform="ios" src="package-assets/iconos/ios/project60.png" width="60" height="60"/>
<icon platform="ios" src="package-assets/iconos/ios/project120.png" width="120" height="120"/>
<icon platform="ios" src="package-assets/iconos/ios/project180.png" width="180" height="180"/>
<icon platform="ios" src="package-assets/iconos/ios/project76.png" width="76" height="76"/>
<icon platform="ios" src="package-assets/iconos/ios/project152.png" width="152" height="152"/>
<icon platform="ios" src="package-assets/iconos/ios/project80.png" width="40" height="40"/>
<icon platform="ios" src="package-assets/iconos/ios/project57.png" width="57" height="57"/>
<icon platform="ios" src="package-assets/iconos/ios/project114.png" width="114" height="114"/>
<icon platform="ios" src="package-assets/iconos/ios/project72.png" width="72" height="72"/>
<icon platform="ios" src="package-assets/iconos/ios/project144.png" width="144" height="144"/>
<icon platform="ios" src="package-assets/iconos/ios/project50.png" width="50" height="50"/>
<icon platform="ios" src="package-assets/iconos/ios/project100.png" width="100" height="100"/>
<icon platform="ios" src="package-assets/iconos/ios/project187.png" width="187" height="187"/>
<config-file platform="android" parent="/manifest/application" mode="merge">
<activity android:launchMode="singleTop" />
</config-file>
</widget>
|
aab0350d86611300b92b92d7c7da317f85e5ba6ff6b5936a78ef6faa84617a0c | ['00a1abe772544c06a62466a74198273f'] | I am writing a script that needs to save some information out of an email. I have cpanel setup on my webserver to pipe emails to a certain address to my python script. I can see that the data is coming in correctly through,
email = sys.stdin.readlines()
but I cannot figure out how to decode it to see the different message parts. I have read the python documentation on MIME, but have had no success decoding the messages.
How do I decode these MIME messages and access their different parts?
| 309add47014555100e6e999e924b948d6ccc13aeea831819cf190cf952a25b46 | ['00a1abe772544c06a62466a74198273f'] | I have cpanel set to pipe emails to a python script. I will eventually have to write to files with this script, so I am trying a very basic script now.
#! /usr/bin/python
import sys
def main():
y = open("mail.txt", "a")
for line in sys.stdin:
y.write(str(line))
y.close()
main()
When I pipe something to it from the command line, it works fine, but I when I send an email to it, it bounces back with an IO error.
IOError: [Errno 13] Permission denied: 'mail.txt'
What am I doing wrong?
|
abbfe6d9c015ef3a57334f6f3b072a09d0f725e7816f3f9678b14024e32505df | ['00a9204792104e8a898db25074f7508f'] | I found an answer to it (source).
So, usually, BERT outputs vectors of shape
[batch_size, sequence_length, embedding_dim].
where,
sequence_length = number of words or tokens in a sequence (max_length sequence BERT can handle is 512)
embedding_dim = the vector length of the vector describing each token (768 in case of BERT).
thus, input = torch.randn(batch_size, 512, 768)
Now, we want to convolve over the text sequence of length 512 using a kernel size of 2.
So, we define a PyTorch conv1D layer as follows,
convolution_layer = nn.conv1d(in_channels, out_channels, kernel_size)
where,
in_channels = embedding_dim
out_channels = arbitrary int
kernel_size = 2 (I want bigrams)
thus, convolution_layer = nn.conv1d(768, 100, 2)
Now we need a connecting link between the expected input by convolution_layer and the actual input.
For this, we require to
current input shape [batch_size, 512, 768]
expected input [batch_size, 768, 512]
To achieve this expected input shape, we need to use the transpose function from PyTorch.
input_transposed = input.transpose(1, 2)
| 3fb33ee1da0158fb176f509a87bf1fad96342102e9cc7f5b05a1bf400584eb6a | ['00a9204792104e8a898db25074f7508f'] | Suppose, I have a 3D tensor A
A = torch.arange(24).view(4, 3, 2)
print(A)
and require masking it using 2D tensor
mask = torch.zeros((4, 3), dtype=torch.int64) # or dtype=torch.ByteTensor
mask[0, 0] = 1
mask[1, 1] = 1
mask[3, 0] = 1
print('Mask: ', mask)
Using masked_select functionality from PyTorch leads to the following error.
torch.masked_select(X, (mask == 1))
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-72-fd6809d2c4cc> in <module>
12
13 # Select based on new mask
---> 14 Y = torch.masked_select(X, (mask == 1))
15 #Y = X * mask_
16 print(Y)
RuntimeError: The size of tensor a (2) must match the size of tensor b (3) at non-singleton dimension 2
How to mask a 3D tensor with a 2D mask and keep the dimensions of the original vector? Any hints will be appreciated.
|
eceecc371b02cf1d52879faf44e6117ab4d86a52aacf2488f621bf12bd50e06b | ['00b70fcde58c4091b06e77fcf6cb9d7c'] | Use CDbCommand instead
$rawData=Yii<IP_ADDRESS>app()->db->createCommand()
->select('*, 3963 * acos(cos(radians('.$distanceString['latitude'].')) * cos(radians(latitude)) * cos(radians('.$distanceString['longitude'].') - radians(longitude)) + sin(radians('.$distanceString['latitude'].')) * sin(radians(latitude))) AS distance')
->from('TableName')
->where($sqlCondition)
->order('distance')->queryAll(true,$sqlVariables);
eg. together with CArrayDataProvider
$dataProvider=new CArrayDataProvider($rawData);
// $dataProvider->getData() will return a list of arrays.
| 6c117f72992a8552d150759d2a39431ba630fba55215848eb40328eb50a75288 | ['00b70fcde58c4091b06e77fcf6cb9d7c'] | I would guess it's because $db is static.
Inspired by:
http://www.yiiframework.com/wiki/123/multiple-database-support-in-yii/
I would try something like this, in your SynchroAR class.
...
private $_currentDb = null;
public function setDb($db = null)
{
if($db === null)
{
$this->_currentDb = null;
parent<IP_ADDRESS>$db->setActive(true);
}
else
{
$this->_currentDb = $db;
$this->_currentDb->setActive(true);
}
}
public function getDbConnection()
{
if($this->_currentDb !== null)
return $this->_currentDb;
else
return parent<IP_ADDRESS>$db;
}
protected function runSynchro($method)
{
$this->goSynchro = false;
foreach($this->entryConns as $conn)
{
$this->setDb($conn);
call_user_func(array($this, $method));
}
$this->goSynchro = true;
$this->setDb();
}
|
1f6e330e95ee7713faf1e07410211054a392791216237a8709e866c35c3d409d | ['00bf0e9da3164313be3dd2b4f326c733'] | I commented that the performance would not be good, but that I was showing a regex option. And though the name of the function begins with parse, I'm not sure the op's question was to completely determine whether the entire file was valid. I'm not going to write an entire parser in my answer, but showing the possibility to match some things with regex. I already noted in the answer both things you bring up in the comment. | 6eb3fdd1e5e8a6c2da566fc45d148761a1af594f7ff17d910def0545cb428911 | ['00bf0e9da3164313be3dd2b4f326c733'] | I was running a Python program that used the camera and closed the program that I had created but left Python open. When testing a C++ program with the camera I was getting this error even though I had the Python program that I created closed.
After I closed Python itself then my camera was able to work in C++
|
8ffb522e4e6a83494e827acad6f8e32901a0bd78b7da9b2878a6e04292dd3a85 | ['00c46ec5642e42b281dce81fd0bde6d0'] | class RegistrationsController < ApplicationController
def create
user = User.new(
email: params['user']['email'],
name: params['user']['name'],
password: params['user']['password'],
password_confirmation: params['user']['password_confirmation']
)
if user.save
session[:user_id] = user.id
render json: {
status: :created,
user: user
}
else
render json: { errors: user.errors }, status: 500
end
end
end
After that your validations will be available here:
.catch(error => {
console.log("registration error", error.response.data.errors);
});
So you will receive array of validation errors
| de1e77a4feffdb50f0a73a024c88fcfb898ab0b36c5c6bf5fb18dae9ecb85713 | ['00c46ec5642e42b281dce81fd0bde6d0'] | You can add conditional actions to the index table:
ActiveAdmin.register Website do
actions :index
index do
selectable_column
id_column
column :state
column :name
column :created_at
column :updated_at
actions do |website|
item('Verify state', verify_admin_websites_path(website.id), class: 'member_link') if website.state == 'draft'
end
end
member_action :verify do
# do your magic here, like or whatever you do
WebsiteVerifyStateService.process!
redirect_back(fallback_location: root_path)
end
end
|
f4384a6ecb64dbfa00b16c03c5cbd017d2ef82c54187c870aa3533aa5e1da522 | ['00c76d13a2704737a270559f5ba050ce'] | I'm having a problem with Ajenti V Website Custom configuration
I need to enable this directive for one of my websites:
client_max_body_size 8M;
If i try to put this
http {
client_max_body_size 8M;
}
in Custom configuration or in Custom top level configuration, but after that, nginx stops to work
and if I type:
nginx -t
it shows this:
nginx: [emerg] "http" directive is not allowed here in /etc/nginx/conf.d/xxxxx.conf:18
Where I should put this directive?
Thanks
| 67b9768a73490ce941e93489bd6b59746d921956538e3bae8da5fa0289fa2a7d | ['00c76d13a2704737a270559f5ba050ce'] |
I need to custom the output of Woocommerce Products Categories Widget showing the percentage discount for that category (Discount_Price*100/Standard_Price).
I can easily create a function that takes from the first product of that category:
Discount Price
Standard Price
and calculate the percentage discount, but I don't know how to show it in the output of the widget like this:
First Category (50% discount)
Second Category (30% discount)
Can you help me?
Thanks
|
817d9b15ced3150896dea1df943ce10144a011f321bd3d3ac1c407a65e840145 | ['00ca94729f8e488980b8628fa7b99206'] | Your statement "Damagecalculator.effectiveness[256]" makes no sense. You don't define or assign anything here. I think that's why the compiler complains. You're using the array wrong. Just use a simple integer to set the effectiveness. If you want the effectiveness to be set at this specific numbers, you should use enumerators.
| d49ed0044e505107e8c6c96dd76bfef84ac30676a0e97ab3d167fb94fdeb120b | ['00ca94729f8e488980b8628fa7b99206'] | I'm not familiar with Python, but I would place the biggest number in front of the string/calculation so the strings match.
Sorry if this code is not Python-like, but I think you'll get the thing.
...
int a;
int b;
string c;
if(a+b == 10)
{
if(a>b)
{
c = a + "+" + b + "=10";
}
else
{
c = b + "+" + a + "=10"
}
}
...
Then add string c to your list like you used to, checking for duplicates.
I hope this is the answer for you!
|
2bdf4fb0f37e39d62ba6fb1ccb6e93dc9f9d5f40930e5ccabf86f3d76e11289c | ['00cd78a520a84787ae3bcd3d7ab63b06'] | Is is possible to define foreign keys referencing multi columns in another model?
For example one foreign key references a two-column index in the product table, and the SQL statement:
FOREIGN KEY (product_category, product_id) REFERENCES product(category, id)
BTW I've looked into django.contrib.contenttypes and don't think that's the perfect solution for this kind of scenario.
| 6fba163bb3ff5d7450956066f94e610df9ff9e16ceab7cb436839f92fdc91404 | ['00cd78a520a84787ae3bcd3d7ab63b06'] | If you are doing this on NTFS, here's a lib for low level access: NTFSLib.
You can enumerate through all file records in $MFT, each representing a real file on disk. You can get all file attributes from the record, including $DATA.
This may be the fastest way to enumerate all files/directories on NTFS volumes, 200k~300k files per minute as I tested.
|
cdbb36a60ce5b05e25dee23e8e48b79b4d6c72f4e13666f5d3373dce5824f6d5 | ['010b575c03a14b928c70a3b598263913'] | Thanks for the reply. It turns out that only (n-1)*(m-1) values are needed to fully determine the probability table. So, it suffices to constrain the first (n-1) and (m-1) values of each row and column respectively to be less than the given marginals and also constrain all values to be greater than 0. The remaining values can then be easily calculated. | 054de196462150fb111fb7f199a84d84b1b0e28b8a0631a65cc97eb794cb5555 | ['010b575c03a14b928c70a3b598263913'] | You are already doing the correct thing below, with Response.Write.
I would change GetInfo to return an Array of strings, and then use String.Join.
string[] theTicket = getInfo(context, ticketId);
Response.Write(String.Join(",", theTicket);
otherwise you could loop through your arraylist and build the comma separated list yourself. then you can parse the comma separated values in js.
The better option, would be to use a json library and serialize the ArrayList as json and use that on the client side.
|
9de82421701ef41abe69f3c34fa14c43271e3e9270345ab7570623ab855815c5 | ['010ec45c61954e7d8020e9a517204908'] | As the box edges are generally thinner (as in your case) than the text inside them, we can leverage this information.
By applying a horizontal morphological closing kernel (Dilation -> Erosion), we can make thin vertical lines white, which will help OCR. Some trash may be left after processing but that wouldn't hinder OCR accuracy. The size of the kernel depends on the width of the border lines. Obviously, you can tweak it as per your case.
Here is the sample code:
import cv2
import numpy as np
im = cv2.imread('sample_image.png')
im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
k1 = (4,1)
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, k1)
im = cv2.morphologyEx(im, cv2.MORPH_CLOSE, kernel, iterations=1)
_,im = cv2.threshold(im, thresh=200, maxval=255, type=cv2.THRESH_BINARY)
cv2.imwrite('sample_output.png',im)
And here are the images:
sample_image.png
sample_output.png
| a91dc251c479a7ace7939a2638628cecb2487494610e54eee0582f5c67a91034 | ['010ec45c61954e7d8020e9a517204908'] | Both models have different architectures so weights of one can't be loaded into another,irrespective of that they inherited same base model. I think it is a simple case of fine-tuning a model (saved model in your case).
What you should do is change the way to create new model, i.e. rather than loading the original resnet model as base model with include_top = False, you should try loading the saved model and implementing your own include_top. This can be done as:
for layer in saved_model.layers[:]:
layer.trainable = False
x = Flatten()(saved_model.layers[-2].output)
Here the key thing is saved_model.layers[-2].output which means output from the second last layer.
Hope it helps, if not please clarify your doubts or let me know what I missed.
|
d09ad56dc4a2980217a8e648d2389a717b83141dc99be0cc4408455170ba5194 | ['0118893983da40dd9a3bca3dadb42c24'] | I'm having some problems with if function in R.
First I tried this:
test<-matrix(10,3,3)
if(test[2,2]==10) {test[2,2]<-5}
Ok, it's doing what I want. So, I will try this:
if(Hylo.Measures[i,3]=="CLc0006x") {Hylo.Measures[i,3]<-"CLc0005x"}
Ops! I got the following message:
Warning message:
In `[<-.factor`(`*tmp*`, iseq, value = "CLc0005x") :
invalid factor level, NA generated
I couldn't figure out what is going on here!
What obvious step am I missing?
| 59152f45bccd9c432654496e5e8480af4562dfc31bb14a52390b0e73fcce6591 | ['0118893983da40dd9a3bca3dadb42c24'] | So, I built a function called sort.song.
My goal with this function is to randomly sample the rows of a data.frame (DATA) and then filter it out (DATA.NEW) to analyse it. I want to do it multiple times (let's say 10 times). By the end, I want that each object (mantel.something) resulted from this function to be saved in my workspace with a name that I can relate to each cycle (mantel.something1, mantel.somenthing2...mantel.something10).
I have the following code, so far:
sort.song<-function(DATA){
require(ade4)
for(i in 1:10){ # Am I using for correctly here?
DATA.NEW <- DATA[sample(1:nrow(DATA),replace=FALSE),]
DATA.NEW <- DATA.NEW[!duplicated(DATA.NEW$Point),]
coord.dist<-dist(DATA.NEW[,4:5],method="euclidean")
num.notes.dist<-dist(DATA.NEW$Num_Notes,method="euclidean")
songdur.dist<-dist(DATA.NEW$Song_Dur,method="euclidean")
hfreq.dist<-dist(DATA.NEW$High_Freq,method="euclidean")
lfreq.dist<-dist(DATA.NEW$Low_Freq,method="euclidean")
bwidth.dist<-dist(DATA.NEW$Bwidth_Song,method="euclidean")
hfreqlnote.dist<-dist(DATA.NEW$HighFreq_LastNote,method="euclidean")
mantel.numnotes[i]<<-mantel.rtest(coord.dist,num.notes.dist,nrepet=1000)
mantel.songdur[i]<<-mantel.rtest(coord.dist,songdur.dist,nrepet=1000)
mantel.hfreq[i]<<-mantel.rtest(coord.dist,hfreq.dist,nrepet=1000)
mantel.lfreq[i]<<-mantel.rtest(coord.dist,lfreq.dist,nrepet=1000)
mantel.bwidth[i]<<-mantel.rtest(coord.dist,bwidth.dist,nrepet=1000)
mantel.hfreqlnote[i]<<-mantel.rtest(coord.dist,hfreqlnote.dist,nrepet=1000)
}
}
Could someone please help me to do it the right way?
I think I'm not assigning the cycles correctly for each mantel.somenthing object.
Many thanks in advance!
|
47f69e25970e72fb07b786a78ec9bcc01bce904eafe9d436a858477c783c8f6e | ['0119e1de790c49adb5f5da74a7fe10ee'] | Thanks for your info <PERSON> i've starting do some research and playing around with sample code and realised my database provider, microsoft azure, does not support sqldependancy to be able to trigger messages to clients (unless you pay ALOT for sql managed instance). Is it possible to trigger a message as the result an API hit in my scenario above? do you have any pointers to some resourses i could look at? thanks. | 1eb3f4ee9e32c5ac1a69fb1915c13a609f4b432c442585eab774fb5e97ec5361 | ['0119e1de790c49adb5f5da74a7fe10ee'] | Also how can these published messages get triggered? Can you setup some trigger that would then cause a new message to be sent to a subscriber? maybe whenever an insert happens on a database table? or whenever a particular api is accessed from a customer (e.g. create customer order api)? Any pointers <PERSON> |
8f5a87212c36e316a7aba67c73f84933b305b85aee605200476a34b75dd236f4 | ['011d56219aed404fb29ae1c9db3891cd'] | The Solution here is to use pyspark.sql.functions.split() function.
df = sqlContext.createDataFrame([
(1, '14-Jul-15'),
(2, '14-Jun-15'),
(3, '11-Oct-15'),
], ('id', 'date'))
split_col = pyspark.sql.functions.split(df['date'], '-')
df = df.withColumn('day', split_col.getItem(0))
df = df.withColumn('month', split_col.getItem(1))
df = df.withColumn('year', split_col.getItem(2))
df = df.drop("date")
| 0afd894773ff082b111bf2169641b3a4b5e61772aa2251463bda2e8a4d889efc | ['011d56219aed404fb29ae1c9db3891cd'] | There are two ways we can do that:
Method 1: Use argsparse and pass all the required variables while executing the script.
parser = argparse.ArgumentParser(
description="Usage: spark2-submit ens_load_pb_sdps.py <sdp_name>")
parser.add_argument(
"-start_date", "--start_date"
type=date,
help='start date for query')
parser.add_argument(
"end_date", "--end_date"
type=date,
help='start date for query')
parser.add_argument(
"-table_name", "--table_name"
type=date,
help='start date for query')
parser.add_argument(
"-file_path", "--file_path"
type=date,
help='start date for query')
parser.add_argument(
"partition_name", "--partition_name"
type=date,
help='start date for query')
parser.add_argument(
"-partition_value", "--partition_value"
type=date,
help='start date for query')
args = parser.parse_args()
start_date, end_date, table_name, file_path, partition_name, partition_value = args.start_date, args.end_date, args.table_name, args.file_path, args.partition_name, args.partition_value
query_stmt="""
SELECT * FROM parquet.{file_path}/{table_name}/data
WHERE {partition_name} = {partition_value} AND (my_date >= '{start_date}' AND
my_date <= '{end_date}')
""".format(file_path=file_path, table_name=table_name, partition_name=partition_name, \
partition_value=partition_value, start_date=start_date, end_date=end_date)
Method2: Use a conf file
Also instead of passing the value while executing the scripts, we can keep the value in a conf json file and then load that json file into a python dict and then use it while forming the query.
Inside Json File - conf.json
{
"start_date": "2019-01-01",
"end_date": "2020-01-01",
"partition_name": "name",
"partition_value": "<PERSON>",
"file_path": "C://files/dummyPathh/",
"table_name": "dummyTable"
}
Python code to load the conf file -
file_path = "C://path/to/config" // path to conf file
json_file = glob.glob(file_path)
with open(json_file, 'r', encoding="utf8") as file:
conf_object = json.load(file)
start_date, end_date, table_name, file_path, partition_name, partition_value = conf_object.start_date, conf_object.end_date, conf_object.table_name, conf_object.file_path, conf_object.partition_name, conf_object.partition_value
query_stmt="""
SELECT * FROM parquet.{file_path}/{table_name}/data
WHERE {partition_name} = {partition_value} AND (my_date >= '{start_date}' AND
my_date <= '{end_date}')
""".format(file_path=file_path, table_name=table_name, partition_name=partition_name, \
partition_value=partition_value, start_date=start_date, end_date=end_date)
You can change the value in the conf file for running different queries.
To take it one step more <PERSON>,
You can make a nested dict json conf file and then use it so that you don't have to edit the conf file each time we run the query.
|
4bb84613655de4e6f2aa20acbfda197b3652bb2df9bff0aceaf38475b74b361e | ['012c36844d45459cafc15c9e2d34d829'] | Your code is right i didn't find any problem in your code it should scroll till that element is visible.
Don't use absolute xpath, it's good practice to always use dynamic xpaths.
Please try below code,
browser.executeScript('window.scrollTo(0,0);').then(function () {
page.saveButton.click();
})
| b10323feeb71a84301bbcb84c52673abdf9c6e2694890f0ee0cc638bce8b23ad | ['012c36844d45459cafc15c9e2d34d829'] | Its good practice to use page load time out wherever you are navigating to new web page.
it will wait till all the element gets loaded or till 40 sec. so basically it will check for two conditions
till all elements to be loaded
till 40 sec. (you can give time as per your requirement)
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
|
c9b63cff91e3a31e54bf60e149b69730553bcaa8662a2242f27a63edd76ce9df | ['013347e5f07546e0864f29e45c0bbf1a'] | I am creating a website for an organisation. All of the user details are retrieved from the Microsoft Graph API. The only thing I need help with is that after retrieving the binary for the current user's profile picture, I don't know where I should store the picture. I have figured out how to convert the binary to base64 and display it on the webpage, I just don't know where to place the image. I would prefer not storing it in the database or storing it permanently on the server. I have experimented with storing it in the session token, but that didn't work as the session token was not big enough to store all that data. My website is using Python 3.7.0 and Flask with Jinja2 as the templating system. On the front end, I am using JavaScript and JQuery. Any suggestions would be greatly appreciated! Thanks in advance.
| 69172e9ede81bd232871d0d45d4a0dfd7cf896adb07474e5b51f9e82d4d49edc | ['013347e5f07546e0864f29e45c0bbf1a'] | I found out that if you separate the logic in the event listener into its own function, you could just call that function when the button is pressed.
const input = document.getElementById("inpt");
input.addEventListener('input', function() {
changeText();
});
const btn = document.getElementById("btn");
btn.addEventListener('click', function() {
input.value = "";
changeText();
});
function changeText() {
const resultingText = document.getElementById("txtDiv");
resultingText.innerHTML = input.value;
alert("called");
}
JS Fiddle: https://jsfiddle.net/joabysvt/1/
|
fc649dd4c7ce9d749f1db77c71fe2a24f465ae3ed4cdfbea1b88be8a9fc7a829 | ['0136170617bd48db83bbc8c1f2ebdef0'] | i'm trying to update my listview from my callback function that reads the stdout of a process.
i'm doing something like this:
process.OutputDataReceived = function();
public void function() {
this.Dispatcher.Invoke((MethodInvoker)() => {
listview.Items.add(newItem);
});
}
this updates my listview, but only when the process finishes!
i want it to update the list view instantly and i have no idea how and why it's not doing it like this.
thanks.
| e49448b50d6355b573e5db27ffe2a2c850ff4f6e10e30a046ba7197d86627dee | ['0136170617bd48db83bbc8c1f2ebdef0'] | i'm including bootstrap in my project:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
and i'm just taking this code from their website:
<div class="row">
<div class="col-sm-6 col-md-4">
<div class="thumbnail">
<img src="..." alt="...">
<div class="caption">
<h3>Thumbnail label</h3>
<p>...</p>
<p><a href="#" class="btn btn-primary" role="button">Button</a> <a href="#" class="btn btn-default" role="button">Button</a></p>
</div>
</div>
</div>
</div>
i'm not sure why, but i'm getting the thumbnail without the border unlike in their website.
thanks.
|
f752172d693c3fff2abf4f31193f770ffce4fe5a8bb489f2026d1746dac8abc4 | ['014aff0534904fe28849bd2bd7f729ed'] | I want to keep track of trips made in a day.
I have the following tables using MySQL :
route (routeID,start,destination,carId)
user (userId,routeId,...)
ticket (ticketID,routeID..)
car (carID,ownerID)
owner (ownerID..)
So my problem I want to keep a record of trips made in a day for example that includes users who bought a ticket being transported on a specified route by a car owned by Owner, to be shown as History for admin, car owner, and users.
Maybe a query with INNER JOIN Might show me what I want but it won't record anything, so what is the best MODEL/table structure that fits this situation.
I hope I made this as clear as it can.
Thank you very much for your consideration.
| 2f0b109a05694fce6791fbecb3e958b5d55c9d1db3eeb4d6532ed5c837ebe82c | ['014aff0534904fe28849bd2bd7f729ed'] | I am interested in Azure Maps' animation library. After setting up an account and initialized the map. I found out that the coordinates I put as parameters aren't the ones it shows.
For Example I currently live in Tunisia. So I've set up the center coordinates to (36.800697, 10.181198).
But, the map gets centered at Addis Ababa for some reason. I am currently following their code example "Animate marker along path". [Github link][1] As you can see I have set up a bunch of mock coordinates.
PS: In the following example, I will mask my key.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Animate marker along path - Azure Maps Web SDK Samples</title>
<meta charset="utf-8" />
<link rel="shortcut icon" href="/favicon.ico"/>
<meta http-equiv="x-ua-compatible" content="IE=Edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<meta name="description" content="This sample shows how to easily animate a HTML marker along a path on the map." />
<meta name="keywords" content="Microsoft maps, map, gis, API, SDK, animation, animate, animations, point, symbol, pushpin, marker, pin" />
<meta name="author" content="Microsoft Azure Maps" />
<!-- Add references to the Azure Maps Map control JavaScript and CSS files. -->
<link rel="stylesheet" href="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2.0/atlas.min.css">
<script src="https://atlas.microsoft.com/sdk/javascript/mapcontrol/2/atlas.min.js"></script>
<!-- Add reference to the animation module. -->
<script src="../Common/scripts/azure-maps-animations.min.js"></script>
<script type='text/javascript'>
var map, marker, animation;
//Create an array of points to define a path to animate along.
var path = [
[36.80067, 10.19111],
[36.80081, 10.19077],
[36.80148, 10.19548],
[36.83469, 10.30360]
];
function GetMap() {
//Initialize a map instance.
map = new atlas.Map('myMap', {
center: [36.817421, 10.305192],
zoom: 13,
view: 'Auto',
//Add your Azure Maps key to the map SDK. Get an Azure Maps key at https://azure.com/maps. NOTE: The primary key should be used as the key.
authOptions: {
authType: 'subscriptionKey',
subscriptionKey: '<key>'
}
});
//Wait until the map resources are ready.
map.events.add('ready', function () {
//Create a data source and add it to the map.
datasource = new atlas.source.DataSource();
map.sources.add(datasource);
//Add a line for the path as a visual reference.
datasource.add(new atlas.data.LineString(path));
//Add a layer for rendering line data.
map.layers.add(new atlas.layer.LineLayer(datasource));
//Create a marker and add it to the map.
marker = new atlas.HtmlMarker({
position: [-122.33825, 47.53945]
});
map.markers.add(marker);
map.events.add('click', function () {
if (animation) {
//Restart the animation.
animation.reset();
animation.play();
} else {
animation = atlas.animations.moveAlongPath(path, marker, { duration: 2000, captureMetadata: true, autoPlay: true });
}
});
});
}
</script>
</head>
<body onload="GetMap()">
<div id="myMap" style="position:relative;width:100%;min-width:290px;height:600px;"></div>
<div style="position:absolute;top:0px;left:calc(50% - 100px);background-color:white;padding:5px;">Click the map to animate marker.</div>
<fieldset style="width:calc(100% - 30px);min-width:290px;margin-top:10px;">
<legend><h1 style="font-size:16px">Animate marker along path</h1></legend>
This sample shows how to easily animate a HTML marker along a path on the map.
This sample uses the open source <a href="https://github.com/Azure-Samples/azure-maps-animations" target="_blank">Azure Maps Animation module</a>
</fieldset>
</body>
</html>
|
ddf0629690e58dd22c675e22ca323030fc22fa4653cc17f1711f1b03498f5d1a | ['014b8505ad474c7697ff2201597ea8fe'] | Speaking of heap sort, consider heapq python module. It exists for this very purpose - provide an implementation of the heap queue algorithm. It isn't designed not very conveniently, but there are handy wrappers - you can google it yourself.
Speaking of finding duplicates, any n log(n) sorting algorithm shouldn't be efficient enough. Take a look at the python set builtin!
| 04bdac3099c6b52a2ed114e8f7dfebaf9848d540a520e93555a960d851893ea0 | ['014b8505ad474c7697ff2201597ea8fe'] | x = 5**36
str_x = [int(i) for i in str(x)]
curBestIndex = 0
curBestSum = sum(str_x[:12])
curSum = curBestSum
for i in range(len(str_x) - 11):
delta = str_x[i + 11] - str_x[i]
curSum += delta
if curSum > curBestSum:
curBestSum = curSum
curBestIndex = i
big = str(x)[curBestIndex : curBestIndex + 12]
print(big)
print(curBestSum)
|
34c6a34e4a15f9f615b8bac2d2f8e80e7187edf8dbe1881258b2e636af224138 | ['014c577033fa4d1b98e202ff74f177d8'] | so accouding to your second last comment, does it implicate that its gonna be really long to see woobly windows and cube, etc in cinnamon.. however i've observed that compiz manager installs and opens up flawlessly.. even i can configure the woobly windows in that and no error comes.. however cannot experience the woobly windows.. is using mate a better option in addition to cinnamon ?? | 7b5d83a717f02e63c65345aa7ecabb7140e6c8b8c3ef5f3a76035a3672d23a92 | ['014c577033fa4d1b98e202ff74f177d8'] | Before proceeding with any further, make sure u have a backup of your data somewhere external. If you are not sure then you may mess-up with the boot loader of the OS's. To start with, you must have one partition totally vacant. Big HDD with one single partition will not work out. |
acc37be60f9f4da931dad8846d64822b5ecc65b269d70838dbbbe42588d7c191 | ['014d640c6d0f4489899cb8b52a124a89'] | Found the answer !
For some reason, I happened to have this line in my spec/rails_helper.rb:
config.include RSPec<IP_ADDRESS>Rails<IP_ADDRESS>ViewRendering
Which, I think, came from an old tutorial on view specs. Unfortunately, I was not able to find which one (tutorial) it was...
Anyway, I just remove this line, and everything went OK! My request specs pass, even when ran in a suite or whole file. (and my view specs also pass)
Hope this could be useful to anyone.
| 9596495d39c02ab8fc512883982a7d23483e8789bd81b3077fab80b131a21c81 | ['014d640c6d0f4489899cb8b52a124a89'] | My goal here is to run specs on files generated by axlsx-rails gem, and use a custom rspec matcher I found here.
In my spec example, I have:
describe Statistic<IP_ADDRESS>CompanyTableSetsController do
login_user # this just for Devise Auth
it "generates a proper excel sheet" do
...
get "show", format: :xlsx, id: id
response.content_type.to_s.should eq Mime<IP_ADDRESS>Type.lookup_by_extension(:xlsx).to_s
end
end
But when I run my test, I get :
Failure/Error: response.content_type.to_s.should eq Mime<IP_ADDRESS>Type.lookup_by_extension(:xlsx).to_s
expected: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
got: "text/html"
And of course I can't get the worksheet in other spec examples...
Think I miss something here, because in my browser, the Excel sheet is generated normally.
Thanx for your help.
|
a1bfba79997942aa36257af0ad4641c5d0476b93c899469600a86d236b9e6511 | ['01501b8bdd344aafa703e2b70934c4f4'] | Here's my two cents.
const sourceData = [
{
"metric": "Approved",
"rounded_counts": [
{ "2017-11-16 15:10:00": 3 },
{ "2017-11-16 15:11:00": 5 }
]
},
{
"metric": "Approved",
"rounded_counts": [
{ "2017-11-16 15:10:00": 28 },
{ "2017-11-16 15:11:00": 28 }
]
},
{
"metric": "Quarantine",
"rounded_counts": [
{ "2017-11-16 15:10:00": 1 },
{ "2017-11-16 15:11:00": 2 }
]
}
];
function mergeDatas(currentObject, rounded_counts) {
return rounded_counts.map(x => {
if (currentObject.data.some(y => y[0] === Object.keys(x)[0])) {
const miniArray = currentObject.data.find(y =>
y[0] === Object.keys(x)[0]);
miniArray[1] += x[Object.keys(x)[0]];
return miniArray;
}
return x;
})
}
const result = sourceData.reduce((tmp, x) => {
if (tmp.some(t => t.name === x.metric)) {
const currentObject = tmp.find(y => y.name === x.metric);
mergeDatas(currentObject, x.rounded_counts);
return tmp;
}
tmp.push({
name: x.metric,
data: x.rounded_counts.map(y => {
const key = Object.keys(y)[0];
return [key, y[key]];
}),
});
return tmp;
}, []);
console.log(result);
| ed2fd30f7564e6a80f98cd286624eb7e8c426f2c05d7fa0e12ab5a6cfbc31c59 | ['01501b8bdd344aafa703e2b70934c4f4'] | I make a small application that can display multiple information in a web page to be displayed on connected screens on a Chrome. Like pictures, videos, or URLs.
But the URLs makes me worry: I can not display them directly with an Iframe because of 'X-Frame-Options' which blocks its loading. So I created a proxy to fix it but some files do not load because of the protection against sniffing.
I am just trying to display an URL from a web page on a screen without interaction on this URL.
If anyone had an idea, I thank him in advance.
|
10dc1e2bee2f707b40b0528d7d3db2c7a298659b5ca0c46981dea96360b81cba | ['0152de84e9b341629c1965f7ecf4ff82'] | I would try using `nmap` to test if that port of server is available and it's not filtered, if it's filtered, then you need to allow connections to that port from outside, if it shows `open`, so no filtered or closed, then it would be some routing error, but on LAN it should work, in this case `ping`ing that server would reveal some information | 1d5d91f4e3872ad1fa00bbf401e6939f006a837f78365dabe578647352eaa7b5 | ['0152de84e9b341629c1965f7ecf4ff82'] | Are you sure they are on same network ? As you mentioned, there is /16 network, so probably it's divided into several smaller. Be sure to check network addresses, network masks and default gateway, because you should be able to communicate with devices on same network. Check also routing table on notebook, there should be at least 1 default route (<IP_ADDRESS>) to default gateway
|
5416f3bd413eb1d8d8fcdc4f9c755d8ee886ffd35c6646dbeacadca23b1db434 | ['015c7a33154a43cfaec86a549d17d47e'] | There is too much to go through in the original code. So, I'll give you the simplified version of what you need.
https://jsfiddle.net/2hjm0tnb/
In a nutshell, you want to create a new class and operate with it.
Let's say these are 3 elements you are working with. you want them to have the same class to shorten the code
<div class="testclass"></div>
<div class="testclass"></div>
<div class="testclass"></div>
In css, we use the original class for original styling and add another class for the change
.testclass {
background-color:#ccc;
width:50px;
height:50px;
margin-top:10px;
}
.active {background-color:#000;}
// here we say that this will work for every element with original class
$(".testclass").each(function(){
//here we declare counter to count number of clicks
var counter = 1;
//add class with changed style on mouse over
$(this).mouseover(function(){
$(this).addClass('active');
});
// this will define actions on click
$(this).click(function(){
//add 1 to counter
counter++;
//if counter is odd, it will add the class. If not- will do nothing
if (counter % 2 == 1) {
$(this).toggleClass('active');
}
});
});
| fa2427e10a23d18cd1feb26504dfd66ec34b61f59cdf5f994a8f9dfdaadf95fc | ['015c7a33154a43cfaec86a549d17d47e'] | When creating a custom post at new registration, I'm using new user's id for posts name and slug.
Name gets proper id, but slug gets "-2" suffix. And redirect sends new user to working url (that is with '-2' suffix)
I can not figure out what causes this iteration. And since i will be using these IDs for a number of things, i need to get rid of it.
if ( !username_exists( $user ) && !email_exists( $email ) ) {
$user_id = wp_create_user( $user, $pass, $email );
if( !is_wp_error($user_id) ) {
//user has been created
$user = new WP_User( $user_id );
$user->set_role( 'participation' );
$my_cptpost_args = array(
'post_title' => $user_id,
'slug' => $user_id,
'post_status' => 'publish',
'post_type' => 'profile'
);
$cpt_id = wp_insert_post( $my_cptpost_args, $wp_error);
//Redirect
header( 'Location: http://mynewsite.com/profile/'.$user_id );
exit;
} else {
//$user_id is a WP_Error object. Manage the error
}
}
|
eb0478e3e0df7113a09197e37529c37d3ea64a3cacae7698961f1319c4576936 | ['0183d6c9383d4d96a18fcb97f082b7db'] | I am working on angular 2 project. I have 3 layer routing. It means if I navigate to URL dashboard/projects/timesheet then it will load my dashboard component which has router-outlet which loads project component having another router-outlet which loads timesheet component. There is a parameter pid which loads data on timesheet for particular project. The problem is if I call navigate method of Router class it will load all components from starting of dashboard to timesheet. But I only want to update my Timesheet component.
| aef18a4d4706ed44bff21776dfafec1d8a042f9f525d371398ee8f52b9d8eb61 | ['0183d6c9383d4d96a18fcb97f082b7db'] | I am working on my Angular 4 project. I have two components, one is TaskCardComponent and CalendarComponent. There is a css class in CalendarComponent called 'calendar'. What I want to do is append TaskCardComponent-html to this 'calendar' class div using jquery in CalendarComponent .ts file. I know there is a way to use selector of component. But I have requirement to use jquery only. How can I do that?
Thanks in advance.
|
c9599532a180d0601dd3904bd93bc0025a3a3423596fe0087726ec01b67d7a7f | ['01963a015eeb45f8934eaac2a4dfdeb3'] | I've been getting the ApiException 10 error when trying ot sign up with google. BEFORE YOU MARK THIS AS DUPLICATE: My question differs from others 'cause my App IS published on the playstore.
I've been getting ApiException 12500 while using debug and release SHA-1's until I figured I had to use Google Play's sha-1 'cause it's published.
Ok, set, but now I have an ApiException: 10:. The Client IDs I tried are the one I created in the Google Devs console (as Web App since I use Firebase) and the one written inside the google-services.json.
Is it messing up 'cause I'm using google play's SHA-1 or did I miss something? Would it work if I'd be to release it on the store? HOW do I program a Google Sign In and test it before publishing if my App is already on the store?
Btw before someone comes up with it, support mail is there and google auth is enabled.
| 1a5d8a8add9b11e1d1fabf990582f36d6752ca5ff66adc7cddd6c2229354816a | ['01963a015eeb45f8934eaac2a4dfdeb3'] | I've been following this to implement google sign in in my app. I've followed every step, set my SHA1 and web cliednt id in firebase and the app.
What happens: I click the button to sign in with Google The google prompt appears I select the account The propmt closes.
I've put some toasts here and there to see where the code gets stucks and
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned
from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == GOOGLE_SIGN) {
Task<GoogleSignInAccount> task = GoogleSignIn.getSignedInAccountFromIntent(data);
try {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = task.getResult(ApiException.class);
firebaseAuthWithGoogle(account);
} catch (ApiException e) {
alert("You suck even more"); <---THIS ONE
// Google Sign In failed, update UI appropriately
// ...
}
}
}
That toast in the catch (ApiException e) is displayed. Why is it stuck on the onActivityResult?
Here is the gradle:
dependencies {
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-storage:17.0.0'
implementation 'com.firebaseui:firebase-ui-storage:4.1.0'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
}
apply plugin: 'com.google.gms.google-services'
Or at least the google relevant ones.
I've followed everything regarding this aPI EXCEPTION, YET NOTHING HELPS.
Hell, I even deleted the whole Firebase project out of frustration and created it new and did this... Yet nothing... I can't even do that 'cause I can't put the same SHA1 in Google Dev and Firebase, I'm prompted with a d uplicate
Please, it must be way easier than this, I think I'm just overthinking this by now
Please help me, it's like 5 hours I'm looking through github issues.
|
4d69d51dc5ad47ca4a744e4fcd0c3bf5dde9a7480d80b01ef81767463de5cdcf | ['01a6b0b958ee4fe0bbb58c8b31b9f10a'] | http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSNotificationCenter_Class/Reference/Reference.html
Apple documentation link above pretty clearly states that NSNotificationCenter does not retain it's observers, thats why you can't release the dataAnalyzer there - it would be dealloc'd and the notification would attempt to post to a nil reference.
Subscribe to the notification(s) in the -init method of each view controller. That ensures the controller has been created and initialized, and makes each controller responsible for it's own actions.
I'm not entirely sure what your question is, could you rephrase it if the above didn't resolve your problem.
Also, be aware NSNotificationCenter will post to all observers, but it is not async - it waits for each one to finish processing the notification before sending to the next object.
| fd8be9d781f1cd68f5dbe5e806837c21b918dc2fdd83f49a3cfc967b8d09c432 | ['01a6b0b958ee4fe0bbb58c8b31b9f10a'] | Hope this helps!!!
There are 4 levels of warnings (0 to 3). These are set from the kernel memory watcher, and can be obtained by the not-so-public function OSMemoryNotificationCurrentLevel().
typedef enum {
OSMemoryNotificationLevelAny = -1,
OSMemoryNotificationLevelNormal = 0,
OSMemoryNotificationLevelWarning = 1,
OSMemoryNotificationLevelUrgent = 2,
OSMemoryNotificationLevelCritical = 3
} OSMemoryNotificationLevel;
How the levels are triggered is not documented. SpringBoard is configured to do the following in each memory level:
Warning (not-normal) — Relaunch, or delay auto relaunch of nonessential background apps e.g. Mail.
Urgent — Quit all background apps, e.g. Safari and iPod.
Critical and beyond — The kernel will take over, probably killing SpringBoard or even reboot.
|
611a58eae394f9806808bf16ec394ba24cbabc23131a434b6d3f51d28f14d736 | ['01c1863d73064a0e8777754b1c3278c8'] | Exceptions sometimes occur. When they do, they're logged and later analyzed. The log obviously contains the stack-trace and other global information, but often crucial context is missing. I'd like to annotate an exception with this extra information to facilitate post-mortem debugging.
I don't want to try{...}catch{... throw;} since that counts as catching an exception and that makes debugging harder (during development I'd like the app to stop and the debugger to react when the original exception is thrown, and not when the outermost uncaught exception is). First-chance exception handlers aren't a workaround since there are unfortunately too many false positives.
I'd like to avoid excessive overhead in the normal, non-exceptional case.
Is there any way to store key pieces of context (e.g. filename being processed or whatever) in an exception in a way that doesn't catch the exception?
| feb525fef9fc09d990371ea675a938ae07d6338047bcb0af8ab82a80608b4c8c | ['01c1863d73064a0e8777754b1c3278c8'] | You're probably looking for the ArrayDeque which supports push/pop style access from both ends of the list efficiently.
Avoid Stack and Vector - these are synchronized, which implies generally pointless overhead.
ArrayList is also fine; however, you'd need to implement your own (trivial) pop method since it is not provided by the class itself. ArrayList does permit indexed access, which ArrayDeque lacks.
|
1a7c5f96b0f0bae97d052266bd9ce63b605f5980b1cc2dd96ade28b67b6baf39 | ['01d152acb5084fb2b8a761f33f321ed2'] | One way is to use drivers. You can, in effect, link the properties of one object to other objects. In your example, you have the choice of driving all 3 rotation angles or just a single angle.
To add a driver, display the rotation properties of the linked-to object (cube2 in your example). An easy way to do this is press "N" in the 3D View or choose the Object Properties tab. Then right-click one of the rotation angle values. Choose "Add Drivers" (all 3 rotations) or "Add Single Driver" (only the chosen rotation). The property value will turn purple and can no longer be changed manually. You can remove the driver by right-clicking and choosing again.
Next open a Graph Editor window and press "N" to display the Properties sidebar. To the right of the window menu ('View', 'Select', 'Marker', 'Channel', 'Key'), there is a drop-down labeled "F-Curves". Change this to "Drivers".
For simplicity sake, I'll describe how to set up one driven rotation angle. If you want to drive 2 or 3 rotation angles, simple repeat the following steps:
In the upper left, click one of the angles below "Drivers". If they aren't visible, you may need to click "Drivers". Find the Drivers panel in the right-hand Properties sidebar. This panel shows the driver setup.
The first item you likely want to change is "Scripted Expression" to either "Averaged Value" or "Sum Values". Since you want to copy a single property, you will get the property you want by choosing the average or sum of that single value. (This was confusing to me at first, but it provides a lot of power and flexibility in more complex situations.)
By default, a variable has been created called "var". Choose the driving object (cube1 in your example) and then choose the property you want to copy using the "Type" drop-down menu.
You might click "Update Dependencies" if an error message appears beneath the "Remove Driver" button.
You can test out the driver by rotating cube1 and watch cube2.
Other resources on using drivers:
In the Blender Reference Manual
<PERSON> in-depth tutorial on YouTube
| 768736c7fb5061c6122ce37df232e54ab5e4e7a3f295cfc550b235bafe73f488 | ['01d152acb5084fb2b8a761f33f321ed2'] | <PERSON>: nice comment here's my real problem, homotopy hypothesis said that $\infty$-groupoids classify space up to homotopy. So if I get it right, the idea is to reduce the study of spaces up to homotopy to the study of these $\infty$-categories, which are algebraic in their nature. So now arise the question: "to study these structures shouldn't we be able to make some calculations with these structures, like we do with complex-chains and groups?" |
98fd92ad325decc1f05196055b7c081be7165bdee6b6b775b8aa55b0e7ad0adf | ['01d345f130ae4d88843516a5c400f6a6'] | First off, I have no idea what Apple calls their OS. I only use their iOS devices and I tried to avoid their computer OS as best as possible, however, I'm getting started in developing iOS apps. I need to either run the Apple OS in a VM or set up dual-booting. I have a few questions though that hopefully can get answered.
Where can I purchase a license for Apple?
I've never set up dual-booting before, how do I go about doing so with Win7 as my current OS? (Ideally using a different HDD)
Is there anything I should know before going ahead?
| 88661c64f31a77ddc76248bbe94432c9b5007a1990bced5ec9fde97c5babdb70 | ['01d345f130ae4d88843516a5c400f6a6'] | <PERSON> Perhaps it's a personal quirk but I've always added the dog ear to the top right (even if the bookmarked page is the left one). This is evidently a "ruleless" habit with no right or wrong answer but if I were in <PERSON> position I would likely have opted for the top-right corner dog ear also. But it would be, indeed, an intuitive choice, not fact based. |
9e8e6e977c9a6249b4464e2404e47b40033dfc73204a6ba07fd9a306c75f7a93 | ['01d47ca89df5471bb136efd00ac1db06'] | My program gets a binary string ( up to 200 characters long) and then it multiplies it by a decimal number. The calculator works only for the first 2-3 iterations. After that it doesn't return the correct result. Any help ?
#include <stdio.h>
#include "myfun.c"
#include <string.h>
int main()
{
int l,l1;
char a[200],b[200],f[200];
int c[200],d[200];
for (i=0;i<200;i++)
{
c[i]=0;
d[i]=0;
}
gets(a);
l=strlen(a);
l1=strlen(a);
for (int i=0;i<l;i++)
{
c[200-l+i]=a[i]-48;
}
////////////////////////////////////////////
for (int i=0;i<l1;i++)
{
d[200-l1+i]=a[i]-48;
}
////////////////////////////////
for (int t=1;t<193;t++) //here is specify how many times i am multypling
bin_add(c,d);
for (i=0;i<200;i++){
printf("%d",c[i]);
}
return 0;
}
int bin_add(int c[200],int d[200])
{
int car[200]; //carry
i=200;
car[i]=0;
while (i >= 0) {
//find carry and shift it left
//find the sum
car[i-1] = c[i] & (d[i] |car[i]) ;
c[i]=(c[i]^d[i]) ^ car[i];
i--;
}
return c[i];
c[i]=0;
}
| 33daf01e51b4d45256a4454e0e072b2c98b5c54bbd2e019ed1e6fb48dbf4ac92 | ['01d47ca89df5471bb136efd00ac1db06'] | For example I have a program that adds two numbers. Once I input the two numbers and calculate their sum, I want to go back to the beginning of main, and be able to give other 2 numbers. This is a minimal example, using a simple loop wont work because I am working on a program that has over 30 different functions in use.
|
b42290a4f0f53c0d46a6e592e9383bfabbad6214b83ee8aa364eced92957e5b0 | ['01d49d61fad74712b32c8dceab633b71'] | Was attempting to add a new DAG to our Google Cloud Composer instance - we have 32+ DAGs currently - and doing the usual things in https://cloud.google.com/composer/docs/how-to/using/managing-dags doesn't appear to be having any effect - we can't see these DAGs in the webserver/UI and I don't see that they are necessarily being loaded. I do see them being copied to the appropriate bucket in the logs but nothing beyond that.
I even tried setting a dummy environment variable to kick off a full restart of the Composer instance but to no avail.
Finally I've put together an entirely stripped down DAG and attempted to add it. Here is the DAG:
from airflow import models
from airflow.contrib.operators import kubernetes_pod_operator
from airflow.operators.python_operator import BranchPythonOperator
from airflow.operators.dummy_operator import DummyOperator
dag = models.Dag(
dag_id="test-dag",
schedule_interval=None,
start_date=datetime(2020, 3, 9),
max_active_runs=1,
catchup=False,
)
task_test = DummyOperator(dag=dag, task_id="test-task")
Even this simple DAG isn't getting picked up so I'm wondering what I can try next. I looked through https://github.com/apache/airflow/blob/master/airflow/config_templates/default_airflow.cfg in an effort to see if perhaps there was anything I might tweak in here in terms of DagBag loading time limits, etc. but nothing jumps off. Totally stumped here.
| dc82d8473779872f12a806491fd987fcb3b72a3ff166cbaf7890ce0f1062edd3 | ['01d49d61fad74712b32c8dceab633b71'] | Large Dataflow job here, about 700 Gb of data getting formatted with a final write to BigQuery.
We're running into an issue on both 2.15.0 and 2.16.0 (Python SDK) where the step appears to fail at the final step when it attempts to create an import job:
Workflow failed. Causes: S04:xxx to BigQuery/WriteToBigQuery/NativeWrite failed., BigQuery import job "dataflow_job_5111748333716803539" failed., BigQuery creation of import job for table "xxx" in dataset "xxx" in project "xxx" failed., BigQuery execution failed., Unknown error.
This appears to be the very last step and costs a significant amount of CPU time to get here before finally failing with an Unknown error with no obvious way to fix it. We've tried running with different versions of the SDK as noted above (since it looks like there were some changes in 2.16.0 that were BigQuery related) but we are essentially stuck with a lot of sunk CPU hours without any obvious next steps here.
Any ideas about things we could try to fix the issue would be greatly appreciated!
|
f49e7a51db2178c05a5f0f3c605a4a790aa4adad6f1ea35806ee5723598dbbec | ['01d7b6868b7a461fa8fc98c8d92f76b7'] | In the following code sample both checks of obj2 and obj3 at the end with instanceof return true even if the ways there were constructed are different and the results of returning name property are different.
var Obj1 = function() {
this.name = "foo1";
};
Obj1.prototype.name = "foo1onProt";
var obj1 = new Obj1();
var Obj2 = function() {};
Obj2.prototype = new Obj1();
Obj2.prototype.constructor = Obj2;
var obj2 = new Obj2();
var Obj3 = function() {};
Obj3.prototype = Object.create(Obj1.prototype);
Obj3.prototype.constructor = Obj3;
var obj3 = new Obj3();
console.dir(obj1);
console.log("obj1.name: " + obj1.name);
console.dir(obj2);
console.log("obj2.name: " + obj2.name);
console.dir(obj3);
console.log("obj3.name: " + obj3.name);
console.log("obj2 instanceof Obj1: " + (obj2 instanceof Obj1));
console.log("obj3 instanceof Obj1: " + (obj3 instanceof Obj1));
Result of the run in Chrome:
Obj1
name: "foo1"
__proto__: Object
constructor: function () {
name: "foo1onProt"
__proto__: Object
obj1.name: foo1
Obj2
__proto__: Obj1
constructor: function () {}
name: "foo1"
__proto__: Object
constructor: function () {
name: "foo1onProt"
__proto__: Object
obj2.name: foo1
Obj3
__proto__: Object
constructor: function () {}
__proto__: Object
constructor: function () {
name: "foo1onProt"
__proto__: Object
obj3.name: foo1onProt
obj2 instanceof Obj1: true
obj3 instanceof Obj1: true
What is the best way to recognize that obj2 and obj3 are different?
How does actually instanceof work?
| a93de4e6e47f714c3c0734d370d201dbce5111a68d459abba0b65b12183ac275 | ['01d7b6868b7a461fa8fc98c8d92f76b7'] | After some tests it seems indeed that the problem is caused by the strategy = GenerationType.TABLE. With the change to strategy = GenerationType.SEQUENCE the problems described above with duplicated keys were gone.
@Id
@SequenceGenerator(name = Consts.VEHICLE_ATTR_ID_SEQ,
sequenceName = Consts.VEHICLE_ATTR_ID_SEQ,
allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE,
generator = Consts.VEHICLE_ATTR_ID_SEQ)
@Column(name = "ID", updatable = false)
public Long getId() {
return id;
}
|
64e51918354deb685b83fcfff15f4c5a615cc3484ac137cfc91f176d242c2651 | ['01dd0e9488804eb5b406b4bc5dc15353'] | I am trying to covert the exact amount of time between two Calendar objects in Java.
This is the code that I currently have...
public static Map<TimeUnit, Long> computeDifference(Calendar date1, Calendar date2) {
long diffInMillies = date2.getTimeInMillis() - date1.getTimeInMillis();
//create the list
List<TimeUnit> units = new ArrayList<TimeUnit>();
units.add(TimeUnit.SECONDS);
units.add(TimeUnit.MINUTES);
units.add(TimeUnit.HOURS);
units.add(TimeUnit.DAYS);
Collections.reverse(units);
//create the result map of TimeUnit and difference
Map<TimeUnit,Long> result = new LinkedHashMap<TimeUnit,Long>();
long milliesRest = diffInMillies;
for ( TimeUnit unit : units ) {
//calculate difference in millisecond
long diff = unit.convert(milliesRest,TimeUnit.MILLISECONDS);
long diffInMilliesForUnit = unit.toMillis(diff);
milliesRest = milliesRest - diffInMilliesForUnit;
//put the result in the map
result.put(unit,diff);
}
return result;
}
When printed, the output looks like this {DAYS=1, HOURS=10, MINUTES=30, SECONDS=45} for input date1 = 19 August 2019 02:00:00 and date2 = 20 August 2019 12:30:45
The largest time unit available in this method is DAYS, but I want to find something that includes both months and years. I realize that TimeUnit doesn't really have anything to do with specific calendar dates (rather a 24-hour interval), which is why I was wondering if there is any way to make this conversion using the Calendar class or something similar. I've also looked into ChronoUnit as a substitute for TimeUnit, but that won't work for the same reason TimeUnit doesn't.
Would love any suggestions for how to incorporate larger time units. Thank you!
| c93f29966d4b8520987a3755426609c0abde3343f2c13495c334a62d3bb3ee47 | ['01dd0e9488804eb5b406b4bc5dc15353'] | I am trying to find the shortest path through a map represented as a matrix of 0s and 1s, where 0s are passable space and 1s are impassable walls. The the entrance is at the top left (0, 0) and the exit is at the bottom right (width - 1, height - 1).
My function solution(int[][] map) finds the length of the shortest path from the entrance to the exit, where you are allowed to remove one wall as part of the path. The path length is the total number of nodes you pass through, counting both the entrance and exit nodes. Conditions on map include that the starting and ending positions are always passable (0), the map will always be solvable, though you may or may not need to remove a wall, and that the height and width of the map can be from 2 to 20. Moves can only be made in cardinal directions; no diagonal moves are allowed.
A couple test cases:
Input:
int[][] a = {{0, 1, 1, 0},
{0, 0, 0, 1},
{1, 1, 0, 0},
{1, 1, 1, 0},
{1, 1, 1, 0}};
Output:
8
Input:
int[][] b = {{0, 1, 0, 0, 0},
{0, 0, 0, 1, 0},
{0, 0, 1, 1, 0},
{0, 1, 1, 0, 0},
{0, 1, 1, 0, 0}};
Output:
9
Input:
int[][] c = {{0, 1, 0, 0, 0},
{0, 0, 0, 1, 0},
{0, 0, 1, 1, 1},
{0, 1, 1, 0, 0},
{0, 1, 1, 0, 0}};
Output:
11
My code for my solution is as follows:
public static int solution(int[][] map) {
int rows = map.length;
int cols = map[0].length;
Graph graph = new Graph(map);
Queue<Node> queue = new LinkedList<>();
ArrayList<Node> marked = new ArrayList<>();
Node start = graph.getNode(0, 0);
queue.add(start);
marked.add(start);
start.setDistanceFromStart(1);
while(!queue.isEmpty()) {
Node current = queue.remove();
if(current.getX() == rows - 1 && current.getY() == cols - 1) { //if we have reached goal node
return current.getDistanceFromStart();
}
for(Node n : current.getNeighbors()) {
queue.add(n);
n.setDistanceFromStart(current.getDistanceFromStart() + 1);
}
}
return -1; //no path found
}
I created two classes with the along with the solution method, Graph and Node:
class Graph{
private Node[][] _nodeMap;
private int _rows;
private int _cols;
public Graph(int[][] map) {
_nodeMap = new Node[map.length][map[0].length];
_rows = _nodeMap.length;
_cols = _nodeMap[0].length;
for (int i = 0; i < _rows; i++) {
for(int j = 0; j < _cols; j++) {
_nodeMap[i][j] = new Node(i, j, map[i][j], false, this);
}
}
}
/**
* Gets the Node at location (x,y)
* @param x - the x val of the Node being retrieved
* @param y - the y val of the Node being retrieved
* @return
*/
public Node getNode(int x, int y) {
return _nodeMap[x][y];
}
/**
* Replace the node at x,y with the new node n.
* @param x
* @param y
* @param n
*/
public void setNode(int x, int y, Node n) {
_nodeMap[x][y] = n;
}
/**
* Checks to see if a node has a neighbor (either a wall or a path) to the north
* @param n - the node being checked
* @return boolean - true if there is a neighbor, false if there is not
*/
public boolean hasNorth(Node n) {
if(n.getX() > 0) {
return true;
} else {
return false;
}
}
/**
* Return's the neighbor to the north
* @param n - the current node
* @return Returns the Node to the north of n
*/
public Node getNorth(Node n) {
return _nodeMap[n.getX() - 1][n.getY()];
}
/**
* Checks to see if a node has a neighbor (either a wall or a path) to the south
* @param n - the node being checked
* @return boolean - true if there is a neighbor, false if there is not
*/
public boolean hasSouth(Node n) {
if(n.getX() < _rows - 1) {
return true;
} else {
return false;
}
}
/**
* Return's the neighbor to the south
* @param n - the current node
* @return Returns the Node to the south of n
*/
public Node getSouth(Node n) {
return _nodeMap[n.getX() + 1][n.getY()];
}
/**
* Checks to see if a node has a neighbor (either a wall or a path) to the east
* @param n - the node being checked
* @return boolean - true if there is a neighbor, false if there is not
*/
public boolean hasEast(Node n) {
if(n.getY() < _cols - 1) {
return true;
} else {
return false;
}
}
/**
* Return's the neighbor to the east
* @param n - the current node
* @return Returns the Node to the east of n
*/
public Node getEast(Node n) {
return _nodeMap[n.getX()][n.getY() + 1];
}
/**
* Checks to see if a node has a neighbor (either a wall or a path) to the west
* @param n - the node being checked
* @return boolean - true if there is a neighbor, false if there is not
*/
public boolean hasWest(Node n) {
if(n.getY() > 0) {
return true;
} else {
return false;
}
}
/**
* Return's the neighbor to the west
* @param n - the current node
* @return Returns the Node to the west of n
*/
public Node getWest(Node n) {
return _nodeMap[n.getX()][n.getY() - 1];
}
}
class Node {
private int _x; //x location
private int _y; //y location
private int _type; //1 if a wall, 0 if a path
private Graph _map;
private int _distFromStart;
private boolean _wallRemoved;
public Node(int x, int y, int type, boolean wallRemoved, Graph map){
_x = x;
_y = y;
_type = type;
_wallRemoved = wallRemoved;
_map = map;
_distFromStart = -1;
}
public int getX() {
return _x;
}
public int getY() {
return _y;
}
public int getType() {
return _type;
}
public boolean getWallRemoved() {
return _wallRemoved;
}
public int getDistanceFromStart() {
return _distFromStart;
}
public void setDistanceFromStart(int distance) {
_distFromStart = distance;
}
/**
* Returns an ArrayList<Node> containing the neighbors of a node.
* @return
*/
public ArrayList<Node> getNeighbors(){
ArrayList<Node> neighbors = new ArrayList<>();
if(this._wallRemoved) { //if a wall has already been removed
if(_map.hasWest(this) && _map.getWest(this)._type == 0) { //check west neighbor
Node node = _map.getWest(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map/*, node._timesEvaluated + 1*/);
neighbors.add(n);
}
if(_map.hasEast(this) && _map.getEast(this)._type == 0) { //check east neighbor
Node node = _map.getEast(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map);
neighbors.add(n);
}
if(_map.hasNorth(this) && _map.getNorth(this)._type == 0) { //check north neighbor
Node node = _map.getNorth(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map);
neighbors.add(n);
}
if(_map.hasSouth(this) && _map.getSouth(this)._type == 0) { //check south neighbor
Node node = _map.getSouth(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map/);
neighbors.add(n);
}
} else { //if a wall hasn't been removed yet
if(_map.hasWest(this)) { //check west neighbor
if(_map.getWest(this)._type == 1) { //if west neighbor is a wall
if(!this._wallRemoved) {
Node node = _map.getWest(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map);
neighbors.add(n);
}
} else { //if west neighbor is a path
Node node = _map.getWest(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), false, _map);
neighbors.add(n);
}
}
if(_map.hasEast(this)) { //check east neighbor
if(_map.getEast(this)._type == 1) {
if(!this._wallRemoved) {
Node node = _map.getEast(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map);
neighbors.add(n);
}
} else {
Node node = _map.getEast(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), false, _map);
neighbors.add(n);
}
}
if(_map.hasNorth(this)) { //check north neighbor
if(_map.getNorth(this)._type == 1) {
if(!this._wallRemoved) {
Node node = _map.getNorth(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map);
neighbors.add(n);
}
} else {
Node node = _map.getNorth(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), false, _map);
neighbors.add(n);
}
}
if(_map.hasSouth(this)) { //check south neighbor
if(_map.getSouth(this)._type == 1) {
if(!this._wallRemoved) {
Node node = _map.getSouth(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), true, _map);
neighbors.add(n);
}
} else {
Node node = _map.getSouth(this);
Node n = new Node(node.getX(), node.getY(), node.getType(), false, _map);
neighbors.add(n);
}
}
}
return neighbors;
}
}
My code works, the correct answer is returned for each test case. My issue is that the code is terribly slow. I'm pretty sure that the maze is being solved by brute force (if not, the time constraint is at least similar to brute force) causing large maps (such as a 20x20 map) to take a very long time to solve. How can this I optimize my code to make it run more quickly? Thanks!
|
5680eaca4e0d3a37204f101b9319e5eb71d0fcc3b2641c14f3c3e93f2f7caac8 | ['01f9ef39a1404d6ead80b7d96322083b'] | тогда это очень-очень разные решения. Ваш вариант это виртуализация, с полноценной ос и кучей сервисов, а Docker это по сути сильно продвинутый chroot с одним сервисом внутри.
И у них совершенно разные задачи:
- виртуализацией вы можете воссоздать среду, приближенную к реальному серверу.
- докером можете сделать переносимые контейнеры с сервисами. | 71eda3398028e463ba76f4da1a4526de68a87c84b7bcda46e6da160ab21c0109 | ['01f9ef39a1404d6ead80b7d96322083b'] | I feel like this should be included as an example somewhere in the [Guide to Asking Questions](https://codereview.meta.stackexchange.com/questions/2436/how-to-get-the-best-value-out-of-code-review-asking-questions). Never heard of a usr file, but I could easily follow the question due to its structure. |
7072d47dc56f40a8dfae052c20037694c96c96a0357b3510d54423592e4a6ce1 | ['01fb46c9bf6142118e461587f54b1467'] | I ended up using inotify, for some reason icrond was not working:
#!/usr/bin/env bash
dir=/ftproot
while true #run indefinitely
do
inotifywait -m -q --format '%w%f' -e create,moved_to $dir | while read FILE; do
if [[ $FILE == *.cia ]]; then /ftproot/despacer.sh "$FILE" & /ftproot/rename.sh
fi
done
done | fa41e1530412e70aa4144391203de9452fbaa688553f07f24349efca5f3028ce | ['01fb46c9bf6142118e461587f54b1467'] | Why are river and sliver pronounced with a short vowel, but rover and slider pronounced with long vowels? Is it because the latter two examples are words made by attaching the -er suffix to an existing word (with a long vowel), or something else?
If the former, why is cover not pronounced with short vowel (ie. why does it sound like the 'o' in 'covet' instead of the 'o' in comet?) (and, on that point, why is the 'o' in covet and comet different?)
|
dea186b5b17f5e97b331b6c0376bc4e8012ec8f452c2288c84453365e4904cf1 | ['02012d22b8c04534b21462de811a704d'] | I don't understand why it gives me the following error message "does not contain a definition for Fill" on this line trackCollection.Fill(data);
Here's my controller method for your inspection:
public static List<DBTrack> GetDBTracks()
{
SQLDBTrackData sql;
if (DBTrackData == null)
{
List<DBTrack> daa = new List<DBTrack>();
DBTrack trackCollection = new DBTrack();
System.Data.DataTable data = new System.Data.DataTable();
trackCollection.Fill(data);
DBTrackData = new List<DBTrack>();
foreach (DataRow p in data.Rows)
{
DBTrack top = new DBTrack()
{
// TrackID = Convert.ToInt32(p.Field<double>("TrackID")),
AddedDate = p.Field<DateTime>("DateTimes"),
TrackName = p.Field<string>("TrackName"),
ArtistName = p.Field<string>("ArtistName"),
};
DBTrackData.Add(top);
}
}
return DBTrackData;
}
Any help would be great.. Thanks
| d63ffc573d705fb6240d326f0c271c4727c78bd80883860fa426c144ebf62ccf | ['02012d22b8c04534b21462de811a704d'] | I am trying to display records from last year but its not showing any results.
If i take remove the code displayed below then it displays all the results fine.
This is the code I'm working with:
var trackFilter = Convert.ToString(DateTime.Now.AddDays(-365));
DateTime fromDate = DateTime.Now.AddDays(-365);
DateTime toDate = DateTime.Now;
daa = daa.Where(c => (trackFilter == "" ||
c.TrackName.ToLower().Contains(trackFilter.ToLower()))
&&
(fromDate == DateTime.MinValue || fromDate <= c.Date)
&&
(toDate == DateTime.MaxValue || c.Date <= toDate)
).ToList();
I don't know what I'm doing wrong here and any help would be great! - Thanks :)
|
8ef4f1601593475f1dee74f3f6deb1dc64d902f26b1b43225dd17d35bd7f9861 | ['02036df88d304408a2851104ca1758ee'] | All,
I have a dataframe with repeated indices. I'm trying to update the values using the index for all rows with that index. Here is an example of what I have
name x
t
0 A 5
0 B 2
1 A 7
2 A 5
2 B 9
2 C 3
"A" is present at every time. I want to replace "x" with the current value of "x", minus the value of "x" for "A" at that time. The tricky part is to get with an array or dataframe that is, in this case
array([5, 5, 7, 5, 5, 5])
which is the value for "A", but repeated for each timestamp. I can then subtract this from df['x']. My working solution is below.
temp = df[df['name'] == 'A']
d = dict(zip(temp.index, temp['x']))
df['x'] = df['x'] - df.index.to_frame()['t'].replace(d)
name x
t
0 A 0
0 B -3
1 A 0
2 A 0
2 B 4
2 C -2
This works, but feels a bit hacky, and I can't help but think there is a better (and must faster) solution...
| 2ff7451cc8dd9ea2172d4880843166c8c42ff02f0b5e27c5bcecad8735060905 | ['02036df88d304408a2851104ca1758ee'] | So, here is the page in discussion, DONATION RESULTS
What I did was I used the SQL DB to populate rows by totals, works great. Now, I want when the name is clicked, or the ammount is clicked, for a dialog to pop up with all the individual donations that person has recieved. To do this, I need to use
$eachone = mysql_query("SELECT donor_first,donor_last FROM dc_donations WHERE sponsoring='***'")
where * needs to automatically fill with the data from the name/previous query. So for example, for the sponsor tk, when you click on the link tk, it should run
SELECT donor_first,donor_last FROM dc_donations WHERE sponsoring='tk'
It also needs to be nested inside another while loop. This works, outside of the while loop, just as a test. It retrieves all the names, however, not just the ones for that particular sponsor. But, when I put it inside the other while loop, to put the content inside the div, instead of in some random spot on the page, it doesn't work anymore.
while($row=mysql_fetch_array($eachone)) {
echo $row['donor_first'] . ' ' . $row['donor_last']. ' ';
}
here is my entire code, sorry if its long, shouldnt be too bad.
MY CODE (PASTEBIN)
|
414d15e9dfa198ec7a6cdc4315b22d14ea178d005cd8a50bdebb152020cd58e9 | ['020801591d724a00ac8b5805ed107d38'] | You should read the "Media-Queries" and "The Grid" sections of the docs:
http://foundation.zurb.com/docs/
<div class="row">
<div id="block" class="small-2 large-8 columns">Content</div>
</div>
This code will make "#block" to be 2 columns wide for every screen size due to "small-2" class. The 'large-8' class overrides that behavior on a window width of 768px and above, making it be 8 columns wide on large screens.
To simplify, that code will render "#block" to be 2 columns wide on mobile phone screens and 8 columns on a Desktop Screens.
If you need IE6-8 support, you need to use Respond.js too:
https://github.com/scottjehl/Respond
| 286a5b3698c9dba804aef194bd0f341834c3df05c2f9214f8e9bdd1c4ac7ca8c | ['020801591d724a00ac8b5805ed107d38'] | I made some mixins to make easier to deal with that:
https://gist.github.com/jofralogo/5324278
@mixin rgrid($phone-grid:"",$desktop-grid:""){
@extend .small-#{$phone-grid};
@extend .large-#{$desktop-grid};
@extend .columns;
}
This mixin provides an easy way to use the F4 grid classes and media-queries.
$phone-grid: number of grid columns.
$desktop-grid: number of grid columns that overrides $phone-grid for window width 768px and above.
Only one parameter could be declared to define a value for every window width.
i.e.:
@include rgrid(3,6); => 3 columns for phone, 6 columns for desktop.
@include rgrid(6); => 6 columns.
|
05407db46cd2295d01192b993c0089babd95daf345ca8d12646636628a4b7500 | ['020c1b2fca504ae7aacd6e5062ae2f46'] | I want to check whether a facebook post contains call-to-action button, if yes, then what the type is:
'open_link, like_page, shop_now, play_game, install_app, use_app, install_mobile_app, use_mobile_app, book_travel, listen_music, learn_more, sign_up, download, watch_more, no_button, call_now, apply_now, buy_now, get_offer, get_offer_view, get_directions, message_page, message_user, subscribe, sell_now, donate_now, get_quote, contact_us, start_order, record_now, vote_now, register_now, request_time, see_menu, email_now, open_movies'
I tried to search it using facebook explorer but I cannot find anythings:
https://developers.facebook.com/tools/explorer
How to do that using facebook api if I have the post id and an access token?
| 6b0f69b95f6dc38c1705cb11b8429ecfa6486d3a4045943dfe18bc92bde73b5e | ['020c1b2fca504ae7aacd6e5062ae2f46'] | I am new to CleverTap.
I want to get the number of new users in each of the previous 30 days. I can only view from the dashboard that today's new user number is shown. But how to read the values with API?
It was suggested that the query should be like this:
clevertap = CleverTap("idxxxx", "passcodexxxx")
query = {
"event_name": "abc",
"from": 20170505,
"to": 20170609
}
result = clevertap.events(query)
info = pd.read_json(json.dumps(result))
How can I get the number of new users?
Thank you very much.
|
8219dd5366bae032b408f28749d4fc088ddb5bdd393f40d02c7890f928678e57 | ['020e5d02d33d4eea8ff79b2d6b83965d'] | In my current setup I am using Telegraf to ingest nginx logs from syslog and spit them out into influxdb. This works great.
Telegraf has support for grok log parsing. As far as I can tell it can be invoked for [[inputs.file]] and for [[processors.parser]].
How can I configure telegraf to parse the message part of each incomming log statement from [[inputs.syslog]] with grok?
I tried the following configuratiopn, but it does not work. I get no errors or messages from telegraf at all and there is no change in the output:
# [...] Boilerplate omitted for brevity
# Accept input from syslog
[[inputs.syslog]]
server = "tcp://:2010"
# Send metrics to InfluxDB
[[outputs.influxdb]]
urls = ["http://our_influx.com"]
username = "admin"
password = "admin"
# Process logs with grok
[[processors.parser]]
parse_fields = ["message"]
drop_original = true
merge = "override"
data_format = "grok"
grok_patterns = ["%{COMBINED_LOG_FORMAT}"]
| 4b3baa955a9c86c9433ffbfcfdfec29c0eea01b49919ac911808eae5162b43fa | ['020e5d02d33d4eea8ff79b2d6b83965d'] | I have added the above comment back in after it got swept away with the moved-to-chat comments. My comment was not part of any "extended discussion" and was specifically about the integrity of the (non)answer at hand here. Were it actually answering the question, I would +1, but since it does not actually answer the question, it needs some appropriate content added. |
98f8d5448918539a025c59d8342b4a19fbe9e38da74815397a7650683b0d3602 | ['02203b776e40417f99fd8a8213e11e44'] | Assuming you have a student structure:
struct student {
int id;
char name[20];
};
You can imitate qsort() function, to design a parameter to receive a callback function and to receive the size and size of each element if you'd like use void *.
int find_ele(void *base, size_t num, size_t width,
int (*equal)(const void *, const void *),
void *param)
{
int i;
for (i = 0; i < num; ++i) {
if (equal((char *) base + i * width, param)) {
return i;
}
}
return -1;
}
Then, define a "tester":
int student_tester(const void *p1, const void *p2)
{
struct student *sp = (struct student *) p1;
int id = *(int *) p2;
return sp->id == id;
}
In main() function:
int main(void)
{
struct student student_list[] = {
0, "A",
1, "B",
2, "C"
};
int id = 2;
int index = find_ele(student_list, sizeof student_list,
sizeof(struct student), student_tester, &id);
if (index != -1) {
printf("find_ele(id=2) = student_list[%d]; name = %s. \n",
index, student_list[index].name);
} else {
printf("Not found. \n");
}
return 0;
}
This is a bit complicated. You can create macros to simplify it if you don't care.
Rename find_ele to _find_ele, and create a macro:
#define find_ele(base, num, compare, param) _find_ele(base, \
num / sizeof base[0], \
sizeof base[0], \
compare, param)
And create another macro to define a "tester":
#define define_tester(name, type, type_to_find, code) \
int name(const void *_p, const void *param) { \
type *p = (type *) _p; \
type_to_find value = *(type_to_find *) param; \
return (code); \
}
Now you can define a "tester" like this:
define_tester(student_tester, struct student, int,
p->id == value);
Complete code:
#include <stdio.h>
int _find_ele(void *base, size_t num, size_t width,
int (*equal)(const void *, const void *),
void *param)
{
int i;
for (i = 0; i < num; ++i) {
if (equal((char *) base + i * width, param)) {
return i;
}
}
return -1;
}
#define find_ele(base, num, compare, param) _find_ele(base, \
num / sizeof base[0], \
sizeof base[0], \
compare, param)
#define define_tester(name, type, type_to_find, code) \
int name(const void *_p, const void *param) { \
type *p = (type *) _p; \
type_to_find value = *(type_to_find *) param; \
return (code); \
}
struct student {
int id;
char name[20];
};
define_tester(student_tester, struct student, int,
p->id == value);
int main(void)
{
struct student student_list[] = {
0, "A",
1, "B",
2, "C"
};
int id = 2;
int index = find_ele(student_list, sizeof student_list, student_tester, &id);
if (index != -1) {
printf("find_ele(id=2) = student_list[%d]; name = %s. \n",
index, student_list[index].name);
} else {
printf("Not found. \n");
}
return 0;
}
| 2573a751981d6bb706c3ba5cfb0deca0e3b2164057f156992a4b7f012f6af39b | ['02203b776e40417f99fd8a8213e11e44'] | function noCSS() {
var links = document.getElementsByTagName("link");
for (var i = links.length - 1; i >= 0; --i) {
if (links[i].rel === "stylesheet") {
links[i].parentNode.removeChild(links[i]);
}
}
}
You have to check the rel attribute of each <link> in the loop;
You can remove them in a reversed order (when you remove links[0], links[1] takes the place of it and when you remove links[1] it actually removes the second one of the rest;
Or you can just use while (links.length) instead, and always remove links[0] (the first one of the rest).
|
83e2402536ea76f652909254d9702929b41d68db889f3f3787384654c962cc2e | ['02338b54c1274f2cab081ccd6321c37b'] | I'm using .NET 4.7.1 and Visual Studio 2017 (Community Edition) and I've been storing sensitive key/license data as a string within the program. Suppose we have the following string:
string password = "admin123"
How safe is this from extraction within a hex editor or similar methods? I'm not well versed in hex editing, but after a few trivial searches it seems the string is obfuscated in some way.
Any insight would be greatly appreciated, thank you.
| 385f97e488b92e1f6d235b8f9fd161c831deaa27d2ae71ea39272c2315a58849 | ['02338b54c1274f2cab081ccd6321c37b'] | I'm rewriting some legacy code and would like to use both STL AND smart pointers. However, memory is defined in STL, so if I include memory then it's some STL code and smart pointers are unavailable.
Whats a workaround? Rename the STL file and any references to it? Is there a better way to do this?
Thank you very much!
|
bbe9393c273d6f715c8251f9d0177db00af3a03bd829b195d73f8af0b243801e | ['0239ca2e168b4be59abf1a5f11c06197'] | I post the solution I just found after a battle on symfony and webpack!
The trick: (for Symfony and webpack)
1 / Install dropzone
2 / Leave the file dropzone.js or dropzone.min.js in the node_modules, do not touch them.
3 / Create a file.js, ex: myDropzone.js
4 / Call Dropzone in myDropzone.js with:
window.Dropzone = require('dropzone/dist/min/dropzone.min');
5 / As well as the dropzone config code according to your choices:
Dropzone.autoDiscover = false;
$(function() {
//Dropzone class
$('.dropzone').dropzone({
paramName: "file",
maxFilesize: 2,
maxFiles: 2,
addRemoveLinks: true,
acceptedFiles: "image/*,application/pdf"
});
});
| df25c4419726df02ed2711a7960079a09020ba36734e58c53fc5c6601f95ddbf | ['0239ca2e168b4be59abf1a5f11c06197'] | I watched the various conversations on the subject, sorry to redo a topic but I look for a whole day and I do not understand why Dropzone is not defined.
In my console it's always the same speech ...
Uncaught ReferenceError: Dropzone is not defined
Where could I have been wrong?
<div action="{{path('document_create')}}" class="dropzone">
<div class="fallback">
{{ form_widget(form.file, {
'attr': {'type': 'file', 'name': 'file'}
}) }}
</div>
</div>
JS:
Dropzone.autoDiscover = false;
$(function() {
//Dropzone class
var myDropzone = new Dropzone(".dropzone", {
url: "upload.php",
paramName: "file",
maxFilesize: 2,
maxFiles: 10,
acceptedFiles: "image/*,application/pdf"
});
$('#startUpload').click(function(){
myDropzone.processQueue();
});
});
|
ff4ea10ca3988733286146f7e7ba0077c20bbbf52eba3000e15357e867618e79 | ['024619a700b14307850303672343d457'] | Thanks <PERSON>, before everything I had to navigate to /bin before I was able to get root access under zch.
Then instead of using a live cd I sudo'd gedit the passwd and changed the shell value to /bin/bash wherever it appears, now it seems to work. Thanks again for all your help | 2d2aaceef48d36b9e97ad75f0ec4b9467a56c885b5c64b2bc2f0c9160ee1eccf | ['024619a700b14307850303672343d457'] | The non-perturbative result in [hep-th/0003055, hep-th/0010274] is based on two facts: the effective propagator is constant and all effective propagators (i.e. the ladder diagrams) resum exactly in a Laguerre polynomial in the coupling constant.
Given that I have not fully read the paper by <PERSON> and <PERSON>, I think that if you follow the same argument, now a different value of the constant, as written above equation (11), leads to the same Laguerre polynomial but with a rescaled coupling constant, as written in (11).
|
ab7932607c9364ee1ef61fa11ca69f7c65b3676b1930dbbd597e7a8f6930860b | ['024d58a904314b00ae83c5cc1bf539ca'] | You say that you are using VS 2013? If so, you do not need the extra git tools. I don't have them installed on my VS 2013, can use TFS with GIT just fine, and I don't experience the issue with .gitignore being ignored.
You can even manage the .gitignore via the IDE GUI so formatting should always be in the format desired by TFS/VS: http://msdn.microsoft.com/en-us/library/vstudio/hh967655.aspx#ignore
As stated in the Requirements from: https://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c:
Note: Visual Studio 2013 includes Git tools by default so these tools
are not needed. Learn more on MSDN:
http://msdn.microsoft.com/en-us/library/vstudio/hh850437.aspx
| 86bc7553d74a1a9ac6b7106bf9d763554130d33ae82b90c976d35b69561eb952 | ['024d58a904314b00ae83c5cc1bf539ca'] | I had the same issue with Visual Studio 2017 on Windows and latest Xamarin using the iOS simulator on remote Mac. Debugging started, but breakpoints were not hit.
Got it working by changing nothing on the Mac or iOS Build options; instead changed the generated Debugging information type in Visual Studio 2017 in Windows from "Full" or "Pdb-only" to "Portable".
I did this for the iOS Platform project as well as the shared Xamarin.Forms project (.NET Standard 2.0).
After this the breakpoints started getting hit in both the Shared project and the iOS platform project. Good times.
|
effdc289384f1b04ccb3e9bc96c618ac5d6213e3126fdafa153ef0c2f05784a7 | ['024ecdf657594fffa9957efc7fffecab'] | I'm afraid that you can't change what is read from the QR code unless you change the code. You'll have verify the source at some point up stream. Maybe in the app or on your server? Maybe if you send a random code in the e-mail so that you can make sure that each one is only used once.
| 607fd83ef9cb7c709a18f2f022a4178a568a7cf7a1a936a71b65ddda618754c3 | ['024ecdf657594fffa9957efc7fffecab'] | I was looking for something similar sometime last year. This is the one I settled on:
YAJL
It's not a single file solution, but it's not very big either. I has some features like JSON formatting and syntax checking that you might see as feature bloat, but they don't bother me.
|
d3e92a2a871bce05778cff88caaf05957e671aefc942f2c49d4746b966676325 | ['025462b372504c798d9c2221ecff5092'] | Once you have 10000 reputation points on a site, you gain access to the moderator tools. This includes an easy access to list recently closed questions. You can periodically review that list, and find questions where you want to cast delete votes. There are also some rules that make the SE software auto-delete certain questions, though I don't remember what they are. | 021fb59517c265f8b314fe314ac966560edd0c5689685caba1c357890c755032 | ['025462b372504c798d9c2221ecff5092'] | @JonEricson: Yes, but sometimes you don't have a choice of the face. On http://winterbash2015.stackexchange.com/ or on the "Your Hats" dialog from my user page, hats shows up on a white background, not on a face. Further, hats can extend outside the avatar, and Most SE sites have a white background. This bothered me in the Secret Hats thread where most people put screenshots of hats with such confusing backgrounds, which is why I made the edit http://meta.stackexchange.com/revisions/270793/3 where I rendered the hat on a blue background. (The larger resolution is just a bonus.) |
b12e0d2ad2b9473b0c6944ef1d085546fd247e99c8707d0a0eefb46ede8ccc82 | ['027847e711da48f5bf5b7ed02d2e1097'] | Since the ProgressDialog class is deprecated, here is a simple way to display ProgressBar in AlertDialog:
Add fields in your Activity:
AlertDialog.Builder builder;
AlertDialog progressDialog;
Add getDialogProgressBar() method in your Activity:
public AlertDialog.Builder getDialogProgressBar() {
if (builder == null) {
builder = new AlertDialog.Builder(this);
builder.setTitle("Loading...");
final ProgressBar progressBar = new ProgressBar(this);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
progressBar.setLayoutParams(lp);
builder.setView(progressBar);
}
return builder;
}
Initialize progressDialog:
progressDialog = getDialogProgressBar().create();
Show/Hide AlertDialog whenever u want using utility methods:
progressDialog.show() and progressDialog.dismiss()
| 5871c1a8ce093dbdc46f606b53d75aad79a6be484e7104e76f0d382e6f577ec4 | ['027847e711da48f5bf5b7ed02d2e1097'] | I have a Switch button in toolbar and two TextViews in RecyclerView.
I want to manage the visibility of one of the TextViews in RecyclerView based on the state of Switch.
I have added OnCheckedChangeListener to the Switch and am setting a boolean FLAG to TRUE of FALSE here. This FLAG value is read in onBindViewHolder(-,-) method of the Adapter and I am setting the View visibility to VISIBLE/GONE based on the FLAG.
In MainActivity:
Switch switchView;
private boolean switchFlag;
public boolean isSwitchFlag() {
return switchFlag;
}
public void setSwitchFlag(boolean switchFlag) {
this.switchFlag = switchFlag;
}
protected void onCreate(Bundle savedInstanceState) {
...
switchView.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
setSwitchFlag(isChecked);
adapter.notifyDataSetChanged();
//recyclerView.refreshDrawableState()
}
});
...
}
In Adapter:
public void onBindViewHolder(ViewHolder viewHolder, Cursor cursor) {
if (((MainActivity) mContext).isSwitchFlag()) {
viewHolder.textView.setVisibility(View.VISIBLE);
...
}
How do I manage to show/hide views in RecyclerView on any event in Toolbar?
|
e0f328f9d88bfd078cd41e3443e7ecc9432bde4edd299b5e5c80053d8011e439 | ['0281376c6a654a08852e273a0cb39dd8'] | Old question, but still valid, here's simple answer:
If you want to limit your vertx system to the single server, i.e. not have the eventbus leak out across your local network, the simplest thing to do is create a local copy of Hazelcast's cluster.xml on your classpath, i.e. copy/edit vertx source (see git):
vertx-hazelcast/src/main/resources/default-cluster.xml
into a new file in your vertx project
src/main/resources/cluster.xml
The required change is to the <multicast> stanza disabling that feature:
<hazelcast ...>
...
<network>
...
<join>
...
<multicast enabled="false">
...
</multicast>
<tcp-ip enabled="true">
<interface><IP_ADDRESS></interface>
</tcp-ip>
| c36c19c483906c2d856508f8cbf9e4450ced56c335d7beec1de60414797ce255 | ['0281376c6a654a08852e273a0cb39dd8'] | You're on the right lines.
My suggestions:
reverse the order of your arguments to isSubList, i.e.
isSublist(X,Y) means X is a subList of Y. That would be more
legible to most Prolog readers (but hey, there's only a handful of
us...). This makes most sense if you use the 'op' operator and
define isSublist as an infix operator, so you could write "X
isSublist Y" and that would be equally valid Prolog.
try and avoid the cut (!) - it's an extra-logical predicate and
leads you down the rabbit hole of thinking all the time about the
order Prolog will interpret your clauses. For such a simple relation
you should be able to keep your code 'declarative'.
You really have TWO different matching situations - firstly
matching a sublist anywhere in another list, and secondly
exactly matching a list from the first element (i.e. this happens after you get the first match). I.e. you have a
subList(X,Y) (I
dropped the 'is') and frontList(X,Y) where frontList(X,Y) only
succeeds if list X is the first part of list Y.
So you end up with the following code:
subList([H|T1],[H|T2]) :- frontList(T1,T2).
subList([H1|T1],[H2|T2]) :- H1 \= H2, subList([H1|T1],T2).
frontList([],_).
frontList([X|T1],[X|T2]) :- frontList(T1,T2).
For extra marks, you can see that frontList(X,Y) is actually the same as
append(X,_,Y)
Think about it... append a list to X and you get Y means that the elements of X must be the first elements of Y...
|
a10df05e43dc291c15baf32b0e68f0a8fbe080f1850ce3053b9fb8a546ee18d8 | ['028863224c0e4aa797362f1710389603'] | Add the "> /dev/null 2>&1 &" to you command, to ensure the process gets properly forked and doesn’t log anywhere.
The equivalent shell command looks like this:
curl -XPOST "http://elastichost/index/type/${array[i]}/_update" -d '
{
"script" : "ctx._source.tags = [ctx._source.tags]"
}' > /dev/null 2>&1 &
It takes a little over 1ms to fork the process, which then uses around 4k of resident memory. While the curl process takes the standard SSL 300ms to make the request
On my moderately sized machine, I can fork around 100 HTTPS curl requests per second without them stacking up in memory. Without SSL, it can do significantly more:
forking a process without waiting for the output is fast.
curl takes the same time to make a request as socket, but it is
processed out of band.
Forking curl requires only normal unix primitives.
Forking sets a single request back only a few milliseconds, but many
concurrent forks will start to slow your servers.
Do not echo anything in your terminal.
Reference: link
| a32fbe061b29dddf697dc37baabaab68c9edcbc3f973899fbf474249c9fd930f | ['028863224c0e4aa797362f1710389603'] | You may need to add "source ~/.rvm/scripts/rvm" to your ~/.bash_profile file.
echo "source $HOME/.rvm/scripts/rvm" >> ~/.bashrc
To install rvm:
rm -rf ~/.rvm
curl -L https://get.rvm.io | bash -s stable
In your script type:
type_rvm=$(type rvm | head -n 1)
echo "type rmv: $type_rvm"
You could try export rvm:
export PATH=$PATH:/opt/rvm/bin:/opt/rvm/sbin
|
5b21fdade43142b7b84e378801535f193ce09c6178f596a9c368a2dbba1b8fde | ['02911690d5224b4bbfbd9fa23f5474ba'] | I created a Debezium Embedded engine to capture MySQL change data. I want to commit the offsets as soon as I can. In the code, the config is created including follows.
.with("offset.commit.policy",OffsetCommitPolicy.AlwaysCommitOffsetPolicy.class.getName())
Running this returns, java.lang.NoSuchMethodException: io.debezium.embedded.spi.OffsetCommitPolicy$AlwaysCommitOffsetPolicy.<init>(io.debezium.config.Configuration)
However, When I start the embedded engine with,
.with("offset.commit.policy",OffsetCommitPolicy.PeriodicCommitOffsetPolicy.class.getName()), the embedded engine works fine.
Note that the class OffsetCommitPolicy.PeriodicCommitOffsetPolicy constructor includes the config parameter while OffsetCommitPolicy.AlwaysCommitOffsetPolicy doesn't.
public PeriodicCommitOffsetPolicy(Configuration config) {
...
}
How to get the debezium embedded engine to use its AlwaysCommitOffsetPolicy?
| 7f9a1b6bcfcd52e3ee2ab4cc36ca9e1c64c1479619922ee671ffecb9446b11ff | ['02911690d5224b4bbfbd9fa23f5474ba'] | I am using debezium in my java application to capture changes from Oracle 12c. The oracle database is accessible on localhost:1521. Below is respective java code.
// Define the configuration for the embedded and Oracle connector ...
Configuration config = Configuration.create()
.with("connector.class", "io.debezium.connector.oracle.OracleConnector")
.with("tasks.max", "1")
.with("offset.storage",
"org.apache.kafka.connect.storage.FileOffsetBackingStore")
.with("offset.storage.file.filename",
"/home/username/oracleLogs/offset.dat")
.with("offset.flush.interval.ms", 10000)
.with("name", "oracle-debezium-connector")
.with("database.hostname", "localhost")
.with("database.port", "1521")
.with("database.user", "c##xstrm")
.with("database.password", "xs")
.with("database.sid", "ORCLCDB")
.with("database.server.name", "oracle-debezium-server")
.with("database.out.server.name", "dbzxout")
.with("database.history",
"io.debezium.relational.history.FileDatabaseHistory")
.with("database.history.file.filename",
"/home/username/oracleLogs/dbhistory.dat")
.with("database.dbname", "ORCLCDB")
.with("database.pdb.name", "ORCLPDB1")
.build();
// Create the engine with this configuration ...
EmbeddedEngine engine = EmbeddedEngine.create()
.using(config)
.notifying(this<IP_ADDRESS>handleEvent)
.build();
// Run the engine asynchronously ...
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.execute(engine);
Note that the Oracle database is configured as given here. Also the ojdbc8.jar and xstreams.jar obtained from Oracle Instant Client have been imported to the java project.
When the above code is executed, it produces following output even when the Oracle database is shut-down. The changes are not captured either.
28 [pool-1-thread-1] INFO org.apache.kafka.connect.storage.FileOffsetBackingStore - Starting FileOffsetBackingStore with file /home/username/oracleLogs/offset.dat
What am I doing here wrong?
|
78e628eb68f0359641508ff4f7aeb65aa69d8e26ac4da0bc6c5e745f69b014b2 | ['02b90a3fda47432e95a3a7947ab4ee59'] | Since your question was based on writing a file to send to a 3D printer, I suggest you ditch the STL format file and use an OBJ format file instead. It is much simpler to compose, and it produces a much smaller file. There isn't a binary flavor of OBJ, but it's still a pretty compact file as you will see.
The (abbreviated) spec says:
List all the geometric vertex coordinates as a "v", followed by x, y, z values, like:
v 123.45 234.56 345.67
then List all the triangle as "f", followed by indices in a CCW order, like:
f 1 2 3
Indices start with 1.
Use a # character to start a comment line. Don't append comments anywhere else in a line.
Blank lines are ok.
There's a whole bunch of other things it supports, like normals, and textures. But if all you want to do is write your geometry to file to import into a 3D printer then OBJ is actually preferred, and this simple content is valid and adequate.
Here is an example of a perfectly valid file composing a 1 unit cube, as imported successfully in Microsoft 3D Viewer (included in Win/10), AutoDesk MeshMixer (free download), and PrusaSlicers (free download)
# vertices
v 0 0 0
v 0 1 0
v 1 1 0
v 1 0 0
v 0 0 1
v 0 1 1
v 1 1 1
v 1 0 1
# triangle indices
f 1 3 4
f 1 2 3
f 1 6 2
f 1 5 6
f 1 8 5
f 1 4 8
f 3 7 8
f 3 8 4
f 3 6 7
f 2 6 3
f 5 8 7
f 5 7 6
If you've got data in multiple meshes, you ought to coalesce the vertices to eliminate duplicate points. But because the file is plain text you can use PrintWriter() object and println() methods to write the whole thing.
| 9632f6324440ff5ad0223a37d0b4944c3519b86e72a0dc5ec31dcdc465fe64cc | ['02b90a3fda47432e95a3a7947ab4ee59'] | I can load a Bitmap Font just fine with the following code:
BitmapFont font= new BitmapFont(
Gdx.files.internal( "Fonts/MyFont.fnt" ),
Gdx.files.internal( "Fonts/MyFont.png" ),
false );
but I'm trying to implement the AssetManager instead. So I recoded that snippet with the following code:
AssetManager assetManager = new AssetManager();
assetManager.load( "Fonts/MyFont.fnt", BitmapFont.class );
assetManager.load( "Fonts/MyFont.png", Texture.class );
assetManager.finishLoading();
BitmapFont font = assetManager.get( "Fonts/MyFont.fnt" );
If failed of course. The the call to the finishLoading() method returned a message indicating:
Couldn't load dependencies of asset: "Fonts/MyFont.fnt"
Ok. that makes sense, because I didn't do anything with the texture. So how do I pass the texture file as dependency? github.com/libgdx/libgdx/wiki/Managing-your-assets says:
BitmapFontLoader is a good example of an asynchronous loader that also
has dependencies that need to be loaded before the actual asset can be
loaded (in that case it's the texture storing the glyphs). Again, you
can do pretty much anything with this.
Well Duh! I guess they assume, "... if you only knew how!" But, their example doesn't show how - as a matter of fact their example shows pretty much what I've written. So, I'm stumped. All Google seems to be able to find are examples of what to do with TTF fonts, but nothing for regular old Bitmap Fonts.
Does anyone have an example of the solution to this error. Thanks a million!
|
e7b6a5f7ab2ee58ab50df9a5720fed1dac7be2382906a747a07aee75e9de8c06 | ['02bd1430af0d4ad0a6f4ed564f9d769e'] | I'm trying to get Mule to log the exception that my SOAP component throws in the following flow. For instance, if I pass it malformed xml as an input, in soapUI I get a meaningful output, but I want to be able to log this in either the console or to send it to a JMS queue.
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<flow name="CAB-Mule_WMBFlow1" doc:name="CAB-Mule_WMBFlow1">
<http:inbound-endpoint exchange-pattern="request-response" address="http://localhost:8081/DemoCustomer" doc:name="HTTP" mimeType="text/xml">
<idempotent-redelivery-policy maxRedeliveryCount="3">
<dead-letter-queue>
<vm:outbound-endpoint path="error-queue" />
</dead-letter-queue>
</idempotent-redelivery-policy>
</http:inbound-endpoint>
<cxf:jaxws-service port="80" serviceClass="com.mulesoft.demo.DemoCustomer" doc:name="SOAP"/>
<component class="com.mulesoft.demo.DemoCustomerIntImpl" doc:name="Java"/>
<jms:outbound-endpoint queue="StudioIN" connector-ref="Active_MQ" doc:name="JMS"/>
<logger level="INFO" doc:name="Logger" message="Payload: #[payload]"/>
</flow>
<flow name="error" doc:name="error">
<component class="com.mulesoft.demo.ExceptionService" doc:name="Java"/>
<jms:outbound-endpoint queue="Error" connector-ref="Active_MQ" doc:name="JMS"/>
</flow>
ExceptionService is just:
public class ExceptionService {
public void onException(ExceptionMessage e) {
System.err.println("EXCEPTION MESSAGE<IP_ADDRESS><IP_ADDRESS> " + e.getException().getMessage());
}
}
| daf5dd4d96a33fa2c444dd6241311565ef822ee51c272cff89168c9a717a4a4b | ['02bd1430af0d4ad0a6f4ed564f9d769e'] | Massive thanks to <PERSON>'s comment for the shift-key hint (and all the other help too, of course). There were no macros running that were using the Shift key but occasionally as I alt-tabbed out, I'd use alt-shift-tab or some other combination using shift and break it due to Excel's "No shift when opening" security rule.
The documentation on the microsoft support page has a resolution for this issue, involving detecting when the shift key is held and running another loop inside the Do Until that prevents open from being called until it's released.
Final relevant code:
'Declare API
Declare Function GetKeyState Lib "User32" _
(ByVal vKey As Integer) As Integer
Const SHIFT_KEY = 16
Function ShiftPressed() As Boolean
'Returns True if shift key is pressed
ShiftPressed = GetKeyState(SHIFT_KEY) < 0
End Function
...
Do Until strFilename = ""
Do While ShiftPressed()
DoEvents
Loop
Set wbSrc = Workbooks.Open(fileName:=myPath & "\" & strFilename, UpdateLinks:=False)
Set wsSrc = wbSrc.Worksheets(1)
wsSrc.Copy after:=wbDst.Worksheets(wbDst.Worksheets.Count)
wbSrc.Close False
strFilename = Dir()
Loop
|
ef56df5d0244fe9d244abca84f3ee67823d6b5dcca79a65d8e3a55871bc99558 | ['02c9efcab5c34c7e959cacd13d4d21e0'] | It's ok no worries. I checked online to see what was the runlevel 1.
I tried to live boot but it didn't work, so i'm trying with another version (first was 16.04.1 and now 16.04.6 - i only know that i'm running on 16.04 but the last nuber i don't remember). | 090a99473a617ccdcf5b11e4affb98ea6128d5e46441daa4bafe489c550d2329 | ['02c9efcab5c34c7e959cacd13d4d21e0'] | I was trying to find a way to resize correctly my window for virtual box(to get it full screen) , however at one point I executed the command get-apt dist-upgrade and I think this command break my computer running on Ubuntu 16.04
The computer boots but I can't use my keyboard(can't open a terminal) or my mouse on my desktop. So I taught about rebooting in secure mode but I don't know how to do it. My computer is a dell so I did F12 to enter Bios and then I hold esc so I enter the grub. Instead of having an option to boot in secure mode I just have a command line. I used the command "reboot" and now I'm in the Bios.
How can I do to boot in secure mode?
I have a save of many of my files in a USB drive, how to get back to that save or undo that apt-get dist-upgrade?
Thanks. !
|
8e0f3e588b87f60372892481d019c002668562302ea499247fea91093bcdfe09 | ['02ca6edc8059415c991c7b62014ee860'] | When I'm searching by the following aggregation:
"aggregations": {
"codes": {
"terms": {
"field": "code"
},
"aggs": {
"dates": {
"date_range": {
"field": "created_time",
"ranges": [
{
"from": "2017-12-06T00:00:00.000",
"to": "2017-12-06T16:00:00.000"
},
{
"from": "2017-12-07T00:00:00.000",
"to": "2017-12-07T23:59:59.999"
}
]
}
}
}
}
}
I get the following result:
"aggregations": {
"codes": {
"buckets": [
{
"key": "123456",
"doc_count": 104005499,
"dates": {
"buckets": [
{
"key": "2017-12-05T20:00:00.000Z-2017-12-06T12:00:00.000Z",
"from_as_string": "2017-12-05T20:00:00.000Z",
"to_as_string": "2017-12-06T12:00:00.000Z",
"doc_count": 156643
},
{
"key": "2017-12-06T20:00:00.000Z-2017-12-07T19:59:59.999Z",
"from_as_string": "2017-12-06T20:00:00.000Z",
"to_as_string": "2017-12-07T19:59:59.999Z",
"doc_count": 11874
}
]
}
},
...
]
}
}
So now I have a list of buckets of buckets. I need to have a total count value for each bucket, which is the sum of doc_counts of the buckets inside. For example, the total count for my first bucket should be 156643 + 11874 = <PHONE_NUMBER>.
I've tried using Sub Bucket aggregation, but
"totalcount": {
"sum_bucket": {
"buckets_path": "dates"
}
}
this is not going to work, because "buckets_path must reference either a number value or a single value numeric metric aggregation, got: org.elasticsearch.search.aggregations.bucket.range.date.InternalDateRange.Bucket". Any ideas how should I do this?
| 4347c987640df09d1694f7d7b9498044c064b868b8ceef3ce8434ef70e10ce03 | ['02ca6edc8059415c991c7b62014ee860'] | I have the following query:
GET my-index-*/my-type/_search
{
"size": 0,
"aggregations": {
"my_agg": {
"terms": {
"script" : "code"
},
"aggs": {
"dates": {
"date_range": {
"field": "created_time",
"ranges": [
{
"from": "2017-12-09T00:00:00.000",
"to": "2017-12-09T16:00:00.000"
},
{
"from": "2017-12-10T00:00:00.000",
"to": "2017-12-10T16:00:00.000"
}
]
}
},
"total_count": {
"sum_bucket": {
"buckets_path": "dates._count"
}
},
"bucket_filter": {
"bucket_selector": {
"buckets_path": {
"totalCount": "total_count"
},
"script": "params.totalCount == 0"
}
}
}
}
}
}
The result of this query is a bunch of buckets. What I need is the list of keys of my buckets. The problem is the aggregation result size is 10 by default, after getting those 10, my bucket_filter filters them by total count, and I get only some of those 10. I need to have all the results, which means I need to specify "size" = n, where n is the distinct count of code values, so that I don't lose any data. I have billions of documents, so in my case n is about 30.000. When I tried executing the query, "Out of memory" occurred on cluster, so I guess it's not the best idea. Is there a good way to get all the results for my query?
|
de7df3deef1ab0afb7a7c9e7a052e2eb4b0a4ca964b241edab14c1e3cf4abb96 | ['02cc6cacdf534d9e8cf38eb99fcff452'] | AWS young blood here. Our site is currently being hosted on a Google registered domain, specifically in a subdomain of our root "beta.{root domain}" It's time to switch the whole of the site to the root, and my understanding is that Google requires an A record to map that root domain, but I'm having problems.
We've previously been using a CNAME record to point the subdomain to an AWS Elastic Load Balancer without any problems. But when I try to use the ELB's A record in Google Domain's field I get an "invalid value error." Similarly, if I try to use an AWS Route 53 alias record in order to create an A record to our ELB, Google Domains won't accept that as valid entry either.
screenshot: https://i.imgur.com/L5CRWJD.png
I'm starting to think these two services are not going to play as well together as I had hoped.
Has anyone experience similar issues? What's the best way to try to resolve this problem? Should I look to transfer the DNS registration over to AWS / Route 53 and cut Google Domains out of the equation altogether? Or am I overthinking the issue?
Is there a way to configure the root of a Google Domain to point to an AWS Elastic Load Balancer simply and painlessly?
| 559e840deb18a0087225febec575c06bf5b10ee7be60aa24df0b2ca21f9e6c05 | ['02cc6cacdf534d9e8cf38eb99fcff452'] | I'm attempting to lay the foundation for a relatively simple messaging system using Twilio API and its Python wrapper. Users should be able to text a keyword and receive back a string of responses.
The problem is, using the suggested HttpResponse() package from Twilio's documentation, when I loop through the messages to add them to a response chain, they hit Twilio in a block, and sends the service sends them in a seemingly random order, which really compromises the readability of the block.
Here's a simplified version of the loop I'm running in Django to create the response:
@csrf_exempt
def inbox(request)
if request.method == "POST":
# Interpret the keyword in the incoming message
data = request.POST
messageBody = data['Body'].lower()
# Check if it matches a valid keyword
targetTrigger = Keyword.objects.get(trigger_word=messageBody)
# Pull the appropriate responses
messageChain = Message.objects.filter(keyword_answers=targetTrigger)
# Create the messaging response
resp = MessagingResponse()
# Populate it with messages
for sms in messageChain:
resp.message(sms)
# Send them to Twilio
return HttpResponse(str(resp))
I've glossed over the try and error catches for the sake of readability. And like I said, this sends the messages in a seemingly random order, with shorter messages appearing to send through to my iPhone first more of the time. Not always, but enough for me to need to rethink this method.
Strangely there's little in the documentation about sending multiple messages in a SMS HttpResponse, though I imagine it's a common use case. The alternative I was considering is sending back a blank HttpResponse to simply acknowledge to Twilio the message was received successfully, and then using its regular one-by-one sending method with my for loop. That seems a little less efficient, but I need accuracy in the order the messages send.
Any suggestions? Twilio developer evangelists, I know you all are out here.
|
3ba4465d1ec4ed61ead44ac64302716922b663d11e440eadf5da5b324027c57f | ['02da7d606c264ef8915ec6a844c1d5be'] | Many of the property management software offerings have high monthly minimums. In some cases the minimums are as high as $200 per month. Rentables offers affordable property management software for just $0.50 per $1000 in monthly rents and no monthly minimum. It sounds like in your case the monthly fee would be minimal.
Disclosure: I work for Rentables. We would be happy to assist you in getting set up.
| e53cf72372f3b7598abaf9b6ad2b272ebf73fc187adb9a8c3dccf08e5dcc0c5e | ['02da7d606c264ef8915ec6a844c1d5be'] | The answer is yes!
I did
I configure a vpn using logmein hamachi
I install hamachi on my raspberry
I register my iphone into the VPN where my raspberry is
I connect to the vpn from my iphone
I use iSSH app to connect to the raspberry to the ip provided by logmein (both - raspberry and iphone should be active into the vpn)
If you need more details, just ask, not problem at all.
P.D
Demure suggest an interesting alternative I'll give it a chance.
|
a5ffc4421c9995ca7c36219b6b15ed0458ddb4d6c5d296b42db1fdb8fef0d4f6 | ['02ed61c296ab41689435a29b8949b85a'] | I installed a new Laravel application after the description https://medium.com/@dennissmink/laravel-echo-server-how-to-24d5778ece8b
I did after i tried to install socket.io in an current application. In both cases there is the problem that the socket.io turns without any results.
vagrant@homestead:~/code/test$ laravel-echo-server start
L A R A V E L E C H O S E R V E R
version 1.5.0
⚠ Starting server in DEV mode...
✔ Running at localhost on port 6001
✔ Channels are ready.
✔ Listening for http events...
✔ Listening for redis events...
Server ready!
Channel: test-event
Event: App\Events\ExampleEvent
Channel: test-event
Event: App\Events\ExampleEvent
window.Echo.channel('test-event')
.listen('ExampleEvent', (e) => {
alert(e)
console.log(e);
});
What is missing that the socket.io does not get any results? Any hint?
| 0023135e650a5956fe6844fc2949cf7631cd4dad4b66d8090c06b230d6a8e525 | ['02ed61c296ab41689435a29b8949b85a'] | Axios catch an error even if the response is success.
I tried to check the error but in my opignion, it doesn't make sense.
Is there something wrong in the code in my vuex acion:
export const store = ({ dispatch, state, commit }, { payload, context }) => {
return axios.post('/api/projects', payload).then((response) => {
commit('addProject', response.data)
commit('setProjectData', response.data)
}).catch(function (error) {
if (error)
context.errors = error.response.data.errors
})
}
//Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'error.response.data')
|
735bdaf8c5de7ed2b53da5d0e59d9c633b725d66a810d2b0c9f28084652b75e6 | ['02ff1301d6a345bcbbaadc77b9d1a972'] | I want to set up the psql terminal tool in Centos 6.6
I have been given access to as database and i just want to use the terminal for writing queries to the database for information. I have no prior experience with psql before but I want to move on from the pgadmin3 gui.
I started off by installing psql:
yum install postgresql
but when I try to access it, ie. typing [root@localhost]# psql I get the following error:
psql: FATAL: database "root" does not exist
I've tried using:
psql --host=<DB instance endpoint> --port=<port> --username=<master user name> --password --dbname=<database name>
but that fails to work too, maybe this is really basic but im completely lost for setting this up
| 21043369e109ee0159e88ed7b9a280b6516504814bd28e371d4743c8a05d67f9 | ['02ff1301d6a345bcbbaadc77b9d1a972'] | You could use the requests package which is my preference over urllib.
This returns all the html from the web page.
import requests
response = requests.get('http://stackoverflow.com/questions/34157599/how-do-you-convert-pythons-urllib2-urlopen-to-text')
with open('test.txt' 'w' ) as f:
f.writelines(response.text)
f.close()
|
85d53ee2172b84eb7923cf397b4bb7729aee2318b4686fc469fa7ce314d3b6c2 | ['0303ed8a99fb41b7b706e93257c026b4'] | We can see here:
Code=-1016 "Request failed: unacceptable content-type: text/html"
That your problem should be happening because of this line:
operation.responseSerializer = [AFJSONResponseSerializer serializer];
For some reason your server must be returning a non-JSON response, and you are using a JSONResponseSerializer. So if you fix the server return type the correct format you'll probably be fine.
Or, you could just change the serializer type like this:
operation.responseSerializer = [AFHTTPResponseSerializer serializer];
if it's just for a testing purpose.
| 7eb25eebe7553a90c62b670c281c3e1dedef7e79510cd61d42e1bcb468a08501 | ['0303ed8a99fb41b7b706e93257c026b4'] | I'm having a bad time trying to set the new UIInterfaceOrientations from iOS 6.
Resuming my app:
My app have a bunch of views;
Almost every view should be shown on Portrait orientation;
2 of my views (the ones that play videos with MPMoviePlayerViewController) should rotate to left, right and portrait orientations.
My original idea was to set the app supported orientation to Portrait and than change (don't know how) the supported orientation from the video player views.
What would be the best way to deal with this?
Thank you in advance!
|
889f28143999ad1c926a7973a5aab29a95747b93caf22a0bff3661c9cc4fe13d | ['030a0ef0188241eebdc9763bde8d911e'] | I have a column that is used for calculations only. It displays either a 0 or a positive number which represents vacation time. In our Time table it is entered as a negative number and I convert it to a positive number for calculations. I need that positive value to go into the NonWorkHrs column for each entry by an employee. It needs to be the same value for all records within a user ID.
I have tried using case statements and select max within a sub-query
update DME
set NonWorkHrs =
(
select max(VacationHours)
from DME b
where useruid = b.useruid
and useruid in (1,2,3)
and NonWorkHrsHolder > 0
)
where useruid in (1,2,3)
I also tried a case statement
update DME
set NonWorkHrs =
(case
when (VacationHours > 0)
then (VacationHours)
--no else statement is need. All rows should have the same value
end
)
where useruid in (1,2,3)
I convert the negative TimeEntered values to positive values in the VacationHours column. The NonWorkHrs column is used to in calculations to determine the actual work hours.
The expected result is
Useruid UserFullName NonWorkHrs VacationHours TimeEntered
1 <PERSON> 8 8 -8
1 <PERSON> 8 0 10
1 <PERSON> 8 0 12
2 John Doe 18 18 -18
2 John Doe 18 0 23
3 Bob Builder 16 16 -16
3 Bob Builder 16 0 40
The actual result is
Useruid UserFullName NonWorkHrs VacationHours TimeEntered
1 <PERSON> 18 8 -8
1 <PERSON> 18 0 10
1 <PERSON> 18 0 12
2 John Doe 18 18 -18
2 John Doe 18 0 23
3 Bob Builder 18 16 -16
3 Bob Builder 18 0 40
| 847b5310f8186cfd5fb178b10cdcf46a8561fdb82590ec39921a44e1e96d7976 | ['030a0ef0188241eebdc9763bde8d911e'] | I need to concatenate the columns LastName and FirstName into a new column called EmployeeName. The problem is that some first name fields include a middle initial and some do not. We do not want the initial in the EmployeeName column. How do I remove it from those instances?
I have tried trim functions, left functions, right functions and I cannot get it to work quite right. I have tried concatenating the columns then cleaning it up, that does not work either
SELECT LEFT(EmployeeName, LEN(EmployeeName) - 2) FROM myTable
but this removes the last characters even for those with no middle initial. I have it as -2 to account for the space between FirstName and Middle Initial
When the EmployeeName field is <PERSON>, <PERSON> it removes the space and J correctly
When the EmployeeName field is <PERSON>, <PERSON> it removes the 'hn'. I don't want that.
Thank you very much
|
3904d033d9a613f014fd74db455e12e4e838039554e4a7355839134bcfc2c812 | ['030df2ee87544f3bb6adfc1787fa0913'] | I explain the simplified version: Let's name your database A, with |A|=50 elements in it. Now 6 elements of these 50 are special somehow and we want to keep track of them. We call the set of these 6 elements C.
Now to our job: We should count all subsets X of A with exactly 9 elements and at least 15% of their elements should come from C. Since 15% of 9 is 1.35 we need at least 2 elements of C in our sets X.
We know that there are binomial(50,9)=<PHONE_NUMBER> subsets of A with 9 elements. Now lets count how many of them violate your criteria: there are 44 elements in A which are not in C, so there are binomial(44,9) subsets of A that contain no elements from C. Next we count how many 9-element-subsets of A contain exactly one element of C: We take a random 8-element-subset from A without C and put exactly one element from C to it, so we get 6*binomial(44,8) possibilities.
Now we can write our result, by taking all 9-element-subsets from A and subtracting those, that violate your criteria:
binomial(50,9) - binomial(44,9) - 6*binomial(44,8) = 733107430.
Ok... now we know how much there are. But how do we list them?
Let's use some pseude-code to do it:
AminC := setminus(A,C)
for j in 2..6 do
for X1 in subsets(C, j) do
for X2 in subsets(AminC, 9-j) do
print(setadd(X1,X2))
This algorithm yields an alternative way of counting your sets:
binomial(6,2)*binomial(44,7) +...+ binomial(6,6)*binomial(44,3)=733107430.
Hope this helps..
| 97cdddc046b547d99c57841b7c6144c87dfe49a22cf805930f5ace015ed4df5e | ['030df2ee87544f3bb6adfc1787fa0913'] | The first problem is an integer overflow in makeY and check: In both functions 'result' is very likely to overflow, because you build the product first and reduce modulo n afterwards. Try to reduce mod n after every multiplication to keep 'result' small.
For example in makeY, write:
int result = r % n;
for (int i = 0; i < si.length; i++) {
if (ei[i] == 1)
result = (result * si[i]) % n;
}
return result;
(I also removed Math.pow() to make it more readable and efficient, but this was not an error.)
The second problem is the logic of your check function: The signBit variable is not needed, but instead you should check if y*y is equal to shouldY or -shouldY.
public static boolean check(int n, int x, int y, int[] ei, int[] vi) {
int shouldY = x % n;
for (int i = 0; i < vi.length; i++) {
if (ei[i] == 1)
shouldY = (shouldY * vi[i]) % n;
}
return (y*y - shouldY) % n == 0 || (y*y + shouldY) % n == 0;
}
With these small corrections i managed to get your code running. Hope it helps...
|
779e84f4df7a07d548e71b5fda8dd68556b11d9ab7ab18e4b31f47a81b233c9e | ['03250c572c1e4d1aa145b4228c8692f3'] | We have used an approach that extends .Net namespace hierarchy to indicate similar business areas and map the namespaces to the folder structure.
Namespaces:
Company.AreaA.Project1
Company.AreaA.Project2
Company.AreaB.Project3
Company.AreaB.Project4
Folders:
$/Company/AreaA/Project1
$/Company/AreaB/Project3
This convention continues also within the projects too.
| 30d660c716a344c4e16bf102937ca956ca844958fe020529046d80c7004712d6 | ['03250c572c1e4d1aa145b4228c8692f3'] | With all the hype around MVC (and rightly so) I've decided to give it a go myself and write my first .NET MVC web application. With a few options to choose from I was wondering which framework MVC do people recommend.
Microsoft ASP.NET MVC
The above with alternative view engine
Castle Project - MonoRail
MVC#
Maverick.NET
It seems like the first two are really the top contenders. Also some DI container is a natural complement to MVC - MonoRail would come with one already while ASP.NET MVC could perhaps work with something like Unity.
|
8cbf5efcbab0577d7c85641e70d399cacff733de00bfec4410353b04d76f665a | ['03288f57d2674989ac9d47c0b1918cfd'] | Evening all,
Is there an easy way to select text between strings?
For example: I have a script that imports a .txt file. I would like to select all the string in between objectGUID: and userAccountControl.
countryCode: 0
badPasswordTime: 131823486788076442
lastLogon: 131824500819176115
pwdLastSet: 131377781146718190
objectGUID<IP_ADDRESS> +i+FBf6NJUy+G+T6S52UUw==
userAccountControl: 66048
badPwdCount: 0
codePage: 0
In the example above the result would be: +i+FBf6NJUy+G+T6S52UUw==
Eventually I would turn this into a variable in which I can call upon later.
Any help would be appreciated.
Best regards & thanks in advance.
| 22787abd00b72bf156ed346682da033f6f390e74e242874984137b1532acf8b3 | ['03288f57d2674989ac9d47c0b1918cfd'] | Our organisation renames all new computers before they join our domain and I am trying to create a script to display the next available number.
So, our naming convention is as follows
Example:
GBYOR-DT1
GB - YOR - DT - 1
[Country] [City] [Desktop] [Number]
However my predecessor thought to number these in no logical order and that just isn't happening on my watch. (Did someone say OCD?)
Currently I run
> Get-ADComputer -Filter * | where{$_.Name -Like "GBYOR-DT*" | FL Name | Export-CSV -Path "X Location"
I then go into Excel, split the cells and the sort numerically.
What I would like is to create a script that just shows me the next available number.
For example, as it currently stands, we have X number of machines, one is GBYOR-DT4, another is GBYOR-DT245 but there is no GBYOR-DT15.
I would like to script this so that when I run it, it will look at all of the machines registered on our domain and then display the next one
> GBYOR-DT1
> GBYOR-DT2
> GBYOR-DT3
> GBYOR-DT4
> GBYOR-DT6
>
> ...GBYOR-DT5 does not exist so this is the next number to use for renaming.
Any help would be appreciated.
|
72350e0e4c9f8d4f581783251afd85e2a98cae780831395b17823eabbd8e8c79 | ['032e0fac3f6d4113aceb185fb7a0a82e'] | When I had the same error it was because my instance of the firebase admin SDK admin was not the same as the one I used to get the firestore() instance. You might want to try replacing db in your example snippet with admin.firestore() to make sure this is not the case for you
| 579db43d7bb53570ae72f9d5ecf4de9473368aba6c7a1dfff7e6bcf3e5ef0fc6 | ['032e0fac3f6d4113aceb185fb7a0a82e'] | This seems to be related to webkit bug 23113. The only workaround I've found so far is adding a CSS transform: scale(${scale}) (where you'd have to get the current scale using JS) property to a <section> inside foreignObject (an example can be found in marpit-svg-polyfill)
|
9db8fb605a6e89ab85979722cc6fdc0c38c85326ac2fe2f2a60853696e0e251a | ['033a3dbf300348eb8c79e37b5d90a2d9'] | For getting authorization code , the flow goes to email/password page of social tables. I am trying to load that page in an iframe.
Gives below error message:
Refused to display 'https://auth.socialtables.com/login?redirect=/oauth/authorize?client_id=xxxxx..' in a frame because it set 'X-Frame-Options' to 'sameorigin'.
Is there a anyway i can override this option so that it gets
displayed in iframe?
Is there another way to display this page
within my application?
| cb62cf1c09dbab3944acaedfd0dced9175740d22d808a32b872c578b0526925a | ['033a3dbf300348eb8c79e37b5d90a2d9'] | This can be done by setting below in web.xml/configuration.xml:
<context-param>
<param-name>spring.profiles.active</param-name>
<param-value>hibernatePersistence</param-value>
</context-param>
<!--context-param>
<param-name>spring.profiles.active</param-name>
<param-value>mySqlPersistence</param-value>
</context-param-->
The components which are related to hibernate can be annotated as:
@ActiveProfiles("hibernatePersistence")
And similarly you can have components for "mySqlPersistence"
If you need mySqlPersistence to be active remove the comments and comment "hibernatePersistence" one.
|
b1cb6809b807e791a0a77ba6e2eddd66d725a6a95c4edc4bf6f8da56a4f1207a | ['0355bf6d84f64b8fb862e12cf071b24d'] | I have a computer with a generic Radeon card running Kali Linux. The install is a week old. When I plug the computer into a kvm switch cable, the only color displayed is the dark blue of the Kali install screen. Everything is dark blue, even the text inside the Terminal boxes. When I go to the Color section of Settings, Kali correctly recognizes whatever monitor I attach to the kvm switch. However, the option to change the color profile is grayed out. There is no Settings menu for the video card. If I bypass the kvm and plug the commuter directly into the monitor, or if I use RealVNC to view the desktop, the correct colors appear.
Here are the dmesg sections on the Radeon:
[ 0.301352] smpboot: CPU0: AMD A4-3400 APU with Radeon(tm) HD Graphics (family: 0x12, model: 0x1, stepping: 0x0)
[ 2.951506] [drm] radeon kernel modesetting enabled.
[ 2.951948] radeon 0000:00:01.0: VRAM: 512M 0x0000000000000000 - 0x000000001FFFFFFF (512M used)
[ 2.951950] radeon 0000:00:01.0: GTT: 1024M 0x0000000020000000 - 0x000000005FFFFFFF
[ 2.952100] <PERSON> 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO2_pfp.bin
[ 2.952118] radeon 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO2_me.bin
[ 2.952131] <PERSON> 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO_rlc.bin
[ 2.952227] [drm] radeon: dpm initialized
[ 2.952321] radeon 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO_uvd.bin
[ 2.966232] radeon 0000:00:01.0: WB enabled
[ 2.966234] radeon 0000:00:01.0: fence driver on ring 0 use gpu addr 0x0000000020000c00 and cpu addr 0x(____ptrval____)
[ 2.966236] radeon 0000:00:01.0: fence driver on ring 3 use gpu addr 0x0000000020000c0c and cpu addr 0x(____ptrval____)
[ 2.966610] <PERSON><PHONE_NUMBER>] smpboot: CPU0: AMD A4-3400 APU with Radeon(tm) HD Graphics (family: 0x12, model: 0x1, stepping: 0x0)
[ 2.951506] [drm] radeon kernel modesetting enabled.
[ 2.951948] radeon 0000:00:01.0: VRAM: 512M 0x0000000000000000 - 0x000000001FFFFFFF (512M used)
[ 2.951950] radeon 0000:00:01.0: GTT: 1024M 0x0000000020000000 - 0x000000005FFFFFFF
[ 2.952100] radeon 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO2_pfp.bin
[ 2.952118] radeon 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO2_me.bin
[ 2.952131] radeon 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO_rlc.bin
[ 2.952227] [drm] radeon: dpm initialized
[ 2.952321] radeon 0000:00:01.0: firmware: direct-loading firmware radeon/SUMO_uvd.bin
[ 2.966232] radeon 0000:00:01.0: WB enabled
[ 2.966234] radeon 0000:00:01.0: fence driver on ring 0 use gpu addr 0x0000000020000c00 and cpu addr 0x(____ptrval____)
[ 2.966236] radeon 0000:00:01.0: fence driver on ring 3 use gpu addr 0x0000000020000c0c and cpu addr 0x(____ptrval____)
[ 2.966610] radeon 0000:00:01.0: fence driver on ring 5 use gpu addr 0x0000000000072118 and cpu addr 0x(____ptrval____)
[ 2.966614] radeon 0000:00:01.0: radeon: MSI limited to 32-bit
[ 2.966658] radeon 0000:00:01.0: radeon: using MSI.
[ 2.966679] [drm] radeon: irq initialized.
[ 3.618400] [drm] Radeon Display Connectors
[ 3.706613] fbcon: radeondrmfb (fb0) is primary device
[ 3.765223] Console: switching to colour frame buffer device 180x56
[ 3.769235] radeon 0000:00:01.0: fb0: radeondrmfb frame buffer device
[ 3.781482] [drm] Initialized radeon 2.50.<PHONE_NUMBER> for 0000:00:01.0 on minor 0
When I use the kvm switch. there is nothing about the monitor or video in the dmesg, just entries about loading the mouse and keyboard (USB devices).
My OpenBSD and FreeBSD computers do not have this problem. Is this Kali or Linux? Is there such a thing as a driver for kvm switches? I could not find one on Google. Is there a color profile I could download that would fix the problem? And why is the color set a "Kali install blue" rather than the white color of default Terminal text? Is the number on the "color frame buffer device" too low for multiple colors?
Thanks in advance.
| 8ec94c8fecbf34e674420d36fc4f04490ec08c871d36ac2ab2278a6e0f365ca6 | ['0355bf6d84f64b8fb862e12cf071b24d'] | I Made a menu to remove admin menus for people that are not allowed to see it so they don't make changes to the site.
But I can't get submenus to display only the main menu's
this is the code:
<?php
class clean_Admin_Menu {
public $toggleItemSlug = 'toggle_cleanadminmenu';
public $toggleItemOrder = '300.1';
public $hiddenItemsOptionName = 'toggle_cleanadminmenu_items';
public $nonceName = 'toggle_cleanadminmenu_options';
public function __construct() {
add_action( 'admin_init', array( $this, 'admin_init' ) );
//add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
//add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
//action to add menu pages on admin
add_action( 'admin_menu', array( $this, 'addMenuPages' ) );
//action for adding classes to admin menu items
add_action( 'admin_menu', array( $this, 'adminMenuAction' ) );
}
//Checks if users has the correct email and removes menu's if the user id doens't match.
public function toggle_menu_items() {
$current_user = wp_get_current_user();
//Getting emails from database(q_admin)
global $wpdb;
$table_name= $wpdb->prefix.'q_admin';
$DBP_results= $wpdb->get_results("SELECT * FROM $table_name");
$showMenu = false;
//Check if emails match with the 2 databases
foreach($DBP_results as $DBP_cols){
if ((string)$current_user->data->user_email == (string)$DBP_cols->email){
$showMenu = true;
break;
} else {
$showMenu = false;
}
}
if ( $showMenu ) {
// logged in.
?>
<script>
(function($) {
var menusAreHidden = false;
$(function() {
$('.menu-top.clean-wp-admin-menu__valid-item').show();
$(document).trigger('wp-window-resized');
//When the toggle extra item clicked show/hide menu items
//Also trigger the wp-window-resized event for left menu
$('#toplevel_page_toggle_cleanadminmenu a').click(function(e){
e.preventDefault();
$('.menu-top.clean-wp-admin-menu__valid-item').show();
$(document).trigger('wp-window-resized');
});
$('#adminmenu .wp-menu-open.hidden').removeClass('hidden');
});
})(jQuery);
</script>
<?php
} else {
// not Logged in.
}
}
//Redirect function when there are erros.
public function admin_init() {
if ( is_admin() ) {
ob_start();
add_action( 'admin_head', array( $this, 'toggle_menu_items' ) );
}
}
/*
// function to toggle the menu.
public function toggle_menu_items2() {
?>
<script>
(function($) {
var menusAreHidden = false;
$(function() {
$('.menu-top.clean-wp-admin-menu__valid-item').show();
$(document).trigger('wp-window-resized');
//When the toggle extra item clicked show/hide menu items
//Also trigger the wp-window-resized event for left menu
$('#toplevel_page_toggle_cleanadminmenu a').click(function(e){
e.preventDefault();
$('.menu-top.clean-wp-admin-menu__valid-item').show();
$(document).trigger('wp-window-resized');
});
$('#adminmenu .wp-menu-open.hidden').removeClass('hidden');
});
})(jQuery);
</script>
<?php
}
*/
//Add menu pages in admin
public function addMenuPages() {
//toggle menu button
/*
add_menu_page(
__('Toggle Menu', 'clean-admin-menu'),
__('Toggle Menu', 'clean-admin-menu'),
'manage_options',
$this->toggleItemSlug,
function () { return false; },
"dashicons-hidden",
$this->toggleItemOrder
);
*/
add_menu_page(
__('Q Admin', 'clean-admin-menu'),
__('Q Admin', 'clean-admin-menu'),
'manage_options',
'clean-admin-menu_options',
array(
$this,
'settingspage'
),
get_stylesheet_directory_uri() . '/assets/img/q-favicon.png',
);
//action for adding css
wp_enqueue_style( 'style.css', get_stylesheet_uri() );
add_submenu_page ( 'clean-admin-menu_options', 'Q Menu', 'Admin List', 'read', 'theme-options.php', 'call_back_q');
function call_back_q(){
echo '<div class="wrap"><div id="icon-options-general" class="icon32"><br></div>
<h2></h2></div><br>';
include ('admin_list.php');
}
}
// Add items to display the menus correctly
public function adminMenuAction() {
global $_registered_pages, $_parent_pages, $menu, $admin_page_hooks, $submenu;
global $self, $parent_file, $submenu_file, $plugin_page, $typenow, $_wp_real_parent_file;
//list of items selected from settings page
$selectedItems = $this->selectedItems();
$menuItems = wp_list_pluck($menu, 2);
foreach ($menu as $k => $item) {
// Reminder for parent menu items array
// 0 = menu_title, 1 = capability, 2 = menu_slug, 3 = page_title, 4 = classes, 5 = hookname, 6 = icon_url
$isSelected = in_array($item[2], $selectedItems);
$isCurrentItem = false;
$isCurrentParent = false;
//check if item is parent of current item
//if not both of them, it deserves to be hidden if it is selected
if ($parent_file) {
$isCurrentItem = ($item[2] == $parent_file);
if (isset($_parent_pages[$parent_file])) {
$isCurrentParent = ($_parent_pages[$parent_file] === $item[2]);
}
}
$isHidden = ($isSelected && false === ($isCurrentParent OR $isCurrentItem));
if ($isHidden) {
$menu[$k][4] = $item[4] . ' hidden clean-wp-admin-menu__valid-item';
}
}
}
public function settingsPage() {
global $_registered_pages, $_parent_pages, $menu, $admin_page_hooks, $submenu;
$this->saveSettings();
$pluginName = 'clean-admin-menu';
$selectedItems = $this->selectedItems();
?>
<style>
.wrap td, .wrap th { text-align: left; }
.table-menulist{ background-color: #fff; padding: 10px; margin-bottom: 20px; }
.table-menulist th { padding: 5px; border-bottom: 1px solid #DFDFDF; }
.table-menulist td { padding: 5px; border-bottom: 1px solid #DFDFDF; }
.table-menulist tr:last-child td { border-bottom: 0;}
.table-menulist .awaiting-mod, .table-menulist .update-plugins {display: inline-block;vertical-align: top;box-sizing: border-box;margin: 1px 0 -1px 2px;padding: 0 5px;border-radius: 9px;color: #fff;font-size: 11px;line-height: 1.6;text-align: center;z-index: 26;}
</style>
<div class="content">
<div id="main">
<div class="wrap">
<h1><?php esc_html_e('Q Admin Menu', $pluginName); ?></h1>
<?php
echo (($_GET['saved']==1)?'<div class="updated"><p>' . __('Success! Admin menu cleaned successfully', 'clean-admin-menu') . '</p></div>':'');
?>
<form action="<?php echo esc_attr(admin_url('admin.php?page=clean-admin-menu_options')); ?>" method="post">
<?php wp_nonce_field($this->nonceName, $this->nonceName, true, true); ?>
<input type="submit" class="button-primary" value="<?php esc_html_e('SAVE CHANGES', $pluginName); ?>"/>
<table class="table-menulist">
<tr>
<th></th>
<th></th>
<th style="width:300px;">Menu Items</th>
</tr>
<?php
$separator = 0;
foreach ($menu as $key => $menuItem){
$isSeparator = strpos($menuItem[4], 'wp-menu-separator');
$isSelected = in_array($menuItem[2], $selectedItems);
//if ($isSeparator !== false OR $menuItem[2] === 'toggle_cleanadminmenu') {
if ($isSeparator !== false) {
$menuItem[0] = '――――――separator――――――';
$separator++;
}
// Hiding the Separator before the "toggle menu" link
if($separator > 1) { $separator = 0; continue; }
?>
<tr>
<td>
<input type="checkbox" name="toggle_cleanadminmenu_items[]" value="<?php echo $menuItem[2]; ?>"
id="toggle_cleanadminmenu_item_<?php echo $key; ?>"
<?php echo ($isSelected) ? 'checked' : ''; ?>
<?php //echo ($menuItem[2] === 'index.php') ? 'disabled' : ''; ?> />
</td>
<td>
<?php if ($isSelected){ ?>
<span style="color:#CA4A1F;" class="dashicons-before dashicons-hidden"></span>
<?php }else{?>
<span style="color:#18dc0b;" class="dashicons-before dashicons-visibility"></span>
<?php } ?>
</td>
<td>
<label for="toggle_cleanadminmenu_item_<?php echo $key; ?>">
<strong <?php echo ($isSeparator !== false?'style="color:#B7B7B7;"':'')?>>
<?php
if ($menuItem[2] === 'clean-admin-menu_options')
echo '―― '.strtoupper($menuItem[0]).' ――<br><sub style="color:#616A74;">Alleen zichtbaar voor super admins</sub>';
else
echo $menuItem[0];
?>
</strong>
</label>
</td>
</tr>
<?php } ?>
</table>
</form>
<hr>
</div>
</div>
</div>
<?php
}
public function selectedItems() {
$items = get_option($this->hiddenItemsOptionName);
if (!$items) {
$items = array();
return $items;
}
return $items;
}
private function saveSettings() {
global $menu;
if (!isset($_POST[$this->nonceName])) {
return false;
}
$verify = check_admin_referer($this->nonceName, $this->nonceName);
//TODO if empty but has post delete items
if (!isset($_POST['toggle_cleanadminmenu_items'])) {
$itemsToSave = array();
$savedSuccess = 0;
} else {
$menuItems = wp_list_pluck($menu, 2);
$items = $_POST['toggle_cleanadminmenu_items'];
//save and check to see if it exists
$itemsToSave = array();
if ($items) {
foreach ($items as $item) {
if (in_array($item, $menuItems)) {
$itemsToSave[] = $item;
}
}
}
$savedSuccess = 1;
}
//update and set as autoloading
update_option($this->hiddenItemsOptionName, $itemsToSave, true);
// we'll redirect to same page when saved to see results.
$adminPageUrl = admin_url('options-general.php?page=clean-admin-menu_options&saved='.$savedSuccess);
wp_safe_redirect( $adminPageUrl ); exit;
}
}
new clean_Admin_Menu();
?>
I don't know how to get it to work hope somebody is able to help me.
|
89c93ba599cc96df0c21f270f9938daed8173f31e17186a54ac7a807cc5d4c09 | ['03617d5e734d43078c6cc48f6972c7e5'] | I don't know, If connection strings have the same formatting/configuration for all of SQL Server editions or not?
For example is it different between Express and Enterprise?
Because in my tutorial source that I'm learning(Asp.Net Core MVC)the SQL Server is Express and mine is Enterprise.
For that I get error and I guess it's because of my connection string.
With Thanks
| 5d70b85f62e2f799b9927b814a98eef749310c4b7da17d0f88d6b5080dde19dc | ['03617d5e734d43078c6cc48f6972c7e5'] | here there are two forms, mainform and loginform.
First, loginform comes up because it is initialized in the constructor of the mainform.
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
//
LoginForm frmLogin = new LoginForm();
frmLogin.ShowDialog();
//
}
}
So I would like to prevent the user cannot closed the Loginform by [X]in the title bar because after the Main form will be appeared. with thanks
|
df0c4ce4864d04adebcfba0cfae823300a828d5cbbb7dff8c0ef92dd7cc31ee3 | ['036392828cd4471e99e244756eabb20b'] | Perhaps that is where my misunderstanding is. Is the margin of error on the total population as opposed to the observed number with the attribute? In other words, does a 5% margin of error mean 5% on the 5M (which would be 250K) and not 5% on whatever the observed number is with the population? | 6abc2b4659078a52472608655a1dd8fc7f40e03e3e3345a12635fb7185d7c8f4 | ['036392828cd4471e99e244756eabb20b'] | Im creating a Windows Service and I want to put a dynamic path in the code. But it only accepts static code.
This works:
Process.Start("C:\\Program Files\\Program\\Program.exe", "-socket 12345");
But this doesnt:
String path = "C:\\Program Files\\Program";
String programName = "\\Program.exe";
String fileLocation = path + programName;
Process.Start(fileLocation, "-socket 12345");
Someone can help me?
|
d8e808ad6ca3e52268a8563514dfd2f5068a6a5535d4c9e3a2fc829bbdda8c9e | ['0369f4864d2d468ab6eebeb07a893ad4'] | You could answer this one with the proportion theorem in Geometry.
The parallel lines in the triangle produces two equiangular triangles that are therefor similar.
$$\frac{\text{Area of small Triangle}}{\text{Area larger triangle}}=\frac{a-b_1h}{2a-b_1H}$$
$$\frac{\frac{1}{2}(b_2-b_1)h}{\frac{1}{2}(B_2-B_1)H}=\frac{a-b_1h}{2a-b_1H}$$
But by the similarity of the triangles $\frac{b_2-b_1}{B_2-B_1}=\frac{h}{H}$ so
$$\frac{h^2}{H^2}=\frac{a-b_1h}{2a-b_1H}$$
$$h^2(2a-b_1H)=(a-b_1h)(H^2)$$
$$(2a-b_1H)h^2+(b_1H^2)h-aH^2=0$$
Now you'll have to solve the quadratic equation, assuming $a$ is also known
| 910c4fc27af46dc751b7db42c76f32eceea0b19f6ebad458fbf73767fdc95e34 | ['0369f4864d2d468ab6eebeb07a893ad4'] | "Rules of inference don't bear truth, while assumptions do." What do mean? Point of clarification: I am assuming with rules of inference that you are talking about rules of logic, such as A is A; A is not not A and if A is B and B is C then A is C.
(sorry about dropping the "implicite" - I actually thought it was a typo, or I am misunderstanding what you mean - would you mind if we get back to that once I understand what you mean about assumptions.) |
7abe895fb6c39d3a50f315e0f933f5585449597d5d405eb9983dde5dbfd7b571 | ['037c8cae20c4471b9fb71521ed899dbf'] | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
string filePath = "test.txt";
vector<std<IP_ADDRESS>string> qNames;
ifstream openFile(filePath.data());
if (openFile.is_open())
{
string line;
while (getline(openFile, line))
{
qNames.push_back(line.c_str());
}
openFile.close();
}
if (!qNames.empty())
{
srand((unsigned int)time(NULL));
for (int i = 0; i < 10; i++)
{
int num = rand();
int linePos = num % qNames.size();
cout << qNames.at(linePos).c_str() << endl;
}
}
return 0;
}
| 1d0430662d094fed0c08a790db598b24b4f1f329196ab22940cf4b13456f33c8 | ['037c8cae20c4471b9fb71521ed899dbf'] | It seems that memory access violation might be occurred in print function, as the temp->next is not initialized to NULL.
node* person = new node;
cin >> person->data;
person->next = NULL; // preferred
below is one of the sample for FIFO. Just returns head pointer and find the last element every time with looping.
node* pushBack(node* h) {
node* person = new node;
cin >> person->data;
person->next = NULL;
if (h == NULL) {
h = person;
}
else {
node* last = h;
while (last->next != NULL) {
last = last->next;
}
last->next = person;
}
return h;
}
Or, using function parameters both the head pointer and last element pointer would be better as reduce the while loop.
|
cfa577a46ff28e85c3b7628751f905824630cbab185c041df1b30e1bbf6c4749 | ['039254fa649b4d2cb2275d01a5ac1386'] | The error The given ColumnMapping does not match up with any column in the source or destination
happen usually for 3 causes:
You didn't provide any ColumnMappings, and there is more column in the source than in the destination.
You provided an invalid column name for the source.
You provided an invalid column name for the destination.
In your case, you didn't supply column mapping. Here is an online example similar to your scenario: https://dotnetfiddle.net/WaeUi9
To fix it:
Provide a ColumnMappings
For example: https://dotnetfiddle.net/Zry2tb
More information about this error can be found here: https://sqlbulkcopy-tutorial.net/columnmapping-does-not-match
| b980ca39855e9a8ee5502257124fcc53adde50e441f8eb5456be355033ec164d | ['039254fa649b4d2cb2275d01a5ac1386'] | By “refeshing the data”, I would assume that you mean creating a new context so Entity Framework get fresh data from the database instead of using entity loaded in the ChangeTracker.
1.How to refresh the data in the entities in C#, created using Entity Framework as shown in the code sample?
You usually create a new context. You can use multiple context in your code.
using (DEMONewEntities demonew = new DEMONewEntities())
{
}
// ...code...
using (DEMONewEntities demonew = new DEMONewEntities())
{
}
2.How often to refresh the data as it may add to the performance?
As often as possible but that depend of what you do. Having to much entities in the Change Tracker can kill your performance.
You can find some information about how slow the ChangeTracker can become with a lot of entities here:
https://entityframework.net/improve-ef-detect-changes-performance
https://entityframework.net/why-detect-changes-slow
|
b1eb0bce98e9ff7e24b95d942f034947a7a55f99cac32767e34401d2670fe56d | ['03946e9f9e2e4bbb81885619a3568803'] | I have two sets of randomly generated data with the wrapped normal circular distribution. I would like to test for homogeneity of means between these two samples. I was considering using Watson-Williams test but which requires that the samples are drawn from populations with a Von Mises distribution. Therefore, I am wondering if there is any two-sample test that can be applied to data with wrapped normal distribution.
| f7ac6777f47d48125589fbe134526c595d55641cf2007d8e62e1ee3adf07ae27 | ['03946e9f9e2e4bbb81885619a3568803'] | I am getting into strange situation regarding the RSS viewer on SharePoint
I have two environments of SharePoint (production & testing)
I was showing a specific RSS news (ABC) on both of them , and it was working after setting the proxies and other stuff.
Suddenly (may be due to some changes done on the production without testing), the RSS viewer on the production is not showing the RSS news it is showing protocol error, while it is still working fine on the testing environment.
Now the strange part is if I change the RSS of the one our management wants and put BBC or CNN news these works well on both the production and the test environment.
But the one we want it to work (which was working fine on both) do not work on the production and works fine on testing.
Any suggestions of how can I figure it out?
|
67ead5041e0c6c46730c9fb273d120ed26b8964c5e79a67f6919afb3c8df98bc | ['0394ba5f6a9c49539ac959249e8e4d6f'] | So your first problem is that you have width and height on the image in question set to 100%. What this does is crops that image to 100% of parent's height, and 100% of parent's width at the time of rendering. Therefore, when you try to move it you're moving an already set image (ie there is not tail bit to follow).
In the code snippet below, I changed height to auto, left width as 100%, and made sure overflow: hidden was set on item class. I also zoomed in your image and moved it around to demonstrate that your original problem is no longer present.
Cheers,
.current-houses {
height: 600px;
width: 600px;
background-color: grey;
display: grid;
gap: .5rem;
grid-template-columns: repeat(8, 1fr);
grid-template-rows: repeat(11, 2rem);
}
.current-houses__item--2 {
grid-row: 4 / -1;
grid-column: 3 / -1;
/*The part in yellow is item */
background-color:yellow;
/* Add in this line so excess image does not surpass boundaries */
overflow: hidden;
}
.current-houses__img {
width: 100%;
/* Change Heighto to auto */
height: auto;
object-fit: cover;
display: block;
}
.current-houses__img--2 {
/* Just trying to move image down; however, it is not working. */
transform: scale(1.5) translateY(1rem);
}
/* FIRST IMAGE JUST TO HELP WITH CONTEXT */
.current-houses__item--1 {
grid-row: 1 / 4;
grid-column: 6 / 9;
}
<div class="current-houses">
<figure class="current-houses__item current-houses__item--1">
<img src="https://images.unsplash.com/photo-1512917774080-9991f1c4c750?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1050&q=80" alt="" class="current-houses__img current-houses__img--1">
</figure>
<figure class="current-houses__item current-houses__item--2">
<img src="https://images.unsplash.com/photo-1475855581690-80accde3ae2b?ixlib=rb-1.2.1&auto=format&fit=crop&w=1050&q=80" alt="" class="current-houses__img current-houses__img--2">
</figure>
</div>
| b3f669b8723cc06136f9c6f2a44fecb6f247c360cd499f030f32cfa920f01787 | ['0394ba5f6a9c49539ac959249e8e4d6f'] |
Add class="viewbox" to the viewbox.
Then, add overflow: visible on said class
Then adjust x and y coordinates as you see fit
.main {
position: relative;
}
/*Add class="viewbox" to viewbox */
.viewbox {
overflow: visible;
}
.secondrect {
width: 100%;
background: purple;
height: 30px;
}
#over {
position: absolute;
}
<div class="main">
<div class="firstrect">
<svg viewBox="0 0 50 10" class="viewbox">
<rect width="100%" height="100%" style="fill: rgb(102, 102, 201);" />
<rect
id="over"
x="10"
y="9"
width="20%"
height="30%"
style="fill: rgb(152, 251, 071);"
/>
</svg>
</div>
<div class="secondrect"></div>
</div>
|
28ae1702ecd2329846d47a12dfa87430e376ee1aef1096aa8e552cca43e46402 | ['0399e04b83dc4d5abfa23014387af8a6'] | I have repositories hosted in Stash and Gitlab but would like to consolidate them to Github.
I am clear on how to move the the Git repositories themselves using git clone --bare and git push --mirror.
My question is about preserving the additional info related to these repos (e.g. pull requests, user permissions, hooks) to minimize the burden for the users having to reconfigure the newly migrated repos. Is there any existing tool to assist w/ such tasks.
The blocker right now is I don't have a way to migrate the fork relationship between the different repos. I would be happy if someone could describe a manual procedure to do that.
For example, say, I have a repo A in Stash, and A' is forked from A. Once I migrate A and A' to Github using the git clone --bare and git push --mirror, I have 2 unrelated repos. How can I make the new A' a fork of the new A?
Any pointer would be very helpful
| 2227007d87c273f60ffa2bf9d4af295f5fb8ae3f7a7964c001a0ddfb941ad116 | ['0399e04b83dc4d5abfa23014387af8a6'] | I would like to know if there is a way to receive a real time update when a user (who granted my apps needed rights) post a photo in an album, in a group, or share photo on his/her status updates.
Looking at facebook docs, I was under the impression I could only get update if the user change his/her the profile photo.
|
8bf6151666528d89dd84f4b57a44af924f63c20b3bc65c5fccac56b54afc2f6d | ['039f2556ad37496f84aa9a178295f83f'] | I am trying to figure out why the menu pick for a note's Folder Name is not getting selected in the code below. I'm using the tags around the folder options. The user can select the Folder Name for the note being created from the UI, but the UI doesn't maintain the selection. As a result, the note is not getting saved to any of the folders.
import React, { Component } from 'react'
import NotesContext from './notesContext'
import './addNote.css'
class AddNote extends Component {
static contextType = NotesContext
constructor(props) {
super(props);
this.state = {
name: '',
value: '',
id: '',
folderId: '',
content: ""
}
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChange(event) {
console.log("handleChange value: " + event.target.value);
console.log("handleChange name: " + event.target.name)
this.setState(
{[event.target.name]: event.target.value}
);
}
handleSubmit(event) {
console.log("this.context: " + JSON.stringify(this.context))
event.preventDefault();
let requestOptions = {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": this.state.name,
"id": this.state.id,
"folderId": this.state.folderId,
"modified": new Date().toISOString(),
"content": this.state.content
})
};
fetch("http://localhost:9090/notes/", requestOptions)
.then(response => response.json())
.then(result => {
console.log("result:" + JSON.stringify(result));
this.context.addNote(
result.name,
result.id,
result.folderId,
result.modified,
result.content
);
this.props.history.push("/");
})
.catch(error => console.log('error', error));
}
render() {
let notesContext = this.context
return (
<form
className="AddNote"
onSubmit={e => this.handleSubmit(e)}
>
<h1>Create a note</h1>
<label>
Note Name:{' '}
<input
type="text"
value={this.state.name}
className="NameInput"
name="name"
id="name"
onChange={(e) => this.handleChange(e)}
/>
</label>
<label>
Content:{' '}
<textarea
className="ContentInput"
name="content"
id="content"
onChange={e => this.handleChange(e)}
/>
</label>
<label>
Folder:{' '}
<select
value={this.state.folderId} onChange={ (e) => this.handleChange(e)}>
{notesContext.folders.map(folder => {
return(
<option
value={folder.name}
name={folder.name}
key={folder.id}>{folder.name}
</option>
)
})}
</select>
</label>
<input
type="submit"
value="Submit"
className="SubmitButton"
/>
</form>
);
}
}
export default AddNote;
| c99322fde7aaf01197dcdb62d18b9a7182cd6e9d9df658cb656fcf9497fbad3c | ['039f2556ad37496f84aa9a178295f83f'] | I have a partial Answer at this point. I split up the handleChange method for setting the note and folder. This is now allowing me to create the note in the selected folder -- only if I select a new folder, not the folder selected by default. So I still need to fix that part.
import React, { Component } from 'react'
import NotesContext from './notesContext'
import './addNote.css'
class AddNote extends Component {
static contextType = NotesContext
constructor(props) {
super(props);
this.state = {
name: 'Cows',
id: '',
folderId: '',
content: "",
value: '',
}
this.handleChangeOfNote = this.handleChangeOfNote.bind(this);
this.handleChangeOfFolder = this.handleChangeOfFolder.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleChangeOfNote(event) {
//console.log("handleChange value: " + event.target.value);
//console.log("handleChange name: " + event.target.name);
this.setState(
{[event.target.name]: event.target.value}
);
}
handleChangeOfFolder(event) {
this.setState(
{folderId: event.target.value}
);
}
handleSubmit(event) {
event.preventDefault();
let requestOptions = {
method: 'POST',
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": this.state.name,
"id": this.state.id,
"folderId": this.state.folderId,
"modified": new Date().toISOString(),
"content": this.state.content
})
};
fetch("http://localhost:9090/notes/", requestOptions)
.then(response => response.json())
.then(result => {
console.log("result:" + JSON.stringify(result));
this.context.addNote(
result.name,
result.id,
result.folderId,
result.modified,
result.content
);
this.props.history.push("/");
})
.catch(error => console.log('error', error));
}
render() {
let notesContext = this.context
return (
<form
className="AddNote"
onSubmit={e => this.handleSubmit(e)}
>
<h1>Create a note</h1>
<label>
Note Name:{' '}
<input
type="text"
value={this.state.name}
className="NameInput"
name="name"
id="name"
onChange={(e) => this.handleChangeOfNote(e)}
/>
</label>
<label>
Content:{' '}
<textarea
className="ContentInput"
name="content"
id="content"
onChange={e => this.handleChangeOfNote(e)}
/>
</label>
<label>
Folder:{' '}
<select
value={this.state.folderId} onChange={(e) => this.handleChangeOfFolder(e)}>
{notesContext.folders.map(folder => {
return(
<option
value={folder.id}
name={folder.name}
key={folder.id}>{folder.name}
</option>
)
})}
</select>
</label>
<input
type="submit"
value="Submit"
className="SubmitButton"
/>
</form>
);
}
}
export default AddNote;
|
7fbc0bad8ebb81e864d03abcb151d1aa73a186ef9772321ecb40db1476c68218 | ['03bd7d4fda5f4b74b4a2fb9dd095f994'] | I trying to overlay a letter on slick slider item.. wan't to achieve something like this.
But it"s not working. What am I doing wrong? here is my fiddle
<div class="slider single-item">
<div id="item">
<div class="container">
<div class="row">
<div class="col-lg-6 col-md-6" id="member_image">
<img class="img-responsive shadow" src="https://www.epicurrence.com/images/speakers/mackey.jpg" />
</div>
<div class="col-lg-6 col-md-6 text-center">
<hr id="devider" />
<div id="member_name">Bradley Michael</div>
<div id="position">Graphic Designer </div>
<hr style="width: 15px; margin: auto; margin-top: 30px; margin-bottom: 30px;" />
<div id="member_text">
Urabitur eget odio ac risus malesuada gravida ac non dolor. In dignissim purus augue. Duis mauris justo, interdum id dolor eget, consequat consectetur ante. Quisque tempus nunc rutrum ipsum venenatis, quis mollis risus ultrices. Maecenas vitae odio eget
nulla volutpat semper ac in lacus.
</div>
</div>
</div>
</div>
<div id="overlay_member">B</div>
</div>
</div>
| 0421fbd04332a7e26de5e9d5aa0e3e1066c4081a59a6375915b8ff73ed6601e8 | ['03bd7d4fda5f4b74b4a2fb9dd095f994'] | I am using slick slider with animation on my site. everything works great except when I drag slide if not moved to the next or previous slide I don't want to use animation.
<div id="my_slider">
<div id="item">
<div id="name" class="hidden">slide1</div>
</div>
<div id="item">
<div id="name" class="hidden">slide2</div>
</div>
<div id="item">
<div id="name" class="hidden">slide3</div>
</div>
</div>
here is <PERSON>
|
1d8f5187b50543b4187975f67a6b017c398fa9c3489fa437db7e58d5c375e41d | ['03e732357a4844e68a8eedd6fffc836f'] | The answer to the linked question does not seem to say what you claim. The rule for Dutch prefixes is that the first one is capitalized when the first name or first initial is does not precede it, except when it is a shortened version (with an apostrophe). See for example [this article](http://www.dutchgenealogy.nl/how-to-capitalize-dutch-names-with-prefixes/). | a4bd56e03670b187e74175069f1e97034495ee49376b25a384e647c74ffe47d2 | ['03e732357a4844e68a8eedd6fffc836f'] | @clemens but it has to wind up at the end of the real body somehow. The standard environment solution also has a \par that is supposed to go in at the end, but it arrives too alte so to speak. What makes the \par for the alternative environments arrive on time? |
6ef51edccabfe6b31f3a45bf815a7b6632678a3d1180d79642702bae859a1803 | ['03f264a6cac84bdd95dea96ec8f754e9'] | Ok it may have been a while but I figured out I could just use my own constant instead of sun.swing.SwingUtilities2.BASICMENUITEMUI_MAX_TEXT_OFFSET as long as it was used consistently in the offending code. By no means an ideal solution.
On the upside bad imports from sun packages has gone into the coding rule checks.
| 828a343dde8f93dd73123aa73c4d081af3f02f417dacee44e4aa4ee5f4765e82 | ['03f264a6cac84bdd95dea96ec8f754e9'] | I have a grammar defined which can be parsed ok. Due to the nature of the model it makes sense to split the model across multiple files. Following cross references in the IDE is working fine and I am all happy there.
My requirement is to generate a single XML document from the multiple input model files.
What I find is that when my generator
import org.eclipse.xtext.generator.AbstractGenerator
...
class MyModelGenerator extends AbstractGenerator
is called
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
That the resource only contains the files that modified. Whereas, what I need is all of the model files.
I have found Xtend – Generating from multiple input models which seems to address what I need. But what I have found is that most of the interfaces have changed since it's writing in 2011.
Reading the release notes, version 2.9.0 introduced a new generator.
I have looked at using the approach I referenced and updating it. The generators seem different in places. I am experimenting with ways that might work, but I am trying to understand the way it was intended to work.
Is there any documentation on how the generation process is intended to work? Or if there is an example that would be appreciated.
|
8a2426098a6e79077441e79cb5622add6a2d478d65dac108d7fdb429cba42520 | ['03f3fb0786a3403dab9f045b4bf6a864'] | I am using RN 0.63 and i am facing issue in React Native core alert.It popup and disappear automatically with second.I want alert should disappear when i click on OK button.
Alert.alert(
'Alert Title',
msg, // <- this part is optional, you can pass an empty string
[
{text: 'OK', onPress: () => console.log('OK Pressed')},
],
{cancelable: false},
);
| 57959e9cab104bfda4e27b69c37c53d53af8626d6e11bbf99b391b6b1e2ef310 | ['03f3fb0786a3403dab9f045b4bf6a864'] | I have error in cordova plugin firebase in ionic 3
BUILD FAILED in 38s
Task :app:compileDebugJavaWithJavac FAILED
24 actionable tasks: 24 executed
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\gradlew: Command failed with exit code 1 Error output:
Note: E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\CordovaLib\src\org\apache\cordova\engine\SystemCookieManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:6: error: cannot find
symbol
import com.google.firebase.iid.FirebaseInstanceIdService;
^
symbol: class FirebaseInstanceIdService
location: package com.google.firebase.iid
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:9: error: cannot find
symbol
public class FirebasePluginInstanceIDService extends FirebaseInstanceIdService {
^
symbol: class FirebaseInstanceIdService
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:544: error: method getByteArray in class FirebaseRemoteConfig cannot be applied to given types;
: FirebaseRemoteConfig.getInstance().getByteArray(key, namespace);
^
required: String
found: String,String
reason: actual and formal argument lists differ in length
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:562: error: method getValue in class FirebaseRemoteConfig cannot be applied to given types;
: FirebaseRemoteConfig.getInstance().getValue(key, namespace);
^
required: String
found: String,String
reason: actual and formal argument lists differ in length
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:616: error: no suitable method found for setDefaults(Map,String)
FirebaseRemoteConfig.getInstance().setDefaults(defaultsToMap(defaults), namespace);
^
method FirebaseRemoteConfig.setDefaults(Map) is not applicable
(actual and formal argument lists differ in length)
method FirebaseRemoteConfig.setDefaults(int) is not applicable
(actual and formal argument lists differ in length)
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePlugin.java:780: error: cannot find symbol
myTrace.incrementCounter(counterNamed);
^
symbol: method incrementCounter(String)
location: variable myTrace of type Trace
E:\ionic\School_App_A\School_App_A\School_App_A\platforms\android\app\src\main\java\org\apache\cordova\firebase\FirebasePluginInstanceIDService.java:18: error: method does not override or implement a method from a supertype
@Override
^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
7 errors
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
Compilation failed; see the compiler error output for details.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
|
3cf228f4ae7f1f569d5fd56da548c4bc3337fa33fce10303bacce3da0e1d315e | ['03fc8970b16a4c50b2327931abc82851'] | I check the result and if no rows were updated change the 5 to a 6 in this example and reissue the update query.
(The actual application is more complicated which requires this rather than simply setting to thecount + 1 without the where)
This example is simply trying to maintain a simple counter with multiple processes updating the counter. I suspect that this is not working in my MySQL MyISAM table with counts getting missed. Should I expect this to work for MyISAM and if not, should it work with INNODB?
UPDATE thetable SET thecount = thecount +1 WHERE thecount = 5;
| c585ba7caad81f85a704e6ce433aa2c1f828eeff603a0b25997780411009324e | ['03fc8970b16a4c50b2327931abc82851'] | Columns a1 and a2 are the answers you are looking for. I tried this without the derived table did not get the correct answer. There is either a mysql bug or a misunderstanding on my part. But with the derived table it seems to work fine.
SELECT
sums.start_week,sums.*,
sums.tot1-sums.cur1-sums.back1 a1,sums.tot2-sums.cur1-sums.back2 a2
FROM
( /* Derived table cf counts */
SELECT DATEDIFF(test_data.close_date,'2015-02-02') DIV 7 AS sd,
'2015-02-02' + INTERVAL (DATEDIFF(test_data.close_date, '2015-02-02') DIV 7) WEEK as start_week,
(select COUNT(*) from test_data d1 where d1.location='one') tot1,
(select COUNT(*) from test_data d2 where d2.location='two') tot2,
count(CASE WHEN test_data.location='one' then 1 else null end ) cur1,
count(CASE WHEN test_data.location='two' then 1 else null end
) <PERSON>,
(select count(*) from test_data d1 where d1.location='one' AND d1.close_date<
('2015-02-02' + INTERVAL (DATEDIFF(test_data.close_date, '2015-02-02') DIV 7) WEEK) ) as back1,
(select count(*) from test_data d2 where d2.location='two' AND d2.close_date<
('2015-02-02' + INTERVAL (DATEDIFF(test_data.close_date, '2015-02-02') DIV 7) WEEK) ) as back2
from test_data
where test_data.close_date >= '2015-02-02'
group by DATEDIFF(test_data.close_date,'2015-02-02') DIV 7 ,
'2015-02-02' + INTERVAL (DATEDIFF(test_data.close_date, '2015-02-02') DIV 7) WEEK
) sums
|
e134750399961c7ba6d090f86a96f257a73f2325e04bd236937d19e6c4d742ef | ['040bfb7c5f3d48ce9f44f1a5716d3c4e'] | The vanishing locus of $f$ in $\mathbb A^2$ (an affine plane curve) sits in $\mathbb P^2$ via the decomposition you described. It's worth pointing out that the affine plane is dense in the projective plane. When you pass to the homogenization $F$, its vanishing locus is the closure of the vanishing locus of $f$. Does that answer your question? In other words, you add in a few points on the $\mathbb P^1$ at infinity that arise as limits of points on the vanishing of $f$. | 9861590c3d385b4612eabbae5cc77297b52ee624bee501111b9d1faf4166c569 | ['040bfb7c5f3d48ce9f44f1a5716d3c4e'] | What he should be saying, I think, is that the root changes if your loop passes through one of the branch cuts (deleted intervals). So $r=1.5$ works, but not $r=2.5$. I also don't think the linked question is entirely correct (specifically regarding the identifications). You do indeed glue A to A, B to B, and so on. If we start on the lower sheet and pass through $[1,2]$ from below, we jump up to the upper sheet. Continuing to wind around $1$, we pass through the interval again which causes us to jump back to the lower sheet; so after a revolution of $4\pi$ we get back to where we started. |
5e23f9dcbcc9734967bd7dcc2bc4f5455394c4e10a2ae5dc2aa68ae5566e6a4c | ['0411f47fd89f4276b11ee43a4f6fc566'] | when i try to print my competitor names i have this value returning
Name@75b84c92
can anyone explain why? i'm a complete beginner at java and this assignment is due in next week. i have no errors in my code but can't understand why the name isn't printing. i'm not sure if i have a problem with calling another class
can anyone help?
public class Competitor {
//create instance variables
private int competitorNumber;
private Name competitorName;
private String competitorLevel;
private String competitorCountry;
int[] competitorScore;
//create constructor
public Competitor(int number, Name name, String level, String country, int[] score) {
competitorNumber = number;
competitorName = name;
competitorLevel = level;
competitorCountry = country;
competitorScore = score;
}
public Name getCompetitorName() {
return competitorName;
}
public class CompetitorMain {
public static void main(String[] args) {
int[] SRScores = {4,5,4,3,3};
Competitor <PERSON> = new Competitor (104, new Name ("<PERSON>", "<PERSON>"), "Inter 1", "Germany", SRScores);
int[] LGScores = {5,4,5,4,3};
Competitor <PERSON> = new Competitor (105, new Name ("<PERSON>", "<PERSON>"), "Inter 1", "USA", LGScores);
System.out.println(sonkeRothenburger.getCompetitorName());
public class Name {
private String firstName;
private String middleName;
private String lastName;
public String getFullName() {
if (middleName.isEmpty()) { return "" + firstName + lastName;
}
else {return "" + firstName + middleName + lastName;
}
}
public Name(String firstName,String lastName, String middleName) {
this.firstName = firstName;
this.lastName = lastName;
this.middleName = middleName;
}
public Name(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
this.middleName = "";
}
| 84eb6b25b1d1f2694c2607eb937e846e1994f2c3575d4296ee4930d4c6bba129 | ['0411f47fd89f4276b11ee43a4f6fc566'] | I have a list of products that are for sale on a subscription basis. the prices vary per region (about 15 regions). I'm trying to find the next closest priced product available on that day (not the cheapest on that day). My data looks like this
data = [['29/10/20', 400, 300, 2, 1],
['29/10/20', 250, 400, 1, 2],
['29/10/20', 600, 600, 3, 3],
['30/10/20', 800, 500, 3, 2]
['30/10/20', 200, 800, 1, 3],
['30/10/20', 550, 300, 2, 1]
df = pd.DataFrame(data, columns = ['date', 'east price', 'west price', 'east position', 'west position'])
I would like my ouput to look like
date east_price nearest_east_price west_price nearest_west_price
29/10/20 400 250 300 300
29/10/20 250 250 400 300
29/10/20 600 400 600 400
30/10/20 800 550 500 300
30/10/20 250 250 800 500
30/10/20 550 250 300 300
i'm not sure whether to do this bt the position information that is available or is there another way to do this. i've been stuck on this all day. i also have the problem for the cheapest product on that day, i'd like it to return its value. can anyone help? i'm new to programming so might be missing the obvious
|
511f7b3c893d0db190b7f3b617dedba664dfe93d58728e557daa9262ac462d9c | ['04132e3ea89a4f4d82a3d40583d1d9cb'] | If I understood correctly by looking at your code, in this case specifically, you don't need the StockPostSerializer. You can acheive the result you want by changing StockSerializer as follows:
class StockSerializer(serializers.ModelSerializer):
class Meta:
model = Stock
fields = ['shoe', 'size', 'amount']
extra_kwargs = {'shoe': {'write_only': True}}
I greatly apologize if I misunderstood your question.
EDIT:
Forgot to say. Using this serializer you don't need any extra route on your ModelViewSet
| 24b7651bc55c849acb55018e74ff9a0886aa72028bc3c97e30b6141a1d7e2c24 | ['04132e3ea89a4f4d82a3d40583d1d9cb'] | You don't get automatic joins in Django, no need for it because you can just follow the ForeignKey relation on the object (the_object_you_get.its_foreign_key). Now, of course, that will hit the DB twice. if you'd rather avoid that, you can use something like .prefetch_related('employee_id') on whatever queryset you need to use. This will prevent you from hitting the DB multiple times (at the price of one larger initial query of course).
Finally, if you wanna serialize a ForeignKey relation, the answer <PERSON> gave is pretty comprehensive. Only thing is that you don't necessarily need to set the employee_id field as read_only=True (a bit of a limitation). You can also override the UserRoleSerializer .create() the method so that it calls the .create() method of UserSerializer.
|
82b7c71de7729ab0ee09dc1cd2b77145005e3cd774f3a7aac4e30972dfe7f2e0 | ['04157a5027314e149ce8ec43cf423174'] | #include <stdio.h>
#include <type_traits>
void print()
{
printf("cheers from print !\n");
}
class A
{
public:
void print()
{
printf("cheers from A !");
}
};
template<typename Function>
typename std<IP_ADDRESS>enable_if< std<IP_ADDRESS>is_function<
typename std<IP_ADDRESS>remove_pointer<Function>::type >::value,
void >::type
run(Function f)
{
f();
}
template<typename T>
typename std<IP_ADDRESS>enable_if< !std<IP_ADDRESS>is_function<
typename std<IP_ADDRESS>remove_pointer<T>::type >::value,
void >::type
run(T& t)
{
t.print();
}
int main()
{
run(print);
A a;
run(a);
return 0;
}
The code above compiles and print as expected:
cheers from print ! cheers from A !
what I would like to express is : "if the template is function then apply this function, else ...". Or in another formulation : having a version of the function for function templates, and a default version for non function templates.
so, this part seems somehow redundant, and could be "replaced" by a "else" condition :
template<typename T>
typename std<IP_ADDRESS>enable_if< !std<IP_ADDRESS>is_function<
typename std<IP_ADDRESS><IP_ADDRESS>type ><IP_ADDRESS>value,
void ><IP_ADDRESS>type
run(Function f)
{
f();
}
template<typename T>
typename std::enable_if< !std::is_function<
typename std::remove_pointer<T><IP_ADDRESS>type ><IP_ADDRESS>value,
void ><IP_ADDRESS>type
run(T& t)
{
t.print();
}
int main()
{
run(print);
A a;
run(a);
return 0;
}
The code above compiles and print as expected:
cheers from print ! cheers from A !
what I would like to express is : "if the template is function then apply this function, else ...". Or in another formulation : having a version of the function for function templates, and a default version for non function templates.
so, this part seems somehow redundant, and could be "replaced" by a "else" condition :
template<typename T>
typename std::enable_if< !std::is_function<
typename std::remove_pointer<T><IP_ADDRESS>type ><IP_ADDRESS>value,
void ><IP_ADDRESS>type
run(T& t)
would this exists ?
| 6e36bc193b88a8092d1db3bedebda93543f9323e08a48e2e314a786722957b45 | ['04157a5027314e149ce8ec43cf423174'] | finally things were not so difficult.
the javascript script create a file config.mingw that is easy to edit, in this case manually adding the paths separately with -I, in my case:
INCLUDE+= -IC:\cpp\libraries\iconv\GnuWin32\include -IC:\cpp\libraries\zlib1.2.3\GnuWin32\include
LIB+= -LC:\cpp\libraries\iconv\GnuWin32\lib -LC:\cpp\libraries\zlib1.2.3\GnuWin32\lib
|
2afea3f12ab59d7d23e75f35e963144b5eb463f81f9e5f53e3d8d43c8aedeb20 | ['042bd3bf36bd45a7a7ce50e2f8c4f157'] | You want to wait till all api response you get and stored in db, so you should do async-await and promisify all the response.
You can use Request-Promise module instead of request. So you will get promise on every requested api call instead of callback.
And use promise.all for pushing up all request(module) call inside array.
Using async-await you code execution will wait till all api call get response and stored in db.
const rp = require('request-promise');
app.post('/', async (req, res) => {
try{
const { urls } = req.body;
// completed all will have all the api resonse.
const completedAll = await sendRequest(urls);
// now we have all api response that needs to be saved
// completedAll is array
const saved = await saveAllData(completedAll);
// Should be called after all data saved from for loop
res.status(200).send('All data saved')
}
catch(err) {
res.status(500).send({msg: Internal_server_error})
}
})
function sendRequest(urlArr, i){
const apiCalls = [];
for(let i=0;i < urlArr.length; i++){
apiCalls.push(rp(urlArr[i]));
}
// promise.all will give all api response in order as we pushed api call
return Promise.all(apiCalls);
}
You can refer these links:
https://www.npmjs.com/package/request-promise
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all
| 452e45b57cac23986c35f03dbb2956a119977f021047a5315d75d111f3aede1f | ['042bd3bf36bd45a7a7ce50e2f8c4f157'] | You can use async/await. But you didn't used it right way. You got syntax error that says you can use await only in async function. So you can write your code like this,
async function listCars() {
try{
db = await MongoClient.connect(url);
var dbo = db.db("testdb");
car_and_name_parent = await dbo.collection("cars").find({}, {
projection: { _id: 0, name: 1} }).toArray();
return car_and_name_parent
}catch(err){
throw err;
}
};
|
3ce9ffad47f3e45e846d45667860534efc955ba5d4991835f40870b4d33c2147 | ['04341abfc4fa4312b98f162803f026b9'] | I bought a games bundle which has games that are both available and not available for Linux. I understand that to play the available games for Linux I only have to download Steam and voilà. But is it possible to play the games that are 'not available for Linux' by installing steam on PlayOnLinux or Wine and then installing the game with steam?
I got Ubuntu 14.04
| 1a59da0d94676a3e73768f1365c4646c2e3bfe5d91af9493738097e65e4ca30a | ['04341abfc4fa4312b98f162803f026b9'] | I have an installation disk of Sacred 2 Fallen Angel with serial code and all that but ubuntu 14.04 does not see anything on the disk. I have it mounted under Devices as S2DISC1 but when I click it it's empty.
So I'm wondering if there is a program already on ubuntu that can copy an image or .iso from the cd to my computer and run it from there? I think I used Daemon Tools for that on windows but I never had the problem of not being able to boot a cd there.
|
5bdb70a1622995777b5fd13d00517c5980542f2500a846a23bf0ba7251838820 | ['04348d9ec3db47009ad1db6a37ef13f1'] | Can someone help me? I have no idea what to do. If someone could please help me with a step by step process. I have no idea what or if I need to instal something. The only think I know is that I usually lose all my projects so I need a proper way to save them. Btw my knowledge about github is 0
| 5d00737f598702f8c829dba26640de3a022c148694588c379cb026b1455c408f | ['04348d9ec3db47009ad1db6a37ef13f1'] | So i have the program bellow, but the console keeps showing me only my first cout even if i input n, I need some help
#include
using namespace std;
void DivizoriCresc1(int n, int d)
{
cout << " ceva";
if(d > 0)
{
DivizoriCresc1(n, d - 1);
}
if(n % d == 0)
{
cout << d << " ";
}
}
int main()
{
int n;
cout << "n =";
cin >> n;
cout << " ceva";
DivizoriCresc1(n, n);
cout << " ceva";
return 0;
}
Last login: Wed Nov 21 16:11:42 on ttys000
MacBooks-MacBook-Pro:~ macbook$ /Users/macbook/Desktop/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/macbook/CodeBlocksProject/tema1/bin/Debug/tema1
n =50
Process returned -1 (0xFFFFFFFF) execution time : 1.856 s
Press ENTER to continue.
MacBooks-MacBook-Pro:~ macbook$
|
559cbad163f8de598a016dbf6ca452698ca9e2d708757a141c9ece9086e600ee | ['04395a984eb9495a84dd7229e5ec3e22'] | I tried to create a website to display each product with an image, but I want to disable it to users to download the image's product when the user right-click on it, he/she can't to download it or Open the image on new tab to download, I read many questions on StackOverflow about it but nothing tells me how to do it. I want to display this box which on the below image appears.
please help me.
| 8ea9b45c7f79a4456fd1e569645a8540e19a17768a7cefccef2cc7d6106ecae9 | ['04395a984eb9495a84dd7229e5ec3e22'] | Sorry for this question I think it's not difficult but I'm new to PHP, I tried to show some images of products with the link, If the item is available $row['p_status']=='1' ok the link will be opened else it display an alert, but I tried to write some code inside while loop but when I test it, it display many alert according the number of those items which is $row['p_status']=='0' if I have 5 products which it it's not available if I click on an product it show me five alert.
Please help me this is my code.
<?php
$query = "SELECT * FROM products";
$result = mysqli_query($conn,$query);
while ($row = mysqli_fetch_assoc($result)) {
?>
<div class="column">
<img src="<?=get_image($row['image']);?>">
<span>Add to Your Cart </span>
<a href="mycart.php?add=<?=$row['product_id'];?>" id="a">
<?php
if ($row['pro_status']=='0') {
# the link above not open but, how to do with code?
}
?>
</div>
<?php
}
?>
|
971098e96e8c5c2c404ae4c14d7a29a186ce62bf00b74d2a176835d2c771b691 | ['043c7ed2420c409fa664136df453e90b'] | This was asked and answered at the time: https://meta.stackexchange.com/a/314609/282289
I talked to <PERSON> about this... It's not lost, but... Getting it back into the system is gonna be a lot of work. Unfortunately, work we don't have the time for.
If, at some point, we can spare the time to figure out how to merge it in... We'll do so. Otherwise, it probably will end up lost eventually. Either way, by then we should have plenty of new data.
| 0316caa44baf6e87c77733a1e598a94d8f5013914f84006be845b9d33fc1f9ce | ['043c7ed2420c409fa664136df453e90b'] | The name could be "mod emeritus" just like a "professor emeritus". The question would be if they have reduced powers. I could see situations where having a separate category (maybe show a diamond that isn't filled in?) would be interesting so that newer moderators could invite them to the moderator chat to ask about how certain situations were handled in the past. It would show status without having the number of people with mod powers growing all the time. |
76ba2649a0bd8b7e326bc5c363c016d40534e730621c490929117e754addd807 | ['044a1de3b1234cf8b1f0b5e32dbf3e98'] | There's no big scary procedure. :) All you have to do is drop a file named LICENSE with your license of choice inside of it into your project's root directory and make it obvious that that file is the license for the entire project, either through comments in the source code or a notice in the README.
Choose any license you want. A quick google search can get you on your way.
One of the most commonly used ones in open source is the GPL.
| 3263360ca22d04c7cc74d34e1ce860a88ffbe317bf174ecb615538f4a7b2395a | ['044a1de3b1234cf8b1f0b5e32dbf3e98'] | public class B { }
public class C { }
public class D { }
public class E { }
public class A :
IRetrievable<B, C>,
IRetrievable<D, E>
{
public TValue Retrieve<TKey, TValue>(TKey input)
{
throw new NotImplementedException();
}
}
What is the reason I can't do this? Visual Studio is telling me that the interfaces aren't being implemented, even though they could be via putting types B, C and D, E in TKey, TValue, respectively.
|
1f27a8baaedf35e08fa9e10e69e1d925ea45329d555ee0fdc7c735a4c9ac2add | ['0464c6508f8d4717ab625f1dd6debda2'] | I have a hard time understanding something related to using a concat function inside a mergeMap operator.
The documentation for concat says that
You can pass either an array of Observables, or put them directly as arguments.
When I put the Observables directly as arguments, like in the following example, I correctly get 20 and 24 in the console.
of(4)
.pipe(
mergeMap(number => concat(of(5 * number), of(6 * number)))
)
.subscribe(value => console.log(value));
But when I put them as an array, then in the console I get the Observables and not their values:
of(4)
.pipe(
mergeMap(number => concat([of(5 * number), of(6 * number)]))
)
.subscribe(value => console.log(value));
Here's a live version in Stackblitz.
Any idea why is that? Shouldn't both examples work identically?
| 057d566b2720291ddcc2c403e2b2248287868758a3ff724b2272977800e826d5 | ['0464c6508f8d4717ab625f1dd6debda2'] | Your links to the images don't work because they point to files on your computer. You need to upload them somewhere and put the link here to be able to see them. Anyway, if you have background-image:url("6928140-swiss-alps.jpg") your image should be in the same folder as the css file. And it should be called 6928140-swiss-alps with the .jpg extension at the end.
|
d82ad368b2ede8dc3ec58d5a856e4b993d5735ea979d900ed5494ec4a80a4232 | ['0479aff1c15b4297bbeb16f0451fec6b'] | I can't figure out why there's a quite significant (~30%) difference between new visits figure I get from Mixpanel and GA. Here's how I implemented this metrics with Mixpanel:
if(!mixpanel.get_property("First visit")) {
mixpanel.register_once({ "First visit": $.now() });
mixpanel.track("Visit");
}
Is there anything wrong with this code? Is there any better way to do it? I want to implement a signup funnel with mixpanel (first visit -> sign up form -> sign up), but can't afford tracking every single visit, so I track just the first one. Though daily "Visit" events differ by 30% from New Visitors from Analytics and spoils the funnel.
| a1d54f613b9a6679d4a6a363e680292b85022c2047004e16d186a5db57fea2a3 | ['0479aff1c15b4297bbeb16f0451fec6b'] | From time to time, all ruby programs become slow. By slow I mean, they run 2-3x time slower than usually. After restart everything backs to normal. Here are two outputs (first is "slow") from strace -T for process running specs: https://gist.github.com/1213292. Maybe it's not just ruby, but the whole system (which seems more likely), but this is only thing I noticed. It seems to be random, sometimes it happens few times a day and sometimes it's fine for couple of days and every time reboot fixes this. I have neither idea why does time spent in stat grows that much, nor how to debug it further. Is it system (Ubuntu 11.04) thing, hardware (Intel 320 SSD) problem, something else?
|
0272cde2e6119d583f187cb7da2941596af3418d610bbb18e5eecf7c968043e5 | ['047bc11b7bf6492d9d6a115a60913492'] | I have a site that is currently running version 1.3. Unfortunately due to changes made in the code I am unable to upgrade the site at this time to a newer version. I am trying to add a drop down filter to the Reports -> Sales -> Sales Reports for Customer Group. I am able to add the front end filters by creating a new grid.phtml file. However, I am not sure how to include the dynamically chosen customer group and filter it in the collection.
Does anyone have a suggestion on which collection should be extended to achieve this (I was trying to extend 'Mage_Reports_Model_Mysql4_Order_Collection') or how to call the dynamically chosen variable? Would it be better to create an entirely new custom report?
| 9066ace3f7be8accaaaeba183e5da605eda3dc69dcb902b677384d09f155e243 | ['047bc11b7bf6492d9d6a115a60913492'] | Currently, I have set up an ajax call, that on change of a particular field it should execute a php script. The script first executes on page load.
AJAX Call
$j.ajax({url: prod_json_url, dataType: 'json', cache: true,
beforeSend: function( xhr ) {
xhr.overrideMimeType( 'text/plain; charset=x-user-defined' );
},
success: function(data) {
//things to do on success with JSON
}
});
Everything works great in my virtual environment for testing, but when I deploy this to a different server the following happens.
1) On page load, I can view the URL in FireBug being executed and returning the correct JSON Response. Logging shows that it did go to the script to be executed and returns the correct data. Everything acts as it should.
2) I then click to update the field. By viewing Firebug in the Console again, the correct URL is being executed, however, the JSON response is incorrect. It keeps the same one that occurred on page load. When I added logging, it appears that it never actually reaches the updated URL. (Which is the same URL as page load with updated arguments).
3) If I wait some time, and try again, it sometimes behaves as it should again, but only for the one execution.
This behavior makes me believe it is a cacheing issue. Does anyone have an idea of how I can resolve this or what variable I should be looking for or checking? The database is exactly the same and I'm not sure what else might be causing this. Any help is greatly appreciated! Please let me know if more information would be helpful as well.
|
ebd9d09a35c57c9a22112b4d9aebec383d55c2b47af3c7918718607fdc822180 | ['047e6178124f4c9a83074745f38e696c'] | Thanks! This one definitely works. If you plot a flow plot in mathematica, the solutions actually run off the x-axis, because the gradient of y'[t] is undefined when y = 0. Are there any examples you can think of that would have a gradient with no undefined points? Thank you for your help! | 77a69dcee0dc2ed7831013d1bc8f306217c05ff378c35c347ea7e9bb786d25af | ['047e6178124f4c9a83074745f38e696c'] | I want to create simple script to check domain availability. Can anybody tell me is this function enough to check domain availability before user can register:
<?php
$recordexists = checkdnsrr("www.google.com", "ANY");
if ($recordexists)
echo "The domain name has been taken. Sorry!";
else
echo "The domain name is available!";
?>
or should I go with some other whois script like http://www.mrscripts.co.uk/index.php?op=lite
|
b5ea6cebd992897debac22217882e0d2707eb48b8e9211832422565aa5ae419a | ['048f936001dc41e6a1e19e0bd502f6ff'] | I was able to install CLI on windows 16 AWS instance. when I try "aws ec2 describe-instances" CLI command, I get the following error
CLI command "describe-instances" throw error "An error occurred (AuthFailure) when calling the DescribeInstances operation: AWS was not able to validate the provided access credentials"
In .aws\config file I have following content:
[default]
region = us-west-2
How can authorization fail when it took my access key id and secret access key without any issue.
| 4e5a918456338faefe6dd36cb82d1f93aeee601f3ee516759227165292dff739 | ['048f936001dc41e6a1e19e0bd502f6ff'] | I have created AWS EC2 Windows 16 instance and was able to attach additional volume etc...and so far so good.
I wanted to try to use CLI commands.
Installed CLI on AWS-EC2 windows instance. and did according the instructions attached in the picture below.
when I type "aws ec2 describe-instances I get "Could not connect to the endpoint URL"
When I was creating the instance, I chose a "Security Group" that had HTTPS enabled.
any help?
|
c04a1c7004824c4022216ec6d4b800689a4ac7c33468281d52eb1c7fec19fcba | ['04903bef12a94e92979c04774c753119'] | Hello I am trying to sync data between my to server using below command
rsync -avzP --exclude /home/username/public_html/raj/sandip "-e ssh -p 18765" <EMAIL_ADDRESS>:/home/username/public_html/raj/ /home/rajrathodbvn/public_html/raj/
I want exclude directory called sandip but even I try to exclude it, its getting copied. Let me know if I am missing something. I have both server centos7.
Thanks
| 43df8b58f96a71d0d065b178954f1f59fd48f980bc67734533758f12125562fb | ['04903bef12a94e92979c04774c753119'] | There are several things to consider here:
The size of the page1 and page2 files. If they are very small it's probably not worth the extra overhead of a separate http request to put them in individual files.
The total size of your combined files: Some mobile devices are not keen on caching large files.
The likelihood of your users hitting both page1 and page2 during their visit to your site.
A side note: If you're worried about the server side organization you can keep the files separated while developing and combine the files into one as a part of your build.
|
8f0bd099235bac5e72fa0284ed78b812370266a633fd20fbaed6e827723811b0 | ['04967698ec464110827eb61f2bfd5bb8'] | When I do a simple unit testing in C#,
it's throwing "System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it <IP_ADDRESS>:52747"
Unit test Cs file:
CS file for the get method:
When I run test method , it's keep on refusing
| 74d8faf2a6d461b5f933e901f62f2e0a59dff3178a26db54421eaeb9e13a3d1b | ['04967698ec464110827eb61f2bfd5bb8'] | Here i have used yii2 configuration with rules
<?php
$params = array_merge(
require(__DIR__ . '/../../common/config/params.php'),
require(__DIR__ . '/../../common/config/params-local.php'),
require(__DIR__ . '/params.php'),
require(__DIR__ . '/params-local.php')
);
return [
'id' => 'app-backend',
'basePath' => dirname(__DIR__),
'controllerNamespace' => 'backend\controllers',
'bootstrap' => ['log'],
'modules' => [],
'components' => [
'user' => [
'identityClass' => 'common\models\User',
'enableAutoLogin' => true,
],
'log' => [
'traceLevel' => YII_DEBUG ? 3 : 0,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'urlManager' => [
'enablePrettyUrl' => true,
'rules' => require(__DIR__ . '/routes.php'),
],
'errorHandler' => [
'errorAction' => 'site/error',
],
],
'params' => $params,
];
And given below routes.php
<?php
use yii\web\UrlRule;
return array(
// REST routes for CRUD operations
'POST <controller:\w+>s' => '<controller>/create', // 'mode' => UrlRule<IP_ADDRESS>PARSING_ONLY will be implicit here
'api/<controller:\w+>s' => '<controller>/index',
'PUT api/<controller:\w+>/<id:\d+>' => '<controller>/update',// 'mode' => UrlRule<IP_ADDRESS>PARSING_ONLY will be implicit here
'DELETE api/<controller:\w+>/<id:\d+>' => '<controller>/delete', // 'mode' => UrlRule<IP_ADDRESS>PARSING_ONLY will be implicit here
'api/<controller:\w+>/<id:\d+>' => '<controller>/view',
// normal routes for CRUD operations
'<controller:\w+>s/create' => '<controller>/create',
'<controller:\w+>/<id:\d+>/<action:update|delete>' => '<controller>/<action>',
);
When i access local2host.com/advanced/backend/web/index.php/country/create - It's working fine
but when i access through local2host.com/advanced/backend/web/index.php/api/country/create
It's throwing 404 - not found error
Unable to resolve the request "api/country/create".
As per my requirement :
when i access this link local2host.com/advanced/backend/web/index.php/api/country/create
it should access "country" as controller and "create" as action
|
0c9f417c9c7cc282d256e15d4ccef5e36dfa254e91cc475fed70be2eef7778a2 | ['04ac61e869fb4c0baa72ed29c140307c'] | This will hopefully clear things up.
# read in (slightly edited) data
df<-data.frame(Time=c("07:40:00","07:42:00","15:02:00","20:06:00"),Sunrise=c("2009-09-17 07:41:30","2009-09-17 07:41:30","2009-09-17 07:41:30","2009-09-17 07:41:30"),Sunset=c("2009-09-17 20:05:30", "2009-09-17 20:05:30", "2009-09-17 20:05:30", "2009-09-17 20:05:30"))
# convert character to POSIXct
df$Sunrise<-as.POSIXct(df$Sunrise,format="%Y-%m-%d %H:%M:%S")
df$Sunset<-as.POSIXct(df$Sunset,format="%Y-%m-%d %H:%M:%S")
# add date to Time variable and convert to POSIXct
df$Time<-as.POSIXct(paste(strptime(df$Sunrise,"%Y-%m-%d"),df$Time),format="%Y-%m-%d %H:%M:%S")
# identify times during the day
df.day<-df[df$Time>df$Sunrise & df$Time<df$Sunset, ]
# identify times NOT during the day
df.night<-df[!(df$Time>df$Sunrise & df$Time<df$Sunset), ]
I should have used the not (!) operator in my previous response for finding the night times. I had thought you had just a numeric variable for time and I haven't worked with POSIXct data before. This should solve the problems though.
| 2c40b68dc1109cd3d359f664d5659f31e68d0376c062d4cca19ae50a8e90219a | ['04ac61e869fb4c0baa72ed29c140307c'] | You need to set stringsAsFactors=F in your data.frame so that it isn't making your A1, B1, C1 variables into factors (which it is complaining about when you try to replace the value with a level that isn't present). This will make A1, B1, C1 character variables which will replace as expected.
dat12 <- data.frame (A1 = c("AAAA", "AAAB", "AABB", "ABBB", "BBBB"),B1 = c("AAAA", "AAAB", "AABB", "ABBB", "BBBB"), C1 = c("AAAA", "AAAB", "AABB", "ABBB", "BBBB"),stringsAsFactors=F)
dat12
dat12[dat12 == "AAAA"] <- "AA"
see ?data.frame for more info
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.