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 |
|---|---|---|---|---|---|
3d08a99be2ed4203617676e3f3b145aed7a41308849dd7b030ede01b3eeb31c6 | ['6158eadeb24c4e4db043949df76ca1c5'] | I'm looking to appends a character to a textarea in. I have a simple GUI designed to look like like a mobile phone and I want to be able to click on one of the buttons and update the textarea with that character. If I click another button, I want to be able to append that character to the first. How do I do this? Obviously right now it is just setting the character for that button in the textarea and will be replaced when another button is clicked.
public void actionPerformed(ActionEvent e) {
String source = e.getActionCommand();
if (source.equals("1")) {
TextArea.setText("1");
} else if (source.equals("2abc")) {
TextArea.setText("a");
} else if (source.equals("3def")) {
TextArea.setText("e");
} else if (source.equals("4ghi")) {
TextArea.setText("i");
} else if (source.equals("5jkl")) {
TextArea.setText("k");
} else if (source.equals("6mno")) {
TextArea.setText("o");
} else if (source.equals("7pqrs")) {
TextArea.setText("s");
} else if (source.equals("8tuv")) {
TextArea.setText("t");
} else if (source.equals("9wxyz")) {
TextArea.setText("x");
}
| b07b9a124ffdb4aec5628a924458d044313210ffc9b30766e94949fd924dece4 | ['6158eadeb24c4e4db043949df76ca1c5'] | I'm wondering if someone has a script to zip all the files in a folder and it's sub-folders while maintaining the original filenames? So basically for every file within the folder, I would want a corresponding zip file created. I've never used VBScript before so I'm not sure how this can be done and would take a me quite a while to figure it out. I would then remove all instances of the original files.
|
568906344d3e652af4cb8341a8bef6169e6035620772cce312eae27a79cdd7ab | ['615bc81b07d44d2aa699cba8e1b6fcdb'] | The problem is, The columns that are required for group by need to be in the end. Below the modified query, It should work now.
select
case
when status in ( 'fail','detained') then 'FAILED'
when status in ( 'absent') then 'absent'
when status in ( 'pass') then 'PASSED'
else null
end as Final_Status,course,dept
from college
group by course,dept;
| e28608b8daf4fc6aaa14efc734ca28496b6529b84adba5a3dff6c7596972c541 | ['615bc81b07d44d2aa699cba8e1b6fcdb'] | This seems to be because you don't have HDFS. If you have HDFS when a worker node takes the task, the files are available to them. because you dont have HDFS, when the task is passed over to Worker nodes, they dont see the location where they are supposed to read the data from.
I would say you should use HDFS or have NFS mount so that all nodes have access to the same files regardless of where the worker node is.
I hope this helps.
|
2a3bcf63c7d37205a812688e4a710d525fd3359f0e1fe38e06150f0044042692 | ['618b0e3c92024327aa79b77e5362dd57'] | I just got into PIC-programming on Microchips MPLAB X IDE. My programm requires two timers. TMR4 has an interrupt interval of 500ms and TMR2 interrupts every second. When starting the program, the two timers are synced up, so within a small margin of error, when the TMR4 interrupts for the second time, TMR2 also executes the interrupt code. But when I stop TMR2 for a period of time and then start it again, the two timers are completely out of Sync.
Is there a way to resynchronize the two timers or to restart them?
| 70ea84cfa6bfe32df2e218cf68e39a1ff533909094a08e773fc50978946fc59b | ['618b0e3c92024327aa79b77e5362dd57'] | While converting PNG-Files into numpy arrays I noticed that the conversion sometimes resulted in different array shapes. While the first image has a three dimensional array shape (as most images do) the second one has two dimensions. The images are both screenshots and have not been altered. Unfortunately the array shape really matters for my intended use.
I used the code below for the image conversion.
import numpy as np
import PIL.Image
img_path = '' # Put the image path here
img_pil = PIL.Image.open(img_path)
img_array = np.asarray(img_pil)
print(img_array.shape)
My question is whether there is a way to align the shapes of the images.
|
7d717e8927a63721632191b7a3d62dc0d8ad2edaca9b438272a1beef21afce49 | ['61aa74c6fb0748e2b7b80061f2fa759f'] | i'm trying ormlite. i'm finding that when i insert an object with a DateTime property, it is getting -8:00 (my timezone is +8) applied by ormlite. It should be inserted with literally what the time is. in my case it is already UTC.
however reading the values out of ormlite, the +8 is not getting re-applied.
is this a known bug?
thanks
| 210d71e65424d5343716fa8c6be9f6825556fef150aa4ec79fa402a2ed1d2c13 | ['61aa74c6fb0748e2b7b80061f2fa759f'] | i was diagnosing an issue where i had json or jsv objects being received in web form or query variables and was getting an Index was outside the bounds of the array exception being thrown by servicestack. This is a rest client in another product sending this to my servicestack rest services.
I narrowed it down to de-serializing a form variable with an empty string as the value instead of json.
this is a simple test case that does the same thing. I would have expected null being returned?
v3.9.26 servicestack.text
`
class simpleDTO {
public string FirstName { get; set; }
public string LastName { get; set; }
}
[TestMethod]
public void TestMethod1()
{
var json = "";
var o = JsonSerializer.DeserializeFromString(json, typeof(simpleDTO));
Assert.IsNull(o);
}`
|
dc834b63deffff39aefebdaa77c7ac7c309609d5f1fed40d5aeebd5cb18d64ad | ['61bd2a7d038642768325c6a9dc78ab92'] | hello, i have updated the image above to make it clear,actually in this above image --->
Things Done
1. the inputPath_image.jpg is the background image that i have set as shown in above output.
2.showwaves is done with this above query showwaves=s=1280x175:colors=Yellow:mode=line:draw=full ,
Things i want to add in this command...
1. i want watermark at the bottom right in this command.. so what should i add in command (additional) to achieve this logo at the bottom. | 5e31e9b9ff8ef0768486fe7ff03a4a00cedb09cdd9b8ee462333d3cad9b7362b | ['61bd2a7d038642768325c6a9dc78ab92'] | firstly the difference is that in earlier question its about the logo(watermark) to be placed with the 'showwaves' function and a background image as labled as 'inputPath_image.jpg' and mp3 file as seen there are three inputs and the fourth is watermark.
And in this question is its totally different ,it only has one input that is mp3 file and watermark with the 'showspectrum' function.
And it seems that you are not getting my point. i am here for asking help in my project and you are not helping at all. these websites are made to share problems and getting solved. not to increase problems |
8ebe0d7d767c0d86b9e5d51f46764c79c4944ef57444acf92bcc829929cd7aea | ['61c415959fc949948db0ef5a5e9881b2'] | <PERSON>,
I'm developing the application using .net 2008 and Oracle 10g as database. I have deployed the application in IIS, now when two users get logged into the same applicaion, same page at a time getting error as
"*Connection must be open for this operation.Cannot access a disposed object.object name: 'Oracle.DataAccess.Client.OralceConnection'.Connection must be open for this operation"*
Plz give a solution to solve this multiuser issue..
Thanks in Advance!!!!
| 508b1bcf1970234c0f8e15ac01e2ddab45663ae697b4182783c2b7e0ed497f34 | ['61c415959fc949948db0ef5a5e9881b2'] | The problem described is occurring because word automatically updates the caption field codes before printing/saving. When this happens, the numbers that are assigned to each caption are sequentially assigned; ie: 1, 2, 3, 4... etc. This happens even if you manually assign them to 1, 2a, 2b, 3... In this case, when you hit "print", you'll end up with 1, 2a, 3b, 4... and so on.
As a workaround you can restart the numbering by toggling field codes, inserting a "\r Number you want to restart from", and then updating the field. You should no longer experience the problem you were having.
This workaround is explained in greater detail in this Microsoft Knowledgebase here:
https://support.microsoft.com/en-us/kb/145508
|
c091f52ce47b12018e583613961640fb2910f2ee4a2ac83246c028deb6288449 | ['61cc21b1aeed45eb9e80725ab7b46a65'] | I have a list points and their values that cover an area like so:
#x, y, value
list = [
(1.123, 1.232, 15),
(1.121, 2.323, 12),
(1.124, 3.451, 17),
(1.120, 4.593, 06),
(1.121, 5.638, 09),
(2.123, 1.232, 19),
(2.121, 2.323, 72),
(2.124, 3.451, 13),
(2.120, 4.593, 99),
(2.121, 5.638, 04), and so on...]
I want to write a function interpolateValueAtCoordinate(x, y) that gives me a good interpolation of a value at the specific coordinates.
What could I do?
| e62a72425281fef72f58635c2f047d25fa3ccbeebda5849d815c46da6e6b9f65 | ['61cc21b1aeed45eb9e80725ab7b46a65'] | I have many data-servers I need to download data from via http as soon as it is available. For each server I start a bash "while true"-loop and within that a wget to poll the server for new data. To start all the bashs I created a tmux config starting a window for every loop such loop and wget. This adds the benefit of easier inspecting what is happening.
I want to create a supervisor-service from this config, which would allow me to start, stop, and restart this tmux and its downloading clients all at once.
However, when I quit tmux, by the very nature of tmux, the bashs and their wgets keep running. Is there a way around that, so I can quit everything and restart everything with a simple supvervisorctl tmuxservice restart?
|
c5043a163f5a57c660a5d82d3d3d9f0f47d0039c0cba59f32ac28ea4f4282f0b | ['61cfa6db8d4146498d38f57a89c9ac54'] | I'm trying to fix my Silverstone SST-ST60F-P 600w power supply which has a burnt resistor. It just so happens I have another psu of the same model so I opened it up to look for the value of the burnt resistor since I can't read the values anymore. The problem is it's not like the usual resistor which is color coded. It has numbers printed on it.
The values listed on the resistor are R207 337Y. It does have a silver band which should mean it's tolerance is 10% but I'm not sure.
| 6001c3521b481c6e2e2011a809e229e14d227e194ae43065130eec08c2910ee3 | ['61cfa6db8d4146498d38f57a89c9ac54'] | The PKI has nothing to do with it. The question was about the cipher string length and algorithm. These are associated. As to whether dynamic or static content... there is no difference as all content on the wire from host to client is encrypted via SSL. Some algorithms are faster than others but not relative to the content length. Twice as much content generally takes twice as long. A 128 bit cipher would be faster but not as strong as 256 bit. |
a0abbac764cda68738d728e9f7d492fc8f9f4470f07904f504333c2766af84c7 | ['61df634d09dd4fb5aede974e7f60131d'] | Ok, maybe stackoverflow can help? :)
I'm trying, without any luck, to create a page transition effect with an svg image.
When the user clicks on a link in Page 1, a diamond shaped svg fades in like a portal into Page 2.
The basic idea is to recreate the space travel in the intro of the Alphaville - Forever Young video: https://www.youtube.com/watch?v=t1TcDHrkQYg
:)
Maybe the diamond also fades in from blue to transparent (but that is the next step).
Diamond svg: https://www.onlinewebfonts.com/icon/413
| ed197e1ff2e6ac95a31d56fce59dbec02edba7ed71601b3a0dce04ba80f780cd | ['61df634d09dd4fb5aede974e7f60131d'] | What's the best way (SQL-code or program) to merge multiple databases into one MasterDB with different but similar tables/views and columns?
Just tables and views, not data. Also set relations if there's any.
Example:
DB1 + DB2 + DB3 = MasterDB
User User User User
Id Id Id Id
Name Name Name Name
Address City Email Address
City
Posts Posts Comments Email
Id Id Id
Title Content Title Posts
Id
Title
Content
Comments
Id
Title
|
36d6f0eeca8bd0d998124d81943fd3b393724eecedd213205193de0ff9da5626 | ['61f51c571a1d4c9e803deb688cfc3770'] | There is a Product class. A list of objects of product class is formed and that list is encapsulated within an object of Order class. both the classes are given below.
Product.java
package com.example.gandhjee.pantry_order;
import java.io.Serializable;
public class Product implements Serializable{
private int id;
private String name;
private int amount;
private int final_id;
private int price;
private int price_per_plate;
//private String description;
private static final long serialVersionUID = -5435670920302756945L;
//Constructor
public Product(int final_id,int id, String name, int amount , int price ,int price_per_plate) {
this.id = id;
this.name = name;
this.amount = amount;
this.setName(name);
this.setAmount(amount);
this.setFinal_id(final_id);
this.price_per_plate = price_per_plate;
this.final_id = final_id;
this.price = price;
}
public int getPrice_per_plate(){
return price_per_plate;
}
public int getPrice(){
return price;
}
public void setPrice(int price){
this.price = price;
}
public void setFinal_id(int final_id){
this.final_id=final_id;
}
public int getFinal_id(){
return final_id;
}
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 int getAmount(){
return amount;
}
public void setAmount(int amount){
this.amount = amount;
}
}
Order.java
package com.example.gandhjee.pantry_order;
import java.io.Serializable;
import java.util.List;
public class Order implements Serializable{
private int order_id;
private List<Product> mProductList;
private String emp_name;
private int area_id;
private int emp_id;
private int conf_room_id;
private int type_id;
//private String description;
private static final long serialVersionUID = -5435670920302756945L;
public Order(List<Product> mProductList, int order_id,int emp_id, String emp_name, int type_id , int area_id ,int conf_room_id ){
this.mProductList = mProductList;
this.order_id = order_id;
this.emp_name = emp_name;
this.emp_id = emp_id;
this.setType_id(type_id);
this.setconf_room_id(conf_room_id);
this.setArea_id(area_id);
}
public void setmProductList(List<Product> mProductList){
this.mProductList = mProductList;
}
public Product getmProductList(){
return (Product) mProductList;
}
public int getConf_room_id(){
return conf_room_id;
}
public void setconf_room_id(int conf_room_id){
this.conf_room_id = conf_room_id;
}
public int getArea_id(){
return area_id;
}
public void setArea_id(int area_id){
this.area_id = area_id;
}
public void setType_id(int type_id){
this.type_id=type_id;
}
public int getType_id(){
return type_id;
}
public int getOrder_id(){
return order_id;
}
public String getEmp_name(){
return emp_name;
}
public void setEmp_name(String emp_name){
this.emp_name = emp_name;
}
public int getEmp_id(){
return emp_id;
}
public void setEmp_id(int emp_id){
this.emp_id = emp_id;
}
}
Now I want to send an Object of Order class from my mobile application to a web service in PHP using Volley library. I searched a lot on the internet but there is no example given for sending an Object within an object from a mobile application to a web service. Any help would be appreciated . Thank you in advance!
| 714da9532c8d646523deb7c82294ef82756f7c8aaa5b39ee4f30169b6807afe2 | ['61f51c571a1d4c9e803deb688cfc3770'] | This is the code of my project where in I have a listview of objects 'mProductList'. I have set an onclickListener on each item of list view which will open a menu with three options. Now on edit i want to change the variable amount in my selected item and display it on the screen. I am new at this so please dont downvote this. Any help would be appreciated stackoverflow. Please let me k now if u need any more of my code.
ProductListAdapter adapter = new ProductListAdapter(getApplicationContext(), mProductList);
lvProduct.setAdapter(adapter);
lvProduct.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
//Do something
Toast.makeText(getApplicationContext(), " Clicked product id = " + view.getTag(), Toast.LENGTH_SHORT).show();
registerForContextMenu(lvProduct);
openContextMenu(lvProduct);
}
});
}
final int CONTEXT_MENU_ADD =1;
final int CONTEXT_MENU_EDIT =2;
final int CONTEXT_MENU_ARCHIVE =3;
@Override
public void onCreateContextMenu(ContextMenu menu, View v,ContextMenu.ContextMenuInfo menuInfo) {
//Context menu
menu.setHeaderTitle("My Context Menu");
menu.add(0, CONTEXT_MENU_ADD, 0, "Add");
menu.add(0, CONTEXT_MENU_EDIT, 0, "Edit");
menu.add(0, CONTEXT_MENU_ARCHIVE, 0, "Delete");
}
@Override
public boolean onContextItemSelected(MenuItem item) {
// TODO Auto-generated method stub
switch(item.getItemId())
{
case CONTEXT_MENU_ADD:
{
}
break;
case CONTEXT_MENU_EDIT:
{
// Edit Action
}
break;
case CONTEXT_MENU_ARCHIVE:
{
}
break;
}
return super.onContextItemSelected(item);
}
}
This is my Product class whose objects are made and displayed in the list view:
public class Product {
private int id;
private String name;
private int amount;
//private String description;
//Constructor
public Product(int id, String name, int amount) {
this.id = id;
this.name = name;
this.amount = amount;
}
//Setter, getter
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 int getAmount() {
return amount;
}
public void setPrice(int amount) {
this.amount = amount;
}
|
5656149fbd0a68b1dae35a3bbc8edec4ec0f36f49b2281214b1012c205420767 | ['620ad643adf64a039342fa17fe7540e8'] | There is problem in your code: "<PERSON>" is a text node with parent element node "from". So you should change value of the text node.
...
for (int i =0; i<list.getLength();i++) {
Node node = list.item(i);
//get the salary element, and update the value
if("from".equals(node.getNodeName())){
Text text = (Text) ((Element) node).getChildNodes().item(0);
text.setNodeValue("prasad");
}
}
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer();
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File("/mnt/sdcard/one.xml"));
transformer.transform(source, result);
...
And I think RegExp would be much easier for this task
"your xml as string".replaceAll("<from>.*?</from>", "<from>prasad</from>");
| 15cebf8c172a3ac1e74bcb4e342eec76b59f4016a0c3f36653fa854f60270854 | ['620ad643adf64a039342fa17fe7540e8'] | I've not yet see a way, after searching here and other sites, to be able to duplicate a Ubuntu 16.04 LivCD, onto the partition(s) of my choice, without wiping the whole ext drive clean in the process.
In other words: I have a large drive with data on it but I just want to create a bootable/LiveCD area without formating the whole drive during install.
Utils/apps like Unetbootin and gnome-disk-utulity haven't been a complete answer, but I have them available.
This might very well be flagged as 'Duplicate', but I can't seem to find an otherwise non-destructive way to add a bootable LiveCD partition to the empty space on my External Hard Drive.
I have at least 7G available w/ an additional 9G in reserve, my ISO of choice would be this one:
ubuntustudio-16.04.4-dvd-amd64.iso
Thx in advance.
|
7ef0f21746062b126b9ab37cf59927779f1caab05efaebfd1e58cb38d69396d0 | ['620cb562dcf1433eb846ec4e003f06e1'] | I have a angular based app, which contains the 4 folders:
- CSS (contains CSS files)
- JS (contains controller folder and the app.js)
- Views (contains the html files)
I cannot run the app.js in a node server, the error I keep on getting is
angular.module('testApp', [])
^
ReferenceError: angular is not defined
And when I click on just the html files it shows only text and the css is not applied. How do I go about running this type of angular app/
| 46078400fd2476d8ea36d5d8c5cd934bfe246abb1e58cabe3f7a9db60cc12eca | ['620cb562dcf1433eb846ec4e003f06e1'] | I've been trying to convert this C function into assembly. The issue is I don't know if I am doing this right. This is my first time, and I wanted to know from you guys how I am doing + some advice. Thank you!
C code:
unsigned int max(unsigned int a, unsigned int b){
//computes the max of a and b
return a > b ? a : b;
}
Assembly:
.global max
.global knapsack
.equ wordsize, 4
.text
.data
max:
push %ebp
movl %esp, %ebp
mov %eax, 4(%esp)
mov %ebx, 8(%esp)
cmp %ebx, %eax
jg knapsack
cmp %eax, %ebx
jg knapsack
movl %ebp, %esp
ret
knapsack:
*Working on this function
|
7dbd1dea147203f2d8cff990d19a3270f6b96f0244aebd6aff5215b7ccf8bf76 | ['6215c759991649ce952ffb7af6d0fea2'] | I need some help for a little jquery selector...
I need to call a function on keypress action, but I need to call this function only when the user isn't in a <form>.
I try with $('body').not('form').keypress(getKey) but it doesn't work
I tried with some combinaison of .not() selector but I didn't do nothing well...
So if someone had an idea how I can do it...
Thanks you
| 8e843d471120a809e9569618a37232c4175e4b03d66b22db9fecb8aa9fc0f59c | ['6215c759991649ce952ffb7af6d0fea2'] | In WooCommerce, on view-order page is there a way to get post id of product (or an other column) ?
I tried to display data of $_product and $item_meta but it's displaying the id of the product created in the admin of WordPress, not the id of the current product in the order.
|
dc8f9de94bc62d145a9c5e97d20b28f712d916aae7b01867dbf2f949918b547c | ['6216696d174d411ba0e0cb951119c479'] | I am getting this error, I tried all forums on this site and still doesnt understand.
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in /home/canwechi/public_html/submit.php on line 25
0
Below is my code:
<?php
define('INCLUDE_CHECK',1);
require "functions.php";
include "includes/vars.inc.php";
if(ini_get('magic_quotes_gpc'))
$_POST['inputField']=stripslashes($_POST['inputField']);
$_POST['inputField'] = mysql_real_escape_string(strip_tags($_POST['inputField']),$link);
if(mb_strlen($_POST['inputField']) < 1 || mb_strlen($_POST['inputField'])>140)
die("0");
mysql_query("INSERT INTO statusupdate SET tweet='".$_POST['inputField']."',dt=NOW()");
if(mysql_affected_rows($link)!=1)
die("0");
echo formatTweet($_POST['inputField'],time());
?>
| fa419b1d526010f45f1179d002ad1b1c7c346d45cb4d5705e5395dfbaab8b420 | ['6216696d174d411ba0e0cb951119c479'] | Unable to create a response with this api.I am unable to call the function locu_search('new york'). I get the following error shown below. I am using Komodo as my IDE, this started when I created a new python shell.
import urllib2
import json
local_api = '0d5897aae41eeafbd62ad0815af15cc42b2ed7c0'
def locu_search(query):
api_key = local_api
url = 'https://api.locu.com/v1_0/venue/search/?api_key=' + api_key
locality = query.replace('','%20')
final_url = url + "&locality=" + locality + "&category=restaurant"
json_obj = urllib2.urlopen(final_url)
data = json.load(json_obj)
for item in data['objects']:
print item['name'],item['phone']
locu_search('new york')
The error is listed below:
**Traceback (most recent call last):
File "<console>", line 0, in <module>
File "<console>", line 0, in locu_search
File "c:\python27\lib\urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "c:\python27\lib\urllib2.py", line 437, in open
response = meth(req, response)
File "c:\python27\lib\urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "c:\python27\lib\urllib2.py", line 475, in error
return self._call_chain(*args)
File "c:\python27\lib\urllib2.py", line 409, in _call_chain
result = func(*args)
File "c:\python27\lib\urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 400: BAD_REQUEST**
|
6aa55cb91af4a53523db38aa1e2df18942bf93fe42450712e543283c8015137e | ['62236273a1c642d2aaf1b0b275c3b816'] | A simple way to do what I think you want would be to create a third column that had formulas like this one: =IF(A1="Y",B1*0.7,B1*0.3). Then, you could use the SUM function to add up all of the results. See the cells with formulas below.
Key Value Weighted Value
Y 1 =IF(A2="Y",B2*0.7,B2*0.3)
N 2 =IF(A3="Y",B3*0.7,B3*0.3)
N 3 =IF(A4="Y",B4*0.7,B4*0.3)
Y 4 =IF(A5="Y",B5*0.7,B5*0.3)
=SUM(C2:C5)
Here would be the result...
Key Value Weighted Value
Y 1 0.7
N 2 0.6
N 3 0.9
Y 4 2.8
5
| 77bf7d2461c0478a44f0ccf4f8f0c8b9d00c28f39d722e63fdc0a911cb6a2da9 | ['62236273a1c642d2aaf1b0b275c3b816'] | Is there a way to select data in quotes in a query? For example, I have a field that contains a value of
SYS_Data("THE DATA I WANT")
Is there a way to search this in SQL (specifically Oracle)?
I really just need to be able to see if the value in quotes matches (exactly) another field in another table.
|
d3eed1d8160423778122584912115c4cc49b89c3a240343688ef09c0125d141c | ['62372f92dbae411e957a604d72507681'] | I managed to solve this (somehow)!
I changed the controllers code to say app.controller instead of using angular.module to define the application. For some reason where this did not work before, now works and I am now working on integrating this into my actual project successfully.
app.controller('MainController', ['$scope', function($scope) {
$scope.trainers = [
{
name: 'Mike',
email: '<EMAIL_ADDRESS><PERSON>',
email: 'mike@gym.com',
tel: '<PHONE_NUMBER>',
info: 'I am a gym instructor',
quote: 'Inspirational Quote'
}, ... ]
}]);
| 4ce85cda67cebc864d941a272db74ee12eb145abd5ac8bf6ed98278761720949 | ['62372f92dbae411e957a604d72507681'] | basically I need a loop within a loop to compare two different arrays in my actionscript3 lottery game.
I have attempted the loop but I cannot seem to get it to work ...
check_win.addEventListener(MouseEvent.CLICK, f_check_win);
function f_check_win(event:Event):void{
for(index = 0; index < matches[index]; index++ ){
trace(index);
for(index2 = 0; index2 < input_array.length; index2++){
if (match[index2] == input_array[index2]){
choose_change = choose_change+1;
}
}
}
So basically within this code check_win is a button. Once the button is clicked it runs the loop. It is meant to take an instance of matches which contains 6 properties and loop until index is greater than matches. According to my output this is happening but the second loop doesn't appear to do anything. Any help is greatly appreciated.
|
e1a41d59de85cf73a580102cfb48b2e8d19192a9707293807b579cdb6788eb59 | ['623a945a4dbf4a9297e0eb518bf3d49a'] | I have a parent which I read its position using jQuery, and assign its left to the child. It works when initially loaded but breaks at resize and I'm having difficulties at debugging it. More specifically it's a flexMenu.
Whenever the menu is smaller than the width of its parent a "More" button appears and holds the links or buttons that can't fit the parent.
So, this "More" button has a .flexMenu-viewMore class assigned, and whenever clicked an .active class is added.
What I did was read the position of .active (class added after "More" is clicked) and assign its left to .flexMenu-popup (which would be the dropdown-content). Like this:
$(".flexMenu-viewMore").click(function(){
var x = $(".active").position();
var dropdown_content = $('.flexMenu-popup');
dropdown_content.css('left',x.left);
});
Whenever I clicked "More" again, the .active class is removed and then I get a TypeError: x is undefined. Of course, because there is no .active class anywhere in the document.
So I added and if so that x is only defined if .active exist.
var demo = document.getElementsByClassName('active').length;
if ( demo > 0 ) {
var x = $(".active").position();
var dropdown_content = $('.flexMenu-popup');
dropdown_content.css('left',x.left);
}
I no longer get the Typerror but, my script keeps working only after the first load. Whenever I resize it, it won't work (even if the more doesn't "absorb" any more links).
How could I make use of something like
$(window).on('resize', function(){
// Code goes here
});
Since, in reality, I only want to call it whenever .flexMenu-viewMore is clicked ("More" button).
Does position breaks at resize and I'm not aware of it?
How could I proceed to debug this?
| cc35e9bedabf9f506723973b29110ddd30756edd29bb6fd8942173162f5ed36e | ['623a945a4dbf4a9297e0eb518bf3d49a'] | I have a form inside the footer, I'm running the php file at the localhost <IP_ADDRESS>/form.php, apparently if one uses php code inside HTML it will just be commented out. From what I understood at the PHP Documentation I need to run the php file directly.
The code is based on the W3Schools PHP Form Required tutorial:
<!DOCTYPE html>
<html>
<body>
<footer>
<form method="post" action="form.php">
<input type="text" name="name" placeholder="Name"><span class="form-error">*<?php echo $nameError;?></span><br>
<input type="submit" value="Send">
</form>
<?php
// define variables and set to empty values
$name = ""; // The variable is defined at the global scope
$nameError = ""; // The error variable is defined at the global scope
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($POST['name'])) {
$nameError = 'Name required'; }
else {
$name = test_input($_POST["name"]); }
}
// The function that will validate the form
function test_input($data) {
$data = trim($data); // The data is stripped of unnecesary characters
$data = stripslashes($data); // Backslashes '\' are removed
$data = htmlspecialchars($data); // Converts special characters into HTML entities
return $data
}
?>
If I left the text blank it wouldn't echo the error at the span, so I tried debugging it
<?php
// Debugging test_input($data)
echo $name;
echo "<br>";
echo $nameError;
echo "<br>";
?>
No matter what I submit at the input, the $name is always blank whereas the $nameError is always echoed.
So I thought that maybe the function isn't returning anything, and I did a little more debugging
// Debugging without the function
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'];
echo $name;
echo "<br>";
}
// Debugging after each iteration of whats inside the function (without return)
$data = trim($data); // The data is stripped of unnecesary characters
echo $name;
echo "<br>";
$data = stripslashes($data); // Backslashes '\' are removed
echo $name;
echo "<br>";
$data = htmlspecialchars($data); // Converts special characters into HTML entities
echo $name;
echo "<br>";
?>
If I introduce, for instance, & \ a my output is:
*a blank line*
Name required
& \ a
& \ a
& \ a
& \ a
Apparently the php built in functions aren't doing what they are supposed to do. stripslashes($data) did not remove the backslash and the & should look as & after going through htmlspecialchars($data).
I even commented everything inside test_input($data) so that it looked like this
function test_input($data) {
return $data }
And still would get nothing. Any ideas why? Also, why is the function test_input($data) defined later in the script instead of being defined before (tried to put it before defining my variables and still would not work). Thanks in advance.
|
4363b664a78e3bad50d25d1f8fdcdbf01bef0f33f20fff28da5d1eafee2d5bec | ['624ce4e395c348a7ad90593c898c93cc'] | Well you can achieve it 2-3 ways, so in Kotlin we have have the delegates which lets you initialize the variable on its first access i.e. the variable gets initialized whenever it is first used, so you can do
val dbHelper by lazy { mmrbd(context) }
Or you can do that in a Java way you can say:
var dbHelper: mmrbd? = null
and initialize it in OnCreate like: dbHelper = mmrbd(context)
Or you can use the lateinit keyword of Kotlin which basically lets you initialize the variable later, but its your responsiblity to initialize it before you use the variable:
lateinit var dbHelper: mmrbd
and initialize it in OnCreate like: dbHelper = mmrbd(context)
| 1bdc39f24c0a13f963f6426e7bdc0b974aeb0462d024f4ef1dccb0a7c17c4af4 | ['624ce4e395c348a7ad90593c898c93cc'] | So, there is some catch if you want Data Binding to work when you are using include in your layouts, So do these things:
Step 1: Change your xml file in which you are using include tag to something like this. Look closely how i am playing with the variable names in this Data Binding.
<data>
<import type="com.example.jenny.MyViewModel"/>
<variable
name="viewModelNew"
type="MyViewModel"/>
<include
layout="@layout/my_include_layout
app:viewModel="@{viewModelNew}"/> <!--this, viewModel is the variable declared in xml which you are including here-->
</data>
Step 2: And in the layout which you are including i.e. in my_include_layout, do the Real Data Binding there like this:
<data>
<import type="com.example.jenny.MyViewModel"/>
<variable
name="viewModel"
type="MyViewModel"/>
</data>
<View
app:visibilityCondition="@{viewModel.showingItems}"/><!--the real Data Binding is happening here-->
Step 3: Also, in your activity or fragment, where ever you are initializing Data Binding, do write
dataBinding.viewModelNew = new MyViewModel() // or something like this, you have to initialze the data binding variable
Let me know, if this helps.
|
d63ed3f804065df69e3045eca171e0ccc3e2001e5cf5c3d0ec8383a1f855540f | ['6255e12ad94a4685a2e97518fbbae817'] | One solution is to use a dependency-injection framework like Spring.
The application configuration would specify the singleton instances, but your test cases could still create as-needed instances and inject them manually.
For more information: http://static.springsource.org/spring/docs/2.5.x/reference/testing.html
An alternative, if you've already got static singleton references sprinkled throughout your code, is to convert your Singleton.getInstance() method into a true factory, using a system property to control its behavior. This system property could be as simple as a flag to indicate that testing is in process, or as complex as the name of another class to use as the real factory (similar to what the JDK does with DocumentBuilderFactory).
| b22be27b77af0c4584a8395846dac1baac36d752b28e3434c870525422af5be9 | ['6255e12ad94a4685a2e97518fbbae817'] | Performance isn't really a consideration, assuming that you're not talking about gigabytes of XML. Yes, it will take longer (XML is more verbose), but it's not going to be something that the user will notice.
The real issue, in my opinion, is support for XML within JavaScript. E4X is nice, but it isn't supported by Microsoft. So you'll need to use a third-party library (such as JQuery) to parse the XML.
|
3ef991a60f0872d8f0b0c2c66487ae4c0280b0ffdcc315d3f2f2e74f96dab16a | ['625826a8e39f49a58e251765e9691cf5'] | Thanks and indeed it is only the last digit. [Google(Chinese)](https://www.google.com.tw/search?q=%E9%81%87%E6%9C%89%E5%B0%BE%E6%95%B8%E7%82%BA%E5%9B%9B%EF%BC%8C+%E6%88%B6%E6%94%BF%E4%BA%8B%E5%8B%99%E6%89%80%E5%BE%97%E6%8A%BD%E7%A9%BA%E4%B8%8D%E7%B7%A8) | a1970d7817407ee005262abdef9f071af0c104a9f085a78fcfec2ae6045145cf | ['625826a8e39f49a58e251765e9691cf5'] | У меня сервер VPX Ubuntu 16.04, на котором я установил mailutils (до этого установил exim4 - не знаю нужно ли было).
Работает - mail -aFrom:<EMAIL_ADDRESS> -s "subject1" "<EMAIL_ADDRESS>" - приходит локально, работает на внешние почтовые ящики, работает отправка из php.
Что нужно прописать в настройках DNS MX - "почтовый клиент", "хост" с тем чтобы принимать сообщения?
|
2e2ffdb750dfbda4418e7f8b642dafe0d1b5d40bd76c5b783107933d9c0b1f60 | ['626f8bff1609400692f36d003f8f7e71'] | I have XML
<test-suite type="TestFixture" name="RegionalityFeature" description="Regionality" executed="True" result="Failure" success="False" time="64.162" asserts="3">
<properties>
<property name="Description" value="Regionality" />
</properties>
<failure>
<message><![CDATA[One or more child tests had errors]]></message>
<stack-trace />
</failure>
<results>
<test-suite type="ParameterizedTest" name="_10CorrectRegionSwitchoverWithAuthorization" description="#10 Correct region switchover with authorization" executed="True" result="Failure" success="False" time="39.907" asserts="2">
<categories>
<category name="*Page" />
<category name="LoginPage" />
<category name="ErrorPage" />
</categories>
<properties>
<property name="Description" value="#10 Correct region switchover with authorization" />
</properties>
<failure>
<message><![CDATA[One or more child tests had errors]]></message>
<stack-trace />
</failure>
<results>
<test-case name="QA.*.Tests.Features.Regionality.RegionalityFeature._10CorrectRegionSwitchoverWithAuthorization("*","*","moskva","/login/?returnUrl=https:*/","spb","*бург","/customers/products/",System.String[])" executed="True" result="Failure" success="False" time="39.904" asserts="2">
<failure>
<message><![CDATA[ User is not authorized
Expected: not null and not <empty>
But was: <string.Empty>
]]></message>
<stack-trace><![CDATA[в QA.*.Tests.Steps.Pages.*PageSteps.PageIsAuthorizedWithUser(String login) в c:\AutoTest3\source\QA.*.Tests\QA.*.Tests\Steps\Pages\*PageSteps.cs:строка 59
в TechTalk.SpecFlow.Bindings.BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration)
в TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStepMatch(BindingMatch match, Object[] arguments)
в TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance)
в TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.OnAfterLastStep()
в QA.*.Tests.Features.Regionality.RegionalityFeature._10CorrectRegionSwitchoverWithAuthorization(String login, String password, String region, String loginUrl, String newRegion, String newRegionTitle, String expectedUrl, String[] exampleTags) в c:\AutoTest3\source\QA.*.Tests\QA.*.Tests\Features\Regionality\Regionality.feature:строка 26
]]></stack-trace>
</failure>
</test-case>
</results>
</test-suite>
<test-suite type="ParameterizedTest" name="_9CorrectRegionSwitchover" description="#9 Correct region switchover" executed="True" result="Success" success="True" time="24.251" asserts="1">
<categories>
<category name="*Page" />
<category name="ErrorPage" />
</categories>
<properties>
<property name="Description" value="#9 Correct region switchover" />
</properties>
<results>
<test-case name="QA.*.Tests.Features.Regionality.RegionalityFeature._9CorrectRegionSwitchover("moskva","/cu*/","spb","Санкт-Петербург",System.String[])" executed="True" result="Success" success="True" time="24.249" asserts="1" />
</results>
</test-suite>
</results>
</test-suite>
It is necessary to alter it to json in order to put it in elasticsearch
For this I chose Logstash
My config looks like this:
input {
file {
path => "C:\AutoTest3\report\test.xml"
start_position => "beginning"
sincedb_path => "NUL"
codec => multiline {
pattern => "</test-suite>"
negate => true
what => "previous"
auto_flush_interval => 1
}
}
}
filter {
xml {
source => "message"
target => "message.parsed"
xpath => [
"/test-suite/results/test-suite/@name", name,
"/test-suite/results/test-suite/@success", success
]
force_array => false
}
mutate {
remove_field => [ "path","@timestamp","host","tags","@version"]
}
}
output {
file {
codec => "json"
path => ["C:/Logstash/temp.json"]
}
}
From this XML I need to make a json with two entries:
name
success
{
"success": ["False"],
"name": ["_10CorrectRegionSwitchoverWithAuthorization"]
}
{
"success": ["True"],
"name": ["_9CorrectRegionSwitchover"]
}
But I can not understand how I can write a pattern in multiline (which element to navigate) so that logstash understands that I have 2 events here.
| 34f041443e968574f04777f27851ac632bb7d7833ae896fee94076617a12c6f7 | ['626f8bff1609400692f36d003f8f7e71'] | Here's solution
input {
file {
path => "C:\AutoTest3\report\test.xml"
start_position => "beginning"
sincedb_path => "NUL"
codec => multiline {
pattern => "<test-suite type="
negate => true
what => "previous"
auto_flush_interval => 1
}
}
}
filter {
xml {
source => "message"
target => "message.parsed"
xpath => [
"/test-suite/@success", success,
"/test-suite/@name", name,
"/test-suite/@time", time,
"/test-suite/@description", description,
"/test-suite/results/test-suite/results/test-case/failure/message/text()", "message"
]
force_array => false
}
mutate {
remove_field => [ "path","@timestamp","host","tags","@version","message","message.parsed"]
}
}
output {
file {
codec => "json"
path => ["C:/Logstash/temp.json"]
}
}
|
4984794409ccdb8604c7994f28f34b4a6e17d5f4092ddf52121032141a57afba | ['6275946620ac43609a9f8fb408c0e06c'] | I have a dataframe that contains the following,
Reading
Date
2020-05-09 14:54:00 13661
2020-05-09 14:55:00 13672
2020-05-09 14:56:00 14251
2020-05-09 14:59:00 15255
I have figured out how to extract the last element:
lastelement=(series["Reading"].iloc[-1])
which gives me "15255"
Note:the first column is the index not a column in the dataframe as such.
so I also want to extract the index value for that same element (which may not be unique int the readings column), i.e. "2020-05-09 14:59:00"
I can anybody help?
thanks
(forgive me if my question is poor, its my first post on stackoverflow! - I can usually work my answers out from all of the other questions/answers presented here)
| 702684b4ae01f4528fce1cec68c500f86815d4af5e704b7e4d8f5068f1bd5f87 | ['6275946620ac43609a9f8fb408c0e06c'] | Given the following Dataframe,
SecondsInDay Min Max
0 0 1 2
1 300 3 4
2 600 5 6
3 0 7 8
4 300 1 0
5 300 2 12
6 300 4 56
I want to extract overall minimum and maximum value for every row where SecondsInDay = 300.
Being new to DataFrames, it took a while but I wrote the following code:
val = df[df.SecondsInDay==300]
index=val.index
maxVal=val['Max'][index[0]]
minVal=val['Min'][index[0]]
for d in index:
if maxVal < val['Max'][d]:
maxVal = val['Max'][d]
if minVal> val['Min'][d]:
minVal= val['Min'][d]
which indeed returns the correct values
maxVal=56
minVal=1
However, I read that iterating through DataFrames is not good particularly at scale,
therefore could I have written this better?
thanks in advance
|
d24f742e7ac62cb199c5c8af14e424bda90b433f16ebf56e145cc224c0a7c526 | ['6295ddac9d36462ea94a59827b828b33'] | I had a background process running, of which the command starts with "nohup nice". As it takes usually 20 hours, so I had it running during the night. However, I got a message says "write failed: broken pipe" this morning, probably because the server closes connections that are idle for too long.
When I logged into the server again, there's no job when I type the "jobs" command.
How can I restart the program from where it's left instead of running from the beginning?
| d3e4e9c69623e9be70a867d9ca51c75663d5f95aa875361509d14faefd0b35f1 | ['6295ddac9d36462ea94a59827b828b33'] | I have a a file containing about 20 million sentences, how can I extract 2 million sentences out from it?
I thought about using the split command like this "split -l 2000000 sub2016", but then it will create a series of texts, while I just need one.
So how can I specify it?
Thank you!
|
5dad8fc55d1243e6906d709d4de468e4aa9ede6ea91a6fd0f8da8f2e53d49a98 | ['62a313989098453dac0fef9f0cfbb685'] | Very interested to know why that worked. <PERSON> said of -c, "If the -c option is present, then commands are
read from the first non-option argument com‐
mand_string. If there are arguments after the
command_string, the first argument is assigned
to $0 and any remaining arguments are assigned
to the positional parameters. The assignment
to $0 sets the name of the shell, which is used
in warning and error messages." the bash man page isn't very n00b friendly. | 21c8a4e9fa47b90661f868a3e6b2af6bb8e6602cf3cd6cad531fec06750d39ba | ['62a313989098453dac0fef9f0cfbb685'] | I am in:
GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu)
the script is: (note.sh)
#! /bin/bash
edit="edit"
if [[ $edit = $1 ]]
then
touch ~/.notes/"$2".txt
$EDITOR ~/.notes/"$2".txt
else
tree ~/.notes
fi
I was hoping
if I input in bash:
./note.sh
I get output as if i had typed
tree ~/.notes
But i want this script to basically accept arguments, so
if I input
./note.sh edit new_note
then if new_note.txt does not exist,
touch ~/.notes/new_note.txt
then
(Gedit for me) text editor opening new_note.txt in terminal for editing
the else statement works, but
./note.sh edit new_note returns
./note.sh: line 10: /home/username/.notes/testnote.txt: Permission denied
It does the touch but not the editor.
What is being denied permission here?
Thanks in advance! I am very new to both shell scripting and askubuntu and much appreciate any help
|
bd47563299dbe1ca7d8f58b46ee618229a1a6fc6c98fd87a95ff04ef8d0697bf | ['62bb75fe955c492ba3fe0df79b992027'] | I'm a little confused on the correct way to make my class support NSCopy mechanics and I'm hoping someone can help clear things up for me.
The big question is this:
If my class is mostly immutatble except for a collections property, when I'm implementing the 'copyWithZone' method through NSCopy inheritance, do I need to do the version where I'm returning a self that had a retain called on it like this:
- (id)copyWithZone:(NSZone *)zone
{
return [self retain];
}
or do I need to do the other version that takes in to consider the policies used by NSCopyObject as outlined in the Memory Management programming guide published by Apple? (I've read a number of posts about how NSCopyObject is dangerous so one has to be careful with their implementations).
- (id)copyWithZone:(NSZone *)zone
{
NSCell *cellCopy = NSCopyObject(self, 0, zone);
/* Assume that other initialization takes place here. */
cellCopy->image = nil;
[cellCopy setImage:[self image]];
return cellCopy;
}
My class has ivars are a mix of primitive types, object types and an NSArray collection. I'm intending the class to be semi-immutable in the sense that clients cannot modify any of the intrinsic properties after the class was created initially but at some point the client will receive additional related data that needs to be appended to the class. Additionally, when clients are holding on to an instance, they should have their own copy instead of sharing it so it is a deep copy instance as opposed to a shallow copy.
The code:
@interface MySampleClass : NSObject {
NSString *myName;
NSString *myTitle;
BOOL isAFlag;
NSArray *aListOfProperites; // collection holds objects of another class named 'MySampleProperty'
}
@property (nonatomic, copy, readonly) NSString *myName;
@property (nonatomic, copy, readonly) NSString *myTitle;
@property (nonatomic, readonly) BOOL isAFlag;
@property (nonatomic, copy, readonly) NSArray *aListOfProperties;
-(id)initWithNameTitleAndFlag:(NSString *)aName title:(NSString *)aTitle flag:(BOOL)aFlag;
-(void)addProperty:(MySampleProperty *)aProperty;
@end
@implementation MySampleClass
-(id)initWithNameTitleAndFlag:(NSString *)aName title:(NSString *)aTitle flag:(BOOL)aFlag
{
self = [super init];
if (nil != self)
{
[self setMyName:aName];
[self setMyTitle:aTitle];
[self setAFlag:aFlag];
}
return self;
}
// all of my object setters do a 'copy' instead of retain or assign
-(void)setMyName:(NSString *)aNewName
{
if (aNewName != myName)
{
[myName release];
myName = [aNewName copy];
}
}
- (id)copyWithZone:(NSZone *)zone
{
// do I do a simple retain on the object or follow NSCopyObject policies?
}
@end
| ec6c67684150ceb1ee49fbab2b67efac4b7077d23915d5b9e5feda8a0c94c936 | ['62bb75fe955c492ba3fe0df79b992027'] | In Objective-C, is there any way to find out which objects are the ones retaining another object?
For example, I have a collection of MyClass objects and if I iterate through them to get the retain count on each object, I see the count at 2. How can I find out who the holders are?
for (NSString *aKey in aDictionaryOfMyObjects)
{
MyClassObject *myClassObj = [aDictionaryOfMyObjects objectForKey:aKey];
// following shows a retain count of 2. Presumably, the first count is
// due to myClassObj is held as the value in NSDictionary and second is because I
// I just acquired a pointer to it above. I'd like to find out who exactly
// might have references to myClassObj.
NSLog(@"retain count = %d", [myClassObj retainCount]);
}
|
472182dcb0300d7f40c58eada12c91a023dc0999836f948c346953ff4f857678 | ['62d20e4ed8f245bda93748ab1b0242b0'] | Very old post, but still actual problem:
Let's me point my case, with a new SDcard, out of box (64GB samsung verified), never used.
Due to trying to solve problem of SDcard not recognized on a tablet dualboot Android/Windows 10, I had to plug/unplug this card (and a couple of its brothers) surely more than 100 times (surely cause of damage ?), format, re-format and re-re-reformat, Fat, exfat, ntfs, etc... tons of works this poor card could support !
At last (after solving problem), I wanted to have then, a "clear and proper" SDcard for use and begin to check "properly" it...
What was my surprise to see that half of it (half of 64GB) was covered by bad sectors !!!
So, despited, I did:
- Formatage by Windows 10 included softwares (quick and no quick mode) > no result !
- I read this old (2004) HP USB FORMAT TOOL is the best for that (better than SDFormatter)... Not true, no improvement seen !
- Then, Formatage low level (wiping with bit=0) done with Mini Partition wizard > no improvement
- Finally, back to SDFormatter, I did and did again (option FULL overwrite), knowing 64GB takes 1 hour to perform !
... At the 3rd pass, bad sectors had completely disappeared !
Hurrah !
For information, bad sectors were revealed by Mini Partition Tool (Surface test), while <PERSON> by Windows said everything is fine ???
Hope this can help
| 28ddf2a5e3945ecd3ccb27bc50cb600c0f85e0b3ca39a7dcf85355570db123e3 | ['62d20e4ed8f245bda93748ab1b0242b0'] | Nope, but I found it.
The bug was caused by a slight modification on my code which was acting differently between dev and prod environment. This piece of code is related to Doctrine_Query which I override to handle master/slave connections. Some kind of dumb effect side, very difficult to debug.
Thank you for help.
|
21239a8018d001a8af266f9b76a6b293fd2a7f7050ce5df7161d36ca276ee31e | ['62d92a9f236c48fa9b0fcebfe1b3ab92'] | If I have a docker session already running, is there any way to increase the shared memory?
I know that we can do docker run -it --shm-size=13g dockertag /bin/bash
as shown in https://stackoverflow.com/a/35884597/3776827
or change the docker-compose.yml file.
But if I have a docker session already running, is it still possible to do that? (I have one process running and don't want to stop it)
Where do I put this run command?
docker build -f ./Dockerfile -t <tag> .
docker tag <tag> <repo>
docker push <repo>
If I do docker run -it --shm-size=13g <tag> /bin/bash
, I get inside the docker. Doing docker push after (exiting the docker) this didn't create any effect.
I am trying to solve these errors on pytorch:
https://github.com/pytorch/pytorch/issues/8976
https://github.com/pytorch/pytorch/issues/973
Pardon my understanding of docker. I am a newbie to it.
| f3f92077c90c7b37aa03938dea708fc36af8aea6ee639b4345e2eaef5faae0ec | ['62d92a9f236c48fa9b0fcebfe1b3ab92'] | I am working with Community Detection in graphs. I have been through the different community detection algorithms implemented in igraph and plotting the community structures. Now after getting the communities object for different algorithms, I want to compare the algorithms based on different measures like density,cut ratio, coverage. (I know that modularity is already implemented). I can obtain a subgraph and then calculate the intra-cluster density but to find the inter-cluster density, I dont not know how to proceed. This is the code I have been using to find intra-cluster density:
karate <- graph.famous("Zachary")
wckarate <- walktrap.community(karate) #any algorithm
subg1<-induced.subgraph(karate, which(membership(wckarate)==1)) #membership id differs for each cluster
intradensity1 <- ecount(subg1)/ecount(karate) #for each cluster
Similarly I could proceed for each cluster and add all the densities or take the average of the all. My question is that if the number of communities is very large, then how to proceed?
And if I want to extract the number of edges between different communities, is there a nice way to extract the number of edges?
Please pardon me if this question is already asked. I am novice to igraph and R.
|
bfa4ba2cf5b21d25fc8e23928d3b47e6f883d7732d5fed31ea5a81ce3c9f584c | ['630644920aaf407688e997f6d2d11d97'] | Okay I was trying to install OpenStack on Fedora 20 by going through this article http://openstack.redhat.com/Quickstart and encountered an error like below:
packstack --allinone
ERROR : Failed to run remote script, stdout:
stderr: + trap t ERR
+ DEVICE=($(ip -o address show to <IP_ADDRESS> | cut -f 2 -d ' '))
++ ip -o address show to <IP_ADDRESS>
++ cut -f 2 -d ' '
bash: line 3: ip: command not found
+ '[' '!' -z ']'
+ ip link show ''
bash: line 5: ip: command not found
++ t
++ exit 127
So it is evident from the error that it is not able to find the ip binary...but where to change that?
Shed some light.
| c1f001ed9f70559e35c69e2980823fa22f83bda3d58105f5d46cfa7e9c4ca9d1 | ['630644920aaf407688e997f6d2d11d97'] | From my experience, you are giving false information. With the above method, arcpy runs fine whether using it outside of ArcGIS, or within. Of course, I have not tried every single arcpy function, but I have used it extensively at work, e.g. I am currently writing an application of >10000 lines which makes extensive use of arcpy, numpy, numexpr, osgeo, shapely, fiona, multiprocessing and wxpython without any problems. Note that the above installation method leaves the python installation created by ArcGIS untouched. |
d2a7019733a67d799833aafb169c9536d2f27262ae5246d781424408408865c7 | ['631272fa1cfd4604a91e7d7f047e98b0'] | I think something like this might work:
function send_ajax_request(data){
$.ajax({
url: "yoururl",
type: "GET",
dataType: "json",
data: {
data: data,
csrfmiddlewaretoken: '{{ csrf_token }}'
},
success: function (json) {
next_ajax(json['success']);
},
error: function (xhr, errmsg, err) {
alert("Could not send URL to Django. Error: " + xhr.status + ": " + xhr.responseText);
}
});
}
function next_ajax(data){
$.ajax({
url: "yoururl",
type: "GET",
dataType: "json",
data: {
coord: JSON.stringify({ "info": data[0], "info2": data[1] }),
csrfmiddlewaretoken: '{{ csrf_token }}'
},
success: function (json) {
console.log(json)
},
error: function (xhr, errmsg, err) {
alert("Could not send URL to Django. Error: " + xhr.status + ": " + xhr.responseText);
}
});
}
Basically, use your Ajax's sucess function to invoke the next Ajax request. Should work!
| 18c595bfd17da7ffa2784017531f8890c60a1183814cb016aed24c7ba3cdd824 | ['631272fa1cfd4604a91e7d7f047e98b0'] | I want to use data that was fetched using an AjaxQuery, parse that data and send the user to another view to do other stuff. However, I'm getting a Error 200 and a snippet of my test view and I have no idea why!
The main idea of what I want to do is get the user location using a js function, then I use an AjaxQuery to get the coordinates, use POST in a view whose function is to handle the data and then send the user to another view where I can use those coordiantes to do other stuff.
AjaxQuery
$(document).ready(function(sol) {
$("#send-my-url-to-django-button").click(function(sol) {
$.ajax({
url: "/establishments/process_url_from_client/",
type: "POST",
dataType: "json",
data: {
lat: sol[0],
lon: sol[1],
csrfmiddlewaretoken: '{{ csrf_token }}'
},
success : function(json) {
alert("Successfully sent the URL to Django");
},
error : function(xhr,errmsg,err) {
alert("Could not send URL to Django. Error: " + xhr.status + ": " + xhr.responseText);
}
});
});
});
View.py
def get_coordinates_view(request):
return render(request, 'base2.html')
def process_url_from_client(request):
res = request.POST.get('data')
return render(request, "results.html")
Urls.py
urlpatterns = [
path("", views.get_coordinates_view),
path("process_url_from_client/", views.process_url_from_client),]
The results.html for now is just an html with hello, the error I get with this is: Could not send URL to django. Error 200: hello!
Thank you so much!
|
493c3eec69c30cbc67e5ca4c47f81576081a3e5ca5a3eb884b2f1f0b4a8e68d5 | ['632b1936e0464738a9b4fd916f9fb353'] | I have a pretty basic form that i render from a view using a model.
In this form I have som text inputs like this:
<div class="editor-label">
@Html.LabelFor(model => model.UserProfile.FirstName)
</div>
<div class="editor-field">
@Html.TextBoxFor(model => model.UserProfile.FirstName)
@Html.ValidationMessageFor(model => model.UserProfile.FirstName)
</div>
When this is rendered on the webpage it contains this nasty inline style:
<input
id="UserProfile_FirstName"
name="UserProfile.FirstName"
type="text"
value="xxx"
sourceindex="4"
style="border-style: solid; border-width: 1px;
border-color: rgb(238, 50, 50) rgb(240, 80, 80) rgb(240, 80, 80);
box-shadow: rgb(250, 230, 230) 1px 1px inset;
-webkit-box-shadow: rgb(250, 230, 230) 1px 1px inset;">
I'v tried several approaches for removing this, including
@Html.TextBoxFor(model => model.UserProfile.LastName, null,
{ @style = "border-width: 0px;" })
And similar, but the inline styles that i add are added before the styles i want to remove so they are overwritten.
How can I remove or overide this inline style?
| 7581006fbaac6e234374906b5c03bfc6fc266adb82455dccc136ad4f2a05596a | ['632b1936e0464738a9b4fd916f9fb353'] | I have been trying to track the estimated loading progress on a WKWebView using KVO on the "estimatedProgress" property in a Xamarin ios UIViewController.
I add an observer like this:
public override void ViewDidLoad()
{
base.ViewDidLoad();
...
WkView.AddObserver("estimatedProgress", NSKeyValueObservingOptions.New, ProgressObserver);
...
}
ProgressObserver looks like this:
public void ProgressObserver(NSObservedChange nsObservedChange)
{
Console.WriteLine("Progress {0}", WkView.EstimatedProgress);
}
When I run this it returns something like this:
2015-11-17 09:29:15.345 testappiOS[10056:1381155] Progress 0.1
2015-11-17 09:29:15.636 testappiOS[10056:1381155] Progress <PHONE_NUMBER>
2015-11-17 09:29:15.949 testappiOS[10056:1381169] Warning: observer object was not disposed manually with Dispose()
Googling " Warning: observer object was not disposed manually with Dispose()" returns information about the need to manually dispose the observer, obviously. But I have not been able to figure out how to apply this to my problem.
Can anyone offer some insight on this?
|
f9b1cebc87e3898f196bdbd25a13cd26bab49cd728101460524805929219ce93 | ['632d4b8e33784e5b89f6285877cd7578'] | This is my problem,
I have a website with some content, and i want the header to be 100% width of the browser, and some content that's wrapped inside wrapper to make it about.. 50% of the browser width.
Then we have something like this:
But, we're adding a menu aswell. This is done with UL, and we cant just add the menu (i think), because the content of the menu is going to be in the wrapper. So it looks like this:
What have i tried?
I've given the element header/menu this css:
padding-left: 3000px;
margin-left: -3000px;
padding-right: 3000px;
margin-right: -3000px;
I also added overflow-x:hidden; on the body element so they cant scroll x wise. But on their phones, they can. So this makes everything "unresponsive"
HTML:
<html>
<title>Rocket League Prices - Home</title>
<body>
<div class="wrapper">
<header>
<a href="/index.php">
<div class="header-1">
Rocket League Prices
</div>
</a>
</header>
<ul class="nav-top">
<li class="nav-top"><a href="/index.php" title="HOME" class="nav-top">
<i class="fa fa-home fa-lg" aria-hidden="true" ></i><br><span class="meny-text">Home</span></a></li>
<li class="nav-top"><a href="/pc.php" title="PC PRICE LIST" class="nav-top">
<i class="fa fa-desktop fa-lg" aria-hidden="true"></i><br><span class="meny-text">PC list</span></a></li>
<li class="nav-top"><a href="/ps4.php" title="PS4 PRICE LIST" class="nav-top">
<i class="fa fa-gamepad fa-lg" aria-hidden="true"></i><br><span class="meny-text">PS4 list</span></a></li>
<li class="nav-top"><a href="/certified.php" title="CERTIFIED LIST" class="nav-top">
<i class="fa fa-certificate" aria-hidden="true"></i><br><span class="meny-text">Certified list</span></a></li>
<li class="nav-top" style="float:right;!important" >
<a href="#" class="nav-top meny-text" data-toggle="modal" data- target="#modal-staff">
<i class="fa fa-envelope-o" aria-hidden="true"></i> <br>Staff</a></li>
</ul>
<div class="modal fade" id="modal-staff" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
CSS:
body{
overflow-x: hidden;
}
header{
padding: 20px;
background-color: #1798e5;
color: black;
padding-left: 3000px;
margin-left: -3000px;
padding-right: 3000px;
margin-right: -3000px;
}
ul.nav-top {
background-color: white;
margin-left: auto;
margin-right: auto;
padding: 0;
margin-top: 0 auto;
float:left;
color: #34495e;
display:table-row;
text-align: center;
width: 100%;
margin: 0;
margin-bottom: 15px;
list-style-type: none;
padding-left: 3000px;
margin-left: -3000px;
padding-right: 3000px;
margin-right: -3000px;
}
li a.nav-top{
color: #34495e;
text-decoration: none;
padding: 20px 20px;
}
li a.nav-top:hover{
background-color: #f1f2f3;
color: #1798e5;
}
li.nav-top {
text-decoration: none;
float: left;
}
.wrapper{
max-width: 1000px;
margin-left: auto;
margin-right: auto;
}
CODEPEN: http://codepen.io/anon/pen/QdLpzM
| ff4b4bb18f4fc081e32f69031342e4d7a0fdd59489bff7fd5176c214e1b2e8ec | ['632d4b8e33784e5b89f6285877cd7578'] | @andew larsen
If this is my notification
<font style="float:right">
<nav class="dropdownContainer">
<span class="lightpill-n dropdown-toggle"><i class="fa fa-bell dropdown-toggle"></i> 1</span>
<ul class="dropdown">
<span class="text1">
Hello!
<p>We updated a few changes to the website. Keep yourself updated by reading more.
<p>
<span class="btn-read" style="text-align:right;">Read more</span>
</span>
</ul>
</nav>
</font>
and I want
<div class="lightpill-warn>1</div>
to dissapear when they open the notificaiton, how?
|
f6e6ec32e903a227714bba96743f9667a27295a08f4da007fcbadc87b8fe93c4 | ['632fd51d671e4737bc4bdd9757028796'] | I've one form to upload an attachment file
<form id="post-job-form" class="frontend-form" action="" method="post" enctype="multipart/form-data" role="form">
<?php
$status_message = '';
if( isset( $_GET['message'] ) ){
$status_message = $_GET['message'];
}
// check if user have post a company
$check = get_posts( array( 'post_type' => 'company', 'author' => get_current_user_id() ) );
if( $check == null ){
$status_message = '6';
}//endif;
jobboard_set_post_message( $status_message );
?>
<div class="form-group">
<label for="sallary_periode"><?php _e( 'Salaire Periode', 'jobboard' ); ?></label>
<select name="sallary_periode" id="sallary_periode" class="form-control">
<?php
$sallary_periode = array(
'hourly' => 'Hourly',
'daily' => 'Daily',
'weekly' => 'Weekly',
'monthly' => 'Monthly'
);
foreach( $sallary_periode as $periode_key => $periode_value ) {
$selected = '';
if( $default['sallary_periode'] == $periode_key ){
$selected = 'selected';
}
echo '<option value="'.$periode_key.'" '.$selected.'>'.esc_attr($periode_value).'</option>';
}
?>
</select>
</div><!-- /.form-group -->
<div class="form-group">
<label for="job_img"><?php _e( 'L`image (en option)', 'jobboard' ); ?></label>
<?php
if( isset($_GET['action']) && $_GET['action'] == 'edit' ){
$edit = get_post( $_GET['jid'] );
$jobimag = get_post_meta( $edit->ID, 'jbchild_meta_job_image', true );
if(!empty($jobimag)){
echo '<img src="' . $jobimag . '">';
}//!empty
}//endif;
?>
<input class="" type="file" name="job_photo" id="job_photo" accept="image/*" />
<span class="help-block"><?php _e( 'Télécharger éventuellement votre image pour les candidats pour voir', 'jobboard' ); ?></span>
</div><!-- /.form-group -->
<?php
if( isset( $_GET['action'] ) && $_GET['action'] == 'edit' ){
$button_text = __( 'Update Job', 'jobboard' );
?>
<input type="hidden" name="form_type" id="form_type" value="edit_post_job" />
<input type="hidden" name="post_id" id="post_id" value="<?php echo esc_attr( $default['post_id'] ); ?>" />
<?php
}else{
$button_text = __( 'Post A Job', 'jobboard' );
?>
<input type="hidden" name="form_type" id="form_type" value="post_job" />
<?php
}
?>
<input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( get_current_user_id() ); ?>" />
<button type="submit" name="submit" class="btn btn-post-resume"><?php echo esc_attr( $button_text ); ?></button>
</form>
And this is my function:
function jobboard_post_job_123( $data = array(), $files = array(), $update = false ){
$post_status = 'publish';
if(jobboard_option('enable_highlight_package_job') == '1'){
$post_status ='publish';
}
$job_args = array(
'post_content' => $data['job_description'],
'post_title' => $data['job_title'],
'post_status' => $post_status,
'post_type' => 'job',
'post_author' => $data['user_id'],
);
$message = '1';
if( $update ){
$job_args['ID'] = $data['post_id'];
$job_args['post_status'] = get_post_status( $data['post_id'] );
$message = '2';
}
$job_id = wp_insert_post( $job_args );
if($job_id){
if( isset( $data['job_region'] ) ){
wp_set_object_terms( $job_id, $data['job_region'], 'job_region' );
}
if( isset( $data['job_type'] ) ){
wp_set_object_terms( $job_id, $data['job_type'], 'job_type' );
}
if( isset( $data['job_category'] ) ){
wp_set_object_terms( $job_id, $data['job_category'], 'job_category' );
}
// Job Company Metabox
update_post_meta( $job_id, '_jboard_job_company', $data['job_company'] );
// Job Experience Metabox
update_post_meta( $job_id, '_jboard_job_experiences', $data['job_experience'] );
// Job Salary Metabox
update_post_meta( $job_id, '_jboard_job_sallary', $data['job_sallary'] );
// Job Salary Periode
update_post_meta( $job_id, '_jboard_sal_periode', $data['sallary_periode'] );
// Job Summary Metabox
update_post_meta( $job_id, '_jboard_job_summary', $data['job_summary'] );
// Job Overview Metabox
update_post_meta( $job_id, '_jboard_job_overview', $data['job_overview'] );
if( !empty( $files['job_photo']['name'] ) ){
$job_img = jobboard_file_upload( $files['job_photo'], 'file' );
$old_job_img = get_post_meta( $job_id, 'jbchild_meta_job_image', true );
if($job_img){
//update_post_meta( $job_id, 'jbchild_meta_job_image', $job_img['url'], $old_job_img );
update_post_meta( $job_id, 'jbchild_meta_job_image', 'http://www.soslivreur.fr/wp-content/uploads/2016/04/20160316_174725.jpg' );
}
}
// Job metabox data set
$job_meta = array(
'_jboard_sal_periode'
);
update_post_meta( $job_id, 'jobboard_job_mb_fields', $job_meta );
wp_redirect( esc_url(add_query_arg( array( 'action' => 'edit', 'jid' => $job_id, 'message' => $message ) ) ) );
exit;
}
}
I have a problem. When I'm submitting this form others field can insert to database but an image can't insert to database.
How to fix my code? Thank you
| 254e9ba07b532835bca1a291a24621ebcd0e259a2cf3de7070a3ec6ee5576847 | ['632fd51d671e4737bc4bdd9757028796'] | I'm making space separator on integer. This is my code
if ( $.fn.appear && $.fn.countTo ) {
$('.counter').appear(function() {
$('.timer').each(count);
function count(options) {
var $this = $(this);
options = $.extend({}, options || {}, $this.data('countToOptions').replace(/ /g,'') || {});
$this.countTo(options);
}
});
}
When I'm execute an integer can display but show Uncaught TypeError: Cannot read property 'replace' of undefined. So how to fix my code?
|
76e5519eff26cc6b1578934938365d9697764d0c4d129994a38e7feb49e8cfbb | ['6336f163129a4831be1e3fc1306950e2'] | I just met my girlfriend's mom for the first time and I was slightly nervous. I think the reason you feel so anxious is because you're placing so much importance and value in meeting them and having everything be perfect.
It's obviously a little important but if you are telling yourself it will be absolutely perfect then you are just going to make yourself more nervous overthinking it and setting yourself up to not have a good time. Try not to care as much and it will not be as stressful. Also, remember that they are probably the reason your significant other is the way they are so there is a high likelihood that you will get along just fine.
| 0054b2e8f6ceba7a283d28c303a093d7f76433889bef3fc3adf056b7a1230dfc | ['6336f163129a4831be1e3fc1306950e2'] | Are you sure you want to do this? Why are you storing a pointer to integers passed in instead of the integer itself?
You have a strong possibility of storing a pointer to a temporary; const T& obj can be created as a temporary from a type that is convertable to T. For example, if you had the following:
IntSet<int> int_set;
int_set.insert(1);
short foo= 2;
int_set.insert(foo);
Both calls to IntSet<T><IP_ADDRESS>insert will result in storing a pointer to a temporary value, which is almost always a bug.
|
1c98434cf10a926a3d501610cbabfcf0e35c5eddf8f8401ba48cef3d5b578ddc | ['6347789f760d4c60993a32a018aa9037'] | I want to call my server from index view and bring model from server to view
i have done but that is not working please tell how to do
here this is what i did
var app = angular.module('app', []);
var CreateController = ['$scope','$http', function ($scope, $http) {
$scope.model = {};
$scope.mydata = 'ajs works';
$http.get('/Testing/Index').success(function(data){
$scope.model = data;
})
.error(function(data){
console.log("error");
});
}];
app.controller('CreateController', CreateController);
and here is the Index View
<div ng-controller="CreateController">
<table class="ui-sortable-handle">
<tr>
<td>
<input type="hidden" id="qid" value="{{model.Questions.AddQuestionID}}" />
</td>
</tr>
<tr>
<td>
<input type="hidden" id="complevel" value="{{model.Questions.ComplexityLevel}}" />
<input type="hidden" id="servcomplvl" value="{{model.servercomplevel}}" />
</td>
</tr>
<tr>
<td>
<h3>Question: {{model.Questions.Question}}</h3>
</td>
</tr>
<tr ng-repeat="item in model.Options">
<td class="switch radius">
<input id="{{item.Options}}" type="radio" name="selectedvalue" value="{{item.Options}}">
<label for="{{item.Options}}"></label>{{item.Options}}
</td>
</tr>
</table>
what i return from view is
return View(vm);
| 0d24aa9e740ad37057909dbf65a84260d8eeca581cb6c80c8833c7c2d05eb04a | ['6347789f760d4c60993a32a018aa9037'] | Check whether your Bootstrap is properly added.
after that add img-responsive class to img tag, it would solve your problem.
html,
body {
margin: 0;
padding: 0;
}
.container {
max-width: 100%;
margin: 0 auto;
padding: 0 10px;
}
.jumbotron {
background: url(http://i.imgur.com/U0ZfxUe.jpg) no-repeat center center;
background-size: 100% 100%;
height: 800px;
max-width: 100%;
}
.header {
background-color: #34495E;
}
.nav a {
color: #fff;
text-decoration: none;
}
.nav {
list-style-type: none;
margin: 0;
padding: 20px 0;
}
.nav li {
color: #fff;
display: inline;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 12px;
margin-right: 25px;
text-transform: uppercase;
}
.main {
left: 0px top: 0px;
text-align: left;
}
.main h1 {
color: #2E86C1;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 70px;
margin-top: 0;
margin-bottom: 80px;
}
.btn-main {
background-color: #333;
color: #fff;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 18px;
letter-spacing: 1.3px;
padding: 16px 40px;
text-decoration: none;
text-transform: uppercase;
}
.btn-default {
border: 2px double #34495E;
color: #34495E;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 10px;
letter-spacing: 1.3px;
padding: 10px 20px;
text-decoration: none;
text-transform: uppercase;
display: inline-block;
margin-bottom: 20px;
}
.supporting {
padding-top: 80px;
padding-bottom: 100px;
}
.supporting .col {
float: left;
width: 33%;
font-family: 'Raleway', sans-serif;
text-align: center;
color: #2E86C1
}
.supporting img {
height: 32px;
}
.supporting h2 {
font-weight: 600;
font-size: 23px;
text-transform: uppercase;
text-align: center;
}
.supporting p {
font-weight: 400;
font-size: 14px;
line-height: 20px;
padding: 0 50px;
margin-bottom: 40px;
}
.col {
display: inline;
}
.clearfix {
clear: both;
}
.history {
border: 2px double #34495E;
}
.history h2 {
width: 100%;
font-family: 'Raleway', sans-serif;
text-align: center;
color: #2E86C1
}
.history p {
color: #34495E;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 16px;
letter-spacing: 1.3px;
padding: 10px 20px;
display: inline-block;
}
.history ul {
margin: 0;
padding-left: 30px;
}
.history ul li {
margin: 0px;
padding: 0px;
text-indent: 0em;
margin-left: 1em;
}
.history li {
color: #34495E;
font-family: 'Raleway', sans-serif;
}
.About {
border: 2px double #34495E;
}
.About h2 {
width: 100%;
font-family: 'Raleway', sans-serif;
text-align: center;
color: #2E86C1
}
.About p {
color: #34495E;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 16px;
letter-spacing: 1.3px;
padding: 10px 20px;
display: inline-block;
}
.Contact h2 {
width: 100%;
font-family: 'Raleway', sans-serif;
text-align: center;
color: #2E86C1;
}
.Contact p {
color: #34495E;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 15px;
letter-spacing: 1.3px;
padding: 10px 20px;
float: left;
text-align: center;
}
.ISO h2 {
width: 100%;
font-family: 'Raleway', sans-serif;
text-align: center;
color: #2E86C1;
}
.ISO p {
color: #34495E;
font-family: 'Raleway', sans-serif;
font-weight: 600;
font-size: 18px;
letter-spacing: 1.3px;
padding: 10px 20px;
float: right;
}
.footer {
background-color: #333;
color: #fff;
padding: 30px 0;
}
.footer p {
font-family: 'Raleway', sans-serif;
text-transform: uppercase;
font-size: 11px;
}
<!DOCTYPE html>
<html>
<head>
<link data-require="bootstrap@3.3.7" data-semver="3.3.7" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script data-require="bootstrap@3.3.7" data-semver="3.3.7" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<div class="header">
<div class="container">
<ul class="nav">
<li>
<a href="tl.html">Home</a>
</li>
<li>
<a href="About.html">About</a>
</li>
<li>
<a href="Team.html">Team</a>
</li>
<li>
<a href="Contact.html">Contact</a>
</li>
</ul>
</div>
</div>
<div class="jumbotron">
<div class="container">
<div class="main"></div>
</div>
</div>
<div class="ISO">
<div class="container">
<h2 class="hero">Certification</h2>
<section class="container">
<div class="row">
<div class="col-xs-6">
<img class="img-responsive" src="http://i.imgur.com/wQQP94Y.jpg" />
</div>
<div class="col-xs-6">
<p>
<u class="warning">GOVERNMENT SUB-CONTRACTOR INFORMATION</u>
<br />
CR and ORCA Registered US Government Sub-Contractor
<br />
Company CAGE Code: 4STK5
<br />
<u>Business Certifications:</u>
<br />
Veteran Owned - Small Business
<br />
ISO 9001-2015 Certificate Number 16.127.1
<br />
Labor Surplus Region
<br />
<br />
<u>NAICS Codes:</u>
<br />
332710 – Machine Shops
<br />
332721 – Precision Turned Product Manufacturing
<br />
<br />
<u>Potential Federal Supply Classifications:</u>
<br />
1005/1010 – Guns – 30mm – 75mm
<br />
1650 – Aircraft Hydraulic, Vacuum and De-icing System Components
<br />
1660 – Aircraft Air conditioning , heat and pressurizing equipment
<br />
2590 – Miscellaneous vehicle components
<br />
2910/2915 – Fuel System Components
<br />
2930/ 2935 – Engine Cooling System Components
<br />
4130 – Refrigeration and Air Conditioning components
<br />
7320 – Kitchen Equipment and appliances (components)
<br />
<br />
</p>
</div>
</div>
</section>
</div>
</div>
</body>
</html>
|
1381cd3139124ad25778ecad82c71977e0f8890fddec36dd66fb9774e2323a5a | ['6353da76caeb4e02a10de9f800f8cf43'] | Adding a new nested column within person:
df = df.withColumn(
"person",
struct(
$"person.*",
struct(
lit("value_1").as("person_field_1"),
lit("value_2").as("person_field_2"),
).as("nested_column_within_person")
)
)
Final schema :
root
|-- city_name: string (nullable = true)
|-- person: struct (nullable = true)
| |-- age: long (nullable = true)
| |-- name: string (nullable = true)
| |-- nested_column_within_person: struct (nullable = true)
| | |-- person_field_1: string (nullable = true)
| | |-- person_field_2: string (nullable = true)
| 28ba59ba5bba91b8b80650a0b8772a47b2303d7f088a0284a15aa4e56cbad611 | ['6353da76caeb4e02a10de9f800f8cf43'] | [New to Spark] Language - Scala
As per docs, RangePartitioner sorts and divides the elements into chunks and distributes the chunks to different machines. How would it work for below example.
Let's say we have a dataframe with 2 columns and one column (say 'A') has continuous values from 1 to 1000. There is another dataframe with same schema but the corresponding column has only 4 values 30, 250, 500, 900. (These could be any values, randomly selected from 1 to 1000)
If I partition both using RangePartitioner,
df_a.partitionByRange($"A")
df_b.partitionByRange($"A")
how will the data from both the dataframes be distributed across nodes ?
Assuming that the number of partitions is 5.
Also, if I know that second DataFrame has less number of values then will reducing number of partitions for it make any difference ?
What I am struggling to understand is that how Spark maps one partition of df_a to a partition of df_b and how it sends (if it does) both those partitions to same machine for processing.
|
932729cdcd030a5490cd5cb712f6bf4810902f531709b9b9db80160be3825443 | ['63589cbc3295420da2b93f715cbfa060'] | I've got an ajax/json call that is returning the correct number of records, but they are all the same record, the first record.
SQL View:
ALTER view [dbo].[v_EMS_BM_Organization_Detail] as
select a.OrgID
, a.Organization
, a.inactive
, b.buID
, b.BusinessUnit
, count(distinct c.Budget) Budgets
, count(distinct d.BEMS) People
from t_EMS_BM_Organization a
left join t_EMS_BM_Business_Unit b
on a.OrgID = b.OrgID
left join t_EMS_BM_Budget c
on b.buID = c.buID
left join t_EMS_BM_Person d
on c.Budget = d.Budget
group by a.OrgID
, a.Organization
, a.inactive
, b.buID
, b.BusinessUnit
GO
When querying in SQL Server:
select *
from v_EMS_BM_Organization_Detail
where OrgID= 6
Returns:
OrgID Organization inactive buID BusinessUnit Budgets People
6 E3001 0 27 Manufacturing Services Staff 1 5
6 E3001 0 43 BASN 1 0
6 E3001 0 45 Special Assignment 1 0
My Model:
namespace EMSBM.Models
{
using System;
using System.Collections.Generic;
public partial class v_EMS_BM_Organization_Detail
{
public int OrgID { get; set; }
public string Organization { get; set; }
public Nullable<bool> inactive { get; set; }
public Nullable<int> buID { get; set; }
public string BusinessUnit { get; set; }
public Nullable<int> Budgets { get; set; }
public Nullable<int> People { get; set; }
}
}
My Controller:
[HttpPost]
public JsonResult OrgDetails(int ID)
{
List<v_EMS_BM_Organization_Detail> orgDetail = new List<v_EMS_BM_Organization_Detail>();
orgDetail = db.v_EMS_BM_Organization_Detail.Where(x => x.OrgID == ID).OrderBy(x => x.BusinessUnit).ToList();
return this.Json(new
{
Result = (from obj in orgDetail
select new
{
OrgID = obj.OrgID
,
Organization = obj.Organization
,
inactive = obj.inactive
,
buID = obj.buID
,
BusinessUnit = obj.BusinessUnit
,
Budgets = obj.Budgets
,
People = obj.People
})
});
}
My Ajax/Json call:
$('#organization-table-body').delegate('tr', 'click', function () {
var OrgID = $(this).attr('id');
OrgID = OrgID.substr(2, OrgID.length);
$.ajax({
type: 'post',
url: '/OrganizationDetail/OrgDetails',
contentType: "application/json; charset=utf-8",
data: JSON.stringify({ ID: OrgID }),
success: function (data) {
$('#org-detail-body').empty();
var html = '';
$.each(data['Result'], function (i, item) {
if (i == 0) {
$('#org-name').html(item.Organization +' Details');
$('#OrgID').val(OrgID);
$('#btn-active-status').removeClass('btn-primary');
$('#btn-active-status').removeClass('btn-danger');
if (item.inactive == true) {
$('#btn-active-status').html('Activate Organization');
$('#btn-active-status').addClass('btn-primary');
} else {
$('#btn-active-status').html('Deactivate Organization');
$('#btn-active-status').addClass('btn-danger');
}
}
html += '<tr id="tr' + item.buID + '" class="cursor-pointer"><td>' + item.BusinessUnit + '</td>';
html += '<td>' + item.Budgets + '</td><td>' + item.People + '</td></tr>';
});
$('#org-detail-body').html(html);
$('#org-detail-div').modal('show');
},
error: function (ex) {
alert(ex.responseText);
}
});
When passing 6 like in the sql server query above I get three records, this is correct. But all three records are only the first record:
Business Unit Budgets People
BASN 1 0
BASN 1 0
BASN 1 0
When debugging in VS 2012 I only get the first record duplicated the correct X number of times no matter what ID I pass.
| 8fc5cf3a36b4db707024be8f8976c1006bda4bc87717b76ac9cae0af3eccb755 | ['63589cbc3295420da2b93f715cbfa060'] | I have a tracking feature on my site. When users scan items, the scan is saved. Easy enough. It has been working fine for the past 6 months.
I have a few users where when they scan, the scanned input is changed, but only one character in the string.
Example:
Barcode is W7411A-004ZT-LX
Sometimes it scans correctly:
W7411A-004ZT-LX
Sometimes it replaces a character, in this case the 2nd character, and scans as:
W%411A-004ZT-LX
The scanner is a Symbol LS4208.
Thanks in advance!
<PERSON>
My input box:
<input type="text" id="kitID" />
My jQuery:
$('#kitID').keypress(function(e){
var <PERSON> = $('#kitID').val();
if ( e.keyCode == 13 && kit.length > 3 ){
addKit();
}
if ( e.keyCode == 9 && kit.length > 3 ) {
addKit();
$('#kitID').focus();
}
});
$('#kitID').keyup(function(){
var <PERSON> = $('#kitID').val();
var pgrm = $('#ddPgrm').val();
var charOne = kit.substr(0,1);
var charLast = kit.substr(kit.length - 1, 1);
var charDash = kit.substr(kit.length - 3,1);
if ( kit.length > 1 ) {
$('#cmdKit').show();
if (( pgrm == 'XX4' && charOne == 'R' ) || ( pgrm == 'XX7' && charOne == 'W' )) {
if ( charLast == 'I' || charLast == 'O' || charLast == 'X' ) {
if ( charDash == '-' ) {
addKit();
$('#kitID').focus();
}
}
}
} else {
//$('#cmdKit').hide();
}
$('#kitID').focus();
});
function addKit(){
var rack = $('#rackID').val();
var <PERSON> = $('#kitID').val();
var <PERSON> = $('#rackVal').val();
var <PERSON> = $('#ddLoc').val();
var <PERSON> = $('#ddLocII').val();
var pgrm = $('#ddPgrm').val();
var jRsn = $('#jailRsn').val();
/*var charOne = kit.substr(0,1);
var charLast = kit.substr(kit.length - 1, 1);*/
kit = kit.toUpperCase();
var i = 0;
while ( i = 0 ) {
if ( kit.substr(0,1) == ' ' ) {
kit = kit.substr(1,kit.length);
} else {
i ++;
}
}
if ( kit.substr(0,3) == 'IP-' ){
alert('Scan the kit barcode #, not the IP number.');
} else if ( ( Loc == 50 || Loc == 51 ) && jRsn == '' ) {
//$('#jailRsn').focus();
alert('Enter the reason for Jailing.');
} else {
var i = 0;
while ( i = 0 ) {
if (kit.substr(0,1) != 'R' || kit.substr(0,1) != 'V' || kit.substr(0,1) != 'W' ) {
kit = kit.substr(1,kit.length);
} else {
i ++;
}
}
if ( rackVal == 'NR' ) {
$.ajax({
url:"kitSystem.asp?Kit="+kit+"&uT=10",
success: function(responseText){
$.ajax({
url:'kitSystem.asp?Kit='+kit+'&KitEx='+responseText+'&Loc='+Loc+'&LocNm='+ LocII +'&Pgrm='+pgrm+'&jRsn='+ encodeURIComponent(jRsn) +'&uT=11'
});
}
});
var inMKM = 0;
$.ajax({
type:"post",
url:"kitSystem.asp?Kit="+kit+"&uT=112",
dataType:"xml",
async:false,
success: function(xml){
$(xml).find('option').each(function(){
var kitID = $(this).children('kitID').text();
if ( kitID != '' ) { inMKM = 1; }
})
}
});
$('#kitTable').show();
if ( inMKM == 0 ) { $('#kitTable > tbody:last').append('<tr style="background-color:green;color:white"><td>'+ kit +'</td><td></td></tr>'); }
else { $('#kitTable > tbody:last').append('<tr style="background-color:red;color:white"><td>'+ kit +'</td><td>deleted from MKM</td></tr>'); }
cntUpdate();
$('#kitID').val('');
//$('#cmdKit').hide();
$('#kitID').focus();
} else {
$('#kitRackTable').show();
$.ajax({
url:"kitSystem.asp?Kit="+kit+"&rack="+rack+"&uT=10"
});
$.ajax({
type:"post",
url:"kitSystem.asp?Rack="+rack+"&Kit="+kit+"&uT=9",
dataType:"xml",
async:false,
success: function(xml){
$(xml).find('option').each(function(){
var kitNm = $(this).children('kit').text();
var kitStat = $(this).children('stat').text();
if ( kitStat == 'RED' ){
$('#kitRackTable > tbody:last').append('<tr style="background-color:red;color:white"><td>'+ kitNm +'</td><td>'+ kitStat +'</td><td><input id="cmdPlus" value="+" type="button" /><input id="cmdMinus" value="-" type="button" /></td></tr>');
} else {
$('#kitRackTable > tbody:last').append('<tr style="background-color:green;color:white"><td>'+ kitNm +'</td><td>'+ kitStat +'</td><td><input id="cmdMinus" value="-" type="button" /></td></tr>');
}
cntUpdate();
$('#kitID').val('');
//$('#cmdKit').hide();
$('#kitID').focus();
});
}
});
}
}
}
|
a26333ee730b5e280966f628f8b2cd3a7234e14ff398c64123ae22a0bb8f7923 | ['636197958cb749f99cd66365f2cd0d58'] | You could read the data into a dictionary like in this example shown:
def empty():
return {'Target': '', 'Type': '', 'User': '', 'Comment': ''}
def process(record):
item = empty()
for line in record:
line_items = line.split(':', 1)
if len(line_items) == 2:
item[line_items[0]] = line_items[1].strip()
if len(line_items) == 1:
item['Comment'] = line_items[0].strip()
print('here save into SQL:')
print(' Target:' + item['Target'])
print(' Type:' + item['Type'])
print(' User:' + item['User'])
print(' Comment:' + item['Comment'])
print('')
def main():
lines = r.split('\n')
record = []
for line in lines:
line = line.strip()
if line != '':
record.append(line)
else:
process(record)
record = []
process(record)
if __name__ == "__main__":
main()
Result would be:
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Domain Extended Credentials
User:username
Comment:Saved for this logon only
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Domain Password
User:domain\username
Comment:Local machine persistence
here save into SQL:
Target:LegacyGeneric:target=Slack/tokens
Type:Generic
User:tokens
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:domain\username
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:username token
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:username
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:username
Comment:Local machine persistence
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:domain\username
Comment:
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:email address
Comment:
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic Certificate
User:<Certificate>
Comment:
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:
Comment:
here save into SQL:
Target:MicrosoftAccount:target=SSO_POP_Device
Type:Generic
User:
Comment:
| 20475ce8379cc440d47ff8bddb7891eedca3b4b1cb69b1f36cbf726ff164cfff | ['636197958cb749f99cd66365f2cd0d58'] | You could define the scm source files and then create a custom_command for each of them. This would create a .c file for each .scm file. The created files could be added to a list (e.g. named scm_c_files) and used in the add_executable command. Finally, the libraries used can be defined with target_link_libraries.
I don't know exactly how gsc and the corresponding incremental link file work, but if you could give the incremental link file a custom name (is there some sort of -o option for it?), it would simply be another add_custom_command that depends only on the .c files generated from the .scm files.
For example something like this:
add_custom_command(
OUTPUT incLink.c
gsc -link ${scm_c_files} -o incLink.c
DEPENDS ${scm_c_files}
)
A complete CMakeLists.txt could look something like this:
cmake_minimum_required(VERSION 3.17)
project(finalexec C)
set(CMAKE_C_STANDARD 99)
set(SCM_SOURCES m2.scm m3.scm)
set(scm_c_files)
foreach(scm_source ${SCM_SOURCES})
get_filename_component(file_c ${scm_source} NAME_WE)
set(file_c "${file_c}.c")
add_custom_command(
OUTPUT ${file_c}
COMMAND gsc -c ${CMAKE_CURRENT_SOURCE_DIR}/${scm_source}
DEPENDS ${scm_source}
VERBATIM
)
list(APPEND scm_c_files ${file_c})
endforeach()
add_custom_command(
OUTPUT incLink.c
COMMAND gsc -link ${scm_c_files} -o incLink.c
DEPENDS ${scm_c_files}
)
add_executable(finalexec m1.c ${scm_c_files} incLink.c)
target_link_libraries(finalexec gambit m dl util)
Test
Since I don't have gsc I just replaced the custom commands with an echo and a touch. If I run
cmake .
make
I get as output:
[ 12%] Generating m3.c
gsc -c /Users/stephan/kk/m3.scm
[ 25%] Generating m2.c
gsc -c /Users/stephan/kk/m2.scm
[ 37%] Generating incLink.c
gsc -link m2.c m3.c -o incLink.c
[ 50%] Building C object CMakeFiles/finalexec.dir/m1.c.o
[ 62%] Building C object CMakeFiles/finalexec.dir/m2.c.o
[ 75%] Building C object CMakeFiles/finalexec.dir/m3.c.o
[ 87%] Building C object CMakeFiles/finalexec.dir/incLink.c.o
[100%] Linking C executable finalexec
[100%] Built target finalexec
which seems to be what you're looking for.
|
34ebb87223fca677d4543f29869e894d73ad0ddaeb85d71a5f64c82d9196075f | ['63626598b056484fafbb5c6ef47f1ec5'] | If you find that PIL has problems on some platforms, using a native image viewer may help.
img.save("tmp.png") #Save the image to a PNG file called tmp.png.
For MacOS:
import os
os.system("open tmp.png") #Will open in Preview.
For most GNU/Linux systems with X.Org and a desktop environment:
import os
os.system("xdg-open tmp.png")
For Windows:
import os
os.system("powershell -c tmp.png")
| 9d2baff90aee0c53daf16c3142e22fdc6ce3c4635345ed22dd286b5aa8689961 | ['63626598b056484fafbb5c6ef47f1ec5'] | I'm trying to solve for the x-coordinates of the critical points of the function A(b) in WxMaxima (the GUI for Maxima), but it refuses to give a numerical solution. When I take the derivative, it leaves terms like d/db(1/2 * x) inside instead of evaluating them. How do I get Maxima to solve for all x-coordinates where the derivative of A(x) is equal to 0? Here is a minimal (pun intended) example of what I'm trying to do:
|
03cc86a57c7eaee95e7a83979f4fd153dc60812723ee5f2a84bb176df25794de | ['637ef89376a64665ad94b5c656b3f722'] | i reached here via google, though very late to the party, but hopefully can help someone.
in my case, the cause is simply because of a funny folder name in a certain parent folder, after i get rid of the special characters, they are all going fine by taking ownership normally via GUI.
| eaebef4ca49f3b4fa2048df116c6f8a9a96cf7bca77a6b5fefd1a2c786352268 | ['637ef89376a64665ad94b5c656b3f722'] | The "should" prefix is only acceptable because it's part of the framework's API.
It only makes sense in react because react expects some components to have it.
But in user land object oriented classes it doesn't make a lot of sense.
React asks you (the creator of the class) if the component should update, but in framework-less code it doesn't happen that frequently. |
ac4a97066c36d5e16e380cf76468ec120aa804a18c68928cf6ab4ad0079fffc3 | ['637f695064ef4ea9b1743ef77f407ecb'] | I am getting error like this when i run the application.I am using HttpClient,HttpEntity,HttpResponse and HttpPost in my MainActivity..so i made some modifications to gradle file.After that i am getting error like this.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: org/apache/http/ConnectionClosedException.class
i have also included multidex library and org.apache.http.legacy.jar in my app.but then also i am getting the same error.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.test1"
minSdkVersion 15
targetSdkVersion 23
multiDexEnabled true
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'org.apache.httpcomponents:httpcore:4.4.1'
compile 'org.apache.httpcomponents:httpclient:4.5'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.android.support:multidex:1.0.1'
compile files('libs/org.apache.http.legacy.jar')
compile 'org.apache.httpcomponents:httpmime:4.5.1'
}
I Know this question has been asked many times,but none of the solutions worked for me..
Can anyone please help me to resolve this one.
| b23dee4ed81ecf6b134949599af14579ca9613c5a62ba1b83c2a32733f64dd31 | ['637f695064ef4ea9b1743ef77f407ecb'] | i am having php file like this..
<?php
define('HOST','localhost');
define('USER','root');
define('PASS','123');
define('DB','123');
$mysqli = new mysqli(HOST,USER,PASS,DB);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$mysqli->query("SET NAMES 'utf8'");
//$sql="SELECT via,events,doc FROM profile";
$sql="SELECT via, doc FROM profile";
$result=$mysqli->query($sql);
while($e=mysqli_fetch_assoc($result)){
$output["response"][]=$e;
//json_encode($output) = str_replace("\/", '/', json_encode($output));/* not working*/
}
echo(json_encode($output));
$mysqli->close();
?>
it is giving response like this.
{"response":[{"via":"19156001882722","doc":"http:\/\/oursite\/propic_uploads\/58.png"},{"via":"sunil holla","doc":"propic_uploads\/Fantasia Painting(29).jpg"}]}
how can i get the above response like this.I mean how to replace the above response with this one.
{"response":[{"via":"19156001882722","doc":"http://oursite/propic_uploads/58.png"},{"via":"sunil holla","doc":"propic_uploads/Fantasia Painting(29).jpg"}]}
can anyone please help me to get this...
|
713480d777712dd31ebc72d835337bcf8e4fb9e9915b23f9e3f657d669a66411 | ['6385e48737084621adeb58919150d561'] | I am using a KeyboardAvoidingView to move a button up with the keyboard, within that I have a scrollview which keybordShouldPersistTaps is set to always, within the scrollview, I am using a Formik form. I still have to double click a button twice in order to get the keyboard to dismiss and submit my data. I have always tried to manually dismiss/handle the keyboard on the scrollview with no luck, Any other approaches I should try?
<KeyboardAvoidingView style={{ flex: 1 }} behavior={'padding'}>
<ScrollView contentContainerStyle={{ flexGrow: 1 }} keyboardShouldPersistTaps={'always'}>
<Formik
initialValues={this.state}
validationSchema={this.schema}
onSubmit={(values, actions) => {
actions.setSubmitting(false);
}}
render={({ handleBlur, handleChange, handleSubmit, values, isValid }) => {
return (
<View style={onboardingStyles.inputContainer}>
<View>
<Text theme={theme} style={onboardingStyles.headerText}>
{i18n.t('phone_verify')}
</Text>
<TextInput
activeHighlight
value={RizeCore.util.formatPhoneDOM(values.phone)}
onChangeText={(val: string) => {
const phone = RizeCore.util.parseOutDigits(val, 10);
return handleChange('phone')(phone);
}}
onBlur={() => handleBlur('phone')}
label={i18n.t('phone_number')}
style={onboardingStyles.input}
labelStyle={{ color: 'white' }}
keyboardType={Platform.OS === 'web' ? 'default' : 'number-pad'}
returnKeyType="done"
/>
</View>
<BottomFixedCTA
ctaLabel={i18n.t('phone_send_code')}
loading={smsCodeIsBusy}
disabled={!isValid}
onPress={handleSubmit as undefined}
onBackPress={this._navSignUp}
/>
</View>
);
}}
/>
</ScrollView>
</KeyboardAvoidingView>
| ee56139d2bf18a33e52596678555dcfbad0cb83024be0d2be807eb555c3733e3 | ['6385e48737084621adeb58919150d561'] | JSON code: http://headytunes.co/?json=1
I am trying to pull the author name, but only repeating the first author in the JSON list. I am also trying to pull the thumbnail image and the multiple categories that come up from this JSON, but I can't correctly pull the image or the tags.
HttpEntity entity = response.getEntity();
String data = EntityUtils.toString(entity);
Actors actor = new Actors();
JSONObject jsono = new JSONObject(data);
JSONArray jarray = jsono.getJSONArray("posts");
JSONObject jsonoTwo =jsono.getJSONArray("posts").getJSONObject(0).getJSONObject("author");
for (int i = 0; i < jarray.length(); i++) {
JSONObject object = jarray.getJSONObject(i);
actor = new Actors();
actor.setName(object.getString("title"));
actor.setDescription(object.getString("excerpt"));
actor.setDate(object.getString("date"));
actor.setAuthor(jsonoTwo.getString("name"));
//.setTags(jsonoThree.getString("title"));
//actor.setImage(images.getString("url"));
songList.add(actor);
|
2220869c0c447c173645f430ff50601527d273ab58a88c45a8f6ec7054989688 | ['638a8e9356664c3486130fb5e7e81e02'] | Let $\Delta=\{(x_1,\cdots,x_n)\in\mathbb{R}^n_{\ge 0}\,|\,a_1 x_1 + \cdots + a_n x_n \le 1\}$ (all the $a_i$'s are positive) be an $n$-simplex such that $(1,1,\cdots,1)$ is contained in the interior of $\Delta$. What is the smallest possible value of $\#(\Delta\cap\mathbb{Z}^2)$? Is it true that the number of lattices points in $\Delta$ is at least $\binom{2n}{n}$? Clearly the equality can be achieved when all the $a_i$ are sufficiently close to (but less than) $\frac{1}{n}$.
| 546f62cfeb143ed33c6166ac357dec62cba2bc6b82f24f2a973df498f9ee09af | ['638a8e9356664c3486130fb5e7e81e02'] | Generally, working independently means that you would be able to implement a full project, given only high-level instructions. Consider this more like project ownership, where you would carry out the full SDLC on your own:
meet with the client to develop requirements and get sign-off
create the system design and get approval
code the solution
perform your own testing and be able to lead the client through user testing sessions
deliver the product to Production
implement training if needed
perform maintenance
Granted, depending on the task, your work may represent a subset of the SDLC. Generally, though, you should be able to perform it on your own.
|
943ad8cc75f8ef70cf6a745844f760ea594f5ae9bdc4f75956586d0ad564531a | ['639194c8d0374f36966b7c39ebb62699'] | Why does this seem odd? What zone is there between tropical and temperate? I didn't feel the need to make a separate "subtropical" forest as that's not really a thing. If you look at east Asia, you will see that it goes from temperate forest in China to tropical rainforest in southeast asia with nothing in between. | fd525649d18357ace08c90fd76febe1f8a43bb1eb97363fd4878b486b379b405 | ['639194c8d0374f36966b7c39ebb62699'] | @javadba: Odd! I'm also running Mojave (10.14.6), and the following does work for me: 1) Right click on the file in Finder (on the desktop, in a folder) to bring up the menu. While the menu is open, hold Option, and the menu options change slightly. One of the options for me (for a file called `filename.txt`) is `Copy "filename.txt" as Pathname`. If that doesn't work for you, what numeric version of MacOS are you using? |
8e4bb1ac4593fbfa9987135261e4232db06314beae7f940fe7387250ed4a1a2d | ['63a02f55a80f4855879f781473292d9b'] | In my python program, I have a list of keys and values that are added to a text file and I need to be able to extract this string list and turn it into a dictionary.
For example:
counter = 0
add = str(counter)
counterDict = UserID + ": " + add + ", "
counter = counter + 1
#This should make counterDict look like: ""Smi39119": 0, "Joh38719": 1, " etc.
f = open("Dictionaries.txt","a")
f.write(counterDict)
f.close()
#Then I would like to be able to open the file and turn that string into a dictionary
f = open("Dictionaries.txt","r")
string = f.read()
#This way 'string' should still be a string, but look like this: "{"Smi39119": 0, "Joh38719": 1, }"
I do not know if this is possible, but if it is, all solutions would be greatly appreciated.
| f9ad71e313494d5e4e7cefa248c560cbc152b7b2f1f6f1ac2dbb99d1e9d0e809 | ['63a02f55a80f4855879f781473292d9b'] | I'm creating code that creates new user identifications for users, and then adds all their account details to a dictionary and then adds this dictionary to another dictionary of all the accounts.
My problem is that I need each of these 'accounts', per say, need to be named after the user ID's that are generated.
So for example, the user ID created for someone is "Jo23219" and their 'account' is a dictionary:
account = {
"user": "Jo23219",
"pass": "password",
"status": "silver",
}
But instead of the dictionary being named "account", I need it named "<PERSON>".
I understand this question has been asked before, but they have been answered with the use of dictionaries or lists, which would be fairly inconvenient for what I'm trying to achieve.
Is it possible to do this without dictionaries or lists?
|
ce9ef72042ec2b702985b487e2fee1ae59d0e4a6b3b95262dc1462eb0b0e8bb6 | ['63b11ad3ff0b464cb33f73d79b5288f6'] | In my application, i have 2 class, one class for the portail ( RootViewController), and one class ( MainViewController ) ( in a navigation controller ) for sending request to a webservice.
When i start the application, i fill some textfield, then i push to my other class with this code:
MainViewController *mainViewController = [[MainViewController alloc] initSpecial:0];
navController =[[UINavigationController alloc] initWithRootViewController:mainViewController];
self.view.frame = [[UIApplication sharedApplication].windows.lastObject frame];
[self.view addSubview:navController.view];
And i send my request to the webservice.
ConnectionDidFinishLoading receive the response from the server, everything is fine.
Then i want to come back, to my first class i do :
RootViewController *rootViewController = [[RootViewController alloc] init];
[self.navigationController pushViewController:rootViewController animated:YES];
Now i try to repeat this process, but this time, when i am in the second class for sending my request, the request does not go completely and so does not go throw ConnectionDidFinishLoading.
I guess there is a problem, my request in the second class must be on a thread, and i probably do not move between class properly.
If you have an idea, please tell me.
| ca3a727eb1791a921a45b41e39cc146698aa9e73206c78a8471fdbf9caa0722b | ['63b11ad3ff0b464cb33f73d79b5288f6'] | How to move a label?
i would like to show a song title, moving from right side to left side with a duration that i can set. as you can see on a car radio. when the label if off the screen it should reappear from the right side
thank you
|
73e75e663cd2e1d9f3acc6245c185f719b7cd59b4854bc9fbb7ad4bcd4734bc7 | ['63cf57027a7f42eebe6722fa7fce1b1f'] | I have a class wrapper around posix mutex called LockGuarrd. it was used for a long time and now I was asked to create another class MyModuleLockGuard that wraps the original wrapper. the new class should now be used in my module
Is it possible to generate a compilation error in every place that uses the Original LockGuard in my module? I want other people developing not to accidently use it in the future
the code is one huge process and each module is a separate code directory. its all being compiled to 1 executable. I am not allowed to change that
the code is all cpp/c compiled with gcc via makefile and scons
| 77c023e147c2a494941894bed6a6013bfc72206ff1aca7422a63d2530eeae700 | ['63cf57027a7f42eebe6722fa7fce1b1f'] | I have a class (lets call it checker) and diffrent kind of classes that execute tasks (lets call them tasks). each tasks belongs to several categories
each task runs and at some point asks checker if they are allowed to do something. checker answers according to system state and according to their category. a task can be in multiple categories
how would you implement that? (cpp but I don't really think its language specific).
I was thinking adding a list of categories in each task and have a function that gets a category and answers if the task belongs to it.
class checker {
bool is_allowed(Task * task);
}
class Task
{
bool is_belongging_to_category(Category cat);
void some_task_to_do()
{
...
if (checker<IP_ADDRESS>is_allowed(this)) { ....}
else {....}
}
}
Is there a better way to solve this? Maybe some known design pattern...
|
15c60482c2ef14d5aea60422eb536d8e0e8998980212b901f36abed49711b2c7 | ['63d070b6cbd843898fbd8cb3ac277eba'] | I am trying to make simple webapp where an element can be clicked or hold to call different function.
$(document).on("click",'.element', function() {
clickFunction();
});
let timeoutId = 0;
$(document).on('pointerdown','.element', function() {
timeoutId = setTimeout(holdFunction, 500);
}).on('pointerup pointerleave', '.element', function() {
clearTimeout(timeoutId);
});
And it was tested and worked fine on Chrome, Firefox and mobile Chrome.
The problem is that on mobile Firefox the 'pointerdown' event is not called at all and i don't really know why.
| 88904ae4bbf7d3a76620fd9702237795bad1553aafd8ef02f706befeaedd72b4 | ['63d070b6cbd843898fbd8cb3ac277eba'] | Hi i am making my first steps in CUDA technology but i think i do not get it right.
I am trying to multiply two dimensional array by vector but something is not working
Here is the code I am trying to figure out:
#include <stdio.h>
#include <stdlib.h>
#define N 2
__global__ void Multiply(int A[N][N], int B[N], int C[N]){
int i = threadIdx.x;
int j = threadIdx.y;
int sum = A[i][j] * B[j];
C[i]= sum;
printf("%d,%d ", sum, C[i]);
}
int main(){
int A[N][N] ={ {1,1},
{1,1}
};
int B[N] = {4,6};
int C[N] = {0,0};
int (*aA)[N], (*aB), (*aC);
cudaMalloc((void**)&aA, (N*N)*sizeof(int));
cudaMalloc((void**)&aB, (N)*sizeof(int));
cudaMalloc((void**)&aC, (N)*sizeof(int));
cudaMemcpy(aA, A, (N*N)*sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(aB, B, (N)*sizeof(int), cudaMemcpyHostToDevice);
cudaMemcpy(aC, C, (N)*sizeof(int), cudaMemcpyHostToDevice);
int numBlocks = 1;
dim3 threadsPerBlock(N,N);
Multiply<<<numBlocks,threadsPerBlock>>>(aA,aB,aC);
cudaMemcpy(C, aC, (N)*sizeof(int), cudaMemcpyDeviceToHost);
cudaFree(aA);
cudaFree(aB);
cudaFree(aC);
printf("\n");
system("pause");
}
in this case the Output is : 4,6 4,6 6,6 6,6 so basically the sum i giving the right values but C[i] is returning always 6 although there is sum value assigned to it.
What am I doing wrong?
|
bef806be2cac648d2d306b4bf89a4ba3fa10604d796f23d32ff4830ec18e8620 | ['63d951d185a2456cb6ad7336982d7504'] | Exactly. My theory was that its only making it to "the router" because the wireless card in the will-Inspiron-7520 doesn't have support for what you are trying to do. I only say this because I tried something similar a while back and ran into this limitation. If you are able to plug into the <IP_ADDRESS>\24 with an Ethernet cable and use that interface you should have better luck. Basically with most wireless cards you cant be connected as a client to the network you are trying to route to. There just isnt enough interfaces. You would have to use one to send and one to recieve. Hope that helps | 0b14d587156091cc40534caeead4c2a5abb9d3fd07940bf1cd0ac5a07132f765 | ['63d951d185a2456cb6ad7336982d7504'] | Thanks to <PERSON> I found this tutorial that works great
https://www.howtoforge.com/how-to-set-up-software-raid1-on-a-running-system-incl-grub2-configuration-ubuntu-10.04
basically the instructions are as follows:
1.) Change the partition type --> fdisk /dev/sdd --> press t, select partition, l to list codes, looking for "Linux raid setup" usually fd
2.) Do the above for every volume you plan to add --> fdisk /dev/sda | t | 1 | fd
3.) Zero the superblock of the devices --> mdadm --zero-superblock /dev/sdd4
4.) Create the raid device --> mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdd4 /dev/sda1
5.) check to make sure device exists --> cat /proc/mdstat --> should now see your raid device
6.) Create filesystems on our raid array --> mkfs.ntfs /dev/md0
7.) Mount raid array --> mount /dev/md0 /srv
8.) I recommend a benchmark for your array so you have an idea if something is going wrong
|
13caf68f9ffba5560482dd7b4391e4e29698da3000d8ae39ec79c30cb09e7ab6 | ['63e2a1ab896a4fa28201f9096cb2f209'] | I'm working on a budgeting app. I have a component that holds values I would like to pass to an array that is stored in it's own file. I am able to get data from the array but I can't seem to figure out how to push data into the array.
Is there a way to even do this or would I have to create another component and store the array in that component?
input.component.ts
import { Component, OnInit, Input } from '@angular/core';
import { USERS } from '../mock-users';
import { Users } from '../Users';
//import { Users } from '../Users';
@Component({
selector: 'app-input',
templateUrl: './input.component.html',
styleUrls: ['./input.component.css']
})
export class InputComponent implements OnInit {
@Input() description: string;
@Input() date: Date;
@Input() amount: number;
@Input() category: string;
constructor() { }
ngOnInit() {
}
addExpense() {
console.log('expense added');
}
}
mock-users.ts
import { Users } from './Users';
export const USERS: Users[] = [
{
id: 1,
name: '<PERSON>',
username: 'keenan.kaufman',
password: 'admin',
expenses: [{
//var myDate = new Date('2019-5-2T00:00:00');
date: new Date('2019-5-2T00:00:00'),
description: 'Electric Bill',
amount: 42,
category: 'Utilites'
},
{
date: new Date('2019-5-2T00:00:00'),
description: 'Rent',
amount: 350,
category: 'Rent'
}]
}
];
| 2072635b15da398fa06301dbe7af87b0f8db657f603147bc99bca22a09c42578 | ['63e2a1ab896a4fa28201f9096cb2f209'] | I am still pretty new to Assembly and currently taking an introductory class at my local community college.
One of the requirements for our assignments was to use macros to print text and take in user input.
I am pretty sure my printing code is right:
displayString MACRO message:REQ
<PERSON>, message
push eax
call printf
add esp, 4
ENDM
I am confused though on how I would go about getting the user input. Here is what I have so far:
obtainString MACRO input:REQ, msgformat:REQ
<PERSON>, input
push eax
<PERSON>, msgformat
push eax
call scanf
add esp, 8
ENDM
Because the macro is a separate file, I am pretty sure the variables do not transfer to my main file. I am just wondering how would I transfer the contents of 'input' from the macros file to a variable in my main file.
Thank you.
Side note: For some reason my project will not compile because it cannot find the macros file although it is in the same folder as the main file.
|
03bf0f1c389b41720461a4cd9ffad1eee5cdc76b18c0c603a08282b42fd7e063 | ['63e44414a17e422e9d667822bc53790a'] | I have a csv file with a column where the integers are over 16 characters long. The issue with this is that it changes the integer to a short abbreviation example: 8.71688E+17, is there a way in c# you can convert it back to a long integer without having to modify the csv file itself?
I currently convert the CSV file to a datatable, could there be a way at the conversion stage?
| 8724ce3796ae401900493fc9b7c4b5c17e7d06c6cffe912a529023e5ad6bda3f | ['63e44414a17e422e9d667822bc53790a'] | Does anyone know how to convert OracleDateTime to System.DateTime?
I was able to convert OracleNumber to double via a directcast, however does not compute with datetime?
What I have tried:
Dim oDateTime As OracleDateTime = (DataRow)oRow("Date")
Dim vDateTime As DateTime
vDateTime = Convert.ToDateTime(DirectCast(oDateTime, OracleDateTime))
Any help would be appreciated
|
3b77d9fe556973579b95c96871de45007be0b10618936cd0b1c5eccbc6b55e3e | ['63ed6c82e0844b408c746238ea016a4f'] | Discretising the PDE $$u_{t} = u_{x}$$ using FE on time ($k$), BE on space ($n$) yields
$$\frac{u^{k+1}_{n+1} - u^{k}_{n+1}}{\tau} = \frac{u^{k}_{n+1} - u^{k}_{n}}{h}$$
Now rewrite so you have $u^{k+1}_{n+1}$ on the RHS, everything else on the LHS. | c244980a37406b63a19d69acd3914d66f0d8661e3cecd7f54cc544731e723fd1 | ['63ed6c82e0844b408c746238ea016a4f'] | To do that, you would need to write your ODE as a [first order system](https://en.wikipedia.org/wiki/Ordinary_differential_equation#Reduction_to_a_first-order_system) before you applied any numerical scheme. This is usually a better approach than discretising the full ODE directly (I think, though I may be remembering wrong) as it provides better stability properties. |
ad3440f946ada36e0671c5fe21c4f2bcdeb14c58b8b9202bd6d631210a1f06d3 | ['63fb76e87e3147b791d8ae9bb823fcf7'] | Suppose I wish to read about wait syscall. Typing man wait would only give the manual entry for wait as in shell, not in syscall. However if I type man waitpid, I would get the manual entry for wait as they are inside the same page.
How do I specify which manual entry is desired in a case like this?
| 86a445ce7623d938bf30a0124bf0eb8933dea9c55898e104bec867a4f4a098cb | ['63fb76e87e3147b791d8ae9bb823fcf7'] | A very good comment but on my router (bbox3 provided by the telecom operator) I can not configure much. I have only a user account and not an admin account for my router and the things I can do are very limited. So I cannot set fixed IP addresses for certain mac addresses. |
501fe7d9e0f72254269d9e35d39559d476e3322d286e512fc5e3d623fa8db119 | ['63fb87aaa6ad4beaa7d4684cd9f6908a'] | I need to stand up a test domain to try and fix accounts that have been synced into AAD. I have had zero experience with Azure AD or O365, so I'm not sure how to proceed.
A previous admin setup our company's O365 account and setup AD Connect, apparently without ever reading up or testing. AD here has been a mess.
I am the 4th person to inherit this mess. All the previous admins had their idea of the proper AD structure and best practices for groups and group policy. I've spent the better part of a year putting out fires and replaced a couple DCs and cleaned up ghosts of DCs past. We have not had any replication issues in 6 months, so I feel confident in moving forward with trying to get O365 working.
======================
The problem(s):
Accounts that are synced have user@company.local names
and do not allow us to log into O365.
The only working accounts have been created in the cloud
using their email addresses.
My plan:
Setup a new DC (Hyper-V)
Allow it to replicate.
Shutdown DC and clean up AD so there are no ghosts left.
Bring the DC up in an isolated network.
Setup a trial O365 account.
Sync AD to trial account.
Try to fix the problems we have in our production domain.
======================
Here is where I have questions.
I need to allow this test domain to have access to the internet and O365.
Will I be able to setup a trial O365 account and setup AD connect to sync just like the production domain?
Will I be able to setup a hybrid Exchange environment to test moving mailboxes to the cloud in a trial?
The IDfix tool says I need to fix ProxyAddresses. Do I set it to our users SamAccountNames or email addresses.
I'm probably missing a lot here. Please let me know what I've missed and where I need to be looking.
Thanks for your help!
dot19408
| b31c90e2582a96e02aca7239493bb60f05a22f73db21ea37db1f83c58490ba4a | ['63fb87aaa6ad4beaa7d4684cd9f6908a'] | I.e. is the function $y=b^{kx}$ an eigenfunction for the derivative operator $\frac{dy}{dx}$, where k is a constant because the derivative of such a function is ${k\ln(b)}b^{kx}$, which is a constant ($k\ln(b)$) times the original function ($b^{kx}$.) Does it even make sense to say this? If it does, are there any other such eigenfunctions for the derivative operator?
|
0e09fbff96bc0596e51ebf2820fc635a5afaab74e3b81ede30d2e37044ba7f4f | ['640631a594c0451cb3ffbedac945cb13'] | Absolutely you can! This is the beauty of a many to many relationship, in fact the example at http://laravel.com/docs/4.2/eloquent#many-to-many has the User and Role classes both set with belongsToMany. Thought being in that case (and sounds like in yours as well) that a user can have multiple roles and each role can be associated with multiple users.
Regarding your last two questions, the only part that gave me pause is the use of a role_id within the pivot table. The code you provided doesn't go into detail on what purpose that serves. As long as the User would only ever have one role associated with an Org this is fine, but if it could ever be more than one I would recommend another table to hold that User to Org role relationship.
| f285324a4c4d78875f4bfdb74c95edd2f69924c6544a4726c8e9218ed5ad7723 | ['640631a594c0451cb3ffbedac945cb13'] | All previously mentioned concerns (loading into PHP memory and the availability of mysqldump) aside, there's also an error in the script that only returns the data for the last table. The line $return=""; needs to be outside and before the foreach loop it's in. Something like:
<?php
backup_tables('localhost','root','','dbname');
/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);
$return="";
//get all of the tables
if($tables == '*')
{
$tables = array();
$result = mysql_query('SHOW TABLES');
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
//cycle through
foreach($tables as $table)
{
$result = mysql_query('SELECT * FROM '.$table);
$num_fields = mysql_num_fields($result);
//print_r($num_fields);exit;
$return.= 'DROP TABLE '.$table.';';
$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
$return.= "\n\n".$row2[1].";\n\n";
for ($i = 0; $i < $num_fields; $i++)
{
while($row = mysql_fetch_row($result))
{
$return.= 'INSERT INTO '.$table.' VALUES(';
for($j=0; $j<$num_fields; $j++)
{
$row[$j] = addslashes($row[$j]);
// $row[$j] = preg_replace("\n","\\n",$row[$j]);
$row[$j] = preg_replace("/(\n){2,}/", "\\n", $row[$j]);
if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
if ($j<($num_fields-1)) { $return.= ','; }
}
$return.= ");\n";
}
}
$return.="\n\n\n";
}
//save file
$handle = fopen('db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
// print_r($handle);exit;
fwrite($handle,$return);
fclose($handle);
}
?>
|
64d93d615e385eebf1431a9b32662ee18d03a2a820edf3992d0e83531f1e24a7 | ['6429216000614d5db91780b1cfe3a0d2'] | Yes, Kind of. I used <PERSON>'s rule and calculated that voltages at O1 and O2 are indeed equal. But I am still not quite sure what you exactly meant by calculating them as functions of voltages at A and B. In fact I didn't need to use the voltage of node B as a variable to show that V of O1 and O2 are the same using <PERSON>. | 0db88762b2d16165ca7843e4f673508e758d963ab9f24cdc5d2a9e57946a4f83 | ['6429216000614d5db91780b1cfe3a0d2'] | trato de insertar una imagen a traves de hooks de react.js cuando lo hago resulta que la imagen no aparece entonces quisiera saber en que me estoy equivocando.
import React, {useState} from 'react';
import NavigationItems from "./NavigationItems/NavigationItems";
import classes from "./Header.module.css";
import Logo from "../../LogoComp/Logo.js";
const Header = () => {
const [useSrc] = useState(["src/assets/Logo.png"])
const [useAlt] = useState(['Logo-Blog'])
return (
<header className={classes.Header}>
<Logo Link="/"
src={useSrc}
alt={useAlt} />
<NavigationItems></NavigationItems>
</header>
);
}
export default Header;
|
58f1307f149c5f6a4ebe11d15086de3b20278077435d1c68daf8b0dd6026f83d | ['64349527998f470abb8f19b1cb8d4510'] | I was looking at the latest update to the ShowYou application, and the parallax effect they have implemented is absolutely amazing. I am playing around with UITableView and UIScrollView to see if I can sort of mimic it, but I wanted to see if I could touch base with some other folks to see how they would do it.
Any thoughts?
| 3f81d55da2d818e33542101e67eb49457e66d6123df1dd58056fca94db6e691a | ['64349527998f470abb8f19b1cb8d4510'] | So, in case anyone runs into the same issue, I ended up toggling the Background between NULL and Transparent. It's kind of a hack, but WPF Routing (Yes I am going to hate) is a huge headache. I'll probably run into performance issues later (maybe not), but I am able to avoid traversing the tree.
|
3f628761448ef864150b00591d9cc3e8a85c6019acd74b0c5509ea3135854e89 | ['643c42e639ca447b9fa1520a6d2b06c0'] | I'd like to order values with two decimals/periods and wondering if there's CAST/Convert datatype that will allow me to do this. Values are currently something like this:
1.11.1
1.11.10
1.11.11
1.11.2
1.11.21
1.11.3
I'd like them to be ordered like the following:
1.11.1
1.11.2
1.11.3
1.11.10
1.11.11
1.11.21
| da4f8bc1b47c32964f25e69e88f101c433ca0a573bed5020d28c7ea2ef42c906 | ['643c42e639ca447b9fa1520a6d2b06c0'] | I have a case statement within a select returning many values, but I only want the first value since I'm doing a Count.
SELECT DISTINCT
ATM.TicketID
,COUNT(CASE WHEN ((ATM.PriorityID='E' OR ATM.PriorityID='U') AND
MAX(ATQ.QuestionID) THEN 1 END)) AS [A]
.....
For each 'E' and 'U' value, there are many QuestionID's (joined from another table). But I only need one QuestionID for each E or U.
I'm having difficulty with nested aggregates.
|
b931c7bd7b91ab0fee4f91880f37202f8668e49b5f4941d2bfe0dbb26764fc7a | ['644fb187e09746439770869dd74e3638'] | If you want to get some parameters of class A within class B, you need to have an instance of class A inside B.
You can create an object of A, or pass it with the B constructor,...
for example:
class AbstractScreen extends StatefulWidget {
final Spacecraft valueAbstractAll;
AbstractScreen({Key key, this.valueAbstractAll}) : super(key: key);
@override
_AbstractScreenState createState() => _AbstractScreenState();
}
class _AbstractScreenState extends State<AbstractScreen> {
.....
}
class CustomListView extends StatelessWidget {
//here I create the instance of AbstractScreen, you can initialize abstractScreen on constructor
AbstractScreen abstractScreen = new AbstractScreen();
final List<SpacecraftAbstract> spacecrafts;
CustomListView(List<SpacecraftAbstract> spacecraftsAbstract,) :
spacecrafts = spacecraftsAbstract.where((SpacecraftAbstract)
=> SpacecraftAbstract.id_conference == abstractScreen.valueAbstractAll.id /*get valueAbstractAll of AbstractScreen instance*/ )
.toList();
Widget build(context) {
return ListView.builder(
itemCount: spacecrafts.length,
itemBuilder: (context, int currentIndex) {
return createViewItem(spacecrafts[currentIndex], context);
},
);
} ..............
| aa022cd19cd07fd90cbf4057768d4a9032d5c7154713b8c5b4d354af0ef35aff | ['644fb187e09746439770869dd74e3638'] | To align the widget within a Row or Columns, we can use these parameters inside Row or Columns.
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
Row:
mainAxisAlignment determine horizontally align the path
crossAxisAlignment determine vertically align the path
Column:
mainAxisAlignment determine vertically align the path
crossAxisAlignment determine horizontally align the path
|
89f7e38ebd1cf7c288e679fbb7f63908cb13dab9e56917491a6841a04dd139b9 | ['64536c49362443c39ebcf404dc65aead'] | i'd like to create a large pdf (not typical page size) with long lines, max ~1000 characters / line, where the page size and font are such that no lines need to wrap.
the intention is not for the text in this document to be readable when the full page is viewed on any reasonably-sized monitor -- instead the reader can zoom to individual portions of interest within the document.
i attempted this with a small font in latex, but no success.
any help is greatly appreciated. thanks.
| b64f4ef0f99ca7a897553d43027a8a59d4380243735a7385af1ffc999db7a337 | ['64536c49362443c39ebcf404dc65aead'] | It should be 'across' the globe, not 'on' the globe. If you are 'on' a globe you are on just ONE spot, but if you go 'across' a globe, now you are talking about many countries. I would say "we arguably have" not "have arguably". Should be "the highest number" of graduates. I'm not crazy about the entire sentence though. I would either break it into two sentences as two distinct thoughts OR state your country is 'blessed" BECAUSE you have the highest number of graduates. Depends upon what your point is.
|
0f6f06f10b4b6f50bf55a19496dd5d925228121322ee98496c519e91f80d9dde | ['645887b14ff745ed80fbf0ceba91e9eb'] | I came across some code that boils down to the following:
enum BAR { /* enum values omitted */ }
class Foo{
public:
void set(const BAR& bar);
private:
uint32_t bits;
};
void Foo<IP_ADDRESS>set(const BAR& bar)
{
(uint32_t&)bits = bits | bar;
}
I don't understand the point of the c-style cast in the assignment in Foo<IP_ADDRESS>set. Why would you cast the lhs of an assignment? Am I crazy, or does this have a purpose?
| aa3f2b382e2d6318f3ff1bbdafd59752b23ba323697aa6ccf270d002c8adadd9 | ['645887b14ff745ed80fbf0ceba91e9eb'] | Also there's a second contradiction in that her descriptions of accio do not match what would happen if objects were to travel at near light speed. Such speeds are not visible to the human eye, obviously, so if accio was near the speed of light, it would look like instantaneous teleportation, not the object "zooming" towards the caster like she writes. It would also make a sonic boom because "near the speed of light" is much faster than the speed of sound. Furthermore, I think it likely even inanimate objects would be destroyed by such sudden and extreme acceleration. |
78515561485a796ef36d896d79afa3298b71eebe93721f85cee580644dce20ae | ['645e1b7c90ee406aa9c3c79943e866ff'] | Всем привет, стоит задача сделать так,чтобы пока пользователь находится на сайте в фоне выполнялся php скрипт, который никак не должен мешать взаимодействовать пользователю с сайтом(скрипт будет ждать некоторое время а потом делать 2 запроса к бд), при этом если пользователь выйдет с сайта, выполнение должно прекратиться, а если перейдёт на другую страницу, то скрипт не должен начать выполняться снова.
| aea004c1f93484107718ee3f307da0ac274aa88fbc0f06d8b4fbbbe9b158ca00 | ['645e1b7c90ee406aa9c3c79943e866ff'] | Hi <PERSON>, thanks for the reply! Never tried SpinRite but i will go check out. And for the freeze i can confirm that it really works. Btw i've built a simple usb-fan with a 10cm chassis fan that can cool down hdd when stress copy are in progress. |
3a62441b69ede6b73997d8137bca89b5b3bd9e01b38b15fe842c2faffb5c209a | ['646b0a62a808463c8233e328da501c30'] | I got the solution myself, this is the solution.
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 1 && resultCode == RESULT_OK) {
Uri url = data.getData();
DatabaseReference messageRef = FirebaseDatabase.getInstance().getReference().child("Messages").child(currentUserId).child(otherUserId).push();
final String messageId = messageRef.getKey();
DatabaseReference notificationRef = FirebaseDatabase.getInstance().getReference().child("Notifications").child(otherUserId).push();
final String notificationId = notificationRef.getKey();
final StorageReference file = FirebaseStorage.getInstance().getReference().child("message_images").child(messageId + ".jpg");
file.putFile(url).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
@Override
public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
file.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
@Override
public void onSuccess(Uri uri) {
String imageUrl = uri.toString();
Map messageMap = new HashMap();
messageMap.put("message", imageUrl);
messageMap.put("type", "image");
messageMap.put("from", currentUserId);
messageMap.put("to", otherUserId);
messageMap.put("timestamp", ServerValue.TIMESTAMP);
HashMap<String, String> notificationData = new HashMap<>();
notificationData.put("from", currentUserId);
notificationData.put("type", "message");
Map userMap = new HashMap();
userMap.put("Messages/" + currentUserId + "/" + otherUserId + "/" + messageId, messageMap);
userMap.put("Messages/" + otherUserId + "/" + currentUserId + "/" + messageId, messageMap);
userMap.put("Chat/" + currentUserId + "/" + otherUserId + "/message", "You have sent a picture.");
userMap.put("Chat/" + currentUserId + "/" + otherUserId + "/timestamp", ServerValue.TIMESTAMP);
userMap.put("Chat/" + currentUserId + "/" + otherUserId + "/seen", ServerValue.TIMESTAMP);
userMap.put("Chat/" + otherUserId + "/" + currentUserId + "/message", "Has send you a picture.");
userMap.put("Chat/" + otherUserId + "/" + currentUserId + "/timestamp", ServerValue.TIMESTAMP);
userMap.put("Chat/" + otherUserId + "/" + currentUserId + "/seen", 0);
userMap.put("Notifications/" + otherUserId + "/" + notificationId, notificationData);
FirebaseDatabase.getInstance().getReference().updateChildren(userMap, new DatabaseReference.CompletionListener() {
@Override
public void onComplete(DatabaseError databaseError, DatabaseReference databaseReference) {
sendButton.setEnabled(true);
if (databaseError != null) {
Log.d(TAG, "sendMessage(): updateChildren failed: " + databaseError.getMessage());
}
}
});
}
});
}
});
}
}
| fb636b0bd47482c6972f55074d8653bab4e628c009c6439954e37b765f08ffdf | ['646b0a62a808463c8233e328da501c30'] | I am trying to make a Virtual Assistant and for that i am using gtts but when i am trying to run my code am stuck with this errors, is there any way to get around? I have tried everything but did not succeed, this problem occurs in all my projects when i use gtts
Errors -
Traceback (most recent call last):
File "/Users/ashvinbhagat/Downloads/TARS-master/tars.py", line 177, in <module>
talk("TARS activated!")
File "/Users/ashvinbhagat/Downloads/TARS-master/tars.py", line 24, in talk
text_to_speech.save("audio.mp3")
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts/tts.py", line 111, in save
self.write_to_fp(f)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts/tts.py", line 124, in write_to_fp
'tk' : self.token.calculate_token(part)}
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts_token/gtts_token.py", line 28, in calculate_token
seed = self._get_token_key()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gtts_token/gtts_token.py", line 61, in _get_token_key
tkk_expr = re.search(".*?(TKK=.*?;)W.*?", line).group(1)
AttributeError: 'NoneType' object has no attribute 'group'
Code -
from gtts import gTTS
import speech_recognition as sr
import re
import time
import webbrowser
import random
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import smtplib
import requests
from pygame import mixer
import urllib.request
import urllib.parse
import json
import bs4
def talk(audio):
"speaks audio passed as argument"
print(audio)
for line in audio.splitlines():
text_to_speech = gTTS(text=audio, lang="en-uk")
text_to_speech.save("audio.mp3")
mixer.init()
mixer.music.load("audio.mp3")
mixer.music.play()
def myCommand():
"listens for commands"
# Initialize the recognizer
# The primary purpose of a Recognizer instance is, of course, to recognize speech.
r = sr.Recognizer()
with sr.Microphone() as source:
print("TARS is Ready...")
r.pause_threshold = 1
# wait for a second to let the recognizer adjust the
# energy threshold based on the surrounding noise level
r.adjust_for_ambient_noise(source, duration=1)
# listens for the user's input
audio = r.listen(source)
print("analyzing...")
try:
command = r.recognize_google(audio).lower()
print("You said: " + command + "\n")
time.sleep(2)
# loop back to continue to listen for commands if unrecognizable speech is received
except sr.UnknownValueError:
print("Your last command couldn't be heard")
command = myCommand()
return command
def tars(command):
errors = ["I don't know what you mean", "Excuse me?", "Can you repeat it please?"]
"if statements for executing commands"
# Search on Google
if "open google and search" in command:
reg_ex = re.search("open google and search (.*)", command)
search_for = command.split("search", 1)[1]
print(search_for)
url = "https://www.google.com/"
if reg_ex:
subgoogle = reg_ex.group(1)
url = url + "r/" + subgoogle
talk("Okay!")
driver = webdriver.Firefox(executable_path="/path/to/geckodriver")
driver.get("http://www.google.com")
search = driver.find_element_by_name("q")
search.send_keys(str(search_for))
search.send_keys(Keys.RETURN) # hit return after you enter search text
# Send Email
elif "email" in command:
talk("What is the subject?")
time.sleep(3)
subject = myCommand()
talk("What should I say?")
message = myCommand()
content = "Subject: {}\n\n{}".format(subject, message)
# init gmail SMTP
mail = smtplib.SMTP("smtp.gmail.com", 587)
# identify to server
mail.ehlo()
# encrypt session
mail.starttls()
# login
mail.login("username_gmail", "password_gmail")
# send message
mail.sendmail("FROM", "TO", content)
# end mail connection
mail.close()
talk("Email sent.")
# search in wikipedia (e.g. Can you search in wikipedia apples)
elif "wikipedia" in command:
reg_ex = re.search("wikipedia (.+)", command)
if reg_ex:
query = command.split("wikipedia", 1)[1]
response = requests.get("https://en.wikipedia.org/wiki/" + query)
if response is not None:
html = bs4.BeautifulSoup(response.text, "html.parser")
title = html.select("#firstHeading")[0].text
paragraphs = html.select("p")
for para in paragraphs:
print(para.text)
intro = "\n".join([para.text for para in paragraphs[0:3]])
print(intro)
mp3name = "speech.mp3"
language = "en"
myobj = gTTS(text=intro, lang=language, slow=False)
myobj.save(mp3name)
mixer.init()
mixer.music.load("speech.mp3")
mixer.music.play()
elif 'stop' in command:
mixer.music.stop()
# Search videos on Youtube and play (e.g. Search in youtube believer)
elif "youtube" in command:
talk("Ok!")
reg_ex = re.search("youtube (.+)", command)
if reg_ex:
domain = command.split("youtube", 1)[1]
query_string = urllib.parse.urlencode({"search_query": domain})
html_content = urllib.request.urlopen(
"http://www.youtube.com/results?" + query_string
)
search_results = re.findall(
r"href=\"\/watch\?v=(.{11})", html_content.read().decode()
)
# print("http://www.youtube.com/watch?v=" + search_results[0])
webbrowser.open(
"http://www.youtube.com/watch?v={}".format(search_results[0])
)
pass
# weather forecast in your city (e.g. weather in London)
# please create and use your own API it is free
elif "weather in" in command:
city = command.split("in", 1)[1]
#openweathermap API
url = 'http://api.openweathermap.org/data/2.5/weather?q={}&appid=your_api_key&units=metric'.format(city)
response = requests.get(url)
data = response.json()
#print(data)
temp = data['main']['temp']
round_temp = int(round(temp))
talk('It is {} degree celcius in {}'.format(round_temp, city))
time.sleep(3)
elif "hello" in command:
talk("Hello! I am TARS. How can I help you?")
time.sleep(3)
elif "who are you" in command:
talk("I am one of four former U.S. Marine Corps tactical robots")
time.sleep(3)
else:
error = random.choice(errors)
talk(error)
time.sleep(3)
talk("TARS activated!")
# loop to continue executing multiple commands
while True:
time.sleep(4)
tars(myCommand())
Please help me, what i am doing wrong or what should i do?
|
4307a20c3eb155bf3bdfb12fee4b01dcbcf58dc30da35f85906d1bf400c67939 | ['646b8db12e22465b924f40fe1b4e50ba'] | This is definitely doable with props.
In parent component
<template>
...
<router-view :profile="myDataObject.profile" />
...
</template>
In child component
<script>
export default {
name: "child",
props: ["profile"]
...
Now, in your child component you may access the data by referring to this.$props.profile.
I am using this pattern with Vue 2.5.16. and Vue Router 3.0.1.
PS: A good option is to also use vuex for such scenarios.
| 0888ffaf9c00bee8ed420759fd450b138a81d96fe06a4331551a72af3329381e | ['646b8db12e22465b924f40fe1b4e50ba'] | I've faced exactly the same problem and it took some digging, but the solution is quite simple.
Solution
You cannot use use outbound connections on port 25 in your Cloud Function.
So I've changed port to 465 and used secure connection and it does work.
I have (randomly) found a mention of this at Tips & Tricks documentation page.
PS: The same limitation applies to Compute Engine (see docs).
|
0cf1fee5469eabdbed07ce23ef10d0aa0b159813f984c97a227cbe8771e0116f | ['6470e332124f420db65ef5f04f2823bc'] | I have 2 tables "srot_data" and "vada"
CREATE TABLE `srot_data` (`ID` int(10) NOT NULL,Datum` datetime DEFAULT NULL,`ID_obsluha` int(10) DEFAULT NULL,`Linka` varchar(10) DEFAULT NULL,`Kontejner` varchar(10) DEFAULT NULL,`Vada` int(10) DEFAULT NULL,`m_srot` decimal(8,3) DEFAULT NULL,`m_pres` decimal(8,3) DEFAULT NULL,`blok` int(10) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `vada` (`ID` int(10) NOT NULL,`Cislo` int(10) DEFAULT NULL,`Popis` varchar(50) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Sample data:
INSERT INTO `srot_data` (`ID`, `Datum`, `ID_obsluha`, `Linka`, `Kontejner`, `Vada`, `m_srot`, `m_pres`, `blok`) VALUES(1, '2018-04-16 11:23:44', 21, 'EXMET2', 'ELDY-', 18, '27.500', '12.500', 1),
INSERT INTO `vada` (`ID`, `Cislo`, `Popis`) VALUES(1, 1, 'Najíždění výroby(resp. nové elektrody)'),(2, 2, 'Expander - poškozená mřížka'),(3, 3, 'Olověný pás - koroze '),(4, 4, 'Olověný pás - potrhaná mřížka'),(5, 5, 'Pastovačka - nedopastované elektrody'),(6, 6, 'Pastovačka - nerovnoměrné pastování (křivé stohy)'),
I need to get:
{"Total":"37", "vada":"Pastovačka - nedopastované elektrody".}
But this is what I get now
{"Total":"37", "vada":"5".}
My sql is:
$sql = "SELECT count(blok) AS Total ,
Vada AS vada
FROM srot_data
LEFT JOIN vada ON vada.<PERSON> = srot_data.Vada
WHERE Linka = 'EXMET1'
GROUP BY vada
ORDER BY Total DESC limit 1";
"vada": "Pastovačka - nedopastované elektrody" is <PERSON> from table vada, which has number 5 in table srot_data.
How do I get the value instead of number?
| cbcb0205590f16219e2a2139277d92dff3a327af274239664295dcfc2adc1c70 | ['6470e332124f420db65ef5f04f2823bc'] | I try to push data from database (data_viewer) to javascript chart but doesnt work. I need to display data_viewer as y: ... (in label: "Vada 1", y: data_viewer). Anybody knows what I´m doing wrong? Thank you.
Database connection is ok and the graph seems to be ok also. But no data from database.
<?php
require('db_config.php');
/* Getting srot_data vada */
$sql = "SELECT count(blok) AS count FROM srot_data WHERE Vada = '1' GROUP BY vada";
$viewer = mysqli_query($mysqli,$sql);
$viewer = mysqli_fetch_all($viewer,MYSQLI_ASSOC);
$viewer = json_encode(array_column($viewer, 'count'),JSON_NUMERIC_CHECK);
?>
<script>
window.onload = function () {
var data_viewer = <?php echo $viewer; ?>;
var chart = new CanvasJS.Chart("chartContainer", {
title:{
text: "PPM 1"
},
axisY: {
title: "Hodnoty",
lineColor: "#4F81BC",
tickColor: "#4F81BC",
labelFontColor: "#4F81BC"
},
axisY2: {
title: "Procenta",
suffix: "%",
lineColor: "#C0504E",
tickColor: "#C0504E",
labelFontColor: "#C0504E"
},
data: [{
type: "column",
dataPoints: [
{ label: "Vada 1", y: data_viewer },
]
}]
});
chart.render();
createPareto();
function createPareto(){
var dps = [];
var yValue, yTotal = 0, yPercent = 0;
for(var i = 0; i < chart.data[0].dataPoints.length; i++)
yTotal += chart.data[0].dataPoints[i].data_viewer;
for(var i = 0; i < chart.data[0].dataPoints.length; i++){
yValue = chart.data[0].dataPoints[i].data_viewer;
yPercent += (yValue / yTotal * 100);
dps.push({label: chart.data[0].dataPoints[i].data_viewer, y: yPercent});
}
chart.addTo("data",{type:"line", yValueFormatString: "0.##\"%\"", dataPoints: dps});
chart.data[1].set("axisYType", "secondary", false);
chart.axisY[0].set("maximum", yTotal);
chart.axisY2[0].set("maximum", 100);
}
}
</script>
|
8c30e2cc2779b1e6c442fdefc13e88a1ead732360f2c72c078b90c7ff7714b09 | ['648116e6f1ef40e5a7ec5be274177410'] | I've a python script which reads a sensor and writes it's value in loop in a file in the same folder the script is located. That part is working fine when I run the script in command line.
Now I wanted to keep that script running in background. So I used forever for that. That seems to work too as I'm not getting any errors.
But the problem I'm facing, the forever script does not update the value in the file. I've searched for that file on the whole system, thinking maybe forever runs the script from another place but I can't find a copy of that file.
I guess it's just a small hint why I don't get an updated file but I can't find the reason for that.
I work with fobj in the py scrip.
| 9ae9237d608924ba6557b298d760b62548a48443fa80f09f02633458ae68a48f | ['648116e6f1ef40e5a7ec5be274177410'] | Looks like a solution to me but I can't figure out to get it running.
I added your function to the js part:
function openQRCamera(node) {
var reader = new FileReader();
reader.onload = function() {
node.value = "";
qrcode.callback = function(res) {
if(res instanceof Error) {
alert("No QR code found. Please make sure the QR code is within the camera's frame and try again.");
} else {
node.parentNode.previousElementSibling.value = res;
}
};
qrcode.decode(reader.result);
};
reader.readAsDataURL(node.files[0]);
alert (getTruncatedQRCode(reader, node, "3"));
}
function getTruncatedQRCode(reader, node, index) {
if (!(reader && node && Array.isArray(node.files))) return;
const code = reader.readAsDataURL(node.files[0]);
if (code) return code.substr(0, index);
}
But the alert shows just undefined :(
|
941e39bb9ec9b681af3265fc44d80d957936f85269432b4c019071e4f30bb25b | ['649c4857a9e046c2bec35d31bb694c15'] | I'd like to think that <PERSON> is probably the fastest among the 9 titans in terms of running speed and not agility (in which case I think the Jaw Titan would dominate). Here's the explanation. <PERSON> managed to outrun the Scout Regiment Horses as seen throughout the "Female Titan Arc" and she even managed to catch up from the Right Wing up to the Rear of the Center whilst the entire platoon is CONSTANTLY moving at the speed of the said horses. Deducing from all the information above she has to be about twice as fast as the horses in order to catch up to Levi Squad by the end of the episode, also putting into consideration all the scout members' attempt to slow her down (fighting her and delaying her movement).
Now let's compare her to the other fast shifters such as the Cart Titan and the Jaw Titan, let's start with what we have seen. <PERSON> may be very agile and nimble but when running in the anime, I don't think she even comes close to the Female Titan. She tried to catch up to <PERSON> riding his horse while he took <PERSON> (not revealing her true name) and yet she never caught up. Meaning she has to be at the same speed with the horses.
Moving on to the Cart Titan. The anime didn't really shown much about its speed but it i notably very fast too considering it saved the beast titan holder from certain death. But they didn't note how fast it was meaning it's not that impressive. Unlike how <PERSON>, recognized the Female Titan's unbelievable speed during her first appearance.
So there you go, maybe among the 3 Fast Titan Shifters I'd rank them like this:
1.) Female Titan (Actual facts from wiki and the anime)
2.) Cart Titan (From the wiki and bits of hints from the anime.)
3.) Jaw Titan (From observation)
| dad4f06d777c9357db65284cc06627be1fd228d017d3de9a385a9ea74deb727a | ['649c4857a9e046c2bec35d31bb694c15'] | We have a TL-ER6020 which we are setting up in a "Non NAT" mode (the WAN side is on a /30 network and routes a /29 network).
I want to be able to "Remote Manage" the router, but want to prevent it from being accessible over HTTP from the WAN side.
On a Cisco RV042, I had configured things so that I would PPTP into the router and then would be able to access the router via its internal IP. However, this router had NAT configured.
What is the right way to approach this problem?
|
286eb6bd0c66cf3e31484dd63d4213d20a0d0e9f8e3f4f5931ff516542719e8e | ['649e4f57542e43ee81b2650cf36e1a72'] | I'm a begginer with PlayFramework and I have a few questions about how to put the server to work properly.
I have been reading a few tutorials on how to deploy a Play! app and I decided to use the server that comes with it and lighttpd as reverse proxy. (I want to deploy 2 or 3 apps in the same machine with different domain)
My app is just like a youtube with only two pages, list videos and upload video. Nothing else is done with the app. I use mysql server for the database.
The machine is a VPS with 1024 RAM with Debian, it does not have swap partition.
The URL to the app is proselo.info and it is quite slow.
I've made a test with ab and you can see the results below:
ab -n 150 http://proselo.info/listar
Total transferred: 185250 bytes
HTML transferred: 124800 bytes
Requests per second: 2.01 [#/sec] (mean)
Time per request: 498.539 [ms] (mean)
Time per request: 498.539 [ms] (mean, across all concurrent requests)
Transfer rate: 2.42 [Kbytes/sec] received
Any help will be apreciated
Thanks
| 4bdd9fdd71a5e4222f7ee122acd6fb2b00107f108438ba83543cf8a0a8ad9629 | ['649e4f57542e43ee81b2650cf36e1a72'] | I am doing a project were I am trying to make the backend with playframework and the frontend with Extjs.
I can retrieve the data from the server with Json and show it in a grid with all it's fields.
The problem comes when I try to modify, remove or add any record.
The request sent by Ext: DELETE lista?_dc=1318409614652
(I solved _dc with "noCache: false" over the proxy)
The request right now is: DELETE lista
The request I need is: DELETE lista/"parameter of the object like ID or name"
Do you have any idea about this? If you need any information let me know
Thanks in advance!
|
06a335fae46be28877d892d0e13d7877cde8483e9c782247614ca0466d997ef5 | ['64a0f902cf024c57bb994d81f2fe5e97'] | Thanks for the suggestions.
In terms of system utilization, the servers themselves typically run at ~14% memory and 2% CPU, even during peak hours, so we aren't really saving anything in terms of caching. Static assets are cached via a CDN, but outside of that we don't use any caching.
We are currently implementing the fpm slow log to see if this yields any results. What's most interesting to me is that this issue does not occur on the old platform; he issue is very recreatable by just switching deployments. | 97933db8944c335449d9d2793f41f060d87e622ed8505693c2898f662a0c4a50 | ['64a0f902cf024c57bb994d81f2fe5e97'] | AWS Elastic Beanstalk service routes traffic back to its EC2 instances through HTTP by default. I know this can be configured to achieve end to end encryption by adding SSL encryption from the load balancer back to its EC2 instance(s). I also know that by default everything created by Elastic Beanstalk is inside a VPC.
Is the default configuration (ELB <-- HTTP --> EC2) secure?
|
a7412764d55f307afe8f08f75484ae9c1483e2bb1b82cae94a2b4c87714168f7 | ['64ba57f21abe417c9e2030cd0165444f'] | Right know I have no idea what is wrong. What I did is to use v4l2-ctl maybe someone can give me a hint.
v4l2-ctl -d /dev/video2 --all
Format Video Capture:
Width/Height : 1280/720
Pixel Format : 'YUYV' (YUYV 4:2:2)
Field : None
Bytes per Line : 2560
Size Image : 1843200
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Limited Range)
Flags :
| d4800a5e370c3377e3665f8dd3f109c474115f02074327e1b4abdaae4edb8e76 | ['64ba57f21abe417c9e2030cd0165444f'] | Good news, problem is solved. Open video selects a wrong decoder. In my case "YU12" but the webcam uses: YUYV. I have to set it manually - (Function: set(cv2.CAP_PROP_FOURCC, fourcc)). Working code is below:
import os
import sys
import cv2
videoSource = 0
def getFrame():
""""""
cv_cam_0 = cv2.VideoCapture(videoSource)
if not cv_cam_0.isOpened():
raise Exception('video source: %s could not be opened' %(str(videoSource)))
cv_cam_0.set(cv2.CAP_PROP_FRAME_WIDTH, 1280)
cv_cam_0.set(cv2.CAP_PROP_FRAME_HEIGHT, 720)
fourcc = cv2.VideoWriter_fourcc(*'YUYV')
ret = cv_cam_0.set(cv2.CAP_PROP_FOURCC, fourcc)
codec_char_code = int(cv_cam_0.get(cv2.CAP_PROP_FOURCC))
a = chr(0x000000FF& codec_char_code)
b = chr((0x0000FF00& codec_char_code) >> 8)
c = chr((0x00FF0000& codec_char_code) >> 16)
d = chr((0xFF000000& codec_char_code) >> 24)
print('codec 4 char code: ' + a+b+c+d)
#ret, raw_frame = cv_cam_0.read()
ret = cv_cam_0.grab()
ret, raw_frame = cv_cam_0.retrieve()
cv2.imwrite('/tmp/testRaw.png', raw_frame)
def main(args):
getFrame()
sys.exit()
if __name__ == "__main__":
main(sys.argv)
|
ae478a118ba632662dffb5540ebe2f009bd24851c2ced8223ce34864edb1a6cd | ['64dc8b7996fd4b799ea81a1ad3aa9755'] | Есть таблица ПРОДАЖИ (Время datetime, Сумма Float)
Как посчитать общую сумму и кол-во на каждые 15 минут за сутки?
Чтобы получилось так
Время Количетво Сумма
(01:30:00-01:45:00) 5 123456
(01:45:00-02:00:00) 10 235000
(02:00:00-02:15:00) 15 535000
| 2f53373f9117ad152e6e7f49d3f779b659eb7bf4a33a98b782630669f5378fb0 | ['64dc8b7996fd4b799ea81a1ad3aa9755'] | Добрый вечер!
В цикле с помощью pg_class создала временные таблички, в которые сохранила данные до обновления на случай, если потребуется откат.
В нескольких таблицах пусто, так как не было связанных данных. И теперь нужно оставить только таблички, содержащие информацию.
Пожалуйста, подскажите, как удалить из схемы только пустые таблицы с названием, начинающимся на tmp_123... ?
Спасибо!
|
d09f94c3d26b8910308957eb4db290ad86d381ce5dd1e69f06595ab63ec0956c | ['64ddc01005114f3c9133a7ca4add40cf'] | I am familiar with the Egyptian version of this idiom and it refers to the back of the neck and not the shoulders and is considered very disrespectful. I am not sure if there are different version of the phrase in the Middle East, but the Egyptian version would be more offensive in Arabic than anything on your list. | 2e8a4b8a596d3e2dc6dd7d179e14b33eb5b8c12006b5a05f5289a9ff1eec99d0 | ['64ddc01005114f3c9133a7ca4add40cf'] | I have `error_reporting`, `log_errors`, and `error_log` all configured this way, but it's still not logging errors for the Joomla site. This site was copied down from an Apache server. I imported the `.htaccess` rules into IIS 7.5; but alas, it's still failing. Do you by chance have any idea what else I might need to look into? |
d06eb4583d80a3f05fc59fc015899408cb14bc758f8c9b4530f168c491131cd6 | ['64e64b31ca4f4017a78a71500294fc6f'] | My question is simple, when I run the following code and check the DB, I find that the user is deleted successfully, that means the User.findOneAndDelete is executed, promise is fulfilled and I expect to see { success: 'user_deleted' } in the response; however, I am getting { error: 'user_not_found' } which is supposed to happen ONLY if User doesn't exist which isn't the case here because the code inside the IF block is executed as per my observation in the DB.
User.exists({ username}).then(exists => {
if (exists) {
User.findOneAndDelete({ username }).then(() => {
res.json({ success: 'user_deleted' });
return;
}
).catch(err => {
res.json({ error: 'user_delete_fail' });
return;
})
};
res.json({ error: 'user_not_found' })
return;
});
Now to solve this I tried to add an else statement instead of the implicit way I was doing it before, and it worked as expected and I got `{ success: 'user_deleted' } in the response.
User.exists({ username}).then(exists => {
if (exists) {
User.findOneAndDelete({ username }).then(() => {
res.json({ success: 'user_deleted' });
return;
}
).catch(err => {
res.json({ error: 'user_delete_fail' });
return;
})
} else {
res.json({ error: 'user_not_found' })
return;
};
});
My question is: Why is this behavior happening? Why is execution jumping to the bottom of the function already? And why when it goes to the bottom of the function and responds, how does the delete occur and the User is deleted in the DB, I am quite confused here.
EDIT: It also behaves as expected when I convert the parent function to an async function and use await on the DB operation.
| d78377601bf3bcf7a64d69044069894b5573a1700bbbe23b6b92620a6b607b18 | ['64e64b31ca4f4017a78a71500294fc6f'] | If you want to create new files with your data in it you must use the 'w+' tag in your open function as so:
# Looping and creating multiple files
for i in range(1, 4):
# Using 'w+' to create file with such name if
# it doesn't actually exit
f = open('serial_data_{}.txt'.format(i), 'w+')
# Now you can write any data to your file
f.write('{} squared is {}'.format(i, i*i))
# Close your file
f.close()
This will produce 3 files with the following content:
serial_data_1 = "1 squared is 1"
serial_data_2 = "2 squared is 4"
serial_data_3 = "3 squared is 9"
Note: You must close the files after writing.
Additionally using 'w+' will overwrite the files every time you run it, use 'a' instead of 'w+' if you want to add/append to the file's current data.
Hopefully that helped :)
|
60b51cb30e6fd637f2c12b0ca6e7912ca663f316457100d308df62ed26dcd4ac | ['64e9ceec18d1451fadc433bf6d74a055'] | I wrote a software package called rna-pdb-tools. Hmm.. but now I have a problem. Is it?
Furthermore, rna-pdb-tools were used to curated structures submitted
to the RNA-Puzzles,
https://github.com/mmagnus/RNA-Puzzles-Normalized-submissions)
facilitating the comparison of structural models.
or was used?
Or I should say "software rna-pdb-tools was used" or "package rna-pdb-tools was used" but "rna-pdb-tools were used"?
| f422a48c7b68c5f46c25cfae5cd3deafa232db9278bcbe764a2516d5dbebd704 | ['64e9ceec18d1451fadc433bf6d74a055'] | I dont like using isset, but if there is masses of code done by another, then it can be a saving grace. I wrote the wee code below to help with this problem, instead of using isset() isseter($a,$b) will return $b if $a is not defined or empty, or the function returns a null. Any improvements, welcome:
//returns var or NULL (if undefined)
//$reserve optional second value is returned as $default if undefined
function isseter(&$default,&$reserve=NULL)
{
$default = isset($default) ? $default : NULL;
$reserve = isset($reserve) ? $reserve : NULL;
if ((!$default) && ($reserve)) $default=$reserve;
return $default;
}
|
777c0b53d7364d538f3e402a9beeb72e16864888c23e11238a2410099f6a3ee0 | ['64f4eafb828e42b2a53e53ca46a29f87'] | I’m looking to buy a DSLR and I’m stuck between buying a Canon with an EF mount or a camera with Micro 4/3s. I have a good set of old Canon FD lenses (From a 28mm to a telephoto) that I’d like to use, and ideally not buy many new lenses.
So - which system is best for use with FD lenses?
I see the FD to MFT adaptor doubles the focal length, so does that mean it’s not worth it? None of my lenses would be particularly wide any more.
On the other hand, I’m having difficulty finding resources for using FD lenses with an EF mount - surely if there’s a full frame sensor then the lenses will be closer to their original focal length?
Or are there too many downsides to using the old lenses completely? I’m not too fussed about autofocus etc.
| 5bc287510149bbcb7a1a90244b0c99c69a93faeab10dd40075891689e1413291 | ['64f4eafb828e42b2a53e53ca46a29f87'] | I was wondering if anyone knew a way (short of modifying angular-strap.js) that I can reconcile the $modal provider collision between angular-ui modal and anglular-strap "aside" (which uses the $modal provider)? Currently if I try to use both, only one will work.
Possibly making things more complicated, I'm using the modalService https://github.com/m-e-conroy/angular-dialog-service that wraps angular-ui's modal control.
|
b3a8f49a8a5f0fc1946df68b1f6a18c56a5fbf8b021a70cfaeb10b660a2c6ffa | ['6504f9e11ee0411b8297083a937bb7d2'] | Thank you for indicating the distinction between the material that is and isn't ejected.
I understand that most of the Fe-56 in the ISM is produced in the decay of Ni-56 > Co-56 > Fe-56 _after_ the shell burning products of a massive star (core collapse supernova) or the fusion products of a type Ia supernova have been ejected. | 2a4d35acfde7dd04b3974397980c486b39478205099390090f5666947141254c | ['6504f9e11ee0411b8297083a937bb7d2'] | Your answer helps. I suppose "Fewer electrons per mass unit for heavier species leads to lower radiative opacities and higher luminosities" means that the number of electrons in the core decreases, so the contribution from electron scattering to the opacity decreases, so more photons leave the core: higher core luminosity. If this is correct, why does the number of electrons per unit mass decrease? My guess: because the positrons from the CNO-cycle (or pp-chains) annihilate with electrons. During He-burning and beyond the number of electrons wouldn't change much since alpha captures dominate. |
610a55c7f738afd3e5fbe6d1859fafd1b5c3d90e404cc25485bc19e643ed16cd | ['65114b28d1664998808c43dcc55b470c'] | (Let me preface this by saying I am extremely new to the AS400 and RPGLE and CL Programming. I know SQL fairly well, but not when in use with the AS400)
This seems like it should be very simple.
At Year End we have to update our warehouse table to the new current year. This has been a manual process, to go to STRSQL and run
update rco set ccfscy = '2017' where crsts = 'A'
This has been done by the same person for the past 40 years and they are now retiring this year. My boss wants this to become a CL Program where it is all done without someone manually running the STRSQL command and it can be integrated into the Year End Process.
All the CL Program has to do is prompt for what year you want to change the warehouse files too and upon entering the date into the screen it would run the SQL program and update the records according to the SQL command.
Can someone please point me into a direction where I might be able to learn more about using the CL program to accomplish this process?
Thank you.
<PERSON>, Systems Programmer
| 17090ac943e4bf674b59e3aa770644c2bf27970ca3e4e4f291114f299d8deee7 | ['65114b28d1664998808c43dcc55b470c'] | OK, So I have a spreadsheet that was made by combining two identically structured spreadsheets that merged all the data into one. The problem is that both spreadsheets have "similar" data but one has more data than the other but both have data that is missing in each of the spreadsheets but all the data is required to be kept. One suggestion I was given was to manually go through the spreadsheet row by row to combine the rows. Given there are 5000 rows in this spreadsheet, this option is not desirable. I did find a VB Script that allowed me to combine rows of similar information, the problem was it seems to only combine everything into on row based on one column of information.
Sub MG30Nov12()
'Updateby20150519
Dim Rng As Range
Dim InputRng As Range
Dim nRng As Range
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
Set InputRng = InputRng.Parent.Range(InputRng.Columns(1).Address)
With CreateObject("scripting.dictionary")
.CompareMode = vbTextCompare
For Each Rng In InputRng
If Not .Exists(Rng.Value) Then
.Add Rng.Value, Rng.Offset(, 1)
Else
.Item(Rng.Value).Value = .Item(Rng.Value).Value + Rng.Offset(, 1)
If nRng Is Nothing Then
Set nRng = Rng
Else
Set nRng = Union(nRng, Rng)
End If
End If
Next
If Not nRng Is Nothing Then
nRng.EntireRow.Delete
End If
End With
End Sub
What i would like to do is do something like this but combine over multiple coulmn data.
Any ideas or suggestions?
|
b9d67d64950da4e2fb2c4734b4022edb8f9f797fe66b6ebd970b2d26cb31bd56 | ['65121640e98048329dc5f88f711269f7'] | Whenever I made a linear regression model, it just diverged, all the time. I really couldn't find any solutions for that. But when I changed the learning rate to 0.0000252, it worked! But another problem is that it learns so slowly so that I have to wait for the model to learn for more than 10 minutes.
How can I fasten learning without changing the learning rate?
| 7fdb956f06eaaab22dc621ff8fd44fc97cfe0af8f5fe48540eaf9d6d8697a627 | ['65121640e98048329dc5f88f711269f7'] | I'm working on Facebook chatbot, and I found some difficulties while reading Facebook's official Messenger Platform tutorial.
The frustrating part is here:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"greeting",
"greeting":{
"text":"Timeless apparel for the masses."
}
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
I'm using a Node.js and Heroku. How should I use the code above to make it work?
|
409d6c53b8ab4a3578161387ebf1ade0ffd34e9670593dad0271619352ff669d | ['651812250a6e46c0b0b5a485e32e876c'] |
System wide.
Yes, we expect the cache to update.
A service change notification will cause us to refresh, or reading uncached.
Using uncached forces over the air traffic so we will connect, otherwise we only connect when needed. As an example if you are subscribed to a value change notification and the remote device published a directed connectable advertisement we will connect to get the notification. There are many other cases when we connect, but typically only when necessary to save the remote devices battery.
| 45950c00cdce7243914962769bdb1867bf2ad953cd07e00066f01037e5e9ee24 | ['651812250a6e46c0b0b5a485e32e876c'] | The BluetoothSerial class calls RfcommDeviceService.FromIdAsync(String) where the string represents the RFCOMM service instance (a service).
The BluetoothDevice.FromIdAsync(String) takes a string representing the remote Bluetooth device instance for classic baseband (a device).
If you want the BluetoothDevice from the RfcommDeviceService you use the RfcommDeviceService.Device property.
If you want to find the services for a BluetoothDevice you use the BluetoothDevice.RfcommServices property.
|
e1235fd350761a194e7770de3959636de3d1c14c65f9c7b17c30311d26f93bfa | ['652aca87b160460cb0c064a6a676cca8'] | Im looking for a word, method or similar for this situation. Say that i'm for example have 3 viewcontrollers, a, b and c.
And then i'm navigating from a to b and finally from b to c. From c then I want to dismiss my viewcontrollers all the way back to a. How do i achive this programmatically?
| 00bb05f03d19078e553dda2a76af4c8209d49b0704ad5d93989af5893c5b3a09 | ['652aca87b160460cb0c064a6a676cca8'] | I have some trouble with setting up my rules for a firestore project. I try to learn the database setup but can't find any solution for this. So there's no problems when i try to get a document from my collection "lists". But when i try to get all of the documents in the collection "lists" xcode tells me "Missing or insufficient permissions".
My goal is to have users that are able to create documents in collection "lists" but they can only read the documents in "lists" where they appear in the document array "members".
Right now I can add documents in collection("lists") without any problem but I can't read them. I can only read them one by one from xcode with a specific target.
Any tips or ideas?
service cloud.firestore {
match /databases/{database}/documents {
match /{documentId} {
allow read: if request.auth.uid != null;
}
match /lists/{docId} {
allow write: if request.auth.uid != null;
allow read: if request.auth.uid in resource.data.members
}
}
}
Xcode.
//working
let docRef = db.collection("lists").document("j0hHA5TLPETf6JRMbC1s")
docRef.getDocument { ...
//not working due to permission failed
db.collection("lists").getDocuments() { ...
|
95a7c8a8390c93ed2507c920348c48bf9b4bc016fba4392f7b4273bfbad1a7fd | ['652b9a8e872948729eb45dfcff46d7a3'] | I have a multilevel menu. Each of level is a list with ul-tag. Each point of the menu is li-tag.
I want to slide down all of parent uls of the current point of the menu when loading the page.
Now I do the next:
var parents = selector.parents('ul');
parents.each(function(index, parent){
parent.slideDown();
});
But I get an error 'Uncaught TypeError: parent.slideDown is not a function'. And when I try to print a parent in console, I get the raw html. How can I get an access to the single parent inside each to make a slideDown? Or slide down all parents in any ways.
| 4fd6e4150fd959802ea3ddc423bb14d166fcd23979dc3044bcc00b50942b3bbd | ['652b9a8e872948729eb45dfcff46d7a3'] | If your array has the constantly number of layers, you may use foreach-function for the each layer. If your array has different number of layers every time - you should use the recursion, because it's the only solution in your situation.
Something like this:
array_walk_recursive($array, function($item, $key){
//your actions
});
|
d0614333759066886aa7ee7ca51a44e4a553acadbbed1111308ced70a46af94d | ['6539fbd5dc52475fbfc1322dd4b6bb91'] | User can capture or select a image from gallery. I would like to upload that image to server.
This is my code for camera -
camera.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent i = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
//String encode = ImageBase64.encode(i);
startActivityForResult(i, CAMERA_REQUEST);
}
});
And this is my code to select a image from gallery -
gallary.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent g = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.INTERNAL_CONTENT_URI);
startActivityForResult(g, GALLARY_REQUEST);
}
});
Also, I am displaying that image with below code -
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if(resultCode == RESULT_OK) {
if(requestCode == CAMERA_REQUEST) {
Bitmap bitmap = (Bitmap) data.getExtras().get("data");
uploaded_img.setImageBitmap(bitmap);
}
}
if(requestCode == GALLARY_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) {
Uri uri = data.getData();
uploaded_img.setImageURI(uri);
}
}
Now, I would like to convert this image to base64 and upload to server.
| f06ce4a541fdd6e24800aa80c5b57e0460e96460e60a4dcd5c4875e6957097c8 | ['6539fbd5dc52475fbfc1322dd4b6bb91'] | I have a recyclerview. Once user clicked on any item of recyclerview item it should open a new fragment. But I would like to pass a id with it like we send with intent using putExtra.
Below is my adapter onBindViewHolder method code -
public void onBindViewHolder(@NonNull DashboardViewHolder holder, int position) {
final Dashboard product = dashboardList.get(position);
//loading the image
Glide.with(mCtx)
.load(product.getImage())
.into(holder.imageView);
holder.rate.setText(product.getRate());
holder.name.setText(product.getName());
holder.city.setText(product.getCity());
//holder.id.setText(String.valueOf(product.getId()));
holder.boatList.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Toast.makeText(mCtx, ""+String.valueOf(product.getId()), Toast.LENGTH_SHORT).show();
//Intent intent = new Intent(mCtx, AddNewBoatFragment.class);
//intent.putExtra("boat_id", product.getId());
//intent.putExtra("owner_id", product.getOwner_id());
//mCtx.startActivity(intent);
//getSupportFragmentManager().beginTransaction().replace(R.id.dahsboard_fragment,
//new MyBoatFragment()).commit();
Fragment fragment = new AddNewBoatFragment();
FragmentManager fm = ((AppCompatActivity)mCtx).getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.dahsboard_fragment, fragment);
ft.commit();
}
});
}
Below is my class -
public Dashboard(int id, int owner_id, String image, String rate, String name, String city){
this.id = id;
this.owner_id = owner_id;
this.image = image;
this.rate = rate;
this.name = name;
this.city = city;
}
public int getId(){ return id; }
public String getImage() {
return image;
}
public String getRate() { return rate; }
public String getName(){
return name;
}
public String getCity() { return city; }
public int getOwner_id() { return owner_id; }
|
c09ba6e584b1e3ec47f537af2786854e8bc1bd6c37fd1aa78eabacfd126b373f | ['655c1e207fa3426a97aba186b710125e'] | What I want to do is like this.
Below is code using numpy. How do I do it using tensorflow functions?
import matplotlib.pyplot as plt
import numpy as np
import tomopy
output_size = 64
[X, Y] = np.mgrid[0:output_size, 0:output_size]
xpr = X - int(output_size) // 2
ypr = Y - int(output_size) // 2
reconstructed = tomopy.misc.phantom.barbara(size=64, dtype='float32')
reconstructed = np.squeeze(reconstructed)
plt.imshow(reconstructed, cmap='gray')
plt.show()
radius = output_size // 2
reconstruction_circle = (xpr ** 2 + ypr ** 2) <= radius ** 2
reconstructed[~reconstruction_circle] = 0.
plt.imshow(reconstructed, cmap='gray')
plt.show()
| 9abd96eb298558d8c7acf7dcd91b4888c8473b41c1a12dbb5456b3c0aa0ba6da | ['655c1e207fa3426a97aba186b710125e'] | The tf.where function does exactly what I want.
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
width = 512
sess = tf.Session()
[X, Y] = np.mgrid[0:width, 0:width]
xpr = X - int(width) // 2
ypr = Y - int(width) // 2
radius = width // 2
reconstruction_circle = (xpr ** 2 + ypr ** 2) <= radius ** 2 #set circle
all_white_img = tf.ones(shape=[width, width], dtype=tf.float32)
plt.imshow(sess.run(all_white_img), cmap='gray', vmax=1.0, vmin=0.0)
plt.show()
reconstruction_circle = tf.cast(reconstruction_circle, tf.bool)
all_white_img = tf.where(reconstruction_circle, all_white_img, tf.zeros_like(all_white_img))
plt.imshow(sess.run(all_white_img), cmap='gray', vmax=1.0, vmin=0.0)
plt.show()
|
5f9ac74cacb0abdcf30a6de8b8fefed18851e4b029971c76df358a271554585d | ['656123ec3ad148849edd17be5833abd5'] | Both versions of the word would known as a Racial Slur:
a derogatory or disrespectful nickname for a racial group, used without restraint
The usage of the word is highly debated in the United States as some members of the black community use the term freely among themselves with little to no backlash (an example being the song you mention).
| e631b7aeb52ec32f0a0af70b0c1261d73722c5099d1db9c829cd5a9e050bbb9c | ['656123ec3ad148849edd17be5833abd5'] | This does not provide an answer to the question. Once you have sufficient [reputation](http://english.stackexchange.com/help/whats-reputation) you will be able to [comment on any post](http://english.stackexchange.com/help/privileges/comment); instead, [provide answers that don't require clarification from the asker](http://meta.stackexchange.com/questions/214173/why-do-i-need-50-reputation-to-comment-what-can-i-do-instead). - [From Review](/review/low-quality-posts/224949) |
59f926a6089d0c63a8b02183864a5254820b2b1c6524d45f3332cbaa27a39c4b | ['65637568238a4c3480abfe26e55a6f77'] | I agree with <PERSON>'s comment that you probably don't want to do this unless you really have to because it will slow down the saving process. If you NEED to have them go in order and you really want to use DispatchGroup to do it, you could do the following:
let group = DispatchGroup()
for i in 0 ..< 5 {
group.enter()
asyncTask { // Use your getData function here
print("Done: \(i)")
group.leave()
}
group.wait()
}
I would also note that in your code:
if let error = error {
print("An error has occured!")
} else {
print("Data saved \(i)")
myGroup.leave()
}
If there is an error, 'leave' will not get called and you will never be notified of completion. You should probably leave even if there is an error so that your program doesn't hang.
| 32f75422d09245c9f4172dae3f9f9b39858c2ec2eaa71e576a1bae6ea4bebc6b | ['65637568238a4c3480abfe26e55a6f77'] | You should check your storyboard to make sure that the top view controller in the navigation controller is actually a PredictorTableViewController. The error says that it's a UITableViewController. You might have to check the Identity Inspector in the top right hand corner of the storyboard editor to see if you have the class set correctly.
|
e5581554bff2e61e26f3712e92d21fd0457dcb5ef7c7050fb5f60ea2f4caa3d8 | ['65647270bb2d44ef8611711a57b1d0df'] | Ember defers the DOM manipulation until "later" via the run loop. To test, you can force the run loop to execute its contents immediately by calling Ember.run.end() . The following should pass:
describe 'Controllers', ->
describe 'UrlSearch', ->
it 'should append view', ->
Ember.run.end()
expect($('#url_search_url').length).toEqual(1)
Typically you don't have to flush the run loop in your application code... you can just let Ember execute everything when it is ready to do so. But in your test code, it is sometimes necessary.
| e9582100e78c0c9537b386f9abd369fa6db76439ffb0c3c94315bf2da7e18e06 | ['65647270bb2d44ef8611711a57b1d0df'] | You are definitely on the right track. As <PERSON> suggested in his comment, you do not need to preface the function with Ember.computed(). The property() call will take care of that for you. By doing both, you are making a computed property method out of a computed property method, which seems like it may cause problems.
Also consider marking the property as cacheable(), which will cause the function to only execute once when _id changes, as opposed to any time the method is called.
This seems like the ideal approach:
created_at: function() {
var objid = this.get('_id');
return new Date(parseInt(objid.substring(0,8), 16)*1000);
}.property('_id').cacheable()
|
141b2947f05a570ec2acde9f17da7196a8f4e663b231c5d782d6a625094f320d | ['65691379c2664e41ac66e8105aca9b62'] | I'm a little confused about iterators in Java. How do I make next() only return certain values? Like say I have a boolean array of 10 elements, and I only want to return those that are true. Do I put a conditional in the next() method that checks for that condition and returns when it is met? Or do I check for the condition when I actually use the iterator and keep calling next() until I get a suitable value, and then use that value?
Similarly if I have an array of ints, and I want to create a string representation of the array where each element is separated by a space, but I only want to use negative elements. If I want to do this with an iterator, do I check for the negative element in the next() method and only return next values that are negative, or do I check when I'm making the string representation, and keep calling next() until I get a negative value, and then add that value to the string?
Thanks!
| ac130c3b1d781e940aeecbfda59be11d11266f8c2d12280ada1263ee2cd208aa | ['65691379c2664e41ac66e8105aca9b62'] | I'm in the process of creating my first iPhone app. It is an exercise log that will allow users to use the GPS to track a run, then be able to save a map of the route as well as the time/distance and upload it to a website. A local list of runs would also be saved on the device. My question is, what is the best way to implement the saving and retrieval of the map? I recall reading somewhere that the way to do it is to have entities that have latitude and longitude attributes, and then fetch these in reverse by time when plotting the map. This would mean that each entity is a point during the run. Is there a way to store all of the coordinates in an array in one entity so that one entity would represent a whole run?
I haven't really looked at relationships since I'm new to app development, but it seems like I could use relationships to store runs? As in, have the parent entity be the run, and have one of the destinations be all the coordinate entities of that run. Does this sound correct?
Thanks!
|
a607f073dcc79c350ca4541639dbe17ff09e470dfaa534e18595af509810de3b | ['658fd9615abd4bc99ecf08a5ff3ce4f3'] | I would just include that small specific portion of css in my main code and use a simple if...else statement, and change 'logo.jpg' depending on whether the user is logged in or not.
For example, if the user is logged in, the variable for the logo would be changed from the default value. If the user isn't logged in, then use the original logo.
Can't really provide more detail as there is no code to work with.
| 6896a0755112c2f4ce6dd4f10146e1c0a6f160845957982dd637b768b33fc920 | ['658fd9615abd4bc99ecf08a5ff3ce4f3'] | Basically your browser is caching the the web pages, and rails is currently configured to allow you to do that. You will have to manually specify in rails that you do not want page caching to occur.
Refer to this link here. It should be exactly what you are looking for.
Basically what the page I linked is telling you to do is to add a couple of lines to application_controller.rb:
This:
before_filter :set_no_cache
and the function:
def set_no_cache
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"
end
Let me know if it works or not.
|
bcab488bed047f9fee7aeb919ae4061b86e3c9176c8f810866fd9d58d81cf1c7 | ['659dd9a5e2aa4497af747ab3685b06ec'] | I am going to propose a possible answer that I am not sure I like. What if I open multiple cursors on the database simultaneously. So I would have the following cursors:
IncidentReportCursor
IRCamerasCursor
IRNotesCursor
IRGroupsAssignedCursor
IRWidgetsUsedCursor
Then I could iterate the cursors at the same time and build my result set as I go by interleaving the collections into each IncidentReport entity as in the sample code below. Is this a crazy idea, to have multiple cursors, or is it reasonable?
Statement irStat = conn.createStatement();
Statement irCamStat = conn.createStatement();
Statement irNoteStat = conn.createStatement();
irStat.setFetchSize(100);
irCamStat.setFetchSize(100);
irNoteStat.setFetchSize(100);
ResultSet irRS = irStat.executeQuery("select * from IncidentReport order by id");
ResultSet irCamRS = irCamStat.executeQuery("select * from IRCameras order by incidentId");
ResultSet irNotesRS = irNoteStat.executeQuery("select * from IRNotes order by incidentId");
int lastCamIncidentId = -1;
int lastNotesIncidentId = -1;
while(irRS.next()) {
IncidentReport ir = new IncidentReport();
populateIR(irRS, ir);
// iterate the notes results until we catch up to the current id
while(!irCamsRS.isClosed() && lastCamIncidentId <= ir.getId()) {
if(irCamsRS.next()) {
IRCam irCam = new IRCam();
populateCam(irCamsRS, itrCam);
lastCamIncidentId = irCam.getIncidentReportId();
if(lastCamIncidentId == ir.getId()) {
ir.addCam(irCam);
}
}
}
// iterate the notes results until we catch up to the current id
while(!irNotesRS.isClosed() && lastNotesIncidentId <= ir.getId()) {
if(irNotesRS.next()) {
IRNote irNote = new IRNote();
populateNote(irNotesRS, itrNote);
lastNotesIncidentId = irNote.getIncidentReportId();
if(lastNotesIncidentId == ir.getId()) {
ir.addNote(irNote);
}
}
}
serializeIncidentReport(ir);
}
| 8b6a6acf11240073ef34c591e291d874b71db9eac7feac3ffc03bdbab7f13d20 | ['659dd9a5e2aa4497af747ab3685b06ec'] | I am working at a branch office and have been tasked with changing out the DHCP scope to match the overall corporate IP address scheme. The main office assigned me an IP address range of <IP_ADDRESS> through <IP_ADDRESS><PHONE_NUMBER> through <PHONE_NUMBER>. I changed the scope on Friday afternoon and came in on Monday morning to discover that only some of the workstations had picked up new leases from the new DHCP scope. Any ideas as to what may be happening, what I might check or adjust?
|
4313a541764646f6864c0eda6dfd215528ca389ec138dfda75e1eda461003c23 | ['65a110ac79084634a9bc3563ecfc8c67'] | Without having implemented your setup, I generally make REST calls using requests by implementing a method similar to the following.
def get_weather(data):
# Set api endpoint to what's needed
endpoint = 'http://example.com/api/weather:9000'
# Do any work needed specific to api prior to call
# Send request and get response
response = requests.get(url=endpoint, data=data)
# Process response
result = process(response)
return result
You can create a class that is going to make all api calls to the same url, and just change the endpoint.
class ApiCaller():
def __init__(self, base_url, port):
self.base_url = base_url
self.port = port
def __get_url(self, endpoint):
return '%s%s%s' % (self.base_url, endpoint, self.port)
def get_weather(self, data):
endpoint = 'weather'
return requests.get(url=self.__get_url(endpoint), data=data)
def get_hello(self, data)
endpoint = 'hello'
return requests.get(url=self.__get_url(endpoint), data=data)
| 990b42602d98a4b1af04062d15316a53e3aacd31d149e329f16fc32bea09cbbc | ['65a110ac79084634a9bc3563ecfc8c67'] | I created a simple __main__.py:
if __name__ == '__main__':
print 'the rain in Spain falls mainly on the plane'
I can create a zip with __main__.py using the command zip -r test.zip __main__.py
Now I can call test.zip:
$ python test.zip
the rain in spain falls mainly on the plane
When I create a tar with __main__.py using the command tar -cf test.tar __main__.py
When I call it, I get the following.
$python test.tar
File "test.tar", line 1
__main__.py print 'the rain in spain falls mainly on the plane'
^
SyntaxError: invalid syntax
What do I have to do for python to recognize it like the zip?
|
bfc69480eca7290ee3fe2daa13abd2aa1edaad2218df4ed841c429da2e262ce8 | ['65a85d34d8cf42cb97370c6f94747e8b'] | I'm not sure about python but with C++, we can use wxStaticBoxSizer as it support the label display, same as the LabelFrame in tkinter or group/frame in some other languages.
You should layout your gui by the other BoxSizer/GridBoxSizer first and then add StaticBoxSizer inside, you will got the better look.
Ex:
wxStaticBoxSizer *sizer = new wxStaticBoxSizer(wxVERTICAL, panel, "Label here");
| 7e45b3569d0e382b608b9b07c2916c9ae4b1431b308f237a699bab9bd1f397aa | ['65a85d34d8cf42cb97370c6f94747e8b'] | You may check your anti-virus SW.
I got the same problem "OSError: [Errno - 9999] Unanticipated host error" every time I tried to record the wave file by pyAudio.
I check and confirm all the parameters OK.
I was stuck for several days before I noticed the anti-virus on my PC block my python script call to the hardware level.
All the thing I need to do is disable or exit the anti-virus SW and everything work well again.
|
65b4a380d7e088df32e1ed9b4a11df20e7eabbe1ab3fd198ff5ee10665044876 | ['65ba2012c15446d9943000b6e3530500'] | Thanks! I just punched some holes in a scrap of leather I had left over from a writing desk I built over the summer and used some parachord for the straps. Man, that is one comprehensive website on slinging. After skimming through it I've come to the conclusion it might not be the design of the sling that's the problem, but the skill of the slinger:) | f926f49a36740f1f14fda7630ffc40aefdae5cf4485afcda3d37aaad70099172 | ['65ba2012c15446d9943000b6e3530500'] | This pretty much sums it up, except that for beginner, really small projects (2 people in this case, only HTML) I would recommend subversion with TortoiseSVN. I find that it's easier for people to grasp, and the nice explorer extensions mean that you don't have to worry about using the command line. |
b3f07704cae3bb897c4bdf6bfaa8b455c414fa0e42f65c41030b1943262f4d72 | ['65baeaa1570b41a89f99256dcb65e28a'] | Can someone help me with Allegro 5.0.8 static linking in MSVC2010?
allegro-5.0.8-monolith-static-mt.lib; -> this doesn't work for me. I can run the game from IDE but i can't release the solution.
I have this at the top of my program:
#include <allegro5/allegro.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_primitives.h>
#include <allegro5/allegro_native_dialog.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
And this is pops out in my build output:
1>------ Build started: Project: igra2, Configuration: Release Win32 ------
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Load_Glyph
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Get_Kerning
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Get_Char_Index
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Done_Face
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Request_Size
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Set_Pixel_Sizes
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Attach_File
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Open_Face
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Done_FreeType
1>allegro_ttf-5.0.8-static-mt.lib(ttf.obj) : error LNK2001: unresolved external symbol _FT_Init_FreeType
1>C:\Users\Nikola\Documents\Visual Studio 2010\Projects\igra2\Release\igra2.exe : fatal error LNK1120: 10 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
What else do I have to include? It seems that there is a problem with linking allegro_ttf.h. Is there somewhere a list of what to link for my includes?
P.S. If anyone else has an issue with building an allegro solution in MSVC10, this is what resolved most of my problems (except for this one): https://www.allegro.cc/forums/thread/611289
| d78c2a86e0ef05ba0f6004297fed5cac5ee8ca20419aa815c7b19bc3135000e1 | ['65baeaa1570b41a89f99256dcb65e28a'] | This answer helped me, however, it is missing a few things.
Download the Apple Font Tools and install them. Then open the Terminal, navigate to the "Fonts" folder, or open "font Book", find your font, right click to show it in the Finder, copy-paste it somewhere else and then navigate to that folder in Terminal.
Then paste this in the terminal (beware of spaces in the name of the font, put a \ in front of them):
ftxdumperfuser -t hhea -A d MyFont.ttf
This will generate a MyFont.hhea.xml file, which you can open with any text editor. Now you can modify the ascender & descender properties.
If your font gets cut off at the top, then increase ascender and descender by the same amount.
When you're done editing, paste this in the terminal:
ftxdumperfuser -t hhea -A f MyFont.ttf
This will generate a new .ttf file which you can install like a normal font. Works with other font extensions as well, such as .otf.
|
e17f2ccd75e7ae328c804b28b6a29117eda5fd23ccf0ae662b8e59e48de5d2be | ['65c170d90ea54e318628f37ecbb7f62f'] | in my application I would love to implement a progressDialog to the image download process and after this, i want call the intent ACTION_ATTACH_DATA. currently my code works fine but as you can see when it starts downloading, immediately called the intent. my goal is to show the intent after the download and with a progressdialog. Thanks for your help :)
code:
Button impostacome = (Button)popupView2.findViewById(R.id.impostacome);
impostacome.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
File folder = new File(Environment.getExternalStorageDirectory() + "/Wallpaper");
boolean success = false;
if (!folder.exists()) {
success = folder.mkdirs();
}
if (!success) {
} else {
}
File direct = new File("/sdcard/Wallpaper/");
if (!direct.exists()) {
direct.mkdirs();
}
DownloadManager mgr = (DownloadManager) getSystemService(Context.DOWNLOAD_SERVICE);
Uri downloadUri = Uri.parse("http://www.brothersapp.com/immaginiapp/wallpaper/1");
DownloadManager.Request request = new DownloadManager.Request(
downloadUri);
request.setAllowedNetworkTypes(
DownloadManager.Request.NETWORK_WIFI
| DownloadManager.Request.NETWORK_MOBILE)
.setAllowedOverRoaming(false).setTitle("brothersapp download")
.setDescription("The image is Downloading...")
.setDestinationInExternalPublicDir("/brothersapp/", "/1.jpg/");
mgr.enqueue(request);
Intent myintent = new Intent(Intent.ACTION_ATTACH_DATA);
Uri sendUri = Uri.parse("file:///sdcard/brothersapp/1.jpg");
myintent.setDataAndType(sendUri, "image/*");
startActivity(Intent.createChooser(myintent, "Set As"));
| 7d58d6ac869bbf6407bcf56ce64c786f28b7511223a7b64fddcbc34ecf7e7cec | ['65c170d90ea54e318628f37ecbb7f62f'] | I'm trying to run my app for all devices, but I have a problem with a storage permit in some phones. my app changes the background both in the home and in the block screen through the following code
Intent myintent = new Intent(Intent.ACTION_ATTACH_DATA);
Uri sendUri = Uri.parse("file:///sdcard/0prova/"+intclick+".jpg");
myintent.setDataAndType(sendUri, "image/*");
startActivity(Intent.createChooser(myintent, "Set As.."));
and this window opens
when i click on the icon lock screen (<PERSON>) nothing happens.
but if I follow these steps and allow permission everything works.
the questions are: can i change it automatically with the code?or go to the page and enabled by the user?
thanks in advance!
|
2c964dd14eb1ea35e5854a85df294b2a056ad62d567bb1b5dd3bb9ac2a3dcc9d | ['65cc2172952d40aab188d668fe0f0328'] | Install sshpass under Debian / Ubuntu Linux
Type the following command:
$ sudo apt-get install sshpass
How do I use sshpass?
Login to ssh server called server.example.com with password called t@uyM59bQ:
$ sshpass -p 't@uyM59bQ' ssh <EMAIL_ADDRESS>
Under shell script you may need to disable host key checking:
$ sshpass -p 't@uyM59bQ' ssh -o StrictHostKeyChecking=no <EMAIL_ADDRESS>
How do I backup /var/www/html using rsync?
Run rsync over SSH using password authentication, passing the password on the command line:
$ rsync --rsh="sshpass -p myPassword ssh -l username" server.example.com:/var/www/html/ /backup/
| 640607fc2d1c7ab4ce116c8294841347fad21821eb1e8660ec71bf304ca87d21 | ['65cc2172952d40aab188d668fe0f0328'] | I've searched around S.O and google but haven't found a solution that I understood straight away.
The code below is what I have.
(I have added comments below just for clarity on s.o)
I would like it to have a shorter signature but remain very understandable/readable
The Code:
def fix_filenames_in(folder):
''' Removes spaces from filenames within a folder '''
files = os.listdir(folder)
for file_name in files:
new_name = ''
if ' ' in file_name:
# I could have used .replace() but decided to go with splitting on the space
new_name = file_name.split(" ")
# This filters empty splits in the list: ['file', '', 'name'] -> ['file', 'name']
# Is there a better way to do this?
new_name = [segment for segment in new_name if not segment == '']
new_name = '-'.join(new_name)
# Building file paths
old_filename = folder + os.sep + file_name
new_filename = folder + os.sep + new_name
# Actual renaming
os.rename(old_filename, new_filename)
Running it:
# Assuming the following list is from the os.listdir() call
images = ['bat man.jpg', 'cat woman.jpg', 'the scary joker.png']
fix_filenames_in(images)
# Result:
['bat-man.jpg', 'cat-woman.jpg', 'the-scary-joker.png']
|
9965b774e38d5c67229d4ba6139e8204e379f3243ecf6d5785a508a6fffc2491 | ['65daf00ff9d0462f8a0bd38c859a514a'] | I'm learning SQL injection in one of my security classes and this is for an extra credit assignment on a project site the professor created himself. I want to list all the databases but I'm having some trouble with the syntax. I have tested that this is sql injection vulnerable, so then I tried
';show databases;--
in the username input field. but then I got an error saying
syntax error near 'show databases;--' and password=';show databases;--' at line 1
What did i do wrong?
| 44138bdafe5dfbea3de8d2b66daca8ae8b86bfe984295f8297a2bc7ad55f206c | ['65daf00ff9d0462f8a0bd38c859a514a'] | Because this points to an instance of the class, in the static method you don't have an instance.
The this keyword refers to the current instance of the class. Static member functions do not have a this pointer
You'll notice the definition of a static member is
Use the static modifier to declare a static member, which belongs to the type itself rather than to a specific object
Which is why this has nothing to point to.
|
141da5c639b4ea75a686b45c4ebc8cca8534fb62d54d8881463b96123e94103d | ['65e8d4bad1f1419995888815f6f63c2b'] | At some point during the film, one man gets killed, but the timer on his arms still has time on it. Seeing as the person that killed him (<PERSON>) didn't take the time (which his character is likely to do), you can infer that once a person dies, their remaining time dies with them.
| 92c96c311741df80db5a8da1b3b915a6ba4f9ee51fda3d44791356fb0f6fcd48 | ['65e8d4bad1f1419995888815f6f63c2b'] | Thank you for the suggestion, <PERSON>. However, much like the `\ifx\insertsection` approach, this again only addresses the first conditional requirement and not the other two. That is, the expression `\number\value{subsection}` evaluates to 0 for any frame that is not currently in a subsection environment, even if that frame is in a section environment that contains subsections. |
bbad8518b2b57927f8bc3b3050739aad74d279119cd4ace7615f5afad0f9a28d | ['65ef43688d98454eb6ae6b3264d0b73d'] | I am trying to implement asynchronous http reverse proxy with tornado on Python3.
Handler class is as follows:
class RProxyHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
backend_url = 'http://backend-host/content.html' # temporary fixed
req = tornado.httpclient.HTTPRequest(
url=backend_url)
http_client = tornado.httpclient.AsyncHTTPClient()
http_client.fetch(req, self.backend_callback)
def backend_callback(self, response):
self.write(response.body)
self.finish()
When content.html is small, this code works fine. But with large content.html, this code raises Exception:
ERROR:tornado.general:Reached maximum read buffer size
I found the way to handle large contents with pycurl. Though, it seems does not work with Python3.
In addition, I added streaming_callback option to HTTPRequest. But the callback won't be called when disabled chunked response by backend server.
How can I handle large contents?
Thanks.
| f61c41e31dd0f12eb5371a4c33d39b47e42ee2e00d969071f9d6682871c44999 | ['65ef43688d98454eb6ae6b3264d0b73d'] | We are running Redis server on CentOS and connect to it from CentOS clients.
Most of requests are successfully done but the server does not respond to SYN packet from clients sometimes.
At that time, client TCP socket state was SYN_SENT and after retries client gave up connection.
tcpdump results:
18:11:05.031716 IP <IP_ADDRESS>.56287 > <IP_ADDRESS>.6379: Flags [S], seq 1819611675, win 14600, options [mss 1460,sackOK,TS val 774050308 ecr 0,nop,wscale 7], length 0
18:11:05.892703 IP <IP_ADDRESS>.42376 > <IP_ADDRESS>.6379: Flags [S], seq 1513100388, win 14600, options [mss 1460,sackOK,TS val 773648381 ecr 0,nop,wscale 7], length 0
18:11:05.892723 IP <IP_ADDRESS>.6379 > <IP_ADDRESS>.42376: Flags [S.], seq 174277326, ack 1513100389, win 14480, options [mss 1460,sackOK,TS val 773688703 ecr 773648381,nop,wscale 7], length 0
18:11:05.894383 IP <IP_ADDRESS>.42376 > <IP_ADDRESS>.6379: Flags [F.], seq 15, ack 2413, win 160, options [nop,nop,TS val 773648383 ecr 773688704], length 0
18:11:05.894533 IP <IP_ADDRESS>.6379 > <IP_ADDRESS>.42376: Flags [F.], seq 2413, ack 16, win 114, options [nop,nop,TS val 773688704 ecr 773648383], length 0
18:11:06.031146 IP <IP_ADDRESS>.56287 > <IP_ADDRESS>.6379: Flags [S], seq 1819611675, win 14600, options [mss 1460,sackOK,TS val 774051308 ecr 0,nop,wscale 7], length 0
18:11:07.886769 IP <IP_ADDRESS>.56288 > <IP_ADDRESS>.6379: Flags [S], seq 686592816, win 14600, options [mss 1460,sackOK,TS val 774053163 ecr 0,nop,wscale 7], length 0
18:11:07.886788 IP <IP_ADDRESS>.6379 > <IP_ADDRESS>.56288: Flags [S.], seq 1370830450, ack 686592817, win 14480, options [mss 1460,sackOK,TS val 773690697 ecr 774053163,nop,wscale 7], length 0
18:11:07.887957 IP <IP_ADDRESS>.56289 > <IP_ADDRESS>.6379: Flags [S], seq 1024235732, win 14600, options [mss 1460,sackOK,TS val 774053164 ecr 0,nop,wscale 7], length 0
18:11:07.887968 IP <IP_ADDRESS>.6379 > <IP_ADDRESS>.56289: Flags [S.], seq 2275146780, ack 1024235733, win 14480, options [mss 1460,sackOK,TS val 773690698 ecr 774053164,nop,wscale 7], length 0
18:11:08.031127 IP <IP_ADDRESS>.56287 > <IP_ADDRESS>.6379: Flags [S], seq 1819611675, win 14600, options [mss 1460,sackOK,TS val 774053308 ecr 0,nop,wscale 7], length 0
18:11:08.071202 IP <IP_ADDRESS>.56288 > <IP_ADDRESS>.6379: Flags [F.], seq 75, ack 37, win 115, options [nop,nop,TS val 774053347 ecr 773690697], length 0
18:11:08.071382 IP <IP_ADDRESS>.6379 > <IP_ADDRESS>.56288: Flags [F.], seq 37, ack 76, win 114, options [nop,nop,TS val 773690881 ecr 774053347], length 0
18:11:08.908821 IP <IP_ADDRESS>.42378 > <IP_ADDRESS>.6379: Flags [S], seq 4151704632, win 14600, options [mss 1460,sackOK,TS val 773651397 ecr 0,nop,wscale 7], length 0
18:11:08.908837 IP <IP_ADDRESS>.6379 > <IP_ADDRESS><PHONE_NUMBER> IP 192.168.1.110.56287 > 192.168.1.100.6379: Flags [S], seq 1819611675, win 14600, options [mss 1460,sackOK,TS val 774050308 ecr 0,nop,wscale 7], length 0
18:11:05.892703 IP 192.168.1.110.42376 > 192.168.1.100.6379: Flags [S], seq <PHONE_NUMBER>, win 14600, options [mss 1460,sackOK,TS val 773648381 ecr 0,nop,wscale 7], length 0
18:11:05.892723 IP 192.168.1.100.6379 > 192.168.1.110.42376: Flags [S.], seq 174277326, ack <PHONE_NUMBER>, win 14480, options [mss 1460,sackOK,TS val 773688703 ecr 773648381,nop,wscale 7], length 0
18:11:05.894383 IP 192.168.1.110.42376 > 192.168.1.100.6379: Flags [F.], seq 15, ack 2413, win 160, options [nop,nop,TS val 773648383 ecr 773688704], length 0
18:11:05.894533 IP 192.168.1.100.6379 > 192.168.1.110.42376: Flags [F.], seq 2413, ack 16, win 114, options [nop,nop,TS val 773688704 ecr 773648383], length 0
18:11:<PHONE_NUMBER> IP 192.168.1.110.56287 > 192.168.1.100.6379: Flags [S], seq 1819611675, win 14600, options [mss 1460,sackOK,TS val 774051308 ecr 0,nop,wscale 7], length 0
18:11:07.886769 IP 192.168.1.110.56288 > 192.168.1.100.6379: Flags [S], seq 686592816, win 14600, options [mss 1460,sackOK,TS val 774053163 ecr 0,nop,wscale 7], length 0
18:11:07.886788 IP 192.168.1.100.6379 > 192.168.1.110.56288: Flags [S.], seq <PHONE_NUMBER>, ack 686592817, win 14480, options [mss 1460,sackOK,TS val 773690697 ecr 774053163,nop,wscale 7], length 0
18:11:07.887957 IP 192.168.1.110.56289 > 192.168.1.100.6379: Flags [S], seq 1024235732, win 14600, options [mss 1460,sackOK,TS val 774053164 ecr 0,nop,wscale 7], length 0
18:11:07.887968 IP 192.168.1.100.6379 > 192.168.1.110.56289: Flags [S.], seq <PHONE_NUMBER>, ack 1024235733, win 14480, options [mss 1460,sackOK,TS val 773690698 ecr 774053164,nop,wscale 7], length 0
18:11:<PHONE_NUMBER> IP 192.168.1.110.56287 > 192.168.1.100.6379: Flags [S], seq 1819611675, win 14600, options [mss 1460,sackOK,TS val 774053308 ecr 0,nop,wscale 7], length 0
18:11:<PHONE_NUMBER> IP 192.168.1.110.56288 > 192.168.1.100.6379: Flags [F.], seq 75, ack 37, win 115, options [nop,nop,TS val 774053347 ecr 773690697], length 0
18:11:<PHONE_NUMBER> IP 192.168.1.100.6379 > 192.168.1.110.56288: Flags [F.], seq 37, ack 76, win 114, options [nop,nop,TS val 773690881 ecr 774053347], length 0
18:11:<PHONE_NUMBER> IP 192.168.1.110.42378 > 192.168.1.100.6379: Flags [S], seq <PHONE_NUMBER>, win 14600, options [mss 1460,sackOK,TS val 773651397 ecr 0,nop,wscale 7], length 0
18:11:<PHONE_NUMBER> IP 192.168.1.100.6379 > 192.168.1.110.42378: Flags [S.], seq 763390897, ack <PHONE_NUMBER>, win 14480, options [mss 1460,sackOK,TS val 773691719 ecr 773651397,nop,wscale 7], length 0
I checked some server parameters as follows:
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
client side:
net.ipv4.tcp_timestamp = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 1
Before/after of this problem, I checked /proc/net/netstat, then some values were increased(TW, DelayedACKs, TCPPrequeued, TCPHPHits, TCPPureAcks, TCPHPAcks).
Also I checked backlog overflow, but does not seem to be that.
# nstat -az TcpExtListenDrops
TcpExtListenDrops 0 0.0
What can be considered as reason? and how can I confirm that?
|
b3c5b4e9f71e8487ca571cf222bb8c01ec86151b9beb9f9e9df79400c5b2cd59 | ['65f1802871ce47e98f929224ba885ce4'] | I am new to CNTK and all Machine Learning frameworks. I tried to do image recognition process with Faster RCNN with CNTK. I modified the "DetectionDemo.py" to refer to my own dataset (positive, negative, testImages, and finally a prediction image).
The dataset are basemap areas (you can imagine something like google map). Some areas are considered category A (labeled as A), some areas are considered category B (labeled as B), some areas are category C (labeled as C), etc. So I would like to predict the areas and its category by using other set of basemap into the CNTK as the prediction image.
No matter how big is my prediction image size, I always use the same zoom level, the same resolution (dpi, meters per cell).
On my first prediction image (around 3200 x 3200 pixels), the system produced few prediction boundary boxes like in average around half size of my prediction image size. So I expected to have the same size of prediction boundary box size when I used a larger image size. However, when I used a larger image size (around 9000 x 9000 pixels) for prediction, the system produced few prediction boundary boxes also in average around half size of my prediction image size. And this kept going. When I put a prediction image that was multiple times larger in size (around 18000 x 18000 pixels) and ran the prediction again, the system produced few prediction boundary boxes also in average around half size of my prediction image size. During all of these, the training data were the same, did not change. It still used the same model and settings.
Is this normal in CNTK? How to have a stable size of prediction boundary box result? Why the size of prediction boundary boxes result do not try to follow the average size of the labeled training data boundary?
Looking forward to some suggestions...
| 70463759f3ef44b6758666ab85afe7fc25320986189f9e1a3b2124b14bb9d252 | ['65f1802871ce47e98f929224ba885ce4'] | I am working with dojo 1.10.
This is my main script:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Title</title>
<link rel="stylesheet" href="http://SERVERABC/arcgis_js_api/library/3.10/3.10/js/esri/css/esri.css"/>
<style id="myStyle">
html, body {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
overflow: hidden;
font-family: Arial, Calibri, Times New Roman;
}
textarea, input[type="text"]
{
font-family: Arial, Calibri, Times New Roman;
font-size: 12px;
}
</style>
<script type="text/javascript" src="js/common.js"></script>
<script>
dojoConfig = {
packages: [
{ name: "js", location: "/js" }
]
};
</script>
<script src="http://SERVERABC/arcgis_js_api/library/3.10/3.10/init.js" ></script>
<script>
var map;
var streetMap;
var imageryMap;
require(["esri/map",
"esri/config",
"esri/layers/FeatureLayer",
"esri/geometry/webMercatorUtils",
"esri/geometry/Extent",
"esri/layers/ArcGISTiledMapServiceLayer",
"js/parameters",
"dojo/fx",
"dojo/window",
"dojo/parser",
"dojo/on",
"dojo/dom",
"dojo/dom-geometry",
"dojo/domReady!"], function (Map, esriConfig, FeatureLayer, webMercatorUtils, Extent, ArcGISTiledMapServiceLayer, Parameters, coreFx, win, parser, on, dom, domGeom) {
esriConfig.defaults.io.proxyUrl = "proxy.ashx";
esriConfig.defaults.io.alwaysUseProxy = false;
parser.parse();
map = new Map("map", {
center: [114.220118, 22.317574], // longitude, latitude
zoom: 1,
showAttribution: false,
lods: [
// { "level": 6, "resolution": 2445.98490512499, "scale": 9244648.868618 },
// { "level": 7, "resolution": 1222.99245256249, "scale": 4622324.434309 },
// { "level": 8, "resolution": 611.49622628138, "scale": 2311162.217155 },
// { "level": 9, "resolution": 305.748113140558, "scale": 1155581.108577 },
// { "level": 10, "resolution": 152.874056570411, "scale": 577790.554289 },
// { "level": 11, "resolution": 76.4370282850732, "scale": 288895.277144 },
// { "level": 12, "resolution": 38.2185141425366, "scale": 144447.638572 },
// { "level": 13, "resolution": 19.1092570712683, "scale": 72223.819286 },
{"level": 14, "resolution": 9.55462853563415, "scale": 36111.909643 },
{ "level": 15, "resolution": 4.77731426794937, "scale": <PHONE_NUMBER> },
{ "level": 16, "resolution": 2.38865713397468, "scale": <PHONE_NUMBER> },
{ "level": 17, "resolution": 1.1943285668550503, "scale": <PHONE_NUMBER> },
{ "level": 18, "resolution": 0.5971642835598172, "scale": <PHONE_NUMBER> },
{ "level": 19, "resolution": 0.29858214164761665, "scale": <PHONE_NUMBER> }
]
});
streetMap = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", {
id: "streetMap"
});
imageryMap = new ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer", {
id: "imageryMap"
});
map.addLayer(streetMap);
map.addLayer(imageryMap);
imageryMap.hide();
onlyForTesting();
map.on("load", function () {
map.resize();
});
});
</script>
</head>
<body>
<div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%; height:100%;">
<div id="header" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
<div id="languagesContainer"></div>
</div>
<div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" baseClass="dijitContentPaneNoPadding"></div>
</div>
</body>
</html>
This HTML file should load another .js file called parameters.js that is located inside the js folder. The js folder and the HTML file is located in the same folder (same level).
It is working on a local computer. And I can create and get the object of the Parameter module that is loaded from js/parameters. But when I moved all the website files to the SERVERABC machine (inside wwwroot of IIS7) WIndows Server 2008 R2, the script will not run properly. It stops in the middle and does not show anything. It will only run properly if I delete the "js/parameters" inside the Require (and delete the "Parameters" variable too).
How can one script works on a computer but does not work on another? Is there any setting I must do first on the Server machine? Notice that all the Dojo javascript reference files are located in SERVERABC machine, either when I run my script on my local computer or from server SERVERABC.
Any ideas or solution will be much appreciated.
|
2385c6cdef1bba6af5e6b33bf0b69379b885b036038be6b5ec8dfaff34241b15 | ['65f7e8f8130745be8bfd738e110e2d14'] | You have to run the
if (isset($_POST['submit'])){
global $u;
$u = 'yes';
}
before the
if(!isset($u)){
echo 'the $u has no value';
} else if(isset($u)){
echo 'the $u has a value of yes';
}
PHP reads the code line by line, so isset($u) always return FALSE until the line $u = 'yes'; is run.
| 6f637805c06ece14e14e60082b12bdc548ab3f2485a59dfcfa2559fe67d18255 | ['65f7e8f8130745be8bfd738e110e2d14'] | You cannot use continue inside short if-statement. Short if-statements is for returning values, like this
$val = $bool ? $one : $two;
Now, $val will have either the value of $one or the value of $two, depending of the truth value of $bool.
continue is no value, so it cannot be used in short if-statement. Use normal if-statement for this operation.
In this case, I would have done it like this:
for ($x=1; $x<=5; $x++){
if($x == 3) continue;
//some code here
}
|
6a45173f5605ad18df2a12bd4e50512d94fb275ae1e2d30ec8f9c2bd395aa914 | ['66196c4bc91640f1a59797c6e070e22c'] | I have this snippet below and I';m trying to make it an if/else statement and I'm getting syntax errors...
<!--script for changing Number of Columns-->
$(window).load(function(){
var idx = $('select[name="numNames"]').children('option:selected').index();
if (idx < 7){
$('.oneColumn').click(function() {
$('.IH_pINameRow').removeClass("floatLeft ");
$('.IH_pINameRow').addClass("floatNone ");
$('.odd').removeClass("leftMargin");
$('.even').removeClass("rightMargin ");
$('.pI_nameText').removeClass("textAlignLeft textAlignRight");
$('.pI_nameText').css('font-size', '2em');
$('.pI_nameText').addClass("1col");
$('.pI_nameText').removeClass("2col");
$('label.twoColumn').css('background-position', '-104px -52px');
$('label.oneColumn').css('background-position', '-104px -26px');
} else {
return false;
}
}); //error is here//
if (idx > 3){
$('.twoColumn').click(function() {
$('.IH_pINameRow').removeClass("floatNone ");
$('.IH_pINameRow').addClass("floatLeft ");
$('.odd').addClass("leftMargin");
$('.even').addClass("rightMargin ");
$('.pI_nameText').css('font-size', '1em');
$('.pI_nameText').removeClass("1col");
$('.pI_nameText').addClass("2col");
$('.odd').removeClass("textAlignLeft");
$('.even').removeClass("textAlignRight");
$('.even, .odd').addClass("textAlignCenter");
$('label.twoColumn').css('background-position', '-104px -26px');
$('label.oneColumn').css('background-position', '-104px -52px');
$('label.leftAlignment').css('background-position', '-104px -52px');
$('label.centerAlignment').css('background-position', '-104px -26px');
} else {
return false;
}
});
});
I'm also not sure if the code scope is correct such that the idx variable is available to the second function...
| 05658f977eb84a2a209d0cc16834a8f3d7137a6832a037a8b3ad693f7a60bae5 | ['66196c4bc91640f1a59797c6e070e22c'] | I'd like to add the index of a given radio button to a URL string, but in the middle and have that passed to the value of a hidden input in a form.
here is the code so far:
jQuery
<script type='text/javascript'>//<![CDATA[
$(function(){
$('input[name="Names"]').click(function () {
var idx = $(this).index(':radio')
$('.submission input[name="image"]').val("http://URL/images/0 + (idx + 1) + .jpg");
})
});//]]>
</script>
HTML
<div class="submission">
<input type="hidden" name="name" value="I'm Here Notification Sign" />
<input type="hidden" name="price" value="10" />
<input type="hidden" name="image" value="http://URL/images/01.jpg"/>
</div>
This obviously doesn't work, but for output i'd like to see http://URL/images/02.jpg when clicking on radio button 2 etc.
Thanks!
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.