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 |
|---|---|---|---|---|---|
5cb89a5605945b0b02e797b772c52528e3eaa4ec20649d953044b93582df0144 | ['2cf90f8bf3a545148b739d70ee65d0b9'] | For a school assignment I am having to create a driving theory test and have to use the Dictionary function.
Dictionary<int, QuestionsClass> dictionary = new Dictionary<int, QuestionsClass>();
dictionary.Add(0, new Classes.QuestionsClass("Question", "Answer A", "Answer B", "Answer C", "Answer D", "Answer B"));
question = dictionary;
This is an example of the dictionary code where the last list item is the correct answer.
private void Option01Selected(object sender, EventArgs e)
{
if (radOption1.Checked)
{
SelectedAnswer = radOption1.Text;
}
}
I have four of these so the program knows which option has been selected as the answer. Once the user has selected their choice, they hit a submit button.
CorrectAnswer(); //check the answer is correct
CountQuestions++; //counts how many questions have been asked
This is part of the code that is in the submit button
if (!string.Equals(SelectedAnswer, question[RandomQuestion].Answer, StringComparison.OrdinalIgnoreCase))
{
Correct = Correct + 1;
}
lblScore.Text = Convert.ToString(Correct);
This is the function that keeps score of the correct answers.
Now for the problem. It may be very simple and easy to spot but this is my first C# application and I can't figure it out.
When the user selects an answer, the program always sees it as the correct answer.
Any help would be a HUGE help.
Thank You
<PERSON> | 02fcd066fe106693acc41fa790fe1e0f17d324801d17c480227daa2e79bee48b | ['2cf90f8bf3a545148b739d70ee65d0b9'] | I am working on an assignment for class and we have to create a dynamic website. We have to create all the containers in HTML, then load all out content onto a MySQL DB and then use Javascript to read the PHP file that collects the content from MySQL.
I have managed to get it to pull a list from the DB and display on my site, but now I'm stuck as to how to get it to read other parts of the page and pull them into the html.
Here is the PHP I have so far:
$con=mysqli_connect("localhost","Username","password",'DBname');
if (mysqli_connect_errno()){
die("Error: " . mysqli_connect_error());
}
$result = mysqli_query($con,"SELECT * FROM HomeList");
echo "<ul>";
while($row = mysqli_fetch_array($result)){
echo "<li>".$row['ListItem']."</li>";
}
echo "</ul>";
mysqli_close($conn);
?>
Here is my Javascript:
function getOutput() {
getRequest(
'php/getinfo.php',
drawOutput,
drawError
);
return false;
}
// handles drawing an error message
function drawError () {
var container = document.getElementById('id');
container.innerHTML = 'Error has occurred';
}
// handles the response, adds the html
function drawOutput(responseText) {
var container = document.getElementById('id');
container.innerHTML = responseText;
}
// helper function for cross-browser request object
function getRequest(url, success, error) {
var req = false;
try{
// most browsers
req = new XMLHttpRequest();
} catch (e){
// IE
try{
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
// try an older version
try{
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e){
return false;
}
}
}
if (!req) return false;
if (typeof success != 'function') success = function () {};
if (typeof error!= 'function') error = function () {};
req.onreadystatechange = function(){
if(req .readyState == 4){
return req.status === 200 ?
success(req.responseText) : error(req.status)
;
}
}
req.open("GET", url, true);
req.send(null);
return req;
}
I'm wanting to reuse as much code as possible but for pulling content from the DB without having to have multiple JS and PHP files. And we are under strict orders to not use plugins or Bootstrap.
Any help would be great!
Thank you!
|
9914a788356cfbdcb42f07570dbbc37293c5787900803187217221806427cb75 | ['2d0d3c82e1d04765ab66632ef9a39491'] | The ionic generate page <page_name> command will generate the HTML, TypeScript, and SCSS files for the newly created page in a new directory under app\pages.
To correctly address those components in your AppModule the imports must be like:
import { TermsOfUsePage } from '../pages/terms-of-use/terms-of-use';
import { PrivacyPolicyPage } from '../pages/privacy-policy/privacy-policy';
// rest of your code
| bdd78c1ea75e42a7a89028aff77facd053ebaf1513635c4e8a2c128680fc5ada | ['2d0d3c82e1d04765ab66632ef9a39491'] | Hope this would help you:
.page_menu_wrapper {
width:100%;
max-width:1100px;
margin:0 auto;
}
.clear {
clear:both
}
.page-menu ul {
display: inline-block;
margin: 0;
list-style: none;
}
.page-menu ul li {
float: left;
padding: 0 7px;
background-color:green;
transition:all 400ms ease-in-out}
.page-menu {
float:left;
width:100%;
height:auto;
padding:0!important;
margin:0 5px;
text-align: center;
font-size:100%;
font-weight:400}
.page-menu ul {
margin:0 auto!important;
text-align:center;
display: block;
width:100%;
padding:0!important;
line-height:72px}
.page-menu li a:hover {
background-color:#e8554e!important}
.page-menu ul li a {
color:white!important;
padding:0 40px 0 0;
text-decoration:none;
}
.page-menu ul li a img {
vertical-align:middle!important}
@media screen and (max-width:1000px){
.page-menu,.search-box {
width:100%;
margin:0 }
.page-menu ul li {
width:33.3%;
float:left}
.page-menu ul li:first-child {
width:100%;
float:none;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin-top:10px}
.page-menu ul li:last-child {
width:100%;
float:none;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;}
.page-menu ul li {
text-align:center}
.page-menu ul li a {
margin:0 auto;
padding:0}
.page_menu_wrapper {
padding-bottom:10px}
}
@media screen and (max-width:480px){
.page-menu ul {line-height:2em}
}
@media screen and (max-width:240px){
.page-menu ul li{width:50%}
}
.searchform {
display: inline-block;
zoom: 1; /* ie7 hack for display:inline-block */
*display: inline;
padding:0 5px;}
.searchform input {
font: normal 12px/100% Arial, Helvetica, sans-serif;}
.searchform .searchfield {
background: #fff;
padding: 6px 6px 6px 8px;
width: 202px;
border: solid 1px #bcbbbb;
outline: none;
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
-moz-box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,.2);
box-shadow: inset 0 1px 2px rgba(0,0,0,.2);}
.searchform .searchbutton {
color: #fff;
border: solid 1px #494949;
font-size: 11px;
height: 27px;
width: 27px;
text-shadow: 0 1px 1px rgba(0,0,0,.6);
-webkit-border-radius: 2em;
-moz-border-radius: 2em;
border-radius: 2em;
background: #5f5f5f;
background: -webkit-gradient(linear, left top, left bottom, from(#9e9e9e), to(#454545));
background: -moz-linear-gradient(top, #9e9e9e, #454545);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#9e9e9e', endColorstr='#454545'); /* ie7 */
-ms-filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#9e9e9e', endColorstr='#454545'); /* ie8 */
}
<div class="page_menu_wrapper">
<nav class='page-menu'>
<ul>
<li><a href='/'><img height='70' src='logo.png' width='171'/></a></li>
<li><a href='about.php'><span itemprop='name'>About</span></a></li>
<li><a href='contact.php'><span itemprop='name'>Contact</span></a></li>
<li><a href='privacy.php'><span itemprop='name'>Privacy</span></a></li>
<li><a href='sitemap.php'><span itemprop='name'>Sitemap</span></a></li>
<li><a href='iklan.php'><span itemprop='name'>Iklan</span></a></li>
<li><form class="searchform">
<input class="searchfield" type="text" value="Search..." onfocus="if (this.value == 'Search...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Search...';}" />
<input class="searchbutton" type="button" value="Go" />
</form></li>
</ul>
</nav>
<div class='clear'></div>
</div>
|
d8aceb571f04ec80e0d4e5ef2414bfc00af1574edb0b5d58f1de5e713d077646 | ['2d173bfc984f449aa21bc7dd7bbf5e41'] | Six months ago I published my first app to Google Play. It was simple game like 4 pics 1 word. It became very popular in my country (Russia).
Now I want to release the same game but with different levels.
I try to add new app in my Google play developer console but I get the following message:
You need to choose a different title for your app. This one is already
the title of com.hungl.photosandwords.
I want to publish my new game with exectly same name as the first one.
Is it possible?
I have two ideas about it:
1) Choose default language as English (my game isn't translated in English) and add translation to Russian. But won't it affect in search position?
2) Use other account to publish new game. But I'm afraid I'll get banned for the same design.
What should I do in this case?
| d2691e938778592d2a6cf11ead44ea3ed5de7d2e335a56a3a86a1a6bcb5fa2cc | ['2d173bfc984f449aa21bc7dd7bbf5e41'] | Finally I have solved this.
I found out that I use different shells in my terminal session and when running PHP exec() (or shell_exec()) function:
omix@omix:~$ ps -p $$
PID TTY TIME CMD
15471 pts/0 00:00:00 bash
omix@omix:~$ php -a
Interactive mode enabled
php > echo shell_exec('ps -p $$');
PID TTY TIME CMD
15908 pts/0 00:00:00 sh
Now I run shell commands from PHP like this:
$c = shell_exec('/bin/bash -c "compgen -c pyt"');
This works for me.
|
4c6ec69a9c5d02cd7b0209e02ae99962a1ab951220d274d6c2b584032480e206 | ['2d3547fecc8e4aa29d89743ae71145d7'] | I have a roles migrations.
'use strict';
var dbm;
var type;
var seed;
/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};
exports.up = function (db) {
return db.createTable('roles', {
role_id: { type: 'int', primaryKey: true, unique: true, autoIncrement: true },
role_name: 'text',
})
}
exports.down = function (db) {
return db.dropTable('roles')
};
exports._meta = {
"version": 1
};
Now, I would like to set some default roles. How am I suppose to do that?
'use strict';
var dbm;
var type;
var seed;
/**
* We receive the dbmigrate dependency from dbmigrate initially.
* This enables us to not have to rely on NODE_PATH.
*/
exports.setup = function (options, seedLink) {
dbm = options.dbmigrate;
type = dbm.dataType;
seed = seedLink;
};
exports.up = function (db) {
const sql = "DELETE FROM roles"
db.runSql(sql, function (err) {
if (err) return console.log(err)
})
return db.insert(
'roles',
['user_role'],
[['admin', 'technician']]
)
};
exports.down = function (db) {
const sql = "DELETE FROM roles"
db.runSql(sql, function (err) {
if (err) return console.log(err)
})
return null
};
exports._meta = {
"version": 1
};
No matter what I try I always get
unterminated quoted string at or near "'admin);"
as an error.
It runs in the docker container and I already ran run migrate_up for both migrations
The documentation states I need to do this: insert(tableName, columnNameArray, valueArray, callback)
So, how do I add multiple rows in one statement?
| b74cdcf966d77154faac4c493a23f010e2fa8794f639e1e4d153d278d1f0acbc | ['2d3547fecc8e4aa29d89743ae71145d7'] | You can disregard these warnings. As far as I remember they are related to git. When I took his Angular course a few months ago I didn't have any issues using Win 10 Pro.
Are you using vs code terminal for your cli/npm installs?
Here is the information from his course content 1.5 on troubleshooting the instalations:
A lot of problems are solved by making sure you're using the latest
version of NodeJS, npm and the CLI itself.
Updating NodeJS:
Go to nodejs.org and download the latest version - uninstall (all)
installed versions on your machine first.
Updating npm:
Run [sudo] npm install -g npm (sudo is only required on Mac/ Linux)
Updating the CLI
[sudo] npm uninstall -g angular-cli @angular/cli
npm cache verify
[sudo] npm install -g @angular/cli
Here are some common issues & solutions:
Creation of a new project takes forever (longer than 3 minutes) That
happens on Windows from time to time => Try running the command line
as administrator
You get an EADDR error (Address already in use) You might already have
another ng serve process running - make sure to quit that or use ng
serve --port ANOTHERPORT to serve your project on a new port
My changes are not reflected in the browser (App is not compiling)
Check if the window running ng serve displays an error. If that's not
the case, make sure you're using the latest CLI version and try
restarting your CLI
Hope it helps
|
184eeaaa29469e9e9f391c3e54329dc4a8c3dd4e3fb67c1fc7be71910bc668f1 | ['2d3767cfcb614c998b4a08b7d6f9615f'] | I have always used backticks (`) to execute my SQL queries. However, recently, I learned that if I excluded them, column names such as "From" will be interpreted differently.
Now, for safety reasons, I'd just like to know exactly which other words I shouldn't use as column names, in case I would ever make a query without backticks (or worse - it's not supported in a later MySQL version).
Correct me if I've gotten this wrong, but function names (such as "Password") are safe to use, right?
| 36835a0db2d8355f9b06f78dabab9c5b4acb27dd30ad4b863bb343e8fbd5e427 | ['2d3767cfcb614c998b4a08b7d6f9615f'] | So my path:
/Users/work/Desktop/My Folder/My File.txt
My Folder and My File have spaces. Of course, in Terminal, when you tab for autocompletion it would do /Users/work/Desktop/My\ Folder/My\ File.txt.
My problem is when I use that path in python as such:
from subprocess import Popen
def print_rc(file):
with open(file, 'r') as infile:
p = Popen(["lpr -o page-ranges=1-2"], stdin=infile)
output = p.communicate()[0]
I get an error that no such file or directory error. When I do os.path.exists('/Users/work/Desktop/My Folder/My File.txt'), it turns out as True. So I think the problem has to do with the spaces.
What would I need to do to make convert the python string into something bash can understand then?
|
7a7dd4c8f26f78a84f513494c48877b55f6cf857fa0966f78556c11347850d57 | ['2d38f63753474a718bbf71b56c4feba9'] | I want to run a simple line of code:
document.getElementById('..').click();document.getElementById('..').click();
over multiple pages of the same website. I have a list of all those pages, I want to open the page, click those two elements and close the page over - 700 times. Can I possibly program chromium console to do that(taking into account loading times)?
| 66095d67c92448a405f3eca96d868167263b15d241b720974055b32a76d0c872 | ['2d38f63753474a718bbf71b56c4feba9'] |
Blender 2.68-4
Linux peppermint os 3
Toshiba tecra m1 with Trident Cyberblade
Everything seams to work properly, I get fully functional UI, but in the work space there are only points with orientation arrows, they react as if there wore objects but neither objects nor the grid shows up. They appear in the render thou.
|
3ed2daef006078933985fb696ec4751fb10ce2329dbed4289274ae82b2a18737 | ['2d4ed523ded745c0b14eb5cf1264b611'] |
Install w3tc or wp-super-cache
cut down on the number of posts/tags (remember that wordpress stores revisions of posts in the wp_posts table, so, if someone likes to leave themselves logged in and autosave runs every 5 minutes, you can get quite a few excess revisions in there)
replace wordpress
get a faster disk
While I disagree with some of the tunables in the config based on gut feelings, http://blog.mysqltuner.com/ contains a script that you can run that gives you input on your config settings. You'll want to have mysql running for 48+ hours for it to give the best recommendations.
table_definition_cache
thread_concurrency (On a quadcore, I usually run this at 6)
join_buffer_size (you have it listed as join_buffer which may be incorrect, look at show status/show variables to make sure your config values are taking effect as you expect)
If you aren't running email on the same partition as your database, consider mounting the filesystem with noatime,nodiratime. Check other tunable settings on your filesystem.
| 659ef9366bf4f176630e9a6e45798305ff01c56fc949f3e267b09098acc51010 | ['2d4ed523ded745c0b14eb5cf1264b611'] | While <PERSON> has just corrected the wiki formatting, there are still errors in the code.
RewriteCond %{HTTP_REFERER} .ru [NC,OR]
will block anything that contains somecharacter(ru) within the string.
so, any url that contains aru would be declined. A more restrictive ruleset should be used for that.
RewriteRule .* - [F]>
will cause an error 500 as it is an invalid string. removing the > would fix that.
While I had more than 50 rep earlier, I have 1 now, so, I cannot comment on your answer. Please merge the answer into a comment. Thanks.
|
09d4cb0e4b75535845a5f1b3cc38ee151859f0e5a8bd3dbeeb38b5f7cc329a3b | ['2d5d0ed330374cc8866d838bb9ac72a0'] | OK I removed the private constructor, and re-wrote the two public ones like this:
/**
* Public constructor. Used to construct a response containing
* the required information from the TotalStation device.
*
* @param horizontalAngle
* The horizontal angle.
* @param verticalAngle
* The vertical angle.
* @param slopeDistance
* The slope distance.
*/
CDeviceTSGetObservationResponse(double horizontalAngle,
double verticalAngle,
double slopeDistance)
: CDeviceServerResponse(CDeviceServerResponse<IP_ADDRESS>TS_GET_OBSERVATION,
CDeviceServerResponse<IP_ADDRESS>SUCCESS_MESSAGE),
m_dHorizontalAngle(horizontalAngle),
m_dVerticalAngle(verticalAngle),
m_dSlopeDistance(slopeDistance) {}
/**
* Public constructor. Used to construct a response containing
* the error message from the TotalStation device.
*
* @param errorMsg
* The error message for the response.
*/
CDeviceTSGetObservationResponse(std<IP_ADDRESS>string errorMsg)
: CDeviceServerResponse(CDeviceServerResponse<IP_ADDRESS>TS_GET_OBSERVATION,
errorMsg),
m_dHorizontalAngle(0.0),
m_dVerticalAngle(0.0),
m_dSlopeDistance(0.0) {}
| 11057ff8b63dd99e76ffcde30164be52b030d0d3374464dc529185f0d4f951a2 | ['2d5d0ed330374cc8866d838bb9ac72a0'] | Note: In anticipation of those that would like to point out the bad design of having code which constructs objects inside it, rather than via dependency injection, or factories, which are easily mocked; I am dealing with writing tests for legacy code, where refactoring the code into a more modern design is not an option.
I have a command method that when it executes will construct three objects in the class MyObjectWrapper, which is dependent on another class MyObject. In the test, both of these classes and the 6 objects are all mocked. Consider the following code:
@RunWith(PowerMockRunner.class)
@PrepareForTest(MyCommand.class)
public class MyCommandTest {
@Mock public MyObject objectOne;
@Mock public MyObject objectTwo;
@Mock public MyObject objectThree;
@Mock public MyObjectWrapper wrapperOne;
@Mock public MyObjectWrapper wrapperTwo;
@Mock public MyObjectWrapper wrapperThree;
private MyCommand command;
@Before public void beforeEach() {
command = new MyCommand();
MockitoAnnotations.initMocks(this);
initialiseWrapper(wrapperOne, objectOne, true, false);
initialiseWrapper(wrapperTwo, objectTwo, false, false);
initialiseWrapper(wrapperThree, objectThree, true, true);
}
private void initialiseWrapper(MyObjectWrapper wrapperMock, MyObject objMock, boolean option1, boolean option2) {
wrapperMock = PowerMockito.mock(MyObjectWrapper.class);
PowerMockito.whenNew(MyObjectWrapper.class)
.withParameters(MyObject.class, Boolean.class, Boolean.class)
.withArguments(objMock, option1, option2)
.thenReturn(wrapperMock);
}
@Test public void testConstructoresCalled() throws Exception {
command.execute();
VERIFY constructor with arguments: objectOne, true, false
VERIFY constructor with arguments: objectTwo, false, false
VERIFY constructor with arguments: objectThree, true, true
}
}
I know that I could confirm that the constructor was called 3 times with:
PowerMockito.verifyNew(MyObjectWrapper.class, times(3));
However I need to confirm that the constructors were called, with the three passed in arguments. Is it possible to do this?
|
e690c04e1ce397cdcb28644d43b685186a7f0eba791abc94afc3d7746be277c6 | ['2d6150fdb6b949c68d2c2271c48a2aa9'] | And also if you want to print to the terminal, the right way to do it is...
System.out.println("Text here")
And if you dont want to break the line when writing, you can do this.
System.out.print("Text here")
When using "" inside of an print method, it indicates that you want to print a String.
| 854721318d3f5b4727d6d6ef2b4068588714ef5eaf5a47bed48d0a0f309263e2 | ['2d6150fdb6b949c68d2c2271c48a2aa9'] | I have created a java program that has a login screen. It takes two inputs, discordID and key.
The discordID and key are located inside of an JSON file that is automatically updated by a Discord bot that i have. The bot is made in Python.
I want to use MySQL for handling the user login requests. So my question is...
Can i open up the server for public and handle user login requests? And if that works i want to return True or False depending if the credetials match the ones in the DataBase.
Was thinking at mongoDB for example. There you can return True or False depending if the credentials from the user equals to the ones you have in the database.
|
2580b9503550e083244a97d346f24771379d42a6237e8593f6d5ac62e5525606 | ['2d651ebfe7db43e4b3f9686a5a46138a'] | You have to rename the file after uploading it.
$sourceFile = 'C:\temp\allisv22018201810101009.csv'
$sourceItem = Get-Item $sourceFile
# If uploading to a Team Drive, set this to 'true'
$supportsTeamDrives = 'false'
# Set the file metadata
$uploadMetadata = @{
originalFilename=$sourceItem.Name
name=$sourceItem.Name
description="TestCSV"
}
# Set the upload headers
$uploadHeaders = @{
Authorization="Bearer $accessToken"
"Content-Type" = "application/json"
}
# Perform the upload
try {
$response = Invoke-RestMethod -Uri "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart" -Method Post -Headers $uploadHeaders -InFile $SourceFile
$urifile = "https://www.googleapis.com/drive/v3/files/$($response.id)"
$renameResponse = Invoke-RestMethod -Uri $urifile -Method Patch -Headers $uploadHeaders -Body '{ "name":"HappyFile.csv" }'
If you successfully upload your file, it will return the value in $urifile and you can use that to rename the file.
| 62dc7243ea68d1ac79c563d3440f7c43d434c3ea059340531a45e90904e87169 | ['2d651ebfe7db43e4b3f9686a5a46138a'] | Token retrieval all figured out.
Uploading files to Google Drive.
Getting error
Here is the powershell command I'm using:
$response = Invoke-RestMethod -Uri "https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart" -Method Post -Headers $uploadHeaders -Body $uploadBody
Here is the string for the variable $uploadBody
--314159265358979323846
Content-Type: application/json; charset=UTF-8
{
"description": "TestCSV",
"name": "test-emp.csv",
"originalFilename": "test-emp.csv"
}
--314159265358979323846
Content-Transfer-Encoding: base64
Content-Type: application/octet-stream
c0FNQWNjb3VudE5hbWUsRU1QX05VTQ0KYnNtaXRoLDc3Mzk5Mg0KbHNvbmcsMzM3MTEwDQpnc3Vkbyw2NDkwNTc
--314159265358979323846--
This fails - only changed the data file:
--314159265358979323846
Content-Type: application/json; charset=UTF-8
{
"description": "TestCSV",
"name": "csv3.csv",
"originalFilename": "csv3.csv"
}
--314159265358979323846
Content-Transfer-Encoding: base64
Content-Type: application/octet-stream
c2VxLGZpcnN0LGxhc3QNCjEsQW15LEJhcmtlcg0KMixMZWUsU2FsYXphcg0KMyxFc3RlbGxhLEtlbm5lZHkNCg
--314159265358979323846--
For completeness, here is the header IDictionary param for $uploadHeaders
Name Value
---- -----
Authorization Bearer ya29.GlxbBiz86xKlRnjzQY2z70vHtWfL4sr28BvX-OKio8PbcEfJ0l7tQgx9btNqMdanYXG_WzSD74WD_15903vn0mYO0G0uI8lez5g77Z_W0gKrIRh_s...
Content-Type multipart/related; boundary=314159265358979323846
Content-Length 400
I've read a great deal on this and have made sure there were two rn before payload. Any pointers would be greatly appreciated!
Thank you!
|
bf7336545bfe52534553f32a9882d672a9cf298aedc8ae7f9ead68fb71deb829 | ['2d65753be4834d2d938ba2b7a37f4302'] | We would like to disable mod_pagespeed for our office as it can make administering image based content on sites frustrating no knowing which is the current version of an image.
Does anyone know a way of disabling it for a specific IP ?
I am aware of the url switch ?ModPagespeed=off however need something that does not require user intervention every time. Also i know the cache can be cleared on the command line but users adminstering content will not have this level off access.
Any help would be great.
| 87f96031bb0213a4e4de1cb1ab555eb60d7ca551ea147d1f704ede7c9ebd7571 | ['2d65753be4834d2d938ba2b7a37f4302'] | Today our server got hit by a large number of requests from Facebook IPS in the range 66.220.159.XXX
The user agent give is : "Facebot/1.0"
I cant find any information on this on the facebook site, it seems its not the regular facebook user agents i.e ‘facebookexternalhit’ or ‘facebookplatform’.
I am trying to find some more information on this bot will it obey any sort of crawl delay directive ?
|
df6513097046f104044ba2827e7936f076cef5f14586565ad281fb970428d53e | ['2d65c5e8496f4d40b8f1400d83bf7ae1'] | I had python 32 bit installed so i uninstalled it and installed the 64 bit version.
I upgraded the path also but when i try using pip it is still using the previous path of the 32 bit python and pip
this is the exact error in cmd :
Fatal error in launcher: Unable to create process using '"c:\users\sagar annaji\appdata\local\programs\python\python37-32\python.exe" "C:\Users\Sagar Annaji\AppData\Local\Programs\Python\Python37-32\Scripts\pip.e
xe" install numpy'
while i think with my new path the command should have been:
'"C:\Users\Sagar Annaji\AppData\Local\Programs\Python\Python37\python.exe" "C:\Users\Sagar Annaji\AppData\Local\Programs\Python\Python37\Scripts\pip.exe" install numpy'
python works fine but pip doesnt i included a pic of my path variables please help me resolve it.
| e4856918335455deee2e8120a373609c5e3139984dcdcba4b54e572f21c309d2 | ['2d65c5e8496f4d40b8f1400d83bf7ae1'] | import pynput
import time
def poschange(x,y):
#print(f"{x},{y}")
print("poschange called")
pynput.mouse.Controller().position = (0,0)
def stop(key):
#print(key)
try:
if key.char == 'a':
print("stopped")
keyli.stop()
mouli.stop()
exit()
except:
pass
<PERSON> = pynput.keyboard.Listener(on_press = stop)
keyli.start()
<PERSON> = pynput.mouse.Listener(on_move = poschange)
mouli.start()
keyli.join()
mouli.join()
I just want to lock the mouse position when of the the mouse to (0,0) until I press the 'a' key on the keyboard and then the program terminates and i get control my mouse again.
To my knowledge in this code when ever i move the mouse the poschange() method is called and the mouse position must be set back to (0,0) and repeat again until the mouse listener thread is terminated, but it just works twice, the print statement in the poschange() function is printed twice in the console and then the mouse becomes sluggish and moves slowly, when I press 'a' the listeners must stop and program must terminate but it doesn't I have to manually do it and only the the mouse becomes fast and normal again. But when I remove the line pynput.mouse.Controller().position = (0,0) from the code the thing works as i intend, it prints the print statement "poschange called" every time I move the mouse and the program terminates as expected when I press the 'a' key.
can someone please tell me why and tell me whats wrong with this. Thanks in advance.
|
a7634e1b77a1f7a14b5ff35d98fbd58e78ee3864bde2a31e1f0d6f75f4305a97 | ['2d7ab08be203437f95d7a49288d74497'] | I have a Casio fx-9750GII, I'm starting to get to grips with just how useful it can be. For those familiar with it you will be aware it can graph functions.
However I noticed when looking through the set up menu it has a complex mode which can be set to a+bi. So I enabled that option and entered 3+4i as a function, the calculator does not draw anything.
How do I graph complex numbers?
| a8f0486837eb047b854902b17f314c323d915236fe3654d7e5ffef6f5c790943 | ['2d7ab08be203437f95d7a49288d74497'] | To solve the integral:
$\int\frac {x}{\sqrt{4-x^2}}\ dx$
I used the substitution:
$u = \sqrt{4-x^2}$
hence:
$\frac{du}{dx} = -\frac {x}{\sqrt{4-x^2}}$
$dx = -\frac {\sqrt{4-x^2}}{x}\ du$
So the integral becomes:
$\int\frac {x}{u}(-\frac {\sqrt{4-x^2}}{x})\ du$
$= \int\frac {x}{u}(-\frac {u}{x})\ du$
$= \int -1\ du$
$= -u+c$
$= -\sqrt{ 4-x^2}+c$
However the solution I have seen is:
Use the substitution $x = 2\sin(t)$, so $dx = 2\cos(t)\ dt$
So the integral becomes:
$\int \frac {2\sin(t)(2\cos(t))}{\sqrt{\cos(t)^2}}\ dt$
After some rearranging the integral becomes:
$\int 2\sin(t)\ dt$
Which gives:
$-2\cos(t)+c$
Then using $\sin(t) = \frac x2$:
$\cos(t)^2 = 1 - \sin(t)^2$
$\cos(t)^2 = 1 - \frac {x^2}{4} = \frac{4-x^2}{4}$
$\cos(t) = \frac{\sqrt{4-x^2}}{2}$
Which then gives the solution as:
$= -\sqrt{ 4-x^2}+c$
I feel like the method I used was more efficient as it didn't require the use of trig functions. I'm fairly confident my method is correct so why would the solution use trig functions? Was I just lucky that I decided $u = \sqrt{ 4-x^2}$ was a good substitution?
|
85ce49f328143750de3ebd061581fe60d19642cdeebf9645a9ae2411209f65ee | ['2d7fba408bbf4b199cf5cda5d7c5a007'] | I am working on setting up a few new bots for Hangouts Chat. Part of the effort involves using Hubot, which is working well. Another use case requires posting to user spaces based on external functions, which is done via a python command script. I have a project and separate service account setup for each bot, and the permissions for the bot service account appear to be the same. None of the bots have corresponding domain-wide delegation at the GSuite Security level.
We obtain the spaceid for each user via one Hubot that saves their spaceid to a database, and the python script can then lookup the user and obtain that id.
However, only one of the 5 projects appears to be able to post a message to a user space. All others get a 403 error and fail to post. The same python script is used for any of the 'bots' with the only difference being the json file used for authentication.
Not sure this is enough information. But, I wonder what could be causing this problem if not permissions?
| 2a20c20419a4a8a6daced6b86ba63682ac2d14cd736a6bde8007e16251522a1a | ['2d7fba408bbf4b199cf5cda5d7c5a007'] | I figured it out. The spaceid I was registering via another bot is not the same as the spaceid associated with the bot/user communication for any other bot. In other words, it appears that the spaceid a bot sees for a user is unique to its communication with the user. I will need to have users register with the bot that needs to send the message instead of a common registration bot
|
cb88e268dd05b6e7468aa4e59f63e9b8530f911be456e0424ae4efd6f8374790 | ['2d85cf7ec9984dd7963a9a79e6eaa819'] | i am trying to write a loop which will filter the HomeTeam playing with AwayTeam by particular team. So in the end i can have a column which will tell me the number of matches won/lost/draw when a particular team played against the AwayTeam in the past. So the original data set looks like this:
Date HomeTeam AwayTeam FTHG FTAG FTR Draw Lost Win
(chr) (chr) (chr) (int) (int) (chr) (dbl) (dbl) (dbl)
1 17/08/2002 Blackburn Sunderland 0 0 D 1 0 0
2 17/08/2002 Charlton Chelsea 2 3 A 0 1 0
3 17/08/2002 Everton Tottenham 2 2 D 1 0 0
4 17/08/2002 Fulham Bolton 4 1 H 0 0 1
5 17/08/2002 Leeds Man City 3 0 H 0 0 1
6 17/08/2002 Man United West Brom 1 0 H 0 0 1
i have written this code first:
arsenal <- football %>%
select(1:10) %>%
filter(football$HomeTeam == "Arsenal" & football$AwayTeam == "Birmingham" & Date >= 17/08/2002)
birmingham <- football %>%
select(Date, HomeTeam, AwayTeam, FTHG, FTAG, FTR) %>%
filter(football$HomeTeam == "Birmingham" & football$AwayTeam == "Arsenal" & Date >= 17/08/2002)
It produced the following:
Date HomeTeam AwayTeam FTHG FTAG FTR Draw Lost Win
(chr) (chr) (chr) (int) (int) (chr) (dbl) (dbl) (dbl)
1 18/08/2002 Arsenal Birmingham 2 0 H 0 0 1
2 01/05/04 Arsenal Birmingham 0 0 D 1 0 0
3 04/12/04 Arsenal Birmingham 3 0 H 0 0 1
4 02/10/05 Arsenal Birmingham 1 0 H 0 0 1
5 12/01/08 Arsenal Birmingham 1 1 D 1 0 0
6 17/10/09 Arsenal Birmingham 3 1 H 0 0 1
Date HomeTeam AwayTeam FTHG FTAG FTR
(chr) (chr) (chr) (int) (int) (chr)
1 12/01/2003 Birmingham Arsenal 0 4 A
2 22/11/03 Birmingham Arsenal 0 3 A
3 15/05/05 Birmingham Arsenal 2 1 H
4 04/02/06 Birmingham Arsenal 0 2 A
5 23/02/08 Birmingham Arsenal 2 2 D
6 27/03/10 Birmingham Arsenal 1 1 D
So i would like to automate this process for all teams like in the example above. i have produced the following loop but it doesnt work:
list_of_teams <- c("Arsenal", "Aston Villa", "Manchester City", "Liverpool")
for(i in 1:length(list_of_teams)){ football_1 <- football %>%
select(1:10) %>%
filter(football$HomeTeam == list_of_teams[i] & football$AwayTeam == list_of_teams[i+1])
for(j in 1:length(list_of_teams[-i])){
football$HomeTeam == list_of_teams[j] & football$AwayTeam == list_of_teams[-i]
print(c(list_of_teams[[i]], list_of_teams[-i][[j]]))
}
}
The plan was to create the empty dataframe and then based on what loop produces it will store it there. However, eventually it will store only the teams which are in list_of_teams variable initially created.
Question is: why does the loop ignore/or doesnt do selection of the columns 1:10 and filter the HomeTeam and AwayTeam accordingly and how we can solve this problem?
Thank u in advance, i am new to R and programming any help will be appreciated.
| db6b89c5f973e8c0087a5e354bd1b0ebcc9bd942221709f3c39f760c02e028f3 | ['2d85cf7ec9984dd7963a9a79e6eaa819'] | I have read similar headings and unfortunately couldnt find an answer. The problem is that i have the following data:
[,1] [,2] [,3] [,4] [,5]
HomeTeam "Arsenal" "Leicester" "Man United" "QPR" "Stoke"
AwayTeam "Crystal Palace" "Everton" "Swansea" "Hull" "Aston Villa"
and i want it to be as follows:
Teams Opponent
HomeTeam Arsenal Crystal Palace
AwayTeam Crystal Palace Arsenal
HomeTeam1 Leicester Everton
AwayTeam1 Everton Leicester
HomeTeam2 Man United Swansea
AwayTeam2 Swansea Man United
i have tried the following command but its incorrect, just to give you an idea what i am trying to do:
odd <- seq(1, 759, by = 2)
<PERSON> <- seq(2, 270, by = 2)
df <- data.frame(team = df_1[odd,1],
opponent = df_1[even,1])
Question is: how can i modify the command above ? Or can u suggest me any other code. Thanks in advance!
|
41351570c9bb1aeaeb1268aedc9741c8eceefc28a9a386bbf36da0f9e0cf1285 | ['2d8cb75ad3774c7cb329b030a5610135'] | I'm trying to do my homework (the overall problem is about $A$ a finite abelian group and showing $A \cong A^\vee \cong A^{\vee\vee}$, but you can ignore that), and I think I have a fundamental lack of understanding of how to extend a character $A \to \mathbb{C}^\times$.
For example, more precisely, let's say $A$ and $B$ are finite abelian groups, and $A \hookrightarrow B$ (or even $A \leq B$, whatever is clearer). If we have a character $\chi_A: A \to \mathbb{C}^\times$, how do we find a character $\chi_B: B \to \mathbb{C}^\times$ such that $\chi_B |_A = \chi_A$?
Any examples or recommendations for resources I can look up will be appreciated!
Here are my thoughts so far: Let's say you have $\{1,\sigma\} = \mathbb{Z}/ 2 \mathbb{Z} \leq V_4$, the Klein 4-group, and I have a character $\sigma \mapsto -1$; any extension will just take the generator of the other copy of $\mathbb{Z}/2 \mathbb{Z}$ in $V_4$ and map it to either -1 or 1. But that only works if $A$ is the product of a subset of the direct summands of $B$ (which are all cyclic). If $A = \mathbb{Z} / 2 \mathbb{Z}$ and $B = \mathbb{Z} / 4 \mathbb{Z}$, we wouldn't be able to do this; we would need to cleverly pick out the image of a generator of order 4 such that the image of the element of order 2 matches up with $\chi_A$. When $A$ and $B$ have more summands, would I be able to still use this process, for each cyclic piece of $A$ that is a subgroup of a cyclic piece of $B$?
| b60a162bd18a01e79722d5f9256a113f0df51ca8dcd59fe2c3a36c875f6d711e | ['2d8cb75ad3774c7cb329b030a5610135'] | [cont'd] Maybe $H$ would have to be something like $S_{|G|}$ acting on $|G|$ by conjugation, but then I'd have to check which are actually _group_ actions, i.e. $S_{|G|}$ acting on $G$. This approach should theoretically reveal all possible outer automorphisms (I think...), but it is again probably extremely tedious... |
a581be5151f9c3888a4bf93c3286df02939b16d24c8d9af884b270b07453d97c | ['2d9231a7d22d4057905e9ecec92e10a7'] | Hi for do a login I do:
headers = {
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36'
}
try:
url = 'https://empresa.computrabajo.com.mx/login'
r = s.get(url, headers=headers)
soup = BeautifulSoup(r.content, 'html.parser')
#the page in the login have a hiden attribute call token for do the login
token = soup.find("input", attrs={'name': '__RequestVerificationToken'}).get('value')
login_data = {
'__RequestVerificationToken': token,
'UserName': 'YOURUSERNAME',
'Password': 'YOURPASS',
'KeepMeLoggedIn': 'false'
}
r = s.post(url, data=login_data, headers=headers)
except Exception as getError:
print('Error Login')
you can find a lot of information in youtube, to see how using the network tool in google chrome can catch he headers and url that need to use in a login page of your interest.
| 226bad734daf4830ad46e0d48a12dc85ec06fde32b5a8cf7bfafb5303c76c944 | ['2d9231a7d22d4057905e9ecec92e10a7'] | for only the token I do:
import requests, json
token_url = "https://apisandbox.paylocity.com/IdentityServer/connect/token"
#client credentials
client_id = 'XXXX'
client_secret = 'XXXXXX'
#step A, B - single call with client credentials as the basic auth header - will return access_token
data = {'grant_type': 'client_credentials', 'scope':'WebLinkAPI'}
access_token_response = requests.post(token_url, data=data, verify=False, allow_redirects=False, auth=(client_id, client_secret))
print(access_token_response.headers)
print (access_token_response.text)
And after that code I recived the Token the same as the PostMan.
you can check: https://developer.byu.edu/docs/consume-api/use-api/oauth-20/oauth-20-python-sample-code
for more information/options.
|
337e4b6192829a10cbc6e7e6431c17ec9e00c41c593334a2be0d66d64853bfbf | ['2d9792d123ca4ba18edfad7283c13616'] | I Recently started using geopandas to handle shapefiles of my city. Recently I found a problem using the contains method from geopandas. The problem is the following:
I got 2 different shapefiles with the same crs projection: districts and sections. I need to obtain all the section polygons that are withing a district. I read about the contains method and it looks like it is exactly what I need but at the moment of running it, the returning polygons within is empty. The weird thing here is when I use intersects method instead contains it returns the sections within the district plus all the adjacent sections to this.
The following is my code:
districts = GeoDataFrame.from_file('districts_WGS84.shp')
sections = GeoDataFrame.from_file('sections_WGS84.shp')
districts.crs == sections.crs #To be sure the files share the same crs
#The following line returns an empty array, but it should return all seccions within a district
print len(sections[sections.contains(districts.geometry[34]) == True])
# districts.geometry[34] is a fixed discrict in order to run a test
#The following line returns the list of all sections within the district plus adjacent ones
print len(sections[sections.intersects(districts.geometry[34]) == True])
Is there any problem with how I'm trying to get it or is a problem with the method itself?
Here there are the shapefiles to repeat my problem:
Districts: https://ufile.io/0a6f1
Sections: https://ufile.io/e2463
Regards.
| 3b94c5e4b67fbc123c788a7f7bd1fe4aefa8b175ad28676043784eb32ae13e59 | ['2d9792d123ca4ba18edfad7283c13616'] | Regards.
I'm Struggling trying to figure out how to do the next operation in pandas:
I have a csv file with timestamps of stations like the following:
head of the file
The next thing I do is the following pivot_table using pandas:
trips.pivot_table('bike', aggfunc='count',
index=['date', 'hour'],
columns='station_arrived').fillna(0)
returning something like this:
enter image description here
My Problem is the following:
I want to reindex the 'hour' column to have indexes from 0 to 23 hours per day, even if there aren't counts that day.
Doing reindex with only one index is easy, but things get complicated when I'm trying this in a multiindex dataframe
Is there any way to make that possible?
|
359b2925ada959818b72d835deba35787c90213295665085d667517e093dbeec | ['2dab20cba8f548a682d798a695a54406'] | I have Resource server and Authorization server, both are working fine when I use Postman to generate to token from authorization server and then use Get request with that token, and then I see the text in my Resource server.
Is there way to create similar Client application in Spring Boot to fill the same function as postman does? Checks if user has token, if not then sends me to Authorization server where user can login, and then takes the user back with the token to see the message what is on Resource server.
| c6b1a7e4e96db11419bb45e57498446cadd1937dbec376a09470d310cd3f9bd9 | ['2dab20cba8f548a682d798a695a54406'] | I have a dictionary that has has filename like 1.xml and then the DeviceIDs like 3 and 12.
{'1.xml': ['3', '12'], '2.xml': ['23', '17''], '3.xml': ['1', '12']}
And I have a code that compares the DeviceIDs and displays when there are duplicates. Right now it only works when all of the files include the DeviceID.
When running this code:
it = iter(dict.values())
intersection = set(next(it))
print(intersection)
for vals in it:
intersection &= set(vals)
it returns
set()
because the DeviceID is only in first and third file, but not in second. Can someone help me to modify this code to get it to display the DeviceID when it is only a duplicate in some of the files?
|
02c9a003b300d415a6ffa1d7a2de1e9a3fd5be9feea8a42a85c2b66fc6dc2921 | ['2db04fcf1aa541c4bcc3e354a539e5b2'] | I've just started with fabric.js, and I want to draw a grid I've found this function but, I have the error : "Cannot read property 'moveTo' of undefined , I suppose I'm not in the correct scope, maybe I'm not sure...
this is my code:
<html>
<head>
<script type='text/javascript' src='http://code.jquery.com/jquery-1.7.1.js'></script>
<script type='text/javascript' src='http://cdnjs.cloudflare.com/ajax/libs/fabric.js/1.2.0/fabric.all.min.js'></script>
</head>
<body>
<canvas id="canvas" width="800" height="450" style="border:1px solid #000000"></canvas>
<script>
var canvas = new fabric.Canvas('canvas');
canvas.add(new fabric.Circle({ radius: 30, fill: '#f55', top: 100, left: 100 }));
canvas.selectionColor = 'rgba(0,255,0,0.3)';
canvas.selectionBorderColor = 'red';
canvas.selectionLineWidth = 5;
draw_grid(100);
//this is the function I found
function draw_grid(grid_size) {
grid_size || (grid_size = 25);
currentCanvasWidth = canvas.getWidth();
currentcanvasHeight = canvas.getHeight();
// Drawing vertical lines
var x=0;
for (x = 0; x <= currentCanvasWidth; x += grid_size) {
this.grid_context.moveTo(x + 0.5, 0);
this.grid_context.lineTo(x + 0.5, currentCanvasHeight);
}
// Drawing horizontal lines
var y;
for (y = 0; y <= currentCanvasHeight; y += grid_size) {
this.grid_context.moveTo(0, y + 0.5);
this.grid_context.lineTo(currentCanvasWidth, y + 0.5);
}
grid_size = grid_size;
this.grid_context.strokeStyle = "black";
this.grid_context.stroke();
}
</script>
</body>
</html>
| 9881c3a0edeff18be61236b3ccc669bf2076abe3ee5693d323dedfef287cc953 | ['2db04fcf1aa541c4bcc3e354a539e5b2'] | I have this function on my code, and give me this error:
syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ')' on line 25
I cant find the error maybe you can see what I can't D:
public function InsertHero()
{
$this->load->view('Header');
$this->load->view('HeroForm');
$this->load->view('Footer');
$data = array(
'Name' -> $this -> input -> post('nick'), //this is the line 25
'Power' -> $this -> input -> post('superpower'),
'Phone' -> $this -> input -> post('phone'),
'Email' -> $this -> input -> post('mail'),
'Category' -> $this -> input -> post('category_id')
);
$this->model_heroes->insert($data);
redirect(base_url());
}
|
5e5e6a6796c5cea5231899724f9adf7347125ddb125088f591efc0b2ae51e8d6 | ['2db6392758c5458297937e0aa0d078c4'] | I faced with the same issue and it was hard to figure out from the documentation here to understand that path to browsermob-proxy server should also include executable.
In your case the code should be the next:
require 'selenium-webdriver'
require 'browsermob/proxy'
server = BrowserMob<IP_ADDRESS>Proxy<IP_ADDRESS>Server.new "E:\browsermob\browsermob-proxy-2.0-beta-8\browsermob-proxy"
server.start
Hope it helps
| a60c53927ec057a54391a6014c078461de4619b2d90fb6fd37791e56e35eb433 | ['2db6392758c5458297937e0aa0d078c4'] | I faced with the same issue and it was hard to figure out from the documentation here to understand that path to browsermob-proxy server should also include executable.
In your case the code should be the next:
require 'selenium-webdriver'
require 'browsermob/proxy'
server = BrowserMob<IP_ADDRESS>Proxy<IP_ADDRESS>Server.new ".//browsermob-proxy-2.0-beta-8//bin//browsermob-proxy.bat"
server.start
Hope it helps
|
fb37f6cca3f2a12a96e2c838a3f6c9a42cf091f5be7de4281a70ca01e56a8d7d | ['2dcda9b03d054726ad483ceedfba8c6f'] | Wildcard ssl can be used with multiple subdomains of a domain.So it's cost is high. I f you have multiple subdomains under a domain, you need to purchase a wildcard ssl.
Wildcard certificates secure the common name and all subdomains at the level you specify when you submit your request. Just add an asterisk (*) in the subdomain area to the left of the common name.
| ffd54e6e455294459985f34d5109f246388163f0a42dc26f04aa19860341aaf9 | ['2dcda9b03d054726ad483ceedfba8c6f'] | You can set permissions using svn authz file. First of all, we need to create an Access Control file.
sudo nano /etc/apache2/svn_access_control
User Groups
You can create groups of users and then use those for rules. You do this under a special heading in square brackets:
[groups]
mygroup = <PERSON>, <PERSON>
This will create a group called ‘mygroup’ which ‘<PERSON>’ and ‘<PERSON>’ belongs to.
And now for some examples. Examples
[groups]
team = <PERSON>, <PERSON> = <PERSON>, <PERSON>, <PERSON>
[/]
@team = r <PERSON> = rw
[/wowapp/trunk]
@team = r @devteam = rw <PERSON> = rw
In this example:
Created a group team which has two members; <PERSON> and <PERSON>.
Created another group, called devteam which has three members; <PERSON>, <PERSON>, <PERSON>.
In the root of the repository, I’ve given the group team read permissions.
Also, in the root, <PERSON> has read and write permissions.
In the trunk of wowapp, the group team has read permission.
Also, the devteam group has read and write permissions.
And another user, called <PERSON> has read and write permissions.
You need to add is the following line in apache svn configuration file.
AuthzSVNAccessFile /etc/apache2/svn_access_control
So that the file looks like this:
<Location /svn>
DAV svn
SVNPath /home/svn
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile /etc/apache2/dav_svn.passwd
AuthzSVNAccessFile /etc/apache2/svn_access_control
Require valid-user
</Location>
Save the file, and then restart Apache2:
sudo /etc/init.d/apache2 restart
You should now have access control working for Subversion over Apache2.
|
13cefe8527a9a77496e36a1c3fe123a2ff3cbe03516bee923c8fafa9ff92c850 | ['2df4120632434081b351cfc7d22cd1de'] | in my form when i check both checkboxes i would like for a messagebox to displayed.
both checkboxes linked to one messagebox. i have tried different messagebox functionality but all end up displaying the messagebox when one check box is marked.
if (e.KeyCode == Keys.Q)
checkBox1.Checked = !checkBox1.Checked;
if (e.KeyCode == Keys.A)
checkBox2.Checked = !checkBox2.Checked;
MessageBox.Show("task completed", "form1");
| 4345d53ac8ec55b03d8a797e6113ffcac84df1753a1bf2e427fa2eee184f61b6 | ['2df4120632434081b351cfc7d22cd1de'] | well i'm new to c# and i'm using Visual studio 2012.
i'm trying to make a checkbox with the appearance of a button.
when a keyboard key is pressed i would like for it to show the same way when the mouse clicks a button. If i hit the A key the button/checkbox is pressed down and if A key is hit again the button/checkbox is raised up.
i got this to work with just the button1 but i can't get it to show the pressing of the button by using this code
switch (e.KeyCode)
{
case Keys.D1:
// Simulate clicks on button1
ShowPictureButton.PerformClick();
break;
default:
break;
}
i figured i can use a checkbox so it will stay down when pressed.
|
50afbc8019a219d387827e472c5e8bb198429f34e7fd1244ffe11b0da2e3e1d8 | ['2e014f3cc4f24512a7ca24b8cadabdcd'] | I have a requirement where I have a bunch of email, name, and other customer info in a PySpark dataframe. All my email fields are masked except one and I want to get the name of that field in the new column that I generate.
def add_base_col(df):
for name in df.schema.names:
df1 = df.withColumn("is_base", F.when(df[name].like("%*%"), None).otherwise(name))
return df1
I know the above code over writes the new field that I am creating and just gets me the last column name in the dataframe, so I am not really sure how to do it correctly.
Name Email1 Email2 Email3 Email4 Phone is_base
ABC <EMAIL_ADDRESS> <EMAIL_ADDRESS> <EMAIL_ADDRESS> <EMAIL_ADDRESS> 123459684 Email1
XYZ <EMAIL_ADDRESS> <EMAIL_ADDRESS> <EMAIL_ADDRESS> <EMAIL_ADDRESS> 237623747 Email2
The other approach I found was this, but did not help me either
df.withColumn("is_base",
F.coalesce(*[F.when(~F.col(c).like('%*%'), c) for c in df.columns])
).show()
| e3d92f90249f474785b51ae75e4ef9869c8c1307465321a73f2fa34f63f06b4d | ['2e014f3cc4f24512a7ca24b8cadabdcd'] | I have a use case where I need to generate a JSON for each line in text file and do a post request to an API. This is what the file looks like:
Member_ID,Login_ID,First_Name,Last_Name,Entity
ID1,Jim1,Jim,Kong,Entity1
ID2,OlilaJ,Olila,Jayavarman,Entity1
ID3,LisaKop,Lisa,Kopkingg,Entity1
ID4,KishoreP,Kishore,Pindhar,Entity1
ID5,Gobi123,Gobi,Nadar,Entity1
I am new to the API world, so I want to know how can I do a post call with just the Member_ID and Login_ID parameters. The output for each line being successfully posted to the api needs to be shown as a log.
|
86345d39c0d14947f1fe6c49018d3cd56fca60ff963b338cb1359786a1472b19 | ['2e28ef4275234e72a244e62b59a9b360'] | I have read your answer in another post. hmm..I am a little bit understand about the multiplication of a function with its inverse will result a unity matrix, if that is what you meant.
so , I tried to do that like in my EDIT 2. I am not sure though whether that is what you meant. But still I cannot end up with the one like in your answer here. | c844eed47534e8aa9ce0c1c9a64777d6aa6ae111f8a31cc449277ff79e22899b | ['2e28ef4275234e72a244e62b59a9b360'] | Yes, I want to solve for $x$ so $y$ is real.
I will get $y$ in my discriminant equation if I follow your suggestion, (I did this kind of rearrangement before for other purpose in this same physics problem i am facing).
if so, the discriminant will depend on $y$, how to deal with that? |
67348f1a36cf08962552579ce758448133e99dbe923bc8efb6f8f48abdac4963 | ['2e343d77609b48f6ac7a60cf7ed3d38d'] | Try with {{#each items.item1}}
Because, Col.find({},{item1:1}) just remove all other field from result.
Limit Fields to Return from a Query
It's like SELECT item1 FROM table in SQL
If you need repeat your template for each item in item1, you need to precise which array should be use.
<template name="temp">
{{#each items.item1}}
{{> anotherTemplate}}
{{/each}}
</template>
| d60124d97cfa3fcfc6f56ed591019c95d7a9bb19696862cf02632b4afbb6ffc6 | ['2e343d77609b48f6ac7a60cf7ed3d38d'] | I think the problem comes from here:
Router.route('/jobs/create', {name: 'jobCreate'});
The "create" is used as "id" on your route 'jobCreate'
Just try something like this
Router.route('/jobs/view/:_id/', {
name: 'jobPage',
data: function() { return Jobs.findOne(this.params._id); }
});
// route to edit a job post
Router.route('/jobs/edit/:_id/', {
name: 'jobEdit',
data: function() { return Jobs.findOne(this.params._id); }
});
Router.route('/jobs/create/', {name: 'jobCreate'});
EDIT:
The source of problem is here:
Router.route('/jobs/:_id/', {
All path after /jobs/ is used as :id
|
b1d4e09399fb5e153955c1efa58df7f4fb8b01ffd7a36542505a3d42dd4e9f92 | ['2e4ec791a7e84503be593c7f7bdd7bcd'] | I have a problem with a program that I am building that saves test results to a file on my school's local drive. The problem is, when I try to save test results to a file that I choose with a JFileChooser, the program throws a java.io.FileNotFoundException. Here is the code for my method that serializes test results to a file.
@Override
public void testEnded() {
start.setEnabled(true);
pause.setEnabled(false);
end.setEnabled(false);
results.setVisible(false);
panel.setVisible(false);
cheatSheet.setEnabled(true);
tableTest.setEnabled(true);
TestEntryEvent event = new TestEntryEvent(name, panel.getCorrectCount(), panel.getIncorrectCount());
if(panel.getTotalCount() == 158) {
LinkedList<TestEntry> entries = new LinkedList<TestEntry>();
TestEntry entry = new TestEntry(event.getName(), event.getCorrect(), event.getIncorrect());
ObjectInputStream ois = null;
File file;
if(JOptionPane.showConfirmDialog(MainFrame.this, "This test has been completed with " + panel.getCorrectCount() + " questions correct out of " + panel.getTotalCount() + "\nWould you like to save the results?", "Test Completed", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
if(chooser.showSaveDialog(MainFrame.this) == JFileChooser.APPROVE_OPTION) {
file = new File(chooser.getSelectedFile().getName());
try(FileInputStream fis = new FileInputStream(file)) {
try {
ois = new ObjectInputStream(fis);
} catch (EOFException e) {
}
try {
if(ois != null) {
entries = (LinkedList<TestEntry>)ois.readObject();
}
} catch (EOFException e) {
}
if(entries == null) {
entries = new LinkedList<TestEntry>();
}
entries.add(entry);
if(ois != null) {
ois.close();
}
} catch (IOException | ClassNotFoundException e1) {
JOptionPane.showMessageDialog(MainFrame.this, "An error occurred! This was the message: " + e1.getClass());
}
try(FileOutputStream fos = new FileOutputStream(file)) {
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(entries);
oos.close();
} catch (IOException e) {
JOptionPane.showMessageDialog(MainFrame.this, "An error occurred! This was the message: " + e.getClass());
}
}
}
control.addTestEntry(entry);
testTable.refresh();
control.deleteEntries();
}
if(panel.getTotalCount() < 158) {
JOptionPane.showMessageDialog(MainFrame.this, "You did not complete all questions on the test!", "Test Incomplete", JOptionPane.INFORMATION_MESSAGE);
}
panel.setCorrectCount(0);
panel.setIncorrectCount(0);
panel.setTotalCount(0);
panel.setCorrectLabel("Correct: " + panel.getCorrectCount());
panel.setIncorrectLabel("Incorrect: " + panel.getIncorrectCount());
testing = false;
roots.clear();
}
When I create a file on the local drive of my school's network where I can serialize the test results to, and run the test on the same computer and serialize the test results, then it works and the file is found! However, when I use a different computer to run the program and serialize results to the local drive file that I created on another computer, it gives me a java.io.FileNotFoundException. Any help would be greatly appreciated.
| 9bbba17073384a6487e275c9de56c50710ed99318b7d454fd2e7508ed2f4fcf4 | ['2e4ec791a7e84503be593c7f7bdd7bcd'] | I have a method in my program that reads from a file, and I have associated with both a FileInputStream variable and an ObjectInputStream variable. However, I do not know how many objects will be serialized in the file when I run the program, so I do not know how many objects to deserialize using the method readObject(). This is the method from my project:
public void importResults(File file) throws FileNotFoundException, IOException, ClassNotFoundException {
TestEntry entry = null;
try(FileInputStream fis = new FileInputStream(file)) {
ObjectInputStream ois = new ObjectInputStream(fis);
tests.clear();
entry = (TestEntry)ois.readObject();
tests.add(entry);
ois.close();
}
}
The variable entry is where I will store TestEntry objects that I deserialize from the file. The problem is, if I try to deserialize too many objects, I get an EOFException. How do I get my program to figure out how many objects there are serialized in the file so I can deserialized the right amount? Any help will be greatly appreciated! Thank you.
|
196bce3bcb45b84673e8c86ee8039c8976e9a10b1260c25a58c12f8fee6f7619 | ['2e504652371e4be89792940cd99d7028'] | Sending emails with SendGrid
Works just fine on my local (code below)
No source control, just a straight WebDeploy of the same code to AzureWebsites yeilds the error below. SendGrid support have no clue.
Exception Details: System.Net.Sockets.SocketException:
[SocketException (0x271d): An attempt was made to access a socket in a way forbidden by its access permissions]
CodeScales.Http.HttpClient.Navigate(HttpRequest request, HttpBehavior httpBehavior) +772
CodeScales.Http.HttpClient.Execute(HttpRequest request) +45
SendGridMail.Transport.REST.Deliver(ISendGrid message) +115
public bool SendEmail(string from, string to, string subject, string content)
{
var myMessage = SendGrid.GenerateInstance();
// Setup the email properties.
myMessage.From = new MailAddress(from);
myMessage.AddTo(to);
myMessage.Text = content;
myMessage.Subject = subject;
var username = "#####";
var pswd = "#####";
var credentials = new NetworkCredential(username, pswd);
// Get REST instance for sending email.
var transportREST = REST.GetInstance(credentials);
// Send the email.
transportREST.Deliver(myMessage);
return true;
}
| 7cad08b41d494dcb7eb3e87a9515f2e9d46b5033804ba8b5314d41a262e7914d | ['2e504652371e4be89792940cd99d7028'] | Issue with css binding, it is deep in the app but I will try and extract the bug to fiddle unless..... (fingers crossed) you know or can guess at what's happening from the following, It seems as you can see below I've got it rendering character indexes of the class string I'm trying to add, clearly not what we want:
THE TEMPLATE:
<section data-bind="css: type" class="toolbox-tool">
<span data-bind="text: type"></span>
<label data-bind="attr: {for: id}"/>
<img data-bind="attr: {src: imageSource}"/>
</section>
THE RENDERED MARKUP
<section data-bind="css: type" class="toolbox-tool 0 1 2 3 4 5 6 7 8 9 10 ui-draggable">
<span data-bind="text: type">text-ticker</span>
<label data-bind="attr: {for: id}" for="2"></label>
<img data-bind="attr: {src: imageSource}" src="#">
</section>
|
41aaf8f7c1d44165f042ebc4a256dc45660d2e8e1388705235681eb122b84036 | ['2e51c47238f74f4abe80ec59ec014f54'] | I am making an android application that needs to save listview items to the sdcard. I am using a dynamic listview that the users can delete items from and add items to. I want the listview to save the items if the application gets destroyed or if the user hits the back button. Basically when the activity is destroyed. Please help and thanks SO much in advance! I am using this code so far:
public class NotesActivity extends ListActivity implements OnClickListener {
/** Called when the activity is first created. */
List<String> myList = new ArrayList<String>();
EditText AddItemToListViewEditText;
Button AddItemToListView, AddItemToListViewButton, CancelButton, DeleteButton,CancelButton2, DeleteAllButton;
LinearLayout AddItemToListViewLinearLayout, DeleteItemFromListViewLinearLayout, DeleteAllItemsFromListViewLinearLayout;
public int DeleteIndexNumber;
static final String[] COUNTRIES = new String[] {
"Matte på A1 med Ole", "Engelsk på klasserommet", "Film på A1 etter friminuttet"
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.notes);
setListAdapter((ListAdapter) new ArrayAdapter<String>(this, R.layout.list_item, COUNTRIES));
setListAdapter((ListAdapter) new ArrayAdapter<String>(this, R.layout.list_item, myList));
ListView lv = getListView();
lv.setTextFilterEnabled(true);
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(), "Note: " + ((TextView) view).getText(),
Toast.LENGTH_SHORT).show();
DeleteIndexNumber = position;
DeleteItemFromListViewLinearLayout = (LinearLayout)findViewById(R.id.DeleteItemFromListViewLinearLayout);
DeleteItemFromListViewLinearLayout.setVisibility(View.VISIBLE);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu meny) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.listviewmenubuttons, meny);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.AddItemToListView:
AddItemToListViewButton = (Button)findViewById(R.id.AddItemToListViewButton);
CancelButton = (Button)findViewById(R.id.CancelButton);
DeleteButton = (Button)findViewById(R.id.DeleteButton);
CancelButton.setOnClickListener(this);
DeleteButton.setOnClickListener(this);
AddItemToListViewLinearLayout = (LinearLayout)findViewById(R.id.AddItemToListViewLinearLayout);
AddItemToListViewButton.setOnClickListener(this);
AddItemToListViewLinearLayout.setVisibility(View.VISIBLE);
break;
case R.id.DeleteAllNotes:
DeleteAllItemsFromListViewLinearLayout = (LinearLayout)findViewById(R.id.DeleteAllItemsFromListViewLinearLayout);
DeleteAllItemsFromListViewLinearLayout.setVisibility(View.VISIBLE);
CancelButton2 = (Button)findViewById(R.id.CancelButton2);
DeleteAllButton = (Button)findViewById(R.id.DeleteAllButton);
CancelButton2.setOnClickListener(this);
DeleteAllButton.setOnClickListener(this);
break;
}
return true;
}
public void onClick(View src) {
switch(src.getId()) {
case R.id.AddItemToListViewButton:
AddItemToListViewEditText = (EditText)findViewById(R.id.AddItemToListViewEditText);
myList.add(AddItemToListViewEditText.getText().toString());
((ArrayAdapter)getListView().getAdapter()).notifyDataSetChanged();
AddItemToListViewEditText.setText("");
AddItemToListViewEditText.clearFocus();
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.toggleSoftInput (InputMethodManager.SHOW_FORCED, InputMethodManager.RESULT_HIDDEN);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
AddItemToListViewLinearLayout.setVisibility(View.GONE);
break;
case R.id.CancelButton:
DeleteItemFromListViewLinearLayout = (LinearLayout)findViewById(R.id.DeleteItemFromListViewLinearLayout);
DeleteItemFromListViewLinearLayout.setVisibility(View.INVISIBLE);
break;
case R.id.DeleteButton:
myList.remove(DeleteIndexNumber);
((ArrayAdapter)getListView().getAdapter()).notifyDataSetChanged();
DeleteItemFromListViewLinearLayout = (LinearLayout)findViewById(R.id.DeleteItemFromListViewLinearLayout);
DeleteItemFromListViewLinearLayout.setVisibility(View.INVISIBLE);
break;
case R.id.DeleteAllButton:
myList.removeAll(myList);
((ArrayAdapter)getListView().getAdapter()).notifyDataSetChanged();
DeleteAllItemsFromListViewLinearLayout = (LinearLayout)findViewById(R.id.DeleteAllItemsFromListViewLinearLayout);
DeleteAllItemsFromListViewLinearLayout.setVisibility(View.INVISIBLE);
break;
case R.id.CancelButton2:
DeleteAllItemsFromListViewLinearLayout = (LinearLayout)findViewById(R.id.DeleteAllItemsFromListViewLinearLayout);
DeleteAllItemsFromListViewLinearLayout.setVisibility(View.INVISIBLE);
break;
}
}
}
| 6ba24d5d0188fbcaf4daf7296b6da1e2a6c4fd8e8ca2d9d69d93f2ecf4ad5047 | ['2e51c47238f74f4abe80ec59ec014f54'] | I am making an android application that uses these views:
(Root) - LinearLayout
(Child of root) - ListView + 3 other linearlayouts beneeth that listview. But once i add to many items to the listview, the layouts are being placed outside of the screen. Which i don't want to. How can i make this happen? So that all of the three linearlayouts stay on the screen, at the bottom??? Please help and thanks in advance!
My screen XML code:
<?xml version="1.0" encoding="utf-8"?>
LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background"
android:orientation="vertical" >
<TextView
android:id="@+id/NotesWelcomeTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/NotesWelcomeText" />
<ListView
android:id="@+android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView
<LinearLayout
android:id="@+id/DeleteAllItemsFromListViewLinearLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:visibility="invisible" >
<Button
android:id="@+id/CancelButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Cancel" />
<Button
android:id="@+id/DeleteAllButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Delete" />
</LinearLayout>
<LinearLayout
android:id="@+id/DeleteItemFromListViewLinearLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1"
android:visibility="invisible" >
<Button
android:id="@+id/CancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Cancel" />
<Button
android:id="@+id/DeleteButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/Delete" />
</LinearLayout>
<LinearLayout
android:id="@+id/AddItemToListViewLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:visibility="gone" >
<EditText
android:id="@+id/AddItemToListViewEditText"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_weight="1" >
</EditText>
<Button
android:id="@+id/AddItemToListViewButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/Add" />
</LinearLayout>
</LinearLayout>
|
bfda3af6695b6edb6c653deb0a6e175d20c4fe12e81a3e0e0c0ab94bc9a05438 | ['2e589acdaf184be9910a722e83611e1f'] | Manage to fix by downloading the latest rsync file directly from http://repo.msys2.org/msys/x86_64/ extracting it. Then copy rsync at ./usr/bin/rsync.exe and paste it into the /usr/bin folder of the Git installation.
On my machine, that is C:/Program Files/Git/usr/bin/
| 0d08c9a8beec5cf1e5bef3d68808b5ea0e7c7706ad048351248a5f8860961460 | ['2e589acdaf184be9910a722e83611e1f'] | I want to copy a file from a local machine to a remote machin. Im using gitbash (MINGW64) to run the following command but I get error bash: rsync: command not found
rsync -avz c/local/directory/image.png user@<IP_ADDRESS>:/remote/directory/
How do I install resync for gitbash?
I've read the following post (Why is rsync not found?) which mentions adding the path to resync as quick solution but what is the path for resync on windows?
rsync --rsync-path=/home/elbarna/bin/rsync -avz c/local/directory/image.png user@<IP_ADDRESS>:/remote/directory/
|
f628b3720370fe71c678781a943f0ba0d6a6ed6207e5d84bdb7c52d0c1f70d01 | ['2e59735335044cfc9c02bdde8fb044b6'] | I set up my "mercurial_server" as follows (except I used hgwebdir.cgi instead of hgweb.cgi) and I created a repo
hg init
then I create a local repo work on my code and then push my updates to the server (tortoisehg), they show up on the web, but not in the actual directory? Is this supposed to happen I cant find a write up on the database
| f6eeb731ca420ec0a4ea4153bb397d22118c11e9dcab153ccab9cfeebac58835 | ['2e59735335044cfc9c02bdde8fb044b6'] | You can find energy density of a photon gas, which is what the Unruh Effect would generate, here:
https://en.wikipedia.org/wiki/Photon_gas
Pressure would be 1/3 times U/V
A photon gas does not conserve photons. It is described by two variables: temperature and volume.
Since you only need acceleration (or an equivalent gravitational field) to calculate the Unruh Effect Temperature, and all you need is Temperature and Volume to determine the internal energy of a photon gas, calculating the temperature per unit of volume should be relatively straightforward. Making sure that the units match (Lorentz–Heaviside, Gauss, etc.) might be the hardest part.
|
e49267b45947aec2b10f3c10b1a00771d18016d5808ff566de2257cb0433607d | ['2e621955f5b34cdfbf9cca8569476af3'] | We have a large MongoDB collection with ~10 millions of documents and we need to process them in some way and export our data into files.
To do so we need to read every record from the collection via cursor.
MongoDB runs inside docker swarm mode so it has some network instability and sometimes we face Socket Exception: Connection reset.
WARN org.mongodb.driver.connection - Got socket exception on connection
to localhost:27017. All connections to localhost:27017 will be closed.
It occurs at random time (sometimes it doesn't appear at all) and MongoDB Java driver immediately closes the connection and stops processing.
But when I use Nodejs mongodb driver it works fine and doesn't fail at all.
Maybe I'm missing some options or something?
We're using MongoDB 3.4 and mongodb-driver-async 3.4 from maven.
| 01cdc3aad1e05accd02c505b4a76b5218349a14d055486cbe32b02c515141bd0 | ['2e621955f5b34cdfbf9cca8569476af3'] | I have a relatively large neo4j graph with 7 millions vertices and 5 millions of relations.
When I try to find out subtree size for one node neo4j is stuck in traversing 600,000 nodes, only 130 of whom are unique.
It does it because of cycles.
Looks like it applies distinct only after it traverses the whole graph to maximum depth.
Is it possible to change this behaviour somehow?
The query is:
match (a1)-[o1*1..]->(a2) WHERE a1.id = '123' RETURN distinct a2
|
996964c7ea869b1770ad7c48117441cfaaead0aa629c982916f17ba7049b797d | ['2e6e2a1e8d4545c9bdd57cca8d4b8a2f'] | <?php
$begin = new DateTimeImmutable('19:00');
$end = new DateTimeImmutable('24:30'); // Last 30 min will not be inclued (see output)
$interval = new DateInterval('PT30M'); // Interval 30 min
$daterange = new DatePeriod($begin, $interval ,$end);
$ranges = [];
foreach ($daterange as $key => $range) {
$ranges[$key] = $range->format('H:i');
if($key>0) {
$ranges[$key-1] .= ' - '.$range->format('H:i');
}
}
array_pop($ranges);
print_r($ranges);
Output:
Array
(
[0] => 19:00 - 19:30
[1] => 19:30 - 20:00
[2] => 20:00 - 20:30
[3] => 20:30 - 21:00
[4] => 21:00 - 21:30
[5] => 21:30 - 22:00
[6] => 22:00 - 22:30
[7] => 22:30 - 23:00
[8] => 23:00 - 23:30
[9] => 23:30 - 00:00
)
| f30810b9b9fd3227b3baec4d26dc438fc95d9c43497f41ea577cf20662be795a | ['2e6e2a1e8d4545c9bdd57cca8d4b8a2f'] | This might look sth like this:
if ($all_taxes)
{
foreach ($all_taxes as $tax)
{
$t = new BusinessTaxProfile($tax->getId());
$subprofile = BusinessTaxSubProfileManager<IP_ADDRESS>getBusinessSubProfiles($tax->getId(), 1);
$t->sub = (int)!empty($subprofile);
$tax_array[] = (string)$t;
}
}
But You have to edit BusinessTaxProfile __toString() method also because I think there is generating json output.
Show BusinessTaxProfile then I'll edit my answer to fit.
|
21019b9f374f884e67fc0f62c9d26793e626cac9eef9eccdbb4219a28956d2ef | ['2e70d38fb58d470db71f536bc345616d'] | Hello Stack Overflow Community,
I am trying to figure out how to access a variable declared inside render from a function that is outside render, I do not fully understand how to go about doing this because I am very new to React-Native and I believe solving this one thing will give me a good understand of how scope works in this language. For my project I access user data through this.props, however when I try to pass this data to an outside function it seems to fail with what I assume has to do with scope. I simplified my code just to the parts that matter, pagination is the function outside of render() when I try to access the variable indicator declared in render it cannot find the variable. I am getting user data from this.props. Thank you in advance!
get pagination () {
length = indicator
}
render () {
const { wrap,image, images, auto, button, indicator} = this.props
return(
<View>
{ this.pagination }
</View>
)}
| 6a112e081b2990e3121c627f301298b4e3815a093c121043e06811e375421c76 | ['2e70d38fb58d470db71f536bc345616d'] | Hello Stack overflow community,
Thank you in advance for the help I am a rather new to react native.
For this project i have imported the library nuka-carousel.
So what I am trying to do is to take in a dynamic list of images and place them into a carousel object. I am unsure of 1 how to fetch the data and 2 how to have a loop that would place them all into the same object. Right now I have it set up to take static inputs but I would like it to be dynamic.
This is what the image list data looks like
[{"id":4,"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":4,"record":{"id":4,"c_dzp64j57b0pm6b8clmddapump":"test4","created_at":"2020-06-11T18:16:36.443Z","updated_at":"2020-06-11T18:16:36.443Z","c_55pk7oxu728xufdeh6st6fplh":{"url":"68ca15c0503a7bc6850d9e8f52d2e3a4302b75a00d6b6b48b759980f02f4ee56.gif","size":13473,"width":300,"height":300,"filename":"file.gif"},"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":4}}}},{"id":3,"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":3,"record":{"id":3,"c_dzp64j57b0pm6b8clmddapump":"test1","created_at":"2020-06-11T16:29:14.713Z","updated_at":"2020-06-11T18:15:24.949Z","c_55pk7oxu728xufdeh6st6fplh":{"url":"19cb397219e0e95d9a0ebc42de7d6012a9b5965b5eca112ef37f0ff374642c01.jpg","size":5557,"width":275,"height":183,"filename":"file.jpg"},"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":3}}}},{"id":2,"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":2,"record":{"id":2,"c_dzp64j57b0pm6b8clmddapump":"test2","created_at":"2020-06-11T16:29:04.801Z","updated_at":"2020-06-11T18:15:07.995Z","c_55pk7oxu728xufdeh6st6fplh":{"url":"75dcb52136d892cf5fad9637f650231fae1f33599739a99678517bf959a07ae9.jpg","size":7595,"width":284,"height":177,"filename":"file.jpg"},"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":2}}}},{"id":1,"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":1,"record":{"id":1,"c_dzp64j57b0pm6b8clmddapump":"test3","created_at":"2020-06-11T16:28:59.989Z","updated_at":"2020-06-11T18:15:15.956Z","c_55pk7oxu728xufdeh6st6fplh":{"url":"ec4bdfcb37766426fe5f22ee521556131233480f877f13c4c3716dca7c6a5d2b.jpg","size":5503,"width":168,"height":300,"filename":"file.jpg"},"_meta":{"datasourceId":"97578cbb11844a92914b7ed8eb174929","tableId":"t_0sspte5yfnottg3npjqxbf7k5","id":1}}}}]
I want to be able to put the urls from this data into carousel.
This is the code I have now it is currently hardcoded. The list of images is called images
return (
<Carousel renderCenterLeftControls={false} renderCenterRightControls={false} renderCenterLeftControls={({ previousSlide }) => (
<button onClick={previousSlide}> <Icon name={button.Previcon} size={28} color={button.Prevcolor} /> </button>
)} renderCenterRightControls={({ nextSlide }) => (
<button onClick={nextSlide}> <Icon name={button.Nexticon} size={28} color={button.Nextcolor} /> </button>
)} defaultControlsConfig={{
pagingDotsStyle: {
fill: Indicator.Secondarypcolor,
}
}} >
<img src="https://images.squarespace-cdn.com/content/v1/5a5906400abd0406785519dd/1552662149940-G6MMFW3JC2J61UBPROJ5/ke17ZwdGBToddI8pDm48kLkXF2pIyv_F2eUT9F60jBl7gQa3H78H3Y0txjaiv_0fDoOvxcdMmMKkDsyUqMSsMWxHk725yiiHCCLfrh8O1z4YTzHvnKhyp6Da-NYroOW3ZGjoBKy3azqku80C789l0iyqMbMesKd95J-X4EagrgU9L3Sa3U8cogeb0tjXbfawd0urKshkc5MgdBeJmALQKw/baelen.jpg?format=1500w" />
<img src="https://via.placeholder.com/400/ffffff/c0392b/&text=slide2" />
<img src="https://via.placeholder.com/400/ffffff/c0392b/&text=slide3" />
<img src="https://via.placeholder.com/400/ffffff/c0392b/&text=slide4" />
<img src="https://via.placeholder.com/400/ffffff/c0392b/&text=slide5" />
<img src="https://via.placeholder.com/400/ffffff/c0392b/&text=slide6" />
</Carousel>
)
All of the carousel stuff works but I need to be able to put those urls inside the carousel but when I have tried to put a loop inside the tag it breaks.
|
f1d1ab7bd824e7b6a17b3aa88449602a4b540c432727cb336094469dc5238461 | ['2e8ad7db52d349fb9b9505411dbd1865'] | <PERSON> I see it useful with complex statements which are difficult to understand: A complex shell call which requires a half dozen variables can be encapsulated in a `sign_mail(...)`, which makes it immediately clear what that is supposed to do, and you don't have to waste brain power on it unless you want to troubleshoot the mail signature. Compared to an inline 200 character long `subprocess.check_call(shlex.split("openssl smime -sign -binary..."))`. It also makes it easy to drop in a replacement signing method. | c701cdfe793c00c697623fcd5b0ad5464bb1f977dc369fa76a9b3a39f35c8961 | ['2e8ad7db52d349fb9b9505411dbd1865'] | Three machines are involved here.
Localhost where I do my development. AKA laptop.
Bastion host where you must connect first. AKA jump.
MySQL server where I want to connect to. AKA DB.
My ssh public key is in /home/myusername/.ssh/authorized_keys on jump.
My ~/.ssh/config has this:
Host jump
HostName jump.domain.com
User myusername
IdentityFile ~/.ssh/myprivatekey
I can ssh jump and get onto jump fine.
What ssh command do I need to run in terminal on Laptop in order to be able to connect from Laptop to DB via
mysql -h <IP_ADDRESS> -P 3308
I need an SSH tunnel and a port forwarding, but I have yet to get the syntax correct. I want to use 3308 for production DB and 3307 for staging DB and am running local MySQL DB on 3306, which is why port forwarding to non-standard mysql ports.
|
7556e485d4046422727f16fbd77aa4ab5f14377d6c9d49a3b532d5cbe71fc923 | ['2e8dddc22f5942d48106a0cd8b12cc04'] | For sample if I have this class:
class Item
def initialize
@i = 10
end
def value
@i ++ 1
end
end
# initialize the class
i = Item.new
Is if we call p i.value we get 11. Is it possible to modify this call somehow to get 12 when we run it instead of 11?
| 93f083469a8463f2e2d71528b211ed8e1c0b5f4019b5a96bb79bf6b6b8e93669 | ['2e8dddc22f5942d48106a0cd8b12cc04'] | XML:
<tickets>
<request day="tue">
<ticket>
<type>Tech Support</type>
<cust>9045</cust>
<status>pending</status>
<ticket>
<ticket>
<type>Account Support</type>
<cust>3344</cust>
<status>resolved</status>
<ticket>
</request>
<request day="wed">
<ticket>
<type>Tech Support</type>
<cust>9944</cust>
<status>new</status>
<ticket>
<ticket>
<type>Billing</type>
<cust>3344</cust>
<status>pending</status>
<ticket>
</request>
</tickets>
How do I write a select="" to match all of the cust element values, non repeating (if there are most than 1 request)?
|
457adc914060e1ff79864cb642582ca623333a35eea3fc7d9746928ba9b2ffb4 | ['2e8ffd7a0d094e1681c12c8f4a4b74d6'] | I have a validation that, when successful creates a session variable:
if( password_verify($password, $artist_password) ) { // if this is true
// create $_SESSION artist name
$_SESSION['artist_name'] = $artist_name;
return $artist_name;
} else {
echo "Incorrect Password";
}
This validation is initiated by an Ajax request.
If there are errors with the validation, I echo a message. This echoed message is received by the Ajax success method via the data argument.
$.ajax({
url: '../includes/login_validation.php',
type: 'post',
data: inputs,
success: function(data){
$("span#error_msg").html(data);
},
// returns 'Incorrect Password'
My problem is in defining the return response from the PHP file.
For example, when there's an error, the PHP script echoes a message and in turn this response is received and processed through the Ajax success method and placed into a html placeholder.
However, if the SESSION variable is assigned I want to return that data and include it in a redirect.
My question is, how can I discern between an echoed response as the return value and a returned value containing other data (e.g $_SESSION['artist_name']).
And if successful, how can I include it in my redirect so that the redirected page will have access to the session variable.
window.location.href="artistWorkshop.php"; // plus session variable
| 0069019d5f0484c3f132326b4f6a9a9a41d3ec50879f1c7bec4f2342986c8a50 | ['2e8ffd7a0d094e1681c12c8f4a4b74d6'] | Okay, so the problem came from using localhost as the DB_HOST parameter. Localhost is not correct in this situation.
The solution came from changing 'localhost' to the database server id which was found on my Plesk panel after clicking on the Database link and noting the 'database server' field for the database I was trying to connect to. The format is similar to an IP address: xx.xx.xxx.xx:xxxx (where x = a number). NOTE: the last 4 digits are a port number and are to be EXCLUDED when using them to connect to the database server.
The solution came from contacting the support team for Plesk which I found very late in my research (there's a tiny little blue sidebar on the far right of the screen that allows you to contact support - I didn't see this bar at first)
The information that support provided me related to the following link, where the same information can be provided. (I didn't put two and two together!)
https://support.godaddy.com/help/article/39/viewing-your-database-details-with-shared-hosting-accounts?countrysite=ca
|
460dd9b7bcd5ccfc492ee99faed0e7665625642aed057c990e0fa4e2c54c84ab | ['2ec1b752e3374e18bb38872beb02bb1d'] | Thanks for all the responses I was able to do this using, @jb-nizet's answer using JsonTypeInfo with JsonSubTypes.
Here are the annotations I used:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({@JsonSubTypes.Type(value = D.class, name = "D"),
@JsonSubTypes.Type(value = E.class, name = "E")})
Because I could not edit class C because of ownership reason I use this with a mixIn class. Here's how I created it:
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
@JsonSubTypes({@JsonSubTypes.Type(value = D.class, name = "D"),
@JsonSubTypes.Type(value = E.class, name = "E")})
abstract class CMixIn {
}
Here is how I used the mixIn class:
private ObjectMapper objectMapper = new ObjectMapper().addMixIn(C.class, CMixIn.class);
Now To serialize Object a of class A:
String serializedString = objectMapper.writeValueAsString(a);
To deserialize the above string:
objectMapper.readValue(serializedString, A.class);
| f4b986c9dbb5d6a0068e13c6f38910ebc957ca83e19b5bdab9a79e9017dd8e0b | ['2ec1b752e3374e18bb38872beb02bb1d'] | I want to add creation timestamp using DynamoDBAutoGenerateStrategy.CREATE to my items in dynamo db, my mapper is initialized with config: DynamoDBMapperConfig.SaveBehavior.UPDATE_SKIP_NULL_ATTRIBUTES, but when I check my item in Dynamo DB it doesn't get updated.
Similarly I also have DynamoDBAutoGenerateStrategy.ALWAYS, which gets updated on creating an item, I also checked aws code for DynamoDBAutoGenerator, it mentions there is some limitations of using CREATE with DynamoDBAutoGenerateStrategy.ALWAYS.: https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/datamodeling/DynamoDBAutoGenerator.java
Creation and lastUpdated Timestamps:
@DynamoDBAutoGeneratedTimestamp(strategy = DynamoDBAutoGenerateStrategy.CREATE)
@DynamoDBTypeConvertedTimestamp
private Long creationTimestamp;
@DynamoDBAutoGeneratedTimestamp(strategy = DynamoDBAutoGenerateStrategy.ALWAYS)
@DynamoDBTypeConvertedTimestamp
private Long lastUpdatedTimestamp;
Mapper Initialization:
@Provides
@Singleton
@Inject
public DynamoDbClient dynamoDbClientWithMapper(
@Named("standardAwsCred") AWSCredentialsProvider awsCredentials,
@Named("dynamodb.realm") String region) {
final DynamoDBMapperConfig.Builder configBuilder = new DynamoDBMapperConfig.Builder();
configBuilder.setSaveBehavior(DynamoDBMapperConfig.SaveBehavior.UPDATE_SKIP_NULL_ATTRIBUTES);
DynamoDBMapperConfig dynamoDBMapperConfig = configBuilder.build();
DynamoDBMapper dynamoDBMapper = new DynamoDBMapper(AmazonDynamoDBClientBuilder.standard()
.withCredentials(awsCredentials)
.withRegion(region)
.build(), dynamoDBMapperConfig);
return new DynamoDbClient(dynamoDBMapper);
}
How can I get this to work? I have a solution that is to not have DynamoDBMapperConfig or keep it as default while creating Mapper and pass it everytime I have to update an item, but I don't prefer using this way can anyone suggest how can I make the above code work?
|
96a32e1083c78bfc0320800d766e481a1c4022e576f945ff9d861388df8ec6c1 | ['2ece0376e0644e1a9c2f53ed922e0a7f'] | You can instantiate 2 Node.js servers - one for HTTP and HTTPS
You can also define a setup function that both servers will execute, so that you don't have to write much duplicated code.
Here's the way I did it: (using restify.js, but should work for express.js, or node itself too)
http://qugstart.com/blog/node-js/node-js-restify-server-with-both-http-and-https/
| 5b24f22d904df200e627dc2c736c857601c8f6ce64651239b681226d710ddf23 | ['2ece0376e0644e1a9c2f53ed922e0a7f'] | Rails is a bit confusing, but I had a similar problem. Here's some steps you can take to make sure you're not missing any small code issues. (this eventually led me to discover a syntax bug in the namespaced controller).
run bundle exec rake routes to generate a list of what route links to what controller and action. If this is good, then move to step 2. If not, fix your routes file and try again. (many good tutorials on this, so I won't go into detail)
Go into the rails console, and just load the controller class. If it doesn't work, you may have discovered a bug in syntax. Here's what happened on console when I tried to load the Api<IP_ADDRESS>V2<IP_ADDRESS>CampaignsController.
irb> Api<IP_ADDRESS>V2<IP_ADDRESS>CampaignsController
=> CampaignsController
Note: Rails is directing all requests to the wrong controller (based on Rails' fancy logic to load controller classes). It should goto Api<IP_ADDRESS>V2<IP_ADDRESS>CampaignsController, but instead it is loading CampaignsController.
You can also verify it in the console with:
> app.get '/api/v2/campaigns.json'
> app.controller.class
=> CampaignsController
# This is not the expected controller.
This ended up being a syntax problem in a class I was extending from the Api<IP_ADDRESS>V2<IP_ADDRESS>CampaignsController.
It was a bit mind-boggling, but hope this helps someone else.
|
36e1e2b33ec02310870d0295d859c462a3a24c1e37f507b6a4d4249cadd89fe4 | ['2edd5a3badac44f5858d91ebd2902c17'] | So the problem seems to be inside EditorComponent constructor(), where the editorState is set to empty as default(or should I say at first). And that probably overwrites our initialValues for the Editor Field.
constructor(props) {
super(props);
this.state = {
editorState: EditorState.createEmpty()
};
I didn't find a solution to solve this problem and finally use initialValues as intended, but I found an alternative to set default value for the Editor some string of HTML that we see fit.
Here is a Link to that solution:
https://github.com/jpuri/react-draft-wysiwyg/issues/357
| 2b0ecf093f8f93b0984600d04f47da9df022d423ca16690881e8fae93f256a87 | ['2edd5a3badac44f5858d91ebd2902c17'] | Hello and Thanks in advance.
I am trying to install a package with composer but at first it gave me an error about requiring ext-dom and ext-mbstring extensions, I solved that but now it's giving me this error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Conclusion: don't install illuminate/html v5.0.0
- Conclusion: remove laravel/framework v6.9.0
- Installation request for illuminate/html ^5.0 -> satisfiable by illuminate/html[5.0.x-dev, v5.0.0].
- Conclusion: don't install laravel/framework v6.9.0
- illuminate/html 5.0.x-dev requires illuminate/support ~5.0 -> satisfiable by illuminate/support[5.0.x-dev, 5.1.x-dev, 5.2.x-dev, 5.3.x-dev, 5.4.x-dev, 5.5.x-dev, 5.6.x-dev, 5.7.17, 5.7.18, 5.7.19, 5.7.x-dev, 5.8.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.33, v5.0.4, v5.1.1, v5.1.13, v5.1.16, v5.1.2, v5.1.20, v5.1.22, v5.1.25, v5.1.28, v5.1.30, v5.1.31, v5.1.41, v5.1.6, v5.1.8, v5.2.0, v5.2.19, v5.2.21, v5.2.24, v5.2.25, v5.2.26, v5.2.27, v5.2.28, v5.2.31, v5.2.32, v5.2.37, v5.2.43, v5.2.45, v5.2.6, v5.2.7, v5.3.0, v5.3.16, v5.3.23, v5.3.4, v5.4.0, v5.4.13, v5.4.17, v5.4.19, v5.4.27, v5.4.36, v5.4.9, v5.5.0, v5.5.16, v5.5.17, v5.5.2, v5.5.28, v5.5.33, v5.5.34, v5.5.35, v5.5.36, v5.5.37, v5.5.39, v5.5.40, v5.5.41, v5.5.43, v5.5.44, v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.16, v5.6.17, v5.6.19, v5.6.2, v5.6.20, v5.6.21, v5.6.22, v5.6.23, v5.6.24, v5.6.25, v5.6.26, v5.6.27, v5.6.28, v5.6.29, v5.6.3, v5.6.30, v5.6.31, v5.6.32, v5.6.33, v5.6.34, v5.6.35, v5.6.36, v5.6.37, v5.6.38, v5.6.39, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9, v5.7.0, v5.7.1, v5.7.10, v5.7.11, v5.7.15, v5.7.2, v5.7.20, v5.7.21, v5.7.22, v5.7.23, v5.7.26, v5.7.27, v5.7.28, v5.7.3, v5.7.4, v5.7.5, v5.7.6, v5.7.7, v5.7.8, v5.7.9, v5.8.0, v5.8.11, v5.8.12, v5.8.14, v5.8.15, v5.8.17, v5.8.18, v5.8.19, v5.8.2, v5.8.20, v5.8.22, v5.8.24, v5.8.27, v5.8.28, v5.8.29, v5.8.3, v5.8.30, v5.8.31, v5.8.32, v5.8.33, v5.8.34, v5.8.35, v5.8.36, v5.8.4, v5.8.8, v5.8.9].
- don't install illuminate/support 5.5.x-dev|don't install laravel/framework v6.9.0
- don't install illuminate/support v5.5.0|don't install laravel/framework v6.9.0
- don't install illuminate/support v5.5.16|don't install laravel/framework v6.9.0
- don't install illuminate/support v5.5.17|don't install laravel/framework v6.9.0
- don't install illuminate/support v5.5.2|don't install laravel/framework v6.9.0
- don't install illuminate/support v5.5.28|don't install laravel/framework v6.9.0
- don't install illuminate/support v5.5.33|don't install laravel/framework v6.9.0
- don't install illuminate/support v5.5.34|don't install laravel/framework v6.9.0
- Installation request for laravel/framework (locked at v6.9.0, required as ^6.2) -> satisfiable by laravel/framework[v6.9.0].
|
12a04020778ba0ca126ed01a8c75b8e9c8749376b36ed8a9e804d7749dd6a91c | ['2edf513b85974bccba637feeec645330'] | The proposition 2.9 of <PERSON> and <PERSON> syas that a sequence of $A$-modules
$$M'\xrightarrow u M \xrightarrow v M'' \rightarrow 0$$
is exact iff the dual sequence
$$0\rightarrow Hom (M'',N)\xrightarrow{\bar{v}} Hom(M,N)\xrightarrow{\bar{u}} Hom (M',N)$$
is exact for all $A$-modules $N$.
But I have trouble understanding the proof: Suppose the dual sequence is exact for all $A$-modules $N$, then since $\bar{v}$ is injective for all $N$, it follows that $v$ is surjective.
But I don't understand why it is true, please helps.
| 43076a15e9d826bcf92623b8b834fad27bcade02600111d3a315af7c835eaeab | ['2edf513b85974bccba637feeec645330'] | I have a friend who can be like this. I would call him chaotic, in the sense that it is used for alignments in D&D:
Chaos implies freedom, adaptability, and flexibility. On the downside, chaos can include recklessness, resentment toward legitimate authority, arbitrary actions, and irresponsibility. Those who promote chaotic behavior say that only unfettered personal freedom allows people to express themselves fully and lets society benefit from the potential that its individuals have within them.
-Wikipedia
Other possibilities include inconsiderate or divisive
|
8043dc01cde53c55dd110d89252eea5eef23c9a476fe9016397066a800655025 | ['2ee637f1c2f54117ae0d51c0ea79a514'] | Read what's in the file using getline. See sample code below:
ifstream InFile(argv[1], ios<IP_ADDRESS>in); /*Open file from arg[1]*/
std<IP_ADDRESS>string LineContent;
getline(InFile, LineContent); /*Save line per line */
With your line saved in a string, you can now transfer the data from that string to the vector, see:
vector<int> list;
list.push_back(atoi(LineContent.c_str()));
Now, you can print out what's in the file:
for (int i = 0; i < list.size(); i++)
cout << list[i] << endl;
| bd7d328954b4726cd1ee6aab9d7729e1986bc863ae0db8c80db4263d3b336712 | ['2ee637f1c2f54117ae0d51c0ea79a514'] | To get the directory of a program, first use GetModuleFileNameEx to get the program path, and your directory will start from the first character to the last backslash found.
Example:
Program is: "C:\Windows\notepad.exe";
Directory is: "C:\Windows";
In code:
DWORD pid = 104;
CHAR ProgramFile[MAX_PATH];
std<IP_ADDRESS>string DirectoryPath;
HANDLE hProcess = OpenProcess(PROCESS_VM_READ|PROCESS_QUERY_INFORMATION, FALSE, pid);
GetModuleFileNameExA(hProcess, NULL, ProgramFile, MAX_PATH);
DirectoryPath = ProgramFile;
DirectoryPath = DirectoryPath.substr(0, DirectoryPath.find_last_of('\\'));
std<IP_ADDRESS>cout << "ProgramFile: " << ProgramFile << endl;
std<IP_ADDRESS>cout << "Directory: " << DirectoryPath.c_str();
|
b4be15b310a095adde38cd01dc461eb28100b1aa5431b207f5b8f4400761cf1a | ['2ef0898927a545f09ea905fb772d3af5'] | I am also trying to deploy a ZendSkeletonApplication on a shared host but I am facing some problem regarding redirection. The problem is when a user try to login it gets stuck to /projectname/user/authenticate. It doesn't get redirected to dashboard after authentication.Unfortunately all i see is a white, empty page. Locally it worked perfectly Here it looks like Zend doesn't recognize that it should do anything with this url and redirecto to appropriate action.
Thanks in advance
| 4bb592e51ea485cd3ee8025a2fa4a8009a76f32ba16b0a95b3e632bc6a57d1b8 | ['2ef0898927a545f09ea905fb772d3af5'] | You need to add all the files inside public folder to the root i.e public_html. Then create a folder behind root (suppose folder named zf2project) and copy all your folder except public folder into it.
Then edit your index.php file
chdir("zf2project/".dirname(__DIR__));
Btw can you provide the link to your site.
|
61530a0a1772a10a593a815f9acf298e4003b04d49b0c82f915840d359a03fb4 | ['2f1d5c74b95d4d61950a505abf8b6981'] | We've got a non-standard svn setup which looks like this:
Root
|----->Trunk
| |---->Projects
| | |---> Project 1
| | |---> Project 2
| | |---> Project 3
| |---->Libraries
| | |---> Library 1
| | |---> Library 2
|----->Tags
| |---->Projects
| | |---> Project 1
| | | |----> <IP_ADDRESS>
| | | |----> <IP_ADDRESS>
| | |---> Project 2
| | | |----> <IP_ADDRESS>
| | | |----> <IP_ADDRESS>
| |---->Libraries
| | |---> Library 1
| | | |----> <IP_ADDRESS>
| | | |----> <IP_ADDRESS>
| | |---> Library 2
| | | |----> <IP_ADDRESS>
| | | |----> <IP_ADDRESS>
I've already done a git-svn clone, but of course none of the tags work (we have no branches in svn).
Is there anyway to untangle this mess into multiple git repos?
| e43dbcb58c12b6ae0068c80ba98a0fc729ccce4f56187283e14d2f4574f2c2a2 | ['2f1d5c74b95d4d61950a505abf8b6981'] | I have an application that has a main form which has 10 buttons that are user configurable.
I have another form with which to configure those 10 buttons actions.
What is the best way for me to configure these 10 buttons?
Currently, I'm passing the 10 buttons as a List to the second form, and link them to the appropriate combobox tag.
The problem is if sometime in the future I decide to add a button or rearrange them, I'll have to rewrite the code. Anyone know a better way?
private readonly List<PictureBox> pictureBoxes;
private readonly List<ComboBox> comboBoxes;
public Shortcut_Buttons (List<string> stringsList, List<Button> sButtons)
{
InitializeComponent();
pictureBoxes = Controls.OfType<PictureBox>().ToList();
comboBoxes = Controls.OfType<ComboBox>().ToList();
if (pictureBoxes.Count != sButtons.Count)
throw new ArgumentException("Not enough Buttons/Pictureboxes.");
int i = 0;
foreach (var pictureBox in pictureBoxes)
{
pictureBox.BackgroundImage = sButtons[i++].BackgroundImage;
}
i = 0;
foreach (var comboBox in comboBoxes)
{
comboBox.DataSource = stringsList;
comboBox.Tag = sButtons[i++];
comboBox.SelectedIndexChanged += SetShortcutButton;
}
}
|
9928445cece2d15ed08cd18230877b21e5adf94c0f1fb989bc4a1541c567f0c9 | ['2f201a2f3ab44a20a03f05b9a5e76cc8'] | Is it possible in C++ to pass a variable argument lists to a base constructor?
I could just copy the code of the base constructor to the derived class, an handle the variable argument list there, but that would lead to unwanted code duplication.
This is what I tried so far:
class A{
public:
A(const char * fmt,...){
va_list ap;
va_start( ap, fmt );
vprintf(fmt,ap);
va_end(ap);
};
};
class B: public A{
public:
B(const char * fmt,...):A(fmt){;};
};
int main(){
B("%d\n",42);
}
But the constructor doesn't pass the variable arguments to the base class constructor.
| fb459e12aa0ee3667beb2bb55f4b5d0d14e7cdb7396103f5dede6665e7668d64 | ['2f201a2f3ab44a20a03f05b9a5e76cc8'] | I have a datafile that depends on other datafiles, but the generating script ignores if they are missing. The script automatically creates the makefile, including the ones that do not exist - that in the case they get created, the depending file is recreated.
data: infile1.raw infile2.raw
touch $@
infile1.raw:
infile2.raw:
Adding empty rules avoids an error, but triggers an unwanted recreation.
Implicit rules work sometimes, but not reliable - %.raw: causes make to complain that there is no rule to make the infile1.raw targets. Explicitly stating that it does not need to be build with %.raw:; removes the error, but causes again a rebuild. I would hope to avoid wildcards such as
data: $(wildcard infile*.raw)
as it very hard to automate this in such a way that not far to many files are matched.
Is there a way to achieve that make ignores missing dependencies?
|
c0971599c0ff9ea1f1614e72b8614bcecbb688362c2e58a076ca61bf96a91f3b | ['2f2a1c407303473fac097f7302b2167d'] | Thank you for the insight I think I'm making progress, suppose we pick 1 couple from n couples this is done (2n-1)!*2 ways => (n choose 1)*(2n-1)*2, but if we pick k couples from the n couples, then would it be: (2n -2k + k)!*2^k ( just figured out the power of k, since each of the k couple can be swapped). | 8ca8209c66c2c27e2c743f71328b9e9c8cc52e00809d7dbe8c44bd3b354776b4 | ['2f2a1c407303473fac097f7302b2167d'] | <PERSON> would this be the same as the mean required in the question? my concern is calculating the value using the method outlined above i.e. mu(A) = number of trials for A * probability of success of A = 8 * 0.7 = 5.6, would this approach be correct in calculating the mean total daily sales of A? |
10b83f4db42f3cfbc5ef10a6ec3c8b5ed06851a0e3729140b5d1c97122339684 | ['2f3a3e2987fd47b6b0fab4bf00d2b048'] | Here is the simple example to update your cart in your case
`
public function addtocart(Request $req,$id){
//return redirect('Resouce/product');
$product = _prod<IP_ADDRESS>find($id)->toArray();
$item = [
'name' => $product['pName'],
'description' => $product['pDesc'],
'price' => $product['pPrice'],
];
if($req->session()->has('cart')){
$oldCart = $req->session()->get('cart');
$newCart = [
'qtyTotal' => 0,
'priceTotal' => 0,
'item' => array_merge($item,$oldCart['item'])
];
$req->session()->put('cart',$newCart);
}
$cart = [
'qtyTotal' => 0,
'priceTotal' => 0,
'item' => [$item]
];
$req->session()->put('cart',$cart);
$a = session()->get('cart');
dd($a);
}`
| 866255802c4249dfce9fd71ac1220ca37667609922a6fde13abf9c12cfeade6a | ['2f3a3e2987fd47b6b0fab4bf00d2b048'] | I have an order table and an order_details table in my system.
Relationship between order table and order details table is one to many, means One order has many order details.
Now the problem is i am trying to filter the order with the quantity of items a that are stored in order_details table.
what i doing right know trying to access with whereHas
if ($request->has('quantity') && $request->quantity != null){
$query = $query->whereHas('orderDetails',function ($q) use ($request){
$q->whereRaw('SUM(Quantity) >= '.$request->quantity);
});
}
$orders = $query->orderBy('OrderID','desc')->get();
But it throws an error
General error: 1111 Invalid use of group function (SQL: select * from `orders` where `AddedToCart` = 0 and `PaymentSucceeded` = 1 and exists (select * from `order_details` where `orders`.`OrderID` = `order_details`.`OrderID` and SUM(Quantity) >= 12) order by `OrderID` desc)
I will be vary thankful if i get the solution
|
56857b56abd6684671682cc8682d5e108ff3d6455fc4dcd05ddc456f087b9744 | ['2f3b86813883464895c486f5c674c530'] | If I correctly understand, the requirement’s attributes ("Small", "Medium", "Large"…) are stored in the Collection’ table, and are related to the requirement (“sizes”, “shapes”, “colors” …) with a oneToMany relation (a requirement can have multiple selection) ….
If so,
the following code works:
OrderType.php
$builder
->add('requirements', CollectionType<IP_ADDRESS>class,
array(
'entry_type' => RequirementType<IP_ADDRESS>class
)
);
RequirementType.php :
$builder
->add('name', HiddenType<IP_ADDRESS>class, array('disabled'=>true))
->add('collections', EntityType<IP_ADDRESS>class, array(
'class' => ‘AppBundle:Collection’,
'choice_label' => 'name', 'multiple' =>true))
In your Twig view :
{{ form_start(orderForm) }}
{% for requirement in orderForm.requirements %}
<label>{{ requirement.name.vars.value }}</label>
{{ form_widget(requirement.collections) }}
{{ form_widget(requirement.name) }}
<br>
{% endfor %}
{{ form_end(orderForm) }}
| f28207a65166686b69e53b126736b3ddea7009c0f413e88ddffa4b67b5f31235 | ['2f3b86813883464895c486f5c674c530'] | If you take a look at MyBatis documentation, useGeneratedKeys and keyProperty is what you need at least to get auto increment data (for some database, you will need to add keyColumn).
As you can see, useGeneratedKeys depends on if/how is implemented the getGeneretadKeys method of the dataBase's JDBC.
For exemple, with mysql or H2, getGeneretadKeys support only one column. The last generated key will be the one return by getGeneretadKeys.
In conclusion, in your case you need to add only useGeneratedKeys and keyProperty (with ID_ERROR auto_increment):
Mapper.xml
<resultMap type='pathToJavaClass/Error' id='error'>
<id property='id' column='ID_ERROR' />
<result property='timestamp' column='DATE' />
<result property='type' column='TYPE'/>
<result property='message' column='MESSAGE'/>
<result property='source' column='SOURCE'/>
</resultMap>
<insert id="insertRecord" parameterType="error" useGeneratedKeys="true" keyProperty="id">
INSERT INTO errors (
DATE,
TYPE,
MESSAGE,
SOURCE
)
VALUES (
#{timestamp},
#{type},
#{message},
#{source}
)
</insert>
Interface.java
public void insertRecord(@Param("error") Error error);
If you still get some issue to retrieve generated Keys, check also the documentation of mysql's JDBC (older version may not implement getGeneretadKeys).
|
49ca6fff3cb06867adb3a21a98b4dfa568a46347dd5bc9b27a7e2e4f293fd7ca | ['2f3e2af9c94c48128c6265a821d77d25'] | Var_dump: array(2) { ["order_1"]=> array(3) {
["name"]=> string(4) "lala"
["desc"]=> string(7) "lalalal"
["attach"]=> string(1) "�" }
["order_2"]=> array(3) {
["name"]=> string(5) "name2"
["desc"]=> string(5) "desc2"
["attach"]=> string(1) "�" } }
Форма:
<form action="" method="POST" enctype="multipart/form-data">
<div id="addtask"></div>
<input type="text" name="name[]" value="name1" /><br>
<input type="text" name="desc[]" value="desc1" /><br>
<input type="file" name="files[]" multiple /><br>
<input type="text" name="name[]" value="name2" /><br>
<input type="text" name="desc[]" value="desc2" /><br>
<input type="file" name="files[]" multiple /><br>
<input type="submit" value="Нажми" name="enter"><br>
</form>
Расширение файлов: пробовал разные расширения, основной .png и еще разные, обязательно нужны расширения .cdr, .pdf, .png, .jpeg
Кодировку файлов не нашел, но весь код переведен в UTF-8 через notepad++
| 9c67b3b472f29f4279f476a9f83e4baa3bf4b8b1450bdf7a2f24ec3948acfd8c | ['2f3e2af9c94c48128c6265a821d77d25'] | Было бы вообще отлично если в ["attach"] я бы видел названия файлов желательно через ",", но это я и сам смогу сделать. Просто через var_dump я вижу картину с иероглифом а не названия файлов, а насчет формы, я сейчас занимаюсь разработкой данной системы и сделал все на скоряк, на моем нормальном сайте все будет нормально. Просто я бы хотел получить цивилизованный ответ на мой вопрос, т.к. я сам уже ничего придумать не могу, голова просто кипит. |
9c637db0d6749a1dc85543f3b9347865cb853dca938d71b59f1354dbe1e55168 | ['2f4f76865ca84eeb8a315e6add5f5d9b'] | I knew that it could be used in the idiomatic way you referred to but my doubt was about "sooner than possible" because I heard it from many people I know, even though I have never considered to say it and I think l'll never do it. Thank you. | 8bc7e7c4d909365cf054d7696f364a1f2a7b00dec6f067ed823c4380335f1d13 | ['2f4f76865ca84eeb8a315e6add5f5d9b'] | The encrypted HDL is decrypted by the EDA tool. The private key is needed by EDA tool during analysis phase (e.g. simulation) or transformative phase (e.g. synthesis). The private key belongs to EDA tool. Key is not needed by hardware. You can find more details at https://ipencrypter.com/brochures/hdl-ip-protection/
|
ca79c57a4a0e5c7d16f7c661ca66299d8b7eed4abd1259644c65cd4ca486b017 | ['2f59064225d2444fa95f95d037324706'] | I understand that Google will not share IP addresses of users it tracks, and that it's against their TOS for you to store any personally identifiable information. However, would it be permissible for you to store an encrypted version of a user's IP address as a custom variable in Google Analytics?
If so, what's a recommended way to encrypt an IP address so it's easily reversible? Ideally reversible in Excel.
| 1c26102ecfd74d332bbb53e3ce5de8001daaf3169b0a87089de96d614bfac99e | ['2f59064225d2444fa95f95d037324706'] | I'm trying to set up a calendar where a user can select multiple time slots by clicking and dragging in the weekly view ('agendaWeek'). For example - Mon 2-4pm, Tues 1:30-2:00pm, etc.
What's the recommended way to do this? Currently every time a new selection is made, the previous one automatically gets cleared.
|
98c7428451bf26dfdce58970c6250aae0b7aee0c8a9fd706a2f34c43ba73c172 | ['2f5b07e59f60443a929323bada7ec8f1'] | Last week a young adult from Haiti, enrolled in our ESL class, asked the following question when presented with the following:
Tea has caffeine, and so does coffee.
His question was: "Why can't you use the word "has" in place of "does"?
I had two responses. First of all, I don't believe that a comma is needed because the second clause is not independent. Secondly, I prefer not to use a word twice in a sentence. I know the first use of "has" indicates past, present, and future, but, beyond that, I'm not certain what to tell him.
<PERSON> | 74ecf91d9003cbdc319feaf1e82cf14efbf78d43d638ece310f985ac8a117cee | ['2f5b07e59f60443a929323bada7ec8f1'] | First step: take a look over PHP-FPM pools (ex.: http://blog.chrismeller.com/configuring-and-optimizing-php-fpm-and-nginx-on-ubuntu-or-debian)
Second step: You can create a php-fpm pool for each domain you're hosting (ex. mysite.com)
In PHP-FPM config:
-----------------
Copy “www” pool config file (www.conf located in /etc/php5/fpm/pool.d/ on my system) saving it as mysite.conf and changing:
- the [www] label at the top of the file to [mysite]
- the port in the “listen” directive to 9001 (from the deault of 9000)
- add a new line: php_value[session.cookie_domain] = ".mysite.com"
Third step: Create a new listener in Nginx for the new site (mysite.com)
In Nginx config:
----------------
Create a new vhost for mysite.com. and send PHP requests via port 9001 rather than the default port 9000
Forth step: restart PHP-FPM (on my system: /etc/init.d/php-fpm restart) and Nginx (on my system: /etc/init.d/nginx restart)
Credits go to: https://thedotproduct.org/setting-or-overriding-php-configuration-in-php-fpm-pool-configurations/
|
74c0b70986fe89be72b4cd493998b917e5fe3217beae6c1dac8a1bdcb12ec5d6 | ['2f6e04a03b3a4199a15db737c0879707'] | Can be done with primitives if you really just want numbers:
@interface Hotlines : RLMObject
@property NSString *id;
@property NSString *department_name;
@property NSString *flag;
@property RLMArray<NSNumber*><RLMFloat> *numbers;
@end
From the realm docs:
RLMArrays can store primitive values in lieu of Realm objects. In
order to do so, constrain a RLMArray with one of the following
protocols: RLMBool, RLMInt, RLMFloat, RLMDouble, RLMString, RLMData,
or RLMDate
.
| f1366ec580cc70ef9e5819196a13acd5762358d01e4dfac465a651df0c03e982 | ['2f6e04a03b3a4199a15db737c0879707'] | I just ran into the same issue - in my case brew wasn't creating the symlinks.
You can force this in order to get the right version via:
$ brew unlink bison
Unlinking /usr/local/Cellar/bison/3.0.4... 0 symlinks removed
$ brew link bison
Warning: bison is keg-only and must be linked with --force
Note that doing so can interfere with building software.
$ brew link bison --force
Linking /usr/local/Cellar/bison/3.0.4... 9 symlinks created
$ source ~/.bash_profile
$ bison -V
bison (GNU Bison) 3.0.4
|
96d8506e386462a7e78a349f4a13acf58ad51ca1ad7946729206d4046aa3b376 | ['2f740e9cde144591a51e678f4a1f0c7a'] | I am trying to remove namespaces in an xml document and getting the following error:
ERROR: 'The prefix "car" for element "car:name" is not bound.'
ERROR: 'com.sun.org.apache.xml.internal.utils.WrappedRuntimeException: The prefix "car" for element "car:name" is not bound.'
Here's my xml file:
<car:name>Toyota Corolla</car:name>
<car:year>2000</car:year>
Here's my removeNs.xslt
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:variable name="vLowercase" select="'abcdefghijklmnopqrstuvwxyz'" />
<xsl:variable name="vUppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
<xsl:template match="*">
<xsl:element
name="{concat(translate(substring(local-name(), 1, 1),
$vUppercase, $vLowercase),
substring(local-name(), 2))}">
<xsl:apply-templates />
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:attribute name="{local-name(.)}">
<xsl:value-of select="." />
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
and my java method:
private static String stripNameSpaces(String inXml) {
String outputXml = "";
try {
StringWriter writer = new StringWriter();
TransformerFactory factory = TransformerFactory.newInstance();
Source xslt = new StreamSource(new File("./src/main/resources/removeNs.xslt"));
Transformer transformer = factory.newTransformer(xslt);
Source text = new StreamSource(new StringReader(inXml));
transformer.transform(text, new StreamResult(writer));
outputXml = writer.toString();
} catch (TransformerConfigurationException tcEx) {
tcEx.printStackTrace();
return tcEx.getMessage();
} catch (TransformerException tEx) {
tEx.printStackTrace();
return tEx.getMessage();
}
return outputXml;
}
My guess is that I have to add something to removeNs.xslt but have not been able to figure out what. If someone could help me with this, I'd really appreciate it
| 5bfb80957d142c6e241ccdfc6bd41353e301c7c99c9fcc4664070ae240f523d6 | ['2f740e9cde144591a51e678f4a1f0c7a'] | I'm trying to test a rest call that is a part of an mvc controller.
My unit test is currently returning a 404 error code, instead of a 200 status code, which would determine that the request was sent successfully.
Here's the signature of my method that I'm trying to test:
@PreAuthorize("hasRole('ROLE_SSL_USER')")
@PostMapping(value = "/employee", consumes = MediaType.ALL_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<Object> postEmployee(HttpEntity<String> httpEntity, @RequestHeader("DB-Client-Id") String clientId,
@RequestHeader("X-Forwarded-Client-Dn") String dn) throws IOException, ValidationException {}
Here's my unit test class:
public class ControllerTest {
@InjectMocks
private Controller aController;
private MockMvc mockMvc;
@Before
public void setup() {
MockitoAnnotations.initMocks(this);
this.mockMvc = MockMvcBuilders.standaloneSetup(aController).build();
}
@Test
public void PostEmpTest() {
try {
this.mockMvc.perform(post("/employee")
.contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Am I missing something from my perform() call that is resulting in the 404 bad request code?
|
c98a07dbb245b793ddd91a30911ed45353787d07197acd381dabc30b816c5dda | ['2f8e6b3bef844833b3ecd75d9668c3db'] | You could format things nicely, or at least consistently.
Hardcoding in the current year is a bad idea.
if (year % 400 == 0) {
isLeapYear = true;
} else if (year % 100 == 0) {
isLeapYear = false;
} else if (year % 4 == 0) {
isLeapYear = true;
}
You could put a day < 1 check once, before the other day checks.
| 1192a38fa7eceaf68c196b8e8d7436a789acf4df69e87cecb33484dbe686ebde | ['2f8e6b3bef844833b3ecd75d9668c3db'] | Our Solution
I found the directive that Umbraco uses called umb-load-indicator and it works; however, I'm still curious if someone has a better solution.
Right now here is what my view looks like using the $scope.loading value.
<div ng-controller="MyController">
<div style="height: 25px;" ng-if="loading">
<umb-load-indicator></umb-load-indicator>
</div>
<div ng-class="usky-editor-placeholder" ng-if="!loading">
<!-- main content goes here -->
</div>
</div>
Please let me know if you have a better solution.
|
04942d937c1a7669a246ef5a506bbf6d02b324b8624fdf821c94bc59eb9bdd93 | ['2f999618768d401289fce94acf7bc31f'] | After starting a new application and using NgRx's new action creator pattern, I have found myself missing having an explicit type for an action. For example when I'm testing a service, I would like to know that it dispatched the correct action with the correct properties.
How do I go about this while retaining type safety in TypeScript?
An example:
// What should the '???' in the following line be?
spyOn(store, "dispatch").and.callFake((action: ???) => {
expect(action.type).toBe(fetchProductStructureAction.type);
// TypeScript complains here if I don't add the correct type to action
expect(action.property).toBe(expectedProperty); // <--
})
| 357e8a6982f4f3bb99758d9d7d31d5c8d8578252f448d943e104de31903aa65e | ['2f999618768d401289fce94acf7bc31f'] | I have a PDF file stored in app/storage/, and I want authenticated users to be able to view this file. I know that I can make them download it using
return Response<IP_ADDRESS>download($path, $filename, $headers);
but I was wondering if there is a way to make them view the file directly in the browser, for example when they are using Google Chrome with the built-in PDF viewer. Any help will be appreciated!
|
b0ce3d86c5580e40e0f97267ae07bc1a6009284910a234504b3357d03f83200e | ['2f9f350475624d6f8f960e8c37a7d52a'] | You are correct in that dictionaries are not ordered, but hashed. As a result, the order of a dictionary should not be relied on.
You can use the OrderedDict to help you achieve your goal:
from collections import OrderedDict
a = OrderedDict()
a['b'] = 1
a['a'] = 2
> a
> OrderedDict([('b', 1), ('a', 2)])
| b9b89cf70d9f2f2886d6365a5b0ae4e2edf034d4e8421cfbc32d847bfe4526e8 | ['2f9f350475624d6f8f960e8c37a7d52a'] | No, the directory API does not have an equivalent to the emailsettings API at this time. This page explains how to use it, and will likely have a link to the new API if/when google plans to release one: https://developers.google.com/admin-sdk/email-settings/?csw=1
|
693391576ccbc30eaefc9495ebed5badf6b3b3ec4554cf983dd2a42b57138133 | ['2f9fa4a283dc4d35b962782adc858224'] | If you're concerned about speed, data.table should be faster. If you're like me and aren't familiar with data.table syntax, dtplyr makes it easy. In the below benchmarks, dtplyr looks like it's about 3-5x faster than the base R option above. And, to me at least, it's easier to read.
library(data.table)
library(dtplyr)
library(dplyr, warn.conflicts = FALSE)
library(microbenchmark)
# Creating our test table
df <- tibble(
term1 = sample(LETTERS, 50000, replace = T),
term2 = sample(LETTERS, 50000, replace = T),
value = sample(10, 50000, T)
)
# lazy version of the test table is for dtplyr
df_lazy <- lazy_dt(df)
# answer proposed above
cz <- intersect(union(which(df[,1] == "C"), which(df[,2] == "C")), union(which(df[,1] == "Z"), which(df[,2] == "Z")))
df[cz,]
# a dtplyr answer
cz_dtplyr <- df_lazy %>%
filter((term1 == "C" & term2 == "Z") | (term1 == "Z" & term2 == "C"))
#benchmarking the 2 options
benchmarks <- microbenchmark(
"base_union" = intersect(union(which(df[,1] == "C"), which(df[,2] == "C")), union(which(df[,1] == "Z"), which(df[,2] == "Z"))),
"dtplyr" = df_lazy %>%
filter((term1 == "C" & term2 == "Z") | (term1 == "Z" & term2 == "C"))
)
benchmarks
Unit: microseconds
expr min lq mean median uq max neval
base_union 1669.9 1703.15 2127.677 1755.45 2046.40 6121.8 100
dtplyr 666.8 692.70 744.486 722.10 779.65 1042.2 100
| bd16c8a5a209e34785b079d9ec8974d232d449105ffe37b564a639c98b0db8ab | ['2f9fa4a283dc4d35b962782adc858224'] | You're close! Two things need adjusting. From the documentation, note that the selected argument in updatebs4TabItems takes an integer (the position of the selected tab), not a string (so not the id name you have). Also, the inputID argument for updatebs4TabItems will refer to the sidebarID for you, which you need to set. The below code should work how you want.
library(shiny)
library(bs4Dash)
ui <- bs4DashPage(
# Sidebar -------------------------------------------------------------
sidebar = bs4DashSidebar(
bs4SidebarMenu(
id = "sidebarID", #note the new ID here
bs4SidebarMenuItem(
"Welcome",
tabName = "item0"
),
bs4SidebarMenuItem(
"Page 1",
tabName = "item1"
),
bs4SidebarMenuItem(
"Page 2",
tabName = "item2"
)
)
),
# Body -------------------------------------------------------------
body = bs4DashBody(
bs4TabItems(
bs4TabItem(
tabName = "item0",
fluidRow(
actionButton("JumpToV1", "Go to Page 1"),
actionButton("JumpToV2", "Go to Page 2")
)
),
bs4TabItem(
tabName = "item1",
fluidRow(
bs4Callout(
title = "This is Page 1",
elevation = 4,
status = "danger"
)
)
),
bs4TabItem(
tabName = "item2",
fluidRow(
bs4Callout(
title = "This is Page 2",
elevation = 4,
status = "danger")
)
)
)
)
)
server <- function(input, output, session) {
observeEvent(input$JumpToV1, {
#changed ID and selected here and below
updatebs4TabItems(session, inputId = "sidebarID", selected = 2)
})
observeEvent(input$JumpToV2, {
updatebs4TabItems(session, inputId = "sidebarID", selected = 3)
})
}
shinyApp(ui, server)
|
363b63490f76ccef24b8f5488a6c0be4b29f14283b68cc11833362899ebb90d7 | ['2fb0ebf9202f4d9184ae15185fb40585'] | In summation, all four examples are punctuated below *exactly* as presented, correct (yes or no)?
<PERSON> said, "February 7, 1969 is my date of birth." (No comma after "1969" here?)
<PERSON> reported, "The Gary, Indiana man was arrested on charges of conspiracy." (No comma after "Indiana" here?)
<PERSON> said, "The February 1, 2015 meeting has been canceled."
(No comma after "2015" here?)
<PERSON> said, "Gary, Indiana, is my home town." (Comma required after "Indiana" in this one?) | c3bcf6e3d08681adb78fb5614327a4a2833a3b12af56ac2738e614c20db96dc9 | ['2fb0ebf9202f4d9184ae15185fb40585'] | You need to turn your analysis to Raster.
Try the Proximity analysis set of tools found in ArcMap
http://resources.arcgis.com/en/help/main/10.1/index.html#//018p00000007000000
You can use the Cost Allocation tool to set the barriers
http://resources.arcgis.com/en/help/main/10.1/index.html#//009z00000016000000
|
03eff65c5811510f4190538605e38f9c5c4a7d8abf70fe184ed837a35dc0c312 | ['2fb7d3dc6a614d148e5f43b1bece250d'] | I have class Stack :
class Stack {
private:
int top;
int capacity;
int *storage;
public:
Stack(int capacity) {
if (capacity <= 0)
throw string("Stack's capacity must be positive");
storage = new int[capacity];
this->capacity = capacity;
top = -1;
}
void push(int value) {
if (top == capacity)
throw string("Stack's underlying storage is overflow");
top++;
storage[top] = value;
}
...
and I try to allocate it with
Stack* s = new Stack (100);
When I try to execute any of Stack's functions (push for example), I get an error C2228: left of '.push' must have class/struct/union. Can someone explain how to do it correct way?
| 46bd318554b5153ccc683adf6b51904ca57b42ce67be4a561bd7f38aab3a0f10 | ['2fb7d3dc6a614d148e5f43b1bece250d'] | I'm having a defaultdict dictionary that has keys like this:
RJECNIK['*','A']['<A>']
now i don't know how to check if there is a key, for example:
a=list(RJECNIK.keys())
gives me the list of only first keys (['*','A']).
In my code I need an if statement
if key in RJECNIK:
...
But it doesn't work since I don't know how to check for a PAIR of keys in defaultdict with 2 keys.
|
7dc4120143c4a98cbc88d684032233a60ad0c5debcb8d0d12e86d76b7dbe6583 | ['2fd5e99857a54103a46f07166d4c7eca'] | I get an array of all the users with an attribute ID in their document:
Users := []backend.User{}
err := Collection.Find(bson.M{"channel_id": bson.ObjectIdHex(chId)}).All(&Users)
if err != nil {
println(err)
}
Which I want to send as a JSON response back to the browser/client. However, the User struct contains things like IDs and Hahsed Passwords which i don't want to send back!
I was looking at something like using the reflect package to select the fields of the struct and then putting them into a map[string]interface{} but im not sure how to do it with an array of users.
| 29ec8e9aea70cca0d2772c9f80e27cb460af0388df9dd6240a3c17937036b6a5 | ['2fd5e99857a54103a46f07166d4c7eca'] | Im using JSON for a "scene" file for my engine; it looks like this:
{
"thorium": {
"name" : "JustAnotherMap",
"desc" : "A Map file",
"actor": {
"type" : "Volume",
"name" : "m_pActor1",
"rotation" : "0.0 0.0 0.0",
"position" : "0.0 0.0 0.0"
}
}
}
So i want to be able to read this and for example, create the object VolumeActor with a name m_pActor1 etc. Is this a regex job? I've seen a lot of conflicting information so im not so sure how to approach this.
|
88d18d50e32d1b8dbe58d60b3996fd0ea4f255182ce241965e30d7a331b5e79a | ['3005ff3e80ff47f79cec58cb7964bd2c'] | In index.html all of your img src's have '../images/[name of image]', the .. at the start means move up a directory, but your images folder is in the same folder as the index.html file. The site is looking for an images folder in the wrong place because of the ../, to fix this just need to replace the ../images with images/.
| 50f5f27b658f31218d27f7254a61af28986e35639a91d32dabdab6c3b855066f | ['3005ff3e80ff47f79cec58cb7964bd2c'] | Each horizontal line can be treated as a binary number, 1 for lit, 0 for dark. Bottom row underneath the display all 1s. This makes all the operations really easy, moving left and right can be dealt with using bit shifts, and finding which digits stay on when moving up a row is as simple as ANDing the row with the row below it.
|
7c6ac65ce4203309c321ab5c387b23769ec4f696b209021b1964f12e4e5a82aa | ['3013f0767e7242ac957a688fd622e7a2'] | The new log you added shows that other mail servers are rejecting email coming from your server because it's in a black list, most likely because spam is (or was) sent from your side. That's probably the weird traffic that your hosting provider was talking about.
This log shows that yes, your server was sending spam and is now listed in anti-spam blacklists, but this is not enough yet to find the reason.
I'd advice to check your system for rootkits/backdoors. This tool might help:
http://www.rootkit.nl/projects/rootkit_hunter.html
| ac0f6bff5f8621cada4e252ae223bc05e1ecaba33290cc0dfea5c186526f620b | ['3013f0767e7242ac957a688fd622e7a2'] | I would say I feel you can be in transition of a merger even within myself. Growing up between different english dialects, I often find that I can hear the difference , but that the choice of making the distinction is optional: similar as to how I can hear the difference between "whine / wine" and "hue / you" or even "do / dew" and "mayor / mare" when I hear them being distinguished, but its not necessary to do so, and distinguishing them is a choice made by the speaker |
a0d5476fc97a0e2da39827e15c48365db7b0bcee4e98f9dae8c08de50a2fab7d | ['301ea28312c24fe686007c3a608a7550'] | I conquered the whole land and destroyed all but two of the factions which have no territory or lords to their name. Basically there is no winning animation or anything just and achievement if you are playing through steam. Otherwise eventually all the factions disappear and you are left in control and you could keep playing if you wanted but really all thats left are bandits to kill so have fun and start a new playthrough using different weapons and strategies this time.
| d47afa10d553d3c631785aad0807eb5f80f1edc672ffee49648bc33150ea518e | ['301ea28312c24fe686007c3a608a7550'] | The Debug menu mostly gives access to functions in relation to hidden partitions (e.g. the system-restore-partition in Lion). see Debug Menu
Most likely the Debug menu is mainly for Apple internal use (their techs dealing with stuff probably found these functions useful) so it's hidden by default.
|
7226d52e2c9c3a11a8d46a1a0a3a2ac999dd4fbd460d8b376c4e7af18f1af332 | ['30273e644ee6469fba8939139b1ff8a6'] | This solution will use 7-Zip to zip the output files to the solutions folder.
Create this zipper.bat file and place it in your solution folder:
"C:\Program Files\7-Zip\7z" a -y -tzip %2 %1 -mx5
echo done
Add this line to your Post-build events:
call "$(SolutionDir)zipper.bat" "$(TargetDir)" "$(SolutionDir)zipped.zip"
| 6e93d85233190ade3c3844c25dffb1ca79f318cc22ef03c40c62d4e74f9719c0 | ['30273e644ee6469fba8939139b1ff8a6'] | You will need to create a custom GMapMarker and use the zoom level in the OnRender() to scale the image. Each zoom level has a different ratio but luckily for you, I have mesured them all. Not sure if the ratio changes with different map providers?
You can set the x/y scale and heading using a seperate thread and it will update in real time.
The "defaultZoomLevel" will set the zoom level at which the image has a 1:1 ratio. I have only tried the value 16, not sure it will work for other values you may need to calculate all the ratios for each value or extract the curve from the data and use that to scale the ratio.
Use this to set the zoom level when it changes:
private void Gmap_OnMapZoomChanged()
{
//trackBar_Zoom.Value = (int)Gmap.Zoom;
//label_Zoom.Text = "Zoom: " + trackBar_Zoom.Value.ToString();
SelectedOverlay?.SetZoomLevel(Gmap.Zoom);
}
Use it like:
SelectedOverlay = new GMapMarkerImageOverlay(Gmap.Position, 0, 1, 1, Gmap.Zoom, Resources.GreySquare);
Overlay_ImageOverlays.Markers.Add(SelectedOverlay);
And this is the MapMarker:
public class GMapMarkerImageOverlay : GMapMarker
{
private readonly double deg2rad = 3.<PHONE_NUMBER>.0;
private readonly double rad2deg = 180 / 3.14159265;
private readonly float defaultZoomLevel = 16;
private float zoomRatio = 1f;
private float heading = 0;
private double zoom = 0;
private float scaleX = 0;
private float scaleY = 0;
private Bitmap overlayImage;
private void SetZoomRatio()
{
if (zoom < 12)
{
zoomRatio = 0.045f;
}
else if (zoom == 12)
{
zoomRatio = 0.08f;
}
else if (zoom == 13)
{
zoomRatio = 0.155f;
}
else if (zoom == 14)
{
zoomRatio = 0.285f;
}
else if (zoom == 15)
{
zoomRatio = 0.53f;
}
else if (zoom == 16)
{
zoomRatio = 1f;
}
else if (zoom == 17)
{
zoomRatio = 1.88f;
}
else if (zoom == 18)
{
zoomRatio = 3.55f;
}
else if (zoom == 19)
{
zoomRatio = 6.75f;
}
else if (zoom == 20)
{
zoomRatio = 11.5f;
}
else
{
zoomRatio = 11.5f;
}
}
public GMapMarkerImageOverlay(PointLatLng p, float heading, float scaleX, float scaleY, double zoom, Bitmap image)
: base(p)
{
overlayImage = image;
this.heading = heading;
this.scaleX = scaleX;
this.scaleY = scaleY;
this.zoom = zoom;
SetZoomRatio();
}
internal void SetPosition(PointLatLng position)
{
//Position = position;
//LocalPosition = position;
}
public void SetHeading(float h)
{
heading = h;
}
public void SetZoomLevel(double z)
{
zoom = z;
SetZoomRatio();
//Util.Log($"Zoom level: {z}");
}
public void SetScaleX(float x)
{
scaleX = x;
}
public void SetScaleY(float y)
{
scaleY = y;
}
public void SetRatio(float r)
{
zoomRatio = r;
}
public override void OnRender(Graphics g)
{
try
{
var temp = g.Transform;
g.TranslateTransform(LocalPosition.X, LocalPosition.Y);
float ratio = (float)zoom / defaultZoomLevel;
ratio *= zoomRatio;
g.ScaleTransform(scaleX*ratio, scaleY*ratio);
base.ToolTipMode = MarkerTooltipMode.OnMouseOver;
base.ToolTipText = $"Ratio:{ratio}";
// anti NaN
try
{
g.RotateTransform(heading);
}
catch
{
}
var sIcon = overlayImage;
sIcon = new Bitmap(sIcon, sIcon.Width / 1, sIcon.Height / 1);
g.DrawImageUnscaled(sIcon, sIcon.Width / -2, sIcon.Height / -2);
g.Transform = temp;
}
catch (Exception ex)
{
//Util.Log(ex);
}
}
}
|
6d077b61b031ac960db58afa62e543cda1cca5f5002f3b5161994cf5135dfdae | ['302ea83d24cb4d04a3d0bc1950cd7e35'] | Could you try this whith a cursor and SELECT INTO:
DECLARE @Type VARCHAR(50);
DECLARE @TableCounter INT;
DECLARE @SQL VARCHAR(MAX);
DECLARE @TableName VARCHAR(20);
SET @TableCounter = 1;
DECLARE db_cursor CURSOR FOR
SELECT DISTINCT type
FROM Table_A
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @Type
WHILE @@FETCH_STATUS = 0
BEGIN
PRINT @Type
SET @TableName = CONCAT('Table_', @TableCounter)
SET @SQL = 'SELECT * INTO '+ @TableName +' FROM Table_A WHERE Type = ''' + @Type+''''
EXEC (@SQL)
SET @TableCounter = @TableCounter + 1;
FETCH NEXT FROM db_cursor INTO @Type
END
CLOSE db_cursor
DEALLOCATE db_cursor
I think this code could be short with a nested sentence, but works.
| ca60df7ec636a3d2fec7d8a72960d40987eb6e72596e5d0be56d248468102429 | ['302ea83d24cb4d04a3d0bc1950cd7e35'] | You can use the default filter operator as reference.
The following example demonstrates how to configure a string filter and select the "contains" operator as default, also you can specify the active filter operators with their order using this tag: <kendo-filter-(operatorName)-operator>.
<ng-template kendoGridFilterCellTemplate let-filter let-column="column">
<kendo-grid-string-filter-cell [column]="column" [filter]="filter" operator="contains">
<kendo-filter-contains-operator></kendo-filter-contains-operator>
<kendo-filter-eq-operator></kendo-filter-eq-operator>
</kendo-grid-string-filter-cell>
</ng-template>
|
440a231ea7def1a5cce9433f11a0f65ca5dc95fd597edac0e8177e011ef4ede2 | ['30392b0e84484eb7bcb2c60af13f1b04'] | You can use the TextPainter class to determine the width of some text.
https://api.flutter.dev/flutter/painting/TextPainter-class.html Flutter uses that during layout to determine the size of a text widget.
Not sure if the result from TextPainter will include a small amount of padding or not, though if it does, the already proposed solution will likely do so too.
| cb14b8e8d16ad1fe4baa00f9aa698eaa9e4b8be3d72b4ac372c2773ccf535e5f | ['30392b0e84484eb7bcb2c60af13f1b04'] | What you could do is have an InheritedWidget (call it say GameStateWidget) above your Navigator (or MaterialApp if you're using its navigator). In the InheritedWidget have a ValueNotifier, say savedGame that has the value you want to share.
Then in the route where you need to set the value
GameStateWidget.of(context).savedGame.value = ...
And in the route where you need the value
ValueListenableBuilder(
valueListenable: GameStateWidget.of(context).savedGame,
builder: (context, savedGameValue, child) => ...
)
|
0b4331cadb765bcab20059435a28b6c3659dcf47f56fff428593f3c037c11ed7 | ['3042999d4df84a518418d6aeaad2369c'] | SELECT ID, Artist, Title
FROM videos v join runlog l on l.videoID = v.id
WHERE
-- 1. All in past hour will not show
datetime < DATEADD(hour,-1,GETDATE())
-- 2.
and not exists
( select 1
from videos v2 join runlog l2 on l2.videoID = v2.id
where v2.Artist = v1.Artist and datetime > DATEADD(hour,-1,GETDATE())
)
-- 3.
and not exists
(
select 1
from
(
select count(1) recordCount
from videos v3 join runlog l3 on l3.videoID = v3.id
where v3.Artist = v1.Artist and datetime > DATEADD(hour,-24,GETDATE())
)
where recordCount>=3
)
order by Artist, Title
OR
SELECT ID, Artist, Title
FROM videos v join runlog l on l.videoID = v.id
WHERE
-- 1. All in past hour will not show
datetime < DATEADD(hour,-1,GETDATE())
and v1.Artist in
(
-- 2.
select Artist
from videos v2 join runlog l2 on l2.videoID = v2.id
where datetime > DATEADD(hour,-1,GETDATE())
union all
-- 3.
select Artist
from videos v3 join runlog l3 on l3.videoID = v3.id
where datetime > DATEADD(hour,-24,GETDATE())
group by v3.Artist having count(1) >= 3
)
| 7bdb7cd545885664981d8723262e6bed0c0e1b81afe7b8f9a6b025ff381a09e6 | ['3042999d4df84a518418d6aeaad2369c'] | b.GetUser() will NOT trigger db query, and NEITHER dtoUser.Where(n => n.Name == "TEST") will trigger query. The differed Execution means it will execute db query only when you "use" it, for example a foreach clause, or SingleOrDefault()/Count()/...
So your program above will do what you want. But there'll be performance issue. The generated SQL will like
Select Name, Age from User
It will get all records from database into memory, do a filtering in memory then return the filtered records. If you want the filtering in database side, should replace IEnumerable with IQueryable
|
8fc3d0fec33752761d36c2c943b83df7344e89cf05ca91572beb05a56a263691 | ['304cbaa0cdc748288e96804dfbc4c5ab'] | You will not lose existing student table its make a problem when you want add a column that is not null so in that situation you must set default value for it.
Update your Model in console manger run Add-Migration command with setting a name.
Than run Update-Database Command.
PM> Add-Migration intial123
PM> Update-Database -Verbose
| c13792b1d3363f2c3dc390f742653a6493a948bdf74a7f1bada103027d8fdb49 | ['304cbaa0cdc748288e96804dfbc4c5ab'] | Snapshot simply means depending on your configuration Maven will check latest changes on a special dependency. Snapshot is unstable because it is under development but if on a special project needs to has a latest changes you must configure your dependency version to snapshot version. This scenario occurs in big organizations with multiple products that these products related to each other very closely.
|
c0373fcdf828d641b0098b8dda16d6ff1ca2029fadb76aae39dd55a0d2926d52 | ['3053416c46224fb187dc53dc5ff1005a'] | You are right, it does not depend on $x$ but on $k$ in my lecture notes, meaning momentum, so $p$ would be fine too, but I the exponential seems to not be in any of my lecture notes. (The rules I set above were in momentum space)
In the exercise it doesn't specify if they want it in momentum or position space, does that mean I can choose whichever? | 66d22d4236d5fb5c993677415949ec46df03f3372553e30b261076e732aa5393 | ['3053416c46224fb187dc53dc5ff1005a'] | When reading Mechanism for ordinary-sterile neutrino mixing it is stated in the abstract that:
"(...)sterile neutrinos can occur only if Dirac and Majorana mass terms exist which are both small and comparable."
What is the meaning of comparable in this context? Does it means both mass terms must be on a similar scale (energy wise)?
Later in the article the conditions for them to be comparable are given, but it still doesn't say what comparable truly means.
|
2d26f1f836481007589239615e8ac48b8341cc88fc79375286e3d1380e0a508c | ['3054a88432874037a7c0644c4a84cccf'] | You can do something like this:
# Connect to the template1 db (built in)
conn_template1 = PG.connect( dbname: 'template1' )
res1 = conn.exec('SELECT * from pg_database where datname = $1', ['words'])
if res1.ntuples == 1 # db exists
conn_words = PG.connect(dbname: 'words')
# ... do stuff to your DB
conn_words.exec('INSERT INTO words ....')
else
conn.exec('CREATE DATABASE words')
end
Hope that helps!
| 23a3f50d79f3d557776a807534d784da87922e9661bd62496b1bee62b14e9b01 | ['3054a88432874037a7c0644c4a84cccf'] | You can't have a category with an ID of 0. You could use 1 but an alternative might be:
categories = (1..10).to_a.map do |n|
subscribers = rand(1..99)
description = Faker<IP_ADDRESS>Lorem.paragraph(30)
Category.create!(
title: TITLES.pop,
subscribers: subscribers,
description: description
)
end
# Create Posts
100.times do |n|
title = Faker<IP_ADDRESS>Lorem.sentence
content = Faker<IP_ADDRESS>Lorem.paragraph(30)
post = Post.create!(
title: title,
content: content,
)
post.categorizations.create(
category: categories[0]
)
post.categorizations.create(
category: categories[rand(categories.size)]
)
end
|
cf24f803962a292c138f230ac1833aeb629febc3230730547873f0dac15cd9f9 | ['30588eff869b42db96dc8df8f3e903fb'] | I am using docusaurus 1.14.4
I need to create embedded mode for each document which remove header, footer and left navigation.
Page url look like this http://localhost:3000/...../?mode=emb
I figure out a way by adding this piece of script to each md file
<script>
function getParameterByName(name) {
var match = RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var mode = getParameterByName('mode');
if (mode === 'emb') {
setTimeout(()=>{
let list = ['fixedHeaderContainer', 'docsNavContainer', 'nav-footer', 'docs-prevnext'];
for (var itemClassName of list) {
var item = document.getElementsByClassName(itemClassName)[0]
item.parentNode.removeChild(item)
}
document.getElementsByClassName('navPusher')[0].style.paddingTop = 0;
document.getElementsByClassName('mainContainer')[0].style.paddingTop = 0;
}, 0)
}
</script>
It work but does not look like a proper way. Can anyone suggest a better way?
| 26b0586b0d7c7df89ba9bf16d2e095629d355ef225d62a65dcc0bf9c5bd1ff0f | ['30588eff869b42db96dc8df8f3e903fb'] | i'm trying to read an audio file mp3 and download it using django and vuejs
my-backend code
@api_view(['GET'])
@permission_classes([permissions.IsAuthenticated])
def file_download(request, application_id, file_id):
base_path = os.getenv('UPLOAD_PATH')
file_name = str(file_id)
file = default_storage.open(base_path + file_name)
print(file)
print(file.size)
print(settings.MEDIA_ROOT)
response = HttpResponse(content=file)
response['Content-Type'] = 'audio/mp3'
response['Content-Length'] = file.size
return response
front-end code
ApplicationFileService.download(this.$route.params.applicationId, this.$route.params.fileId).then(
async result => {
let blob = new Blob([result.data], { type: 'audio' })
console.log(blob.size);
this.$utils.downloadFileFromBlob(result.data, this.file.name)
}
)
download file function
downloadFileFromBlob (data, fileName) {
const blob = new Blob([data])
const url = window.URL.createObjectURL(blob)
const anchor = document.createElement('a')
anchor.href = url
anchor.download = fileName
anchor.click()
window.URL.revokeObjectURL(url)
}
I was able to download the file but it is not playable while the original file on server was fine.
I check file size on server is 6270152 and it is correct but when i check the file received in front-end it is 10610168 in size.
I don't know why there is a big difference in file size the file received was wrong and not playable.
Can anyone help?
|
40779f672242ade3804e8eadbd208ab08b0b7bd808d4724349d86d9df87a3b1a | ['305b4aa0eb484098803f6845cd6bea27'] | To fix the Android Pie slow setText problem, I used PrecomputedText as per the suggestion in the comments. I made separate AsyncTask classes for use depending on the SDK version. I don't know if there's a better way to handle that part, but the real solution to my question is answered by using PrecomputedText in Android 9.
void callBackgroundQuery(String query){
if (android.os.Build.VERSION.SDK_INT >= 28){
backgroundQueryAPI28 BQ = new backgroundQueryAPI28(this);
BQ.execute(query);
} else {
backgroundQuery BQ = new backgroundQuery(this);
BQ.execute(query);
}
}
private class backgroundQueryAPI28 extends AsyncTask<String, Void, PrecomputedText>{
private ReadingActivity mReadingActivity;
final PrecomputedText.Params params = mTextView.getTextMetricsParams();
final Reference textViewRef = new WeakReference<>(mTextView);
public backgroundQueryAPI28(ReadingActivity ra){
mReadingActivity = ra;
}
@Override
protected PrecomputedText doInBackground(String... query) {
SQLiteDatabase db = mDbHelper.getInstance(getApplicationContext()).getReadableDatabase();
Cursor c = db.rawQuery(query[0],null);
StringBuilder builder = new StringBuilder();
String chap, verse, text;
int bookNum;
c.moveToFirst();
while (!c.isAfterLast()) {
bookNum = c.getInt(0);
chap = c.getString(1);
verse = c.getString(2);
text = c.getString(3);
String completeVerse = getAbbreviation(bookNum) + " " + chap + ":" + verse + " " + text;
builder.append(completeVerse).append("\n");
c.moveToNext();
}
String allText = builder.toString();
final PrecomputedText precomputedText = PrecomputedText.create(allText, params);
return precomputedText;
}
@Override
protected void onPostExecute(PrecomputedText result) {
super.onPostExecute(result);
mTextView.setText(result);
mReadingActivity.setScroll();
}
}
private class backgroundQuery extends AsyncTask<String, Void, String>{
private ReadingActivity mReadingActivity;
public backgroundQuery(ReadingActivity ra){
mReadingActivity = ra;
}
@Override
protected String doInBackground(String... query) {
SQLiteDatabase db = mDbHelper.getInstance(getApplicationContext()).getReadableDatabase();
Cursor c = db.rawQuery(query[0],null);
StringBuilder builder = new StringBuilder();
String chap, verse, text;
int bookNum;
c.moveToFirst();
while (!c.isAfterLast()) {
bookNum = c.getInt(0);
chap = c.getString(1);
verse = c.getString(2);
text = c.getString(3);
String completeVerse = getAbbreviation(bookNum) + " " + chap + ":" + verse + " " + text;
builder.append(completeVerse).append("\n");
c.moveToNext();
}
String allText = builder.toString();
return allText;
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
mTextView.setText(result);
mReadingActivity.setScroll();
}
}
| e184ab20c8704314204d1b62188a661d5daae648c21874cd25fabb2aff8d7fb3 | ['305b4aa0eb484098803f6845cd6bea27'] | I'm rewriting my Java note taking app in Kotlin. I'm trying to populate a RecyclerView with TextViews built from my SQLite database query, but I can't figure out how to make it wait for the query to be done, or take an action when it is done.
In my Java version I accomplished this by using AsyncTask for the query and then calling PostExecute.
Now in my Kotlin version I'm using launch(Dispatchers.IO), but I'm not sure how to do the rest. How do I accomplish the same functionality?
|
43d80258c925cb7340e787c3f840afbe28b74260458aa94b97479376cd71811e | ['3064f83e085b434cad661584fdc4dde5'] | Inside each list item of flatlist, we have a Picker to choose value But when we are changing the picker value it is changing and immediately refreshing for all another rows.
This is happening only when we are applying the Flatlist, but outside the flatlist it was fine.
Can anybody help us, how to solve the issue.
import React from 'react';
import { Text, View,FlatList,Image,StyleSheet ,ScrollView, TextInput,TouchableOpacity,Alert
} from 'react-native';
import { Picker ,Icon} from "native-base";
var gradeInputs= [];
var hoursInput =[];
var grades_list =[
{
"course": "BIO-110",
"TITLE": "أحياء عامة )1(",
"hours":"2"
}
,
{
"course": "CHEM-110",
"TITLE": "كيمياء عامة )1(",
"hours":"4"
}
,
{
"course": "ELCS-100",
"TITLE": "لغة انجليزية",
"hours":"3"
}
,
{
"course": "STAT-110",
"TITLE": "احصاء عام )1(",
"hours":"3"
}
];
export default class calculate_gpa extends React.Component {
constructor(props)
{
super(props);
this.state = {
selected: "A+"
};
}
onValueChange(value ) {
this.setState({
selected: value
});
}
render( ) {
return(
<View style={{flex:1}} >
<ScrollView >
<Text style={{ fontSize:20,fontWeight: 'bold',
fontFamily: "DroidKufiReqular",}}>{"\n"} أدخل الدرجة المتوقعة لكل مادة{"\n"}</Text>
<FlatList
data={ grades_list}
maxHeight={400}
renderItem={({ item, index }) =>
<View key={item.id}>
<View style={{ justifyContent: 'center',
alignItems: 'center' ,
marginTop:'7%', }}>
</View >
<View style={{
justifyContent: 'space-between',
flexDirection:'row',
alignItems:'center',
marginTop:0,
}}>
<View style={{ width: '16.5%', alignItems:'center' , top:-20 }}>
<Text style={{ textAlign: "center",}}>{item.course}</Text>
</View>
<View style={{ width: '20%', alignItems:'center', top:-15 }}>
<Text style={{ fontFamily: "DroidKufiRegular",
}}>{item.TITLE}</Text>
</View>
<View style={{ width: '20%', alignItems:'center' , top:-20,marginRight:0 }}>
<Picker style={{borderStyle:'solid',height: 50, width: 120}}
mode="dropdown"
iosIcon={<Icon name="arrow-down" />}
headerBackButtonText="Baaack!"
selectedValue={this.state.selected}
onValueChange={this.onValueChange.bind(this)}
>
<Picker.Item label="A+" value="4.5" />
<Picker.Item label="A" value="4" />
<Picker.Item label="B+" value="3.5" />
<Picker.Item label="B" value="3" />
<Picker.Item label="C+" value="2" />
</Picker>
</View>
<View style={{width: '16.5%', alignItems:'center', top:-15 }}>
<Text style={{ textAlign: "center"}}>{item.hours}</Text>
</View>
</View>
</View>
}
keyExtractor={item => item.id }
extraData={this.state}
/>
<View style={{ justifyContent: 'center',
alignItems: 'center',}}>
<TouchableOpacity style={[styles.buttonContainer, styles.loginButton]}
>
<Text style={styles.loginText}>احتسب معدلك</Text>
</TouchableOpacity>
</View>
</ScrollView >
</View>
);
}}
const styles = StyleSheet.create({
buttonContainer: {
height:60,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
marginBottom:15,
width:250,
borderRadius:30,
marginTop:20,
},
loginButton: {
backgroundColor: "#87dc9b",
},
loginText: {
color: 'white',
fontSize:20,
fontFamily: "DroidKufiBold",
},
})
| 7f48535cc67b5cc100613c230934a810ec1dc9d6ff329fb8088ca289d08e69a4 | ['3064f83e085b434cad661584fdc4dde5'] | when I have run alert function in my real device( iPhone)
the function works with me , however, the app says "index.html" and the alert below it. How do I remove the "index.html" part?
<script type="text/javascript">
function login(oFormElement){
var username1=document.getElementById("user_name").value;
var pass=document.getElementById("pass_word").value;
var params="username="+username1+"&password="+pass;
alert(params);
}
</script>
|
1ec7a039cb1e45437d36ee832a7871de22f911c4f456c18978459b361a7437c2 | ['30900a70a1a8493bad20dc6c30671f65'] | Following error occurred while trying to execute a test for the POST API
events.js:71
throw argumentt[1]; // unhandled 'error event'
Error: connect ECONNREFUSED
at errnoException (net.js:769:11)
at Object.afterConnect [as oncomplete] (net.js:760:19)
The code is as follows:
var http = require('http');
assert = require('assert')
var opts = {
host:'localhost',
port:8000,
path:'/send',
method:'POST',
headers:{'content-type':'application/x-www-form-urlencoded'}
}
var req = http.request(opts,function(res) {
res.setEncoding('utf8')
var data = ""
res.on('data', function(d) {
data += d
})
res.on('end',function() {
assert.strictEqual(data, '{"status":"ok","message":"Tweet recieved"}')
})
})
req.write('tweet=test')
req.end()
| f1dbba82191c85fbd1eab4ce3b77c2c33fe16912db66dba125cd92773f901675 | ['30900a70a1a8493bad20dc6c30671f65'] | I've followed instructions on developer.android.com carefully:
I've downloaded Eclipse Classic 3.6.1
I've opened Help->Install New Software and added ADT Plugin site
But it failed twice once using
https://dl-ssl.google.com/android/eclipse/ and the other time using
http://dl-ssl.google.com/android/eclipse/
now as i try to do it repeat the process, it says duplicate(it is duplicate) and devoid's me of downloading adt plugin.
now how can i download adt plugin ?
|
807ed24fbde15e042c1fdbcac5fa2d3315935a1cf07ca8b72a83739c1e48b790 | ['30ad81429b484562b9ea3ea8bf9f96a0'] | I am using Eclipse IDE for PHP and now that I started using also JS I am missing the autocomplete options. I do not know if they're missing because I did something wrong or because the variables are not defined yet (similiar to MATLAB). Autocomplete works great with PHP, HTML and CSS but not with JS.
I tried the classic
> Window > Preferences > JavaScript > Editor > Content Assist > Advanced
and
Installing extensions
but it did not help. I also tried to reference to some external files, but I am pretty sure that's not what is wrong.
I've been searching the whole day and I did not find an actual answer. As Eclipse has so many multiple options to adjust everything, I am getting a bit overwhelmed with that...
I would appreciate someone explaining to me how the autocompletion works. Where and whwn does it look for the suggestions (definitions in the js file or in the whole script) and why does it not show the DOM methods like window.onload or document.getElementById for example. Is this normal because there is no window/document yet or do I have to check some checkboxes in order to make eclipse do that?
| b20d6adfbd72ff43fbc601b3aff82a24d076d39613521a291cf02e6c74a78c0e | ['30ad81429b484562b9ea3ea8bf9f96a0'] | I cannot comment yet, so I'll give my hint here:
I think the problem is you are comparing strings. In this case, SQL looks for the alphabetical order, a 1 is higher than 0, so the string "0999" is lower than the string "1". Think of it as words, the word "b" will be ordered before the word "zaaa".
Convert the string you're trying to compare into a number and try again.
I hope I could explain myself.
|
acee823cbf2615568c64e8ca31e81806783d201f9826ada38b9e7d98f9555fc2 | ['30c10b03e5b446a6ab88945cbc652e1f'] | I have two servers
http://example.net - my "main" server
http://example.com - a server dedicated to my blog
both servers run Nginx on Ubuntu 14.04. I have cofigured the example.net server thus
location /blog {
proxy_pass https://ip.of.example.com/blog;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
Now when I browse to https://example.net/blog the blog landing page on the example.com server is displayed. However, this is happening at the expense of a redirect to the example.com server so the browser address bar ends up showing https://example.com/blog/path/to/article in place of https://example.net/blog/path/to/article.
Quite apart from the fact that this is not the desired result having blog content appearing on another domain would have disastrous SEO consequences.
I am afraid I am working in the dark here since I understand little of Nginx reverse proxy configuration. I'd be most grateful to anyone who might be able to help out.
| 5d540eff518773480f2a73e554e759afd2e08400e1e4efbcd7c782ddd1fb7082 | ['30c10b03e5b446a6ab88945cbc652e1f'] | La razón por lo que las opciones no aparecen seleccionadas es porque no le estas pasando la propiedad selected en mat-list-option, acabo de responder la misma pregunta hecha acá mat-selection-list Seleccionar valor por default Angular
Puedes encontrar un ejemplo en este link
Debes de asegurarte es pasarle una condicion a la propiedad selected para que marque como seleccionada
|
ffa12c93cedc7f6de2558722906982251ec223b65ddc9e5d8f813ad92bed9247 | ['30d7ee59ea0f470bab034bcbe5adb711'] | I have a csv file with lots of lines, for example
This is line 1
This is line 2
This is line 3
This is line 4
This is line 5
This is line 6
This is line 7
This is line 8
This is line 9
And with a code in Python I need to print only lines that come after certain lines, more specifically, I need to print the line that comes after line 3 and the line that comes after line 7, and after printing, need to put them in another csv.
How can I do it?
Thanks!!
| 7da0dfadbcda68c16c27bdf3d23570fa3b3846ba6a138123fd2b5af0f84953ea | ['30d7ee59ea0f470bab034bcbe5adb711'] | I have a really huge dataframe (thousends of rows), but let's assume it is like this:
A B C D E F
<PHONE_NUMBER>
1 5 2 5 5 5 5
2 5 2 5 2 5 5
3 2 2 2 2 2 2
4 5 5 5 5 5 5
I need to see which value appears most frequently in a group of columns for each row. For instance, the value that appears most frequently in columns ABC and in columns DEF in each row, and put them in another column. In this example, my expected output is
ABC DEF
2 2
5 5
5 5
2 2
5 5
How can I do it in Python???
Thanks!!
|
a881738ed1aed06c2b768e673a84fd8ff4607a11c0cf031fc85245ef3185ccc5 | ['30daee2da0f04c46a0123ded91e9adea'] | I have a pandas DataFrame with the following structure
animal | description
---------+----------------
dog | mammal
cat | feline mammal
shark | big fish
I would like to print the dataframe like this:
0;animal;description
1;dog;mammal
2;cat;feline mammal
3;shark;big fish
in order to copy the dataframe into the clipboard.
I want to know if there is a straightfoward solution with pandas instead of looping around each row and casting.
if I try to print it I will just get this result:
print(df.values)
array([['0,animal,description;;'],
['1,dog,mammal;;'],
['2,cat,feline mammal;;'],
['3,shark,big fish;;']],
dtype=object)
| d5405bc13271abf72bc95c513d4cad90b443748d55d8a9931ee23fe20e4b5f74 | ['30daee2da0f04c46a0123ded91e9adea'] | What solved my issue was:
Create the repository from https://dev.azure.com/
From the repository view, create your credentials with name and password
Now in the console you can clone your repository by changing the url that azure provides you initialy as
git clone https://<companyname>@dev.azure.com/<companyname>/<project name>/_git/<repository name>
to
git clone https://<your credentials name>@dev.azure.com/<companyname>/<project name/_git/<repository name>
now it will ask you for a password. You must use the one you provided when you created the credentials.
|
f854a5df609c1c3b3f4bb57643029c963324baf1555b59741256b8468f2f17f3 | ['30ddb498a0c74c16bd19e0655c323e3d'] | I would like to arrange the data in account statement format, but I totally no idea to write the SQL commands, especially range of dates.
Table A
Creditors name Invoice No Due date Outstanding Amt
Company A A001 1/8/2014 1500
Company B A002 1/6/2014 300
Company B A003 1/7/2014 900
Company B A004 5/7/2014 50
Company c A005 31/12/2014 200
Result, Statement Date: 11/8/14
Creditors name 0-30 Days 31-60 Days 61-90 Days Over 90 Days Amt Due
Company A 1500 0 0 0 1500
Company B 0 950 300 0 1250
Company c 0 0 0 200 200
Please help & Thank you
| 43fddeb05afadd83f34fb900932141945528cee09736b50816a92d7e4430e0d0 | ['30ddb498a0c74c16bd19e0655c323e3d'] | I would like to arrange the data in account statement format, but I totally no idea to write the SQL commands, especially range of dates.
Table A
Creditors name Invoice No Due date Outstanding Amt
88 Food Center A001 1/8/2014 1500
24 Hours Clinic A002 1/6/2014 300
24 Hours Clinic A003 1/7/2014 900
24 Hours Clinic A004 5/7/2014 50
High Tech A005 31/12/2014 200
Result, Statement Date: 11/8/14
Creditors name 0-30 Days 31-60 Days 61-90 Days Over 90 Days Amt Due
88 Food Center 1500 0 0 0 1500
24 Hours Clinic 0 950 300 0 1250
High Tech 0 0 0 200 200
Please help & Thank you
|
897eaac2d223e8edca9a043fd9473e7d8ccfc9d0af967c4ccf7ddffcacbb841a | ['30e4fed793894e6c8eef1d51e5e17370'] | Somehow this userscript seems to append the attributes to the parent instead of the child :c
Please help me to understand why it's doing that :o
// ==UserScript==
// @name GMod Cinema Porn
// @namespace Bluscream
// @version 1.0
// @description H3H3
// @author Bluscream
// @include https://www.youtube.com/embed/OiMTuwS3xvg*
// @include http://cinema.pixeltailgames.com/search.html
// @include *
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0/jquery.min.js
// @run-at document-end
// ==/UserScript==
(function() {
'use strict';
if (window.location.href.startsWith("https://www.youtube.com/embed/OiMTuwS3xvg")) {
window.location.href = "http://embed.redtube.com/player/?id=42019&autostart=true";
} else if (window.location.href == "http://cinema.pixeltailgames.com/search.html"){
$ = jQuery || $;
$( document ).ready(function() {
temop = $('#content-container').children('div[style="text-align:center;font-size:0;"]:first');
temop.append('<service>').css('background-image', 'url("http://cdn1-www.craveonline.com/assets/uploads/2013/12/man_file_1048340_youporn-icon.png")').click(function () {
window.selectService("YouPorn", "http:\/\/www.youporn.com");
}).hover(function () {
window.hoverService();
});
});
//$('#content-container>div[style="text-align:center;font-size:0;"]').append('<service style=\'background-image:url(\"logos\/youtube.png\")\' onclick=\'selectService(\"YouTube\",\"http:\/\/www.youtube.com\")\' onmouseover="hoverService()">-</service>');
}
})();
| 4cc9a23fa36de5bbb8fde079861697cdfeda793c0e5f58889fede03c432203da | ['30e4fed793894e6c8eef1d51e5e17370'] | def commandTaskList(self, schid, targetMode, toID, fromID, params=""):
import psutil
msg = []
for p in psutil.process_iter():
try:
_p = str(p.as_dict(attrs=['name'])['name'])
ts3lib.logMessage(_p, ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
if ".exe" in _p.lower(): msg.extend(_p)
except psutil.Error: pass
ts3lib.logMessage(str(msg), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
msg = '\n'.join(sorted(msg))
self.answerMessage(schid, targetMode, toID, fromID, msg)
This is my code and the first logMessage() shows:
1/28/2017 04:32:30 PyTSon Error RemindersServer.exe
1/28/2017 04:32:30 PyTSon Error AutoHotkey.exe
1/28/2017 04:32:30 PyTSon Error raptr_ep64.exe
The second one shows:
1/28/2017 04:32:30 PyTSon Error ['w', 'i', 'n', 'l', 'o', 'g', 'o', 'n', ...]
|
77da3e708701efaf49e24fe9d5697540801e135070c482ce7cdc062328925d39 | ['30e55a76fb2242bba837847b9f5c6ed4'] | I tried to understand an implementation of linear probing hash table using Java. However, I am frustrated with understanding why M is given an initial value of 30001. The skeleton of the code is given below.
public class LinearProbingHashTable<Key, Value>{
private int M = 30001;
private Value[] vals = (Value[]) new Object[M];
private Key[] keys = (Key[]) new Object[M];
private int hash(Key key){...}
public void put(Key key, Value val){...}
public Value get(Key key){...}
}
My question is why M is initialised to 30001 here. Is this a rule-of-thumb? How should I decide the size of M when initialising the linear probing hash table?
| 514d69d7671534893078622a585d1656b4c77f3193a13674ba5ab43622b4f893 | ['30e55a76fb2242bba837847b9f5c6ed4'] | Here is a nested for loop. I work out the time complexity for it is nlg(n).
int sum = 0;
for(int k = 1; k < n; k*=2){
for(int i = 1; i < n; i++){
sum++;
}
}
My thoughts are as follows.
The outer for loop: k will take values of 1, 2, 4, 8, ... Thus it will take lg(n) iteration.
The inner for loop: i will take n iteration.
Hence, the overall operations taken will be nlg(n).
Am I right?
|
97301ecfaccf040f79c0ea28bffd5c865b6df08205770f19025cc8c1b9fb5894 | ['30f790567c194280898b163b0c9ccce5'] | @EJoshuaS: As the draft tries to make clear: not everyone knows what terms to google. Being told to google this or that that you didn't even know the name of isn't exactly friendly is it? I think the example in the draft is really nice: “This is called Invariance and Covariance. If you Google it, you’ll find tutorials that can explain it much better than we can in a comment here.” | 7e9b34cb46242922c8c9148ec717bc478ed5db2e5af7908100120dbbcc793fdb | ['30f790567c194280898b163b0c9ccce5'] | Long time reader, first time poster.
I'm trying to rsync the latest few log files from a remote server to my laptop. I've gotten close with this:
ssh -qx <EMAIL_ADDRESS> "cd /path/to/logs && find . -mtime -1 -print0" | rsync --from0 --files-from=- -avHS "<EMAIL_ADDRESS>:/path/to/logs/" .
But that syncs all the files from the past day, which is too many. Ideally I'd like to just download the last half dozen or so files. I know this will list the latest 6 files:
ls -t|head -6
But I'm not sure how to use these two bits of info together (if it's even possible) to solve my problem. Thanks in advance!
|
e44d01838581aed2d396a26681654e761182bbd6e60630455cf3b1fdd6f6a51f | ['310670d69dba430bbcc4d6617391b70c'] | I think you have a logic problem, in that you keep trying to read from the same file with each iteration through the loop (unless your removed something relevant from your code). If you want to read from the same file after each loop, than you should only need to create the stream reader once, outside the outer for loop. In addition, since you are not closing the file, you could be running into issues with being at the end of the file after the first iteration. That would explain why it only works the first time
| 68491ca1aafebdbe76b357146b87860be3894f370a24bac5ab39e23c8de28b33 | ['310670d69dba430bbcc4d6617391b70c'] | You won't be able to manage/display thousands of markers on google maps using Marker Manager, the performance will be atrocious. The only way to do this with any reliability is to use either a utility like MarkerClusterer, which groups markers in close proximity together, or use a Fusion Tables Layer.
I personally would recommend the Fusion Tables Layer, however there is a great writeup here that talks about all of the different options that you might want to consider. https://developers.google.com/maps/articles/toomanymarkers
|
04a2af7baf716d3fb79ccd5b0932e5393d8c1a2bdb273d3e1d38c0a4f928a56a | ['3118e368ed5447f8b1d6b01493ad820f'] | When I had the task of testing our website for deployment to a load balanced environment, a duplicate test environment wasn't an option.
What we did was specify more than 1 Worker Process (aka a web garden) in IIS, found under the 'Process Model' group in 'Advanced Settings' for the appropriate application pool.
This worked a treat for us, with simple round robin behaviour.
| 3f4d16177946f7831fd72aaf03067ad0d76192a62ebfe67fecf6fda7454985ff | ['3118e368ed5447f8b1d6b01493ad820f'] | Back in the day DIM reserved memory for the array and when memory was limited you had to be careful how you used it. I once wrote (in 1981) a BASIC program on TRS-80 Model III with 48Kb RAM. It wouldn't run on a similar machine with 16Kb RAM until I decreased the array size by changing the DIM statement
|
e014ad89fbe5958450165a1482c148fafe761fcef0dc34a612cf177a8e836932 | ['312eb9b414a44d17b8d8b94270214a91'] | Now I see where the disconnect is: you put an equal sign between feds decision not to underwrite certain types of loans (e.g. 100% ones, or >80% when the amount exceeds area-specific limits) and the borrowers ability to afford a home. However, it's only a rule: it's here today, it wasn't there a few years back, and it may or may not be there in the future. Fundamentally, if one has cash flow that lets him service the debt, then he can afford whatever is bought on credit. There's also a credit risk that determines the interest on the loan, but that is a separate story. | d54199f0ca24313d0e3a60adb6ddf70316a6355b29d91e8873e1ba5d0224f814 | ['312eb9b414a44d17b8d8b94270214a91'] | Back in 2006, our mortgage broker easily got us two mortgages for use when purchasing a home with 10% down:
A non-conforming ("jumbo") loan with 80% LTV requirements covering 80% of the purchase, and
A HELOC for the remaining 10%
Would a scheme like that work after 2008, in particular in 2013? If not, are there other financing schemes that can be used to purchase a house with a low (five to ten percent) down payment when the amount of financing exceeding the "conforming" limits (708K in our area)?
|
acaf4b3368585cecbb8b4bdb38cf5ef5fd76e09e44ff44177eb732de2411be4e | ['313f137c31744512a8859a59f3288ef0'] | I am new to Neo4j and I am trying to compare two graphs in Neo4j. My first question is how to create two different graphs on Neo4j. I created something like below which is just like two disconnected graphs.
Neo4j graph
Is this the best way we can have two graphs in Neo4j for comparison or there is another way?
My second question is based on my requirement to find the common vertices and common edges in both graphs. How to get this information? I am using Java to connect to Neo4j to create and run Cypher queries.
There are some questions asked on this platform about this but none seems to be quite what I am looking for.
If anyone can even suggest better ways to implement similarity algorithms on large graphs, I would really appreciate it.
| 5332e275556d37f1ec26d50b513c4e771aae6fcb29c115bf6ef7785cba9fccd0 | ['313f137c31744512a8859a59f3288ef0'] | I want to design a crawler, using java, that crawls a webpage and extract certain contents of the page. How should I do this? I am new and I need guidance to start designing crawlers.
For example, I want to access the content "red is my favorite color" from a webpage which is embedded something like below:
< div >red is my favorite color< / div >
|
c67cfd3b1f5022ab2895a22ee820b093866c36cda79c8713bf7d880e4da42f20 | ['314426f290ed425fbe69216396bb16d5'] | I tried Speech API example for Windows Phone 8. in my call phone 2 languages install en-GB and en-IN and my phone default language is en-in, when i tried with en-gb, it is working fine but when i tried with phone default language which is en-in, it is not working
it gives error , it throws exception.
On this code:
Perform speech recognition.
this.recoOperation = recognizer.RecognizeAsync();
var recoResult = await this.recoOperation;
It throws Exception:
**SPERR_WINRT_UNSUPPORTED_LANG 0x800455BC The requested language is not supported.**
So, It is means what Indian English is not supported with Speech Recognitiona API or I should change some additional settings to make it work?
Thanks.
| c43989c1b59be0cafabf1756e20c8ccef4c4886cc7ee83b61b5ad30d3869a092 | ['314426f290ed425fbe69216396bb16d5'] | I am working on html5 uploading script.
I want md5 hash for every chunk of file stream.
here is I am using FileReader for reading stream but when I pass reader result to base64 class
I got exception.
Object doesn't support property or method 'charCodeAt'
var reader = new FileReader();
reader.onload = function (f) {
var hash = MD5(Base64.encode(f.target.result));
};
reader.readAsArrayBuffer(blob)
|
522199401397fca68b0b4d8aea38bb15de7c4eacc50659e0175b63904e589385 | ['314d5ecbe12a4d8f92914a814742cb78'] | I'm writing a python code that add events on my google calendar, but when i input lets say 1 PM, it add the event at 5PM in the calendar.
The timeZone are well set up I think :
'timeZone': 'America/New_York'
'timeZone': 'America/New_York'
And my google calendar timezone setting is GMT+00:00
What am I doing wrong?
| 31f5b375f473972d8f6d2b52af3daf2efe37f8b48b8299c80befb485c3bae161 | ['314d5ecbe12a4d8f92914a814742cb78'] | new to programming.
I have a class in java and i'm trying to write this program but it's printing none-stop and it's even bugging my browser! (Im using an online ide)
my instructions:
Q: how much do you love me?
Below 10 : wrong answer
equal to 10 and more = good answer
I know how to do it but I dont want the program to stop every time i write an answer. I want the program to keep running until i have a 10 +. So i can always input until it's 10+ out of 10.
this is my lines :
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner input = new Scanner (System.in);
System.out.println ("how much do you love me out of 10");
int num1 = input.nextInt();
while (true)
if (num1 <= 9) {
System.out.println("Wrong answer");
}
else {
System.out.println ("Good answer");
}
}
}
|
e513d42f1878ad3b6d40fa61dad8db046cf0abcdd7863f6494f1dfe73f5ddde4 | ['315efa95448a4c05867f5eb6d1c1efaa'] | I am trying to group items within a PHP foreach by their 'field->value' and get the sum of each group separately. This code below works, but I feel like there is a more efficient way of doing it?
Thanks in advance.
<?php
$number_1 = 0;
$number_2 = 0;
$number_3 = 0;
foreach ( $fields as $field ) {
if($field->value == 1) {
$number_1 += $field->number;
}
if($field->value == 2) {
$number_2 += $field->number;
}
if($field->value == 3) {
$number_3 += $field->number;
}
}
echo $number_1;
echo $number_2;
echo $number_3;
?>
| d89b3c568f8a4043c06df33807535fbb3798fe1a488c8c738b32c24a722976a7 | ['315efa95448a4c05867f5eb6d1c1efaa'] | I am trying to match a specific format mixed with numbers, and text. The numbers are dates that will vary.
These should match:
/shop/2017/12/04/string-of-text/another-string-of-text
/shop/2017/12/04/string-of-text/another-string-of-text/
These should not:
/shop/2017/12/04/string-of-text/another-string-of-text/more-text
/shop/2017/12/04/string-of-text/
/shop/2017/12/04/string-of-text
Is this even possible?
So far I've gotten this far, but it seems to match in some of the cases where it shouldn't:
^/shop/(.*?)/(.*)/(.*)/(.*)/(.*)$
|
3a0c1caf924cd666ba141840a1893ecccfdf8130924f2976d90ca19fed6d036d | ['315f8c428406479ca83abbe7f78712d6'] | I am attempting to create a tessellation shader:
#version 410 core
// define the number of CPs in the output patch
layout (vertices = 3) out;
uniform vec3 gEyeWorldPos;
// attributes of the input CPs
in vec3 WorldPos_CS_in[];
in vec2 TexCoord_CS_in[];
in vec3 Normal_CS_in[];
// attributes of the output CPs
out vec3 WorldPos_ES_in[];
out vec2 TexCoord_ES_in[];
out vec3 Normal_ES_in[];
float GetTessLevel(float Distance0, float Distance1)
{
float AvgDistance = (Distance0 + Distance1) / 2.0;
if (AvgDistance <= 2.0) {
return 10.0;
}
else if (AvgDistance <= 5.0) {
return 7.0;
}
else {
return 3.0;
}
}
void main()
{
// Set the control points of the output patch
TexCoord_ES_in[gl_InvocationID] = TexCoord_CS_in[gl_InvocationID];
Normal_ES_in[gl_InvocationID] = Normal_CS_in[gl_InvocationID];
WorldPos_ES_in[gl_InvocationID] = WorldPos_CS_in[gl_InvocationID];
// Calculate the distance from the camera to the three control points
float EyeToVertexDistance0 = distance(gEyeWorldPos, WorldPos_ES_in[0]);
float EyeToVertexDistance1 = distance(gEyeWorldPos, WorldPos_ES_in[1]);
float EyeToVertexDistance2 = distance(gEyeWorldPos, WorldPos_ES_in[2]);
// Calculate the tessellation levels
gl_TessLevelOuter[0] = GetTessLevel(EyeToVertexDistance1, EyeToVertexDistance2);
gl_TessLevelOuter[1] = GetTessLevel(EyeToVertexDistance2, EyeToVertexDistance0);
gl_TessLevelOuter[2] = GetTessLevel(EyeToVertexDistance0, EyeToVertexDistance1);
gl_TessLevelInner[0] = gl_TessLevelOuter[2];
}
However, when I run my game, I get the following error:
Error: 1281
Tessellation shader wasn't able to be compiled correctly. Error log:
ERROR: 0:? : '' : Incorrect GLSL version: 410
WARNING: -1:65535: 'GL_ARB_explicit_attrib_location' : extension is not available in current GLSL version
WARNING: 0:4: 'vertices' : symbol not available in current GLSL version
WARNING: 0:? : 'gl_InvocationID' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_InvocationID' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_InvocationID' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_InvocationID' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_InvocationID' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_InvocationID' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_TessLevelOuter' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_TessLevelOuter' : variable is not available in current GLSL version
WARNING: 0:? : 'gl_TessLevelOuter' : variable is not available in current GLSL version
WARNING: 0:? : '
My game appears to be ignoring the shaders, but I guess that is expected with so many errors?
I have already tried googling the error, however I am unable to find any solution or even information on why this is happening.
How can I fix the above errors so my shader can run correctly?
| 803f298a1867fa5595e91c6e8266f9cf9d4e5096f23c306523b2d376020de4f4 | ['315f8c428406479ca83abbe7f78712d6'] | I have drawn some buttons on a JFrame, however when the user clicks the "Shop" button, I would like to wipe what is currently drawn and draw some new stuff.
When the user clicks the "Shop" button again, I would like to close the shop and for the old stuff to re-appear again and the shop menu to dispensary.
How can I do this without creating an entire new JFrame?
|
53fc6cd23c6483b278ee2fd34c2bbaeec5ca59da503f68cccd43e77aa61201d1 | ['316a1fdbebae46f587741367d5a33c14'] | Just expending <PERSON>'s post its better to check if directory exists before creating a directory
private void button1_Click(object sender, EventArgs e)
{
//all the directories
string[] path = {"C:\\Test", "C:\\TestABC", "C:\\Test1\\123", "C:\\Test2\\145"};
for(int i = 0; i < path.Length; i++)
{
if(!Directory.Exists(path[i])
Directory.CreateDirectory(path[i]);
}
}
| 625d53ad8b59bb54b0b0a83ff5aee112ed138304665ad34978558d8bd781e697 | ['316a1fdbebae46f587741367d5a33c14'] | I think your finally code block is working fine. Maybe your lbl text is lost because view state isn't enabled.
I advise you shouldn't write error messages in finally block. Finally block is used for code cleanup etc.
Here you need to put your error message in catch block.
A few more things about try catch finally
Try Block: wrap the code with try block where you are doing stuff (DB retrieval, connections, calling functions etc)
Catch block: The code wrapped in these blocks will be executed when there is an exception in try block, If you want you can have multiple catch blocks each for a specific exception.
Finally: Well finally block always runs regardless of exception or successful execution of try block and this block is used for code cleanup. consider this example - you created a db connection and then try to retrieve some data, you connection is successful but there is an error in your query then there will be an exception and it will come to catch block. what you need to do is to close the connection in finally that way you will not have any open connection.
I hope it will help.
|
4944212183a0e88b75c68b6c8a373b226a193142c5478b3fac93fd376acdaa89 | ['3173b20416f74c33b7b2101631a0cb31'] | Supposedly there is some built in hard drive magic called "Secure Erase" which is wildly faster and more secure than "dd if=/dev/zero..."
I am most excited about the speed increase.
There seems to be a GUI for it as part of Parted Magic: http://www.ocztechnologyforum.com/forum/showthread.php?81321-Secure-Erase-With-bootable-CD-USB-Linux..-Point-and-Click-Method
Is there something like this for Ubuntu? Better yet, is there a way to actually issue this command "manually" like with smartctl or something?
| 22913b9ee457b927866b0460bddc04382a04b5bb7fee8ef7461b3882dbb28c2a | ['3173b20416f74c33b7b2101631a0cb31'] | We used i18n module to have our nodes as translatable.
However we also themed a specific nid with e.g node--9.tpl.php.
Problem is that i18n creates separate nodes(this separate nids), for each translation language, thus the theme file only applies to 1 version of that particular node.
How can I handle this?
|
a3944d19b0f92fc7e09be9c15708b935b107e955945b30e2b308582bb16e17db | ['318011db479e49fe87e7fb617c532505'] | Lets say you have two instances, A and B, of the access type T. The Adjust method is then called when you do B := A.
But be careful when using this method, since it can create memory leaks when not properly used! If your idea is B to hold a full new reference to object A, then leave it empty. In that case, every pointer within B will point to the same location in memory as the pointers within A.
Just complete the method if you want to perform value type assignments, that is to say, when you want the objects to have the same "data" but in different memory locations, so that if you change A, then B will not notice it. In that case you can manually assign the values of each pointer inside the Adjust method, and create/free the internal objects if necessary.
| 66b992d5bc30af45a940f5060a08774553812d09896a7c47aca6e1bdd83419a7 | ['318011db479e49fe87e7fb617c532505'] | I would like to instruct the Ada compiler to select between two different blocks of code, depending on predefined static compiler directives, such as for instance "DEBUG" or "RELEASE". I would like to do something like this:
if DEBUG then
< COMPILE THIS CODE >
end if;
if RELEASE then
< COMPILE THIS OTHER CODE >
end if;
C# and other languages offer the #define directive for this. Has Ada something similar to offer? And if not, how is this done in Ada?
|
548250a03d50bf113efe8ef22a292b9658cc435b46de9f04c406dc15f8ae08d2 | ['3180771ca61a4de89d4394355515aaae'] |
I want to get rid of that space in the legend between the name and the percentage. In the pic, I have highlighted the space in yellow.
For example, I want the first legend item to be "Lithuania (30.5%)". That extra space between "Lithuania" and "30.5%" spoils my UI.
My code for the legend is the following:
// Add and configure Series
var pieSeries = chart.series.push(new am4charts.PieSeries());
pieSeries.dataFields.value = "litres";
pieSeries.dataFields.category = "country";
pieSeries.slices.template.stroke = am4core.color("#fff");
pieSeries.slices.template.strokeWidth = 2;
pieSeries.slices.template.strokeOpacity = 1;
pieSeries.ticks.template.disabled = true;
pieSeries.labels.template.disabled = true;
// This creates initial animation
pieSeries.hiddenState.properties.opacity = 1;
pieSeries.hiddenState.properties.endAngle = -90;
pieSeries.hiddenState.properties.startAngle = -90;
pieSeries.legendSettings.labelText = '{category}';
pieSeries.legendSettings.valueText = null;
pieSeries.labels.template.text = "{category}: {value}";
pieSeries.slices.template.tooltipText = "{category}: {value}";
chart.legend = new am4charts.Legend();
chart.legend.fontSize = 5;
chart.legend.markers.template.width = 5;
chart.legend.markers.template.height = 5;
What change must I make in order to get this done?
| 1b3073a6b539edf824c3b55255102874817cd70e3e6d953a5b6d170bc149ce20 | ['3180771ca61a4de89d4394355515aaae'] | I have created a backend module that contains the endpoints classes. It also has libraries that contain the endpointapi classes. During compile time, I am able to import both, the classes of that module and its library in the MainActivity file of the app. During run time however, it fails to detect the classes present in the library of the module. What could be the issue?
The error while running code is as follows:
Error:(10, 66) error: package com.example.shashank_pc.myapplication.backend.tempClassApi does not exist
The folder structure for backend module inside project is as follows:
For some reason, the classes inside the backend libraries, such as the those present in the tempClassApi and myApi folder, are not being detected
settings gradle file:
include ':app', ':backend'
App module gradle build file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.example.shashank_pc.testcloudendpoints"
minSdkVersion 22
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/bm/*'
exclude 'com/google/appengine/repackaged/org/codehaus/jackson/impl/*'
exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/*'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.code.findbugs:jsr305:2.0.1'
testCompile 'junit:junit:4.12'
compile project(':backend')
}
|
96708688add51a406adfaeafb9eee51ffb82f74777ee18c6b9ef8cd485e536a9 | ['3196744daa15418f9622c51f64cefea4'] | To make this topic 'more complete'.
I required the column names and data types on a SELECT statement (not a table).
If you want to do this on a SELECT statement instead of an actual existing table, you can do the following:
DROP TABLE IF EXISTS abc;
CREATE TEMPORARY TABLE abc AS
-- your select statement here!
SELECT
*
FROM foo
-- end your select statement
;
select column_name, data_type
from information_schema.columns
where table_name = 'abc';
DROP IF EXISTS abc;
Short explanation, it makes a (temp) table of your select statement, which you can 'call' upon via the query provided by (among others) @a_horse_with_no_name and @selva.
Hope this helps.
| 19046350e06a99e96ffb94e8449ab1e452492e11612c30a37655e66e654dc9c3 | ['3196744daa15418f9622c51f64cefea4'] | I know this topic is years old, however during my own search for the same, this one popped up. I believe the requester is looking for the following in views.py:
views.py
class Overview(ListView):
model = models.data
template_name = "overview.html"
def get_queryset(self):
name = self.request.resolver_match.url_name
print(name)
Do note that I'm using class based views. Within regular views, the name can be retrieved as follows (not tested):
def current_url_name(request):
html = "<html><body>Url name is {}.</body></html>".format(request.resolver_match.url_name)
return HttpResponse(html)
The url name is within the (self.)'request' variable. From within your view, 'resolver_match.url_name' is the one you're looking for.
Hope this helps people in search of the same.
|
8c9d6ef7f9138d75eec2fb6b6fbcc6fbf0bb737130a8b68d1f034ccd877e6c52 | ['31a5d719510540278a7b6fe52408c72d'] | I need to use scannner to take input from user for data type double separated by white space.
Scanner input = new Scanner(System.in);
System.out.print("exampleDouble: ");
double db = input.nextDouble();
db+=input.nextLine();
I thought this would work, looking for a simple statement for capturing 2 values (both double, separated by space). no arrays. only need to capture 2 values , not more.
Example : 58.0 57.3
| cadc8a1ee4363d66296ef422d7db8a11303334edbcb668148fc1dcf9b4f67f89 | ['31a5d719510540278a7b6fe52408c72d'] | I need to report my result % the 10,000,001st prime.
Examples of input/output:
Enter a natural number (non-negative integer): 12
factorial 120152218
superfactorial: <PHONE_NUMBER>
ultrafactorial: 170942852
My code to calculate factorial, superfactorial and ultrafactorial:
public class UltraFactorial {
public static int ultrafactorial(int n) {
if (n == 0 || n == 1) {
return factorial(n);
} else {
return superfactorial(n) * ultrafactorial(n-1);
}
}
public static int superfactorial(int n) {
if (n == 0 || n == 1) {
return factorial(n);
} else {
return factorial(n) * superfactorial(n-1);
}
}
public static int factorial(int n) {
if(n == 0 || n == 1) {
return n;
} else {
return n * factorial(n-1);
}
}
public static void main(String []args){
Scanner console=new Scanner(System.in);
int n=console.nextInt();
System.out.println("factorial of n="+factorial(n));
System.out.println("superfactorial of n="+superfactorial(n));
System.out.println("superfactorial of n="+ultrafactorial(n));
}
}
|
c46b037b7a51671153db484eaff2e4b93c80eaa1537ac980e1766d08f7f5448f | ['31a83b04f585456881e26187703bcc75'] | function scrollWithin(wrapperElementId, innerElementId) {
// get the inner element
var innerElement = document.getElementById(innerElementId);
// calculate the offset top to to wrapper element plus the element height
var topPos = innerElement.offsetTop + (innerElement.offsetHeight / 2);
// zoom the wrapper element to the inner element
document.getElementById(wrapperElementId).scrollTop = topPos;
}
scrollWithin('scrollable', 'item3');
hope I got your point. Here is a fiddle to test: https://jsfiddle.net/ukhzxs59/
| 035bd49fe2c18b43dffd4c2b7df3f36cc0419e781cf0e26b4bbfd0c74d69a7d4 | ['31a83b04f585456881e26187703bcc75'] | The Angular DatePipe returns a string, not a number. Your switch case checks for numbers. So change your cases to a string or value to string.
And another hint: Date didn't start with 0 (so june is 6, not 5):
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'nomeMes'
})
export class NomeMesPipe implements PipeTransform {
transform(value: any): string {
if (value && !isNaN(value)) {
value = +value;
switch (
value // Converte o numero em nome do mês
) {
case 1:
value = '<PERSON>';
break;
case 2:
value = '<PERSON>';
break;
case 3:
value = '<PERSON>';
break;
case 4:
value = '<PERSON>';
break;
case 5:
value = '<PERSON>';
break;
case 6:
value = '<PERSON>';
break;
case 7:
value = '<PERSON>';
break;
case 8:
value = '<PERSON>';
break;
case 9:
value = '<PERSON>';
break;
case 10:
value = '<PERSON>';
break;
case 11:
value = '<PERSON>';
break;
case 12:
value = '<PERSON>';
break;
}
return value;
}
}
}
|
ff2be397a4e1ab4f224c3e6c1c9238dbb7a0dc71c15ba86c921693bcfbee839a | ['31a91c3c1be1480bb342da4731076bfb'] | I have created a sidebar that hides with the .click() function targeting an image with the id of "cross".
It is my goal to have page load with no sidebar (.sidebar_menu) visible, and with my menu hamburger (.bars) visible . How do i do this?
HTML:
<img class="bars toggle_menu" src="http://res.cloudinary.com/dnooxiorz/image/upload/v1502388038/thinbarsfinal_knx5mw.png">
<div class="sidebar_menu">
<img id="cross" src="http://res.cloudinary.com/dnooxiorz/image/upload/v1502391349/cross_tcn6yk.png">
<center>
<a href="index.html"><h1 class="boxed_item">HELLO</h1></a>
</center>
<ul class="navigation_selection">
<a href="#"><li class="navigation_item">Projects</li></a>
<li class="navigation_item">About</li>
<li class="navigation_item">Resume</li>
</ul>
</div>
Javascript:
$(document).ready(function(){
$("#cross").click(function(){
$(".sidebar_menu").addClass("hide_menu");
$(".toggle_menu").addClass("opacity_one");
});
$(".toggle_menu").click(function(){
$(".sidebar_menu").removeClass("hide_menu");
$(".toggle_menu").removeClass("opacity_one");
});
});
Best,
<PERSON>
| 3e587d8d76830ef7e80575a23d692bd0afc0be673fa7759e89e1e29e5c5a15ec | ['31a91c3c1be1480bb342da4731076bfb'] | I need some help building an image slider in css/HTML.
My issue is that the five images i have to slide in are not hidden therefore they span the entire width of 2 webpages creating a horizontal scrollbar. I want the images sliding in to be hidden so there is no horizontal scrollbar.
.slider {
height: 350px;
}
.slider figure div {
width: 20%;
float: left;
}
.slider figure img {
width: 100%;
float: left;
}
.slider figure {
position: relative;
width: 500%;
left: 0;
animation: 40s slidy infinite;
}
<div class="slider">
<figure>
<div class="slide"><img src="#"></div>
<div class="slide"><img src="#"></div>
<div class="slide"><img src="#"></div>
<div class="slide"><img src="#"></div>
<div class="slide"><img src="#"></div>
</figure>
</div>
|
d29a62d2c31006dace800e44ee652577bd19bf0c4e953022d44154153dbe7c05 | ['31abf6c4cf334072af4d8286b18de93c'] | Хочу чтобы из места обозначенного комментарием //это место "перекинуло" в цикл обозначенного //этот цикл, при том, что они находятся в разных методах. Если что ниже приведённый код не работает и как его исправить?
public Token nextToken()
{
position = skipWhitespaces(code, position);
if (position == -1) {
goto mainLoop; //здесь ошибка //это место
//System.exit(0);
return null;
}
StringBuilder buffer = new StringBuilder();
char current = code.toCharArray()[position];
while (current != ' ')
{
buffer.append(current);
position++;
if (position >= code.length()) {
//end of parsing input string
break;
}
current = code.toCharArray()[position];
}
//System.out.println(buffer.toString());
TokenType tokentype = getTokenTypeByName(buffer.toString());
if (tokentype == null) throw new RuntimeException(buffer.toString());
addToken(tokentype, buffer.toString());
return new Token(buffer.toString(), tokentype);
}
public void tokenize(String[] input)
{
for (String thisStr : input)
{
code = thisStr;
mainLoop:for (position = skipWhitespaces(code, 0); position < code.length(); position++) //этот цикл
{
//System.out.println(position);
if (position == -1) System.exit(0);
Token thisToken = nextToken();
//System.out.println(thisToken.text + '\t' + thisToken.getName());
if (thisToken == null) return;
parseToken(thisToken);
}
}
}
Если что задавайте вопросы
| 2f68aca46717522d77675ad9d8d735af302dd6679e28a2b5d184f1d942c4da0f | ['31abf6c4cf334072af4d8286b18de93c'] | Занимаюсь разработкой виртуальной машины на C# используя .NET Core 1.1. Для неё есть специальные исполняемые файлы в которых прописаны названия подключаемых dll библиотек (и не только, но это не суть). Все эти библиотеки находятся в папке vmlib. Каждая из них имеет главный класс наследуемый от VMLibrary и имеют название библиотеки, например System, и имеют метод Load не принимающий аргументов. Названия библиотек в исполняемом файле моей виртуальной машине написаны через запятую. То есть например пользователь указал 2 библиотеки "sys, tex" и вм (виртуальная машина) должна их найти в папке vmlib, затем в каждой библиотеке найти главный класс и выполнить метод Load.
Подскажите как реализовать такое, потому что после долгих поисков в интернете я ничего подобного не нашёл :(
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.