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 |
|---|---|---|---|---|---|
c185db0f990ed4e3b558a95064abc0f634388397f89077549cfb09ed367cab05 | ['7c019c91510d4fc4852b741871521cf3'] | I am making a small database application for the experience, but I am having a problem with actually accessing the database from my PHP code. I've tried accessing the file name, accessing the separate mysql file. But whatever I do, I get an error message
<?php
$password = md5("passhash");
$user = array("name"=> "JohnDoe", "password" => $password, "email" => "<EMAIL_ADDRESS><PERSON>", "password" => $password, "email" => "email@email.com");
try {
$db = new PDO("mysql:host=localhost; dbname=users.ibd; port=8889", "root", "root");
...
}
Unable to connectSQLSTATE[HY000] [1049] Unknown database 'users.ibd'
Do you guys have any experience with this error message and what I could possibly be doing wrong when it comes to declaring the database name in my PDO initialization?
| dc18eb0ec960c99b6ec14aad8a3f47623ed33beea1260c7dc2213eb0fe57f9a5 | ['7c019c91510d4fc4852b741871521cf3'] | You need to install the module in order to use it. If, for example, you needed vue-tabs-components somewhere in your web app, you are going to need that source code for that module in order to use the tabs.
When it's served to the client, the code gets packaged and bundled so it's true, they don't need npm, but you do as the developer.
And regardless of if you are front-end or not, if you are using Javascript, you're more likely than not going to need NPM at one point in the development process.
If you want to use CDN's, you could check https://cdnjs.com/
There are CDN's of some NPM front end libraries, but it's not always assured you'll find what you're looking for.
|
caeea8ec1d609fc7d6ed569764e6ff015b2ba555c76ecb6fca1a62a88b588474 | ['7c026ede583046b69f289ff0d5ce1829'] | Hi guys new coder here... just need some help.
I want to display a nested data in vue having vuetify
here is my data:
{
"data": [
{
"id": 1,
"customer": {
"id": 88,
"name": "<PERSON>",
"mobile": "240-545-5366 x7059"
},
"item": "rau",
"qty": "4",
"fit": {
"name": "fourth"
},
"shop": "Metz, <PERSON> and <PERSON><PHONE_NUMBER>"
},
"item": "rau",
"qty": "4",
"fit": {
"name": "fourth"
},
"shop": "Metz, Cole and McKenzie"
},
],
}
I am using Laravel as a back end. not sure about the proper term but I used the Laravel resource functionality to somewhat relate my table together that's why I got this nested data.
this is my vue file and I used vuetify data tables to display the above data
<script>
export default {
data () {
return {
search: '',
dialog: false,
edit:false,
items:[],
headers: [
{text: 'customer',align: 'start',sortable: false,value: 'customer',},
{ text: 'item', value: 'item' },
{ text: 'qty', value: 'qty' },
{ text: 'fit', value: 'fit' },
{ text: 'shop', value: 'shop' },
],
}
},
created(){
this.fetchItems();
},
methods: {
fetchItems(){
axios.get('api/item')
.then(res=>{
this.items = res.data.data;
});
}
}
}
</script>
<template>
<v-card>
<v-card-title>
Items
<v-spacer></v-spacer>
<v-btn depressed color="primary" @click="addNew"> ADD</v-btn>
<v-spacer></v-spacer>
<v-text-field
v-model="search"
append-icon="mdi-magnify"
label="Search"
single-line
hide-details
></v-text-field>
</v-card-title>
<v-data-table :headers="headers" :items="items" :search="search"></v-data-table>
</v-card>
</template>
thank you for the help guys.
| 55b87a7bdfcc02293b9414dfe545b6b58be5e9607fc0fa6fb462c9da4288e046 | ['7c026ede583046b69f289ff0d5ce1829'] | I am trying to build a sms notification using laravel,
I want to execute a http url once i hit the function on a laravel's controller with this code
public function sendSMS()
{
return 'https://api.smsglobal.com/http-api.php?action=sendsms&user=testuser&password=secret&from=Test&to=61447100250&text=Hello%20world'
}
Am expecting this to execute the url to send the sms notification but with no avail, it will be a great if someone will help me on how to achieve this.
|
b018c711f69303d7482120f1e54a9a49116ad274c6b6fda58a0307085a773b54 | ['7c03c1bcca694e2396b78af20566ba82'] | "Untagged union as fibered coproduct" is a great answer to the question I was trying to ask, though at a slightly higher level of abstraction than I hoped for. I think <PERSON> paper might elucidate this for me, though I need to re-read it to make sure.
One thing I'm not sure how to fix is the use of $0$ and $1$ to represent distinct singleton terms. I understand the potential confusion between $0$ and the empty type, but is there a standard notation for distinct singleton types? | 98d9526274090c4a4facc1ba5a9429869a62874d6a32ff3197c66033bb5b5b00 | ['7c03c1bcca694e2396b78af20566ba82'] | These are
the words to, two and too.
We three are one
For ear or tongue
Yet not for eye nor hand
They sound the same, but are written differently.
Of our good three
But one lacks three
Only one of the words has fewer than three letters, the others have exactly three.
As this riddle lacks we
None of these words appear in the riddle.
Note that
There are other possibilities, eg. so, sew and sow, but given the references to one and three, two seems the most natural answer.
|
0c26c2fa55efdab48752d5b0354d300cf4ca48dc55a1ff0582487f570fe791f5 | ['7c0b356b81b54dd59a0ab0ad180b06f4'] | For opening a file to write in Ubuntu on Windows bash, you can type -:
nano filename.txt
The above command will allow you to write/edit in the file after which, you can use ctrl+x and then press 'y' to save. Check/view the file content using -:
cat filename.txt
| 63f9935c65b53b347a53434eb50cb66286f1d5329f6804a7731a011cc78bae78 | ['7c0b356b81b54dd59a0ab0ad180b06f4'] | To remove all special characters in the given para:
word=""
for ch in para:
if ch.isalnum() or ch==" ":
word+=ch
To calculate the less frequently used words whose count < 3:
x=[]
for i in word.split():
if word.split().count(i)<3 and i not in x:
x.append(i)
To print the last 20 less frequent words:
print(x[-20:])
It works perfectly fine:)
|
ec5d7d4f52ae97886684ac188a1e3db2c18083aa4c1b5f69962009735832309d | ['7c2ac843f4da429db10961fe2796b7a1'] | I am currently creating a report in SSRS. In order to save the job of creating a load of Stored Procedures I Found some code that would populate my parameter only with results that already exist in the table(i will call it the ID). The idea is I only want the Id values that already appear in the table so that there are not any blank records.
I have some code on my report that is as follows:
Public Shared Function RemoveDups(ByVal items As String) As String
Dim noDups As New System.Collections.ArrayList()
Dim SpStr
SpStr = Split(items ,",")
For i As Integer=0 To Ubound(Spstr)
If Not noDups.Contains(SpStr(i).Trim()) Then
noDups.Add(SpStr(i).Trim())
End If
Next
Dim uniqueItems As String() = New String(noDups.Count-1){}
noDups.CopyTo(uniqueItems)
Return String.Join(",", uniqueItems)
End Function
This is whats in the parameter to get the values:
=Split(Code.RemoveDups(JOIN(Parameters!BU.Value, “,”)), “,”)
This gets the ID from the dataset i show from the table and removes all of the duplicated ones.
The Problem I am have is I an ID eg 5 that shows in the parameter but it does not show its data in the table I have created. I have run an sql query and it does have record. The relevant data also appears when the filter is not on the table but not when it is.
Is there anything I can do to solve the problem.
Thanks in advance.
| a425a5b43058ba395c84893751e9273aeaf7d744bd8d5392fab2d5b18dc0fadc | ['7c2ac843f4da429db10961fe2796b7a1'] | I am currently looking at a system that implements the PayPal api. As a part of this I need to get the feeAmt() which is the fee that is paid to paypal for processing the payment.
From the documentation that I have looked at it appears that I have to implement the getExpressCheckoutDetailsReq() method in order to get the information that I want however no matter what I have tried I am struggling to do this. I should also let you know that I am currently developing my application using Java so using this is going to be best.
If any more explanation is needed please don't hesitate to ask and I will do my best to amend the post :)
|
45eea032bd82f0843db7f572cf7f7245b8fdffd93f4e9a37d7ef03c09a331f43 | ['7c2c2ce2fa124497addc668ddf97675d'] | I want to prank my brother by throwing all domains he tries to visit to a webserver I have on the network.
but how do I edit his /etc/hosts file in such a way that I will redirect everything to that server?
<IP_ADDRESS> is the server
| 45e603e28ce2b2cc0dc4520f4d1e72146219ca5193e939ed1b6a462734c9892f | ['7c2c2ce2fa124497addc668ddf97675d'] | I've been running Lubuntu for about 4 years now (since I think 12.04 actually?), however, something unforeseen happened.
I got a relationship that actually lasted for more than 2 years o.0
Anyways, back on topic, she has to do homework now and then on my laptop, which is perfectly fine by me.
I created a new user for her so she doesn't have to see my documents. ( ͡° ͜ʖ ͡°)
However, I have a tonne of things in my menu that she doesn't have to bother with like:
Oracle Java stuff (she does need the JRE, but she can still access that)
Etherape
the Wine folder
a lot of stuff out of the Preferences folder
the System Tools folder
Just to name a few.
However, I can't simply throw them out for everybody, because I do need them.
Does anybody here know a good (and preferably simple - and safe?) solution for it?
It's not that I don't trust her, it's just that I want to strip as much stuff she doesn't need as possible.
Cheers!
|
4cf89c203b3ec32cb29e27628b28b3f1b2a6bcfdfbaeff91824a08c79cb75a00 | ['7c37d6cfa92c49b4b51e8a4e4b6bbdeb'] | So, I have a table with the following structure;
CREATE TABLE [dbo].[LoadAgencyInfo](
[Agency] [varchar](4) NULL,
[Fund] [varchar](1) NULL,
[Account] [varchar](14) NULL,
[LName] [varchar](20) NULL,
[FName] [varchar](9) NULL,
[SSN] [varchar](9) NULL,
[Prior] [varchar](3) NULL,
[BalDue] [varchar](8) NULL,
[DRSBal] [varchar](8) NULL,
[Fill1] [varchar](16) NULL,
[FileDate] [varchar](6) NULL,
[Fill2] [varchar](3) NULL,
[P1] [varchar](2) NULL,
[P2] [varchar](2) NULL
) ON [PRIMARY]
GO
I then have a flat file that I intend to bulk upload to the database. The file format is as follows and is just a normal text file, see below; there are several different files but they all follow this format.
Sample Data
2000S10000252 VYUSBN RUDXOD 0099882260000006824100000000 181802
2300S20000350 TEVXXXX TGXC 0025045640000000652800000000 052153
The file is supposed to follow the format below based on character length. Each cell should fill with the correct information based on where the characters are in the file/record. The records with a width of zero fill should fill with zeros. The records with skip this field should skip over the particular field and not put any data into the cell.
File Break Down
Field Name
Character Start
Character End
Width
Agency
1
4
4
Fund
5
5
1
Account
6
19
14
LName
20
39
20
FName
40
48
9
SSN
49
57
9
Prior
58
60
3 (Zero fill, doesn’t come from text file default to 000)
BalDue
61
68
8
DrsBal
69
76
8 (Zero fill, doesn’t come from text file default to 00000000)
Fill1
77
92
16 (Skip this field)
FileDate
93
98
6
Fill2
99
105
7 (skip this field)
The flat file is supposed to follow a strict guideline in terms of character length, for example the first four characters belong to the agency cell, and the next character belongs to the fund cell, etc. Notice there aren’t any delimited characters so I am using a SQL format file to help process the records and input them into the database. However no matter what I do the appropriate cells are either not filled in or partially filled in and when I attempt to skip over fields the fields I am skipping get populated. I have tried changing the datatype to nvarchar but still doesn’t work. Sometimes the data gets garbbled and doesn’t translate properly.
See the format file below;
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharFixed" MAX_LENGTH="4" />
<FIELD ID="2" xsi:type="CharFixed" MAX_LENGTH="1"/>
<FIELD ID="3" xsi:type="CharFixed" MAX_LENGTH="14"/>
<FIELD ID="4" xsi:type="CharFixed" MAX_LENGTH="20"/>
<FIELD ID="5" xsi:type="CharFixed" MAX_LENGTH="9"/>
<FIELD ID="6" xsi:type="CharFixed" MAX_LENGTH="9"/>
<FIELD ID="7" xsi:type="CharFixed" MAX_LENGTH="3"/>
<FIELD ID="8" xsi:type="CharFixed" MAX_LENGTH="8"/>
<FIELD ID="9" xsi:type="CharFixed" MAX_LENGTH="8"/>
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="Agency" xsi:type="SQLINT" LENGTH="4"/>
<COLUMN SOURCE="2" NAME="Fund" xsi:type="SQLNVARCHAR" LENGTH="1"/>
<COLUMN SOURCE="3" NAME="Account" xsi:type="SQLNVARCHAR" LENGTH="14"/>
<COLUMN SOURCE="4" NAME="LName" xsi:type="SQLNVARCHAR" LENGTH="20"/>
<COLUMN SOURCE="5" NAME="FName" xsi:type="SQLNVARCHAR" LENGTH="9"/>
<COLUMN SOURCE="6" NAME="SSN" xsi:type="SQLINT" LENGTH="9"/>
<COLUMN SOURCE="7" NAME="Prior" xsi:type="SQLINT" LENGTH="3"/>
<COLUMN SOURCE="8" NAME="BalDue" xsi:type="SQLINT" LENGTH="8"/>
<COLUMN SOURCE="9" NAME="DRSBal" xsi:type="SQLINT" LENGTH="8"/>
</ROW>
</BCPFORMAT>
Any help as to why this isn’t working would be very beneficial
| 291506e1e6efbab5e83aa5be618a9baf2ad5c42b6394ae1e25a190c046c1a62c | ['7c37d6cfa92c49b4b51e8a4e4b6bbdeb'] | So, I’ve made some adjustments to the SQL format xml file and to the SQL command itself as you can see below. The issue now is that all of the appropriate fields are populated when I run the command, but the last cell in the first row gets all the subsequent row’s data as there are over 2000+ rows. What should happen is after the sixth character in the FileDate field the data should move to the next row instead of putting all of the subsequent rows in the FileDate field. I have tried updating the ROWTERMINATOR field with 0x0a, 'n, 'r, 'r'n, 'n'r but nothing seems to work. I am also puzzled as to why the command isn’t respecting the MAX_LENGTH attribute as I have it set to 6 and why none of the row terminators aren’t working? I’ve been at this for days and it is driving me wild.
The source file is plan text from a unix machine and only has lf as the row terminator. I cant post the image of the data because I dont have 10 rep points.
XML File
<?xml version="1.0"?>
<BCPFORMAT xmlns="http://schemas.microsoft.com/sqlserver/2004/bulkload/format" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RECORD>
<FIELD ID="1" xsi:type="CharFixed" LENGTH="4" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="2" xsi:type="CharFixed" LENGTH="1" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="3" xsi:type="CharFixed" LENGTH="14" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="4" xsi:type="CharFixed" LENGTH="20" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="5" xsi:type="CharFixed" LENGTH="9" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="6" xsi:type="CharFixed" LENGTH="9" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="7" xsi:type="CharFixed" LENGTH="3" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="8" xsi:type="CharFixed" LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="9" xsi:type="CharFixed" LENGTH="8" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="10" xsi:type="CharFixed" LENGTH="16" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>
<FIELD ID="11" xsi:type="CharTerm" MAX_LENGTH='6' TERMINATOR="0x0a" COLLATION="SQL_Latin1_General_CP1_CI_AS"/>/>
</RECORD>
<ROW>
<COLUMN SOURCE="1" NAME="Agency" xsi:type="SQLCHAR" />
<COLUMN SOURCE="2" NAME="Fund" xsi:type="SQLCHAR" />
<COLUMN SOURCE="3" NAME="Account" xsi:type="SQLCHAR" />
<COLUMN SOURCE="4" NAME="LName" xsi:type="SQLCHAR" />
<COLUMN SOURCE="5" NAME="FName" xsi:type="SQLCHAR" />
<COLUMN SOURCE="6" NAME="SSN" xsi:type="SQLCHAR" />
<COLUMN SOURCE="7" NAME="Prior" xsi:type="SQLCHAR" />
<COLUMN SOURCE="8" NAME="BalDue" xsi:type="SQLCHAR" />
<COLUMN SOURCE="9" NAME="DRSBal" xsi:type="SQLCHAR" />
<COLUMN SOURCE="10" NAME="Fill1" xsi:type="SQLCHAR" />
<COLUMN SOURCE="11" NAME="FileDate" xsi:type="SQLNCHAR" />
</ROW>
</BCPFORMAT>
|
e1d0e7f5488adfae2c9415c5d1c6399e771b11b71fd6749e08285827d9e880b6 | ['7c427f0902a443bcbef9366862b32de5'] | First thing, you won't see emptys divs.
Example - 1
$(document).ready(function() {
$('.change').click(function() {
$('#first').toggle();
$('#second').toggle();
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="first" style="display: none">teste</div>
<div id="second">teste2</div>
<button class="change">change</button>
Example - 2
You can check if a element is visible with that:
$(document).ready(function() {
$('.change').click(function() {
if($('#first').is(":visible")){
$('#first').hide();
$('#second').show();
}else{
$('#first').show();
$('#second').hide();
}
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="first">test1</div>
<div id="second">test2</div>
<button class="change">change</button>
| fb10c0edc940e0acef92d10cd114d9874b6267981291da0e3d443483591637d2 | ['7c427f0902a443bcbef9366862b32de5'] |
$(function(){
let motion1 = $('.motion1');
let motion2 = $('.motion2');
let images = $('.column1 img');
images.each(function(){
if($(this).parents().hasClass('motion1')){
console.log('hi');
} else{
console.log('no');
}
});
});
#main__slider{
width:40rem;
height:25rem;
margin: 0 auto;
display:grid;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr)
}
.column1{
border:1px solid;
position:relative;
}
img{
width:100%;
height:100%;
object-fit:cover;
position:absolute;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="main__slider">
<div class="column1 motion1">
<img src="https://www.arup.com/-/media/arup/images/perspectives/themes/cities/cities-alive/cities-alive-header.jpg?h=1125&la=en&w=2000&hash=415B3F648DFB5F1822DD43328B988A2C78318E7F" alt="">
<img src="https://livability.com/sites/default/files/Great%20Cities%20for%20Filmmakers.jpg" alt="">
</div>
<div class="column1">
<img src="https://www.cesarsway.com/sites/newcesarsway/files/styles/large_article_preview/public/Common-dog-behaviors-explained.jpg?itok=FSzwbBoi" alt="">
<img src="https://d17fnq9dkz9hgj.cloudfront.net/uploads/2018/03/Pomeranian_01.jpeg" alt="">
</div>
<div class="column1">
<img src="https://i.kinja-img.com/gawker-media/image/upload/s--vHt6tbFa--/c_scale,f_auto,fl_progressive,q_80,w_800/xjmx1csashjww8j8jwyh.jpg" alt="">
<img src="https://www.drdavidludwig.com/wp-content/uploads/2017/01/1-RIS_6IbCLYv1X3bzYW1lmA.jpeg" alt="">
</div>
<div class="column1">
<img src="https://www.railengineer.uk/wp-content/uploads/2017/10/AT300_HULL-TRAINS_with-logo.jpg" alt="">
<img src="https://www.virginexperiencedays.co.uk/content/img/product/large/steam-train-trip-17104839.jpg" alt="">
</div>
<div class="column1 motion2">
<img src="https://www.healthline.com/hlcmsresource/images/topic_centers/977-When_do_girls_stop_growing-732x549-thumbnail.jpg" alt="">
<img src="https://images.askmen.com/1080x540/2018/09/06-125712-how_to_talk_to_girls_on_tinder.jpg" alt="">
</div>
<div class="column1">
<img src="https://www.familyeducation.com/sites/default/files/inline-images/baby%20girl%20names%20image.jpg" alt="">
<img src="https://cdn2.momjunction.com/wp-content/uploads/2015/03/Learning-Activities.jpg" alt="">
</div>
<div class="column1 motion1">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/Team_Korea_Rio_2016_06.jpg/1200px-Team_Korea_Rio_2016_06.jpg" alt="">
<img src="https://expo.advance.net/img/9c4d2bc2c7/width960/30gallery_state_indiv_gym_.jpeg" alt="">
</div>
<div class="column1">
<img src="https://cdn4.sportngin.com/attachments/call_to_action/9127/0843/_7006687_large.jpg" alt="">
<img src="https://cdn.vox-cdn.com/thumbor/4pOVrNf6Ezmge6_VKHgYmAyCNoU=/0x0:3642x2712/1200x800/filters:focal(1275x341:1857x923)/cdn.vox-cdn.com/uploads/chorus_image/image/54106607/usa_today_9864342.0.jpg" alt="">
</div>
<div class="column1">
<img src="https://livability.com/sites/default/files/Great%20Cities%20for%20Filmmakers.jpg" alt="">
<img src="https://media.wired.com/photos/59bafdf204afdc5248726f5c/master/w_2400,c_limit/BMW-TA.jpg" alt="">
</div>
</div>
|
3ec78904b2f734906702e385a4a24842f2b74efdb14e5a293a6ddbb5a9469897 | ['7c4aa630789342e1a548732b9c91a65b'] | My main target is to globally enable all ports to compile with macports-clang-3.4 and use libc++ instead of libstdc++.
For example when working with one port I need to set configure.compiler=macports-clang-3.4 and configure.cxx_stdlib=c++11 to the command line. But how I can set this variables via macports configuration globally so that any invocation of port would automatically use my defaults? variants.conf accepts only variants and no keywords and macports.conf only includes global keywords.
| 0b7717eb4f11de9eb75faca54473d59d53c42ce2291cf9f87e123e55ada3cc5d | ['7c4aa630789342e1a548732b9c91a65b'] | I'm working on an application to help create a grocery list based on the meals (and their ingredients and quantity) that the user provides. So far, the epics that I've come up with are:
1.) Research (units of measure, popular food items and categories, etc.)
2.) Login
3.) Scenarios (have food and possible recipe, need meals etc.)
4.) My Fridge (feature that allows user to store what they already have in the fridge)
5.) Units of measure (locale detection? how do we allow the user to switch between imperial and metric systems)
6.) Grocery list (how to display, best way to display, email/sms grocery list to self, email/sms to others, etc.)
7.) Food (need to find the most common way each food is measured, display est calories, etc.)
I'm creating epics off major components of the application. Is this the right way to frame them?
|
5435f7ac572be138d8efe2c01edd1b7f76dbb4cca0fc65aca14c7918c9da4889 | ['7c4e98d7b0d14fa891955d89ce6cf40c'] | If there was never an MS account attached then I'd expect to be asked to add one. I'm not, it's just asking for the MS account password. As I said, the login password does not work so it certainly seems like there's some other account login associated. | e75e434454bdfc3a74cedd6190a4dea6cc7a484e16312898d08fb6c89ebfb84f | ['7c4e98d7b0d14fa891955d89ce6cf40c'] | I'm trying to update my father's Windows 8 PC to 8.1 and then to 10. Unfortunately there's a bit of a mystery surrounding his Microsoft account login.
His user account has a password that he uses to login, but when I updated to 8.1 the process requested his MS account password and the login password didn't work. On reverting to 8.0 and going to the User Settings it has an option to sign in to the MS account but that also doesn't seem to share the login password. I've been to the live.com account page and it declares that the account doesn't exist.
I'm not sure how to proceed. I'd prefer to sort out his MS account rather than switching to a local account but it seems to be in some weird limbo where the PC thinks one is linked but the site doesn't recognise that the account exists.
|
529ab9dbf736336840c6ac261a6baa4f161612809b2049a5730a42c942fc9f63 | ['7c6bd28c134546b2b5717dbb534d4cfa'] | Yes, you can have many different assert statements inside of j/x/n Unit tests.
However, as you have found, should any of the asserts fail, the entire testMethod will fail as a result.
As it so happens, inside of a testMethod the test runner will begin executing the assert statements. As soon as one fails the testMethod will return, not executing any additional asserts.
| a6606be8d9d8e7104dc4bfa8a05e89368a11ebc0ed1143e72ed6172834a46e4d | ['7c6bd28c134546b2b5717dbb534d4cfa'] | Looks like the restlet framework has called getRequestEntityStream() on the Request object which in turn calls getInputStream(), so calling getReader() on the request throws IllegalStateException.
The Servlet API documentation for getReader() and getInputStream() says:
public java.io.BufferedReader getReader()
...
...
Throws:
java.lang.IllegalStateException - if getInputStream() method has been called on this request
public ServletInputStream getInputStream()
...
...
Throws:
java.lang.IllegalStateException - if the getReader() method has already been called for this request
From the documentation it seems that I cannot call both getReader() and getInputStream() on the Request object (even though it wasn't me that was doing it).
I had to instead use getInputStream() rather than getReader().
|
4471a2625103375c682ef03a237de5372470088c97b3f4c737d60db77d41fa28 | ['7c6f5d3e5b30413ea4e069b4f8087f90'] | I'm not sure that this will definitely address all of the warnings, but try adding the argument stringsAsFactors=FALSE to the end of the line where you create the data.frame.
Just by creating a character column you are using factors, which can't be modified with a simple assignment command. Your command should read x<-data.frame(name=character(920),date=numeric(920),ton=numeric(920),stringsAsFactors=FALSE).
| 03fd53d95d02647c22a2800da1f45f4bb8f3575c617861632fbf1ca27ca5e387 | ['7c6f5d3e5b30413ea4e069b4f8087f90'] | I've been writing a program in R that outputs randomization schemes for a research project I'm working on with a few other people this summer, and I'm done with the majority of it, except for one feature. Part of what I've been doing is making it really user friendly, so that the program will prompt the user for certain pieces of information, and therefore know what needs to be randomized. I have it set up to check every piece of user input to make sure it's a valid input, and give an error message/prompt the user again if it's not. The only thing I can't quite figure out is how to get it to check whether or not the file name for the .csv output is valid. Does anyone know if there is a way to get R to check if a string makes a valid windows file name? Thanks!
|
1571932793c083944246b4309bacfb53219f963f91f967129d3a0faf3b16e9f2 | ['7c76a0f0c3ac47beb7ace98a04cc9583'] | Personally, if I had to do something like this and was for whatever reason prevented from refactoring credentials as I go, I'd add two more branches, ending up with an arrangement similar to the following:
master: the original code you inherited
localcred: branch from master, and add just the one patch that changes all the credentials to what you need locally. Treat this branch as read-only hereafter (and possibly add a hook to prevent accidental commits).
feature: branch from master, and all fixes go here (and possibly add a hook to prevent merging with the patch in localcred)
local: a branch (not a tag!) that will start out as a branch of localcred, and then merge feature whenever you need to run your unit tests. All testing happens from here, but no development happens here. In addition, this branch is disposable, because you might want to rebase inside of feature, and the fastest way to deal with the result will be to delete branch local, branch it again from localcred and merge feature before running your tests. This is likely to be a common enough operation in my workflow that I'd build an alias to do it repeatedly in just a few keystrokes, but I work the hell out of the disposability of Git branches, which kind of freaks out some people who watch me, so YMMV.
When you think your fixes are ready for publication, you do your final rebase of feature to clean up the history, dump and recreate local for your final test, merge feature into master, and once that's accepted upstream, merge master into localcred and rebase your credential patch to the top, then dump and recreate local and feature and play the game all over again.
If you want to rapidly test a large set of tiny variations of code without having to commit and merge each time, checkout local, make your changes until you're happy, commit, and immediately cherry-pick from local into feature, then drop and recreate local.
Does that satisfy your needs?
| 46444a806523f02d735f34f5d6cb65117602b6790d808694fdc0a48fda64d20d | ['7c76a0f0c3ac47beb7ace98a04cc9583'] | @SantiBailors first you say "hopefully no" and then "why does it matter" - so you clearly understand why it matters. Not because of language being better or worse, but because of market context. Using a modern language has, often times, technical advantages - tooling, libraries, etc - so it would probably be useful. Being able to hire people to join the project - even more useful. |
7d9d51d43bb142d04fe0957335e4edde202baf91e6cf5459673dffb63827aa70 | ['7c77cc5acf3447b5b0a4db765e6eaf7d'] | How I can parse int from JSON which I get from Cloud Pub/Sub? I tried many ways but no one was successful. Here is my example code and output from it.
exports.subscribe = (event, callback) => {
const pubsubMessage = event.data;
console.log(Buffer.from(pubsubMessage.data, 'base64').toString());
console.log(pubsubMessage.temp);
callback();
};
| 00041a7aca533196ed32e913c2c27f5eb3c7688a6c7e7356db0e7d639d1e0dd8 | ['7c77cc5acf3447b5b0a4db765e6eaf7d'] | I have some transaction data frame with customerId, date(Date class, but separate year and month num cols are available too), value. I need group data by ID and month and do summarise value and convert it to time series for stl function. But some customer did not have transaction in some month and you need for stl have complete order time series and I want it complete with zero values. And for each customer a want complete year-month and calculate trend and seasonal from his first year-month transaction to now. What it easier way to do it?
I tried simple generate for each year-month transaction with zero value and group by and put vector to ts function. But generate rows for 2000 customer is slow. Is a better way?
Simple data:
x = data.frame(customerId = c("A","B","A","B","A","B","A","A", "B", "B","A"),
date = as.Date(c("2018-09-11", "2018-09-12", "2018-09-25", "2018-11-21", "2018-11-21", "2018-12-21", "2019-01-05","2019-02-20","2019-03-05","2019-05-01","2019-05-28")),
value = runif(11,500,2000))
I expect to have time series like this for each cutomer and his year-month range:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2018 3252.00 1948.73 0.00 3614.50
2019 0.00 5588.50 0.00 4973.50 1164.00 0.00 0.00
|
20112d35eb04f05cec7bbc0d7ffbfa2f285b714cd77ec1361b0ab306b74e0bc9 | ['7c7b38d5d008483eb3a118bef62311ef'] | Here is the complete story. I have this ROG Strix G g531gv laptop for almost 6 months now.
specs: i7 9750h, rtx2060(mobile), intel SSD 660p M.2 nvme 512gb, 16gb 2666mhz ram, 1tb 5400 seagate HDD
Temps when playing games that's installed on the ssd was 28c on the lows and 50c if it's really hot.
The first time the drive failed(suspected) was last march 12. What happened was i was just doing things on my laptop like browsing on chrome then it slowed down slowly to a point that every action done was delayed by a minute. I hard reseted the laptop upon booting up it got stuck on the manufacturer's logo, tried waiting for an hour but it still stuck. Tried recovering with system image, didn't also work it was very slow. The only option I had was to reinstall windows. I wiped the said SSD and installed windows on it again. Used it for 2 weeks without any fuss. Then came April 7, the problem came back. Same thing happened, slow down to a point that it's not responding anymore. Re-installed windows again, this time i tried removing the HDD to narrow down the culprit. Everything was fine again until April 23, the problem came back. I reinstalled windows again but this time I tried reinstalling all the drivers and updated the firmware of the SSD. I used windows 10 check disk but no problem was found. I also used crystialdisk but also no problem was found. The problem was reproduced when i used Intel SSD Drive Tool box's Full diagnostic scan. At 56% the problem came back, slow down until it was not responding anymore. I tried waiting for it to go away for 3 hours, was thinking that it was just the full diagnostic scan that slowed the system down but it got stuck on 56% for 3 hours. Now i wiped all the drives, installed windows on the 1TB HDD so that i can still use the laptop without trouble. I am currently doing a full reformat of the SSD, after reformat im gonna try to run the full diagnostic scan again.
I already talked to the shop where i bought the laptop, still under warranty but because of the covid-19 lockdown on our area, there's nothing the shop and I can do about it at the moment. I just want to know what really is the problem. primary culprit is the SSD. second is the nvme slot of the motherboard but i dont have anything to support that theory. Sorry for the wall of text. Any help is well appreciated! Thanks!
| 5ba5b99dc822f41a20820030710019c90e124410097015472e4863a1ef897fac | ['7c7b38d5d008483eb3a118bef62311ef'] | <PERSON> Our teacher said my proof isn't correct and that I should I start out a proof by choosing some $(b_i) \in \prod Im (f_i)$ and see where this goes. I'm unable to follow his suggestion and write a proper proof. Or he may have said something entirely different, unfortunately I don't remember exactly now. |
161eacf6dacf8e3d1b867cded19b0e3599c6c6ea5f995c0f27df6e4b8863ef5f | ['7c99620496f14e388608c212ed4b3ce0'] | I'm Java background and new to oracle SQL
1.i'm creating the custom type and not sure is there other way ?
2.Created procedure UPSERT
3.While executing with exec command in SQL Developer throwing an error
Custom TYPE :
create or replace type temperature_ARRAY as table of number;
create or replace type pressure_ARRAY as table of number;
Procedure:
create or replace PROCEDURE flange_derating_upsert(i_flangecode IN VARCHAR2,i_product IN VARCHAR2,i_product_inch IN VARCHAR2,i_product_meterstyle IN VARCHAR2,i_pressure in pressure_ARRAY,i_temperature in temperature_ARRAY)
AS
begin
for i in i_temperature.FIRST..i_temperature.LAST loop
update xxcz_flange_ratings_mmi
set pressure = i_pressure(i),
LAST_UPDATED_by = 107009
where PRODUCT_NAME like '%'||i_product_inch||'%'||i_product_meterstyle||'%' and PC_MODEL_CODE = i_flangecode and temperature = i_temperature(i);
DBMS_OUTPUT.PUT_LINE(sql%rowcount||' '||i_temperature(i));
if sql%rowcount = 0 then
-- no rows were updated, so the record does not exist
insert into xxcz_flange_ratings_mmi (PRODUCT_NAME,PC_MODEL_CODE,TEMPERATURE,PRESSURE,LAST_UPDATED_BY) values(i_product,i_flangecode,i_temperature(i),i_pressure(i),107009);
end if;
end loop;
end flange_derating_upsert;
when execute : exec flange_derating_upsert('A1','2 inch Quad High Pressure','2','Quad High Pressure',(275,235,215,195,170,140,125,110,95,80,65),(100,200,300,400,500,600,650,700,750,800,850));
Getting below error :
Error starting at line : 32 in command -
BEGIN flange_derating_upsert('A1','2 inch Quad High Pressure','2','Quad High Pressure',(275,235,215,195,170,140,125,110,95,80,65),(100,200,300,400,500,600,650,700,750,800,850)); END;
Error report -
ORA-06550: line 1, column 1386:
PLS-00306: wrong number or types of arguments in call to 'FLANGE_DERATING_UPSERT'
ORA-06550: line 1, column 1386:
PLS-00306: wrong number or types of arguments in call to 'FLANGE_DERATING_UPSERT'
ORA-06550: line 1, column 1386:
PL/SQL: Statement ignored
<PHONE_NUMBER> - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
| 6b292fff4a7ffd01d8d09d0f084cb55c7ef4114e8b837bb30ed69234b94116ff | ['7c99620496f14e388608c212ed4b3ce0'] | int is an integer, a number that has no digits after the decimal point. It can be positive or negative. Internally, integers are stored as binary numbers. On most computers, integers are 32-bit binary numbers, but this size can vary from one computer to another. When calculations are done with integers, anything after the decimal point is lost. So if you divided 2 by 3, the result is 0, not 0.6666.
char is a data type that is intended for holding characters, as in alphanumeric strings. This data type can be positive or negative, even though most character data for which it is used is unsigned. The typical size of char is one byte (eight bits), but this varies from one machine to another. The plot thickens considerably on machines that support wide characters (e.g., Unicode) or multiple-byte encoding schemes for strings. But in general char is one byte.
|
12886ecb2947d008bca2e9c7bff8f195544cec4fd95745482521f75c78e25895 | ['7cb44cf32c3440d5ba18e316e03e79dc'] | I'm not really sure how to go about even solving. So I am programming blackJack and I have my function declarations (as shown) as such, and for my add_card_to_hand function, I don't know what to do. I have 2 arguments, a hand that I have passed by reference since I'm gonna be changing its internal values and a card; the card that I am adding to the hand. So how do I actually add the card to the hand? I also don't know the type, I just put hand_t, it might be void.
typedef enum { HEARTS, DIAMONDS, SPADES, CLUBS } suit_t;
typedef enum { ACE = 1, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING } value_t;
typedef struct {
suit_t suit;
value_t value;
} card_t;
typedef struct {
card_t* deck;
int num_decks;
int nextcard;
} shoe_t;
typedef struct {
card_t playercards[21];
int num_cards_in_array;
} hand_t;
hand_t add_card_to_hand(hand_t* hand, card_t card) {
}
| 873ccd71695aeae1f15859989fee1625a224f4f357d7de7e5592b2fa8cc6082e | ['7cb44cf32c3440d5ba18e316e03e79dc'] | I am trying to see all flights that happen every single day and where they go to. I am ultimately stuck, I have selected the categories that I want selected use the filter to try to get all the flights that have exactly 365 flights but it says there is no data, I don't know what my next step should be.
flights %>%
select(month, day, flight, carrier, origin, dest) %>%
filter(sum(flight) == 365) %>%
view()
|
40e25899605b6a59fa1bbedadaa2b97696ceff5515df68f45b28774941ca7578 | ['7cb7e41972f9474ca3ff44e774ed6fa7'] | You are creating new pickThree instances using the var keyword, so the original pickThree instance that was added to data never gets set with a value. You need to remove the var keywords like so:
if (under25) {
pickThree = ".Under25";
} else if (under50) {
pickThree = ".Under50";
} else if (under75) {
pickThree = ".Under75";
} else if (under100) {
pickThree = ".Under100";
} else if (under250) {
pickThree = ".Under250";
} else if (over250) {
pickThree = ".Over250";
}
| 60a025cf3a94ef0be0507af233eafc1e96e86d364afebddcfbafa337593b6164 | ['7cb7e41972f9474ca3ff44e774ed6fa7'] | If you need to do this with a more complex set of fields i would suggest checking out the :nth-of-type() and :nth-child() css selectors.
.field {
display: inline-block;
}
.field:last-child {
display: block;
}
<div class="field" >
<input placeholder="Firstname" class="firstname" id="firstname_field" name="firstname" size="30" value="" type="text">
</div>
<div class="field" >
<input placeholder="Lastname" class="lastname" id="lastname_field" name="lastname" size="30" value="" type="text">
</div>
<div class="field" >
<input placeholder="Email" class="email" id="email_field" name="email" size="30" value="" type="text">
</div>
|
97ec169d1b7b712d2787b6140b9888f68577429d01eeaf00cee20b72215c8dde | ['7ccdfa982610426d8030f780f84db783'] | Replace
vector<int> list3(list1.size()+list2.size());
with vector<int> list3;
When you initialize the Vector with a size of X you will have X elements with the value 0. Then you use list3.push_back(Y); which will add the Element Y at the end of the vector.
If you declare an empty vector and use list3.push_back(Y); you wil have only one element Y in the vector.
| 573e0419d832735a6764bc2a10867a1a170d88f002f8383ce30c7f4190e6b2be | ['7ccdfa982610426d8030f780f84db783'] | I wrote a programm that can up-/download documents to sharepoint and check them in/out. It is used for data integration purposes and works quite well.
It was implemented using SOAP, but unfortunately the Server is configured to only be able to handle files with a size lesser than 50MB via SOAP.
The server configuration is fixed, so I have to work around that.
I added some code and I am able to up/download bigger files now, but If I want to check them in via SOAP I get the same error.
Now I wonder If it is possible to checkin/out files using the httpclient.
My code so far...
public class HttpClient {
private static final Logger LOGGER = LogManager.getLogger(HttpClient.class.getName());
HttpClient() {
}
public static void download(final String source, final File resultingFile) {
CloseableHttpClient client = WinHttpClients.createSystem();
HttpGet httpRequest = new HttpGet(source);
CloseableHttpResponse httpResponse = null;
try {
httpResponse = client.execute(httpRequest);
HttpEntity entity = httpResponse.getEntity();
if(httpResponse.getStatusLine() != null && httpResponse.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {
LOGGER.warn(httpResponse.getStatusLine());
}else {
LOGGER.debug(httpResponse.getStatusLine());
FileUtils.touch(resultingFile);
InputStream is = entity.getContent();
File outFile = new File(resultingFile.getAbsolutePath());
FileOutputStream fos = new FileOutputStream(outFile);
int inByte;
while ((inByte = is.read()) != -1) {
fos.write(inByte);
}
is.close();
fos.close();
client.close();
}
} catch (ClientProtocolException e) {
LOGGER.warn(e);
} catch (UnsupportedOperationException e) {
LOGGER.warn(e);
} catch (IOException e) {
LOGGER.warn(e);
}
}
public static void upload(final File source, final String destination) {
CloseableHttpClient httpclient = WinHttpClients.createSystem();
HttpPut httpRequest = new HttpPut(destination);
httpRequest.setEntity(new FileEntity(new File(source.getPath())));
CloseableHttpResponse httpResponse = null;
try {
httpResponse = httpclient.execute(httpRequest);
EntityUtils.consume(httpResponse.getEntity());
if (httpResponse.getStatusLine() != null && httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_CREATED) {
LOGGER.debug(httpResponse.getStatusLine());
LOGGER.info("Upload of " + source.getName() + " via HTTP-Client succeeded.");
} else if (httpResponse.getStatusLine() != null && httpResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
LOGGER.debug(httpResponse.getStatusLine());
}else {
LOGGER.warn("Uploading " + source.getName() + " failed.");
LOGGER.warn(httpResponse.getStatusLine().getStatusCode() + ": " + httpResponse.getStatusLine().getReasonPhrase());
}
} catch (IOException e) {
LOGGER.warn(e);
LOGGER.warn(e.getMessage());
}
return;
}
}
|
cda780da9911fb82a8eae21a78e082955432b73324d27dc9f80a8bb5160f0a5a | ['7cd4ad4a670e4e84a04cd1ee447ad4ed'] | Problem solved
Initially changed the format of the cell
DataGridTextColumn Binding="{Binding Pay,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay,StringFormat={}{0:+#;-#;''}, Converter={StaticResource decimalConverter}}" Header="Sum" IsReadOnly="False"/>
And added Converter
public class DecimalConverter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
if (value != null) {
return value.ToString().Replace(",", lib.csGlobals.numSep).Replace(".", lib.csGlobals.numSep);
}
return Binding.DoNothing;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
string data = (value as string).Replace(",", lib.csGlobals.numSep).Replace(".", lib.csGlobals.numSep);
if (data == null) {
return value;
}
if (data.Equals(string.Empty)) {
return 0;
}
if (!string.IsNullOrEmpty(data)) {
decimal result;
if (data.EndsWith(".") || data.Equals("-0") || data.Equals("-") || data.EndsWith(",")
|| data.Equals("-0.0") || data.Equals("-0,0")
) {
return Binding.DoNothing;
}
if (decimal.TryParse(data, out result)) {
return result;
}
}
return Binding.DoNothing;
}
}
| 64b1693835f4307bfb22535f55af15afa9a09b67cb4dda03d62eac4cd93d8d00 | ['7cd4ad4a670e4e84a04cd1ee447ad4ed'] | The client application has an app.config file where the IP address of the service is specified <endpoint address= "net. tcp://<IP_ADDRESS>:8123/Service". During development, I use <IP_ADDRESS> to update server references (during which the necessary classes are automatically generated).I have a few servers with wcf services for different group users. Servers have different id addresses. During click-once publishing, I have to specify the IP of and publish my application to each group. How can I configure application to be taken the ip endpoint from app.config when developing, and the ip endpoint from a saved file for user?
|
4eacd114cbd47be500daa7c99d57aded904667e6c12be63effd4a52a420b5f6a | ['7cde7aabac1e4d5f88153958e562e11a'] | I found how to upload a file without Token.
https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable
First you must use Token and file's info you want to upload to create the
resumable upload link.
Send this to google.
POST /upload/storage/v1/b/myBucket/o?uploadType=resumable HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer your_auth_token
Content-Length: 38
Content-Type: application/json; charset=UTF-8
X-Upload-Content-Type: image/jpeg
X-Upload-Content-Length: 2000000
{
"name": "myObject"
}
In the response header there is a link to use to upload a file
to Google Cloud storage.
Location: https://example.storage.googleapis.com/music.mp3?upload_id=tvA0ExBntDa...gAAEnB2Uowrot
| e4055ec16a7495c6ed2633e146fd800718fe79b72483722b2a5b8f9e0509c607 | ['7cde7aabac1e4d5f88153958e562e11a'] | I'm trying to use ImpactJS, a JS framework.
I want to add socket.io functions.
As soon as I add socket.io there is an error
Uncaught ReferenceError: sock is not defined jquery-1.7.1.min.js:4
My class where I use soket.io :here (end of the file)
My index.html : here
I don't understand why I can't use both.
Thx for your help.
|
e6d6f73a5c0ab70231de968e739104bb1de372f71861aef23187cf53f816aee2 | ['7cf07a0132bd4568a93cb0434c63be38'] | Basically, when assigning the property of my image view to a property in my data model it doesn't work. However, if I explicitly set it as a new UIImageView it works fine.
cell.imageview = obj.struct.imageview
Doesn't work, have to click cells to see the images or wait 10-20 seconds
cell.imageview = UIImageView(UIImage(named: "name.jpg"))
Works fine.
| 29bd05705cc0b3bc5ddcc3cb8b10cc83cfd06a3e1309ecb9fee43f7f1ac4db0a | ['7cf07a0132bd4568a93cb0434c63be38'] | using dequeueReusableCellWithIdentifier works for the first 7 cells and then it randomly starts to reuse the cells from 1-7 for 8-14 and so on... However it should be creating new cells as they dont exist yet.
This is my code-
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
NSLog(indexPath.description)
var cell = (tableView.dequeueReusableCellWithIdentifier("matchCell", forIndexPath: indexPath)) as! MatchCell
if (cell.created == nil) {
cell = configureCell(cell, withIndex: indexPath.section)
}
return cell
}
No Idea why this is happening. It works fine for the first 7 cells...
|
7c90e76ecf19bc4d6699e6c7e65622820f0902d64547217ab488f9eade58d8c1 | ['7cf5a7ba580b49a8b71104dab3d8385b'] | You were close, but you missed a few characters that needed to be escaped.
First, powershell (and most other things) uses \ to escape quotes, not /. Second, in batch, plain % need to be escaped by using %% instead. (On a side note, you would normally have to escape the |, but you don't have to here because it's in a quoted string.)
Finally, if you want to build the string and not just return the binary of the last character, you're going to have to enable delayed expansion and concatenate each line of the output.
@echo off
setlocal enabledelayedexpansion
set /p "_input=Input: "
for /f "delims=" %%A in ('powershell "[System.Text.Encoding]<IP_ADDRESS>UTF8.GetBytes(\"%_input%\") | %%{[System.Convert]<IP_ADDRESS>ToString($_,2).PadLeft(8,'0')}"') do set "varBinary=!varBinary!%%A"
echo.!varBinary!
echo."!varBinary!"
echo "!varBinary!"
echo !varBinary!
| 7755a65349b8bfd03a2768c5d6524f206e4363da16f55d107e6953ced5b4f297 | ['7cf5a7ba580b49a8b71104dab3d8385b'] | for loop variables can only be a single letter. %%file is not a valid variable name, so you get an error. (Run the script from the command line instead of double-clicking it to see the error %file was unexpected at this time.) Simply change the loop variable to %%f.
set /a var=0
for /r c:users\user\desktop\ %%f IN (*.mp3*) do (
set /a var+=1
)
echo %var%
|
11aff381849e6e2b4da062655463c86cc3dbd963dc8a4689ddb54032399b3ea6 | ['7d019e80fd95465f8f8a514a66a4cb94'] | Find a mentor and pick his/her brains often. Once you are working in the field ask for code reviews from senior developers. This will get you out of your own habits, and reading people's suggestions for how you can improve will give you plenty of insights. Don't sit around reading, solve problems on a per-problem basis and work your way up from there.
| 3de39a950ff63d37bdd77552835b0fc8a88366ea8e015b5526122ab9d502a361 | ['7d019e80fd95465f8f8a514a66a4cb94'] | спасибо! это то что я искал. нужно только разобраться
вот в этом private static final String DATE_PATTERN =
"(0?[1-9]|1[012]) [/.-] (0?[1-9]|[12][0-9]|3[01]) [/.-] ((19|20)\\d\\d)"; Такое я уже встречал в некоторых примера по валидации даты. В остальном логика понятна. Проще говоря глянуть поподробней классы Pattern и Matcher |
2c57154e198c9a133b6e1005c3ac8e2aa6d2d5f350e5e35be8190a4b62d32f54 | ['7d0613d49f174b1896c3fb449fc2eafd'] | So just FYI, I have very limited SQL training, and my new position is requiring that I learn so please be gentle with me :)
First off, I saw this:
Multi-table query in Microsoft Access
And that is exactly what I need in principle; however, my data structure is a little different. I have roughly 24 databases each averaging around 1gb of information over 8 years across 420 institutions (4 databases for each year - about 16 million observations in total). Every field is identical across databases.
I need to run analyses on all of this information, but ms-access databases are limited to 2gb, so I'm trying to figure out a workaround. My idea is to link each table into a master database, and then run queries using the selection query from the above link. My question is whether or not this will actually work. My computer has 32gb of physical memory, so I feel like I should be able to load all of it into active memory while performing any queries, but I still don't know. Is there a more efficient way?
Basically, what I need to be able to query institutions over years. Right now that's impossible and it's causing issues. Because institutions aren't subjected to any scrutiny regarding the information they report, we need to understand how reporting trends evolved within and between them over time.
I was given a list of about 40 questions that all involve different queries that we need to run, so I'm hoping against hope that I can figure out a solution that doesn't involve me losing my mind.
Thank you all for your help!
<PERSON> | 465233d2689a2a6c3695db6be74f5697c8e7e3e1b0d7aaf3831744d4225982e0 | ['7d0613d49f174b1896c3fb449fc2eafd'] | I have a dataset of 800k unique customers, and then about 3.5 million customer orders. In the customer orders table I have data such as Zip code, etc. These details changed between orders (if a customer moved for example), so right now I need to match the unique customers with the FIRST details.
So in customers I have (for example) (custID is primary key, no duplications)
CustID | First Year Ordered | Last Year Ordered
001 1995 2005
002 1996 2004
003 1995 2011
... ... ...
And in customer Orders I have:
CustID | Year | Address | DOB
001 1995 123 Fake Street 01/01/1970
001 1996 456 Other Street NULL
... ... ... ...
002 1996 201 East West St 02/02/1965
... ... ... ...
Each customer ID in has between 1-50 orders, and I want the info relating ONLY to the first order, so that the final output is:
CustID | First Year | Last Year| Address | DOB
001 1995 2005 123 Fake Street 01/01/1990
002 1996 2004 201 East West ST 02/02/1965
... ... ... ... ...
Does anyone know how to do that? Since I'm in access, i thought I could use the First() command (having sorted the table previously by year), but it doesn't seem to be working for me. Does anyone have any suggestions?
|
838a2db34b57b51694f1687bbd5769f8fc5311ce5988475c527798cb0f93e118 | ['7d1cd5b0357d44fb86c29e55aebd272a'] | @Ian_Fin The postdoc salary is quite decent. Once I start working, I could manage the expenses and afford to live there.
I am just unable to front the upfront setup costs. I have just come off a few months of not being paid and in addition to this, the currency conversion from what I was paid in my last job to GBP isn't really that great either! So, the savings haven't really accounted to much! | dc212bb4f02e7c87f80ae272f6139711c7d0d5f71e1c101fcf223d1f09e7e3b7 | ['7d1cd5b0357d44fb86c29e55aebd272a'] | I would like to change the graph to show the 14.047 is less than 15, more decimal precision
\documentclass[12pt,a4paper,onecolumn, openright]{report}
\usepackage{xcolor}
\usepackage{pgfplots}
\usepackage{tikz}
% Define bar chart colors
%
\definecolor{bblue}{HTML}{4F81BD}
\definecolor{rred}{HTML}{C0504D}
\definecolor{ggreen}{HTML}{9BBB59}
\definecolor{ppurple}{HTML}{9F4C7C}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width = 0.85*\textwidth,
height = 8cm,
major x tick style = transparent,
y tick label style={
/pgf/number format/fixed
},
ybar=2*\pgflinewidth,
bar width=12pt,
ymajorgrids = true,
ylabel = {\#iterations},
symbolic x coords={topology1,topology2,topology3,topology4,topology5},
xtick = data,
scaled y ticks = false,
enlarge x limits=0.12,
ymin=0,
ymax=20,
legend style={at={(0.5,-0.15)}, anchor=north,legend columns=-1},
]
\addplot[style={bblue,fill=bblue,mark=none}]
coordinates {(topology1, 15) (topology2,12) (topology3,11)(topology4, 9) (topology5,9) };
\addplot[style={ppurple,fill=ppurple,mark=none}]
coordinates {(topology1,18.047) (topology2,15.047) (topology3,14.047)(topology4, 12.047) (topology5,12.047)};
\addplot[style={ggreen,fill=ggreen,mark=none}]
coordinates {(topology1,18.047) (topology2,15.047) (topology3,14.047)(topology4, 12.047) (topology5,12.047)};
\legend{MARA-MC,MARA-MMMF,MARA-SPE}
\end{axis}
\end{tikzpicture}
\end{document}
|
ea191b1597d0adc3449b0fc9150d92f4d9e89deda5cbc0e73ae5b00dd132d7b5 | ['7d1d2b07bea2470fa923053cf306ef28'] | I have Maven Spring Boot Project that I configured to run on Tomcat 8.5 server.
I run and develop it in Eclipse Java EE IDE.
pom.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ca.gatin</groupId>
<artifactId>todoapp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>TodoApp</name>
<description>Cloud TodoApp Server</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
application.properties is (sensitive data replaced with *****):
############################
# #
# Logger Configuration #
# #
############################
# Log Level: ERROR, WARN, INFO, DEBUG or TRACE
#
# logging.level.root=WARN
logging.level.org.springframework.web=DEBUG
logging.level.org.hibernate=INFO
############################
# #
# Web Server Configuration #
# #
############################
#server.port=9191
#server.contextPath=/api # let it handle in code /api for APIs, /web - for WEB
############################
# #
# DataSource Configuration #
# #
############################
spring.datasource.url=jdbc:mysql://localhost:3306/todoappdb_dev
spring.datasource.username=*****
spring.datasource.password=*****
spring.datasource.schema=classpath:/data/schema.sql
spring.datasource.data=classpath:/data/data.sql
# Keep the connection alive if idle for a long time
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
#####################
# #
# JPA Configuration #
# #
#####################
# validate: validate the schema, makes no changes to the database.
# update: update the schema.
# create: creates the schema, destroying previous data.
# create-drop: drop the schema at the end of the session.
# none
##
spring.jpa.generate-ddl=false
spring.jpa.hibernate.ddl-auto=none
spring.jpa.hibernate.naming-strategy=org.hibernate.cfg.ImprovedNamingStrategy
# Whether to enable logging of SQL statements.
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
spring.jpa.hibernate.format_sql=true
########################
# #
# Application specific #
# #
########################
#
#admin - renat
authentication.oauth.adminid.renat=*****
authentication.oauth.secret.renat=*****
authentication.oauth.tokenValidityInSeconds.renat=1800
#
#client - web
authentication.oauth.clientid.web=*****
authentication.oauth.secret.web=*****
authentication.oauth.tokenValidityInSeconds.web=1800
Tomcat server.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--><!-- Note: A "Server" is not itself a "Container", so you may not
define subcomponents such as "Valves" at this level.
Documentation at /docs/config/server.html
--><Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<!-- Security listener. Documentation at /docs/config/listeners.html
<Listener className="org.apache.catalina.security.SecurityListener" />
-->
<!--APR library loader. Documentation at /docs/apr.html -->
<Listener SSLEngine="on" className="org.apache.catalina.core.AprLifecycleListener"/>
<!-- Prevent memory leaks due to use of particular java/javax APIs-->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<!-- Global JNDI resources
Documentation at /docs/jndi-resources-howto.html
-->
<GlobalNamingResources>
<!-- Editable user database that can also be used by
UserDatabaseRealm to authenticate users
-->
<Resource auth="Container" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/>
</GlobalNamingResources>
<!-- A "Service" is a collection of one or more "Connectors" that share
a single "Container" Note: A "Service" is not itself a "Container",
so you may not define subcomponents such as "Valves" at this level.
Documentation at /docs/config/service.html
-->
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL/TLS HTTP/1.1 Connector on port 8080
-->
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation. The default
SSLImplementation will depend on the presence of the APR/native
library and the useOpenSSL attribute of the
AprLifecycleListener.
Either JSSE or OpenSSL style configuration may be used regardless of
the SSLImplementation selected. JSSE style configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2
This connector uses the APR/native implementation which always uses
OpenSSL for TLS.
Either JSSE or OpenSSL style configuration may be used. OpenSSL style
configuration is used below.
-->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="conf/localhost-rsa-key.pem"
certificateFile="conf/localhost-rsa-cert.pem"
certificateChainFile="conf/localhost-rsa-chain.pem"
type="RSA" />
</SSLHostConfig>
</Connector>
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine defaultHost="localhost" name="Catalina">
<!--For clustering, please take a look at documentation at:
/docs/cluster-howto.html (simple how to)
/docs/config/cluster.html (reference documentation) -->
<!--
<Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/>
-->
<!-- Use the LockOutRealm to prevent attempts to guess user passwords
via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI
resources under the key "UserDatabase". Any edits
that are performed against this UserDatabase are immediately
available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
<!-- SingleSignOn valve, share authentication between web applications
Documentation at: /docs/config/valve.html -->
<!--
<Valve className="org.apache.catalina.authenticator.SingleSignOn" />
-->
<!-- Access log processes all example.
Documentation at: /docs/config/valve.html
Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t "%r" %s %b" prefix="localhost_access_log" suffix=".txt"/>
<Context docBase="TodoApp" path="/todoapp" reloadable="true" source="org.eclipse.jst.jee.server:TodoApp"/></Host>
</Engine>
</Service>
</Server>
Tomcat setup is:
The static Web content location is:
What I can't do is:
1. to stop redeploying whole project (including Java and DB part) each time I change static resources;
2. looking on logs console I can see that Spring Boot is started two time, so I want it to start only once.
| 9774062e61883a9e7ed43e6e6123041e7bc0cf0d3b6f2ac4e6498ead972edd99 | ['7d1d2b07bea2470fa923053cf306ef28'] | I am trying to configure Tomcat7 serer.xml
the
<Host appBase="webapps/testweb" name="trythis.test.com" unpackWARs="true" autoDeploy="true">
<Context docBase="." path="" reloadable="false">
<Environment name="WEB_APP_PROPERTIES" type="java.lang.String" value="\\<IP_ADDRESS>\config"/>
</Context>
</Host>
Even though this config folder is accessible over the network my Tomcat can't access it:
Did I configure Environment wrongly?
|
021b41b3930290a6edea2c69318ff1e968406603fdc109d652dc6667a756b6dc | ['7d2b6b4bc0fb4f98a3365c77becd1feb'] | @SpehroPefhany - the choice of stabilization caps is a compromise between instability at high currents or slow response at low currents. The translinear arrangement with a common base transistor in the feedback it adds undesired gain in the loop requiring more damping but it avoids the base current causing an error. | 35f7151d6f5c3b5883b21e96357bb47472b44b6ffb2e5715c365ab5517112eb8 | ['7d2b6b4bc0fb4f98a3365c77becd1feb'] | The shield is usually implemented as a piece of copper foil wound on top of the first winding (probably primary in this case) before the secondary is wound. The foil is insulated so that although it wraps completely round the primary it does not create a shorted turn. Its purpose is to minimize noise on the AC supply coupling into the secondary and the circuits it feeds. The shield has a connection so it can be grounded. |
e681581608d8881dbbb602c4c62d39158bd794c6c03ff8f6884aeb983165ccb8 | ['7d2f73dc3f7e4c9d87527bfd3a3a4ec8'] | I am learning to use template functions and organize my code in multiple files. I looked at Why can templates only be implemented in the header file? where they point out I should implement my template-functions in the header; I also looked at C++ inline functions: declare as such, define as such, or both? Why? so I know I should define fully specialized functions as inline in the header; and I looked at Why use a “tpp” file when implementing templated functions and classes defined in a header? where they suggest to define the templates (and also the fully specialized templates?) in a separate my.tpp and add #include "my.tpp" at the end of my header.
Now my question as a completely beginner is: How do I combine all this with regular functions.
Imagine the following:
#ifndef IVAL_H
#define IVAL_H
//Function to determine if input string is of a given type
template<typename T>
bool is_type(std<IP_ADDRESS>string);
//Specialization when testing integer
//As I also want to accept e.g. 4.0000 as an integer
template<>
bool is_type<int>(std<IP_ADDRESS>string);
//Function to get a given type
template<typename T>
T get_type(std<IP_ADDRESS>string);
//Finally a normal function to ask for [y/n]
bool yesNo(std<IP_ADDRESS>string prompt);
//Include templates definitions
#include"ival.tpp"
#endif /*IVAL_H*/
Then I have, as suggested in the questions quoted above:
//in ival.tpp
#ifndef IVAL_TPP
#define IVAL_TPP
template<typename T>
bool is_type(std<IP_ADDRESS>string input)
{
//How to validate input
}
template<>
bool inline is_type<int>(std<IP_ADDRESS>string input)
{
\\How to validate when integer
}
template<typename T>
T get_type(std<IP_ADDRESS>string prompt)
{
//How to keep asking until valid input
//Using is_type
}
#endif /*IVAL_H*/
And finaly as a .cpp my normal function:
//in ival.cpp
#include "ival.h"
bool yesNo(std<IP_ADDRESS>string prompt)
{
//How to ask for [y/n]
//Using get_type<char>
}
This causes some confusion as to how is the correct way of organizing my functions. When in a header we have both template functions and normal functions, is the normal thing to do what I did above? (different source file for normal functions), are the fully specialized functions treated as a template (i.e. defined inline in the file where all templates are) or as a function (i.e. defined just in .cpp as all other functions).
Is what I did more convenient over defining the template functions in .cpp and explicit instantiate to char, int, double, float, and std<IP_ADDRESS>string
| 269563424df4c8b102bd382fb7a5abf81452355f307b0b4aefb7a4ab40bc6b70 | ['7d2f73dc3f7e4c9d87527bfd3a3a4ec8'] | I have an activity in which after I press a Button I change the visibility of Group A from visible to gone, and the visibility of Group B from gone to visible.
I would like to simulate the same default animation you get when you go from one activity to another after pressing my button (while I remain in the same activity).
I have been looking online, but I have only been able to find examples of overridePendingTransition, which doesn't apply to my situation.
|
fb6d378412ec637b040e45e76269b12a944c317d9821dabd9f2c11f3d50cc29c | ['7d2fb4b0418345dea34d04003e36d384'] | The finally block is always executed, also when some runtime exception occurs while in the try block. It is used make sure the java program (in this case specifically the locks, but it's also often used to close streams) is in a 'valid' state exiting the try - catch - finally block.
In this case, as <PERSON> posted, the goal is to return true when both locks are obtained, and false when no lock is obtained. When - due to some interruption, only one lock is obtained, the program is not in a desirable state. This is prevented by the code in the finally block: when only one lock is obtained, that lock is then released.
| 54adbf1319317fccbe3cebf9addb1d174a0924d92913ed8f9646603a03dcc8b0 | ['7d2fb4b0418345dea34d04003e36d384'] | You need some more advanced structures to store information about your platforms. Consider having a Set of the x-coordinates of your platforms and performing the operation 'contains`
for example:
Set<Integer> xcoords = new HashSet<Integer>();
xcoords.add(platform2.x);
xcoords.add(platform3.x);
if (xcoords.contains(Guy.x + Guy.width)){
} else {
goRight();
}
|
b1ec9e7dd23be2671f64f69dafd21a231442fdd4d10fa840ded17ce63982bdaa | ['7d3c339999044375b2ef3e9a62209977'] | @waltinator don't know what you were trying to so with the swapon command. It just gave swapon help. This is the output when my computer is starting to grind to a halt, but still responds if patient. MEM TOTAL 3.8G USED 3.7 FREE 109M SHARED 55M BUFFERS 883M CACHED 1.5G SWAP TOTAL 255M USED 616K FREE 255M | 6aba07ab86a5d2a13a6cda5536dc4e2ae455b8c1757a56dd1717dab1f2edb916 | ['7d3c339999044375b2ef3e9a62209977'] | On my computer after a moment of use xwindows becomes unresponsive. Can't type anything or interact at all. I checked the processes with the ps command and it once said compiz was 79% CPU. I restarted the environment and after a short while it became unresponsive. This time compiz was only 4%. Checking the memory however I was pretty much all full. PS didn't give any hint to what is using the resources. What is going on?
|
e4687fa52daaabd1cd13f79d8b2137708d03a0c67213377f1bbacf3c9ba73422 | ['7d472bc318d94be1a5b117c7a86ee3ad'] | You can use product options feature of cscart. So you have to define swatch option along with price for that product. Now you just have to change layout of product detail page so whenever customer add swatch product to buy, product option will be used. In that case admin can see which products swatch option is ordered.
To know more about product options please visit this link - http://docs.cs-cart.com/4.3.x/user_guide/manage_products/options/product_options.html
Hope this will solve your purpose.
| 4f5bc4ba9c70cc1d1b3d940921bf81d5511756e0ab2a99eb80379b32a6f928db | ['7d472bc318d94be1a5b117c7a86ee3ad'] | You can use long polling. By Creating An Open Connection To Server.
Here is a Example:
(function poll(){
$.ajax({ url: "index.php?a=1", success: function(data){
//HANDLE RESPONSE AS YOU NEED;
}, dataType: "json", complete: poll, timeout: 30000 });
})();
In Index.php
//add this at top to create open connection
set_time_limit(0);
if($_GET['a']){
$data = array("status"=>200,"data"=>$response_array);
echo json_encode($data);
die;
}
I just give this example to show how to use long polling. To know more about long polling please checkout here
|
c92ce2de6fa0d43b53d949e50d0d205e9428817408b0e97f62acdcb5b37aa895 | ['7d4c10c502844a0bafdeca99f8c4b496'] | You will want to loop your result set using a while loop. Example below:
public static ObservableList<Customer> search_ForDropDown(String searchQuery){
MysqlDataSource dataSource = CurrentServer.getDataSource();
ObservableList<Customer> data = FXCollections.observableArrayList();
data.clear();
try {
String query = "SELECT * FROM CUSTOMER LIMIT 5";
Connection conn = dataSource.getConnection();
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
Customer customer = new Customer();
customer.setID(rs.getInt("id"));
customer.setPhoneNumber(rs.getString("phoneNumber"));
customer.setEmailAddress(rs.getString("emailAddress"));
data.add(customer);
}
rs.close();
stmt.close();
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
return data;
}
| 4ad51f3a741dc7832e7a6ed79f6d2c52473b3b3b91b4dbee43d10d206a4d37e9 | ['7d4c10c502844a0bafdeca99f8c4b496'] | You can explicitly give the entire file path, which might solve your problem. Also the OS you are using must support the operation. This might help:
if (Desktop.isDesktopSupported()) {
try {
File myFile = new File("C:\\Users\\klinks\\Documents\\pdf.pdf");
Desktop.getDesktop().open(myFile);
} catch (IOException e) {
// System probably doesn't have a default PDF program
}
}
|
77a0a5d57bcae445c3dc14135ba79ad3cacf09fee4b56df5353f03a77f183e47 | ['7d59802b2f044cd49634e59558d93543'] | @AlisonE.E. I *could* explain to you how to remount the system partition as read-write, but that deserves a new question, and in fact there's no need for that. And not only because it's been asked already, but really it's not necessary. I have updated my answer with the exact steps I used myself. Good luck :) | b2a81ee6890f306c399a98a2c212f5d3c96210fcea8dde479a34654caab5fa16 | ['7d59802b2f044cd49634e59558d93543'] | The Windows DVD is only needed for one file. The "best" way to create an answer file is with the Windows System Image Manger...which is part of the Windows Automatic Installation Kit. Which is kinda big, but necessary, even if just for imagex.
http://theitbros.com/sysprep-a-windows-7-machine-%E2%80%93-start-to-finish
http://technet.microsoft.com/en-us/library/dd349343(WS.10).aspx
|
3a9c1b2171505bfe98d90c930c50f5983d78066fc0ece6b62e39dd9bddba5154 | ['7d5b6310f44f48429357a10dce3202db'] | I have installed grunt on my system using npm install, and also have installed the command-line-interface for it, but when I try to run grunt it throws the following error,
Fatal error: Unable to find Gruntfile. What is missing in here? There is no documentation for the error.
| 7bc064dfb43711fb6fe31f4cc16105608f1cbc4e6651190bbe09a05dbea3750a | ['7d5b6310f44f48429357a10dce3202db'] | I have tried playing with activeTintColor, inActiveTintColor, tintColor inside the icon, tabs and also on the tab as a prop and even inside the style but the color of the active/inactive tab doesn't change.
I am working with react-native-router-flux 4.0.0-beta.21
<Scene key={'tabBar'} tabs={true}
tabBarStyle={AppStyles.tabBarStyle}
tabStyle={AppStyles.tabStyle}
tabBarPosition={'bottom'}
activeTintColor={'#e91e63'}
showLabel={false}>
<Scene
{...AppConfig.navbarProps}
key={'map'}
component={MapScreen}
icon={props => TabIcon({icon: 'map-marker'})}
analyticsDesc={'Map'}
></Scene>
<Scene
{...navbarPropsTabs}
key={'home'}
component={FeedScreen}
icon={props => TabIcon({ ...props, icon: 'view-list'})}
analyticsDesc={'Home'}
></Scene>
</Scene>
|
fa46ed1582b9a6f5b0910277a7703661a9b152c5d4b52b2c5cdda36e2f669346 | ['7d6a889c4594459ebd8b2eb510a07b46'] | I tried on two different computers, one is my target computer which is a net book, the other is my main computer where I moved this file to a USB drive. The Internet says these are image files that do not execute the way the YouTube videos show they should work.
What do I need to do differently in order to install the Ubuntu software on the net book?
| da680ede097284425a3a263a109b57beb827b636ad0bb4dd39c31698d0e64271 | ['7d6a889c4594459ebd8b2eb510a07b46'] | Is there a way to cast a dictionary i a one-liner and without all the overhead in C# .net 3?
var result = new Dictionary<string, AccessoryVariant>();
foreach (BaseVariant variant in mVariants.Values)
{
result.Add(variant.Id, (AccessoryVariant)variant);
}
return result;
I would like to do something like this:
return (Dictionary<string, AccessoryVariant>)mVariants;
/Sven
|
6def601ce2235af24883d29084f349b6f4f2718afee07eb09004a2696206a584 | ['7d72496bd0a74bd6b63d8e42cf6cf1cb'] | This is somewhere inbetween nostalgia and an answer. If you look at many papers and pre-prints from the University of Chicago into the late 70's, they usually thank <PERSON> for typing the manuscript. There was a very expensive special purpose IBM machine for mathematical typing in the department. It was <PERSON>'s full time job to type mathematics on it.
| 999a360bf15526f1b0c1d46e7978d2544cfa1f99a7474d445ff5c18b49ce6cdb | ['7d72496bd0a74bd6b63d8e42cf6cf1cb'] | Look at the ForeignKey docs. It says:
When an object referenced by a ForeignKey is deleted, Django by default emulates the behavior of the SQL constraint ON DELETE CASCADE and also deletes the object containing the ForeignKey. This behavior can be overridden by specifying the on_delete argument.
So the default behavior is to cascade on delete, but you can change it by specifying something like this:
class Foobar(models.Model):
user = models.ForeignKey(User, on_delete=models.SET(User.objects.get_or_create(username="foooobarrrr")[0]))
|
372e02e01b34faa1f496f9cbff7e0b937d98c31dafb10f2c99040c0488af151d | ['7d7538cfb9234e7a9ee9d9e633bd97a1'] | I have a web address www.abc.com/check ... I have created a web service on this address for receiving data. Through an android app i send some data to this address using following code:
public class TestappActivity extends Activity {
EditText ch;
Button btn;
InputStream is;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ch=(EditText)findViewById(R.id.ch);
btn=(Button)findViewById(R.id.btn);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
sendData();
}
});
}
private void sendData() {
Log.i(getClass().getSimpleName(), "send task - start");
HttpParams p=new BasicHttpParams();
p.setParameter("name", ch.getText());
HttpClient client = new DefaultHttpClient(p);
try {
HttpResponse response=client.execute(new HttpPost("http://www.abc.com/check"));
is=response.getEntity().getContent();
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Log.i(getClass().getSimpleName(), "send task - end");
}
}
How can i find if my post was successful ? What do i get back when i post something. ?
| dc165d85d3bfba830dd6b8ccd9bf114153e3ee05601dd033d60b475612e2a2df | ['7d7538cfb9234e7a9ee9d9e633bd97a1'] | We have been building an internal project management tool. My lead asked me to define the services for the project. The main entities we will be using in the project are:
Projects
Releases
Milestones
Resources
What i am unable to get is what exactly is a service? Service refers to Web services? Rest services? The functions I will be implementing for the entities?
And what is a good service model for a project? How do i measure if the service model is good or not ?
|
64e2ab49aeb8e981905720983a265ba9fd5b3690489c3b66a33800ef92ff7b42 | ['7d7852342d154a708f4ff0dd5fa0eadd'] | I have a MongoDB collection with 17M records. It has many queries with sorting and other filters with operators like >, <, NOT, IN (basically other than equality operators).
As mongo suggests that index with sorting should follow a specific order( Equality, Sorting, Range), I think I might end up with many indexes that are very specific to each and every query. Which may lead to other problems of over-indexing.
Is there a better way to handle this use case in MongoDB.
| 62e35479d047264e54eeac3fc6030a36ff933085c3f453a123e090270da76c7b | ['7d7852342d154a708f4ff0dd5fa0eadd'] | Try this
@CacheConfig(cacheNames = "com.abc.domain.State")
public interface StateRepository extends CrudRepository<State, Integer>, QueryDslPredicateExecutor<State> {
@QueryHints(value = {
@QueryHint(name = "org.hibernate.cacheable", value = "true"),
@QueryHint(name = "org.hibernate.cacheMode", value = "NORMAL"),
@QueryHint(name = "org.hibernate.cacheRegion", value = "CacheRegion")
})
Page<State> findAll(Predicate predicate, Pageable pageable);
}
It worked for me.
|
7ef4b7ae82b0b8f9d0219ee796557ff6167e2d493e3afbe035fa73e922bf9918 | ['7d8ab19005434452a0a677503d1d476c'] | Suppose we have a simple print statement within a for loop such as
for (var i = 0; i < 2; i++){
setTimeout(() => console.log(i));
}
Two questions.
setTimeout is a browser API method, but how does it access i? i is declared inside the for loop, and I am accessing i inside the method setTimeout even though i is not passed through, how?
Why is 2,2 printed, instead of 0,1?
| 73844dcc0fae3d2bdfe97d16991be82d3e87302c75c617de3a7599deebefee33 | ['7d8ab19005434452a0a677503d1d476c'] | I have been trying to understand closures but every single example I have seen and read all contain the same examples of functions inside functions, but all of the closure problems I face contain functions inside loops.
for (var i = 0; i < 2; i++){
setTimeout(() => console.log(i));
}
Take the above code as an example, setTimeout is an API method inside the browser and i is not being passed through.
function sayHello(name) {
var text = 'Hello ' + name;
var say = function() { console.log(text); }
say();
}
sayHello('Joe');
The above frequently used closure example is not the same because I have called setTimeOut inside a for loop. setTimeout is not defined/created inside the function/loop, I am only calling it. It could therefore be defined somewhere else, outside of the function, which goes against closures entirely. What am I missing here o.O
Secondly, I have a for loop, not a function above another function. Is the variable declaration above the equivalent?
|
4a9fe4e537c922df5851ad8c72f637e3db8ef3506db3682d2f33ae3fbe1a0745 | ['7dae817e85784f1cb028d17767daa915'] | Hi I want to Change live video frame in shape before while loop my webcam default resolution 640x480.
When i run it say "(480, 640, 3)" it still default resolution
......
<PERSON>, frame1 = cap.read()
cropped1 = frame1[0:240, 0:320]
ret, cropped1 = cap.read()
ret, frame2 = cap.read()
print(cropped1.shape)
while cap.isOpened():
diff = cv2.absdiff(cropped1, frame2)
gray = cv2.cvtColor(diff, cv2.COLOR_BGR2GRAY)
blur = cv2.GaussianBlur(gray, (5,5), 0)
_, thresh = cv2.threshold(blur, 20, 255, cv2.THRESH_BINARY)
dilated = cv2.dilate(thresh, None, iterations=3)
contours, _ = cv2.findContours(dilated, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
......
| 502696d67d532b5e621263aebccc876e951ec6ff37d7c676e9ea13db6faca21f | ['7dae817e85784f1cb028d17767daa915'] | Finally i did it!!!
...
<PERSON>, frame1 = cap.read()
<PERSON>, frame2 = cap.read()
print(frame1.shape)
while cap.isOpened():
diff = cv2.absdiff(frame1, frame2) # 640x480 frame
diff2 = diff[0:240, 0:320] # Top Left
diff3 = diff[0:240, 320:640] # Top Right
diff4 = diff[240:640, 0:320] # Down Left
diff5 = diff[240:480, 320:640] # Down Right
gray2 = cv2.cvtColor(diff2, cv2.COLOR_BGR2GRAY)
blur2 = cv2.GaussianBlur(gray2, (5,5), 0)
_, thresh2 = cv2.threshold(blur2, 20, 255, cv2.THRESH_BINARY)
dilated2 = cv2.dilate(thresh2, None, iterations=3)
contours2, _ = cv2.findContours(dilated2, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
gray3 = cv2.cvtColor(diff3, cv2.COLOR_BGR2GRAY)
blur3 = cv2.GaussianBlur(gray3, (5,5), 0)
_, thresh3 = cv2.threshold(blur3, 20, 255, cv2.THRESH_BINARY)
dilated3 = cv2.dilate(thresh3, None, iterations=3)
contours3, _ = cv2.findContours(dilated3, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
.
.
.
gray5 ...
|
6b67edd85257e359f84a274641d49adc804d97a31b503bb09291a7427092e309 | ['7dcca56086b44789bfcc37e3fadcdb55'] | The easiest way to accomplish this is to use the guest network. The guest network can be configured to start and stop service at a particular time of day. The kids' devices are now connected to the guest network, which stops providing service at 21:00. The rest of the household devices are connected to the main network, which provides service 24/7.
| a4d3fdfa330496f39f2d6733afadea90e917b98e71b5fc6de64bba25424b212d | ['7dcca56086b44789bfcc37e3fadcdb55'] | I have an Ubuntu (14.04) machine with two Ethernet cards.
One Ethernet card (eth0) is connected to the office network.
The machine is addressable from the outside Internet.
I have a Web camera that runs its own little Web server. The camera has an Ethernet NIC in it.
I want to connect the camera to the Ubuntu machine's second NIC (eth1) and set up some some kind of forwarding. The idea is to hit to reach the camera's Web server from the Internet and view images, etc. The camera can also upload its images to an FTP server, and I would like it to connect to an FTP server I have running on the Ubuntu machine.
I'm pretty sure I need to bridge the NICs by editing /etc/network/interfaces to look like:
auto lo
iface lo inet loopback
iface eth0 inet manual
iface eth1 inet manual
auto br0
iface br0 inet dhcp
bridge_ports eth0 eth1
This is where I get lost. Do I need to set up iptables to forward IP traffic arriving at the Ubuntu machine on some port (e.g. 51001) to port 80 on ... eth1 .... ? I can't visualize what to do next?
|
58bfedc5ce5cbb1dc125f2cd5b07bbdec3e31e481be1add46b62d1550c5eaab4 | ['7dd4b468201e4eb8aaf486915a6f1c2b'] | I make a VB.Net Web Service. And that will be called by Android Emulator from IIS 7.0. Simple method which return sum of 2 digit works fine but when i try to insert record in the database MY SQL SERVER at that time it will generate java.net.ServerTimeoutException. But When I try to run it from Browser at that time it will works fine means it able to insert record in database but from Android Simulator it will give a Exception.
package com.BuddiesHub;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
public class Register extends Activity
{
EditText mobno,password,cnfpassword,secqus,secans;
Button register;
public final String SOAP_ACTION = "http://tempuri.org/doRegister";
public final String OPERATION_NAME = "doRegister";
public final String WSDL_TARGET_NAMESPACE = "http://tempuri.org/";
public final String SOAP_ADDRESS = "http://<IP_ADDRESS>/BuddiesHub/Service.asmx";
SoapSerializationEnvelope envelope=null;
HttpTransportSE httpTransport=null;
PropertyInfo pi=null;
SoapObject request=null;
Object response=null;
//private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.register);
mobno=(EditText)findViewById(R.id.txtmobno);
password=(EditText)findViewById(R.id.txtpassword);
cnfpassword=(EditText)findViewById(R.id.txtcnfpassword);
secqus=(EditText)findViewById(R.id.txtsecqus);
secans=(EditText)findViewById(R.id.txtsecans);
register=(Button)findViewById(R.id.btnregister);
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
//mobno ,name,secqus,secans
pi=new PropertyInfo();
pi.setName("mobno");
pi.setValue(mobno.getText().toString());
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("name");
pi.setValue(password.getText().toString());
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("secqus");
pi.setValue(secqus.getText().toString());
pi.setType(String.class);
request.addProperty(pi);
pi=new PropertyInfo();
pi.setName("secans");
pi.setValue(secans.getText().toString());
pi.setType(String.class);
request.addProperty(pi);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
httpTransport = new HttpTransportSE(SOAP_ADDRESS);
//SoapObject response=null;
// response = null;
//String result = null;
try
{
httpTransport.call(SOAP_ACTION, envelope);
response = envelope.getResponse().toString();
Toast.makeText(getBaseContext(), response.toString(), Toast.LENGTH_LONG ).show();
}
catch (Exception exception)
{
response=exception.toString();
Toast.makeText(getBaseContext(), response.toString(), Toast.LENGTH_LONG ).show();
}
} });
}
}
| fef30ff0911b8d42585d329f6ea5032d5faee2913947facf8bfe848549332e14 | ['7dd4b468201e4eb8aaf486915a6f1c2b'] | I got the solution. Please take care that your computer Firewall is off when you use IIS as virtual server on your local pc. If you turn off your firewall protection then it will be allowed you to access the web methods but if firewall is on then you get java.net.SocketTimeOutException
|
046a49e534ff2ba66f8f7f06518e6981f5995e796ec6f7f4b8268e4014c31f83 | ['7dd8012aa011417381d68aa99bcc0150'] | I have this program that runs a DES encryption for the full 16 rounds, but I only need it to run 1 complete round. My problem is that I can't seem to figure out where to cut my coding to make it stop running the full 16 rounds. Thank you for your help!
import javax.crypto.*;
import java.security.*;
import java.util.Scanner;
import java.util.*;
/**
* Performs encryption
*/
public class DESEncryption{
// Initial Permutation table
private static final byte[] InitialPermutation = {
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7
};
// Permuted Choice 1 table
private static final byte[] PermutedChoice1 = {
57, 49, 41, 33, 25, 17, 9,
1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27,
19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15,
7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29,
21, 13, 5, 28, 20, 12, 4
};
private static final byte[] PermutedChoice2 = {
14, 17, 11, 24, 1, 5,
3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8,
16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55,
30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53,
46, 42, 50, 36, 29, 32
};
// Array to store the number of rotations that are to be done on each round
private static final byte[] rotations = {
1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
};
private static final byte[] Expansion = {
32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1
};
private static final byte[][] SubstitutionBoxes = { {
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
}, {
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
}, {
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
}, {
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
}, {
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
}, {
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
}, {
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
}, {
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
} };
private static final byte[] Permutation = {
16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25
};
// Final permutation table
private static final byte[] FinalPermutation = {
40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25
};
private static int[] C = new int[28];
private static int[] D = new int[28];
private static int[][] subkey = new int[16][48];
public static void main(String args[]) {
System.out.println("Enter the plaintext in hexadecimal: ");
String input = new Scanner(System.in).nextLine();
int inputBits[] = new int[64];
for(int i=0 ; i < 16 ; i++) {
String s = Integer.toBinaryString(Integer.parseInt(input.charAt(i) + "", 16));
while(s.length() < 4) {
s = "0" + s;
}
for(int j=0 ; j < 4 ; j++) {
inputBits[(4*i)+j] = Integer.parseInt(s.charAt(j) + "");
}
}
System.out.println("Enter the key in hexadecimal: ");
String key = new Scanner(System.in).nextLine();
int keyBits[] = new int[64];
for(int i=0 ; i < 16 ; i++) {
String s = Integer.toBinaryString(Integer.parseInt(key.charAt(i) + "", 16));
while(s.length() < 4) {
s = "0" + s;
}
for(int j=0 ; j < 4 ; j++) {
keyBits[(4*i)+j] = Integer.parseInt(s.charAt(j) + "");
}
}
System.out.println("Encryption Rounds: ");
int outputBits[] = permute(inputBits, keyBits, false);
System.out.println("Decryption: ");
permute(outputBits, keyBits, true);
}
private static int[] permute(int[] inputBits, int[] keyBits, boolean isDecrypt) {
int newBits[] = new int[inputBits.length];
for(int i=0 ; i < inputBits.length ; i++) {
newBits[i] = inputBits[InitialPermutation[i]-1];
}
int L[] = new int[32];
int R[] = new int[32];
int i;
for(i=0 ; i < 28 ; i++) {
C[i] = keyBits[PermutedChoice1[i]-1];
}
for( ; i < 56 ; i++) {
D[i-28] = keyBits[PermutedChoice1[i]-1];
}
for(int n=0 ; n < 16 ; n++) {
System.out.println("\n-------------");
System.out.println("Round " + (n+1) + ":");
int newR[] = new int[0];
if(isDecrypt) {
newR = fiestel(R, subkey[15-n]);
BitsDisplayed(subkey[15-n]);
} else {
newR = fiestel(R, KS(n, keyBits));
BitsDisplayed(subkey[n]);
}
int newL[] = xor(L, newR);
L = R;
R = newL;
System.out.print("L = ");
BitsDisplayed(L);
System.out.print("R = ");
BitsDisplayed(R);
}
int output[] = new int[64];
System.arraycopy(R, 0, output, 0, 32);
System.arraycopy(L, 0, output, 32, 32);
int finalOutput[] = new int[64];
for(i=0 ; i < 64 ; i++) {
finalOutput[i] = output[FinalPermutation[i]-1];
}
String hex = new String();
for(i=0 ; i < 16 ; i++) {
String bin = new String();
for(int j=0 ; j < 4 ; j++) {
bin += finalOutput[(4*i)+j];
}
int decimal = Integer.parseInt(bin, 2);
hex += Integer.toHexString(decimal);
}
if(isDecrypt) {
System.out.print("Decrypted text: ");
} else {
System.out.print("Encrypted text: ");
}
System.out.println(hex.toUpperCase());
return finalOutput;
}
private static int[] KS(int round, int[] key) {
int C1[] = new int[28];
int D1[] = new int[28];
int rotationTimes = (int) rotations[round];
C1 = leftShift(C, rotationTimes);
D1 = leftShift(D, rotationTimes);
int CnDn[] = new int[56];
System.arraycopy(C1, 0, CnDn, 0, 28);
System.arraycopy(D1, 0, CnDn, 28, 28);
int Kn[] = new int[48];
for(int i=0 ; i < Kn.length ; i++) {
Kn[i] = CnDn[PermutedChoice2[i]-1];
}
subkey[round] = Kn;
C = C1;
D = D1;
return Kn;
}
private static int[] fiestel(int[] R, int[] roundKey) {
int expandedR[] = new int[48];
for(int i=0 ; i < 48 ; i++) {
expandedR[i] = R[Expansion[i]-1];
}
int temp[] = xor(expandedR, roundKey);
int output[] = sBlock(temp);
return output;
}
private static int[] xor(int[] a, int[] b) {
int answer[] = new int[a.length];
for(int i=0 ; i < a.length ; i++) {
answer[i] = a[i]^b[i];
}
return answer;
}
private static int[] sBlock(int[] bits) {
// S-boxes applied in method.
int output[] = new int[32];
for(int i=0 ; i < 8 ; i++) {
int row[] = new int [2];
row[0] = bits[6*i];
row[1] = bits[(6*i)+5];
String sRow = row[0] + "" + row[1];
int column[] = new int[4];
column[0] = bits[(6*i)+1];
column[1] = bits[(6*i)+2];
column[2] = bits[(6*i)+3];
column[3] = bits[(6*i)+4];
String sColumn = column[0] +""+ column[1] +""+ column[2] +""+ column[3];
// Converting binary to decimal value
int iRow = Integer.parseInt(sRow, 2);
int iColumn = Integer.parseInt(sColumn, 2);
int x = SubstitutionBoxes[i][(iRow*16) + iColumn];
String s = Integer.toBinaryString(x);
while(s.length() < 4) {
s = "0" + s;
}
for(int j=0 ; j < 4 ; j++) {
output[(i*4) + j] = Integer.parseInt(s.charAt(j) + "");
}
}
int finalOutput[] = new int[32];
for(int i=0 ; i < 32 ; i++) {
finalOutput[i] = output[Permutation[i]-1];
}
return finalOutput;
}
private static int[] leftShift(int[] bits, int n) {
int answer[] = new int[bits.length];
System.arraycopy(bits, 0, answer, 0, bits.length);
for(int i=0 ; i < n ; i++) {
int temp = answer[0];
for(int j=0 ; j < bits.length-1 ; j++) {
answer[j] = answer[j+1];
}
answer[bits.length-1] = temp;
}
return answer;
}
private static void BitsDisplayed (int[] bits) {
for(int i=0 ; i < bits.length ; i+=4) {
String output = new String();
for(int j=0 ; j < 4 ; j++) {
output += bits[i+j];
}
System.out.print(Integer.toHexString(Integer.parseInt(output, 2)));
}
System.out.println();
}
}
| f2668a0848f073d8df3610ef0221dc55a1126a5047c25fa705da1f9bbfcc8f14 | ['7dd8012aa011417381d68aa99bcc0150'] | I have a dictionary and I am trying to get a code to print using a function. I am having trouble getting my function to work and not understanding why it isn't printing the student from my dictionary.
def getstudent(key):
students = {'23A' :['<PERSON>', '<PERSON>', 95.6],
'65B' :['<PERSON>', '<PERSON>', 75.5],
'56C' :['<PERSON>', '<PERSON>', 98.7],
'68R' :['<PERSON>', '<PERSON>', 90.5]}
I want to then run the function and type in getstudent('65B'), but when I run I don't get anything in return.
Thanks!
|
2dd3f40c5def62d5cf7b930cb4cdd1d4affbb97a1250d1d30951e2d7f5536a8c | ['7ddb3971ea554471a958ccd871b799e1'] | OpenLayers current version has a bit of inconsistency in their filter api. Some filters get the feature itself and some get the attributes of the feature. This breaks down because OpenLayers.Filter.FeatureID is the most filter that requires the feature and most of the API including OpenLayers.Filter.Comparison are passing the feature attributes around.
I actually wrote a solution to this and offered it to the OpenLayers community on Github. Feel free.
https://github.com/openlayers/openlayers/pull/1138
| f0a4214d5ea80c98f46f550952b204104003dc69533b717bc8bef8b32b5f5b8e | ['7ddb3971ea554471a958ccd871b799e1'] | Relax. There is nothing inherently insecure about passing the ID to the browser and POSTing it or putting it on the query string. The ID is not itself sensitive.
Just like <PERSON> said above, a
<input type="hidden" name="id" value="123" />
is a common way to pass the ID around.
The element of safety comes in the handling of the next request. ALWAYS check that the user making the request is authorized to modify the data that correspond to the ID. This is generally done by checking the user's login cookie. There are other methods of authentication but the bottom line is to prove that the user you have should be editing the data they are trying to edit.
|
0bd41dbcacb2605724641d8ba5307afb16f9110d81ee0a7e638162ac7c068bd9 | ['7ddbdfa367684d6c8bf9419e69880b8f'] | I was developing a project with Hibernate and when I changed the server tomcat to Jboss(WildFly) I had some problems in my project because of Maven configuration(Pom.xml). The WildFly alredy had the jars that my project needed and it made a conflict.
I changed the compile to provided, so it was solved:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.0.1.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.21.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.21.Final</version>
<scope>provided</scope>
</dependency>
| d66ba78091d52833cc674acf7efd99b9e8376fd5d4cdd1a5acba81fb7f2a2fa8 | ['7ddbdfa367684d6c8bf9419e69880b8f'] | I'm using:
wildfly-10.0.0.Final(JBoss Application Server).
That works to me:
Properties jndiProperties = new Properties();
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put(Context.PROVIDER_URL, "http-remoting://localhost:8080"); //System.getProperty(Context.PROVIDER_URL, "http-remoting://localhost:8080"));
/* jndiProperties.put(Context.SECURITY_PRINCIPAL, "user");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "xxx");*/
InitialContext context = new InitialContext(jndiProperties);
MyFirstEJBRemote ejb = (MyFirstEJBRemote) context.lookup("/EJBProjectName/MyFirstEJB!src.MyFirstEJBRemote");
Hope it helps!
|
79c895045cf3f371dd629275c4560d6969a4241fe5ed4d4f7752fec2a61c7b4c | ['7ddf849df58a44a981c6018f1d378222'] | I am trying to implement an authenticate mechanism with a jersey 2.13 client. But I'm not able to get the responded cookie with a session-id set to the client and that subsequent client requests automatically request including the session cookie.
My idea was to solve this with ClientResponseFilter and ClientRequestFilter.
public class AuthResponseFilter implements ClientResponseFilter {
@Override
public void filter(ClientRequestContext clientRequestContext, ClientResponseContext clientResponseContext) throws IOException {
Map<String, NewCookie> cookies = clientResponseContext.getCookies();
}
}
The clientResponseContextParameter has the session-cookie set. But i'm not sure how it'll be possible to automatically set that cookie to subsequent client requests.
Any help would be appreciated.
| e26f7755c230141ad35a5aa32c2933edd337ee67a93a2e1b57600f0e3fce3ce0 | ['7ddf849df58a44a981c6018f1d378222'] | To set a css class to the panels body you can do it like this:
Panel.body.addCls("logo");
And the css needs to look something like this:
.logo
{
background-image: url(logo.png);
background-position: top right, top left;
background-repeat: no-repeat;
}
This will display the logos in the top right and top left of panels body.
|
9fc3f62cecdab2997a8fb83cd5343e1c401b452f9a69a4c7db06b14195c240ef | ['7de21c7893294f7ebd76c9b3fee07b8c'] | I have a project which looks like this:
docs
rnsrc
src
Inside docs are word docs, pptx, etc. Inside rnsrc is a React Native project and inside src is a client for it (Python.) I would like to have this full directory under Git version control, which I can achieve, but React Native supplies a .gitignore with projects and I cannot get Git to acknowledge it. React Native .gitignore looks like this:
# Xcode
!**/*.xcodeproj
!**/*.pbxproj
!**/*.xcworkspacedata
!**/*.xcsettings
!**/*.xcscheme
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace
# Gradle
/build/
/RNTester/android/app/build/
/RNTester/android/app/gradle/
/RNTester/android/app/gradlew
/RNTester/android/app/gradlew.bat
/ReactAndroid/build/
# Buck
.buckd
buck-out
/ReactAndroid/src/main/jni/prebuilt/lib/armeabi-v7a/
/ReactAndroid/src/main/jni/prebuilt/lib/x86/
/ReactAndroid/src/main/gen
# Watchman
.watchmanconfig
# Android
.idea
.gradle
local.properties
*.iml
/android/
# Node
node_modules
*.log
.nvm
/bots/node_modules/
package-lock.json
# OS X
.DS_Store
# Test generated files
/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
*.js.meta
/coverage
/third-party
# Root dir shouldn't have Xcode project
/*.xcodeproj
# ReactCommon subdir shouldn't have Xcode project
/ReactCommon/**/*.xcodeproj
RNTester/build
I have tried moving this one level up (into the directory I described at the beginning) and appending:
# Docs
docs
But it doesn't work, "docs" and the entirety of rnsrc is added to the repository. I'm still finding my way around Git and would appreciate some guidance!
| d0d94955527845f4ad4be1c86197fc8a43e4caa6c1a34c27c5e0bff3ef4247a9 | ['7de21c7893294f7ebd76c9b3fee07b8c'] | I'm fairly recent to Swift and would like to take advantage of the Decodable functionalities, was hoping for some help.
A public API I am consuming emits the data I want under the key: 'c' but there is some metadata surrounding it. For example:
{
a: 1,
b: 2,
c: [{
d: 3,
e: 4
},
{
d: 5,
e: 6
}
]
}
I've created a struct like this:
struct Block: Decodable {
d: Int?
e: Int?
}
As above, I'd like to be able to have the data parsed into type: [Block] from the data under 'c' as swiftly (sorry) as possible and was hoping there is a 4.1 way of accomplishing this.
Thanks for your time!
|
c78cab857c32bf0f3fb8d3cfb20a120465b8d0295f3be9635d7aab4137f2e544 | ['7dec41a9197d4d6ab5c804feb38b85f5'] | Hi <PERSON>, thanks for the quick response to my inquiry. I haven't heard of Adobe Lightroom, but will definitely check it out. Regarding my current cropping issue, all my images have white background. What I did with all the square images was set the IMAGE WIDTH to 750... so now all images are 750x750 and ALL subject matters are at MOST 750H.. but subject WIDTH could be from 1-750. Then I set crop to 750x1000 and drag to crop from center of image out...the crop tool stops at 750... how can I automate for crop to go beyond 750? | 824c3e540b0e3ea1b1eeda52fafdd425f955c892c67407013fadd16710664e7a | ['7dec41a9197d4d6ab5c804feb38b85f5'] | I am going to install Gentoo Linux, and I see three options on their website:
Minimal Installation CD, 2019-05-26, 286 MiB
Hybrid ISO (LiveDVD), 2016-07-04, 2 GiB
Stage 3, 2019-05-26, 260 MiB
From their website:
The Gentoo minimal installation CD is a bootable image which contains a self-sustained Gentoo environment. It allows the user to boot Linux from the CD or other installation media. During the boot process the hardware is detected and the appropriate drivers are loaded. The image is maintained by Gentoo developers and allows anyone to install Gentoo if an active Internet connection is available.
and
A stage3 tarball is an archive containing a minimal Gentoo environment, suitable to continue the Gentoo installation using the instructions in this manual. ...
I would opt for the hybrid ISO, but it is too old.
What is the difference between the minimal installation CD and "Stage 3", considering they have roughly the same size?
|
14259591abd2ee3063a2f108237629ad7b954932e8922151d310a835da090dd8 | ['7e09eb8a88ce439fa8c59899122a88f7'] | going further:
14.4V / 330 Ohm = 4.7mA|
finally 9.6 + 9.6 + 4.7 = 24mA for 3 LEDs|
or just 240mA for 30LEDs/m and 480mA for 60LEDs/m|
3.5W/m and 7W/m respectively|
140W for all my system|
I think, that bottleneck is my LED controller - I figured that it's the only 3x4A but not more than 100W output, specified in manual... That's a shame, because in the description it was 192W or 144W, otherwise, I wouldn't purchase it. So, adding a few amplifiers in some points will be a good solution.
And yes, now I know how to count my system consumption properly, thank you! | 4bdcdce61311a2dd4efa91a681af8709f0b112264c78c17c42b7635f60cb5833 | ['7e09eb8a88ce439fa8c59899122a88f7'] | Let's say that you use log4j in a program where fds 0, 1, and 2 are either closed (which would cause write(2) to fail with EBADF) or redirected to /dev/null. Then log4j tries to output a log message. What would happen in this situation? You'd have a silent failure, which is something you'd want to avoid having happen in a logging library at all costs.
|
9ae3b50936847bff9a6ecf40c49ca647e8575892d367471f208432d836491967 | ['7e0cd98caab448708ba5bebcd0d303ac'] | When I run your second example:
(test1, test2, test3="3", test4="4", test5 = "5", test6 = "6")
I get a different result from what you report:
test1=="3", test2=="4", test3=="5", test4=="4", test5=="5", test6=="6"
(note that test4 is "4", not "6")
Which makes sense to me, because it parses like this:
((test1, test2, test3) = ("3", (test4="4", (test5 = "5", (test6 = "6")))))
So you get an evaluation something like this:
((test1, test2, test3) = ("3", (test4="4", (test5 = "5", (test6 = "6")))))
[assign "6" to test6]
((test1, test2, test3) = ("3", (test4="4", (test5 = "5", "6"))))
[assign "5" to test5]
((test1, test2, test3) = ("3", (test4="4", "5", "6")))
[assign "4" to test4]
((test1, test2, test3) = ("3", "4", "5", "6"))
[assign "3", "4", and "5" to test1, test2, and test3 respectively]
| 22de78388ab47bfeb8e64f019855fce620d7d9778603e616e6d308c90487e0fc | ['7e0cd98caab448708ba5bebcd0d303ac'] | If I am not wrong your system has three operating system one is windows 7 and other is two different version of Ubuntu.I think your boot loader may not be installed in the same drive where your Ubuntu is installed, if it is not then do the following steps.
1.Use the live CD to check which partitions exists on your hd.
2.Mount your Linux partition
3.(Re)Install Grub.
4.Reboot your system.
|
86fb31ada15ed01ad80f806f4dec08d6e888062ae8ce313d835ba100b1857559 | ['7e16e8c220ea40549e8aaee0bd0a8e26'] | Basically, I have springboot application serving my index.html and other static JS files which includes(runtime, vendor, main) chunks created during the production build by Webpack. How do I set cache-control settings for index.html and chunks separately so that index.html won't be cached and chunks will be cached on the client-side? Currently, I have my resources under static folder like the following:
├── static
│ ├── index.html
| |-- bundles
│ │ ├── main.js
│ │ ├── vendors.js
│ │ ├── runtime.js
`
Basically, I am aiming for long-term caching of static assets on the client-side.
| 44842867f7e4fa1e0b12d3a2c5f4f301bb5d87158762a2df52bb0cd3b524eb58 | ['7e16e8c220ea40549e8aaee0bd0a8e26'] | I am building a small game in HTML canvas in React. For that, I need to pre-load all the images before I start interacting with the canvas API. I am loading all of the images using Promise.all like follows:
import tile from '../assets/images/tile.png';
componentDidMount() {
this.load();
}
loadImages(images) {
return images.map(image => {
return new Promise(resolve => {
const image = new Image();
image.onload = () => {
this.loadedImages.tile = image; //this.loadedImages is an instance variable
resolve(image);
};
image.src = image;
});
});
}
load() {
Promise.all(this.loadImages([tile]))
.then(a => console.log(a))
.catch(e => console.log(e));
}
All of the images exist in the source directory of the project. I am not sure if Promises are used to load them since they are not fetched from web. Anyways, Promise.all in load method does not resolve all the promises so it does not print any of the logs in thenables/catch. However, I can able to resolve a single promise like follows:
loadImage($image) {
return new Promise(resolve => {
const image = new Image();
image.onload = () => {
this.loadedImages.tile = image;
resolve(image);
};
image.src = $image;
});
}
load() {
this.loadImage(tile)
.then(a => console.log(a)) //prints the image element - a
.catch(e => console.log(e));
}
Please someone help me with this. Thank you!
|
6b9376b510e92ed383d843640c66b5f3b85cd2f51d8cff9e318a9fce56d15793 | ['7e181a222754499e9c475264fa2b2758'] | First thing is you don't need to call form.getFieldValue('phone'); in the validator function. Second is the validator accepts 3 parameters where callback is a must. But in your scenario you need to use the value as well so you can do something like
validateMobileNumber = (rule, value, callback) => {
// const{ form } = this.props;
// let mnumber = form.getFieldValue('phone');
console.log("this is a mobil validator",value);
if(value.length !=10 ){
console.log("invalid mobile nuumber");
}
}
And if you asking specific validation rule then that really depends on your requirements. Here is the link for others who might be interested in reading the docs as well.
https://ant.design/components/form/#components-form-demo-register
| 7940adbdb1adde5d94620ad11a4cffe39010c2e669c7c8888c3be298a1fc2a0f | ['7e181a222754499e9c475264fa2b2758'] | Well, I don't know why you have this sort of scenario but the first things that comes in my mind is that you can write handleSaveClick method in your Parent component. And in case you need to use that function on any action that might be happening in your child component, you can pass this function as a prop from parent component. So your both cases can be handled
You can call this method on something happening in parent component
You can use the same method on any action that is happening in your child component.
If still you think that you have to define the method in your child component, you can use the refs
|
d6f0f4801f47e847e9635b21049a28a47026b742aad8b7e1fdf3187d79182969 | ['7e21b63043754fb8a8c2c185cf2e4341'] | I build a multi-tenant app in laravel, That works properly in local but it does not work on production/staging. Whenever I try to login, it shows an error that : SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tenancy.users' doesn't exist.
I have already run migrations and also try php artisan config:ca.
Package used : composer require "hyn/multi-tenant:5.3.*"
.env :
LIMIT_UUID_LENGTH_32=true
APP_URL_BASE=testdomain
APP_URL=http://${APP_URL_BASE}
DB_CONNECTION=system
TENANCY_HOST=<IP_ADDRESS>
TENANCY_PORT=3306
TENANCY_DATABASE=tenancy
TENANCY_USERNAME=root
TENANCY_PASSWORD=
database.php :
'default' => env('DB_CONNECTION', 'tenant'),
....
'system' => [
'driver' => 'mysql',
'host' => env('TENANCY_HOST', '<IP_ADDRESS>'),
'port' => env('TENANCY_PORT', '3306'),
'database' => env('TENANCY_DATABASE', 'tenancy'),
'username' => env('TENANCY_USERNAME', 'tenancy'),
'password' => env('TENANCY_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
'tenant' => [
'driver' => 'mysql',
'host' => env('TENANCY_HOST', '<IP_ADDRESS>'),
'port' => env('TENANCY_PORT', '3306'),
'database' => env('TENANCY_DATABASE', 'tenancy'),
'username' => env('TENANCY_USERNAME', 'tenancy'),
'password' => env('TENANCY_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
.....
| 4377f77b1fa7aeaefa474f428cda966de667407d033fef23472ce8f3ed6bfd37 | ['7e21b63043754fb8a8c2c185cf2e4341'] | You can also use Right and Position property of css.
div.b {
height: 0%;
border-bottom: 20px solid #c00;
width: 830px;
right: 30px;
position: absolute;
-webkit-animation: increase 3s;
-moz-animation: increase 3s;
-o-animation: increase 3s;
animation: increase 3s;
animation-fill-mode: forwards;
}
@keyframes increase {
100% {
width: 10px;
}
<!DOCTYPE html>
<html>
<body>
<div class="b"></div>
</body>
</html>
|
93e51f6dea552b13a3b43f3562a929515d2e509f028c5c5a0a6a1b4aa287da58 | ['7e432851c6564984bb56e314570c89f0'] | i'm noob using the youtubeapi for android, i've setup and i've launched the demo app with success, but seeing the demo examples it seems that when you select a play list, the app launch an Intent that goest outside the app, using the network explorer. I'd like to load a play list inside my app, is it possible?
Thanks in advance!!
| d4a1a5cefeae279d719c15e45b8364d05722b45a3ef9bf4b6b2d8549525bcb98 | ['7e432851c6564984bb56e314570c89f0'] | i'm drawing a list with the RecyclerView component succesfully, but when i have a lot of items, if i scroll down very fast, sometimes one item gets overlapped over the RecyclerView. if i scroll at a "normal" velocity, never happens this bad performance, only when i scroll down fast in the first load of the RecyclerView. It seems like a bug... Any ideas? This is the code from my adapter:
public class RecibosListRVAdapter extends RecyclerView.Adapter<RecibosListRVAdapter.ItemReciboViewHolder> implements Filterable{
private static final String TAG = "RecibosListRVAdapter";
public static List<ItemRecibo> listRecibos, listRecibosFiltered;
private int lastPosition = -1;
Context context;
HashMap<String, Integer> hashLogos;
public InterfaceRecibo_Clicked asysncresponse;
TinyDB tini;
public static List<ItemRecibo> getListRecibosFiltered() {
return listRecibosFiltered;
}
public static List<ItemRecibo> getListRecibos() {
return listRecibos;
}
public static void setListRecibos(List<ItemRecibo> listRecibos) {
RecibosListRVAdapter.listRecibos = listRecibos;
}
public static void setListRecibosFiltered(List<ItemRecibo> listRecibosFiltered) {
RecibosListRVAdapter.listRecibosFiltered = listRecibosFiltered;
}
@Override
public Filter getFilter() {
return new RecibosFilter(this, listRecibos);
}
private static class RecibosFilter extends Filter {
private final RecibosListRVAdapter adapter;
private final List<ItemRecibo> originalList;
private final List<ItemRecibo> filteredList;
private RecibosFilter(RecibosListRVAdapter adapter, List<ItemRecibo> originalList) {
super();
this.adapter = adapter;
this.originalList = new LinkedList<>(originalList);
this.filteredList = new ArrayList<>();
}
@Override
protected FilterResults performFiltering(CharSequence constraint) {
filteredList.clear();
final FilterResults results = new FilterResults();
if (constraint.length() == 0) {
filteredList.addAll(originalList);
} else {
final String filterPattern = constraint.toString().toLowerCase().trim();
for (final ItemRecibo user : originalList) {
if (user.getMontante().contains(constraint)) {
filteredList.add(user);
}
if (user.getDescripcion().toLowerCase().contains(constraint.toString().toLowerCase())) {
filteredList.add(user);
}
if (user.getProveedor().toLowerCase().contains(constraint.toString().toLowerCase())) {
filteredList.add(user);
}
if (user.getEstado().toLowerCase().contains(constraint.toString().toLowerCase())) {
filteredList.add(user);
}
if (user.getFechaEntrada().toLowerCase().contains(constraint.toString().toLowerCase())) {
filteredList.add(user);
}
}
}
results.values = filteredList;
results.count = filteredList.size();
return results;
}
@Override
protected void publishResults(CharSequence constraint, FilterResults results) {
adapter.listRecibosFiltered.clear();
adapter.listRecibosFiltered.addAll((ArrayList<ItemRecibo>) results.values);
adapter.notifyDataSetChanged();
}
}
public RecibosListRVAdapter(FrmListadoRecibos activity, List<ItemRecibo> listRecibos, TinyDB tini)
{
this.asysncresponse = activity;
this.listRecibos = listRecibos;
this.listRecibosFiltered = new ArrayList<>(listRecibos);
hashLogos = Utilidades.rellenaHash();//TODO quitar estático
this.tini = tini;
}
@Override
public RecibosListRVAdapter.ItemReciboViewHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
context = parent.getContext();
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_listadorecibos, parent, false);
ItemReciboViewHolder itemrecibo_holder = new ItemReciboViewHolder(v, new ItemReciboViewHolder.IMyViewHolderClicks()
{
public void onPotatoClick(View caller, int posClicked) {
Log.d("TAG", "Poh-tah-tos");
if(caller instanceof CardView) {
asysncresponse.response_cardview_clicked(posClicked, (CardView) caller);
}
};
});
return itemrecibo_holder;
}
@Override
public void onBindViewHolder(RecibosListRVAdapter.ItemReciboViewHolder holder, int position)
{
if(position < listRecibosFiltered.size()) {
try {
holder.imgempresa.setImageResource(hashLogos.get(listRecibosFiltered.get(position).getUrlicon()));//R.mipmap.icn_iberdrola_beta
} catch (NumberFormatException ne) {
Log.e(TAG, "mal formato en RecibosListRVAdapter asignando la url del icono de empresa");
holder.imgempresa.setImageResource(R.mipmap.ic_launcher);
}
holder.txtrecibotitle.setText(listRecibosFiltered.get(position).getDescripcion());
holder.txtestado.setText(listRecibosFiltered.get(position).getEstado());
holder.txtfechavence.setText(listRecibosFiltered.get(position).getFechaEntrada());
holder.txtfacturaimporte.setText(TextUtils.concat(listRecibosFiltered.get(position).getMontante(), Constants.EUROSUFIJO));
if (tini.getBoolean(listRecibosFiltered.get(position).getId(), false)) {
holder.cv.setCardBackgroundColor(context.getResources().getColor(R.color.pagado));
holder.txtestado.setText(context.getResources().getString(R.string.pagado));
holder.txtestado.setTextColor(context.getResources().getColor(R.color.pagadoestado));
holder.txtestado.setTypeface(null, Typeface.BOLD);
} else {
holder.txtestado.setTextColor(context.getResources().getColor(R.color.pendienteorange));
holder.txtestado.setTypeface(Typeface.createFromAsset(context.getAssets(), "fonts/robotolight.ttf"));
if (position % 2 == 0)
holder.cv.setCardBackgroundColor(context.getResources().getColor(R.color.orangelightest));
else
holder.cv.setCardBackgroundColor(context.getResources().getColor(R.color.orangelighter));
}
setAnimation(holder.itemView, position);
}
}
// Apply some custom animations to loading the items in the list
private void setAnimation(View viewToAnimate, int position)
{
// If the bound view wasn't previously displayed on screen, it's animated
if (position > lastPosition)
{
Animation animation = AnimationUtils.loadAnimation(context, android.R.anim.slide_in_left);
viewToAnimate.startAnimation(animation);
lastPosition = position;
}
}
@Override
public int getItemCount() {
if(this.listRecibosFiltered!=null)
return this.listRecibosFiltered.size();
else
return 0;
}
public static class ItemReciboViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener
{
CardView cv;
ImageView imgempresa;
TextView txtrecibotitle;
TextView txtestado;
TextView txtfechavence;
TextView txtfacturaimporte;
public IMyViewHolderClicks mListener;
ItemReciboViewHolder(View itemView, IMyViewHolderClicks listener) {
super(itemView);
mListener = listener;
cv = (CardView)itemView.findViewById(R.id.itemlistadocard);
imgempresa = (ImageView)itemView.findViewById(R.id.imgempresa);
txtrecibotitle = (TextView)itemView.findViewById(R.id.txtfacturaname);
txtestado = (TextView)itemView.findViewById(R.id.txtfacturaestado);
txtfechavence = (TextView)itemView.findViewById(R.id.txtfacturafechavence);
txtfacturaimporte = (TextView)itemView.findViewById(R.id.txtfacturaimporte);
cv.setOnClickListener(this);
}
@Override
public void onClick(View v) {
if (v instanceof CardView){
mListener.onPotatoClick((CardView) v, this.getLayoutPosition());
}
}
public static interface IMyViewHolderClicks {
public void onPotatoClick(View caller, int posclick);
}
}
}
|
12202b2de2e8f77db419e158c9051b9625e24b1d7c361ab553d17b158f3ce4f8 | ['7e51a7e09b2a4a8f881301a1395d686d'] | My opinion:
Model: Store data of the path in the Model class, like array of points.
Utility/Helper: Create some painting methods in a utility class, like PaintHelper. Input is the data of the path. So you can use it in other projects.
Controller: call to get data from model, then call painting methods. Then get final result and display/reset UI.
| 40e92c07273e6d9bba02958bbb4f8ddd35b8e9a86f7d5309f63d9733e0e43e34 | ['7e51a7e09b2a4a8f881301a1395d686d'] | You can create a UIView for background of indicator:
func showActivityIndicatory(uiView: UIView) {
var container: UIView = UIView()
container.frame = uiView.frame
container.center = uiView.center
container.backgroundColor = UIColorFromHex(0xffffff, alpha: 0.3)
var loadingView: UIView = UIView()
loadingView.frame = CGRectMake(0, 0, 80, 80)
loadingView.center = uiView.center
loadingView.backgroundColor = UIColorFromHex(0x444444, alpha: 0.7)
loadingView.clipsToBounds = true
loadingView.layer.cornerRadius = 10
var actInd: UIActivityIndicatorView = UIActivityIndicatorView()
actInd.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
actInd.activityIndicatorViewStyle =
UIActivityIndicatorViewStyle.WhiteLarge
actInd.center = CGPointMake(loadingView.frame.size.width / 2,
loadingView.frame.size.height / 2);
loadingView.addSubview(actInd)
container.addSubview(loadingView)
uiView.addSubview(container)
actInd.startAnimating()
}
Ref: https://coderwall.com/p/su1t1a/ios-customized-activity-indicator-with-swift
|
82357ec20d6260875df06ed0c01be86ee14207918298c30a14ec2319b9b0b371 | ['7e5463fb63fb472fb01b12f2648619f1'] | i want to debug an php generated image algorithm with print.
The problem is that it doesn't output the text i put in print.
How can i output variables, so that i can debug?
Thanks,
<PERSON>
public function drawPicture()
{
$im = imagecolorallocate ($this->picture, 255, 0, 255);
imagettftext($this->picture, $this->fontSize , 0, 100, 100,$im , "cooperm.TTF", $this->name);
# int ImageCopy ( resource $dst_im , resource $src_im , int $dst_x , int $dst_y , int $src_x , int $src_y , int $src_w , int $src_h )
//imagecopy($this->picture, $this->pika, $this->wappen['pika']['dst_x'], $this->wappen['pika']['dst_y'], 0, 0, $this->pika_size[0], $this->pika_size[1]);
$zufall = rand(1,99999999);
#header("Content-Type: image/jpeg");
imagepng($this->picture);
$this->checkFontSize();
imagedestroy($this->picture);
print "WHY_DOESNT_PRINT?";
}
| 34994878cbd5740252e723149bf3304e4c821acbe83b2b5ded7a2a1c97dc94eb | ['7e5463fb63fb472fb01b12f2648619f1'] | I'm writing an Ant-Simulation.
The Kernel Performance is very bad. In comparsion to standard c++ solution it has a big performance disadvantage.
I dont understand why. The operations in the kernel are mostly without control structures (like if/else).
Kernels:
https://github.com/Furtano/BA-Code-fuer-Mac/blob/master/BA/Ant.cl
https://github.com/Furtano/BA-Code-fuer-Mac/blob/master/BA/Pheromon.cl
I made a benchmark, and the OpenCL Kernel Performance is very bad.
(Left Axis: Execution time in ms, Bottom Axis: number of simulated Ants)
Can you give me advice?
You can find the hole code in the git repo, if you are interested (the OpenCL stuff is happening here: https://github.com/Furtano/BA-Code-fuer-Mac/blob/master/BA/clInitFunctions.cpp).
Thanks :)
|
9a6c4d0e762ac60afc7c5edf3a23673145b7996fb354daa93949f5c17ad85182 | ['7e6d42ff60754d0b97eb6fbbc6be0b5a'] | Bosun fails to send alert notification to mail configured with the below log.
error: notify.go:111: failed to send alert high.cpu{host=} to [*@gmail.com] EOF
This is my bosun.conf
tsdbHost = localhost:4242
stateFile = /data/bosun.state
ledisBindAddr = 0.0.0.0:9565
smtpHost = smtp.gmail.com:465
emailFrom = <EMAIL_ADDRESS><IP_ADDRESS>:9565
smtpHost = smtp.gmail.com:465
emailFrom = bosun-alert@noreply.com
notification email {
email = ***@gmail.com
next = email
timeout = 5s
print = true
}
template test {
subject = {{.Last.Status}}: {{.Alert.Name}} on {{.Group.host}}
body = `<p>Alert: {{.Alert.Name}} triggered on {{.Group.host}}
<hr>
<p><strong>Computation</strong>
<table>
{{range .Computations}}
<tr><td><a href="{{$.Expr .Text}}">{{.Text}}</a></td><td>{{.Value}}</td></tr>
{{end}}
</table>
<hr>
{{ .Graph .Alert.Vars.metric }}
<hr>
<p><strong>Relevant Tags</strong>
<table>
{{range $k, $v := .Group}}
<tr><td>{{$k}}</td><td>{{$v}}</td></tr>
{{end}}
</table>`
}
alert high.cpu {
template = test
$metric = q("sum:rate{counter,,1}:os.cpu{host=*}", "1h", "")
$avgcpu = avg($metric)
crit = $avgcpu > 3
warn = $avgcpu > 2
critNotification = email
warnNotification = email
}
Please help me figure what I am doing wrong.
| a58a92a5846e8198d4c177b865b9f8ea270fc84ba40c8dc726d23eca21f96403 | ['7e6d42ff60754d0b97eb6fbbc6be0b5a'] | Why is it giving 400 bad request for the following code. We want to schedule a torrent using web API of utorrent.
import urllib2, base64
username = "username"
password = "password"
request = urllib2.Request("http://<my_ip>:<torrent_webapi_port>/gui/?action=add-url&s=%s" % urllib2.quote("http://torcache.net/torrent/CDADFE86960C3255EB37B15F7E45C281F3A3C937.torrent?title=[kickass.to]arrow.s02e14.hdtv.x264.lol.ettv"))
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result.read()
|
d76723dc6c39fb83118a8d2f5488de2fb0d5724024c3cdb5cab964cd3ff76c41 | ['7e75662448fb4e469a38fa02fd3a665d'] | I am using mstsc RDP API for remote connection.I have seen in MSDN there is an api for device redirection from mstsc activex.
As per MSDN IMsRdpDeviceV2 is an enhancement of the IMsRdpDevice interface.
https://learn.microsoft.com/en-us/windows/desktop/termserv/imsrdpdevicev2
Checked dll version
- 10.0.17134
- 10.0.16299
- 10.0.15063
- 10.0.14393
- 10.0.10290
- 6.1.7601
Where can i find IMsRdpDeviceV2?
| 55c297eb0ceac97b6d305c83244e59076f93d6bda112039e06f1b232f8002f27 | ['7e75662448fb4e469a38fa02fd3a665d'] | How can i integrate userid and password in NSIS script which will enable to runas admin mode?
I have a simple NSIS Script which copy my application file to program files. This script works in admin mode. i have to install this on several machine with admin(Administrator) and password(CorpPass@2424) without giving UAC Dialog.
Sample Script
# This installs two files, app.exe and logo.ico, creates a start menu shortcut, builds an uninstaller, and
# adds uninstall information to the registry for Add/Remove Programs
# To get started, put this script into a folder with the two files (app.exe, logo.ico, and license.rtf -
# You'll have to create these yourself) and run makensis on it
# If you change the names "app.exe", "logo.ico", or "license.rtf" you should do a search and replace - they
# show up in a few places.
# All the other settings can be tweaked by editing the !defines at the top of this script
!define APPNAME "TEST App Name"
!define COMPANYNAME "TEST NAME"
!define DESCRIPTION "A short description goes here"
# These three must be integers
!define VERSIONMAJOR 1
!define VERSIONMINOR 1
!define VERSIONBUILD 1
# These will be displayed by the "Click here for support information" link in "Add/Remove Programs"
# It is possible to use "mailto:" links in here to open the email client
!define HELPURL "http://..." # "Support Information" link
!define UPDATEURL "http://..." # "Product Updates" link
!define ABOUTURL "http://..." # "Publisher" link
# This is the size (in kB) of all the files copied into "Program Files"
!define INSTALLSIZE 7233
RequestExecutionLevel admin ;Require admin rights on NT6+ (When UAC is turned on)
InstallDir "$PROGRAMFILES\${COMPANYNAME}\${APPNAME}"
# rtf or txt file - remember if it is txt, it must be in the DOS text format (\r\n)
LicenseData "license.rtf"
# This will be in the installer/uninstaller's title bar
Name "${COMPANYNAME} - ${APPNAME}"
Icon "logo.ico"
outFile "sample-installer.exe"
!include LogicLib.nsh
# Just three pages - license agreement, install location, and installation
page license
page directory
Page instfiles
!macro VerifyUserIsAdmin
UserInfo<IP_ADDRESS>GetAccountType
pop $0
${If} $0 != "admin" ;Require admin rights on NT4+
messageBox mb_iconstop "Administrator rights required!"
setErrorLevel 740 ;ERROR_ELEVATION_REQUIRED
quit
${EndIf}
!macroend
function .onInit
setShellVarContext all
!insertmacro VerifyUserIsAdmin
functionEnd
section "install"
# Files for the install directory - to build the installer, these should be in the same directory as the install script (this file)
setOutPath $INSTDIR
# Files added here should be removed by the uninstaller (see section "uninstall")
file "app.exe"
file "logo.ico"
# Add any other files for the install directory (license files, app data, etc) here
# Uninstaller - See function un.onInit and section "uninstall" for configuration
writeUninstaller "$INSTDIR\uninstall.exe"
# Start Menu
createDirectory "$SMPROGRAMS\${COMPANYNAME}"
createShortCut "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk" "$INSTDIR\app.exe" "" "$INSTDIR\logo.ico"
sectionEnd
# Uninstaller
function un.onInit
SetShellVarContext all
#Verify the uninstaller - last chance to back out
MessageBox MB_OKCANCEL "Permanantly remove ${APPNAME}?" IDOK next
Abort
next:
!insertmacro VerifyUserIsAdmin
functionEnd
section "uninstall"
# Remove Start Menu launcher
delete "$SMPROGRAMS\${COMPANYNAME}\${APPNAME}.lnk"
# Try to remove the Start Menu folder - this will only happen if it is empty
rmDir "$SMPROGRAMS\${COMPANYNAME}"
# Remove files
delete $INSTDIR\app.exe
delete $INSTDIR\logo.ico
# Always delete uninstaller as the last action
delete $INSTDIR\uninstall.exe
# Try to remove the install directory - this will only happen if it is empty
rmDir $INSTDIR
# Remove uninstaller information from the registry
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${COMPANYNAME} ${APPNAME}"
sectionEnd
|
87df26617cfda946f893258b81cc354d3d22435a32c0c18dc077126b5073ad9e | ['7e7646bdad6e4169998a5f3d5d167e95'] | Вроде как решил вопрос)
ymaps.ready(init);
function init() {
// Стоимость за километр.
var DELIVERY_TARIFF = 1.25,
// Минимальная стоимость.
MINIMUM_COST = 1,
myMap = new ymaps.Map('map', {
center: [36.838093, -100.496856
],
zoom: 5,
controls: []
}),
// Создадим панель маршрутизации.
routePanelControl = new ymaps.control.RoutePanel({
options: {
// Добавим заголовок панели.
float: 'left',
maxWidth: '500px',
minWidth: '200px',
showHeader: true,
title: 'Delivery calculation'
}
}),
zoomControl = new ymaps.control.ZoomControl({
options: {
size: 'large',
float: 'right',
position: {
top: 15,
right: 20
}
}
});
// Пользователь сможет построить только автомобильный маршрут.
routePanelControl.routePanel.options.set({
types: {auto: true}
});
myMap.controls.add(routePanelControl).add(zoomControl);
// Получим ссылку на маршрут.
routePanelControl.routePanel.getRouteAsync().then(function (route) {
// Зададим максимально допустимое число маршрутов, возвращаемых мультимаршрутизатором.
route.model.setParams({results: 1}, true);
// Повесим обработчик на событие построения маршрута.
route.model.events.add('requestsuccess', function () {
var activeRoute = route.getActiveRoute();
if (activeRoute) {
// Получим протяженность маршрута.
var length = route.getActiveRoute().properties.get("distance"),
// Вычислим стоимость доставки.
price = calculate(Math.round(length.value / 1000)),
// Создадим макет содержимого балуна маршрута.
balloonContentLayout = ymaps.templateLayoutFactory.createClass(
'<span>Расстояние: ' + length.text + '.</span><br/>' +
'<span style="font-weight: bold; font-style: italic">Стоимость доставки: ' + price + ' р.</span>');
// Зададим этот макет для содержимого балуна.
route.options.set('routeBalloonContentLayout', balloonContentLayout);
var d = document.getElementById("viewContainer");
while (d.firstChild)
d.removeChild(d.firstChild);
this.outputElement = $('<div><form id="feedback" action="mail.php" method="post"><p><div class="tt">Route length: </div><input name="length" value="' + length.text + '"></p><p><div class="tt">Delivery Price: </div><input name="price" value="' + price + ' $"></p><p><div class="tt">Your Name: </div><input type="text" name="name" value=""></p><p><div class="tt">Your Phone: </div><input type="text" name="tel" value=""></p><p><input type="submit" value="Send"></p></div>').appendTo('#viewContainer');
// Откроем балун.
activeRoute.balloon.open();
}
});
});
// Функция, вычисляющая стоимость доставки.
function calculate(routeLength) {
return Math.max(routeLength * DELIVERY_TARIFF, MINIMUM_COST);
}
}
<!DOCTYPE html>
<html>
<head>
<title>Cost to ship a car</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://api-maps.yandex.ru/2.1/?lang=en_US" type="text/javascript"></script>
<script src="deliveryCalculator.js" type="text/javascript"></script>
<script src="https://yandex.st/jquery/2.2.3/jquery.min.js" type="text/javascript"></script>
<style>
html, body{
width: 100%;
height: 100%;
padding: 0;
margin: 0;
}
#map {
width: 100%; height: 50%;
}
#viewContainer {
margin: 8px;
}
</style>
</head>
<body>
<div id="map"></div>
<div id="viewContainer"></div>
</body>
</html>
| 7a2de3369199b90e5833777a7a9f35dab71912e05e3dbbfa64c99c03cbedac6e | ['7e7646bdad6e4169998a5f3d5d167e95'] | Rooted my Tecno Spark K7 Android 7.0 Nougat (Stock ROM + Magisk + TWRP). Trying to reinstall my apps from backup apks but I'm getting this message App not installed. This app isn't compatible with your phone. Doesn't really make sense to me, since I'm using the same apks that were installed on the same phone with the same stock ROM.
Only difference is the rooting but my old phone was also rooted, and I had no trouble reinstalling its apps, so I honestly don't see how rooting is the cause of my current issue.
How do I solve this?
|
cdc15f3a6dc22d22ce64060472852d8c1c89a49e141ade3e8b6d1a6c92ca75e2 | ['7e8a7e7825d94c13b97d8fade7e735e9'] | @Crissov The `(?!…)` expressions only save a few bytes each. I reduced a lot of bytes by combining three of the positive/negative week-of-year/day-of-week year patterns into one each. The last ones don't correspond to each other. So I got 8 long sub-patterns down to 5. Also, since `|20|25|` is the same length as `|2[05]|` I went for the more readable option. | f04b7b50e9cd72ad6b214abe90422866d89844a0c80a17d343e5c464d6ae7d37 | ['7e8a7e7825d94c13b97d8fade7e735e9'] | At least in the UK, it depends greatly on the business which site is defacto. I have engineer friends on LinkedIn. I also have friends who are artists, fencing instructors, have businesses making clothing or are magicians or musicians and they all have business facebook pages in addition to their personal facebook pages. I would never look for any of those businesses on LinkedIn. |
8392b113ac8454c8429a4cdb13dea01d00bfa0a45ee430c67992241cb42c59de | ['7e90f89f441b4972800798ed1d02033d'] | It sounds like you need to set up your HABTM relationship properly.
You already have the join table, UsersExtended, which contains your foreign keys.
Remove all previous relationships and set up HABTM in each of your User and UserExtendedField models.
The relationship code in your User model would look like this:
var $hasAndBelongsToMany = array(
'UsersExtended' => array(
'className' => 'UsersExtended',
'joinTable' => 'UsersExtended', //assuming this is the
//name of that model's table
'foreignKey' => 'user_id',
'associationForeignKey' => 'field_id'
)
);
For more information check out the page in the cakephp book
In addition, this blog post helped me grasp the relationship concepts when I was learning cakephp.
| de72eeb142ccf94141eb4d61040ef7fb169235d7fdc32c5318ae9ad8867581c3 | ['7e90f89f441b4972800798ed1d02033d'] | Based on your description, I would recommend doing it this way:
Have a users table with a field for "group_id". This allows you to have multiple users with login privileges that all can view the same options or colors based on their grouping.
In the case of a general (non-logged in) user, the assign the group_id to default to 0.
Next, ditch the product_selections and product_selections_colors tables.
You don't want to have to repeat products across tables.
Simply add a new table that pairs which product ids can be purchased by which group_ids. (HABTM relationship in cake)
You will obviously need to tweak this general setup to work specifically for your needs.
|
a4996f929e9e8a41155f178e0d53734b3929177f9c162c4c4e5d77100baeb8de | ['7e9260d5816e4ac39fb681bc1f8ff977'] | I recently posted an answer on the Hello, World question and after posting, discovered this answer claiming to do it in 18 bytes in brainfuck. I read through it and thought that it was completely wrong and so notified the OP in the comments. We then had a bit of an argument about whether this is a valid answer but we couldn't settle it so I thought I'd post this.
Can anyone settle this debate? Surely his answer is invalid?
| 5b1cbe08c852cd19f4c978440f1d4c40a79c87ac26398d2cbfcc847a447ba71b | ['7e9260d5816e4ac39fb681bc1f8ff977'] | Not quire sure why this has been VTCed. As far as I can tell, this is a very clear challenge, with a couple of clarifications which have been made. Would the close voter mind clarifying their reasoning for the rest of us, so we can understand *why* you've voted? |
ccdfc76a3698f905e1927e2621f0a95f2c51eb0f22ac15ac9e2bd9041ce4386f | ['7e996c91b21648b991b0c480c9e0609a'] | I am trying to run cucumber+testNG+selenium through Maven .
My Runner File looks like this
//@RunWith(Cucumber.class)
@CucumberOptions(
format={"pretty", "json:target/report.json"},
features = {"classpath:cucumber/sample.feature"},
glue = "com.stepDefinitions",
tags="@test"
)
public class RunCukesTest extends AbstractTestNGCucumberTests {
}
I initialize my driver in @BeforeSuite
WebDriver driver = new FirefoxDriver();
It works fine when i run it through TestNG Test in Eclipse , But it throws Null Pointer Exception while i try it with mvn test
Am i missing something here?
| ffd3d03e54640b5b6d4b00bc07904d83af23084190f5e31d4fc7768a7a7bee07 | ['7e996c91b21648b991b0c480c9e0609a'] | I am new to docker , we are trying to create docker image for my project which we used run in simple Maven commands
mvn verify
a quick google search gives me - Dockerfile
FROM maven:3.6.0-jdk-8
COPY src C:/docker/
COPY pom.xml C:/docker/
COPY testng.xml C:/docker/
RUN mvn -f C:\docker clean verify
my understanding from above commands are , fetch maven 3.6 image from docker hub and copy existing project files to docker container and run the maven commands .
My POM.XML looks like
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-jvm-deps</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.2.5</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>net.masterthought</groupId>
<artifactId>cucumber-reporting</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.44.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.26</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<useSystemClassLoader>false</useSystemClassLoader>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>sample</projectName>
<outputDirectory>target/cucumber-reports/advanced-reports</outputDirectory>
<cucumberOutput>target/cucumber-reports/CucumberTestReport.json</cucumberOutput>
<buildNumber>1</buildNumber>
<parallelTesting>false</parallelTesting>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
I am getting an error saying
POM file C:docker specified with the -f/--file command line argument
does not exist
I know that , i have problem with my docker basics , but it would be great help if you teach/tell me what could be the issue here .
|
d821f41fee67ec131a335a3d5e8571936392e8dcc89cf44422a8417ea3a448ac | ['7e9976b148aa43baa75e1c7a18d01f60'] | I'm working on a site which i'm developing using an MVC structure. My models will represent all of data in the site, but i'm struggling a bit to decide on a good controller structure. The site will allow users to login/register and see personal data on a number of pages, but also still have access to public pages, e.g FAQs, Contact page etc.
This is what I have at the moment...
A Template Controller which handles main template display. The basic template for the site will remain the same whether or not you are logged in.
A main Website Controller which extends the Template Controller and handles basic authentication. If the user is logged in, a User<IP_ADDRESS>control_panel() method is called from the constructor and this builds the control panel which will be present throughout the authenticated session. If user is not logged in, then a different view is loaded instead of the control panel, e.g with a login form. All protected/public page related controllers will extend the website controller.
The user homepage has a number of widgets I want to display, which I'm doing via a Home Controller which extends the Website Controller. This controller generates these widgets via the following static calls:
$this->template->content->featured_pet = Pet<IP_ADDRESS>featured();
$this->template->content->popular_names = Pet<IP_ADDRESS>most_popular();
$this->template->content->owner_map = User<IP_ADDRESS>generate_map();
$this->template->content->news = News<IP_ADDRESS>snippet();
I suppose the first thing I'm unsure about is if the above static calls to controllers (e.g Pet and User) are ok to remain static - these static methods will return views which are loaded into the main template. This is the way I've done things in the past but I'm curious to find out if this is a sensible approach. Other protected pages for signed in users will be similar to the Home Controller.
Static pages will be handled by a Page Controller which will also extend the Website Controller, so that it will know whether or not the user control panel or login form should be shown on the left hand side of the template. The protected member only pages will not be routed to the Page Controller, this controller will only handle publicly available pages.
One problem I have at the moment, is that if both public and protected pages extend the Website Controller, how do I avoid an infinite loop - for example, the idea is that the website controller should handle authentication then redirect to the requested controller (URL), but this will cause an infinite redirect loop, so i need to come up with a better way of dealing with this.
All in all, does this setup make any sense?! Grateful for any feedback.
| be34c77d5b0c6692f4abc3db464c3c96ed39f428511d559912ec73bb0867b418 | ['7e9976b148aa43baa75e1c7a18d01f60'] | У меня есть скрипт, в который я вставил фрагмент с кодом, который использует функцию
header('Content-type: image/jpeg');
что значит на странице есть рисунок.
Но она мне сбивает весь остальной код. Как мне локализовать её только для части кода? или может есть возможность использовать второй раз header, что бы перекодировать обратно страницу в
header('Content-type: text/html');
|
f877ce2a126e7e34e1b03ede249bce1b4f9d4f88c78912b1c5c9b1418d05a556 | ['7ea74496a2364549a89b04210f2236ce'] | App uses the JSON API plugin with the Glide library for images.
For example, a high quality picture like this:
http://previews.123rf.com/images/wavebreakmediamicro/wavebreakmediamicro1403/wavebreakmediamicro140342957/28409409-Group-of-people-running-together-for-fitness-in-the-park-Stock-Photo.jpg
comes out very blurry like this in cardview:
On other areas of the app, the image loads fine.
I downloaded the Disable JPEG Compression and Regenerate Thumbnails.
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="150dp"
android:clickable="true"
android:foreground="?android:attr/selectableItemBackground"
android:layout_margin="5dp"
app:cardBackgroundColor="@color/cardBackground"
app:cardCornerRadius="10dp"
app:cardElevation="5dp"
android:id="@+id/card_view">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Thumbnail image -->
<ImageView
android:id="@+id/thumbnail"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_gravity="center_horizontal|top"
android:adjustViewBounds="true"
android:scaleType="centerCrop"/>
<!-- Article title -->
<TextView
android:id="@+id/title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="@dimen/activity_horizontal_margin"
android:layout_gravity="bottom"
android:background="@drawable/listgrad"
android:textColor="@android:color/white"
android:textAppearance="?android:attr/textAppearanceMedium" />
<!-- Article comment count -->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:id="@+id/comment_count"
android:layout_alignBottom="@+id/thumbnail"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<!-- Article view count -->
<!--<TextView-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:textAppearance="?android:attr/textAppearanceSmall"-->
<!--android:text="Small Text"-->
<!--android:id="@+id/view_count"-->
<!--android:layout_alignTop="@+id/comment_count"-->
<!--android:layout_toLeftOf="@+id/comment_count"-->
<!--android:layout_toStartOf="@+id/comment_count" />-->
</FrameLayout>
Adapter
public class MyRecyclerViewAdaptor extends RecyclerView.Adapter<MyRecyclerViewAdaptor.ViewHolder> {
// A list of posts
private List<Post> posts;
private Context mContext;
private OnItemClickListener mListener;
public interface OnItemClickListener {
void onItemClick(Post post);
}
public MyRecyclerViewAdaptor(ArrayList<Post> posts, OnItemClickListener listener) {
this.posts = posts;
mListener = listener;
}
@Override
public ViewHolder onCreateViewHolder(final ViewGroup viewGroup, final int i) {
View v = LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.card_view_item, viewGroup, false);
mContext = viewGroup.getContext();
return new ViewHolder(v);
}
@Override
public void onBindViewHolder(ViewHolder viewHolder, final int i) {
Glide.with(mContext)
.load(posts.get(i).getThumbnailUrl())
.centerCrop()
.into(viewHolder.thumbnailImageView);
viewHolder.title.setText(posts.get(i).getTitle());
int count = posts.get(i).getCommentCount();
String countText = (count == 1 || count == 0) ? count + " Comment" : count + " Comments";
viewHolder.commentCount.setText(countText);
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mListener.onItemClick(posts.get(i));
}
});
}
@Override
public int getItemCount() {
return posts.size();
}
public static class ViewHolder extends RecyclerView.ViewHolder {
ImageView thumbnailImageView;
TextView title;
TextView commentCount;
public ViewHolder(View itemView) {
super(itemView);
thumbnailImageView = (ImageView) itemView.findViewById(R.id.thumbnail);
title = (TextView) itemView.findViewById(R.id.title);
commentCount = (TextView) itemView.findViewById(R.id.comment_count);
}
}
}
| 2efda2bca61fe895bf406c81a4b6901f59ac2ced7c431805b9c99323528094ac | ['7ea74496a2364549a89b04210f2236ce'] | Unfortunately, "tools:replace" didn't work for me, but a GitHub issue in the Firebase UI has a solution https://github.com/firebase/FirebaseUI-Android/issues/230
But FirebaseUI already depends on version 4.11.0 of the SDK. Can you try removing your Facebook dependency and just relying on the transitive dependency brought in by FirebaseUI?
|
2b98d1b21d9ae3e096ba055d811f641fea0988d22fa1e36550edc15a03323b42 | ['7eb306e6a7c849bba520205651541813'] | I want to delete multiple rows or all rows in Database using DataGridView.
For example. If I have 10 rows in the DataGridView, then all the 10 rows should be selected and deleted. Here is my code for deleting single row in database using DataGridView.
private void btnDeleteProduct_Click(object sender, EventArgs e)
{
ConnectionStringSettings conSettings = ConfigurationManager.ConnectionStrings["MyDBConnectionString"];
string connectionString = conSettings.ConnectionString;
if (ProductServicesDataGrid.CurrentRow.Selected)
{
string selectedCode = ProductServicesDataGrid.CurrentRow.Cells[0].Value.ToString();
conn = new SqlConnection(connectionString);
try
{
conn.Open();
cmd = new SqlCommand("DELETE FROM ProductServices where ProductCode='" + selectedCode + "' ", conn);
sdr = cmd.ExecuteReader();
loadProductServicesTable();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
conn.Close();
}
}
else
{
MessageBox.Show("Row is not Selected");
}
}
Can someone please help me and modify my code?
| 9140ca2356cf3d7b901407fc0f379f6cb51798447206c1fe695ac011f0401b24 | ['7eb306e6a7c849bba520205651541813'] | You can try something like this:
public void Color()
{
foreach (DataGridViewRow row in ProductServicesDataGrid.Rows)
if (Convert.ToInt32(row.Cells[5].Value) > Convert.ToInt32(row.Cells[6].Value))
{
row.DefaultCellStyle.ForeColor = Color.DarkGreen;
}
else if (Convert.ToInt32(row.Cells[5].Value) < Convert.ToInt32(row.Cells[6].Value))
{
row.DefaultCellStyle.ForeColor = Color.Yellow;
}
else if (Convert.ToInt32(row.Cells[5].Value) == 0 && Convert.ToInt32(row.Cells[6].Value) > Convert.ToInt32(row.Cells[5].Value))
{
row.DefaultCellStyle.ForeColor = Color.Red;
}
else
{
row.DefaultCellStyle.ForeColor = Color.DarkBlue;
}
}
|
8a69032a9d4aa692ab2c763d4f48a6d6056d3aefad8549bf91c19202fbeae85b | ['7ec17872a0904de7bd2b1f91c9aef176'] | Are you sure it never moves to the next step? Maybe it does, but, for instance, in 5 minutes?
I'm asking that because Step Functions has the limitation: even if your Glue job executes in a few seconds, Step Functions polls the results from Glue job once every 5 minutes actually.
A kind of workaround you could implement is to change arn:aws:states<IP_ADDRESS>:glue:startJobRun.sync to arn:aws:states<IP_ADDRESS>:glue:startJobRun — then Glue job task just will trigger the Glue job and will move to the next step.
Most likely, you will need to wait the Glue job finished and get some result out of there. Therefore, you need to wrap the previous state with a few more ones.
The main purpose is to merely start the Glue job. Apart from that, we need Glue job RunJobId.
I don't know if it can be retrieved from Glue job itself, so I've created a Lambda to run the Glue job using boto3 start_job_run function and then get RunJobId from the response.
Create a Lambda which will be grabbing the status (JobRunState) of the Glue job (via boto3 get_job_run function) by RunJobId from the previous step.
Using Wait Step Functions state type, run the Lambda you created every N seconds.
Use Choice state type to filter Glue job statuses out.
If RUNNING, go back to the Wait step.
If SUCCEEDEED, then go ahead to the next state.
If [FAILED | STOPPED], go wherever else.
Finally, it looks something like this.
| b252afe5ed7d34e6d38e2944a0f93302c53d8b61d768ae1b5f30576af5ce8869 | ['7ec17872a0904de7bd2b1f91c9aef176'] | I don't know exactly what it is needed for, but my Glue connection to RDS started working only when I had created S3 endpoint.
VPC → Endpoints
Create S3 endpoint
Service category: AWS services
Service name: com.amazonaws.eu-central-1.s3
VPC: choose one that your RDS is associated with
Route tables: choose one that contain subnets for VPC
|
8d2da6411b75eb99e3ad68db86f2351d9b2d2972ff47819ce3d0e9e5a26b8998 | ['7ed7611b1e3f4ddc9b979ea61dfbc09e'] | It's not possible. Basically each @Test runs only once. If you need to do something after each test class you have to use @AfterClass annotation on method in your MainTest. You can do some hacks with method order etc. in MethodInterceptor (http://testng.org/doc/documentation-main.html#methodinterceptors) but it's not good idea for this case.
| 6b7e1c0a9452626b940bf47006ca88312ebd0f5cdd9201284933f7ffcfc4bae1 | ['7ed7611b1e3f4ddc9b979ea61dfbc09e'] | you can use project properties to add/change/... different suites. In you example you are probably running
gradlew test
which run both suites. If you modify test task in your build.gradle
def suite1 = project.hasProperty("suite1")
def suite2 = project.hasProperty("suite2")
test {
useTestNG() {
dependsOn cleanTest
useDefaultListeners = true
if(suite1) {
suites "src/test/resources/simpleSuite.xml"
}
if(suite2) {
suites "src/test/resources/advancedSuite.xml"
}
}
}
you can choose suite in this way
gradlew test -Psuite1
gradlew test -Psuite2
gradlew test -Psuite1 -Psuite2
|
2b0fea0ed618ed09b96badeedb857b0a1f882a4818b004a10bfef4a71353e9b5 | ['7eee958159654b0b88e2c97882a9f85f'] | I'm confused about how to do big-O analysis for the following problem -
find an element from an array of integers. ( an example problem)
my solution
sort the array using bubble sort ( n^2 )
binary search on the array for a given element (logn)
now the big-O for this is n^2 or n^2 + logn ? Should we only consider the higher term ?
| e176379f88de223fc46c81ff87ef8de140f74d4cb4140555638734e3b083d718 | ['7eee958159654b0b88e2c97882a9f85f'] | I have an powershell session created by
New-PSSession -ComputerName localhost
I'm able to access the above session by
PS C:\> Get-PSSession
Id Name ComputerName State ConfigurationName Availability
-- ---- ------------ ----- ----------------- ------------
1 Session1 localhost Opened Microsoft.PowerShell Available
PS C:\> Enter-PSSession -Id 1
Now if I open another powershell window, then can I access the session created above ?
I did try but "Enter-PSSession -Id 1" did't work for me. Is this possible at all ?
|
f566ea36ff817cc0650a9ca9b5779b56bf6db1be90a51f43a328387be398b31b | ['7ef2fbd67a6e43dc98a638f6bb7ee587'] | i have 2 sonos speaker. I have done an application on dialogflow where i can say "play muse" to listen my mp3 on them. The sentence is send to a php webserver (with a webhook) and the sound is send to the sonos with the api. But, the only solution i have found to identify the source, is to add:
"play muse on the kitchen", or "play muse on the bedroom".
I dont know how to identify the source where the request comes from, and to deliver the sound on the correct speaker.
Have you an idea ?
| 266e81e8f0b983ce7080f4761de243501af2598f4b50fe74e123a16f1dcc6171 | ['7ef2fbd67a6e43dc98a638f6bb7ee587'] | i have a site with url like ref.php?id=2 already indexed by Google.
I know how add keywords in my url with these rule:
RewriteCond %{QUERY_STRING} ^id=2$
RewriteRule ^ref.php$ http://www.website.fr/boat? [R=301,L]
But, i don't know how redirect the old url to the new.
If i do this
RewriteRule ^boat$ /ref.php?id=2 [L]
I have an error.
The only solution i found is to duplicate ref.php into ref2.php
and adding this rule
RewriteRule ^boat$ /ref2.php?id=2 [L]
Maybe a better solution exist. So have you an idea ?
THanks
|
62967a30a369a2cbc04cb0f85cba963c7d451de4d04ab9eaad6e76a9172ebad8 | ['7ef4bf2fae5a4ec6934261034d7d2927'] | I have two d3 charts in separate divs on a single page. After clicking on bar, the line chart should update accordingly for e.g. the click action on specific bar, should add an appropriate line to a line chart in another div. I am able to create a click action on bar. How can I use this action from bar chart to update a line chart accordingly. Here is my plunker code.
bar_svg.selectAll("#bar_chart")
.data(TOP_TEN_CHANNELS)
.enter().append("rect")
.on("click", function (d){
console.log("inside_bar_fucntion "+ d.channel);
})
| b0bf3b3dfc8579a2cd5d3de88e2b8c08f71e1bcae25ef1699403a37222e4a34b | ['7ef4bf2fae5a4ec6934261034d7d2927'] | I am trying create a bar chart for top 10 among n number of entities. What I am trying to achieve is to give unique color to each bar. I am able to get the expected results when number of entities is 10 or less. This is what I am getting.
I want to use colors from d3.schemeCategory10 only. Here is my plunker code.
bar_svg.selectAll("#bar_chart")
.data(TOP_TEN_CHANNELS)
.enter().append("rect")
.attr("rx", 2) // set the x corner curve radius
.attr("ry", 2)
.attr("class", "bar")
.style("fill", function(d,i){ return color(d.channel);})
.attr("x", 35)
.transition()
.ease(d3.easePoly) // apply a transition
.duration(500)
.attr("height", y.bandwidth()-5)
.attr("y", function(d) { return y(d.channel); })
.attr("width", function(d) { return x(d.views); });
|
75f36dd0c4e769562102b96905b5af36b545e28e8cb56d945b4840ff193911e6 | ['7ef6d8b3961c43cc969cb31db0cdbaaf'] | I am working in TabPy inside Tableau and want to perform normal statistical calculations.
I am stuck with Cp calculation. Here is the code that I wrote -
SCRIPT_REAL("
import pandas as pd
import numpy as np
from scipy import stats
# Calculate Cp
def Cp(list,_arg2,_arg3):
arr = np.array(list)
arr = arr.ravel()
sigma = np.std(arr)
Cp = float(_arg2 - _arg3) / (6*sigma)
return Cp
",FLOAT([USL - Param]), FLOAT([LSL - Param]))
The error that I am getting is -
No Return Value
although I am clearly returning Cp. What could be the issue?
Please help.
| 4fc7103eab2c67f0c3d99daeb7bb7c4153065b4955c052cda897140edf547d2e | ['7ef6d8b3961c43cc969cb31db0cdbaaf'] | Here is the code that I have written -
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<style>
div.bar{
display: inline-block;
width: 20px;
height: 75px;
background-color: blue;
margin-right: 5px;
}
</style>
<head>
<title> Simplebar - Out Dataset </title>
<script src="https://d3js.org/d3.v4.js"></script>
</head>
<body>
<script type="text/javascript">
d3.csv("officedata.csv", function(data){
console.log(data);
d3.select("body")
.selectAll("div")
.data(data)
.enter()
.append("div")
.attr("class", "bar")
.style("height", function(d){
var bheight = d.age*5; //scales the bar height 10 times
return bheight + "px";
})
.style("color", function(d){
if( d.age > 30) { return "red"; }
else { return "blue"; })
});
</script>
</body>
</html>
and here is the csv file -
name,age
pragyan,23
rashmi,26
tumon,40
debajit,50
dhiraj,19
I want to give condition that the color should be red if the age is above 30. I have tried the color part in a separate code and it was working but when I tried it in here, it is not working. Removing the color part, the height is working just fine.
How can I add two style properties? Please help.
|
be58d6bf37f5f49ca2f81d3ee5bc4ffe6ced93a45c568bee7167a41bafa81f06 | ['7f0d93134d6c407aa0a2a7969cc183ef'] | amixer worked for me but I didn't get the nice animation that I get when I press the volume up button on my keyboard.
I decided to use xte to directly press that key from the command line:
Volume up:
xte 'key 0x1008ff13'
Volume down:
xte 'key 0x1008ff11'
Mute:
xte 'key 0x1008ff12'
I figured out the keysym (that hex number) by using xev.
sudo apt-get install xbindkeys xautomation
xev
and then press the volume up button on your keyboard to get the keysym. The key sym may vary from system to system so finding it from xev will be the most reliable way.
The result looks like this for me:
KeyRelease event, serial 37, synthetic NO, window 0x2c00001,
root 0xef, subw 0x0, time 6660080, (566,573), root:(664,651),
state 0x0, keycode 123 (keysym 0x1008ff13, XF86AudioRaiseVolume), same_screen YES,
XLookupString gives 0 bytes:
XFilterEvent returns: False
| 1db7e8c86819a33d910cae89151e31a97610207a487bb52de65434cc80265cda | ['7f0d93134d6c407aa0a2a7969cc183ef'] | I have some problems on sticky sessions with HAproxy.
Haproxy counts every request as a new session.
I have a Java servlet that creates the cookie JSESSIONID.
If I refresh that page 5 times. The servlet count it as 1 session and 5 request from that sessionid.
But the HAproxy stats page shows it as 5 different sessions.
And 0 current sessions.
Haproxy prefixes the cookie correct, cookie: "JSESSIONID=test1~3fjp6734ys78grhk50ler16r" and is persistent.
I hit the same server every time.
This is my config file:
global
daemon
maxconn 256
defaults
mode http
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
frontend http-in
bind *:3333
acl Testrule path -m beg /test
use_backend Test if Testrule
backend Test
option httpchk GET /test
cookie JSESSIONID prefix
appsession JSESSIONID len 52 timeout 20m prefix
server test2 vm-stapp-146:9003 check cookie test2
server test1 vm-stapp-145:9003 check cookie test1
listen stats *:3334
mode http
stats enable
stats uri /proxy-stats
stats admin if TRUE
Why do the stats page show every request as a new session? And it always shows 0 current sessions.
Thanks.
|
d534a249d55a50dc437d6bb75740b4e0523762b943cbdece6f937a43eef69cb6 | ['7f2b319932e3435ba4c05849fa08b38c'] | I have the following code in the setup procedure in netlogo
set-default-shape Mappers "target"
create-mappers MappersCounterSlider
[
set color red
set size 1.5 ;; easier to see
set label-color blue - 2
set xcor 10
set ycor random 11
]
I need to change the random 11 to a specific value for each turtle I create, for example if I have 5 turtles I want to have 5 turtles in diffrent 5 fixed positions.
| 200fe2f44b81b5b8b542e4b0d68e6300c6dd66ee0413a2f1ce1eacd69e49959b | ['7f2b319932e3435ba4c05849fa08b38c'] | I'm trying to restore a BAK file automatically from a C# application
this is my code
ServerConnection conn = new ServerConnection();
conn.ConnectionString = ConnString;
Server myServer = new Server(conn);
myServer.ConnectionContext.StatementTimeout = 0;
return myServer;
I'm getting the following error
"
sql server version (11.0) is not supported" noting that the BAK file comes from SQLServer 2012 and I have SQLServer 2012 on the machine
|
125b25b970fac1b12d17a1faad1e243a5add1276c776e72bca117754dfdc0180 | ['7f2e6477f76e4e2589923c0d3bbc9db2'] | There are a bunch of OpenID Connect providers you can use to test your client: you can sign up for a free Auth0 or Okta developer sandbox, download and run IdentityServer locally, or try the OAuth2 Playground.
As for writing the client. Please don't write your own. There are a list of libraries from the OpenId Foundation. I've used pyoidc for a non Django application, you could hook that in to your app, or use one of the Django specific OpenID Connect libraries.
| d82c780f3171d53223bb6e12735eee235939b15ea99f2a4d12efb3202b4a0703 | ['7f2e6477f76e4e2589923c0d3bbc9db2'] | You can do everything you need by:
Building an AMI. I would build an AMI with all of the packages pre-installed. You can even do this by creating an EC2 instance by hand, then creating an AMI from it.
Using CloudFormation EC2 helper scripts. I would use EC2 init scripts to run all of the per instance scripting on an instance configured with the AMI created in (1).
You can even use CloudFormation custom resources to copy objects to S3.
|
9ca1ac86e352b0bea8e612d7c18e376dc7adf02eb3dd5bd9adffcda5ca46df3e | ['7f35ff4749334b7785130c2468e67450'] | One can use qPython to load the data to the Python process and then KFold from sklearn to repeatedly split the data set into training and test part.
Suppose we have the following table defined on the KDB+ side:
t:([] time:.z.t+til 30;ask:100.0+30?1.0;bid:98+30?1.0)
Then on the Python side you can do the following to produce indices of the train/test splits:
from qpython import qconnection
import pandas as pd
from sklearn.model_selection import KFold
with qconnection.QConnection(host = 'localhost', port = 5001, pandas = True) as q:
X = q.sync('t')
kf = KFold(n_splits=4)
for train_index, test_index in kf.split(X):
print("TRAIN:", train_index, "TEST:", test_index)
See the KFold documentation for other variants of KFold.
| c47584a61a145658814c016cc246ee5ff4c44c7dd43f9b2c73915c2ea2e66577 | ['7f35ff4749334b7785130c2468e67450'] | To save a dataframe in KDB+ with qPython one can use the sync method of the QConnection class. Set the first parameter to a string defining a q function that assigns its parameter to a global variable and send the dataframe as the second parameter. Something like this:
from qpython import qconnection
import pandas as pd
df = pd.DataFrame({'sym':['abc','def','ghi'],'price':[10.1,10.2,10.3]})
with qconnection.QConnection(host = 'localhost', port = 5001, pandas = True) as q:
q.sync('{t<IP_ADDRESS>x}',df)
Note that you need to use a double colon <IP_ADDRESS> in the function definition so that the parameter is assigned to a global variable t rather that a local variable.
|
0e6999439537c34a9db4104f85f73f2cee1873296b5300f9cd8e022bce05ed78 | ['7f374e92576d4622a78683ec6e59f5eb'] | I have changed my code and written this. It is now reading document.getElementById('foo'). I want to move my div element every 20msec for that I have used setTimeout() but it doesn't do anything.
<body>
<div id="foo" style="width:10px;">a</div>
<script language="javascript">
function doMove() {
var foo=document.getElementById('foo');
foo.style.left = parseInt(foo.style.left)+10+'px'; // pseudo-property code: Move right by 10px
setTimeout(doMove,20); // call doMove() in 20 msec
}
doMove();
</script>
</body>
</html>
| 1106a9137a792c3fcd2d851f797d6837399cb88e8768f703a457f200770b3c66 | ['7f374e92576d4622a78683ec6e59f5eb'] | You can try this:
step 1: Keep the three pop ups with different ids in your html with style = "display:none;position:absolute;top:50%;left:50%;". and a classname popup.
e.g.
<div class="popup" id="1" style = "display:none;position:absolute;top:50%;left:50%;"></div>
step 2: Give classname (respective ids of hidden divs) to your divs on which user will hover and a parent attribute to your divs.
e.g.
<div class="showdiv" parent="1"></div>
step 3: now write following code:
$(document).ready(function() {
$('.showdiv').mouseover(function() {
$(".popup").hide();
$("'#"+$(this).attr('parent')+"'").show();
});
});
try prop if attr doen't work.
|
459120aadf993267957bf9e7ae40f8341525ad4c250c96cd12119dfb14fcabdb | ['7f39d79540054c8dabcef97a9ac65796'] | So after lots of investigation I finally figured out what the problem was. It was all down to redirecting from http to https. From articles I found on the web (can't remember the urls anymore), is that the libraries that the wsdl2java and wsimport stub generators use to do the webservice communication don't allow a http to https redirect follow due to security reasons.
So even though I was generating the stubs from a https wsdl location ie. https://wsdl.location.com?wsdl, when I ran the code to do a webservice call, it was trying to make the call to http://wsdl.location.com which resulted in a redirect request to https://wsdl.location.com, But the http library does not allow that. So it just forwards the 302 http code up as an exception.
Also, there are two web-service urls. One is a testing service which is normal http url and then there is a production server which is over https. So to work around this is all I did is configure the service on the fly to use the end-point I have specified (which is now the https address) by using the BindingProvider class. This also allows me to specify on the fly depending on which environment that is making to call, to use the test url or the production one ie.
NotificationWebService service = new NotificationWebService();
NotificationWebServiceSoap serviceSoap = service.getNotificationWebServiceSoap();
BindingProvider bindingProvider = (BindingProvider) serviceSoap;
bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "https://wsdl.location.com");
String xmlString = serviceSoap.getRSAPublicKeyXMLString();
So in short, if anyone encounters this problem. Make sure if the end point you need point to is on https, that you are making a direct https call and not a http call that will ask for an https redirect. You can check this by examining the serviceSoap while debugging. It will say to which url it is making the call.
I didn't look into or go with the option to configure wsdl2java and wsimport to generate the stubs and force the stubs to use the https call so that I could configure multiple url end-points for different environments.
| d4510fab9817e4d3526ce1832bd5fb0d7045c10dd4a22207b42866ad65e9b940 | ['7f39d79540054c8dabcef97a9ac65796'] | I found that the solution was to force the sure-fire plugin to use JUnit. I did this by overriding surefire plugin in the specific project as follows. The dependency forces surefire to use JUnit.
<build>
<plugins>
<!-- force sure fire to use junit instead of testng -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.10</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
|
b05eac852737ea1199555089f3f5416d2c70815863df136a29d559cb222eb12b | ['7f3f38f776b742e7897cd7dc4637fb93'] | I'am trying to send two select paramaters to a function from outside. What i am trying to achieve is simplified at below
I have a model like this,
public class Entity
{
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
}
SampleData:
3 / <PERSON> / <PERSON>
4 / <PERSON> / Putin
and an another model
public class IdTextModel
{
public string Id { get; set; }
public string Text { get; set; }
}
and I'm trying to create a function like this
public List<IdNameModel> GetList(propselectorA, propselectorB){
return data.Select(x => new IdTextModel(){
Id = propselectorA,
Text = propselectorB
});
}
Usage:
var list = GetList(x => x.Id, x => x.Surname);
ExpectedResult:
3 / <PERSON>
4 / <PERSON>
How can i accomplish that? Thank you.
| 1181ba802f14ad7709c41bae47dfa8c762724bddbc2184384fbb4fbc61095617 | ['7f3f38f776b742e7897cd7dc4637fb93'] | I am trying to increase maxReceivedMessageSize for my wcf odata service. I have an another web service which is posting values to my wcf service to insert values to sql. I am posting
{
A:1,
B:1,
C:3,
D:4,
}
this raised an error. The remote server returned an error: (400) Bad Request. If i post the value below, it inserted successfully.
{
A:1
}
so can somebody please help me how to fix this error please? There are examples on the web which are trying to modify web config like below but they dont suits me because i dont have a service contract.
<system.serviceModel>
<bindings>
<basicHttpBinding>
<!-- Create a custom binding for our service to enable sending large amount of data -->
<binding name="MyBasicHttpBinding"
maxBufferPoolSize="<PHONE_NUMBER>"
maxReceivedMessageSize="<PHONE_NUMBER>"
maxBufferSize="<PHONE_NUMBER>">
<readerQuotas
maxArrayLength="<PHONE_NUMBER>"
maxBytesPerRead="<PHONE_NUMBER>"
maxDepth="<PHONE_NUMBER>"
maxNameTableCharCount="<PHONE_NUMBER>"
maxStringContentLength="<PHONE_NUMBER>" />
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<!-- Enable the serializer to serialize greater number of records -->
<behavior name="WCFServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
<dataContractSerializer maxItemsInObjectGraph="<PHONE_NUMBER>"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<!-- Bind the WCF service to our custom binding -->
<service behaviorConfiguration="WCFServiceBehavior"
name="WcfDataService">
<endpoint address="" binding="basicHttpBinding"
bindingConfiguration="MyBasicHttpBinding"
contract=" `WHICH I DONT HAVE, OR I HAVE IT BUT I AM NOOB` "/>
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
My WCF working with ADO.net Entity Model
public class WcfDataService : DataService< DataModel.DataModelEntities >
{
// This method is called only once to initialize service-wide policies.
public static void InitializeService(DataServiceConfiguration config)
{
// TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
// Examples:
config.SetEntitySetAccessRule("*", EntitySetRights.All);
// config.SetServiceOperationAccessRule("MyServiceOperation", ServiceOperationRights.All);
config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;
}
}
|
09702abe70bab752271dd99960ccdeb4e47cb5197f1a3d4e6463e0d7ca192136 | ['7f412f718f9b43f1aaa7542c9027b5b6'] | So I came across this bizarre behavior — when I try to setState using objects, it only fails in SOME cases.
For example this works,
getUserClaimAmount().then(
userClaimAmount => {
this.setState({ userClaimAmount: userClaimAmount.toString()})
}
);
But the following does not. It will throw an error saying that React children are not allowed to be objects.
getUserClaimAmount().then(
userClaimAmount => {
this.setState({ userClaimAmount: userClaimAmount})
}
);
However, the following works for some reason. "bettingPoolTotal" is the same type as "userClaimAmount" above.
getBettingPoolTotal().then(
bettingPoolTotal => {
this.setState({ total: bettingPoolTotal });
}
);
Below is a screenshot of what the state looks like. It's clear that there's obviously React children that are indeed objects.
Example of React state
| cab23aed700451c61563c5856b05707575e2b69fe7bb7c21568125a23f4158d2 | ['7f412f718f9b43f1aaa7542c9027b5b6'] | I have the following two endpoints on my express server:
api.get(
"/register",
asyncMiddleware( async (req, res) => {
res.cookie("TEST", "value", {});
res.sendStatus(200);
})
);
api.get(
"/home",
asyncMiddleware( async (req, res) => {
console.log(req.cookies);
res.sendStatus(200);
})
)
I'm hosting the above endpoints at localhost:3010. I'm also running a front-end server that's hosted on localhost:3000. When I call the /register endpoint from the front-end, and then call the /home endpoint, the console.log(req.cookies) comes back with an empty object. However, calling the /register endpoint from localhost:3010 will set the cookie as intended, and the console log will show the correct value.
Are there any special steps I need to take to get cookies working across domains in Express? I've looked around the documentation and couldn't follow anything relevant.
|
962e6c33fe10dcf4289551bb1f929e8c87d401002357f4076343e7d05c21a025 | ['7f5208648a71474fabab5ffcadaddd1b'] | The loopback documentation states that the AngularJS "SDK creates a Category.products() method that can be used to list all products in a given category."
$scope.products = Category.products({
id: $scope.category.id,
});
This works fine but, how do I return a list of all categories with all related products. I have been through the documentation and the source core (lb-services.js) and can't see how to do this.
Any ideas?
| 69770d881a3b464f6b04de85a7af0eae35afd368e855d0fc5465c42a008f6db8 | ['7f5208648a71474fabab5ffcadaddd1b'] | Worked it out.
You need to create a remote method in the parent model (ensure you've set up the relationships between the models).
Supplier.supplierServices = function (cb) {
var response;
Supplier.find({include: 'Services'}, function (err, suppliers) {
console.log('err', err, 'suppliers', suppliers);
response = suppliers;
cb(null, response);
});
};
Then run lb-ng to expose the api to the angular SDK. You can then call the remote method from the client.
|
44b692c6e7465cdb92c54f07caeb6b01791d0aff27582646b2778267bf7167b0 | ['7f6d16338e63496c8ab2dd52a13f6a34'] | I created my first simple C# app in VS 2010. Nothing but an application that runs a form and uses several references. I want to put this on other machines. What is needed to run this application besides the exe. I am targeting .NET 4.0 and I know 4.0 is installed on the machines. I tried to put it on a machine but all it does is nothing. Is there some kind of runtime I need to install besides the .NET framework. What is required to run this Winform app. Thanks
| 8f12e0fe3250c36e17727a755690771e12229e3929d77d38251170e7dfcdc3fc | ['7f6d16338e63496c8ab2dd52a13f6a34'] | You are calling accept changes on the table but be advised you can call acceptchanges on every individual row thus only effecting that row.
dsDataset.Tables["OrderSummary"].Rows[currentrow].acceptchanges();
It really depends on what you are trying to do. You can update all at the end on the table or individually on each row.
Also keep in mind that calling table acceptchanges it will change the datarowstate to unchanged. Thus if you are trying to update a database (SQL,Access, ect...) then that could interfere with the database updates.
It appears from your example that you are only using this table for a report therefore not sure why you would need to update the datarowstate at all. Not sure the report cares. As far as I know the acceptchanges/datarowstate only concerns updating the backend.
|
cbe8587335007c036901bbaab4e00e3f89e686725a14af799d56ef2ca5c21b4f | ['7f75cf6e6ef943889e07d4d18c588307'] | Trying to extract zonal information within a shapefile layer that contains district regions, for a monthly time series of raster data stored in a netcdf.
I've so far only been able to extract the average across all time periods for each shapefile (see below). But really I want the monthly average within each region.
The ultimate aim is to have this in a pandas geodataframe which I can then merge with some attribute data for each region. I'm not very used to working with netcdfs so any suggestions would be helpful! The time dimension within the netcdf is 'yyyy-mm-dd' format.
#import netcdf data
with rio.open('/MSLA_all_test.nc') as msla_nc:
msla_nc_data = msla_nc.read(1,masked=True)
msla_nc_meta = msla_nc.profile
#import polygons
region_polys = gpd.read_file('/GADM2_coast_regions.shp')
#Extract pixel values for each polygon : zonal stats
region_value=rs.zonal_stats(region_polys, msla_nc_data, nodata=-999, affine=msla_nc_meta['transform'], geojson_out=True, copy_properties=True, stats="mean")
| e15f80a0f4c4e14f24e88bc5d0bb1cffe824a3bc6df9c1ebd67d13fcf2544e15 | ['7f75cf6e6ef943889e07d4d18c588307'] | Looking to group my fields based on date, and get a mean of all the columns except a binary column which I want to sum in order to get a count.
I know I can do this by:
newdf=df.groupby('date').agg({'var_a': 'mean', 'var_b': 'mean', 'var_c': 'mean', 'binary_var':'sum'})
But there is about 50 columns (other than the binary) that I want to mean, and I feel there must be a simple, quicker way of doing this instead of writing each 'column title' :'mean' for all of them. I've tried to make a list of column names but when I put this in the agg function, it says a list is an unhashable type.
Thanks!
|
d323e0dea843d655565633cb117a944ccb83726b0b1d8dffbd382db413735faa | ['7f9544370ff84fcc86211618456f743b'] | I'm facing a situation which I spent the whole day trying to get this working but unfortunately I'm running out of ideas and I thought you gyus might help me out.
I have two streams, one audio stream for the customer (micMyStream1) and one video and audio stream for the seller (MyStream1). The idea behind this is pretty simple. The user speaks to his microphone and this audio is conveyed to the seller and then the seller answers the user's question but using a video and audio stream.
So far so good, it works pretty fine right now but someone came up with the idea of "merging" the audio from the user's stream with the audio and video from the seller in order to make a third person to watch the whole conversation between them
Unfortunately when I audio merge one audio stream ( probably the user's one) the conversation goes a little bit awkward like below:
Expected Scenario:
User: Hi, How are you ?
Seller: I'm good thanks, How can I help you ?
User: I'd like to know a little more about the product next to you
Seller: Sure, Which information would you like to know?
User: How much does it cost?
Seller: It's 100 bucks
Actual Scenario:
User: Hi, How are you ?
User: I'd like to know a little more about the product next to you
Seller: I'm good thanks, How can I help you ?
User: How much does it cost?
Seller: Sure, Which information would you like to know?
<PERSON>: It's 100 bucks
It seems like one stream comes much faster than another so when I merge the audio the conversation makes no sense for the spectator. I tried to use in some many ways the itsoffset parameters but with no success
Do you guys got any idea of how can I get that working ? I mean, is there anything I can do to postpone the fast stream to make the conversation closer to the expected?
This is the last ffmpeg commando I'm using.
ffmpeg -itsoffset 00:00:07 -i rtmp://<ip>:1935/live/micMyStream1 -i rtmp://<ip>:1935/live/MyStream1 -filter_complex [0:a][1:a]amerge -codec:a aac -ac 2 -strict -2 -f flv rtmp://<ip>:1935/live/bcMyStream1
Thanks in advance
| 6db487b26e937346f5f79a7f3ab3f7aff6ae1c74d6ec3a4b3f80bc5790523e12 | ['7f9544370ff84fcc86211618456f743b'] | I have read the "Getting Started" introduction on Docker's website, but I still have one question I could not find an answer to:
Is it possible to set up a Docker container which can create other containers (real-time) ? For instance, can I create a container called "ContainerDeployer" which can
1. Download existing containers from Docker's official, public Docker Hub repository and deploy them?
2. Create a new image based on user input and then run a container from the newly created image?
Thanks in advance.
|
4c928f3269a3260ed4d0d1dc4701cd3bb56917e4e6bff2dead881a3db6d2ff69 | ['7fa3de7c04d64befbc04f80185737a3c'] | I need to redirect some output that would normally be printed to screen into a file.
I have been able to redirect output to the file but I can't seem to figure out how to direct the output of the rest of my program back to the terminal window.
All code is in C. The program is running on Ubuntu.
Any insight as to what needs to be done?
| 2a41b65f0af3e429274c06060dfdab80670a7dc10f4b35178001d804550ee7f8 | ['7fa3de7c04d64befbc04f80185737a3c'] | I have two forms, Form A and Form B. My Properties.Settings.Default has a timer object that when "ticked" needs to open Form B. What I would like to do is program the timer_tick(object sender, Eventargs e) event for the timer object that is in the solution's properties.
Is this possible? If so how?
The issue I am having is I don't know the syntax to program events for properties.
Any help/alternate ways would be much appreciated.
P.S. What I am essentially trying to do is trigger a screen saver (Form B) after x seconds but when Form B is clicked it needs to re-enable the timer and close itself.
|
72de3a49bbcf792078a6516249d93a22076fcad5d36aa2b824901a5987a923e8 | ['7fbd0e2d55ad400d8fc4bb07c8707e10'] | My friends and I want to build an app iOS and Android that makes REST API calls to Django, and Im in charge of setting up the backend server. I've heard a lot of things like about nginx and stuff, but I can't find anywhere how to start things off and make a useable server and such.
Ive heard good things about Digital Ocean, but I dont know where to start off.
Thanks for your help!
| 4a5df01887d62638aad074bb19c5023baa7512030b9504ef42cfeccc01c3faf1 | ['7fbd0e2d55ad400d8fc4bb07c8707e10'] | I am trying to pass in parameters into my REST API get request, like this:
parameters = {'key':value}
response = requests.get('some url', params= parameters)
but the API that I am using uses a url-path instead of a query argument. I want it like:
/api/resource/parametervalue
and it comes out like:
/api/resource?parameter=value
I've searched all over the web to find if I can somehow change what response.get takes in, but I can't seem to find it. What should I do?
Thank you!
|
193b90b826e3d3484727113ee9f127c619c821b9dc3e4a4d578a958ef8006d8c | ['7fe47493c6834b3da4436a7cc144b726'] | I currently have:
var content = document.querySelectorAll(".content");
var myButtons = document.querySelectorAll(".more-button");
function enableContent(evt){
// remove class d-none so it can appear
content[evt.currentTarget.param].className = content[evt.currentTarget.param].className.replace(/\bd-none\b/g, "");
}
for(var i=0; i<myButtons.length; i++){
myButtons[i].addEventListener("click", enableContent);
myButtons[i].param = i;
}
Each myButton has it's own content. I'm trying to make content appear slowly when myButton is clicked like so:
for(var i=0; i<myButtons.length; i++){
myButtons[i].addEventListener("click", function(){setTimeout(enableContent, 2000, evt)}));
myButtons[i].param = i;
}
But it doesn't work, there is a problem with the parameter evt. How do I pass in evt to setTimeout?
| 1855e3cb8f977a5dc9895dd0b9cd3306297a6db7a643b9570e0bfc8115dc9c29 | ['7fe47493c6834b3da4436a7cc144b726'] | In frontend script I have:
function loadContent(){
var count = 0;
var xhr = new XMLHttpRequest();
xhr.open("GET", "/getMore", true);
xhr.onload = function(){
if(this.status == 200){
data = JSON.parse(this.responseText);
}
xhr.send();
}
I'm trying to pass variable 'count' to the backend in my node js like this:
router.get("/getMore", async function(req, res){
count = req.params.count;
});
I can't seem to get past that. How do I do it? Thanks!
|
eb35abe839388d5a1942d9f59d7f2726533edadf33fe0358211c153b84dd1761 | ['7fe866add61b43eb9e6bf48b60c9ffef'] | I would like to set the default file association for a file type (PDF) to an Apple Script app. The Apple Script app will open the file type on a remote machine (using remote Apple events) with a specific app (Preview.app). Not that it matters but, the remote machine is a virtual machine on the local machine. I think the script should look something like this:
set remoteMachine to "eppc://elcapitan.local"
tell application "finder" of machine remoteMachine
open ("/Applications/Preview.app" as POSIX file as alias)
end tell
set pathToLocalOnRemote to "/Volumes/cajal"
repeat with fn in argv
tell application "Preview" of machine remoteMachine
open pathToLocalOnRemote & fn
end tell
end repeat
What is not clear to me is, what actually happens when a file type (PDF) is opened in the Finder? The default file association will specify which app to use. Inside the app, is there just a binary that is called which gets a list of file names as its argument? If so, is this binary just like some command line binary? In sum, can I trust Finder will execute my script by something analogous to a command line call with a list of files as the argument? Also, will the file name list be given as the (full) absolute path?
| bf57400dbefb44c5d96169e8aa1d1993b9cc5c60079514d7a4dfa272e10baaa8 | ['7fe866add61b43eb9e6bf48b60c9ffef'] | I have a simple automator app that runs a simple script. It uses ssh to open a file on the local machine, MachineA, with an app on the remote machine, MachineB, and logs the ssh call.
on run {input, parameters}
repeat with fn in input
set fn to POSIX path of fn
set fn to "/Volumes/MachineA" & fn
set fn to "\"/usr/bin/open -a /Applications/Preview.app " & fn & "\""
set cmd to "ssh -x MachineB.local " & quoted form of fn
do shell script "echo " & cmd & " >> ~/cmd.log"
do shell script cmd
end repeat
end run
The log output is:
ssh -x MachineB.local "/usr/bin/open -a /Applications/Preview.app /Volumes/MachineA/Users/<USER>/Documents/<FOLDER>/<FILE>.pdf"
When I use the app to open a file (drag & drop), an error is thrown.
However, if I copy the output in the log file to the command line, success, the file is opened on the remote machine. Why the difference?
|
61e57c95376472ba77bbc48e30f01e6bf1a3cd28a760c45f69d58347ff5d2d0b | ['7ff858d1392c4db4842ea4f26ceb0c25'] | I can't seem to be able to get $\Gamma_{ij}^k$ to vanish at $p$ without it vanishing everywhere else. You have $\sum_{ij} a^ia^j\Gamma_{ij}^k(q)=0$ for all $q$ and all $k$, and this should yield $\Gamma_{ij}^k(q)=0$, shouldn't it? What am I doing wrong? | 668d32c8c2cd20a9955d6e5981cb3ad043ca384c1db2795ea8d9b4fb8faa67b4 | ['7ff858d1392c4db4842ea4f26ceb0c25'] | The correct assumption to begin a proof of the contrapositive would be that $S$ is non-closed, not that $S$ is open (I think you’ve mixed up $S$ and $V$).
I also think you are doing yourself a disservice by proving the contrapositive. Closedness is more or less contained in the very definition of completeness. |
f43bb36e8c90a7ff6457ede9b128a4ad1acfe6b2ffab768292a44a84bcc7d298 | ['7ff8ff9c36bf4dc287a59baba0146a9a'] | I tried deciphering your question, and I think you want something like this:
function item_attributes_data($id){
// first get your attributes
$query=$this->db->query("SELECT id, attributes.attribute_text FROM attributes");
$attributes = $query->result();
$finalResult = array();
// then get the items for each attribute
foreach($attributes as $attribute) {
// fetch the items
$itemsQuery = $this->db->query("SELECT attr_value, cost FROM item_attributes WHERE attr_id=" . $attribute['id']);
$items = $itemsQuery->result();
$finalResult[] = array( "attribute_text" => $attribute["attribute_text"], "choices" => $items );
}
return $finalResult;
}
| ac8baba1c38f716af80f42246eee9eaa4eb65496a6a9113373ed1e3cc88e3974 | ['7ff8ff9c36bf4dc287a59baba0146a9a'] | You could create a function like this:
const then = f => p => p.then(f)
And then your pipe would look like:
const AuthService = () => ({
async signIn(credentials: Credentials): Promise<AuthSession> {
return R.pipe(
api.signIn,
then(signInResultToAuthSession),
then(saveAuthSession),
)(credentials)
}
})
You could even catch exceptions with:
const pCatch = f => p => p.catch(f)
R.pipe(
api.signIn,
pCatch(err => console.error(err)),
then(signInResultToAuthSession),
then(saveAuthSession),
)(credentials)
|
8ba5648ba5ee7ac1f0964b7a3b6e0185dbd7c25754d4ccd0e1ee15e97310e634 | ['7ffb59508b90418cb2a3c12054dd0f65'] | I have combined two questions into one. Apology for it. But since theyshare relavant topic,hence did so.
I have ASP.Net MVC Site. Now I have read number of times about adding expiry date for static content and enabling gZip compression for static content
But I am not sure how to do it. If you say adding a .httaccess file on the server. That I already did.But its not reflecting the impovement.
Here is .httacces file snippet.
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
ExpiresDefault "access plus 1 days"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
#Custom Fonts Add correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
# Add a far future Expires header for fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
</IfModule>
Is there anything wrong configuration with this file?
Second,How to enable gZip compression for the site as well?
| 57397aafc70102ff4ebc5e5cffaf3bf984f8de7c1adb9a2da24ae5449f6be0df | ['7ffb59508b90418cb2a3c12054dd0f65'] | I am bining website link to href. This value is coming from database. I am bining this value using angular.
Now problem is that suppose the value coming from db is www.google.com
But when it bind this value to the following element.
<a ng-href={{websiteUrl}} title="My Website"> Website Link </a>
The ng-href takes the current page url+the value from DB.
I am binding this value in ASP.Net MVC View.
|
3fd4c47252c0791dbdc838f604d37938986199dbbd157adc1f4a76c19b14d2cc | ['8004062e0cfa429fa4b677463eb45d75'] | I'm using the PiCloud REST API to run a background task from the Google Appengine (GAE). My PiCloud function returns a byte string to GAE as follows:
result = numpy.asarray(arr,numpy.float32).tostring()
return pickle.dumps(bz2.compress(result))
This works OK except that, when the string "result" is large (24MB is a typical value) the pickling blows the returned blob up in size to exceed the 32MB limit on GAE URLfetch responses, even with the bz2 compression. I've tried using json.dumps() but it doesn't work. Is there a way to return the blob that doesn't expand it?
| 70437eb0cddf9a766edb0d27e58b16a4b904a41502832d469f4d91fba1fcce37 | ['8004062e0cfa429fa4b677463eb45d75'] | Since upgrading from Ubuntu 14.04 to 16.04 I get the following error on the local development server:
ERROR 2016-06-19 14:03:10,294 wsgi.py:263]
Traceback (most recent call last):
File "/home/mort/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/mort/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/mort/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/mort/python/ms-image-analysis/src/index.py", line 5, in <module>
import imagemodels
File "/home/mort/python/ms-image-analysis/src/imagemodels.py", line 5, in <module>
import numpy.random as random
File "/home/mort/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 705, in load_module
module = self._find_and_load_module(fullname, fullname, [module_path])
File "/home/mort/google_appengine/google/appengine/tools/devappserver2/python/s andbox.py", line 446, in _find_and_load_module
return imp.load_module(fullname, source_file, path_name, description)
File "/usr/lib/python2.7/dist-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/usr/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/lib/python2.7/dist-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/lib/python2.7/dist-packages/numpy/core/__init__.py", line 22, in <module>
from . import _internal # for freeze programs
File "/usr/lib/python2.7/dist-packages/numpy/core/_internal.py", line 14, in <module>
import ctypes
File "/usr/lib/python2.7/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
File "/home/mort/google_appengine/google/appengine/tools/devappserver2/python/sandbox.py", line 963, in load_module
raise ImportError('No module named %s' % fullname)
ImportError: No module named _ctypes
It seems to be triggered by the numpy import. My local numpy version is 1:1.11.0. Should I be using the runtime-supported version 1.6.1 instead?
Thanks,
<PERSON>
|
fb79a3def6c772060a7b72b18b07bed1e951c8eb2019c6ecc2e81480bfb70904 | ['8008abe55063464b8fb3436e458d8ddf'] | What i am trying to do is, once my form is submitted, it will pass certain values from a form to PayPal.
This is my form code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form class="form-horizontal" action="<?php echo whichPPUrl(); ?>" method="post" id="paypal_form" target="_blank">
<div class="form-group">
<label class="control-label col-xs-4" for="text">URL:</label>
<div class="col-xs-8">
<input id="text" name="url" placeholder="site.com" type="text" class="form-control" required="required">
</div>
</div>
<div class="form-group">
<label class="control-label col-xs-4" for="checkbox"> </label>
<div class="col-xs-8">
<div class="checkbox">
<label class="checkbox">
<input type="checkbox" class="sum" name="metrics_1" value="1.00">
<strong>Moz</strong> - DA/PA/MozRank/Links In/Equity
</label>
</div>
<div class="checkbox">
<label class="checkbox">
<input type="checkbox" class="sum" name="metrics_2" value="1.00">
<strong>SEMRush</strong> - Rank/Keywords Number/Traffic/Costs/URL Links Number/Hostname Links Number/Domain Links Number
</label>
</div>
<div class="checkbox">
<label class="checkbox">
<input type="checkbox" class="sum" name="metrics_3" value="1.00">
<strong>Majestic</strong> - Rank/Keywords Number/Traffic/Costs/URL Links Number/Hostname Links Number/Domain Links Number
</label>
</div>
<div class="checkbox">
<label class="checkbox">
<input type="checkbox" class="sum" name="metrics_4" value="1.00">
<strong>Backlinks</strong> - Get any backlinks found for your domain plus anchor text (250 max.)
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="total" class="control-label col-xs-4">Cost ($):</label>
<div class="col-xs-8">
<input id="total" name="cost" type="text" class="form-control">
</div>
</div>
</div>
<div class="form-group">
<label for="total" class="control-label col-xs-4"> </label>
<div class="col-xs-8">
<input type="hidden" name="cmd" value="_xclick" />
<input type="hidden" name="business" value="<EMAIL_ADDRESS>">
<input type="hidden" name="item_name" value="Wraith Metrics">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="custom" value="getTheFormValues()">
<input type="hidden" name="amount" value="getAndPassTheCost()">
<input type="hidden" name="return" value="https://www.wraithseo.com/custom-metrics-builder.php?paid=1">
<input type="hidden" name="notify_url" value="https://www.wraithseo.com/gateway/ipn.php">
<input type="image" src="images/purchase.png" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</div>
</div>
</div>
</form>
<script>
// pass the total value over to the form: <input type="hidden" name="amount" value="getTheCost()">
function getAndPassTheCost() {
return $("#total").val();
}
</script>
<script>
// pass the form values over and deal with them on the backend: <input type="hidden" name="custom" value="getTheFormValues()">
function getTheFormValues() {
return $("form").serialize();
}
</script>
<script>
$(document).ready(function() {
// updates / adds the checkbox values
function updateSum() {
var total = "0.00";
$(".sum:checked").each(function(i, n) {
let sum = parseFloat(total) + parseFloat($(n).val());
total = sum.toFixed(2);
});
$("#total").val(total);
}
// run the update on every checkbox change and on startup
$("input.sum").change(updateSum);
updateSum();
});
</script>
I am not the greatest with Ajax, i have done a basic example of what i think is the right way to go:
This function:
<script>
// pass the total value over to the form: <input type="hidden" name="amount" value="getTheCost()">
function getAndPassTheCost() {
return $("#total").val();
}
</script>
Would get the value from the input text box and pass it through to the post form.
This function:
<script>
// pass the form values over and deal with them on the backend: <input type="hidden" name="custom" value="getTheFormValues()">
function getTheFormValues() {
return $("form").serialize();
}
</script>
Would just serialize all the form data which i can then validate and process on the backend.
Have i over complicated the process? my issue is i'm not able to pass this data to the form whcih is then sent via POST to a PayPal script, any help in the right direction would be appreciated.
| 36a504514c51b1dc2afc24edcc6c3e6ef0cc5dc46b77a18d66783e43041b6522 | ['8008abe55063464b8fb3436e458d8ddf'] | What i am trying to do is make my JSON object the same as an already developed one, these are the displays:
Original:
{
"name": "test product",
"descriptionUrl": "https:\/\/www.site.club\/",
"images": [
"https:\/\/thesite.com\/kf\/HTB1bGBljyAKL1JjSZFoq6ygCFXa7\/TY-Unicorn-Big-Eyes-Plush-Toys-Ty-Beanie-Boos-Kids-Lovely-Children-Gifts-Kawaii-Stuffed-Animals.jpg",
"https:\/\/thesite.com\/kf\/HTB1rCK3bfJNTKJjSspoq6A6mpXaJ\/TY-Unicorn-Big-Eyes-Plush-Toys-Ty-Beanie-Boos-Kids-Lovely-Children-Gifts-Kawaii-Stuffed-Animals.jpg",
"https:\/\/thesite.com\/kf\/HTB1zWO2eGmWQ1JjSZPhq6xCJFXaa\/TY-Unicorn-Big-Eyes-Plush-Toys-Ty-Beanie-Boos-Kids-Lovely-Children-Gifts-Kawaii-Stuffed-Animals.jpg",
"https:\/\/thesite.com\/kf\/HTB13sOWXoRIWKJjSZFgq6zoxXXah\/TY-Unicorn-Big-Eyes-Plush-Toys-Ty-Beanie-Boos-Kids-Lovely-Children-Gifts-Kawaii-Stuffed-Animals.jpg"
],
"priceRange": {
"minPrice": "19.99",
"maxPrice": "19.99",
"currency": "USD"
},
"descriptionHtml": "HTML code can potentially go here!",
"descriptionText": "Test product description"
}
My Attempt:
{
"name": "test product",
"descriptionUrl": "https:\/\/www.site.club\/",
"images": "https:\/\/www.site.club\/images\/img-instagram-icon.png",
"priceRange": {
"minPrice": "19.99",
"maxPrice": "19.99",
"currency": "USD"
},
"descriptionHtml": "HTML code can potentially go here!",
"descriptionText": "Test product description"
}
The code i have written so far is:
<?php
if (isset($_POST['submitNewProduct'])) {
// TRY/CATCH //
try {
// 1 - PRICE ARRAY //
$prices = [];
foreach (['minPrice', 'maxPrice'] as $searchField) {
$prices[$searchField] = $_POST['product_price'];
}
$prices['currency'] = 'USD';
// 2 - IMAGES ARRAY //
$images = [];
$images = "https://www.site.club/images/img-header-39847.png";
$images = "https://www.site.club/images/img-instagram-icon.png";
// SETUP THE JSON OBJECT //
$productData = array('name' => $_POST['product_name'],
'descriptionUrl' => getUrl(),
'images' => $images,
'priceRange' => $prices,
'descriptionHtml' => 'HTML code can potentially go here!',
'descriptionText' => $_POST['product_description']
);
print_r($productData);
// INSERTION //
$i = <IP_ADDRESS>getInstance()->insert(
'products',
[
'product_unique_id' => generateId("wlu", $member),
'product_category_id' => 0,
'product_name' => $_POST['product_name'],
'product_json_body' => json_encode($productData, JSON_PRETTY_PRINT),
'product_url' => getUrl(),
'product_active' => 'Y',
'product_date' => date('Y-m-d H:i:s')
]);
stdmsg("...");
} catch (Exception $e) {
stderr($e->getMessage());
}
}
?>
The issue is when i'm adding images, in the original JSON object, it is displayed between the [ ] square brackets, also in my test above i cannot add multiple images to the JSON object like the original format, any help would be appreciated.
|
9a6f2e2b21645a2fe4c385627a96b478c085f957d69a6e0c4d2087d279a14986 | ['800bc9e9ac7e4410b82cf2707168cf39'] | You need to replace the crystal & touch sensor.
Take it to the Apple store. They may do it for free or they may not. If they won't do it for free depending on where you live you may be able to find someone local who will do it for a lot less than Apple.
Otherwise there are many place that will do it through the mail. If you are handy and ambitious you can also try ordering the parts and doing the replacement yourself.
| 8cd2793807345a18db07c8ba93d56fcad97cf68ecda08c773f82f2414ae32993 | ['800bc9e9ac7e4410b82cf2707168cf39'] | OK I see the point, then the definitions you have used in the answer seem to be too vague - the triple (subject = code running with privileges of a particular user, object = file, action = open object) satisfies the definitions. Basically it revolves around the precise border between subject and action. Or is it that I have wrong lexical context (i.e. the system one instead of the security one)? |
25a249ad19bcefd02c8a21b2040ce5c572a4cbfa3e274ee3be71c39a01ebaf26 | ['8012af8fcc344e0c9467bae18b739ec1'] | Thanks everybody. I was able to resolve the problem. The supported platform uses the EC2,VPC, so my AWS account is in the current region that does not use a default VPC. I dumped everything out, created VPC using wizard, then the security group. Then re-created the DB instance, assigned it the new VPC i re-created. Thanks for your efforts.
| 128e6df486a4e16fff0f1be7c8cf179367977271dcec7834b7596a24bc1bf937 | ['8012af8fcc344e0c9467bae18b739ec1'] | Please have a look at sample data configuration file at
http://wiki.apache.org/solr/DataImportHandler#FileListEntityProcessor
You need to use something like XPathEntityProcessor to define
entities for indexing. Other entity processors, such as
PlainTextEntityProcessor,
can instead be used if you are not using XML files. Also, make sure
that the field definitions in your schema.xml match the field names
here.
|
a2869cf6ab4ad5835336061c15675c3616d9879745c8632fa3488c9bd0cb0e88 | ['801647463dc14ea5bc550ff0335380ea'] | I am trying to mitigate ssl bypassing on a jailbroken iOS.
I am unable to find any good work around as mobile substrate and SSL kill switch are able to bypass SSL.
I have tried two things:
SSL Pinning
Detect jailbreak and stop the application
Both can be cracked. My application handles confidential data so securing from SSL kill switch and mobile substrate is necessary. Thanks in anticipation
| 10c283438a8080f8b784707da95054c657550df28882ca602d637455af9563db | ['801647463dc14ea5bc550ff0335380ea'] | Adding to @Comzyh answer, this indeed is due to mixed python versions when an upgrade happen due to any reason. A quick fix is to remove your venv python binary i.e. rm <path-to-your-env>/bin/python and copying your system python binary to your venv like cp /usr/bin/python <path-to-your-env>/bin/python. This will fix the weak ref error
|
0ee0f64368e1d5320e3f0737dcc50254a286474a82f47ce2b5fa29c889049080 | ['8019ecda9c2b45ac84d6641770773b0c'] | I have a data like below
concat Type ddate TTIME
1348 - 2019-06-10 B 6/10/2019 12:34:03
1348 - 2019-06-10 A 6/10/2019 12:38:02
1348 - 2019-06-10 B 6/10/2019 13:37:15
1348 - 2019-06-11 A 6/11/2019 14:35:20
1348 - 2019-06-11 B 6/11/2019 18:01:01
1348 - 2019-06-11 A 6/11/2019 18:02:42
1348 - 2019-06-11 B 6/11/2019 19:59:34
I am trying to add a tag where for concat group, if the minimum time = Type A and Maximum of Time = Type B then needs to add include for all the line items of concat group. Else needs to mark as exclude for all the line items of the particular concat group like below:
concat Type ddate TTIME Category
1348 - 2019-06-10 B 6/10/2019 12:34:03 Exclude
1348 - 2019-06-10 A 6/10/2019 12:38:02 Exclude
1348 - 2019-06-10 B 6/10/2019 13:37:15 Exclude
1348 - 2019-06-11 A 6/11/2019 14:35:20 Include
1348 - 2019-06-11 B 6/11/2019 18:01:01 Include
1348 - 2019-06-11 A 6/11/2019 18:02:42 Include
1348 - 2019-06-11 B 6/11/2019 19:59:34 Include
I tried like below but not able to generate the desired output
df1 = df1 %>%
arrange(concat, time) %>%
group_by(concat) %>%
mutate(
Category = ifelse((TTIME == min(TTIME) & Type =="A") & (TTIME == max(TTIME) & Type =="B"),"Include","Exclude"))
| e04ae3e0ca8572350674d36171ece65b881ed8ec8e1c11f2b94865151b6ecfb0 | ['8019ecda9c2b45ac84d6641770773b0c'] | I have a list of list where I want to extract a specific column from each data set.I used the following code to get the 7th column of each data in the list of list.
lapply(out, function(x) lapply(x, function(y) y[,7]))
However, it looks like some data has less than 7 columns. But I need to get only the 7th column wherever available and combine all of them into one data frame (The column name may be different in each data in list of list but I am sure that the required information is available only in the 7th column)
|
f87c1fffc0591e577243bf670596cf17f0fd9fb45f4df577128f48d2835dc9c8 | ['8025555c975547fb932942683b8344c6'] | I try to develop a maven project with Angular 2 with Spring security.
The structure of the project is similar on this guide:
http://csetutorials.com/deploy-angular-2-maven-webapp-on-tomcat.html
But i am having a problem when building angular 2 using webpack. Because when i change a html to jsp in my angular 2. I get an error for (maven or npm) like this
From that error, i try to find an appropriate loader to compile jsp file or some tweak for webpack to recognize .jsp file but i cant find any of those solutions. So is it webpack can't compile jsp files?
| eaa9bb32cd70d157b1014b5e94d6f66f19f195351987ad90470b620d9bce0305 | ['8025555c975547fb932942683b8344c6'] | When i run my spring boot web service, i want to source myscriptfile.sh which contains lots of export commands in order to modify my web service URLs based on the environment of the current shell, before building my project.
I can run it in terminal using this command:
source /path/to/my/script/file/myscriptfile.sh; mvn spring-boot:run
But sometimes i want to do debugging on my project in IntelliJ, so i try to configure it to run that script before build process in external tools.
The configuration looks like this:
but when i try to debug my project i get
bin/bash: source: No such file or directory.
I not sure what is wrong with the setting, can anyone help?
|
4a93a6908b73ccf96467529f77a693478f8cad661b0724702037b34c3ecd7d0e | ['80281aa037ad4428a53a35cfaea20193'] | Here's my version, I made the code as verbose as possible so it should be self explanatory.
def showWord(word,knownLetters):
word=word.lower()
characters=""
wordsofar=""
for char in word:
if char in knownLetters:
characters = characters + char + " "
wordsofar += char
elif char == " ":
characters = characters + "/ "
wordsofar += " "
else:
characters += "_ "
print characters
return validate(word, wordsofar)
def validate(word, knownLetters):
word_dict = {}
for c in word:
if c not in word_dict:
word_dict[c] = 1
else:
word_dict[c] += 1
for c in knownLetters:
if c not in word_dict:
return False
else:
word_dict[c] -=1
for k,v in word_dict.iteritems():
if v != 0:
return False
return True
and then for the while loop, you'll be checking if showWord(word, knownLetters) returns false.
| ffee83deae4bbb6ed54b574695c339c5f4b93545598fbb6104c0a2c9433c4e83 | ['80281aa037ad4428a53a35cfaea20193'] | Through Python's subprocess module, I'm trying to capture the output of the dd command.
Here's the snippet of code:
r = subprocess.check_output(['dd', 'if=/Users/jason/Desktop/test.cpp', 'of=/Users/jason/Desktop/test.out'])
however, when I do something like
print r
I get a blank line.
Is there a way to capture the output of the dd command into some sort of data structure so that I can access it later?
What I essentially want is to have the output below be stored into a list so that I can later do operations on say the number of bytes.
1+0 records in
1+0 records out
4096 bytes transferred in 0.000409 secs (10011579 bytes/sec)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.