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 |
|---|---|---|---|---|---|
00ed279da0671b58412ab6b340c92cab664131dd4e65d0fb469cd686d3742fae | ['a2c69657376041768d7ca5685ef2eb0b'] | Actually its quite easy to authenticate a customer in your case. The customer info SOAP response gives us the password_hash of the user registered in Magento. This hash is an md5 hash which can authenticated using the password which the user will enter along with his email in your system. I have a sample code below hope this helps anyone looking for this answer.
$complexFilter = array(
'complex_filter' => array(
array(
'key' => 'email',
'value' => array('key' => 'eq', 'value' => '<EMAIL_ADDRESS>')
)
)
);
$result = $proxy->customerCustomerList($sessionId, $complexFilter);
var_dump($result);
/**
* Validate hash against hashing method (with or without salt)
*
* @param string $password
* @param string $hash
* @return bool
*/
function validateHash($password, $hash)
{
$hashArr = explode(':', $hash);
switch (count($hashArr)) {
case 1:
return md5($password) === $hash;
case 2:
return md5($hashArr[1] . $password) === $hashArr[0];
}
}
var_dump(validateHash('asdfgh',$result[0]->password_hash));
| ba03262fd9c4c79fa54653c5a17c94d062392956a2efbd89f4203b708a1eced0 | ['a2c69657376041768d7ca5685ef2eb0b'] | If any one in the future is going to face this same problem with the Mana Dev layered navigation bar this might help. You are seeing this error because you have deleted an attribute from the system which was being used by mana dev. Now Mana dev plugin keeps a copy of the attribute used in layered navigation or search, if you deleted an attribute without disabling for search and layered navigation, Mana Dev plugin will try to find this plugin and will not be able to process the attribute which was deleted.
To resolve it just re create the attribute in the backend but do not enable for layered navigation or search. This error will go away.
|
bd57a4bb93ae68789faa450c1faffa62fda1e650a55c60ee3fcb3151d3ec3c4b | ['a2da6ced4cfd4e8d85bc2b15ce456d06'] | I have a group of (dynamically added) div tags which the user can drag around the screen. What I need to happen is when the user drags (using JQuery draggable) one of the divs near to another div for a line / border to appear, and then the divs to lock together, similar to how Google docs presentation and MS PowerPoint do when you do something similar with a textbox or image.
I guess what I am trying to detect is if the borders of two divs are over each other, and give visual feedback if they are, in the form of the borders which are above each other changing colour.
| dbe91340c65f4ae93b2de235c16a0a6c971998a922aad253ec5de1d07c24c1eb | ['a2da6ced4cfd4e8d85bc2b15ce456d06'] | I have some code which works in essence, but fails to add one to the value stored in a MySQL Database.
The aim is that a word is picked from a text file, the scripts check if it is in the database already and if it is, add 1 to the relevant row in the database. All of this works except for the +1, which just adds an arbitrary number!
$connection = mysql_connect('localhost', 'root', '') or die('Could not connect to MySQL database. ' . mysql_error());
$db = mysql_select_db('decode',$connection);
$text = file_get_contents('text.txt') or die ('SYSTEM ERROR');
$words = explode(" ", $text);
foreach ($words as $word){
$word = explode("\n", $word);
foreach ($word as $single){
echo $single;
$sql = mysql_query("SELECT * FROM `wordsequences` WHERE `word` = '".$single."'");
if( $res = mysql_fetch_array($sql) ){//already in reference
$previousWord = $res['previousWord'];
$occurence = $res['occurence'];
$newOccurence = $res['occurence'];
$newOccurence = intval(++$newOccurence);
$newOccurence = mysql_real_escape_string($newOccurence);
echo $newOccurence;
$sql2 = mysql_query("UPDATE `decode`.`wordsequences` SET occurence = $newOccurence WHERE `word` = '".$single."' AND `previousWord` = '".$previousWord."' AND `occurence` = '".$occurence."' LIMIT 1;");
} else {//not in reference
}
echo '<hr>';
}
}
Here are a few sample values for 'occurence' in the database starting at 1:
1
10
19
28
But each time, echo $newOccurence results in the correct next digit.
Can anybody see anything dreadfully wrong with what I have here???
PS. I have tried the direct query UPDATE xyz SET occurence = occurence + 1 WHERE ... but to no avail, also my field type is set at int(11). The direct query works in phpMyAdmin, but not in the php...
Thanks in advance.
|
d36e50186220e1d2fcf61c628d260c55428be1d5d00f8fa219d541c6ad20360f | ['a2de202a03b54484ac234b710f481037'] | I have a data table and a code table, And I want to join one column of the code table to two columns in the data table.
I didn't find a way to join so I tried:
SELECT
A.COLUMN1,
(SELECT CODE_NAME FROM CODE_TABLE B WHERE B.CODE = A.COLUMN2) AS COLUMN2,
(SELECT CODE_NAME FROM CODE_TABLE B WHERE B.CODE = A.COLUMN3) AS COLUMN3
FROM DATA_TABLE A ;
DATA_TABLE
COLUMN1 COLUMN2 COLUMN3
test AA001 BB001
test1 AA002 BB002
test2 AA003 BB003
CODE_TABLE
CODE CODE_NAME
AA001 APPLE
AA002 SAMSUNG
AA003 OPPO
BB001 LG
BB002 HWAWEI
BB003 GOOGLE
How to treat it as a join rather than a subquery?
| de6c6b27be9cd942f02a3fe636a0472121a64b4575b7c60555ccb4e102f07f80 | ['a2de202a03b54484ac234b710f481037'] | I have an app that consists of a pure webview. I have been running this app for about six months and have had no problems so far. But about a month ago there was a problem.
Users of galaxy note 8 and 9 are experiencing inconvenience. My app will see the login screen for the first time. Here, users of galaxy notes 8 and 9 often do not work with javascript. The page refreshes and nothing happens. So they have to try the same login more than 10 times.
I also have a galaxy note 9, and I can see the same problem on my phone. However, I did not find any difference in configuration with other galaxies.
Do you know how to solve this problem?
The people who have the problem are android version 8.1.0,
chrome version is <PHONE_NUMBER> (most recent update).
|
1b75a2e68db970dfb0a9d3f96ecf8f52e2975d71f2c16480d1faabfef8825386 | ['a2df956ee7e94a58ab399b180727c983'] | I've just got my 2D sprite game running on the 360 and WP7 and it's far slower on these than the Windows counterpart. The FPS is about a frame a second, but on windows its smooth. I'm using Farseer the latest version in this. Is there anything on these two platforms that could cause such a drastic slowdown?
Thanks in advance.
| 8cef737d93e9e6dfdca8e000eedc0173bbe835c0b498417921fad1f279854335 | ['a2df956ee7e94a58ab399b180727c983'] | I've added uap10.0 to the target frameworks list in the CSProj file (Net Core project) so that I can reference this library from a UWP project.
As follows:-
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net462;uap10.0;xamarin.ios10;MonoAndroid70</TargetFrameworks>
</PropertyGroup>
</Project>
But when building I get the following error message:-
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets(84,5): error : Cannot infer TargetFrameworkIdentifier and/or TargetFrameworkVersion from TargetFramework='uap10.0'. They must be specified explicitly.
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1111,5): error MSB3644: The reference assemblies for framework ".NETFramework,Version=v10.0" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.
What I have failed to do?
Thanks.
|
8db2e0c85c94a29450680630e82b5ac324b340d0e610494ebf19e757797577bb | ['a2e0dc0936b3499ca55c7760859b796b'] | So, I'm making a custom PC case for myself. I want to add a simple on/off key switch (like all of the bikes have), only on ignition, start + restart button should work.
Here problem is that, I bought a ignition switch of some motor bike which has on/off as I wanted, but when switch is ON, circuit opens, when it is OFF, circuit closes. (that's how bikes work, when switch is OFF, earthing doesn't allow bike to start. Similarly when switch is ON, earthing breaks and bike can be started.
I want to use this key switch in my PC. Are there any electronic parts that I can use in my case?
Such as if switch is OFF (here close) but PC shouldn't start and when switch is ON (open) , PC starts?
Simple on/off key switch is not available at my place. I've searched every single store.
Here's a video about the switch I want.
https://youtu.be/fUeIVqdZyy4
| f1427034fe8ec5d97d879e7491ad9fd23773cd6d3c2985f6c54ead6d92bae342 | ['a2e0dc0936b3499ca55c7760859b796b'] | So I've three relays connected in parallel. Each of them gets triggerd with 9v and I've a 5v source. Can I trigger all the relays with 5v by connecting some kind of additional electrical part, like capacitor or something? Btw they all should be triggered always be default (continuous flow should be present).
Also a 5v relay is not available where live, so I've to manage with the same relays.
|
0b961a02bc1a3006c58a4a98e8431cd5dda6b3726842a4d1921cdc731dce85c6 | ['a3044538325145f28bde6bc109d49a2b'] | I'm trying to generate an adjacency matrix (later to be used to create a social network graph) from a simple three-variable data set. See below.
Year Company Project
2001 A Proj1
2001 B Proj1
2005 C Proj3
2004 D Proj4
2004 E Proj4
The idea is to generate a matrix in which the rows and columns are companies and the edges indicate whether or not any given pair of companies has participated on the same project. This would look something like:
A B C D E
A 0 1 0 0 0
B 1 0 0 0 0
C 0 0 0 0 0
D 0 0 0 0 1
E 0 0 0 1 0
How would I accomplish something like this in R? Based on other users' attempts, I tried reshape2, but no luck.
Any help would be appreciated.
Thanks!
| 4f59544d9b2d9d9d5d88ab0f7178994cab8f997218c08dc9f5f6fea593b93571 | ['a3044538325145f28bde6bc109d49a2b'] | I have a data frame that looks as follows:
df <- data.frame(x = c('a', 'b', 'c', 'd'),
y = c('b', 'a', 'c', 'c'),
z = c(1, 1, 1, 4))
I would like to identify duplicate cases/rows. Seems like simple task I thought I should be able to tackle via duplicates or unique. Not so much, unless I'm missing something obvious here.
I would like to return a data frame where case 1 (a-b) and case 2 (b-a) are recognized as the same. In other words, the result of this should be
x y z
a b 1
c c 1
d c 4
I don't care which case, 1 or 2, gets returned, so long as there is only one.
Any help would be much appreciated!
|
8af45d7e575d7ad45036dfcce70364e8b8bd8e2693fde88ec562295ac4e0b055 | ['a3170ff036064310ba2bc6f7af0ef0d3'] | I tried to add this ppa and it's working. As a workaround to add it to your system execute the following under root (sudo su before executing the following code):
echo deb http://ppa.launchpad.net/captiva/ppa/ubuntu trusty main > /etc/apt/sources.list.d/captiva-ppa-trusty.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B12AB791
apt-get update
apt-get install -y captiva-icon-theme
| 3a2179f53b08136d92f93f13fbd34ac166303ed8f451bb07f913c37ea39e0f26 | ['a3170ff036064310ba2bc6f7af0ef0d3'] | See the domain's whois data:
$ whois youplus.biz |grep 'Name Server'
Name Server: NS77.DOMAINCONTROL.COM
Name Server: NS78.DOMAINCONTROL.COM
It happens this way:
When you do
dig @<IP_ADDRESS> www.youplus.biz
you force dig to go to <IP_ADDRESS> nameserver and ask for domain www.youplus.biz
Wnen you ping youplus.biz from the server it uses DNS server from /etc/resolv.conf. I'm sure that you have <IP_ADDRESS> there as you've installed bind on that server.
When you do ping youplus.biz not from the server ping uses resolver from the local system. The resolver from your local system only knows DNS server for domain youplus.biz which is stated in whois data (really simplified version, but you can always see the DNS server which will be used in whois data)
So you need to change DNS servers for domain youplus.biz to <IP_ADDRESS><PHONE_NUMBER> www.youplus.biz
you force dig to go to <PHONE_NUMBER> nameserver and ask for domain www.youplus.biz
Wnen you ping youplus.biz from the server it uses DNS server from /etc/resolv.conf. I'm sure that you have 127.0.0.1 there as you've installed bind on that server.
When you do ping youplus.biz not from the server ping uses resolver from the local system. The resolver from your local system only knows DNS server for domain youplus.biz which is stated in whois data (really simplified version, but you can always see the DNS server which will be used in whois data)
So you need to change DNS servers for domain youplus.biz to <PHONE_NUMBER> instead of the current NS77.DOMAINCONTROL.COM/NS78.DOMAINCONTROL.COM. It is usually done via domain registrar's control panel.
|
ed3b99acab461ed0f3b14cf33913f7f92bf30123e2457b562297b36e970091fc | ['a32956678b07414dac0c0a14f219ae75'] | I am interested in comparison of visualization of dataset: histogram and density. I used dataset below for example only, however the idea is the same and it is for Poisson distribution:
Could anyone help me to plot display this with ggplot2?
example <- read.csv(file=url('http://www.math.uah.edu/stat/data/HorseKicks.csv'),header=T)
summary(example)
hist(example$C14,prob=T)
summary(glm(C14~1,family=poisson(link='log'),data=example))
lines(x=0:4,y=dpois(0:4,lambda=exp(0.1823)),col='red',lwd=1)
| b914cac05c4687810c9173da16aef46755b3c6110c4ceca7b643bf77a7e9f32d | ['a32956678b07414dac0c0a14f219ae75'] | For the subject of generalized linear models:
How to construct a nested sequence of (at least 100) models by adding one variable at time?
There is a base model_0, E(Y) = b0 + b1x1 + b2x2, which is a part of next complicated model.
The pattern is:
model_1 = model_0+b3x1*x2
model_2 = model_1+b4x1^2
model_3 = model_2+b5x2^2
model_4 = model_3+b6x1^2*x2
model_5 = model_4+b7x1*x2^2
model_6 = model_5+b8x1^2*x2^2
model_7 = model_6+b10x1^3
model_8 = model_7+b11x2^3
model_9 = model_8+b12x1^3x2
etc.
Task hints to use poly() and update() functions and the main task is to test AIC(model_o) against generated AICs of other generated models and apply test statistics.
Would be glad for any help with coding above pattern.
|
8cc89ffca0553d027739455a4c319443b951b4eba9f4db52e81944093bb58675 | ['a3309aa6285645db8b2fd35429afb29f'] | First, sorry for my bad english, okay go to this question above. I was surfing a lot for reference about this question on many websites, but i didn't find the right answer yet.
I'm trying to make a C program which this program can determine if the user input an integer or not, if user didn't input an integer then the program retry prompt to user for input an integer and so on. Everything is ok when i use scanf() return value on conditional statement, but the problem is, when user input 'whitespace/blankspace/space' (on ascii code as  ) and press 'enter', my program just stay running to wait for user input some characters or integer.
I just wish that if the input is 'whitespace/blackspace/space', the program will repeat prompt to user to input an integer or the program just stop.
Here is the case code :
#include <stdio.h>
int main() {
int number, isInt;
printf("Input a number : ");
do {
if ((isInt = scanf("%d", &number)) == 0) {
printf("retry : ");
scanf("%*s");
} else if (number < 0) {
printf("retry : ");
}
} while (isInt == 0 || number < 0);
printf("%d\n", number);
return 0;
}
I am a newbie in C, and curious about this. I know if i use %[^\n] <-- code format for scanf() string and convert it to integer, the program that i mean will run correctly. Is there another way to solve this using %d code format? or using scanf() ?
Please help me to break my curiosity, Regards :D
| e82bf73b038fa6c9a6d9a3d1790a5b46233e27784104dc595e1e22d6967f299b | ['a3309aa6285645db8b2fd35429afb29f'] | Forget about bootstrap img-responsive, try to use pure css code and embed it to the image html tag. And use Viewport-percentage lengths: the vw, vh, vmin, vmax units. Vw (for width) and vh (for height) for sizing the image.
Here's the example code :
<img src="/images/xxx.jpg" style="width:100vh; height:150vh"/>
for more reference :
https://www.w3.org/TR/2015/CR-css-values-3-20150611/#viewport-relative-lengths
hope this answer could fix your problem.
|
9921b00f1d3e073d6001e14c7cb1b8e7ad7e06d1861cffeacbbd6d6d12ab8700 | ['a33237dfda6b4aca91309bc2f8c9f3f9'] | We have this problem on all our servers, I check one of them is using VMXNET3 and problem still exists.
We are struggling with problem about 2 years... Next time this problem happens, we are going to use Microsoft Network Monitor to trace packet in order to find a clue. | 3d90341775e2ca4d74b46bb14f93e21863a2ec5051c4687e19abfa40823f24b7 | ['a33237dfda6b4aca91309bc2f8c9f3f9'] | No we don't use IIS Dynamic IP Restriction, We use similar rule on our firewall before web server, and nothing special is reported by firewall when this problem happens. Very interesting point is that even sites without any active connection are affected by this problem. and I think problem is not related to heavy load. |
59dde017188a6cc8b6015288285e18d539b9d923fc9f570525de847ca6dabb2d | ['a33a52c62d8a4241a0b9818c70ab9917'] | I'm working though <PERSON>'s Lie groups, Lie algebras, and representations and I want to show that the matrix Lie group $Sp(2N,\mathbb{R})$ is not locally compact. I've already shown that it fails to be compact since it is not bounded. The text doesn't talk about local compactness at all. How would I go about proving this?
I know that $\mathbb{R}^d$ is locally compact and subspaces need not be locally compact. To prove the space is not locally compact it would suffice to show that there exists a matrix with no compact neighborhood.
| af2a5d4751a37303565545764e72414e92f7192282c4929ac29773092b745d07 | ['a33a52c62d8a4241a0b9818c70ab9917'] | Let $\phi:A \rightarrow B$ be a ring homomorphism, $M$ be an $A$-module, and $N$ a $B$-module.
Prove that
$$N \otimes_B (B \otimes_A M) \cong N \otimes_A M$$ as either $A$ or $B$-modules.
We know that $B \otimes_AM$ is a $B$-module and $N$ is an $A$-module via extension and restriction of scalars. We have that $N \cong N \otimes_BB$.
Is it legal to do this:
$$N \otimes_B (B \otimes_AM) \cong (N \otimes_BB) \otimes_AM \cong N \otimes_AM$$
|
844a6e6b3f30ab55d0b1d74db3371c0b23324b372a8a864e6b3076e2f5cd45f3 | ['a347e22c5ad24a609100e0862f42294a'] | It's best to use from 9AM to 4PM , as I'm not sure implementing 9.30 till end at 4 in single line
00,15,30,45 09-16 * * 1-5 command*****
If you want exactly start at 9.30, you would end up adding two lines.
30,45 09-15 * * 1-5 command
00,15 10-16 * * 1-5 command
| 5425877477d5b2918bf41ea881b14d6dc7254151ac95f34fdab2706ef8e2be7d | ['a347e22c5ad24a609100e0862f42294a'] | The webpage content you want to download, should re direct you to the first website you mentioned if the cookie is not available for your session.
Ideally you don't have to authenticate with cookie site and launch the to be downloaded URL.
Use below parameters with wget to get authenticated on redirect.
wget --username=user --password=password "URL"
Let me know if this is not working
|
e625bed5f7c19bb06b158405bd5d6c41239d9f045a6b43392186e2485bd62299 | ['a366705452284d61aec2d4e389e8c5cc'] | Всем доброго времени суток!
Столкнулся с такой проблемой, как отправка сообщений с localhost. Использую сборку XAMPP (Win7).
Пытался по этой инструкции (http://www.simplecoding.org/php-mail-pod-windows.html) и на этом форуме (https://php.ru/forum/threads/otpravka-pochty-s-lokalxost.40515/) (надеюсь администрация не рассердится за ссылки). Примеры отправки сообщений использую из тех же ссылок приведённых выше. В общем-то никаких ошибок не вываливается, но и сообщения на почту не приходят...
В общем, чтобы много не разглагольствовать:
настройки sendmail.ini:
; tls = always use TLS
; none = never try to use SSL
smtp_ssl=auto
; the default domain for this server will be read from the registry
; this will be appended to email addresses when one isn't provided
; if you want to override the value in the registry, uncomment and modify
;default_domain=smtp.mail.ru
; log smtp errors to error.log (defaults to same directory as sendmail.exe)
; uncomment to enable logging
error_logfile=error.log
; create debug log as debug.log (defaults to same directory as sendmail.exe)
; uncomment to enable debugging
;debug_logfile=debug.log
; if your smtp server requires authentication, modify the following two lines
auth_username=моя_почта_mail.ru
auth_password=мой_пароль
; if your smtp server uses pop3 before smtp authentication, modify the
; following three lines. do not enable unless it is required.
pop3_server=pop.mail.ru
pop3_username=моя_почта_mail.ru
pop3_password=мой_пароль
; force the sender to always be the following email address
; this will only affect the "MAIL FROM" command, it won't modify
; the "From: " header of the message content
force_sender=моя_почта_mail.ru
; force the sender to always be the following email address
; this will only affect the "RCTP TO" command, it won't modify
; the "To: " header of the message content
force_recipient=
; sendmail will use your hostname and your default_domain in the ehlo/helo
; smtp greeting. you can manually set the ehlo/helo name if required
hostname=mail.ru
Настройки в php.ini
; XAMPP: Comment out this if you want to work with an SMTP Server like
Mercury
SMTP =
;smtp_port = 25
; For Win32 only.
; http://php.net/sendmail-from
sendmail_from =
; XAMPP IMPORTANT NOTE (1): If XAMPP is installed in a base directory with spaces (e.g. c:\program filesE:\xampp) fakemail and mailtodisk do not work correctly.
; XAMPP IMPORTANT NOTE (2): In this case please copy the sendmail or mailtodisk folder in your root folder (e.g. C:\sendmail) and use this for sendmail_path.
; XAMPP: Comment out this if you want to work with fakemail for forwarding to your mailbox (sendmail.exe in the sendmail folder)
sendmail_path = "E:\xampp\sendmail\sendmail.exe\" -t"
; XAMPP: Comment out this if you want to work with mailToDisk, It writes all mails in the E:\xampp\mailoutput folder
;sendmail_path="E:\xampp\mailtodisk\mailtodisk.exe"
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =
; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=Off
; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "E:\xampp\php\logs\php_mail.log"
Может кто-то сталкивался с этой проблемой и знает как её решить?
| 8e4bb35e166720634b103829484207348e3e43cbd069a24d1985fdcf73cab0db | ['a366705452284d61aec2d4e389e8c5cc'] | The idea is to use l2 cohomology as a quasiregular map invariant.
It is easy to see that there are closed 1-forms on the ring which are not exact, but it occures that every closed l2-form in punctured ball
$f_1(x,y)dx + f_2(x,y)dy$
is exact. Here $f_1$ and $f_2$ are $C^{\infty}(B_1\backslash\{0\})\cap L^2(B_1\backslash\{0\})$ functions. The ball $B_1$ is open.
I have got some problems with the proof.
I want to prove that $\int_{x^y+y^2=r^2}f_1dx+f_2dy=0$ for any $0<r\leq 1$.
Then, as the form is exact, this integral doesn`t depend on radius $r$. So by using the polar coordinates and the previous remark we can write:
$r\int_0^{2\pi}f_2(r,\varphi)\cos(\varphi)-f_1(r,\varphi)\sin(\varphi)d\varphi=\frac{1}{\varepsilon}\int_0^\varepsilon r\int_0^{2\pi}f_2(r,\varphi)\cos(\varphi)-f_1(r,\varphi)\sin(\varphi)d\varphi dr$
This holds for any $\varepsilon>0$. I am trying to get some upper inequalities in order to prove that this is zero but the standart ones seems not to be useful here. Can you help me on that?
If we prove that this is integral is zero and the pullback of differential form saves L2-integrability we get the required contradiction.
|
a8fb2e8c232b9c901ee4d3cbb0f1cd8f79ab209fc0be7a56bcb1319f588f6ae1 | ['a36815ccb27e4311ba7e3f8745fcded6'] | If you don't want to manually type out a level table like the other answer suggets you can also try doing your process with a recursive function:
$current_exp = 0;
$current_level = 1;
$to_next_level = 1000;
function did_level( $amount = 0 ) {
global $current_exp;
global $curent_level;
global $to_next_level;
$tmp_amount = $amount + $current_exp;
$tmp_amount_remainder = $tmp_amount - $to_next_level;
if ($tmp_amount >= $to_next_level) {
$current_level++;
$to_next_level *= 2;
$current_exp = $tmp_amount;
if ($tmp_amount_remainder > 0) {
// Level us up again.
did_level( $tmp_amount_remainder );
} else {
// Store the new level, to next level, and current exp
}
} else {
// Store the new exp amount
}
}
| cf883ce70a210771cf324147db8efe794d882905ebd288a9eebde5e5413ba9f0 | ['a36815ccb27e4311ba7e3f8745fcded6'] | Check your line with:
realpath(dirname('__FILE__'));
__FILE__
is a magic constant, and should not be wrapped in single or double quotes.
If you were to echo out the result of that function call you would probably see a different path than what you're expecting.
You're also trying to use string interpolation with single quotes around the variable instead of double:
SITE_ROOT.'/images/$article_image';
Should be:
SITE_ROOT."/images/$article_image";
Example:
if (!empty($_FILES['image'])) {
$tmp_file_to_upload = $_FILES['image'];
if ($_FILES['image']['error'] == UPLOAD_ERR_OK) {
$uploaded_name = $tmp_file_to_upload['name'];
$tmp_name = $tmp_file_to_upload['tmp_name'];
$destination = realpath(dirname(__FILE__))."images/$uploaded_name";
if (!move_uploaded_file($tmp_name, $destination)) {
die('Error uploading file.');
}
} else {
die('Error uploading file.');
}
}
|
1215e7842fb0a6634962b037b7ed215e6dfdb5f1baa315a8187fcd04ad5533f6 | ['a389091deba24ef9a5a45f7712e1434c'] | I'm trying to learn Django but I need help because I'm having trouble understanding.
how can I iterate through all of my models without having to write for loops for each level of tasks that I have?
Example but like infinite sub tasks:
Task #1
1.1 Subtask #1
1.2 Subtask #2
1.2.1 Subsubtask #3
Task #2
2.1 Subtask #4
.
.
.
.
My model many to many field on itself
class task(models.Model):
name = models.CharField(max_length=100)
notes = models.TextField()
created = models.DateTimeField()
created_by = models.ForeignKey(User)
subtask = models.ManyToManyField('self')
My template
{% for task in items %}
<li>{{ task.name }}
<ul>
{% for subtask in task.subtask.all %}
<li>{{ subtask.name }}</li>
{% endfor %}
</ul>
</li>
{% endfor %}
How can I use a template tag to infinite for loop down tasks
| 34200385d7aa91199dcc9fb09374e3c5ad22233e2766f2247700fe730db8980c | ['a389091deba24ef9a5a45f7712e1434c'] | I'm trying to recurse my list.
but even if I have only one task under another task it runs ERROR maximum recursion depth? Why?
task_recurse.html
{% if items %}
<ul>
{% for task in items %}
<li>
{{ task.name }}
{% with items=task.subtask.all template_name="task_recurse.html" %}
{% include template_name %}
{% endwith %}
</li>
{% endfor %}
</ul>
{% endif %}
task.html
{% include "task_recurse.html" with items=items %}
Task model
class task(models.Model):
name = models.CharField(max_length=100)
notes = models.TextField()
created = models.DateTimeField()
created_by = models.ForeignKey(User)
subtask = models.ManyToManyField('self')
It gives me a error on the view? Is this the problem?
def tasks(request):
items = task.objects.all()
return render(request, 'tasks.html', {'items': items})
So two questions really:
1) Why does this return maximum recursion depth when I only have two tasks where only one task is a subtask ?
2) How can I prevent infinite recursion ?
|
493559f0fd2953360f8f50594079b4ab5fd99f55ee0693e0604833e66c30a560 | ['a39fa63da08f45f1b7d057ba9f245b47'] | I provide an answer that runs in O(h) running time.
class Node {
public int key;
public Node l;
public Node r;
public Node p;
public Node(int key) {
this.key = key;
this.l = null;
this.r = null;
this.p = null;
}
}
public Node preorderNext(Node v) {
if (v.l != null) {
return v.l;
} else if (v.r != null) {
return v.r;
} else {
while (v.p != null) {
if (v == v.p.l) {
if (v.p.r != null) {
return v.p.r;
} else {
v = v.p;
}
} else {
if (v.p.p == null) {
return null;
} else if (v.p == v.p.p.l) {
if (v.p.p.r != null) {
return v.p.p.r;
} else {
v = v.p;
}
} else {
v = v.p;
}
}
}
return null;
}
}
| ba9f06ae480474cb59ad62bc6b81064be258cd792f97bf089fb30d2c6883a433 | ['a39fa63da08f45f1b7d057ba9f245b47'] | Currently I'm learning threads in java. I'm wondering what happens when a thread's run() has returned(which means the thread is dead)? For example:
public class ThreadA extends Thread {
private Thread threadB = new ThreadB();
...
@Override
public void run() {
threadB.start(); //It will take a while to finishes
}
}
...
ThreadA threadA = new ThreadA();
threadA.start()
What will happen to threadA and threadB? Would they be garbage collected? If so, how and when?
|
01bb0baf0d6442d7d77c30eb0ea3765fc54549459f6fd823b78a3192c64faef6 | ['a3abc7dd83bc4c8db9787492d1e7bf79'] | I've solved the problem.
What i did was to change the base in setup.py to : base = None
and I installed the xlsxwriter by following this thread: ImportError: No module named 'xlsxwriter': Error in <PERSON>
After this, I encountered another problem:
No module named: scipy.sparse.csgraph._validation
but I simply add this to the 'includes': ['scipy.sparse.csgraph._validation', ...]
now everything works perfectly.
I hope this helps anyone who has the same problem.
| e0acccc4885a46237d38b90330e580dfec956728d0e28a05da97df993cef3d17 | ['a3abc7dd83bc4c8db9787492d1e7bf79'] | I made an executable gui (with tkinter) file using cx_freeze. The executable has several buttons. When the user click the button, the calculation should work and then it will write out an xlsx file.
Everything went good when I make the executable, there was no error. But when I click the button, it seems like the calculation works (since it was loading), but then it does not write out the xlsx file.
I don't know what went wrong. Anyone can help me?
Here's the setup.py file:
import sys
from cx_Freeze import setup, Executable
import os
import tkinter
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [Executable("gui.py", base=base)]
packages = ["tkinter", 'xlsxwriter', 'matplotlib']
options = {
'build_exe': {
'includes': ["os", "tkinter", 'numpy.core._methods', 'numpy.lib.format', 'xlrd', 'scipy', 'pandas'],
'include_files': [r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tcl86t.dll",
r"C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\DLLs\tk86t.dll"]
},
}
os.environ['TCL_LIBRARY'] = r'C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Users\USERNAME\AppData\Local\Programs\Python\Python36-32\tcl\tk8.6'
setup(
name="Tool",
version="1.0",
description="Tool prototype for calculating",
options=options,
executables=executables
)
|
01521ef3a26fffb2628ae609b3c4cd1a18d7d9a6b509083ff207fcbd6574afcc | ['a3b23d93167249baa1ad96af76898f3f'] | Say, Tables A & B had common column AB and tables B & C had a common column BC, then you could use a query similar to the following (table B would have column AB and BC while A would have just AB and C would have just BC):
select A.*, C.*
from A
join B ON A.AB = B.AB
join C ON B.BC = C.BC
| a2a89cfb6b297184ca208efe8c7a61331842a529bd826e2037d98123a04b9871 | ['a3b23d93167249baa1ad96af76898f3f'] | You need to include the ngRoute module. It was put into its own module a few releases ago.
Make this change and see if it works:
var demoApp = angular.module('demoApp', ['ngRoute']);
You have included the script file for it but have not indicated that demoApp has a dependency on it.
|
1ba5685a5578bd8403952d77fa0a8e4ef8a26a79cc5f0a9dfe70e4ce339951c9 | ['a3b8dbc49e044f37b62462d2c25f1776'] | As <PERSON> said, we have 2 invocation methods:
1) python -m tests.core_test
2) python tests/core_test.py
One difference between them is sys.path[0] string. Since the interpret will search sys.path when doing import, we can do with tests/core_test.py:
if __name__ == '__main__':
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from components import core
<other stuff>
And more after this, we can run core_test.py with other methods:
cd tests
python core_test.py
python -m core_test
...
Note, py36 tested only.
| cbb6482cb6aea5ddc6d9a004e7fd8c9906c80fd284ba11690aefd340843518c1 | ['a3b8dbc49e044f37b62462d2c25f1776'] | Pro: F-literal has better performance.(See below)
Con: F-literal is a new 3.6 feature.
In [1]: title = 'Mr.'
...: name = '<PERSON>'
...: count = 3
...:
...:
In [2]: %timeit 'Hello {title} {name}! You have {count} messages.'.format(title=title, name=name, count=count)
330 ns ± 1.08 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
In [3]: %timeit 'Hello %s %s! You have %d messages.'%(title, name, count)
417 ns ± 1.76 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
In [4]: %timeit f'Hello {title} {name}! You have {count} messages.'
13 ns ± 0.0163 ns per loop (mean ± std. dev. of 7 runs, 100000000 loops each)
|
549aec93922b8c7d7fe04979bdc76564d9f8730770d6701a98202d82d0e7be3c | ['a3baefcb1acd4282bb42e3f2974085fe'] | public void paintComponent(Graphics g) {
Image frstWinBackg = new ImageIcon("new.jpg").getImage();
g.drawImage(frstWinBackg, 0, 0, getWidth(), getHeight(), this);
}
I am drawing an image file as JPanel background through above code. When I make executable jar file of my project, I have to keep that image file in same folder. Is there any way to compact this image file inside jar file as I think providing image file along with jar file is not a good idea.
| 919ce9042a4615bf8f2b6c9ab50d163a5def7bb87d3a970e2b96e0a6d575cdc5 | ['a3baefcb1acd4282bb42e3f2974085fe'] | public void paintComponent(Graphics g) {
Image frstWinBackg = new ImageIcon("new.jpg").getImage();
g.drawImage(frstWinBackg, 0, 0, getWidth(), getHeight(), this);
}
In this code, image file is read inside paintComponent() method. As paintComponent() method can be called several times in a second, it searches for image file every time. So, to make appearing the image, image file has to be kept in the same folder of jar file.
If we don't want to provide image file externally, we must read image inside the constructor and draw it by paintComponent() method.
e.g. In constructor, to read image file:
Image img = ImageIO.read(getClass().getResource("resources/new.jpg"));
Then, paintComponent() method will be:
public void paintComponent(Graphics g) {
g.drawImage(img, 0, 0, getWidth(), getHeight(), this);
g.drawImage(img, 0, 0, this);
}
|
b81fefd817aea0592e5af81d86589dc7f016b041f701a8343918baec4b81eae5 | ['a3beeed614c14c699c489ca6e85303de'] | How do I install Let's Encrypt Certificates on amazon Linux I already have a WordPress website hosted.
Can anyone tell me the steps how do i start with it and what are the commands and what permission I should change and how do i edit ssl.conf and add certificates and auto renew.
| 7e24c8251278d877ea0a03901b4f9c38ed2584cb8a6ba46c9bad39e8d0970d21 | ['a3beeed614c14c699c489ca6e85303de'] | <PERSON> Thanks for you response. My first thought as an alternative is not a real service instance, but rather a Fake. I believe Fake dependencies would still let it be called Unit test. If providing a real instance I agree it would need to be have a configuration without side effects/external deps. Models instances, rather than mocks, can be used in Unit Tests for example. |
475ae55e39d1f99ce3517e2dc0c175b40f26e858b33fb91bc59ae75f92892aa7 | ['a3c1e925f169478aacd474d979294ac9'] | I'm currently using MVC5.
Imagine the scenario where one controller ActionA does its work and the redirects to another controller ActionB but also wants this second method to display a message on its related view.
If Controller ActionA sets the ViewBag.Message and then calls RedirectToAction, when ActionB starts, the value of that Message is gone.
What's the best way to pass a message from one action controller to another, without using Session ??
| 6abac9be594ccacf6e72bf22314e3a21ee677e85b1815d954bc3ec269a951be7 | ['a3c1e925f169478aacd474d979294ac9'] | I'm reading left and right about Async and Task but I still don't get how one can wrap an existing 3rd party call into an async method.
Mainly the 3rd party dll offers a method to call one of their APIs
var client = new FooClient();
var response = client.CallMethod(param1, message);
if (response.RestException != null)
{
status = response.RestException.Message;
return false;
}
else
return true
and this call as expected will block the current thread till it returns the response.
So I looked at Task and other ways to make this call Async but still get the response back cause based on that the application will take different actions.
I kind of feel Task is the way to go but their DLL does NOT have an CallMethodAsSync method so I don't know what to do at this point.
Any help will be much appreciated !!
|
c38063ff59ff586fd0613c3fb39bd2b2966c76475c9d2749b1073ce9ab0e715a | ['a3c3709f6af248de9d47a4ecbb589f55'] | I detected few days ago that my server was under slowloris attack (I found a lot of "-" 408 0 "-" "-" values in my access.log).
I changed my configuration like this:
In mod_reqtimeout:
RequestReadTimeout header=5-20,minrate=20
I installed mod_qos and configured it like that:
QS_SrvMaxConnPerIP 50
QS_SrvMinDataRate 120 1500
Is it enough?
Most of the available tutorial just leave the default values in the configuration files.
I noticed that now the "-" 408 0 "-" values are increased a lot. I suppose that's good because it means that more connection are detected as malicious and it means that they are closed befaure they can "damage" the server. Right?
Can I do something more? Blocking the ips?...
Thanks in advance for any feedbacks!
| 65eb3e11e65fb4ddf62eab208ef0bbbbfdbde8f161f046c11b4330175ab3ac63 | ['a3c3709f6af248de9d47a4ecbb589f55'] | I wanted to assess the feasibility of using a on/off push button controller IC to latch the input ON so the hold down time required is minimal. My battery pack is fairly large and 6uA would take quite some time to kill the battery. I just thought it was odd a basic FET leakage was much less in comparison |
aa2cb6409051a305a02344126cf68b9cb87a6edd5fa426a2c1b8d296c7bdd0b9 | ['a3cec9abb545449794dd6be7fe693141'] |
Let $P(x)$ be a polynomial of degree 4 , having extremum at $x=1,x=2$ and $$\lim_{x\to 0}\frac{x^2+P(x)}{x^2}=2.$$ Then what is the value of $P(2)$?
I worked out the limit using L'Hospital got a relation in terms of second derivative of $P$; the other derivative relations are that first derivatives are zero at 1,2.
How can we interpretate these derivative equations to find the function?
Any help is welcome.
| b86762e105d94c5eb7ff22bfb4dff6202d669979694f3fc6c22c7aee3286b76a | ['a3cec9abb545449794dd6be7fe693141'] | I'm trying to update the retention label and sensitivity label of a file in a SharePoint Online Document Library using CSOM.
I can update the Retention Label using the SetComplianceTag method and it works well. How do I update the sensitivity label? From what I could see online, I use the same method, but when I try and use the same method it just overwrites the retention label and the sensitivity label is unchanged.
Can anyone help?
|
bec11c56e46bf9295e271f500f39554941c73b108f7f6850765e2b7e2502e8d3 | ['a3d8b63f7531483b99f1dd2fa54757d1'] | @DaveyDaveDave maybe I should've stopped the conversation after my "Please don't answer if you don't know what you're talking about" comment. but when you ask 1+1=? and someone answers 3 and they persist on it, I can only replicate by calling them incompetent, call that rude, I call it saying the truth. Answers of the kind only waste the time of the OP and mislead people who might have the same question in the future. The attitude I gave had one goal: stopping the person from misleading people in the future. It's a shame to learn that calling things by their name incur punishment in SOF : / | f65f086eabd535f6946dda2d30d14bc2184aaa25a7611cda740c041fd44dfbb6 | ['a3d8b63f7531483b99f1dd2fa54757d1'] | I'm performance testing the below Javascript code snippet under Firefox, Chrome, and Safari
var f = function(x) {
return Math.sin(x);
}
function testSpeed() {
console.log("test started, please hold on...");
var time = Date.now();
for(var i = 0; i < 1000; i ++) {
for(var x = 1; x < 200000; x ++) {
f(x);//replace by Math.sin(x) here
}
}
console.log("total time = " + ((Date.now() - time) / 1000.0));
}
testSpeed();
The results are:
0.12s under Firefox, same when I replace the f(x) call by Math.sin(x).
5.2s under chrome, same when I replace the f(x) call by Math.sin(x).
7.12s under Safari but surprisingly only 0.56s when I replace the f(x) call by Math.sin(x).
This makes Firefox ~50x faster than Chrome and ~70x faster than Safari, is there any known reason for that?
Also under Safari why does the direct call to Math.sin(x) make a huge difference (~13x faster) compared to the f(x) call?
|
2c56bcf5b0198a96d9f1625732024d71bef8087287323152d4b9a13b3032c2ee | ['a3f486d36ee142f79a25278109c08c7d'] | I am currently receiving 2 e-mails a day asking me to update a Wordpress multisite I once worked on...and I am starting to get desperate!
Things I have tried:
I have changed my email adress both for the admin user and in the general settings.
I have tried adding the following to the functions.php file:
apply_filters( 'auto_core_update_send_email', false);
add_filter( 'auto_core_update_send_email', '__return_false');
apply_filters( 'send_core_update_notification_email', false);
..without any luck.
An obvious solution would be to just update :), but I am hoping to solve this problem once and for all since I am no longer taking this kind of work and have lots of other sites I have worked on in the past.
Any suggestions would be very welcome!
| 88e0d99e1f3070bac965f5339751429bdc4c9406a3deebace8848ef0ad70e520 | ['a3f486d36ee142f79a25278109c08c7d'] | I'm attempting to create a booking calendar using the jQuery UI datepicker.
I want to be able to save all the dates in between a min and max range. Meaning, when the user selects a min date of "04/16/2014" and max date of "04/19/2014" I want to save every day in that range to an array.
Saving just the min and max date would probably not be enough, since there will be multiple min and max dates for all the different bookings.
This array will in turn be used to add a class to those dates as is shown in the code below.
var bookedArray = <?php echo json_encode($bookedDates); ?>;
// function putting dates into the calendar
function bookedDates(mydate){
var pickable=true;
var displayClass ="available";
var checkdate = $.datepicker.formatDate('mm/dd/yy', mydate);
for(var i = 0; i < bookedArray.length; i++)
{
if(bookedArray[i] == checkdate)
{
pickable = true;
displayClass= "booked-date";
}
}
return [pickable,displayClass];
}
// jQuery UI calendar picker
$( "#from" ).datepicker({
beforeShowDay: bookedDates,
defaultDate: "+1w",
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
onClose: function( selectedDate ) {
$( "#to" ).datepicker( "option", "minDate", selectedDate );
}
});
$( "#to" ).datepicker({
beforeShowDay: bookedDates,
defaultDate: "+1w",
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
onClose: function( selectedDate ) {
$( "#from" ).datepicker( "option", "maxDate", selectedDate );
}
});
|
9e370e02e718298e7f54aa166e53f8ee39b7cb2b283ea520e1a487512e14ff02 | ['a3f9e3d864dc44ceb01ae8331cffedb4'] | I have android project where - ListClass has a Listview. Upon clicking on an item of Listview - opens CardFlipActivity with two fragments that are set up to be viewed as pageflip action. I need to play a video on the top fragment and display a image in the bottom fragment of the CardFlipActivity
1) How to pass the strings for the (raw folder video files and image files) from listview item switch position in ListClass to retrieve for display in the fragments of the CardFlipActivity.
ListClass code:
public class ListClass extends ListActivity {
static final String VIDEO_PATH = null;
static final String IMAGE_PATH = null;
static final String VIDEO_NAME = null;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// storing string resources into ArrayList
String[] coronary_pathology_clips = getResources().getStringArray(R.array.coronary_pathology_clips);
ArrayList<String> coronary_pathology_clipsList = new ArrayList<String>(Arrays.asList(coronary_pathology_clips));
// Binding resources ArrayList to CathListAdapter
setListAdapter(new CathListAdapter(this,R.layout.list_item, coronary_pathology_clipsList));
getListView().setBackgroundColor(Color.GRAY);
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
change(position);
}
void change(int position){
String selectedValue = (String) getListAdapter().getItem(position);
Toast.makeText(this, selectedValue, Toast.LENGTH_SHORT).show();
Intent intent = new Intent(getApplicationContext(), CardFlipActivity.class);
switch(position){
case 0 :
String path1 = "android.resource://" + getPackageName() + "/" + R.raw.video1;
String path1a = "android.resource://" + getPackageName() + "/" + R.raw.image1;
intent.putExtra (VIDEO_PATH, path1);
intent.putExtra (IMAGE_PATH, path1a);
break;
case 1 :
String path2 = "android.resource://" + getPackageName() + "/" + R.raw.video2;
String path2a = "android.resource://" + getPackageName() + "/" + R.raw.image2;
intent.putExtra (VIDEO_PATH, path2);
intent.putExtra (IMAGE_PATH, path2a);
break;
}
Bundle dataBundle = new Bundle();
dataBundle.putString("VIDEO_NAME", selectedValue);
intent.putExtras(dataBundle);
startActivity(intent);
}
}
CardFlipActivity Code
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.NavUtils;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class CardFlipActivity extends Activity
implements FragmentManager.OnBackStackChangedListener {
private Handler mHandler = new Handler();
private boolean mShowingBack = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_card_flip);
if (savedInstanceState == null) {
// If there is no saved instance state, add a fragment representing the
// front of the card to this activity. If there is saved instance state,
// this fragment will have already been added to the activity.
getFragmentManager()
.beginTransaction()
.add(R.id.container, new CardFrontFragment())
.commit();
} else {
mShowingBack = (getFragmentManager().getBackStackEntryCount() > 0);
}
// Monitor back stack changes to ensure the action bar shows the appropriate
// button (either "photo" or "info").
getFragmentManager().addOnBackStackChangedListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
// Add either a "photo" or "finish" button to the action bar, depending on which page
// is currently selected.
MenuItem item = menu.add(Menu.NONE, R.id.action_flip, Menu.NONE,
mShowingBack
? R.string.action_photo
: R.string.action_info);
item.setIcon(mShowingBack
? R.drawable.ic_action_photo
: R.drawable.ic_action_info);
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
// Navigate "up" the demo structure to the launchpad activity.
// See http://developer.android.com/design/patterns/navigation.html for more.
NavUtils.navigateUpTo(this, new Intent(this, ListClass.class));
return true;
case R.id.action_flip:
flipCard();
return true;
}
return super.onOptionsItemSelected(item);
}
private void flipCard() {
if (mShowingBack) {
getFragmentManager().popBackStack();
return;
}
// Flip to the back.
mShowingBack = true;
// Create and commit a new fragment transaction that adds the fragment for the back of
// the card, uses custom animations, and is part of the fragment manager's back stack.
getFragmentManager()
.beginTransaction()
.setCustomAnimations(
R.animator.card_flip_right_in, R.animator.card_flip_right_out,
R.animator.card_flip_left_in, R.animator.card_flip_left_out)
.replace(R.id.container, new CardBackFragment())
.addToBackStack(null)
.commit();
mHandler.post(new Runnable() {
@Override
public void run() {
invalidateOptionsMenu();
}
});
}
@Override
public void onBackStackChanged() {
mShowingBack = (getFragmentManager().getBackStackEntryCount() > 0);
// When the back stack changes, invalidate the options menu (action bar).
invalidateOptionsMenu();
}
/*A fragment representing the frontcard.*/
public static class CardFrontFragment extends Fragment {
public CardFrontFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_card_front, container, false);
}
}
/*A fragment representing the back card.*/
public static class CardBackFragment extends Fragment {
public CardBackFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_card_back, container, false);
}
}
}
| 70077b1dad0a97705788955071ad70618d8dc4ba4577647bb964824721f260e9 | ['a3f9e3d864dc44ceb01ae8331cffedb4'] | I have a tab bar project with one tab in the beginning and the view controller has buttons. If a button is tapped - a specific view controller is expected to be added to the tabbarcontroller/tab items. But each time I press the button the same viewcontroller/tab item is being added (multiple tab items of the same). I am trying to limit one tab item for one Viewcontroller, regardless how many times the button is tapped. Any help would be appreciated.
-(IBAction) buttontap:id(sender){
UITableViewController*TableView = [mainStoryBoard instantiateViewControllerWithIdentifier:@"Table A"];
TableView.title = @"Table A";
NSMutableArray *TabBarItems = [NSMutableArray arrayWithArray:self.tabBarController.viewControllers];
if ([self.tabBarController.tabBarItem.title.description isEqualToString:@"Table A"])
{
[TabBarItems addObject:nil];
}
else
{
[TabBarItems addObject:TableView];
TableView.tabBarItem.image = [UIImage imageNamed:@"contents.png"];
}
[self.tabBarController setViewControllers:TabBarItems];
}
|
577a8a8311ac2c86d3ede71ce16cc3e5cd0085f4efa3a53c4731b673bae5bca6 | ['a3fe5b6a0ef443c09c014f8d33ba7651'] | If your script depends on having variable names have hyphens, that's a programming error. If it is convenient for you because of the tools that you regularly use to have the variable names contain a hyphen, you may have to learn more and different tools.
Have you tried using tr to convert the hyphens into underscores?
hyphenated_name="a-b"
unhyphenated_name=$(echo $hyphenated_name | tr '-' '_')
declare -x $unhyphenated_name="some value"
Bash does allow '-' to appear in function names. I do this all the time. For example:
function foo-bar() {
echo "$@"
}
| bff1cf319cbee5f99bbeb4f3d6582efd84dc127668017cfa0d2b3d16db21f82e | ['a3fe5b6a0ef443c09c014f8d33ba7651'] | I agree with <PERSON> answer in general. I would add you need to read the installation docs to know what "make clean" actually does. There can be different levels of clean that you might need to use, such as "make realclean" and "make distclean." There are informal conventions for these, but nothing carved in stone.
|
77b313c2d2e6f45e3bb8a355b124191e654db7421f682fba1d901cb1fb20ffdc | ['a405304e73fd4e62968624a2bf92f2cf'] | Yes, you can do that. You will have to create a wrapper bean around the data source class. Here is an example of how I have done it before. Hope this helps!
<beans>
<bean id="someDao" class="com.dao.SomeDAOImpl">
<property name="datasource">
<ref local="secureDataSource"/>
</property>
</bean>
<bean id="secureDataSource" class="com.ds.SecureDataSource">
<property name="driverClassName">
<value><your driver></value>
</property>
<property name="url">
<value><your url></value>
</property>
<property name="username">
<value><your user id></value>
</property>
<property name="password">
<value><encrypted_pwd></value>
</property>
</bean>
</beans>
Then inside the SecureDataSource class you will need to decrypt the password.
import java.sql.Connection;
import java.sql.SQLException;
public class SecureDataSource extends DriverManagerDataSource{
private String url;
private String username;
private String password;
/**
* @param url the url to set
*/
public void setUrl(String url) {
this.url = url;
}
/**
* @param username the username to set
*/
public void setUsername(String username) {
this.username = username;
}
/**
* @param password the password to set
*/
public void setPassword(String password) {
this.password = password;
}
protected Connection getConnectionFromDriverManager() throws SQLException {
String decryptedPassword = null;
//decrypt the password here
return getConnectionFromDriverManager(url,username,decryptedPassword);
}
}
| 14b810eaa39d4e34f4adc7056faaa03020a4880847fa2d10f95ee300860af692 | ['a405304e73fd4e62968624a2bf92f2cf'] | Since you mentioned you want to do certain things during the deployment I think you can use spring here to perform certain tasks or load something in memory (cache) during deployment. For example in the application context xml you can have this:-
<bean id="someCache" class="com.my.company.MyCache"
init-method="load">
<!-- <property> as needed -->
</bean>
MyCache class could be something like below:-
class MyCache{
public void load() {
//do your deployment work
}
}
|
624a6140f3f9d234cbd58ee1989e95b1200a18fb2edd33103cd12de451c00469 | ['a41a1c1678bb423e9caf57fd6f096419'] | How would I create variable sub-headers in a BIRT list..
The original BIRT list is as follows:
Sys_ID | Sys_Name | App_ID | App_Name
----------------------------------------
S1 | ABR | A1 | ABR: Bim
S1 | ABR | A2 | ABR: Dip
S1 | ABR | A3 | ABR: Saw
S2 | TIP | B1 | TIP: Yop
S2 | TIP | B2 | TIP: gum
S3 | GOO | C1 | GOO: res
I want to implement BIRT to show the following:
Sys_ID | Sys_Name | App_ID | App_Name
----------------------------------------
S1 | ABR | |
S1 | ABR | A1 | ABR: Bim
S1 | ABR | A2 | ABR: Dip
S1 | ABR | A3 | ABR: Saw
S2 | TIP |
S2 | TIP | B1 | TIP: Yop
S2 | TIP | B2 | TIP: gum
S3 | GOO | |
S3 | GOO | C1 | GOO: res
The Sys and App data are all implemented in one BIRT data set.
Can anyone please help?
| 2fa719425afff905fc45eb9073366f1c3963b65646472a01b8c6edf7c26f5ff7 | ['a41a1c1678bb423e9caf57fd6f096419'] | I'm trying to implement an SSRS report without showing repeated subreport headers in each subreport shown in the top-level report, when it runs.
But I still want to show the top-level header on the first header row of the top-level report, the top-level header's columns of which correspond to each subreport's columns of course.
How would I go about implementing this?
|
074984cbca4beda5102d8b1f5ed66445830dcc4ea8eb62170197365163b189cd | ['a4279dab25a643e9889f6d1a9c42ba42'] | Could it be a mistake, that Im operator is not "idempotent", since, if I apply it to a, say, 5+i4, I should get number 4, and since 4 is real, next time I apply Im to 4, I get 0 ? If shown in Cartesian coordinate system, first application of Im will project to imaginary axis, and every next time, there will be no need to "move" dot and it will remain on the same spot on imaginary axis. This seems odd, since from first approach I could conclude one thing and from second approach something else. I am sure there is some flaw in my thinking, and would like to know where. | 13decff679191b5f398fc24868435ac88770d882045306a0e7bed302ae45b476 | ['a4279dab25a643e9889f6d1a9c42ba42'] | Всем привет! У меня есть два файла - .mov и .jpg. Они располагаются в Firebase Storage. У меня есть URL для их загрузки.
Что необходимо -
Загрузить эти два файла и записать их локально. Далее воспользоваться local URL для того, чтобы к ним обратиться. Проблема заключается в том, что реакции на запись нет вообще никакой.
Ниже метод для загрузки из Firebase и записи данных -
func observeLivePhotos() {
let photosRef = Database.database().reference().child("Images")
photosRef.observe(.value) { (snapshot) in
for child in snapshot.children {
if let childSnapshot = child as? DataSnapshot,
let dict = childSnapshot.value as? [String: Any],
let imageURL = dict["imageURL"] as? String,
let placeholder = dict["placeholder"] as? String,
let videoURL = dict["videoURL"] as? String,
let URLimageURL = URL(string: imageURL),
let placeholderURL = URL(string: placeholder),
let URLvideoURL = URL(string: videoURL) {
let livePhoto = LivePhotos(imageURL: URLimageURL, placeholder: placeholderURL, videoURL: URLvideoURL)
self.placeholderImageURL = livePhoto.placeholder
self.videoURL = livePhoto.videoURL
self.mainImageURL = livePhoto.imageURL
//GetVideo
let fileManager = FileManager.default
let urlForDownload = NSData(contentsOf: self.videoURL)
do {
let documentDirectory = try fileManager.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false)
let videoURLPath = documentDirectory.appendingPathComponent("Video.mov")
urlForDownload?.write(to: videoURLPath, atomically: true)
}
catch {
print(error)
}
print(tempPhotos)
}
}
}
}
Смотрел в папке симулятора. Изменения идут только в файлах в папке Preferences. В Documents должно сохраняться, но там ничего, связанного с видео-файлом...
Ошибок никаких нет. Помогите, пожалуйста... Заранее, огромное спасибо :)
|
7ab398f746ea8e5c5ef9fd13b23bef90b11c2f8ad42aa1c21714b158100a9e34 | ['a443d142f77f4aae8761cd2c548777fc'] | Can we do operations on a csv file or sql table without reading the file ,i.e without using read_csv or read_sql_table.
Basically i have a very large files and need to compare both files or tables and delete the common rows.
import pandas as pd
colnames=['email']
data= pd.read_csv("sample",names=colnames, header=None)
data1=pd.read_csv("sample1",names=colnames,header=None)
filter=data[~data['email'].isin(data1)]
I have been doing like this but as i m reading the csv files it is taking lot of time.
So is there any other way to perform this operation like we use "DELETE " operator in sql without reading the file.
Kindly help me please.
| b99c09a4b187b7e9f0622b550deb051dffe81adf47bc63f14e7d9ace624e3de5 | ['a443d142f77f4aae8761cd2c548777fc'] | I was able to pick the records from the mysql table and put them in queue later get them from queue but not able to insert into a new mysql table.
Here i am able to pick up only the new records when ever they fall into the table.
Hope this may help you.
Any mistakes please assist me.
from threading import Thread
import time
import Queue
import csv
import random
import pandas as pd
import pymysql.cursors
from sqlalchemy import create_engine
import logging
queue = Queue.Queue(1000)
logging.basicConfig(level=logging.DEBUG, format='(%(threadName)-9s) %(message)s', )
conn = pymysql.connect(conn-details)
cursor = conn.cursor()
class ProducerThread(Thread):
def run(self):
global queue
cursor.execute("SELECT ID FROM multi ORDER BY ID LIMIT 1")
min_id = cursor.fetchall()
min_id1 = list(min_id[0])
while True:
cursor.execute("SELECT ID FROM multi ORDER BY ID desc LIMIT 1")
max_id = cursor.fetchall()
max_id1 = list(max_id[0])
sql = "select * from multi where ID between '{}' and '{}'".format(min_id1[0], max_id1[0])
cursor.execute(sql)
data = cursor.fetchall()
min_id1[0] = max_id1[0] + 1
for row in data:
num = row
queue.put(num) # acquire();wait()
logging.debug('Putting ' + str(num) + ' : ' + str(queue.qsize()) + ' items in queue')
class ConsumerThread(Thread):
def run(self):
global queue
while True:
num = queue.get()
print num
logging.debug('Getting ' + str(num) + ' : ' + str(queue.qsize()) + ' items in queue')
**sql1 = """insert into multi_out(ID,clientname) values ('%s','%s')""",num[0],num[1]
print sql1
# cursor.execute(sql1, num)
cursor.execute("""insert into multi_out(ID,clientname) values ('%s','%s')""",(num[0],num[1]))**
# conn.commit()
# conn.close()
def main():
ProducerThread().start()
num_of_consumers = 20
for i in range(num_of_consumers):
ConsumerThread().start()
main()
|
6958af54416df8a33a5290066bcf8982c58fcd0e1b4072a6c28514ada2cb2319 | ['a4507e9348a24f4eb30c27a35169c222'] | I am on Lubuntu 18.04 LTS. I want to create a hotspot in a simple way so that I can share my LAN (wired) connection with my Android phone. Tried several method, including manually creating wifi hotspot (edit connection etc.) , but still not successful. At most, my phone is able to authenticate, but getting stuck at "Fetching IP address....." stage.
Please suggest any GUI apps or any script, using which I can easily create the Wifi hotspot.
| 3686e96ed115a0266211b9ad98da5b1f2a0f521f725bbcc7a1563b3e510bf5d6 | ['a4507e9348a24f4eb30c27a35169c222'] | On my Windows 10 laptop, (UEFI Secure boot), I can boot from Ubuntu18:04 live-USB, successfully. I don't actually install Ubuntu ( I choose "Try Ubuntu"). Still, when I reboot (after proper Shutdown and removing USB), I get Windows boot menu with Win-10 and Ubuntu as option. It means, this EFI entry is being created on its own, even if it is just a live-cd session.
Each time, I have to manually remove the EFI boot entry.
How can I avoid this situation ? Please help.
|
78406e3ce178173b0a1dfddef257c3c52b64d88570c18bd528ebabd34cbe4eda | ['a467dd5b8ff2493ebc11abf9b6591f77'] | I don't know how I got the name Trane but the furnace is actually a Payne model# pg8maa036070. I don't know how to check for gas pressure or how much is required. Is there any special equipment I need to check?
Something I forgot to mention is when the furnace starts and the third burner doesn't light, I'll let try a few times on it's own. If that fails, I'll blow hard into the third burner with my mouth and it will light everytime. | 95d1e5133cf9f77567281aacc10cec66fce8be59296425ecfbbc752429064227 | ['a467dd5b8ff2493ebc11abf9b6591f77'] | Thank you for the response! I am thinking about getting a raspberry pi, and based on your answer, I could probably learn a lot just from experimentation with different components. Also, I will be sure to check out the different books you recommended, as they all seem to offer plenty of information towards my question! |
cfbbfa8676d52e8e29b555068593f7ba984aaa65f9ddf516eff996ac05611467 | ['a46d6330eb2347c291401a438d8fc762'] | This may be a silly question. In the sentence 'X was measured with a galvanometer', does the use of the word 'with' instead of 'using' convey the meaning that X was measured along with a galvanometer?
Which of course does not make sense, but to be correct should we not say 'X was measured using a galvanometer'? Or am I wrong and both usages are acceptable in this context? The use of 'with' instead of 'using is very common, as you can see. Which is why I feel this might be a silly question and that I might be nitpicking.
Thanks in advance.
| 3b0787057abc38739b929e028f7b4a58e747af9d12d59ec446a5c1d9dae485dc | ['a46d6330eb2347c291401a438d8fc762'] | I read an article on climate change which used the expression 'extreme high temperature'
Extreme high temperatures set to break records: ANU expert
I understand that 'extreme' can mean extremely low or extremely high. But since the article is using the word 'high', isn't the usage 'extreme high' redundant? So I figured that it must have been a typo, and that the author probably meant 'extremely high'. But just to be sure, I did a Google search and was surprised to find that this usage is quite common.
MWD defines 'extreme' as:
a : existing in a very high degree extreme poverty b : going to great or exaggerated lengths : radical went on an extreme diet c : exceeding the ordinary, usual, or expected extreme weather conditions
2 archaic : last
3 : situated at the farthest possible point from a center the country's extreme north
4a : most advanced or thoroughgoing the extreme political leftb : maximum
5a : of, relating to, or being an outdoor activity or a form of a sport (such as skiing) that involves an unusually high degree of physical risk extreme mountain biking down steep slopesb : involved in an extreme sport an extreme snowboarder
Now, the 'extremely low' aspect is not given anywhere in this definition, but TFD does define it as
Either of the two things situated at opposite ends of a range: the extremes of boiling and freezing.
What I want to know is whether the usage 'extreme high' is correct, and if it is, how is it different from 'extremely high'.
Thanks
|
61d217f6dffb285574928e7351bdd357f03f06e01f9fc01dd2e690faa397f5e8 | ['a4742d9e9650476a8a1680a9c41c768d'] | I shared my solution that I use in my projects. Maybe it helps someone.
pip install django-fake-model
Two simple steps to create fake model:
1) Define model in any file (I usualy define model in test file near a test case)
from django_fake_model import models as f
class MyFakeModel(f.FakeModel):
name = models.CharField(max_length=100)
2) Add decorator @MyFakeModel.fake_me to your TestCase or to test function.
class MyTest(TestCase):
@MyFakeModel.fake_me
def test_create_model(self):
MyFakeModel.objects.create(name='123')
model = MyFakeModel.objects.get(name='123')
self.assertEqual(model.name, '123')
This decorator creates table in your database before each test and remove the table after test.
Also you may create/delete table manually: MyFakeModel.create_table() / MyFakeModel.delete_table()
| c42b22b8113561eeabcbc4973f2debcb0bd0dd71e335b438cf47ce73e0b439e5 | ['a4742d9e9650476a8a1680a9c41c768d'] | I think you may use pre_save signal to validate events count.
I'd add field number to event table and unique key by (user_id, number)
pre_save get last number from events and compare it with quota if last number greater then quote - raise an error
unique index need to ensure that two events won't save parallely
|
f97620ed18427cb3ae0d5f3313814f018368df449667414881138fc2bc2fcb51 | ['a474c0dbff95426ca17dfc1ef9a0e8e7'] | I want to create a PowerShell script to do following
1) Create Login/User in SQL
2) Grant Access to Database
3) Remove Access to Database
Process will be like this
1) Connect to SQL Server (Instance) -> Connect to Database in that instance -> See if Login/User Exist -> if No -> Create login -> Create user -> Grant Access to Database.
Note:
1) User are Windows
2) Sometimes I will like to connect to multiple SQL instance. So script should also check if the mentioned database are present in that instance.
| 51613f50ec37e73b68492e1cdfe03f43f5f8b04f52033b507b676c9203f1714b | ['a474c0dbff95426ca17dfc1ef9a0e8e7'] | I was able to resolve this issue by saving the credentials on the XYZ server and then calling them under my INvoke-Command.
Like This :
$Session = New-PSSession -ComputerName "XYZ"
Invoke-Command -Session $Session -ScriptBlock {
$password = Get-Content -Path D:\Creds\creds.txt | ConvertTo-SecureString
$Cred = New-Object System.Management.Automation.PSCredential ("domain\UserId", $password)
Then the rest of the code. ... .. . . .
}
|
0a2316b82f6624e94fe5abc0f6a7e6729f3009948be36eadc422424e22f56170 | ['a48e633c5fa345eba4572e8bbed5493f'] | If my spring-servlet.xml is
<bean id="defaultAnnotationHandlerMapping"
class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping" />
<bean id="annotationMethodHandlerAdapter"
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
everything is fine.
But the DefaultAnnotationHandlerMapping and AnnotationMethodHandlerAdapter is not adviced.So I change the xml like this
<bean id="defaultAnnotationHandlerMapping"
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
<bean id="annotationMethodHandlerAdapter"
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<bean
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
then there is a mistake 406 (Not Acceptable)
The backstage is good,no error.
Then I delete the
<bean id="defaultAnnotationHandlerMapping"
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
<bean id="annotationMethodHandlerAdapter"
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter" />
everything is good now.
So I want ask If I delete the code is right or wrong?
If it is wrong! How can I fix it?
Thank you,I am looking forward to your answer.
| 6ad10e726637cf1b2d57314494edf2e9e8679ae9547625376f8d2b267f68c4c2 | ['a48e633c5fa345eba4572e8bbed5493f'] | I'm getting the following error. It seems there are multiple logging frameworks bound to sl4j. Not sure how to resolve this. Any help is greatly appreciated.
14:42:35,411 ERROR [stderr] (MSC service thread 1-3) SLF4J: Class path contains multiple SLF4J bindings.
14:42:35,412 ERROR [stderr] (MSC service thread 1-3) SLF4J: Found binding in [vfs:/content/offer-warehouse-processor-api.war/WEB-INF/lib/log4j-slf4j-impl-2.7.jar/org/slf4j/impl/StaticLoggerBinder.class]
14:42:35,412 ERROR [stderr] (MSC service thread 1-3) SLF4J: Found binding in [vfs:/content/offer-warehouse-processor-api.war/WEB-INF/lib/slf4j-log4j12-1.7.21.jar/org/slf4j/impl/StaticLoggerBinder.class]
|
84fc2bfbbf1c037c7274e508d6860bf36407910517b00a10e0df232a8fb4f1d3 | ['a4af4633298d4e4fad6271c39cdcc960'] | I'd say you have two questions to answer:
First, What is the max time you want to spend working? Anything beyond that, book yourself to be somewhere else. Personally, I have to pick up my kids - that's a hard limit on how long I can stay at the office, because I must be at point X by time Y. (And most employers have enough self-awareness to know that "can't you get someone else to pick them up" is a very poor question). If you don't have kids, find somewhere else you need to be. Evening meeting. Classes. What isn't so important as making it clear that this time isn't available.
Second, how much do you value your free time? I'm presuming your contract has some sort of hourly rate (or a flat rate for X hours). If they want to go over that (and you're willing to), how much are you going to charge them for it? Employees get time-and-a-half as a minimum, after all. If you're willing to work for bonus pay and they're willing to pay it, then everyone's happy.
| 11fa8e9facb36d29e093a45108e80d918779433e9e08affbd613efdff6fbced6 | ['a4af4633298d4e4fad6271c39cdcc960'] | Let's look at how a quadrotor flies, then apply that to a trirotor.
Let's assume that we want to remain in a stationary hover position. To do that, you need to balance all the forces: thrust from the propellers vs. gravity, and the torques of each motor.
Each motor produces both thrust and torque according to the equations:
$$
T = K_T\rho n^2 D^4
$$
$$
Q = K_Q\rho n^2 D^5
$$
Where $T$ is thrust, $Q$ is torque, $K_T$ and $K_Q$ are system dependent constants, $\rho$ is the air density, $n$ is rotor speed, and $D$ is rotor diameter.
If you increase thrust then you increase torque, and vice versa. A quadrotor remains stationary by balancing all the forces. This is possible because the quadrotor is symmetrical: two motors spin clockwise, and two motors spin anti clockwise. If all the motors rotate at the same speed then the torques balance, and the thrust balances.
The only question then is what speed? The four rotors need to spin fast enough to collectively generate enough lift to remain in a stationary hover.
What about a trirotor?
Intuitively, the easy base case is when the arms holding the motors are all the same length (such that you can ignore the effects of the motor's displacement from the center of mass). In this case you must set the force of each motor to be equal (to hover without falling) then the torques will be unbalanced (2 in one direction, 1 in the other). The result is a spinning trirotor.
The slightly more difficult case is when the rotor arms are not the same length. To solve that, let's solve the general case. The equation for torque is:
$$
\tau = rFsin(\theta)
$$
$sin(\theta)$ is 1 (at a right angle), so we can ignore it and rearrange our torque equation as follows:
$$
F = \frac{\tau}{r}
$$
Let's make a trirotor and label it as follows:
Then, we can balance all the torques:
$$
\frac{\tau_A}{r_A} + \frac{\tau_B}{r_B} + \frac{\tau_C}{r_C} = 0
$$
Substitute in the motor equation for torque from above:
$$
\frac{ K_Q\rho n_A^2 D^5}{r_A} + \frac{K_Q\rho n_B^2 D^5}{r_B} + \frac{K_Q\rho n_C^2 D^5}{r_C} = 0
$$
And get rid of the common constants:
$$
\frac{n_A^2}{r_A} + \frac{n_B^2}{r_B} + \frac{n_C^2}{r_C} = 0
$$
To solve this equation, we need to make a system of equations with the thrust for each motor:
$$
T_A + T_B + T_C = mg
$$
$$
K_T\rho n_A^2 D^4 + K_T\rho n_B^2 D^4 + K_T\rho n_C^2 D^4 = mg
$$
$$
n_A^2 + n_B^2 + n_C^2 = \frac{mg}{K_T\rho D^4} = C
$$
Where C is some constant. We don't really care what it is as long as it's non-zero (if it's zero then we don't need the motors to do anything).
Now, make our system of equations and solve them:
$$
\frac{n_A^2}{r_A} + \frac{n_B^2}{r_B} + \frac{n_C^2}{r_C} = 0
$$
$$
n_A^2 + n_B^2 + n_C^2 = C
$$
Right away we see that there is no solution except when $C=0$.
Thus, a trirotor needs the servo to rotate at least one motor in order to generate more torque without generating more thrust (in the z direction).
|
12fde3a0fad228e3127e4c61825115a59eaec8a7954327422050669f4c8a13c1 | ['a4afc55acbae491e8d14ccc5447ec6e0'] | @ <PERSON>: I believe you need to check your /etc/xrdpstartwm.sh - the first lines in mine reads,
if [ -f /etc/X11/xinit/xinitrc ]
then
. /etc/X11/xinit/xinitrc
exit 0
fi**
That means that if /etc/X11xinit/xinitrc exists, that file will be executed instead - and it won't help much to add the
. /etc/environment
to /etc/xrdpstartwm.sh. :-)
<PERSON>
| 17a785657d9e96fdffa5a69fc6103a44fc790292691925f1685904d2ce780455 | ['a4afc55acbae491e8d14ccc5447ec6e0'] | I believe the :before pseudo element is placed inside the element but before its content. As such the before element is still a child of that a and will take up space within that element. The underline you are seeing is not part of the :before element but the anchor element.
As such I believe you have to take the :before element out of the natural flow with absolute positioning.
http://jsfiddle.net/KmWL2/
h3 {
display:block;
margin:20px auto;
padding:6px;
width:85%;
text-align:left;
font: 21px 'lucida sans'; color:#444;
border-bottom:#ccc 1px solid;
}
h3 a{
margin:0; padding:8px 4px 0 0;
display:block;
float:right;
width:auto;
text-decoration:none;
font: 14px 'lucida sans';
position: relative;
}
h3 a:hover{ text-decoration:underline; }
h3 a:before{
content: '+';
margin:0;
padding: 4px;
position: absolute;
left: -15px;
top: 3px;
}
h3 a:hover:before{ text-decoration:none; }
|
0f5148982931d33fb3988b9255beabadd9c8d519b28224fc4c3b7a8afb8c271b | ['a4c047d2d31a4117aa964e0ad2d98e76'] | I have this simple project to do. This is the code I have so far, it works perfectly fine. But if someone types in a letter or an unknown symbol, the program crashes. How can I make this error proof and display or print a message if the wrong thing is entered?
def excercise5():
print("Programming Excercise 5")
print("This program calculates the cost of an order.")
pound = eval(input("Enter the weight in pounds: "))
shippingCost = (0.86 * pound) + 1.50
coffee = (10.50 * pound) + shippingCost
if pound == 1:
print(pound,"pound of coffee costs $", coffee)
else:
print(pound,"pounds of coffee costs $", coffee)
print()
excercise5()
| e82d1efa8e9eea1ea83bebddb63fe0970e5b18871a00f251ce8031e299f5cc25 | ['a4c047d2d31a4117aa964e0ad2d98e76'] | This is the problem I have to solve : Write a program to sum a series of numbers entered by the user. The program should first prompt the user for how many numbers are to be summed. It should then input each of the numbers and print a total sum. This is what I have so far:
def excercise13():
print("Programming Excercise 13")
print("This program adds a series of numbers.")
while True:
try:
numberTimes = float(input("Enter how many numbers will be added: "))
except ValueError:
print("Invalid input.")
else:
break
numberTimes = int(numberTimes)
while True:
try:
for i in range(1,(numberTimes+1)):
("""I don't know what to put here""")
except ValueError:
print("Invalid input.")
else:
break
totalSum =
print("The sum of",nums,"is:",totalSum)
print()
excercise13()
|
9c87a1a1bfb5c15b89f6486784bb1eb8272fd2682145afa2531220e7d57d1716 | ['a4ce9dd769a24f86940135bcc508f82b'] | My understanding is that Random forest itself is a regularization method for decision trees by repeating various forms of decisions trees and have some fitting better to some data and other fitting better to others. My question was why don't we just apply regularization at each node of a single decision tree.n | 283e41c801663c4f8062b82a59c7e30d3e467a6354b2ddc78377fad9d4a2aed0 | ['a4ce9dd769a24f86940135bcc508f82b'] | This problem involves logic-based math, I tried making truth tables for this problem but I don't think you can because there are 9 doors!
Below is what I came up with but I want to know if there is a better way of figuring this out.
Base on the tip from the hostess, there is something behind door8; then it is either 1 dollar or the price; since the sign on the price door is always true; therefore Door8 can only be false with \$1 behind it.
Since door8 is false, then there is something behind door9. Similarly, door9 can only be false with \$1 behind it.
Since door9 is false, door6 is true.
Since door6 is true, door3 is wrong.
Since door3 is wrong, then door5 is wrong, and door7 is true.
Since door5 is wrong, door2 is wrong, and door4 is wrong.
Since door7 is true, the Prize is behind door1.
Since door2 is wrong, there is something behind door2; it is \$1 since the sign is false.
Since door4 is wrong, the sign on door1 is true.
Base on the information above, we can create a table for all the doors.
Since sign on door one is true, and sign on door 6 is true, then there is nothing behind door 6 and 7.
Door 3/4/5 can be either \$1 or nothing.
|
8c18f3558681ff2e60a2f3c0f55f3aac6c1d3f712f5f9bb33cec8773c0b87f93 | ['a4d0b502cbb84d40bb36c6d4ce6000c7'] | I get a csv file has data like below:
> "value","name"
> 403.375,"C1"
> 409.625,"C1"
> 300.5,"C11"
> 321.125,"C11"
> 740.25,"C2"
> 718.875,"C2"
> 303.25,"Q"
> 323,"Q"
> 146.875,"H1"
> 171.75,"H1"
> 210.875,"H2"
> 234.625,"H2"
> <PHONE_NUMBER>,"CQ1"
> 1742.5,"CQ1"
> 2319.875,"CH1"
> 2449,"CH1"
> 1227.25,"CH2"
> 1157.375,"CH2"
> 781,"CQ1.1"
> 715.125,"CQ1.1"
> 713.125,"CH1.1"
> 670.25,"CH1.1"
How can I get the mean of values by names, like this:
> "mean","name"
> 406.5,"C1"
> <PHONE_NUMBER>,"C11"
> ... ...
and get the barplot to show mean labels by name in R?
| cbb4b4d04794b72f569190c273963cf531cdb73bdced0a9acf55c2b4c2d4a8cc | ['a4d0b502cbb84d40bb36c6d4ce6000c7'] | I have two vector a, b. I wanna compare the size of them. I know I can use if (a.size() > b.size()). But my question is if the size are too big out of the type int for a or/and b. For example, a.size() is 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999, etc. How can I compare the sizes of a and b? sorry for my English.
|
f1de1c094654e3a8b0989ab097cb3da87c24fc363900b4f73c762586395830dc | ['a4d49d991ac64be4a6f58bfaaf5e15d5'] | One way, is to construct an ArrayList named equalOrLower let's say, and whenever it is computers time to choose, a new ArrayList is created, which will store all the enemy possible cards whose value is less than the players number. The enemy (computer) can then only choose a value from the newly created ArrayList.
int playerNumber = 5;
int[] enemyPossibleCards = {1,2,6,4,9};
ArrayList<Integer> equalOrLess = new ArrayList<>();
equalOrLess.clear();
for(int i = 0; i < enemyPossibleCards.length; i++){
if(enemyPossibleCards[i] < playerNumber)
equalOrLess.add(enemyPossibleCards[i]);
}
This is some example code to help you understand my answer. The ArrayList will be cleared every time the function is called in order to make sure the previous values are deleted. Please reach out if you have any further questions :)
| a517b23987749db57739ac1b30476f1fb9ac19b20b4c54b1eb81e2277d009b09 | ['a4d49d991ac64be4a6f58bfaaf5e15d5'] | I have the following yup check:
nrOfApples: yup.number().min(0).max(999),
And right now if I leave the field blank, it validates as false. Is there any way to make yup.number() accept empty values? I have tried:
yup.number().nullable()
But it doesn't seem to work. Any ideas on how I can make such thing happen?
|
5f4ce9f365555021f6739dc9f30e9b019e1d37a61aafc695da427c6568203a31 | ['a4e93ab7cbc645fab6a2bf0cc8433f5e'] | I want to find the nearest neighbor of the output compared to the training set based on this framework: https://github.com/carpedm20/DCGAN-tensorflow
(I asked already generally in this post: Generative Adversarial Network: How to find the most similar image to the output within the training samples? with the answer:
"The best approach is probably to find nearest neighbors in a compressed representation space such as the latent code vector of a convolutional autoencoder.")
Now, I want to know, how to do that practical based on the DCGAN (see GitHub).
Has somebody an idea how to find the nearest neighbors? Where can I find a compressed representation space such as the latent code vector?
| 5de447344c629ad9e6f830bcfcd597032783fd006d8e9a6f3eb2c0805e24e920 | ['a4e93ab7cbc645fab6a2bf0cc8433f5e'] | Even though the user is the same uid=2000(shell), still the output of group is very different when run on adb shell (rooted device) than on serial console.
So it seems that through adb shell the user belongs to more groups than when logged in on a serial console.
On other Linux systems it is the opposite - you have more rights when on serial console, since apparently you have direct physical access, but on Android (at least on Oreo) it does not seem logical, since adb can run over Wi-Fi for example.
What is the idea behind such decision?
|
25e1e7f9237422e72205ca535c0621dba250e4dcd88495d1c8cc1d2959f14b46 | ['a4ee3be2e024457b9e7c86cb33ed8725'] | I want to fit a distribution.
If I have a dataset I can do it quite easy:
library("fitdistrplus")
data_raw <- c(1018259, 1191258, 1265953, 1278234, 1630327, 1780896, 1831466, 1850446, 1859801, 1928695, 2839345, 2918672, 3058274, 3303089, 3392047, 3581341, 4189346, 5966833, 11451508)
fitdist(data_raw, "lnorm")
This is what I would do to fit a lognormal distribution to my dataset.
But what if I don't have a dataset just the mean, standard deviation and some quantiles. For example:
Mean: 2965042
std.dev: 2338555
Quantiles:
0.1: 1251014
0.5: 1928695
0.8: 3467765
0.9: 4544843
0.95: 6515300
0.999: 11352784
How would you proceed to fit an estimation for this kind of data?
Thank you and best regards
<PERSON>
| 50576bcd83a2f80ead6f6358a7ac8bfc89c006c250aa0a2bc3fb7ff2cf197a8a | ['a4ee3be2e024457b9e7c86cb33ed8725'] | I am trying to do a lognorm distribution fit but the resulting paramter seem a bit odd. Could you please show me my mistake or explain to me if I am misinterpreting the parameters.
import numpy as np
import scipy.stats as st
data = np.array([1050000, 1100000, 1230000, 1300000, 1450000, 1459785, 1654000, 1888000])
s, loc, scale = st.lognorm.fit(data)
#calculating the mean
lognorm_mean = st.lognorm.mean(s = s, loc = loc, scale = scale)
The resulting mean is: 945853602904015.8.
But this doesn't make any sense.
The mean should be:
data_ln = np.log(data)
ln_mean = np.mean(data_ln)
ln_std = np.std(data_ln)
mean = np.exp(ln_mean + np.power(ln_std, 2)/2)
Here the resulting mean is 1391226.31. This should be correct.
Can you please help me with this topic?
Best regards
<PERSON>
|
0c47ad784933da77abc387aa4c4c3b49bc9beaeb172f826e290f819f99afa597 | ['a4ee7d143d8048858245b56ab44f0540'] | In our project, we are using Selenium Web driver to automate web application.For one of the application, we need to submit a mainframe jobs and then only a data will be available for next application.
As we were not able to automate mainframe jobs, there is always gap between two application and we were not able to achieve end to end scenarios.
Does anyone have any idea on automating mainframe session using JAVA/Web Driver.
I came to know about Jameleon/Jagacy Driver. But not much information is available.
Its really helpful to me if someone share thoughts on achieving this.
| bac62cab67029734cc404d16dfb68934f733eff3899e50d9cebde7978db11d5f | ['a4ee7d143d8048858245b56ab44f0540'] | I want to get URL in LI tag through X PATH and Validate these URL based on its response code.
Could someone help me to get URL from below and to validate URL using response code.
<li class="menu-link divider">
<a onclick="getSearchOption('Amazon.com','http://www.amazon.com/s?url=');"></a>
</li
|
d1f7fd18c06570ef1ea9321c6ac6a8986ee780c1f0989dcfbcac593546af149d | ['a4f09906d4564e5883a33d2d7e72f3cf'] | I am currently working on a project which has a number of background tasks that get executed. Each task created and then sent to a concurrent service which manages the execution process of all tasks. Each task is stored in a database table during the length of its execution.
My dilemma is that each task performs very specific functions, and in general most delegate to a service in another part of the system, the brunt of the work is done, and then the task returns.
Currently I have a very simple system implemented which tracks the progress of task, it works well, however each task that is executed needs to add a lot of extra code to accommodate the functionality on the services it delegates to.
So to as an example my task would have a method:
@Override
public void execute() {
service.calculateAverage();
}
And then correspondingly in the service:
public float calculateAverage() {
float total = 0.0f;
for (i = 0; i < 20; i++) {
total += i;
}
return total / 20;
}
Tracking the progress of this is fairly simple, I just update my task in the database after it has gone past a certain threshold of iterations. However, to generify this is proving to be quite a task, as each task that is executed might delegate to a different service entirely. This means in each service I need to add code specific to the implementation for that service.
I have done a bit of searching and I can't seem to find any good patterns that can help with creating a generic system for tracking the progress of each task. Any pointers or even just places to look or read-up on would be good.
| 32878f1e721a74386506137fc345968698e3b5b9128caf141b5aa5edb058a8eb | ['a4f09906d4564e5883a33d2d7e72f3cf'] | As far as C++ goes, there won't be any issues with using one header file and splitting the actual implementations of the functions between 2 files. However this strays from convention, if you need functions from "Second.cpp" in "First.cpp" perhaps you should look at what is happening in each one and maybe the functionality should be separated into another file.
As personal preference I say you should stick to having one cpp file for each header file. Splitting the implementation is just going to cause headaches later if you need to refactor or move the implementation again.
|
de04e9d331683a99cdd0cdf86dabdb951cec65a32942cd38f6e640e45654dbff | ['a5000e3ab7e7453598878801c95dff57'] | Hello Forum, while working with CI 2.0.3 and internationalization (i18n) library, i’ve run into this problem. I’ve read similar posts here, but they did not solve my issue. Hope somebody here can point me into the right direction.
The routes.php:
$route['default_controller'] = "home";
$route['404_override'] = '';
$route['scaffolding_trigger'] = "";
// '/en', '/de', '/ru' URIs -> use default controller
$route['^(en|de|ru)$'] = $route['default_controller'];
// URI like '/en/about' -> use controller 'about'
$route['^(en|de|ru)/(:any)'] = "$2";
This works perfectly, but i have an area called “blog”, inside the Blog CI_Controller is a function that grabs an article from database:
public function article()
{
$this->db->where('id', $this->uri->segment(4));
$data['query']= $this->db->get('blogentries');
$this->load->view('article_view',$data);
}
Wonderful, works also. The result is an URL like /en/blog/article/1.
In the language files i have my variables saved like this:
$lang['menu.blog'] = "Blog";
In the blog view the $lang variable is loaded:
<?=lang('menu.blog')?>
The problem occures while opening an article, the var from the language file is not loaded at all. http://localhost/ instead of “Blog”. I guess it has to do with the routing. So if for an URL like /en/blog i would have:
$route['^(en|de|ru)/(:any)'] = "$2";
All other URLs work perfectly and load the variables from the language file correctly.
But how can i handle URLs like /en/blog/article/1? Am i thinking in the right direction?
Suggestions are appreciated.
Thank you.
| 23afe8bad90eb03926240cf73420cece6f530ee06ba242caa40500744bb4cc19 | ['a5000e3ab7e7453598878801c95dff57'] | Suddenly get stuck into this mode
After hours of working on a doc, I've CMD+TAB'ed out of the doc and suddenly come back to this. It's happened before and after some clicking around, I went to Review > Protect Document (which was enabled somehow) and that fixed.
However, now it won't work. I desperately need help. I'm not sure even what mode this is, it shows super wide pages, can't select text properly.
|
476a1f7766729d33b35c81925f4acd2ba8ecf7b8cf8f5e403a6a79da300b9f14 | ['a505f6739f904155833dced663ea3b75'] | I am trying to add values to the saml:AttributeValue elements of this xml document:
<saml:AttributeStatement xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">
<saml:Attribute Name="FNAME">
<saml:AttributeValue></saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="LNAME">
<saml:AttributeValue></saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="Gender">
<saml:AttributeValue></saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="UniqueID">
<saml:AttributeValue></saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="DateOfBirth">
<saml:AttributeValue></saml:AttributeValue>
</saml:Attribute>
<saml:Attribute Name="ClientID">
<saml:AttributeValue></saml:AttributeValue>
</saml:Attribute>
Using this c# code:
//get the AttributeStatement node
XmlNode attrs = assertion.SelectSingleNode("//saml:AttributeStatement", ns1);
//get the Attribute nodes within the AttributeStatement node
XmlNodeList attr = attrs.SelectNodes("//saml:Attribute", ns1);
//foreach node in the Attribute node list get the AttributeValue node and add an innerText value
foreach (XmlNode xn in attr)
{
XmlNode attrValue = xn.SelectSingleNode("//saml:AttributeValue", ns1);
switch (xn.Attributes["Name"].Value)
{
case "FNAME":
attrValue.InnerText = UserInfo.FirstName;
break;
case "LNAME":
attrValue.InnerText = UserInfo.LastName;
break;
case "Gender":
attrValue.InnerText = UserInfo.Email;
break;
case "UniqueID":
attrValue.InnerText = UserInfo.UserID.ToString();
break;
case "DateOfBirth":
attrValue.InnerText = UserInfo.UserID.ToString();
break;
case "ClientID":
attrValue.InnerText = UserInfo.UserID.ToString();
break;
default:
attrValue.InnerText = "No attribute listed";
break;
}
//output each AttributeValue innerText.
lblTest.Text += attrValue.InnerText + " ";
}
The lblTest is displaying how I would expect - with the correct values for all 6 elements, but the document is not displaying any values at all. Is this the correct way to loop through and add these values to nodes?
| 82b9100345bc839b835df1ab6421fe0d8eb8a7311e2828ce2ad194f07d0941ff | ['a505f6739f904155833dced663ea3b75'] | The issue was not so much on the xsl side of things, but on how aspdotnetstorefront used the data. I got around my particular problem by modifying the procedure outlined here: http://forums.aspdotnetstorefront.com/showthread.php?17159-Display-Product-s-Mapped-Categories-on-ShowProduct-aspx-simpleproduct-xml-config
Thanks
|
82e11b4ef4f817268594c061764616e64e977b8ea91aadc66603428109182031 | ['a507c07136c84ce8810e1057c8776179'] | I want to select an image id every 24 hours . for example at special time like 12 a.m , i able to select a random id to set it to my imageview.
I know to use alarm manager , but I do not know how to use it.
here I just selected my random id like this ans set to SharedPreferences and finally it get it.
i want to this every 24 hours.
would you please help?
I am new with android.
private void setBG(int bg) {
SharedPreferences.Editor share1 = getSharedPreferences("share1", Context.MODE_PRIVATE).edit();
share1.putInt("bg", bg);
share1.commit();
}
private int getBG() {
SharedPreferences share1 = getSharedPreferences("share1", Context.MODE_PRIVATE);
return share1.getInt("bg", R.drawable.pg19);
}
private void showBGS() {
Random rand = new Random();
int rndInt = rand.nextInt(18) + 1;
String drawableName = "pg"+ rndInt;
int resID = getResources().getIdentifier(drawableName, "drawable", getPackageName());
setBG(resID);
}
| b5b0a5e5330c2edb34d7914aad847b8220e77c522bff0c2b4f6aa3e993402ed7 | ['a507c07136c84ce8810e1057c8776179'] | In my project I had some music in raw . I can read them and play them easily in this way :
Field[] fields = R.raw.class.getFields();
for (int i = 0; i < fields.length - 1; i++) {
SongInfo info = new SongInfo();
try {
String name = fields[i].getName();
if (!name.equals("ringtones")) { info.setFileName(name + ".mp3");
info.setFavorite(pref.getString(info.getFileName()));
int audioResource = R.raw.class.getField(name).getInt(name);
info.setAudioResource(audioResource);
}
info.setName(name);
} catch (Exception e) {
// TODO: handle exception
Log.e("LOG", "Error: " + e.getMessage());
}
listSong.add(info);
NOW I PUT MY MUSIC IN ASSET FOLDER ,and change my code like this (i read them from ASSET):
String[] files = context.getAssets().list("mp3");
for (int i = 0; i < files.length ; i++) {
SongInfo info = new SongInfo();
String name = files[i];
name = name.substring(0, name.length() - 4);
if (!name.equals("ringtones")) {
info.setFileName(name);
info.setFavorite(pref.getString(info.getFileName()));
//int audioResource = R.raw.class.getField(name).getInt(name);
//info.setAudioResource(audioResource );
}
listSong.add(info);
}
now I can read them from asset corretly ,but just for playing them ,I need int audioResource.(the lines that are comment)
How to access to this int audioResource?
How to getInt(name) from asset?
any suggestion?
|
b696a44aec01382437c0167377c6711d4e96ccff32b405e1ce9415baa878c72b | ['a512160b4b9b43b190013dc7daa0d70e'] | por isso que estava querendo concatenar a minha lista com um {{ forloop.counter0 }} pois dessa forma resolveria o meu problema, "creio eu skaoskaosko" pois quando eu acesso a lista dessa forma `{{ list.0 }}` ele me retorna só o primeiro item da `array`, e se pra cada loop eu tiver um `i++ do counter` talvez resolvesse meu problema, <PERSON> ? | c29f697d85e0f0bd6bc4636d74d1599772b14c8cdd25339978dbedd67d283245 | ['a512160b4b9b43b190013dc7daa0d70e'] | Well, I did finally figure out what was going on, and I'll post it here even though no one ever responded to me... but this might help someone down the road, so here goes.
Basically, the problem WAS in my firewall. Specifically in the Intrusion Detection section.
Detect TCP probes
Block sites probing TCP ports
Detect UDP probes
Block sites probing UDP ports
These four were checked, and every time a machine would search for another machine on the LAN, its IP would show up on the "blocked" listing. I simply added the internal Lan IP range to the "addresses to ignore" box. |
c6d2e900a25af93bbc70ddc8ceb103f5cba8f5349a09f016a4fad91ebdbb8155 | ['a530ab9d7387445f9e9c8f6aec07b5b3'] | user_word = input("guess a word: ")
with open("C:/Users/Callum_test/Documents/Python/dog.txt") as dictionary:
if user_word is dictionary.read():
print("Well done, you got a", len(user_input), "letter word")
else:
print("That's not a word!")
Hello,
I've created the above code but for some reason it can't find the word in the file? I've not done anything like this for a while and have no idea how to get it working. The code functions seemingly fine but no input is found in the text file.
thanks,
<PERSON>
| 2623a1ebcd4bee364a9bc37cd9e8d0acfd6da4748f5847a8665fd0b05f80a52e | ['a530ab9d7387445f9e9c8f6aec07b5b3'] | I have created this code to get 3 different options in 3 different places. Its actually a flash card program i hoped to get working but I can't. It goes into a endless loop and i have no idea why. There may also be other problems but i havent got to them yet but please tell me anyway. Keep the sam var names so i can understand easily. I have attached all the code. They is some more but its not been implemented yet.
There is also 3 lists each with 14 items but these won't go into code:
key_words = ['Cellulose', 'Respiration', 'Haemoglobin', 'Ventilation', 'Cartilage', 'Cytoplasm', 'Nucleus', 'Alveoli', 'Amino acids', 'Virus', 'White blood cells', 'Photosynthesis', 'Stomata', 'Vaccine', 'Fibre']
defs = ['Tough substance that makes up the cell walls of green plants', 'A chemical reaction that causes energy to be released from glucose', 'A substance which joins to oxygen and carries it round the body in the blood', 'Breathing', 'Tough, smooth substance covering the ends of bones to protect them', 'Jelly-like part of a cell where chemical reactions happen', 'Controls what happens inside a cell', 'Tiny air sacs in the lungs', 'Produced when proteins are digested', 'The smallest type of microbe', 'Can engulf bacteria or make antibodies', 'The process of turning carbon dioxide, water and light into glucose and oxygen', 'Small holes in the underside of a leaf', 'Dead or inactive forms of a microorganism', 'A nutrient that cannot be digested']
completed = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
thanks
<PERSON>
import random
option1 = random.randint(int(1), int(14))
option2 = random.randint(int(1), int(14))
option3 = random.randint(int(1), int(14))
while option1 == option2 or option1 == option3:
placement1 = random.randint(int(1), int(3))
while option2 == option3:
option2 = random.randint(int(1), int(3))
placement1 = random.randint(int(1), int(3))
placement2 = random.randint(int(1), int(3))
placement3 = random.randint(int(1), int(3))
while placement1 == placement2 or placement1 == placement3:
placement1 = random.randint(int(1), int(3))
while placement2 == placement1 or placement2 == placement3:
placement3 = random.randint(int(1), int(3))
print('What is the correct defenition for', key_words[option3])
place3 = 1
if placement1 == 1:
print('1: ', defs[option1])
elif placement1 == 2:
print('1: ', defs[option2])
elif placement1 == 3:
print('1: ', defs[option3])
place3 = '1'
if placement2 == 1:
print('2: ', defs[option1])
elif placement2 == 2:
print('2: ', defs[option2])
elif placement2 == 3:
print('2: ', defs[option3])
place3 = '2'
if placement3 == 1:
print('3: ', defs[option1])
elif placement3 == 2:
print('3: ', defs[option2])
elif placement3 == 3:
print('3: ', defs[option3])
place3 = '3'
choice = str(input('Enter 1, 2 or 3: '))
if choice == place3:
print('Well done, correct.')
a = completed[option3] + 1
completed[option3] += 1
else:
print('Inccorect. Have another look and we`ll come back later.')
|
fb507462f6102843dfa8e43cabf0eb2797cc7537542f2f004099253fa274186a | ['a54028c0956e4087893ece452059c326'] | The above tends to be more common, though it is rarely clarified. Thank you for pointing this out.
In addition to the above ambiguity, there is also some disagreement on how the folds should be treated in per-fold models. In the answer, I suggested that "each model is built using four of the chunks as a training set, and one as a testing set." Another approach is to use one chunk for training and the rest for testing. This should produce worse estimates and more variance between the folds, but sets a more rigorous requirement for consistency and is computationally cheaper. | e339f09bd22417c15f56784812e777d610285882e1961000fc828f9e3853e269 | ['a54028c0956e4087893ece452059c326'] | Lots of ways to cut this cake, some context would help. One way is to look at proportion of individuals within each group who moved from X to Y on a given question. Picking the X and Y should be based on the initial hypothesis and context it provides. You could also abstract away the magnitude of the changes and just look at the direction if that's more relevant. You could also compare between groups.
Once you have the numbers, you can test for whether the changes within each question are statistically significant, though expect very large intervals with such small samples. |
6ce256eb6675e7100fac722f8140049536aa05e26f3c955abd525ab9bd30f3d1 | ['a5444f2bff6e472dbf9882d06588d46b'] | There is at least one situation that only
getSystemService(Context.LAYOUT_INFLATER_SERVICE);
must be used instead of the counterpart
getLayoutInflater
That situation is in an arbitrary object class. For example, I have an instance of class call objectA. In objectA, I want to inflate a view onto the parent view (happen in ArrayAdapter that inflates customized row on the its listview.) In this case, context.getLayoutInflater does not work since there is no activity or windows associated with the context. Only getSystemService(Context.LAYOUT_INFLATER_SERVICE) is appropriate then.
| 53d7d8fa5e1473d7b4b3e4a0233df483c08128ae61cd4bde3dae5303cb3d652d | ['a5444f2bff6e472dbf9882d06588d46b'] | I am having an issue about generating Android KeyHash with debug.keystore that I don't quite understand.
What I understand is that if I generate a KeyHash on my PC no matter how I generate it, it should give me a unique keyhash. And I can bring this keyhash for integration with Facebook SDK.
However, what I found out is the following:
I use the following command line suggested on Facebook developer page:
keytool -exportcert -alias androiddebugkey -keystore %HOMEPATH%.android\debug.keystore | openssl sha1 -binary | openssl base64
with password: android
And I obtained the following keyHash : E3P3dslAkuReIuFQJC5oTlhkRrs=
I then use the following method I found on StackOverflow:
In order to generate key hash you need to follow some easy steps.
1) Download Openssl from: here.
2) Make a openssl folder in C drive
3) Extract Zip files into this openssl folder created in C Drive.
4) Copy the File debug.keystore from .android folder in my case (C:\Users\SYSTEM.android) and paste into JDK bin Folder in my case (C:\Program Files\Java\jdk1.6.0_05\bin)
5) Open command prompt and give the path of JDK Bin folder in my case (C:\Program Files\Java\jdk1.6.0_05\bin).
6) Copy the following code and hit enter
keytool -exportcert -alias androiddebugkey -keystore debug.keystore > c:\openssl\bin\debug.txt
7) Now you need to enter password, Password = android.
8) If you see in openssl Bin folder, you will get a file with the name of debug.txt
9) Now either you can restart command prompt or work with existing command prompt
10) get back to C drive and give the path of openssl Bin folder
11) copy the following code and paste
openssl sha1 -binary debug.txt > debug_sha.txt
12) you will get debug_sha.txt in openssl bin folder
13) Again copy following code and paste
openssl base64 -in debug_sha.txt > debug_base64.txt
14) you will get debug_base64.txt in openssl bin folder
15) open debug_base64.txt file Here is your Key hash.
with password: android
And I obtained the following keyHash : zp+a+1HT9jLTgob9Htw9EFrZatY=
Both of these methods are generated on the same PC and with the same debug.keystore. Why are they not the same? Aren't they supposed to be the same?
Another issue is KeyHash I obtained with an android code on different phones. I use the following code (again found on the StackOverflow):
public static void showHashKey(Context context) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
"com.example.loginfb", PackageManager.GET_SIGNATURES); //Your package name here
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.i("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}
} catch (NameNotFoundException e) {
} catch (NoSuchAlgorithmException e) {
}
}
Then I checked on the log window with two different phones, what I found is the following:
LG phone Android 2.3
12-09 09:22:51.832: I/KeyHash:(20572): NlsbfhmR2/ZCXnpKNNsH+0II8LM=
Samsung phone Android 4.2.2
12-09 09:51:21.054: I/KeyHash:(20067): zp+a+1HT9jLTgob9Htw9EFrZatY=
They gave me different HashKeys. However, one of them (zp+a+1HT9jLTgob9Htw9EFrZatY=) is consistent with the second method above.
Anyone knows what is happening here? I am really confused for quite some times.
Thanks for any response.
|
b51f67daea8a3f5482173d0e1238ef468698bebdae716a592a55afa1054bbbdd | ['a55c1dbbac434543bfe8ad3285468443'] | I would like to install Linux on PC through USB flash drive. But there is already old operating system. I want to clean HDD using command line. In windows, I just use diskpart > list disk > select disk > clean. Is there any way to clean HDD as easy as Windows does?
| e061df3d2b5d8bf7467893a577fd945a27449ee3c15cd4830f5beb97dcc42841 | ['a55c1dbbac434543bfe8ad3285468443'] | I made a simpe AutoIt Script to deploy Categories
#include <File.au3>
#include <Array.au3>
$sFilePath="Kategorien.csv"
$outlook = ObjCreate("Outlook.Application")
If Not @error Then
$ns = $outlook.getnamespace("Mapi").categories
Local $aArray[1][3]
_FileReadToArray ( @ScriptDir&"\"&$sFilePath,$aArray, 2,";")
$Anzahl=UBound ($aArray) -1
ProgressOn("Outlook Kategorieimport", $sFilePath &" wird Importiert ", "0%")
For $i = 1 to $Anzahl
$aArraySub=$aArray[$i]
$Name=StringReplace($aArraySub[0],'"','')
$Color=StringReplace($aArraySub[1],'"','')
$ShortcutKey=StringReplace($aArraySub[2],'"','')
$ns.add($Name,$Color,$ShortcutKey)
$pc=100/$Anzahl * $i
ProgressSet(round($pc,0), round($pc,0) & "%")
Sleep(500)
Next
ProgressSet(100, "Fertig", "Ferig")
Sleep(500)
ProgressOff()
Else
EndIf
Import File: Kategorien.csv
"Name";"Color";"ShortcutKey"
"Kategoriename";"1";"0"
|
4aa65526fc80211caaa72352700c8e413b6f1436b279c66640ba754eb8693483 | ['a55ca3922ca34c0384e08cda9851cf60'] | Highlight the variable and then press Control+Shift+G or Right Click->References->Workspace will get you all of the references of a particular variable, and you can see where it was assigned or passed as an argument that way. It will show up in a window on the bottom, and a double click will take you directly to the reference.
| cc9d2a364615539e8ec74962593e9cd462db5ad47747067a05a3d105aacb1ab1 | ['a55ca3922ca34c0384e08cda9851cf60'] | If you're talking about redefining an actual type system, like making a statically typed language dynamic or making a weakly-typed language strongly-typed, then no.
Practically every language lets you define your own types, so I don't think that's what you meant either.
The only thing I can think of that might fit into what you're asking about are Macros in Common Lisp, which let you extend the syntax. This might be able to acheive what you are looking for, but until you state what it is exactly you're looking for, I can't really elaborate.
Also OCaml and its related languages allow you to do some pretty cool things with types. You can basically define any kind of type you can think of and then match against it with pattern matching, which makes it especially good to write compilers in.
|
ad800868542c4bbbb922bef438b82c32071ee46e11b473eead63b648c01e2cad | ['a563e1826eb442dbb74071acb4d02ae8'] | I've to deny access from set of IP set from specific country and downloaded the list from http://www.ipdeny.com/ site.
I tried to block this set using
firewall-cmd --permanent --ipset=blacklist --add-entries-from-file=/home/cn.zone
but that got failed. Error
Error: INVALID_IPSET: blacklist.
How can i block them.
| 16f851ee96445f79845a71c0d7c86bb4c2989a0d16eb6cf667a4e50222d994ad | ['a563e1826eb442dbb74071acb4d02ae8'] | I try to switch an existing (and well deploying) application to MySql instead of Hypersonic. After I follow all steps from JBoss tutorial my application fails in deploy saying:
org.hibernate.MappingException: An association from the table OLOLO refers to an unmapped class: com.trololo.pack.Class.
MySql DB for JBoss has become filled with the data. But my app's DB is empty. I guess it is something wrong with hibernate, right?
I have JBoss 4.2.3. In the /default/deploy dir I have 2 *-ds.xml files. One for the JBoss and another for my app. Please share your ideas what is wrong there? Any help is welcome.
|
a7c75ea27b014e382f11463c72616e045b59a93fdfc202881b5c79878a8ce1df | ['a569e4037bc24d7aa87f804e2a6d2bca'] | Not exactly the answer as I was asking for (Graphviz), but I found a much nicer solution with MATLAB. It was about plotting a seating plan for an event.
What I did broken down:
imread() image of the floor plan
Roughly determined pixel spacing, used as x & y vector for image() so that tables are in scale with the room.
Manually defined centers for the clusters (here tables) with the help of ginput() (or imellipse())
Plotted circles with plot() and added text with text()
| 9a1b9b62a25d7f770e8c5cb936ac78599862e3e49e677e5564f4001ad2ab64a4 | ['a569e4037bc24d7aa87f804e2a6d2bca'] | Alternatively, you can also use the built-in rmdir() function with the s argument to remove all subfolders and files in the given folder:
rmdir('results', 's')
Please note that your results folder will also be removed, so your code would need to create an empty folder again (see mkdir()).
Further, I suggest to always use absolute file paths.
|
57412dcfeb40b10fa9c6a2fe8426f76a0ec0f855755cd8c30bcd5c042be340e4 | ['a56d15e6a27e44389cd3d2ecf19bbbdb'] | Yes you can use linked servers, that is one way we handle this. You will need the correct oracle driver installed in order to use it. I would put the opentran on the inserting of the data versus any checking or auditing of the incoming data. As the oracle db is remote you can't include it in the transaction.
| d2fdab4319d08b3f127bd3ca19d34b4cb1059ab649b17fee5bddf1263c677e2a | ['a56d15e6a27e44389cd3d2ecf19bbbdb'] | I know that there isn't a specific answer to this and different countries have different guidelines in regard to this. There are a couple cell-phone towers in my vicinity (one of which is some 15-20 meters away). I live in India and I filed a complaint with our Department of Telecommunications and just today, they came to my house and took various readings in and around it. Being new to this subject, most of the terms I found on the internet were alien to me. And I couldn't convincingly convert readings through Google.
My question is as follows: their instrument showed the EMF readings to be around 2.8-3.8 mW/m2 (milliwatts per metre square) at various points around the house. Is this safe? They told me that the limit imposed by the Indian government is 4.5 mW/m2. It would be great if someone could verify that as well. I know for a fact that Indian regulations for EMF radiation are much more stringent than the EU and the US. I want to stay in the 'extreme' safe side and it would be great to know how this reading compares to the average exposure levels and those in different countries.
I know there isn't one set in stone, but I would like to know the generally accepted limit for EMF exposure.
|
66303ae429cfb4567975df18a6c0ca76b2c5640a9da296db995690f01fc586e0 | ['a5706637cdeb43508106ab59ed5f84dd'] | Currently I build HTML templates and replace {Title} placeholder with matching values before sending 'parsed email template' to recipients but the issue is there's no way to generate 'list of data' in table dynamically, thus resorting to using angularjs 'ng-repeat' but when parsed, it sends out angularjs tags instead of generating the HTML representation
My question is how can I build 'angularjs' template with ng-repeat that can be used for sending email templates dynamically without having to load the page in browser cause it seems the angularjs page is only translated when opened in browser
How is it possible using ng-repeat to generate HTML tags dynamically, suitable enough to be sent as email message, thanks
{Title} Placeholder
<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
| 7d72d5255d5f2229227504081881e496d883676dd76763710c1d65bf5e5e6aa0 | ['a5706637cdeb43508106ab59ed5f84dd'] | Having researched the issue extensively especially applying recommendations from similar issues on stackoverflow, the below code still returns error ""System.Net.Mail.SmtpException: Syntax error, command unrecognized. The server response was: connection rejected at....""
try
{
var mail = new MailMessage();
mail.From = new MailAddress("<EMAIL_ADDRESS>");
mail.To.Add(new MailAddress("<EMAIL_ADDRESS>"));
mail.Subject = "TEST";
mail.Body = "This is a test mail from C# program";
using (var smtp = new SmtpClient())
{
smtp.Credentials = new System.Net.NetworkCredential("<EMAIL_ADDRESS>", "AABBCCDDEE1!","gmail.com");
smtp.Host = "smtp.gmail.com";
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.UseDefaultCredentials = false;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Timeout = 10000;
//
smtp.Send(mail);
Console.WriteLine("Message sent successfully");
Console.ReadLine();
}
}
catch (Exception e)
I have done everything possible
On Client> I have alternated smtp properties (permutation) etc
On Server> I have made gmail account less secure, I have disabled captcha etc
I observed that similar issues on stackoverflow were mostly dated over 3years ago and thus, is it possible that gmail no longer supports this SMTP method via C#, likewise has it been deprecated in favor of gmail API
Also, please find provided in code, original password supplied for the gmail account, in order to confirm if this issue is general or isolated to this gmail account
Thanks
|
a9fcee3f3271b9715a7d392740c55ddaeafeecdc08dc1a357c14136bd0e209da | ['a5740c4966cd4f4d8adfbd80f80cd87f'] | I want to replace switch statements here with proper code. I need suggestion of doing this in an improved manner.
switch(true) {
case ($value === 'test1'):
$testArray['class'] = 'incomplete';
return $this->icon(
'test_0.png',
$testArray
);
case ($value === 'test2'):
$testArray['class'] = 'progress';
return $this->icon(
'test_1.png',
$testArray
);
case ($value === 'test3'):
$testArray['class'] = 'complete';
return $this->icon(
'test_3.png',
$testArray
);
}
| a67208c22ccb99dcc80d6e0d3d5dff55ac512120a8948cdab71276f4a56b898b | ['a5740c4966cd4f4d8adfbd80f80cd87f'] | I've a code something like this, i just want to know is it good habit to use lots of 'and' 'or' in a single if statement
if (array_key_exists(self<IP_ADDRESS>SUB_FORM_CONTACT, $data) &&
array_key_exists('company', $data[self<IP_ADDRESS>SUB_FORM_CONTACT]) &&
((array_key_exists('salesRegion', $data[self<IP_ADDRESS>SUB_FORM_CONTACT]['company']) && !empty($data[self<IP_ADDRESS>SUB_FORM_CONTACT]['company']['salesRegion'])) ||
(array_key_exists('serviceRegion', $data[self<IP_ADDRESS>SUB_FORM_CONTACT]['company']) && !empty($data[self<IP_ADDRESS>SUB_FORM_CONTACT]['company'][''])))
) {
}
Or is there any better way of doing this?
|
1c06f9b88b77bb57187a665b9778376b88f126ab8f49ef237873bd7d1662f2b2 | ['a575de0f1f754e218755876018a1567d'] | In android mobile we have an default application Market, under submenu there is functionality called all applications. In this, first it shows only ten records in which it will display defalut image and text, then in back ground it will update images. When we scroll down (i.e., end of list) and it shows loading and then it loads next 10, images will load lazily.
How to acheive this senario.
Thanks in <PERSON>
Jayanth
| bc39304123a7b4913b0ed46ae0e501e50456f6c0078ba9ef0492c0b656ff653c | ['a575de0f1f754e218755876018a1567d'] | I want to create a layout in such a way that on top edittext and button should be there in one row.
The search text I enter in editext and click on search button. Then I want to display a custom list view where each row contains image and text.(As per the API demos example list14 I have tried). But when I run the application, button and edittext are being added to each row (i.e., Each row contains a image, text, editext, button. Can Any one guide how to resolve this issue.
Below is my xml file:
<!--
<FrameLayout android:layout_width="wrap_content"
android:layout_height="0dip" android:layout_weight="1"></FrameLayout>
-->
<ImageView android:id="@+id/icon" android:layout_width="48dip"
android:layout_height="48dip" />
<TextView android:id="@+id/text" android:layout_gravity="center_vertical"
android:layout_width="0dip" android:layout_weight="1.0"
android:layout_height="wrap_content" />
<!--
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="@+id/prdsearchtb"
android:text="@string/tb_prd_search_lbl"></EditText>
-->
<!--
<TableLayout android:id="@+id/TableLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"> <TableRow>
-->
<Button android:id="@+id/prdsrcbutton" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/btn_lbl_prd_search"
android:layout_x="2px" android:layout_y="410px"></Button>
<!-- </TableRow>
</TableLayout>
-->
and Java File:
/**
*
*/
package org.techdata.activity;
import android.app.AlertDialog;
import android.app.ListActivity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
/**
* @author jayanthg
*
*/
public class ProductSearch extends ListActivity {
private static class ProductSearchAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private Bitmap mIcon1;
private Bitmap mIcon2;
public ProductSearchAdapter(Context context) {
mInflater = LayoutInflater.from(context);
// Icons bound to the rows.
mIcon1 = BitmapFactory.decodeResource(context.getResources(),
R.drawable.icon48x48_1);
mIcon2 = BitmapFactory.decodeResource(context.getResources(),
R.drawable.icon48x48_2);
}
@Override
public int getCount() {
return DATA.length;
}
@Override
public Object getItem(int position) {
return position;
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView,
ViewGroup parent) {
ViewHolder holder;
Button btn=null;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.productsearch, null);
// Creates a ViewHolder and store references to the two children
// views
// we want to bind data to.
holder = new ViewHolder();
holder.text = (TextView) convertView.findViewById(R.id.text);
holder.icon = (ImageView) convertView.findViewById(R.id.icon);
btn=(Button)convertView.findViewById(R.id.prdsrcbutton);
convertView.setTag(holder);
} else {
// Get the ViewHolder back to get fast access to the TextView
// and the ImageView.
holder = (ViewHolder) convertView.getTag();
}
// Bind the data efficiently with the holder.
holder.text.setText(DATA[position]);
holder.icon.setImageBitmap((position & 1) == 1 ? mIcon1 : mIcon2);
holder.icon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("image", " u clicked on icon Position" + position);
}
});
holder.text.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("Text", " u clicked on text Position" + position);
}
});
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i("Button","U clicked on button");
}
});
return convertView;
}
static class ViewHolder {
TextView text;
ImageView icon;
}
private static final String[] DATA = { "<PERSON>",
"Abbaye du Mont des Cats" };
}
ListView product_search_list;
Button srch_btn;
EditText srch_text;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(new ProductSearchAdapter(this));
// setContentView(R.layout.productsearch);
// getListView().setEmptyView(findViewById(R.id.text));
// srch_text = (EditText)findViewById(R.id.prdsearchtb);
// srch_btn = (Button) findViewById(R.id.prdsearchtb);
// srch_btn.setOnClickListener(new View.OnClickListener() {
//
// @Override
// public void onClick(View v) {
// callProductSearchAdapter();
//
// }
// });
}
void callProductSearchAdapter() {
setListAdapter(new ProductSearchAdapter(this));
}
private void createDialog(String title, String text, final Intent i) {
if (i == null) {
AlertDialog ad = new AlertDialog.Builder(this).setIcon(
R.drawable.alert_dialog_icon).setPositiveButton("Ok", null)
.setTitle(title).setMessage(text).create();
ad.show();
}
}
}
Regards:
Jayanth
|
571fac16eae3f6c677a7527804ddc88ba0fe6772a99e96639f57f36a299a99c8 | ['a5769940aaeb44cd952580e1f01a87f3'] | I agree with @Barmar, and thus I understand your misunderstanding.
However, correct me if I'm wrong but I have some doubts about your get_maximum_hourglass_sum function because it seems to me that you are actually taking all of the middle row of an hourglass into account (instead of taking only the middle point)
PS : I ran your code on hackerank and I failed most of the test due to RunTimeError though
| d8fc7801226e9e389d20c28f3b76738b140006f6a53801e02d88d083bff26fad | ['a5769940aaeb44cd952580e1f01a87f3'] | Thanks for asking,
I took some time to understand the objective of your algorithm but if you want to loop and save all of your sublists I think this should work :
def slicing_items(slc_len = 5, lst, iterate_num = 25):
# slc_len correspond to the number of slices, lst is the list of sequences
n = len(lst)
k = 1
p = k * slc_len
slicing_list = []
while k < iterate_num:
current_slice = []
if p >= n:
for i in range (1, p//n):
current_slice += lst #How many times we passed the length of the list
p = p % n #How many items remaining ?
current_slice += lst[-(slc_len-p):]
current_slice += lst[:p]
else:
current_slice = lst[p-slc_len:p]
k += 1
p += slc_len
slicing_list.append(current_slice)
return slicing_list
Output :
slicing_items(5,my_list,10)
>>> [['a', 'b', 'c', 'd', 'e'],
['f', 'g', 'h', 'i', 'j'],
['k', 'l', 'm', 'n', 'o'],
['p', 'q', 'r', 's', 't'],
['u', 'v', 'w', 'x', 'y'],
['z', 'a', 'b', 'c', 'd'],
['e', 'f', 'g', 'h', 'i'],
['j', 'k', 'l', 'm', 'n'],
['o', 'p', 'q', 'r', 's']]
However if you just want the last slice over your iterate_num then your function should fit perfectly (maybe you should use slicing over than rewriting the list in your first boolean statement for rapidity)
|
547f69d41bf4c8342d7d5c80438fdefa73dceb32ed890158858948d4c2c56526 | ['a57a442f88384a5aa78e581bbb3110fa'] | I created an app initially using Pie sdk
And it worked on Pie devices
Now I want it to run on Nougat and Oreo as well
How to do it
I am attaching the log as well as the app level Gradle after changing the sdk version to 26
APP LEVEL GRADLE
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.divyateja.waviour"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.firebase:firebase-firestore:17.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:design:26.1.0'
}
repositories {
mavenCentral()
}
MANIFEST
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.divyateja.waviour">
<!-- Permissions -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<uses-library
android:name="org.apache.http.legacy"
android:required="false" />
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="preloaded_fonts"
android:resource="@array/preloaded_fonts" />
<activity
android:name=".MapsActivity"
android:label="@string/title_activity_maps"></activity>
</application>
</manifest>
Log when changing the sdk version to 26 in APP LEVEL GRADLE and running
<PHONE_NUMBER>:23:58.974 2133-3528/? E/NetworkScheduler: Invalid component specified.
2018-10-13 12:23:59.<PHONE_NUMBER>/? E/NetworkScheduler: Invalid component specified.
2018-10-13 12:23:59.132 2176-2725/? E/ActivityThread: Failed to find provider info for com.google.android.apps.gsa.testing.ui.audio.recorded
2018-10-13 12:24:<PHONE_NUMBER>/? E/TaskPersister: File error accessing recents directory (directory doesn't exist?).
2018-10-13 12:24:00.957 2176-2628/? E/ContentStoreEUAS: Failed to commit the deferred actions
2018-10-13 12:24:01.505 <PHONE_NUMBER>/? E/memtrack: Couldn't load memtrack module
2018-10-13 12:24:<PHONE_NUMBER>/? E/SurfaceFlinger: ro.sf.lcd_density must be defined as a build property
2018-10-13 12:24:02.<PHONE_NUMBER>/com.divyateja.waviour E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
2018-10-13 12:24:02.<PHONE_NUMBER>/com.divyateja.waviour E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
2018-10-13 12:24:02.<PHONE_NUMBER>/com.divyateja.waviour E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
2018-10-13 12:24:02.<PHONE_NUMBER>/com.divyateja.waviour E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
2018-10-13 12:24:<PHONE_NUMBER>/com.divyateja.waviour E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.divyateja.waviour, PID: 4054
java.lang.RuntimeException: Canvas: trying to draw too large(219469824bytes) bitmap.
at android.view.DisplayListCanvas.throwIfCannotDraw(DisplayListCanvas.java:229)
at android.view.RecordingCanvas.drawBitmap(RecordingCanvas.java:97)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:529)
at android.view.View.getDrawableRenderNode(View.java:19381)
at android.view.View.drawBackground(View.java:19317)
at android.view.View.draw(View.java:19114)
at android.view.View.updateDisplayListIfDirty(View.java:18073)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.updateDisplayListIfDirty(View.java:18064)
at android.view.View.draw(View.java:18851)
at android.view.ViewGroup.drawChild(ViewGroup.java:4214)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4000)
at android.view.View.draw(View.java:19126)
at com.android.internal.policy.DecorView.draw(DecorView.java:785)
at android.view.View.updateDisplayListIfDirty(View.java:18073)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:643)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:649)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:757)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2980)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2794)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2347)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1386)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6733)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:911)
at android.view.Choreographer.doCallbacks(Choreographer.java:723)
at android.view.Choreographer.doFrame(Choreographer.java:658)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:897)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
2018-10-13 12:24:<PHONE_NUMBER>/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
2018-10-13 12:24:<PHONE_NUMBER>/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008cdf
2018-10-13 12:24:<PHONE_NUMBER>/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
2018-10-13 12:24:<PHONE_NUMBER>/? E/eglCodecCommon: glUtilsParamSize: unknow param 0x00008824
2018-10-13 12:24:<PHONE_NUMBER>/? E/NetworkScheduler: Invalid component specified.
2018-10-13 12:24:<PHONE_NUMBER>/? E/NetworkScheduler: Invalid component specified.
2018-10-13 12:24:<PHONE_NUMBER>/? E/ActivityThread: Failed to find provider info for com.google.android.apps.gsa.testing.ui.audio.recorded
| b1c71f30469eb0b6bd95208ae9f8060ab0cc89ccbeda91b13439b73e9b637230 | ['a57a442f88384a5aa78e581bbb3110fa'] | I made this app like 1 year ago and when I open it up it pops up with a bunch of totally random errors...probably due to updates but then
error: incompatible types: Fragment cannot be converted to SupportMapFragment
.findFragmentById(R.id.map);
Maps Activity Code:
import android.location.Address;
import android.location.Geocoder;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.widget.Toast;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.UiSettings;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
import java.util.List;
import java.util.Locale;
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
public GoogleMap mMap;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
/**
* Manipulates the map once available.
* This callback is triggered when the map is ready to be used.
* This is where we can add markers or lines, add listeners or move the camera. In this case,.
* If Google Play services is not installed on the device, the user will be prompted to install
* it inside the SupportMapFragment. This method will only be triggered once the user has
* installed Google Play services and returned to the app.
*/
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
try {
List<Address> listAddresses =geocoder.getFromLocation(MainActivity.Globals.Latitude, MainActivity.Globals.Longitude,1);
if (listAddresses != null && listAddresses.size() > 0) {
String address = "";
if (listAddresses.get(0).getThoroughfare() != null) {
address += listAddresses.get(0).getThoroughfare() + " ";//Address
}
if (listAddresses.get(0).getLocality() != null) {
address += listAddresses.get(0).getLocality() + " "; //City
}
if (listAddresses.get(0).getAdminArea() != null) {
address += listAddresses.get(0).getAdminArea() + " ";//State
}
if (listAddresses.get(0).getCountryName() != null) {
address += listAddresses.get(0).getCountryName() + " ";//Country
}
if (listAddresses.get(0).getAdminArea() != null) {
address += listAddresses.get(0).getPostalCode();
}
Toast.makeText(MapsActivity.this, address, Toast.LENGTH_SHORT).show();
}
} catch (Exception e) {
e.printStackTrace();
}
//Customization
mMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
UiSettings uiSettings = mMap.getUiSettings();
uiSettings.setCompassEnabled(true);
uiSettings.setZoomControlsEnabled(true);
LatLng person = new LatLng(MainActivity.Globals.Latitude, MainActivity.Globals.Longitude);
mMap.addMarker(new MarkerOptions().position(person).title("Person").icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(person,12));
}
}
If it helps android studio made me change some gradle stuff
GradleProperties:
org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
Adding Jetifiers to this gives me a whole bunch of errors so I didn't do that
Build.Gradle:
apply plugin: 'com.google.gms.google-services'
android {
signingConfigs {
config {
keyAlias 'Name'
keyPassword 'Password'
storeFile file('/Location')
storePassword 'Password'
}
}
compileSdkVersion 29
defaultConfig {
applicationId "com.example.appMaps"
minSdkVersion 23
targetSdkVersion 29
versionCode 7
versionName '7.0'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
//noinspection GradleCompatible
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.firebase:firebase-core:17.4.3'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.firebase:firebase-firestore:21.4.3'
implementation 'com.android.support:multidex:1.0.3'
//noinspection GradleCompatible,GradleCompatible
implementation 'com.android.support:design:26.1.0'
}
repositories {
mavenCentral()
}
|
f7f6a37d6be3b1f35ad82719e89704c440e0d58b4ad99ea37401be5a258d545f | ['a57f84eac01b45c9af7a0b5a14c6c0b5'] | I'm still a rookie to the R world, in a very accelerated class with limited/no guidance. My assignment is to build a custom function that reads in a specific .csv, and take some specific columns out to be analyzed. Could anyone please offer some advice? The "sample code" I was given looks like this:
AnnualLekSurvey=function(data.in,stat.year){
d1=subset(data.in,year==stat.year)
d2=d1[c("year","complex","tot_male")]
attach(d2)}
So when it's complete and I run it, I should be able to say:
AnnualLekSurvey(gsg_lek,2006)
where "gsg_lek" is the name of the file I want to import, and 2006 is the values from the "year" column that I want to subset. "complex" and "tot_male" will be the variable to be analyzed by "year", but I'm not worried about that code right now.
What I'm confused about is; how do I tell <PERSON> that gsg_lek is a .csv file, and tell it to look in the proper directory for it when I run the custom function?
I saw one other vaguely similar example on here, and they had to use the if() and paste() commands to build the string of the file name - that seems like too much arbitrary work, unless I'm just being lazy...
Any help would be appreciated.
| 72e4449649f21e4e9387df90ea3463febccc812c7eaf1635a03597015b442784 | ['a57f84eac01b45c9af7a0b5a14c6c0b5'] | I have 57 individuals (with ~60,000 replicates) labeled by "ID_Year" used to create a GLME model of habitat selection. How do I extract unique coefficient estimates for each "ID_Year"?
Here is the model:
Cand.mod[[25]] <-glmer(Used ~ WBEMesicHa + Treatments + WBERoads45 + WBERoads25 + WBERoadsUn + Powerlines + Agricultur + UrbanEucli+ NonUrbanEu + ClippedCan + (1|ID_Year),family=binomial(logit),data=data)#failed to converge
I have tried fixef(Cand.mod[[25]]) and get a single output of the model estimates:
(Intercept) WBEMesicHa Treatments WBERoads45 WBERoads25 WBERoadsUn Powerlines Agricultur UrbanEucli NonUrbanEu ClippedCan2 ClippedCan3
-4.<PHONE_NUMBER>.045302307 -0.111918732 -0.036906751 0.025336140 0.<PHONE_NUMBER>.<PHONE_NUMBER>.<PHONE_NUMBER>.004829703 -<PHONE_NUMBER>.070915726 -<PHONE_NUMBER>
ClippedCan4 ClippedCan5
-<PHONE_NUMBER> -<PHONE_NUMBER>
But I just can't get it for each of the 57 individuals. I'm sure I'm missing something simple...
|
d1c4f32687244250c6972b2f565a7f4c72a501ec191ee8e95a913bb1addac62e | ['a58096ea0090448ca54fc3c85600441d'] | Let's say we have this array :
Student[] students = new Student[3];
students[0] = new Student() { Number = 123, Name = "<PERSON>", Firstname = "<PERSON>" };
students[1] = new Student() { Number = 456, Name = "<PERSON>", Firstname = "<PERSON>" };
students[2] = new Student() { Number = 789, Name = "<PERSON>", Firstname = "<PERSON>" };
I want to remove the student object with Number 456 so I call my method :
RemoveStudentWithNumber(456);
This is what I tried :
public void RemoveStudentWithNumber(int number)
{
for (int i = 0; i < students.Length; i++)
{
if (students[i].Number == number)
{
students[i] = null;
}
}
}
This does delete the correct student but it replaces it with an empty line in the array.
So I actually want to reduce the lenght of the array when the method is called correctly.
| 690003db5a2becb3966e0f73f4f75c6230d998bbd2edca1c9b3253f7759b0296 | ['a58096ea0090448ca54fc3c85600441d'] | How can I get which radio is selected via jQuery?
I have two radio buttons and want to post the text of the selected one, how can I get the text with jQuery?
I know how to get the value of the selected radio button :
$('[name="topping"]:checked').val()
<div>
<label>Would you like extra topping?</label>
<input type="radio" value="y" name="topping" id="toppingy"/><label for="toppingy"
class="sidelabel">Yes</label>
<input type="radio" value="n" name="topping" id="toppingn"/><label for="toppingn" class="sidelabel">No</label>
</div>
But this doesn't work :
$('[name="topping"]:checked').text()
|
9a142d924fcdc8fcc8750a40a1b9477561a29c94b786099fec5cf7d713f58bfd | ['a58b94cd7f754ed291f81213cdb5bd0e'] | I need to get an image using webservice which is rest.And most of the tutorials are about click the button in order to trigger the process.I need to implement this such a way that when activity opens images has to be loaded immediately without trigger or clicking the button or something.I just need a source or idea.
Any help will be appreciated.
| 6704ed94079411da53fdf1bf8cfa48971c9457aff22963b6bcbe7a7f751ff08a | ['a58b94cd7f754ed291f81213cdb5bd0e'] | I want to create a drop down list as it is shown in the image.
Image
So when it is clicked,I want it to show up like this right under the text.I want to get some source to do this.If you can give any source it will be appreciated.Thanks.
|
f7e24834f41042a0916ad628916913434067ebbff4f1e2039cb3c536b0f09d85 | ['a5919ed6811943bb9ea8ff4557242635'] | Has anyone got any experience of building .net core apps with TeamCity and Octopus? I know there are various guides on implementing this but they rely on having a project.json file which has been removed by Microsoft. Has anyone come up with any solution?
I'm currently using the dotnet-core-plugin suggested by TeamCity - but it appears to rely on the project.json file
| 4921adaaab03ad7bedfd147bd4fae6a4e11191e815999ea92392960eee4f334e | ['a5919ed6811943bb9ea8ff4557242635'] | I'm trying to call a function from a C++ library using DllImport
[DllImport("DLL.dll", CallingConvention = CallingConvention.StdCall)]
private static extern IntPtr XXX(double dtoday, double dexp, double fwd, double[] sList, double[] vList);
The signature of the C++ function is
std<IP_ADDRESS>vector <double> XXX( const double dtoday,
const double dexp,
const double fwd,
const std<IP_ADDRESS>vector <double> &sList,
const std<IP_ADDRESS>vector <double> &vList)
The problem I'm having is that &sList and &vList are empty by the time they get to the C++ (dll), I think this is happening because of the & in the function definition.
I have tried [In, Out] ref vList in the import signature but that didn't solve the issue.
If anyone has any ideas they would be gratefully received
Thanks
|
0228621978fe2523d430f420d23c6b404a82bf37b37f6312b7e0725e2e3b35fd | ['a5a4255027174e3db02537ede7590d29'] | This is my code:
$(function(){
$('.pop').dialog({
autoOpen: false
});
$('.show_pop').click(function(){
$(this).closest('.parent').find('.pop').dialog('open');
});
});
http://jsfiddle.net/0v62hL7p/4/
I need to target only one .pop and open the dialog.
What am I missing in my code? Thanks! I'm still new so please bear with me...
| 4eed36b3ae8b9bc548286e8b09e4bee7a3ff27a249322b2c14f80376613f9ab3 | ['a5a4255027174e3db02537ede7590d29'] | So I'm trying to look for functions (among y and z) that contains a function call a using Eclipse search.
In this code:
void y ()
{
if {
}
if {
}
}
void z ()
{
if {
}
a(b(c,d,e));
if {
}
}
My Regex matches the entirety of functions y and z excluding before the function name.
\b(y|z) ?\(.+?(\r\n|\r|\n)(?s)\{(\r\n|\r|\n).*?((?<=\r\n|\r|\n)\})
What I want is a regex that matches only functions that call function a inside it.
I tried this but it fails:
\b(y|z) ?\(.+?(\r\n|\r|\n)(?s)\{(\r\n|\r|\n).*(\ba\().+?((?<=\r\n|\r|\n)\})
|
955dda57a7ce6b7dac5d441d860ba3021d0cb45cbce8adecedfc403a76744c20 | ['a5b3e05397474273ab6dc17e6e18ab59'] | So you're saying a series resistor on the data line is bad design practice since the I/O pin is still pulled high? It seems the most simple approach and I can confirm that it works in my case. Out of curiosity, what sort of chip is it that could self destruct? | fc439314bbfaaafcc3e8762fd0f788f990620e1b77e04644a9c998063e387162 | ['a5b3e05397474273ab6dc17e6e18ab59'] | Hello all, i first want to thank everyone for their opinions, very much appreciated, i missed out the point that known vulnerabilities are as important and dangerous as well since it is known to all attackers for exploitation. Before reading everyone's comments, i thought unpredictability was the more important issue as we do not know what we are facing, however, after reading everyone's comment, i now have a balanced point of view. |
18c2d4ea4ff03897144cfb31b971466f08f69fc7a4676aee06ed8f3ac001516a | ['a5b75c3ade7448938933355fcc08aee5'] | Suggesting future improvements is an excellent idea, but I would recommend putting that into a *separate* follow-up email / memo. Busy managers seem to have a tendency to only read the first "pane" displayed by their email tool (about 25 lines), so lengthy emails are best avoided (I learned that the hard way). It also doesn't seem optimal to mix the two threads "what just happened here" (still part of managing the aftermath of the current crisis) and "this is what I think should happen going forward" (now that we have all calmed down, let's work on averting crisis in the future) | 7fa1ba6533dfa67025fd0a5c43323be149e31ff5e2dbd8f18adf6e492f63f8ab | ['a5b75c3ade7448938933355fcc08aee5'] | formatting a 8GB SD Card will lead to the same with GB and GiB: 8GB = 7,45GiB but dont forget with what kind of system you format. FAT will lead to a very small table, but e.g. ext will lead to a bigger journal. When you format the 8GB are still the 8GB! or the 7,45GiB are still 7,45GiB. |
2cb87ac649841b376feec89bdad75057cc4fa5e29d5536570f87e1f97494f933 | ['a5b9c82f152b4e639fbc5d95e5489c94'] | Is possible to run CoreTelephony framework in background mode? i'm making hardware for iphone ad i need when the iphone is in sleep mode and when you recived a call or sms my hardware make sound. i can make this when my app is running but when i put the iphone on sleep mode not work.
Is possible to do these work in background ?
thanks !
| f830555e210b6447b37d510f3d757479102bf04522c34887528ca3d15532ef14 | ['a5b9c82f152b4e639fbc5d95e5489c94'] | I am developing an application in which I need to detect when my iPhone receives a notice of Twitter or Facebook, and then perform an action on my application.
example: I'm hardware developer and would like to make an application when a notification arrives me, flashing a LED (independent of the iPhone).
What need would be to know if it is possible to detect from my application notifications from other applications, and what is the way to do it, because I have knowledge in ios development.
Thank you.
|
b30f98d0aefd364e96166f733b939c7c5a131c1b18272eb605f19644c3f9898b | ['a5bcdbb569084fb0b3781e1b3cf32982'] | You don't want to prevent your users from closing multiple modals rapidly, every approach in this direction will be a fail.
What you want to do is preventing your user to close any tab by mistake.
As it is a mistake use case, do not design for it from the beginning (except if it does not disturb any 'normal' use case).
Rather than doing that, just add the feature to re-open previously closed tab.
A little rubber with 'undo' action should be enough.
If you can user test it I would be happy to know if it was enough.
download bmml source – Wireframes created with Balsamiq Mockups
| 1c2554a6ab86d3df9de80a016bcc022a2a12779fdfd98da0a95e1d7310a98b6e | ['a5bcdbb569084fb0b3781e1b3cf32982'] | Short answer is no. You can add a standard pagination but the dots like you did are :
- not actionable
- it is very hard to understand what they are for at first glance.
You should find something else that does not have those problems.
A pagination could be enhanced with the dots like you have though, but then take care of not displaying too much redundant information.
|
10de6a36e3a08267f627f9f95b4f269aa8b48ed1946f318080fa3e634d7c4a4e | ['a5ca81dce1af4f8fb511a3a9ea1a16d0'] | Ok, use requests.get to make a get request, then use .json method to parse response as a json, then optionally convert timestamps (given in ms, divide by 1000 to get seconds) into datetime objects like this:
import requests
from datetime import datetime
from pprint import pprint
def get_stock_prices(symbol: str) -> list:
symbol = symbol.lower()
url = f'https://www.highcharts.com/samples/data/{symbol}-c.json'
res = requests.get(url)
res.raise_for_status()
prices_raw = res.json()
return [[datetime.fromtimestamp(t / 1000), price]
for t, price in prices_raw]
symbol = 'AAPL'
stocks = get_stock_prices(symbol)
pprint(stocks)
output:
[[datetime.datetime(2017, 7, 17, 16, 30), 149.56],
[datetime.datetime(2017, 7, 18, 16, 30), 150.08],
[datetime.datetime(2017, 7, 19, 16, 30), 151.02],
[datetime.datetime(2017, 7, 20, 16, 30), 150.34],
[datetime.datetime(2017, 7, 21, 16, 30), 150.27],
[datetime.datetime(2017, 7, 24, 16, 30), 152.09],
[datetime.datetime(2017, 7, 25, 16, 30), 152.74],
[datetime.datetime(2017, 7, 26, 16, 30), 153.46],
| 0ca852aeb81ba7e7e4b705588b1479209030557312c98d7193044bb586d03836 | ['a5ca81dce1af4f8fb511a3a9ea1a16d0'] | Wow, it's been a cumbersome task, but I've finally managed to do it. I've used find function with a filter function to find <p> elements inside the table.
https://www.crummy.com/software/BeautifulSoup/bs4/doc/#a-function
Please note that I've fixed the malformed parts of HTML you've posted.
from bs4 import BeautifulSoup, Tag
if __name__ == "__main__":
html = '''
<p>Hello world!</p>
<table><tr><td> </td><td>•</td><td><p>First bullet point text</p></td></tr></table>
<table><tr><td> </td><td>•</td><td><p>Second</p></td></tr></table>
<table><tr><td> </td><td>•</td><td><p>Third</p></td></tr></table>
<table><tr><td> </td><td>•</td><td><p>Last</p></td></tr></table>
<p>Some paragraph</p>
<table><tr><td> </td><td>•</td><td><p>1st item of 2nd list</p></td></tr></table>
<table><tr><td> </td><td>•</td><td><p>2nd item of 2nd list</p></td></tr></table>
<p>Another paragraph</p>
'''
soup = BeautifulSoup(html, 'html.parser')
# find all <p>s under a table and replace table with the <p> element
def p_under_table_extractor(el: Tag):
table_parent = el.find_parent('table')
return el.name == 'p' and table_parent
for p in soup.find_all(p_under_table_extractor):
table_parent = p.find_parent('table')
p.name = 'li'
table_parent.replace_with(p)
# the only <p>s are the root <p>s
for p in soup.find_all('p'):
# find all succeeding <li>s
li_els = []
for el in p.find_all_next():
if el.name != 'li':
break
else:
li_els.append(el)
# put those <li>s inside a <ul>
if li_els:
ul = soup.new_tag('ul')
for li in li_els:
ul.append(li)
# and put <ul> after the <p>
p.insert_after(ul)
print(soup.prettify())
which prints:
<p>Hello world!</p>
<ul>
<li>First bullet point text</li>
<li>Second</li>
<li>Third</li>
<li>Last</li>
</ul>
<p>Some paragraph</p>
<ul>
<li>1st item of 2nd list</li>
<li>2nd item of 2nd list</li>
</ul>
<p>Another paragraph</p>
|
0a48c40e880ec4fee67ca9eb60120c2e3c82e85a6b88b3d44e0b5fabcb45d0c0 | ['a5d1025a99854de8b8869959717c57d9'] | Looks like you are not overriding the hdfs configurations dfs.name.dir , dfs.data.dir, by default it points to /tmp directory which will be cleared when your machine restarts. You have to change this from /tmp to another location in your home directory by overriding these values in your hdfs-site.xml file located in your HADOOP configuration directory.
Do the following steps
Create a directory in your home directory for keeping namenode image & datanode blocks (Replace with your login name)
mkdir /home/<USER>/pseudo/
Modify your hdfs-site.xml file in your HADOOP_CONF_DIR(hadoop configuration direcotry) as follows
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>dfs.name.dir</name>
<value>file:///home/<USER>/pseudo/dfs/name</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>file:///home/<USER>/pseudo/dfs/data</value>
</property>
<property>
<name>dfs.replication</name>
<value>1</value>
</property>
</configuration>
Format your hdfs namenode & start using
| 7defa1c675b55f492ec79afa83393501f94ac5ddb27c0c1ca2538de068afcbfd | ['a5d1025a99854de8b8869959717c57d9'] | Looks like you are not overriding the hdfs configurations dfs.name.dir , dfs.data.dir, by default it points to /tmp directory which will be cleared when your machine restarts. You have to change this from /tmp to another location in your home directory by overriding these values in your hdfs-site.xml file located in your HADOOP configuration directory.
Do the following steps
Create a directory in your home directory for keeping namenode image & datanode blocks (Replace with your login name)
mkdir /home/<USER>/pseudo/
Modify your hdfs-site.xml file in your HADOOP_CONF_DIR(hadoop configuration direcotry) as follows
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<property>
<name>dfs.name.dir</name>
<value>file:///home/<USER>/pseudo/dfs/name</value>
</property>
<property>
<name>dfs.data.dir</name>
<value>file:///home/<USER>/pseudo/dfs/data</value>
</property>
</configuration>
Format your hdfs namenode & start using
|
c7d4c923324201170da1ec142bfe3b713b532feb80c04a81f2aa4a8a373c90a9 | ['a5d225ece8624090ac3132c6730e9525'] | When trying to add/install Blocktrail SDK as dependency for Composer. It shows
an error like this: Requested PHP extension GMP is missing from your system. (Link to screenshot)
I've tried enabling the extension GMP in my cpanel using php.ini. But even if it was enabled it still shows the same error which is very confusing. I already tried communicating this with my hosting provider but they dont know what to do.
Note: I am using PUTTY for installations.
Blocktrail SDK installation instructions
So, is there anyone who ever encountered this kind of error? Or is there any alternative to installing the blocktrail-sdk but still using Composer?
| c0a6020513565098edd01a54eb3cfad008265e34e18dc93221950d2b0a040e0d | ['a5d225ece8624090ac3132c6730e9525'] | This is my index.html:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Code Concrete</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
<button class="btn btn-md btn-primary" id="btn-test">Click this!</button>
</body>
</html>
This is my app.component.ts
<app-nav></app-nav>
<div class="container-fluid">
<section class="content-wrapper">
<h1>{{title}}</h1>
<h2>asd</h2>
<nav>
<a routerLink="/dashboard">Dashboard</a>
<a routerLink="/heroes">Heroes</a>
</nav>
<button class="btn btn-md btn-primary" id="btn-test">Click this!
</button>
<router-outlet></router-outlet>
<app-messages></app-messages>
</section>
</div>
I have a scipt custom.js included in angular.json (formerly angular-cli.json).
custom.js
$('button#btn-test').on('click',function() {
alert("success");
});
I have also jquery and bootstrap styles and scripts included in angular.json.
The button was working when inside index.html but when i transferred it into app.component.html, it won't work anymore. Why is the button not working? Did I miss any line of codes? Do I need to import anything else when I've already included my scripts and styles in angular.json?
Thanks in advance
|
428a399c1f46af6a7398b2aae4d967484bd078651f6c0c8ae606d3f7124158ce | ['a5d75b6b39134bff9ec9ff0cd2b326e4'] | I have followed a tutorial from this website http://jtreminio.com/2012/07/setting-up-a-debian-vm-step-by-step/. I am up to the point in the tutorial where it says to login via SSH. I have installed Putty and logging in under debian-vm as the host name and I have also used <IP_ADDRESS> as a IP address. I get a connection timed out error every time I try to login.
I have read other posts and suggestions pop up that it may be due to firewall issues or network related issues. Ultimately I am not well versed in networking so I really wouldn't know. Can someone suggest where to start to fix this issue or help me with any ideas they may have. I am using Oracle Virtual box with Debian 64 bit on Windows 7. I have OpenSSH installed on Debian, using NAT for adaptor 1 and Host only adaptor on 2. I have written to the files in Debian and I have written the IP address and host name into the hosts file on Windows 7 as instructed.
| 2ede72699c2fc9ce69edb0c817cb18809671ac3900a05c18a12b0ef8122b5e3c | ['a5d75b6b39134bff9ec9ff0cd2b326e4'] | I done all the instructions you gave me. disabled adaptor 2, started ssh on debian, got back tcp <IP_ADDRESS>:22 LISTEN. I pinged IPV4 address on my windows machine from debian and that worked. The eth0 from the ifconfig has a inet addr of <IP_ADDRESS>. I managed to ping to the windows machine without disabling the firewall. |
2b75ef1ba2aea4e6fe3d79e65b9f04836fefc38855e4b38961442c8945f9f31d | ['a5e4a874525545f797b4e0b49d6b2d57'] | The Boost community has discussed that some weeks ago (copying code from Boost and publish in a project with another license). The conclusion was that this is unfair and not legal. Note that even open source licenses might not be compatible (lawyer with a presentation regarding to mixing open source licenses and derivative work). | c87f4d2b93d5afe114f9f026339be1e706038958ce239b79d3cae020171bee35 | ['a5e4a874525545f797b4e0b49d6b2d57'] | I have a column in excel 2003 that contacts phone numbers. Thousands of rows of phone numbers. Problem is they are not all formatted the same way, some are <PHONE_NUMBER>, some are <PHONE_NUMBER>, etc. I need them all to be <PHONE_NUMBER>. How can I do this?
Thanks!
|
36b04b0255608f8c54d382f8f85eb1af951023ff6f9ddeadd3fb9948645b7f55 | ['a5e7d155c76d4d48b815025defe962dd'] | The master branch of http://github.com/zenovich/runkit is compatible with all versions of PHP. Sandboxing only works if thread safety is enabled. So you should recompile your PHP after configuring it with flag --enable-maintainer-zts to use Runkit_Sandbox class. After that you should use Runkit compiled from source.
| d4548436b39333c96d612981de5a64b2afdbc50c63093f88789dd388af93ba5d | ['a5e7d155c76d4d48b815025defe962dd'] | The runkit extension is a perfect solution for your needs. It is proven by years of my personal experience and described in many presentations and articles authored by different authors in the internet.
I can assure you that the runkit_method_redefine function as well as the whole runkit extension is not experimental anymore (documentation hosted on the php.net is obsolete).
The up-to-date runkit extension can be found on http://github.com/zenovich/runkit
Sincerely,
<PERSON>
|
8e0f6ecb155ffca4dfeef35f943d4a679779a241158c5b496a38ef7490dd4d37 | ['a5ee440b1a2343e7acd412018ed901a0'] | ctx.drawImage(image, sx, sy, sWidth, sHeight, dx, dy, dWidth, dHeight)
The sx,sy,sWidth,sHeight are measured according to the source image. Say we have an image in way HIGH resolution, for instance, 2000 * 1000, then the sWidth and sHeight should be scaled up to that resolution. In your case, it should be 80 / 300 * 2000 for sWidth.
I've made those adjustments to your code.
function draw(x, y) {
ctx.clearRect(0, 0, canvas.width, canvas.height); // you might want to draw on a clean canvas each time
let scaleX = x / img.offsetWidth * image.width;
let scaleY = y / img.offsetHeight * image.height;
let scaleWidth = lens.offsetWidth / img.width * image.width;
let scaleHeight = lens.offsetHeight / img.height * image.height;
ctx.drawImage(image, scaleX, scaleY, scaleWidth, scaleHeight, 0, 0, canvas.width, canvas.height);
}
| b7866eceac1730ed18c17b87d63147f5dfb2d50148e0a05ae3c24c494aa37bda | ['a5ee440b1a2343e7acd412018ed901a0'] | $.next() finds elements only in its siblings. If you want to search in its children elements, use find() and a precise selector instead.
<div class='container'>
<div class='a'>a
<div class='a2'>a2</div>
</div>
<div class='b'>b</div>
</div>
console.log($('.a').next('div')) // div.b
console.log($('.a').next('a2')) // undefined
|
5abc0fc37aa3b787030cd11ef468e13164d7614f0b076d95aa5fa10ad2f7a30a | ['a5f336a6acb34f23aa4f573400b9fdef'] | You could use this
var timer = setInterval(function () {
scrollOK = true;
}, 100),
scrollOK = true,
count = 20;
$(window).bind('scroll', function () {
if (scrollOK) {
scrollOK = false;
if ($(this).scrollTop() + $(this).height() >= ($(document).height() - 100)) {
//now load more list-items because the user is within 100px of the bottom of the page
console.log('You Hit Bottom!');
var out = [];
for (var i = 0; i < 10; i++) {
out.push('<li>' + (count++) + '</li>');
}
$('ul').append(out.join('')).listview('refresh');
}
}
});
http://jsfiddle.net/knuTW/
| 8bbf47a8429ad99a5689f1340cd2fac94a0bbac39a0658d08b56d2cedfa27c5f | ['a5f336a6acb34f23aa4f573400b9fdef'] | <ul data-role="listview">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
<li>11</li>
<li>12</li>
<li>13</li>
<li>14</li>
<li>15</li>
<li>16</li>
<li>17</li>
<li>18</li>
<li>19</li>
</ul>
var timer = setInterval(function () {
scrollOK = true;
}, 100),
scrollOK = true,
count = 20;
$(window).bind('scroll', function () {
if (scrollOK) {
scrollOK = false;
if ($(this).scrollTop() + $(this).height() >= ($(document).height() - 100)) {
//now load more list-items because the user is within 100px of the bottom of the page
console.log('You Hit Bottom!');
var out = [];
for (var i = 0; i < 10; i++) {
out.push('<li>' + (count++) + '</li>');
}
$('ul').append(out.join('')).listview('refresh');
}
}
});
Refer this link http://jsfiddle.net/knuTW/
|
df980b6325cb9865d1be5c1265a7fbf35a5e057908339cbbe424721e161d99ea | ['a5f7ca42cd4c469fa3e29061c9edafb4'] | I'm pretty sure (Someone correct me if i'm wrong), using the new operator allocates dynamic memory for that variable. The variables will most likely already have some garbage value assigned to them that gets overridden when you assign a new value to them. Whereas assigning it NULL just assigns it whatever the NULL value is (probably 0000000).
| 2a5283bf7b81abaf43cc224648f48898b5fa3015ec9f68904ca21ad3bb7e46a7 | ['a5f7ca42cd4c469fa3e29061c9edafb4'] | What are the major differences between Logstash and Fluentd?
What I know so far is:
Both:
- Open Source
- Available on Linux and Windows
- Data/log collectors
Logstash:
- Centralized repo for plugins
- Small fixed queue size (often need Redis to manage)
- More memory intensive (~120 MB)
- Commonly apart of the ELK stack
Fluentd:
- Decentralized repo for plugins
- Built-in, dynamic queue management (but makes setup more complicated)
- Less memory intensive (~30-40 MB)
Source: https://logz.io/blog/fluentd-logstash/
Are there any major differences that I, or this article, missed that are worth mentioning?
|
a89a387a96e2ddeaa1a8e92f10a39b1c9f31877ef2e3fd9e0889d679f455d15a | ['a60ba5bc64fc4dd2b147110889cc73e9'] | I have this code, which generates a HTML table from a Google Spreadsheet. I am attempting to make just the table auto refresh every 5 seconds, while the spreadsheet loads. However, when using the following code, it just makes the table disappear after 5 seconds. Does anyone see what is wrong or have a better solution?
<div class="sheetstotables"></div>
<script type="text/javascript">
var tableId = "AB12C"
var x = document.createElement("script"); x.type = "text/javascript"; x.async = true;
x.src = "http://www.sheetstotables.com/get_table.js";
var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(x, s);
</script>
<script>
function autoRefresh_div()
{
$(".sheetstotables").load("load.html");// a function which will load data from other file after x seconds
}
setInterval('autoRefresh_div()', 5000); // refresh div after 5 secs
</script>
| 84c5563fa3a3cadb04435c0242dbcb5b98aa1e98773216a24453ae69f8c64d50 | ['a60ba5bc64fc4dd2b147110889cc73e9'] | I'm attempting to scrape this Tableau dashboard, however I'm running into a problem where I am missing values in my output. Specifically, it seems like my code won't scrape/print repeated values (a value that shows up twice will only be scraped/printed once).
Here is the code I am using:
import requests
from bs4 import BeautifulSoup
import json
import re
r = requests.get("https://public.tableau.com/views/COVID-19HospitalsDashboard/Hospitals?%3Aembed=y&%3AshowVizHome=no",
params = {
":embed": "y",
":showVizHome": "no",
":host_url": "https://public.tableau.com/",
":embed_code_version": 3,
":tabs": "no",
":toolbar": "no",
":animate_transition": "yes",
":display_static_image": "no",
":display_spinner": "no",
":display_overlay": "yes",
":display_count": "yes",
":language": "en",
":loadOrderID": 0
})
soup = BeautifulSoup(r.text, "html.parser")
tableauData = json.loads(soup.find("textarea",{"id": "tsConfigContainer"}).text)
dataUrl = f'https://public.tableau.com{tableauData["vizql_root"]}/bootstrapSession/sessions/{tableauData["sessionid"]}'
r = requests.post(dataUrl, data= {
"sheet_id": tableauData["sheetId"],
})
dataReg = re.search('\d+;({.*})\d+;({.*})', r.text, re.MULTILINE)
info = json.loads(dataReg.group(1))
data = json.loads(dataReg.group(2))
print(data["secondaryInfo"]["presModelMap"]["dataDictionary"]["presModelHolder"]["genDataDictionaryPresModel"]["dataSegments"]["0"]["dataColumns"])
|
38d5430d12d36ddd07aed99ab14c0da9b2cb387537f2fb6d9ba3d66bf930a359 | ['a6250621a9fb43c08bbb0676a59636cc'] | You will want to place your javascript under one document.ready to start, then I named the error and success variables differently based on what dom element they were pulling from. This should help you.
$(document).ready(function(){
var error = $('#an-introduction-to-physiotherapy-for-the-geriatric-patient .error').html();
var success = $('#an-introduction-to-physiotherapy-for-the-geriatric-patient .success').html();
var tissueError = $('#tissue-repair-with-professor<PERSON> .error').html();
var tissueSuccess = $('#tissue-repair-with-professor-<PERSON> .success').html();
if (error != null) {
$('#an-introduction-to-physiotherapy-for-the-geriatric-patientLabel').empty().text('Error Sending Registration');
}
if (success != null) {
$('#an-introduction-to-physiotherapy-for-the-geriatric-patientLabel').empty().text('Registration Delivered');
}
if ((error != null) || (success != null)) { $('#an-introduction-to-physiotherapy-for-the-geriatric-patient').modal('show'); }
$('form#form_tissue-repair-with-professor<PERSON> .required').attr('required', 'required');
if (tissueError != null) {
$('#tissue-repair-with-professor-<PERSON> Sending Registration');
}
if (tissueSuccess != null) {
$('#tissue-repair-with-professor-<PERSON> Delivered');
}
if ((tissueError != null) || (tissueSuccess != null)) { $('#tissue-repair-with-professor-<PERSON>'); }
});
| 482d70834393945d2d594bfc663cfc258e3d54a5c72fb188539c7c5277a8000d | ['a6250621a9fb43c08bbb0676a59636cc'] | $cars = array
(
array("Volvo", 22, 18),
array("BMW", 15, 13),
array("Saab", 5, 2),
array("Land Rover", 17, 15),
array("benz", 252, 1558),
array("tesla", 115, 193),
array("chevy", 587, 211),
array("ford", 13217, 115),
array("Volvo", 22, 18),
array("BMW", 15, 13),
array("Saab", 5, 2),
array("Land Rover", 17, 15),
array("benz", 252, 1558),
array("tesla", 115, 193),
array("chevy", 587, 211),
array("ford", 13217, 115),
array("Volvo", 22, 18),
array("BMW", 15, 13),
array("Saab", 5, 2),
array("Land Rover", 17, 15),
array("benz", 252, 1558),
array("tesla", 115, 193),
array("chevy", 587, 211),
array("ford", 13217, 115),
array("Volvo", 22, 18),
array("BMW", 15, 13),
array("Saab", 5, 2),
array("Land Rover", 17, 15),
array("benz", 252, 1558),
array("tesla", 115, 193),
array("chevy", 587, 211),
array("ford", 13217, 115),
array("tesla", 115, 193),
array("chevy", 587, 211),
array("ford", 13217, 115),
);
$i = 0;
foreach ($cars as $innerCar) {
if ($i == 0) {
echo "<table style='display:inline;'>";
echo "<tbody>";
}
echo "<tr>";
foreach ($innerCar as $car) {
echo "<td>$car</td>";
}
echo "</tr>";
if ($i == 5) {
echo "</tbody>";
echo "</table>";
$i = 0;
} else {
$i++;
}
}
|
b7a135d33c3e1004c7598f7d2b3e0dff1b52b9ad3f0bb2dfd5e2043ed2e51efb | ['a62ce1a9402d4242a34f30212bd41eab'] | I was taking the fast.ai course and came across this snippet of code (in Python 3):
PATH = "data/dogscats/"
os.listdir(f'{PATH}valid')
This returns the list of the files in the directory data/dogscats/valid, like I expected. However, I don't understand what purpose the "f" in front of '{PATH}valid' serves. When removed, the code throws a "FileNotFound" error. Why is the "f" there? It's not even part of the string? I know this might be an elementary question, but it's something I'd love to understand.
Thank you in advance!
| 6ad1091573151fae5f98ec15e9c39f6f4ad7e28f86a29149c1027d15b48ebc93 | ['a62ce1a9402d4242a34f30212bd41eab'] | I've been trying to make a page that displays different elements based on different users' member roles. Currently, I have two member roles: the default "Member" and a new role "Sponsors". I've gotten the member roles using the wix-users module as such.
import wixUsers from 'wix-users';
$w.onReady(function () {
//TODO: write your page related code here...
var roleName;
let currentUser = wixUsers.currentUser;
currentUser.getRoles()
.then( (roles) => {
var firstRole = roles[0];
roleName = firstRole.name; // "Role Name"
console.log(roleName);
var roleDescription = firstRole.description; // "Role Description"
}).catch(
onFailure()
);
if(roleName === "Sponsors"){
$w('#text13').show();
}
});
I know that the promise from getRoles() is resolving based on my debugging, and the console.log(roleName) is logging "Sponsors" to the console correctly when I'm logged in. However, it seems that the if statement of if(roleName === "Sponsors") will not run, whatever I do. What am I doing wrong? Thank you in advance!
|
7b15aa1ac444a859ca1770c6ff42a9c1b36c31474a387123c8bba236001c6c6f | ['a62eda56a586449dbde87aa564e628d3'] | Client site http://site1.jsp have form which i want post.
<form name="searchForm" method="POST" **action="/oes/site1.do**">
<table cellspacing="3" cellpadding="2" border="0" width="100%">
<tr>
<td>
<P>
<STRONG>Please select a search type</STRONG>:
</P>
<P>
<INPUT type="radio" name="type" value="arg1" CHECKED />Multiple occupations for one geographical area
</P>
<P>
<INPUT type="radio" name="type" value="occ_geo"/>One occupation for multiple geographical areas
</P>
<P>
<INPUT type="radio" name="type" value="ind_occ"/>Multiple occupations for one industry
</P>
<P>
<INPUT type="radio" name="type" value="occ_ind"/>One occupation for multiple industries
</P>
</td>
</tr>
<tr>
<td>
<input type="submit" value="Continue">
</td>
</tr>
</table>
</form>
| 7ec46e522433a7a15c4aba93ffc1a8dd43ac9b210209ed7ce50ec4215c1ad9e6 | ['a62eda56a586449dbde87aa564e628d3'] | I struggle that issue for three days, and there is no solution. It just not working and never been. So I will try use another tool, because cordova just don't fit for geolocation purposes. Now I'm focus on java and I want do this properly (ios was a bonus, when I choose cordova).
|
67ec710c7e8897ff50a1efbf4bdf2bf9dab6896e956c77500c218d5306f2e3a8 | ['a63464d2d6a940efa702f001825d4ff2'] | <PERSON> I don't subscribe to it at all. You might say that it has been obsoleted for *some people*, but to make a sweeping statement that it has been obsoleted by emails is hardly justifiable. I'd be very hard pressed to find an e-mail in my mailbox that doesn't have at least a name both for salutation and for signature. | 42487c5eb1c33a251f07d54e0ca24c8e0d0ca3394dbc991f4168db4f2748c08a | ['a63464d2d6a940efa702f001825d4ff2'] | I'd say that judging a thesis merely by its length, without knowing any details, isn't really helpful. Half of it might be data tables, diagrams, whatever. Although I'm in a different field, computer science, my master thesis 25 years ago was just as long or more. But half of it was source code. No committee was expected to read every single line of it, of course, but simply put, yes, the thesis was that long. |
8511883388715e6b33c2f631e4501d932ddd7e37788d0565dec73480be84bba5 | ['a6372cb3b56049229d25b1a4afad9905'] | Thanks. I installed lib32z1 lib32ncurses5 lib32bz2-1.0 libjpeg62:i386. Then I installed the 64-bit driver again. The same error appeared. Next, I installed ia32-libs. I installed the 64-bit driver again. The same error appeared. So I can't still print. Moreover, I have the same problem with my 32 bits pc.So I don't think it's a problem of 32 bits libraries. | ae948e31a2ae1558c38edfdfd0c4e231c46c6638d8ba4f9d5e6431273d16a86f | ['a6372cb3b56049229d25b1a4afad9905'] | OK, here is the code which solved my problem. Thank you <PERSON> and <PERSON>!
' set identity_insert to on to insert tables with key'
Command = New SqlCommand("SET IDENTITY_INSERT table ON", con)
Command.ExecuteNonQuery()
'Copy dataTable into MSSQL database'
Using bulkCopy As SqlBulkCopy = New SqlBulkCopy(cn, SqlBulkCopyOptions.KeepIdentity)
bulkCopy.DestinationTableName = dTable.TableName
Try
bulkCopy.WriteToServer(dTable)
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
End Using
'disable identity_insert'
Command = New SqlCommand("SET IDENTITY_INSERT table OFF", con)
Command.ExecuteNonQuery()
|
a2b9ba394a0768a43d905669ef154040f786a9a352a6365ec1c9efd8c7ae379a | ['a65ae91793224fa0858d4b37c629e22c'] | I would just do it in the traditional OOP style.
First define an interface for a factory class
public interface BlockFactory {
Block createInstance(int x, int y, LayerType ltype);
}
And then define corresponding factories
public class HoleBlockFactory implements BlockFactory {
public Block createInstance(int x, int y, LayerType ltype) {
return new HoleBlock(x, y);
}
}
public class GrassBlockFactory implements BlockFactory {
public Block createInstance(int x, int y, LayerType ltype) {
return new GrassBlock(x, y);
}
}
Finally in your generator first you get a factory in your switch statement and the use the factory to create objects when you need:
public class FlatGenerator implements Generator {
@Override
public BlockFactory generateBlock(LayerType ltype, int x, int y) {
switch (ltype) {
case Liquid:
return new HoleBlockFactory();
case Solid:
return new GrassBlockFactory();
default:
throw new RuntimeException();
}
}
}
}
public class World {
Generator generator = ...;
// ...
private void generateBlocks(int x, int y) {
for (LayerType ltype : LayerType.values())
setblock(generator.generateBlock(ltype, x, y).createInstance(x, y, ltype), //.new() is as an example
x, y, ltype);
}
}
| 4b0f07e43d01c9a7b5f7cebb41244e666ed3f44c1977568e98b30a66a7a9cb33 | ['a65ae91793224fa0858d4b37c629e22c'] | The most important difference is that python yield gives you an iterator, once it is fully iterated that's over.
But C# yield return gives you an iterator "factory", which you can pass it around and uses it in multiple places of your code without concerning whether it has been "looped" once before.
Take this example in python:
In [235]: def func1():
.....: for i in xrange(3):
.....: yield i
.....:
In [236]: x1 = func1()
In [237]: for k in x1:
.....: print k
.....:
0
1
2
In [238]: for k in x1:
.....: print k
.....:
In [239]:
And in C#:
class Program
{
static IEnumerable<int> Func1()
{
for (int i = 0; i < 3; i++)
yield return i;
}
static void Main(string[] args)
{
var x1 = Func1();
foreach (int k in x1)
Console.WriteLine(k);
foreach (int k in x1)
Console.WriteLine(k);
}
}
That gives you:
0
1
2
0
1
2
|
3345234a436529f3b0d0e3e85457aba95fd375e862893b21e5ebe27f36579b8c | ['a6880c0ad74347d28defed67360bb49a'] | I'm using an InputStream to read bytes from a TCP server (written in C#) into a byte[], and encoding them into a string using new String(byteArray, "UTF-16LE"). This method encodes characters in the Basic Multilingual Plane just fine, but does not handle supplementary characters.
I understand that bytes in C# are unsigned whereas Java bytes are signed, and that a supplementary character can be composed of either one or two unicode values.
ByteBuffer wrapped = ByteBuffer.wrap(dataBytes);
wrapped.order(ByteOrder.LITTLE_ENDIAN);
short noOfSites = wrapped.getShort();
for(int i = 0; i < noOfSites; i++){
short siteNo = wrapped.getShort();
short textLength = wrapped.getShort();
byte[] textBytes = new byte[textLength];
wrapped.get(textBytes, 0, textLength);
for(byte bite : textBytes){
System.out.print(bite+" ");
} //just to see what's in the byte array
String siteText = new String(textBytes, "UTF_16LE");
System.out.println(siteNo + ": " + siteText);
siteList.add(new Site(siteNo, siteText));
publishProgress(siteNo + " - " + siteText);
}
In this instance, dataBytes is the byte array containing the bytes read from the server, noOfSites is the number of objects to be read from the server, siteNo is an ID, textLength is the number of bytes containing the name of the site, and textBytes is the array that holds these bytes.
When receiving the word "MÜNSTER" from the server, the bytes read into the buffer are:
77 0 -3 -1 78 0 83 0 84 0 69 0 82 0.
However, the "Ü" character is unrecognised, which I suppose is down to the -3 -1 UTF-16 value that Java is trying (and failing) to encode. I understand that in C#, "Ü" is represented by DC-00, but I don't understand why this becomes -3 -1 in Java.
Any help would be greatly appreciated.
| 468bb0ed51b4b08bad47614e14e490a10fc69a2a7aac8ca8fa709f8025771e98 | ['a6880c0ad74347d28defed67360bb49a'] | I am trying to add two different fragments into two containers in my activity. The containers are part of a collapsible view I have made:
collapsible_view.xml
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/collapsible_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="TextView"
android:gravity="center"/>
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/collapsible_body"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
The container I'm trying to use is collapsible_body.
I want to add two of these views to my activity layout and then add a different fragment in each collapsible_body. However, using fragmentTransaction.replace(R.id.collapsible_body...) does not specify which one of my two views collapsible_body's to replace.
Basically, the same as this question here: Fragment - replace container, if id is not unique
|
70b93fc69440b301303b94c79056d86fb78dbd56f56af2eec08852fb8068e0c2 | ['a6a63edba5724f87ae1dd66b36d5b91e'] | I have created a class Library in VB.NET which we are calling from SSIS script task.
Could someone please advice how I can throw error back from VB.NET function which was suppose to return a string value but it returns null, in that case I would like the SSIS script task to fail.
| 657f4c7b35783e970a7e974c6229627728ee7c70c7684fc00760dd758928238a | ['a6a63edba5724f87ae1dd66b36d5b91e'] | Can someone please advise:
I have got SOURCE (which is OLD SQL Server) and we need to move data to new DESTINATION (which is NEW SERVER). So moving data between different instances.
I'm struggling how to write the package which looks up in destination first and check if row exists then do nothing else INSERT.
Regards
|
06dabed44955e951df3e77996917fd7c450daec9bf9eaefc579ebf7341348a30 | ['a6aa0807fae44ea59dc150902231b98c'] | Actually the docs DO say how you can reuse connection for multiple requests:
If you wish to re-use a connection across multiple HTTP requests
without automatically closing it you can use ::new instead of ::start.
request will automatically open a connection to the server if one is
not currently open. You can manually close the connection with finish.
You can find this in this section: https://ruby-doc.org/stdlib-2.5.0/libdoc/net/http/rdoc/Net/HTTP.html#class-Net<IP_ADDRESS><IP_ADDRESS>new instead of <IP_ADDRESS>start.
request will automatically open a connection to the server if one is
not currently open. You can manually close the connection with finish.
You can find this in this section: https://ruby-doc.org/stdlib-2.5.0/libdoc/net/http/rdoc/Net/HTTP.html#class-Net::HTTP-label-How+to+use+Net-3A-3AHTTP
| b1855e2395d5f3982ea402be8d94b4301026b8c79bdd370584801894e8b5f954 | ['a6aa0807fae44ea59dc150902231b98c'] | It looks you want to test your schema because you want to know if it is going to break the client. Basically you should avoid this.
Instead you can use gems like: graphql-schema_comparator to print breaking changes.
I suggest to have a rake task for dumping your schema (and commit it in your repo).
You can write some spec to check if the schema was dump - then you will make sure, you have always up-to date schema dump.
Setup your CI to compare schema of current branch with schema on master branch.
Fail your build if schema has dangerous or breaking changes.
You can even generate Schema Changelog using schema-comparator ;) Or you can even use slack notifications to send any schema changes there so your team could easilly track any changes.
|
6fa6eca26972f2d2a02a5c7d92863fec0e2500649cc17da427f566c85d13516c | ['a6af6ac1728c491dbbc1ce756f68e0d2'] | We've not thought about freezing apps with Vispy much yet. The pitfall that I'd expect matches with gmas80's answer; Vispy can use multiple backends, which means that these are dynamically loaded and cx_Freeze is unable to select the backend modules as a dependency. Depending on the backend that you need, you need to add some modules in vispy.backends to the list of includes.
| 05bb190a71b1f88e8fa02399ffd0059715d354450f8bc9d41a1433229339a0bd | ['a6af6ac1728c491dbbc1ce756f68e0d2'] | As pointed out by <PERSON>, Vispy provides OpenGL bindings for OpenGL ES 2.0. More interesting about vispy is vispy.gloo which provides a much easier (object oriented) way to use OpenGL.
If you need full desktop OpenGL functionality (not limited to ES 2.0), you need PyOpenGL. I think that currently it is supported (at least on Linux). This works for me:
<PERSON> install pyopengl
Alternatively, pip should work as well:
pip install pyopengl
|
762605e8e1ea4f4b74c2da91ebda10551bd8d0951a6cc9d2c8324fe360a0486d | ['a6afc80226d4417895f73b7f62c23036'] | I would use a message handler to achieve such mechanism. In your custom View class, create a Handler, then pass a reference of this handler to the button (for instance in the onCreate event of your Activity), then use the sendMessage() / handleMessage() mechanism to communicate between the Button and the other View.
This method will also allow all the other components to interact nicely with your custom View if you need to.
| d171b9eddb23f318a659e0adfbb22c5c365a9d6b992faa9cf703666d4295997c | ['a6afc80226d4417895f73b7f62c23036'] | I also experienced the same problem with a Sony Xperia X10. I managed to make it "remember" the pairing by changing the security level settings on the bluetooth device side (as I am developing the device also).
I am not sure about the "temporary pairing" explanation, that would be manufacturer dependent, it doesn't make much sense that different phones would react differently to a connection with the same device.
However it is the unbounding part that is a problem for me. Typically the Bluetooth stack seems to crash when the user is unpairing a device while the application is connected in the background. I still haven't figure out how to manage the ACTION_BOND_STATE_CHANGED event properly.
|
f523703e628ce6c9bfba3ae34702a96685aa650a3f6c9fea6edc3ea498ca490d | ['a6d217cf4a894d878bcebb52652ab6b8'] | What I have understood from your question is there is some data under column A and B as shown below (Click on Run code snippet to check the values in table) and the result you want is the name of the adjacent cell having max(B1:B7)
then select cell C1 and use this formula you will get your answer
=vlookup(Max(B1:B7),{B1:B7,A1:A7},2,False)
<table border=1>
<th>
Column A
</th>
<th>
Column B
</th>
<tr>
<td>
ABC
</td>
<td>
9
</td>
</tr>
<tr>
<td>
DEF
</td>
<td>
112
</td>
</tr>
<tr>
<td>
GHI
</td>
<td>
20
</td>
<tr>
<td>
PETS
</td>
<td>
618
</td>
</tr>
<tr>
<td>
JKL
</td>
<td>
10
</td>
</tr>
<tr>
<td>
MNO
</td>
<td>
25
</td>
</tr>
</table>
| fe1e6575142c503bcfde74e341944d9b55f70c495476b0f5c574a27f38af4e40 | ['a6d217cf4a894d878bcebb52652ab6b8'] | I tried all the above mentioned still not working for me. I was working on a windows application after that I have started the web application coding on visual studio after that whenever I was opening the Visual studio this problem was occurring. I am using Visual studio 2015. So what I did, I have right-click inside the toolbox panel and selected 'choose option' then under '.Net framework' components tab I have checked all check boxes for which assembly name is 'System.windows.forms' It is working for me now.
|
101a76d9a000226fbfb78215d2bc730de5cdb23c993fcb2551057e9e01055729 | ['a6df339e15e44ff7a3570a88ae4fb6f8'] | This problem is because the data you are concatenating, is coming from http call, which is asynchronous,before your data came through http call, the line
$scope.twitchData=makeJson(responseDataValues,responseData);
got executed with both blank array.
You can do it either by promise resole,
or with a simple way
make following changes in your code :
function fitData(response)
{
responseData.push(response);
if(responseDataValues.length){
$scope.twitchData=makeJson(responseDataValues,responseData);
}
}
function fitDataValues(response)
{
console.log(response);
responseDataValues.push(response);
if(responseData.length){
$scope.twitchData=makeJson(responseDataValues,responseData);
}
}
the http call take the more time will invoke the function call with both array having values.
| 6dbcb6b0ad2b4deb5cf3cafafd14b902ae7fb9bdae1082aa3c47c78b148d9abf | ['a6df339e15e44ff7a3570a88ae4fb6f8'] | You can send your server time to client and get a difference in client time and server time and save this time difference, and also save the starting time stamp of timer.
You can verify this timer accuracy latter by hitting the server for server time and calculate new difference between client and server time, if it find any discrepancy, correct the timer.
|
9804d2f18c6c18ba8edd4a261761835d3aeb4850109b38b5f048906739762b73 | ['a6dfedf4d73f4a01926fbca19912556c'] | i would like to use the second property LogoWidth to set the width on the first property but im getting the "Cannot refer to an instance member of a class from a shared method"
If there's anyone that can help i'll appreciated
<DetailViewLayoutAttribute(LayoutColumnPosition.Left, "Header Logo", LayoutGroupType.SimpleEditorsGroup, 1)>
<VisibleInListView(False), DevExpress.Xpo.DisplayName("Logo"), ImmediatePostData> '<RuleRequiredField("Logo", DefaultContexts.Save)>
<ImageEditor(ListViewImageEditorMode:=ImageEditorMode.PictureEdit,
DetailViewImageEditorMode:=ImageEditorMode.PictureEdit, ListViewImageEditorCustomHeight:=85, DetailViewImageEditorFixedHeight:=160, DetailViewImageEditorFixedWidth:=160)>
<Size(SizeAttribute.Unlimited)>
Public Property Logo() As Byte()
Get
Return GetPropertyValue(Of Byte())("Logo")
End Get
Set
' If True Then
SetPropertyValue(Of Byte())("Logo", Value)
' End If
End Set
End Property
<DetailViewLayoutAttribute(LayoutColumnPosition.Right, "Header Logo", LayoutGroupType.SimpleEditorsGroup, 1)>
<VisibleInListView(False), DevExpress.Xpo.DisplayName("Width"), ImmediatePostData> '<RuleRequiredField("LogoWidth", DefaultContexts.Save)>
Public Property LogoWidth As Integer
Get
Return _LogoWidth
End Get
Set(ByVal Value As Integer)
SetPropertyValue(NameOf(LogoWidth), _LogoWidth, Value)
End Set
End Property}
| cca5bd6f66a8e120f1022ca9b115e80896a6680c07eae740b7701126b74e965f | ['a6dfedf4d73f4a01926fbca19912556c'] | Thanks, I found a solution that works
Private Sub SCA_ViewBy_Execute(sender As Object, e As SingleChoiceActionExecuteEventArgs) Handles SCA_ViewBy.Execute
If SCA_ViewBy.SelectedIndex = 0 Then
' Dim listEditor As GridListEditor = TryCast((CType(View, ListView)).Editor, GridListEditor)
' If listEditor IsNot Nothing Then
' Dim gridView As GridView = listEditor.GridView
' gridView.BeginSort()
' Try
' gridView.ClearGrouping()
' gridView.Columns("Division").GroupIndex = 0
' gridView.Columns("SubDivision").GroupIndex = -1
' Finally
' gridView.EndSort()
' End Try
' End If
Dim listEditor1 As ASPxGridListEditor = TryCast((CType(View, ListView)).Editor, ASPxGridListEditor)
If listEditor1 IsNot Nothing Then
Dim gridView As ASPxGridView = CType(listEditor1.Grid, ASPxGridView)
gridView.ClientInstanceName = View.Id
Dim divisionColumns As GridViewDataColumn = TryCast(gridView.Columns("Division"), GridViewDataColumn)
'Dim subdivisionColumns As GridViewDataColumn = TryCast(gridView.Columns("SubDivision"), GridViewDataColumn)
If divisionColumns IsNot Nothing Then
'detailsColumns.DataItemTemplate = New UpDownButtonsTemplate()
gridView.ClearSort()
gridView.SortBy(divisionColumns, DevExpress.Data.ColumnSortOrder.Ascending)
gridView.GroupBy(divisionColumns, 0)
gridView.ExpandAll()
End If
End If
ElseIf SCA_ViewBy.SelectedIndex = 1 Then
Dim listEditor1 As ASPxGridListEditor = TryCast((CType(View, ListView)).Editor, ASPxGridListEditor)
If listEditor1 IsNot Nothing Then
Dim gridView As ASPxGridView = CType(listEditor1.Grid, ASPxGridView)
gridView.ClientInstanceName = View.Id
Dim divisionColumns As GridViewDataColumn = TryCast(gridView.Columns("Division"), GridViewDataColumn)
Dim subdivisionColumns As GridViewDataColumn = TryCast(gridView.Columns("SubDivision"), GridViewDataColumn)
If divisionColumns IsNot Nothing Then
'detailsColumns.DataItemTemplate = New UpDownButtonsTemplate()
gridView.ClearSort()
gridView.SortBy(divisionColumns, DevExpress.Data.ColumnSortOrder.Ascending)
gridView.GroupBy(divisionColumns, 0)
gridView.GroupBy(subdivisionColumns, 1)
gridView.ExpandAll()
End If
End If
Else
End If
End Sub
|
c4ee08648ad71970c640c1dff62c9c5e2bc1faf79bbedb5499c34b949198e4b8 | ['a6e4536bf95742378e3ac6f31f9d075f'] | I want to make a system for tabs. I have a server with a database with different companies with there info. All the companies get a same tab, but with different content form the database.
The way I have to do it, is to make a new app (Tab app) for every company and link to the website like http://www.domainname.com/facebook.php?companyname=NAME.
I want a way that I can use 1 app for every company and only have to change the "companyname" variable. Is that possible?
| ef1281311cfc1a597a9440368dec7e69993f0ea58bfed6040fb5f499f954be42 | ['a6e4536bf95742378e3ac6f31f9d075f'] | I want to use a custom font on a website and want to secure it. I know there is like Cufon etc, but I want to do it with @font-face, because Cufon changes the text with and @font-face only apply the font to the text. So I found fontdeck.com and they use @font-face with secure font loading.
I have to include a CSS file with the following code:
@font-face {
font-family: 'Proxima Nova Thin';
src: url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.eot');
src: url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.eot?') format('embedded-opentype'),
url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.woff') format('woff'),
url('http://f.fontdeck.com/f/1/c0NxWjZ3YjEABIN8EILvJ0RNEaQrLMTNf/ckiJrqjmmED2eZzkurKBHRmOyi18vUlxuV1sPQGGKg/w.ttf') format('opentype');
font-weight: 100;
font-style: normal;
}
But if I go to with the browser to the URL's for EOT, WOFF and TTF files, I will see "Forbidden".
Can somebody explain me how this works?
|
b6b11f6187138d591c287f60220a7283a7087defdc66766d8725a6969bdbf8d0 | ['a6f956d8f4134563a26d9b27839b0f5a'] | How to user case insensitive where filter in loopback with postgresql.
I have trued using
pattern = new RegExp('.*'+data+'.*', "i")
but not working.
My code is
searchUsersAppointment(data): void {
let cpr = /^\d+$/.test(data);
let pattern = new RegExp('.*'+data+'.*', "i");
let query = {};
if(cpr){
query = {where: {CPR: {like: data} } };
}else{
query = {where: {firstName: {like: pattern} } };
}
this.patientDetailsApi.find(query).subscribe(searchDetails => {
this.searchDetails = searchDetails;
})
}
Can any one help me to fix this issue.
| eaeee9f4d2c74d131b2c1dddd8a82e368e63984a7b37011f9b28b5cfc0a822c3 | ['a6f956d8f4134563a26d9b27839b0f5a'] | I'm new to node js, in my project one of the function not wait till for loop execute
let prepareExecution = (type) => {
let files = [];
let filestodelete = [];
let data = {};
data.files = files;
data.filestodelete = filestodelete;
let list = ['vpl_run.sh','vpl_debug.sh', 'vpl_evaluate.sh', 'vpl_evaluate.cases'];
for (let i = 0, len = list.length; i < len; i++) {
let fileName = list[i];
let testCase = "Case1";
let test = {};
test[fileName] = testCase;
console.log(test)
data.files.push(test);
}
let test = {};
test.fileName = 1;
data.filestodelete.push(test);
return data;
}
What I got is
{
"files": {},
"filestodelete": {
"fileName": 1
}
}
Output I need is
{
"files": { 'vpl_run.sh': 'Case1'},
"filestodelete": {
"fileName": 1
}
}
Can you please any one guide me for the above issue
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.