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 |
|---|---|---|---|---|---|
8e7f0adbae0e940f7142f302f0583f27287a2da1628ff93a53a5dbc9450d2fb7 | ['95397e15a8c34720b06ff9bb75d9d3e4'] | I made a clock in java that shows the current time. I would make sure that the clock both updated at intervals of one minute, thus updating the result in the console.
I read to use threads, but I'm not very knowledgeable on the subject, who would help me to make it happen?
import java.util.*;
public class Current
{
public static void main(String[] args)
{
Calendar calendar = new GregorianCalendar();
String hour;
int time = calendar.get(Calendar.HOUR);
int m = calendar.get(Calendar.MINUTE);
int sec = calendar.get(Calendar.SECOND);
if(calendar.get(Calendar.AM_PM) == 0)
hour = "A.M.";
else
hour = "P.M.";
System.out.println(time + ":" + m + ":" + sec + " " + hour);
}
}
class Data
{
public static void main(String[] args)
{
Calendar cal = new GregorianCalendar();
int day = cal.get(Calendar.DAY_OF_MONTH);
int month = cal.get(Calendar.MONTH);
int year = cal.get(Calendar.YEAR);
System.out.println(day + "-" + (month + 1) + "-" + year);
}
}
| 20ea6b95d64c654b2b45a588c3ef037c5d087d094bc1f39dc74cf248befb7bc5 | ['95397e15a8c34720b06ff9bb75d9d3e4'] | <html>
<head>
<title> Regioni </title>
</head>
<body>
<label>Selezione una regione</label>
<select name="regioni" id = "reg" name = "reg">
<option value="Abruzzo"> Abruzzo </option>
<option value="Basilicata"> Basilicata </option><onClick="Basilicata(regione)">
<option value="Calabria"> Calabria </option>
<option value="Campania"> Campania </option>
<option value="Emilia-Romagna"> Emilia-Romagna </option>
<option value="Friuli-Venezia Giulia"> Friuli-Venezia Giulia </option>
<option value="Lazio" id ="lazio" onclick="Ch"> <PERSON> </option>
</select>
<br>
<label>Province</label>
<select style="width:200" id="opt" name ="province">Province</select>
<script>
function Ch()
{
var ddl = document.getElementById("reg");
var selectedValue = ddl.options[ddl.selectedIndex].value;
if(selectedValue == "<PERSON>")
{
var select = document.getElementById("opt");
select.options[select.options.length] = new Option('Roma', 'Viterbo');
}
else
{
alert('seleziona una provincia!');
}
}
</script>
</body>
</html>
If I click lazio, I would like that in the second select box appear the provinces of the region Lazio.
You can do this?
I tried but apparently does not work.
|
44ffdce45e516e6e9abc03ff37c6006b3823c810845ab753face31bb05a727fb | ['95400b65c89a4c9689709c6bd3fa2d41'] | So I have to convert the following grammar to CNF. However in order for me to do so, I know I will have to first:
i) eliminate the recursive start symbol
ii) eliminate null-rules to construct an essentially non-contracting
grammar
iii) eliminate unit rules
S -> SS
S -> aSb
S -> 1
But I am so lost and this is my first time working with coversions to CNF. I know the basic principals on converting the grammar, but whats getting me confused is the above transformations that I have to do first. Can someone please show me how i would do this.
| b25c10b6f80ffca422ed84a249e167c72315571f39c60abf0c115440c079bd8f | ['95400b65c89a4c9689709c6bd3fa2d41'] | Let say we have the following grammar G:
S -> bA
-> aB
-> 1
A -> aA
-> bB
B -> bA
-> aB
-> 1
How would i go about solving the corresponding semiring equations to derive a rational expression for L( G). I would have to start by solving for B.
SO what i have done so far is:
S = bA + aB + 1
A = aA + bB
B = bA + aB + 1
B = b*(aA +1)
A = aA + bb*(aA+1)
= aA + bb*aA + bb*
= (a+bb*a)A + bb*
= (a+bb*a)*bb*
S = b(a+bb*a)*bb* + aB + 1
But from there I am not sure what to do, or even if I did the entire thing right. Also, how would I describe L(G)?
|
c05e3e113d5d202d50eab3e7278520b262db5cea1d24d72dda372d742fb7b11e | ['954942b799e34d53b4dc033c0be42071'] | Native event support for firefox webdriver tend to be for a few specific versions of the browsers for each release of selenium. I suspect your versions of selenium doesn't support native events in firefox 28.
The changelog for V2.42 doesn't say what version of firefox they support for native events but apparently V28 of firefox was supported in V2.41. You could always try downgrading to that version of selenium or try firefox 33 on selenium V2.46 which looks like the latest version of firefox that has native event support.
https://github.com/SeleniumHQ/selenium/blob/master/java/CHANGELOG
There is also the option of going for synthetic events over native events.
| 6c59ca679f4041f747d07d791d0ccdfc2e1375725d45d5c022ffd31eaded5827 | ['954942b799e34d53b4dc033c0be42071'] | Any time you are passing a value into an xpath query you will have to handle any apostrophe in that value. The actual xpath query you are trying to run is;
//div[contains(.,'This page can't be displayed')]
You'd think you would be able to escape it but others and I have had problems doing that in the past.
http://www.seleniumtests.com/2010/08/xpath-and-single-quotes.html
Using concat works for me and the person in the above link.I'd expect the following xpath to work.
String expectedText = "concat('This page can','\"'\"','t be displayed')";
String waitforXpath = "//div[contains(.,'"+expectedText+"')]";
In general I tend to pass any values i'm inserting into xpath through a method that will turn it into an xpath ready concat string. This is c#.
private string prepareForXpath(string text)
{
if (!text.Contains("'"))
{
return "'" + text + "'";
}
StringBuilder finalString = new StringBuilder();
finalString.Append("concat('");
finalString.Append(text.Replace("'", "',\"'\",'"));
finalString.Append("')");
return finalString.ToString();
}
This can all be quite messy and it's why xpath locators can be a pain. I'd prefer the method suggested by <PERSON>. The fact that approach isn't working probably deserves more investigation.
|
bf9a44cf8bde514dc14a360569555e04f0dc9cab97cdba4dfa45cc3b04297be3 | ['95521ba8554748d1a7ef06ffb55b1f63'] | tnx on answer i know something about iptables and firewall but not good with networks and routing, do you maybe know what can i do/type to make this router work?
I have tryed something like this (test home lan) but cant ping all ips:
route add -net <IP_ADDRESS> netmask <IP_ADDRESS> gw <IP_ADDRESS>
route add -net <IP_ADDRESS> netmask <IP_ADDRESS> gw <IP_ADDRESS><PHONE_NUMBER> gw 192.168.1.1
route add -net 192.168.1.1 netmask <PHONE_NUMBER> gw 172.17.17.1 | 862eed8ffac9a06f22ae99cb8658e0480db0be76d943bb27c349c79fb529c36d | ['95521ba8554748d1a7ef06ffb55b1f63'] | Hooray for mentioning <PERSON>; he has a draft text on undergraduate analysis that (if I recall correctly) makes use of Bolzano-Weierstrass and Interval Bisection but 'not too much else'. His stuff is written in a light-hearted style, with humorous footnotes and so on. If it's good enough for the students at Cambridge, then it must be worth a look.
Also, have a look at Prof <PERSON>' blog and perhaps say hello. The more you interact with other learners, the more relaxed and informed you will be about discussing your studies- a good thing if you are going to interview to get onto a degree course at some point. Do you have a university near you? If so, what are the rules about visiting their maths faculty library?
See if you can arrange to have reference rights there. in the UK, all you need is a local library card, and most university libraries will let you have a browse whenever you like.
You might feel a bit awkward at your age but I say take the plunge and go for it. Today's awkward kid (why is he here?) is tomorrow's undergrad with a place on the course.
On a similarly confident note, have you heard of an examination called STEP? Google the word. STEP is administered by Cambridge University and extends on the current UK pre-university mathematics requirements. You could download some past papers and have a go.
If it's all too easy for you, I've just spoken to the next <PERSON>. Meanwhile, most people
who enter for the STEP exam want to get into Cambridge to study maths and find the papers pretty difficult but a challenge worth taking on, given the rewards on offer. Perhaps you are at that age where, with a bit of luck here and there, you could make a real go of that.
At the very least, if you download the past papers and keep a record of your work, you will have something interesting to show tutors when you apply for university.
To conclude, good luck and when you eventually get your office at the Institute of Advanced Study, tell them I sent you. Nobody will know what the heck you're on about, or who I am, but they'll laugh anyways because, hey, there goes that kid who proved that thing ! :)
|
0c9017a240434187aa90dffe26a7cb40784d4c9efd09539247f861d5ec252192 | ['956970cfbe8c45ff8af36d0bb65d0aea'] | im trying to write windows 7s calculator but i have problems just in multiply and divide. here im writing the codes that are connected to multiply so you can get the reason.
double input1;
double input2;
double result;
string <PERSON>;
<PERSON> means + or - or * or /
private void button14_Click(object sender, EventArgs e)
{
input1 = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
amalgar = "*";
}
it was for * button.
this is for negativation button :
private void button20_Click(object sender, EventArgs e)
{
input1 = Convert.ToDouble(textBox1.Text);
input1 = input1 * (-1);
textBox1.Text = input1.ToString();
}
and this is for equal button:
input2 = Convert.ToDouble(textBox1.Text);
if (amalgar == "*")
{
result = (input1 * input2);
textBox1.Text = Convert.ToString(result);
}
here is some examples for results:
2*6=12 Right
2*(-2)=4 Wrong
(-2)*2=-4 R
4*(-5)=25 W
8*(-7)=49 W
3*(-6)=36 W
8/2=4 R
8/(-2)=1 W
8/(-3)=1 W
| bdcfd2b27285cbc7f4a44b543e4c5f910c171cc4d171cf669e93ebb6df4a90b6 | ['956970cfbe8c45ff8af36d0bb65d0aea'] | i have solved it .it was an easy mistake.
the problem was in negativation button with i tried to multiply input1 by -1.
i have changed the code to :
input3 = Convert.ToDouble(textBox1.Text);
qarine = input3 * (-1);
textBox1.Text = qarine.ToString();
in that button and some clauses in equal button :
else if (amalgar == "*")
{
if (input1 > 0 && input2 > 0)
{
result = (input1 * input2);
}
else if (input1 < 0 && input2 < 0)
{
result = (input1 * input2);
}
else if (input1 < 0 && input2 > 0)
{
result = (qarine * input2);
}
else if (input1 > 0 && input2 < 0)
{
result = (input1 * qarine);
}
textBox1.Text = Convert.ToString(result);
}
|
35f63db3b822abeda26007df24c267544362a0d02e999cf2ce6fb5b8425689ac | ['956b9fa981b9436ca43eb002938a9f05'] | I've recently erased all node_modules and did a fresh npm install. And keep getting this error:
ERROR in Error: Child compilation failed:
Cannot find module 'handlebars'
- compiler.js:76
[wallet-admin]/[html-webpack-plugin]/lib/compiler.js:76:16
- Compiler.js:214 Compiler.<anonymous>
[wallet-admin]/[webpack]/lib/Compiler.js:214:10
- Compiler.js:403
[wallet-admin]/[webpack]/lib/Compiler.js:403:12
- Tapable.js:67 Compiler.next
[wallet-admin]/[tapable]/lib/Tapable.js:67:11
- CachePlugin.js:40 Compiler.<anonymous>
[wallet-admin]/[webpack]/lib/CachePlugin.js:40:4
- Tapable.js:71 Compiler.applyPluginsAsync
[wallet-admin]/[tapable]/lib/Tapable.js:71:13
- Compiler.js:400 Compiler.<anonymous>
[wallet-admin]/[webpack]/lib/Compiler.js:400:9
Child html-webpack-plugin for "index.html":
ERROR in Cannot find module 'handlebars'
Not sure what is going on...I've tried changing all versions of:
html-webpack-plugin, webpack, handlebars-loader thinking it is a versioning issue. It doesn't seem to be. Any ideas?
| ba48e2aa51316ccd5d9e607c8dde822c353040799b4e6604d93117b4ded21a6c | ['956b9fa981b9436ca43eb002938a9f05'] | In addition to <PERSON>'s explanation, you would want to use the didInsertElement hook instead of the init hook to only re-render after the view is created. So it would look more like:
App.FooView = Ember.View.extend({
didInsertElement: function() {
this.rerender();
}
});
Although, I'm not exactly sure why you'd need to rerender after the view has already rendered.
|
76af9d4bda2ccce16f41ba05614e9bdeb33f3ed65e2c1ae6d211a0783efe3d20 | ['9575fb713e8147269eaf0a234263cd1e'] | I run a small business with a Prestashop e-commerce website that sends customers to Sagepay to make a payment using the Presto Chango Sagepay payment module.
In my office I also have a one PC connected to the DMZ interface of our pfsense edge/outer firewall. Nothing else is connected to the DMZ network and all ports out are controlled with nothing being allowed in. This single PC runs Linux and is used to access the Sagepay virtual terminal via a web browser; to manually enter card payment details that are take over the telephone. Very occasionally, we also use the virtual terminal to enter card details given to us in person by a card holder.
In total we probably do not more that £150,000 of card payment transactions per year.
So far I have been using SAQ-C-VT, but I have never been sure that this is the correct form to use.
It is difficult for a small business to get good non-conflicting information on PCI DSS. Therefore, does anyone have a view on the correct SAQ form that we should be using?
| 92d0a59778c08381ea3569ab3cd96e91d337453ea6b3ee4a19535adf853f7bfd | ['9575fb713e8147269eaf0a234263cd1e'] | <PERSON> - The legal "small print" on the terms and conditions page unfortunately disagrees with the individual you spoke to on the phone. And when it comes to legalese, especially when the same T&C page lists recourses and talks about audits, I'd rather err on the side of the written legal terms and not a he-said-she-said situation over the phone. Also your being able to check out just means that they are assuming that you're a staff member of the K-12 schools, which is fully allowed to purchase per the terms. |
020cd62354e96b6a1eb5afb68a150daf7768b26187cc6afd071b5de335cd598f | ['958e201e8a4c49258970151cc0802ed2'] | I tried to find the answer to my question in several other threads, but i couldn´t find one fitting.
I have a light barrier consisting of 2 photo-transistors. I want to detect the peaks of these barriers with the android headphone jack. I need to know the time between these.
I´ve got a amplifier cicuit for it already, so the peaks are pretty steep now.
My approach is to use the AudioRecord class, scan through the buffer, find the rising edge, start a timer and stop it after the second peak.
That´s kinda working already, but only for times around 100ms.
What I need is to measure precisely in the 1-10ms region. The peak is maybe around 0.1ms wide.
I call the peak detect funktion every 0.01ms, but i noticed, that it hast around 3000 values in its buffer to scan through this. I think that it takes too long to scan through these.
Am I stuck on the wrong approach? Is there a more easy way to do this? It just hast to be fast ;-).
Thank You in Advance!
| d2eab044ddd762e91cdff48f0e2a14bef9379bf3724aa172dad26949dea2c4d8 | ['958e201e8a4c49258970151cc0802ed2'] | Fortunately I solved the problem on my own:
The C.H.I.P. from NextThing has a 3.5mm TRRS jack, which does not only output stereo audio but component video as well.
Now if you plug in a standard 3.5mm jack, the ground pin does does interfere with the component video connector.
Thats why there was this humming noise on the audio output. And thats why it disappeared exactly after 10mins, because the screen idle time is 10min, I think.
So I have to admit, that it was indeed not a programming question as it was a connection issue. Thanks anyway for the quick answer!
|
e2d14cdc19032462d589384d7f964d49b2bf027af277dac9cf8589ddf63c46cf | ['95936cd462a548e494ede25b1513965b'] | I've been asked to do some updates on an Access 2007 VBA application. My experience is mostly with Excel VBA, not much with Access.
In one place, we're adding some additional fields. One of the tables is exported to an Excel workbook like this:
DoCmd.TransferText acExportDelim, "(text file specification)", "(source table name)", (path to CSV file to be created), True
After adding the new fields to the source table, I get the error:
"The INSERT INTO statement contains the following unknown field name: '(field name)'. Make sure you have typed the name correctly, and try the operation again."
After reading what I could find on this, I understand that the problem is that the "text file specification" does not have the new fields. And further, that I can't edit the text file specification but instead must create a new one.
Okay, I can do that. But how do I know everything the previous text file specification was doing? I can see the result, but that doesn't necessarily tell me everything it did.
Is it possible to see, even if read only, that text file specification? If I go (in Access 2007) to External Data tab > Export section > Saved Exports, and go to the Saved Exports tab, I see a single item there that may be the one, though it doesn't seem to have the same name there as what I see in the DoCmd.TransferText line. However I don't see any way of viewing what it does; just a name for it, a description (which is blank), and a path (which is not currently valid).
Is there a better way than playing guessing games about what the old text file specification does?
Any suggestions?
Thanks,
<PERSON>
| 7d54176ae573b569b9a82f21e7bd1d16e7e0961941fde3222c632486ce1447d5 | ['95936cd462a548e494ede25b1513965b'] | I've been asked to do some maintenance on an Access 2007 VBA database.
It has linked tables to another Access database in the same folder. It had hard-coded links to that database, so if the user copied the folder to a new folder, it tried to use the linked database in the original folder. They asked me to eliminate the danger of using the wrong linked database in that scenario.
I added code that runs when the database is opened, to make it reset the links to the database in it's own folder. If the linked database isn't there or was renamed, the user is prompted to browse to the correct database. So far so good.
But if the user cancels that dialog, I don't want to leave it connected to the wrong database. I want to set the linked tabledef's Connect property to the "correct" path even though the table is not there. Then the user will get an error that the linked table isn't there until they copy in the linked database -- rather than inadvertently use the wrong database.
When I use Resume Next to get past the error that is raised when I set the Connect property to a nonexistent database, the change doesn't stick, leaving it connected to the wrong database. So for now, I'm closing the database when that happens (after alerting the user that the linked database can't be found). That's safe in terms of not using the wrong database, but I don't think it's the ideal user experience.
So -- is it possible to set the Tabledef's Connect property to a nonexistent database?
Thanks,
<PERSON>
|
7d3866fc88404e642e687c1abaef7256a5488f405b40e6f011a89698ae71d8de | ['959a3db7d03a4178b457db0f3d04c50c'] | I'm trying to send text to WeChat for sharing and it looks like WeChat loads but then immediately closes. The error code I'm getting in WXEntryActivity is -6, which doesn't seem to correspond to anything in the ErrCode enum.
My package name is the same that the app was registered under and I'm building with the signature also used to register the app. I'm stumped on where to go from here.
Here's what I see in the logcat (including some data from the BaseResp object):
D/MicroMsg.SDK.WXApiImplV10: check signature:...
D/MicroMsg.SDK.WXApiImplV10: pass
D/MicroMsg.SDK.MMessageAct: send mm message, intent=Intent { cmp=com.tencent.mm/.plugin.base.stub.WXEntryActivity (has extras) }
D/WXEntryActivity: onResp: errStr: null
D/WXEntryActivity: onResp: transaction: text1461027271082
D/WXEntryActivity: onResp: getType(): 2
D/WXEntryActivity: onResp: errCode: -6
And this is the code that gets called to send the request (I literally copied it from someone's test app that works):
WXTextObject textObj = new WXTextObject();
textObj.text = "TEST TEXT";
WXMediaMessage msg = new WXMediaMessage();
msg.mediaObject = textObj;
// msg.title = "Will be ignored";
msg.description = "TEST DESCRIPTION";
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("text");
req.message = msg;
req.scene =/* isTimelineCb.isChecked() ? endMessageToWX.Req.WXSceneTimeline :*/ SendMessageToWX.Req.WXSceneSession;
api.sendReq(req);
| e85726acdf539505a9e5c89939e59337460fc566a5174cb35fae13c149e28866 | ['959a3db7d03a4178b457db0f3d04c50c'] | Can't comment, no rep.
After updating to the latest build tools, hierarchy viewer and a bunch of other stuff was removed from the tools directory. I downloaded the tools separately from the Android Studio download page and it included the hierarchy viewer. Not sure what's going on, but it seems updating build tools in Android Studio removes the hierarchy viewer.
Edit: Hierarchy viewer is listed under the deprecated features from Build tools 25.3.0
http://tools.android.com/recent/androidsdktoolsrevision2530feb2017
|
d5cc969a44fdef884b58da4ff5924d5a3be3396f63f680458bfd821bd45bad2e | ['95abd455419843fdb608089c924a234f'] | I found a beginner-friendly tutorial here: http://androidrox.wordpress.com/2011/05/13/android-sample-app-drag-and-drop-image-using-touch/
here is the xml code in my case:
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/absLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<Button
android:id="@+id/myButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Countries" />
</AbsoluteLayout>
MainActivity.java:
public class MainActivity extends Activity {
AbsoluteLayout absLayout;
Button myButton = null;
boolean touched = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
absLayout = (AbsoluteLayout) findViewById(R.id.absLayout);
myButton = (Button) findViewById(R.id.myButton);
myButton.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
touched = true;
return false;
}
});
absLayout.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(touched == true) // any event from down and move
{
LayoutParams lp = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT,(int)event.getX()-button_Countries.getWidth()/2,(int)event.getY()-myButton.getHeight()/2);
myButton.setLayoutParams(lp);
}
if(event.getAction()==MotionEvent.ACTION_UP){
touched = false;
}
return true;
}
});
}
Basically what happens here I need to touch myButton once first to convert the boolean touched to true. Then I might be able to drag myButton by start touching anywhere on absLayout. How can I simply drag the button freely without the need of touching the button first?
I tried setting the LayoutParams on myButton touch listener. It causes flickering to the dragging progress.
Also, AbsoluteLayout is always tagged as deprecated. What does "deprecated" means? Does it mean obsolete and therefore unusable? Or usable but there might be a better solution?
| b39c7822ed90a26e732df22a38c2e1ffcf8119b02de5b759c50166e285f87e0a | ['95abd455419843fdb608089c924a234f'] | I'm novice in Android development and now I'd really like to learn Shared Preferences. I've googled it so many times and I don't think I quite mastered it.
I believe this Shared Preferences will help me to store username and a password on my login screen activity. Thanks you!
|
1653b3ba014085917c243d408667f805abd2f94e49f957f645aa70be60054c0b | ['95b46955155d4fdbb94f954c9b2f8d9c'] | I have a cell array named "output"(dimension = 3 x 6). Each cell in the first row of this cell array has entries which are 1024 x 1024 matrices (type double). I would like to take the mean value of a given ROI within each matrix. For example, I would want Matlab to produce the mean of the region ([100:200],[100:200]) for each of the matrices and save to an excel or .txt.
I am unsure how to proceed in terms of coding this. Please help!
Thanks :)
| 26a4c818db6f3701efd42c809cada66680d3c40d1c15cdcf16f9f12011703872 | ['95b46955155d4fdbb94f954c9b2f8d9c'] | I have a cell array (3 x 4), called output, containing a 1024 x 1024 matrix in each cell. I want to plot the 4 matrices in ouput{1,:}. Furthermore, I have a structure, called dinfo, which correspondingly contains the names of each matrix (field with matrix names = "name"). I want each image to be titled with its name. Here is the code I have written thus far:
for i = 1:length(output{1,:})
figure
imagesc(output{1,i});
colormap('jet')
colorbar;
title(num2str(dinfo.name(i)))
end
I keep getting the error that "length has too many input arguments". If I change the code to avoid the length function-related error:
for i = 1:4
figure
imagesc(output{1,i});
colormap('jet')
colorbar;
title(num2str(dinfo.name(i)))
end
I get the error, "Expected one output from a curly brace or dot indexing expression, but there were 4 results".
Any thoughts on how I could resolve both of these errors?
Thank you for your time :)
|
419b538410bbd62698d94b3f66b66e0be3cfa64217a27020d960cb68726ff70e | ['95b7915a11104d069db19d3ff60a726c'] | Hi there i have spent more than 20 hours to figure out how to upload image from my app to server, image which i want to upload could be either taken from camera or photo roll..... here is my code which does show progress of uploading but doesnt reach to server and thus gets negative response form server.. please help me..
Alamofire.upload(multipartFormData: { multipartFormData in
multipartFormData.append(UIImageJPEGRepresentation(image, 0.1)!, withName: imageName)
for (key, value) in parameters {
multipartFormData.append(value.data(using: String.Encoding.utf8)!, withName: key)
}
},
to: URL_USER_PROFILE_IMG_UPLOAD)
{ (result) in
switch result {
case .success(let upload, _, _):
upload.uploadProgress(closure: { (progress) in
print("Upload Progress: \(progress.fractionCompleted)")
})
upload.responseJSON { response in
print(response.result.value)
}
case .failure(let encodingError):
print(encodingError)
}
}
and my server code is in PHP as this
<?php
// Path to move uploaded files
$target_path = "profile-photos/";
// array for final json respone
$image_upload = array();
$server_ip ="00.000.000.000";
//gethostbyname(gethostname());
// final file url that is being uploaded
$file_upload_url = 'http://' . $server_ip .'/'.'folder2017'.' /'.'webser'.'/'. $target_path;
if(isset($_FILES['image']['name'])) {
$target_path=$target_path.$_FILES['image']['name'];
if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {
$image_upload=array('path'=>$file_upload_url,'response_code'=>1);
echo json_encode($image_upload);
}
} else {
$image_upload=array('response_code'=>0);
echo json_encode($image_upload);
}
?>
| e86e32f33fee38cdb6db42b2389f697e946db36d19a53320dd9e4669f238df2c | ['95b7915a11104d069db19d3ff60a726c'] | I am struggling to find the solution for opening a specific view of my IOS app when i get notification, i want to open a screen when user taps on received notification.
I am able to get the notification and when app is in background and i tap on notification it redirects me to specific view, it does also work when app is in active state but it just opens app when i tap on it and app is in killed state..
below is my appdelegate code
if application.applicationState == .inactive{
print ("app is NOT active from not sec.")
let articleId = userInfo["notification_id"] as? String
UserDefaults.standard.set(articleId, forKey:"articleId");
let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewControlleripad : UIViewController = mainStoryboardIpad.instantiateViewController(withIdentifier: "notificationsPageSB") as UIViewController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = initialViewControlleripad
self.window?.makeKeyAndVisible()
let isPromoFCM = 1 as? Int
UserDefaults.standard.set(isPromoFCM, forKey:"isPromoFCM1");
}
else if application.applicationState == .active {
let articleId = userInfo["notification_id"] as? String
UserDefaults.standard.set(articleId, forKey:"articleId");
print ("app is active from not sec.")
let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewControlleripad : UIViewController = mainStoryboardIpad.instantiateViewController(withIdentifier: "notificationsPageSB") as UIViewController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = initialViewControlleripad
self.window?.makeKeyAndVisible()
/* let storyboard = UIStoryboard(name: "Main", bundle: nil);
let viewController: wow_Request_completed_vc = storyboard.instantiateViewController(withIdentifier: "wow_Request_completed_vc") as! wow_Request_completed_vc;
// Then push that view controller onto the navigation stack
let rootViewController = self.window!.rootViewController as! UINavigationController;
rootViewController.pushViewController(viewController, animated: true);
self.window?.rootViewController!.performSegue(withIdentifier: "link_to_wow_completed_vc", sender: nil)
*/
//let isOpenedThroughFCM = "yes"
//UserDefaults.standard.set(isOpenedThroughFCM, forKey:"isOpenedThroughFCM");
isComingFromFCM3 = 1;
} else {
// let isOpenedThroughFCM = "yes"
// UserDefaults.standard.set(isOpenedThroughFCM, forKey:"isOpenedThroughFCM");
isComingFromFCM3 = 1;
print ("app is NOT active from not sec.")
let articleId = userInfo["notification_id"] as? String
UserDefaults.standard.set(articleId, forKey:"articleId");
let mainStoryboardIpad : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewControlleripad : UIViewController = mainStoryboardIpad.instantiateViewController(withIdentifier: "notificationsPageSB") as UIViewController
self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = initialViewControlleripad
self.window?.makeKeyAndVisible()
}
|
f82535ec637a1438368fcbde80364b6b74a30af8832098ac801b10390c212350 | ['95eeb17d0f9641799d75308a7262a495'] | Ok a friend give me solution.
It's my regex which does not work so I replace
string testMessage = String.Format("{0}", data.Value);
string delSpace = testMessage;
Regex regex = new Regex(@"(\s){2,}");
testMessage = regex.Replace(delSpace, "&");
by
string testMessage = String.Format("{0}", data.Value);
testMessage = testMessage.Replace("\n",string.Empty);
testMessage = testMessage.Replace("\r", string.Empty);
testMessage = testMessage.Replace(" ", string.Empty);
| 3edee523f8a4035a146f7192d2e69478d143a896aad08b9ca55157c6e254dd64 | ['95eeb17d0f9641799d75308a7262a495'] | I know this post is old but recently I have the same problem with combobox.
Situation : I have an editable combobox which propose complete words when user write some letters.
But when I want to type a letter, combobox auto highlight the text and the next letter auto replace the previous.
Solution : I use a textbox to avoid any highlight like that:
<ComboBox IsTextSearchEnabled="False" IsEditable="True" x:Name="CMB_ClientName"/>
<TextBox Text="{Binding ElementName=CMB_ClientName, Path=Text}" TextChanged="ComboBoxChange" x:Name="TXT_ClientName"/>
And I generate the textbox TextChanged event :
private void ComboBoxChange(object sender, TextChangedEventArgs e)
{
//Clear ComboBox items
CMB_ClientName.Items.Clear();
//Auto Open DropDownList
CMB_ClientName.IsDropDownOpen = true;
//Get data from database (use entity framework 6.x)
dbEntity.Client.Load();
//Attribute Data to variable
var clients = dbEntity.Client.Local;
foreach (Client client in clients)
{
//If data begin with the texbox text, the data is add to the combobox items list.
if (client.Nom.ToLower().StartsWith(TXT_NomClient.Text.ToLower()))
{
CMB_ClientName.Items.Add(client.Nom);
}
}
}
I know this solution isn't realy beautifull, but it is for me the easiest solution to avoid highlight text and all the solutions in this post don't work for me.
I hope this solution will be helpfull, thanks for reading.
Math.
Ps: My apologies, my English is not very good. I hope you will understand me correctly.
|
870a6aa1cbb35e3c05bedc0aa7ccaebb01683fbd077cf7c183d7840864c29eed | ['960d9a75bc83477cae9299be94c3abe3'] | You may have opted into having Google Play sign your releases with a key they generated, and only use your key for the upload.
If you did, go to Google Play Console Release Management -> App Signing and copy the App signing certificate SHA-256 fingerprint and put it into the assetlinks.json file.
| 23798ac63d2439e2d726344c07f8a7a295b604aeb49e06e09a173cafeb24a999 | ['960d9a75bc83477cae9299be94c3abe3'] | Generally, freezing meat and thawing before consumption will not affect flavor. There are some precautions you can take when freezing and thawing to ensure that the meat doesn't get damaged (i.e. freezer burnt or overcooked if you thaw under heat). Here is an excerpt from a useful article on the subject.
When packaging meats for the freezer, the most important thing is to
protect them from exposure to air. Wrap meats very tightly in either
plastic wrap or freezer paper, pressing the wrapping right up against
the surface of the meat. Next, wrap another layer of aluminum foil
around the meat or seal it inside a zip-top freezer bag.
Packaged like this, meat can be kept frozen for at least three months.
After this time, even well-wrapped meats can start to develop freezer
burn, though I've often cooked meat several months after freezing and
found it to be perfectly fine.
The best and safest way to thaw meat is to place the frozen package in
the refrigerator and let it thaw gradually. Small cuts will thaw this
way in about 24-hours while larger cuts can take a few days. If you're
rushed for time, small cuts can also be thawed in a bowl of lukewarm
water under running water.
For some more tips see the full article: http://www.thekitchn.com/freezer-savvy-the-best-way-to-freeze-and-thaw-meat-177355
|
252fbfa6bd9cbe7878d5237bfb6e4eec2018d1ccab130fb8262a8163d099b305 | ['9610596a3a3444b0831a2a926de2fe1e'] | Sorry to keep you waiting, I will close this due to still waiting from our users for feedback(they use this files only once a month). which means I can't confirm if my solution was correct or not. However what I did was tweak the code. and added an if to check the current pages link and added the Ie.readyState < READYSTATE_COMPLETE into the code. it looks like the following:
If Ie.LocationURL <> "site link" Then Do While Ie.Busy = True Or Ie.readyState <
READYSTATE_COMPLETE DoEvents Loop
End If
I do this twice. once for the login page, and the second time.
It seems to work for me(did the data scrape at least 10 times and no error)
Thank you for your time and sorry for the wait.
| 9d5f6928d554d41ad70ef278f69f4d2ee07c61443b3956952d533a665ba22197 | ['9610596a3a3444b0831a2a926de2fe1e'] | I got 2 table, one is a pivot table that has usernames and hours of work in it.
second table has username and the payment per hour
I want to have an answer in one column besides the 1st table with the hours * payment for worker.
For example:
nik 12 Total 240$ nik 20$(in a different sheet""master)
<PERSON> 15 Total 315$ john 21$(in a different sheet"master")
i did a vlookup that works but ONLY if both of the username columns are the same order.
=(VLOOKUP(A2:A25,master!A2:B24,2,FALSE))*(VLOOKUP(master!A2:A24,A2:B25,2,FALSE))
Is it possible to make the 1st column to search from the second one even if its out of the order?
-Nik
|
f9cbecd7a030214c5980ecbbfa4fb67a8fab2e375b61c3e2bc043fd1bdb2c314 | ['961f5643547c459ea927a3983c4bf030'] | I'm trying to extract data from an Xml file, I followed this tutorial:
XmlPullParser tutorial
And now have the following code:
public void parse(InputStream is) {
// create new Study object to hold data
try {
// get a new XmlPullParser object from Factory
XmlPullParser parser = XmlPullParserFactory.newInstance().newPullParser();
// set input source
parser.setInput(is, null);
// get event type
int eventType = parser.getEventType();
// process tag while not reaching the end of document
while(eventType != XmlPullParser.END_DOCUMENT) {
switch(eventType) {
// at start of document: START_DOCUMENT
case XmlPullParser.START_DOCUMENT:
break;
// at start of a tag: START_TAG
case XmlPullParser.START_TAG:
// get tag name
String tagName = parser.getName();
Log.i("AT START TAG","AT START TAG..."+tagName);
// if <study>, get attribute: 'id'
if(tagName.equalsIgnoreCase("Date")) {
Log.i("****PARSER INFO","TAG NAME="+tagName+"...."+parser.nextText());
eventDates.add(parser.nextText());
//study.mId = Integer.parseInt(parser.getAttributeValue(null, Study.ID));
}
// if <content>
else if(tagName.equalsIgnoreCase("Name")) {
Log.i("****PARSER INFO","TAG NAME="+tagName+"...."+parser.nextText());
performanceNames.add(parser.nextText());
//study.mContent = parser.nextText();
}
// if <topic>
else if(tagName.equalsIgnoreCase("RequestURL")) {
Log.i("****PARSER INFO","TAG NAME="+tagName+"...."+parser.nextText());
eventsURLS.add(parser.nextText());
//study.mTopic = parser.nextText();
}
break;
}
// jump to next event
eventType = parser.next();
}
// exception stuffs
} catch (XmlPullParserException e) {
//study = null;
} catch (IOException e) {
//study = null;
}
// return Study object
}
For some reason, the code within the IF statements is not running even though I have made sure the tag names do equal the strings above.
What am I doing wrong?
| da80cb54632919717df6f9b96d628b81bed07db02e9a9c342046174cbdb3c14a | ['961f5643547c459ea927a3983c4bf030'] | I'm using the SDWebImageDownloader library to download images asynchronously.
The problem i'm having is when I click the back button before the images finish download the app is crashing on the following line in the SDWebImage Class:
if([delegate respondsToSelector:@selector(imageDownloaderDidFinish:)])
This is how i'm using it in my code:
sdDownloader = [[SDWebImageDownloader downloaderWithURL:headerImgURL delegate:self]retain];
What is causing it to crash? I'm retaining it and i'm not releasing it anywhere.
|
873ec84485d6736373cf01ab0b2c30f69abe1bc60c491e568e53f36e7f2a6dd0 | ['9621699574654d39a6aaa839a59eb985'] | I am using a vue + nuxt.js application, I like to know if it is possible to cache an axios webservice call for all clients. I have to get some currency reference data and this makes not much sense that every client has to call this data.
Can someone provide me some hints or even an example? Thx.
| 13bb87bdbfcbc828083991b3d67760896979b3f05ded88b1da408c23190ef53c | ['9621699574654d39a6aaa839a59eb985'] | After studying the stack trace of the stale exception I recognised that the issue comes not directly from the EventFiringWebDriver. It gets thrown by my listener implementation of the WebDriverEventListener while I try to get the tag name of the element after the click has been performed.
For me it looks like that the design of the WebDriverEventListener is not optimal. With other words you may not able to use the passed WebElement in the "afterXXX" methods, otherwise you may risk a stale exception. Instead you should use the "beforeXXX" methods in order to retrieve the details of the elements.
Stacktrace of my StaleElementReferenceException
at org.openqa.selenium.htmlunit.HtmlUnitDriver.assertElementNotStale(HtmlUnitDriver.java:963)
at org.openqa.selenium.htmlunit.HtmlUnitWebElement.assertElementNotStale(HtmlUnitWebElement.java:734)
at org.openqa.selenium.htmlunit.HtmlUnitWebElement.getTagName(HtmlUnitWebElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement$1.invoke(EventFiringWebDriver.java:332)
at com.sun.proxy.$Proxy18.getTagName(Unknown Source)
at ch.megloff.test.SimpleExtentReportWebDriverEventListener.afterClickOn(SimpleExtentReportWebDriverEventListener.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.openqa.selenium.support.events.EventFiringWebDriver$1.invoke(EventFiringWebDriver.java:81)
at com.sun.proxy.$Proxy16.afterClickOn(Unknown Source)
at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.click(EventFiringWebDriver.java:346)
..s
Java Code snippet of "getTagName()" of the underlying HtmlUnit Implementation
public String getTagName() {
assertElementNotStale();
return element.getNodeName();
}
My "Error-prone" listener implementation for this "afterClickOn" Method - the "getTagName()" should not be called after a click has been performed
public class MyWebDriverEventListener extends AbstractWebDriverEventListener {
...
@Override
public void afterClickOn(WebElement element, WebDriver driver) {
// bad implementation, click has been already performed
// so you may risk to have a stale exception in case the
// browser switched already to the other page (DOM got changed)
logEvent("Clicked on tag: " + element.getTagName() + " with href: " + element.getAttribute("href"));
}
}
|
fce8e65d7fec2d1dd5139e0bbfa0b7e40c2597824f7285cb22b395e024c40f32 | ['9626819d37fd46db9075b9e58792e058'] | you can write a function for this too.
what i understood is you are looking for exactly 2 variables in an array.
here is what i tried
function find(arr,first,second){
let temp=false;
if(arr.includes(first)&&arr.includes(second)){
temp=true;
}
return temp;
}
find(["foo","bar"],"foo","bar");
if you are looking for an array of exactly same length then you can have length check too in function.
the function will look like
function find(arr,first, second){
let temp=false;
if(arr.length!=2)
return false
if(arr.includes(first)&&arr.includes(second)){
temp=true;
}
return temp;
}
find(["foo","bar"],"foo","bar");
| 36349662d7591f7cd72fc813f4904065a902f8ef6f7362dc2bc305ae3fbda57c | ['9626819d37fd46db9075b9e58792e058'] | I know this is late but this but the above answers didn't work for me.
I tried KeyboardAvoidingView outside ScrollView with behavior={'padding'} as I guess behavior={'position'} has been messing with view. following is my code
<KeyboardAvoidingView behavior="padding">
<ApplicationDetailsTabs
initialIndex={this.state.activeTab}
onChange={this.onTabChange}
/>
<ScrollView style={styles.container}>
|
3786ddd1291c9284cb494f784a3ce257b23a657d145a4d65eb064a4dce813904 | ['963350149bb748fa8422583329427c9d'] | kthread_create arguments have been explained in kernel source code.
kthreade_create definition in kernel source
As you can see namefmt is a printf-style format string. Which means
1. namefmt can be a string literal like "my-kernel-thread" and in that
case the variable arguments will not be needed. In this case your
kthread will be named my-kernel-thread
2. namefmt can be a format specifier like "%s-%d" and in that case
variable arguments can be arguments according to this format
specifier. Like for this example they can be "my-kernel-thread",
10. In this case your kthread will be named my-kernel-thread-10
| 78e39fc6118baf5b979fc3881f13f9ff32062ef6d649e3a5ef91f1c7e649ef0f | ['963350149bb748fa8422583329427c9d'] | Have you tried flushing the ofstream object i.e fDriversProbe.flush() after every write. I had similar issue where I was trying to feed camera shutter and gain parameters using sysfs attribute exported by the driver, but the settings were not reaching driver. Accompanying the write into sysfs file with a subsequent flush fixed the issue for me.
|
e1975b7b7067500e39fa4ec7cb572d4dabf2bcf31a6e4687e24f07416090f8be | ['9634c0ac0ade46c3a9bbeb1356dcf5a1'] | I duplicated a Drupal site and the database from the first one to another. Of course i copied files from 1st instance to 2nd.
Now i encounter a database error when i try to add a content to the page, but ONLY content.
Full error
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048
Kolumna'entity_id' nie może być null: INSERT INTO {field_data_body}
(entity_type, entity_id, revision_id, bundle, delta, language,
body_value, body_summary, body_format) VALUES
(:db_insert_placeholder_0, :db_insert_placeholder_1,
:db_insert_placeholder_2, :db_insert_placeholder_3,
:db_insert_placeholder_4, :db_insert_placeholder_5,
:db_insert_placeholder_6, :db_insert_placeholder_7,
:db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => node
[:db_insert_placeholder_1] => [:db_insert_placeholder_2] =>
[:db_insert_placeholder_3] => CONTENT TYPE I TRY TO ADD (here its podstrona) [:db_insert_placeholder_4] =>
0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] =>
adawdawd [:db_insert_placeholder_7] => [:db_insert_placeholder_8] =>
html ) in field_sql_storage_field_storage_write() (line 494 of
/home/username/domains/domain/public_html/subdomain/modules/field/modules/field_sql_storage/field_sql_storage.module).
To be very precise: 1st i copied all files from 1st instance to 2nd (which is hosted on a subdomain) then i deleted the 2nd db, then i copied the 1st database with specific prefix (of course matching the installation prefix). Most interesting is the fact that i can add content types, views etc, but i cant add any content to the page cause above error prompts.
I will really appreciate any help, and thanks in advance!
| de521da5d671deb699d862ae7c469d593750c547aea108602674fe061a0fc4e4 | ['9634c0ac0ade46c3a9bbeb1356dcf5a1'] | Im writing a River-Raid-Like game, and all images are drew with g.drawImage(...).
My question is: How to keep the content aspect ratio, and scale the content to fit the new window size ,when someone will resize the JFrame?
Is there any option like that? Can i do this without using JLabels and Layouts? If not, how to do this other way?
My code to draw things on the JPanel
private void doDrawing(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
drawStrings(g2);
mapa.drawMap(g2);
ArrayList ms = craft.getMissiles();
for (Object m1 : ms) {
Missile m = (Missile) m1;
g2.drawImage(m.getImage(), m.getX(), m.getY(), this);
}
g2.drawImage(craft.getImage(), craft.getX(), craft.getY(), this);
for (EnemyJet enemy : enemies) {
g2.drawImage(enemy.getImage(), enemy.getX(), enemy.getY(), this);
}
for (Fuel fuel : fuels) {
g2.drawImage(fuel.getImage(), fuel.getX(), fuel.getY(), fuel.getHeight(), fuel.getHeight(), this);
}
for (Obstacle o : obst) {
g2.drawImage(o.getImage(), o.getX(), o.getY(), this);
}
drawStrings(g2);
}
Also Jpanel constructor:
private void initBoard() {
addKeyListener(new TAdapter());
setFocusable(true);
setBackground(Color.WHITE);
setLayout(new GridBagLayout());
craft = new Craft(ICRAFT_X, ICRAFT_Y);
mapa = new Mapa();
setMinimumSize(new Dimension(WIDTH, HEIGHT));
initEnemiesAndAddThem();
czas = new Timer(delay, this);
czas.start();
}
JFrame constructor:
private void initGame()
{
add(new Plansza());
setTitle("Reeevah Raaid");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(WIDTH, HEIGHT);
setPreferredSize(new Dimension(WIDTH, HEIGHT));
setLocationRelativeTo(null);
pack();
setVisible(true);
//setExtendedState(JFrame.MAXIMIZED_BOTH);
//setResizable(false);
}
|
d48c8d2187eff30fc5ab05e59782936dd2f7ae2bbd9a54f2ae3cdc626899d122 | ['96489eda41a84a55baf9f6d714a24ebd'] | I'm gonna to create a navigation bar using<nav> </nav>. but I don't know that should I use <Li></Li> and in it to make the items, or<a></a>is just fine?? and what is the difference between this two?? and which one is better?
<nav>
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#About">About</a></li>
<li><a href="#Contact">Contact</a></li>
<li><a href="#Buy">Buy</a></li>
</ul></nav>
or
<nav>
<a href="#home">Home</a>
<a href="#About">About</a>
<a href="#Contact">Contact</a>
<a href="#Buy">Buy</a> </nav>
| e4e1c2f00184d1bea6dc48ce343ebcad3cadcad3238a411e8145f8ab1e869b90 | ['96489eda41a84a55baf9f6d714a24ebd'] | I have this html :
<div class="d-flex align-items-center flex-column flex-sm-row justify-content-between w-100 pt-10 pb-15">
<h1 class="product-title mb-0 pl-10 order-2 order-sm-1 ml-auto ml-sm-0" itemprop="name">
Samsung Galexy A70
</h1>
</div>
which one is true???
this selector??
div.d-flex align-items-center flex-column flex-sm-row justify-content-between w-100 pt-10 pb-15 h1{
}
or this one?
div.d-flex h1{
}
|
f5d731270605720f39323e2b1c04c385f2c9d6a752ef795f07682d693da35889 | ['964b15e20fcd40d28de3d1d9ef104c99'] | With the help of a colleague, we got it worked out. Here's the updated code...
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/branding/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/branding/$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
The WP-specific rules in the htaccess file cause some strange situations to occur. The main one being that there is an internal rewrite from /branding/ to /index.php, and then WP handles the request within the PHP. The file checks will handle the check to ensure that the index.php file exists. WP will internally deal with redirecting valid page requests that don't have trailing slashes.
| 5ea0343ac9ef7f4490c57d6e578bbca1a3af892123854ca963c8ade959906742 | ['964b15e20fcd40d28de3d1d9ef104c99'] | I have checked all of the related questions I can find in here (and in Google in general), and tried all of the various solutions given, but haven't been able to get this to work.
I am working on a Wordpress site that has recently gone SSL. I have set it up so that all pages are forced to https by adjusting the Settings page in the Admin area, adding the appropriate line to the wp-config file to force the admin side to be https and have modified my htaccess files to the following:
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/branding/
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTPS} on
RewriteRule ^branding/ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Here's what I would like this to do...
1) http://www.example.com/ (and any sub pages except branding) gets redirected to https://example.com
2) http://example.com/branding stays as it is
3) https://example.com/branding is redirected to http://example.com/branding
The above htaccess code works to force the http: to https:, however, if I enter either http://example.com/branding or https://example.com/branding I am redirected to https://example.com.
I have used numerous variations of the initial Rewrite code and placed it in various places (as instructed in various other answers to similar questions here) with no change to the result.
If anyone can tell me where my error is and how to fix it, it would be much appreciated.
|
9a92b25a60553cfc980c75eb90ed3628f7970e85f5f0bf05958be0376a6ce0a7 | ['96516108a5f74ea19c778c59d841b918'] | Here's some code to get you started.
using System.Text;
using System.Windows.Forms;
using System;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
textBox1.Text = "<EMAIL_ADDRESS>; <EMAIL_ADDRESS>; <EMAIL_ADDRESS>";
}
private void textBox1_Click(object sender, EventArgs e)
{
int nextSpaceIndex = textBox1.Text.Substring(textBox1.SelectionStart).IndexOf(' ');
int firstSpaceIndex = textBox1.Text.Substring(0, textBox1.SelectionStart).LastIndexOf(' ');
nextSpaceIndex = nextSpaceIndex == -1 ? textBox1.Text.Length : nextSpaceIndex + textBox1.SelectionStart;
firstSpaceIndex = firstSpaceIndex == -1 ? 0 : firstSpaceIndex;
textBox1.SelectionStart = firstSpaceIndex;
textBox1.SelectionLength = nextSpaceIndex - firstSpaceIndex;
}
}
}
This will, when you click on an email address, select the entire email address. I'm not sure if this is the functionality you're going for (it sounds like it is, though), but it'll get you started. If you want to do other things beyond having click functionality, hook into the other events offered by TextBox.
| 008f52a304c90ca1a204816c2d34c3960eb0bac207d0c5a8e760f192c8791c33 | ['96516108a5f74ea19c778c59d841b918'] | Can't think of one that would let you interactively edit it directly on the command line but there are ways to make it more convenient than what you're describing. If it's a short term change and you just need to add something to the path, you can self reference the current value. For example, in Bash:
PATH=$PATH:/ADDITIONAL/PATH
Or if you want to alter precedence, you can prepend it with
PATH=/ADDITIONAL/PATH:$PATH
You can also save yourself a cut and paste by echoing the value into a temporary file
echo $PATH > tempfile.txt
If you have more complex or permanent changes to make, you can reference and edit your environment variables in your equivalent rc and or profile file. If they're not already present, you can use the echo method to get them in an editable state, (just make sure to use >> to append instead of overwrite). Or, in vi, you can also use
:r!echo $PATH
In emacs it would be
C-u M-! echo $PATH
To insert the output into the file you're working on.
|
e8faa8e59d508c50c79fdb0025dc1894a62134afa238b2bfa252ebd98f4ab23e | ['9656ccaaf3df4a15b6bfc05451b0d85e'] | package com.company;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
int[][] puma = {{1, 2, 0, 3}, {3, 2, 0, 1}, {0, 0, 4, 2}, {3, 3, 0, 4}};
Scanner input = new Scanner(System.in);
System.out.println("Enter space for putting 1: ");
int a = input.nextInt();
int b = input.nextInt();
if (a == 0 && b == 2) {
puma[0][2] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
if (a == 1 && b == 2) {
puma[1][2] = 2;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 3: ");
a = input.nextInt();
b = input.nextInt();
if (a == 2 && b == 0) {
puma[2][0] = 3;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 1: ");
a = input.nextInt();
b = input.nextInt();
if (a == 2 && b == 1) {
puma[2][1] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
if (a == 3 && b == 2) {
puma[3][2] = 2;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
}
if (a == 3 && b == 2) {
puma[3][2] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
if (a == 2 && b == 1) {
puma[2][1] = 2;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
}
}
}
if (a == 2 && b == 1) {
puma[2][1] = 3;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 1: ");
a = input.nextInt();
b = input.nextInt();
if (a == 2 && b == 0) {
puma[2][0] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
if (a == 3 && b == 2) {
puma[3][2] = 2;
}
}
if (a == 3 && b == 2) {
puma[3][2] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
if (a == 2 && b == 0) {
puma[2][0] = 2;
}
}
}
if (a == 3 && b == 2) {
puma[3][2] = 3;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 1: ");
a = input.nextInt();
b = input.nextInt();
}
}
if (a == 2 && b == 0) {
puma[2][0] = 2;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 3: ");
a = input.nextInt();
b = input.nextInt();
if (a == 1 && b == 2) {
puma[1][2] = 3;
}
if (a == 2 && b == 1) {
puma[2][1] = 3;
}
if (a == 3 && b == 2) {
puma[3][2] = 3;
}
}
if (a == 2 && b == 1) {
puma[2][1] = 2;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 3: ");
a = input.nextInt();
b = input.nextInt();
if (a == 1 && b == 2) {
puma[1][2] = 3;
}
if (a == 2 && b == 0) {
puma[2][0] = 3;
}
if (a == 3 && b == 2) {
puma[3][2] = 3;
}
}
if (a == 3 && b == 2) {
puma[3][2] = 2;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 3: ");
a = input.nextInt();
b = input.nextInt();
if (a == 1 && b == 2) {
puma[1][2] = 3;
}
if (a == 2 && b == 0) {
puma[2][0] = 3;
}
if (a == 2 && b == 1) {
puma[2][1] = 3;
}
}
}
if (a == 1 && b == 2) {
puma[1][2] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
}
if (a == 2 && b == 0) {
puma[2][0] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
}
if (a == 2 && b == 1) {
puma[2][1] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
}
if (a == 3 && b == 2) {
puma[3][2] = 1;
for (a = 0; a < puma.length; a++) {
for (b = 0; b < puma[0].length; b++) {
System.out.print(puma[a][b] + " ");
}
System.out.print('\n');
}
System.out.println("Enter space for putting 2: ");
a = input.nextInt();
b = input.nextInt();
}
for (int i = 0; i < puma.length; i++) {
for (int j = 0; j < puma[0].length; j++) {
System.out.print(puma[i][j] + " ");
}
System.out.print('\n');
}
}
}
}
//this is what ı can after with <PERSON> trying to do it in short way :(
| a1ad81c69507a3f57ea43be5fee6f32f55b184fb0b36ced88233594141f94e14 | ['9656ccaaf3df4a15b6bfc05451b0d85e'] | package com.company;
class mergeNumbers {
public static void mergeNumbers(int[][] grid, int row, int column, int nextNumber) {
grid = new int[][]{
{2, 0, 1, 1, 0, 8},
{2, 1, 0, 2, 4, 0},
{1, 2, 1, 2, 1, 3},
{2, 3, 2, 0, 1, 0},
{0, 0, 5, 8, 7, 2},
{2, 0, 1, 1, 0, 0}};
}
}
//A Cell of the board is either empty or contains a number.
|
bc843e609fb1b410d14963afc21d67d0b72da48466198885b9eca022f957d782 | ['965c1374ee354f8497b52c59696eaf7b'] | My friend is telling me that Wix is a better oil filter. He says they don't use paper, and that the intake holes are bigger. I just bought a TG16 (which is the expensive FRAM filter). Is there any objective studies done on these two? How do I know paper is worse than whatever Wix using? How do I know that hole size matters at all?
Is there a consumer reviews or something that can advise my purchase?
| 4715295984ec4aa60fd5304bbd70aebe1898f0624dfffb9386200dc94516de2e | ['965c1374ee354f8497b52c59696eaf7b'] | Hm, I'd like to hand out two "accepted answers". ;)
<PERSON> answered the first part of my question:
Create a new ashx instead of aspx page
So I've created a generic handler which is what I was looking for.
<PERSON> answered the second part of my question:
use the XmlWriter, sort of a halfway solution between hand crafting the xml as a string and using a dom.
So I've used the XmlWriter, which is what I was looking for.
|
fa15e8f1611e9914ebe4fd173218dbd58fb36bddb7642d8066e2bae56299310b | ['9666a1b615cd499b9d94ff3a955ac8ac'] | The same message appears repeatedly in our logs after recently upgrading Apache from 2.4.9 to 2.4.12, yet everything in our web application continues to work as it did before.
Recent Apache source code contains these lines in modules/generators/mod_cgid.c:
rv = ap_pass_brigade(r->output_filters, bb);
if (rv != APR_SUCCESS) {
/* APLOG_ERR because the core output filter message is at error,
* but doesn't know it's passing CGI output
*/
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(02550) "Failed to flush CGI output to client");
}
...whereas in earlier versions it just had:
ap_pass_brigade(r->output_filters, bb);
So if I'm reading this right, Apache used to ignore the return value of the function in this context, and more recently somebody decided it might be important.
If you feel the message is uselessly cluttering up your logfiles, you might try changing the APLOG_ERR constant to APLOG_INFO or APLOG_DEBUG, and compiling it that way.
| 33b0944f7fc8432d1515cc1eb33f243249e2dcc8fee747d38e72512c3407a8dd | ['9666a1b615cd499b9d94ff3a955ac8ac'] | A bit late to the party, but I was having the same problem (trying to find where the "l." command was aliased in RHEL6), and ended up in a place not mentioned in the previous answers. It may not be found in all bash implementations, but if the /etc/profile.d/ directory exists, try grepping there for unexplained aliases. That's where I found:
[user@server ~]$ grep l\\. /etc/profile.d/*
/etc/profile.d/colorls.csh:alias l. 'ls -d .*'
/etc/profile.d/colorls.csh:alias l. 'ls -d .* --color=auto'
/etc/profile.d/colorls.sh: alias l.='ls -d .*' 2>/dev/null
/etc/profile.d/colorls.sh:alias l.='ls -d .* --color=auto' 2>/dev/null
The directory isn't mentioned in the bash manpage, and isn't properly part of where bash searches for profile/startup info, but in the case of RHEL you can see the calling code within /etc/profile:
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null 2>&1
fi
fi
done
|
c12f10415fd10531eea944cad760f6c141f01bd57250d991e8c2b64d9f7c4883 | ['967c242ea39c40d9905555db574f242f'] | I've got a list of links on my page. Here's an example:
<a href="#">Link (tagMe)</a>
<a href="#">Link (anotherTag)</a>
<a href="#">Link (aThirdTag)</a>
How do I get jQuery to check all my links and remove the one with the string "(anotherTag)" so the output list will look like:
Link (tagMe)
Link (aThirdTag)
| 79f04b3a15b8f84c577b70ed89a730f5a17d887a4936be377bbb4e94b88b2c07 | ['967c242ea39c40d9905555db574f242f'] | I'm having trouble getting my configuration right for this. I have a NextJS setup with next-css and I'm trying to add react-svg-loader to the configuration:
next.config.js:
const withCSS = require("@zeit/next-css");
module.exports = withCSS({
cssModules: true,
cssLoaderOptions: {
importLoaders: 1,
localIdentName: "[local]__[hash:base64:4]"
},
webpack(config, options) {
const { dev, isServer } = options;
config.module.rules.push({
test: /\.svg$/,
use: [
{
loader: "react-svg-loader",
options: {
jsx: true // true outputs JSX tags
}
}
]
});
return config;
}
});
The svgs will still fail to load:
{ Error: (client) ./svgs/pencil.svg 10:9 Module parse failed:
Unexpected token (10:9) You may need an appropriate loader to handle
this file type.
Looks like my config above doesn't work but I can't quite figure out why.
|
75bd8a045744ea80102a9f8c72d62a6c375cd03d5dcc47bf5afa93298a215709 | ['96913f0933be4b34adb779e12de6d3b8'] | The inability to easily replace the footage of a clip while retaining the effect stack and transitions is a pretty big limitation that I've run into as well. I found a work-around that works as long as your clips are video files and not image sequences. If you move the source clips before starting kdenlive, then when you open your project, kdenlive won't be able to find them and will present you with a list of clips that it can't find, which will be all the ones that you moved.
I found that you can double-click on each entry in the list and navigate to your new (in this case, stabilized) footage and select it.
Unfortunately, this doesn't seem to work with image sequence clips because it doesn't present the correct dialog box for that. I might try directly editing the kdenlive file and see if that works..
| 9a91a0ed24ade841346cac158d47e40e54fb734a31f5f459022f87a317c78210 | ['96913f0933be4b34adb779e12de6d3b8'] | Connection pooling is a default behavior that cannot be configured by the client for Sql Azure. Your app should be getting the benefits of connection pooling by default. Ensure that your connections strings are unique as a new pool will be created for connections with different strings. This article in MSDN specifies:
When a new connection is opened, if the connection string is not an
exact match to an existing pool, a new pool is created. Connections
are pooled per process, per application domain, per connection string
and when integrated security is used, per Windows identity. Connection
strings must also be an exact match; keywords supplied in a different
order for the same connection will be pooled separately.
Now with regards to a setting that you don't remember. You may have been talking about MARS (Multiple Active Result Sets). This feature is now available on Sql Azure.
|
ffdd00c5b0c850b2c49095044debf0f4403b7d90107f211f749df87b88d0a1d2 | ['969f1dcc397949f9b4d1540c550bce1c'] | I met the same problem, what I did is
Open Keychain Access
Find the corresponding keychain entry for your repo, and double click to open (e.g. the entry with name github.com)
Click the 'Access Control' tag
Select 'Allow all applications to access this item' and save changes
This solves the problem (or at least for me), but in some sense makes it less secure though.
| 78b91d18764df350565c84d620ccf46f623a24c305ae4b9f3733a9aac5988906 | ['969f1dcc397949f9b4d1540c550bce1c'] | Calculating everything manually will be horrible when you want to support multiple devices of different screen size. Use constraints if you want to scale the UIImageView to a certain ratio of another view.
Please refer to the auto layout guide at https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/AutolayoutPG/Introduction/Introduction.html
|
af9eefc3768d110c2ef07664a46c874cb3ef43700e6066e6f156f02ad455dfb8 | ['96a591ae187d4f65bea2b801bad3c49e'] | When manipulating the DOM the event handlers that are attached to your buttons are not attached again. You have a similar problem after the page loads - button2 does not exist and there is no click event for it.
If you regenerate the events after DOM manipulation it will work:
function set_events() {
$("#button1").click (function() {
$("body").append ("<div id = 'div2'></div>");
$("#div2").append ("<input type = button id = 'button2' value = 'button2' />");
$("#div1").remove();
set_events();
});
$("#button2").click (function() {
$("body").append ("<div id = 'div1'></div>");
$("#div1").append ("<input type = button id = 'button1' value = 'button1' />");
$("#div2").remove();
set_events();
});
}
$(document).ready (function() {
set_events();
});
| 923d95733b12014d6fe961b428da4490ebec3b139ba95949738e0eac65d27e09 | ['96a591ae187d4f65bea2b801bad3c49e'] | As everyone around is recommending, using NuSOAP for new projects is not a good idea. But in my case there is lots of legacy code depending on it.
I could solve my problem by patching the NuSOAP library to discard the nul chars by adding:
$val = str_replace("\x00", '', $val);
after:
$val = str_replace('>', '>', $val);
Didn't go deep and add processing of invalid unicode and BOMs.
|
5508d832c8bd693fd6f0ffb709859f6e8ebc3a78380434ed638ce433cadc757e | ['96a6f957660346b480207d4c6b7c4560'] | I am trying to make an application that copy/saves an .exe(app.exe) file on program-files folder on drive C from my resources. I have tried several ways to complete the process. But my luck didn't help. I am currently using [Windows 7] Professional(Activated). Here's some ways I have tried(Included below).
I have searched on [Google], [Yahoo] and [Bing]
I have searched on [StachOverflow]
I have changed <requestedExecutionLevel level="asInvoker" uiAccess="false" /> to <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
I have executed the application [as administrator]
I have started Visual Studio on administrator mode
I have tried changing folders(On C drive)
Here's my code to copy/save the .exe (Included Below)
Dim path = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
Private Sub Spread(ByVal FilePath As String, ByVal File As Object)
Dim FByte() As Byte = File
Try
My.Computer.FileSystem.WriteAllBytes(FilePath, FByte, True)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Spread(path, My.Resources.putty)
End Sub
Appreciate! Sifat, Dipta
| 6dc6011650d42fb4cee39a26ae7f03a6bc02fefc327f57de868967bbb2554b54 | ['96a6f957660346b480207d4c6b7c4560'] | I am assuming guardianview.Show() is the page you are trying to show your user's data. So basically you just create some labels and retrieve some strings/integers from your MySql database. Here's some codes, that may give you a better understanding.
Try
MysqlConn.Open()
Dim Query As String
Query = "select * from bengkel1_farah.guardian where g_ID='" & Form1.TextBox1.Text & "'"
command = New MySqlCommand(Query, MysqlConn)
reader = command.ExecuteReader
While READER.Read
Label15.Text = READER.GetInt32("ID") 'You use GetInt32 to get integers
Label31.Text = READER.GetString("Name") 'You use GetString to get strings
Label23.Text = READER.GetString("Email")
End While
MysqlConn.Close()
Catch ex As MySqlException
MessageBox.Show(ex.Message)
Finally
MysqlConn.Dispose()
End Try
I tried to be clear enough, anyway if you still face troubles, I will try to explain more.
|
9b02b01f854618ed6b1fab5975c7bada39651936f1a1b875017f00393853924d | ['96cf22843b9a4198afb128367622f238'] | The customer requires us to install our asp.net-based web system on their intranet server. As soon as the initial adjustments are done, the server will be made completely inaccessible to us (due to security reasons as you might have guessed). On the other hand, we are still responsible for maintenance and ongoing development.
So I am after some kind of auto update system. It is deemed like a windows service working side by side with the site and periodically polling central server for updates. Assuming the central server is under developers' control, such approach would solve the problem.
The question is whether such systems exist, either commercial or free/open source. Have anybody heard of them? We are a bit limited in time and would prefer to accommodate ready made solution rather than writing it from scratch.
| 254031a1740803bcea87eed571e10f495d8fe61f6deab52272fd5555079bc92a | ['96cf22843b9a4198afb128367622f238'] | I have been working on getting an analytical equation for a scalar potential of a source function in an elastic wave equation, in which I end up with an expression that has an integration of unnormalized $Sinc$ function in an interval as:
$\int\limits_{-\pi a}^{\pi a} Sinc(x\:k) \:dk$
here $a$ is a constant and $x$ is a spatial domain and $k$ is corresponding spatial frequency (Wavenumber). I know the integration of $Sinc$ function is $\pi$ in the integral between $-\infty$ and $\infty$. But I don't know how to integrate $Sinc$ in an interval between $-\pi a$ and $\pi a$.
Anyway I did try to simplify the integration as follows.
$2\:\int\limits_{0}^{\pi a} Sinc(x\:k) \:dk$
$2\:Si(\pi a)$ $\;$ where $Si$ is a sine integral.
I just wanted to know if I am right, if not please help me to simplify the integration. Many thanks in advance.
|
78ef92283c4afbe0dc111e67fdf889f154c7b9d5d355f721ecf5e3609f366084 | ['96d905b43221483a99c4c89c88ca59cc'] | I'm trying to improve the speed of a site and I've noticed that it takes 3 seconds to download some images from CloudFront.
To download a 18kb image it takes 3 seconds:
And it's a Hit from CloudFront:
Can anyone explain why it's taking so long?
| 24b2945853823d5eda1cfa1729da05fcb67e65370ace97c57efccd3dd988455b | ['96d905b43221483a99c4c89c88ca59cc'] | Agree, it is a difficult read unless one is working through examples with guidance. I don't recall specifically, but does his other work on data analysis and hierarchical modelling have a more accessible approach? (http://www.stat.columbia.edu/~gelman/arm/). I was wondering whether you can model your problem against his radon examples. |
faf3bec938634473f2142c15e95cfe4d2c8ceaf97811d354eb2415fb569fa75f | ['96d95ae43457427e9723f91dffa828a9'] | couple of days ago new version of PowerMockito has been released with support to verify private/protected method calls. Although I made it work in simple case, I am missing something with more "complicated" function. Given the following classes:
public class A {
protected void myMethod(Exception... ex) {
System.out.println("Method A");
}
protected void another() {
System.out.println("Method A 1");
}
}
:
public class B extends A {
@Override
protected void myMethod(Exception... ex) {
System.out.println("Method B");
}
@Override
protected void another() {
System.out.println("Method B 1");
}
}
:
public class C extends B {
@Override
protected void myMethod(Exception... ex) {
System.out.println("Method C");
}
public void testMe() {
myMethod(new NullPointerException("XXX"));
}
@Override
protected void another() {
System.out.println("Method C 1");
}
public void testMeAnother() {
another();
}
}
and the following test case:
@PrepareForTest({ A.class, B.class, C.class })
public class MethodTest {
@Test
public void test() throws Exception {
C classUnderTest = PowerMockito.mock(C.class);
PowerMockito.doCallRealMethod().when(classUnderTest, "testMeAnother");
PowerMockito.doCallRealMethod().when(classUnderTest, "testMe");
PowerMockito.doCallRealMethod().when(classUnderTest, "myMethod");
PowerMockito.doCallRealMethod().when(classUnderTest, "another");
classUnderTest.testMeAnother();
classUnderTest.testMe();
//this works as expected
PowerMockito.verifyPrivate(classUnderTest, times(1))
.invoke(PowerMockito.method(C.class, "another"))
.withNoArguments();
//this raises an TooManymethodsFoundException:
// Matching:
// void myMethod(...)
// void myMethod(...)
// void myMethod(...)
// three times!
PowerMockito
.verifyPrivate(classUnderTest, times(1))
.invoke(PowerMockito.method(C.class, "myMethod",
Exception[].class))
.withArguments(any(Exception[].class));
}
}
//yes, I am calling the methods on mock directly, no matter for this snippet
Full stack strace of given test can be found there
Thanks in advance!
| 9503208a0827e23b90133f2aa800ff782678f20e3bb8ce729213156f56abf434 | ['96d95ae43457427e9723f91dffa828a9'] | Your MessageBusModule does not re-export handlers, thus they are not "visible" on app.module level (at least this is what I understand on my own)
I got similar scenario like that:
const commands = [NewOrder, ChargeForOrder]
const events = [ChargeOrder, OrderProcessed]
const sagas = [AdjustWalletFunds]
@Module({
imports: [
CqrsModule,
WalletsModule,
TypeOrmModule.forFeature([...]),
],
providers: [...commands, ...events, ...sagas],
exports: [CqrsModule, ...commands, ...events, ...sagas],
})
export class RxModule {}
so, assuming you import your MessageBusModule in the main app.module, try the following:
@Module({
imports: [CqrsModule],
providers: [
MessageBusLocalService,
StartWorkflowHandler
],
exports: [MessageBusLocalService, StartWorkflowHandler]
})
export class MessageBusModule {
}
|
090bb083d478b4f2a3e3517c225f92e6d41cef4b51e93385d5fad2720caf7b3d | ['9700f0bb736f4dc78bcbc3743eac6e33'] | For some reason, Teradata is really working on hiding such information. I'm looking for most recent patch release (security and maintenance updates) for Teradata DB for each core release above version 14 (14.00, 14.10, 15.00, 15.10, 16.00, 16.10 and 16.20). Missing parts are, e.g. 16.10.xx.yy. Having Teradata enterprise access didn't sort my issue at all - which is odd. Is some one able to tell me, where I could find such information?
| 8fca8c37eb078a4f46e9a3f7b8e91fe0f44d63a07a81804841787667a899be9e | ['9700f0bb736f4dc78bcbc3743eac6e33'] | I'm aware of other, well documented methods of user managing like WebUI, CLI tools, API POST.. What I actually need is to have ability to create user only by issuing N1QL statement. I can't find such chapter under documentation or so. This leads me to confusion: is it possible at all? From other hand, I've found some code snippets where user is being create, but this is not too clear to me. Any help would be much appreciate.
Cheers.
|
a067e42b4d31d232ee85092af89a1c7819ecfee71bd7b3debae09cb513c3e7ca | ['9708dacb57a542daa17de75fb8b61d5c'] | You should expect the two JDKs to generate the same bytecode because they both use the the same java compiler from OpenJDK. The differences, as <PERSON> said, will be at runtime due to differing VM and GC implementations. Even if you generated the bytecode with a different compiler (e.g. the one in the eclipse IDE), that bytecode should run on any VM.
| 94018f552217af7f82eecbb0f32655c105f88625ff92bfec8bf910719c704566 | ['9708dacb57a542daa17de75fb8b61d5c'] | I expect you just need to add the directory containing nvml.dll to your PATH.
The page you referenced is somewhat difficult to read, but it does mention the need to update PATH and, in particular, include the folder with nvml.dll.
You can find the NVML library in your NVIDIA drivers directory.
The default location of this directory is C:\Program Files\NVIDIA Corporation\NVSMI.
If the NVIDIA software is installed in the default location on your system, the following should allow your test to run:
set PATH=%PATH%;C:\Program Files\NVIDIA Corporation\NVSMI
You can use the 'System Properties' control panel dialog to make that change permanent.
|
150a207d31124c7a9b4c207e65d85331ae5308a676a3e65435f254f8fe6dfa65 | ['9714a795587f46dfbe67de2b4cfcb76b'] | I have three jobs that I would like to serialize in Jenkins.
They should run as a block after a job that triggers them:
Job1 -> [A,B,C]
Job2 -> [A,B,C]
Right now when Job1 is triggered twice, I get the following behavior:
Order that jobs are run now:
-Job1
-Job2
-A
-B
-(job A or C)
-Order is not guaranteed after this
What I would like to see is:
Order that jobs are run:
-Job1
-Job2
-A (from Job1)
-B (from Job1)
-C (from Job1)
------------
-A (from Job2)
-B (from Job2)
-C (from Job2)
| 39875a7f5968717e01a84557df96f8bc1a9c0fa4c99b6337a9346c62625190a5 | ['9714a795587f46dfbe67de2b4cfcb76b'] | I was having similar errors trying to compile my IDL file, and i tried it from the command line:
idlj -fall file.idl
And got an error message about declaring a function twice.
dpss.idl (line 8): createPlayerAccount has already been declared.
Once I fixed the error, I was able to compile the idl in eclipse with no errors.
|
264fbfa5f454d00b7fb04f333f1a7b44fc1b7ae84fb4e0c2d4898474edb8d43f | ['971e27e5e07d43f2b695a5fe2b326af1'] | I've been trying to use the Java VisualVM profiler to figure out ways to make my own code more efficient, but I've noticed that a lot of the method calls I see when I try to do CPU sampling on the running process seem to be obfuscated method names. The weird thing is that I don't even know where they're coming from, so I seemingly have no way of knowing how to comprehend what I see.
| 82d49aca76d237bf2aac9bf7be19c59f8f33dbb13e780c8c620b762a320ceea0 | ['971e27e5e07d43f2b695a5fe2b326af1'] | I'm currently developing a SPA in Angular, and so I've created a REST service using ServiceStack. I am also using ServiceStack's default authentication and authorization solution, which allows me to decorate services with the Authenticate attribute, and also allows me to authorize roles.
However, since my application has users, and users own resources, I need a way to restrict non-authorized users from performing certain actions. Furthermore, I would like to be able to create a single service for each discrete entity which can properly figure out what is safe to write to the database and what is safe to return to the user depending on their level of authorization.
So as an example, let's say I've created a service to handle operations on a Group entity. One of the actions I allow on a Group is to get the details for it:
Route: api/groups/{Id}
Response: Name, Description, CoverImageUrl, Members
However, depending on who the user is, I wish to restrict what data is returned:
Not authenticated: Name, CoverImageUrl
Authenticated: Name, CoverImageUrl, Decription
Member of requested group: Full access
Admin of website: Full access
So one simple approach to doing this is to create 3 different response DTOs, one for each type of response. Then in the service itself I can check who the user is, check on their relation to the resource, and return the appropriate response. The problem with this approach is that I would be repeating myself a lot, and would be creating DTOs that are simply subsets of the "master" DTO.
For me, the ideal solution would be some way to decorate each property on the DTO with attributes like:
[CanRead("Admin", "Owner", "Member")]
[CanWrite("Admin", "Owner")]
Then somewhere during the request, it would limit what is written to the database based on who the user is and would only serialize the subset of the "master" DTO that the user is permitted to read.
Does anyone know how I can attain my ideal solution within ServiceStack, or perhaps something even better?
|
5bc244315cec2cade4e4679e0028545f85a3ae40baac26b67f2e1fd0d0baf983 | ['9726cc10c56c4497b24ab4ef19a47ac9'] | Did you tried tu use a custom listView, if you are receiving the data in a Json is much better to use a custom listView
here is a somehow good tutorial, that explain how to add text an images to every row on the list
http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/
also if you need 3 columns that scroll independently you can use 3 listViews, you will see an example of how to make many scroolviews on the google apidemos
| e376eaa64d5ee54287591f423c7f5f64c0a398767b2e755ec0d31c2d14325935 | ['9726cc10c56c4497b24ab4ef19a47ac9'] | I'm not sure but maybe you can calculate the convex hull, and then circumscribe it into a rectangle, then you will have the scale of your map to ensure that every circle is shown on the screen.
here: you can find information about the convex hull: http://en.wikipedia.org/wiki/Convex_hull
|
b44774348c215326a8fbd53fee17ffa47d643127e84cc6bd4c5c153c0eea1eca | ['97280aa4c5694cf997a7e886e4efce39'] | I want to capture images from webcam without any post processing, that is NO auto focus , exposure correction , white balance and stuff. Well basically I want to capture continuous frames from webcam and make each frame compare with the previous one and save them to disk only when there is an actual change. Because of the post processing almost every frame is being returned as different for me.
code so far
using namespace cv;
bool identical(cv<IP_ADDRESS>Mat m1, cv<IP_ADDRESS>Mat m2)
{
if ( m1.cols != m2.cols || m1.rows != m2.rows || m1.channels() != m2.channels() || m1.type() != m2.type() )
{
return false;
}
for ( int i = 0; i < m1.rows; i++ )
{
for ( int j = 0; j < m1.cols; j++ )
{
if ( m1.at<Vec3b>(i, j) != m2.at<Vec3b>(i, j) )
{
return false;
}
}
}
return true;
}
int main() {
CvCapture* capture = cvCaptureFromCAM( 1);
int i=0,firsttime=0;
char filename[40];
Mat img1,img2;
if ( !capture ) {
fprintf( stderr, "ERROR: capture is NULL \n" );
getchar();
return -1;
}
cvNamedWindow( "img1", CV_WINDOW_AUTOSIZE );
cvNamedWindow( "img2", CV_WINDOW_AUTOSIZE );
while ( 1 ) {
IplImage* frame = cvQueryFrame( capture );
img1=frame;
if ( !frame ) {
fprintf( stderr, "ERROR: frame is null...\n" );
getchar();
break;
}
if(firsttime==0){
img2=frame;
fprintf( stderr, "firtstime\n" );
}
if ( (cvWaitKey(10) & 255) == 27 ) break;
i++;
sprintf(filename, "D:\\testimg\\img%d.jpg", i);
cv<IP_ADDRESS>cvtColor(img1, img1, CV_BGR2GRAY);
imshow( "img1", img1);
imshow( "img2", img2);
imwrite(filename,img1);
if(identical(img1,img2))
{
//write to diff path
}
img2=imread(filename,1);
firsttime=1;
}
// Release the capture device housekeeping
cvReleaseCapture( &capture );
return 0;
}
While ur at it, I'll be great full if u can suggest a workaround for this using another frame compare solution aswell :)
| 2a625fd291d0938bb9922c851b0728f1345121f95c9f91fbc35ae8a15f0ea881 | ['97280aa4c5694cf997a7e886e4efce39'] | These features are accessible to Profile owners and Device Owners. I would request you to Read about Google EMM and Device Provisioning. Google allows you to use their EMM API to manage devices via a Google EMM Community account. Alternativly you can use various 3rd party EMM or MDM solutions like Kardamom or IBM MaaS360
|
c9f13fdfd7ac9842930ae9b431e39139002a5ef9912752af9c19483cbe55149e | ['972a89bde8f449938211c0f9b378825b'] | I need some advice how to handle the following case. I'm saving an object graph within core data. For simplicity lets say i have a User object (name, age, adress). Adress is another object with some properties. Now the User can change his Adress. If he changes it i need to remember these changes for the next order. After that i need to revert back to the original Adress. The User can also revert back at any time. Where should i save these temporary changes? I thought about adding a new entity like ChangedData but this somehow does not feel right. Basicly i need to remember the original object and if the User changes it i need to remember those for some Time as well. I hope i could express my problem well enough.
| 7961a3b045f6dca9ebe326ea3e51f6a0974ed01381e192d5cfc0dcc6c595a1d5 | ['972a89bde8f449938211c0f9b378825b'] | if i understand your question correct you have to define a class which extends from CssResource (you probably have done that already). In your view you can have a static instance of this class (let's call it cssInstance). In the constructor you have to call cssInstance.ensureInjected(). If you now want to add or set a style you can do it easly like Example: anyWidget.addStyleName(cssInstance.styleBorder());
|
f44443112d56a1481e7fd10d75cdca83d368e7b822b697e9327abd18d4483ffb | ['972fba289daf45a594a04134ebc5e719'] | I have a bot which connects to an IRC channel and reads the chat with a StreamReader. Everything works fine, the bot can read and response, but the problem is the Windows Form is freezing while the StreamReader is active.
while(true)
{
string message = irc.readMessage();
if (message.Contains("!test"))
{
irc.sentChatMessage("answer");
}
}
I tried putting it on a timer instead of the while loop that ticks every 100ms with no change.
the method
public string readMessage()
{
string message = inputStream.ReadLine();
return message;
}
| de10cc1ccf7ee5b582cbab2a9d7e38aa81bcba3a1122aecfe51a3ad2c3c2dc8e | ['972fba289daf45a594a04134ebc5e719'] | ok I found the solution:
currentPlaylist.Uri
That code gives me this: spotify:user:myname:playlist:02DfsHuBWwi1aCp8kxwVrs
but what I need is just the id at the end, so I cut it with
currentPlaylist.Uri.Substring(30)
An imperfect solution, as it will cause errors when the username has a different length than 7, but it works for now.
|
040381e38c5e115d2d2f1b6dda69cbb2b4f20bbb42e9aba2c15d405df6b1a33e | ['9736a98dc52a4004a5d35e8dc100d135'] | enter image description here
I have tried double click method, Thread.sleep, implicit wait , explicit wait(both before and after the element), used xpath, css locators but I still get the org.openqa.selenium.ElementNotInteractableException: element not interactable exception.
This is the latest version of the code;
//selecting student information tab
driver.findElement(By.cssSelector("div.mat-tab-labels>div:nth-child(2)")).click();
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
//enter lastname
// try {
// new
WebDriverWait(driver,10).until(ExpectedConditions.elementToBeClickable(By.cssSelector("ms-text-
field[placeholder='GENERAL.FIELD.LAST_NAME']"))).click();
// driver.findElement(By.cssSelector("ms-text-
field[placeholder='GENERAL.FIELD.LAST_NAME']")).sendKeys("Abuzer");
// } catch (Exception e){}
WebElement lname = driver.findElement(By.xpath("//ms-text-field[@formcontrolname='lastName']"));
lname.click();
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
lname.sendKeys("John");`
I am also sharing the commented parts of what have not worked for me.
| bc272b924ed5100bcf7da511536950944b1b1644a7b22eb73241627c8feeae2d | ['9736a98dc52a4004a5d35e8dc100d135'] | enter image description here
Hi, trying to automate follow button clicks using java but having trouble using the javascriptexecutor in for loop. Here is my code:
List<WebElement>clickOnFollowButton = driver.findElements(By.xpath("//button[contains(text(),'Follow')]"));
for (int i = 0; i < clickOnFollowButton.size() ; i++) {
driver.findElements(By.xpath("//button[contains(text(),'Follow')]")).get(i).click();
((JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView();", clickOnFollowButton);
}
Your help is much appreciated.
|
71853ed073bdb73eb701d4fb346dd67323a468d2b7c5cb43c579039963f5bebf | ['9742ff405c6942c4a719195f84055b1c'] | since you want all pairs (i,j) where i and j are indicies with i lower than j, i dont quite understand why you want <PERSON> here.
int size = v.size();
StringBuffer sb = new StringBuffer(graaf);
for (int i=0;i<size;i++) {
for (int j=i+1;j<size;j++) {
sp.append(v.get(i)+v.get(j)+" ");
}
}
| 9a84b0830285ceaf224a95389adb04d2954693bde98ff2b2fc2432bef94fca03 | ['9742ff405c6942c4a719195f84055b1c'] | All in all there shouldnt be an "optimal" sequence. Its all about understanding the topic. Since not two people can learn with the same speed, there shouldnt be something like an "optimal" sequence. But its good to learn basic approaches of each topic.
There are alot Tutorials out there, which explains the most fundamental thing in any topic. E.g. Youtube covers most graph problems. Even DP and so can be found there. Especially on Topcoder Tutorials there is alot you can learn.
On the other hand you will learn nearly nothing, if u dont have to think for yourself. So solving such puzzles is a must. I would recommend this site (especially for dp). Just check the "problem set" link on the site and look for dynamic programming.
|
d8fa404638008b27793009747acee5bf3a21b64745325018d87c3c2438c14b41 | ['9746f0179035443cab232dc2337e650b'] | Made directories from a list using this:
import os
cwd = os.getcwd()
folders = ['file1','file2','file3']
for folder in folders:
os.mkdir(os.path.join(cwd,folder))
Would also like to add three subdirectories within each of those files, e.g ['sub1','sub2','sub3']
Tried something like this (and other simple-minded approaches) with no success:
import os
cwd = os.getcwd()
folders = ['file1','file2','file3']
subfolders = ['sub1','sub2','sub3']
for folder in folders:
os.makedirs('os.path.join(cwd,folder/subfolders/)')
Any ideas? Thank you!
| 356bb36a8cca479e8bb98afe669886c22b446325e3add5e0fede5c2db98bf700 | ['9746f0179035443cab232dc2337e650b'] | The code below generates a sum from the "Value" column in an ndarray called 'File1.csv'.
How do I apply this code to every file in a directory and place the sums in a new file called Sum.csv?
import pandas as pd
import numpy as np
df = pd.read_csv("~/File1.csv")
df["Value"].sum()
Many thanks!
|
d82448fd2a93167230e557aeafdc1f86ddb86b39f6e1a95ddfeeec2b0d31c1fd | ['97530170a2124468955377f0ff31cf85'] | I have SQL that works perfectly in OracleSQLDeveloper.
basis of the SQL : pulls day and defines the day of the month and then provides the shift and hours for the day in question.
i am trying to make the 3 dates parameters so i can vary them dynamically.
SQL:
select t.*, dsp.day_work_hours as SHIFT from
(select employee, decode( extract(day from date '2016-05-17'), 1, day_1, 2, day_2, 3, day_3, 4, day_4, 5, day_5, 6, day_6,7, day_7,8, day_8,9, day_9,10, day_10, 11, day_11, 12, day_12, 13,day_13, 14,day_14,15,day_15,16,day_16,17,day_17,18,day_18,19,day_19,20,day_20,21,day_21,22,day_22,23,day_23,24,day_24,25,day_25,26,day_26,27,day_27,28,day_28,day_29,30,day_30,31,day_31) as day_shift
from odb.location_site_emp_schl_tmplt
where group_month = extract(month from date '2016-05-17')
and group_year = extract(year from date '2016-05-17')) T
inner join odb.daily_shift_pattern dsp on dsp.day_pattern = t.day_shift
EXCEL Cell formula it's referencing:
=TEXT(today,"YYYY-MM-DD")
the excel cell displays perfectly as well but if i run the SQL with parameters it states "expression missing"
any ideas why this isn't working?
| 21c734df50d2fbdeea7277042ea4dbd7982d1dd1dac3148d25dd0a2b2330ec41 | ['97530170a2124468955377f0ff31cf85'] | can anyone see why i'd be getting this error in my code?
if i remove the error trapping it works fine but can't see what the issue is with the error trapping.
thanks
= simple_form_for @pic, html: { multipart: true } do |f|
- if @pic.errors.any?
#errors
%h2
= pluralize(@pic.errors.count, "error")
prevented this Pic from saving
%ul
- @pic.errors.full_message.each do |msg|
%li= msg
.form-group
= f.input :title, input_html: { class: 'form-control' }
.form-group
= f.input :description, input_html: { class: 'form_control' }
= f.button :submit, class: "btn btn-info"
|
5c4d79cc5f7482d7291ab26e676d2af64cb0a63b47b1c5fb5bd40107a75e11b8 | ['9763a97c2cf64b5da80e98c66bcb7387'] | I had to do some jython scripting for a websphere server. It must be a really old version of python it didn't have the ** operator or the len() function. I had to use an exception to find the end of a string.
Anyways I hope this saves someone else some time
def pow(x, y):
total = 1;
if (y > 0):
rng = y
else:
rng = -1 * y
print ("range", rng)
for itt in range (rng):
total *= x
if (y < 0):
total = 1.0 / float(total)
return total
#This will return an int if the percision restricts it from parsing decimal places
def parseNum(string, percision):
decIndex = string.index(".")
total = 0
print("decIndex: ", decIndex)
index = 0
string = string[0:decIndex] + string[decIndex + 1:]
try:
while string[index]:
if (ord(string[index]) >= ord("0") and ord(string[index]) <= ord("9")):
times = pow(10, decIndex - index - 1)
val = ord(string[index]) - ord("0")
print(times, " X ", val)
if (times < percision):
break
total += times * val
index += 1
except:
print "broke out"
return total
Warning! - make sure the string is a number. The function will not fail but you will get strange and almost assuredly, useless output.
| 67bfc3a82751595cf6751c7102097408a4c8a76dc7d4265b5cefdeaf237978f1 | ['9763a97c2cf64b5da80e98c66bcb7387'] | Disclaimer This is by no means standard and there could very well be a better spring way of doing this. None of the above answers address the issues of wiring a public static field.
I wanted to accomplish three things.
Use spring to "Autowire" (Im using @Value)
Expose a public static value
Prevent modification
My object looks like this
private static String <PERSON> = "testBranch";
@Value("${content.client.branch}")
public void finalSetBranch(String branch) {
<PERSON> = branch;
}
public static String BRANCH() {
return <PERSON>;
}
We have checked off 1 & 2 already now how do we prevent calls to the setter, since we cannot hide it.
@Component
@Aspect
public class FinalAutowiredHelper {
@Before("finalMethods()")
public void beforeFinal(JoinPoint joinPoint) {
throw new FinalAutowiredHelper().new ModifySudoFinalError("");
}
@Pointcut("execution(* com.free.content.client..*.finalSetBranch(..))")
public void finalMethods() {}
public class ModifySudoFinalError extends Error {
private String msg;
public ModifySudoFinalError(String msg) {
this.msg = msg;
}
@Override
public String getMessage() {
return "Attempted modification of a final property: " + msg;
}
}
This aspect will wrap all methods beginning with final and throw an error if they are called.
I dont think this is particularly useful, but if you are ocd and like to keep you peas and carrots separated this is one way to do it safely.
Important Spring does not call your aspects when it calls a function. Made this easier, to bad I worked out the logic before figuring that out.
|
489323a5fa12b368fc882b9384621a775712de232f3376583ffdd81912a2cd08 | ['97827808ad584641bf5b1c5779460246'] | im running Windows 8.1 inside Parallels Desktop 9 in Mavericks (mac)
I have an ASUS Xonar Essence STX soundcard (PCI-Express) connected, is there any hope of making it work inside the windows virtual machine it parallels?
By default it won't detect it ofcourse - http://take.ms/qgxZe - the card isn't showing up in Sound or Device manager and the installation process for the STX drives dies saying that it's not connected, though it IS connected, and works fine on a natural windows system booted from another SSD drive (I have dualboot).
I'm aware that the card itself is deadly incompatible with macs and it's not really designed to work that way but still, is there anything possible to play around to make it work inside a parallels virtual machine?
| 636ecfe3bb8bce89161c12a41f767536341bba4e2c4f373d2d1a6053d462222f | ['97827808ad584641bf5b1c5779460246'] | The Windows 8.1 native camera app started acting weird: when turning it on it shows the camera image with an incredibly small framerate of around 2-3 fps, instead of the usual smooth 18-30fps.
When I open the camera in some other application like Skype or OpenBroadcasterSoftware everything works just fine so it's clearly not the hardware webcam problem.
When you click on the video button inside the windows camera app - the image jumps to the normal framerate aswell, but only until you end with making the video and go back to the photo mode; the pics themselve also end up alright, only the experience of making them ain't the best because of the sucky framerate.
The camera app wasn't always weird like this, it used to have the solid framerate until something like a month ago when it has changed completely spontaneously, I can't recall any program installation or other event that could be the cause.
I'm using Windows 8.1 Pro and the Logitech HD Pro Webcam C920.
Any help on fixing this highly appreciated!
|
805594f9c9cbbb55dc7778a929f4886d4d139548b3c66d8d86ddeed9fc96058e | ['9794d29ecdec4b2b910e403af009da4b'] | I am trying to figure out google apps script, which will move files from one parental folder to the subfolders based on part of files name. I am using one mail merge script to automatically create letters and documentation. Every file has an unique code in his name (for ex. file name is: "Lepic - KN - 28541 - 2013.pdf", where the "28541 - 2013" is the unique code) and for every unique code exist one subfolder (folder name: "Lepic - 28541 - 2013").
So in parental folder it basically looks like this:
Lepic - KN - 28541 - 2013.pdf
Lepic - RV - 28541 - 2013.pdf
Novak - KN - 15427 - 2013.pdf
Michal - Vozidla - 11125 - 2012.pdf
etc etc ...
Now I have to move every file to his folder manually, which is really annoying even with only 20+ files.
Does anybody know how to modifity this script (listened in google script examples) to sort files to folders based on theirs unique code automatically?
function moveFileToFolder(fileId, targetFolderId) {
var targetFolder = DocsList.getFolderById(targetFolderId);
var file = DocsList.getFileById(fileId);
file.addToFolder(targetFolder);
};
Thank you!
| 4dfb56914c6d7cbd28b753502e01dcb578400dad043cebddd985847c607b20a7 | ['9794d29ecdec4b2b910e403af009da4b'] | I took the fooby´s code and after long trial-and-error procedure I came with code that is working for me, so if anyone is interested, here it is:
function ShowDataFromOtherSheet() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheetByName("Databaze");
var ids = sheet.getRange(2, 1, sheet.getLastRow() - 1).getValues();
for (var i = 0; i < ids.length; i++) {
var id = ids[i];
var ssraw = SpreadsheetApp.openById(id);
var sheetraw = ssraw.getSheetByName("Raw");
var range = sheetraw.getRange("A2:AB2");
var data = range.getValues();
sheet.getRange(i + 2, 2, 1, data[0].length).setValues(data)
}
}
And thank you <PERSON> - i would not make it without your help!
|
d2ac139a16214d4b3a1e03b50ebf8b1bb723fd77d799b0df4b3a71d0b2e905cd | ['97960174df024f43b5117b8758bf3e5c'] | I'm wrestling with these last few days. I found lots of links, but none of them really helped me. I'm quite a beginner in WPF.
All I need is to reach SelectedItem property in nested ListView.
Outter ListView binding works, of course.
What I tried after some research and doesn't work, even I don't really understand why it dosnt work:
<Window x:Class="ListViewRef.View.ListViewWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:ListViewRef.ViewModel"
xmlns:local="clr-namespace:ListViewRef.View"
mc:Ignorable="d"
Title="Nested List Views" Height="450" Width="800">
<Window.DataContext>
<vm:MainVM/>
</Window.DataContext>
<StackPanel x:Name="Global">
<TextBlock Text="{Binding MainTitle}"/>
<ListView ItemsSource="{Binding Path=SourceCollection}"
SelectedItem="{Binding Path=OutterSelectedItem}"
>
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding Title}"/>
<TextBlock Text="Now second ListView:"/>
<ListView ItemsSource="{Binding Strings}"
SelectedItem="{Binding Path=NestedSelectedItem,
RelativeSource={RelativeSource AncestorType=vm:MainVM},
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}"
></ListView>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackPanel>
</Window>
And ViewModel:
using ListViewRef.Model;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
namespace ListViewRef.ViewModel
{
public class MainVM : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
private string mainTitle;
public string MainTitle {
get { return mainTitle; }
set { mainTitle = value; OnPropertyChanged(nameof(MainTitle)); }
}
private string nestedSelectedItem;
public string NestedSelectedItem {
get { return nestedSelectedItem; }
set
{
nestedSelectedItem = value;
MessageBox.Show("NestedSelectedItem: " + nestedSelectedItem);
OnPropertyChanged(nameof(NestedSelectedItem));
}
}
private string outterSelectedItem;
public string OutterSelectedItem {
get { return outterSelectedItem; }
set
{
outterSelectedItem = value;
MessageBox.Show("OutterSelectedItem: " + OutterSelectedItem);
OnPropertyChanged(nameof(OutterSelectedItem));
}
}
public ObservableCollection<ClassWithObsList> SourceCollection { get; set; }
public MainVM()
{
MainTitle = "Title of the Grid";
SourceCollection = new ObservableCollection<ClassWithObsList> {
new ClassWithObsList("First Title", new ObservableCollection<string> { "First", "Second"}),
new ClassWithObsList("Second Title", new ObservableCollection<string> { "Third", "Fourth"}),
new ClassWithObsList("Third Title", new ObservableCollection<string> { "Fifth", "Sixth"}),
};
}
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Model class:
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace ListViewRef.Model
{
public class ClassWithObsList : INotifyPropertyChanged
{
private string title;
public string Title {
get { return title; }
set {
title = value;
OnPropertyChanged(nameof(Title));
}
}
public ObservableCollection<string> Strings { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
public ClassWithObsList(string title, ObservableCollection<string> strings)
{
Title = title ?? throw new ArgumentNullException(nameof(title));
Strings = strings ?? throw new ArgumentNullException(nameof(strings));
}
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
| 0bf9b903fbcddfffc827de3ad4ef2c205ea6241763e637273d981a31ceb58be3 | ['97960174df024f43b5117b8758bf3e5c'] | I made this minimalistic project to learn output and input with user control and it's working as intended. I want to ask, is this a good approach or is there something which is not necessary?
I also want to post this, because there is tons of post with specific user cases, but not one with a simple example to learn binding mechanics.
Main Window:
<Window x:Class="OutputFromUserControl.View.OutputFromUserControlWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OutputFromUserControl.View"
xmlns:uc="clr-namespace:OutputFromUserControl.View.Controls"
xmlns:vm="clr-namespace:OutputFromUserControl.ViewModel"
mc:Ignorable="d"
Title="Output From User Control" Height="450" Width="800">
<Window.DataContext>
<vm:MainVM x:Name="MainVM"/>
</Window.DataContext>
<StackPanel HorizontalAlignment="Left">
<Label Content="Form elements:"/>
<Border CornerRadius="5" BorderBrush="Blue" BorderThickness="1">
<Grid HorizontalAlignment="Left" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Label Content="Name Input: " Grid.Row="0" Grid.Column="0"/>
<TextBox Grid.Row="0" Grid.Column="1"
Text="{Binding NameInput, UpdateSourceTrigger=PropertyChanged}"
Width="200"
/>
<Label Content="Surname Input: " Grid.Row="1" Grid.Column="0"/>
<TextBox Grid.Row="1" Grid.Column="1"
Text="{Binding SurnameInput, UpdateSourceTrigger=PropertyChanged}"
Width="200"
/>
<Label Content="Name Output from Control: " Grid.Row="2" Grid.Column="0"/>
<TextBlock Grid.Row="2" Grid.Column="1"
Text="{Binding FullName}"
Width="200"
/>
</Grid>
</Border>
<Label Content="User Control:" Margin="0,10,0,0"/>
<Border CornerRadius="5" BorderBrush="Red" BorderThickness="1">
<uc:NameConcatControl x:Name="NameUC"
NameInput="{Binding NameInput}"
SurnameInput="{Binding SurnameInput}"
NameOutput="{Binding FullName, Mode=TwoWay}"
/>
</Border>
</StackPanel>
</Window>
MainVM:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
namespace OutputFromUserControl.ViewModel
{
public class MainVM : INotifyPropertyChanged
{
private string nameInput;
public string NameInput {
get { return nameInput; }
set
{
nameInput = value;
OnPropertyChanged(nameof(NameInput));
}
}
private string surnameInput;
public string SurnameInput {
get { return surnameInput; }
set {
surnameInput = value;
OnPropertyChanged(nameof(SurnameInput));
}
}
private string fullName;
public string FullName {
get { return fullName; }
set {
fullName = value;
OnPropertyChanged(nameof(FullName));
}
}
public event PropertyChangedEventHandler PropertyChanged;
private void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Control xaml:
<UserControl x:Class="OutputFromUserControl.View.Controls.NameConcatControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:OutputFromUserControl.View.Controls"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<Label Content="Name Input: " Grid.Row="0" Grid.Column="0"/>
<TextBlock Grid.Row="0" Grid.Column="1"
Text="{Binding NameInput}"
x:Name="NameInputTextBlock"
/>
<Label Content="Surname Input: " Grid.Row="1" Grid.Column="0"/>
<TextBlock Grid.Row="1" Grid.Column="1"
Text="{Binding SurnameInput}"
x:Name="SurnameInputTextBlock"
/>
<Label Content="Name Output: " Grid.Row="2" Grid.Column="0"/>
<TextBlock Grid.Row="2" Grid.Column="1"
Text="{Binding NameOutput}"
x:Name="OutputNameTextBlock"
/>
</Grid>
</UserControl>
User control .cs:
using System.Windows;
using System.Windows.Controls;
namespace OutputFromUserControl.View.Controls
{
/// <summary>
/// Interaction logic for NameConcatControl.xaml
/// </summary>
public partial class NameConcatControl : UserControl
{
public string NameInput {
get { return (string)GetValue(NameInputProperty); }
set { SetValue(NameInputProperty, value); }
}
public static string defaultNameInput = "NameInput";
public static readonly DependencyProperty NameInputProperty =
DependencyProperty.Register("NameInput", typeof(string), typeof(NameConcatControl), new PropertyMetadata(defaultNameInput, SetNameOutput));
public string SurnameInput {
get { return (string)GetValue(SurnameInputProperty); }
set { SetValue(SurnameInputProperty, value); }
}
public static string defaultSurnameInput = "Surname Input";
public static readonly DependencyProperty SurnameInputProperty =
DependencyProperty.Register("SurnameInput", typeof(string), typeof(NameConcatControl), new PropertyMetadata(defaultSurnameInput, SetNameOutput));
public string NameOutput {
get { return (string)GetValue(NameOutputProperty); }
set { SetValue(NameOutputProperty, value); }
}
public static string defaultNameOutput = "Name Output";
public static readonly DependencyProperty NameOutputProperty =
DependencyProperty.Register("NameOutput", typeof(string), typeof(NameConcatControl), new PropertyMetadata(defaultNameOutput));
private static void SetNameOutput(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
NameConcatControl control = (NameConcatControl)d;
string nameInput = "";
string surnameInput = "";
if(e.Property.Name == "NameInput")
{
string newValue = (string)e.NewValue;
nameInput = string.IsNullOrEmpty(newValue) ? "" : newValue;
}
else
{
nameInput = string.IsNullOrEmpty(control.NameInputTextBlock.Text)
? ""
: control.NameInputTextBlock.Text;
}
if(e.Property.Name == "SurnameInput")
{
string newValue = (string)e.NewValue;
surnameInput = string.IsNullOrEmpty(newValue) ? "" : newValue;
}
else
{
surnameInput = string.IsNullOrEmpty(control.SurnameInputTextBlock.Text)
? ""
: control.SurnameInputTextBlock.Text;
}
string fullName = $"{nameInput} {surnameInput}";
control.OutputNameTextBlock.Text = fullName;
control.NameOutput = fullName;
}
public NameConcatControl()
{
InitializeComponent();
}
}
}
|
799f6d9702de6917fc425f10b4571bbb47d958434298b2691dc8ca7b1146aeef | ['97c32ddfd94e440b95fe7f920da14a69'] | I'm a beginner and I am wondering if anyone who uses Splunk to monitor SQL server has successfully set up tracking for memory dumps.
As you may know, when a memory dump occurs in SQL Server, a file is created in the root of the SQL server log directory as a .mdmp or .dmp. All we would like to do is be able to keep track of when this memory dump happens and on what server, as indicated by the existence of these files. However, as far as I know, Splunk would not be able to track these files, since it would be scanning a folder looking for new .dmp files, and not indexing a log file that is then searched on.
We have indexes set up for wineventlog, perfmon, and mssql, but to my knowledge, a SQL server memory dump event is not actually logged in any of the related sources types like the general SQL server error log (a related event might, but it would not indicate itself as being related to a memory dump). I might be wrong about this though, and perhaps someone can correct me that this is logged somewhere common that Splunk would be able to consume.
I have also considered that there is a view (sys.dm_server_memory_dumps) that records these events, but we only know of two ways to get that into splunk. One is to set up a sql agent job that would query that table and output it as a file that splunk can then ingest, or to use the sql db connection plugin with splunk, but this has the issue that as far as I know it doesn't use a connection pool, which is a problem for us.
I am wondering how the community has approached this problem, any input appreciated, thank you!
| 96dd27329e5cde4c6dc00aead3bc5ae5c4789ab9737895c736ec4c7ee8dd6de8 | ['97c32ddfd94e440b95fe7f920da14a69'] | I'm wondering what I'm missing here. I have a powershell script that calls another script with some parameters to execute as a way to keep things tidy. Here is what works:
C:\Scripts\Project\coolscript.ps1 -projname 'my.project' -domain 'work'
I want others to be able to use this script without having to change anything, so I thought I could make the path relative instead of the full one starting from C: so I thought I could execute the script like this:
$pathname = $PSScriptRoot + '\coolscript.ps1'
$pathname -projname 'my.project' -domain 'work'
however I get an error that says 'unexpected token in expression or statement for everything after $pathname
ANy ideas what I'm missing? Thank you
|
e604bb983e64b32e8f3f5e6f2da5cfe41e205a0138c5c071a2f87165aef6df8f | ['97c47528a2794ba8ae9c80294fc2ba52'] | i had an html file, and in order to test it with jasmine, I seperated it into an html file and .js file and added
<script type="text/javascript" src="myFile.js"></script>
to my html file and then I put both files in the src folder of Jasmine. now when i want to test, it does not recognize the function in js file and says has no method.
For example, when i write this:
describe("my function", function(){
it("Should return correct value" , function(){
expect(myFunc(50)).toEqual(50)
})
});
Thanks for your help.
| 638836391aa052793306ab16bec8adcce6ecd110162be8772e828b6c5db6bba8 | ['97c47528a2794ba8ae9c80294fc2ba52'] | I have an issue regarding getting the value of a hashmap in this form <String, List<time,value>>. If I want to simplify my problem the data structure is in the following format:
{data1=[fetchTime=123, value=1], [fetchTime=124, value=8], [fetchTime=125,value=0],
data2=[fetchTime=123, value=3], [fetchTime=124, value=8], [fetchTime=125, value=6], data3=[fetchTime=123, value=6], [fetchTime=124, value=9], [fetchTime=125, value=1]}
What I want to do is to calculate the sum of the values of the "same" fetch time. so basically I want to sum up the values of the fetch time of 123 which is (1+3+6) and for fetch time of 124 (8+8+9) and so on.
At this point I just care about the algorithm or any hint not the exact running code, so please suggest me how to do that.
Thank you!
|
583ca16ad83e2d49c5503c5b73e5950d41ec0a48543afb6c98a6a08fb4f2ad53 | ['97c9ee8008174441bc3dc06cf697f4ff'] | In REST controller I have several methods on which I need to create contract test and I don't know how to provide Principal for passing tests.
One of the method in Controller which has Principal in parameters:
@PreAuthorize("hasRole('USER')")
@GetMapping("/current")
public Details getCurrent(Principal principal) {
return houseManager.getById(Principals.getCurrentUserId(principal));
}
I've created base class for tests:
@RunWith(SpringRunner.class)
@WebMvcTest(controllers = {Controller.class})
@ContextConfiguration(classes = {TestConfig.class, ControllerTestConfig.class})
@ComponentScan(basePackageClasses = {Controller.class})
@AutoConfigureStubRunner
public class ControllersWithSecurityBase {
@Autowired
privet Service service;
@Autowired
WebApplicationContext context;
@Mock
private Principal mockedPrincipal;
RestAssuredMockMvc.standaloneSetup(new Controller(service));
RequestBuilder requestBuilder = MockMvcRequestBuilders
.get("/")
.with(user("user")
.password("password")
.roles("USER"))
.principal(mockedPrincipal)
.accept(MediaType.APPLICATION_JSON);
MockMvc mockMvc = MockMvcBuilders
.webAppContextSetup(context)
.defaultRequest(requestBuilder)
.apply(springSecurity())
.build();
RestAssuredMockMvc.mockMvc(mockMvc);
}
Contract:
Contract.make {
name("Should find current by principal")
request {
method(GET)
urlPath(".../current")
}
response {
status(200)
}
}
As result of mvn clean install I've got next exception:
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.ClassCastException: org.springframework.security.authentication.UsernamePasswordAuthenticationToken cannot be cast to java.util.Map
What I need to do for correct mocking Principal and passing tests?
| fed60f2bfa58a0b1f4ebbc0b04c0325cf2afb4d397c77e9afdb7dcd9ee0317ef | ['97c9ee8008174441bc3dc06cf697f4ff'] | My project use Oauth2 security.
So for mocking Principal object in contract tests I've created bean of OAuth2AuthenticationDetails (this class implements Principal interface).
Class configuration with bean OAuth2AuthenticationDetails is:
package com.example.config.fakesecurityconfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.security.authentication.TestingAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.oauth2.provider.OAuth2Authentication;
import org.springframework.security.oauth2.provider.OAuth2Request;
import org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationDetails;
import java.util.*;
@Configuration
public class OAuth2TestConfig {
@Bean
public OAuth2Authentication oAuth2Authentication() {
return new OAuth2Authentication(getStoredRequest(), getUserAuthentication());
}
@Bean
public OAuth2AuthenticationDetails oAuth2AuthenticationDetails() {
MockHttpServletRequest request = new MockHttpServletRequest();
return new OAuth2AuthenticationDetails(request);
}
private OAuth2Request getStoredRequest() {
Set<String> scope = new HashSet<>();
scope.add("read");
scope.add("write");
return new OAuth2Request(
Collections.EMPTY_MAP,
"clientId",
getGrantedAuthorityCollection(),
true,
scope,
Collections.EMPTY_SET,
null,
Collections.EMPTY_SET,
Collections.EMPTY_MAP);
}
private Authentication getUserAuthentication() {
String credentials = "PROTECTED";
Authentication authentication = new TestingAuthenticationToken(getPrincipalMap(), credentials, getGrantedAuthorityAsList());
return new OAuth2Authentication(getStoredRequest(), authentication);
}
private Map<String, String> getPrincipalMap() {
Map<String, String> principalMap = new LinkedHashMap<>();
principalMap.put("id", "5c49c98d3a0f3a23cd39a720");
principalMap.put("username", "TestUserName");
principalMap.put("password", "TestPassword");
principalMap.put("createdAt", "2018-06-14 10:35:05");
principalMap.put("userType", "USER");
principalMap.put("authorities", getGrantedAuthorityCollectionAsMap().toString());
principalMap.put("accountNonExpired", "true");
principalMap.put("accountNonLocked", "true");
principalMap.put("credentialsNonExpired", "true");
principalMap.put("enabled", "true");
principalMap.put("uniqueId", "null");
principalMap.put("uniqueLink", "fc3552f4-0cdf-494d-bc46-9d1e6305400a");
principalMap.put("uniqueLinkCreatedAt", "2019-09-06 10:44:36");
principalMap.put("someId", "59b5a82c410df8000a83a1ff");
principalMap.put("otherId", "59b5a82c410df8000a83a1ff");
principalMap.put("name", "TestName");
return principalMap;
}
private Collection<GrantedAuthority> getGrantedAuthorityCollection() {
return Arrays.asList(
new SimpleGrantedAuthority("ROLE_ADMIN"),
new SimpleGrantedAuthority("ROLE_USER")
);
}
private List<GrantedAuthority> getGrantedAuthorityAsList() {
return new ArrayList<>(getGrantedAuthorityCollection());
}
private LinkedHashMap<String, GrantedAuthority> getGrantedAuthorityCollectionAsMap() {
LinkedHashMap<String, GrantedAuthority> map = new LinkedHashMap<>();
for (GrantedAuthority authority : getGrantedAuthorityCollection()) {
map.put("authority", authority);
}
return map;
}
}
As result my base class for contract tests is:
@RunWith(SpringRunner.class)
@WebMvcTest(controllers = {Controller.class})
@ContextConfiguration(classes = {TestConfig.class, OAuth2TestConfig.class})
@ComponentScan(basePackageClasses = {Controller.class})
@AutoConfigureStubRunner
@WebAppConfiguration
public abstract class HousesControllersSecuredBase {
@Autowired
private Service service;
@Autowired
private WebApplicationContext context;
@Autowired
private OAuth2Authentication oAuth2Authentication;
@Autowired
private OAuth2AuthenticationDetails oAuth2AuthenticationDetails;
@Autowired
private MockMvc mockMvc;
@Before
public void settingUpTests() {
RestAssuredMockMvc.standaloneSetup(Controller(houseService));
mockMvc = MockMvcBuilders
.webAppContextSetup(context)
.build();
RestAssuredMockMvc.mockMvc(mockMvc);
oAuth2Authentication.setDetails(oAuth2AuthenticationDetails);
RestAssuredMockMvc.authentication =
RestAssuredMockMvc.principal(oAuth2Authentication);
}
@After
public void ShuttingDownTests() {
RestAssuredMockMvc.reset();
}
}
|
237b824a0ed9313c727884eaf103cccf6ac257cdc79f2fd93ffa72b60aa63f43 | ['97cc535684f74ebf83433f428bb8356a'] | @reducingactivity that's quite limiting, though. For example, I need to open plain text files with Text Editor, and Asciidoc (.adoc) files with Atom, but they are recognized as plain text files too, so if I change the default application it'll open them always with Text Editor or always with Atom, which forces me to open them by selecting the proper application every time... it's not strange they're not mapped to a separate mimetype by default, but not having the change to add new mimetypes... meh! | 28de797292ac9be759663f804068f8d6f3ac6495e382aaa5116f0d6260f42491 | ['97cc535684f74ebf83433f428bb8356a'] | Alexa estimates website traffic by extrapolating the data from the browsing sessions of the subset of the Internet population who use the Alexa toolbar or browser extensions. This isn't a truly random sample, so questions are raised over the accuracy of such data:
http://en.wikipedia.org/wiki/Alexa_Internet#Accuracy_of_ranking_by_the_Alexa_Toolbar
Installing the Alexa toolbar modifies the browser user-agent, so you can estimate the % of visitors to your site who are contributing data to Alexa by scanning your server logs for requests with the appropriate user-agent strings.
|
c5e3019aa0320b542a568f636ebf98b482ea3aa41030b7655a03d43d82fe169a | ['97e5ffd362da463b926ffddeb4374021'] | I just downloaded and wrote the Raspbian Stretch headless image to a micro SD card. I added a DHCP configuration to give the ethernet adapter a <IP_ADDRESS> address. I then gave my desktop PC's ethernet adapter an address of <IP_ADDRESS> and connected the PC to the raspberry pi with an ethernet cable.
I tested that I am able to ping the raspberry pi on <IP_ADDRESS> so I know I'm able to communicate with it.
I then followed the instructions in item #3 of the remote access readme by placing a single empty file named ssh in the root of the boot partition. I mounted this partition on a linux system and verified it contains all the raspbian boot files (such as cmdline.txt).
When I put the SD card back into the pi and boot, the ssh file is not removed and I always get a connection refused message when attempting to ssh into the pi. Any clue what's going wrong? I used the headless image and this method of access to avoid using a separate monitor and keyboard so the fact that this isn't working is kind of a pain.
| 01442ef1aa5da082fce24069014e43fba973775045fe7e3d6da2165795b3881f | ['97e5ffd362da463b926ffddeb4374021'] | I was able to get this working by modifying the sshswitch.service file to look for the ssh file in / instead if /boot. Then I created the ssh file in the root of the rootfs partition. Below is the modified sshswitch.service which is located at /lib/systemd/system/sshswitch.service.
[Unit]
Description=Turn on SSH if /ssh is present
ConditionPathExistsGlob=/ssh{,.txt}
After=regenerate_ssh_host_keys.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "update-rc.d ssh enable && invoke-rc.d ssh start && rm -f /ssh ; rm -f /ssh.txt"
[Install]
WantedBy=multi-user.target
This is what I did to work around my issues, this is not a "fix" for the issue but it might help someone else in the same situation.
|
c63c366a433cfa7fd9127c3ed4c5912948581d074dbe4742523338c7ecbc69ed | ['97ef064d31f74de0b0ad406fd5a57e74'] | When you pass in a pointer to struct big, the very first thing it points to will be big.small.a, so after your first ld instruction, you've already got the value of big.small.a in %l0. If you try to dereference it again as a pointer, it's not surprising that you get a segfault. So basically what I'm saying is this:
ld [%i0], %l0 /* gives big.small.a */
ld [%i0+4], %l0 /* gives big.small.b */
| 68a5a7183e6ce7ddf5f0607c5466bdbfc741fe94e057f20d444053395f153b93 | ['97ef064d31f74de0b0ad406fd5a57e74'] | Looks to me like you did execute the jump, and it got to program B, as evidenced by the addresses of the instructions in the trace buffer. But where you crashed was in stdio trying to print stuff. Stdio makes extensive use of function pointers, and the sequence clearly shows a call instruction with the target address in a register, which indicates use of a function pointer.
I suggest putting fflush(stdout) in program A just before the jump, and this will allow you to see the messages before doing the jump. Then, in program B, instead of using printf, just put some known value in memory that you can examine later via the monitor to verify that it got there.
My guess is that the stdio library has some data or parameter that needs to be set up at the start of the program, and that's not being done or not done properly. Not sure about the platform you are running on, but do you have some sort of debugging or single stepping ability, like in a debugger? If so, just single step through the jump and follow where the program goes.
|
37c966df14a7203cc26b5c6f1cfa47af3340d01332f953e341c1162143d5c0b3 | ['97f394fa51f245b5aed61333ba230e02'] | I need to get the path of the web/uploads folder from the entity, this is my code:
<?php
class Product{
protected $id;
...
protected $imageName;
protected $file;
...
public function getAbsolutePath(){
return null === $this->imageName ? null : $this->getUploadRootDir().'/'.$this->imageName;
}
public function getWebPath(){
return null === $this->imageName ? null : $this->getUploadDir().'/'.$this->imageName;
}
protected function getUploadRootDir($basepath){
// the absolute directory path where uploaded documents should be saved
return $basepath.$this->getUploadDir();
}
protected function getUploadDir(){
// get rid of the __DIR__ so it doesn't screw when displaying uploaded doc/image in the view.
return 'uploads/products';
}
public function upload($basepath){
// the file property can be empty if the field is not required
if (null === $this->file) {
return;
}
if (null === $basepath) {
return;
}
// we use the original file name here but you should
// sanitize it at least to avoid any security issues
// move takes the target directory and then the target filename to move to
$this->file->move($this->getUploadRootDir($basepath), $this->file->getClientOriginalName());
// set the path property to the filename where you'ved saved the file
$this->setImageName($this->file->getClientOriginalName());
// clean up the file property as you won't need it anymore
$this->file = null;
}
}
And this is the Admin class
<?php
class Product extends Admin {
...
protected function configureFormFields(FormMapper $formMapper) {
$formMapper
->with('General')
...
->add('file', 'file', array('required' => false))
...
->end()
;
}
...
public function prePersist($product) {
$this->saveFile($product);
}
public function preUpdate($product) {
$this->saveFile($product);
}
public function saveFile($product) {
$basepath = $this->getRequest()->getBasePath();
$product->upload($basepath);
}
}
The name of the file is updated well, but the image don't copy at the path web/uploads.
source: http://blog.code4hire.com/2011/08/symfony2-sonata-admin-bundle-and-file-uploads/
| 33bef4c9a222e96afda73dea055c7ddfd7ea6acba9e25e3b4971af29b94cd9af | ['97f394fa51f245b5aed61333ba230e02'] | It depends on the OS you use, for Windows, NetBeans is a good choice. Paragraph git installed using the console and composer to create New Projects Symfony.
Should also have installed WAMP or XAMPP
from the console git:
composer create-project symfony/framework-standard-edition my_project_name
In netbeans:
Activate PHP in Netbeans (https://netbeans.org/kb/docs/php/configure-php-environment-windows.html)
Then in Netbeans open project > path_project_folder_www
Right click on the project > properties, and change the project path:
something like this
|
43cce67ec6fe2652e679c2477324ea565196d77fc3fae01b6cff2efc3a500e66 | ['97f4ed2af0884b9184951656a85c2922'] | So i have a server which I send a Request to and it sends me back a list of rooms,Now i made a window for joining rooms and I'm trying to refresh it every 3 seconds but when i use the Timer thread to refresh the list it doesn't work if I use the normal refresh method with the Timer it works just fine.
Here's some code:
private void AutoRefresh()
{
System.Timers.Timer timer = new System.Timers.Timer(TimeSpan.FromMilliseconds(3000).TotalMilliseconds);
timer.AutoReset = true;
timer.Elapsed += new System.Timers.ElapsedEventHandler(this.Refresh);
timer.Start();
}
private void Refresh(object sender, System.Timers.ElapsedEventArgs elapsedEventArg)
{
GetRoomsResponse response;
response = SendAndRecv();
Button temp;
foreach (RoomData room in response.rooms)
{
temp = new Button { Content = room };
temp.Click += (sender, e) =>
{
JoinRoomClick(sender, e);
};
temp.Content = room.Name;
buttons.Add(temp);
}
ListBoxRooms.ItemsSource = buttons;
}
If I call refresh from the main it works perfectly if I call AutoRefresh it doesn't I think it gets stuck on the for each loop no error's just doesn't do it's job
| 84f4531d077d9c39371d97e088166b7bf2934992d9b914899ea92c6e0b78a373 | ['97f4ed2af0884b9184951656a85c2922'] | I tried to re-install Pokemon Go and I keep getting "authentication error. must sign in to Google account." I'm signed into my Google account. I am logged into my Pokemon Go account at Pokemon.com. I had the app installed on my one previously, then it stopped working I kept getting a retry message. So, I deleted it to start over. Obviously that did no good, and just made it worse. I've looked at many of the Q&A on the internet and nothing resolves my issue. Same with going to Niantic. Any answers?
|
073547fbfee0abe2029e2751bffc605e6271501aef7c66d3295d1f6de240dc83 | ['97f7e06ee2944fa186935ed3d154d575'] | Hi try this code....
package my.test.service;
import java.util.Properties;
import javax.mail.Authenticator;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Message;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
public class Sample {
public static void main(String args[]) {
final String SMTP_HOST = "smtp.gmail.com";
final String SMTP_PORT = "587";
final String GMAIL_USERNAME = "<EMAIL_ADDRESS>";
final String GMAIL_PASSWORD = "xxxxxxxxxx";
System.out.println("Process Started");
Properties prop = System.getProperties();
prop.setProperty("mail.smtp.starttls.enable", "true");
prop.setProperty("mail.smtp.host", SMTP_HOST);
prop.setProperty("mail.smtp.user", GMAIL_USERNAME);
prop.setProperty("mail.smtp.password", GMAIL_PASSWORD);
prop.setProperty("mail.smtp.port", SMTP_PORT);
prop.setProperty("mail.smtp.auth", "true");
System.out.println("Props : " + prop);
Session session = Session.getInstance(prop, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(GMAIL_USERNAME,
GMAIL_PASSWORD);
}
});
System.out.println("Got Session : " + session);
MimeMessage message = new MimeMessage(session);
try {
System.out.println("before sending");
message.setFrom(new InternetAddress(GMAIL_USERNAME));
message.addRecipients(Message.RecipientType.TO,
InternetAddress.parse(GMAIL_USERNAME));
message.setSubject("My First Email Attempt from Java");
message.setText("Hi, This mail came from Java Application.");
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(GMAIL_USERNAME));
Transport transport = session.getTransport("smtp");
System.out.println("Got Transport" + transport);
transport.connect(SMTP_HOST, GMAIL_USERNAME, GMAIL_PASSWORD);
transport.sendMessage(message, message.getAllRecipients());
System.out.println("message Object : " + message);
System.out.println("Email Sent Successfully");
} catch (AddressException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MessagingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| ac61ba86a7a30cb6d7f0363810eb1a1e48e24b4752287321770a1ccab3603a77 | ['97f7e06ee2944fa186935ed3d154d575'] | I am newbie to camel. Let me explain my business requirement, i have some 10 files in Folder A. In particular time all these 10 files will be processed and do the business logic and move the files to Folder B. Each file place one done file respectively. I need to process files from Folder B for next business operation. But i need to start this process only when all the 10 done files are placed. until complete all the 10 files in my previous process, i should not start this process. How to do this in camel.
Note:
i dont want to use any cron for my second route.
10 file is assumption. it may be dynamic
Thanks in advance
|
71561f9c8b2ee688aedc202b60fc4fb8c55d8d133dede42a0f7709b46f3eda74 | ['980f04f4111d46bbbb8981a64743f025'] | I think <PERSON> put the Book of Mormon into the religious language he was familiar with - that of the King James Bible. Any translator has the choice of vernacular to put a work into and he thought this sounded appropriate for a sacred text. Would like to point out that while the King James Bible has some inaccuracies, it is still probably the best English translation out there for preserving the poetic feel of the Bible. Second best would be the New Jerusalem Bible. The Bible, New and Old Testament, is not a prose document. It is poetry, 100%. If you really want to hear it, go to a conservative Jewish Synagogue some Saturday and listen to the chanting. In the original, there are sound-poetic elements that we are all familiar with in English - rhyme, meter, alliteration, assonance etc. In addition, the Bible uses many kinds of structure poetry couplets, acrostics and chiasm. (side note - Book of Mormon also has similar poetic elements, especially chiastic poetry) To translate one work of poetry into a different language is a new artistic work. Due to cultural factors at the time of King James Bible, poetry was considered as the only appropriate vernacular for sacred subjects.
Mormons today share that view of a certain vernacular being appropriate for sacred subjects and are taught to pray in King James English.
| 8bb2b1e6283a1d834b7a643182f89989237413db85bf2c60cbb27b542cfba4a2 | ['980f04f4111d46bbbb8981a64743f025'] | `Why does it take a projectile as long to get to its apex as it does to hit the ground?` Only true if the projectile is launched from the ground. With an upward trajectory. [At least for me, knowing the constraints under which the condition hold true explains the why](http://physics.stackexchange.com/a/<PHONE_NUMBER>). |
e6dc67a1ebb784ab4525cec93e5342be9300d8b607ff99e9d103e12a72fae3a2 | ['9818a92c52204150a7112a18561a13a1'] | I am trying to render a jsf page with extension .xhtml when user chooses a jquery tab, the pages are called using jquery ajax, The problem is when I place a html page in the get method it works , but when the pages are .xhtml it is not rendered , here is an example
$.get("/example/page.xhtml")", function(data) { $(".loads_here").append(data); ...}
| 03f2e2f0cdd29a34e2ad1e35f0e799774bc1f24a484794056e1802e08d2e4f34 | ['9818a92c52204150a7112a18561a13a1'] | Hi I have this method
public static Date toDate(XMLGregorianCalendar calendar)
if (calendar == null) {
return null;
}
return calendar.toGregorianCalendar().getTime();
}
The date I get from this method is with this format Fri May 30 12:00:00 EEST 2014 but I wan the format to be like dd-MM-yyyy HH:mm:ss any idea how ??
|
24b7bccf60f0ecb9b7bb7d4a42a933107a40c4b2904c504c247a1784063b515d | ['981a2a95cfbd44078236e807e1b4abb7'] | The reason the recommendation changed was that a quorum query would require responses from over half of your nodes to fullfill. So if you accidentally left Cassandra user active and you have 80 nodes - we need 41 responses.
Whilst it's good practice to avoid using the super user like that - you'd be surprised how often it's still out there.
| f2816217e445572495e4e9ab346cebe15f3ea57f982f09d6d85efdb2ada16d1c | ['981a2a95cfbd44078236e807e1b4abb7'] | I would guess that your partitioning is leading to hotspots on your data. A common example is to bucket stuff by the day or hour when loading time series data. The net effect is that only one node at a time will be used during the bucket period.
The other thing to look at is the value of max_solr_concurrency_per_core. The defaults can be too high - I'd normally recommend dropping it to 2 - and then gradually increasing until the server maxes out. What are your server hardware specs like, in terms of memory, cpus and disks?
|
4a3c246b8c6b7a3bd848eb680de9f883efa3ab6075996c381b6456bd6dbfa81e | ['9837e704965b457f9f7ccdf02fe474eb'] | This will be sort of an addendum to <PERSON> answer I'm making because I couldn't find the 'Disconnect this display' option in the last step.
The only real difference is ensuring your laptop monitor is not your main display before trying to disconnect it. Perhaps this is common sense, but it took me a while to figure out. Big thanks and credit to <PERSON> for his answer though!
My Setup
Windows 10
Two LCD Monitors
Need
Output to both displays with laptop closed and laptop display off
Continue to have the laptop display off when I wake my laptop from sleep
Steps
Open 'Change Display Settings' (search for that in the start menu or right click the desktop and click 'Display Settings')
Open your laptop lid
Identify which monitor is your laptop monitor (#1 for me when laptop is open)
Select one of the monitor displays (#2 and #3 for me)
Scroll down and click 'Make this my main display'
Select your laptop display (#1 for me)
Scroll down to the 'Multiple displays' dropdown menu and click 'Disconnect this display'
Here is how to confirm, Settings will show greyed out if off -
With Laptop Display Enabled
With Laptop Display Disabled
| 586d9df9a79ee477fa15d6c88356519e7d193e0e705f0af011f74b6332fb8b79 | ['9837e704965b457f9f7ccdf02fe474eb'] |
I am using a jTree structure to display the structure of the project the user is currently using. Users can, of course, open another project, and then, the software is supposed to display the new project's structure. I am using DefaultTreeModel to add/delete nodes, and updating the jTree structure. And since this task can take seconds to be achieved, it was implemented in a new Thread. Here's the code :
class DrawTreeThread extends Thread {
@Override
public void run() {
System.out.println("drawing the tree");
model = (DefaultTreeModel) jTree1.getModel();
Fichier obs,
open,
opens = new Fichier(Batiment.data.getAbsolutePath() + "\\Open"),
obss = new Fichier(Batiment.data.getAbsolutePath() + "\\Obs"),
rooms = new Fichier(Batiment.data.getAbsolutePath() + "\\Rooms");
Fichier bd = new Fichier(Batiment.data.getAbsolutePath() + "\\BuildingData" + Fichier.EXT);
int size = rooms.listFiles().length;
int nbrEtage = bd.readInt("etage");
DefaultMutableTreeNode[] roomz = new DefaultMutableTreeNode[size];
DefaultMutableTreeNode bat = new DefaultMutableTreeNode(Batiment.data.getAbsoluteName());
DefaultMutableTreeNode[] obstacles = new DefaultMutableTreeNode[size];
DefaultMutableTreeNode[] ouvertures = new DefaultMutableTreeNode[size];
DefaultMutableTreeNode[] etages = new DefaultMutableTreeNode[nbrEtage];
jTree1 = new JTree(bat);
for (int etageCounter = 0; etageCounter < nbrEtage; etageCounter++) {
String name = "RDC";
if (etageCounter != 0) {
name += " + " + etageCounter;
}
etages[etageCounter] = new DefaultMutableTreeNode(name);
bat.add(etages[etageCounter]);
model.insertNodeInto(etages[etageCounter], bat, 0);
}
for (int i = 0; i < size; i++) {
roomz[i] = new DefaultMutableTreeNode(rooms.listFiles()[i].getAbsoluteName());
obs = new Fichier(obss.getAbsolutePath() + "\\" + rooms.listFiles()[i].getAbsoluteName());
open = new Fichier(opens.getAbsolutePath() + "\\" + rooms.listFiles()[i].getAbsoluteName());
etages[rooms.listFiles()[i].readInt("etage")].add(roomz[i]);
obstacles[i] = new DefaultMutableTreeNode("Obstacles (" + obs.listFiles().length + ")");
ouvertures[i] = new DefaultMutableTreeNode("Ouvertures (" + open.listFiles().length + ")");
roomz[i].add(obstacles[i]);
roomz[i].add(ouvertures[i]);
DefaultMutableTreeNode[] Obs = new DefaultMutableTreeNode[obs.listFiles().length];
for (int j = 0; j < obs.listFiles().length; j++) {
Obs[j] = new DefaultMutableTreeNode(obs.listFiles()[j].getAbsoluteName());
obstacles[i].add(Obs[j]);
}
DefaultMutableTreeNode[] Open = new DefaultMutableTreeNode[open.listFiles().length];
for (int j = 0; j < open.listFiles().length; j++) {
Open[j] = new DefaultMutableTreeNode(open.listFiles()[j].getAbsoluteName());
ouvertures[i].add(Open[j]);
}
}
model.nodeStructureChanged(bat);
model.reload();
jTree1.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
jTree1.expandRow(0);
System.out.println("drawing the tree with success");
}
}
the new DrawTreeThread().start() is called from a button ActionListner(), but nothing is happening. What's so wrong?
|
48afb6ee4b2eb547ac8807640e21e668c08d5eb6656117086e215514a56bdd39 | ['984e880a9fb84aedb635a688b4fde3d0'] | I agree with the marked answer by <PERSON>. The answer could use some additional notes though.
For the vast majority of software developers the processor and compiler are no longer relevant to the question. Most of us are far beyond the 8088 and MS-DOS. It is perhaps only relevant for those who are still developing for embedded processors...
At my software company Math (add/sub/mul/div) should be used for all mathematics.
While Shift should be used when converting between data types eg. ushort to byte as n>>8 and not n/256.
| 733f6490356c5e240b79777ecabe75eb0ca7109cafc518a097e45b6c36519bcc | ['984e880a9fb84aedb635a688b4fde3d0'] | I prefer <PERSON>'s answer, but none of the examples here that I can see are handling an invalid maxLength parameter, such as when maxLength < 0.
Choices would be either handle the error in a try/catch, clamp the maxLength parameter min to 0, or if maxLength is less than 0 return an empty string.
Not optimized code:
public string Truncate(this string value, int maximumLength)
{
if (string.IsNullOrEmpty(value) == true) { return value; }
if (maximumLen < 0) { return String.Empty; }
if (value.Length > maximumLength) { return value.Substring(0, maximumLength); }
return value;
}
|
4602444212f371adba7be5319d1fb25ba554e95686c59aeffad85f0d3cb02460 | ['9855dad4065b45219f9b61b5c3c1a3ac'] | I would like to understand what this regex correspond to:
preg_match("/\/[A-z]{2}\/[^\/]*/", "expression_to_test")
I've tried with /a2/ but it does not match. As I understand the regex, in this order we have: "/" which is a delimiter, "/" stands for backslash, [A-z]{2} stands for 2 letters, then another "/" then no "/" multiple times...
So, it's obviously not the good answer, if you find a matching pattern I would be great.
Thanks
| 65bde6effc64b4c1eee3333ff105c9d3f5d391846b24519a92570862796c9e43 | ['9855dad4065b45219f9b61b5c3c1a3ac'] | I'm studying BootStrap, and I don't understand the behavior of this piece of code:
<style type="text/css">
article.col-sm-10, nav.col-sm-2 {
line-height: 10px;
}
</style>
Does it mean that articles, col-sm-10, nav and col-sm-2 will be affected by a line-height of 10 px, or is it for articles with col-sm-10 and nv with col-sm-2 attributs ?
Thanks
|
ff13f262de7b3c7589da078ca15be7bac083551bcff47ee00e2102c1778ebd56 | ['986385c446dd48c89c96cc3321f835d9'] | Создайте шаблон NUnit, как это описано на сайте Microsoft:
https://docs.microsoft.com/ru-ru/dotnet/core/testing/unit-testing-with-nunit
1. Установка шаблона проекта NUnit (при этом скачаются оба пакета - NUnit и NUnit3TestAdapter)
Перед созданием тестового проекта необходимо установить шаблоны тестовых проектов NUnit. Это действие необходимо выполнить только один раз на каждом компьютере разработчика, где создаются новые проекты NUnit. Для установки шаблонов NUnit выполните dotnet new -i NUnit3.DotNetNew.Template
2. Используйте шаблон (в каталоге проекта введите команду dotnet new nunit)
Перейдите в каталог PrimeService.Tests и создайте проект с помощью dotnet new nunit. Команда dotnet new создает тестовый проект, который использует NUnit в качестве библиотеки тестов. Созданный шаблон настраивает средство запуска тестов в файле PrimeServiceTests.csproj:
Собственно, все. Далее наслаждаемся жизнью и отладкой.
| 86c3d9ef968148fb8f8718432a7f1ee17c52104c0271f8cd77aa7a0a55723516 | ['986385c446dd48c89c96cc3321f835d9'] | Hola is a VPN service which claims to rely on peers to unblock websites and accelerate browsing. If it relies on peers, clearing there must be peer to peer uploading taking place. What is the easiest way to track how much data it uploads? Also, are there any guarantees besides its personal statement that it isn't uploading personal information?
|
a1e793f6f6c2c86a8e6158e53c41e8497b7004ae9154e73d1cb32c406c6753db | ['9863da27902449178ae3162513c8b46e'] | I didn't like that change either, so I wrote an extension to revert to the VS 2013 behavior. I just wrote it last night, so I'd consider it a beta at this point, but I'll be actively using it and actively fixing any bugs that arise. Feel free to check it out:
https://github.com/refactorsaurusrex/squishy-vs
Turn this...
... into this:
| 2a4c27e5206a6500e329a5c5c700b7aeab76141aa1dcbd8fb398c62a42e6cc07 | ['9863da27902449178ae3162513c8b46e'] | I was just battling the same issue. As far as I can tell, visual studio doesn't allow you to browse to a type in your current project; you can only browse to types in a referenced assembly. However, you can type the fully qualified name of the type you want to use in the settings 'Select a Type' dialog box like shown below. Note that this won't work until your project has been built with the type you want to reference already included. (Same is true with referenced assemblies.) Hope that helps!
|
2e28a117e99371d2d875ccd8dae3f1bc436847d862571169fcb54feb353391a2 | ['9866159d333247a2bb73ebceb7a819fa'] | You can use the OutlineLevel Property located in the Columns to locate the parents and the childrens based on the worksheet outline logic.
Try:
'This function goes thru the outline childrens of a cell and can apply some logic based on their value
Function SubComponentsPresent() As String
Application.Volatile
Dim RefRange As Range
Set RefRange = Application.Caller
Dim Childrens As Range
Set Childrens = OutLineChildren(RefRange)
Dim oCell As Range
For Each oCell In Childrens
'-----------
'Insert code here
'-----------
Next oCell
SubComponentsPresent = tOut
End Function
'This functions returns the childrens of a cell (Considering a column outLine)
Function OutLineChildren(RefCell As Range) As Range
Dim oCell As Range
Dim tOut As String
With RefCell.WorkSheet
If .Outline.SummaryColumn = xlSummaryOnRight Then
Set oCell = RefCell.Offset(0, -1)
Do Until oCell.EntireColumn.OutlineLevel <= RefCell.EntireColumn.OutlineLevel
If oCell.EntireColumn.OutlineLevel = RefCell.EntireColumn.OutlineLevel + 1 Then
If tOut <> "" Then tOut = tOut & ","
tOut = tOut & oCell.Address
End If
Set oCell = oCell.Offset(0, -1)
Loop
Else
Set oCell = RefCell.Offset(0, 1)
Do Until oCell.EntireColumn.OutlineLevel <= RefCell.EntireColumn.OutlineLevel
If oCell.EntireColumn.OutlineLevel = RefCell.EntireColumn.OutlineLevel + 1 Then
If tOut <> "" Then tOut = tOut & ","
tOut = tOut & oCell.Address
End If
Set oCell = oCell.Offset(0, 1)
Loop
End If
End With
Set OutLineChildren = RefCell.Worksheet.Range(tOut)
End Function
| bd7a6eb7bb8b6dfacf3a79528036423542e1b0e61d0fe8131238da48c4f2f8ad | ['9866159d333247a2bb73ebceb7a819fa'] | In Excel 2003, (may be different in Excel2007 ?!) the WorkSheet_Change event is triggered every time the value of a cell is changed wether it is by pressing enter, delete, selecting an other cell after modifying a cell or even when a vba script changes the value of a cell.
I would do something like that:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim RefRange As Range
Set RefRange = Intersect(ActiveSheet.Columns("??????????"), ActiveSheet.UsedRange)
If Not Intersect(Target, RefRange) Is Nothing Then
Target.Offset(0, 1).EntireColumn.Range("A1").Select
'Target.Offset(0, 1).EntireColumn.Range("A65536").End(xlUp).Offset(1,0).Select
End If
End Sub
|
df1894c26c1c098516a3df2386e21d21f268f9e87a26b3b5fffa0a31d5adb9f8 | ['9866c12a4b8f4fcda8b78e863605b13a'] | hi when i open my site (made in smarty) i got this error plz resolve im very new in smarty
Smarty error: unable to read resource: "pagetemplate.tpl" in /var/www/vhosts/example.com/htdocs/includes/smarty/Smarty.class.php on line 1083
Warning: Smarty error: unable to read resource: "pagetemplate.tpl" in /var/www/vhosts/example.com/htdocs/includes/smarty/Smarty.class.php on line 1083
Thanks
| 92be8baf497ebfd88e1731620138be1de149f480a22fbc08152ff7edd1eaf5fd | ['9866c12a4b8f4fcda8b78e863605b13a'] | Hi Regarding Paypal adaptive payment this thread will help https://www.paypal-community.com/t5/About-Payments/Adaptive-Payments-for-Magento-marketplace/td-p/968101
as authorize.net does not provide marketplace api like stripe or paypal provides so it wouldnt be possible in this way .
PS - we are not self promoting our plugin or product , as user asked the questions specifically about our product that why i have added extension link with images and screenshot
|
7ec2e3c3c3bdd90b47577553aa547e3409d5a74fffde2f6f2f14868bed0b13d5 | ['987333d98a9745939bb1bf50b8bb8259'] | I use the native merge functionality to glue two duplicate contacts together programmatically:
merge target source;
Yet this invokes the following error:
12:06:49:251 USER_DEBUG [46]|DEBUG|DML_e: Merge failed. First
exception on row 0 with id 0030-removed---tQAG; first error:
INVALID_FIELD_FOR_INSERT_UPDATE, Unable to create/update fields: Name.
Please check the security settings of this field and verify that it is
read/write for your profile or permission set.: [Name]
I'm confused. For once, the Name field is exactly the same for both contacts. Also, I thought my Apex would run with maximum permissions in any case.
What is a good way to merge two Contacts, ideally copying tasks, attachments etc as well?
| 85d05389501a673d924cdeeceaa225a4bcea54ad48559c83716e33f13178892d | ['987333d98a9745939bb1bf50b8bb8259'] | Is there any downside to encrypting the original message for signing purposes. I understand this does not provide actual protection, and any one with the public key (any one in the world if the public key is made completely public), however, it would seem if the public keys were kept restricted to TLS tunnels and required password access, this would seem to be a small layer of protection. The upside is small, but is there any downside?
|
c63a52c423e009ad8a33f553b8244a97cfab0ffb913d117e13c09e571886ee23 | ['987ca133c08341898c6f736df1242be8'] | Im learning swift now and having the following problem
Please help..
I have 3 classes-
TableViewController
BroadcastModel
BroadcastRequest
I get the following error (the line of error is marked with comment)
Cannot invoke 'requestFinished' with an argument list of type '([(BroadcastModel)])'
import UIKit
public class TableViewController: UITableViewController {
var broadcasts = [BroadcastModel]()
//MARK: ViewControllerLifecycle
override public func viewDidLoad() {
super.viewDidLoad()
//maybe will use the 2d array for sections of broadcasts..
BroadcastRequest().requestNewBroadcasts()
}
public func requestFinished(requestedBroadcasts: [BroadcastModel]) {
self.broadcasts = requestedBroadcasts \* HERE IS THE ERROR *\
self.tableView.reloadData()
}
public class BroadcastRequest {
func requestNewBroadcasts() {
var broadcasts = [BroadcastModel]()
.....
.....
broadcasts.append(broadcast)
TableViewController.requestFinished(broadcasts)
}
}
public class BroadcastModel: NSObject, Printable {
let id: String
let broadcastURL: String
...
...
override public var description: String {
return "ID: \(id), URL: \(broadcastURL) ....."
}
init(...) {
...
}
}
| 7719ab62e663bb4274321b333355e1dd7e6976f96d838b3eb7986ec5347fba01 | ['987ca133c08341898c6f736df1242be8'] | I'm new to swift. My app uses photos people upload to the web and showing the photos in a table view.
It is reloading whenever some user uploads a new photo.
I have a UITextField that when you press it the keyboard goes up. My problem is that it goes down whenever reloadView is happening (when a new photo arrives)
What i'm trying to do is to check if the UITextField is first recogniser and if so I want to wait with the reload until it not first recogniser.
func refreshView()
{
dispatch_async(dispatch_get_main_queue()) { () -> Void in
while (self.dataSource.writeSomethingTextLabel.isFirstResponder()) {
//need to wait somehow for notification that it is not first responder anymore
}
self.tableView.reloadData()
}
}
So with this code the keyboard is not going down of course but the wile loop runs and everything is stuck. my question is how can I wait until the user finishes using the text label (first responder is false).
thanks
|
1276ce24d7e1a6922780efe55dab6f472442775c491a5f72b2ac93e203d45cec | ['987caf89476c4d3783757961ac2aced5'] | In your activity create a handler and initialize it in your on create method
private Handler mHandler;
mHandler = new Handler();
then change your drawer item click listener to this.
private class DrawerItemClickListener implements ListView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> parent, View view, final int position,
long id) {
if (dataList.get(position).getTitle() == null) {
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
SelectItem(position);;
}
}, 250);
}
mDrawerList.setItemChecked(possition, true);
mDrawerLayout.closeDrawer(mDrawerList);
}
}
and change SelectItem method to this
public void SelectItem(int possition) {
Fragment fragment = null;
Bundle args = new Bundle();
switch (possition) {
case 2:
fragment = new FragmentZero();
break;
case 3:
fragment = new FragmentOne();
break;
case 4:
fragment = new FragmentTwo();
break;
case 5:
fragment = new FragmentThree();
break;
case 7:
fragment = new FragmentTwo();
break;
case 8:
fragment = new FragmentZero();
break;
case 9:
fragment = new FragmentOne();
break;
case 10:
fragment = new FragmentTwo();
break;
case 11:
fragment = new FragmentZero();
break;
case 12:
fragment = new FragmentOne();
break;
case 14:
fragment = new FragmentZero();
break;
case 15:
fragment = new FragmentOne();
break;
case 16:
fragment = new FragmentTwo();
break;
default:
break;
}
fragment.setArguments(args);
FragmentManager frgManager = getFragmentManager();
frgManager.beginTransaction().replace(R.id.content_frame, fragment)
.commit();
setTitle(dataList.get(possition).getItemName());
}
| c86abf528dd29289254dfe7642216188677a6b6e7ff7d6b4e3f5a7c051072698 | ['987caf89476c4d3783757961ac2aced5'] | As an addition to <PERSON> answer, the best fix of the issue is Creating your own CustomViewpager class that extends from ViewPager and overriding the RequestChildFocus method with null so as to disable the automatic focus behavior.
Your customeViewPager class will look something like this
public class CustomeViewPager extends ViewPager {
public CustomeViewPager(Context context) {
super(context);
}
public CustomeViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
}
@Override
public void requestChildFocus(View child, View focused) {
//Do nothing, disables automatic focus behaviour
}
}
You can now use this class in your xml and continue from there.
|
f95b342583c6dedbec942f58b76a2f6127af7cf405f6f38ac87e9c3b68fe668c | ['9884b83e1356499d8525aa54cd05d5f8'] | Ah ok, so you adjust $v_i$ by a certain amount (negative or positive), but doesn't what I've written above show that the change in $C$ will always be negative? That is, I can imagine surfaces where the change in C is positive but where the above algebra still holds. Clearly I'm missing something... | 6d00c24bcd994ac5bb997337af22b62dfd0aaa6e6efb636e9617919ebcbd7451 | ['9884b83e1356499d8525aa54cd05d5f8'] | I am new user in Pixelmator and I used to use Photoshop. Now, I would like to use Pen Tool in Pixelmator.
In photoshop, we use pen tool to cut things and then Ctrl+Enter to make a selection.
In pixelmator, I cannot make selection and it automatically fills with color. All I want is just selection .
Please help me how to do this.
|
c8f9239c452db70d4f64dda6a1654f00ea6d6bcfecf6e8cda5791b93e2433f6c | ['988574c07f6145a7a826d32107f06a14'] | I ended up doing something different to get the same result. Instead of trying to create a custom CacheWarmer, I created a compiler pass and modified the definition of the 'options' argument. In this compiler pass, I removed all the files that don't have the locale or language code.
Code:
<?php
namespace X\DependencyInjection\Compiler;
use X\Entity\I18nLanguage;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class TranslatorCompilerPass implements CompilerPassInterface
{
/**
* You can modify the container here before it is dumped to PHP code.
*
* @param ContainerBuilder $container
*
* @api
*/
public function process(ContainerBuilder $container)
{
$definition = $container->getDefinition('translator.default');
$options = $definition->getArgument(3);
$keys = array_keys($options['resource_files']);
$locales = I18nLanguage<IP_ADDRESS>PUBLIC_LOCALES;
$langCodes = array();
foreach (I18nLanguage<IP_ADDRESS>PUBLIC_LOCALES as $locale) {
$langCodes[] = substr($locale, 0, strpos($locale, '_'));
}
$localesAndLangCodes = array_merge($locales, $langCodes);
foreach ($keys as $key) {
if (!in_array($key, $localesAndLangCodes, true)) {
unset($options['resource_files'][$key]);
}
}
$arguments = $definition->getArguments();
$definition->setArguments(array($arguments[0], $arguments[1], $arguments[2], $options));
}
}
That did the trick for me and I can also apply other optimizations like the removal of loaders, etc.
| 807511071f1d4950480a918cc4ec7162c1e389b78a390e672af11c3dc5ed0fb3 | ['988574c07f6145a7a826d32107f06a14'] | I'm working on a git branch that has a lot of merge conflicts with another branch that I've merged into it. I started fixing the conflicts but want to save my work and switch to another branch before I finish the merge process.
Is it possible to stash the changes in the unfinished merge process to switch to another branch and then switch back and finish the merge?
I've spent a lot of time working on fixing the conflicts and I don't want to do this work again. What's the best way to proceed?
I'm using git version 1.7.10
|
f43b5ecc9b397d3eb0cd7a6ca4b2dc17ec2bd089ed3fb32a64d475080e979a3f | ['98866e654aac4a7e9252b7194bf1c920'] | I have a table that contains two columns. One column that has an action code and the second column that has a DateTime stamp
I am somewhat familiar with comparing DateTime from two different columns on the same row, but not from one column from multiple rows
Sample data:
Task_ID Action_Code CreateDate
----------- ----------- -----------------------
474344 BEGIN 2018-09-28 15:00:00
474344 PAUSE 2018-09-28 16:07:29
474344 RESUME 2018-09-28 16:08:49
474344 PAUSE 2018-09-28 16:09:57
474344 RESUME 2018-09-28 16:11:20
474344 CLOSE 2018-09-28 17:00:00
474390 BEGIN 2018-09-28 11:00:00
474390 PAUSE 2018-09-28 11:07:29
474390 RESUME 2018-09-28 11:08:49
474390 PAUSE 2018-09-28 11:09:57
474390 CLOSE 2018-09-28 12:00:00
For Task_ID 474344, I would expect the total time calculated to be 1:57:17 (1 hour, 57 minutes, 17 seconds).
For Task_ID 474390, I would expect the total time calculated to be 0:8:37 (8 minutes, 37 seconds).
| 11dc9f6edd2e27bcecd45c3a029563926fa767eec99fe5112d065b872668bef6 | ['98866e654aac4a7e9252b7194bf1c920'] | I think I may have found my answer:
SELECT DATEDIFF(second, pCreateDate, CreateDate)
FROM (
SELECT *, LAG(CreateDate) OVER (ORDER BY CreateDate) pCreateDate
FROM TaskDataBase
WHERE (Action_Code = 'Pause' OR Action_Code = 'Resume') AND Task_ID = '474344') q
WHERE pCreateDate IS NOT NULL AND Action_Code = 'Resume';
The above will give me
(No column name)
----------------
80
83
I could then add those two to get 163 seconds, and remove it from the time comparison of the BEGIN and CLOSE times (which is 2 hours, or 7,200 seconds), which would give me a total time of 1 hour, 57 minutes, 17 seconds
|
accd16692b846e9368dc5a46bc752da78a2619a51df00b32b7a55c4a271b8653 | ['988e6bb6c6e94e3db6c48ca9c7b6707f'] | I'm trying to set a user account with fixed parameters into Firebase with the CLI, and after success uploading the data, and then test it I get INVALID_PASSWORD in the logs
I think is related with salt and hash, Am I setting these values incorrectly?
There are others Q.A here that are related,
https://stackoverflow.com/a/40851390/2513972
but I trying with python, so please help me, I stuck here.
from passlib.hash import pbkdf2_sha256
from passlib.utils import to_bytes, to_native_str
import base64
PASSWORD = 'aA123456*'
ROUND = 20000
SALT = to_bytes('google')
hash1 = pbkdf2_sha256.using(salt=SALT,rounds=ROUND).hash(PASSWORD)
print(pbkdf2_sha256.identify(hash1))
# True
print(pbkdf2_sha256.verify(PASSWORD,hash1))
# True
print(hash1)
# $pbkdf2-sha256$20000$Z29vZ2xl$PtFLyZHJJucUa2KBg1iJeVJsivis8JimRhFifRRKlFc
print(base64.b64encode(b'Z29vZ2xl'))
# b'WjI5dloyeGw='
print(base64.b64encode(b'PtFLyZHJJucUa2KBg1iJeVJsivis8JimRhFifRRKlFc'))
# b'UHRGTHlaSEpKdWNVYTJLQmcxaUplVkpzaXZpczhKaW1SaEZpZlJSS2xGYw=='
# firebase auth:import sandbox/account_file.csv --hash-algo=PBKDF2_SHA256 --rounds=20000 --project <project_name>
# account_file.csv
# 555000444,<EMAIL_ADDRESS>,false,UHRGTHlaSEpKdWNVYTJLQmcxaUplVkpzaXZpczhKaW1SaEZpZlJSS2xGYw==,WjI5dloyeGw=,,,,,,,,,,,,,,,,,,,,,,
| c8a0be5aeda68135f55e1d7d63c39daee795c1f1a9baedc09023862e72eb0cd1 | ['988e6bb6c6e94e3db6c48ca9c7b6707f'] | I trying to do some scraping without python, just a simple http get request from web angular app, the problem is the response, I need gain access to the headers, to get the csrftoken header.
error: SyntaxError: Unexpected token < in JSON at position 0 at JSON.parse (<anonymous>) at XMLHttpRequest.onLoad (http://localhost:4200/vendor.
Code:
const headers = new HttpHeaders().set('Content-Type', 'text/html; charset=utf-8');
const r = this.http.request<HttpResponse<Object>>('GET', 'https://www.example.com', {
headers: headers
});
|
065616fe2c0a7f44217529b453760d8b7de20bea394c3b5679609baf0112cfe2 | ['9892394f1a1d40229223826888bede18'] | i need change color in run time in panel
<span class="Apple-style-span"
style="background-color: rgba(0, 0, 0, 0); border-collapse: separate; color: rgb(0, 0, 0); font-family: Arial, sans-serif; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 26px; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">
<span class="Apple-style-span"
style="background-color: rgb(221, 75, 57); color: rgb(255, 255, 255); ">
<div class="head"
style="margin-top: 20px; margin-right: 0px; margin-bottom: 20px; margin-left: 0px; padding-top: 5px; padding-right: 0px; padding-bottom: 5px; padding-left: 0px; font: normal normal normal 13px/27px Arial, sans-serif; line-height: 26px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; text-indent: 15px; background-color: rgb(153, 153, 153); ">
<h6 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 13px/27px Arial, sans-serif; line-height: 30px; font-size: large; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-weight: bolder; background-color: #999999; color: #000000;">
Domain Name Registration</h6>
<div class="price"
style="border-width: 0px; margin: 0px; padding: 0px; line-height: 26px; background-color: #999999; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; font-family: Arial, sans-serif; top: 49px; left: 0px; position: absolute; height: 26px; width: 259px;">
<p class="MsoNormal">
<b><span
style="font-size:13.5pt;
font-family:"Times New Roman","serif";mso-fareast-font-family:"Times New Roman"">
Sliver Plan
Hosting
10 HTML Pages
Flash Header
Domain Forwarding
SEO Friendly
<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 13px/27px Arial, sans-serif; line-height: 26px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; background-color: #CCCCCC;">
Now Special Offer!!!</li>
</span></span>
</ul>
</span></span>
</asp:Panel>
| afb5ffc3e541be023e2057f28ca5231f9a0ec3603437533ecf666c2340b8aa57 | ['9892394f1a1d40229223826888bede18'] | i need solution for this error
i am run that time some error occur there is:Send Email Failed.
The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first. i1sm8651517pbj.70
using System;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
#region "Send email"
protected void btnSendmail_Click(object sender, EventArgs e)
{
// System.Web.Mail.SmtpMail.SmtpServer is obsolete in 2.0
// System.Net.Mail.SmtpClient is the alternate class for this in 2.0
SmtpClient smtpClient = new SmtpClient();
MailMessage message = new MailMessage();
try
{
MailAddress fromAddress = new MailAddress(txtEmail.Text, txtName.Text);
// You can specify the host name or ipaddress of your server
// Default in IIS will be localhost
smtpClient.Host = "smtp.gmail.com";
//Default port will be 25
smtpClient.Port = 587;
//From address will be given as a MailAddress Object
message.From = fromAddress;
// To address collection of MailAddress
message.To.Add("<EMAIL_ADDRESS>");
message.Subject = "Feedback";
// CC and BCC optional
// MailAddressCollection class is used to send the email to various users
// You can specify Address as new MailAddress("<EMAIL_ADDRESS>")
message.CC.Add("<EMAIL_ADDRESS>");
message.CC.Add("<EMAIL_ADDRESS>");
// You can specify Address directly as string
message.Bcc.Add(new MailAddress("<EMAIL_ADDRESS>"));
message.Bcc.Add(new MailAddress("<EMAIL_ADDRESS>"));
//Body can be Html or text format
//Specify true if it is html message
message.IsBodyHtml = false;
// Message body content
message.Body = txtMessage.Text;
// Send SMTP mail
smtpClient.Send(message);
lblStatus.Text = "Email successfully sent.";
}
catch (Exception ex)
{
lblStatus.Text = "Send Email Failed.<br>" + ex.Message;
}
}
#endregion
#region "Reset"
protected void btnReset_Click(object sender, EventArgs e)
{
txtName.Text = "";
txtMessage.Text = "";
txtEmail.Text = "";
}
#endregion
}
|
59fc13c069867175f0d544930babd5a117e6625d9f52861654d5cfa0f3af7899 | ['989ce1f6f45747729409564851c8c641'] | As far as i understand you are not using the main view for the video,
So the thing you can do is you can reduce the height of the view on which you are adding the tap gesture, in your case it will be “aView.”
The reduced height should be the height of the control state bar.
There maybe different values of this bar in landscape and portrait orientation.
| 53bf07c08857952ea789f3819b7d0f59e1bea8ac7d628693c80be1525da802c7 | ['989ce1f6f45747729409564851c8c641'] | I have done your requirement in my demo project. I have picked image using UIIMagePicker delegate function
@interface ViewController ()
{
UIImage *chooseImage;
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSDate *time = [NSDate date];
NSDateFormatter* df = [NSDateFormatter new];
[df setDateFormat:@"ddMMyyyy-hhmmss"];
NSString *timeString = [df stringFromDate:time];
NSString *fileName = [NSString stringWithFormat:@"%@", timeString];
chooseImage = info[UIImagePickerControllerEditedImage];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
documentsDirectoryPath = [paths objectAtIndex:0];
NSLog(@"View Controller Path:%@",documentsDirectoryPath);
savedImagePath = [documentsDirectoryPath
stringByAppendingPathComponent:[NSString stringWithFormat: @"%@-%d.png", fileName, num]];
num += 1;
NSData *imageData = UIImagePNGRepresentation(chooseImage);
[imageData writeToFile:savedImagePath atomically:NO];
[picker dismissViewControllerAnimated:YES completion:NULL];
[self displayImage];
}
-(void)displayImage
{
self.imageView.image = chooseImage;
}
and from that method i have called another function->displayImage, which i am using for displaying image in UIImageView. Here below is code.
|
46f594057a758438f66e2de0621a231128f1d2e786d2034162e5e9b712e85359 | ['98a0e85d281f42e38b538b37493a76eb'] | I am looking for a method in matplotlib to create multiple interactive artists (i.e. rectangles, circles, etc) in a single axis that can be resized/rotated/moved using the mouse. I successfully tried this example to create a "draggable" rectangle in matplotlib. However, when two such draggable rectangles overlap, both will move and not just the top-most one as I would like. How can I make sure that only the top-most artist under the mouse pointer will respond to mouse events?
| 594e1c8d17445d674c1792302aaa27a51f51ff76886cd3e69ff77b4ea59da3f5 | ['98a0e85d281f42e38b538b37493a76eb'] | I am giving <PERSON> (version 0.1.0) a try for a simple Poisson regression model. However the results differ when compared to straight pymc3 or statsmodels implementations, and I cannot seem to figure out how to interpret the coefficients that bambi gives me. The test code is below. Did I specify the model wrong, or should I not rely on the automatic priors of bambi?
import numpy as np
import scipy.stats
import pandas
import patsy
import statsmodels
import pymc3
import bambi
%matplotlib inline
# generate data
num_subjects = 4
mu = [5, 8, 10, 11]
num_samples = [43, 60, 56, 38]
counts = [scipy.stats.poisson.rvs(m,size=n,random_state=m) for m,n in zip(mu,num_samples)]
counts = np.concatenate(counts)
subject = np.repeat(np.arange(num_subjects), num_samples)
df = pandas.DataFrame( np.vstack([subject,counts]).T, columns=['subject','counts'])
# sample means
print( df.groupby('subject').mean() )
# subject 0 = 5.0
# subject 1 = 7.4
# subject 2 = 9.5
# subject 3 = 10.0
# fit with bambi
model_bambi = bambi.Model(df)
result_bambi = model_bambi.fit('counts ~ C(subject)', categorical=['subject'], family='poisson', chains=2)
print(result_bambi.summary(hpd=None, diagnostics=None))
# resulting posterior means:
# Intercept 9.3310 -> ?
# C(subject)[T.1] 3.8171 -> ?
# C(subject)[T.2] 4.4419 -> ?
# C(subject)[T.3] 3.8652 -> ?
# fit directly with pymc3
with pymc3.Model() as model_pymc3:
pymc3.glm.GLM.from_formula("counts ~ C(subject)", df, family=pymc3.glm.families.Poisson())
trace = pymc3.sample(2000, njobs=2, tune=500)
pymc3.plot_posterior(trace, varnames=[x for x in trace.varnames if x[:2]!='mu']);
# resulting posterior means:
# Intercept 1.6065 -> mu = 5.0 = exp(1.6065)
# C(subject)[T.1] 0.3990 -> mu = 7.4 = exp(1.6065+0.3990)
# C(subject)[T.2] 0.6477 -> mu = 9.5 = exp(1.6065+0.6477)
# C(subject)[T.3] 0.6977 -> mu = 10.0 = exp(1.6065+0.6977)
# fit with statsmodels
my, mx = patsy.dmatrices( "counts ~ C(subject)", df, NA_action='raise')
model_sm = statsmodels.api.GLM(my, mx, family=statsmodels.api.families.Poisson())
result_sm = model_sm.fit()
print(result_sm.summary())
# resulting posterior means:
# Intercept 1.6094 -> mu = 5.0 = exp(1.6094)
# C(subject)[T.1] 0.3965 -> mu = 7.4 = exp(1.6094+0.3965)
# C(subject)[T.2] 0.6456 -> mu = 9.5 = exp(1.6094+0.6456)
# C(subject)[T.3] 0.6958 -> mu = 10.0 = exp(1.6094+0.6958)
|
d5e32ea25171edd7fa1b8f8f03d6f8a8fe35c69ed6f95c600eba4a7dd28df544 | ['98a64e0327cb483ab7f6bd9b45affa13'] | Selenium script developed using c# can indeed be executed using Safari/Mac OS on browserstack. You can execute a sample test from this link to confirm the same as well.
Link-https://github.com/browserstack/browserstack-local-csharp.
Do you encounter any exception or error stack trace locally when the tests fail?
| ded816613ec35eed00d60c712fb5755d8890ae8780ca952ed546f49408681976 | ['98a64e0327cb483ab7f6bd9b45affa13'] | You can use the callback_url key in run_settings option in browserstack.json to get an update after that build is done running. The payload POSTed to this callback URL is the same as the one you get with the build-info BUILD_ID command.
Protip: You can keep polling the build status using the build-info command in a loop to monitor the build status, and then close the Local connection, and fail the build if the tests failed.
|
e362d445d9fa7e64132671490bdf3a5a99b31777aeaae723b1fdb0be0f5b3c21 | ['98ae4c260098497491c9d848dfd1d322'] | Double-quote characters in strings are kind of tricky. Try this:
Console.WriteLine(String.Format(@"""{0}""", Str));
The @ symbol makes the string into a string literal, meaning that there are no "escape" characters. The outer pair of double-quotes are the normal quotes around a string, and the inner double-pair of double quotes are actual quote characters.
| 7afc29229b79b1e46a672c58aaf1e000f499ccffc2fa55f2986185b9ef6d6b01 | ['98ae4c260098497491c9d848dfd1d322'] | When I start writing a method, I usually check for exceptional conditions first in the method, using If-Then-Throw blocks.
public void ReadFile(string filePath)
{
if (string.IsNullOrEmpty(filePath)
{
throw new ArgumentException(...
This style seems to be very clear and easy to understand, but it takes up more space than I think is necessary. I want to be able to handle errors and exceptional conditions in a smart way that enables whoever's reading these errors to easy take care of them while also keeping the code itself clean.
I've looked a bit at Code Contracts, which seems to me a requirement for certain conditions before and after a method's execution. That seems to be a tad bit overkill for just a null string, and I'm not sure if you can have contract clauses within the method itself, for instance, if the path is not null but no file exists at that path.
The solution I'm thinking of using is rolling my own Assert class. This class will basically turn the above If-Then-Throw into a simple one liner.
Assert.IsFalse<ArgumentException>(string.IsNullOrEmpty(filePath), "The path cannot be null or empty.");
All Assert methods would throw an exception using the exception type and the message in the last argument. The thing is that I'm not sure if this is good practice. Does it confuse what exceptions are truly for, or what Assert actually means? Would it make error-handling easier or harder?
|
e84abc3c49ccdd41a7f21e2e5430c6ce75e574439280f33ac96a8f3dd3ee8e5c | ['98ae4e21a40a403bbc46c20938d1ea97'] | I currently have three Macs:
2019 5K iMac
Early 2013 Retina MacBook Pro
Early 2015 12" MacBook (The tiny one)
In preparation for selling the old laptops to get a new MacBook Pro, I've been updating operating systems and backing up files and cleaning up the laptops. As part of this, I've set the laptops to sync my documents, my desktop, and my photos to iCloud.
All three Macs are on Catalina, and set to automatically keep themselves up-to-date.
The 5K iMac is my new home base machine, and will have the canonical local copies of all my documents and photos.
I don't understand why, in System Information > Storage Management, the reported contents of Documents and iCloud Drive are different on all three Macs. If iCloud is meant to store and sync files between all my Macs, wouldn't iCloud look the same to all three Macs, or is this reporting the local storage being taken up by iCloud?
Why are the Documents storage and the iCloud storage different, if iCloud contains the Documents directory?
Am I just confused as to what Documents is in relation to iCloud Drive?
Thank you for any insight. I find this really vexing. I was hoping iCloud would be a help in migration to a new MBP, but perhaps not? I've seen other migration solutions which involve copying home folders, or using rsync, or using Time Machine, and I could use any of those, but if iCloud can be an automagic solution, then why not try it?
| 162206b5bb43df34fa5924c574662b55c029a094cc1d1b9154451691fe88f4b7 | ['98ae4e21a40a403bbc46c20938d1ea97'] | Depends on your setup sometimes...
%domain\ admins ALL=(ALL) ALL
%domain\\domain\ admins ALL=(ALL) ALL
%domain\ <EMAIL_ADDRESS> ALL=(ALL) ALL
The last one is the one I actually had to use to get mine to work...I'm using sssd and realmd to join my domain.
Many suggestions in the past showed using domain^admins but that has never personally worked for me but according to many posts it has worked for others. Having the first word followed by a \ indicates there is a valid space and then doesn't read it as an invalid character. I hope this helps.
|
635746405a01293d78b14834ceb21a2befea8226231a18807007f564dfb35493 | ['98d1e322f2074398b1815b18f458329c'] | I have a ul which gets appended several lis after an AJAX request. The previous elements in the list get removed, why is this?
AJAX call function:
var $comments = $('.comments').find('ul');
$comments.text('Loading...');
$.ajax({
type: 'get',
url: 'http://localhost/codeigniter/',
success: function(result){
if (result == 0){
$comments.text('No comments.');
return;
}
$comments.text('');
display_comments(result);
}
});
List Display function:
function display_comments(result){
var result_comments = JSON.parse(result);
var <PERSON><PERSON> = $('.comments').find('ul');
for (var i = 0; i < comments.length; i++){
// Insert comments
lis += '\
<li>\
' + comments[i].title + '\
<p>' + comments[i].description +'\
</li>';
}
$ul.append(lis);
}
| 50a98200d8f7418da70b55bc1d98db617d83a9cffc4f7ae2c7cfcc7e5f4e0e3f | ['98d1e322f2074398b1815b18f458329c'] | I am requesting a site with cURL that atomatically logs in and although everything works perfectly every GET request after the script logs in will contain "localhost" in the URL instead of the actual domain of the site so it throws a 404 not found error.
Example: Instead of being https://remotesite.com/dashboard it does http://localhost.com/dashboard (Also notice it is not using https for http://localhost.com/dashboard)
Here is my code:
$curl = curl_init();
$user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:8.0) Gecko/20100101 Firefox/8.0';
$url = 'https://remotesite.com/dashboard';
$post_data = 'username=username&password=password&cookie=true&destination=&login=Log+In';
curl_setopt ($curl, CURLOPT_URL, $url);
curl_setopt ($curl, CURLOPT_USERAGENT, $user_agent);
curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($curl, CURLOPT_HEADER, 0);
curl_setopt ($curl, CURLOPT_POSTFIELDS, $post_data);
curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($curl, CURLOPT_AUTOREFERER, 1);
curl_setopt ($curl, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt ($curl, CURLOPT_COOKIEJAR, "cookie.txt");
$result = curl_exec ($curl);
$errmsg = curl_error($curl);
echo $result;
|
f41a4fcfd7859c4261c2ecd5058143e519b3f74dc44ffbb9f51526b655e35d0b | ['98da2283b501407f9655a9efd08e8ede'] | I believe this because you cannot use a comment on that position - simply remove the original c:/Program Files/Java/jdk1.6.0_26/bin/javaw.exe line (as it says: there is an invalid character # at the beginning). Btw it seems it is rather an issue in the m2e plugin (or it is a faulty configuration and this plugin faced the issue for the first time).
| 863cd956a1e6b2997f5cd5b5b6dcd10af0bf42d935912eec0910c49fd1db8063 | ['98da2283b501407f9655a9efd08e8ede'] | You met a common issue here: when you run something with the java -jar ... command, the -classpath ... property is dropped. The reason is security (Jar files can be digitally signed to ensure they weren't modified and it would be so easy to make java load a different dependency Jar file with the same content but with hijacked functionality).
The solution is simple: include the Class-Path: ... attribute too in your MANIFEST.MF file as you did with Main-Class: ....
|
37ec857a29750ff917d5bbfc92c53e935756c609b831e7399a2881f94ed62d5e | ['98eade53a89b474fb80bd57471d1974c'] | I guess I have understood what you mean. Given the wrong example code below:
input_signal = Input(shape=(L), name='input_signal')
input_h = Input(shape=(N), name='input_h')
faded= Lambda(lambda x: tf.nn.conv1d(input, x))(input_h)
You want to convolute each signal vector with different fading coefficients vector.
The 'conv' operation in TensorFlow, etc. tf.nn.conv1d, only support a fixed value kernel. Therefore, the code above can not run as you want.
I have no idea, too. The code you given can run normally, however, it is too complex and not efficient. In my idea, another feasible but also inefficient way is to multiply with the Toeplitz matrix whose row vector is the shifted fading coefficients vector. When the signal vector is too long, the matrix will be extremely large.
| b84d602d900ec06dc74af5e88c54a9ea7403b6fc9ac24b481a40eda78885e225 | ['98eade53a89b474fb80bd57471d1974c'] | In my problem, I want to convolve two tensors in my neural network model.
The shape of two tensors is [None, 2, 1], [None, 3, 1] respectively. The axis with dimension None means the batch size of the input tensor. For each sample in batch, I want to convolve the two tensors with shape [2, 1] and [3, 1].
However, the tf.nn.conv1d in TensorFlow can only convolve the input with a fixed kernel. Is there any function that can support the convolution of two tensors according to the batch size axis, similar to the tf.multiply which can multiply two tensors for each sample or just elementwise multiplication.
The code I ran can be simplified as follows:
input_signal = Input(shape=(L, M), name='input_signal')
input_h = Input(shape=(N), name='input_h')
faded= Lambda(lambda x: tf.nn.conv1d(input, x))(input_h)
What I want to do is that the sample of input_signal can be convolved by the sample of input_h with the same index. However, it just shows my pure idea which can not be able to run in the env. My question is that how I can modify the code to enable the input tensor can be convolved with another input tensor for every sample in the batch.
|
449503c0e04f3f20a573edd5f130e1335f95eea1d6b1d21d11fc81bf4f1bedf2 | ['98faacba94f1481db56dc099b757c277'] | Não estou conseguindo comparar dois mapas .
Ex:
map<string, any> columnsMap = {
{"status", 1}, {"client_delivered", 0}, {"client_notification", 0}};
map<string, any> columnsMap2 = {
{"status", 1}, {"client_delivered", 0}, {"client_notification", 0}};
if (columnsMap2 == columnsMap)
std<IP_ADDRESS>cout << "algo" << std<IP_ADDRESS>endl;
Mensagem recebida:
/usr/include/c++/9.3.0/bits/stl_pair.h:449:51: note: ‘const std<IP_ADDRESS>any’ is not derived from ‘const std<IP_ADDRESS>__cxx11<IP_ADDRESS>sub_match<_BiIter>’
[build] 449 | { return __x.first == __y.first && __x.second == __y.second; }
Existe alguma forma de fazer essa comparação direta?
Olhando a documentação std<IP_ADDRESS>any não tem o operador [operator==] implementado
| 1ed552cf17f188af7dbfad5517405a53f931e8282626449f7f658f759bdea907 | ['98faacba94f1481db56dc099b757c277'] | I have already deleted my search history but it seems that Facebook learnt my searches. Eg. There are 4 names starting with xy: xya, xyb, xyc, xyd Once I have searched for xyc and after it I have also deleted the logs. But now every time I type xy into the search input box, Facebook shows the name of xyc instead of showing all the names starting with xy or just some names eg. xya, xyb... It specially shows that name I have already searched.
How can I disable this?
How can I remove the names?
If 1,2 are not possible is there any workaround?
E.g. teach Facebook xyb instead of xyc?
I think this is against privacy.
The mentioned people are not my friends, not my followers, I am not their follower.
It is a fact that when I use Facebook from my PC I don't get the same typeahead suggestions as on mobile. The mobile ones annoy me, I would like to delete them but I am unable.
|
7c117c53a2acf8c6c16049c473085fe048a8128d0bcdc166db1d1a7f939594bb | ['99175b8ad9074bb6a6142bc14277bde0'] | And the winner is ...
portfolio.getProperty = function(propertyId) {
var property = $filter('filter')(portfolio.list, {id: +propertyId}, true);
return property;
};
The problem is that the search return a string, it had to be converted in an integer. but it's not easy to spot type issue in javascript...
Thank you for your help everyone.
| 16222fe83d39778153ab6b3bd848ef6c0ca767de3a1b3796d2529c38f309774c | ['99175b8ad9074bb6a6142bc14277bde0'] | I take that you probably have found an answer since then but I had the same problem than you so I just tried a few things and this works for me:
<html>
<head>
<script>
var app = angular.module('propertyDeal', ['ngCordova']);
app.controller('ThisCtrl', function($scope, $cordovaEmailComposer) {
$scope.email = function() {
document.addEventListener("deviceready", function () {
$cordovaEmailComposer.isAvailable().then(function() {
alert("email available");
}, function () {
alert = ("email not available");
});
var email = {
to: '<EMAIL_ADDRESS>',
cc: '<EMAIL_ADDRESS>',
bcc: ['<EMAIL_ADDRESS>', '<EMAIL_ADDRESS>'],
attachments: [
'file://img/logo.png',
'res://icon.png',
'base64:icon.png//iVBORw0KGgoAAAANSUhEUg...',
'file://README.pdf'
],
subject: 'Cordova Icons',
body: 'How are you? Nice greetings from Leipzig',
isHtml: true
};
$cordovaEmailComposer.open(email).then(null, function () {
alert("email not sent");
});
}, false);
}
});
</script>
</head>
<body>
<div ng-controller="ThisCtrl">
<button class="button" ng-click="email()">Send an email</button>
</div>
<script type="text/javascript" src="components/ngCordova/ng-cordova.min.js"></script>
<script type="text/javascript" src="cordova.js"></script>
</body>
</html>
not quite sure it's the right way of doing it but it works...
|
86190ccd65061f574bb91d58c8a5ee185e1e735c5d8a594b6b5bdd41907d9c76 | ['991b7ba21af04d28b4faafcc39df10ce'] | I am trying to display the number of posts made in custom post type "incidents" by the custom taxonomy "store".
eg.
Store 1: 8 posts
Store 2: 6 posts
etc.
I have been looking through here and only been able to find how to display the actual posts, which I do not need.
Thanks for any help!
| e832930991590bafb9b9341cfb1f7212e0fb3ae4d86d036a517dc8f6f8f2c5c9 | ['991b7ba21af04d28b4faafcc39df10ce'] | <PERSON> I have two gmail accounts set up through Mail, and I just checked and had some filters set up in one of my addresses that added labels to the emails, but nothing that moved its location, and no blocks. The other account has neither filters nor blocks. (And that second one is the one I think is having emails disappear). |
78ec11dd62b2c5b5e7788c4a0cf4508354fab2d4683e82f213381c38da0dcb91 | ['9928b1566b0e4d84891fcc982239e2d1'] | I have an ActiveRecord model (Profile) that has a HABTM association to model (Subject).
I am using Sunspot to search for all Profiles based on two fields that will be entered by user which is :zip and (subject.title).
I tried so many different examples on stackoverflow and exhausted my attempts at trying to find the answer. I am definitely new to rails and I would appreciate any help with this. Thank you.
Profile model
class Profile < ActiveRecord<IP_ADDRESS>Base
has_and_belongs_to_many :subjects
searchable do
string :zip
string :title do
subjects.title
end
end
ProfilesController#Index
def index
@search = Profile.search do
with(:zip, params[:zip])
# Don't know what to put here if this is even correct... ???
end
@profiles = @search.results
end
ProfilesView#Index
<%= form_tag profiles_path, method: :get do %>
<p>
<p>Enter Zip:</p>
<%= text_field_tag :zip, params[:search] %>
<p>Enter Subject:</p>
<%= text_field_tag :title, params[:search] %>
<%= submit_tag "Search", name: nil %>
</p>
<% end %>
<% for profile in @profiles %>
<ul style="list-style:none;">
<li> <%= link_to profile.name, profile %> </li>
<li> <%= profile.zip %></li>
<li><b>($<%= profile.rate %>)</b></li>
<% profile.subjects.each do |s| %>
<li> <%= s.title %> </li>
<% end %>
</ul>
<% end %>
| 33c8fda1c2487480b6b02c848ecb940be9ee6ac568b7dbd25d017c11bbe0b097 | ['9928b1566b0e4d84891fcc982239e2d1'] | Found out how to do it...
Profile Model
class Profile < ActiveRecord<IP_ADDRESS>Base
has_and_belongs_to_many :subjects
searchable do
text :subject_search
string :zip
end
def subject_search
subjects.map { |subject| subject.title }
end
end
Profiles#Controller
def index
@search = Profile.search do
fulltext :params[:subject_search]
with(:zip, params[:zip])
end
@profiles = @search.results
end
Profiles#Index
<%= form_tag profiles_path, method: :get do %>
<p>
<p>Enter Zip:</p>
<%= text_field_tag :zip, params[:search] %>
<p>Enter Subject:</p>
<%= text_field_tag :subject_search, params[:search] %>
<%= submit_tag "Search", name: nil %>
</p>
<% end %>
|
a82b7cf9f89a15ada984f4aa5ef50cd63f5ca53aa1b26aac3c3abccf59848302 | ['992c3f6d50884490a67eb05d6b9c7b8c'] | I was writing a code in C to find whether a given triangle is equilateral,isosceles or scalene. I have written it as :
#include<stdio.h>
#include<math.h>
int main()
{
float x1,x2,x3,y1,y2,y3;
float d1,d2,d3;
printf("Enter the co-ordinates of 1st vertex: \n");
scanf("%f%f", &x1,&y1);
printf("Enter the co-ordinates of 2nd vertex: \n");
scanf("%f%f", &x2,&y2);
printf("Enter the co-ordinates of 3rd vertex: \n");
scanf("%f%f", &x3,&y3);
d1= sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
d2= sqrt((x1-x3)*(x1-x3) + (y1-y3)*(y1-y3));
d3= sqrt((x2-x3)*(x2-x3) + (y2-y3)*(y2-y3));
if((d1==d2) && (d2==d3))
printf("Given triangle is equilateral");
else if((d1!=d2) && (d2!=d3) && (d1!=d3))
printf("Given triangle is scalene");
else
printf("Given triangle is isosceles but not equilateral");
}
Now, my problem is how to take input which is an irrational number as input at runtime ? For example, if I have to take √3 as input then how to take it, Is there any way to take square-root at runtime ?
Please help.
| 7a6eed0daf77cfd527b10e71f834995a0cb58ca81abcf601eb37aa467d45f19d | ['992c3f6d50884490a67eb05d6b9c7b8c'] | Regarding this question, for code snippet
for (i = 1; i <= n; i++)
int x = 10;
It is written there in the comment section that space complexity will be O(1). According to me, it should be O(n).
My Reasoning : Variable "x" should not be destroyed after each iteration of "for" loop. According to the scope rules, variable "x" can't be accessed outside the "for" loop because it is declared,defined and initialized in a block "{}" but this variable "x" is local to the function "main()" (Assuming, it is a C code and it is written in main()), So, lifetime of variable "x" will be there till the program gets terminated because activation record(stack frame) of function "main()" will be removed at the end of the program. As lifetime of "x" remains till the program ends, So, it means memory space for "x" will also be created after each iteration of "for" loop and should not be reused. So, there will be "n" copies of variable "x" in activation record of main().
Please correct me if I am wrong.
|
ad3d09fe594a6aac15332771a93f372218486dbb9a834da7976c592304463411 | ['992cfb8464c54c599e62bd52e1111fbf'] | I'm new to obj-c, here writing a convenience routine to fetch entities from a Core Data store. XCode is warning me that I'm missing a return value. Why?
- (NSArray *)findEntities:(NSString *)entityName byField:(NSString *)fieldName andValue:(id)fieldValue
{
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:entityName];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%K == %@", fieldName, fieldValue];
[fetchRequest setPredicate:predicate];
NSError *error;
NSArray *fetchedObjects = [context executeFetchRequest:fetchRequest error:&error];
if (error) {
NSLog(@"LWStore: findEntities error: %@", [error localizedDescription]);
}
return fetchedObjects;
}
The warning is attached to the executeFetchRequest line.
| 150b030a7c8de5c68c8e25884ecedc67c0664a8d1635e6b7e6fe19063a1c687c | ['992cfb8464c54c599e62bd52e1111fbf'] | I have a vertical stack view which can contain 1-3 subviews. The subviews should have height about 1/3 of stack view height, even when there's only one or two of them.
I tried adding:
view.heightAnchor.constraint(equalTo: stack.heightAnchor, multiplier: 0.3)
but it throws a constraint conflict, because stack view pins a subview to top and bottom.
Is there a way to do this with UIStackView?
|
42d681da2955ff298cbe9662cfd4d5889284031e120063b08f84b4d83c985e23 | ['994a485188284825870899f2b88cfdd4'] | I found one fix:
DO NOT attempt to boot the machine from the install. (may have to hard shutdown the machine)
Boot the machine from the Ubuntu 14.04 live DVD.
Change the root directory of the live session to the root directory of the install.
Rename the directory back to etc.
| 2941c568e25677a4167da0806a7366490db3b11faff883bf726accca8319f940 | ['994a485188284825870899f2b88cfdd4'] | I am a certified XenApp 6.5 Admin.
Basically, you are going to need an entire Windows Domain in order to get XenApp running.
This means paying for Window Server licensing fees, buying a huge server with an i7 and loads of memory, paying for Citrix XenApp licenses, etc.
This is the reason that it will be overkill for a single user with a single application.
XenApp is not for you.
Now, your next bet would be to see if your Chromebook uses an x86 processor (not an ARM) processor.
-If your Chromebook uses an ARM processor... sell it and or get a laptop/tablet with Windows that will run your application.
If your Chromebook happens to use an x86 processor AND your program works at Platinum level under WINE (https://www.winehq.org/) (You can find out how well it works searching in the WINE AppDB, https://appdb.winehq.org/), then you might be able to make it work by installing Ubuntu on your Chromebook, then installing WINE, and then installing your program.
If you are unable/uncomfortable installing Ubuntu on your Chromebook and or your program does not run at Platinum level using WINE: Sell your Chromebook and or get a Windows laptop to run your program.
TL;DR:
If your Chromebook is x86 AND you can install Ubuntu AND your program runs at Platinum level using WINE, then install Ubuntu, install WINE, install your program.
If not, then get a Windows laptop/tablet.
|
ef96dd82b6dec672dcc7ac7318ecdb9260cee4a9d2574b5485c92d657f26ca6c | ['994b7c99046944d6a7bd0f2c1e11c266'] | Well, I've manage to get all the books with the attachment by adding in the contextual filter with the relation : Content:Nid > Content referencing Content from field entity reference to the author. However, now I still get a duplicate book node, ex: if the author only has one book, the book still shows.... | d8aeb7edbe4bef4c1185232242ea750454aad0ff89bad29ca22ec1dfe4719a58 | ['994b7c99046944d6a7bd0f2c1e11c266'] | Suppose I have a sequence of positive continuous random variables $\{X_k\}_{k=1}^\infty$ with (unknown) MGF's $M_{X_k}(s)$. Furthermore, it is known that
\begin{equation}\frac{X_n-n\mu}{\sqrt{n}\sigma}\rightarrow\mathcal{N}(0,1),\end{equation}
for some known $\mu$ and unknown $\sigma$. Given the function
\begin{equation}F[z,s]=\sum_{n=0}^\infty z^{-n} M_{X_n}(s),\end{equation}
is it possible to extract $\sigma$ without the use of inverse transforms?
For example:
\begin{equation}F[z,s]=\frac{zs}{1-e^s+zs}.\end{equation}
Answer: $\sigma^2=\frac{1}{12}$.
|
ddd1561df88ddd0893039fcee1df980fed2a5993d0921cb208f5cb5020d28ebe | ['99697b2f77ff4aad8bf99aa5151c2d5a'] | Okay, so I'm making a program where you have two radio boxes to choose from, for the time being, lets call them rb1 and rb2. And so, Which ever one you choose, you press the launch button (BtnLaunch) and the program will launch depending on which radiobox you chose.
The problem I am having is that it only works on my computer as my file path for these programs are in my Z:\ Hard Drive where as most people have C:\ or E:. So I'd like it if the user could choose the file path for rb1 and rb2 and so the next time they open the program, it saves so that they don't need to write the path for the file location again.
So if you dont understand here is my code for radiobuttons:
Private Sub BtnLaunch_Click(sender As Object, e As EventArgs) Handles BtnLaunch.Click
If BtnServer1.Checked = True Then Process.Start("Z:\Path\Program1")
If BtnServer2.Checked = True Then Process.Start("Z:\Path\Program2")
End Sub
So I would like to replace the path with the users choice of path as some people will have ("C:\OtherFolderName\Program") and other will have different. I really hope you understand. Please be broad in answers as I'm new to VB.
Thank you.
| 83459a59861c7c17189f41d332a8dcb912a3257e8c685c8af5143e5552ce9ce6 | ['99697b2f77ff4aad8bf99aa5151c2d5a'] | so I'm currently developing my first app. I'm just creating a simple map app with different markers on it.
So it's all working perfectly well in the emulator. But when I run the published .apk on my phone, the map doesn't show. It has the GUI but there aren't any continents.
Does this have something to do with the API I got?
Note: I'm running the app on my Samsung Galaxy S6.
|
ffa8579631b0c6395b8689ccf359850878d833d10ff360c11e9c45aeed60eaf4 | ['998706e5b31f457f96139d8fdd541c8e'] | I want show own loaction from a address was input by user use LocationOverlay and show position by a small dot or anything by icon....(ex: can show this position by a flag.png )But now i don't know how show it on map.Can you help me!
source code:
public class Main extends MapActivity implements LocationListener {
private static double lat;
private static double lon;
private MapController mapControl;
private MapView mapView;
LocationManager locman;
Location loc;
String provider = LocationManager.GPS_PROVIDER;
String TAG = "GPStest";
Bundle locBundle;
private int numberSats = -1;
private float satAccuracy = 2000;
private float bearing;
private double altitude;
private float speed;
private String currentProvider;
private TextView txt;
private double lat1;
private double lon1;
private Drawable marker;
private Geocoder gcoder;
private MyLocationOverlay me = null;
long GPSupdateInterval; // In milliseconds
float GPSmoveInterval; // In meters
private MyMyLocationOverlay myLocationOverlay;
private List<Overlay> mapOverlays;
public DisplayOverlay displayOverlay;
private EditText address;
Button test;
private Button btnMylocation;
private Button btnAddrress;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_long_van_map);
gps();
btnMylocation = (Button) findViewById(R.id.button1);
// get my location
btnMylocation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
gps();
}
});
gcoder = new Geocoder(this);
me = new MyLocationOverlay(this, mapView);
address = (EditText) findViewById(R.id.editText1);
btnAddrress = (Button) findViewById(R.id.button2);
//Get postion from address
btnAddrress.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String add = address.getText().toString();
try {
List<Address> addresses = gcoder
.getFromLocationName(add, 1);
if (addresses == null) {
// return point;
}
// just get first item of list address
Address add2 = addresses.get(0);
lat1 = add2.getLatitude();
lon1 = add2.getLongitude();
} catch (IOException e) {
}
GeoPoint newPoint = new GeoPoint((int) (lat1 * 1e6),
(int) (lon1 * 1e6));
mapControl.animateTo(newPoint);
marker = getResources().getDrawable(R.drawable.startpoint);
marker.setBounds(0, 0, marker.getIntrinsicWidth(),
marker.getIntrinsicHeight());
//mapView.getOverlays().add(new SitesOverlay(marker));
mapView.getOverlays().add(me);
}
});
}
//Info gps of me
public void gps() {
updateGPSprefs();
locman = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
// Listener for GPS Status...
final GpsStatus.Listener onGpsStatusChange = new GpsStatus.Listener() {
public void onGpsStatusChanged(int event) {
switch (event) {
case GpsStatus.GPS_EVENT_STARTED:
// Started...
break;
case GpsStatus.GPS_EVENT_FIRST_FIX:
// First Fix...
Toast.makeText(Main.this, "GPS has First fix",
Toast.LENGTH_LONG).show();
break;
case GpsStatus.GPS_EVENT_STOPPED:
// Stopped...
break;
case GpsStatus.GPS_EVENT_SATELLITE_STATUS:
// Satellite update
break;
}
//GpsStatus status = locman.getGpsStatus(null);
// Not presently doing anything with following status list for
// individual satellites
// Iterable<GpsSatellite> satlist = status.getSatellites();
}
};
locman.addGpsStatusListener(onGpsStatusChange);
locman.requestLocationUpdates(provider, GPSupdateInterval,
GPSmoveInterval, this);
Log.i(TAG, locman.toString());
// Add map controller with zoom controls
mapView = (MapView) findViewById(R.id.Mapview);
mapView.setSatellite(false);
mapView.setTraffic(false);
mapView.setBuiltInZoomControls(true); // Set android:clickable=true in
// main.xml
int maxZoom = mapView.getMaxZoomLevel();
int initZoom = (int) (0.95 * (double) maxZoom);
mapControl = mapView.getController();
mapControl.setZoom(initZoom);
// Set up compass and dot for present location map overlay
List<Overlay> overlays = mapView.getOverlays();
myLocationOverlay = new MyMyLocationOverlay(this, mapView);
overlays.add(myLocationOverlay);
// Set up overlay for data display
displayOverlay = new DisplayOverlay();
mapOverlays = mapView.getOverlays();
mapOverlays.add(displayOverlay);
txt = (TextView) findViewById(R.id.textView1);
txt.setText(LongVanMap.gettext());
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
@Override
public void onLocationChanged(Location location) {
// TODO Auto-generated method stub
// Called when location has changed
centerOnLocation();
}
@Override
public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub
locman.removeUpdates(this);
}
@Override
public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub
locman.requestLocationUpdates(provider, GPSupdateInterval,
GPSmoveInterval, this);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
centerOnLocation();
}
// Method to assign GPS prefs
public void updateGPSprefs() {
int gpsPref = Integer.parseInt(Prefs
.getGPSPref(getApplicationContext()));
switch (gpsPref) {
case 1:
GPSupdateInterval = 5000; // milliseconds
GPSmoveInterval = 1; // meters
break;
case 2:
GPSupdateInterval = 10000;
GPSmoveInterval = 100;
break;
case 3:
GPSupdateInterval = 125000;
GPSmoveInterval = 1000;
break;
}
}
}
| d7d5107770b6737291dece7d90c6f30015078b0e7e147f45be4650a98cfbb699 | ['998706e5b31f457f96139d8fdd541c8e'] | I writen a application use webview. When i run on android 4.4 or less, my application run normal. But when run it on android 5.0, my webview don't show content of combobox as on screenshot. When i use webrowser default of android, it load my web normal.
When i run my application
When i use webrowser default of android 5.0.
My code:
private WebView webPos;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
progressDialog = new ProgressDialog(this);
webPos = (WebView) findViewById(R.id.webPos);
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
try {
version = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
CallUrl wst = new CallUrl(CallUrl.GET_TASK, this,version);
String Server = "http://androidquery.appspot.com/api/market?app=longvan.mobile.softflowspos";
wst.execute(new String[] {
Server
});
webPos.setWebChromeClient(new WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
progressDialog.setMessage("Đang tải..." + newProgress + "%");
//Log.i("Url hiện tại là: ", webPos.getUrl());
}
});
webPos.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
progressDialog.dismiss();
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
progressDialog.setCancelable(false);
progressDialog.show();
}
public void onReceivedError(WebView webView, int errorCode, String description, String failingUrl) {
Log.i("Error Web View Client: ", description);
Alert alert = new Alert(SoftflowsPos.this, "Server đang bảo trì. Ứng dụng sẽ tạm thời đóng ngay <PERSON>.");
alert.showAlert();
}
});
webPos.getSettings().setJavaScriptEnabled(true);
webPos.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webPos.getSettings().setSavePassword(true);
webPos.getSettings().setLoadsImagesAutomatically(true);
webPos.getSettings().setDatabaseEnabled(false);
webPos.getSettings().setDomStorageEnabled(true);
webPos.getSettings().setLoadWithOverviewMode(true);
webPos.getSettings().setUseWideViewPort(false);
webPos.getSettings().setSupportZoom(false);
webPos.getSettings().setBuiltInZoomControls(false);
webPos.getSettings().setDisplayZoomControls(false);
webPos.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
webPos.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webPos.getSettings().setAppCacheEnabled(false);
webPos.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webPos.setScrollbarFadingEnabled(true);
webPos.setFocusable(true);
webPos.setInitialScale(100);
if (Build.VERSION.SDK_INT >= 19) {
webPos.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
webPos.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}
TestConnect testConnect = new TestConnect();
Boolean flag = testConnect.execute(urlTest).get();
if (isNetwworkAvailable() == true) {
if (flag == true) {
if (savedInstanceState != null) {
webPos.restoreState(savedInstanceState);
} else {
webPos.loadUrl(urlServer);
}
} else {
Alert alert = new Alert(this, "Server <PERSON>. Ứng dụng sẽ <PERSON>.");
alert.showAlert();
}
} else {
Alert alert = new Alert(this, "Thiết bị của bạn chưa có kết nối mạng. Ứng dụng sẽ đóng ngay bây giờ.");
alert.showAlert();
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
Log.i("Thông tin version bị lỗi: ", e.toString());
} catch (InterruptedException e) {
e.printStackTrace();
Log.i("Kiểm tra kết nối bị lỗi: ", e.toString());
} catch (ExecutionException e) {
e.printStackTrace();
}
}
|
8a5fccedd18e70326d425a1f0458e704070d9a27f78e7945f4578ca8c0181672 | ['9987d76bd23540d7bc45176ea1e7f29e'] | I want to download only the last line displayed on the server to my android device. Can you please tell me the process or give a basic idea. I am trying to download files and then compare. But cant we do by just fetching the last line.
try {
BufferedReader br1 = new BufferedReader(new FileReader(file1));
BufferedReader br2 = new BufferedReader(new FileReader(file2));
String strLine1, strLine2;
boolean isSame = true;
StringBuilder finalText = new StringBuilder();
strLine1 = br1.readLine();
strLine2 = br2.readLine();
if (strLine1.equals(strLine2))
Toast.makeText(getBaseContext(), strLine2,
Toast.LENGTH_LONG).show();
else {
isSame = false;
Toast.makeText(getBaseContext(), strLine1,
Toast.LENGTH_LONG).show();
tv.setText(finalText.toString());
}
}finally{
}
| efbc6a1a77da53c51dad2ad4398683cf7414ad8efb3ac25a26031aedf5dbfb9f | ['9987d76bd23540d7bc45176ea1e7f29e'] | i have made a server using php. The server is getting new information after some time. I want the server page to display only the current information. when a new information is received, it should delete the previous one and show only the recent. Can you help me in this.
my current code is:
<?php
$fp=fopen("random.txt","a");
fwrite($fp,$_POST['data']."\n");
echo $_POST['data'];
fclose($fp);
?>
|
ad6e7a16e43fd048e9a3688a685bc8d196ba452dd8349c7150eb73a42a541f48 | ['998b42870fde4deab5932b4e79f81531'] | Given an array of positive integers, find the max no that can be formed by any permutation of the arrangement. I would like to know if there are any better Data Structures which can allow to give a more elegant solution for problem.
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
public class FindMaximumNumbersFromPermutation {
static class DS implements Comparable<DS> {
int intAtI;
Integer[] actualInt;
public DS(int intAtI, Integer[] actualInt) {
super();
this.intAtI = intAtI;
this.actualInt = actualInt;
}
@Override
public int compareTo(DS o) {
if(intAtI < o.intAtI)
return 1;
else if(intAtI == o.intAtI)
return 0;
else return -1;
}
@Override
public String toString() {
String s="";
for(int i=0;i<actualInt.length;i++)
s= s+actualInt[i];
return s;
}
}
public static void main(String[] args)
{
int[] arr = {21,9,23};
List<Integer[]> list = new ArrayList<Integer[]>();
int maxLength= 0;
for(int i=0;i<arr.length;i++)
{
Integer[] digitsArray = getDigitsArray(arr[i]);
if(digitsArray.length > maxLength)
maxLength = digitsArray.length;
list.add(digitsArray);
}
List<Integer[]> output = new ArrayList<Integer[]>();
for(int currentLength=0;currentLength<=maxLength;currentLength++)
doWork(list, output, currentLength);
for(int i=0;i<output.size();i++)
{
Integer[] temp = output.get(i);
for(int j=0;j<temp.length;j++)
{
System.out.print(temp[j]);
}
}
}
private static void doWork(List<Integer[]> list, List<Integer[]> output,
int currentLength) {
List<DS> dsList = new ArrayList<DS>();
for(int i=0;i<list.size();i++)
{
Integer[] temp = list.get(i);
if(temp.length>currentLength)
{
dsList.add(new DS(temp[currentLength],temp));
}
}
Collections.sort(dsList);
Map<Integer,List<Integer[]>> map = new TreeMap<Integer,List<Integer[]>>();
for(int i=0;i<dsList.size();i++)
{
DS ds = dsList.get(i);
if(!map.containsKey(ds.intAtI))
{
List<Integer[]> l = new ArrayList<Integer[]>();
l.add(ds.actualInt);
map.put(ds.intAtI, l);
}
else
{
List<Integer[]> l = map.get(ds.intAtI);
l.add(ds.actualInt);
map.put(ds.intAtI, l);
}
}
ArrayList<Integer> keys = new ArrayList<Integer>(map.keySet());
for(int i=keys.size()-1;i>=0;i--)
{
Integer key = keys.get(i);
List<Integer[]> l = map.get(key);
if(l.size() ==1)
output.add(l.get(0));
}
}
static Integer[] getDigitsArray(int integer)
{
String s = integer+"";
Integer[] ret = new Integer[s.length()];
for(int i=0;i<s.length();i++)
{
ret[i] = Integer.parseInt(s.charAt(i)+"");
}
return ret;
}
}
| 5145ef5a6bdeb3a4be4139a22193b784a897df62ab06a204e9e6ecb267056eef | ['998b42870fde4deab5932b4e79f81531'] | Please try using NSIS (http://nsis.sourceforge.net/Main_Page). Basically you will need to write a NSIS script to do the following
Check if JAVA exists. [Depending on 32 or 64 bit machine you need to check different node]
Get the java path
Run the command java -jar XXXX
There are many sample scripts available on NSIS site. Let me know if you need more help. I will send you sample script.
|
8574457d5b9e52fff082a97721051566c5608f3ab1902f79c5a49617a91e7841 | ['99985463bc7d4c2d83d16039e7c89df6'] | I have solved the problem with recursion. I simply divide the dataset into an almost equal part for every iteration.
public int recursion(int M, int N) {
if (N - M == 1) {
return M ^ N;
} else {
int pivot = this.calculatePivot(M, N);
if (pivot + 1 == N) {
return this.recursion(M, pivot) ^ N;
} else {
return this.recursion(M, pivot) ^ this.recursion(pivot + 1, N);
}
}
}
public int calculatePivot(int M, int N) {
return (M + N) / 2;
}
Let me know your thoughts over the solution. Happy to get improvement feedbacks. The proposed solution calculates the XOR in 0(log N) complexity.
Thank you
| 7137eca5f340305cdc02eb7b6409d1807b6172b0f7ed261a7f9c574ac832e987 | ['99985463bc7d4c2d83d16039e7c89df6'] | I'm trying to implement a reminder app.I have all reminder details stored in sqlite database such id,title,dateInfo,timeInfo etc.
I want to notify the user at appropriate time about the reminder for which i would be using AlarmManager.
Is the below given steps feasible.
Providing id of row as requestCode in pendentingIntents.
Then setting an alarm that would call a service once triggered.
The service would use this id to get data from the database.
If this is feasible can anyone pls provide me with a code snippet.
Any help would be highly appreciated
|
b244d4f1c58933f0b6b2c780b2f8b1f24a1c72451878b8eb2d87967ae1884748 | ['9998c1c2c82e4e9ca83d8db4ad2815f7'] | I have a Booking model which contains created_at and updated_at attributes. I am using association and making use of joins. But when i am doing this i am get createdAt, created_at for attribute created_at and updatedAt, updated_at for attribute updated_at. I am unable to figure what i making it to return 2 column for single attribute.
models/booking.js
...
Booking.init({
booking_id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true
},
slot_time: {
type: Sequelize.DATE,
allowNull: false,
required: true
},
is_active: {
type: Sequelize.INTEGER,
allowNull: false,
required: true,
is:/^[01]$/,
defaultValue: 1
},
created_at: {
type: Sequelize.DATE,
required: true,
allowNull: false,
defaultValue: Sequelize.NOW
},
updated_at: {
type: Sequelize.DATE,
required: true,
allowNull: false,
defaultValue: Sequelize.NOW
}
},{
sequelize,
modelName:'booking',
underscored: true
});
...
models/index.js
...
var result = await Store.findAll({
where: { owner_id: data['owner_id']},
include: [{
model: booking,
where: {
slot_time: {
[Op.gte]: start_date
},
is_active: 1
}
}]
});
...
Output:
"owner_id": 1,
"bookings": [
{
"booking_id": 1,
"slot_time": "2020-05-19T06:30:00.000Z",
"is_active": 1,
"created_at": "2020-05-18T08:39:38.000Z",
"updated_at": "2020-05-18T08:39:38.000Z",
"createdAt": "2020-05-18T08:39:38.000Z",
"updatedAt": "2020-05-18T08:39:38.000Z",
"customer_id": 1,
"store_id": 2
},
{
"booking_id": 5,
"slot_time": "2020-05-19T11:30:00.000Z",
"is_active": 1,
"created_at": "2020-05-18T08:49:13.000Z",
"updated_at": "2020-05-18T08:49:13.000Z",
"createdAt": "2020-05-18T08:49:13.000Z",
"updatedAt": "2020-05-18T08:49:13.000Z",
"customer_id": 1,
"store_id": 2
}
]
| b6cd2c6a4439fb7812aed6e435670b8437fcf71f610a3e0b32a6a40ac83e3486 | ['9998c1c2c82e4e9ca83d8db4ad2815f7'] | I am trying to setup semantic ui react using the steps given https://react.semantic-ui.com/theming. But i don't know what is going wrong here.
/craco.config.js
module.exports = {
plugins: [{ plugin: require('@semantic-ui-react/craco-less') }],
}
/src/semantic-ui/theme.config
....
/*******************************
Folders
*******************************/
/* Path to theme packages */
@themesFolder : 'themes';
@siteFolder : '../../src/semantic-ui/site';
@import (multiple) "~semantic-ui-less/theme.less";
@fontPath : '../../../themes/@{theme}/assets/fonts';
/* Path to site override folder */
@siteFolder : 'site';
....
Error:
@import (multiple) "theme.less";
^ Can't resolve in <path>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.