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 |
|---|---|---|---|---|---|
f70b47e7f50793a223708465e8ad78b835b27d01aadcb69280d97d0debf31605 | ['c6048c27d1294d7abd394d85a73d0b1c'] | I have made a Music Genre Classification Convolutional NN Model in Tensorflow and I face a issue:
I have 999 music Spectrogram images in my X and also have appropriate labels(y). The images are of size (128,1293).
When I check the shape of X it shows me (999,),which signifies number of images ; however I wish to expand X to include the dimensions of the image(1 color channel) to (999,128,1293,1) to feed into my CNN.
I read somewhere you can do it by cv2.resize() , but I am unsure of that method. Any kind of help would be appreciated.
| 21b5f2c85c3025c0d7c42686f92b22e3da93ab109dd61247f802e92bd977901f | ['c6048c27d1294d7abd394d85a73d0b1c'] | I am plotting a scatter plot of price of houses w.r.t latitude and longitude.
I want to reverse the palette so that the red color depicts the most expensive house.
plt.figure(figsize=(12,8))
sns.scatterplot(x='long' ,y='lat' ,data=non_top_1_perc ,hue='price' ,edgecolor=None ,
alpha=0.2,palette='RdYlGn' )
Here's the plot
|
518b3b47917ab1f9d45fec046452b934ccd9c9d26adc603390008b8f8f569aab | ['c60edd9082924bc08be54bfb9e301879'] | I have NodeJS on / path.
On /another.ejs path, I have a little website and I wanna get data from /value path.
I cannot do this call with pure JS and AJAX, because of CORS.
Can I do something like when I click on button, it calls function in NodeJS and return data?
| ab03956affbff7c46c08af8d681ad21f7a00b1debb67443e75c97374febe795e | ['c60edd9082924bc08be54bfb9e301879'] | // index.js //
module.exports = (req, res) => {
res.send("Hello World!");
};
This function is called when I require the file.
let index = require("./index.js");
app.get("/", index);
Can I add some another functions to module.exports?
Like this:
// index.js //
module.exports = (req, res) => {
res.send("Hello World!");
},
hi: (req, res) => {
res.send("Hi!");
};
let index = require("./index.js");
app.get("/", index);
app.get("/hi", index.hi);
|
ac93ea7e6e5bef5568ce9634f7c3a22d1ad3febba6c0923ccbab7bab00415e04 | ['c61dc172e76a498381aeb787b72716d4'] | if (!isset($_COOKIE['language'])) {
$GLOBALS['langswitch'] = "EN";
} elseif ($_COOKIE['language'] === "tr") {
$GLOBALS['langswitch'] = "EN";
} elseif ($_COOKIE['language'] === "en") {
$GLOBALS['langswitch'] = "TR";
}
function languageSwitch (){
if ($GLOBALS['langswitch'] == "EN"){
echo "en";
} elseif ($GLOBALS['langswitch'] == "TR"){
echo "tr";
}
}
if ($_POST['language'] == "tr"){
$GLOBALS['langswitch'] = "EN";
echo "test1";
} elseif ($_POST['language'] == "en"){
$GLOBALS['langswitch'] = "TR";
echo "test2";
}
if ($GLOBALS['langswitch'] === "EN") {
setcookie("language", "tr", time()+(86400 * 365), "/", $vars->networkSite);
} elseif ($GLOBALS['langswitch'] === "TR"){
setcookie("language", "en", time()+(86400 * 365), "/", $vars->networkSite);
}
and using form like this
<form class="vertical-align position-relative" action="<?=$_SERVER['PHP_SELF']?>" method="post">
<button class="nav-link languageShortHand" type="submit" value="<? languageSwitch();?>" name="language"><?= $GLOBALS['langswitch'] ?></button>
</form>
fixed the problem thanks to the suggestion of TemporaryName
| 90e9074a82a595fba5881f9305b1cb0b7886941a9433a725b66b40877018b5b2 | ['c61dc172e76a498381aeb787b72716d4'] | I have a function to change my website's language and inside this function there is an if statement which chooses between two languages (Turkish and English) but before i run the function the if statement works and conditions apply i want to wait until after the function is executed.
setcookie("language", "tr", time()+(86400 * 365), "/", $vars->networkSite);
function langUrl(){
if (!isset($_COOKIE['language'])) {
$GLOBALS['langswitch'] = "EN";
$GLOBALS['language'] = "TR";
} elseif ($_COOKIE['language'] === "tr") {
setcookie("language", "en", time()+(86400 * 365), "/", $vars->networkSite);
$GLOBALS['langswitch'] = "EN";
$GLOBALS['language'] = "TR";
} elseif ($_COOKIE['language'] === "en") {
setcookie("language", "tr", time()+(86400 * 365), "/", $vars->networkSite);
$GLOBALS['langswitch'] = "TR";
$GLOBALS['language'] = "EN";
}
}
<button class="nav-link languageShortHand" type="submit" value="<? langUrl(); ?>"><?= $GLOBALS['langswitch'] ?></button>
I want to execute if after executing the function. Thanks for your help in advance
PS: If I try to run this code like this every time I refresh the page language switches. You can see the problem on https://umutore.com
|
2e06a816e6bbf6db1b981ddb380f1ddee57d6eb5972fbef3a60b9ffdef413c61 | ['c6210c9f6a9244b7b7e842301bcfc90a'] | I have a Gridview within an UpdatePanel that shows some data from my Database. When you click on an edit button, it opens up a detailsView within a ModalPopupextender. When you enter in data in the textBoxes in this detailView and click "update", the Database is updated but the popup does not hide. Then, when I close it manually by clicking "close", the gridView does not refresh unless I refresh the page. I was able to get this to work before, but after spending a week staring at this problem, I decided to ask you guys to see what I am doing wrong.
Here's some code! (Note: a lot of this is an adaptation of a tutorial I found)
<asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="gvReservations" runat="server" CssClass="datagrid" DataKeyNames="dateSubmit"
AutoGenerateColumns="false" AllowPaging="true" AllowSorting="true" PageSize="10"
DataSourceID="mainTable" Width="95%" OnRowUpdated="gvReservation_RowUpdated" OnRowDataBound="OnRowDataBound" OnSelectedIndexChanged="GvReservations_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="dateSubmit" HeaderText="Date Submitted" SortExpression="dateSubmit"
ReadOnly="true" />
<asp:BoundField DataField="lName" HeaderText="Name" SortExpression="lName" ReadOnly="true" />
<asp:BoundField DataField="startTime" HeaderText="Start Time" SortExpression="startTime"
ReadOnly="true" />
<asp:BoundField DataField="endTime" HeaderText="End Time" SortExpression="endTime"
ReadOnly="true" />
<asp:BoundField DataField="labName" HeaderText="Lab" SortExpression="labName" ReadOnly="true" />
<asp:BoundField DataField="class" HeaderText="Class" SortExpression="class" ReadOnly="true" />
<asp:BoundField DataField="term" HeaderText="Semester" SortExpression="term" ReadOnly="true" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="btnViewDetails" runat="server" Text="more" CommandName="Select" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Panel ID="pnlPopup" runat="server" CssClass="detail" Width="500px" Style="display: none;">
<asp:UpdatePanel ID="updPnlReservationDetail" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btnShowPopup" runat="server" Style="display: none" />
<ajaxToolkit:ModalPopupExtender ID="mdlPopup" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlPopup" CancelControlID="btnClose" BackgroundCssClass="modalBackground" />
<asp:DetailsView ID="dvReservationDetail" runat="server" DataSourceID="SqlDetail"
OnDataBound="ReservationDetail_DataBound" CssClass="detailgrid" GridLines="None" DefaultMode="Edit" AutoGenerateRows="false"
Visible="false" Width="100%" OnItemUpdating="ReservationDetail_Updating" OnItemUpdated="ReservationDetail_Updated">
<Fields>
<asp:TemplateField HeaderText="ID">
<EditItemTemplate>
<asp:TextBox ID="tbID" runat="server" Text='<%# Bind("id") %>' ReadOnly="true" />
</EditItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="LabName" DataField="labName" />
<asp:BoundField HeaderText="DateSubmitted" DataField="dateSubmit" />
<asp:TemplateField HeaderText="Start Time">
<EditItemTemplate>
<asp:TextBox ID="startTime" runat="server" Text='<%# Bind("startTime") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="End Time">
<EditItemTemplate>
<asp:TextBox ID="endTime" runat="server" Text='<%# Bind("endTime") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="true" />
</Fields>
</asp:DetailsView>
<div class="footer">
<asp:LinkButton ID="btnClose" runat="server" Text="Close" CausesValidation="false" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
These are the events where I thought it would close the popup and update the gridView
protected void ReservationDetail_Updated(object sender, DetailsViewUpdatedEventArgs e)
{
if (this.Page.IsValid)
{
// move the data back to the data object
// this.dvReservationDetail.UpdateItem(false);
dvReservationDetail.Visible = false;
// hide the modal popup
mdlPopup.Hide();
// refresh the grid
this.gvReservations.DataBind();
this.updatePanel.Update();
}
}
Thanks for the help!
| 16f738c9fa3a0278d038ed0b508a15da7072a99214eb1e36821c43aa21c07f74 | ['c6210c9f6a9244b7b7e842301bcfc90a'] | Actually I can do that, thank you <PERSON>, using the one word userID/user name however I wanted to login with my first ID as well.
Is there a way to change/reset my userID, which has two words in it, without loosing functionality of other programs/software as I may not be able to login to a database managed software like Oracle.
In fact I would like all easy methods, just warn me if a method will cast me to lose functionality of other programs.
Thank you |
5adcbf0739861690d05b38cf764505f6ec46214d834ab9b8edf19c99a47c82ec | ['c6243e8e654a4eaca148c495144baa06'] | Покажите реализацию класса Obstacle - вожможно, там используется Image вместо BufferedImage или выполняются какие-то расчёты в методе getImage. Ещё пара советов: 1) не надо хранить координаты в отдельном массиве, их можно поместить в экземпляры класса Obstacle 2) в методе run() не надо постоянно вызывать System.getCurrentMillis(), лучше сохранять время в переменную, тогда достаточно получать время один раз до цикла и один раз внутри цикла. | d2e0b124b3ab680261843b51750a54ab8d771c6ce68e044b4047b20b2faf95f3 | ['c6243e8e654a4eaca148c495144baa06'] | I'm trying to solve a classification problem using a random forest in R. The training data is a particle's charge at 30 different time instances. However, I need to convert this 30 dimensional data into a single value. I've tried using the sum of the charge across the 30 time bins and I've tried using the variable importance to calculate a weighted sum. To clarify, I fitted a random forest to the 30 dimensional training data and then used the resulting variable importance values to assign a weighting to each time interval for the weighted sum.
Then I trained a random forest on the one dimensional data using the sum and the variable importance weighted sum values. However, the random forest performed better when I wasn't using a weighted sum.
I've tried this with the standard randomForest package and the cforest package and I get the same results.
Could anybody explain why the weighted sum doesn't perform better? In principle should using a weighted sum work better?
|
c0391bcb2c9e00c3d8d8ae337362f66a278b366c6fec712a96b23ca53687519e | ['c66aa33fdac34398a561f4bff8f503ee'] | The closest thing I found is this command ffmpeg -i in.mp4 -filter:v "crop=in_w:in_h-40" -c:a copy out.mp4
, which crops the video 20px from the top and 20px from the bottom.
What's the command to only crop from the top? I couldn't figure it out.
| 8abb25efdc44c2dfaaab43c2fb745364fb304f2a01f8973ceebf4d3a3bc116e1 | ['c66aa33fdac34398a561f4bff8f503ee'] | I have a code snippet like this
#include <cstring>
#define DISABLE_DEFAULT_NEW \
void* operator new(size_t aSize, void* aPtr); \
void operator delete(void* aPtr);
class A
{
public:
DISABLE_DEFAULT_NEW
A() {}
};
int
main()
{
A* a = new A();
return 0;
}
When I compile it, I see error messages like this
disable_new.cpp:17:10: error: no matching function for call to 'operator new'
A* a = new A();
^
disable_new.cpp:9:3: note: candidate function not viable: requires 2 arguments, but 1 was provided
DISABLE_DEFAULT_NEW
^
disable_new.cpp:3:9: note: expanded from macro 'DISABLE_DEFAULT_NEW'
void* operator new(size_t aSize, void* aPtr); \
^
1 error generated.
My question is where does the default new operator go? I'd expect the default syntax of new still work, is it behaviour mentioned anywhere in the spec?
|
e2e6762a46b0286b04847eba94dee02e1d77f830e12e7ffbed46f267c0f54d95 | ['c66decb764844d638625ed5405d593c8'] | My VB has failed. It's 99% of the way there. Just setting up the While Not end of file loop. It's flummoxed me sorry. If you knew the number of Hex entries you could do a do or while loop setting the counter to that number and just decrement the counter. | 221cee6bf9bc4215a4682335ae3b92c7071f97632e42eaa0e08d85071b2cd333 | ['c66decb764844d638625ed5405d593c8'] | I am really trying hard to force myself into believing this, but I just can't fathom. This makes me wonder why Christianity is even a religion. I like and follow the teachings of <PERSON>, but it's hard to believe that <PERSON> was a God (or the God, sorry). |
87d5cd1b7739be07010e6505523b6052f6e958ebc37de5c8cd948bb89666871e | ['c675ee1fd5654c4a871a333706278c76'] | if both white noise sound is traveling in same direction And if their frequency is in phase matched up, then only they get added. But, one thing i am not sure about is after adding up will it remain as white noise or it will become some other type of sound having different frequency.
| 650aae0866859077b478ad48a2623550ec5b8d2e949b8fb0c9f94c360f56a4dd | ['c675ee1fd5654c4a871a333706278c76'] | En esta dirección tienes herramientas conversoras:
using System;
public static void Main(string[] args)
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner ob = new Scanner(System.in);
Solution solution = null;
int testcases = ob.Next();
ob.nextLine();
for (int i = 0; i < testcases; i++)
{
string numsLine = ob.nextLine();
string[] numsLineParts = numsLine.Trim().Split(" ", true);
int dimensions = Convert.ToInt32(numsLineParts[0]);
int numOperations = Convert.ToInt32(numsLineParts[1]);
solution = new Solution(dimensions);
for (int j = 0; j < numOperations; j++)
{
string line = ob.nextLine();
string[] lineParts = line.Split(" ", true);
if (lineParts[0].Equals("UPDATE"))
{
solution.update(Convert.ToInt32(lineParts[1]) - 1, Convert.ToInt32(lineParts[2]) - 1, Convert.ToInt32(lineParts[3]) - 1, Convert.ToInt32(lineParts[4]));
}
if (lineParts[0].Equals("QUERY"))
{
solution.query(Convert.ToInt32(lineParts[1]) - 1, Convert.ToInt32(lineParts[2]) - 1, Convert.ToInt32(lineParts[3]) - 1, Convert.ToInt32(lineParts[4]) - 1, Convert.ToInt32(lineParts[5]) - 1, Convert.ToInt32(lineParts[6]) - 1);
}
}
}
}
|
1028f44932f4f0b452643f2aebcae2b9f8c7bbd6dab186186f98b1f00cf30e37 | ['c67e06256ea647fcb8c1a008d4bfed4e'] | Is there a name for the infinite (repeating, unending) sentence or paragraph? Here is an example of what I mean:
<PERSON> is a chef, painter, author and vocalist from San Francisco who enjoys vinyl records, black and white movies and referring to himself in third-person, as in “<PERSON> is a chef, painter, author and vocalist from San Francisco who enjoys vinyl records, black and white movies and referring to himself in third-person, as in "<PERSON> is a chef, painter, author and vocalist from San Francisco who enjoys vinyl records, black and white movies and referring to himself in third-person, as in "<PERSON> is a chef, painter, author and vocalist from San Francisco who enjoys vinyl records, black and white movies and referring to himself in third-person, as in...........
| f5527950460a4053ca3aeead692e642630408be0cc869a18c92fe818f0912b02 | ['c67e06256ea647fcb8c1a008d4bfed4e'] | @VladD, Действительно ошибку выдает:
BindingExpression path error: 'IsHidden' property not found on 'object' ''MainViewModel' (HashCode=21855962)'. BindingExpression:Path=IsHidden; DataItem='MainViewModel' (HashCode=21855962); target element is 'ListView' (Name=''); target property is 'NoTarget' (type 'Object')
Свойство разместил во ViewModel. Но не в MainViewModel, а в BookViewModel, там, где описаны все поля. |
402d91d6eb03fa65cdac5b077d727e17ae3629ccb2011d60ad03ca38acf01769 | ['c69083496b9e4f3fa33a85579f66cacc'] | I'm trying to pass a global defined array as an argument to a function.
I thougt this function would treat the argument as a local variable.
But it doesn't... Changing the (in my opinion) local variable also changes the values of the global array. What am I doing wrong?
clickX = [];
for(var i=0; i<10; i++) {
clickX[i] = i;
}
doThis(clickX);
function doThis(x) {
for(var i=0; i<x.length; i++) {
x[i]++;
alert(clickX[i]); // this alerts the changed value of x[i] and not the origin value of the global array
}
}
jsfiddle:
https://jsfiddle.net/n546rq89/
| 50750fc8bc7b614b18685247c9c849216b5dc6796ddf2c223c0bdabdb270673a | ['c69083496b9e4f3fa33a85579f66cacc'] | I'm planning to develop a HTML5-App which should be capable of playing 360°-Videos using the Device Orientation of the smartphone. By moving the smartphone the player should pan and tilt the video.
A first idea was to simply embed a YouTube-360-Video. But the YouTube-Browser-Player doesn't seem to make use of the device orientation, in contrast to the YouTube-App.
My second idea is to use krpano and to hand over the orientation to the krpano-player.
Is this possible or do you have another idea to solve this problem?
|
dfb66a4ec313372da40adc76b50674de4f5c33e32c690e942741f713f224f476 | ['c69af8750a154e6c9084d27ae7fbc766'] | I have 2 separate JS objects which need to be merged into the same property.
The objects currently look like this:
Object 1:
[0:{"acircuit":"ABCDEFGH","astatus":"Test"}, 1:{"acircuit":"IJKLMNOP","astatus":"Test2"}]
Object 2:
[0:{"bcircuit":"ABCDEFGH","bstatus":"Test3"}, 1:{"bcircuit":"IJKLMNOP","bstatus":"Test4"}]
I need to merge these results into one so it appears as the following:
[
0:{"acircuit":"ABCDEFGH","astatus":"Test","bcircuit":"ABCDEFGH","bstatus":"Test3"},
1:{"acircuit":"IJKLMNOP","astatus":"Test2","bcircuit":"IJKLMNOP","bstatus":"Test4"}
]
Current code looks like this:
allResults = {this.state.aCircuitResults.concat(this.state.bCircuitResults)}
However, the results appear like this:
[
0:{"acircuit":"ABCDEFGH","astatus":"Test"},
1:{"acircuit":"IJKLMNOP","astatus":"Test2"}
2:{"bcircuit":"ABCDEFGH","bstatus":"Test3"},
3:{"bcircuit":"IJKLMNOP","bstatus":"Test4"}
]
Thanks in advance.
| ddc0894e3fc901ed9f149188a4f8b8c0302d91184538eb13a3c0f8ae234f3670 | ['c69af8750a154e6c9084d27ae7fbc766'] | I'm new to the React framework and recently wrote the below code but have been asked to understand what is wrong with it and how I could improve/fix this component.
Please could someone advise a better way of structuring this component and why this approach? Thanks!
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
name: this.props.name || 'Anonymous'
}
}
render() {
return (
<p>Hello {this.state.name}</p>
);
}
}
|
2cf94c99c20efa15485e58ec97f4a80aa0bad589bc325cfb5dfe3363bacee0bf | ['c6a0d05955fe4a87bd353d90033181ba'] | I have the following situation:
I have a scene lighted by a "sun" lamp that gives me good sharp shadows. But I also want to have a large plane with an emissive material placed above the scene to regulate the "general" brightness. My problem is that while this plane does emit light the way I want it to, it also blocks the sun and casts a shadow on my scene. So I want it to both emit light, and by invisible to the rays of the sun. How can I achieve this?
| 20ed57630ab408199f6b2ee6b209b8f4417c9b9ddf27acb7d3b9de4f6b0129f8 | ['c6a0d05955fe4a87bd353d90033181ba'] | No classism, just trying to figure things out in a limited time frame. There are reasons for why I'm trying to push the boundaries of standard practice and NEC, but, for better of worse, I'd rather leave them out of the discussion. Thanks for pointing to better places for these kinds of questions. |
f0f6a40b91841cc4bc3b8400ef9ce2f6a20bcbf537f54494543cf575109452e4 | ['c6a339a719f94ffe9f2bbba96ba47d0f'] | Not sure if phishing.How did link on letter affect my Yahoo mail layout? I myself though have had good experience with new unknown journal, now has earned impact factor and I am pleased with two journals I published in though they were on suspect list. But there is opportunity for phishing whenever using link in email. I think is good to have reviewer experience though at graduate student level maybe best to have cultivated your pursuits, hands on experience? | 91f59a1661babb386637a9b6086bb9336ef91ac10aad4cbd90673457cb15b8e6 | ['c6a339a719f94ffe9f2bbba96ba47d0f'] | I found Wikipedia to have listed Hellinger distance between pairs of 2-parameter Weibull distributions sharing the same shape parameter
http://en.wikipedia.org/wiki/Hellinger_distance
However, I wasn't able to find any information on Helinger distance between pairs of 3-parameter Weibull distributions (with the 3rd parameter being the location parameter), and that no parameters are shared between the pair of Weibulls.
I was trying to derive for one but I failed miserably, can anyone point out a source that might have some information on this? Or is anyone able to derive a closed form here? Thanks.
**I was also looking for/trying to derive the closed form of KL-divergence between pairs of 3-parameter Weibull distributions, as all papers only derive the closed form for the 2-parameter Weibulls....
|
75521fb0fd34163f6610d60a905e2d55eb328d74a0898b67b36dd9c87c61ce63 | ['c6a46b9c8b014747a047263b11a44505'] | As the space of all right continuous functions with left limits, I believe $X$ is not necessarily a metric space, since it is not generally bounded. Therefore, the equivalence between sequential compactness and compactness does not necessarily hold for $Y$.
If you add the condition that the functions in $X$ be bounded, then then space can be expressed as a metric space, equipped with the $sup$ norm
By construction, subset $Y$ itself is a sequence of functions where $Y$ is defined as $\{f^{n}(t)\}$ and so you are correct in that $\{f^{n}(t)\}$ must have a convergent subsequence.
Note $\{f^{n}(t)\}$ itself need not converge as it is the closure of $Y$ that is compact.
| d67aab54636a3041c9c5bf9f595b740b8ead958ab52833e5842d029d144f66cd | ['c6a46b9c8b014747a047263b11a44505'] | Here's my attempt:
The symmetric group $S_{n}$ acts on the set $\{1, …, n\}$ by permuting its elements.
Let $n \geq 3$. Suppose $\phi \in S_{n}$ but $\phi \neq e$, where $e$ is the identity.
WLOG $\phi(1)=2$. Now let $\psi(2)=3$ and $\psi(1)=1$ Then $\psi(\phi(1))=\psi(2)=3 \neq 2 = \phi(1)= \phi(\psi(1))$.
Note that $\phi$ is a generic permutation (bijection) where our only condition is that it not be the identity, i.e. all we know is it maps $1$ to $2$. We are able to construct a permutation that does not commute (with our generic bijection) and so $e$ is the only element in the center.
|
3e54df493a3d259b31cccb36c871cd9ff4b56738c98086c089ce56e82938c7f2 | ['c6b315cd5e924b168e7b5aa3a046544e'] | We have a blob storage that we are putting MP4 files into. We want to create a function that watches for the incoming files (like a pub/sub), and then using azure media-services encode the file to a wav, and save the transformed artifact to another blob storage container. I can create the job to watch for the files that come in, the problem we are having is finding out how to create a wav file using the media-services transforms. We are trying to avoid having to copy the MP4 files to another location to encode them to wav files, then deleting the MP4 file and the wav file once we are done. These files can run into the gig size quite a bit.
We use the wav files to transcribe them into text (our transcription software requires the files in wav format). We looked at the azure speech services to do the transcriptions, but it is cost prohibitive, and the transcription software we currently use is specialized for our line of work and more efficient at transcriptions.
I guess the first question is "Is it possible to transform an MP4 to wav using azure media-services?" If so, does someone have an example on how this is done?
Thanks.
| 20274ff1479561f7a5df14ac2f4a6469342d7576abadb9d4af2ecadd966a770d | ['c6b315cd5e924b168e7b5aa3a046544e'] | Here is an example of the SQL I am trying to convert to Linq
SELECT
* FROM assetassignment
WHERE asgn_type = 'trc' AND asgn_id = '54490' AND lgh_number <> 3015097 AND mov_number <>2030782
and asgn_enddate in (select max(asgn_enddate) FROM assetassignment
WHERE asgn_type = 'trc' AND asgn_id = '54490' AND lgh_number <> 3015097 AND mov_number <> 2030782 and asgn_enddate <= '03/19/2017')
I need to convert this to Linq. I am using a repository as follows:
public async task<AssetAssignment> FindPreviousTrip(string tractorNumber, DateTime endDate, int legNumber,string moveNumber)
{
using (var ctx = new AssetAssignmentContext(_nameOrConnectionString))
{
var previousTrip = from a in ctx.Set<AssetAssignment>()
where a.AssignmentType == "TRC" &&
a.AssignmentId == tractorNumber &&
a.LegId == legNumber &&
a.MoveNumber == moveNumber &&
a.EndDate).in()
}
}
As you can see I am making a stab at it, but keep failing on the subquery for the EndDate in statement.
I'll keep plugging at it, but any help is appreciated.
|
b1b491f39b2f82cb5415f6cf4fa5f01c727873d0735481e7cc447b2e12e4f224 | ['c6b86d6c403347688956ee1d6c9f37f2'] | So I was just told that having this sort of thing visible whenever someone views the source on your front end is insecure:
<form action="http://www.somedomain.com/form.php" method="post">
Basically, that someone being able to see the php file that the form submits to is dangerous. Is this the case? If so, how do I make my visible source secure while still having the form submit to our hypothetical "form.php"?
| 81c872ba3a33e0d82537e198c8683b92eff07be6ffc3cd9153d32cc574559df5 | ['c6b86d6c403347688956ee1d6c9f37f2'] | I have two css buttons on my homepage that are have an absolute position on them relative to an image. The problem I'm having is that they load a lot faster than the image does, so for a split second upon loading the page, the buttons are floating out in la la land until the image loads and they fall in to line.
Is there a simple fix to this or do I have to totally redo the positioning?
|
ee0ba47bd624f19317fa6a1ea610ff3d68b9324f93194c29cfc01a06f77fdae8 | ['c6c94f01d4ac4054985ab25fc2b51c62'] | I'm using a simple retrofit call which then updates the data and the fragment observes to it through the view model.
Unfortunately for some reason it just doesn't work. it's like the "postValue or setValue" don't work or are simply gone.
Fragment:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mViewModel = ViewModelProviders.of(requireActivity()).get(MyViewModel.class);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
...
subscribe();
mViewModel.fetchList();
return rootView;
}
private void subscribe() {
mViewModel.getListObservable().observe(this, new Observer<List<MyObj>>() {
@Override
public void onChanged(@Nullable List<MyObj> objList) {
....
}
});
}
MyViewModel:
private LiveData<List<MyObj>> mListObservable = new MutableLiveData<>();
private Repository repository;
public MoviesViewModel(Application application) {
super(application);
repository = new Repository();
}
public void fetchList(){
mListObservable = repository.getList();
}
public LiveData<List<MovieObj>> getListObservable(){
return mListObservable;
}
Repository:
public LiveData<List<MyObj>> getList(){
final MutableLiveData<List<MovieObj>> data = new MutableLiveData<>();
mServiceInterface.getData("en-US").enqueue(new Callback<MyResponseCustom>() {
@Override
public void onResponse(Call<MyResponseCustom> call, Response<MyResponseCustom> response) {
data.postValue(response.body().getResult());
}
@Override
public void onFailure(Call<MyResponseCustom> call, Throwable t) {
}
});
return data;
}
| bea05e7325e019e9e5443114763fa007bb78fd2e0a8fb757218009bb7bb9788e | ['c6c94f01d4ac4054985ab25fc2b51c62'] | I have a layout which holds a FrameLayout, which in turn has a varying amount of ImageViews on top of it. (Only one is visible at any given time, and the user can flip/switch between them)
All of the ImageViews are Vector drawables.
When I try to implement the Pinch-to-zoom functionality, I encounter various problems.
With Solution 1 :
override fun onScale(detector: ScaleGestureDetector): Boolean {
scaleFactor *= detector.scaleFactor
scaleFactor = ((scaleFactor * 100)).toInt().toFloat() / 100
scaleFactor = max(MIN_SCALE_FACTOR, min(scaleFactor, MAX_SCALE_FACTOR))
frameView.scaleX = scaleFactor
frameView.scaleY = scaleFactor
frameView.pivotX = e.x
frameView.pivotY = e.y
}
Basically, I use the same logic for Double-tap zoom, and it works fine there(I'm also applying some animation to smoothen it).
However, with pinch-to-zoom, the image suffers from stuttering, especially when I keep holding two fingers on the screen, you can see how it constantly jumps around.
I tried Solution 2 :
which is using this OnPinchListener : https://www.dev2qa.com/android-pinch-zoom-layout-example/
But :
1. The example there works with a simple ImageView (NOT vector).
When I try it with a vector drawable, the image distorts and becomes pixeled and ugly.
2. In my case, I need to apply the scaling(zoom) to the
frameView (FrameLayout holding the images), so using the "setImageBitmap" approach
is irrelevant here.
So basically it seems this solution cannot be used in my case.
Are there any other ways (or something that I missed in my first solution perhaps) that could make the pinch to zoom work smoothly?
|
cdfb4a44a94f879e4e1447a2a60b88c95e0cf42ac6688cdd3cffa580bd709993 | ['c6d167501afc49c4b26bd24c42a0abe7'] | Hi <PERSON>, I have asked a question to <PERSON> to see if they have a /XF switch, that would cover it.
I presume you meant Teracopy instead of Veracopy in your comment? if so i you can't really just verify / compare with teracopy unless all filenames are the same on the source and the destination. | 4a5158de70a691efd257c0786761f5df5b32c2ccfba0f0f1897730e27c11d2af | ['c6d167501afc49c4b26bd24c42a0abe7'] | Hi <PERSON>, Thanks for your answers . I have asked a question to Teracopy to see if they have a /XF switch, that would cover it.
I presume you meant Teracopy instead of Veracopy in your 2nd comment? if so, i you can't really just verify / compare with teracopy unless all filenames are the same on the source and the destination. Are there any other verify programs you know? |
3ced140cd5d0b31ef3ebfc4dddcfb5a8a86975eae697b741e04ef5acb903910d | ['c6f47335bd6a4e1ebedc091ff59ee47c'] | as I can see there is no "memoise_0.1.zip" at http://cran.rstudio.com/bin/windows/contrib/3.0/ . However, there is the "memoise_0.2.1.zip" file.
What version of RStudio IDE are you using? Do you have memoise already installed? Maybe you should try to update the memoise package.
| d9d7ab09330de4ab9d9be1d58ea01b85e6098d33d331618765d80515b1054629 | ['c6f47335bd6a4e1ebedc091ff59ee47c'] | I would like to give a similar solution to crowder's that works quite well for me.
Imagine you have Python installed in /opt/Python-2.7.5 and that the structure of that folder is
$ tree -d -L 1 /opt/Python-2.7.5/
/opt/Python-2.7.5/
├── bin
├── include
├── lib
└── share
and you would like to build vim with that version of Python. All you need to do is
$ vi_cv_path_python=/opt/Python-2.7.5/bin/python ./configure --enable-pythoninterp --prefix=/SOME/FOLDER
Thus, just by explicitly giving vi_cv_path_python variable to configure the script will deduce everything on it's own (even the config-dir).
This was tested multiple times on vim 7.4+ and lately with vim-7-4-324.
|
51bcec2c71bea65fb8ae82768063c601431592dc79f295c321290ce86741b5e9 | ['c6ffacb313c34b1d844ebdfbbeb92df5'] | actually i have a problem using Dialog with content dynamic, when i presed a commandButton i want appear a Dialog, but the content's dialog doesn't appear
XHTML
</p:treeTable>
<p:commandButton value="Add" action="#{showEn.displaySelectedNode}" oncomplete="PF('dialogWidget').show()"/>
</h:form>
<p:dialog appendTo="@(body)" id="dialog" widgetVar="dialogWidget">
<ui:include src="#{showEn.dialog}"/>
</p:dialog>
Java
public void displaySelectedNode(){
if(!dialogs[0].equals("-")){
this.dialog="addEn.xhtml";
}else if(!dialogs[1].equals("-")){
this.dialog="addCu.xhtml";
}else if(!dialogs[2].equals("-")){
this.dialog="addTa.xhtml";
}
}
public String getDialog() {
return dialog;
}
public void setDialog(String dialog) {
this.dialog = dialog;
}
| 8d0e7773c6a28f931c0792a12bfd0445ddfe1acb8cb2334b117220f94669d139 | ['c6ffacb313c34b1d844ebdfbbeb92df5'] | I'm building a app using spring MVC and spring security, when i type username and password i can't navigate to the next page (index). This is my code, please help me.
spring-servlet
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang"
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<context:annotation-config/>
<context:component-scan base-package="com.AppFirst.controller"/>
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
<tx:annotation-driven />
web.xml
<?xml version="1.0" encoding="UTF-8"?>
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>AppFirst</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring-servlet.xml
/WEB-INF/security-context.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
</web-app>
LoginController.java
@Controller
public class LoginController {
@RequestMapping("/login")
public String doLogin(){
return "login";
}
}
|
671d99c01c4ea20d9574822c43375ac4c3546a4d730c5cbfefbe90f7a617ee8f | ['c70dca2059cc475ea4d31a9fa1361684'] | I made a mistake. I thought I had 7.2.8 but it is actually 7.2.2. As for the extensions problem:
I solved the extensions problem. My php.ini file was pointed to the wrong ext folder. I updated it and now the correct extensions are showing up on the info page.
Where to update in the PHP.ini file: Search for the [WebPIChanges] header. The extension_dir is what you want to update.
| d039eaa609565300381231b8edbd4f9fc97c68e309a366a689c86554b9459fc2 | ['c70dca2059cc475ea4d31a9fa1361684'] | The system is:
$ \frac{dx}{dt} = \frac{x}{y}$
$ \frac{dy}{dt} = \frac{y}{x}$
If we express both equations in terms of $dt$ we get our first solution:
$ \frac{1}{y} - \frac{1}{x} = C_1 $
I have hard time figuring out how to find the second one. I know what it equals to
$1 + C_1 x = C_2 * e^{C_1 t}$,
but have no idea how to get it.
The problem is an exercise meant to practice how to solve DE systems using integrable combinations method. All my attempts to use it (add / substract / divide / multiply both equations of the system) yielded nothing.
|
2d64f9846850296429714140d6a60a4a9c62f50f0bd0cd1c55eab98454ecffc8 | ['c7125cc18ede4979931ab1c0a3e22aa9'] | Thanks to @wOxxOm ill made it in this way:
// catch page when triggered by link and browser is already open (firefox) step 1
var lastRequest = null;
chrome.webNavigation.onCommitted.addListener(function (details) {
if(details.url == 'about:blank' && details.frameId == 0 && details.parentFrameId == -1 && details.transitionType == 'link') {
lastRequest = details;
}
});
// catch page when triggered by link and browser is already open (firefox) step 2
chrome.webNavigation.onBeforeNavigate.addListener(function (details) {
if(lastRequest && details.frameId == 0 && details.parentFrameId == -1 && details.tabId == lastRequest.tabId && details.windowId == lastRequest.windowId) {
console.log('New Request detected: open new Link in Firefox when Firefox is already open');
lastRequest = null;
}
});
| 3c852da502b7531c933fafea97c1d98d2a208eca0aaade9e07dd931dd12d1f88 | ['c7125cc18ede4979931ab1c0a3e22aa9'] | I'm searching for an event which triggers when an external Desktop-Software like Outlook, Thunderbird, Messenger App etc. want the default browser (firefox) to open a new link. I could manage with a workaround to catch this event if firefox was closed before:
// catch page when triggered by link and browser was closed
chrome.runtime.onStartup.addListener(function () {
// search for initial tab
chrome.tabs.query({
active: true,
currentWindow: true,
}, function (tabs) {
var initialTab = tabs[0];
// catch open of files and links when browser was closed
if (initialTab.url != 'chrome://newtab/') {
handleNewUrlRequest(initialTab.id,initialTab.url);
}
});
});
But how to catch the opening of an external link when firefox is already running?
Thank you for your help and greetings!
|
2ba6ccdcd0ed5df6f378559f76474dd9806b8a64cedc2d9aebc2e74df42e95d9 | ['c714f786bd4246a0b9e77d7d45df3a44'] | I have been trying to find a simple way to get a list of all possible char values (i.e. ['\000';'\001';...;'\255']) in OCaml.
In Python I'd do a simple list comprehension like:
[chr(x) for x in range(255)]
However, the way I currently know in OCaml is much less simple:
all_chrs = let rec up_to = fun lst max ->
match lst with
| [] -> failwith "Invalid_input"
| hd<IP_ADDRESS>tl ->
let up = hd + 1 in
if up = max then up<IP_ADDRESS>lst
else up_to (up<IP_ADDRESS>lst) max
in let all_ascii = up_to [0] 255
in List.map Char.chr all_ascii
Can anyone point me to the simplest way to do this?
Thanks!
| 104f2185746aee0e2cce53359403828a707da9034bb90df994657c00780b1bae | ['c714f786bd4246a0b9e77d7d45df3a44'] | I am trying to setup code first migrations for an MVC 5 web application hosted in Azure. The problem I am running into is that the migrations only take place on the LocalDB and not the database hosted on Azure.
Currently I have the following setup. I have the connection string for the local DB in my Web.Conf file as follows:
<connectionStrings>
<add name="InterestedPersonDBContext" connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\InterestedPerson.mdf;Integrated Security=True" providerName="System.Data.SqlClient" />
Then in my Web.Release.config I have transforms setup as follows:
<connectionStrings>
<add name="InterestedPersonDBContext"
connectionString="Server=tcp:u756l4y29q.database.windows.net,1433;Database=SkillsMatrixDB;User ID=MyID;Password=MyPassword;Trusted_Connection=False;Encrypt=True;Connection Timeout=30;"
xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
This setup works fine for running the application on both the LocalDB and the Azure hosted DB, however code first migrations only affect the local DB. Is there a way (other than changing the connection string in the Web.Config file) to have code first migrations also apply to the Azure DB?
|
d2cccba22e151503310034abceab8f8f8833a3b170755bbcb29b3b23a57dab12 | ['c73c3759596a4e9a8ef4755c5de5ea85'] | A suspicious link was opened in my Chrome browser and it began downloading files automatically. I'm pretty sure I didn't click anything, so is there a way for me to view how a link was opened in Chrome? (ex. google.com - address bar, example.com - redirected from gmail.com)
| 55df425a5c2c28884af22aee253a44d0de120627c4233161c367aa6fa13f8419 | ['c73c3759596a4e9a8ef4755c5de5ea85'] | I got this settings to work correctly by clicking the "Reset to default size" button. It automatically set the Preferred Size to half the width and height of my original image (since my 'default scaling' is set to '2x' in File->Project Settings).
To keep the button size intact while adding text then set the 'max size' property to the same as 'preferred size'.
|
b3b6fd8d98b987c0d0cb12d5db81bbc78b3874a3fe280ad0ec2328f6fca262fb | ['c749174def4d4aba913738f206572569'] | I am attempting to comment several entries in my [/etc/hosts] file using sed. I have the following command which works great:
sed -i$(date +%s).bak '/devops/,/devops/s/^/# /' /etc/hosts
My problem comes when i re-run the script containing the above line, my commented lines get a new comment. How can I add the ability to skip commented [^#] rows?
Thank you,
<PERSON> | b2b34d588fcaf981f44c25c4aa81012130fd73f810a2362f5060bdbd4b0345d3 | ['c749174def4d4aba913738f206572569'] | This is caused by <PERSON> pre-fetching the yum repos.
If there are more than one repository with the same label you will see your already defined error when puppet is set to use Yumrepo. The error will show the first duplicate alphabetically and abort.
You can reproduce the error following these steps: duplicate a .repo, apply manifest with yumrepo
Initial Repo:
puppet apply -e "yumrepo { 'test': ensure => 'present', baseurl => 'http://test/repourl', descr => 'test' }"
Then duplicate the repo so you have two [test] repos:
cp -p /etc/yum.repos.d/test.repo /etc/yum.repos.d/test2.repo
Now any attempt to use puppet with Yumrepo fails, reproduced below:
# puppet apply -e "yumrepo { 'someapp': ensure => 'present', baseurl => 'http://test/repourl', descr => 'some app' }"
...which yields the following error:
Error: Failed to apply catalog: Section "test" is already defined, cannot redefine in /etc/yum.repos.d/test2.repo
For your error, see which files are duplicating [base]:
grep '^\[base]$' /etc/yum.repos.d/*.repo
|
e288cdf72f1559350dcf7088b30138a0bd53ff55e850a911e95fc4703ae4166d | ['c749181cd57140c6b7fef69ba1da9ee9'] | Answer to 1) This would work fine for polynomial of degree 2 however, what if the polynomial is of a high degree, like 15, try solving the equation after differentiating that.
That is when methods like gradient descent, golden ratio methods, newton's method etc come in handy.
2)I am not sure but I think you are referring to the secant method, maybe this would help- https://en.wikipedia.org/wiki/Secant_method
| a8d02e552a347246e6bb78d482286cf62f7875ef322bccfb4f654d9b8bac4537 | ['c749181cd57140c6b7fef69ba1da9ee9'] | I think the issue you are having now, is that DNS and Netbios. You should be able to connect via IP address. Computer name will not work since Netbios does not broadcast beyond local subnet. You could avoid this if you setup WLAN as a layer 2 bridge mode, that way your LAN and WLAN are on the same subnet. Otherwise you will need to setup a DNS server or create local hosts files on all your machines.
|
08acb3c3f09d76f0cf294d9dd655744f78cfb94a3f6ad006d89191bae7b024dd | ['c7541ccc06404bfcaffbc37f2d6d74d2'] | This is an interesting answer because I can really see how my question was incomplete or too vague. More in details I'm trying to write this game in a web environment, where a loop is not really a viable solution. I can see how an event loop could fit instead. | a2a94e6bba29b83999c6454015f37900132ed8a4e81146d1d8d9f94e11fbfb95 | ['c7541ccc06404bfcaffbc37f2d6d74d2'] | @techraf You are right. I didn't check the error output: *override rwxr-xr-x root/wheel restricted...* properly and didn't realize the missing l...! I'm not surreal - I'm <PERSON> and I will send my new VW Diesel Death Star if you call one of my answers surreal again! |
a9f40b0509c32f18b53b9cd1017b1b1a4af3d070f69ca4a98d38382dacdad607 | ['c7568fc8dc0941bb8ef562481af2f093'] | I am trying to setup various Jenkins pipelines whose last stage is always to run some acceptance tests. To cut a long story short, acceptance tests and test data (much of which is shared) for all products are checked into the same repository which is about 0.5 GB in size. It therefore seemed best to have a separate job for the acceptance tests and trigger it with a "build" step from each pipeline with the appropriate arguments to run the relevant tests. (It is also sometimes useful to rerun these tests without rebuilding the product)
stage('AcceptanceTest') {
steps {
build job: 'run-tests', parameters: ..., wait: true
}
}
So far I have seen that I can either:
trigger the job as normal. But this uses an extra agent/executor,
there doesn't seem to be a way to tell it to reuse the one from the
build (main pipeline). Both pipelines start with "agent { label 'master' }" but that
seems to mean "allocate a new agent on a node matching master".
trigger the job with the "wait: false" argument. This doesn't
block an executor but it does mean I can't report the results of the
tests in the main pipeline. It gives the impression that the test
stage has always succeeded.
Is there a better way?
| f52e19e387f080a5b964db4ddade7df651d1c7b27fdcdf6a119409f802b00e2a | ['c7568fc8dc0941bb8ef562481af2f093'] | A fairly simple answer that occurred to me after posting this is to simply break up the timer into multiple sub-timers, e.g. having 10 6-second timers instead where each one starts the next one in a chain. That way, if I get suspended, I only lose one of the timers and still get most of the wait before timing out.
This is of course not foolproof, especially if I get repeatedly suspended and restarted, but it's easy to do and seems like it might be good enough.
|
349a27e78db40b8581762f8c92f7d05ea7b355ba57afcd5f8117028e53b31e0c | ['c7578bf7c7664f5685a5f96355bee10e'] | I thought so, but where is the problem in the proof? Where we jump from the summation to m to the summation to infinity? Or where he adds the terms down to $|x_2-x_1|$?
EDIT:
Nevermind. Don't add all the extraneous terms, and factor out a $\left(\frac{4}{9}\right)^n$ | b27f786d9755f97b65ccf03addb2b7f1c79aabe3fd0be7c5facce83e6db9ad0b | ['c7578bf7c7664f5685a5f96355bee10e'] | Just to confirm, the reason we take these limits is because the nth coefficient of the laurent series is given by $\frac{1}{2\pi i}\oint\frac{f(z)dz}{z^{n+1}}$ which equals the residue of $f(z)$ at $z=0$ which equals the nth derivative of $\lim_{z\to0}\left( f(z)*z^{n+1}\right)/n!$... correct? |
4561d31f1f91a27cc932b61e046f23fa9d6777c3737ab2980eb7518f57c5d541 | ['c76731bb40524b78a9facd71606cf29a'] | I've tried both codes and I think that the problem is data reading. Here follows my test codes.
Sender code:
void setup() {
Serial.begin(9600);
}
void loop() {
Serial.println("A"),
delay(1000);
Serial.println("B"),
delay(1000);
}
Receiver code:
int data;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop() {
if (Serial.available()) {
data = Serial.read();
if(data=='A')
{
digitalWrite(13,HIGH);
}
else if(data=='B')
{
digitalWrite(13,LOW);
}
}
}
When you try to test data read from serial communication it's always a good practice to save the buffer to a variable and then do all the control stuff. This way you can trust that the data is always the same. Here a more rigid explanation.
When you do an if statement like the one that you've tested you don't actually test the same value in one loop.if(Serial.read()=='A') and else if(Serial.read()=='B') actually tests two different readings from the serial in two different times. When you do instead a single reading with data = Serial.read() and you compare the reading stored in a variable with expected value like data == 'A' the reading is done only one time and "remain the same" through all the loop.
Note that the comparison it's done with char ('') not ("") in my test.
Hope I've helped solving your problem. Let us know it works for you
| eeb8b1dd7d02f3045909eed6088c186e714461921b92331791019157d12751ef | ['c76731bb40524b78a9facd71606cf29a'] | Grab the audio is no problem, you can use one on the many (and cheap) Bluetooth Transmitter / Receiver with 3.5mm audio jack. You can configure those devices to either send or receive signals, it this case it will redirect audio from the audio jack to bluetooth. The thing that is more tricky is determine which bluetooth you want to use (BTLE or older). Bluetooth Low Energy can be a little bit challenging to work with if you're an inexperienced one with this specific protocol. In android studio surely someone have created an app for that.
The following suggests how to use 2 android phones: BLE audio stream
Once you've gathered the audio data from the transmitter you only have to redirect it to your hearing aid device.
Hope I've gave you an idea
|
91e7ba5332c03d569f3350f79b3909c0b0ac3bb3d7a8c4191a178365221e4aa3 | ['c76ca4fbf24a44b096c97d13514f7227'] | I have a data frame consisting of names of preprocessing methods.
*Impute* *Scale*
naomit noscale
knnimpute noscale
naomit scale
knnimpute scale
In step one function g() executes the methods row-wise to create a preprocessed data set. For first row: identity(na.omit(data))
In step two classification error in computed for each preprocessed data set. The objective is to find a combination that minimizes classification error.
There are thousands of combinations. Currently, I use full blind or simple grid search. I need a more intelligent method to find preprocessed data sets worth testing.
I know there is the CRAN task view for optimization and I have tried to learn conceptual
issues from here (http://dl.acm.org/citation.cfm?id=937505).
What would be a good R combinatorial optimization package/ function to find approximately
best solution faster with mimimal up-front work?
| d342ec440662d5a6bbb1439fd7e1af1a3fff3e648853825326af965c3a2b73c0 | ['c76ca4fbf24a44b096c97d13514f7227'] | I would like to use package arules functionalities in my package but can not
import the whole package due to name conflicts. object@datafr is a data frame that needs to be coerced to transactions. How should I deal with the second line in the code below?
showrules <- function(object, support=0.05, confidence=0.5){
combinations <- as(object@datafr, "transactions")
rules <- arules<IP_ADDRESS>apriori(combinations, parameter = list(support = support,
confidence = confidence), appearance=list(rhs='target=high', default='lhs'))
arules<IP_ADDRESS>inspect(rules)
}
|
380cc2491f6a8ad0ebce731d0b03f4bbe0156a63dbbb54fef64a58d1ab31f013 | ['c76cd84a6178490eb30062e365caeb40'] | you can't use the css approch used by leaflet on openlayers, the D3 + openlayer basically draw the data using d3 on a canvas wich is used as an imagelayer.
You need to use the openlayer approch : layers + style , you can have similar performance with openlayers "imagevector" layers.
i edited your jsfiddle with style + imagevector:
http://jsfiddle.net/6r8rat8n/5/
var vector = new ol.layer.Image({
source: new ol.source.ImageVector({
source: vectorSource,
style: new ol.style.Style({
fill: new ol.style.Stroke({
color: '#efefef',
width: 1
}),
stroke: new ol.style.Stroke({
color: '#fff',
width: 1
})
})
})
});
// select interaction working on "mousemove"
var selectMouseMove = new ol.interaction.Select({
condition: ol.events.condition.mouseMove,
style: new ol.style.Style({
fill: new ol.style.Stroke({
color: 'red',
width: 1
}),
stroke: new ol.style.Stroke({
color: '#fff',
width: 1
})
})
});
| 0e6042a4342b195266eadd653ea7abe2f35a5ec8c3965ba7e7f7a66972821964 | ['c76cd84a6178490eb30062e365caeb40'] | Not sure that it is possible, Openlayer can't draw between two instance of the world!
I you deactivate the wrapX function you can see what he see:
http://jsfiddle.net/davidhequet/dkk2yu3L/3/
var vectorSource = new ol.source.Vector({wrapX:false});
vectorSource.addFeature(polygonFeature);
var vectorLayer = new ol.layer.Vector({
source: vectorSource
});
|
7400bcd4ca2772a9bfb0e7d2aac4d19243a6f2d2ea79f9ff63685e7bc2e3b88e | ['c783daf4a0e4488795c5baef91e889d1'] | I have created a docker container for PGbouncer.
(Docker image from - https://hub.docker.com/r/edoburu/pgbouncer)
docker run -d -it --name=pb -e DB_NAME=events -e DB_HOST=localhost -e DB_USER=postgres -e DB_PASSWORD=postgres -e LISTEN_ADDR=<IP_ADDRESS> -e LISTEN_PORT=8083 -e AUTH_TYPE=any -e AUTH_FILE=/Users/nandeeshnaik/Desktop/pg/userlist.txt brainsam/pgbouncer:latest
the above command runs the pgbouncer.
Logs from the docker container,
adduser: user 'postgres' in use
#pgbouncer.ini
# Description
# Config file is in “ini” format. Section names are between “[” and “]”.
# Lines starting with “;” or “#” are taken as comments and ignored.
# The characters “;” and “#” are not recognized when they appear later in the line.
[databases]
* = host=localhost port=5432 user=postgres password=postgres
[pgbouncer]
# Generic settings
listen_addr = <IP_ADDRESS>
listen_port = 8083
auth_file = /Users/nandeeshnaik/Desktop/pg/userlist.txt
auth_type = any
ignore_startup_parameters = extra_float_digits
# Log settings
admin_users = postgres
# Connection sanity checks, timeouts
# TLS settings
# Dangerous timeouts
################## end file ##################
Starting pgbouncer...
2019-09-15 20:05:23.309 1 LOG File descriptor limit: 1048576 (H:1048576), max_client_conn: 100, max fds possible: 110
2019-09-15 20:05:23.309 1 LOG listening on <IP_ADDRESS>:8083
2019-09-15 20:05:23.309 1 LOG listening on unix:/tmp/.s.PGSQL.8083
2019-09-15 20:05:23.309 1 LOG process up: pgbouncer 1.8.1, libevent 2.1.8-stable (epoll), adns: c-ares 1.13.0, tls: OpenSSL 1.0.2n 7 Dec 2017
After this i'm trying to connect to pgbouncer using postgres client (PSQL).
psql -h <IP_ADDRESS> -p 8083 -U postgres events
I get the following error..
(base) MUMCAP0120:pg nandeeshnaik$ psql -h <IP_ADDRESS> -p 8083 -U postgres events
psql: could not connect to server: Connection refused
Is the server running on host "<IP_ADDRESS>" and accepting
TCP/IP connections on port 8083?
using Mac
locally installed Postgresql.
userlist.txt has only "postgres", both username and passwords are in pain text.
Any suggestions and solution to resolve the issue is much appreciated.
Please let me know if you need any more clarity.
| ae333ff6cf200997c78e63d07ab91c63a1ffa94b2a1ff127c2ace0f4238e56cd | ['c783daf4a0e4488795c5baef91e889d1'] | My Project is on spring-boot-starter-parent - "1.5.9.RELEASE" and I'm migrating it to spring-boot-starter-parent - "2.3.1.RELEASE".
This is multi-tenant env application, where one database will have multiple schemas, and based on the tenant-id, execution switches between schemas.
I had achieved this schema switching using SimpleNativeJdbcExtractor but in the latest Springboot version NativeJdbcExtractor is no longer available.
Code snippet for the existing implementation:
@Bean
@Scope(
value = ConfigurableBeanFactory.SCOPE_PROTOTYPE,
proxyMode = ScopedProxyMode.TARGET_CLASS)
public JdbcTemplate jdbcTemplate() {
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
SimpleNativeJdbcExtractor simpleNativeJdbcExtractor = new SimpleNativeJdbcExtractor() {
@Override
public Connection getNativeConnection(Connection con) throws SQLException {
LOGGER.debug("Set schema for getNativeConnection "+Utilities.getTenantId());
con.setSchema(Utilities.getTenantId());
return super.getNativeConnection(con);
}
@Override
public Connection getNativeConnectionFromStatement(Statement stmt) throws SQLException {
LOGGER.debug("Set schema for getNativeConnectionFromStatement "+Utilities.getTenantId());
Connection nativeConnectionFromStatement = super.getNativeConnectionFromStatement(stmt);
nativeConnectionFromStatement.setSchema(Utilities.getTenantId());
return nativeConnectionFromStatement;
}
};
simpleNativeJdbcExtractor.setNativeConnectionNecessaryForNativeStatements(true);
simpleNativeJdbcExtractor.setNativeConnectionNecessaryForNativePreparedStatements(true);
jdbcTemplate.setNativeJdbcExtractor(simpleNativeJdbcExtractor);
return jdbcTemplate;
}
Here Utilities.getTenantId() ( Stored value in ThreadLocal) would give the schema name based on the REST request.
Questions:
What are the alternates to NativeJdbcExtractor so that schema can be dynamically changed for JdbcTemplate?
Is there any other way, where while creating the JdbcTemplate bean I can set the schema based on the request.
Any help, code snippet, or guidance to solve this issue is deeply appreciated.
Thanks.
|
4a69c012778995a52943ec777aec2ca14af23bafffea0a5dfbb8c0162c537c09 | ['c79c7ebb8ae9401784c3adb7c59346fb'] | I'm new to unix and trying to create a guide for users to install subversion. I've found a tutorial about how to build from a tarball. I'm ready to try it out, but I don't know how to download the file from the command line from a web address. Can someone please provide the command I would need, and also which directory I should do it from? What does unpack it mean? Generally translate these instructions like I'm an 8 year old. Thanks:
Download the most recent distribution tarball from:
http://subversion.apache.org/download/
Unpack it, and use the standard GNU procedure to compile:
$ ./configure
$ make
# make install
You can also run the full test suite by running 'make check'.
| da4dd4881a171b9ea0e5ed49d756a4b530bcbe1d3a8132dd0bcfba9ad6a5d455 | ['c79c7ebb8ae9401784c3adb7c59346fb'] | I've got a 1-line batch file that runs a pantaho etl job. It works fine when I run it from command line or gui, but the process doesn't even start when it's scheduled. I have the following settings:
-Run whether user is logged on or off (Do not store password is NOT checked)
-Run with highest privelages
-Trigger is set to 'daily' and 'Enabled' check box is active
-Action is 'Start a program'
-Program/script: The absolute location of my .bat file
-Add arguements is blank
-Start in is the folder where the file is located.
-Nothing is checked on the 'Conditions' tab
The history shows this, that the task goes through all steps in the same moment:
Level Date and Time Event ID Task Category Operational Code
Information 6/10/2013 10:47:00 AM 102 Task completed (2)
Information 6/10/2013 10:47:00 AM 201 Action completed (2)
Information 6/10/2013 10:47:00 AM 129 Created Task Process Info
Information 6/10/2013 10:47:00 AM 200 Action started (1)
Information 6/10/2013 10:47:00 AM 100 Task Started (1)
Information 6/10/2013 10:47:00 AM 319 Task Engine received message to start task (1)
Information 6/10/2013 10:47:00 AM 107 Task triggered on scheduler Info
The scheduler's history tells me the task has been successfully completed with return code of 1.
Thanks for any suggestions.
|
9967d7b45fbe8ce84af108fd639e1b707c428256c7357762cf536bb7232be5a2 | ['c79ce70d344a41f7b6ee7651e2a0db0b'] | @Santanu <PERSON>:
Thanks for reply..it is working fine for me too but when same code is called from process builder then it is not working.. I checked the logs it is inserting data but i think it is getting rolled back..I have written process builder on Knowledge object(__kav).. | 812255bec93688a4aa40fd75962a555dce0ba0a43e5b47c9758670b85d91ca46 | ['c79ce70d344a41f7b6ee7651e2a0db0b'] | I don't think so. My impression of <PERSON> is he is very childlike in his mind. I felt that he just wanted to keep the ring to himself because of a childish possessiveness, rather than some innate knowledge to keep the ring from <PERSON>.
However you do bring up a good point. Unfortunately the only way we would really know is to ask <PERSON>, but that isn't going to happen.
By the way, I'm going from knowledge of the books. I've never seen the films, nor do I desire to.
|
481dfe469860da812f01d830d500c0bc1b4ce313ce71be94dc6e3d85601919ee | ['c7c5dd2a8e3e43709f9a15d796760e64'] | I think I have managed to upload an image via AJAX to a PHP file, I am now trying to move it to a known location, here is my code:
$allowedExtensions = array('JPEG', 'JPG', 'PNG', 'GIF');
$temp = explode(".", $_FILES["image"]["name"]);
$extension = end($temp);
if (in_array($extension, $allowedExtensions)) {
if (file_exists("../pictures/" . $_FILES["image"]["name"])) {
echo $_FILES["image"]["name"] . " already exists";
} else {
move_uploaded_file($_FILES["image"]["name"], "../pictures/" . $_FILES["image"]["name"]);
echo "Moved to ". "../pictures/" . $_FILES["image"]["name"];
}
}
When run I am getting the echo saying it has been moved to "../pictures/capture.JPG" but when I look in that folder, its not there.
Any ideas why? I also don't know what the ["name"] does so an explanation of that would also be great thanks!
| 4861138d2d815341df513c41391e8bb183590c6d10316bd1ad49a1ca2ac69bee | ['c7c5dd2a8e3e43709f9a15d796760e64'] | I'm trying to write a program that reads an integer n from the user, then reads n integers (on separate lines), and finally display the sum of the n numbers read.
Here is my code so far:
addNumbers <IP_ADDRESS> IO ()
addNumbers = do
putStrLn "Enter a number:"
num <- getInt
addNumbers2 num
addNumbers2 <IP_ADDRESS> Int -> IO ()
addNumbers2 num = do
putStrLn "Enter a number:"
n <- getInt
if num == 1 then
print n
else do
print (n + addNumbers2 (num - 1))
At the moment it doesn't compile, the error says:
Couldn't match expected type `Int' with actual type `IO ()'
In the return type of a call of `addNumbers2'
In the second argument of `(+)', namely `addNumbers2 (num - 1)'
In the first argument of `print', namely
`(n + addNumbers2 (num - 1))'
IO is really confusing me, I'm trying to get an output of:
Enter a number:
3
Enter a number:
2
Enter a number:
1
Enter a number:
5
Sum is: 8
|
e74f5936ad1f6b0205487b1e5d42bab9cd60f87e2fc23fc4f5d8c521613669ac | ['c7e32616209645fd86e09992cb211416'] | Users currently upload multiple images to a folder on my EC2 server. They will get multiple views by numerous users.
Should I be uploading all these images to S3 instead via the SDK and then load them via CloudFront to increase performance when they are viewed by other users?
http://docs.aws.amazon.com/AmazonS3/latest/dev/UploadObjSingleOpPHP.html
| 5f6404db356dd6e8a08f43c11500bfe1399bf060f4d77d9f890bb87f80d767f3 | ['c7e32616209645fd86e09992cb211416'] | After joining two tables I have duplicate column names. How can I differentiate between the names and extract the data in PHP.
Services table:
+----+-------+--------+
| id | price | userID |
+----+-------+--------+
| 1 | 435 | 33 |
| 2 | 543 | 32 |
| 3 | 7646 | 33 |
| 4 | 7966 | 31 |
| 5 | 394 | 31 |
| 6 | 569 | 31 |
| 7 | 203 | 32 |
| 8 | 439 | 32 |
| 9 | 329 | 33 |
| 10 | 998 | 31 |
+----+-------+--------+
Customers table:
+----+-------+-------+
| id | name | zip |
+----+-------+-------+
| 30 | <PERSON> 45698 |
| 31 | <PERSON> 87848 |
| 32 | <PERSON> | 56879 |
| 33 | <PERSON> | 35411 |
| 34 | <PERSON> | 59874 |
| 35 | Lo | 99874 |
+----+-------+-------+
Join them using this query:
SELECT *
FROM services AS s, customers AS c
WHERE s.userID=c.id
Joined table:
+----+-------+--------+----+-------+-------+
| id | price | userID | id | name | zip |
+----+-------+--------+----+-------+-------+
| 1 | 435 | 33 | 33 | <PERSON> | 35411 |
| 2 | 543 | 32 | 32 | <PERSON> | 56879 |
| 3 | 7646 | 33 | 33 | <PERSON> | 35411 |
| 4 | 7966 | 31 | 31 | <PERSON> | 87848 |
| 5 | 394 | 31 | 31 | <PERSON> | 87848 |
| 6 | 569 | 31 | 31 | <PERSON> | 87848 |
| 7 | 203 | 32 | 32 | <PERSON> | 56879 |
| 8 | 439 | 32 | 32 | <PERSON> | 56879 |
| 9 | 329 | 33 | 33 | <PERSON> | 35411 |
| 10 | 998 | 31 | 31 | <PERSON> | 87848 |
+----+-------+--------+----+-------+-------+
When I run this script, I want to get the two results in the id columns (eg. 1 and 33 in the first row):
$query = "SELECT *
FROM services AS s, customers AS c
WHERE s.userID=c.id";
$result = $link->query($query);
while($var = mysqli_fetch_array($result)) {
print_r($var);
//I would like to get them similar to this...
//$id1 = $var['id'];
//$id2 = $var['id'];
}
Result (Notice how there's no key for both id columns. The first one is [0] => 1 and has no named key):
Array ( [0] => 1 [id] => 33 [1] => 435 [price] => 435 [2] => 33 [userID] => 33 [3] => 33 [4] => <PERSON> [name] => <PERSON> [5] => 35411 [zip] => 35411 )
Is there anyway to associate a key to the different id's without doing the following for each column with a duplicate name:
$query = "SELECT *, c.id AS myNewID
FROM services AS s, customers AS c
WHERE s.userID=c.id";
|
90aa49fcf67fa8fc75e5247e673518d9a8c98e39ef1609dd8b40d840814a612c | ['c7f1d058c37248b0a4e8d81151c03ad7'] | I tried this way, and it worked. Need to wrap the Icons in a div and it will work.
<List>
<ListItem style={{ textAlign: "center" }}>
<div>
<NotificationsIcon color="primary" fontSize="large" />
Activity
</div>
</ListItem>
<ListItem style={{ textAlign: "center" }}>
<div>
<NotificationsIcon color="primary" fontSize="large" />
Activity
</div>
</ListItem>
</List>
https://codesandbox.io/s/material-demo-forked-b73ds?file=/demo.js
| 55736d6bca920b1ab04c5bc550e55f9df52a3fe890a4d98549be5bc914831dbb | ['c7f1d058c37248b0a4e8d81151c03ad7'] | I'm trying to create space between each rows of table component. I used classname and classes props on TableRow, TableCell, TableBody and Table, but nothing worked. I also tried to create custom theme but it also not working. Here's the code,
const useStyles = makeStyles({
table: {
minWidth: 650
},
tableRow: {
cursor: "pointer",
borderLeft: "8px solid #9a031e",
marginTop: "8px"
},
tableCell: {
marginTop: "8px"
}
});
function createData(name, calories, fat, carbs, protein) {
return { name, calories, fat, carbs, protein };
}
const rows = [
createData("Frozen yoghurt", 159, 6.0, 24, 4.0),
createData("Ice cream sandwich", 237, 9.0, 37, 4.3),
createData("Eclair", 262, 16.0, 24, 6.0),
createData("Cupcake", 305, 3.7, 67, 4.3),
createData("Gingerbread", 356, 16.0, 49, 3.9)
];
export default function BasicTable() {
const classes = useStyles();
return (
<TableContainer component={Paper}>
<Table className={classes.table} aria-label="simple table">
<TableHead>
<TableRow>
<TableCell>Dessert (100g serving)</TableCell>
<TableCell align="right">Calories</TableCell>
<TableCell align="right">Fat (g)</TableCell>
<TableCell align="right">Carbs (g)</TableCell>
<TableCell align="right">Protein (g)</TableCell>
</TableRow>
</TableHead>
<TableBody component={Paper}>
{rows.map((row) => (
<TableRow
key={row.name}
className={classes.tableRow}
styles={{ marginTop: 8 }}
>
<TableCell component="th" scope="row" style={{ width: 100 }}>
{row.name}
</TableCell>
<TableCell align="right">{row.calories}</TableCell>
<TableCell align="right">{row.fat}</TableCell>
<TableCell align="right">{row.carbs}</TableCell>
<TableCell align="right">{row.protein}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
);
}
Please do let me what am I doing wrong? How can I achieve it?
|
2d69eb3275facab13e98ebb8d6ba538373ad8b80338303a8a8e3de48b3283c8b | ['c800e73907f24af18383e470340cd94a'] | Given two positive integers N and X, where N is the number of total patients and X is the time duration(in minutes) after which a new patient arrives. Also, doctor will give only 10 minutes to each patient. The task is to calculate the time (in minutes) the last patient needs to wait.
Input:
The first line of input contains the number of test cases T. The next subsequent lines denote the total number of patients N and time interval X(in minutes) in which the next patients are visiting.
Output:
Output the waiting time of last patient.
Constraints:
1 <= T <= 100
0 <= N <= 100
0 <= X <= 30
Example:
Input:
5
4 5
5 3
6 5
7 6
8 2
Output:
15
28
25
24
56
need in javascript. I know the python code. but needs to convert into javascript. anyone can help me.
n=int(input())
for i in range(n):
t=0
a,b=map(int,input().split())
if a==1:
print(t)
else:
t=(a-1)*(10-b)
print(t)
| 3399127396fd8c5b95be16d31616c160f735376686c4d22cd12aa3f0556fcf52 | ['c800e73907f24af18383e470340cd94a'] | My client requirement is... instead of process portal using the URL they want to launch the process and access the task from their own portal.
For that CHS I exposed as URL and using that URL client portal they can able to launch the process but they cant able to process the task.
When I am framing the URL for processing the task. In that URL component ID also need. for that component ID where and how can we get that information i am not able to get in anywhere, Please anyone knows please provide me some information on that.
https://bpm.co.in/teamworks/fauxRedirect.lsw?zComponentId=3032.58aa9e8b-cafc-4264-91ce-8ac4671d7b27&zWorkflowState=2&zTaskId=t515780&zDbg=0&zComponentName=CoachFlow&applicationId=2&applicationInstanceId=guid%3Afa9c2963d7329bf6%3A-296c0055%3A173b30eee89%3A-8000
|
186ca8983a204e1f6ac1b2f4bb02391880836e1536eb5c2b4528c50072ecef04 | ['c80136cbdbfc496ea81ddcae6083c809'] | I have an app that already many activities and class. Like Profile, Friends, Photos, News Feed, etc. I want to integrate that sliding drawer into my main activities. in the examples, they are just showing array list which is implement onClick. so my question is how to change that array list to become my activities like friends, profile, home and etc.
| 16073288595e248238acaf90f2693789e367811986bc7f815ca7c3fa45ca306b | ['c80136cbdbfc496ea81ddcae6083c809'] | I am using dual panes2 source code from <PERSON> in his youtube channel. And i added <PERSON> slide menu in it. i change main menu into hello world and added slide menu in it. but when i click item in the list fragment. it switch only into the slide. not in the main activity. how to switch it into main activity. here is the screenshoot.
slide menu
the problem in here
thanks,
|
8736fb294e2cc2ae41ad472c3b200186652e1c0ab8d28b4b4c490cdb8bc86858 | ['c8180e2a91e74a6d94128c95251ff24d'] | So I am running a service (Jenkins) that is trying to write to a folder on another machine, but it fails with apparently a permission error. A normal user can write to the shared folder just fine. People say to give the Local System Account write access to the remote share, however, I don't see how to do that in a workgroup. The remote share is on Windows Server 2008, however there is no domain controller.
| caf0b44be3caefd09b71c8a09a39f7d2239fbb136369f71459d870b727438d03 | ['c8180e2a91e74a6d94128c95251ff24d'] | Lo que veo desde el principio es que desea cargar una vista y no llamar a un controlador. El mensaje de error se debe a que CodeIgniters Router busca un controlador de "view". Dentro de ese controlador está intentando llamar la función de "layout". Esto se debe a que el esquema de enrutamiento predeterminado de codeigniter se interpreta de la siguiente manera:
base_url / controller / function.
Le recomiendo que visite esta documentación para comprender mejor el sistema de enrutamiento.
Ahora no entiendo realmente por qué está intentando acceder al archivo menu.php a través de la barra de direcciones. Si está intentando editar un archivo php que contiene html, deberá navegar por la estructura de su directorio. El siguiente es un ejemplo de dónde podría encontrar el archivo que está buscando.
Aplicación / views / layout / menu.php
Aparte de esto, sería útil si compartes parte del código con el que está trabajando y trata de elaborar más sobre su pregunta.
|
41278281d53ed6e3921e82f66a4c783e4cbcac466a1106bcb254dbacc95dea62 | ['c8183c8241fc44ef864d028ff82f8e99'] | Пробую Ajax аутентификацию.
После ввода данных прохожу аутентификацию
user = authenticate(request, username=usermame, password=password)
После логинюсь
auth.login(request, user)
Первый запрос делает все ок, пользователь аутентифицируется.
Если я делаю 2-й запрос на аутентификацию чтобы проверить что пользователь уже зарегистрировался, я получаю анонимный запрос
if request.user.is_authenticated:
Тут объясняется,
https://stackoverflow.com/questions/50533472/python-django-autentication-anonymous-user-after-login
что после входа, все обращения Ajax должны сопровождаться передачей sessionid, как это сделать, подскажите, так ли это, как получать sessionid и передавать ее в data?
| 953cd65771309a70a975862107bf9eee3c01c6e9f84bf3f717096ad580342563 | ['c8183c8241fc44ef864d028ff82f8e99'] | When criteria doesnt match in vlookup it returns #N/A and "IF" condition doesnt know how to handle #N/A.so it ends in unexpected result like #N/A......so what i did is correct in my answer i handle that #N/A....and you're mention instead of result, formula is displaying.....so open a new excel by press Ctrl + N from old excel sheet and copy a empty cell and return to ur old excel and paste that blank cell where that problem occurs and then write formula again and do not copy and paste that old formula..because along with that formula, old cell formatting too paste in new cell..... |
886a707c201120e07e7aa07f4b487eea07349acc870191efae1f22a5567383fb | ['c81a79dd051f42fb82c7a8c92f5d4557'] | Hi I have this error when try to run a command:
sudo ionic cordova run android --prod --release
Error:
ionic-app-script task: "build"
[16:58:40] Error: Metadata version mismatch for module
/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@ionic-native/core/decorators.d.ts,
found version 4, expected 3
Error: Metadata version mismatch for module /Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@ionic-native/core/decorators.d.ts, found version 4, expected 3
at StaticSymbolResolver.getModuleMetadata (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:25616:34)
at StaticSymbolResolver._createSymbolsOf (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:25404:46)
at StaticSymbolResolver.getSymbolsOf (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:25385:14)
at /Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:24241:30
at Array.forEach (<anonymous>)
at extractProgramSymbols (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:24240:79)
at AotCompiler.analyzeModulesAsync (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler/bundles/compiler.umd.js:23796:47)
at CodeGenerator.codegen (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler-cli/src/codegen.js:32:14)
at Function.NgTools_InternalApi_NG_2.codeGen (/Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@angular/compiler-cli/src/ngtools_api.js:73:30)
at /Applications/MAMP/htdocs/collaborazon/WORKSPACE/mobile/node_modules/@ionic/app-scripts/dist/aot/aot-compiler.js:182:73
Here are my dependecies:
"dependencies": {
"@angular/cli": "^6.0.8",
"@angular/common": "^4.4.7",
"@angular/compiler": "^4.4.7",
"@angular/compiler-cli": "^4.4.7",
"@angular/core": "^4.4.7",
"@angular/forms": "^4.4.7",
"@angular/http": "^4.4.7",
"@angular/platform-browser": "^4.4.7",
"@angular/platform-browser-dynamic": "^4.4.7",
"@ionic-native/background-mode": "^4.4.2",
"@ionic-native/badge": "^4.4.2",
"@ionic-native/camera": "^4.4.2",
"@ionic-native/core": "^4.4.2",
"@ionic-native/file": "^4.4.2",
"@ionic-native/file-path": "^4.4.2",
"@ionic-native/file-transfer": "^4.16.0",
"@ionic-native/image-picker": "^4.4.2",
"@ionic-native/local-notifications": "^4.4.2",
"@ionic-native/push": "^4.4.2",
"@ionic-native/splash-screen": "^4.4.2",
"@ionic-native/status-bar": "^4.4.2",
"@ionic/cloud-angular": "^0.12.0",
"@ionic/storage": "^2.1.3",
"ajv": "^5.5.2",
"clean-css": "^4.1.11",
"cli-update": "^3.2.5",
"cordova": "^8.0.0",
"cordova-android": "^6.4.0",
"cordova-browser": "^5.0.3",
"cordova-ios": "^4.5.5",
"cordova-plugin-add-swift-support": "^1.7.2",
"cordova-plugin-background-mode": "^0.7.2",
"cordova-plugin-badge": "^0.8.7",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-console": "1.0.5",
"cordova-plugin-device": "1.1.4",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-filepath": "^1.3.0",
"cordova-plugin-ionic": "^2.0.4",
"cordova-plugin-ionic-keyboard": "~2.0.5",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-splashscreen": "~4.0.1",
"cordova-plugin-statusbar": "2.2.1",
"cordova-plugin-telerik-imagepicker": "^2.2.2",
"cordova-plugin-whitelist": "1.3.1",
"hoek": "^5.0.3",
"https-proxy-agent": "^2.2.1",
"intl": "^1.2.5",
"ionic-angular": "^3.9.2",
"ionic-native": "^2.9.0",
"ionic-plugin-deploy": "^0.6.7",
"ionic-plugin-keyboard": "~2.2.1",
"ionicons": "3.0.0",
"jquery": "^3.3.1",
"jquery-touchswipe": "^1.6.15",
"lodash": "^4.17.10",
"moment": "^2.22.2",
"npm": "^6.2.0",
"phonegap-plugin-push": "^1.11.1",
"rxjs": "^5.5.11",
"sw-toolbox": "^3.6.0",
"swift": "^0.1.8",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@ionic/app-scripts": "^3.2.0",
"@types/node": "^10.5.2",
"node-sass": "^4.9.2",
"rebuild-node-sass": "^1.1.0",
"tunnel-agent": "^0.6.0",
"typescript": "2.4.0"
},
When I run npm outdate command I get:
@angular/cli 6.2.5 6.2.5 7.0.1
@angular/common 4.4.7 4.4.7 7.0.0
@angular/compiler 4.4.7 4.4.7 7.0.0
@angular/compiler-cli 4.4.7 4.4.7 7.0.0
@angular/core 4.4.7 4.4.7 7.0.0
@angular/forms 4.4.7 4.4.7 7.0.0
@angular/http 4.4.7 4.4.7 7.0.0
@angular/platform-browser 4.4.7 4.4.7 7.0.0
@angular/platform-browser-dynamic 4.4.7 4.4.7 7.0.0
ajv 5.5.2 5.5.2 6.5.4
cordova-android 6.4.0 6.4.0 7.1.1
cordova-plugin-console 1.0.5 1.0.5 1.1.0
cordova-plugin-device 1.1.4 1.1.4 2.0.2
cordova-plugin-ionic 2.0.4 2.0.4 5.2.5
cordova-plugin-ionic-keyboard 2.0.5 2.0.5 2.1.3
cordova-plugin-splashscreen 4.0.3 4.0.3 5.0.2
cordova-plugin-statusbar 2.2.1 2.2.1 2.4.2
cordova-plugin-whitelist 1.3.1 1.3.1 1.3.3
ionicons 3.0.0 3.0.0 4.4.6
phonegap-plugin-push 1.11.1 1.11.1 2.2.3
rxjs 5.5.12 5.5.12 6.3.3
swift <PHONE_NUMBER>
typescript 2.4.0 2.4.0 3.1.3
When I run ionic info command I get:
Ionic:
ionic (Ionic CLI) : 4.2.1 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.2.0
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 6.4.0, browser 5.0.1, ios 4.5.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.0.5, (and 15 other plugins)
I try to solve it few days, read related topics but I can not move forward much. Guess 1 or 2 plugins are not synchronized. Please can someone take a look?
Thanks in advance
| 1a69164cb822439a755521614287f76e0f995b4080d452ef4fe805e1fc396dbb | ['c81a79dd051f42fb82c7a8c92f5d4557'] | I am setting up a new project and I want to use gates and policies. I know how to use it by Laravel documentation but I want to go furthermore.
We have a boot method in AuthServiceProvider where we should define gates and policies.
Can we define controllers in gates something like this?
Gate<IP_ADDRESS>define(SomeController<IP_ADDRESS>class, function ($user) {
if($user->something) {
return false;
}
return true;
});
|
df8b6c856bd8f140a2142d14ad6097460ff3905716d628c7ab95f1cd544329b0 | ['c81f827e7b834c5e89a31fb50aee9397'] | As long as you have a primary key on the table, this should work:
UPDATE MyTable SET ColA = ColA + 13
WHERE PKField IN(SELECT TOP 2 PKField FROM MyTable WHERE ColA = 5)
NOTE: You may want to consider an Order By clause somewhere in order to make sure you're updating the relevant 2 records.
| 1d0f827106fe21f498fce3995ec72f08c4c916e753012c06cf6088e37adf1dea | ['c81f827e7b834c5e89a31fb50aee9397'] | Provided the field names are the same in both tables (except for the ones missing) you could write some code to do it for you. Use the TableDefs (http://msdn.microsoft.com/en-us/library/office/bb220949(v=office.12).aspx) object to loop through tables and look for "_a" tables to append to and create the INSERT statement on-the-fly by querying the TableDef's .Fields collection.
For example something like this should work (un-tested, written by hand!):
Dim dbs As DAO.Database
Dim tdfLoop As TableDef
Dim strSql As String
Dim i as Integer
Dim strSourceTable as String
Dim strFieldList as String
Set dbs = CurrentDb
With dbs
For Each tdfLoop In .TableDefs
If Right(tdfLoop.Name, 2) = "_a" Then
strSourceTable = Mid(tdfLoop.Name, 1, Len(tdfLoop.Name)-2) & "_b"
strSql = "INSERT INTO " & tdfLoop.Name & "("
strFieldList = ""
For i = 0 To tdfLoop.Fields.Count - 1
strFieldList = strFieldList & tdfLoop.Fields(i).Name & ","
Next i
If strFieldList <> "" Then
strFieldList = Mid(strFieldList, 1, Len(strFieldList) - 2)
End If
strSql = strSql & strFieldList & ") SELECT " & strFieldList & " FROM " & strSourceTable
dbs.Execute(strSql)
End If
Next tdfLoop
End With
dbs.Close
Set dbs = Nothing
If the 'missing fields' do not have defaults defined in the table, then you could modify the above to return NULL values in their columns but I've assumed they have.
|
809bb5eb47c55d938463aadaeb8dd1be3d6621b395e853aaccfdf61dcfdbd02e | ['c83615790efa4f2baceb3ba81af224c6'] | Let us simplify the given equation in the following way:
\begin{align*}
(n+3)f_{n+3}−2(n+2)f_{n+2}+(n−1)f_{n+1}+2f_n&=0\\
(n+3)f_{n+3}−2(n+2)f_{n+2}+(n+1)f_{n+1}&=2f_{n+1}-2f_n\\
\Delta^2(nf_n)&=\Delta(2f_n)\\
\Delta(nf_n)&=2f_n+K
\end{align*}
where $\Delta$ is the forward difference operator and $K$ is a real constant. Then we have that
\begin{align*}
(n+1)f_{n+1}-nf_n&=2f_n+K\\
(n+1)f_{n+1}&=(n+2)f_n+K.
\end{align*}
It is not hard to show that the solution of the last equation is
$$
\boldsymbol{f_n=C\cdot(n+1)-K},\qquad C,K\in\mathbb R
$$
| a8fd8540099eedd8da6844bf1a372fa9898def78120af97a1e4a79de0a9d3993 | ['c83615790efa4f2baceb3ba81af224c6'] | Your new progression is given by a reccurence relation
$
y_{n+3}-y_{n}=12
$
with $y_1=2$, $y_2=5$ and $y_3=8$. It is not hard to show that the general formula for the sequence is
$
y_n=4n-3+\frac 1{\sqrt 3}\cdot\sin\left(\frac 23\pi n\right)-\cos\left(\frac 23\pi n\right)
$
|
da6edb1bb35c4f19f84534fecadb39d12f2733bef396b941cb9ead132983b3d1 | ['c85cd02a5efd422a87a68ceeccb48c72'] | Add this dependency in your pom.
Check this link:
https://www.baeldung.com/spring-rest-hal
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
It will change your response like this.
"_links": {
"next": {
"href": "http://localhost:8082/mbill/user/listUser?extra=ok&page=11"
}
}
| 80e709773e5240fe21f7c81c8ab6eb72fc78170f712181919064c2b4c4cb1cb1 | ['c85cd02a5efd422a87a68ceeccb48c72'] | The reason is you are trying to get the commentList on your controller after closing the session inside the service.
topicById.getComments();
Above will load the commentList only if your hibernate session is active, which I guess you closed in your service.
So, you have to get the commentList before closing the session.
|
59fb66f790b773369ad55bf6266062dcae0bb42cdee8e89bde73d1472b113233 | ['c86dbe7618504802bb18b251df823eb9'] | Be very careful with the Excel MOD(a,b) function and the VBA a Mod b operator.
Excel returns a floating point result and VBA an integer.
In Excel =Mod(90.123,90) returns 0.123000000000005 instead of 0.123
In VBA 90.123 Mod 90 returns 0
They are certainly not equivalent!
Equivalent are:
In Excel: =Round(Mod(90.123,90),3) returning 0.123 and
In VBA: ((90.123 * 1000) Mod 90000)/1000 returning also 0.123
| f341dbe3e7eecad3f91b3bec6aeb106c7603b49200abad625b11964c3cda64b7 | ['c86dbe7618504802bb18b251df823eb9'] | If you are happy with blanks in the listing try this in sheet2!A2:
=IF(INDEX(Sheet1!$B$2:$E$5,MATCH(A$1,Sheet1!$A$2:$A$5,0),ROW()-1)="x",INDEX(Sheet1!$B$1:$E$1,1,ROW()-1),"")
Just copy the formula over range A2:D5
|
6cbd940c2523dfe9b282ec14904aff1b58cf931bb30385c11240d40db2c20a8c | ['c88f84bab1474375bbd1ef98d527f24c'] | Can you use member? to do what you want to exclude your patches? Eg:
to-report highest-value
let available-destinations edge-patches with [ member? self blacklist = false ]
report max-one-of available-destinations ([benefit-to-me / cost-to-me])
end
I can't really test that without your setup and everything, but member? reports true if the asking agent (in this case, not the turtle but the potentially available patch) belongs to the agentset. For a simple working example, see:
to setup
ca
ask patches with [pxcor > 0 ] [
set pcolor white
]
crt 1
end
to go
ask turtles [
let blacklist patches with [ pcolor = black ]
let northpatches patches with [ pycor > 0 ]
let <PERSON> ( northpatches with [ member? self blacklist = false ] )
ask <PERSON> [ set pcolor red ]
ask <PERSON> [
print self
]
]
end
As far as just showing which patches are available, check out how in the above procedure, the turtle asks turtles in its agentset "northred" to print themselves to the console. That's one simple way!
| ee4981d4e51389d0c99acfd75d7c4b7068a155407dd64e1134176225bf147040 | ['c88f84bab1474375bbd1ef98d527f24c'] | If you just want an angled single-lane road that joins the highway, you could try something like:
to draw-merge
ask patches [
if pycor < -3 [
if ( pxcor < pycor + 7 ) and (pxcor > pycor - 1 ) [
set pcolor black
]
]
if pycor < -2 [
if ( pxcor < pycor + 6 ) and (pxcor > pycor ) [
set pcolor gray
]
]
]
end
|
ca02a66144d3befc9b12e2742e6fb5e8a19f11bc3bfac3c575725d51a3aa121e | ['c899b936f14e4063aa4c98bc8dbac4e0'] | You might want to have a look to Box2D
I had to take care of a game with some collisions in the past, but it was in Java so I could work perfectly with awt.geom library, which is not available in Android.
Another approach would be to work with Rect and detecting collisions with "contains" and "intersect".
| 8d23664f83234c227780f8c2ef02b3ef196ee5e3ea84ffabfe7bdc8fdbba5589 | ['c899b936f14e4063aa4c98bc8dbac4e0'] | App Engine allows up to 1 write per second within the same entity group. To surpass that barrier you have to have 60 x 60 x 24 = 86.4k registrations on the same day, which I think you can live with.
If you still think you need any faster process you could use sharding (more typically known for counters - https://developers.google.com/appengine/articles/sharding_counters), which is basically having different tables for users (or usernames) so that you can read them all to check for uniqueness (App Engine is good at doing many reads per second) and have as much better write pace as tables for usernames you add.
More of sharding on writes here - https://developers.google.com/appengine/articles/scaling/contention
Hope it helps.
|
78859786e93ab096c19c47221f084917cf3874581d177fc6259304e2cb51eac6 | ['c8bdffdf058e48da937bce3a0994610f'] | You can do this without the use of a secondary program. Follow these steps:
Set your game to Windowed mode
Have another program open, like Calculator
Switch to Calculator and drag the program window to the bottom corner of your desktop to get it out of the screenshot
Switch back to GW2 and hover your mouse over the item in question
Alt+tab back to Calculator and do not move your mouse
Hit the Print Screen button
Open up Paint and paste
Essentially what this does is take a screenshot of your current windows desktop, which just happens to have GW2 in the frame. You will need to crop your start bar out of the picture, but it's a way to get what you're after without the need to install additional programs.
| f94e902325516a7037adeaf980af97ce44eb718b55677327c34a0ac9235bd158 | ['c8bdffdf058e48da937bce3a0994610f'] | There is an ip conflict on that subnet with that host ip address. I'd bet my life. :)
check arp tables on other hosts that know that IP address. Look closely through all host configurations. See if there is a network interface that has an IP address on the port but not in the configuration files.
Then again... I could be wrong.
|
d0988797588bcdbe3610283ca675e8fcea4d16c470a19d82e0a287423a07cdfc | ['c8c2df9f638b4587a7198bce1f9ce084'] | Здравствуйте. Подскажите как отследить изменение в адресной строке, изменить или удалить из нее часть, и обновить страницу с новым урл?
Зачем нужно. На странице используется AJAX фильтрация, формируя вот такой урл
site.ru/sapogi?page=5&filter=59
Нужно вот эту часть page=ЛЮБАЯ ЦИФРА& привести к виду page=1& или вообще удалить оставив только site.ru/sapogi?filter=59 и обновить страницу с новым урл.
Подскажите как правильно сделать.
| 80572dd5690555b45036a066ee914652df01f095e1e235625147132390613183 | ['c8c2df9f638b4587a7198bce1f9ce084'] | I have an Access database that I inherited and am trying to add some search functionality to it. This is simply a database that holds patient records such as name, address, phone etc. What I want to do is search by last name and have the rest of the form populate with the information.
It may be worth noting that, for some reason, there is a lock on the desktop icon and when I go to the "form" portion of access to design a form, I am not able to access that as the "design" link is gray shaded. Not sure if these two things are related or not. Right now, there is a single form with nothing but textboxes and a couple of dropdowns. I want to use the "last name" text box to search the table and then populate all other fields. Maybe by using one of the function keys or something like that.
This is the query that works but I have no idea how to tie this into the form. When I run this by itself, I get a dialog box that pops up and I can get the results in tabular format. Again, what I would like is to tie this query into my form.
SELECT tblPatient.LName AS [Last], tblPatient.FName AS [First], tblPatient.PIDNO AS [Patient No], tblPatient.Expiration
FROM tblPatient
WHERE (((tblPatient.LName)=[Enter Last Name]));
|
0810b285f2f337add912ba3f73a06ca86704095f4ac4c490045a5efe6ddae113 | ['c8c369dead074da08353995ae17698ac'] | I want to find the string present in one file if present in another file or not.
For example: file.txt contains->
IamLookingforthispatternpleasehelpme
pattern.txt->
thispattern
<?php
if(strpos(file_get_contents("file.txt"),file_get_contents("pattern.txt"))!=FALSE){
echo "found it!!";
}
else{
echo "not able to find";
}
?>
I wrote above code and ran it but it outputs
"not able to find"
How to do this i am new to php
And to clarify txt files contain texts in above format only.
| 118910a78ef796737ad6e33cc14ca049907ec2631ae8e41c0bbc24b2e264e6e9 | ['c8c369dead074da08353995ae17698ac'] | I have two tables for example "first" and "second". I had to limit first table data to 10 and then join the second table. Both are very large. I joined them and then apply limit after the join. And then fetched the results.
$select = $db->select();
$select->from(array("f"=>'first'),'*')
->join(array("s"=>'second'),'f.id= s.id','*')
-> where("f.state = active")
->order('f.cost DESC')
->limit(10,20);
$res = $db->fetchAll($select);
This above query is taking lot of time. Is there any way to fetch results before and then join to reduce the query time? How to do in ZEND
|
69f830ef3d5932a362a04447721590e495fe80b95805edf6bc86a0a3fa15859b | ['c8c3e4aeee4d4e32ab4db48a7c862f90'] | To troubleshoot firewall I use:
netsh wfp show state
this generates xml file for all the dropped packets and firewall state.
the problem is that this file is 13 MB, and it keeps growing each time I run the command.
is there an option to clear the sate of WFP? maybe I should disable something somewhere, but what?
I have only enabled auditing for dropped packets, and my firewall isn't dropping that much, so this xml file should not be that big.
btw. I did try to disable auditing dropped packets, but this will only prevent adding this info to firewall state, but the file is still huge, and full of old data.
| 2a73df01199f26a301703ceb32d28112f605df679fbbeb8ff0e6b04dc01e50e5 | ['c8c3e4aeee4d4e32ab4db48a7c862f90'] | Unfortunately not, however I've learned that this file contains all the filters from all policy stores in addition to audit entries, which means you can reduce it's size by reducing the amount of firewall rules applied to active store. and then also disable all auditing. I didn't test it yet, my file is currently 100MB which is quite worrying. |
dac155d5cdf40b69f6de0185da0583af6ab8b98c90e76c3bbd49f574ddb96916 | ['c8c830d3f0374c5e89e3967523c812f5'] | My network has an exchange server and an apache server hosting a web site.
Exchange is 192.168.1.10
Apache is 192.168.1.12, secured with SSL
Router/firewall is 192.168.1.1
My external static ip address (for example) is <IP_ADDRESS><IP_ADDRESS>
Apache is <IP_ADDRESS>, secured with SSL
Router/firewall is <IP_ADDRESS>
My external static ip address (for example) is 1.1.1.1 www.aaa.com
I have set up my router to port forward 80 and 443 to <IP_ADDRESS>
So when I browse to www.aaa.com it will show the web site only.
Doing this prevents external access to the Exchange server through a mobile phone, since 443 is going only to the web site.
Is there a way to configure this so that the mail based traffic can be passed through the web server onto the email server? I tried to look into subdomains for apache (for example calling the mail domain mail.aaa.com) but I am not clear on what I am trying to achieve so couldn't work out what I was looking for.
| ab69e67cd6cba3a647665423d053177135becd04f03913a7d941f1f460f30a13 | ['c8c830d3f0374c5e89e3967523c812f5'] | I need to allow both Exchange (2016) traffic and (Apache) SSL web traffic to the same server (Windows 2016). Both require a port forward on 443.
I have two incoming internet connections, both ADSL. eg 100.100.100.1 and 100.100.100.2. I can combine this into one router/modem so they end up being routed from the same device with a local address of 192.168.1.1.
My proposed solution is to set the NIC in the server to have 2 IP addresses, <IP_ADDRESS> and <IP_ADDRESS><IP_ADDRESS> and <IP_ADDRESS>. I can combine this into one router/modem so they end up being routed from the same device with a local address of <IP_ADDRESS>.
My proposed solution is to set the NIC in the server to have 2 IP addresses, 192.168.1.10 and 192.168.1.11. Then I can route port 443 traffic on each incoming internet connection to a different address.
<IP_ADDRESS>:443 > <IP_ADDRESS>:443
<IP_ADDRESS>:443 > <IP_ADDRESS>:443
Then I can bind the exchange traffic to the <IP_ADDRESS> NIC address and the web traffic to <IP_ADDRESS> NIC address.
Both addresses will have their gateway set as the <IP_ADDRESS> address.
Will this work correctly? Or should it be configured differently?
And will there be any other problems with having the addresses set like that?
|
1b5e3048f6c754dd7c538a08da71f89a96f5dec3a9378032ee03eb3d3b984591 | ['c8d40e8b508b49d3a8f01acca4ccd00d'] | 1.way
LocalDate ld = LocalDate.parse(reservationDTO.getReservationDate());
2.way
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDate dateTime = LocalDate.parse(reservationDTO.getReservationDate(),
formatter);
3.way
LocalDate localDate = LocalDate.parse(reservationDTO.getReservationDate());
I try convert String to java.time.localDate but for this 3 ways i have error
java.time.format.DateTimeParseException: Text '2018-7-11' could not be parsed at index 5
| 534feeb3cb1a106cc4a2ee92c29bfd950b03a4b2a409d7cad2f6164d26904a07 | ['c8d40e8b508b49d3a8f01acca4ccd00d'] | I have for example that time "15:00:00" and "15:30:00"
firstly i do split and cast to Integer
const hour = Number(this.time.split(':')[0]);
const minutes = Number(this.time.split(':')[1]);
and later i using for example if(hour > hour1) { .... }
I know that this method is not optimal is some tips to compare time?
|
e5ebfe1b9735b1fa5eef8821e5865242bd326deb32390721a3e12be0f6acd5f8 | ['c8d63007892a4477a466813b28af1739'] | The production env files are NOT into source control, only the local ones are. At least that is the intend, production env files should not be in source control as they contain secrets.
However, they are added to the docker image by docker-compose when you run it. You may create a Docker machine using the Digital Ocean driver, activate it from your terminal, and start the image you've built by running docker-compose -f production.yml -d up.
| 2d8d6cdf4ae6118ad2d590b015e9a5408fc6cbdcac7292f8f7e6b450fefe3d97 | ['c8d63007892a4477a466813b28af1739'] | When you traverse a FK in reverse, you end up with a manager, and multiple items on the other side. So i.zone.namingzone in your for loop is a manager, not a NamingZone. If you change your print loop to:
for i in queryset:
print (i.zone.namingzone.all())
You should see all the naming zones for your item. You can extract the naming field from each NamingZone from the queryset as follows:
queryset.values('zone__namingzone__naming')
You probably want to extract a few other fields from your Light model, like the lpd for instance:
queryset.values('lpd', 'zone__namingzone__naming')
You might have a same ldp several times, as many times as it has naming zones.
|
1ce7a110091aa867be05ba2bd258e46b8561b0460abf5e566828c974b8992075 | ['c8e535af6b714d139932b7e6a75b0257'] | essentially I have a function which I need to pass to a bunch of values in two different moments (here skipped for practical reasons), hence, I thought need to split all the parameters in two tuple sets after which I'd pass the first set and then the second thinking - mistakenly - that python would allocate all the available n parameters of the function to the values passed with the tuple and then the rest with the second tuple. That is not the case:
def example_F_2(x, y, z, g):
return x * y + z * g
e = (1,2)
r = (3,4)
print(example_F_2(e, r))
in fact:
Traceback (most recent call last):
File "C:/Users/francesco/PycharmProjects/fund-analysis/test_sheet.py", line 7, in <module>
print(example_F_2(e, r))
TypeError: example_F_2() missing 2 required positional arguments: 'z' and 'g'
what can I do? I am guessing something from this page should work (https://docs.python.org/3.5/library/functools.html) but I have been unable to do it myself
| 06119283e84e4cd22757b79f201ed7525e76c28c93b7643221871ee96ce51c28 | ['c8e535af6b714d139932b7e6a75b0257'] | so essentially my problem is this, after I authenticate the user with the dajngo built in system, the user switches to the user "admin" instead of keeping the previous user in session. code:
from django.contrib.auth import authenticate
from django.contrib.auth.decorators import login_required
def new_login_view(request):
if request.method == 'POST':
data = dict(request.POST)
data.pop('csrfmiddlewaretoken')
id_client = data['lg_username'][0]
pass_client = data['lg_password'][0]
user = authenticate(username=id_client, password=pass_client)
if user is not None:
# A backend authenticated the credentials
...
return render(request, 'initial_page.html', dictionary_with_info)
when I am in the initial_page.html and activate a view, that is:
@login_required
def home(request):
if request.method == 'POST':
...
when I call for request.user I get: User: admin instead of the user before.
any idea why?
|
144c6627c48450ec7d543b87b5d168ac6ce0a01b86d3e8a27cfbb51777a868b5 | ['c8ee8d5a87a14622a9d7aab7bfbdfc16'] | Now when i click on edit Modal is not opening and database value is getting empty
another jquery
$(document).ready(function(){
$("#form1").submit(function(event){
event.preventDefault();
var formData = new FormData(this);
$.ajax({
url:"upresult.php",
type:"POST",
data:{formData:formData},
async:false,
success:function(data) {
alert(data);
location.reload();
},
cache:false,
contentType:false,
processData:false
});
});
});
upresult.php
<?php
include("connection.php");
if(!empty($_POST)){
$no=$_POST['stud_no'];
$name=trim($_POST['name']);
$mob=trim($_POST['mob_no']);
$dob=trim($_POST['dob']);
$add=trim($_POST['add']);
$photo=trim($_FILES['photo']['name']);
$gen=trim($_POST['gender']);
$cn=trim($_POST['country']);
$st=trim($_POST['state']);
$ct=trim($_POST['city']);
$qry="update stud set stud_name='$name',mobile='$mob',dob='$dob',address='$add',gender='$gen',country='$cn',state='$st',city='$ct' where stud_no='$no'";
$data=mysqli_query($conn,$qry);
if($data)
{
echo '<script language="javascript">';
echo 'alert("Updated Successfully")';
echo '</script>';
}
else {
echo '<script language="javascript">';
echo 'alert("Cannot update record")';
echo '</script>';
}
if(!empty($_FILES['photo']['name'])){
$qry1= "update stud set photo='$photo' where stud_no='$no'";
$data1=mysqli_query($conn,$qry1);
if($data1){
$target_dir="images/";
$target_file=$target_dir.basename($_FILES["photo"]["name"]);
$imageFileType=pathinfo($target_file,PATHINFO_EXTENSION);
if(move_uploaded_file($_FILES["photo"]["tmp_name"],$target_file)){
echo '<script language="javascript">';
echo 'alert("Image upload successfully")';
echo '</script>';
} else {
echo '<script language="javascript">';
echo 'alert("Cannot Upload")';
echo '</script>';
}
}
}
}
| 4f2323272c4b7f94762354b7153d43c9b511294883b3044fb8b79cd4c2e5a212 | ['c8ee8d5a87a14622a9d7aab7bfbdfc16'] | Minimum 3 stocks in item_master table should be maintained.
Table: item_master
create table item_master
(
item_no number(5) primary key,
name varchar(10),
stock_on_hand number(5) default 0
);
Table: item_detail
create table item_detail
(
item_no number(5) references item_master,
operation varchar(10) check(operation in('Sales','Purchase')),
quantity number(5)
);
insert into item_master values(101,'Chair',5);
insert into item_master values(102,'Sofa',4);
insert into item_master values(103,'Table',6);
I have written this trigger for maintaining minimum 3 stocks.
create or replace trigger tristk
before insert or update or delete on item_master
for each row
declare
stk number(5);
begin
select stock_on_hand into stk from item_master where item_no = :new.item_no;
if(stk<=3) then
raise_application_error(-20000,'Not enough stock');
end if;
end;
/
I have written Another trigger to automatically update item_master whenever I insert or update or delete in item_detail
CREATE OR REPLACE TRIGGER triitem AFTER
INSERT OR UPDATE OR DELETE ON item_detail
FOR EACH ROW
BEGIN
UPDATE item_master
SET
stock_on_hand =
CASE :new.operation
WHEN 'Sales' THEN stock_on_hand -:new.quantity
WHEN 'Purchase' THEN stock_on_hand +:new.quantity
END
WHERE item_no =:new.item_no;
END;
/
|
7228e2a070dd31d7b4b2f092b3a7bfe7ffcbe7a6959e405011d4c509d9bb6f5e | ['c90c176fecfd4b8fa4c13d27eab681a9'] | I ended up doing two things. One, I started using patch decorator from the mock library to fake the response form systems B. More specifically I use the @patch('requests.post') then in my code I set the return value to "< Response [200]>". However this only makes sure that requests.post is called, not that the second system processed it correctly. The second thing I did was write a separate test that makes the request that should have been sent by A and sends it to the system to check if it processes it correctly. In this manner systems A and B are never running at the same time. Instead the tests just fake there responses/requests.
In summery, I needed to use @patch('requests.post') to fake the reply from B saying it got the request. Then, in a different test, I set up B and made a request to it.
| b46f8cff56f6ca70486bf896231e4a073ddaf51766c4e0601cf01ac7140175a2 | ['c90c176fecfd4b8fa4c13d27eab681a9'] | I have a flask app that is intended to be hosted on multiple host. That is, the same app is running on different hosts. Each host can then send a request to the others host to take some action on the it's respective system.
For example, assume that there is systems A and B both running this flask app. A knows the IP address of B and the port number that the app is hosted on B. A gets a request via a POST intended for B. A then needs to forward this request to B.
I have the forwarding being done in a route that simply checks the JSON attached to the POST to see if it is the intended host. If not is uses python's requests library to make a POST request to the other host.
My issue is how do I simulate this environment (two different instance of the same app with different ports) in a python unittest so I can confirm that the forwarding is done correctly?
Right now I am using the app.test_client() to test most of the routes but as far as I can tell the app.test_client() does not contain a port number or IP address associated with it. So having the app POST to another app.test_client() seems unlikely.
I tried hosting the apps in different threads but there does not seem to be a clean and easy way to kill the thread once app.run() starts, can't join as app.run() never exits. In addition, the internal state of the app (app.config) would be hidden. This makes verifying that A does not do the request and B does hard.
Is there any way to run two flask app simultaneously on different port numbers and still get access to both app's app.config? Or am I stuck using the threads and finding some other way to make sure A does not execute the request and B does?
Note: these app do not have any forums so there is no CSRF.
|
245974cb23436e42669085f794edbf82eb82ee572d4991137cd51349f13fbe7c | ['c929d2dec7484c60940f7a1245c30d47'] |
if I can't download it somehow
You can't or don't want to? Are you talking about the CSS file itself?
There is no way not to download parts of a big CSS file.But if you already know that some of them are unused then delete them from pack. Or if you are not sure, you could determine it on server side - if you have any back-end code. Or maybe you could check it by using client side JS - for example by checking used CSS classes. But in my opinion it could be bigger overhead than downloading unnecessary CSS files.
| bbf3a2bc5b7af348b7bec6d2294f75514bd8ab13aa058b1c2e64fb2b160615c5 | ['c929d2dec7484c60940f7a1245c30d47'] | If you use a div as a button and an image as a background you can make your CSS like this:
div.divsclass {
border-radius: 15px 50px 30px 5px:
}
So you can set the border-radius in all of the 4 corners, if you want to only with CSS. Or edit your SVG, as mentioned before.
|
fb274609993d6b82fe3c7a0d9981ccb3ec1bb9186806d353dbf7781652ae96d3 | ['c92de60401de4a32a8909face3430d8b'] | The root of this issue is that List.subList() does not copy the List:
/**
* Returns a view of the portion of this list between the specified
* fromIndex, inclusive, and toIndex, exclusive. (If
* fromIndex and toIndex are equal, the returned list is
* empty.) The returned list is backed by this list, so non-structural
...
Then, when you call size() on the resulting view, the exception is thrown. I haven't dug into why this happened, but size() tries to validate it's current size, which in this case is conflicted between the full list and the view.
So, you can remedy this crash by simply copying the list:
List<YOUR_TYPE> trimmed = new ArrayList<>( game.subList(0, maxIndex) );
adapter = new GameCardListMiniAdapter(this, trimmed);
| d2b4f05e2c141b2675cd2775ae0964f6c16382bd9376dece1d10e10595fce316 | ['c92de60401de4a32a8909face3430d8b'] | Cat Plus Plus mentioned that this isn't how a dictionary is intended to be used. Here's why:
The definition of a dictionary is analogous to that of a mapping in mathematics. In this case, a dict is a mapping of K (the set of keys) to V (the values) - but not vice versa. If you dereference a dict, you expect to get exactly one value returned. But, it is perfectly legal for different keys to map onto the same value, e.g.:
d = { k1 : v1, k2 : v2, k3 : v1}
When you look up a key by it's corresponding value, you're essentially inverting the dictionary. But a mapping isn't necessarily invertible! In this example, asking for the key corresponding to v1 could yield k1 or k3. Should you return both? Just the first one found? That's why indexof() is undefined for dictionaries.
If you know your data, you could do this. But an API can't assume that an arbitrary dictionary is invertible, hence the lack of such an operation.
|
cdb2af5122a12547bd32a21f4cca6cc5bb7f54a19185d8725df76a0482f42251 | ['c94694c0ee63457494fe8aecbf5862c2'] | My steps to fix that in Lumen 7:
install "illuminate/redis" package: composer require illuminate/redis:"^7.0"
install "php-redis" on my CentOS7: yum --enablerepo=epel -y install php-pecl-redis
install "predis" package: composer require predis/predis:"^1.0"
change the redis client to "predis" (by default its "phpredis"): 'client' => 'predis'. So the config is:
'redis' => [
'cluster' => false,
'client' => 'predis',
'default' => [
'host' => env('REDIS_HOST', '<IP_ADDRESS>'),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_DATABASE', 0),
],
]
| 2dccac7b7a8742eccde117ab03caf45d14084538a697a62d315ba2864819e670 | ['c94694c0ee63457494fe8aecbf5862c2'] | Just if you don't want to use foreach():
$month_days=array("Apr"=>"30", "May"=>"31", "Jun"=>"30", "Jul"=>"31", "Aug"=>"31", "Sep"=>"30", "Oct"=>"31", "Nov"=>"30", "Dec"=>"31", "Jan"=>"31", "Feb"=>"28", "Mar"=>"30");
$val='May';
$noOfDay = 0;
$month_index = array_search($val, array_keys($month_days));
$noOfDay = array_sum(array_slice($month_days,0,$month_index +1));
var_dump($noOfDay);
Output: int(61)
|
8628bef380368d2327074457da3b1d41af77b2f8ec86376ccef8fabd92ee221c | ['c94ade4814734d888a174c771033e8b3'] | I have Acer Aspire XC100 with RAM upgraded to 8 GB running Linux (Ubuntu). I am using the system as a home entertainment system to listen to music etc. The problem is, the system doesn't seem to have enough power to run Youtube videos in full screen mode. Whenever I go full screen, the video starts to get out of sync with audio. This happens even if the video is already loaded up, so it is not an internet connection problem.
Question: Would installing a basic video card, such as RADEON R7 240, improve Youtube video performance?
| b00df16a4d01d20c26f119de05aaaf8867a2413a5fa123cd0cd980e598afafc7 | ['c94ade4814734d888a174c771033e8b3'] | I am trying to solve a problem of the following form: pick a continuous random vector $(X_1,X_2)$ with support within $[0,\infty)^2$ to maximise $$\mathbb E\left[\sqrt{X_1+X_2}\right]$$ subject to the following constraint: for any $i,j$ with $\{i,j\} =\{1,2\}$ and almost all $x \ge 0$,
$$\frac {f_i(x)}{1-F_i(x)} \ge \frac{1}{\mathbb E[1-e^{-X_j}|X_i = x]}$$
where $F_i$ is the marginal CDF of $X_i$ and $f_i$ is the density of $F_i$.
I only took an introductory course in functional optimisation and I am wondering whether this problem can be solved with standard techniques? In particular, can this be thought as an optimal control problem?
Thank you
|
fc3355bc5b127140163e44492deb22e161d6f7fc0316eda58384bcbfb890eaa2 | ['c95bfdd362c64167b43e6a370669920a'] | Yes, as long as you keep your database integrity when migrating.
CKEditor basically adds HTML tags and attributes to your data, which are saved in your fields' tables in the database. So, for example, if you have a body field that contains text formatted like "Hello, body", and take a look at your field_data_body table, you will see something like this:
<p>Hello, <strong>body</strong>...
| 96d4a320dfc8965af843171b3367939dcd80684950fcb5c3da38cd658ffc799a | ['c95bfdd362c64167b43e6a370669920a'] | Yeah, basically any PHP code will work in the "Computed code PHP" textarea available in any computed field. So you should be fine. Let me know if you run into any issues.
PD. Please note it's not a good practice to include PHP code in a field, but if it's your only option, go ahead. |
d31399e748602b85ee3556ba3d8eb16c844f6f980c9dc8f0173040ad8c1516a7 | ['c95e0e89bf43455c9fd1ed52a9ef7839'] | Here's a part of code I developed to better understand Java gui. I'm also a begginer.
It's three classes: starter class, ongoing non gui processes, gui with the swingworker method. Simple, works, can safely update a lot of gui components from Swingworkers process method (passes a class instance as argument). Whole code so it can be copy/pasted:
package structure;
public class Starter {
public static void main(String[] args) {
Gui1 thegui = new Gui1();
}
}
LOGIC
package structure;
public class Logical {
String realtimestuff;
public String getRealtimestuff() {
return realtimestuff;
}
public void setRealtimestuff(String realtimestuff) {
this.realtimestuff = realtimestuff;
}
//MAIN LOGICAL PROCESS..
public void process(){
// do important realtime stuff
if (getRealtimestuff()=="one thing"){
setRealtimestuff("another thing");
}else{setRealtimestuff("one thing");
}
// sleep a while for readibility of label in GUI
//System.out.println(getRealtimestuff());
try {
Thread.sleep(250);
} catch (InterruptedException e) {
System.out.println("sleep interrupted");
return;
}
}
}
GUI CLASS with Swingworker
package structure;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JLabel;
import java.util.List;
import javax.swing.*;
public class Gui1 {
final class Dataclass{
String stringtosend;
public Dataclass(String <PERSON>){
//super();
this.stringtosend = <PERSON>;
}
}
// EDT constructor
JFrame frame;
public Gui1(){
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
initialize();
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public void initialize() {
// JUST A FRAME WITH A PANEL AND A LABEL I WISH TO UPDATE
frame = new JFrame();
frame.setBounds(100, 100, 200, 90);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
frame.getContentPane().add(panel, BorderLayout.NORTH);
JLabel lblNovaOznaka = new JLabel();
panel.add(lblNovaOznaka);
frame.setVisible(true);
SwingWorker <Void, Dataclass> worker = new SwingWorker <Void, Dataclass>(){
@Override
protected Void doInBackground() throws Exception {
Logical logic = new Logical();
boolean looper = true;
String localstring;
while (looper == true){
logic.process();
localstring = logic.getRealtimestuff();
publish(new Dataclass(localstring));
}
return null;
}
@Override
protected void process(List<Dataclass> klasa) {
// do a lot of things in background and then pass a loto of arguments for gui updates
Dataclass xxx = klasa.get(getProgress());
lblNovaOznaka.setText(xxx.stringtosend);
}
};
worker.execute();
}
}
| 24d998577c94f38e6cff6242f1a998f6456395471badd5d3771bb70959a90e10 | ['c95e0e89bf43455c9fd1ed52a9ef7839'] | I managed to send a char to arduino by using jserialcomm library. The method looks like this:
// imports I make in my class
import javax.swing.*;
import java.awt.FlowLayout;
import java.awt.event.*;
import com.fazecast.jSerialComm.*;
import java.io.PrintWriter;
code in method
System.out.println("connect");
port = SerialPort.getCommPort("COM5"); // change if different
port.setComPortTimeouts(SerialPort.TIMEOUT_SCANNER,0,0);
port.openPort();
//port.setBaudRate(9600);
System.out.println(port.getBaudRate());
try {Thread.sleep(600); } catch(Exception e) {} // I think this sleep is a must until it opens
System.out.println(port.isOpen());
if(port.isOpen()) {
System.out.println("port open!");
try {Thread.sleep(500); } catch(Exception e) {}
PrintWriter output = new PrintWriter(port.getOutputStream());
output.write(2);
try {Thread.sleep(800); } catch(Exception e) {}
output.flush();
System.out.println("char sent");
try {Thread.sleep(600); } catch(Exception e) {}
port.closePort();
}
}
else {
// disconnect from the serial port
//port.closePort();
}
}
|
52b1f0e34451108f4996890ea736b1406eb07df99b13748f202075abe33687ce | ['c96d4271ebc0462a89b9f78646d3dc45'] | This is a follow my rock-paper-scissors program, original post here:
Simple rock-paper-scissors game
Looking for any feedback and recommendations on ways to keep improving.
Quick notes on changes:
Removed the use of using namespace std;
Added inheritance structure.
Added the use of enum variables to replace strings to ease computational
expense while still maintaining code readability.
Simplified the logic of the whoWon function.
Changed the scope whoWon function to deal with a singular task
Removed the use of rand and replaced it with a normal distribution from
the random library.
Added the option of choosing from three types of play:
Player vs Computer, Player vs Player(Local), and Computer vs Computer.
Move choices given by Human players will no longer be echoed onto the
application window to ensure player's do not unfairly see each-other's
choices.
Added a moveToString function so that each player's move choice can be
displayed after the winner is determined.
Changed main.cpp loop structure to be do-while, so it will run atleast
once.
Code:
rock-paper-scissors_v2.h:
#ifndef ROCK_PAPER_SCISSORS_V2_H
#define ROCK_PAPER_SCISSORS_V2_H
#include <iostream>
#include <random>
#include <string>
#include <unordered_map>
#include <termios.h>
#include <unistd.h>
enum rock_paper_scissors{
rock = 0,
paper = 1,
scissors = 2
};
class Player{
protected:
rock_paper_scissors move_choice;
public:
virtual void setMoveChoice() = 0;
virtual rock_paper_scissors getMoveChoice() = 0;
std::string moveToString(rock_paper_scissors);
};
class ComputerPlayer : public Player{
public:
void setMoveChoice();
rock_paper_scissors getMoveChoice();
};
class HumanPlayer : public Player{
private:
std::string player_name;
public:
HumanPlayer();
void setMoveChoice();
rock_paper_scissors getMoveChoice();
};
#endif /* ROCK_PAPER_SCISSORSS_H */
rock-paper-scissors_v2.cpp:
#include "rock-paper-scissors_v2.h"
using std::cin;
using std::cout;
std::string Player:: moveToString(rock_paper_scissors move){
std::string move_as_string;
if(move == rock)
move_as_string = "<PERSON>";
else if(move == paper)
move_as_string = "<PERSON><IP_ADDRESS>string moveToString(rock_paper_scissors);
};
class ComputerPlayer : public Player{
public:
void setMoveChoice();
rock_paper_scissors getMoveChoice();
};
class HumanPlayer : public Player{
private:
std<IP_ADDRESS>string player_name;
public:
HumanPlayer();
void setMoveChoice();
rock_paper_scissors getMoveChoice();
};
#endif /* ROCK_PAPER_SCISSORSS_H */
rock-paper-scissors_v2.cpp:
#include "rock-paper-scissors_v2.h"
using std<IP_ADDRESS>cin;
using std<IP_ADDRESS>cout;
std<IP_ADDRESS>string Player:: moveToString(rock_paper_scissors move){
std<IP_ADDRESS>string move_as_string;
if(move == rock)
move_as_string = "rock";
else if(move == paper)
move_as_string = "paper";
else
move_as_string = "scissors";
return move_as_string;
}
void ComputerPlayer :: setMoveChoice(){
//Simulate the computer randomly choosing a move
std<IP_ADDRESS>random_device rd;
std<IP_ADDRESS>mt19937 gen(rd());
std<IP_ADDRESS>uniform_int_distribution<int> distribution(0,2);
int num_generated = distribution(gen);
move_choice= (rock_paper_scissors)num_generated;
}
rock_paper_scissors ComputerPlayer :: getMoveChoice(){
return move_choice;
}
HumanPlayer :: HumanPlayer(){
cout<<"Please enter your name: ";
cin>>player_name;
cout<<"Hello "<<player_name<<", welcome to Rock-Paper-Scissors! \n";
}
void HumanPlayer :: setMoveChoice(){
cout<<player_name<<", please enter the move you wish to make: \n";
termios oldt;
tcgetattr(STDIN_FILENO, &oldt);
termios newt = oldt;
newt.c_lflag &= ~ECHO;
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
std<IP_ADDRESS>string move;
cin>>move;
//Use a hashmap to map user string input to enum
std<IP_ADDRESS>unordered_map<std<IP_ADDRESS>string,rock_paper_scissors> valid_moves = {
{"rock",rock},{"paper",paper},{"scissors",scissors}
};
//Check for valid user input
while(valid_moves.find(move) == valid_moves.end()){
cout<<"Error, invalid move! Please enter rock, paper, or scissors \n";
getline(cin,move);
}
move_choice = valid_moves[move];
}
rock_paper_scissors HumanPlayer :: getMoveChoice(){
return move_choice;
}
main.cpp:
#include "rock-paper-scissors_v2.h"
using std<IP_ADDRESS>cin;
using std<IP_ADDRESS><IP_ADDRESS> moveToString(rock_paper_scissors move){
std::string move_as_string;
if(move == rock)
move_as_string = "rock";
else if(move == paper)
move_as_string = "paper";
else
move_as_string = "scissors";
return move_as_string;
}
void ComputerPlayer <IP_ADDRESS> setMoveChoice(){
//Simulate the computer randomly choosing a move
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<int> distribution(0,2);
int num_generated = distribution(gen);
move_choice= (rock_paper_scissors)num_generated;
}
rock_paper_scissors ComputerPlayer <IP_ADDRESS> getMoveChoice(){
return move_choice;
}
HumanPlayer <IP_ADDRESS> HumanPlayer(){
cout<<"Please enter your name: ";
cin>>player_name;
cout<<"Hello "<<player_name<<", welcome to Rock-Paper-Scissors! \n";
}
void HumanPlayer <IP_ADDRESS> setMoveChoice(){
cout<<player_name<<", please enter the move you wish to make: \n";
termios oldt;
tcgetattr(STDIN_FILENO, &oldt);
termios newt = oldt;
newt.c_lflag &= ~ECHO;
tcsetattr(STDIN_FILENO, TCSANOW, &newt);
std::string move;
cin>>move;
//Use a hashmap to map user string input to enum
std::unordered_map<std::string,rock_paper_scissors> valid_moves = {
{"rock",rock},{"paper",paper},{"scissors",scissors}
};
//Check for valid user input
while(valid_moves.find(move) == valid_moves.end()){
cout<<"Error, invalid move! Please enter rock, paper, or scissors \n";
getline(cin,move);
}
move_choice = valid_moves[move];
}
rock_paper_scissors HumanPlayer <IP_ADDRESS> getMoveChoice(){
return move_choice;
}
main.cpp:
#include "rock-paper-scissors_v2.h"
using std::cin;
using std::cout;
int whoWon(rock_paper_scissors &p1_move, rock_paper_scissors &p2_move){
// Function will return 1 if player 1 wins, 2 if player 2 wins, and 3 for a tie
//Both players making the same move results in a tie
if(p1_move == p2_move){
return 3;
}
//If not a tie, check for player 1 being the winner
else if((p1_move == rock && p2_move == scissors) || (p1_move == paper && p2_move == rock) || (p1_move == scissors && p2_move == paper)){
return 1;
}
// If none of the above are true, player 2 wins
else{
return 2;
}
}
int main(int argc, char** argv) {
char play_again;
do{
//Initiate the Title Screen
cout<<"Rock-Paper-Scissors \n";
cout<<"-------------------\n";
cout<<"Enter the number of the mode you wish to play: \n";
cout<<"1.) Player vs Computer \n2.) Player vs Player(Local Only) \n3.) Computer vs Computer(Simulation) \n";
int mode_selected;
cin>>mode_selected;
Player *player_1;
Player *player_2;
switch(mode_selected){
case 1:{
ComputerPlayer com;
HumanPlayer hum;
player_1 = &hum;
player_2 = &com;
break;
}
case 2:{
HumanPlayer hum_1;
HumanPlayer hum_2;
player_1 = &hum_1;
player_2 = &hum_2;
break;
}
case 3:{
ComputerPlayer com_1;
ComputerPlayer com_2;
player_1 = &com_1;
player_2 = &com_2;
break;
}
}
player_1->setMoveChoice();
rock_paper_scissors p1_move = player_1->getMoveChoice();
player_2->setMoveChoice();
rock_paper_scissors p2_move = player_2->getMoveChoice();
int winner = whoWon(p1_move,p2_move);
if(winner == 1){
cout<<"Player one chose "<<player_1->moveToString(p1_move)<<" and Player 2 chose "<<player_1->moveToString(p2_move)<< ". Player 1 wins! \n";
}
else if(winner == 2){
cout<<"Player one chose "<<player_1->moveToString(p1_move)<<" and Player 2 chose "<<player_1->moveToString(p2_move)<< ". Player 2 wins! \n";
}
else{
cout<<"Player one chose "<<player_1->moveToString(p1_move)<<" and Player 2 chose "<<player_1->moveToString(p2_move)<< ". It's a tie! \n";
}
cout<<"Would you like to play again?(y/n) \n";
cin>>play_again;
} while(play_again == 'y');
return 0;
}
Additional Questions:
What are some good sources to look at for adding simple PvP online play?
Any tips/ resource recommendations for improving the current "menu" UI?
| ad5d179c09664b5ed2a3aa38a996f69223b5c58b7cfb4b2c09e182974b6748ea | ['c96d4271ebc0462a89b9f78646d3dc45'] | I'm trying to migrate the data at my company from Excel to mySQL so I'm very new at this. I just installed the latest mySQL package via the standard installer and when I try a new connection (I'm trying to get through the mySQLTutorial) the error pops up:
MySQLWorkbench.exe - No disk
There is no disk in drive.
Please insert disk in drive \Device\Harddisk\DR2
My setup for the new connection is as follows:
Connection name: local
Connection method: Standard (TCP/IP)
Hostname: <IP_ADDRESS>
Port: 3306
Default schema: ""
Anyone have any ideas? I'm completely at a loss here...
|
3d9c7f3a34106ba88c0d9b29b0f217cbe8d736bd1e1f34016f739decaec3b873 | ['c973f9526ee04853948ad2d541d2bce7'] | I cannot get date ranges to work properly in a query using SQLite3
Create And Populate Table:
create table dates(myDate DATE);
insert into dates values('2012-10-1');
insert into dates values('2012-10-2');
insert into dates values('2012-10-3');
insert into dates values('2012-10-4');
insert into dates values('2012-10-5');
insert into dates values('2012-10-6');
insert into dates values('2012-10-7');
insert into dates values('2012-10-8');
insert into dates values('2012-10-9');
insert into dates values('2012-10-10');
Query:
select * from dates where myDate >= '2012-10-1' and myDate < '2012-10-31';
Results:
2012-10-1
2012-10-2
2012-10-3
2012-10-10
Where are 10-4 - 10-9?
I get the same results if I use between:
select * from dates where myDate BETWEEN '2012-10-1' AND '2012-10-30';
If I change either of the queries to use '2012-11-1' as the end date, they work properly.
Any help would be greatly appreciated!
| 41da1cad0e442435e9bbb24882f241a546066a1868a04e647356ad2138da865a | ['c973f9526ee04853948ad2d541d2bce7'] | Huge thanks to thedoctor
After enabling logging, I noticed the issue. In Location,
@PrimaryKeyJoinColumn(name = "locationId")
Was incorrect. JPA was trying to join the EventLocation by matching the Location.locationId with the EventLocation.eventLocationId. It is my understanding that JPA does not allow joins on foreign keys so this cannot be done. The database has to be restructured if I want this to work.
|
82d118fae44b3d0fcee228e2904d23c71e5a4fd4a3006f16423d0896da1d282b | ['c97c240a97ca4dabadc16a5803034921'] | Having some trouble getting a valid JSON output from a php for loop, here is my JSON:
[{"title":"One Colour ($2.45)","price":"($2.45)"},{"title":"Two Colours ($3.35)","price":"($3.35)"},{"title":"Three Colours ($4.25)","price":"($4.25)"}],[{"title":"One Colour ($2.45)","price":"($2.45)"},{"title":"Two Colours ($3.35)","price":"($3.35)"},{"title":"Three Colours ($4.25)","price":"($4.25)"},{"title":"One Colour ($3.05)","price":"($3.05)"},{"title":"Two Colours ($4.35)","price":"($4.35)"},{"title":"Three Colours ($5.75)","price":"($5.75)"}],
And here is my php loop that creates the json output
foreach ( $product_addons as $addon ) {
foreach ( $addon['options'] as $option ) :
$loop ++;
switch ($qty) {
case ($qty < 20):
$price = $option['price'] > 0 ? ' (' . wc_price( get_product_addon_price_for_display( $option['price'] ) ) . ')' : '';
$title = strip_tags($option['label']. $price);
break;
case ($qty > 20 && $qty < 35):
$price = $option['discount'] > 0 ? ' (' . wc_price( get_product_addon_price_for_display( $option['discount'] ) ) . ')' : '';
$title = strip_tags($option['label']. $price);
break;
}
$select_text[] = array(
'title' => trim($title),
'price' => trim(strip_tags($price)),
);
endforeach;
echo json_encode($select_text).",";
}
The problem I am getting now is that the JSON output is now valid and I cant quite figure out how to improve it.
| 7cbf1cb6025b9d63b7c5a91b4a74d5a64909b12a014f388c93a1398ff00cf34d | ['c97c240a97ca4dabadc16a5803034921'] | Thanks for the help everyone. I ended up coding this (works like a charm):
<?php foreach($loterms as $key => $loterm) :
$brand_id = substr($loterm->name,0,1);
if(ord($brand_id) > $index_temp):
echo '<li class="full-width">'.$brand_id.'</li>';
endif;
$index_temp = ord($brand_id);
endforeach; ?>
As <PERSON> pointed out all I needed to do was store the index as a variable at the end of the loop then compare that variable with the new index at the start of the next loop and if it changes output my desired code.
|
24e804e840d4b28ebf0d6fd5b2c817849d5a34fe518c0c50f91180a28ae2ca32 | ['c98598c367044f2ca34da7edac5b18fa'] | I realize this post is old but I ran into the same behavior today when importing a json file. The issue was the .json was not properly formed. It was missing the [] (square brackets) at the top and bottom of the file and the ',' (commas) between the objects. I validated the file using http://jslint.com/. The error was resolved once i made these changes.
NOTE: These were the issues which kept my file from being properly formed. I would suggest that you run your data through some type of validator to rule out whatever issue(s) your file MAY be having.
I hope this helps.
| 1ab1fbb39b37394b8bfd512b5460b65cbbdc64c2f4f0643c644a8e8d96e39ad9 | ['c98598c367044f2ca34da7edac5b18fa'] | I have configured the superfish block to display on all pages EXCEPT the user-login page but this is not being honored. I've also created a superfish menu block with no menu items and have configured to ONLY show on the user-login page but this is not being honored.
Why am I trying to do this? There are 3 dummy menu items (not associated with pages) which I cannot make 'disappear' via context rule e.g. only show when user == authorized user (see screen capture).
So if someone knows how to hide the dummy menu items or the whole superfish block from the login screen - please share - it would be appreciated.
Login Screen Image
|
4fe3f737367a841e5205c8f2bd7bc01016c23f5080e0f26f15b57e506fd0d0cf | ['c98f4a70e1f54aec982e07c77b473386'] | NameSpaces from the request XML need to be used in xslt as well.Following xsl gave the PartNumber value.
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:a="http://schemas.datacontract.org/2004/07/DealerBuilt.BaseApi" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:b="http://schemas.datacontract.org/2004/07/DealerBuilt.Models.Parts">
<xsl:output method="xml" version="1.0"/>
<xsl:template match="/">
<xsl:value-of select="*[local-name()='Envelope']/*[local-name()='Body']/*[local-name()='PullCustomerPartsPricingResponse']/*[local-name()='PullCustomerPartsPricingResult']/*[local-name()='CustomerPart']/*[local-name()='Attributes']/*[local-name()='PartNumber']"/>
</xsl:template>
</xsl:stylesheet>
| 2da4f09ca21abd23624107c669212f3517737be469ac3d17968582cba53fce9d | ['c98f4a70e1f54aec982e07c77b473386'] | I'm trying to update the text nodes in xml based on the check if it matches a certain pattern
in xslt 1.0
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:regexp="http://exslt.org/regular-expressions">
<xsl:output method="xml" version="1.0"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:copy>
<xsl:call-template name="CheckAndReplace">
<xsl:with-param name="text" select="."/>
<xsl:with-param name="pattern" select=""/>
</xsl:call-template>
</xsl:copy>
</xsl:template>
<xsl:template name="CheckAndReplace">
<xsl:param name="text"/>
<xsl:param name="pattern"/>
<xsl:for-each select="regexp:match( $text, $pattern, 'gi' )">
<xsl:copy-of select="regexp:replace( $text, $pattern, 'gi','*' )"
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
XML:
<Root>
<Name> <PERSON> </Name>
<Id>  </Id>
</Root>
Here the request has ID tag which matches my pattern and that needs to be replaced
Result Required:
<Root>
<Name> <PERSON> </Name>
<Id> * </Id>
</Root>
|
da26b0e4669c40cb06e8fbb3b949a08f32e950fd9b16cc0931b59cb33cc2ae7e | ['c99072d0c72e4542b9cee8d8d5546ed5'] | The fastest is is join to the same table.
http://www.postgresql.org/docs/8.1/interactive/sql-delete.html
CREATE TABLE test(id INT,id2 INT);
CREATE TABLE
mapy=# INSERT INTO test VALUES(1,2);
INSERT 0 1
mapy=# INSERT INTO test VALUES(1,3);
INSERT 0 1
mapy=# INSERT INTO test VALUES(1,4);
INSERT 0 1
DELETE FROM test t1 USING test t2 WHERE t1.id=t2.id AND t1.id2<t2.id2;
DELETE 2
mapy=# SELECT * FROM test;
id | id2
----+-----
1 | 4
(1 row)
| e108478d341ccf8cea2ab65297846465b224a9281127b57d5d34db24a973e174 | ['c99072d0c72e4542b9cee8d8d5546ed5'] | If you really really really want to create own solution. It's my old bad solution before oAuth times.
Create view which return some key after successful login with username/pass and add generated access_key to db
Check key in request => if exist in db => login
#pseudo code
#view
from django.contrib.auth import authenticate, login
def get_my_token(request, username, password):
user = authenticate(username, password)
if user is not None:
login(request,user)
#first should check has access_key
try:
return UserAuth.objects.filter(user=user).access_key
except:
pass
access_key = 'somecrazy_random_unique_number'
user_auth = UserAuth()
user_auth.user = user
user_auth.access_key = access_key
user_auth.save()
return access_key
Now you can save access_key somewhere and add as header 'access_key_or_any_other_name' to every call to rest resources. Create authentication middleware, not auth backend.
#auth_middelware
class StupidNoAuthMid(object):
def process_request(self, request):
access_key = reuest.META['access_key_or_any_other_name']:
try:
user = UserAuth.objects.filter(access_key=acces_key).user
auth.login(request, user)
except:
pass
You don't want to reinvent the wheel. Use oAauth, you can save access_token for the future.
|
325b8d968b6c6d198ce992fed4442411d922133b4735ded9484abf912baa8867 | ['c994499e912f4b26a5e1a6c66c311006'] | You can use code below.
String full = "Hi 123 it is a 564 and 678, so let's work.";
List<string> list = new List<string>();
string buffer = "";
bool number_seq = false;
int number;
for (int i = 0; i < full.Length; i++)
{
String single_char = full.Substring(i, 1);
bool isNumber = int.TryParse(single_char, out number);
if (isNumber)
{
if (!number_seq)
{
list.Add(buffer);
buffer = "";
number_seq = true;
}
}else if (number_seq)
{
list.Add(buffer);
buffer = "";
number_seq = false;
}
buffer += single_char;
}
list.Add(buffer);
| 26b6698241e5ff0eb3589570317f8aa5310c5dcd62aa61a1013fcf2a4372924b | ['c994499e912f4b26a5e1a6c66c311006'] | I can explain like below
This is an object
public class Person
{
public string Name { get; set; }
public string Surname { get; set; }
public String SayHello()
{
return "Hello";
}
}
You cannot access directly Name, Surname and SayHello from Object like below,
Person.Name = "<PERSON>";
Person.Surname = "<PERSON>";
Person.SayHello();
You should create instanca of an object. This instance is a reference of object
Person person = new Person();
Now, you can access properties and methods of reference of Person object,
person.Name = "<PERSON>";
person.Surname = "<PERSON>";
person.SayHello();
|
e55fb2ab8cb2f03f2d63dbe011013fd27cf52fa56ae967bb64ba2af5b8d1a882 | ['c99ff93f52d0440481ee17b97678105c'] |
<html>
<head>
<style>
#contain_main {background-color:black;
width:100%;
height:auto;}
#main {width:100%;
height:700px;
background-image:url("https://www.sappun.co.kr/shopimages/sappun/0090040002602.jpg?<PHONE_NUMBER>");
background-repeat:no-repeat;
background-position:center center;
background-color:#dbdbdb;}
</style>
</head>
<body>
<div id="contain_main">
<div id="main">
</div>
</div>
</body>
</html>
how can i make the black #contain_main box is place over the #main div box?
i used z-index, position and display, but not work..how can i fix this?
any help will so appreciated! :)
| e30362e08c26f9d463d5bb901b628590160e8445ac49c8c31508178e2cdb85ca | ['c99ff93f52d0440481ee17b97678105c'] |
<table cellpadding="0" cellspacing="0" style="display:inline-block;">
<tr>
<td>
<a href="#">
<img src="https://www.rakuten.ne.jp/gold/sappun/promotion/20201231/test_07.jpg">
</a>
</td>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="#">
<img src="https://www.rakuten.ne.jp/gold/sappun/promotion/20201231/test_08.jpg">
</a>
</td>
</tr>
<tr>
<td>
<a href="#">
<img src="https://www.rakuten.ne.jp/gold/sappun/promotion/20201231/test_09.jpg">
</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
finally i found the way!
but thanks for your help! :D
|
fee3bf5d891d172ab0c41cd923a6e42f297d82c7c6e92a81b098c5759b7a044c | ['c9b1268bb8804c51aeb342985234ce0c'] | I'm getting an exception which I don't understand in this bit of code here:
Dim folderList As List(Of String) = _folderList
For Each folder In folderList
destinationFolder = destinationFolder + "/" + folderName
localFilePath = lbl_folderPath.Text + "/" + folder
alterFolderList(localFilePath)
...
Next
I've got a global variable _folderList which I copy to another variable, folderList, as seen in the first line of my code. When the last method (alterFolderList) is called, it alters the variable _folderList. When debugging, as I reach the end of the for each for the first time (at Next) I get the exception that the collection was modified, when it actually wasn't because the method called doesn't change it. When debugging, after the method is called, I hover above the variable folderList and I see it changed and is now the same as _folderList but it shouldn't because the variable folderList is equaled to _folderList outside the For Each enumeration.
How does this happen? And how to work around this?
| 63dbb46edc0b575134d8a0ac969c57a7825da2cfc59b3f6ed72775b51a7d51b3 | ['c9b1268bb8804c51aeb342985234ce0c'] | The Kendo Splitter has a collapsible property that I want to use. However, the icon is a very small arrow that isn't intuitive at all, the users can barely see it. Even when they know it's there, the icon is so small that clicking it takes some time as hovering such a tiny icon is not that fast.
I want to make it bigger. I managed to enlarge the divider itself
.k-splitbar.k-splitbar-horizontal{
width: 20px;
}
but not the small icon.
I found this post from a user with the exact same issue as me but the solutions there don't work and the user hasn't given any feedback on them.
|
1b18bf93d86670815ea90b1a9fcf477e26b312541eabd30f5e88a1ee9583f8a9 | ['c9b9054c010542cea19dbb75249f10fb'] | "Is there a VBA equivalent to a Getter method in VBA?"
Yes there is, here is an example
Private mSomeValue As String
Public Property Get SomeValue() As String
SomeValue= mSomeValue
End Property
'A corresponding setter method could look like this'
Public Property Let SomeValue(aValue As String)
mSomeValue = aValue
End Property
| eec625f58bbd0b2fddd302eb231560d76dfa763442950d1d8bf5b2b9f7279d7e | ['c9b9054c010542cea19dbb75249f10fb'] | On windows, it is stored in a sqlite database, in
%Home%\.ipython\profile_default\history.sqlite
If the %home% variable is not set, try %userprofile% instead.
As an example, if you'd like to look back at your very first ipython session, you could run
select source from history where session = 1
|
31ed1cf20ccf4affa5164427a9496602f1774c988be283b4852f60b3e3c3dbd8 | ['c9bca4a7f2a74f72874b714e19a9b164'] | The cleanest way to do this would be to extend phpunit with a new assertion method. But here's an idea for a simpler way for now. Untested code, please verify:
Somewhere in your app:
/**
* Determine if two associative arrays are similar
*
* Both arrays must have the same indexes with identical values
* without respect to key ordering
*
* @param array $a
* @param array $b
* @return bool
*/
function arrays_are_similar($a, $b) {
// if the indexes don't match, return immediately
if (count(array_diff_assoc($a, $b))) {
return false;
}
// we know that the indexes, but maybe not values, match.
// compare the values between the two arrays
foreach($a as $k => $v) {
if ($v !== $b[$k]) {
return false;
}
}
// we have identical indexes, and no unequal values
return true;
}
In your test:
$this->assertTrue(arrays_are_similar($foo, $bar));
| b4b00598d6651ea0a22b5696d0d69f850bb32bdb39d33fef1ce66cb255e40c52 | ['c9bca4a7f2a74f72874b714e19a9b164'] | You may also want to look at sending it as an attachment via PEAR Mail_Mime. It can accept an attachment as a string of data.
The RMail package also looks as if it will do the same via the stringAttachment class. You'll have to google for it, because I'm a new user and so I can post only one link at a time.
|
725e76dc93ae924625c70b3056afa4acca395a372f8bd32e03a20a3faff4c687 | ['c9ce3af6db2f4775a12b91e70fbd3bd3'] | I am currently developing an iphone application which is nearing completion but i want to add in the functionality to be able to connect with facebook. I can grasp the basic functionality of this such as connecting and posting status updates and feeds but id like to be able to interact with friends and events within facebook, much like the flixster movies app where you can view friends ratings etc... Can anyone please point me in the right direction? I am fairly new to this all so i need as much help as possible please.
Thanks
<PERSON>
| d8b7596c67400fc5fa4821a40369491701b879232656d938b17cad22c18a5cfa | ['c9ce3af6db2f4775a12b91e70fbd3bd3'] | I am using an if statement to check the value of a BOOLEAN when i click on a button. When the button is clicked if the value is false i want to display a UIActivityIndicator and if the value is true i want to push the new view. I can do this fine but i want the view to change automatically when the BOOLEAN Becomes true if the user has already clicked the button.
So my question is how do you check to see if a value has changed everysecond or less?
|
eea2019ccf6c14fce841010f590d3a850f0b17a40f4373bde51a8b41fb73bf9d | ['c9db6fc389c24ab1bd92f00d9512cf9a'] | To create a histogram in Excel you would use FREQUENCY
This is no diferent in using something such as the groups for colours.
The difference is that you would use an IF statement referring to the group column.
=FREQUENCY(IF(GroupRange="GroupName",DataRange),BinRange)
So if your data was in B2:B40 and your group delimiter in C2:C40 and your bin sizes was in E2:E12 you would use a formula such as:
=FREQUENCY(IF($C$2:$C$40="B",$B$2:$B$40),$E$2:$E$12)
Then pop each group next to each other changing the "B" (or whatever) as you go.
Hopefully this will get oyu on the right track.
(note: with FREQUENCY you must array enter into all cells in line with the bin range... [ctrl]+[shift]+[enter])
| 9a1b6ee972afa84b4f2f9809fe3b6077228ddd2e02a8a247a96cc0c3fef637a6 | ['c9db6fc389c24ab1bd92f00d9512cf9a'] | You can write to a CSV quite simply using VBA.
An example could be:
Sub WriteCSVFile()
Dim My_filenumber As Integer
Dim logSTR As String
My_filenumber = FreeFile
logSTR = logSTR & Cells(1, "A").Value & " , "
logSTR = logSTR & Cells(2, "A").Value & " , "
logSTR = logSTR & Cells(3, "A").Value & " , "
logSTR = logSTR & Cells(4, "A").Value
Open "C:\USERS\Documents\Sample.csv" For Append As #My_filenumber
Print #My_filenumber, logSTR
Close #My_filenumber
End Sub
|
1b4889643dbbe67ea3f373dbbc764561b6b572633509657a69dbb2154c153872 | ['c9e5a8131a2a47e4be82f4d9c3ffc7bd'] | Context
I ran an experiment with a two-factor within-subjects design (factor A with 3 levels (small, medium, large) and factor B two level (open, closed), so 6 test condition).
12 subjects have repeated 5 times each of the six test conditions (so 30 test per subject).
I tested for significance using a repeated measures ANOVA (and for significant main effects, I used Scheffé post-hoc tests).
Question
A reviewer asked me to provide power values for my ANOVA results.
How i can calculate this values? I tried with:
G*Power: cannot do power analyses for repeated measures designs with more than one within-subject or between-subject factor;
R pwr.anova.test: only balanced one way ANOVA.
| d69c1d512505b51092cbf8bc7e8b4f6df7eb229d1f8ec2cabdb9ca8f64e79f72 | ['c9e5a8131a2a47e4be82f4d9c3ffc7bd'] | $args = array(
'post_type' => 'news',
'posts_per_page' => 5,
'post_status' => 'publish',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'week',
'field' => 'slug',
'terms' => $currweeknumber,
)
)
);
$post = get_posts($args);
I have a page which posts 5 news each week. I have a problem. A year passed since I started my blog and this $args query shows me the last year news, not the actual. This is because week number doesn't changed at all, it's the same value from 1 to 52 (basically I have 52 terms with the value of 1,2,3...etc). Is there any way to get the last 5 element of this array, not the first 5? I'm tried with 'order' => ''DESC' but not worked.
|
376810b5236195176fc3bc4a2cb9ec3e39b51fa53a32fca03ee7db14cbbc2a2a | ['c9f7afedd11d486c9ee0ac19351210ee'] | I made a 5 second time bar to replace the wave. when wave1 has been 5 seconds it will move to wave2. then the first wave will be destroyed. when I got to wave3, an error came out. here's my code:
IEnumerator ChangeWave()
{
for (int i = 0; i < wave.Length - 1; i++)
{
yield return new WaitForSeconds(5f);
Destroy(wave[i]);
wave[i+1].SetActive(true);
}
}
the error said The object of type 'GameObject' has been destroyed but you are still trying to access it. - unity
sorry for my bad english.
| 0d0d1b853c7b6072f6db6d7aac7596285c02d4ff125222d2bf52f44f52027594 | ['c9f7afedd11d486c9ee0ac19351210ee'] | so I made a script for multitouch using raycast. when dragged faster, the gameobject will be released, but when moving the gameobject slowly it follows the touch. here the codes
Vector2[] startPos = new Vector2[5];
Touch[] touch = new Touch[5];// Update is called once per frame
void FixedUpdate()
{
Debug.Log(Input.touchCount);
if (Input.touchCount > 0)
{
touch[Input.touchCount-1] = Input.GetTouch(Input.touchCount-1);
Vector2 worldPoint = Camera.main.ScreenToWorldPoint(touch[Input.touchCount-1].position);
RaycastHit2D hit = Physics2D.Raycast(worldPoint, Vector2.zero, Mathf.Infinity);
if (hit.transform != null)
{
if (touch[Input.touchCount - 1].phase == TouchPhase.Moved)
{
hit.transform.position = worldPoint;]
}
else if (touch[Input.touchCount-1].phase == TouchPhase.Began)
{
startPos[touch[Input.touchCount-1].fingerId] = worldPoint;
}
else if (touch[Input.touchCount-1].phase == TouchPhase.Ended)
{
hit.transform.position = startPos[touch[Input.touchCount-1].fingerId];
}
}
}
}
what can i do for drag faster without gameobject will released? sorry for my bad english
|
dce6b29fca3e49e174d3f1c838f0e228562571aff5b814db9faddf1b9a999ead | ['c9f8dfec53d44404900fb876a4cb602e'] | Basically, this person would be obsessed with their appearance. They would look in every reflective surface they could find, and remind themselves of their ugliness; but always searching for a new perspective.
I guess as a narcissist would look in the mirror 110 times a day and think, wow, I'm beautiful, a (insert the word I'm seeking here) would think, you are so hideous.
| 5063dd314c50dbd6964d2e4ad99a83c6586e17f66559203aa41207e8dca6bfad | ['c9f8dfec53d44404900fb876a4cb602e'] | Всем здравствуйте!
Пишу небольшую программку на с# под WinForms и столкнулся с такой проблемой:
У меня есть длинная строка с текстом, которую. мне нужно засунуть в richTextBox так, чтобы она была одна сплошная и прокручивалась горизонтально, но она постоянно переноситься на другую строку, как только полоса прокрутки достигает определенного размера.
Помогите! надо чтобы это было все в одну! линию
То есть это не две строки, а одна, добавленная командой:
TextBox.AppendText("много-много-много текста");
Спасибо.
|
bc396578b3bcfe95e11f5c7d86cf0d577352bfad9d68797be861fac7eedfec13 | ['c9fdf9952d794f069e234d80ff3a4756'] | There is a requirement in my application to evaluate string expressions during runtime in WinRT c# application.
Here are some example expressions:
strObj.Substring(10) + strObj.Substring(strObj.Length - 3)
'001' + strObj.Substring(3) + '003'
Note: Above expressions will be defined in the backend and the application should evaluate at runtime with users input.
I looked at DynamicExpresso, NReco and some other expression evaluators none of those works in WinRT environment. Is there any framework available in WinRT? or how can I achieve it in code?
| 129ad6cd0cd28d0a5abcd8b2c9cb19e6123d8c487f6d42a58bd4af155898c3fd | ['c9fdf9952d794f069e234d80ff3a4756'] | You dont need two connection string. Query you mentioned in ur code snippet need to be run on DB1 db. So your Constr just need to point to DB1 db. Your query will run on DB1 and create a new table Car in DB2 db.
Note: Assumption is that both DB1 and DB2 exists on same server and user you are using have access to create table in DB2 database.
|
d6bf057436b717b4a4279397fe0559d2c9aea9ee7e35de14a9d861ee03137f48 | ['c9fe67c775de4062a4d315ef0a4b4e32'] | I am trying to broadcast a message to two browsers running the same app using Vue-socket.
When the app is created, I hook a listener for new messages to it like so:
mounted: function(){
this.$socket.on('newMessage ', function(data) {
console.log(data)
})
}
When I type a message in one browser, it's sent to the server and received in the event below. I can console.log it.
socket:{
events:{
receivedMsg: function(data){
this.$socket.emit('newMessage', data)
this.$store.dispatch('socket_updateMsg', data)
}
}
}
However, the emit event doesn't seem to trigger the listener yet my app has a VueSocketIO attached to it.
Vue.use(VueSocketIO, 'http://localhost:3001')
new Vue({
router,
store,
render: h => h(App)
}).$mount('#app')
What am I missing?
| 0c31495d1c5f24d9f115c11dfe8392758aeebd3f56153df173f7da42d3923288 | ['c9fe67c775de4062a4d315ef0a4b4e32'] | consider this program:
#include <iostream>
using namespace std;
int main ()
{
int i;
cout << "How many numbers would you like to type? ";
cin >> i;
int * p;
p= new int[i];
cout << "Enter the numbers: \n";
for (int n=0; n<i; n++)
cin >> p[n];
cout << "You have entered: ";
for (int n=0; n<i; n++)
cout << p[n] << ", ";
delete[] p;
return 0;
}
and this one:
#include <iostream>
using namespace std;
int main()
{
int num;
cout << "How many numbers would you like to type? ";
cin >> num;
int arr[num];
cout << "Enter the numbers: \n";
for (int a = 0; a <num; ++a)
cin >>arr[a];
cout << "You have entered: ";
for (int a = 0; a <num; ++a)
cout <<arr[a]<< ", ";
return 0;
}
Both programs are accomplishing the same task and -to me- the latter is a lot
easier to understand than the former. And now my question is why do we need dynamic memory allocation anyway?
|
5167e1e61641273158e282c0ad8797cd1e037235926773b7a4670719c9fcf0bf | ['ca0591d7b0d2420f9e3bc656d564f30f'] | I'm trying to write a JQ filter allowing me to selectively filter object properties based on other of it's values.
For example, given following input
{
"object1": {
"Type": "Type1",
"Properties": {
"Property1": "blablabla",
"Property2": [
{
"Key": "Name",
"Value": "xxx"
},
{
"Key": "Surname",
"Value": "yyy"
}
],
"Property3": "xxx"
}
},
"object2": {
"Type": "Type2",
"Properties": {
"Property1": "blablabla",
"Property2": [
{
"Key": "Name",
"Value": "xxx"
},
{
"Key": "Surname",
"Value": "yyy"
}
],
"Property3": "xxx"
}
}
}
I would like to construct a filter, that based upon the object type, say "Type2", deletes or clears a property of that object, say Property2.
The resulting output would then be:
{
"object1": {
"Type": "Type1",
"Properties": {
"Property1": "blablabla",
"Property2": [
{
"Key": "Name",
"Value": "xxx"
},
{
"Key": "Surname",
"Value": "yyy"
}
],
"Property3": "xxx"
}
},
"object2": {
"Type": "Type2",
"Properties": {
"Property1": "blablabla",
"Property3": "xxx"
}
}
}
Any help greatly appreciated. Thanks in advance.
| 20f43b9cb9b9d35c3cc9a62ccc321b4a2895ac20aed0920741f01f826324554d | ['ca0591d7b0d2420f9e3bc656d564f30f'] | I'm trying to write a JQ-filter for filtering specific resources from an AWS cloudformation template based on resource properties.
For example, when starting from the following (shortened) cloudformation template:
{
"Resources": {
"vpc001": {
"Type": "AWS<IP_ADDRESS><IP_ADDRESS>VPC",
"Properties": {
"CidrBlock": "<IP_ADDRESS>/16",
"InstanceTenancy": "default",
"EnableDnsSupport": "true",
"EnableDnsHostnames": "true"
}
},
"ig001": {
"Type": "AWS<IP_ADDRESS><IP_ADDRESS>InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "ig001"
}
]
}
}
}
}
I would like to construct a jq-filter enabling me to filter out specific resources based on (one or multiple) of their property fields.
For example:
when filtering for Type="AWS<IP_ADDRESS><IP_ADDRESS>InternetGateway" the result should be
{
"Resources": {
"ig001": {
"Type": "AWS<IP_ADDRESS><IP_ADDRESS>InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "ig001"
}
]
}
}
}
}
An added bonus would be to be able to filter on a 'OR'-ed combination of values.
As such a filter for "AWS<IP_ADDRESS><IP_ADDRESS>InternetGateway" OR "AWS<IP_ADDRESS><IP_ADDRESS>VPC" should yield the original document.
Any suggestion or insight would be greatly appreciated.
Tx!
|
491fee457b69c0c340f0e11bed1b719ee26e0ba9044b820b9b657bdcb16114bd | ['ca175142119c468fb66963514765ae6a'] | I'm trying to figure out with Breeze how to expand a specific navigation property for all items in an array of entities with a single request.
On this page of the Breeze documentation it shows the following way of achieving this:
var orderEntityType = selectedOrders[0].entityType;
var navProp = orderEntityType.getNavigationProperty("OrderDetails");
var navQuery = EntityQuery
.fromEntityNavigation(selectedOrders, navProp)
.expand("Product");
manager.executeQuery(navQuery).fail(handleFail);
However, when I tried this I get the error
The 'entity' parameter must be an entity
So I looked up in the documentation specifically for the EntityQuery.fromEntityNavigation method and it shows:
// 'employee' is a previously queried employee
var ordersNavProp = employee.entityType.getProperty("Orders");
var query = EntityQuery.fromEntityNavigation(employee, ordersNavProp);
The documentation indicates that it is for a specific entity, not multiple. Which is consistent with the error I'm getting.
Is it possible to get all the navigation properties in a single request, or is the preferred way to iterate over an array making a request for each entity?
Basically, I'm working on filtering a list of items. My goal is that when a user selects a filter it then expands the needed navigation property at that time instead of loading all the data up front.
Thanks for the help.
| ea512c44ed3acaa885abfdf171bc3e7d8bd785df77f588f6f06b4ebbc5f12edd | ['ca175142119c468fb66963514765ae6a'] | I'm working on a monitoring program for our shipping department that will show orders that are ready to ship. I've been working with SQLDependency to do this and finally got it functioning, however, when I try to add some more specifics to my query, specifically comparing to a datetime column, the OnChange event is repeatedly triggered. When I remove the comparison, it works perfectly.
I've been through Microsoft's documentation, but I don't see anything saying this type of comparison isn't valid.
I've simplified my query down to:
SELECT [SALESLINE].[SHIPPINGDATEREQUESTED]
FROM [dbo].[SALESLINE]
WHERE [SALESLINE].[SHIPPINGDATEREQUESTED] >= '20130614'
Does anyone know what I might be doing wrong or another way to compare against a date?
I can post some of my code, but, as I said, it is working if I don't have a datetime in my WHERE clause.
|
0713231c79bf35bf95a1a0a20ebd66a5a1f4ae0506045a316f5e2aeb08a7fc6c | ['ca218a5c6c5f494ebe27edbd26df5a98'] | <PERSON> Isn't the "between 2 points there must be a line" enough for this? I mean, if I want to connect a and b, assume that the proper line goes through the restricted area, then add another point c, outside, and connect a to b, and b to c, and so on. Is it enough? thx in advance | eb237d289c50dc3c7c45564c35b576b9186ed03b1056dd2f50261b010778f8da | ['ca218a5c6c5f494ebe27edbd26df5a98'] | As the title states, I need to find the functions that aren't measurable, but have a measurable set as a source (because the sigma-algebra on my space A, is P(A) ). I know that every non-zero-measure set has unmeasurable set in it, but how can I describe the functions that their image is those unmeasurable sets?
|
38d601384af4fe8317afb9f042ef2314f9d175827169c97452616e83e14ee886 | ['ca4916e583804d7680e0b11f050179ef'] | Anybody knows which Ubuntu Touch version will be trully convergible?
I purchased a BQ M10 thinking use it to work but there's no VNC or RDP client. There's no File Manager with SSH support and none development tool or IDE.
In this time my Android smartphone seems to be most usable. What's wrong?
Thanks.
| 82246e74626445700913fac925aa7ea240b9c536004c4623bf4029322dd89057 | ['ca4916e583804d7680e0b11f050179ef'] | I have WCF service which launches the remote process from Process.Start successfully on stand alone machine where this WCF service is hosted/deployed and developed.
I deployed this as whole service on another machine, and run the service on that machine as well, execute the service on the same code area which launches the process remotely, here it failed, Strange behavior.
I checked the process state stand alone , and launched the process normally, it executed fine and shown the message box inside that process which was written there. BUT when this process launched via WCF call from code, process didn't launched in interactive manner, Task Manager shown the launched process, but its console not shown, nor any message box shown . ANY IDEA ? or WAY AROUND?
Note : This behavior is observed when WCF service deployed completely with all binaries on another machine
Regards
<PERSON>
|
87f01501d0739e551ffd3594970af10cc9bd9eb5687f1a8a1cad8b3a002ab90a | ['ca52bdc40ea145bfa44ec1843eb08218'] | You might consider increasing the reaction time of your human test subjects. Animals like flies, crayfish, and squid all have significantly faster reaction times than we currently do (see https://www.quora.com/How-do-the-reaction-times-of-various-animals-compare-with-that-of-humans)
This has two advantages that I can think of right now:
They can take evasive action before a flashbang goes off (start to turn their head away, or cover their ears, or duck behind an object).
They will have better reflexes in a gun fight in general, especially vs non-enhanced troops.
| 2f4ef22e9477962a96197373af4399fa8fe4018e5467a335acffb30bcc36a36a | ['ca52bdc40ea145bfa44ec1843eb08218'] | I would definitely make sure you have enough bypass capacitance on the power line of your IC. You may have it already but I don't see it drawn in there. Any cap in the low uF range will do (preferably two or more with different values but probably don't need to go haywire for this).
|
07df4532181f8745481075c1bea8ccc4039d11f545983f7be7e70a697182fc85 | ['ca5c1e6e66b34bb2940885f7d20b28ca'] | You could create an object that encapsulates your number and the function?
so:
var groupA = [{
number: 5,
action: function() {
alert('awesome action');
}
}];
then you could loop over the objects and look for the number,
for(i=0; i<groupA.length; i++) {
if(groupA[i].number == $("#userInput").val())
groupA[i].action(); // call the funciton
}
| ca584d7a2a51b1ba8fbf2a2ac35660bdf264861e0916577105060cc4a2874a11 | ['ca5c1e6e66b34bb2940885f7d20b28ca'] | The problem is you are inserting a new row each time.
You need to explore the Sql UPDATE statement. Basically what you need to do is insert a new row on login and retrieve a unique identifier for that specific row. When the user logs out you need to update that same row using the identifier and set the logout time accordingly.
Hope this points you in the right direction
|
3234f93cd0d9a59378f2e3278a9ebaaf32ad8b88540a866b2eea1bc5f3475ab9 | ['ca6329bd89cc4cd0881480603fb6b778'] | I,m trying to make a responsive website using bootstrap3 that is 3-column in large screens and 2-column in medium:
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-4" id="sidebar1"></div>
<div class="col-lg-6 col-md-8" id="main"></div>
<div class="col-lg-3 col-md-4" id="sidebar2"></div>
</div>
</div>
http://www.bootply.com/yfJF1flD0V
but this code not working properly and on medium size, sidebar2 goes in a new row and i want sidebar2 goes below sidebar1 directly. how can i do that?
| 0761528053e4abf34dac4e406053b5b2a33c7950bf10e3a770b4fe68e676c993 | ['ca6329bd89cc4cd0881480603fb6b778'] | I do it with jQuery.
<div class="container">
<div class="row">
<div class="col-lg-3 col-md-4" id="sidebar1"></div>
<div class="col-lg-6 col-md-8" id="main"></div>
<div class="col-lg-3 col-md-4" id="sidebar2"></div>
</div>
</div>
and jQuery:
function mediumResponsive() {
// Reset everything
$( '#main>div' ).removeClass('col-md-8');
$("#sidebar1").next().andSelf().unwrap();
$( "#sidebar2" ).insertAfter( $( "#main" ) );
if ($('#is-md').is(":visible")) {
// Do medium responsive
$( "#sidebar2" ).insertAfter( $( "#sidbar1" ) );
$("#sidebar1").next().andSelf().wrapAll('<div class="col-md-4"><div class="container-fluid"');
$( '#main>div' ).addClass('col-md-8');
};
};
$(document).ready(mediumResponsive);
$(window).bind( "resize", mediumResponsive );
and it works.
Please tell me your comments.
|
267243b9a301d2261e203795edf195e5b45ff42c5b9e8ccf2ecc4bd266dbceb4 | ['ca6be7354d124c55a3c2b54294b77d1c'] | Im using ajax to send data to a php file which executes a query to a database and returns a string.
When im going to print that string in some html object or an alert(), it prints with two line breaks before the string.
Please help me to find why this happens.
Here is the code im using for ajax
$.ajax({
data: parameters,
url: "components/file.php",
type: "POST",
success: function(response){
$('#Obs').text(response)
}
});
When i look the textarea with the id:Obs there is the response with two line breaks before it.
and this is the php file
$cod=$_POST['id'];
$name=$_POST['name'];
$obs=$_POST['obs'];
$pg= pg_query("SELECT set_session('USER_ID', '".$usr."')");
$cadena="UPDATE elemento_consolidado SET nombre = '$name', observaciones ='$obs' WHERE id_elemento = '$cod'";
$string = new sql_pg($cadena,$conn);
$action=$string->query();
$succes=$query->verify($action);
echo $succes;
This code works fine, but the only issue is the two line breaks when i print the response of this php file.
If someone can help thank you!
Greetings!
Sorry if my english is rustic.
| 1301df510fe2594df0c011907356edf4d2dae93ce860569830ef1110c8aa90bc | ['ca6be7354d124c55a3c2b54294b77d1c'] | The Ocean controlls are under the library Slb.Ocean.Petrel and Slb.Ocean.Petrel.UI.Controls
In visual Studio you have to clic in the Tools menu, and select the Choose toolbox items.
In the show up window, click in Browse and look for the libbraries in the Petrel/Public folder and the controls will add in the General tab at the toolbox.
Hope it will help!
|
559bebc28891106c1590249a6fdf8e43837bffc538a0b595edfc6697cceaccbb | ['ca776bafcbba45e0b87de8175de07c80'] | I am trying to connect an excel file to my C# code. However, the code throws an exception: "'ServerVersion' threw an exception of type 'System.InvalidOperationException'"? What could I do to fix it?
OleDbConnection con = new OleDbConnection();
con.ConnectionString= "Provider=Microsoft.ACE.OLEDB.12.0;DataSource='D:/.Net devlop/ADO_QuickKart Application_14Nov16_1807/QuikkartDB.xlsx';Extended Properties='Excel 12.0 Xml;HDR=YES'";
| 258a446c2732e9ebef517b2dd4ccd051009a74e285606082c0f059e308da37a1 | ['ca776bafcbba45e0b87de8175de07c80'] | I have been developing a tool in which data is copied from the input excel file to another excel file at different column location. Currently, I am using sheets.Range function to copy the data from individual column to another by using a loop for the numbers of rows present(Since there is also some data manipulation). Since the input file is too large, it is taking too much time. How can I optimize it?
Note: I cannot skip the loops
Also, I tried parallel programming concept but since the output data entry is dependent on previous row, it cannot be done.
Some colleague suggested me to convert excel into csv file and then manipulate the data. But, I am not sure if this would help. If yes, how can we do it?
|
f5eeabb5af4836acb968cdb7668dcc87e246e638df2ce9ffd6d9c49f508ded6e | ['ca8aad9a1d1c44eca4cd5f9b96b5b6f7'] | I had a similar problem and here is my solution:
<p:panelGrid style="width:100%"> # notice that I do not define columns attribute in p:panelGrid!!
<f:facet name="header"> # header
<p:row> # p:row and p:column are obligatory to use since we do not define columns attribute!
<p:column colspan="2"> # here I use colspan=2, coz I have 2 columns in the body
Title
</p:column>
</p:row>
</f:facet>
<p:row>
<p:column style="width:150px"> # define width of a column
Column 1 content
</p:column>
<p:column> # column 2 will fill the rest of the space
Column 2 content
</p:column>
</p:row>
<f:facet name="footer"> # similar as header
<p:row>
<p:column colspan="2">
Footer content
</p:column>
</p:row>
</f:facet>
</p:panelGrid>
So as you can see, the main difference is that you do not define columns attribute in p:panelGrid. In header and footer you have to use p:row and p:column, and in my case I also have to use colspan=2 since in body we have 2 columns.
Hope this helps ;)
| 813705a64074970bf9357f77c24a682cec9be3994cba57095c49bcad84928848 | ['ca8aad9a1d1c44eca4cd5f9b96b5b6f7'] | Where is the part of the code in which you update the component? Maybe you could try the following - update the component programmatically inside the method *cmdCreateNew_Click()* like this:
public void cmdCreateNew_Click() {
setTarget(_RULE_DETAILS);
//add this line and check the path to the component
RequestContext.getCurrentInstance().update("templateForm:content:tabView");
}
|
9ab58eb38c83df029f247736ad95b40c99dac281f8c045a05f0ff22f1be9bf4e | ['ca9e4a6ce267457c9d4eb9d2416886d5'] | Hi I am looking for some expert advice on how to break my class up.
Please bear with me this is the 5th week on c# im still fresh.
The task I got is to create a basic database and interface for a fiction company.
The interface shall support basic administration of members of the company.
The only rule is that there should be a split of at least 2 classes.
Now to my problem:
- I use 8 members for the class in the constructor head? is there a better approach to do this?
- Social nb in sweden is a date should I create a date class?.
- If I create a get and set method for every member it will be a long document is there a best practice?.
using System;
class Person
{
private string firstname, lastname, socialnb;
private string email, phone;
private string streetaddress, postcode, city;
public Person(string firstname, string lastname, string socialnb, string, email, string phone, string streetaddress, string postcode, string city)
{
this.firstname = firstname;
this.lastname = lastname;
this.socialnb = socialnb;
this.email = email;
this.phone = phone;
this.streetaddress = streetaddress;
this.postcode = postcode;
this.city = city;
}
public String ToString() // Incomplete
{
return "\n\t"; // Will include all fields in the class
}
}
| d90ccbfe6219217170ab48b03b350daf22f9e38cb926b47b785063cfeb225de5 | ['ca9e4a6ce267457c9d4eb9d2416886d5'] | I am in no way an expert but I would use isEqualToArray inside NSarray class.
The function inside the class compares the receiving array to another array.
SWIFT
func isEqualToArray(_ otherArray: [AnyObject]) -> Bool
Return Values
YES if the contents of otherArray are equal to the contents of the receiving array, otherwise NO
|
4a48a5cff203306fea91b6548ff4ac4f464ab0b43c2a75832704a6590af57221 | ['caaa1861a7404650ace0905d458f30b1'] | I've been having a similar issue in Safari 12+, as I was also using padding to force aspect ratios in a grid based layout. I'm not sure if this is exact same problem you were having, but the fix below works for me on your pen in Safari.
TLDR: Put display:grid on the div surrounding your grid container. Here it is in action: https://codepen.io/harrison-rood/pen/rNxXWPb
After tearing my hair out for hours on this, I decided to try placing display:grid on the wrapper around my main grid, and it worked perfectly! I have no idea why this would fix it, but my guess would be that it gives Safari some more context on the parent container and that allows height:100% to refer to the grid context instead of the parent, similar to how Chrome and Firefox handle this by default. This was so frustrating to me that I felt obligated to create a SO account just so I could post this! Hope it helps!
| c7c4229dcd9838c283e3722b51952f01686b6859689d57687a8bc040aa74f1a8 | ['caaa1861a7404650ace0905d458f30b1'] | As someone else has commented, the way to do this would be to use transform:scale(2) on &:hover - adjusting the number as necessary. This should avoid any layout shift, and it will be more performant than animating the width as you are currently doing.
See this article: https://pqina.nl/blog/animating-width-and-height-without-the-squish-effect/
|
d32d20fe029c37ae2fd5d1c7e8f9a8e50d7d6b9aebbee6bb10ac1427001228cf | ['cae08099c0f64b9db864bc32a4d538a1'] | Looking at your previous question as linked:
Did you ensure to register for location updates like so?
LocationServices.FusedLocationApi.requestLocationUpdates(
mGoogleApiClient, mLocationRequest, this);
If not, your code is likely receiving the last known location once, then not requesting any more updates. Take a look at the code snippets here: http://developer.android.com/training/location/receive-location-updates.html
If you do have the aforementioned code, then ensure your Location settings are set to High Accuracy on your device and you have the appropriate Manifest permissions (coarse and fine accuracy), then post your code here.
Both Location APIs can be finnicky but they are definitely not bugged to the extent you've described. I have tried both in an application I'm creating and have been consistently able to get accurate results.
| 47569337051e91e2779e5dd2c2f3071d5f8a4b6393888fac28858a1412b66348 | ['cae08099c0f64b9db864bc32a4d538a1'] | A cleaner implementation with more thorough explanations can be found in the android documentation here:
http://developer.android.com/training/implementing-navigation/nav-drawer.html
That said, it looks like you already have some clickable list items, all you need to do now is start the new activity within your ItemClickListener. You can make each item do a different thing by referencing the 'position' parameter:
list_view.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
MainActivity.obj.closeDrawer();
Toast.makeText(getActivity(),"Hi "+position,Toast.LENGTH_SHORT).show();
// Start 'YourActivity' when first item is clicked
if(position == 0){
Intent = new Intent(getActivity(), YourActivity.class);
getActivity().startActivity(intent)
}
}
});
I think it is important that you learn some more basic things, such as how to create new Activities and start them before getting too tied up with specific things like Navigation Drawers.
|
61a29da25f3955a3c5e1a9c25b0493b9ce2209c3b150049e3eaf6992e21b29c5 | ['cae8ba7d7d0945d98087445f540fec7c'] | There is an easy fix for this error as per my experience
If you installed metasploit-framework correctly the following workaround WILL work
navigate to the metasploit-framework directory usually, cd ~/metasploit-framework should do the job
Run the same command using 'ruby' i.e. ruby msfvenom -p android/meterpreter/reverse_tcp LHOST=myip LPORT=port -o hack.apk
This shall fix the error you mentioned but note that you might have installation errors in metasploit-framework as I have had too
| 692904ddad0982c9ea31952becf4ee3fce7a07786a38ca17180919c1b30cea0e | ['cae8ba7d7d0945d98087445f540fec7c'] | Unlike regular Linux Distributions, Termux does not keep a history of the version updates hence installing Python 3.6 is a difficult task, but it's not impossible, you'll have to build and install python from its source code. Which you can find (for version 3.6.10) here : https://www.python.org/downloads/release/python-3610/
And if you need help with installation, I'd ask you to follow the guide here without the sudo commands. (https://docs.rstudio.com/resources/install-python-source/)
|
e6950d56e23614e825f634aca7fd0839cd54c7e7424feab58e5b77e5efced61d | ['caeb01f40bcb4d69940bd68765018543'] | I'm learning java and for a particular application I am creating, I am initializing a 2D array of objects. The particular object that would occupy the array when initialized changes multiple variables in its no args constructor. I am wondering if when the array is declared java initializes each variable in all elements of the array:
private Piece positions[][]=new Piece[8][8];
Or is it necessary to do this?
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
Positions[i][j]=new Piece();
Thanks for your help!
| c7bb9020b8f0be733d28cff2a9dae8c2f78998e1efef59daec85e42a01280782 | ['caeb01f40bcb4d69940bd68765018543'] | As stated in title I am having trouble proving this. I have been trying to use a proof by contradiction where I assume A^2-B^2 is even and A - B is odd and show how that is untrue. Unfortunately I can't seem to figure this out.
I have tried setting the even expression equal to 2x (implying even) and the odd to 2y+1 and solving. Unfortunately I got stuck with this.
Any solution using any method would be appreciated!
|
e3a9654ababfd600fbc01f7115259ec6169e59b4a6d486b211ea6a9fc513a09d | ['cb02cf0beed040e7af3f1b288c1c618a'] | I need to create a tab like below.
Using the code as follows i am getting some what near.
<TabControl Margin="-2,0,0,0" Background="#37e8f9" BorderBrush="Red" BorderThickness="0" TabStripPlacement="Left" HorizontalAlignment="Left" Width="261" >
<TabControl.Resources>
<Style TargetType="TabItem">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TabItem">
<Grid VerticalAlignment="Center" HorizontalAlignment="Center">
<Border Name="Border" BorderThickness="1" BorderBrush="Transparent" CornerRadius="5,0,0,5" Margin="10,0,-1,0" >
<ContentPresenter x:Name="ContentSite"
VerticalAlignment="Center"
HorizontalAlignment="Center"
ContentSource="Header" Width="100" TextBlock.TextAlignment="Center" TextBlock.LineHeight="100" TextBlock.LineStackingStrategy="BlockLineHeight" MaxHeight="100"
/>
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Foreground" Value="#805e00" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="12,10"/>
<Setter TargetName="Border" Property="Background" Value="#37e8f9" />
</Trigger>
<Trigger Property="IsSelected" Value="False">
<Setter Property="Foreground" Value="Red" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Padding" Value="12,10"/>
<Setter Property="Background" Value="Red" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsSelected" Value="False" />
</MultiTrigger.Conditions>
<Setter TargetName="Border" Property="BorderBrush" Value="White" />
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</TabControl.Resources>
<TabItem Header="Tab 1" />
<TabItem Header="Tab 2" />
<TabItem Header="Tab 3" />
And the output is as follows.
Now if i add image the tab header area becomes un clickable over the image and throughout the header; except for the header text which is clickable. How do I make the entire header area clickable with image and text inside it?
Thanks in advance.
| 0f098c0c4c58ca39904781118c485379dffe87cb948264e4bbcc1856b7b98160 | ['cb02cf0beed040e7af3f1b288c1c618a'] | Below is the code for the panResponder in componentWillMount() method.
this.panResponder = PanResponder.create({
onStartShouldSetPanResponder: (e, gesture) => true,
onPanResponderGrant: (evt, gestureState) => {
this.state.pan.setOffset(this.state.pan.__getValue());
this.state.pan.setValue({ x: 0, y: 0 });
Animated.spring(this.state.pan, {toValue: {x:100, y:100}}).start();
}
});
How can I call onPanResponderGrant method from a different method?
someMethod = () => {
// call the pan responder function here
// this.panResponder.onPanResponderGrant();
}
|
543164455db70b29da27a4082662fc1f574825058ad97fce557aef9c230acede | ['cb0d4714f92b4568b435556bf4774245'] | I have a table with the following rows:
and I am trying to do a weighted average by Product and ReceiptYearMonth of CaseQuantity
I have created the following DAX measure to try to create the weighted average:
SumX Test = sumx(Query1,
Query1[CaseQuantity] /
calculate(
sum(Query1[CaseQuantity]), ALL(Query1[RecadvLineId])
)
)
but that just returns the following:
i.e. the measure returns 4.00 for 201702 because there are 4 rows in the table for 201702. It returns 2.00 for 201703 because there are 2 rows for it. At this stage I think they should be returning 1.00 for each YearMonth.
Can anyone explain what I am doing wrong here ?
| 3392b8b8add86a1581bce1c81a70ef2b699153072d231bf39706cb91bd7800dc | ['cb0d4714f92b4568b435556bf4774245'] | You could try using the OFFSET x ROWS FETCH NEXT y ROWS ONLY commands like this:
CREATE TABLE TempTable (
TempID INT IDENTITY(1,1) NOT NULL,
SomeDescription VARCHAR(255) NOT NULL,
PRIMARY KEY(TempID))
INSERT INTO TempTable (SomeDescription)
VALUES ('Description 1'),
('Description 2'),
('Description 3'),
('Description 4'),
('Description 5'),
('Description 6'),
('Description 7'),
('Description 8'),
('Description 9'),
('Description 10')
SELECT * FROM TempTable ORDER BY TempID OFFSET 3 ROWS FETCH NEXT 2 ROWS ONLY;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.