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 |
|---|---|---|---|---|---|
47f4a1c9996d8de21c30be21076bb982089ec745f3919e41d86d1764d6f467a1 | ['24389f19290c4849a688c6fa624c775e'] | In case you need different parameters for object creation(batteries for Tesla or Engine for Ford) you can choose between different solutions:
- pass all of these parameters while creating a factory - it will be specific factory for all types of car with such available details;
class SpecificCarFactory
{
public SpecificCarFactory(IList<Battery> batteries, IList<Engine> engines)
{
//save batteries etc into local properties
}
public Car GetCar(CarType carType)
{
switch(carType)
{ case CarType.Ford: return new Mustang(_engines.First()); }
}
}
encapsulate parameters into class object and get them from factory method parameter;
class CarFactory
{
public Car GetCar(CarDetail carDetail) //where CarDetails encapsulates all the possible car details
{
switch(carDetail.type)
{ case CarType.Ford: return new Mustang(carDetail.Engine);//just an example
}
}
}
| 1d462437c98e095893783efcd15ee3314e8cda7d1a33cf9c22fe0b09e6f598ea | ['24389f19290c4849a688c6fa624c775e'] | If I understood you're question correctly you need to use dynamic data to retrieve from the database - than you could find whenever you want in the result set. As an example of such approach there is Massive MicroORM which allows reading result sets into dynamic variables and than read any kind of data that may exist there.
|
6aa8e38467bd240e6d2adfe154a126e238712e1d2c5018bc849b298564944b68 | ['244a1a91446a4fde94c53502dbc5820f'] | This is an original three.js editor and you can see that using orbitControls does not trigger object (de)selection. Like, if one object is selected (we can see a yellow box around it and transformControls attached to it), then object selection is not toggled on mouseup or mousedown. But then again, when we just need to choose an object - we just click on it and it's selected.
My problem is that in my editor a long click is considered to be a click as well. So when I finish rotating orbitControls, mousedown event happens and if some object was under the cursor, then this object gets (de)selected.
I want to know how to prevent this from happening. How to make it so that click is a click (for selecting an object) and long click is a long click (for controlling orbitControls)
| c3f14e41d1d8b441f9fc11e280ad76031c7ead3289c3331814300cd779bcb09c | ['244a1a91446a4fde94c53502dbc5820f'] |
Right now, when I upload my model, its center(highlighted by transformControls) is not in the model's center of mass. How can I shift it there?
I tried this:
(model) => {
box = new Box3();
box.expandByObject(model);
const centerOfBox = new Vector3();
box.getCenter(centerOfBox);
const size = new Vector3();
box.getSize(size);
const centerOfWorld = new Vector3(0, size.y/2, 0);
const offset = new Vector3();
offset.subVectors(centerOfWorld, centerOfBox);
const scale = model.scale;
model.translateX(scale.x*offset.x);
model.translateY(scale.y*offset.y);
model.translateZ(scale.z*offset.z);
}
and also this:
(model) => {
model.traverse(function(child) {
const rememberPosition = child.getWorldPosition(new Vector3());
const box = new Box3();
box.expandByObject(child);
const centerOfBox = new Vector3();
box.getCenter(centerOfBox);
const offset = new Vector3();
offset.subVectors(rememberPosition, centerOfBox);
child.traverse(function(ch) {
if (child instanceof Mesh) {
ch.geometry.translate(offset.x, offset.y, offset.z);
ch.translateX(-offset.x);
ch.translateY(-offset.y);
ch.translateZ(-offset.z);
}
});
});
model.position.copy(new Vector3());
}
In the latter version, I tried to shift the geometry to be at the object's position and then shift everything (geometry+position) back to the original place (original place = visibly original place).
|
665b1ea37217408e8de0f51e48d35860af9626843463a78d20c7fa35ba50fbec | ['24589f6d3d8d46628401c047cb579498'] | 1) I would also suggest TCP. Depending on the complexity of request-response I'd probably pick either some ad-hoc text protocol or use XML (especially suitable if responses or requests are structured and more complex). If you use XML you won't need to write your own parsers/generators. You could even try using XML-RPC but I have no practical experience with that yet.
| 2396ac0ecf6c948891a660c7ac6d794b24b749727e9aab1eb24db4a4842e19af | ['24589f6d3d8d46628401c047cb579498'] | If realloc fails and returns NULL is the former buffer free'd or it is kept intact? I didn't found that particular piece of information in the man page and I'm quite unsure what to do. If memory is freed then double-free could be risky. If not then the leakage would occur.
|
9ee8e16ad5d1e1af51730f760064fa8066735d971885ad00824b8375bd2a0ae6 | ['245b4af13cbd4f479fba10a6a278125d'] | I need help with a problem. I am using regex to find a specific string that ends and begins with a special character. The string can contain words, special characters and spaces. Only the special characters at the end and the beginning should be selected.
Examples:
.Hello i´m <PERSON>"
Result:
Hello i´m <PERSON>
I thank you in advance.
| 5ba2c33772f177197a5f7ae119094dfb70c72e28af8d9c746b32191ec9250489 | ['245b4af13cbd4f479fba10a6a278125d'] | The following code wont work as I expected. I want a User to react with a checkmark and then log something in the console. Instead of that the bot activates the function by itself and then the function never gets called again.
client.once('ready', () => {
console.log('Ready!');
const exampleEmbed = <unimportant>;
client.channels.cache.get("771041812638728235").send(exampleEmbed).then((message) => {
message.react('✅');
message.createReactionCollector(r => r.emoji.name == '✅')
.on('collect', r => {
console.log("nice");
});
});
});
|
bf44ee7910f2bef4ef5de626035370d6d0a0851037965a40f328149a3ce4a0fd | ['24647bc0e55945fc8b12778cfa329a40'] | "-Xsource:2.11 -Ymacro-expand:none" solved my problem , just updated in right click project -> properties -> Scala Compiler , Additional Command Line Parameter , to fix this "build path is cross-compiled with an incompatible version of Scala (2.11.0). In case this report is mistaken, this check can be disabled in the compiler preference page."
| d55b23cec996f6bfbff8b8fba918e5c508e6712b26eaa232754d9b3c70f6cf51 | ['24647bc0e55945fc8b12778cfa329a40'] | I am currently studying kafka and new , I am trying to start the kafka-server-start.sh config/server.properties but getting the below error message, I searched stackoverflow and i am unable to get the solution. Could anyone please advise how to fix this.
Error Message:
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.apache.logging.slf4j.Log4jLoggerFactory]
ERROR StatusLogger No log4j2 configuration file found. Using default
configuration: logging only errors to the console.
21:48:52.090 [main] FATAL kafka.Kafka$ - null
java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
at kafka.utils.CoreUtils$.parseCsvList(CoreUtils.scala:213) ~[kafka_2.11-<IP_ADDRESS>.jar:?]
at kafka.server.KafkaConfig.<init>(KafkaConfig.scala:742) ~[kafka_2.11-<IP_ADDRESS>.jar:?]
at kafka.server.KafkaConfig$.fromProps(KafkaConfig.scala:691) ~[kafka_2.11-<IP_ADDRESS>.jar:?]
at kafka.server.KafkaServerStartable$.fromProps(KafkaServerStartable.scala:28) ~[kafka_2.11-<IP_ADDRESS>.jar:?]
at kafka.Kafka$.main(Kafka.scala:58) [kafka_2.11-<IP_ADDRESS>.jar:?]
at kafka.Kafka.main(Kafka.scala) [kafka_2.11-<IP_ADDRESS>.jar:?]
I am using Ubuntu 14.04, Java 1.8 build 101, zookeeper version 3.4 and kafka version 2.11-0.9
Zookeeper properties (zoo.cfg):
tickTime=2000
initLimit=10
syncLimit=5
dataDir=/usr/local/zookeeper-3.4.10/data
clientPort=2181
kafka properties (server.properties):
broker.id=0
listeners=PLAINTEXT://:9092
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
log.dirs=/usr/local/kafka/kafka-log-1
num.partitions=2
num.recovery.threads.per.data.dir=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
log.cleaner.enable=false
zookeeper.connect=localhost:2181
zookeeper.connection.timeout.ms=6000
|
f62f71f031c2e0ce2a325c6194ff0e827674c912928fca670aa5c8f387f5a281 | ['2470bede2fd84adab6b1d1458996affa'] | I am attempting to use Tahoe-LAFS to make data available on all the machines I have set a share up on. At the moment, there are two machines acting as storage nodes. I will soon be adding a third.
How can I have one full copy of a file per server? I require this since two of the computers on the network are laptops, and I need to retain access even when they are offline.
Failing this, are there any distributed file systems that would fit that use case well? Note that supporting OS X boxes for storage is a requirement.
| c58488783ed7516a674fda29366ce18c49b8e2d7d769a06cf47744c08aaafc62 | ['2470bede2fd84adab6b1d1458996affa'] | I am trying to setup the following using systemd networkd on debian 9:
Interface eth0 ip address from DHCP server
Interface vlan5 on eth0 vlan id 5 with static ip address: <IP_ADDRESS>
This is the configuration:
/etc/systemd/network/20-wired.network
[Match]
Name=eth0
[Network]
DHCP=ipv4
VLAN=vlan5
/etc/systemd/network/vlan5.netdev
[NetDev]
Name=vlan5
Kind=vlan
[VLAN]
Id=5
/etc/systemd/network/vlan5.network
[Match]
Name=vlan5
[Network]
DHCP=no
Address=172.16.0.1/24
When I execute ip addr show:
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 78:a5:04:f1:12:46 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.31/24 brd 192.168.1.255 scope global dynamic eth0
valid_lft 2854sec preferred_lft 2854sec
inet 192.168.1.85/24 brd 192.168.1.255 scope global secondary eth0
valid_lft forever preferred_lft forever
inet6 2a02:a03f:8584:e200:7aa5:4ff:fef1:1246/64 scope global deprecated mngtmpaddr noprefixroute dynamic
valid_lft 56463sec preferred_lft 0sec
inet6 fe80::7aa5:4ff:fef1:1246/64 scope link
valid_lft forever preferred_lft forever
5: vlan5@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 78:a5:04:f1:12:46 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.1/24 brd 172.16.0.255 scope global vlan5
valid_lft forever preferred_lft forever
inet 169.254.243.53/16 brd 169.254.255.255 scope global vlan5
valid_lft forever preferred_lft forever
inet6 fe80::7aa5:4ff:fef1:1246/64 scope link
valid_lft forever preferred_lft forever
Which confirms that eth0 got an ip address from our dhcp, for whatever reason he even has 2 ip addresses: <IP_ADDRESS> and <IP_ADDRESS> but atleast it works.
Vlan5 also has 2 ip addresses: <IP_ADDRESS>/24 and <IP_ADDRESS>/16. If I connect a host on this vlan with ip <IP_ADDRESS>, I cannot access <IP_ADDRESS>.
If I connect a host with ip <IP_ADDRESS>, I can access the host through <IP_ADDRESS><IP_ADDRESS>/24
When I execute ip addr show:
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 78:a5:04:f1:12:46 brd ff:ff:ff:ff:ff:ff
inet <IP_ADDRESS>/24 brd <IP_ADDRESS> scope global dynamic eth0
valid_lft 2854sec preferred_lft 2854sec
inet <IP_ADDRESS>/24 brd <IP_ADDRESS> scope global secondary eth0
valid_lft forever preferred_lft forever
inet6 <IP_ADDRESS>/64 scope global deprecated mngtmpaddr noprefixroute dynamic
valid_lft 56463sec preferred_lft 0sec
inet6 <IP_ADDRESS>7aa5:4ff:fef1:1246/64 scope link
valid_lft forever preferred_lft forever
5: vlan5@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 78:a5:04:f1:12:46 brd ff:ff:ff:ff:ff:ff
inet <IP_ADDRESS>/24 brd <IP_ADDRESS> scope global vlan5
valid_lft forever preferred_lft forever
inet <IP_ADDRESS>/16 brd <IP_ADDRESS> scope global vlan5
valid_lft forever preferred_lft forever
inet6 <IP_ADDRESS>7aa5:4ff:fef1:1246/64 scope link
valid_lft forever preferred_lft forever
Which confirms that eth0 got an ip address from our dhcp, for whatever reason he even has 2 ip addresses: 192.168.1.31 and 192.168.1.85 but atleast it works.
Vlan5 also has 2 ip addresses: 172.16.0.1/24 and 169.254.243.53/16. If I connect a host on this vlan with ip 172.16.0.15, I cannot access 172.16.0.1.
If I connect a host with ip 169.254.243.55, I can access the host through 169.254.243.53, so it seems that the vlan atleast works.
But I cannot figure out why this <IP_ADDRESS> address is added to the vlan5 interface and why I can't access <IP_ADDRESS><PHONE_NUMBER> scope global dynamic eth0
valid_lft 2854sec preferred_lft 2854sec
inet 192.168.1.85/24 brd <PHONE_NUMBER> scope global secondary eth0
valid_lft forever preferred_lft forever
inet6 2a02:a03f:8584:e200:7aa5:4ff:fef1:1246/64 scope global deprecated mngtmpaddr noprefixroute dynamic
valid_lft 56463sec preferred_lft 0sec
inet6 fe80::7aa5:4ff:fef1:1246/64 scope link
valid_lft forever preferred_lft forever
5: vlan5@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 78:a5:04:f1:12:46 brd ff:ff:ff:ff:ff:ff
inet 172.16.0.1/24 brd 172.16.0.255 scope global vlan5
valid_lft forever preferred_lft forever
inet <PHONE_NUMBER> brd <PHONE_NUMBER> scope global vlan5
valid_lft forever preferred_lft forever
inet6 fe80::7aa5:4ff:fef1:1246/64 scope link
valid_lft forever preferred_lft forever
Which confirms that eth0 got an ip address from our dhcp, for whatever reason he even has 2 ip addresses: 192.168.1.31 and 192.168.1.85 but atleast it works.
Vlan5 also has 2 ip addresses: 172.16.0.1/24 and <PHONE_NUMBER>. If I connect a host on this vlan with ip 172.16.0.15, I cannot access 172.16.0.1.
If I connect a host with ip <PHONE_NUMBER>, I can access the host through <PHONE_NUMBER>, so it seems that the vlan atleast works.
But I cannot figure out why this <PHONE_NUMBER> address is added to the vlan5 interface and why I can't access 172.16.0.1. Any ideas?
|
b941533ea19b675dc029bf14e1df8643c67a650010ccac30a25ba3d2c1408659 | ['2486d2dc9ad648399215187b028af9a7'] | I want to hide a particular element in react list.
This is how state looks like:
this.state = {
lgShow: false,
list: [
{ id:1, hidden: true },
{ id:2, hidden: true }
]
};
This is how component looks like:
props.list.map( result => (
<button onClick={toggle(result.id)}> Hide </button>
{ result.hidden && <div id={result.id}> .... </div> }
))
I want to write function toggle which searches the id in App.js and change value of hidden for that id, something like this(Although I'm not able to setState() in this case).
let toggle = id => {
this.state.list.filter( val=>val.id===id ? val.hidden=!val.hidden )
}
| caf908372630ef5026f883c54e63e2d1b7c08db7a8af87c518f6b3c69b3a23b8 | ['2486d2dc9ad648399215187b028af9a7'] | create a queue to catch exceptions.
errors = queue.Queue()
def threaded_func():
try:
# perform some task
except:
errors.put(
# push into queue as required
)
def main():
while True and threads_running:
if errors.__len__():
error_in_main = errors.pop()
# handle the error as required.
Using this manner you can almost immideately catch errors in main thread and perform operations as required.
|
1c8577d512cf3d8e1ecd916ac8518dfe97282ee4fa28b944a2ad754d7eed2076 | ['249864759a414befa456fcdfc90cdb76'] | I've had exactly the same problem, and ended up with this (a bit ugly) solution:
$posts = Model<IP_ADDRESS>factory('Post')...->limit($perpage)->find_many();
$user_ids = $user_lookup = array();
foreach($posts as $post) $user_ids[] = $post->user_id;
$users = Model<IP_ADDRESS>factory('User')->where_id_in($user_ids)->find_many();
foreach($users as $user) $user_lookup[$user->id] = $user;
Only 2 selects. And later in template:
{% for post in posts %}
<h2>{{ post.title }}</h2>
by author: {{ user_lookup[post.user_id].username }}
{% endfor %}
But it only works if you don't have hundreds of posts showing on one page.
| d731f8db747d733f2a28cca573d9f78c87d41fdeebf2a6afafdf0ea14aa261ba | ['249864759a414befa456fcdfc90cdb76'] | I am using following setup on my LEMP (Nginx + PHP-FPM). For Apache this should also be applicable.
PHP-FPM runs several pools as nobody:user1, nobody:user2 ...
Nginx runs as nginx:nginx
User nginx is a member of each user1, user2.. groups:
# usermod -a -G user5 nginx
File permissions:
root:root drwx--x--x /home
user1:user1 drwx--x--- /home/user1 (1)
user1:user1 rwxr-x--- /home/user1/site.com/config.php (2)
user1:user1 drwxrwx--- /home/user1/site.com/uploads (3)
nobody:user1 rw-rw---- /home/user1/site.com/uploads/avatar.gif (4)
(1) User's home dir has no x permission for other, so php-fpm pool running as nobody:user2 will not have access to /home/user1 and vice versa.
(2) php script doesn't have w for group, so it cannot create files in htdocs.
(3) On uploads dir we should manually enable write access for group user1, to enable php script to put files there. Don't forget to disable php handler for uploads, in nginx this is made by
server {
....
location ^~ /uploads/ { }
but for Apache you should check.
(4) uploaded files should also have w for group if we want user1 to be able to edit these files later via ftp or ssh (logging in as user1:user1). Php code is also editable via ftp since user1 is its owner.
Nginx will have read access to all users and write access to all user's uploads since user nginx is a member of each user1, user2, ... groups.
You should not forget to add it to all later groups. You can also modify useradd script to do it automatically.
|
ad5ce89cc8fbce6413b1f91e0a06abcfa48c9bad6a5e91f17cd46a66516d1b67 | ['249907286af54504aeb29225b16535e5'] | Django, at least from version 1.2, allows us to complete this task by using pure default pagination template tags.
{% for page in article_list.paginator.page_range %}
{% if page == article_list.number %}
{{ page }}
{% else %}
<a href="/page{{ page }}">{{ page }}</a>
{% endif %}
{% endfor %}
Where article_list is instance of
paginator = Paginator(article_list, 20)
try:
article_list = paginator.page(int(page))
except (EmptyPage, InvalidPage):
article_list = paginator.page(paginator.num_pages)
| ba46f7886f0e0464c5a3e797b8e1dedb10166f63608a17e35cff0a446761411b | ['249907286af54504aeb29225b16535e5'] | No doubt Discrete Mathematics is a basic part of mathematics, it requires basic knowledge of maths. There are many application of Discrete Mathematics in logic building in programming as well. Most of the artificial intelligent program are based with the logic of Discrete Mathematics. I'd like to recommend you this book as well "Discrete Mathematics and Its Applications by <PERSON>"
Do try solving exercises as it will help you understanding topics well.
|
98dddd0a4857634717158f03527e1be52210cfd20d7a5263281482804bed39f5 | ['2499d9093fb6453c8d047cafe959ebbf'] | Oh, i see, sorry for the duplicated post, i searched for 1 and a half days for a answer on the internet, damn. I'll try what they have there, also, what do you mean my normals? Sorry for not knowing what normals are but i don't EDIT: I tried what they said, didn't work for me. | 3b2f2cc8a0f2873e9fbf7a8b1573ba2635736ac9980a075044f21745681d1d25 | ['2499d9093fb6453c8d047cafe959ebbf'] | I'm using Lumia 535 with Google account and (default) setting of displaying nearest calendar event in the bottom part of my lock screen.
Even though my phone syncs details with Google account (e-mails, contacts and calendar events) on regular basis (every 15 minutes plus sometimes manually) and even though system calendar is up to date, I can see some completely outdated entry on my lock screen.
Most time it displays event, that I no longer have in my calendar. After most (manual or automatic) account sync, I can see that this lock-screen calendar entry does not change. And even if it does, it changes to another "ghost" event, that I had in my calendar for example yesterday or edited it (in my Gmail) and changed its title like about hours ago.
For the sake of testing, I have even installed extra calenda ("SimpleCalendar"), next to system one, to double check, if everything is OK. Both calendars shows up-to-date entries in my Google calendars and correctly synces with all recent changes. Only lock-screen remains the problem.
Does anyone recall similar situation and know, what can be causing it or how to fix it? My wife has Lumia 735 with the same software version (Denim) and for the past ten months, she has been using it, we have never encountered such weird situation.
|
0698c2a6cc2cd5df22966342bc09b9d061a60f11232b08820e15bce63a23aa02 | ['249e6f4e8d7446e1a89d491a7db7bb72'] | I have an application where it is important to check if a 3D polyline revolve fully around an axis. Here's two example where the polylines do revolve around Oz:
And here is an example where it does not:
One constraint I have that all polylines are connected (i.e the first and the last vertex is the same). Any ideas? Thanks.
| 9e6700cd73f03b55b3942e7d228fde4d34d5a4a777eccb425b40a3618eb849f9 | ['249e6f4e8d7446e1a89d491a7db7bb72'] | Hi <PERSON>, I just use this polygon (https://imgur.com/zL25cH3) to test out your algorithm but seems like I'm missing something. The polygon lie on Oxy and I'm testing to see if it revolve around Oz. Since vertex A -> H is on octants 0 -> 7, the windings I calculated is actually 0, which means Oz does not go through it. I think in this case it is. Any idea where I go off track? Thanks :). |
203c97db3b64aafc23ff433600611ffaccc45123f5f6240fad1ce21525f455ca | ['24b16c2cfab14ca2bd1daf5b3c42dde8'] | There isn't really a link between the Debian package management system and gem so the answer is probably this:
package "libmysqlclient-dev" do
action :install
end
gem_package "mysql" do
action :install
end
(The chef_gem resource does install a gem, but it's only for installing gems to use inside a Chef recipe. See all the gory details at the Chef Resources page).
For keeping apt under control, I recommend using the apt Opscode community cookbook and add recipe[apt] to the beginning of the run list for all nodes.
| 0bd1cbaff78e61d141889f54870f691df8569d0cbd99e967f617c8f2de395b64 | ['24b16c2cfab14ca2bd1daf5b3c42dde8'] | If I were you I would make sure to separate all of the data. Is this going to be completely controlled in the database, or is there going to be an application? If it is an application I would have a users table and permissions tables for the people using the application. I would do a separate a customers table for your customers. I agree with the availability table, but if you are using a price based system I would store that separately. For billing I would set up a few tables. I would have a payment type table and a transaction table with due dates. I like the idea of a check in and out table as well.
|
a593e1aa0c6b012d2ec555526ef23a73d93c798c7daf71c242f8ce9236edf404 | ['24b62c4411a84dcabf236cb5d30aec1c'] | Well, no, not really a snapshot.
Because it base its work on parsing info from the proc virtual filesystem, the content of which varies as you actually visit its directories and files. These files and directories do not actually exist per see, they are generated on the fly by the kernel as you visit them, and this can take some time. So you cannot take a "snapshot" of proc. The same goes from programs such as top: it visit all the /proc/<PID>/ directories, and it changes all the time.
A couple of things that may help speed this up, giving you more of a "snapshot-like" (yet not a snapshot) result:
As can be seen from its man page, ss proceed by first parsing /proc/net/tcp, which can take some time. Hence a --summary option:
-s, --summary
Print summary statistics. This option does not parse socket
lists obtaining summary from various sources. It is useful when
amount of sockets is so huge that parsing /proc/net/tcp is
painful.
You might also want to use the -n "no resolve" option (some others programs such as tcpdump or wireshark also have such an option, which speeds things up a lot).
-n, --numeric
Do not try to resolve service names.
| 542909122fa21c7df0d33187f14c86506664363b242f19b45cbb6e812f0f080e | ['24b62c4411a84dcabf236cb5d30aec1c'] | From Qt's doc referenced lower:
"For most features, Qt Multimedia builds upon the multimedia framework
of the underlying system."
So supported formats will rather depend on the multimedia backend used (which depend on your platform), rather than the QMediaPlaylist. Have a look here:
https://wiki.qt.io/Qt_5.5.0_Multimedia_Backends
|
17e1f8f2ccda725fd1943037ab0a4b46dae0978924c8104702cb1f2f34c10216 | ['24b7e5fe51d24a0cac7d16846513c073'] | I need to order my execution. I need to make sure my COMPLETE coords() method finishes, once it is called. how to add a promise or $q to it? I tried printing on console and found forEach loop in coords is completed after the last line of coords() function is executed. see code below. I am really new to angular help please
var appa = angular.module('appa',['firebase','uiGmapgoogle-maps']);
appa.controller('mainCtrl', function($firebaseObject,$scope,$q) {
$scope.coords = function(){
var ref = firebase.database().ref();
var latArray = [];
var lngArray = [];
var cenlat;
var cenlng;
var marker = [];
ref.once("value")
.then(function(snapshot)
{
snapshot.forEach(function(child)
{
latArray.push(child.child("Lat").val());
console.log(child.child("Lat").val());
lngArray.push(child.child("Long").val());
var mark = {
id: child.child("Id").val(),
coords: {
latitude: child.child("Lat").val(),
longitude: child.child("Long").val()
},
options: { title: child.child("Alt").val() }
};
marker.push(mark);
CONSOLE.LOG("wWHY IS THIS PRINTED aFTER??? AND HOW TO HANDLE THIS ??");
});
cenlat = (Math.max.apply(Math,latArray)+Math.min.apply(Math,latArray)/2);
cenlng = (Math.max.apply(Math,lngArray)+Math.min.apply(Math,lngArray)/2);
});
$scope.map.center.latitude = cenlat;
$scope.map.center.longitude = cenlng;
CONSOLE.LOG("wWHY IS THIS PRINTED BEFORE??? AND HOW TO HANDLE THIS ??");
});
};
$scope.map = {
center:
{
latitude: 51,
longitude: 4
},
zoom: 2
};
$scope.coords();
});
| 1e8623f8aa285433c59be4333dc6c91f951983e5c2416e17cdb40434f4423543 | ['24b7e5fe51d24a0cac7d16846513c073'] | I am trying to display markers after the map is displayed. I am unable to do so.. regardless of any error. I have assured that the snapshot is with the data and marker array is nicely created. is there any logical error?? please help.
var apps = angular.module('appa',['firebase','uiGmapgoogle-maps']);
apps.controller('mainCtrl', function($firebaseObject,$scope){
var ref = firebase.database().ref();
var marker = [];
ref.once("value")
.then(function(snapshot)
{
snapshot.forEach(function(child)
{
var mark = {
id: child.child("Id").val(),
coords: {
latitude: child.child("Lat").val(),
longitude: child.child("Long").val()
},
options: { title: child.child("Alt").val() }
};
marker.push(mark);
});
});
$scope.map = {
center:
{
latitude: 67,
longitude: 24
},
zoom: 3
};
});
<body ng-app="apps">
<div id="map_canvas" ng-controller="mainCtrl">
<ui-gmap-google-map center="map.center" zoom="map.zoom">
<ui-gmap-marker ng-repeat="m in marker" coords="m.coords" options="m.options" idkey="m.id">
</ui-gmap-marker>
</ui-gmap-google-map>
</div>
<!--example-->
</body>
|
3a97b184f47ad6b357dfa2a2adf83069b2452e480fa6416702b76636c61c9619 | ['24c1b405a2d24230a3e8101ae101e501'] | It means that element with ID idOtherInfo dosen't exist. Check your source code of web page to be sure that it shows your input correctly.
SOLUTION
If Joomla! generates forms from XML file, it adds jform_ to start of input and label ID and -lbl to end of label.
So for getting input value
var first1 = document.getElementById("jform_idOtherInfo").value;
and for label
var first1 = document.getElementById("jform_idOtherInfo-lbl").innerHTML;
| f6216cb83106a25b0e31bdbd53138ac96a982ae9e3a17816701da0c3dfcccf14 | ['24c1b405a2d24230a3e8101ae101e501'] | Your file name should be category-popular-author.php not category-popular author.php. You have missing dash.
If your category ID is 7, then I guess you have file in wrong directory. Because category-7.php should work.
From codex.
The Template Hierarchy specifies that WordPress will use the first
Template file it finds in your current Theme's directory from the
following list:
category-slug.php
category-ID.php
category.php
archive.php
index.php
So category-popular-author.php should be in wp-content/themes/CURRENT_THEME_NAME/category-popular-author.php
|
94007be1003fa57c4f7c5bb91c948220b196135b1fb9518d66bc2697c551783b | ['24cfb6bed0824958939f6f3a5d2d7bb9'] | After some time with the same disturbing error and after I write a unique Bundle Identifier and it didn't help,
I searched the web and found here that my error was that I selected a virtual device and not an real device. The solution was:
1.I plugged my iPhone
2.I clicked on the button - set the active scheme. and there it was on the top - device iPhone.
the error has gone.
| a9130caceddf7eaf0f56cd2e225cc567ecb0b2423bba00f215a6517372be6dcd | ['24cfb6bed0824958939f6f3a5d2d7bb9'] | i deleted my workbench application completely with synaptic package and installed a fresh workbench. when i opened it, all old DB's (with tables) that have been preserved showed again. so if the workbench save my old data on my ubuntu where is it so i can delete it?
just for give you more details i already delete cache and even the /.mysql/workbench/ folder and it's not helped.
|
360c0ff0c4f4fd053405db8baab4db5e71afa5b1ee32ee0d9401054dd777fadb | ['24d732bbf36d4e96ba017897282cae0e'] | Create the procedure as:
CREATE OR REPLACE FUNCTION GET_SUB_STRING(STR IN VARCHAR2, STR_DELIMITOR IN VARCHAR2:='.',STR_PART IN VARCHAR2:='1')RETURN VARCHAR2 IS
STR_RET VARCHAR2(4000):=NULL;
BEGIN
IF STR_PART = '1' THEN
STR_RET := substr(STR, 1, instr(STR,STR_DELIMITOR,1,1)-1);
ELSE
STR_RET := substr(STR, instr(STR,STR_DELIMITOR,1,STR_PART-1)+1,instr(STR, STR_DELIMITOR, 1,STR_PART)- instr(STR, STR_DELIMITOR, 1,STR_PART-1)-1);
END IF;
RETURN STR_RET;
END;
Then you can use it like this:
SELECT GET_SUB_STRING(COLUMN_NAME,',','1') FROM YOUR_TABLE
| 9a3edcd7cf53d163ab529c19921d2d9419c088d3acf18aa05be8a00f8259a334 | ['24d732bbf36d4e96ba017897282cae0e'] | Create the procedure as:
CREATE OR REPLACE FUNCTION JCOLLECT.GET_SUB_STRING(STR IN VARCHAR2, STR_DELIMITOR IN VARCHAR2:='.',STR_PART IN VARCHAR2:='1') RETURN VARCHAR2 IS STR_RET VARCHAR2(4000):=NULL; BEGIN
IF STR_PART = '1' THEN
STR_RET := substr(STR, 1, instr(STR,STR_DELIMITOR,1,1)-1);
ELSE
STR_RET := substr(STR, instr(STR,STR_DELIMITOR,1,STR_PART-1)+1,instr(STR, STR_DELIMITOR, 1,STR_PART)- instr(STR, STR_DELIMITOR, 1,STR_PART-1)-1);
END IF; RETURN STR_RET; END;
Then you can use it like this:
SELECT GET_SUB_STRING(COLUMN_NAME,',','1') FROM YOUR_TABLE
|
7775d87d480e42e40c3ffb761e52612d8f9dc4ddeaeaa5d1378252e027edc4e8 | ['24de831a261546e1ab7f4d1158411629'] | The issue is that the error message "exec: /usr/share/virt-manager/virt-manager: not found" is misleading. Most likely it just can't find the python interpreter. Try running /usr/share/virt-manager/virt-manager because you'll find it is most likely there. You will see an error message akin to "bash: /usr/share/virt-manager/virt-manager: /usr/bin/python2: bad interpreter: No such file or directory". Make sure you have python 2 installed. After the upgrade you'll likely have /usr/bin/python2.7 in place. Create a symlink to python2 like so: sudo ln -s /usr/bin/python2.7 /usr/bin/python2. After that ./virt-manager should start again just fine.
| 8084d5b617315e5a65bc06e07b729b939dd56e9eac1475811b4d0a223c628331 | ['24de831a261546e1ab7f4d1158411629'] | <PERSON> No, and it never did it again. I can't recall whether it had any other problems that required a reboot after the week in question, but the same problem did not occur. The only solution I know of is to not utterly depend on EC2. Is it happening to you as well? |
9977d81417317eaaf3c64f7057dac9487cb189ef91788a35778232532b72177b | ['24e1013cfb804f6c88ea38e34e1c2c45'] | I am trying to understand a usecase where a web application can authenticate with keycloak server with the following scenarios
Create a realm dynamically from a sign up page(trying to achieve multi tenancy)
Realm has its own authentication properties from user creations to roles assignment.
Authenticate a user against a realm from the provided subdomain.
Instead of mapping user with tenant name and doing a get call on the
service to get the tenant name.
Because the documentation states that tenant name is needed for user authentication.
From the UI I understand that:
1. we need to get token from master realm
http://localhost:8080/auth/realms/master/protocol/openid-connect/token
2. Then create a realm
http://localhost:8080/auth/realms/test
Im not sure if this is a secure workflow.
And not sure if I have to create a client after creating a realm.
Appreciate some thoughts on this.
| 35f2b2a112cc5b8cb4be08b11425cc0a69c3e93a1d6f173428415ab373def847 | ['24e1013cfb804f6c88ea38e34e1c2c45'] | You can convert the list to a dictionary and add the values if it has the same key.
nested_lists = [['A', 50, 10, 10, 10], ['B', 50, 40, 30, 70], ['C', 50, 20, 40, 30], ['A', 20, 20, 20, 20]]
dict = {}
for _list in nested_lists:
key = _list[0]
val = _list[1: ]
if key in dict:
dict[key] = [a + b for a, b in zip(dict[key], val)]
dict.setdefault(key, val)
|
dae5d0fde0ad899a9836b07da4fde4a8c7bb702229dd32fc0352e3f3dcb2ccb9 | ['24e34b7bc60a439c811d6ac4e4a90fbd'] | Just as an add-on, I would like to mention that C++11 codifies things somewhat using the constexpr keyword. Example:
#include <iostream>
#include <cstring>
constexpr unsigned static_strlen(const char * str, unsigned offset = 0) {
return (*str == '\0') ? offset : static_strlen(str + 1, offset + 1);
}
constexpr const char * str = "asdfjkl;";
constexpr unsigned len = static_strlen(str); //MUST be evaluated at compile time
//so, for example, this: int arr[len]; is legal, as len is a constant.
int main() {
std<IP_ADDRESS>cout << len << std<IP_ADDRESS>endl << std<IP_ADDRESS>strlen(str) << std<IP_ADDRESS>endl;
return 0;
}
The restrictions on the usage of constexpr make it so that the function is provably pure. This way, the compiler can more aggressively optimize (just make sure you use tail recursion, please!) and evaluate the function at compile time instead of run time.
So, to answer your question, is that if you're using C++ (I know you said C, but they are related), writing a pure function in the correct style allows the compiler to do all sorts of cool things with the function :-)
| 722dbb3b6b3e55d22435db0d3a607c0604ddee8c136c4685f210704ddb4dfd92 | ['24e34b7bc60a439c811d6ac4e4a90fbd'] | <PERSON> has a good talk that you can watch here about static if in a C++ context (if that's what your asking for).
Link: http://channel9.msdn.com/Events/GoingNative/GoingNative-2012/Static-If-I-Had-a-Hammer
Short answer- it makes the syntax for some template metaprogramming a lot more intuitive.
|
f42d2173b496e4fdf31670b4c5318459cfc4b0bf0dddb59e8ad665bf2ba5664d | ['24f010809c304f3f97d396819598ebf9'] | I have a master page and test page.in test page i use master page:
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Master.Master" CodeBehind="test.aspx.cs" Inherits="ServiceLayer.Recognition.test" %>
But during executing i received this error:
Content controls have to be top-level controls in a content page or a nested master page that references a master page.
| 66ff1e8e545da00ee0e1e913c86561a4c25738d002ce14c6453c30a823947f85 | ['24f010809c304f3f97d396819598ebf9'] | I have a GridView that it contain a Drop-down list.I have a list that wanna to bind this list to drop-down in gridview.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"OnSelectedIndexChanged="GridView1_SelectedIndexChanged" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<ItemTemplate>
<asp:Label ID="Label2" runat="server"></asp:Label>
<asp:DropDownList ID="DropDownList3" runat="server" AppendDataBoundItems="True" OnSelectedIndexChanged="DropDownList3_SelectedIndexChanged1" >
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
and
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
DropDownList dropdown = (DropDownList)e.Row.FindControl("DropDownList3");
ClassDal obj = new ClassDal();
List<phone> list = obj.GetAll();
dropdown.DataTextField = "phone";
dropdown.DataValueField = "id";
dropdown.DataSource = list.ToList();
dropdown.DataBind();
}
and
namespace sample_table
{
public class ClassDal
{
public List<phone> GetAll()
{
using (PracticeDBEntities1 context = new PracticeDBEntities1())
{
return context.phone.ToList();
}
}
}
}
but i received this exception :Object reference not set to an instance of an object
on the row: dropdown.DataTextField = "phone";
|
aeda1a0c352c8bfde8ae41937353de31d2b9de603712b63b2521ca795bfe127c | ['2504d6fe3300429bb6e88da1b70170f1'] | You can now animate vertical-align if you use a measurement!
vertical-align values
set your vertical-align to something like a % or a px and include a transition on that.
Or using jquery, apply a class that contains a css keyframe like so:
.item5, .item6 {
color: #fff;
display: inline-block;
text-align: center;
}
.item5 {
width: 100px;
height: 100px;
background: #03A9F4;
}
.item6 {
width: 150px;
height: 150px;
background: #ff5722;
}
.item6:after {
content: '';
width: 1px;
height: 1px;
background: black;
-webkit-animation: move 2s infinite alternate;
-moz-animation: move 2s infinite alternate;
-o-animation: move 2s infinite alternate;
animation: move 2s infinite alternate;
}
@-webkit-keyframes move { from { vertical-align: 0% } to { vertical-align: 100% } }
@-moz-keyframes move { from { vertical-align: 0% } to { vertical-align: 100% } }
@-o-keyframes move { from { vertical-align: 0% } to { vertical-align: 100% } }
@keyframes move { from { vertical-align: 0% } to { vertical-align: 100% } }
<div class="item5">1</div>
<div class="item6">2</div>
I'm not sure of the browser support though!
| 48534762a4547987d9b5254e8bb1f06d047626248990c3e937b2f132be2e29ab | ['2504d6fe3300429bb6e88da1b70170f1'] | The canvas itself is not aligned to anything. It sits on its own baseline. By vertical-aligning:middle, you are aligning the canvas's middle to the baseline of the text which is the bottom of the text, not the middle of the button.
for a very detailed explanation of how vertical-align works
button {
font-size: 24px;
padding: 20px 0 10px;
}
div {
font-size: 60px;
padding: 10px 0 20px;
background: blue;
display: inline-block;
}
canvas {
width: 100px;
height: 100px;
border: 2px solid black;
vertical-align: middle;
}
<button>Hey</button>
<div>Hey</div>
<canvas></canvas>
|
6e02b384819634ecda267d585b2f51559e5bb8974eee8699e6f1be40fcbfbfd7 | ['250b5b9058bf4cc5846d83b577e47576'] | Use "... LIKE :search ..." instead of "LIKE ':search' ...".
Are you sure you are checking errors from PDO correctly?
If I run your example I get an Error "Invalid parameter number: number of bound variables does not match number of tokens" and not an empty result.
(This is because ':search' is not recognized)
On another note: If you don't know which one of your two changes did cause the problem, why did you do 2 changes at once in the first place?
(Maybe I should have written this as a comment, but I need 50 reputation to be allowed to comment.)
| 02d1851452dc152d1c9ab6ca65f85313bd8028d6f117d527141a8e307df30b04 | ['250b5b9058bf4cc5846d83b577e47576'] | Not very time or memory efficient, but working:
$results = [];
// create a two dimensional array to collect all arrays which are the same
$collection = [];
foreach ($input as $elem) {
$collection[serialize($elem)][] = $elem;
}
// create the result array
foreach ($collection as $elems) {
$result = [];
foreach ($elems[0] as $key => $value) {
$result[$key] = $value * count($elems);
}
$results[] = $result;
}
print_r($results);
(assuming your array comes in $input)
|
a6381fc6c8580baee54b260ddb99f5c6251acf82ce5b35ced3031005baa38425 | ['250f3a88e63c463a9557b4bb6f1ba7b0'] | sounds to me that it will be hard to keep the number of clicks down when trying to solve this with a macro.
Alternatively there is the RoiManager. Then draw a ROI, and hit T key to add it to the list. Then you can save all the ROI's with More>Save. Or you use your macro to iterate over the ROI's and do something with them (save coordinates to a text file, or apply the ROI to another image)
| 73b4206a4a34460b33b534ba407613e01a12da59686733937a5b4883377fd8ad | ['250f3a88e63c463a9557b4bb6f1ba7b0'] | To my knowledge there is not option in read_json() to do that. My suggestion would be to re-work the table once you read the data.
t = pd.read_json('data.json')
t['time'] = [x[1] for x in t['current']]
t['current'] = [x[0] for x in t['current']]
t['voltage'] = [x[0] for x in t['voltage']]
|
a770de5b5a86160bc73789a5278f53c31e50c8becbe8c4412a6c2d488e3d6e5e | ['25159534a9ca45d38d1a3a93128e6798'] | I defined a text area field in an extJS window as follows:
me.myTextArea = Ext.create({
xtype: 'textareafield',
width: 500,
height: 500,
editable: true,
selectOnFocus: false,
listeners: {
afterrender: function() {
this.focus(true);
let cursorPos = this.getValue().length;
this.selectText(cursorPos, cursorPos);
}
}
});
I added the text area field to a panel contained within a window, and I set the text area field as focus element. I prevented the text there to be selected after the textarea field's being rendered. I would like to add the following feature. On closing the window, I will be able to get the position the cursor has within the text area field. So far, my attemps at resolving the problem were withou success. I set up an alert as follows:
listeners: {
'close': function(me) {
alert(me.getCaretPos(cmp.myTextArea.getEl().getId()));
}
},
Now the function named "getCaretPos" is designed to get the cursor position. I did not invent the function, but I found in on the net. Haplessly, the function does not work, it always returns -1:
getCaretPos: function(id){
var <PERSON> = document.getElementById(id);
var rng, ii=-1;
if(typeof el.selectionStart=="number") {
ii=el.selectionStart;
} else if (document.selection && el.createTextRange){
rng=document.selection.createRange();
rng.collapse(true);
rng.moveStart("character", -el.value.length);
ii=rng.text.length;
}
return ii;
}
Especially, I do not undertsand, why "el.selectionStart" is always undefined in the function. I would be very glad if somebody could help me in resolving this mystery.
| b7546d52a45e16a942c063ef0ed8c03663d2f26bb55211d4340d1c0d98094b5e | ['25159534a9ca45d38d1a3a93128e6798'] | <PERSON> wrote a wsdl for a Webservice, which is in a folder named xml. Now I want to generate the JAVA-classes with the following command:
wsimport -Xnocompile -s src xml/GuestBook.wsdl
As my eclipse doesn't ship wsimport, I downloaded jaxws-ri and set its path (C:\Users...\jaxws-ri\bin under system variables), and I also restarted the computer.
Haplessly, I cannot generate the Java classes because wsimport semms not to work. What could be the cause of this error?
|
f2656eb7c4eb52e13d6a5bed3a015e9ec307e80547c98a1720d65588f56c4d53 | ['251e0dfd4a3f4bfa8df7b7ff20bf76fc'] | I was missing a call to glViewport for the shared render context.
The value of the Viewport was defaulted to (0, 0) -> (width, height) for the context used by the visible window. The shared render context had been defaulted to (0, 0) -> (1, 1) because I used a width and height of 1 for the non-visible GLFW window.
| cf15241c36380a877d4ae678d5f5c945a356e0591d3d7115c97cac7e739a07c1 | ['251e0dfd4a3f4bfa8df7b7ff20bf76fc'] | The error is due to the call to socket.close() before the call to socket.shutdown(). If you close a socket while there is a pending synchronous read(), you will occasionally get that error. It is really due to an expected data race in the underlying asio socket code.
Try removing the socket.close() call. Assuming your socket is wrapped in some kind of shared_ptr, you can let the socket destructor close the underlying socket.
You will still want to call socket.cancel() and socket.shutdown() explicitly in your use case in order to cancel outstanding operations.
|
48b51acb5e7b672973f31fe4faf34eb9ae8b3987520b0383f4410181a5fc45d1 | ['252bf8a8921a4101b7440a8e1b39b671'] | Per the example in the documentation, child states will inherit resolved dependencies from parent states. Furthermore, you can have promises for parent dependencies be resolved before children are instantiated by injecting keys into child states.
See example from documentation:
$stateProvider.state('parent', {
resolve:{
resA: function(){
return {'value': 'A'};
}
},
controller: function($scope, resA){
$scope.resA = resA.value;
}
})
.state('parent.child', {
resolve:{
resB: function(resA){
return {'value': resA.value + 'B'};
}
},
controller: function($scope, resA, resB){
$scope.resA2 = resA.value;
$scope.resB = resB.value;
}
However, how do you do this if the dependency is NAMED, not a function. For example, see bolded part:
$stateProvider.state('parent', {
resolve:{
resA: 'ServiceA'
}
},
controller: function($scope, ServiceA){
$scope.ServiceA = ServiceA.value;
}
})
.state('parent.child', {
resolve:{
ServiceB: ServiceB
}
},
controller: function($scope, ServiceA, ServiceB){
}
I can't figure out how to make ServiceB wait for ServiceA to first be instantiated before instantiating.
I tried putting 'ServiceA' as a dependency for ServiceB, but that doesn't work.
Thanks in advance for any help.
| ae062f16649c31f9157f59313aad67281a91bcee8c8e1f4d4fd0b7d580059ee3 | ['252bf8a8921a4101b7440a8e1b39b671'] | Something very strange is causing me much grief and it has to do with Django sessions. Sometimes my code works as expected, and other times it does not.
The workflow I have is this:
User visits URL '/connect/', which resolves to the following function 'get_session_id'. Inside this function, I obtain an "ebay session id", which is a session ID that the ebay API sends me. After I obtain this "ebay session id", I redirect users to an ebay URL that allows users to validate themselves.
import json
import pytz
import requests
from django.contrib.auth import authenticate, login, logout
from django.http import HttpResponseRedirect
from django.shortcuts import redirect, render
from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError
def get_session_id(request):
api = Trading(
appid="XXXXXXXXXXXXXX",
devid="XXXXXXXXXXXXXX",
certid="XXXXXXXXXXXXXX",
config_file=None,
)
res = None
max_retries = 5
number_retries = 0
while number_retries <= max_retries:
try:
res = api.execute(
'GetSessionID',
{"RuName": "XXXXXXXX"}
)
except requests.exceptions.ReadTimeout as exception:
if number_retries > max_retries:
raise exception
number_retries += 1
except ConnectionError as exception:
raise Exception('ConnectionError:\n%s' %
json.dumps(exception.response.dict(), sort_keys=True, indent=5))
else:
break
redirect_url = "https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=%s&SessID=%s" % \
("XXXXXXXXXXXXXX", res.reply.SessionID)
response = HttpResponseRedirect(redirect_to=redirect_url)
print 'Fetched eBay SessionID: %s' % res.reply.SessionID
print 'Django Session Key: %s' % request.session._get_session_key()
request.session['ebay_session_id'] = res.reply.SessionID
request.session.modified = True
return response
If the user successfully validates, I instruct eBay to direct users back to the 'fetchToken/' URL on my site, which resolves to the following function 'fetch_token'. At this point I need to get the original 'ebay_session_id' that I stored in the request.session / Django session above, but for some reason the Django session key sometimes does not match up! Can someone explain why this is the case???
def fetch_token(request):
api = Trading(
appid="XXXXXXXXXXXXXXXXX",
devid="XXXXXXXXXXXXXXXXX",
certid="XXXXXXXXXXXXXXXXX",
config_file=None,
)
print 'Retrieved eBay SessionID for FetchToken: %s' % request.session['ebay_session_id']
print 'Django Session Key: %s' % request.session._get_session_key()
res = None
max_retries = 5
number_retries = 0
while number_retries <= max_retries:
try:
res = api.execute(
"FetchToken",
{"SessionID": request.session['ebay_session_id']}
)
except requests.exceptions.ReadTimeout as exception:
if number_retries > max_retries:
raise exception
number_retries += 1
except ConnectionError as exception:
raise Exception('ConnectionError:\n%s' %
json.dumps(exception.response.dict(), sort_keys=True, indent=5))
#return HttpResponse(e.response.dict())
else:
break
expiration_time_aware = res.reply.HardExpirationTime.replace(tzinfo=pytz.UTC)
EbayTokens.objects.create_ebay_token(eias_token=res.reply.eBayAuthToken,
expiration_time=expiration_time_aware,
user=request.user)
My settings file has the following lines to enable sessions, so that's not the problem. I am using Django 1.9.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
MIDDLEWARE_CLASSES = [
'corsheaders.middleware.CorsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
As I said, SOMETIMES it works, and sometimes it doesn't. I get the feeling that it stops working when I log in with a user, hit a bug, and then refresh. Please see below for an example when it doesn't work. When I go to "/connect/", I have the Django Session Key that starts with "mxcp...", but then when I instruct eBay to redirect back to "/fetchToken/", I get the key that starts with "4b2b".
It might be interesting to note that in my 'django_session' table, "4b2b.." is the second to last entry, whereas "mxcp..." is the last entry.
[21/May/2017 19:17:03] "POST /signup HTTP/1.1" 302 0
Fetched eBay SessionID: skADAA**2c710a5615c0a5f02a54ffe4fffffa58
Django Session Key: mxcpfrtaz2psxf9bp8tb5m2qyknzmw6a
[21/May/2017 19:17:04] "GET /connect/ HTTP/1.1" 302 0
Retrieved eBay SessionID for FetchToken: skADAA**2c6c73ae15c0a7958d63e7e3fffffa42
Django Session Key: 4b2b2d7shui5qxa593wfnccy6c4fudz5
Someone please help, I'll be forever indebted.
|
466affb1cef9536701b9fe5a63a3810b01344d561011e642ad0ccd1d721b8188 | ['252ee780fcfa4aa68abe785da0d78c04'] | Here is my solution : Send your image to this function, with the size of the sprite, followed by the size of the tile. This will return a tiled SKTexture.
-(SKTexture *)tiledTextureImage:(UIImage *)image ForSize:(CGSize)size tileSize:(CGSize)tileSize{
// First we create a new size based on the longest side of your rect
int targetDimension = (int)fmax(size.width,size.height);
CGSize targetSize = CGSizeMake(targetDimension, targetDimension);
// Create a CGImage from the input image and start a new image context.
struct CGImage *targetRef = image.CGImage;
UIGraphicsBeginImageContext(targetSize);
CGContextRef contextRef = UIGraphicsGetCurrentContext();
// Now we simply draw a tiled image
CGContextDrawTiledImage(contextRef, CGRectMake(0,0, tileSize.width,tileSize.height), targetRef);
UIImage *tiledTexture = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
// Finally create a texture and return it.
return [SKTexture textureWithImage:tiledTexture];
}
| 38972422b2c776c2dd4848027e584089d7ed5e943ce55df227a7659b738338ed | ['252ee780fcfa4aa68abe785da0d78c04'] | I uncovered the problem, i had the .xml files in the same directory as the executable and this error was occurring.
Instead i moved the xml files to my home directory and referenced them from there.
originally:
if (!face_cascade.load("./haarcascade_frontalface_alt.xml")) {
printf("Unable to load classifier ");
return 0 ;
}
Now :
if (!face_cascade.load("/Users/$my username$/Documents/$$projectName/$$ProjectName/haarcascades/haarcascade_frontalface_alt.xml")) {
printf("Unable to load classifier ");
return 0 ;
}
Problem solved.
|
98c9009f41f4305bff1602d0f51cec25e20b65be1e592f591b0b8ed50fbde31e | ['253ac18156c2430c994550c8933bca49'] | To add to all the answers here,
It did not work for me in xml no matter where I tried to apply, in AppTheme, referencing in styles. I am currently using support library 27.1.1
It worked only programatically.
Typeface typeface = ResourcesCompat.getFont(this, R.font.my_custom_font);
collapsingToolbarLayout.setCollapsedTitleTypeface(typeface);
collapsingToolbarLayout.setExpandedTitleTypeface(typeface);
| 1875c42b753ca4836ae5f1d57ceb67d72053aefc775eb2caa7d4fb6600cd1d54 | ['253ac18156c2430c994550c8933bca49'] | Context: I am building a design tool.
Video of the problem: https://share.getcloudapp.com/z8uYpKv2
I have a rectangle that can be resized proportionally (scaled) as you can see in the video. Inside the rectangle, I have child rectangles that need to adjust based on the parent rectangle.
Here is how I am calculating the changes as the box moves for the width, height, and x coordinates. I am having trouble with the y-axis.
Let's start the box dimensions at 100x100 with a child box at 50x50, then it scales down to 50x50 (0.5). The child then becomes 25x25.
Calculations
width = 50 / 100 * 25 (new width / original width * original box width)
height = 50 / 100 * 25 (new height / original height * original box height)
x = 0 - (-50) (original x - delta x)
y = ??
Here is what I am trying to achieve https://share.getcloudapp.com/Z4uyeWbO. You can see the parent square is being scaled down, and the child is moving in accordance with the parent. The width is shrinking at scale, the height is shrinking at scale, also the X position is moving from a delta. The hard part to solve is the Y position, it appears to be moving along the hypotenuse. This is what I am trying to solve for -- I am not sure how to put this in math terms.
Here is what I have tried.
y = 50 / 100 / √2 * 50 (new height / original height / square root(2) * original y)
Sorry if the way I communicated this is weird, I am not very math-oriented and excited to learn here, so I appreciate your understanding and patience.
|
cfb16709332c59b110fea8117e7268d5162b31193453e3b7c49715fb88d32eab | ['254280948e0f49f48ba893b9447b6266'] | For my site I need to be able to tell the difference between when an Android tablet visits and when an Android phone visits. It needs to be detected before the page is sent to the user so using JavaScript to check the screen res isn't an option.
At the moment I use this to detect an android device:
stripos($ua, 'android')
Is there anything unique thar a tablet has in it's user agent?
| 71806021cc8d4a8c6d2ba305fa7cd160ab669c12d674ed6aa9468e3656da9822 | ['254280948e0f49f48ba893b9447b6266'] | so today i got my server and i tried to install ubuntu server 14.04 LTS from my Universal Serial Bus stick and i have 8 disk on the server with 148 gb on each, when i get to the point where i am going to choose a disk then i do so. after the installation it installed it on the Universal Serial Bus and not on the disk. I have tried to do the thing i can do and i need help. when i try to boot from disks i get this message (trying to boost from (C:) drive) and when i boot from the Universal Serial Bus i get into the OS (from the Universal Serial Bus)
|
69e7379652a14a247a2dcd244436bb7f29c129128fe64043e62e89e3487a1fbc | ['254e47776a044d82b1a32c945b300e09'] | <PERSON> posted on ea forum yhat qr code goes to need for speed website posting information about their network. I haven't been able to get them to work yet though. http://answers.ea.com/t5/Need-for-Speed-Rivals/How-to-scan-a-qr-code-in-ps4-for-need-for-speed-rivals/td-p/1957339 | e2928e581b8e96dc2714e42513f915b779944ef7c2a859c8ee2ddd310152d790 | ['254e47776a044d82b1a32c945b300e09'] | I'm on windows 7 and was hoping to find an application that would make it easy to assign hotkeys to applications, for example I might assign ALT+C as the command to bring my Chrome window to the front (or open a new instance if I don't have Chrome open).
I was wondering if anyone can recommend an application that does this?
|
04f3272bbd7d7ef99a3a2f512b94f6d513f1e16a7db33d71b3185fafb2cc5c62 | ['255549b693aa4571b52121a54a249cdc'] | Thank you so much!
It also implies this.
Normal Sentence: The cat jumped up and the mouse ran away.
Inverted Sentence: Up jumped the cat and away ran the mouse.
Can you apply this in this sentence?
I arrived on time, as my classmates did, but the lecturer wasn’t there.
What do you think is the right answer? | 4204942271e5d2da3eefac64fb3d1751497e57826c629c9676fb704665638764 | ['255549b693aa4571b52121a54a249cdc'] | The curve $xy =1$ has a slope that is negative everywhere in the first quadrant. This is apparent both visually and algebraically ($dy/dx = -y/x$).
Its reflection in the line $x=4$ is the curve $y(8-x) = 1$ (Reflection of rectangular hyperbola in vertical line)
When I plot the curve using R it seems as if the slope of the reflected curve is positive everywhere in the first quadrant. But algebraically the slope $dy/dx$ is given by $y/(8-x)$ which indicates that when x is greater than 8 the slope is negative.
I can't believe that my eyes are deceiving me. Is the equation for the slope correct?
|
785ffd85feb9c3883dcd2d75101ce6c2aa07d00c31fb218ba5f7388ccfc6a969 | ['257eb615f9724a6d9fb21a7a0fe3a7b4'] | Usually the first way to learn of recurrence/transience is in the probability that the <PERSON> chain ever returns to state $i$. This probability is 1 for a recurrent state (think about how this relates to an infinite number of visits to that state) and less than 1 for a transient state. | 6dea83994950fd2b109822bd766375daab6c775d21174a93c4537e16778880bb | ['257eb615f9724a6d9fb21a7a0fe3a7b4'] | Would the power series approach consist of writing $$f(z) = \sum_{n=0}^{\infty} c_nz^n $$ and then, from the definition of $h(z)$, writing $$h(z) = \sum_{n=0}^{\infty} \frac{1}{z} c_n z^n $$ and then noting that the radius of convergence of the newly defined power series is unchanged from the radius of convergence of $f(z)$ expressed as a power series? |
3c7ed26f43469f426a13de2a7cdc371e7980cf37dc4a3c75469a53ef9e9137ae | ['258c95f4cb904ef2991e8c2e10c43a5c'] | You can see the version of Scala that is supported by Spark in the Spark documentation.
As of this writing, the documentation says:
Spark runs on Java 8+, Python 2.7+/3.4+ and R 3.1+. For the Scala API, Spark 2.3.2 uses Scala 2.11. You will need to use a compatible Scala version (2.11.x).
Notice that only Scala 2.11.x is supported.
| a6d9d5758e3b43938fa1977d53ca3f07726e85ae3754297fdb1b3dfe5c176314 | ['258c95f4cb904ef2991e8c2e10c43a5c'] | Here is how to print the response status and body using tokio 0.2, hyper 0.13, and async/await syntax.
use std<IP_ADDRESS>error<IP_ADDRESS>Error;
use hyper<IP_ADDRESS>body;
use hyper::{Body, Client, Response};
use hyper_tls<IP_ADDRESS>HttpsConnector;
use tokio;
#[tokio<IP_ADDRESS>main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let https = HttpsConnector<IP_ADDRESS>new();
let client = Client<IP_ADDRESS>builder().build::<_, Body>(https);
let res = client
.get("https://www.reddit.com/r/programming/.rss".parse().unwrap())
.await?;
println!("Status: {}", res.status());
let body_bytes = body<IP_ADDRESS>to_bytes(res.into_body()).await?;
let body = String<IP_ADDRESS><IP_ADDRESS>{Body, Client, Response};
use hyper_tls::HttpsConnector;
use tokio;
#[tokio::main]
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
let https = HttpsConnector::new();
let client = Client::builder().build<IP_ADDRESS><_, Body>(https);
let res = client
.get("https://www.reddit.com/r/programming/.rss".parse().unwrap())
.await?;
println!("Status: {}", res.status());
let body_bytes = body::to_bytes(res.into_body()).await?;
let body = String::from_utf8(body_bytes.to_vec()).expect("response was not valid utf-8");
println!("Body: {}", body);
Ok(())
}
|
1a1a13462ea486acc1be630882dc8ad49984d60744dc4a4f0b64bb32f1d83afb | ['259b07f7cc564c59baff303c4d118985'] | I am a little stuck on a small project I am working on and I would appreciate your help.
I have two data frames.
The first one is larger and it is the one I want to use for my final analyses.
It contains ISIN for bonds based on industry, region and has ratings from S&P and Moody’s.
ISIN
Industry
Region
SP
MD
The second data has Industry, rating(S&P and Moody’s) and region as well as an estimated rating based on financial information like investments, spending on R&D etc.
Industry
Region
SP
MD
Internal Estimate
I would like to extract in a new column in the first database the internal rating based on the Industry, Region and Rating labeled “Internal Estimate”.
A merge wouldn’t work because in an industry you can have several S&P and Moody’s ratings or even sometimes those are missing.
That is why I have written a code with the following conditions:
For i in range (1: i):
if Bond_Rating[‘MD’]='' and Bond_Ratings[‘SP’]='':
Bond_Rating[Internal Estimate] = ''
elif Bond_Rating['MD']='' and Bond_Rating[‘SP’]!='':
Bond_Rating['INTERNAL ESTIMATE']= Bond_Rating.lookup[concat('BicId','RegionName',’SP’),INTERNAL ESTIMATE.Table[‘InternalEstimate’]]
elif Bond_Rating['MD']!='' and Bond_Rating[‘SP’]='':
Bond_Rating['INTERNAL ESTIMATE']= Bond_Rating.lookup[concat('BicId','RegionName','MD'), INTERNAL ESTIMATE.Table[‘InternalEstimate’]]
elif Bond_Rating['MD']!='' and Bond_Rating[‘SP’] !='':
Bond_Rating['INTERNAL ESTIMATE']= Bond_Rating.lookup[concat('BicId','RegionName','MD',’SP’), INTERNAL ESTIMATE.Table[‘InternalEstimate’]]
However, I am unsure why my code doesn’t work. I keep getting errors.
I would appreciate your assistance.
| dbc028d545bbc7bcaaea78948b50e7822c22e201f66c0698c90c781bda0deb9a | ['259b07f7cc564c59baff303c4d118985'] | I have an issue with creating a time period in R.
The data that I have on hand is enter image description here
Now I want to do the following.
Identify the hour intervals between start and end time and create a list
Identify the hour intervals b/n start and the break time
Finally, remove the break intervals to find the total time
and then create an output.
Could you please assist me?
|
b0a64393d42196d553cd60b983d8b8c55263bfe3000d9a178176fc858f91f204 | ['25a64476c9124418b467d359cc03af1d'] | I have created table using active report which contains few columns.
Now I want to call that table multiple times.
eg. suppose if there are 3 buildings then that table should called 3 times.
if there are 4 buildings then table should called 4 times.
I have to filled info in table according to each building.
Is it possible in active reports?
| 648a9a0de86fced319f2c07e25f84fd8a91623444a0ad8844c5ce27f6e00f98d | ['25a64476c9124418b467d359cc03af1d'] | I'm new in Active Reports.
I'm using Active Reports version 13. I have created report and showing it in WPF application.
Now i want click event on each rows of table.
Is it possible? and answer is yes then please tell me how.
I search about this problem but i don't found any solution
|
38a7a00fb6a0ce88b7b8d8d22abd509b86071d5c0308aab93ed8b905bb73a410 | ['25be922920414914acbda907d9ff83be'] | I used XAMPP on my linux computer for hosting simple database application. I had it installed in /opt/lampp/ directory. I copied whole /opt/lampp/ directory from backup to new machine. When I run /opt/lampp/xampp start, I get
Starting XAMPP for Linux 1.8.3-4...
XAMPP: Starting Apache...ok.
XAMPP: Starting MySQL...ok.
I can connect to web-server, but it cannot connect to database. When I try to manage database from phpMyAdmin as root user, I get #2002 Cannot log in to the MySQL server.
When I try to stop server, I get
Stopping XAMPP for Linux 1.8.3-4...
XAMPP: Stopping Apache...ok.
XAMPP: Stopping MySQL...not running.
I have directory with name of database in /opt/lampp/var/mysql containing .frm and .ibd files, but I don't have sql dumps.
How can I chceck status of mysql server? (It should be installed locally somewhere in /opt/lampp directory.)
Do I need to modify something on my new system outside of /opt/lampp directory? (Create user, ...)
| d57953926d20fa99ae7d85ac445386b4d15f4dfe79db4730cb28fc63ddf70404 | ['25be922920414914acbda907d9ff83be'] | <PERSON> An extremely large portion of the code we run in webservers is library code. If it's well encapsulated and tested or else has simple inputs and outputs which are unlikely to need to change (e.g. a thread abstraction lib), we find it safe to treat as a black box. In our codebase at work we have a number of these; knotty, dense classes that act as well sealed boxes we have never had to reopen. Where an abstraction includes business logic is where I get scared about maintenance. |
ef557569b4c7618fb5e401511fd5165dac47a95b9465ce536c43e8836c24c7fc | ['25dbe7bb8bb14368b5e7985f49292688'] | I am trying to open popup after clicking on button using python kivy but getting an error
Here is my code:
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.label import Label
from kivy.uix.popup import Popup
from kivy.config import Config
Config.set("graphics", "resizable", 0)
Config.set("graphics", "width", 400)
Config.set("graphics", "height", 500)
class myLayout(BoxLayout):
def __init__(self, **kwargs):
super(myLayout, self).__init__(**kwargs)
btn = Button(text="Click")
btn.bind(on_press=self.clk)
self.add_widget(btn)
def clk(self, obj):
popup = Popup(content="I am popup")
return popup.open()
class ReminderApp(App):
def build(self):
mL = myLayout()
return <PERSON>
if __name__ == "__main__":
ReminderApp().run()
It works if in clk function instead of popup just print something, for e.g.:
def clk(self, obj):
print("Hello world")
Help me please, I'm stuck
Here is the error message:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/lang/builder.py", line 619, in _apply_rule
setattr(widget_set, key, value)
File "kivy/weakproxy.pyx", line 33, in kivy.weakproxy.WeakProxy.__setattr__
File "kivy/properties.pyx", line 478, in kivy.properties.Property.__set__
File "kivy/properties.pyx", line 516, in kivy.properties.Property.set
File "kivy/properties.pyx", line 571, in kivy.properties.Property.dispatch
File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
File "kivy/_event.pyx", line 1120, in kivy._event.EventObservers._dispatch
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/popup.py", line 223, in on__container
self._container.add_widget(self.content)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/boxlayout.py", line 312, in add_widget
widget.fbind('pos_hint', self._trigger_layout)
AttributeError: 'str' object has no attribute 'fbind'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 40, in <module>
ReminderApp().run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/app.py", line 826, in run
runTouchApp()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/base.py", line 502, in runTouchApp
EventLoop.window.mainloop()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/core/window/window_sdl2.py", line 723, in mainloop
self._mainloop()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/core/window/window_sdl2.py", line 460, in _mainloop
EventLoop.idle()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/base.py", line 340, in idle
self.dispatch_input()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/base.py", line 325, in dispatch_input
post_dispatch_input(*pop(0))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/base.py", line 231, in post_dispatch_input
listener.dispatch('on_motion', etype, me)
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/core/window/__init__.py", line 1352, in on_motion
self.dispatch('on_touch_down', me)
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/core/window/__init__.py", line 1368, in on_touch_down
if w.dispatch('on_touch_down', touch):
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/widget.py", line 460, in on_touch_down
if child.dispatch('on_touch_down', touch):
File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/behaviors/button.py", line 151, in on_touch_down
self.dispatch('on_press')
File "kivy/_event.pyx", line 703, in kivy._event.EventDispatcher.dispatch
File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
File "kivy/_event.pyx", line 1138, in kivy._event.EventObservers._dispatch
File "main.py", line 25, in clk
popup = Popup(content="I am popup")
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/modalview.py", line 152, in __init__
super(ModalView, self).__init__(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/anchorlayout.py", line 68, in __init__
super(AnchorLayout, self).__init__(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/layout.py", line 76, in __init__
super(Layout, self).__init__(**kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/widget.py", line 348, in __init__
Builder.apply(self, ignored_consts=self._kwargs_applied_init)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/lang/builder.py", line 469, in apply
self._apply_rule(widget, rule, rule, ignored_consts=ignored_consts)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/lang/builder.py", line 630, in _apply_rule
e), cause=tb)
kivy.lang.builder.BuilderException: Parser: File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/data/style.kv", line 506:
...
504:# Popup widget
505:<Popup>:
>> 506: _container: container
507: GridLayout:
508: padding: '12dp'
...
AttributeError: 'str' object has no attribute 'fbind'
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/lang/builder.py", line 619, in _apply_rule
setattr(widget_set, key, value)
File "kivy/weakproxy.pyx", line 33, in kivy.weakproxy.WeakProxy.__setattr__
File "kivy/properties.pyx", line 478, in kivy.properties.Property.__set__
File "kivy/properties.pyx", line 516, in kivy.properties.Property.set
File "kivy/properties.pyx", line 571, in kivy.properties.Property.dispatch
File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
File "kivy/_event.pyx", line 1120, in kivy._event.EventObservers._dispatch
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/popup.py", line 223, in on__container
self._container.add_widget(self.content)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/boxlayout.py", line 312, in add_widget
widget.fbind('pos_hint', self._trigger_layout)
Exception ignored in: functools.partial(<function _widget_destructor at 0x102eaad08>, 23)
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/widget.py", line 265, in _widget_destructor
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/lang/builder.py", line 760, in unbind_widget
File "kivy/weakproxy.pyx", line 30, in kivy.weakproxy.WeakProxy.__getattr__
AttributeError: 'weakref' object has no attribute 'cline_in_traceback'
Exception ignored in: functools.partial(<function _widget_destructor at 0x102eaad08>, 34)
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/widget.py", line 265, in _widget_destructor
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/lang/builder.py", line 760, in unbind_widget
File "kivy/weakproxy.pyx", line 30, in kivy.weakproxy.WeakProxy.__getattr__
AttributeError: 'weakref' object has no attribute 'cline_in_traceback'
Exception ignored in: functools.partial(<function _widget_destructor at 0x102eaad08>, 39)
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/uix/widget.py", line 265, in _widget_destructor
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/kivy/lang/builder.py", line 760, in unbind_widget
File "kivy/weakproxy.pyx", line 30, in kivy.weakproxy.WeakProxy.__getattr__
AttributeError: 'weakref' object has no attribute 'cline_in_traceback'
| e68077df94b59a668284af5cdfafbc834c5b77fab09d1b8e36d4861b04f45f48 | ['25dbe7bb8bb14368b5e7985f49292688'] | Could you help with an advice or redirect me to related topic..
I am new to python and programming and kinda stack here. I have to get the following output:
..OO.OO..
.OOOOOOO.
.OOOOOOO.
..OOOOO..
...OOO...
....O....
but instead I get:
......
.OO...
OOOO..
OOOOO.
.OOOOO
OOOOO.
OOOO..
.OO...
......
<PERSON> = [['.', '.', '.', '.', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['O', 'O', 'O', 'O', 'O', '.'],
['.', 'O', 'O', 'O', 'O', 'O'],
['O', 'O', 'O', 'O', 'O', '.'],
['O', 'O', 'O', 'O', '.', '.'],
['.', 'O', 'O', '.', '.', '.'],
['.', '.', '.', '.', '.', '.']]
for i in range(0, len(grid)):
output = ""
for j in range(0,len(grid[i])):
output += str(grid[i][j])
print(output)
|
46eeecbec3939311df9815fab63e4d0d2194f0908fd9f6c77ce2d154576cfab7 | ['25dc7913453e4d8aa551cf32a6d70fdd'] | Spark works like SQL... so...
First you need to join the dataframes.
a = df1.alias('a')
b = df2.alias('b')
df_joined = a.join(b, a.Category == b.Category)
then you will be able to filter properly
from pyspark.sql import functions as f
df_joined.select(col('a.category'),col('a.AVG'))\
.where(col('a.AVG') > f.avg(col('b.avg')).groupBy(col('a.AVG'))
| 695dbe59ad2ee7b79edb857a7fd829f7531ba7c4350626dbb882f892fa8698a5 | ['25dc7913453e4d8aa551cf32a6d70fdd'] | df.explode() does exactly what you want.
Example:
import pandas as pd
df = pd.DataFrame({'A': [[1, 2, 3], 'foo', [], [3, 4]], 'B': 1})
df.explode('A')
#Output
# A B
# 0 1 1
# 0 2 1
# 0 3 1
# 1 foo 1
# 2 NaN 1
# 3 3 1
# 3 4 1
|
aae00a55fa9e451d3ed187a453b3c0deacd97bff96a4d9f24b93611bf797dd03 | ['25f2e61731de452096d76715b818b982'] | I think you can't solve the peoblem. I have studied this part, and I also raise ticket in portal.
This response is not coming from the server, it is handled by azure frontend and can't remove the specific header.
You don’t need to spend time to solve this problem, you also can raise a support issue with Microsoft Azure.
| e4113f2bd824a6a99439d6d314e213c946381a7baceeff8fc394ad20763337db | ['25f2e61731de452096d76715b818b982'] | You must have missed something. The code is provided to you below. For specific operations, you can refer to <PERSON>'s answer.
And I have test it, it's works for me. I think it useful to you. For more details, you can refer to this post.
Connecting to Azure SQL using Service Principal in NodeJS, but token is rejected
var msrestAzure = require("ms-rest-azure");
var { Connection, Request } = require("tedious");
let clientSecret = "xxx";
let serverName = "xxx.database.windows.net";
let databaseName = "xxx";
let clientId = "xxx";
let tenantId = "xxx";
async function getConnect() {
// way for Azure Service Principal
let databaseCredentials = await msrestAzure.loginWithServicePrincipalSecret(
clientId,
clientSecret,
tenantId,
{
tokenAudience: "https://database.windows.net/",
},
);
// getting access token
let databaseAccessToken = await new Promise((resolve, reject) => {
databaseCredentials.getToken((err, results) => {
if (err) return reject(err);
resolve(results.accessToken);
});
});
var config = {
server: serverName,
authentication: {
type: "azure-active-directory-access-token",
options: {
token: databaseAccessToken,
},
},
options: {
debug: {
packet: true,
data: true,
payload: true,
token: false,
log: true,
},
database: databaseName,
encrypt: true,
},
};
var connection = new Connection(config);
connection.connect();
connection.on("connect", function (err) {
if (err) {
console.log(err);
}
executeStatement(connection);
});
connection.on("debug", function (text) {
console.log(text);
});
}
function executeStatement(connection) {
request = new Request("select * from CSVTest", function (err, rowCount) {
if (err) {
console.log(err);
} else {
console.log(rowCount + " rows");
}
connection.close();
});
request.on("row", function (columns) {
columns.forEach(function (column) {
if (column.value === null) {
console.log("NULL");
} else {
console.log(column.value);
}
});
});
request.on("done", function (rowCount, more) {
console.log(rowCount + " rows returned");
});
connection.execSql(request);
}
getConnect()
.then(() => {
console.log("run successfully");
})
.catch((err) => {
console.log(err);
});
|
42e91d3174a65ddc1d617334431154743c554793398323fbd2900aca79dc65f1 | ['26003bedf43b40febaaa44cdf2c34d4d'] | can't we introduce some more variables in the algorithm itself and find the complexity the same way we do it manually.
like for example we can have a variable in an insertion sort say n=0 which keeps the track of the entire looping part of the algorithm and then give the answer as O(n^2)
| ff9a43777bf1524b4a86dc68a5e20d161b7d6f6db2149f0086d451c39a4989e0 | ['26003bedf43b40febaaa44cdf2c34d4d'] | I have solve this problem. I had to use an alias name for the inner query. Don't know why but I have made the query run!!
here is my updated query.
delete cc.* from customer_copy cc where cc.code IN
(select code from (select cu.code from customer_copy cu
INNER JOIN customer_copy1 cuc ON cuc.code = cu.code
where cuc.district=cu.district and cuc.city = cu.city and
cuc.name = cu.name and cuc.country = cu.country and
cuc.customer_grp1 = cu.customer_grp1 and
cuc.email = cu.email and cuc.fax = cu.fax and
cuc.house_number = cu.house_number and
cuc.name=cu.name and cuc.postal_code = cu.postal_code and
cuc.region = cu.region and cuc.street = cu.street and
cuc.tax_juris_code = cu.tax_juris_code and
cuc.tax_number1 = cu.tax_number1 and
cuc.tele = cu.tele and cuc.plant_code = cu.plant_code and
cuc.employee_code = cu.employee_code and
cuc.sales_district_code = cu.sales_district_code and
cuc.sales_office_code = cu.sales_office_code and
cuc.tax_number2 = cu.tax_number2 and
cuc.tax_number3 = cu.tax_number3 and
cuc.search_terms_1 = cu.search_terms_1 and
cuc.search_terms_2 = cu.search_terms_2)x);
|
a1ae1886eece0f19d694b6b25668c98a6a564d7feb2be6a62a4d51c4171e0216 | ['2605fedb80ce42be8aece52ab17803dc'] | Scrolling is not stopping when I touch over the contact labels. How can I add this feature for this open project.
https://www.cocoacontrols.com/controls/scroller
If I touch the background, it is working perfectly. I would like to have same thing for the contacts labels too.
Basically, it uses scrollview and there is an animation while scrolling. I can not make stop it when I touch over the labels.
Any help is welcome.
| eb60e14bf0bff87bebe69ef4735de3b42409bc1628aacea08bcd362756b7e923 | ['2605fedb80ce42be8aece52ab17803dc'] | I am developing an iphone application in Objective-C and quite new in it. I just have the request URL, consumer key and secret. How can I do 2 legged authentication, could you provide me some code please. I already checked AFNetworking project and other samples but I think they are too complex for a noob like me.
Thanks.
|
da5349153710b294f712a72b764a513dc5fd291078800d3287d4ca3cb9e8fbf9 | ['2611b7a6183048c0be210c687bd5e007'] | There's a shortcut for toggling the hidden files in Finder that works on QWERTY layouts: SHIFT + CMD + '.'
However, on my AZERTY layout (Belgian more specifically) this doesn't work. If I switch to a QWERTY layout, the shortcut works, so you'l be able to test it if you switch to a AZERTY layout. Anybody any idea? I'm on High Sierra.
| c71050596d367710d43ff3a5d54a7cba47945b3a4ed4168c8abb5e884461dc6f | ['2611b7a6183048c0be210c687bd5e007'] | I'd like to see code coverage data for an iOS project.
Apparently it used to be possible using gcov but using Xcode 4.5 does not result in any gcda files.
Do you know of any tutorials or solutions on how to get such data using the latest Xcode 4.5.1?
Thank you
|
023d314f68c436219da81c1ea8e01ea0a5244bf852716cfb3368d5f9fa233b92 | ['2613eec9b9ce4a859fa274a4ef9154ef'] | Go to the album page and make sure the privacy setting is set to custom.On custom settings add <PERSON> to the field "Don't share with these people" or enter <PERSON> on "share with these speicific people".
Now share the album on her page.That post will be visible only to her and you only.
| 09efb4ac1fd396627eeb21c1f617597920c01d56cdbbf3f86dc5c1c410660501 | ['2613eec9b9ce4a859fa274a4ef9154ef'] | I am undertaking a project to upgrade our Postgresql production database from 9.1 to 9.3 using Londiste.
The reason I choose Londiste is to avoid substantial downtime from restoring the dump file or using pg_upgrade.
I have to upgrade 5 interconnected instances on separate servers at the same time. And, I am testing it on our test db servers.
From this website, I know that someone has used Londiste to upgrade to Postgres higher version before.
So, I would appreciate if anyone can share his/her experience here.
Thanks
|
a7141055c2e2cbd996375292f2a02bbedb36e988f312ab9ae0f5b07d668496f6 | ['261468766714455cb43eed5afbcb8614'] | As you can see in the image, the profile_content Layout takes the whole space available and when I press the "Profile" button the information display correctly.
But when I press the "Messages" button it's not display anything. As you can se in the image, the "blue rectangle" does not fill the whole space like the profile_content Layout.
Both layouts have the same value (wrap_content) in android:layout_widt parameter.
I have some code like:
public void onClick(View v) {
switch(v.getId()){
case R.id.bProfile:
Log.d(TAG, "onClick, buttonProfile pressed");
//Hide previous layout
activeLayout = "bProfile";
profileContent.setVisibility(View.VISIBLE);
//Access for extras passed in from login activity
tUserName.setText(getIntent().getStringExtra("tProfileName"));
break;
case R.id.bMessages:
Log.d(TAG, "onClick, buttonMessages pressed");
profileContent.setVisibility(View.INVISIBLE);
messagesContent.setVisibility(View.VISIBLE);
activeLayout = "bMessages";
test.setText("Test");
break;
}
}
Maybe I should use FragmentLayout for this particular functionality?
Thanks in advance.
| a0c5b4b3e3302775bfbacf8f9dff8156037150d06908ab03b2b48423f2d6f12a | ['261468766714455cb43eed5afbcb8614'] | For your example, this code works:
<?php
$latlong[] = [1,2];
$latlong[] = [3,4];
$latlong[] = [5,6];
$latlong[] = [7,8];
$latlong[] = [9,10];
$latlong[] = [11,12];
$latlong[] = [19,110];
$latlong[] = [21,132];
$off = 3;
for ($i=0; $i < count($latlong); $i+=$off){
if(count($latlong) - $i <= $off){
$last_element = end($latlong);
}
print_r( array_slice($latlong, $i,1));
}
print_r($last_element);
?>
The if statement, in that case, verifies if you set any offset on your code, $last_element variable always contains the last element of your array.
|
e2a546330472b9b592656d0e272430eafe519f010637b3ddd9b3e13d94188be3 | ['2618ef2a23cc465598ba6189549cebb5'] | This might help. There is a gem called Faraday. It is used to make http request. Here is an example usage:
Build a connection
conn = Faraday.new(:url => 'http://sushi.com') do |builder|
builder.use Faraday::Request::UrlEncoded # convert request params as "www-form-urlencoded"
builder.use Faraday::Response::Logger # log the request to STDOUT
builder.use Faraday::Adapter::NetHttp # make http requests with Net::HTTP
# or, use shortcuts:
builder.request :url_encoded
builder.response :logger
builder.adapter :net_http
end
Make your Get request
conn.get '/nigiri', { :name => '<PERSON><IP_ADDRESS>Request<IP_ADDRESS>UrlEncoded # convert request params as "www-form-urlencoded"
builder.use Faraday<IP_ADDRESS>Response<IP_ADDRESS>Logger # log the request to STDOUT
builder.use Faraday<IP_ADDRESS>Adapter<IP_ADDRESS>NetHttp # make http requests with Net<IP_ADDRESS>HTTP
# or, use shortcuts:
builder.request :url_encoded
builder.response :logger
builder.adapter :net_http
end
Make your Get request
conn.get '/nigiri', { :name => 'Maguro' } # GET /nigiri?name=Maguro
| ddd4d9ee993f7e01ac002e993971aa8da6ed5063280cf2ce1a043fe22d55d9b6 | ['2618ef2a23cc465598ba6189549cebb5'] | I second checking out Google IoT Core.
If you have a special use case, you could always connect Google PubSub to another MQTT-enabled IoT platform like Losant. Here is an example of it:
https://docs.losant.com/applications/integrations/#google-pubsub
Then, as you subscribe to messages from PubSub you could publish to MQTT topics and vice versa.
Disclaimer: I work for Losant.
|
4f7691ac16257147187d9d1c21dabc4e4c648b8a8aeb9646a12f6741a7713698 | ['26301674bc1e49fca28c3cddb8568956'] | you can also append this way
$html = '
<html>
<body>
<ul id="one">
<li>hello</li>
<li>hello2</li>
<li>hello3</li>
<li>hello4</li>
</ul>
</body>
</html>';
libxml_use_internal_errors(true);
$doc = new DOMDocument();
$doc->loadHTML($html);
//get the element you want to append to
$descBox = $doc->getElementById('one');
//create the element to append to #element1
$appended = $doc->createElement('li', 'This is a test element.');
//actually append the element
$descBox->appendChild($appended);
echo $doc->saveHTML();
dont forget to saveHTML on the last line
| 714953ed3368474b6fa6a8375482240a0e20300982307d5b42dcb23effa83b80 | ['26301674bc1e49fca28c3cddb8568956'] | i found the solution:
in
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: { (data:Data?, response:URLResponse?, error:NSError?) -> Void in
DispatchQueue.main.async
i change it into
let task = URLSession.shared.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
DispatchQueue.main.async
then i delete the data,response,error in the bottom
from this
} as! (Data?, URLResponse?, Error?) -> Void).resume() // nsurlsession
into this
}).resume() // nsurlsession
|
8452732245db78927d100d276d7cd5df4a288c44dadd910950950f59ff901acc | ['263049639b9240e5b20885f49a3075db'] | I'm using a dataset with fields "virtual_time" and "store_visited" and the data shows a user's activity pattern at different locations during different timestamps.
Problem is sometimes the user could be at the same location but there are several different records of the same place updated on the dataset with slightly different timestamps.
I'm trying to sort of I guess group those smaller timestamps together per location so the data makes better sense to me and I can later distinguish how much time that user has spent at each place.
For instance when I type:
SELECT DISTINCT virtual_time, store_visited
FROM public.consumer
WHERE user = 'e63a9'
ORDER BY 1;
I get back something like:
Store_visited virtual_time
1 M&S 2017-09-16 17:52:06
2 WholeFoods 2017-09-16 18:26:17
3 WholeFoods 2017-09-16 18:26:19
4 WholeFoods 2017-09-16 18:26:20
5 OysterRooms 2017-09-18 13:31:39
But I'd like to filter out the duplicate stores visited from rows 3,4, as they show the same location with only show a time difference of like 2 seconds and 1 second.
Ideally filtering it would show something like:
Store_visited virtual_time
1 M&S 2017-09-16 17:52:06
2 WholeFoods 2017-09-16 18:26:17
5 OysterRooms 2017-09-18 13:31:39
So that it's easier to distinguish the different timestamps at different stores.
Hope that make some sense. Any help would be GREATLY appreciated!
If you have any questions, please let me know!
Many thanks
| 343494149b79f4a1ca6928d86ad11714aee53a87cd8699135411b226980293c5 | ['263049639b9240e5b20885f49a3075db'] | I've been struggling for days to create any given radius in miles around a chosen latitude and longitude (latitude = <PHONE_NUMBER> and longitude = -0.194894315) on PostgreSQL.
The given dataset contains records of millions of coordinates of people's movement patterns. I've tried looking at several different methods but it doesn't work for me on PostgreSQL but I definitely need to do it on PostgreSQL.
SELECT device,brand, (
6380 * acos(
cos(radians<PHONE_NUMBER>))
* cos(radians(latitude))
* cos(radians(lonigtude) - radians(-0.194894315))
+ sin (radians<PHONE_NUMBER>))
* sin(radians(latitude))
))
AS distance
FROM public.consumer
HAVING distance < 0.5
ORDER BY 1 DESC;
I essentially need to create a radius (for instance 0.5 miles) around a given coordinate <PHONE_NUMBER>, -0.194894315) so I can filter out the rest of the data and only return what people have done within the chosen radius.
Hope that made some sense. Please let me know if you have any questions.
ANY HELP WOULD BE GREATLY APPRECIATED!!
|
3cb19b0ea297f81e5ba6c5427d45bc456fcd3df89f3e0159c09ff9e82724f61f | ['26392254879c44c5a5568448317beb46'] | The following fixed the problem I was having in chrome with the validation errors showing up even when disabled with Chrome, due to the combination of required and confirmed:password as v-validate="'required|confirmed:password'"
<input
v-validate="{ required : true, confirmed: field.password}"
type="password" name="confirm_password"
class="form-control"
placeholder="Confirm Password"
v-model="field.confirm_password"
data-vv-as="confirm password">
| 738210b9be906d84d45f3e38f1107b7eed214d613bace97c334e8deb2478d254 | ['26392254879c44c5a5568448317beb46'] | I have this code which is almost giving me what I want.
def merge_data(keys, data)
merged_data = keys.map {|hash| data.first.map {|k,v| if hash.values.first == k then hash.merge(v) end}}
end
See below for the difference between the expected (first) and actual return value:
-[{:awesomeness=>10,
- :first_name=>"blake",
- :height=>"74",
- :last_name=>"johnson"},
- {:awesomeness=>9, :first_name=>"ashley", :height=>60, :last_name=>"dubs"}]
+[[{:awesomeness=>10,
+ :first_name=>"blake",
+ :height=>"74",
+ :last_name=>"johnson"},
+ nil],
+ [nil,
+ {:awesomeness=>9, :first_name=>"ashley", :height=>60, :last_name=>"dubs"}]]
If anyone could explain why I'm getting an extra array level with an index of nil it would be much appreciated!
Based upon the below data:
let(:keys) {[
{:first_name => "<PERSON>"},
{:first_name => "<PERSON>"}
]}
let(:data) {[
{"blake" => {
:awesomeness => 10,
:height => "74",
:last_name => "<PERSON>"},
"ashley" => {
:awesomeness => 9,
:height => 60,
:last_name => "<PERSON>"}
}
]}
let(:merged_data) {[
{:first_name => "<PERSON>",
:awesomeness => 10,
:height => "74",
:last_name => "<PERSON>"},
{:first_name => "<PERSON>",
:awesomeness => 9,
:height => 60,
:last_name => "<PERSON>"}
]}
Thanks!
|
4bbe4b5a3a5482df3a0ea813c6fe0ab1aa43633e0cc06d63b45800a17d08773a | ['26560e95168848679a66b35e8f2ab80f'] | I have a huge table of about 31GB data and close to 150k records. Currently this table is created without primary key to speed up the insert process as I have to copy the data from a live database.
I have to create a composite primary key on this table on 3 columns (int, varchar, varchar)
I am thinking of doing like below
ALTER TABLE mytable ADD PRIMARY KEY(col1, col2, col3);
Please suggest me there is any better way to do this
| b8850aa86e7cde473d52d9fd31c9facadc92eb3b957eef99ee8044cb434c9b5a | ['26560e95168848679a66b35e8f2ab80f'] | I am trying to integrate Razorpay cordova plugin in my ionic app. It works find for Android. But for iOS I am getting below error when I run the app in Xcode. I am unable to proceed further. Please help me resolve the same. FYI, I have integrated as per the steps mentioned in the integration video and have added Razorpay framework in "Embedded Binaries" and have updated "Always Embed Swift Standard Libraries" to "Yes"
Error Msg:
dyld: Library not loaded: @rpath/libswiftCore.dylib
Referenced from: /Users//Library/Developer/CoreSimulator/Devices/B12116FD-C014-41B6-A5BF-6CEE7F079850/data/Containers/Bundle/Application/A76F064E-8CCA-4F93-A6CC-6E2C140CC231/The SICA.app/Frameworks/Razorpay.framework/Razorpay
Reason: image not found
IDE Specs
Xcode: 10.1
Swift version: 4.2.1
Razorpay Version: 1.4.8 (com.razorpay.cordova)
Screenshot - 1 - Build Settings
Screenshot - 2 - Build Settings
|
890f0a8d216bb738c6d5155ebf5f8043a98cf0dcf97daf52c53f2c9fb94a7955 | ['266d2f6ea78d43c38809b15f787c5ea9'] | Think as your AI would
Your AI is only interrested in destroying the enemy AI, it's not interrested in hurting human as long as it's not usefull or damaging their war.
Going on the planet and study scraps on the planet shouldn't pose any problems unless humans try to steal those scraps. If not notice humains should even be able to bring back some scraps to the ship.
To be able to catch a working robot the same kind of thinking apply:
- If the AI is able to compute that in a given situation the likelihood to survive or flew is too low (therefore the likelyhood of destroying other enemy AI will be too low too) then the AI will just wait for this likelyhood to increase.
For this to happend an AI must learn that human can destroy them.
A way to make this happend would be to have a fight with a part of the crew and some robot where this part of the crew have been able to destroy at least one of the robot.
Then if humans are able to find an isolated robot and they put it in a situation where the likelihood of it being destroyed if it fight or flew is too high then the AI will try to call their peer. If it can't then it will just wait for this probability too be lower and humans should be able to catch it and control it as long at this probability stay high enough.
| d9e0a92ccf4dbb8ce74a432081afe7c06bf170d7299e9e4df6185d4c9ba040cb | ['266d2f6ea78d43c38809b15f787c5ea9'] | I'm trying to write a script for ubuntu 10.0.4 to check for an application on my system. I want the script to see if the particular named application is installed, and if it is, if it needs updating. I also want the script to automatically install the app if it isn't installed, or update the application if it is installed. Like if i needed to install WINE or GIMP. I'm not sure how to structure the commands but I know I will use either apt-get, or yum to find the application.
|
258fea5b18e85b119fb75de2c8266b4c219ada8f23240a55028c7edfedf3b93f | ['267e0671969b4cf5ad133697b3322f89'] | REFERENCE STRUCTURE = 00000 A,B,C = 120.000 120.000 42.560
ALPHA,BETA,GAMMA = 90.000 90.000 90.000 SPGR = P1
31984 1 new.pdb
x y z
1 C 8.17500 93.80900 21.90700 8 4 2 0 0 0 0 0 -0.036 1
2 C 9.34800 94.14800 22.73500 1 16 9 0 0 0 0 0 0.038 1
3 C 8.<PHONE_NUMBER>.47500 24.28800 6 9 15 0 0 0 0 0 0.038 1
4 C 6.95800 94.40500 22.32000 12 1 6 0 0 0 0 0 0.060 1
5 O 7.20600 96.40600 26.25200 15 0 0 0 0 0 0 0 -0.270 1
6 C 6.88800 95.13100 23.50200 4 10 3 0 0 0 0 0 -0.036 1
7 O 4.60000 94.52600 21.81800 <PHONE_NUMBER> 0 0 0 0 0 0 0 -0.245 1
8 H 8.26600 93.17800 21.<PHONE_NUMBER>.063 1
9 C 9.25800 94.94800 23.85500 2 3 11 0 0 0 0 0 -0.037 1
10 H 5.98600 95.70100 23.66700 6 0 0 0 0 0 0 0 0.063 1
11 H 10.19600 95.24800 24.29800 9 0 0 0 0 0 0 0 0.063 1
12 C 5.70900 94.23600 21.42300 13454 7 4 0 0 0 0 0 0.337 1
13 O 5.87600 93.60100 20.21100 14 12 0 0 0 0 0 0 -0.477 1
14 H 5.<PHONE_NUMBER>.52600 19.73800 13 0 0 0 0 0 0 0 0.295 1
I have this file structure and I need to make all the columns after the x, y and z columns to be zero and the last column to be deleted. for example I need to have the following as output (sample).
1 C 8.17500 93.80900 21.90700 0 0 0 0 0 0 0 0 0
2 C 9.34800 94.14800 22.73500 0 0 0 0 0 0 0 0 0
| 23522dbe08422c10fb54622b661c6518aa83ee395a4f8a15612ebff2a27ed926 | ['267e0671969b4cf5ad133697b3322f89'] | function DoneButtonPushed(app, event)
assignin('base','roll_no_GUI1',app.StudentInfoDropDown.Value);
assignin('base','projname_GUI1',app.ProjectInfoDropDown.Value);
assignin('base','roll_no_GUI2',app.StudentInfoDropDown_2.Value);
assignin('base','projname_GUI2',app.ProjectInfoDropDown_2.Value);
assignin('base','roll_no_GUI3',app.StudentInfoDropDown_3.Value);
assignin('base','projname_GUI3',app.ProjectInfoDropDown_3.Value);
assignin('base','roll_no_GUI4',app.StudentInfoDropDown_4.Value);
assignin('base','projname_GUI4',app.ProjectInfoDropDown_4.Value);
assignin('base','roll_no_GUI5',app.StudentInfoDropDown_5.Value);
assignin('base','projname_GUI5',app.ProjectInfoDropDown_5.Value);
closereq
end
Hi, I am creating a GUI which contains DropDowns. They are 10 dropdowns as you can see from the code. And I am using assignin to save each one of them into base workspace. But I would like to club all of them into a 2 char array's or 2 cell array's and send only two variables into the base workspace viz, Roll_nos and Projnames_GUI
|
564221abe460bfa785bf0b222761c74b3f2a160172e631b3572f30855801204e | ['2682b468f7f541258fbd9503a074c4ca'] | Should anyone see this and feel curious, I had to reach out to MyDomain.com support and ask for the certificate bundle. They got it to me (.crtc bundle as well as individual files for cert and intermediate cert) and now it works just fine on my nginx server. It wasn't going to work without those additional files.
| 505b8714514ea96cd84832c9acb2d3ec8f32a909acb304ef3d3d2da1c7d19b44 | ['2682b468f7f541258fbd9503a074c4ca'] | I'm trying to set up a SSL certificate on a site using nginx web server. In the past, I generated SSL certs from Let's Encrypt/Certbot with no issues. This time, I purchased a .com domain and a Positive SSL certificate from MyDomain.com. MyDomain.com doesn't provide a .zip file or ca-bundle file for the cert (i.e., there doesn't appear to be an intermediate certificate or root certificate). Instead, it gives me two plaintext lines of code to manually copy: one for Certificate and one for Key.
The Certificate line contains -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----
The Key line contains -----BEGIN RSA PRIVATE KEY----- and -----END RSA PRIVATE KEY-----
I paste each of these lines into its own text editor file (using Atom on Ubuntu 18.0) and save as .crt and .key, respectively. (I was told by MyDomain.com support that the Certificate should be .crt, but who knows?)
I then add these file paths to my nginx site config file as below:
ssl_certificate /etc/ssl/certs/mysite.com.crt;
ssl_certificate_key /etc/ssl/private/mysite.com.key;
However, nginx fails on restart and when I check the config file I get the following:
$ sudo nginx -t
nginx: [emerg] PEM_read_bio_X509_AUX("/etc/ssl/certs/mysite.com.crt") failed (SSL: error:0909006C:PEM routines:get_name:no start line:Expecting: TRUSTED CERTIFICATE)
nginx: configuration file /etc/nginx/nginx.conf test failed
Some things I've tried:
Saving the Certificate as a .pem = same error.
Manually adding the word TRUSTED to the certificate's beginning and ending = same error.
Trying to convert the file based on its encoding:
$ sudo openssl x509 -in /etc/ssl/certs/mysite.com.crt -out /etc/ssl/certs/mysite.com.pem -outform PEM
unable to load certificate
140561005191616:error:0909006C:PEM routines:get_name:no start line:../crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE
$ sudo openssl x509 -in /etc/ssl/certs/mysite.com.crt -inform der -outform pem -out /etc/ssl/certs/mysite.com.pem
unable to load certificate
139831375835584:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../crypto/asn1/tasn_dec.c:1130:
139831375835584:error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:290:Type=X509
$ sudo openssl x509 -inform DER -in /etc/ssl/certs/mysite.com.crt -out /etc/ssl/certs/mysite.com.pem -text
unable to load certificate
139993835831744:error:0D0680A8:asn1 encoding routines:asn1_check_tlen:wrong tag:../crypto/asn1/tasn_dec.c:1130:
139993835831744:error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error:../crypto/asn1/tasn_dec.c:290:Type=X509
I'm not sure what to do from here. Has anyone successfully installed a SSL certificate on nginx using just a .crt file and .key file?
|
ad3e83589cf83ad15c7094f7214ab702f3d0f1c944595a4f1d4b2f3d66ff9602 | ['2686d2a6110844d7a21eb84db75f6dac'] | I need to access some data during the map stage. It is a static file, from which I need to read some data.
I have uploaded the data file to S3.
How can I access that data while running my job in EMR?
If I just specify the file path as:
s3n://<bucket-name>/path
in the code, will that work ?
Thanks
| 186ff74b8eb1a6a069d20c9fc2dcfbca139ac72cb796292a9e5f40419cb6d4d5 | ['2686d2a6110844d7a21eb84db75f6dac'] | I stumbled upon the answer here. Turns out the first 28 bytes in the AIK blob are used for a special structure that gives details on the algorithm, encoding scheme etc & the remaining 256 bytes represents the modulus. So doing a splice on the key worked:
byte[] modulusBytes = Arrays.copyOfRange(aikBytes, 28, aikBytes.length);
// Now get the public key object using:
RSAPublicKeySpec spec = new RSAPublicKeySpec(new BigInteger(Hex.encodeHexString(modulusBytes), 16),
new BigInteger("010001", 16));
KeyFactory factory = KeyFactory.getInstance("RSA");
PublicKey aik = factory.generatePublic(spec);
|
9a1e3b907f8305e6b0fa878d917bd4e67a4b96948b42cb4d341097559e353a4b | ['268c1ccfd74f454c85d6b6ec3fe24b09'] | Ohhh I get it now. The way it was phrased tripped me up. But your explanation made more sense. It wasn't about **"all"** terms, but about terms that **"you are looking for"**. Since relevant documents are sparse, the desired terms are sparse. So irrelevant documents naturally have `fewer occurrences of an already sparse term`, making $u_t$ really small. Your equation also made it v.clear how the approximation works. Thanks thanks! | 1d6ca87ae587ebc21ddedd8f14ed3f55ba0954c250229f925869242487c55096 | ['268c1ccfd74f454c85d6b6ec3fe24b09'] | I encountered this approximation in an Information Retrieval textbook, where they approximated:
$$\log(\frac{1-u_t}{u_t})$$
to $$\log(\frac{1}{u_t})$$
where $u_t\in[0,1]$ (tending towards 1, aka the probability of a frequently occurring value).
I don't understand how they arrived at this value. I've tried pulling it apart into $\log(1-u_t) + \log(1/u_t)$, but $\log(1-u_t)$ approaches negative infinity when $u_t$ is large (~=1), which meant that term couldn't be ignored.
Does anyone have any idea?
|
6cec85256058ca04fb1dea1de373b2a50e657499c6cb593a36e3ed56a52a12bf | ['26b90e14595840b89a2e45173c5f3d2b'] | Hey there folks :) I am trying to set up a search engine with elasticsearch/node.js, express and vue.js. I would like the search results to be clickable links, but they are only returning non-clickable html. I have tried adding normal html A- tags to the .json file, but on the front end this renders as a non clickable html text and not as a clickable link. Any suggestions would be really appreciated
this is what I have tried, just as a test:
<a href="https://www.w3schools.com/html/">Visit our HTML tutorial</a>
I have had a look on google for possible solutions but all I could find were references to the normal html a-tag and that both j.son and vue.js can take those?
| 00b25cd12f26e97c0094b89cb84fa08a746f7479dc354b6a8af3e036662ff4f8 | ['26b90e14595840b89a2e45173c5f3d2b'] | Have just downloaded Visual Studio and am editing an html document. Every time I try to edit a title or a link the editor jumps to the end of the document, while I am typing, so half of the word goes where I want it and the other half ends up at the bottom of the document. As you can imagine it makes for an interesting read lol :) does anyone know what I am doing wrong?
thanks in advance
<PERSON>
|
9948d51063208c5eb4210abe0f000f37ad7d33b12b534fa1045a263ac292c6e9 | ['26bf4cae6cbe4bf290d9d7da8a8bdfaf'] | Are there any creative ways to find the exact referring URL for payments submitted by Magento? I'm using an extension for the MyVirtualMerchant gateway and so far it has not accepted any of the HTTP referrers I have entered (/checkout/onepage, etc).
Do extensions have their own URL structure when they actually send data behind the scenes?
| b0fbd6f11632f46b540a9c35dc3b8754dc3b14294cc1b28ac7c4142187e2f194 | ['26bf4cae6cbe4bf290d9d7da8a8bdfaf'] | You could extend the Amazon payment module to include another order status for that dropdown (involves changing the xml files that control the adminhtml).
Take a look at this custom extension- you can modify the Observer.php file to look for the Amazon payment method and then set the appropriate order status.
MAGENTO AUTO INVOICE AND SET CUSTOM ORDER STATUS UPON CHECKOUT
|
e9229b0fd318f344ab33dd2f5742ed4893050e932a8d8c94ab62d6499f2abbdc | ['26c2577fbfda4c1f83bc1827fbfec8a9'] | I get following error when trying to port projects from Visual studio 2010 to vs2015,
Error U1052 file 'ntwin32.mak' not found
Warning treat as error no Obj file generated (I can't turn the setting Off for this as it is required project settings)
error C2338: The C++ Standard forbids containers of const elements because allocator is ill-formed.
| 5610fd0ae8c23d0b8031a5bdee0892e3b9cc76a364d8fb280ee0ceef67a2cc4f | ['26c2577fbfda4c1f83bc1827fbfec8a9'] | I have used VSS API to make snapshot of C:. The program fails with VSS exception. But when I try to create snapshot of same volume using VSS Admin it completes successfully.
I found the shadow storage space is less then 300 mb and hence it caused my program to fail. Increasing the space of shadow storage worked for me.
My questions are:
How does VSS Admin work fine even if the shadowstorage space is less than 300MB?
Why can't a program created using VSS API also create a snapshot?
What's missing?
|
0135e1599e7f54c8c66937f35585ebccf6c92b0f5ad15326e01d7c3e69e380e8 | ['26c7d90b5cbe4d4cbcd4b995d4365321'] | I'm wondering if there is any way to close a pop-up error, where the pop-up and the main application are the same windows process. The application I'm using periodically will give an error message in the form of a pop-up window. However, the pop-up window does not have its own windows process.
Is there any way (using powershell or batch, etc...) to kill just the pop-up window and let the application resume. Or, is it possible to detect if a pop-up has been created and simply kill the entire application?
My aim is to have a scheduled task periodically checking for these error pop-ups and clearing them so the application can resume it's tasks, which will same save someone having to log into an RDP and manual do clear it.
Cheers.
| 1414e35017022f22a22db50e977bdcc49733162b9e55a3d089dc08b18e4ffa73 | ['26c7d90b5cbe4d4cbcd4b995d4365321'] | This answer to this question is that when you are comparing two different datatypes together, the SQL engine implicitly converts one of the values based Data type precedence.
In my example, I'm comparing an integer value to VARCHAR values from my table column. As the values stored in column2 are numeric (they only contain numbers), the SQl engine can convert these values to INT and compare them to the INT values in my WHERE clause. As such, I get the correct result set.
|
b7572af4f28592d2bfa2bf3ac6346c23221e12982725b14a5df20819d47ec15a | ['26c9a9966c0e48249fe5f7bf438e949b'] | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
// Start here: Search Service area via jQuery
window.filter = function(element)
{
var value = $(element).val().toUpperCase();
$(".left_message > li").each(function()
{
if ($(this).text().toUpperCase().search(value) > -1){
$(this).show();
}
else {
$(this).hide();
}
});
}
});
</script>
<input type="text" placeholder="Enter text to search" onkeyup="filter(this);">
<ul role="tablist" class="left_message">
<li><a href="#"><span><PERSON>>
<li><a href="#"><span><PERSON>>
<li><a href="#"><span><PERSON>>
<li><a href="#"><span>Amitabh</span></a></li>
<li><a href="#"><span><PERSON>>
</ul>
Result : Search <PERSON> , they return following output
<ul role="tablist" class="left_message">`enter code here`
<li><a href="#"><span><PERSON>>
</ul>
| e151a7f92dcb00e4aab99d1bef1972bd072c09b3ceb879cb05c506e3f9ca6d9b | ['26c9a9966c0e48249fe5f7bf438e949b'] | <style type="text/css">
:root {
--slide-1: url("{{url('public/assets/images/logo-nfs.png')}}"); /*this is laravel*/
--slide-2: url("<?php echo 'images/logo-nfs.png';?>");
}`enter code here`
.header111 {
background-image : var(--slide-1); /*this is php*/
}
.header22 {
background-image : var(--slide-2);
}
</style>
<div class="header111">
test here
</div>
<div class="header22">
test here
</div>
<br>
|
245361a35cc2f5f5592b2fb8b8377995815351bb62f50852db721b8d3344a731 | ['26cd6a93adac489694f5646101a831a0'] | <PERSON> you tried to remove the package that you couldn't install in the first place due to the dependency issue. Whether bugid 6863 is the perfect fit or not - not being vulnerable to CentOS at the moment, I can't test it myself - my comment about this being an RPM Dependency issue and not a Security issue still stands. | b609d3d28ec9a6ecf0f6e55f4914d0d146a1782db839ca7899e052c355bf3522 | ['26cd6a93adac489694f5646101a831a0'] | It seems that it does not, and that common practice is to require the intermediate certs to be installed on the Client.
This AWS page, for example, discusses installing the necessary CA and intermediate certs on the client to connect to their hosted MS-SQL instances.
The same question was asked on dba.stackexchange a couple years ago, and mostly through the comment thread, seems to have concluded the same thing.
While the same setup would be unpalatable with web browsers, which are many-to-many, it is more manageable (but still ugly) with SQL clients, which are few-to-fewer.
|
4426d55c814707523f029208f3de17ccb0e56886f3a6cf079403564492597890 | ['26d135e049874f468a6a2588ff02ef31'] | But if we take a point Q and a point K different from each other and belonging to the circumference the distance from K to A will not be different from the distance from Q to A? And yet I need to get to that answer I mentioned in the question, the point is that I do not know how to get there. | bd7189b5128d178a03e3f182bf779d9d099d7601c82918ae42598d9b01b18a55 | ['26d135e049874f468a6a2588ff02ef31'] | Using what <PERSON> and <PERSON> said, let's say that we have a language $L_1 = \Sigma^*$, we know that this languague is a turing-recognizable language. If we pick all possible subsets of $L_1$, then we have a uncountable set $A$, and each subset of $A$ belongs to $\Sigma^*$, since our set $A$ is uncountable set, there is at least one element present at $A$ which isn't turing-recognizable, therefore, there is at least one subset of $\Sigma^*$ which isn't turing-reconizable.
|
1accdfa75b976d91610e8fd83a0a306c653378b178b6ee919454c5481de7869f | ['26d5a59adccf4c4ca3361f02e8190de8'] | Q1, I am trying to implement autoencoder, and I have data like this:
800 300 1 100000 -0.1
789 400 1.6 100500 -0.4
804 360 1.2 100420 -0.2
....
How do I suppose to normalize these data to be able for training?
Q2, Because I don't know the way to do the normalization, so I skip it and just apply the raw data to autoencoder for training, but the gradient become Nan after several iterations, here is the code.
BATCH_SIZE=1
BETA=3
INPUT=89
HIDDEN=64
EPOCHS=1
LR=0.01
RHO=0.1
raw_data=Loader('test.csv')
print(np.shape(raw_data))
raw_data=torch.Tensor(raw_data)
train_dataset=Data.TensorDataset(data_tensor=raw_data,target_tensor=raw_data)
train_loader=Data.DataLoader(dataset=train_dataset,batch_size=BATCH_SIZE,shuffle=True)
model=SparseAutoEncoder(INPUT,HIDDEN)
optimizer=optim.Adam(model.parameters(),lr=LR)
loss_func=nn.MSELoss()
for epoch in range(EPOCHS):
for b_index,(x,_) in enumerate(train_loader):
x=x.view(-1,INPUT)
x=Variable(x)
encoded,decoded=model(x)
loss=loss_func(decoded,x)
optimizer.zero_grad()
loss.backward()
optimizer.step()
print("Epoch: [%3d], Loss: %.4f" %(epoch + 1, loss.data))
raw_data has the shape of (2700,89) , it contains 89 dimensions in each row, and with different scale of value(as Q1 mentioned).
| f33364b879e25aabfa13f059e718e6b0fe812c8683d932284abdaf8a57baa547 | ['26d5a59adccf4c4ca3361f02e8190de8'] | I am use vue.js to create my website.
Now I want to load .xlsx file from the folder.
All the solutions online is telling me using input type to upload file.
But what I actually want to do is that the website will load the data from .xlsx file which is already local in my server folder. Just like you import other vue components and use it.
How do I implement it?
|
57cc74fe6f786dc8db601ce40e9e1d60ac4c686f436146525c116e3da3e27829 | ['26d94c6fdc6648338873a60d74cbb3e8'] | I have a method that iterate through a collection(the assetsHandCollection), copies (link copy) the object to another collection(the gestureCollection) and then it should move the linked object.
This is the method:
def make_gestures():
gestureCollection = bpy.data.collections.get("Gesture")
for hand in assetsHandCollection.objects:
linkedCopyHand = hand.copy()
gestureCollection.objects.link(linkedCopyHand)
linkedCopyHand.hide_viewport = False
linkedCopyHand.hide_render = False
linkedCopyHand.hide_select = False
bpy.context.view_layer.objects.active = linkedCopyHand
bpy.ops.transform.translate(value=(50, 0, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
The object are correctly linked to the new collection but they are not moved.
If I replace the line:
bpy.ops.transform.translate(value=(50, 0, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
with
linkedCopyHand.matrix_world.translation += Vector((50, 0,0))
It works, the oject are correctly linked and translated.
If I check in the console which is the last active object after my script finished to run (with bpy.context.view_layer.objects.active), it is, correctly, one of the object that I have just link copied. If the console I try to run the command:
bpy.ops.transform.translate(value=(50, 0, 0), orient_type='GLOBAL', orient_matrix=((1, 0, 0), (0, 1, 0), (0, 0, 1)), orient_matrix_type='GLOBAL', constraint_axis=(True, False, False), mirror=True, use_proportional_edit=False, proportional_edit_falloff='SMOOTH', proportional_size=1, use_proportional_connected=False, use_proportional_projected=False)
It return CANCELLED, without any further detail.
| 2f2c78ed14a8342f1c6ffcea3603aa63f1f2ad48be87dfac1bbaeefd8f29bc2d | ['26d94c6fdc6648338873a60d74cbb3e8'] | Seems like it should work. Try mount after reboot. Try a mount on a different computer, maybe even *nix. It's conceivable the very last encrypted write to the container corrupted the file system (probably in memory corruption before encryption). If so, an earlier backup of the container might be the only recourse. |
9a8468a99297e3fe032c0a5d7374977752af92249f6340ec42ed7663b0ee6fae | ['26ddc4e6cf704364a022824534d1184b'] | Assuming it built and deployed successfully a single dyno should load the slug and execute the command. To scale and/or change the dyno configuration, you'll need to issue a command with your chosen option. For example:
$ heroku ps:scale web=2 queue=1
This would start three dynos; two for web and a single one for queue processes. You can also scale the individual power of the dynos by increasing the RAM and CPU share using a similar command:
$heroku ps:scale web=2:standard-2x queue=1
| 4aa2d3aec5e08532957676de116d4ea613f3534596efa0a0bb7025fd0b63b146 | ['26ddc4e6cf704364a022824534d1184b'] | Google does a lot more than read tags to organize pages and rank them. However, there is a tag defined in HTML to describe keywords and other information about your page.
Placed in the head of your HTML document, the meta tag can be used to define your pages character set, add a description, keywords and an author (amongst other things).
For example:
<head>
<meta charset="UTF-8">
<meta name="description" content="Jordan's Homepage">
<meta name="keywords" content="Games, younger brothers, stack overflow">
<meta name="author" content="Jordan 1591">
</head>
Google's ranking algorithms are very complex and not publicly known in their entirety, partly to prevent people from abusing them and being unfairly ranked highly, but any seach engine -including Google - will look at meta tags as a bare minimum.
|
a0649d15097d0889adcd695a1c40c493323be1dc127488ff28e402f2f9bf109a | ['26e6a65fd75342fb9c55fc1aca9bde6e'] | So this week I was also trying to set up a project that was “lighthouse verified” lets say.
Next have a really good directory of examples. The particular example I followed that helped me set this up was next.js/examples/with-sw-precache
It's a similar setup to yours only using the SWPrecacheWebpackPlugin with a standard setup
The step that seems to be missing, which may be the problem, is that your not registering your service worker.
In your index file, you could register the service-worker in the componentDidMount Lifecycle.
import React from 'react'
export default class extends React.PureComponent {
componentDidMount() {
if ('serviceWorker' in navigator) {
navigator.serviceWorker
.register('/service-worker.js')
.then(registration => {
console.log('service worker registration successful')
})
.catch(err => {
console.warn('service worker registration failed', err.message)
})
}
}
render() {
return <p>Check the console for the Service Worker registration status.</p>
}
}
| ceef1574ab14777193c212f0503d1974aeae8ad8355dc1545dd2588bbd25f173 | ['26e6a65fd75342fb9c55fc1aca9bde6e'] | I am aware of how to delete branches locally using
git branch -d <branch_name>
and how to delete both locally and remotely using
git push origin --delete <branch_name>
I recently learnt how to prune obsolete branches as well, only when doing so I see the changes reflected in the remote branch list when running this command
git branch -r
But the branch listing seems to still display me all the branches whenever I run this command
git branch
Is there a command to sync the changes from the remote to be reflected in the local branch listing, so that when I delete a branch on github I can pull the updates of all the branch changes i.e which one have been deleted and which still remain, into my local environment?
|
980baa3dfdaf7cd0bcaa653a29ec3f55fb560e14a8e58797d8f3b95b139cbc3e | ['26e8f5bb2a4a49a8a31a553704524882'] | On a mac mini running OSX 10.11.6, if I set dual screen resolution to 1920x1080, it resets to the default 800x600 if the computer is reset (or if slideshow mode on powerpoint is activated), or if the user logs out, or if the computer is awoken from sleep. I have tried resetting the nvram, to no avail.
How do I make this setting persistent? Note: I need the setting to be persistent while in guest mode. I have three other mac minis with identical configurations whose dual screen settings are persistent, even in guest mode.
| ea47d523aca88e06e1155f96412013d879fdf17be1937200d0c6e1d51006ea16 | ['26e8f5bb2a4a49a8a31a553704524882'] | I would use MimeMailParse (http://code.google.com/p/php-mime-mail-parser/)
Then you could simply say
$parser = new MimeMailParser();
$parser->setStream(STDIN);
// Handle images
$path = '/tmp/';
$filename = '';
$attachments = $parser->getAttachments();
foreach ($attachments as $attachment) {
if (preg_match('/^image/', $attachment->content_type, $matches)) {
$pathinfo = pathinfo($attachment->filename);
$filename = $pathinfo['filename'];
if ($fp = fopen($path.$filename, 'w')) {
while ($bytes = $attachment->read()) {
fwrite($fp, $bytes);
}
fclose($fp);
}
}
}
|
b320a4d6e9ce5828b47d648d723d1376dc356ece49c70eed09c6541166f5a5bc | ['26f1ee59d12a411baaac45be503ed3a5'] | To add or modify parts of the data such as adding hours you should convert to LocalDateTime and then use a Period to add a specific Period of time to the datetime. Also need to as milliseconds to format based on your expected input/output. Try this, but change pretendPayload to payload for your example:
%dw 2.0
output application/json
var pretendPayload = {Creation_date: "2019-03-02 07:00:00.000"}
type LocalDateFormat = LocalDateTime { format: "yyyy-MM-dd HH:mm:ss.SSS" }
---
{
CreatedDate: (pretendPayload.Creation_date as LocalDateFormat + |PT1H|) as String{format: "yyyy-MM-dd HH:mm:ss.SSS" }
}
Info on Period here: https://docs.mulesoft.com/mule-runtime/4.1/dataweave-types#dw_type_dates_period
| 74321bdb35b3a39c757bb4889587d9f9796ea54c017c14d446471dd4e4a0fd34 | ['26f1ee59d12a411baaac45be503ed3a5'] | I think until-successful is still the best solution as it gives you a way of breaking out of the loop after X attempts. Just, unfortunately, needs to be controlled with errors. You can use a simple choice and raise-error processor:
<until-successful maxRetries="5">
<http:request method="GET" url="http://something" doc:name="Request" />
<choice>
<when expression="#[payload.status !='OK']">
<raise-error type="APP:REQUEST_NOT_FINISHED"/>
</when>
</choice>
</until-successful>
|
28da517eb2b9551460d34d191a1c9a79102ef31bdb53da788526d9830b07901f | ['26f3e83f49c946e285b4e0af0d6c1102'] | It would seem that religious toleration in Poland became a necessity because borders with Lutheran Prussia and Orthodox Russia kept changing and people had to be reabsorbed into Poland. Also people fled intolerance in Prussia and Russia going to Poland for sanctuary. Poland needed France and Austria as allies against Prussia; therefore, it was wise to remain officially Roman Catholic while allowing Protestant and Eastern Orthodox to worship freely.
| 5a6bc6f58186361cee6d8d5596294c5e754c87fb8cb704ff8d3c4a19977b6781 | ['26f3e83f49c946e285b4e0af0d6c1102'] | Wikipedia claims that "each finite segment of noncomputable sequence of integers is computable".
It continues to clarify: For any noncomputable function, "for any given value of n, [...] a trivial algorithm exists (even though it may never be known or produced by anyone)".
While I do believe this for the given example with busy beavers, I am not certain this is always correct. Is there a proof of this statement?
|
8904f3202670bacb1421afeb8721ebbd28d64773e6c141137792261fa479ea5d | ['26f4508f4f4d4108ba308a1671e1c0e3'] | Im getting the following error when doing this.
Super expression must either be null or a function, not undefined
What I'm trying to do in javascript which I can do in c# is have the child class be able to call the parent class and use functions that instantiate the base class again. Say for instance you have a navbar on a page and each icon takes you to a different page but the navbar is always visible. By inheriting from the parent page I would be able to keep the code dry like we do in c# but for some reason javascript is flipping out when trying to do the same thing even if I just pass null into the super.
Doing this would allow me to havenew Support(browser).someMethod().cb().someMethod()
import { Support } from "./community/Support";
export class NavigationController {
constructor(browser){
this.browser = browser;
}
cb(){
this.browser.cool()
return new Support(this.browser);
}
import { NavigationController } from "../navigation_controller";
export class Support extends NavigationController {
constructor(browser){
super(browser);
this.browser = browser;
}
someMethod(){
this.browser.blah()
return this;
}
| 68bf9d6f8691707283708eb382f1cb19cadd4e9a4471c333f1b20efe7b0a6903 | ['26f4508f4f4d4108ba308a1671e1c0e3'] | I know you cannot run xamarin ios uitests on windows as the xamarin support site says, but is it possible to run it through parallels locally on a mac? I know you can run/build/debug with the xamarin.ios extension but does that apply to xamarin uitests with the simulator as well?
Documentation
Thanks
|
1d29f9c09fab373d9c21a840f06b787d8e0df361e7860292f499c5104cf36247 | ['26f4fce91fea4116b8ac11c5c13fac80'] | estoy intentando cambiar un status de Mailbox e intento seleccionar el option correcto de forma dinamica en base a los 2 request que hago, el primero es para traer los datos del formulario que estoy editando y el segundo request es para traer todos los estatus, intento evaluar si cada vez que cambia el option, su valor es igual al valor que trae el primer request, que se seleccione, y cada vez que seleccione para editar el mailbox, tiene que seleccionarse el option del dropdown, pero no logro que se seleccione, funciona si lo pongo en un label pero la idea es hacer lo mismo pero con el dropdown.
Este es mi select:
<select class="form-control select2" data-toggle="select2" id="Status" name="Status"></select>
El metodo que trae los datos del formulario, cuando edito los datos, aqui es donde tiene que aparecer el option seleccionado con lo que trae el JSON para poder cambiarlo
$dataTable.on("click", "a.edit", function () {
var $this = $(this);
$.ajax({
type: "GET",
url: "/Mailbox/GetMailboxById/" + $this.data('id'),
error: (result) => $.Notification.error(result),
success: function (result) {
if (result.Success) {
var mymailbox = result.Mailboxes[0];
$(FormMB.MailboxStatus).val(mymailbox.MailboxStatus);
LoadMailboxStatus();
$('option').each(function () {
if (mymailbox.MailboxStatus == $(this).text()) {
$(this).attr('selected', 'selected')
};
});
}
else {
$.Notification.error(result.Message);
}
}
});
$mailboxModal.modal();
});
Resultado:
"Success": true,
"Message": "",
"Mailboxes": [
{
"Date": "2020-04-03T15:35:00",
"MailboxStatus": "Nuevo",
"Id": "06d6e6a3-eea2-4bf3-9a37-7c737165256a",
},
{
"Date": "2020-04-03T15:35:00",
"MailboxStatus": "Atendido",
"Id": "06d6e6a3-1111-4bf3-9a37-7c737165256a",
}
Metodo que trae los status:
function LoadMailboxStatus() {
var dropDown = $("#StatusId");
dropDown.empty();
$.ajax({
type: "GET",
url: "/Mailbox/GetStatuses/",
error: (result) => $.Notification.error(result),
dataType: 'json',
success: function (result) {
if (result.Success) {
var status = result.Statuses;
$.each(status, function (key, item) {
dropDown.append($('<option></option>').attr('value', item.Id).text(item.Name));
});
dropDown.change(function () {
$(this).val()
});
}
else {
$.Notification.error(result.Message);
}
}
});
}
Resultado:
"Success": true,
"Message": "",
"Statuses": [
{
"Id": 1,
"Name": "<PERSON>",
},
{
"Id": 2,
"Name": "<PERSON>",
},
{
"Id": 3,
"Name": "<PERSON>",
}
]
Mi duda es, como podría hacer que se seleccione el option del dropdown en base a lo que traigan los request?
| c4585ec2acd47e91291b0d754f35abca91f656c58bb29f0f69787e4b42f69d7b | ['26f4fce91fea4116b8ac11c5c13fac80'] | Tengo un API en php que guarda datos en una base de datos en mi servidor, guarda datos que son texto y numéricos pero no me percaté que tengo un campo de una imagen, así que estoy intentando subir una imagen por esta API pero en si no sé como implementarle la subida de archivos o imagenes para que me suba tanto como los campos que son texto o números como la imagen, todos juntos, aqui esta el API:
post.php
<?php
require_once('exceptions/recordnotfoundexception.php');
require_once('connections/mysqlconnection.php');
require_once('person.php');
class Post {
private $idPost;
private $description;
private $postphoto;
private $postdate;
private $person;
public function getIdPost() { return $this->idPost; }
public function setIdPost($idPost) { $this->idPost = $idPost; }
public function getDescription() { return $this->description; }
public function setDescription($description) { $this->description = $description; }
public function getPostDate() { return $this->postdate; }
public function setPostDate($postdate) { $this->postdate = $postdate; }
public function getPostPhoto() { return $this->postphoto; }
public function setPostPhoto($postphoto) { $this->postphoto = $postphoto; }
public function getPerson() { return $this->person; }
public function setPerson($person) { $this->person = $person; }
public function __construct() {
if(func_num_args() == 0) {
$this->idPost = 0;
$this->description = '';
$this->postdate = '';
$this->postphoto = '';
$this->person = new Person();
}
if(func_num_args() == 5) {
$this->idPost = func_get_arg(0);
$this->description = func_get_arg(1);
$this->postphoto = func_get_arg(2);
$this->postdate = func_get_arg(3);
$this->person = func_get_arg(4);
}
public function add() {
$connection = MySqlConnection::getConnection();
$statement = 'insert into post(description, postDate, postPhoto, idPerson) values (?, ?, ?, ?)';
$command = $connection->prepare($statement);
$command->bind_param('sssi', $this->description, $this->postdate, $this->postphoto, $this->person);
$result = $command->execute();
mysqli_stmt_close($command);
$connection->close();
return $result;
}
Y este es su controlador:
postcontroller.php
<?php
require_once("models/post.php");
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(isset($_POST['description']) &&
isset($_POST['postdate']) &&
isset($_POST['postphoto']) &&
isset($_POST['person']))
{
$parametersOk = true;
$valuesOk = true;
if ($valuesOk)
{
try
{
$person = new Person();
}
catch (RecordNotFoundException $ex)
{
$valuesOk = false;
echo json_encode(array(
'status' => 3,
'message' => $ex->getMessage()
));
}
}
if ($valuesOk)
{
$post = new Post();
$post->setDescription($_POST['description']);
$post->setPostDate($_POST['postdate']);
$post->setPostPhoto($_POST['postphoto']);
$post->setPerson($_POST['person']);
if ($post->add())
echo json_encode(array(
'status' => 0,
'message' => 'Post added successfully'
));
else
echo json_encode(array(
'status' => 4,
'message' => 'Could not add post'
));
}
}
else
{
echo json_encode(array(
'status' => 1,
'message' => 'missing parameters'
));
}
}
En si, los datos se suben por el archivo postcontroller.php <PERSON><IP_ADDRESS>getConnection();
$statement = 'insert into post(description, postDate, postPhoto, idPerson) values (?, ?, ?, ?)';
$command = $connection->prepare($statement);
$command->bind_param('sssi', $this->description, $this->postdate, $this->postphoto, $this->person);
$result = $command->execute();
mysqli_stmt_close($command);
$connection->close();
return $result;
}
Y este es su controlador:
postcontroller.php
<?php
require_once("models/post.php");
if ($_SERVER['REQUEST_METHOD'] == 'POST')
{
if(isset($_POST['description']) &&
isset($_POST['postdate']) &&
isset($_POST['postphoto']) &&
isset($_POST['person']))
{
$parametersOk = true;
$valuesOk = true;
if ($valuesOk)
{
try
{
$person = new Person();
}
catch (RecordNotFoundException $ex)
{
$valuesOk = false;
echo json_encode(array(
'status' => 3,
'message' => $ex->getMessage()
));
}
}
if ($valuesOk)
{
$post = new Post();
$post->setDescription($_POST['description']);
$post->setPostDate($_POST['postdate']);
$post->setPostPhoto($_POST['postphoto']);
$post->setPerson($_POST['person']);
if ($post->add())
echo json_encode(array(
'status' => 0,
'message' => 'Post added successfully'
));
else
echo json_encode(array(
'status' => 4,
'message' => 'Could not add post'
));
}
}
else
{
echo json_encode(array(
'status' => 1,
'message' => 'missing parameters'
));
}
}
En si, los datos se suben por el archivo postcontroller.php pero tengo esta API que sube la imagen y es esta:
uploadImage.php
<?php
require_once("models/connections/mysqlconnection.php");
$upload_path = 'images/';
$server_ip = gethostbyname(gethostname());
$upload_url = 'http://'.$server_ip.'/DeviceCamera/'.$upload_path;
$response = array();
if($_SERVER['REQUEST_METHOD']=='POST') {
if(isset($_POST['name']) and isset($_FILES['image']['name'])) {
$name = $_POST['name'];
$fileinfo = pathinfo($_FILES['image']['name']);
$extension = $fileinfo['extension'];
$file_url = $upload_url.getFileName().'.'.$extension;
$file_path = $upload_path.getFileName().'.'.$extension;
try {
$connection = MySqlConnection<IP_ADDRESS>getConnection();
move_uploaded_file($_FILES['image']['tmp_name'],$file_path);
$statement = "insert into photo (name, image) values ('$name', '$file_url')";
if(mysqli_query($connection, $statement)) {
echo json_encode(array(
'status' => 0,
'message' => 'Image added successfully',
'url' => $file_url
));
}
else
echo json_encode(array(
'status' => 4,
'message' => 'Could not add Image'
));
}catch(RecordNotFoundException $ex){
echo json_encode(array(
'status' => 3,
'message' => $ex->getMessage()
));
}
mysqli_close($connection);
} else {
$response['error']=true;
$response['message']='Please choose a file';
}
}
function getFileName(){
$connection = MySqlConnection<IP_ADDRESS>getConnection();
$query = "select max(idImage) as id from photo";
$result = mysqli_fetch_array(mysqli_query($connection, $query));
mysqli_close($connection);
if($result['id']==null)
return 1;
else
return ++$result['id'];
}
En android studio mando a llamar el archivo uploadImage.php para subir la imagen al servidor pero solo funciona con la imagen, mi pregunta es, ¿como puedo implementar lo de uploadImage.php en post.php y postcontroller.php para que me suba la imagen y los demas campos al servidor?
Gracias por su atención y espero su respuesta
|
92e2a0fb0c7d97bca91ebce29015067024878b846c271df19476f096ecb99b23 | ['27025d0903d1401096a086f41bd63a29'] | I have this struct with many properties. Due to limitations of the solidity stack and practicality of the app, I cannot pass in all the values to the properties when creating a new instance of the struct. Consider the code below:
struct PersonalInfo {
uint256 tsc;
bytes32 surname;
bytes32 firstName;
bytes32 lastName;
bytes32 birthdate;
bytes32 gender;
uint256 nationalID;
bytes32 life;
uint phone;
bytes32 postalAddress;
uint currentSchool;
bytes32 reportingDate;
bytes32 subject1;
bytes32 subject2;
string path
bytes32 email;
uint teacherIndex;
}
I want some properties like string path to be added later. This is because in the registration form, I don't have all these properties as form fields that a user fills. However, when creating a new instance of the struct as shown below, I get an error.
//store teacher details
function storeTeacherDetails(
uint256 tsc,
bytes32 surname,
bytes32 firstName,
bytes32 lastName,
bytes32 birthdate,
bytes32 gender,
uint256 nationalID,
bytes32 life,
uint phone,
bytes32 postalAddress,
uint currentSchool,
bytes32 reportingDate,
bytes32 subject1,
bytes32 subject2,
bytes32 email
) public {
teachers[teacherRecords.length]=PersonalInfo({tsc:tsc,
surname:surname,
firstName:firstName,
lastName:lastName,
birthdate:birthdate,
gender:gender,
nationalID:nationalID,
life:life,
phone:phone,
postalAddress:postalAddress,
currentSchool:currentSchool,
reportingDate:reportingDate,
subject1:subject1,
subject2:subject2,
email:email});
}
After compiling, I get the following error
TypeError: Wrong argument count for struct constructor: 14 arguments given but expected 17.
As a side note, I read somewhere that the stack only goes 7 steps deep. Passing all these parameters at once is a bad idea. I need to group these properties and have getters and setters to each group, but I can only get/set a property of a struct instance that exists. The question therefore is, how do I create an struct instance with say default values for each data type, the set/get then properties later?
| d92dd6fefbd8aa2716f8a908a4f735a71305202e4cc88a57bb63cd3c9c98ef51 | ['27025d0903d1401096a086f41bd63a29'] | So the way I see things is that you could basically have some Godtech that prevents the spreading of the radiation after the body explodes. Let's say for instance that when the body is created, some tech is included in the body such that when it is destroyed, molecules in the body, maybe an extra organ that contains a substance, binds to the God particles and renders them dormant. This could add a few extra layers to your world where non-God creatures could try to harness God particles in dormant form and make themselves Gods, etc.
Another option could be a celestial force that is specialized and tasked with recapturing the God particles. You could make it such that the particles are more like large gems that a creature could consume to mutate and each God "body" releases X number of them upon explosion that must be tracked down.
Really the world is your oyster here because there is no limit to how things can work for you. I personally like the idea of there being crystal like objects that are expelled on release because it introduces the chance for a black market that trades them, a task force to recover them, even a limit to the amount that exist that makes it so there are a finite number of God "bodies" that can be created at any one time.
|
a76c5f1049c5269148e14724018b3d3f7c70e6610a87591b432589a68acc0bae | ['2706b4d589844b9799abeeeeb77feebe'] | Here is a way to do it with wget and cut:
wget -nv https://upload.wikimedia.org/wikipedia/commons/5/54/Golden_Gate_Bridge_0002.jpg 2>&1 |cut -d\" -f2
Explanation, wget -nv ... prints out something like this:
2016-11-15 14:58:44 URL:https://upload.wikimedia.org/wikipedia/commons/5/54/Golden_Gate_Bridge_0002.jpg [1072554/1072554] -> "Golden_Gate_Bridge_0002.jpg.22" [1]
The -nv flag on wget just makes it "non-verbose" (See: man wget)
Since wget writes its output to STDERR we have to redirect that to STDOUT before we can extract the text; to do this we add 2>& at the end of the wget. Then to get out just the filename at the end I used cut. The -d\" is to specify that we are using " as a delimiter. The -f2 specifies that we want the second "column", i.e., the data inbetween the first and the second delimiters ".
First column: 2016-11-15 14:58:48 URL:https://upload.wikimedia.org/wikipedia/commons/5/54/Golden_Gate_Bridge_0002.jpg [1072554/1072554] -> "Golden_Gate_Bridge_0002.jpg.23`" [1]
| b3da8386985fdb945ffb3bf4f06a9f2d92e46f11166f421914f5bc0345efffdb | ['2706b4d589844b9799abeeeeb77feebe'] | If your router is <IP_ADDRESS>/24, and your modem is <IP_ADDRESS>/24, there should not be any issue. Connect the modem WAN output to the WAN input on the router. Any traffic that isn't managed by your router, i.e., anything other than <IP_ADDRESS><PHONE_NUMBER>, and your modem is <PHONE_NUMBER>/24, there should not be any issue. Connect the modem WAN output to the WAN input on the router. Any traffic that isn't managed by your router, i.e., anything other than <PHONE_NUMBER>, will be sent out its default gateway to the modem. You can manage your modem the same way as when it is plugged directly into your computer. |
4502134225bc6e41dcb149a68e16b2f384e58d195293f987755d53ffbaf0537e | ['27086d1918e441b8bba8e00d0bf15d7a'] | I'm trying to use the AngularJS directive ui-tinymce with tinyMce 4.0.25 and IE10, and am unable to get it to work at all.
My html looks like this:
<textarea ui-tinymce ng-model="fubar"></textarea>
In my controller, I have:
$scope.fubar = "this is a <b>test</b>";
It all goes badly at these two lines in the tinymce initialization code itself.
Theme = ThemeManager.get(settings.theme);
self.theme = new Theme(self, ThemeManager.urls[settings.theme]);
The first line sets Theme to undefined and the last line aborts with the message "Object doesn't support this action". The value of ThemeManager.urls[settings.theme] is "http://localhost:57683/Scripts/tinymce/themes/modern", which seems right.
I can no longer find it, but I'd previously found a post where this issue was due to this code being executed before some other part of tinyMCE had been loaded. The solution there was to use a certain tinyMCE option that forced loading in a certain way, however that option has been removed in tinyMCE 4.x. Even more frustrating is that I had tinyMCE working for days with my own directive when suddenly this occurred. I've simplified this to just using ui-tinymce (with the same result) to rule out any of my code as the culprit.
| e30aa790b1f11e7317d61934ea86298417cf86b08fb878b568cb609e975cd755 | ['27086d1918e441b8bba8e00d0bf15d7a'] | I would like to use jqGrid for a great many grids that have only a small set of application-specific column types, and I would like to create a way to enforce consistency. For example, I want all my columns that show the compliance status of a row to have a certain format, be aligned a certain way, have specific search options, etc. So instead of having a colmodel entry like this:
{ name: 'ABC', width: 80, align: 'center', stype: "select",
searchoptions: { value: "1:Compliant;0:Not Compliant"} }
I would like to have one like this:
{ name: 'ABC', width: 80, mytype: compliancestatus }
where compliancestatus is a function I would write.
Is this kind of thing possible - without modifying the jqGrid source code? If so, can someone point me to an example of this type of extension?
|
a6af6e96dc578d4529205648284b21c9cf85dc09c47c2d07892bd8a48363b0e3 | ['270a0db2047946189b44ceec1c4923ef'] | This might be what you are looking for: SnuggleTeX
From the site:
SnuggleTeX is a 100% Java library for converting (a reasonable subset of) LaTeX into XHTML + MathML.
SnuggleTeX can attempt to convert input LaTeX to Content MathML by first creating Enhanced Presentation MathML and then processing that. In many ways, this part of the process is relatively simple since most of the semantic structure has already been inferred (though might not necessarily make any sense).
| 52ce273986e3f05767bacaafd311001a05798edbd8c49a7987303cd21d6d2251 | ['270a0db2047946189b44ceec1c4923ef'] | Error code 0x8007000d tells us, that file contains a malformed XML element.
And your Config Source shows, that problem is between -1 and 0 lines (first 3 bytes of BOM-header).
If the web.config file has a BOM set, then the XML root node encoding attribute must match.
Check the encoding of your's web.config file or try to ReSave it without BOM-header.
VSCode save with encoding
|
516b21333cc91a3ca9c28cfdca73a4b03dba691abd9b4c99f410735678e29c08 | ['270bc116eb4e47779ec8938829c21605'] | Мне нужно, чтобы .img1 был передвинут с помощью margin-top and margin-left в процентах также, как если бы я указал left:98px; and top:38px;
.general {
margin:0 auto;
max-width:1366px;
height:5797px;
width:100%;
}
.div1 {
max-width:1366px;
width:100%;
height:670px;
background-color:rgb(233,233,233);
}
.img1 {
position:absolute;
margin-left:7.17%;
margin-top:5.67%;
}
<--!HTML -->
<div class="general">
<div class="div1">
<img src="01_one_page.png" class="img1">
</div>
</div>
</body>
</html>
я не знаю как считать процентное позиционирование, я не нашел информации за несколько дней (вероятно я плохо искал, но я уже сдался и не хочу искать вновь). Под процентным позиционированием я понимаю то, что зная ширину и высоту родительского блока, можно было бы рассчитать как в процентах указать margin так, чтобы можно было переместить на нужное кол-во пикселей любой элемент.
| 2512c404c27a5884c5948db4dfbef00e1842be9fc027be79961ae9cf58055ab7 | ['270bc116eb4e47779ec8938829c21605'] | This won't work, @EricCarvalho :
'code12:43:44|root@bergen:~] ifconfig eth0|grep inet|grep -v inet6
inet addr:<IP_ADDRESS> Bcast:<IP_ADDRESS> Mask:<IP_ADDRESS>
[12:43:47|root@bergen:~] route add -net <IP_ADDRESS>/13 gw <IP_ADDRESS>
SIOCADDRT: Network is unreachable
Actually, I don't see why I should create a route from <IP_ADDRESS>/13 to <IP_ADDRESS> as I'm already able from 10/13 to reach 192/24, but the reverse is not possible, which is my whole problem |
4d6d1c9c5a6a97ec38ea6e63d5e5b8f035f2c32948ad8573f2d8c80f1f7c5b9d | ['2715fce318e34ba7868782f68434b66e'] | i have a problem with uploading multiple files with php zend framework
i have a form which contains many input[type="file"] tags, each tag has its unique name and id attributes.
when receiving this data, all files gathering in an array files, i can receive and store it easily now, but the problem here is how can i identify which file coming from which input element? it is very important to me to know that because each specific file will store in a specific field in my database.
here an example
<input type "file" name = "main_photo"/>
<input type "file" name = "horizontal_plan"/>
$upload = new Zend_File_Transfer_Adapter_Http();
$files = $upload->getFileInfo();
foreach ($files as $file => $info)
{
if($upload->isValid($file))
{
//here how can i point to the main_photo file or the horizontal_plan file?
}
}
please help, thank you in advance.
| 6f65a52c5551c88b4fbedd2577d03b65b7ad7b260e47e052f9f743ecb8f16afb | ['2715fce318e34ba7868782f68434b66e'] | i have a problem with upload mutilply files using zend framework on server
actually my code works correctly on localhost but on remote server it gives me application error message
my host is ipage.com
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination('projects\\'.$_pId);
// $_pid is my project folder where all files related to it uploded
$files = $upload->getFileInfo();
$i = 1;$g = 1;
foreach ($files as $file => $info)
{
// i have three kinds of images
// innerfinishingphotos_ images which can be more than 1 file eg :innerfinishingphotos_1, innerfinishingphotos_2, innerfinishingphotos_3.
// outerfinishingphotos_ images which can be more than 1 file eg :outerfinishingphotos_1, outerfinishingphotos_2, outerfinishingphotos_3.
// _main_photo image an image.
// here i made if statements to determine which file came from which input file
if( $info == $files["innerfinishingphotos_".$i] && $info["name"] == $files["innerfinishingphotos_".$i]["name"] && !empty( $info["name"] ) )
{
$filename = "inner_finishing".$_pId.uniqid().$files["innerfinishingphotos_".$i]["name"];
$upload->addFilter('Rename', $filename, $files["innerfinishingphotos_".$i]);
$photodata = Array ("project_id"=> $_pId, "photo_link"=> "/projects/".$_pId."/".$filename, "photo_name"=> "inner_finishing");
$projectModel->addInProjectGalary($photodata);
$i++;
}
else if( $info == $files["outerfinishingphotos_".$g] && $info["name"] == $files["outerfinishingphotos_".$g]["name"] &&!empty( $info["name"] ) )
{
$filename = "outer_finishing".$_pId.uniqid().$files["outerfinishingphotos_".$g]["name"];
$upload->addFilter('Rename', $filename, $files["outerfinishingphotos_".$g]);
$photodata = Array ("project_id"=> $_pId, "photo_link"=> "/projects/".$_pId."/".$filename, "photo_name"=> "outer_finishing");
$projectModel->addInProjectGalary($photodata);
$g++;
}
else if ($info == $files["_main_photo"] && !empty( $info["name"] ))
{
$filename = "main_photo".$_pId.uniqid().$files["_main_photo"]["name"];
$upload->addFilter('Rename', $filename, $files["_main_photo"]);
$photodata = Array ("project_id"=> $_pId, "photo_link"=> "/projects/".$_pId."/".$filename, "photo_name"=> "project_photo");
$projectModel->addInProjectGalary($photodata);
}
//then i receive the image
if($upload->isValid($file))
{
try {
$upload->receive($file);
}
catch (Exception $e) {
echo "upload exteption";
}
}
}
i tested this code and i works correctly on localhost and all images uploaded and their data entered my database
but on my remote host 'ipage.com' not work.
please guys help me
|
ff6de8e330b1444ee51502d6df9cbfd4a519cd9254bca385c18996a4a1b77244 | ['27215588e40945cca7370446a5072c7d'] | I keep getting 400 Bad Request error whenever im trying to pass an entire object through form:select.
HTTP Status 400 – Bad Request
Type Status Report
Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
This is my select form:
<html>
<head>
<title>Dodaj produkt do aukcji</title>
</head>
<body>
<form:form action="saveProduct${auction.id}" modelAttribute="newProduct" method="POST">
<label>Nazwa:</label> <form:input path="name"/><br>
<label>Cena:</label> <form:input path="price"/><br>
<label>Kategoria:</label>
<form:select path="productCategory">
<form:options items="${productCategories}" itemLabel="name"/>
</form:select><br>
<input type="submit" value="Dodaj" class="save"/><br>
</form:form>
</body>
</html>
Controller:
@GetMapping("/addProductPage")
public String addProductPage(@RequestParam("auctionId") int id,Model theModel) {
Collection <ProductCategory> pCategories = productCategoryService.getProductCategories();
Auction auction = auctionService.getAuction(id);
Product product = new Product();
ProductCategory pCategory = new ProductCategory();
theModel.addAttribute("auction", auction);
theModel.addAttribute("newProduct", product);
theModel.addAttribute("productCategories", pCategories);
return "add-product";
}
@PostMapping("/saveProduct{someId}")
public String saveProduct(@ModelAttribute("newProduct") Product product, @PathVariable(value="someId") String someId) {
Auction auction = auctionService.getAuction(Integer.parseInt(someId));
Collection<Product> products = auction.getProducts();
products.add(product);
auction.setProducts(products);
product.setAuction(auction);
auctionService.saveAuction(auction);
productService.saveProduct(product);
return "redirect:/showMyAuctions";
}
Product entity:
@Entity
@Table(name="product")
public class Product {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="product_id")
private int id;
@Column(name="name")
private String name;
@Column(name="price")
private float price;
@ManyToOne
@JoinColumn(name="category_id")
private ProductCategory productCategory;
@ManyToOne
@JoinColumn(name="auction_id")
private Auction auction;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public float getPrice() {
return price;
}
public void setPrice(float price) {
this.price = price;
}
public ProductCategory getProductCategory() {
return productCategory;
}
public void setProductCategory(ProductCategory productCategory) {
this.productCategory = productCategory;
}
public Auction getAuction() {
return auction;
}
public void setAuction(Auction auction) {
this.auction = auction;
}
@Override
public String toString() {
return "Product [id=" + id + ", name=" + name + ", price=" + price + ", productCategory=" + productCategory
+ "]";
}
}
Product category entity:
@Entity
@Table(name="product_category")
public class ProductCategory {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="category_id")
private int id;
@Column(name="name")
private String name;
@OneToMany(mappedBy="productCategory", cascade=CascadeType.ALL, fetch=FetchType.EAGER)
Collection<Product> products;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Collection<Product> getProducts() {
return products;
}
public void setProducts(Collection<Product> products) {
this.products = products;
}
@Override
public String toString() {
return "ProductCategory [id=" + id + ", name=" + name + "]";
}
}
What i want is the chosen product category to be added to the product.
| 8ebc740293f4690085db6b8c875ac3b6781f0d4e88e55734bea59e31a0fd04ff | ['27215588e40945cca7370446a5072c7d'] | I've been trying to make a custom annotation validation for checking if there is user already created in database but for some reason my user service in ConstraintValidator class returns null but in controller it finds the user.
Here userService returns null
package pl.discount.validation;
import java.util.Optional;
import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;
import org.springframework.beans.factory.annotation.Autowired;
import pl.discount.annotation.UserExists;
import pl.discount.model.entity.Users;
import pl.discount.service.UsersService;
public class UserExistsContraintValidator implements ConstraintValidator<UserExists, String> {
@Autowired
UsersService usersService;
@Override
public boolean isValid(String value, ConstraintValidatorContext context) {
boolean result;
System.out.println("WARTOSC VALUE ===>>>>>>" + value);
Optional<Users> user = usersService.getUser(Integer.valueOf(1));
System.out.println("WARTOSC user.name ===>>>>>>" + user.get().getUsername());
if(user != null ) {
result = false;
}else {
result = true;
}
return result;
}
}
Here it finds the user and displays user name
package pl.discount.controller;
import java.util.Optional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import pl.discount.model.entity.Users;
import pl.discount.service.UsersService;
@Controller
public class TestController {
@Autowired
UsersService usersService;
@RequestMapping(value="/", method=RequestMethod.GET)
public String testPage() {
Optional<Users> user = usersService.getUser(Integer.valueOf(1));
System.out.println("WARTOSC user.name ===>>>>>>" + user.get().getUsername());
return "test-view";
}
}
This is error stack when i try to register the user
Hibernate: select role0_.role_id as role_id1_3_, role0_.role_name as role_nam2_3_ from role role0_ where role0_.role_name=?
WARTOSC VALUE ===>>>>>>test
2019-03-25 21:57:30.490 ERROR 4512 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is javax.validation.ValidationException: HV000028: Unexpected exception during isValid call.] with root cause
java.lang.NullPointerException: null
at pl.discount.validation.UserExistsContraintValidator.isValid(UserExistsContraintValidator.java:22) ~[classes/:na]
at pl.discount.validation.UserExistsContraintValidator.isValid(UserExistsContraintValidator.java:1) ~[classes/:na]
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:171) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.constraintvalidation.SimpleConstraintTree.validateConstraints(SimpleConstraintTree.java:68) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateConstraints(ConstraintTree.java:73) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.metadata.core.MetaConstraint.doValidateConstraint(MetaConstraint.java:127) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.metadata.core.MetaConstraint.validateConstraint(MetaConstraint.java:120) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateMetaConstraint(ValidatorImpl.java:533) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForSingleDefaultGroupElement(ValidatorImpl.java:496) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForDefaultGroup(ValidatorImpl.java:465) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateConstraintsForCurrentGroup(ValidatorImpl.java:430) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validateInContext(ValidatorImpl.java:380) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.validator.internal.engine.ValidatorImpl.validate(ValidatorImpl.java:169) ~[hibernate-validator-6.0.14.Final.jar:6.0.14.Final]
at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.validate(BeanValidationEventListener.java:116) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.cfg.beanvalidation.BeanValidationEventListener.onPreInsert(BeanValidationEventListener.java:80) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.action.internal.EntityIdentityInsertAction.preInsert(EntityIdentityInsertAction.java:197) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.action.internal.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:75) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:645) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.engine.spi.ActionQueue.addResolvedEntityInsertAction(ActionQueue.java:282) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.engine.spi.ActionQueue.addInsertAction(ActionQueue.java:263) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.engine.spi.ActionQueue.addAction(ActionQueue.java:317) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.addInsertAction(AbstractSaveEventListener.java:359) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:292) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:200) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:131) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:192) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:135) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:62) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:800) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:785) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_171]
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:350) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at com.sun.proxy.$Proxy112.persist(Unknown Source) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_171]
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:308) ~[spring-orm-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at com.sun.proxy.$Proxy112.persist(Unknown Source) ~[na:na]
at org.springframework.data.jpa.repository.support.SimpleJpaRepository.save(SimpleJpaRepository.java:489) ~[spring-data-jpa-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_171]
at org.springframework.data.repository.core.support.RepositoryComposition$RepositoryFragments.invoke(RepositoryComposition.java:359) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.data.repository.core.support.RepositoryComposition.invoke(RepositoryComposition.java:200) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$ImplementationMethodExecutionInterceptor.invoke(RepositoryFactorySupport.java:644) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:608) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$invoke$3(RepositoryFactorySupport.java:595) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:595) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:59) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:294) ~[spring-tx-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98) ~[spring-tx-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:139) ~[spring-tx-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:135) ~[spring-data-jpa-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.data.repository.core.support.SurroundingTransactionDetectorMethodInterceptor.invoke(SurroundingTransactionDetectorMethodInterceptor.java:61) ~[spring-data-commons-2.1.5.RELEASE.jar:2.1.5.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:212) ~[spring-aop-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at com.sun.proxy.$Proxy114.save(Unknown Source) ~[na:na]
at pl.discount.service.serviceImpl.UsersServiceImpl.saveUsers(UsersServiceImpl.java:66) ~[classes/:na]
at pl.discount.controller.RegistrationController.saveUser(RegistrationController.java:38) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_171]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:908) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882) ~[spring-webmvc-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-embed-websocket-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:74) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178) ~[spring-security-web-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-5.1.5.RELEASE.jar:5.1.5.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200) ~[tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:834) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1415) [tomcat-embed-core-9.0.16.jar:9.0.16]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.16.jar:9.0.16]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_171]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.16.jar:9.0.16]
at java.lang.Thread.run(Unknown Source) [na:1.8.0_171]
|
4f0d09cf6c7c835188c4736d5bf43473f83aabbc19fe4ed2b9ff0742818ff227 | ['2726789979614b82ac8f2b16bea12bc9'] | This oscillator provides clock to an FPGA which powers the ultrahdmi mod for an N64 (https://www.retrorgb.com/ultrahdmi.html).
It's clearly marked
A03ZZ
1414
Clock output is diametrically opposite pin 1, it's a 4 pin device, it takes a 3.3V supply. Dimensions are nominally 3.2mm by 2.5mm
When I scope it with my limited equipment I get a weak ~75MHz signal (50mv p-p), but that could be junk from a number of sources.
The story behind this: it came to me with a glitch where it would lose on screen display functionality over time. Careful application of compressed air suggested the oscillator was the culprit, so I tapped it with the soldering iron on all 4 corners - now the device simply doesn't work. I've since fixed the bridge between the land and the exposed leadframe to no avail. I'd like to try replacing this part with something as close as possible, but if we fail to identify it SMD oscillators are cheap enough that I'll buy a spread of spectrum and try em all if I have to.
| bb9b35cad4caf1718a82a2fd62c140f324de6c9cfd87269d042647852b4f1490 | ['2726789979614b82ac8f2b16bea12bc9'] | When enable is low only the tri state buffer will be “z” or “hi-z”, whereas the AND gate will output a real zero.
Tri states are usually used with their outputs in parallel with other outputs, and the enable lines are sequenced in such a way that the outputs never are in conflict. The AND gate has no such feature - if you were to parallel it with another logic output there could be conflicts, leading to undefined voltage levels. |
d4891c115d1f233a5bd9cdfa535d89b4894057fd65f8dc9ac9eefd793d74f83a | ['2727586361a4420f83cff0809220b6c7'] | thank u for the reply. so lets say I am doing it on the page level, and if the user clicks on check...I want to display a text besides the checkbox saying _Approved_ and by default when it is not checked I want it to show _Not Approved_. Is this possible ? | 620297db793c489bc1a6bc02645cd3491d0bcbd29c3595df1130cac412822f94 | ['2727586361a4420f83cff0809220b6c7'] | **1st question:**: where is this object setting located ? I could not find anywhere in my object page. **2nd question:** So u mean if i am logged in and I change it to XYZ and if another person logs in with his credentials he the change won't reflect in his. |
3a4cb642df7357312ea068bc72077cad247693925591ab862a70953c9f4ff475 | ['2729f588c9c64c4dbac30b3da64d1d8f'] | I found the solution. Pretty simple to tell the truth. just add the tags table between divs and use the $ ("# divid"). hide (); to hide and $ ("# divid"). show (); to display.
The code was as follows.
...
<div id="divid">
<table id="listid" class="scroll"> <tr> <td/> </ tr> </ table>
</ div>
...
<script>
...
$ ("#divid"). hide ();
$ ("#divid"). show ();
...
</ script>
| ff7a8df84bf844d5a635895db1b66647b7e4779db054d771d38a69033398221e | ['2729f588c9c64c4dbac30b3da64d1d8f'] | I have four jqgrid in my jsp application. They are loaded via ajax using the method addXmlData (messageXML) How can I hide three of the grid and show only one of them, and in accordance with the click of a button, hide and show the other grids. The content of the grids are updated according to the user's needs via ajax. I need only show one at a time not to mess up the form.
|
a232ddb70d81b3ee0811c0be3c104ab9d0140ff44b76dfa5a4e4aefcf4248bb4 | ['27350054bacf4de295fce924d24c9243'] | So, here's what I found... We can either zero out the relationship in the POA, or we can recreate the records... We tried reimporting the records from a development org we have, but the problem persisted since we are using clones (same guids)... We have to reimport to the dev org with new guids, and then can promote to test org using clones at that point...
| 4d056b7536f531cdcc81abe61342c362d37dca42f9401773a11717013d9a776f | ['27350054bacf4de295fce924d24c9243'] | I'm trying to style a Select element to have a transparent background, and during troubleshooting the logic has run me in a circle.
We use Divi as our WP theme.
We are using Ninja Forms as our forms plugin.
Two fields in this mix at this point, a regular text input and the select field.
We applied a custom class to each of those fields.
We applied the following directive to that class:
.header_form_select {
background: transparent !important;
}
Here's where the troubleshooting went in circles. When we test this arrangement we find that the text input accepts the styling and is indeed transparent. The select, not so much. If we move the select field element outside of it's parent element the styling DOES affect it. So something must be overwriting it, right?
However, if we keep it within the parent element (as designed), and style the background to be red instead of transparent it works as expected. It seems the trouble is specifically with transparency AND the select element (since it works fine with the text input)...
I can't seem to find any information on why it would be a quirk around select elements, and at the same time it's hard to believe that's the root of the problem since if we just move it outside of that parent element it DOES work...
Any help untangling this mess would be super great. :) Thanks everyone.
|
5b0faf51315dec5c722d0cabfa1ee268b5184e9ff36753b3ea7f4c098e6b945e | ['274bbb1382ac414597495d83d537dc13'] | You cannot replace the system Python with anything else. You will break almost everything and render your system inoperable.
Rather, you should use Software Collections to install Python 3.x: https://docs.oracle.com/cd/E37670_01/E59096/html/index.html
Python 3.6 isn't available, but I see Python 3.3, 3.4 and 3.5 so hopefully one of those is sufficient.
| f3564e16ef6909e129044a40f3098cfdbbe8a4ef1ccfd12366df728465e2bc5d | ['274bbb1382ac414597495d83d537dc13'] | Oracle Linux uses the system-installed version of Python for almost all of its command-line utilities, so changing that could irreparably damage your system.
Instead of replacing the default Python install, you should strongly consider using Python 2.7 from Software Collections instead.
Using Software Collections means that the install of Python 2.7 is separated from the system install, so you don't run the risk of damaging your system. You can then make it available to your applications via the scl tool.
|
55d3b75c45de5247728378e7beadf72417ab8fbd0588597c5fb1a12e87d1fc04 | ['276368930bf242289fe79d5d4ddd7b32'] | I start working with CoreBluetooth for a week, but I dont know how to reconnect to the peripheral after losing connection.
For example, my CBCentralManager connect to peripheral A, the real manager on iPhone said 'Connected', then I go away for awhile, the CBCentralManager lost connection to the peripheral A, the real manager on iPhone said 'Not Connected'. Then I go back, the CBCentralManager doesn't reconnect to peripheral A, but the real manager on iPhone said 'Connected'.
How can I make my CBCentralManager reconnect automatically?
Sorry for my bad English.
| 903e1be52e2230b3480113e08f6ba7f6b4d730a1d1157eaf2dd965cdbe761655 | ['276368930bf242289fe79d5d4ddd7b32'] | Try this, it worked for me
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if (tableView == tableView1) {
let cell = self.tableView1.dequeueReusableCellWithIdentifier("cell1", forIndexPath: indexPath) as! gamesCustomCell
cell.date.text = dates[indexPath.row]
cell.time.text = times[indexPath.row]
cell.teamOne.text = teamsOne[indexPath.row]
cell.teamTwo.text = teamsTwo[indexPath.row]
cell.field.text = fields[indexPath.row]
return cell
} else if (tableView == tableView2) {
let cell = self.tableView2.dequeueReusableCellWithIdentifier("cell2", forIndexPath: indexPath) as! womensGamesCustomCell
cell.womensDate.text = womensDates[indexPath.row]
cell.womensTime.text = womensTimes[indexPath.row]
cell.womensTeamOne.text = womensTeamsOne[indexPath.row]
cell.womensTeamTwo.text = womensTeamsTwo[indexPath.row]
return cell
}
return UITableViewCell()
}
|
26ce1105cb7839e85db3eafc9ca713bc6323a074b071ad69551b309a8e501c20 | ['27687271ad4d4188809a62908ebc2ad9'] | I am new to JSON and I am learning using the json.simple library. I can't figure out how to access the values in the nested objects or arrays. Here is a piece of the JSON file that I am working with:
{
metrics: {
steps: {
min: 0,
max: 140,
sum: 1161,
summary: {
max_steps_per_minute: null,
min_steps_per_minute: null
},
values: [
0,
0,
0,
0,
0,
13,
0,
0,
0,
| a8d35c7138ba614295d26e6ccfffd959d9690bc7927915a4abdc758fb1b17704 | ['27687271ad4d4188809a62908ebc2ad9'] | Im building a custom logger using Winston in Sails. I would like to set a log level variable in all of my various environment configs and reference that variable in the log.js file. This seems to work in my controllers with a reference of sails.config.variableName but the same reference in log.js throws: Details:ReferenceError: sails is not defined Can someone tell me how to reference this variable from the config? Is there some sort of require statement that I can add?
I would rather not set the level with some sort of switch/conditional that references the env variable used to start up the application in the log.js (ie. process.env.myEnvironment)
|
6b2b36ec96243c31279a0eb09104916143bb95f5a6f200d3aea0c11fe1bff8ee | ['277e971ec3294946a1b85e3cdc5c0a55'] | How do I clear/remove query string parameters, which my MVC action, doesn't require/support?
For instance, my action requires, say an id and a bool flag, so the url would be something like: http://localhost:someport/controller/action/?id=1&remove=true
But, if a user types in something like, http://localhost:someport/controller/action/?id=1&remove=true&some-junk-param=0
Then, I want the some-junk-param to be removed and not shown in the address bar, when the request is processed.
Any thoughts?
| 0439d4e7e60effdd865ab923b9b25d4302b3d4119a295913f0755f2cbae5bf1e | ['277e971ec3294946a1b85e3cdc5c0a55'] | In my case, I was able to solve it by running it as an Administrator!
Don't know why, couple of days back it was working fine, suddenly it started to freeze when trying to debub web app!
Hope it helps someone!
BTW: I am running VS2013 Ultimate, with Update 4
|
1d295f504dfb1fc4c6bd27cc46b11456de4aa7e0f2a427bad9f6154f7dd282c2 | ['27a06941b1534618afd2841e10d759fb'] | I might not be able to post complete code as its too big and convulated. But I can give you the gist of the issue
In js controller logic, I need to access this id attribute to fetch data from apex controller.
Button url is something like
/c/mycomp.cmp?id=a00N000000G8bvEIAR
The issue is that I am unable to access this id in js controller of lightning component | f18c9c1a2b21feaf709fd0f919b8db3675f26eb12ca95e2ec7900ecdd87380ad | ['27a06941b1534618afd2841e10d759fb'] | No, sorry. Gases by definition are miscible. There are no gases which (in the absence of a gravitational (or possibly electric) gradient will separate. On Earth the gravity is insufficient to even get CO2 to concentrate below the O2 and N2 (molecular wts 44, 32, 28 respectively).
Also, your desire for a gas which is a source of energy but is "safe" is another oxymoron. If it can be readily converted to another state and provide energy, it is quite unlikely to be "safe". Are you able to give a counter-example? (Keep in mind that wood, as saw dust, is quite explosive).
Two gases come to mind which are dense and fairly inert SF6 and NF3. Both are big time greenhouse gases but not too toxic, iirc. You might be able to get some energy from them, I'm not sure what the reactions would be, possibly by reacting them with water...just a speculation.
|
529d09b0daf5857d8b4d04daf2211dbb1caa8594851d3bd1600566983c6a7b8f | ['27a416154d4842f1886262f5edf4095c'] | In the <PERSON> disc model, a version of the isoperimetric inequality states that $L(\partial(A))>c\mu(A),$ where $\mu$ is the hyperbolic area and $L(\gamma)=\int_0^1 \frac{|\gamma'(t)|}{1-|\gamma(t)|^2},$ for a curve $\{\gamma(t)\}_{t=0}^1$ and for some positive constant $c$.
Is there an elementary proof of this result, and what is the best constant possible here? I guess for a fixed area the set which minimizes the size of the boundary is the disc of that given area, we can check that the constant here would be $1$.
Furthermore, if we restrict our class of sets $A$ to large sets (say, those sets $A$ which contain a ball $B(z, r)$ for some $z\in A$ and large $r$), can we make the constant c in the inequality as large as we want by taking $r$ large?
Any help or references would be greatly appreciated!
| 7f1df5f85842428554a8386d61f7205716cddaa85a4d3c6d7536cd5d76e5d479 | ['27a416154d4842f1886262f5edf4095c'] | Во мне накопилось немного информации о возможных способах шаблонизации, но я так и не сумел найти ничего, где понятно объяснялось бы что и в каких случаях лучше использовать. Поэтому я решил выписать немного плюсов и минусов каждого типа так, как я их понимаю, и обсудить их с вами... потому что обсудить это мне с кем-нибудь нужно :)
1. Клиентская шаблонизация с json rest api
Достаем из базы данные => отдаем их на клиент в json/xml => разбираем данные на клиенте, создавая объекты по клиентским моделям => добавляем каждую полученную модель в DOM.
плюсы:
пользователь ждет только нужные ему данные
в процессе загрузки данных можем показать красивый прелоадер
минусы:
дублируем модели
лишний раз напрягаем клиентский браузер шаблонизацией
2. Тоже rest api, только шаблонизация, в целом, серверная
Достаем из базы данные => создаем из них html код => отдаем на клиент html => на клиенте просто пихаем полученный html в DOM не думая.
Этот способ мне кажется самым практичным, но о нем почему-то практически не пишут. Я просто что-то не то читаю, или есть серьезные недостатки, которых я просто не вижу?
плюсы:
первых два из пункта выше
не дублируем модели
минусы:
выглядит так, будто их нет
3. Классическая серверная шаблонизация... только сервер
Выбираем данные из базы => на сервере это все дело делаем в html, но не кусочек страницы, а всю страницу целиком => отдаем на клиент заново всю страницу.
плюсы:
не дублируем модели
минусы:
перерисовываем все то, что у пользователя уже было и все вытекающие по типу отсутствия прелоадеров, пустой белой страницы и так далее
Вопросы
Какие еще есть вариации?
Кто что использует в своих проектах (личных, рабочих, как делают крупные компании...)?
Почему?
Какие плюсы и минусы я пропустил/не понял?
В каком случае что использовать лучше?
|
950d88eb3f77c09d2e1dd12f682adc2af961adf1265585c472951f0a31eb6a7b | ['27cf2d4420be42e888a13a367e8eca43'] | When running the android emulator, I always get the following error message before the emulator process is killed.
PANIC: .//android/sockets.c:1002:int socket_recvfrom(int, void *, int, SockAddress *):
System call looped around EINTR 100 times: recvfrom(fd,buf,len,0,sa.sa,&salen)
I am using Android SDK / AVD Manager on Mac OSX10.10 (64 bit) and Java version 1.7.0_65.
Does anyone know what this means, why this happens, and how it can be alleviated?
Any help would be greatly appreciated.
| 40faaaad5cfdfdf8a79dc8c99ccb11f0b2ab7888dbb8b859e615b27de7252c8d | ['27cf2d4420be42e888a13a367e8eca43'] | The error message appears because adb cannot connect to the device although it is running. This is not supposed to happen, but it does from time to time.
You can always check if adb can see the emulator by running adb devices, which should result in a list of devices it can see. If this list is empty, the device is not found. You can resolve this by adb kill-server, waiting a couple of seconds and then running adb start-server. Try running adb devices again, and the device should be listed, and the installation should succeed.
Starting an emulator can be done by running emulator @<device-name> [options]. The device name can be found by running android list avd. This will result in a list of devices of which the <device-name> will also be listed.
|
595eace4b54c134c974230ac950f96e235604ba4e502c250fc41154ecc42bda3 | ['27d2087594fa41a5a29967dfdb2b656c'] | I'm fairly new to varnish, so hopefully someone might be able to help me out!
Currently I've got 2 load-balanced linux VMs hosted on Windows Azure. They are load-balanced using Azure's own load-balancer for traffic on port 80 using a round robin strategy.
What I would like to do is add Varnish into the mix - however I don't know the best way to fit it into my architecture...
PLAN A
Linux VM 1
Varnish (VM) --> Azure Load Balancing ------>
Linux VM 2
Varnish sits in front of the load balanced VMs. I think this would do what I would like by caching before going to the back-end....but there's a single point of failure, being varnish. If varnish goes down, then this won't work.
PLAN B
Varnish (VM) ---------> Linux VM 1
Azure Load Balancing ------>
Varnish (VM) ---------> Linux VM 2
Varnish is now load balanced which helps eliminate a single point of failure, but now I have 2 cache VM's which will cost more to host. Also I now have to manage the cache across two different servers.
PLAN C
Linux VM 1
Varnish (VM) ------>
Linux VM 2
Get rid of Azure load balancing altogether and use Varnish as a load-balancer in its own right. This would give me more control over load balancing, however (again) - single point of failure.
For any of the experts out there, what from your experience is the best way forward?
| a9c03505da9b9797f052282a9e30af005bfd22c848921baeaf715a1c87a2189b | ['27d2087594fa41a5a29967dfdb2b656c'] | We are being asked whether it's possible to have the administration of Drupal completely removed if a site is hosted on a production environment, but have it available on a pre-production environment that would put content / modules to the same production DB.
My initial thoughts are - no.
As I understand it, the administration system IS drupal. The best solution we could recommend is to
Disable the admin menu and overlay on the production servers
Use .htaccess files on the production servers to deny any requests to Drupal's admin paths e.g. /user /users /admin
On the pre-production server, use .htaccess files again to restrict access by IP address.
Setup appropriate user accounts and roles in drupal.
Is there something really obvious I'm missing, or can anyone suggest alternative solutions to the problem?
|
41368fa7babf21d0ef85280df02a3c678d0cf43bf0e51c3d2306a9caf0e2479b | ['27e4c4f5cb2f4bc1bfa4882fb73c5fa5'] | You can switch back to HTML by clicking on the word "Nunjucks" in VS Code's status bar. This "Language Indicator" is near the bottom-right of VS Code's window. Clicking it will display a "Select Language Mode" drop-down-list where you can select "HTML".
After that, things that normally work for HTML files (like Format Document) will work again; however, things like the special syntax highlighting applied to Nunjuck files will not, but you can switch back and forth as needed.
Here's VS Code's documentation for Changing the language for the selected file.
| 3352b1d4050da0729b95c93d7f9789f7d89b7ef25580355c4a2edb3f5f0e7d90 | ['27e4c4f5cb2f4bc1bfa4882fb73c5fa5'] | If you have Linux on the same system, you could boot into Linux, ensure the Windows partition is mounted (for instance here it's in /mnt/C) and then do strings /mnt/C/Windows/System32/ntoskrnl.exe 2>/dev/null | grep amd64. For me in printed 9600.18258.amd64fre.winblue_ltsb.<PHONE_NUMBER>, and googling for winblue indicates that this was the code name for Windows 8.1.
|
7e1dd11c9dbc4927992c991da1a782a63d5b858f55c1f876acbff54e25b0266a | ['27edf187c2c7492696bb6987f46da914'] | No, they were not the same.
The fusion pistol has two levels of power: minor (uncharged), and; major (charged). The S'pht compilers (both major and minor) had one level of damage (even though it doesn't feel like that).
Looking at the source code (available at Marathon Infinity source code), in particular projectile_definitions.h:
For the fusion pistol
Minor
{ /* _projectile_fusion_minor */
_collection_rocket, 11, /* collection number, shape number */
_effect_minor_fusion_detonation, _small_media_detonation_effect, /* detonation effect, media_detonation_effect */
NONE, 0, NONE, /* contrail effect, ticks between contrails, maximum contrails */
_projectile_minor_fusion_dispersal, /* media projectile promotion */
WORLD_ONE/20, /* radius */
0, /* area-of-effect */
{_damage_fusion_bolt, 0, 30, 10}, /* damage */
Major
{ /* _projectile_fusion_major */
_collection_rocket, 12, /* collection number, shape number */
_effect_major_fusion_detonation, _medium_media_detonation_effect, /* detonation effect, media_detonation_effect */
_effect_major_fusion_contrail, 0, NONE, /* contrail effect, ticks between contrails, maximum contrails */
_projectile_major_fusion_dispersal, /* media projectile promotion */
WORLD_ONE/10, /* radius */
0, /* area-of-effect */
{_damage_fusion_bolt, 0, 80, 20}, /* damage */
For the Compilers
Minor
{ /* _projectile_compiler_bolt_minor */
BUILD_COLLECTION(_collection_compiler, 0), 4, /* collection number, shape number */
_effect_compiler_bolt_minor_detonation, _small_media_detonation_effect, /* detonation effect, media_detonation_effect */
NONE, 0, 0, /* contrail effect, ticks between contrails, maximum contrails */
NONE, /* media projectile promotion */
0, /* radius */
0, /* area-of-effect */
{_damage_compiler_bolt, _alien_damage, 40, 10}, /* damage */
Major
{ /* _projectile_compiler_bolt_major */
BUILD_COLLECTION(_collection_compiler, 1), 4, /* collection number, shape number */
_effect_compiler_bolt_major_detonation, _small_media_detonation_effect, /* detonation effect, media_detonation_effect */
_effect_compiler_bolt_major_contrail, 0, NONE, /* contrail effect, ticks between contrails, maximum contrails */
NONE, /* media projectile promotion */
0, /* radius */
0, /* area-of-effect */
{_damage_compiler_bolt, _alien_damage, 40, 10}, /* damage */
In summary, the damage inflicted by each weapon is:
Fusion Pistol
Minor: 30
Major: 80
Compilers
Minor: 40
Major: 40
| bf912863ab6e99567cdfa5ec981a69b79498de0046f60c9ce3149c043da2b306 | ['27edf187c2c7492696bb6987f46da914'] | $$r = 2\theta^2, 0<=\theta <=\sqrt{5}$$
calc the length of the curve.
Since it's probably polar coordinats the formulat should be:
$$\int_0^\sqrt{5} \sqrt{(r(\theta))^2+(r'(\theta))^2} d\theta = \int_0^\sqrt{5} \sqrt{(2\theta^2)^2+(4\theta)^2} d\theta $$. Wolfram alpha gives the anser 18 for this but the correct answer should be $\frac{38}{3}$ so I suppose my approach is wrong. What's the error?
|
d6de80efc801dcecd67132f032bb440c4241e58ed235d4bd070c88b9e2f2e3da | ['27f5cd6df3e841428af03d86ab751694'] | [continued from previous comment] I have package=udev installed, have dirs={/etc/udev/rules.d/ , /lib/udev/} pre-populated, and have executable=udevadm in $PATH. I'd like to know (1) in what Debian release did you make this work? (I'm assuming wheezy) (2) what Debian packages do you have installed besides `udev`? | 33a0d3189fc2c91e9de7e6e0086596a89751d5ee98e4c3caef76a4a34a817a13 | ['27f5cd6df3e841428af03d86ab751694'] | The answer is, don't use a pager :-) This may not be what you want, since it doesn't set a pager, but the following works for me (in bash, in a fresh terminal), with values set accordingly (you can of course one-line this):
INODE='01234567' # replace with valid inode# for some file
DEVICE='/dev/whatever' # replace with valid device for that inode
# your distro might not require `sudo`, mine does
sudo debugfs -R 'stat <'"${INODE}"'>' "${DEVICE}" 2>/dev/null | tee
I get sudo-prompted, then the data writes to stdout normally, as if unpaged--particularly, the screen does not get cleared. This is what I want; YMMV, HTH.
|
84f54e6df9839199335e097952a02476d70f3cc116b691b9361fb9e2bba27203 | ['27fa6a3c1ad946e6871a8fe68048f174'] | Python Wrapper for SugarCRM REST API v10
https://github.com/Feverup/pysugarcrm
Quickstart
pip install pysugarcrm
from pysugarcrm import SugarCRM
api = SugarCRM('https://yourdomain.sugaropencloud.e', 'youruser', 'yourpassword')
# Return info about current user
api.me
# A more complex query requesting employees
api.get('/Employees', query_params={'max_num': 2, 'offset': 2, 'fields': 'user_name,email'})
{'next_offset': 4,
'records': [{'_acl': {'fields': {}},
'_module': 'Employees',
'date_modified': '2015-09-09T13:40:32+02:00',
'email': [{'email_address': '<EMAIL_ADDRESS>',
'invalid_email': False,
'opt_out': False,
'primary_address': True,
'reply_to_address': False}],
'id': '12364218-7d79-80e0-4f6d-35ed99a8419d',
'user_name': 'john.doe'},
{'_acl': {'fields': {}},
'_module': 'Employees',
'date_modified': '2015-09-09T13:39:54+02:00',
'email': [{'email_address': '<EMAIL_ADDRESS>',
'invalid_email': False,
'opt_out': False,
'primary_address': True,
'reply_to_address': False}],
'id': 'a0e117c0-9e46-aebf-f71a-55ed9a2b4731',
'user_name': 'alice'}]}
# Generate a Lead
api.post('/Leads', json={'first_name': 'John', 'last_name': 'Smith', 'business_name_c': 'Test John', 'contact_email_c': '<EMAIL_ADDRESS>'})
from pysugarcrm import sugar_api
with sugar_api('http://testserver.com/', "admin", "12345") as api:
data = api.get('/Employees', query_params={'max_num': 2, 'offset': 2, 'fields': 'user_name,email'})
api.post('/Leads', json={'first_name': 'John', 'last_name': 'Smith', 'business_name_c': 'Test John', 'contact_email_c': '<EMAIL_ADDRESS><PERSON>', 'last_name': '<PERSON>', 'business_name_c': 'Test <PERSON>', 'contact_email_c': 'john@smith.com'})
from pysugarcrm import sugar_api
with sugar_api('http://testserver.com/', "admin", "12345") as api:
data = api.get('/Employees', query_params={'max_num': 2, 'offset': 2, 'fields': 'user_name,email'})
api.post('/Leads', json={'first_name': '<PERSON>', 'last_name': '<PERSON>', 'business_name_c': 'Test <PERSON>', 'contact_email_c': 'john@smith.com'})
# Once we exit the context manager the sugar connection is closed and the user is logged out
| 781d05b6d6c69b84557823637368b7efab8296056094b6a7a31249cb51071cf9 | ['27fa6a3c1ad946e6871a8fe68048f174'] | Python 3.6+:
pip install PyPDF2
# -*- coding: utf-8 -*-
from collections import OrderedDict
from PyPDF2 import PdfFileWriter, PdfFileReader
def _getFields(obj, tree=None, retval=None, fileobj=None):
"""
Extracts field data if this PDF contains interactive form fields.
The *tree* and *retval* parameters are for recursive use.
:param fileobj: A file object (usually a text file) to write
a report to on all interactive form fields found.
:return: A dictionary where each key is a field name, and each
value is a :class:`Field<PyPDF2.generic.Field>` object. By
default, the mapping name is used for keys.
:rtype: dict, or ``None`` if form data could not be located.
"""
fieldAttributes = {'/FT': 'Field Type', '/Parent': 'Parent', '/T': 'Field Name', '/TU': 'Alternate Field Name',
'/TM': 'Mapping Name', '/Ff': 'Field Flags', '/V': 'Value', '/DV': 'Default Value'}
if retval is None:
retval = OrderedDict()
catalog = obj.trailer["/Root"]
# get the AcroForm tree
if "/AcroForm" in catalog:
tree = catalog["/AcroForm"]
else:
return None
if tree is None:
return retval
obj._checkKids(tree, retval, fileobj)
for attr in fieldAttributes:
if attr in tree:
# Tree is a field
obj._buildField(tree, retval, fileobj, fieldAttributes)
break
if "/Fields" in tree:
fields = tree["/Fields"]
for f in fields:
field = f.getObject()
obj._buildField(field, retval, fileobj, fieldAttributes)
return retval
def get_form_fields(infile):
infile = PdfFileReader(open(infile, 'rb'))
fields = _getFields(infile)
return OrderedDict((k, v.get('/V', '')) for k, v in fields.items())
if __name__ == '__main__':
from pprint import pprint
pdf_file_name = 'FormExample.pdf'
pprint(get_form_fields(pdf_file_name))
|
80ce30b84e1812bf90560b5659ff53c68bab9067ba8bd287f1189cb408ed4611 | ['27ff1ad48c5a4c3cbb159eb91b112637'] | I am trying to launch an application named Aura, which uses SQL as its database engine, in a VDI that allows multiple users to connect at the same time.
When the program is first launch, it works fine, but when it is launched by a second user, I receive the following error:
From researching I figured out it must be that the software is trying to use the same port each time, and that is obviously impossible
So I went into SQL Configuration manager > SQL Server Network Configuration > Protocol for My Application > IP Addresses and changed the IPV4 port into 0 (so it chooses a dynamic port every startup).
It does appear to choose a different port every startup, but this port is still shared by all all the users who connect to the system, therefore the problem remains the same.
How can I configure SQL to provide a different port for every user that logs in?
| 4f0056dc5a6d82edd40e3364bad381e98e3222fa5e365992e9dcb10e4743ecfa | ['27ff1ad48c5a4c3cbb159eb91b112637'] | I am working allot with GoogleMeet and never encountered it.
I would suggest you try to reset the browser / try incognito, and if that fails, try another browser.
If all of that doesn't work you could try to share program instead, as a temporary fix until the end of the presentation.
|
a3c8f49a136fba4d099d0e7f059986cbf96df6480faf100c0cf76707835752cd | ['28249585b1634d46ae216c1dc93e8ac5'] | Hello i have an issue because i am new to create facebook application.
I am using javascript sdk to create a basic application just for sending notifications to users.
I have the code bellow.
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
var uid = response.authResponse.userID;
accessToken = response.authResponse.accessToken;
FB.api('/me', function(info) {
$('#welcome').html("Hello there " + info.birthday );
});
} else if (response.status === 'not_authorized') {
//User is logged into Facebook, but not your App
var oauth_url = 'https://www.facebook.com/dialog/oauth/';
oauth_url += '?client_id=xxxxxxxx'; //Your Client ID
oauth_url += '&redirect_uri=' + 'https://apps.facebook.com/xxxxxxx/'; //Send them here if they're not logged in
oauth_url += '&scope=user_about_me,email,user_location,publish_actions,user_birthday,publish_stream';
window.top.location = oauth_url;
} else {
// User is not logged into Facebook at all
window.top.location ='https://www.facebook.com/index.php';
} //response.status
}); //getLoginStatus
}; //fbAsyncInit
When the user is logged in and not authorized is going to authorize window and working.
When the user is logged in and authorized is working.
But when the user is not authorized and NOT LOGGED IN to facebook, the app is redirect me to the page to login the user, but after is not redirect to the app again to check if or not is authorized.
Can someone help me about this? how to do it.
Thank you
| 4ec314aa168cc86e525b9a54906f75963e5f1a01185a54fe3e0a8bc6be3629ee | ['28249585b1634d46ae216c1dc93e8ac5'] | Why you don't use ion auth for security and for session data... I always using that when i want to create a software with login. Also you need to create a table in your db with name session. And go to config and database files in Config folder and put true to the session where it wants for the database. You don't have read well the documentation
|
46a0d1e3cd67b240d22a53889927d4c44f9cd7feed23fd9cf3675566baec197b | ['283a1a35eb14419facf838942208ed5c'] | I have the following questionnaire controller with the some functions, i am facing problem in the show function where the data is not being passed to the show view, although it is being saved in my database
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use \App\Questionnaire;
class QuestionnaireController extends Controller
{
//
public function create() {
return view('questionnaires.create');
}
public function store( ) {
$data = request()->validate([
'title' => 'required',
'purpose' => 'required',
]);
$data['user_id'] = auth()->user()->id;
$questionnaire = \App\Questionnaire<IP_ADDRESS>create($data);
return redirect('/questionnaires/'.$questionnaire->id);
}
public function show(\App\Questionnaire $questionnaire) {
return view('questionnaires.show', compact('questionnaire'));
}
}
The following is the show view
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{$questionnaire->title}}</div>
</div>
</div>
</div>
</div>
</div>
@endsection
| 99c9e08f4257c728698849cf0b9d0222612a7278f0e40b665a443d652a56df35 | ['283a1a35eb14419facf838942208ed5c'] | I want to make a website which will serve as news aggregator site. This will be my learning project but I don't know from where to start. Should I build the front end first, or the back end first. Further I will need a database to store the jobs. Should I design my database schema before everything else. A guidance in this regard will be appreciated. For technology I will use bootstrap, laravel and mysql
|
99898c74462068905302180615aee84c83e52755a93613498d5657f987d52ed3 | ['2843afe361d84f0c90e0554696f3be68'] | On some of Android devices, there is a bar at the bottom of the desktop that hosts frequently used app icons.
What is the common name for this bar?
Here's the problem.
We are working on a live wallpaper for Android.
The bar covers the essential part of the wallpaper - the bottom part where the ground is on the pictures, see the screen-shots below.
Is there any way to find the height of the bar with Andorid API?
That way we could lift up the bottom of the wallpaper avoiding the overlapping by the bar.
| 013a7bb9cfb9da7b3aefd73a57bed4b7ed15eabcb96506489ac0c1e79482c6a6 | ['2843afe361d84f0c90e0554696f3be68'] | There is a clock widget in our app.
The widget needs to be updated every minute to display the time right.
In Android O, it is advised to use JobScheduler for background updates.
Unfortunately, there are limitations.
The periodic updates of JobService can not be called in less than 15 minutes intervals.
The moment JobService.onStartJob() is unpredictable. We may miss the exact moment to update the minute digit (59th second).
Prior O we used to run a background service with Handler.postDelayed() to update the time in the widget.
In O the background service can be terminated by the system.
How would you recommend to implement a clock widget in Android O?
Is this even possible now?
|
934ece4598275cfef1ae2f048fe58976b98e29742916fa5ac2a89929fb0b1fda | ['2854c27468304cb4b5746a23eedadeab'] | @Relaxed I was merely commenting based on stories in the media about banks in my country, where banks make similar promises regarding fraudulent transactions, but when people then need to rely on such protections, the banks are rather unwilling to adhere to their side of the bargain (this is understandable to a certain extent, as they do need to be sure that their customer is not trying to defraud the bank, but I think I would prefer to avoid any risk from contactless payments by simply not having the ability to make them on my card). | b1251efaf4e339142b171001c902cfaf6f856d65dbee6db1961d14f8b6fa49b7 | ['2854c27468304cb4b5746a23eedadeab'] | Let us solve this problem by considering the free energy $F$ of the whole system in thermal equilibrium (temperature and particle number constant, so $d F = - p \; dV$). In fact the type of system does not matter as far as we are considering a bubble of some gaseous or liquid substance inside another substance (can be the same one). Let us for now just look at the case of an air bubble (label $a$) with a spherical surface ($s$) in water (liquid $l$).
The total free energy (differential) of the system is $$dF = dF_a + dF_l + dF_s.$$
The individual free energies of air and liquid are $dF_a = -p_a\; dV$ ($V = V_a$) and $dF_l = -p_l\; dV_l = p_l\; dV$ since an increase in volume of the liquid is equivalent to the decrease in volume of the air. The free energy of the surface can be described as $dF = \Gamma dA$ where $\Gamma$ is the surface tension and $A$ is the surface area of the bubble. Inserting this into the equation above gives
$$0 = -p_a dV + p_l dV + \Gamma dA \qquad \text{or} \qquad p_a = p_l + \frac{dA}{dV} \Gamma.$$
Assuming a spherical geometry of the bubble we can write $dA/dV = 4 \pi \; d(r^2)/(4\pi \; d(r^3)/3) = 3 \times 1/(3 r^2) \times d(r^2)/dr = 2/r$ and
$$p_a = p_l + \frac{2}{r} \Gamma.$$
The calculation is equivalent for different combinations of substance (air bubble in air (soap), water droplet in air, air bubble in water).
|
3dbce46764cbfc3ccf1170ff73158a0d70dcd7e45762c0b1f385cc4779e0303d | ['2863493c759e45b09e5a8a8e7e298972'] | Let's imagine an electromagnetic wave that points every direction (i.e., from $\theta = 0$ to $\theta = 2\pi$). For simplicity let's consider only the electric field vectors. The wave goes through a polariser. Setting $\theta$ to be the angle from the vertical line (parallel to the polarising direction) the magnitude of the component of the electric field vector will be $E_0 \cos \theta$. Let's think about the superposition of these infinitely many waves with same amplitude. Then the sum will be
$$\sum E_0 \cos \theta \Rightarrow \lim_{N \rightarrow \infty} \sum_{k=1}^N E_0 \cos \theta_k, \ (\theta_k = \frac{k \times 2\pi}{N})$$
which from the graph of $\cos \theta$ from $0$ to $2\pi$ (symmetry) we can deduce that the value will be equal to $0$.
So the resultant component of the electromagnetic wave is zero, and how can we even talk about things like intensity (which becomes $I_0/2$ after moving through the polariser).
This actually leads me to a more fundamental question which is: if the electromagnetic wave directs towards every direction throughout $0\leq \theta<2\pi$ and their amplitudes are all same, then shouldn't the electromagnetic wave always undergo destructive interference with each other, resulting in no light at all?
This logic contradicts our observations of natural phenomena, so maybe I have a misconception. Could anybody clarify?
| 95cbf24d362fd2acec0b71a725925c1fa140ec95d6e9c4550d3c85e19c400879 | ['2863493c759e45b09e5a8a8e7e298972'] | Let's say that a three dimensional object with continuous mass distribution is undergoing rotational motion about an axis that lies on the centre of mass. The translational velocity of the centre of mass is $\vec{0}$.
I understand that the angular momentum is not zero because the direction of the $\vec{r} \times d\vec{p}$ vector is same for all points of the object so they add up to form the total angular momentum.
However I failed to derive quantitively that the linear momentum of the object is equal to $\vec{0}$. I tried to use symmetry or geometry in calculating the integral $$\vec{p} = \int dm \ \vec{v}$$ but for a random continuous mass distribution, with non-constant density $\rho(\vec{r})$, it wasn't easy.
Is there any good mathematical justification that clearly shows the above quantity is zero? (For example, I have seen the reasoning that it is a time derivative of the coordinates of COM relative to the COM so it should be zero but that heavily relies on physical intuition.)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.