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 |
|---|---|---|---|---|---|
bce426cd4bd657bb53fb3c9b5f724e4c4b53a8d8b41ba402f6203e53ff223969 | ['f93abe8f19b143058bedd22eb47f1285'] | This is my very first app. All I need is five buttons, two that call certain phone numbers (only have created one so far) and three buttons that take the user to a certain URL. I have no errors or warnings or any direction on how to navigate the LogCat.
LogCat:
10-08 14:41:40.716: D/AndroidRuntime(793): Shutting down VM
10-08 14:41:40.716: W/dalvikvm(793): threadid=1: thread exiting with uncaught exception (group=0x41465700)
10-08 14:41:40.777: E/AndroidRuntime(793): FATAL EXCEPTION: main
10-08 14:41:40.777: E/AndroidRuntime(793): java.lang.RuntimeException: Unable to start activity ComponentInfo{acps.mhs/acps.mhs.MainActivity}: java.lang.NullPointerException
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.os.Handler.dispatchMessage(Handler.java:99)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.os.Looper.loop(Looper.java:137)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.ActivityThread.main(ActivityThread.java:5103)
10-08 14:41:40.777: E/AndroidRuntime(793): at java.lang.reflect.Method.invokeNative(Native Method)
10-08 14:41:40.777: E/AndroidRuntime(793): at java.lang.reflect.Method.invoke(Method.java:525)
10-08 14:41:40.777: E/AndroidRuntime(793): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-08 14:41:40.777: E/AndroidRuntime(793): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-08 14:41:40.777: E/AndroidRuntime(793): at dalvik.system.NativeStart.main(Native Method)
10-08 14:41:40.777: E/AndroidRuntime(793): Caused by: java.lang.NullPointerException
10-08 14:41:40.777: E/AndroidRuntime(793): at acps.mhs.MainActivity.onCreate(MainActivity.java:25)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.Activity.performCreate(Activity.java:5133)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
10-08 14:41:40.777: E/AndroidRuntime(793): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
10-08 14:41:40.777: E/AndroidRuntime(793): ... 11 more
10-08 14:42:19.696: I/Process(793): Sending signal. PID: 793 SIG: 9
Mainactivity.java
package acps.mhs;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
public class MainActivity extends Activity implements View.OnClickListener {
Button mhshome, pp, mhsdir, cmhs;
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
mhshome = (Button) findViewById(R.id.mhshome);
pp = (Button) findViewById(R.id.pp);
mhsdir = (Button) findViewById(R.id.mhsdir);
cmhs = (Button) findViewById(R.id.cmhs);
mhshome.setOnClickListener(this);
pp.setOnClickListener(this);
mhsdir.setOnClickListener(this);
cmhs.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch(v.getId()) {
case R.id.mhshome:
<PERSON> = Uri.parse("http://www2.k12albemarle.org/school/mohs/Pages/default.aspx");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
break;
case R.id.pp:
<PERSON> = Uri.parse("http://www2.k12albemarle.org/school/MOHS/Pages/Directory.aspx");
Intent intent2 = new Intent(Intent.ACTION_VIEW, uri2);
startActivity(intent2);
break;
case R.id.mhsdir:
Uri uri3 = Uri.parse("http://www2.k12albemarle.org/school/MOHS/Pages/Directory.aspx");
Intent intent3 = new Intent(Intent.ACTION_VIEW, uri3);
startActivity(intent3);
break;
case R.id.cmhs:
Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:<PHONE_NUMBER>"));
startActivity(callIntent);
break;
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<Button
android:id="@+id/pp"
style="@style/AppBaseTheme"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/mhshome"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="@string/pp"/>
<Button
android:id="@+id/mhshome"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="26dp"
android:onClick="onClick"
android:text="@string/mhshome" />
<Button
android:id="@+id/mhsdir"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/pp"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/mhsdir" />
<Button
android:id="@+id/cmhs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/mhsdir"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="@string/callmhs" />
</RelativeLayout>
Its gonna be something incredibly simple I'm certain. Please point me in the right direction.
| 9a4f5727b5ca5aef3cf6fe9a6533377fe3e8b50f4bad3c604d3d98db4db43c68 | ['f93abe8f19b143058bedd22eb47f1285'] | I am trying my hand at developing simple apps with the Android Studio and I cannot seem to run even the default app with a blank activity containing the string "Hello World". When I try and run a device on a running Emulator, it gives me an error message and says it the app is not compatible on a watch. I don't know why it would think the emulator is a watch, but I don't know why I cannot emulate an app without changing anything manifest on the simplest AVD provided. Here is an image of the compatibility http://imgur.com/DEWoaON
08-26 16:09:16.500 733-733/com.example.mac.trial3 E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.mac.trial3, PID: 733
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mac.trial3/com.example.mac.trial3.MyActivity}: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2197)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5026)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.util.AndroidRuntimeException: You cannot combine swipe dismissal and the action bar.
at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:275)
at com.android.internal.policy.impl.PhoneWindow.generateLayout(PhoneWindow.java:2872)
at com.android.internal.policy.impl.PhoneWindow.installDecor(PhoneWindow.java:3129)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:303)
at android.app.Activity.setContentView(Activity.java:1930)
at com.example.mac.trial3.MyActivity.onCreate(MyActivity.java:14)
at android.app.Activity.performCreate(Activity.java:5242)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2161)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2258)
at android.app.ActivityThread.access$800(ActivityThread.java:138)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1209)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5026)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:777)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)
|
a56853a7ab55099ac846905f0fb6012be62e92b81316aa3ebb360d0fbdc37a2d | ['f9463cf04031436381e48b26e3cffcf5'] | I'm writting a program that takes two Strings as input, and search through the second if the first one is present. To return true, the first String has to be in a middle of word inside the second String. It cannot begin/end a word in the second String.
Exemple 1 (must return true):
String s1 = "gramm";
String s2 = "Java is a programming langage"
Exemple 2 (must return false):
String s1 = "cook";
String s2 = "Java is not a cooking langage"
Here is my non-working code:
Scanner scanner = new Scanner(System.in);
String part = scanner.nextLine();
String line = scanner.nextLine();
Pattern pattern = Pattern.compile("\\w+"+part+"\\w+",Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(line);
System.out.println(matcher.matches()) ;
| 567a4a28627fef0fb6c410f8aa92e8a555f5938862b0d855d1599a3a2de3d8d4 | ['f9463cf04031436381e48b26e3cffcf5'] | I'm trying to make my version of game of life but I'm stuck trying to make use of Threads to give the program the ability to pause and resume.
I use a Thread to execute the main Jpanel, where we can see the different generations, when I click on "pause" the screen successfully pauses but when it resumes 5 seconds later (because I use Thread.sleep(5000)), I realize that the screen froze but the game was actually still running, it just wasn't updating the screen.
Like it pauses at generation #5 and resumes at generation #11, and obviously I want the game to resume right where it paused but I tried many things and so far nothing works. Any help would be great.
GameOfLife Class:
public class GameOfLife extends JFrame implements ActionListener {
static JLabel aliveLabel = new JLabel("Alive:");
static JLabel GenerationLabel = new JLabel("Generation #");
static SimpleCellGrid body = new SimpleCellGrid();
static JPanel header = new JPanel();
static int genNumber = 1;
static JButton PlayToggleButton = new JButton("pause");
static JButton ResetButton = new JButton("b");
static Thread t1 = new Thread(body, String.valueOf(header));
public GameOfLife() throws IOException {
super("Game of life");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(700, 660);
setLocationRelativeTo(null);
setLayout(new FlowLayout());
GenerationLabel.setName("GenerationLabel");
aliveLabel.setName("aliveLabel");
PlayToggleButton.setName("PlayToggleButton");
ResetButton.setName("ResetButton");
PlayToggleButton.addActionListener(this);
ResetButton.addActionListener(this);
PlayToggleButton.setIcon(new ImageIcon(play));
ResetButton.setIcon(new ImageIcon(reset));
PlayToggleButton.setPreferredSize(new Dimension(40,30));
ResetButton.setPreferredSize(new Dimension(40,30));
header.setLayout(new FlowLayout());
header.setPreferredSize(new Dimension(100, this.getHeight()));
header.add(PlayToggleButton);
header.add(ResetButton);
header.add(GenerationLabel);
header.add(aliveLabel);
body.setLayout(new BorderLayout());
body.setPreferredSize(new Dimension(500, this.getHeight()));
add(header, BorderLayout.WEST);
add(body, BorderLayout.CENTER);
setVisible(true);
}
public static void updateLabels(){
body.run();
GenerationLabel.setText("Generation #"+ genNumber++);
aliveLabel.setText("Alive: "+ body.totalAlive());
try {
Thread.sleep(100);
updateLabels();
} catch (InterruptedException ignore) { }
}
@Override
public void actionPerformed(ActionEvent e) {
if(e.getActionCommand().equals("pause")){
try {
t1.sleep(5000);
PlayToggleButton.setEnabled(true);
} catch (InterruptedException ex) {
t1.start();
}
}
}
public static void main(String[] args) throws IOException {
new GameOfLife();
updateLabels();
}
}
SimpleCellGrid class:
public class SimpleCellGrid extends JPanel implements Runnable{
private static final int ROWS = 50;
private static final int COLS = 50;
private static final int CELL_WIDTH = 10;
private static SimpleCell[][] cellGrid = new SimpleCell[ROWS][COLS];
public SimpleCellGrid() {
for (int row = 0; row < cellGrid.length; row++) {
for (int col = 0; col < cellGrid[row].length; col++) {
int x = col * CELL_WIDTH;
int y = row * CELL_WIDTH;
cellGrid[row][col] = new SimpleCell(x, y, CELL_WIDTH);
if (new Random().nextBoolean()) {
cellGrid[row][col].setAlive(true);
} else {
cellGrid[row][col].setAlive(false);
}
}
}
}
public int totalAlive(){
int totalAlive = 0;
for (SimpleCell[] simpleCells : cellGrid) {
for (int j = 0; j < cellGrid.length; j++) {
if (simpleCells[j].isAlive())
totalAlive++;
}
}
return totalAlive;
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
Graphics2D g2 = (Graphics2D) g;
for (SimpleCell[] cellRow : cellGrid) {
for (SimpleCell simpleCell : cellRow) {
simpleCell.draw(g2);
}
}
}
@Override
public void run() {
cellGrid = new GenerationMaker4().nextGeneration(cellGrid);
repaint();
}
}
|
bedeacd353b3841e3a4068bfa8c87451e363d9f9f6c27fa130ac3b48d08a3333 | ['f951bada0e994b80bbe53beb5fa765aa'] | I would personally put a delay on the hyperlink. For example, a 5 second delay - so that when the button is clicked, the audio would play (during the delay) and then take the person to the link specified.
For example:
<html>
<head>
<!-- This is where the delay is specified -->
<script>
function delay (URL) {
setTimeout( function() { window.location = URL }, 5000 );
}
</script>
</head>
<body>
<!-- This is where the audio file is specified -->
<audio id="player" src="../media/Click.mp3"></audio>
<!-- The hyperlink is specified via the javascript delay -->
<div>
<a href="javascript:delay('/index.html')" onclick="document.getElementById('player').play()">Home</a>
</div>
</body>
</html>
Please note: In the example above, the delay is set to 5 seconds (5000 milliseconds). This can be changed according to the amount of time you want the user to hear the audio. Also, in the href, change the /index.html to the destination page, but ensure that the URL is specified within the apostrophes, e.g. 'URL'.
Hope this helps.
| 5c60ec75cba912a65b1d622eaa0084ed102d748610d5ddddf651080b4d0e43a5 | ['f951bada0e994b80bbe53beb5fa765aa'] | We can do this purely through CSS thanks to the background-size property now in CSS3. We'll use the html element (better than body as it's always at least the height of the browser window). We set a fixed and centered background on it, then adjust it's size using background-size set to the cover keyword.
html {
background: url(XXX) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
Note: Copy your URL into the XXX area, for example: images/bg.jpg. Then copy and paste the above into your CSS stylesheet.
Works in:
- Safari 3+
- Chrome Whatever+
- IE 9+
- Opera 10+
- Firefox 3.6+
Hope this helps.
|
44254093e84581624db80af2186012000f9da40d92941adcea3adf6c441fa5d1 | ['f958420c6014485f910045e296b544fe'] | The reason why you're getting the error Type Error: Cannot read property 'data' of undefined is because you're trying to accessthis when the arrow notation function in the axios request changes the this reference. You'd actually want to do something like this instead:
import axios from 'axios'
export default {
name: 'ListArticle',
data () {
return {
hasil: []
}
},
created () {
// Create reference to this so you can access the Vue
// reference inside arrow notation functions
var self = this;
axios.get('http://xxx.xxxxx.com/api/laravel')
.then(response => (self.hasil = response))
}
}
| 2da5fccaddd37f20d6beb8050f5c5c9bfffcf1ce853ed1dc7b1f454290793ea9 | ['f958420c6014485f910045e296b544fe'] | There's not a whole lot you can do to add classes to elements that deep inside a premade component unless you fork the codebase for said codebase on github and modify it to make it possible.
An alternative would be to add a class to the actual component itself and then use css selectors to affect those elements.
To do so you might do something like:
.pagination li a {
// Styles affecting the a element here
}
Having looked through the documentation for Vue Datatable, it appears as if you can add custom templates for the tables but not the table pager component.
|
16c98754894601c71b35d42097a953f320ab88cba481e6475903c59e5fd33164 | ['f95f4ed0690043459364b4b5f96b86a0'] | I am creating a software that generates some barcodes in a pdf file. The code I am using to generate the barcodes is given below. The return of the method I set to my "imagBarcode.Src", that is an image tag running in the codebehind. For some reason, the barcodes generated are not being read by any barcode reader. Can someone give me some help to understand what's going on with my code. Thanks in advance.
public string GenerateBarCode(string code)
{
BarcodeInter25 code25 = new BarcodeInter25();
code25.ChecksumText = true;
code25.Code = code;
byte[] barCodeResult;
System.Drawing.Image bc = code25.CreateDrawingImage(System.Drawing.Color.Black, System.Drawing.Color.White);
using (MemoryStream ms = new MemoryStream())
{
bc.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
barCodeResult = ms.ToArray();
}
var barCode = "data:image/png;base64," + Convert.ToBase64String(barCodeResult);
return barCode;
}
| ab075eefbd90d8b99f19c38489dd3b773f1d334653f49d126a7bff182354b5b1 | ['f95f4ed0690043459364b4b5f96b86a0'] | @Duovili!
Put the console.log(JSON.stringify(options)); right after defining the 'options'. I was facing similar problem and then I've noticed that destinationType was undefined which leads to a json similar to this:
{
"quality" : 80,
"sourceType" : 1,
"allowEdit" : false,
"encodingType" : 0,
"saveToPhotoAlbum" : true
}
without the destinationType value. That crashed my application.
|
f97e3b888b104de4b8f7a88b1372583acffc504d11b168c855ff8055e9e29a28 | ['f96ac5d9dcdb44549d60495239e08811'] | I don't no why, but I added one more inside the "contentBox" and everything are done.
My code are like this now:
<div id="contentBox" >
<!-- criação do action para submit -->
<portlet:actionURL name="dataSubmit" var="dataSubmit" />
<form action="<%=dataSubmit %>" method="Post">
<div class="modal-content">
<!-- div do header -->
<div class="modal-header">
<img src="<%=request.getContextPath() %>/img/logo.jpg">
</div>
<!-- div do body -->
<div class="modal-body">
My info here...
<p>
<!-- criação dos botões de nota -->
<div id="myRadiogroup" class="radioClass">
<input id="nota1" type="button" value="1" onclick="radioFunction(1)" class="nota1" >
<input id="nota2" type="button" value="2" onclick="radioFunction(2)" class="nota2">
<input id="nota3" type="button" value="3" onclick="radioFunction(3)" class="nota3">
<input id="nota4" type="button" value="4" onclick="radioFunction(4)" class="nota4">
<input id="nota5" type="button" value="5" onclick="radioFunction(5)" class="nota5">
<input id="nota6" type="button" value="6" onclick="radioFunction(6)" class="nota6">
<input id="nota7" type="button" value="7" onclick="radioFunction(7)" class="nota7">
<input id="nota8" type="button" value="8" onclick="radioFunction(8)" class="nota8">
<input id="nota9" type="button" value="9" onclick="radioFunction(9)" class="nota9">
<input id="nota10" type="button" value="10" onclick="radioFunction(10)" class="nota10">
</div>
</p>
<!-- input que recebe o valor da nota via javascript -->
<input type='hidden' id= 'hiddenField' name='<portlet:namespace/>nota' value='' />
<div class="form-group">
<label for="comment">Commentário (opcional)</label>
<textarea rows="3" cols="50" id="comment" name="<portlet:namespace/>comment"></textarea>
</div>
</div>
<!-- div do rodapé -->
<div class="modal-footer">
<span id="closer" class="closeBtnFooter">Não quero dar feedback </span>
<input id="enviar" type="Submit" class="btn btn-primary" value="Enviar feedback">
</div>
</div>
</form>
</div>
| 0c486612cb9b5e9b9779deb1ca6e29ccaf8aaf82ad6fd0c9964b28289012bdcf | ['f96ac5d9dcdb44549d60495239e08811'] | I'm trying to add some html codes on aui-modal, i'm not sure if this is the correct way, the text is appearing on modal, but the buttons are not running.
Follow my contentBox code:
<div id="contentBox" >
<h3>Title...</h3> </br>
<p> My text... </p> </br>
<p>
<div id="myRadiogroup">
<input id="1" input type="button" value="1" class="nota1" >
<input id="2" type="button" value="2" class="nota2">
<input id="3" type="button" value="3" class="nota3">
<input id="4" type="button" value="4" class="nota4">
<input id="5" type="button" value="5" class="nota5">
<input id="6" type="button" value="6" class="nota6">
<input id="7" type="button" value="7" class="nota7">
<input id="8" type="button" value="8" class="nota8">
<input id="9" type="button" value="9" class="nota9">
<input id="10" type="button" value="10" class="nota10">
</div>
</p>
<div class="form-group">
<label for="comment">Commentário (opcional)</label>
<textarea rows="3" cols="50" id="comment"></textarea>
</div>
here aui-modal code:
YUI().use(
'aui-modal',
function(Y) {
var modal = new Y.Modal(
{
contentBox: '#contentBox',
centered: true,
destroyOnHide: false,
headerContent: '<h3><PERSON>>',
modal: true,
render: '#modal',
resizable: {
handles: 'b, r'
},
visible: true,
width: 450
}
).render();
modal.addToolbar(
[
{
label: 'Cancel',
on: {
click: function() {
modal.hide();
}
}
},
{
label: 'Finish',
on: {
click: function() {
alert('Information sent.');
}
}
}
]
);
Y.one('#showModal').on(
'click',
function() {
modal.show();
}
);
});
When I added the contentBox the modal apear like this:
Image
The buttons on modal, seems like disabled, I click and nothing happen.
I'm using this reference: link
Someone can help me?
|
4d035321b26cddd5ad7fe27dd46ecf25169b661945b590caa66b644308f5a7e8 | ['f980cc6da1514f7591d96c3b030a4f9e'] | I'd like to write a strategy game where it's map will be 3D tiled. I've read some articles on gamedev but most of them are trying to implement 3D in 2D space. I wonder how in nowadays it is implemented using 3D cards. I wonder if using Irrlich will be an overkill (it has a nice heightmap scene node).
Thanks in advance,
<PERSON>
| 6181cdb53e6b8c7f63c80cfaff1bea845c256fba8f468956f6ad6118a2848640 | ['f980cc6da1514f7591d96c3b030a4f9e'] | I store utf-8 strings in KirbyBase table but later when I check string value encoding it is specified as IBM437. I'd like to have all strings stored in utf-8. Is this possible?
Now when I have something like this:
table.insert(some_utf8_string)
table.select(:recno) { |r| r.utf8_field == some_utf8_string }
select query doesn't find rows because of mismatched encoding.
|
0cc2458bc44b199bfe50e91f89495ca92e9147acc69bb4e9c68ef926b03f4f23 | ['f9869e49fc86486cb19f528571b901c4'] | here is a simple 7-segment display with a pushbutton the problem is whenever I make the clock 1 MHZ the display doesn't run as expected but when I use 8 MHZ clock it works fine.
here is the code:
#define F_CPU 1000000L
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRD &= ~(1<<PD4);
DDRC |= (1<<PC0) | (1<<PC1) | (1<<PC2) | (1<<PC3);
PORTC = 0;
while (1)
{
if(PIND & (1<<PD4)){
_delay_ms(25);
if(PIND & (1<<PD4)){
PORTC++;
}
}
}
}
| adca51958fb3ab07bb87cd2b02e309035dc68027cddcd6b38d7243c2173b1dd6 | ['f9869e49fc86486cb19f528571b901c4'] | I have a simple VBA code that makes me update a database table with update statement .
the field I want to update is date/time so the code I use is :
Public myDate, renewalDate As Date
Public Sub Renewal()
renewalDate = DLookup("renewalDate", "tblDate", "[id]=1")
Dim newDate As Date
Serial = "123456789"
If Forms![frmRenewal]![txtSerial] = Serial Then
newDate = DateAdd("m", 1, renewalDate)
MsgBox newDate
DoCmd.SetWarnings (False)
DoCmd.RunSQL "Update tblDate SET tblDate.renewalDate = newDate WHERE (((tblDate.id)=1))"
MsgBox "You successfully renewed your subscription and renewal date is now " & renewalDate
Else
MsgBox "Wrong Serial"
End If
End sub
and here is the database table:
and I get this error when I run the code
|
652a597484694ce542f628c080f0f83280c0b1351194ab3558ce08feae20b615 | ['f99ceee873854f6abc5f338569101277'] | You can set the default width for any resizable column in a ListGrid using ListGridField.setWidth() as follows:
// first create the grid and set columns to be resizable
dataGrid=new ListGrid();
dataGrid.setWidth(500);
dataGrid.setShowResizeBar(true);
dataGrid.setCanDragResize(true);
// set each column to the initial width you want for that column
ListGridField myColumn= new ListGridField("myColumn", "My Column");
myColumn.setWidth(400); // default to 400 pixels wide
ListGridField myAnotherColumn= new ListGridField("myAnotherColumn", "Another Column");
myAnotherColumn.setWidth(300); // default to 300 pixels wide
dataGrid.setFields(myColumn, myAnotherColumn);
| 5ffe8e35d2b0692d1fadebb3166238370ff35c140ed49f03d41f52f112792946 | ['f99ceee873854f6abc5f338569101277'] | Line numbers on duplicate key warnings can be misleading. As the other answers here confirm, every value of a duplicated key is ignored except for the last value defined for that key.
Using the example in the question across multiple lines:
1 hash1 = {key1: 'value1',
2 key2: 'value2',
3 key1: 'value3'}
4 puts hash1.to_s
keydup.rb:1: warning: duplicated key at line 3 ignored: :key1
{:key1=>"value3", :key2=>"value2"}
The message says "line 3 ignored" but, in fact it was the value of the key defined at line 1 that is ignored, and the value at line 3 is used, because that is the last value passed into that key.
|
2dd46e5e384d4e037cc2389d4aef9d40047615db3473312b431bf195b265db75 | ['f9a64a6f6cce4649a3905d79cd60d7b7'] | I have created a custom theme on Wordpress with custom WP Rest API endpoints. This is how I have set it up.
Theme name: Theme 1
Added below line in functions.php
require get_parent_theme_file_path( '/inc/myapi-functions.php' );
And myapi-functions.php consists all the custom APIs. Let's take an example endpoint
add_action('rest_api_init','lmsRoutes');
function lmsRoutes(){
register_rest_route( 'abcAPIRoute/v1', 'login', array(
'methods' => 'POST',
'callback' => 'loginABCuser'
));
}
And the loginABCuser is as below
function loginBUuser($request){
//do some wp_rest_get which returns a response 'my dummy text 1'
$response = // wp_rest_get response;
return $response;
}
The above work perfectly well. I get the response my dummy text 1 as required.
Now the url in wp_rest_get responses keeps changing every time some change happens on the remote API logics. However it is backward compatible in version. Example, I can keep sending the data a v1 url and get the v1 response even if the remote API is in v5 version.
I initially thought using cPanel of the hosting provider I can clone the current theme, make changes in the myapi-functions.php and do the necessary testing and development in the cloned theme, and then swap the live theme to cloned theme. Example would be as below (for loginABCuser in cloned theme)
function loginBUuser($request){
//do some wp_rest_get which returns a response 'my dummy text 2'
$response = // wp_rest_get response;
return $response;
}
I expected the response to be my dummy text 2 but it still returns my dummy text 1
How do I handle this and where am I going wrong?
I even tried changing
require get_parent_theme_file_path( '/inc/myapi-functions.php' );
to
require get_theme_file_path( '/inc/myapi-functions.php' );
in functions.php but still the same issue.
I can always make the changes and test them in a local environment, but I was wondering if I am limited to do it using cPanel file editor and WP Theme preview, how do I go about it?
And what are the best practices to handle such changes in WP Rest API custom endpoints?
| 310541b9fc73c9311ae496b179dab9cc885f01aa33db52090fcf2e1fda14c384 | ['f9a64a6f6cce4649a3905d79cd60d7b7'] | I was wondering if there was a way to add descriptions/ comments to files e.g. PDFs. I have a lot of PDFs and often I forget where the file came from, why it's a good reference, what reading list it's from, etc. It's pretty astounding that this has proved so difficult to do! My ridiculous workaround is to add all that sort of information to the title of the file, leading to titles like: "@@PDE and Martingale Methods in Option Pricing -- A. Pascucci (Bocconi & Springer 2011)(11)" (The first @ denotes that this is a good reference, the second @ denotes the fact that I own a copy. Other bits mean other things.).
I've read that comment and descriptions are not supported by PDF files, and nobody seems to be able to figure out how to do this. If you go to file>properties>description, you can add a description, but it does not show up in the description column in Explorer, and it seems the only way to read them is via opening the files individually, and then file>properties>description. I doubt that Windows has access to that information when it does searches.
My guess is that it cannot be done except with some special program, and I have installed many including "PDF shell tools", "Total Commander", and "FileMeta" and none of them have worked.
A solutions would be much appreciated!
|
2f229bbcf72b1cac100e1661b10a7dad711a2dcbe061d88eab146476a60a2657 | ['f9af1fc0c7eb4f24b5f01eae9f8542c9'] | Hi good people of stackoverflow,
I am stuck with the sticky header. I found the way on how to do it on W3school, however when I implement it into my html/js/css file it doesn't work.
In short the text Name Surname should stick on top of the browser window when scrolling down.
I have tried many things like putting the js code inside script tags, changing the function name and call it as first thing in body and so on. Non of it brought expected results.
Here is the code:
function scroll() {
myFunction()
};
var header = document.getElementById("home-name");
var sticky = header.offsetTop;
function myFunction() {
if (window.pageYOffset >= sticky) {
header.classList.add("sticky");
} else {
header.classList.remove("sticky");
}
}
var nav = false;
function openSideMenu(){
document.getElementById('side-menu').style.width = '250px';
//document.getElementById('main').style.marginLeft = '250px';
nav = true;
}
function closeSideMenu(){
document.getElementById('side-menu').style.width = '60px';
//document.getElementById('main').style.marginLeft = '60px';
nav = false;
}
function toCross(x){
x.classList.toggle("change");
nav ? closeSideMenu() : openSideMenu();
}
body {
font-family: "Arial", Serif;
margin: 0;
/*without margin = 0 image would have small margin*/
background-color: white;
}
/*.background-home, .background-gallery, .background-contact {
background-size: cover;
background-repeat: no-repeat;
background-attachment: fixed;
position: relative;
}
.background-home{
background-image: url("/mnt/120AA1F00AA1D0D1/Editing/Wedding wedpage/obrazki/22343878_10210125005464505_<PHONE_NUMBER>_o.jpg");
background-position: center -900px;
min-height: 100vh;
}
.background-gallery {
background-image: url("/mnt/120AA1F00AA1D0D1/Programming/Wedding-Web-Page/pictures/white_background.png");
background-position: center;
min-height: 100vh;
background-size: cover;
}
/*.background-contact {
background-image: url("/mnt/120AA1F00AA1D0D1/Editing/Wedding wedpage/obrazki/21167099_10209868968863750_7278329271954592356_o.jpg");
background-position: center;
height: 100vh;
}*/
.bar1,
.bar2,
.bar3 {
width: 35px;
height: 5px;
background-color: #333;
margin: 6px;
transition: 0.4s;
}
.open-menu a {
float: left;
display: block;
color: white;
padding: 5px 5px;
position: fixed;
top: 0px;
font-size: 17px;
z-index: 1;
}
.open-menu a:hover {
transform: scale(1.1);
color: #000;
}
.change .bar1 {
-webkit-transform: rotate(-45deg) translate(-9px, 6px);
transform: rotate(-45deg) translate(-9px, 6px);
}
.change .bar2 {
opacity: 0;
}
.change .bar3 {
-webkit-transform: rotate(45deg) translate(-8px, -8px);
transform: rotate(45deg) translate(-8px, -8px);
}
.side-nav {
height: 100%;
width: 60px;
position: fixed;
z-index: 1;
top: 0;
left: 0;
background-color: white;
overflow-x: hidden;
/*hides overflow text in side menu*/
padding-top: 60px;
transition: 0.1s;
}
.side-nav ul {
list-style-type: none;
margin: 0;
padding-left: 14px;
}
.side-nav a {
padding: 10px 10px 10px 0px;
text-decoration: none;
text-align: left;
font-size: 20px;
color: black;
display: inline-block;
transition: 0.1s;
}
.side-nav li:hover {
transform: scale(1.1);
}
div#side-menu li {
background-position: left;
background-repeat: no-repeat;
}
div#side-menu li#youtube {
background-image: url("/mnt/120AA1F00AA1D0D1/Programming/Wedding-Web-Page/pictures/youtube32.png");
}
div.list-margin {
padding-left: 50px;
}
.quote {
position: absolute;
top: 0px;
right: 12px;
font-family: "Dancing Script";
font-size: 60px;
color: white;
}
.title {
position: absolute;
text-align: center;
color: black;
font-size: 120px;
width: 100%;
font-family: 'Amatic SC', cursive;
}
#home-name {
position: absolute;
top: 0px;
left: 5%;
font-size: 50px;
color: black;
z-index: 1;
margin: 0;
font-family: 'Bellefair', serif;
}
#home-name:after {
content: "";
position: absolute;
border-top: 1px solid black;
left: 50%;
bottom: 0;
margin-left: -150px;
width: 300px;
height: 1px;
}
.sticky {
position: fixed;
top: 0;
width: 100%;
}
.sticky+.content {
padding-top: 102px;
}
#titleGallery {
top: 100%;
font-family: 'Amatic SC', cursive;
}
#Terka-A-Jakub-Video {
position: absolute;
top: 150%;
left: 10%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Wedding Page</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Dancing+Script:700">
<link href="https://fonts.googleapis.com/css?family=Amatic+SC" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Bellefair" rel="stylesheet">
<script src="main.js"></script>
</head>
<body onscroll="scroll();">
<div class="header" id="home-name">
<p>Name Surname</p>
</div>
<div class="background-home"></div>
<div class="background-gallery"></div>
<div class="background-contact"></div>
<div id="side-menu" class="side-nav">
<ul>
<li>
<a href="#">
<div class="list-margin">Home</div>
</a>
</li>
<li id="youtube">
<a href="#">
<div class="list-margin">Gallery</div>
</a>
</li>
<li>
<a href="#">
<div class="list-margin">Get in Touch</div>
</a>
</li>
<li>
<a href="#">
<div class="list-margin">About Me</div>
</a>
</li>
<li>
<a href="#">
<div class="list-margin">Contact</div>
</a>
</li>
</ul>
</div>
<div>
<span class="open-menu">
<a href="#" onclick="toCross(this)">
<div class="bar1"></div>
<div class="bar2"></div>
<div class="bar3"></div>
</a>
</span>
</div>
<div class="content">
<p class="quote">One video, <br> thousands memories.</p>
<iframe id="Terka-A-Jakub-Video" width="560" height="315" src="https://www.youtube.com/embed/xY2uUyFyNh4?rel=0" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
<p class="title" id="titleGallery">Gallery</p>
</div>
</body>
</html>
As always, any help will be greatly appreciated :)
| 27129fe11bb40992a4f29a0c10119e994b35c45fad866cdcd74e5ceac3817935 | ['f9af1fc0c7eb4f24b5f01eae9f8542c9'] | I want to change opacity of an image when hover and show a text in middle of the image in same time.
My code is
HTML:
<div class="col-md-4 j-t">
<div class="middle">
<div class="text-middle">Play</div>
</div>
</div>
CSS:
.middle {
transition: .5s ease;
opacity: 0;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
}
.text-middle {
background-color: white;
color: black;
font-size: 16px;
padding: 16px 32px;
}
.j-t {
height: 315px;
background: url("pictures/golden_cut.jpg") center center no-repeat;
background-size: cover;
transition: .5s ease;
backface-visibility: hidden;
opacity: 1;
}
.j-t:hover {
opacity: 0.3;
}
.j-t:hover .middle{
opacity: 1;
}
When used as is the text in the middle is also covered with opacity 0.3 from the image. I want the text in middle to have opacity 1.
Please help.
|
7cd6c42075237b2144f03207a89e8585dae4248ccb919f34ca0c0a41529fd6b6 | ['f9b0b04344f1429a99293eebb9d7f41e'] | I have two arraylist, one is the numbers and another one is the number of elements.
For example:
Number of elements: [4, 3, 1]
Numbers: [31, 21, 50, 70, 90, 80, 50, 100]
for(Integer e : elements){
for(Integer num : numbers){
for (int i = 0; i < e; i++){
System.out.print(num + " ");
}
}
System.out.println();
}
I want to match and print 4 elements to 4 numbers, 3 elements to the next 3 numbers and so on. How can print the numbers based on the index and the next numbers?
Output:
31 21 50 70
90 80 50
100
| 33e193104f874b5bd1064c0768c13cada2f9d4e79dd4e6dcafbbae2682e85adf | ['f9b0b04344f1429a99293eebb9d7f41e'] | I have created a class called ReadFile to load the data (numbers and number of elements) from multiple files to 2 arraylist to store both numbers of number of elements. How can I get both the number of elements which is 4 and the following numbers without duplicating the reading file codes?
Sample input file
4
1 10 9 8
public class ReadFile {
public List <Integer> getNumbers(){
List<Integer> numbers = new ArrayList<>();
File folder = new File("/Users/Mary/NetBeansProjects/Sample/src/program/pkg4/Input");
for (File file : folder.listFiles()) {
try{
FileReader fileReader = new FileReader(file);
BufferedReader reader = new BufferedReader(fileReader);
String numberOfElement = reader.readLine();
String line = reader.readLine();
for (String s : line.split("\\s+")) {
numbers.add(Integer.parseInt(s));
}
reader.close();
}catch(IOException e){
System.out.println("ERROR: There was a problem reading the file.\n" + e.getMessage());
}
}
return numbers;
}
public List <Integer> getElements(){
List<Integer> elements = new ArrayList<>();
File folder = new File("/Users/Mary/NetBeansProjects/Sample/src/program/pkg4/Input");
for (File file : folder.listFiles()) {
try{
FileReader fileReader = new FileReader(file);
BufferedReader reader = new BufferedReader(fileReader);
String numberOfElement = reader.readLine();
elements.add(Integer.parseInt(numberOfElement));
reader.close();
}catch(IOException e){
System.out.println("ERROR: There was a problem reading the file.\n" + e.getMessage());
}
}
return elements;
}
}
|
fbf53099e981fbc7aa3d2a8cf3855507d742bd6d0492be524268ad8913aefd07 | ['f9bdb8b647bf441cb3c06565207db656'] | I searched and found some for randomizing numbers, but I don't think it applies for strings....For example I have a list like this in an array:
string restaurants[] = {"Texas Roadhouse,","On The Border,","Olive Garden,","Panda Express,","Cracker Barrel,","IHOP,","Panda Express,","Pei Wei"};
How would I randomize this or just swap them all around and jumble them up?
| c3764998b746eba53fc3a320ba4eae201f73aff6872e8c258b87b06e074c8335 | ['f9bdb8b647bf441cb3c06565207db656'] | I have an array of 16 (example below). Each match of the tournament involves displaying two restaurants, prompts to choose his favorite one, and removing the losing restaurant from the tournament.
It is like a bracket system; i.e., a restaurant does not reappear in another match until all other restaurants have also appeared in a match for that round). So start with 8 matches, then 4, then 2.
Do not allow the tournament to begin unless the number of restaurants is equal to 16.
I am pretty new to C++. Anyone have a decent outline or suggestions/paths I should look at?
string restaurants[] = {"Texas Roadhouse,","On The Border,","Olive Garden,","Panda Express,","Cracker Barrel,","IHOP,","Panda Express,","Pei Wei"};
|
08c8784f32ebbf087a83f7c097c9be2c7947d6bd56c63accbe2e9d3ca7c6c397 | ['f9cf97b3f6e24e709f53701fff981dfc'] | I am referring to a similar post which i found very useful. It shows how we can load an integer column in an avro file to a BigQuery table containing a timestamp field.
Compatibility of Avro dates and times with BigQuery?
I have a similar question. Is there a way to load an integer value in an avro file to a date column in bigquery?
Since avro does not support date datatype, I have tried keeping the date as a string field in the avro and tried loading it into the date field in BigQuery. But this does not work.
If i knew how BigQuery stores dates internally maybe i could try converting my date to that value and then load it to BQ.
Any suggestions how i can do this?
| 5da09fb30bcc53d5aad78bc4e5fc0514cf6e62838e4031d2309705e9d38e0135 | ['f9cf97b3f6e24e709f53701fff981dfc'] | I wanted to print info or debug or exception messages on screen while running the dataflow program. I am able to do this when running the pipeline with the runner as "DirectRunner". But the same program does not print anything on the dataflow console while running with the runner "DataflowRunner". Here is the code, its very basic.
import apache_beam as beam
from apache_beam.io import ReadFromText
from apache_beam.io import WriteToText
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
import logging
class ProcessData(beam.DoFn):
def process(self, element, var):
logging.getLogger().setLevel(logging.INFO)
logging.info("Print the element %s",element)
logging.info("Print the var %s",var)
logging.getLogger().setLevel(logging.INFO)
#Initialize the pipeline
pipeline_options = PipelineOptions()
pipeline_options.view_as(SetupOptions).save_main_session = True
p = beam.Pipeline(options=pipeline_options)
p | 'Read the data file' >> beam.io.textio.ReadFromText('gs://rohan_staging/data/test.txt') | 'Process Data' >> beam.ParDo(ProcessData(),1)
p.run()
I was able to see the messages earlier on the console, but suddenly i have stopped seeing them. I don't know what i did wrong or what was i doing different before. Please suggest how to i see info messages on the cloud dataflow console.
|
dac5cd4ae691f53a6df8bcf9aabdd9a98f1a00040483c0b826dff77bd0885573 | ['f9db9f3514e34f8d90b6fab24c4cdaa9'] | After reading the above answers I tried different combinations of screenshots from the iPhone 11 pro max simulator none of them worked.
I tried a screenshot from a device(iPhone 6), it worked like a charm in the first attempt.
here are the details:
dimension: 750x1334
size: 303kb
JPEG image
| 71f172d8b42e8e10684f599903ea161baf4b044d6e1dfdec775975ebc42fa0e6 | ['f9db9f3514e34f8d90b6fab24c4cdaa9'] | I have an Audio Player View Controller that has a pan gesture recognizer added to its view. On detecting a pan I animate a UIView containing a child vc in it(that is for the queued tracks). This child vc has a table view in editing mode to allow reordering of music tracks.
Now the issue is when I try to reorder tableview rows the pan guesture handler in parent view controller's view gets called and hence reorder does not work.
What I want is to cancel any pan events generated in the child vc and let the tableview handle it's default implementation of reordering the cells.
Here's my code:
1. In AudioPlayerViewController initializing the view :
lazy var playerQueueContainer:UIView = {
let view = UIView()
view.backgroundColor = .red
let queueVC = AudioPlayerQueueViewController()
queueVC.delegate = self
queueVC.queuedItems = playerItems
queueVC.currentPlayerItem = startPlayerItem
queueVC.willMove(toParent: self)
view.addSubview(queueVC.view)
self.addChild(queueVC)
queueVC.didMove(toParent: self)
queueVC.view.translatesAutoresizingMaskIntoConstraints = false
queueVC.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
queueVC.view.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0).isActive = true
queueVC.view.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0).isActive = true
queueVC.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0).isActive = true
return view
}()
Implementation of pan guesture handler
@objc func handlePanGesture(_ sender: UIPanGestureRecognizer) {
switch sender.state {
case .began:
startInteractiveTransition(state:nextState,duration: 1)
case .changed:
let yTranslation = sender.translation(in: self.playerQueueContainer).y
var fractionComplete = yTranslation/self.queueVCHeight
fractionComplete = currentQueueState == .collapsed ? -fractionComplete : fractionComplete
updateInteractiveTransition(fractionCompleted:fractionComplete)
case .ended:
continueInteractiveTransition()
default:
break
}
}
Table View Methods in AudioPlayerQueueViewController:
func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath) {
if let item = queuedItems?[sourceIndexPath.row]{
queuedItems?.insert(item, at: destinationIndexPath.row)
delegate?.didMoveItem(from: sourceIndexPath, to: destinationIndexPath)
}
}
Toggling the cancelsTouchesInView property doesn't work.
I'm sharing a screen recording in the following link for better understanding of the flow:
screen rec
|
a1033f4932a4ef7858ef8ad808b7d91c444c248e88b3de2e66f8e21ba4277fa7 | ['f9dc130a28724def9fad3e25e83f48be'] | Well, if one algorithm needs $20n$ operations and another needs $n^2$ for doing something, this means that for very small n the cost of the first is much higher, right? Take $n=3$, so the first algorithm needs 60 operations whereas the second just needs 9. for small n the first is therefore more expensive. However. For large n the squared term will increase faster than the linear term, so for big n it's the other way round. Big O notation considers just the fastest growing term, so $x^n+1000x^{n-1}$ is in $O(x^n)$$ | fb5c30bed4440d301fb50126185d1223928e50472f340991c8da44f6849d8747 | ['f9dc130a28724def9fad3e25e83f48be'] | Sorry for the confusion! You're right, I had some typos in it. It depends somehow on your convention: you may always address your grid points like $x_0,...,x_n$ (that is $n+1$ points), or you may start with $x_1$ (just $n$ points).
I mixed both conventions, but corrected the index-errors in my answer above. This makes $L_{n,i}$ a polynomial of degree $n$.
Does this solve your questions?
Let me know :-) |
eb82b93e344bab536d70cba3dbdce4400df002b2a8598dd4dbd2f6c73144c843 | ['f9dc22a6d35a46e8b4ee30493a7f98f3'] | I guess there was misunderstanding in solution of Top K records from HiA book, at section 4.7, which says:
"Top K records—Change AttributeMax.py (or AttributeMax.php) to output the entire record rather than only the maximumvalue. Rewrite it such that the MapReduce job outputs the records with the top K values rather than only the maximum."
The input data set to be used is actually apat63_99.txt file, and the exercise asks for the records with the top K values (CLAIMS) rather than only the maximum. As AttributeMax.py described in listing 4.6 was giving records for maximum claims.
| 9b16687a990ec649ae33ba557f1936d44b5884978cf88fd5a669195cf0601b8b | ['f9dc22a6d35a46e8b4ee30493a7f98f3'] | I implemented using CountDownLatch, and it works as expected.
...
final CountDownLatch countDownLatch = new CountDownLatch(1);
SparkAppListener sparkAppListener = new SparkAppListener(countDownLatch);
SparkAppHandle appHandle = sparkLauncher.startApplication(sparkAppListener);
Thread sparkAppListenerThread = new Thread(sparkAppListener);
sparkAppListenerThread.start();
long timeout = 120;
countDownLatch.await(timeout, TimeUnit.SECONDS);
...
private static class SparkAppListener implements SparkAppHandle.Listener, Runnable {
private static final Log log = LogFactory.getLog(SparkAppListener.class);
private final CountDownLatch countDownLatch;
public SparkAppListener(CountDownLatch countDownLatch) {
this.countDownLatch = countDownLatch;
}
@Override
public void stateChanged(SparkAppHandle handle) {
String sparkAppId = handle.getAppId();
State appState = handle.getState();
if (sparkAppId != null) {
log.info("Spark job with app id: " + sparkAppId + ",\t State changed to: " + appState + " - "
+ SPARK_STATE_MSG.get(appState));
} else {
log.info("Spark job's state changed to: " + appState + " - " + SPARK_STATE_MSG.get(appState));
}
if (appState != null && appState.isFinal()) {
countDownLatch.countDown();
}
}
@Override
public void infoChanged(SparkAppHandle handle) {}
@Override
public void run() {}
}
|
f150985fc07e12edb9254af966b771929466fdb0a2e393fe5c3356856c19882e | ['f9e06e7da9f849c5918d94d06cfd3b27'] | this happened because the connection is not established successfully with the database because the localhost is spelled wrong.
you are omitting the errors during instantiate mysqli class by using @new.
try to remove the @ and check if the connection is not establish to through an exception otherwise it will proceed with code execution .
<?php
$this->db_connect = new mysqli('localhost', 'root', '', 'zanox');
if($this->db_connect->connect_error){
throw new Exception('unable to connect, '. $this->db_connect->connect_error);
}
| 3bd4edbf1a469241c83ec5e2978ed455d8d0c3eafb45897256b5adfd61ba5f47 | ['f9e06e7da9f849c5918d94d06cfd3b27'] | for rest services its preferred to handle responses through http response code
for exampel if the user logged in return 200 OK ,
if the credential failed return 401 Unauthorized
then you can get the response body and handle it
<?php
if($_POST['password'] == 'password' && $_POST['username'] == 'username')
{
header('HTTP/1.0 200 OK');
} else {
header('HTTP/1.0 401 Unauthorized');
}
|
f5d2590d16010019f78125a453e93a8c063b161a9e9adea3a47363876eb4c7cd | ['f9eecb3040634f0c8219fac701b0d737'] | Hey im trying to solve this problem but <PERSON> says i get runtime error which means uncaught exception.
https://open.kattis.com/problems/fizzbuzz
Is there anything that ive missed in my code that crashes the app?
public static void Main(string[] args)
{
string line = "";
while ((line = Console.ReadLine()) != "0")
{
var numbers = line.Split(' ').Select(int.Parse).ToList();
int x = numbers[0];
int y = numbers[1];
int N = numbers[2];
for(int i = 1; i <= N; i++)
{
bool found = false;
bool found2 = false;
if(i % x == 0)
{
if(i % y==0)
{
Console.WriteLine("FizzBuzz");
found2 = true;
}
else
{
Console.WriteLine("Fizz");
found = true;
}
}
if(i % y == 0 && !found2)
{
Console.WriteLine("Buzz");
found = true;
}
if(!found && !found2)
{
Console.WriteLine(i);
}
}
}
}
| a50890418d8713640e52c615a610120ed861a02a326d160bb8b4cf95251edf3f | ['f9eecb3040634f0c8219fac701b0d737'] | Hey guys im trying to compare two textboxes automatically when the user inputs data. The first textbox gets its value from 2 comboboxes where you select % and it calculates to this textbox.
The other textbox is the same and this one can not be greater than the previous textbox.
This is what ive been working on but its only working if you enter the data with the keyboard, which i am not.
tbRegPersPlacÅrArb.KeyUp += textBox_Compare;
Kvarattfördela.KeyUp += textBox_Compare;
private void textBox_Compare(object sender, KeyEventArgs e)
{
Color cBackColor = Color.Red;
if (tbRegPersPlacÅrArb.Text == Kvarattfördela.Text)
{
cBackColor = Color.Green;
}
tbRegPersPlacÅrArb.BackColor = cBackColor;
Kvarattfördela.BackColor = cBackColor;
}
|
102d70cee08cd24460f99afd65c395ced23f894a75860c1de0e49d9e23e2b127 | ['f9f02a39477944f68d603ea6992bda6a'] | I'm quite unsure how to do a form validation within react.
I want to display an error message on the current page saying. However, the password validation is ignored so their is no error that shows on the page.
Password must be at least characters
Maybe i'm not using conditional rendering right
SignUp.js (snippet for demonstration purpose)
constructor(props){
super(props);
this.state ={
errors: {},
}
handleSubmit(event) {
event.preventDefault();
const email = this.email.value;
const password = this.password.value;
if(password.length > 6){
this.state.errors.password= "Password must be at least 6 characters";
}
const creds = {email, password}
if(creds){
this.props.signUp(creds);
this.props.history.push('/');
}
}
render() {
return (
<div className="container">
<div className="row">
<div className="col-md-6">
<h1>Sign Up</h1>
<form onSubmit={this.handleSubmit}>
<div className="form-group">
<label htmlFor="exampleInputEmail1">Email address</label>
<input
name="email"
type="email"
className="form-control"
id="email"
ref={(input) => this.email = input}
aria-describedby="emailHelp"
placeholder="Enter email" />
<small id="emailHelp" className="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div className="form-group">
<label htmlFor="exampleInputPassword1">Password</label>
{this.password > 6 &&
//display an error here
<h2>{this.state.errors.password}</h2>
}
<input
name="password"
type="password"
ref={(input) => this.password = input}
value={this.state.password}
className="form-control"
id="password"
placeholder="Password" />
</div>
<button type="submit" className="btn btn-primary">Submit</button>
</form>
</div>
</div>
</div>
);
}
}
| 37ae93fe02bcd2b73a81f7feae5f357c8e25737768a38cdab787b96eb2fa77f3 | ['f9f02a39477944f68d603ea6992bda6a'] | I want to redirect the client after an action has been fired. I heard of react-redux-router, but not sure how to properly implement it in the actions function.
i followed a little bit of this
https://stackoverflow.com/a/42985875/10865515
However, when i submit the validated form, it doesn't redirect or refreshes.
Actions.js
import { auth as firebaseAuth } from '../firebaseConfig'
import { push, browserHistory } from 'react-router-redux';
export const signUp = (user) => { return (dispatch) => {
firebaseAuth.createUserWithEmailAndPassword(user.email, user.password)
.then(() => {
dispatch({ type: 'SIGNUP_SUCCESS',
payload: (action, state, res) => {
return res.json().then(json => {
browserHistory.push('/');
return json;
});
},
});
}).catch((err) => {
dispatch({ type: 'SIGNUP_ERROR', err});
});
}
}
Reducers.js
const initialState = {
emailSignUp: '',
passwordSignUp: '',
authError: null
}
export default (state = initialState, action) => {
switch (action.type) {
case 'SIGNUP_SUCCESS':
return ({
...state,
authError: null
})
case 'SIGNUP_ERROR':
console.log('signup error')
return ({
...state,
authError: action.err.message
})
default:
return state
}
}
Register.js
// ...
handleSubmit(event) {
event.preventDefault();
const {formData, errors} = this.state;
const {email, password} = formData;
const myError = this.props.authError;
const creds = {
email,
password
}
const register = this.props.signUp(creds);
if (register) {
console.log(creds);
}
}
|
e92ced3444094b030e5b640a80dcf02f4489d65ca2b14d7e5d51369d21cd2a49 | ['f9f6bfe1ab4543ff98cbe9330a7dde81'] | Acutally I have two questions:
Is there any way to configure tinymce to allow only one element in the content with a specific class/attribute? For example, I need only one <div class="title"></div> element in the content, so when you edit this element and press Enter, it creates another <div class="title"/>. Rather, I want just a div with a different class (i.e. <div class="text">). Is that possible?
Is there any way to define allowed elements inside a div? For example, the only valid elements inside <div class="text"> are <br> and inline text. If you try to put a div/p/whatever inside, it will clean it out?
Thanks!
| ab93dab1c562606d39d9d09337051b066ff945723574b87ba258387719ac263a | ['f9f6bfe1ab4543ff98cbe9330a7dde81'] | I have been using MariaDB locally on my machine for development purposes using the extracted zip version (e.g. mariadb-10.3.17-winx64.zip). This has worked flawlessly while on 10.3.x
Have attempted to run 10.4.7 in the same manner, but it fails to start with the following console output.
D:\Downloads\mariadb-10.4.7-winx64\mariadb-10.4.7-winx64\bin>.\mysqld --console
2019-08-31 7:11:58 0 [Note] .\mysqld (mysqld 10.4.7-MariaDB) starting as process 18976 ...
InnoDB: using atomic writes.
2019-08-31 7:11:58 0 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions
2019-08-31 7:11:58 0 [Note] InnoDB: Uses event mutexes
2019-08-31 7:11:58 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-08-31 7:11:58 0 [Note] InnoDB: Number of pools: 1
2019-08-31 7:11:58 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-08-31 7:11:58 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2019-08-31 7:11:58 0 [Note] InnoDB: Completed initialization of buffer pool
2019-08-31 7:11:58 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-08-31 7:11:58 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-08-31 7:11:58 0 [Note] InnoDB: Setting file '.\ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-08-31 7:11:58 0 [Note] InnoDB: File '.\ibtmp1' size is now 12 MB.
2019-08-31 7:11:58 0 [Note] InnoDB: 10.4.7 started; log sequence number 114269; transaction id 9
2019-08-31 7:11:58 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-08-31 7:11:58 0 [Note] InnoDB: Loading buffer pool(s) from D:\Downloads\mariadb-10.4.7-winx64\mariadb-10.4.7-winx64\data\ib_buffer_pool
2019-08-31 7:11:58 0 [ERROR] Could not open mysql.plugin table. Some plugins may be not loaded
2019-08-31 7:11:58 0 [Note] InnoDB: Buffer pool(s) load completed at 190831 7:11:58
2019-08-31 7:11:58 0 [ERROR] Can't open and lock privilege tables: Table 'mysql.servers' doesn't exist
2019-08-31 7:11:59 0 [Note] Server socket created on IP: '<IP_ADDRESS>'.
2019-08-31 7:11:59 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.db' doesn't exist
2019-08-31 7:11:59 0 [ERROR] Aborting
|
315f8e67a891425707885973123d6f0c99923ac04422b5371a517127e883566e | ['fa01b7c998e845a59f6df528103b2964'] | If I was you I would do a procedure to update every register published a year after 2016 until the final date range, because if you only use it from the year 2016 ahead you will update all products.
Ex: From 2016 to 2017.
Why I would build a procedure and not only execute an update in the database?
Maybe in the future, you need to do the same thing then you already have the procedure to do this.
And for security, you can do a backup table where you will save de old price of the products and the new one. Because if you need to do a rollback in the price you have where to get it!
| 4052be50424e0d1ad61444728cdf90dc6272e30e7c5b13a20a3dbc8b1301a970 | ['fa01b7c998e845a59f6df528103b2964'] | Why don't you use ajax for this? As mentioned in comments mix PHP/JS isn't good.
In your HTML, you can do something like
I'm assuming that you are using Blade.
<a href="#" onclick="return deleteGame({$title})">Delete Game</a>
Then in your javascript, you do this using jQuery:
function deleteGame(title){
var answer = confirm('Really?');
if(answer){
$.ajax({
url : "your-php-file.php",
type : 'post',
data : {
title : title
}
})
.done(function(msg){
$("#result").html(msg);
})
.fail(function(error){
console.log(error);
});
}
}
In your PHP you process receiving the data from post $_POST
$title = $_POST['title'];
You can understand better the Ajax function of jQuery here.
|
9613860da8475b5fd8eeded81b9e813cab83f231f64c8d4a952b7ccf674ef81b | ['fa0cceb2e2604f9baf743fc2183e0bec'] | In your code I note you are using the html5 enabling script. First check out the comments here:
http://remysharp.com/2009/01/07/html5-enabling-script/
call the html5.js script AFTER you call the initial jquery.js script
I recently had some issues with a jquery script using AJAX in ie7 & ie8 only. Really odd behaviour of appending divs with the text "div" to the html body. Removing html5 shiv solved the problem, so there may be some sort of conflict.
| 6a7e719a242bd0495aaa4b19c46a644563eb7fd8c26715815495909a1f8a101c | ['fa0cceb2e2604f9baf743fc2183e0bec'] | Although android supports svg from version 3.0+ (http://caniuse.com/svg), it supports a
subset of the SVG Basic 1.1
according to SVG parsing and rendering for Android tutorial, (which actually talks about the android SVG library).
If you jump to the How to prepare your vector images section, you'll see a list of the features of SVG Basic that are not supported, e.g. animation, and advice for saving to the SVG Basic 1.1 profile.
The SVG profile, or possible use of unsupported features, could be the cause of your problem.
|
6de11f0cf83722388f44b50aef1e66d13ce7d9cfb4380cba560e22d8986018ee | ['fa1356f91f584d2181232777ab1afaeb'] | На вход программе подается строка текста на английском языке, в которой нужно зашифровать все слова. Каждое слово строки следует зашифровать с помощью шифра Цезаря (циклического сдвига на длину этого слова). Строчные буквы при этом остаются строчными, а прописные – прописными.
Формат входных данных
На вход программе подается строка текста на английском языке.
Формат выходных данных
Программа должна вывести зашифрованный текст в соответствии с условием задачи.
Примечание. Символы, не являющиеся английскими буквами, не изменяются.
Ввод
Day, mice. "Year" is a mistake!
Вывод
Gdb, qmgi. "Ciev" ku b tpzahrl!
Мой код
def encrypt(text,s):
result = ""
for i in range(len(text)):
char = text[i]
if (char.isupper()):
result += chr((ord(char) + s-65) % 26 + 65)
else:
result += chr((ord(char) + s - 97) % 26 + 97)
return result
#check the above function
text = input().split()
s = 4
print (text)
print (str(s))
print(encrypt(text,s))
| d9e6c32270a7ab091f1c3386b4172af745f7dff6c05381fd6163857ca87cdf04 | ['fa1356f91f584d2181232777ab1afaeb'] | Симметрическая разность множеств
Реализуйте бинарную операцию над множествами — симметрическую разность. Её результатом являются те элементы двух множеств, которые принадлежат ровно одному из множеств (но не принадлежат их пересечению).
Входные данные
В первой строке записано натуральное число — количество элементов первого множества. Во второй строке через пробел перечислены эти элементы (натуральные числа). В третьей строке указано количество элементов второго множества (натуральное). В четвертой строке перечислены через пробел элементы второго множества (натуральные числа). Множества во входных данных могут быть неупорядочены и содержать равные элементы.
Выходные данные
Результат требуется вывести в том же формате: сначала количество элементов, полученных в результате операции, затем (если получено ненулевое количество элементов) вывести сами элементы в порядке возрастания. Множество в выводе должно быть упорядочено, и все элементы его должны быть различными.
Пример
Ввод
3
1 2 3
2
3 4
Вывод
3
1 2 4
Мой код:
a=int(input())
A=set(input())
b=int(input())
B=set(input())
C = A.symmetric_difference(B)
print(len(C))
C=sorted(C)
for n in C:
print(n, end = ' ')
Помогите, пожалуйста, найти ошибку. В проверке пишет ошибку. Вроде пример выполняет, а проверку не проходит. Правда, я не задействую переменные а и b.
|
6e410ac609eb76bac8ccbe9218fd430ae3a9bda4e09475d1d1b10d3596309bfa | ['fa28e0b7bc444e52ae29e0588bccc2da'] | Yes, as <PERSON> indicated we need to add a PXSearchable attribute for the NoteID field of that particular DAC. The below code from the SOOrder DAC file and it may help you to achieve your requirement.
#region NoteID
public abstract class noteID : PX.Data.BQL.BqlGuid.Field<noteID> { }
protected Guid? _NoteID;
[**PXSearchable**(SM.SearchCategory.SO, "{0}: {1} - {3}", new Type[] { typeof(SOOrder.orderType), typeof(SOOrder.orderNbr), typeof(SOOrder.customerID), typeof(Customer.acctName) },
new Type[] { typeof(SOOrder.customerRefNbr), typeof(SOOrder.customerOrderNbr), typeof(SOOrder.orderDesc) },
NumberFields = new Type[] { typeof(SOOrder.orderNbr) },
Line1Format = "{0:d}{1}{2}{3}", Line1Fields = new Type[] { typeof(SOOrder.orderDate), typeof(SOOrder.status), typeof(SOOrder.customerRefNbr), typeof(SOOrder.customerOrderNbr) },
Line2Format = "{0}", Line2Fields = new Type[] { typeof(SOOrder.orderDesc) },
MatchWithJoin = typeof(InnerJoin<Customer, On<Customer.bAccountID, Equal<SOOrder.customerID>>>),
SelectForFastIndexing = typeof(Select2<SOOrder, InnerJoin<Customer, On<SOOrder.customerID, Equal<Customer.bAccountID>>>>)
)]
[PXNote(new Type[0], ShowInReferenceSelector = true, Selector = typeof(
Search2<
SOOrder.orderNbr,
LeftJoinSingleTable<Customer,
On<SOOrder.customerID, Equal<Customer.bAccountID>,
And<Where<Match<Customer, Current<AccessInfo.userName>>>>>>,
Where<
Customer.bAccountID, IsNotNull,
Or<Exists<
Select<
SOOrderType,
Where<
SOOrderType.orderType, Equal<SOOrder.orderType>,
And<SOOrderType.aRDocType, Equal<ARDocType.noUpdate>>>>>>>,
OrderBy<
Desc<SOOrder.orderNbr>>>))]
public virtual Guid? NoteID
{
get
{
return this._NoteID;
}
set
{
this._NoteID = value;
}
}
#endregion
| 2697791ef96211249a2a1bb559c7a6564e857b8a29fdccdcbc69639e3d70a376 | ['fa28e0b7bc444e52ae29e0588bccc2da'] | These fields are Not the default Acumatica fields in 19.106.0020 version.
It's strange, as <PERSON> indicated if a field created by us then that field name will have a prefix as Usr.
As these fields exist in the InventoryItem DAC extension but NOT the database, hence we are getting this run time error.
Even after publishing the package, if you still facing this issue, then that package does not contain the Inventoryitem DAC extension fields. Add these fields to the database and add it to the package.
Please post us the Inventory DAC extension, which will help us to identify the root cause.
|
37b24893084d81b710d721615ed9a5c6a0330785b10549bfcf74ed4a4b2487a2 | ['fa30b915c723492fa9849b9f4e34e1cc'] | Ok, so I was trying to access an object as an array. The solution is to use get_object_vars() after running the get_results() method.
$nums = new DoStuff(0);
$nums->get_results();
$nums = get_object_vars($nums);
if($nums['results']['num'] == 1)
{
printf('<p>(if) Num is: %d</p>', (int) $nums['results']['num']);
}
else
{
printf('<p>(else) Num is: %d</p>', (int) $nums['results']['num']);
}
// Prints: (if) Num is: 1
| 5e67b093ea165a3bb2789a368fb6c1a4afec0fe089ebe51df387ef350af0d7df | ['fa30b915c723492fa9849b9f4e34e1cc'] | I need to customise the logic for Laravel's authentication. I found a solution on SO, by overriding the credentials method in the LoginController like so:
return ['email' => $request->{$this->username()}, 'password' => $request->password, 'status_id' => $whatever];
But now I discovered an issue where a user can still reset their password and then they get signed in automatically. So how can I disable password resets for users who should not be allowed to sign in?
|
d712690c0b8b383e304820d4c2b6671fdca5eb4e03c92a2841891312335ab3b4 | ['fa6a82ee886948dab824b3350c26db41'] | Is there a possibility (if not real than at least theoretical) that we could measure the spin of an electron continously over some (even very short) period of time, so that it does not change during the measurement?
I'm thinking maybe of something like observing it continuously...
Is it achievable?
| d88574561fd7b08459b1ef455fda2d27bde46883daa69bc7ac2ba68c8410d64e | ['fa6a82ee886948dab824b3350c26db41'] | Just as a government has inflated the dollar, making it loose value over time, the same can happen to an over used expression.
This is not necessarily the case of bromides like "Those who cannot remember the past are condemned to repeat it". Epistemologically the problem is not in the over use, but in the lack of meaning in the expression. Remembering history has no significance, if one doesn't understand or can't conceptualize it.
The phrase didn't have a meaning to begin with. It simply is a meaningless sequence of words with the sound of a proverb.
|
ea26ed71047f65fe169703e490e221e5c3c42cccfe6d5e447d73a13b420c10ee | ['fa794bb190bf4016ac6127b128a78d87'] | I have below piece of code to list out all available folders using Drive API's. But after 3000 folders it error out as '500 Internal Error'. How to find which folder and why this error is coming based on the NextPageToken?
Note: It was working properly in last week and from today we started seeing this issue.
Note: Even retry does not work. I have changed the MaxResults value to 1 but even though it fails.
FilesResource.ListRequest list = _DriveService.Files.List();
list.Q = "mimeType = 'application/vnd.google-apps.folder' and trashed = false";
list.MaxResults = 1000;
FileList folders = null;
do
{
folders = list.Fetch<FileList>();
foreach (File folder in folders.Items)
{
retColl.Add(folder.Id, folder);
}
list.PageToken = folders.NextPageToken;
} while (!string.IsNullOrEmpty(list.PageToken));
| 771435030be129a38d2cfa583f3a12bda32b84bb014505d2ded50962b84c4b92 | ['fa794bb190bf4016ac6127b128a78d87'] | During some Read/Write/Update operations SharePoint Client Object model returns '(503) Service Unavailable' exception, reattempt solve this problem.
Here, re-attempt Operation creates a new collection of return values and we are not able to assign it back to the original return value object.
Note: Return value of LoadQuery() method is present in 'ClientQueryableResult.m_data' private variable.
We come up with below reflection code. But the problem is we are not sure whether it is safe to use Reflection with SharePoint Client object module to read one of it's private variable value?
e.g. Loading SharePoint Groups we have
var groups = _ClientContext.LoadQuery(_ClientContext.Web.SiteGroups);
_ClientContext.ExecuteQuery();
Below code caches LoadQuery() parameters and use it in exception case for reattempt
object OrgResult, NewResult, Params;
Params = clientObjects
OrgResult = _ClientContext.LoadQuery(clientObjects);
try {_ClientContext.ExecuteQuery();}
catch (WebException webEx){
NewResult = _ClientContext.LoadQuery(Params);
_ClientContext.ExecuteQuery();
object data = NewResult.GetPrivateFieldValue("m_data");
if (data != null)
OrgResult.SetPrivateFieldValue("m_data", data);
}
// Reflection method to read private value
public static object GetPrivateFieldValue(this object src, string fieldName)
{
object value = null;
FieldInfo fieldInfo = src.GetType().GetField(fieldName, BindingFlags.NonPublic
|BindingFlags.Instance);
if (fieldInfo != null)
value = fieldInfo.GetValue(src);
return value;
}
|
3abc6e15f5589871ab14b36dc82ab49458a22eaac7a858ceb5a299d3638f1a13 | ['fa830c9c466a4bf19511022fe03c7778'] | We are trying to build a web app--Dashboard-- to show different interactive(including click callback, fetch new data etc) charts with Bokeh + Holoviews + Datashader on DJango.
Since data is very large and could have 10+ million points we are using datashader. We can have a static html from backend from Bokeh + Holoviews + Datashader from Backend and pass it to front end using Django REST api as :
views.py
import numpy as np
import holoviews as hv
import datashader as ds
from dask import dataframe as dd
from bokeh.io import <PERSON>, curdoc
from bokeh.layouts import layout
from bokeh.models import Slider, Button
from holoviews.operation.datashader import datashade
renderer = hv.renderer('bokeh').instance(mode='server')
def home(request):
def plot_info(y_col):
from vaex import dataframe as datafm
df_dask = dd.read_parquet(r"C:\Dropbox\1mln.parquet", engine='pyarrow',
columns=['nest11', 'nest21', 'first_element', 'second_element', 'timestamp'])
df_dask['timestamp'] = dd.to_datetime(df_dask.timestamp, unit='ns')
return hv.Curve((df_dask['timestamp'], df_dask[y_col]))
def bearer():
stream = hv.streams.Stream.define('y-axis', y_col="nest11")()
dmap = hv.DynamicMap(plot_info, streams=[stream])
vmap = datashade(dmap).opts(width=1200, height=600, responsive=True)
html = renderer.static_html(vmap)
return html
context = {
'seq_num': bearer(),
}
return render(request, 'home/welcome.html', context)
Works fine. However Since we used Datashader, data is aggregated and converted in static html when we zoom in we would not get the data which we are looking for at from end side. For that, my guess is we need Bokeh server.
My doubts are :(since use of Datashader is must for large dataset)
How can i use Bokeh server along with Django REST apis ? Also i want to have a customized html page at front end so i am using Django template.
Is there an alternative to Django for REST apis development with Bokeh + Datashader ?
Does Bokeh support REST APIs ? how ? pls share some examples of REST APIs and callbacks ? for example I've a Dashboard and when i click one chart, I should get more details about the chart and play around those charts in dashboard ? dropdown etc
| 77c096593e6791d7961069eb7203d68a883b419537746d2142c68907cf49fd2e | ['fa830c9c466a4bf19511022fe03c7778'] | Command -(i tried other tools also, cxf gives- same below mentioned error and axis2 - says this wsdl is in ws rpc std. so can not convert)
wsimport -B-XautoNameResolution -Xdebug -XdisableAuthenticator -keep -s /Users/mukesh/Desktop http://airarabia.isaaviations.com/webservices/services/AAResWebServices?wsdl
WSDL - http://airarabia.isaaviations.com/webservices/services/AAResWebServices?wsdl
Error -
[ERROR] operation "modifyReservation": more than one part bound to body
line 4663 of http://airarabia.isaaviations.com/webservices/services/AAResWebServices?wsdl
Exception in thread "main" com.sun.tools.internal.ws.wscompile.AbortException
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModelerBase.error(WSDLModelerBase.java:732)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.setMessagePartsBinding(WSDLModeler.java:1505)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.setMessagePartsBinding(WSDLModeler.java:1431)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.processLiteralSOAPOperation(WSDLModeler.java:767)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.processSOAPOperation(WSDLModeler.java:698)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.processPort(WSDLModeler.java:466)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.processService(WSDLModeler.java:245)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:216)
at com.sun.tools.internal.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:126)
at com.sun.tools.internal.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:429)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:190)
at com.sun.tools.internal.ws.wscompile.WsimportTool.run(WsimportTool.java:168)
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:497)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:159)
at com.sun.tools.internal.ws.WsImport.main(WsImport.java:42)
|
5c4fe82740349ddc4b9a2902ec8643310be53cb85118548f89f4dfc8cc81fcf9 | ['fa8693b5f4424dc7a019cc067ba8879a'] | I am developing an Android application that would stream a set of jpeg images over the internet. I need to decode each jpeg image into YUV format, perform some image related operations and then stream it after performing some encoding. Currently I am performing this conversion [JPEG -> YUV] in software. To speed up this conversion, I would like to use hardware decoders. Is there is any Android API that can do this coversion ? Can this be done using OMXCodec?
Regards,
<PERSON>
| da8f8659f800da07174483e94fb65569d441016da006106fbd68bce9fcd3d1c8 | ['fa8693b5f4424dc7a019cc067ba8879a'] | While trying to provide Ethernet Connectivity to my Android Device running on Jellybean,
I used ifconfig and route commands to setup Ethernet Connection.
Now I am trying to execute these commands from an Android application, but am not able to set the IP and gateway address.
Is there anyother way of executing these commands?
I used the following code,
public void root_command(String cmd)
{
try{
Process p=Runtime.getRuntime().exec("su");
DataOutputStream stream=new DataOutputStream(p.getOutputStream());
stream.writeBytes(cmd);
stream.writeBytes("exit \n");
p.waitFor();
}
catch(IOException e)
{
}
catch(InterruptedException e)
{
}
}
these are the commands,
busybox ifconfig eth0 <ip_address> up
busybox route add default gw <gateway_address> eth0
|
1bbdd4129fbf2e316ec953a9301794ac14c75181106005ac887d9559c410b47c | ['fa8795864b9442a3be056b7aee4373aa'] | You can use the image as a background with an ImageView. Something like this
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/background"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/door" />
</LinearLayout>
then in Java, wherever you listen for tap or click events, do something like this
ImageView background = (ImageView) findViewById(R.id.background);
background.setImageResource(R.drawable.doorclosed);
to toggle to the other image.
| e269cdaf8224f8e6c2a2717eefc9907ff1a79c13802eef5ce582cca045a74329 | ['fa8795864b9442a3be056b7aee4373aa'] | I believe there should be no difference. These are the lifecycle methods I typically see when pressing the home button from an activity, on android 2.3.4
onPause
onStop
then when I use either the icon or previous applications to navigate back, I see
onRestart
onStart
onResume
Now, in some cases the system will tell your activity to finish while you are away (or immediately when you return if an orientation change occurred). Then you will see onDestroy, and the following when you navigate back
onCreate
onStart
onResume
I don't think there is anything mysterious going on here. According to the Activity documentation, there are only four states that a process can be in, and both of these fall under background activity.
|
8026491bdc7e4487e4ba83638c4f6ad5a0de44b8921d5cc39ef23bf5ad14f1c9 | ['fa88f09c07684778a8db8adf95e37dfe'] | Consider the following sequence of random variables:
$X_1$ has only values $0$ and $1$ with positive probability
$X_2$ only $0,1,2$
$X_3$ only $0,1,2,3$.
Let's stop here. Can this sequence be a martingale?
We would need to find out what $\mathbb{E}(X_2|X_1)$ is.
But I do not see how we could say anything about this without knowing the distribution of those variables.
| fb06b756886d608a7192e58124a9a014b322526f2207d01ab4f5c77957fe22e3 | ['fa88f09c07684778a8db8adf95e37dfe'] | Could you check if my solution is correct? I find the filtrations quite tricky.
Here is the problem: Let $\{X_n\}_{n \in \mathbb{N}}$ be a stochastic process and $B$ a borel set in $\mathbb{R}^N$.
Prove that $ \tau_k = \inf \{n> \tau_{k-1}: \ X_n \in B\}$ is a stopping time w.r. to the natural filtration generated by the process.
Here is what I've done:
I assume that we know that the first hitting time is a stopping time and I want to prove the statement by induction.
Assume $\tau_k$ is a stopping time, $k \ge 1$.
We want to check if $\{ \tau_{k+1} \le n \} \in \mathcal{F}_n$ .
We have that $$\{ \tau_{k+1} \le n \} = \{ \tau_{k+1} =0 \} \cup \dots \cup \{ \tau_{k+1} =n \} $$
$\{ \tau_{k+1} =0 \} = \emptyset$, because if $k \ge 1$ and $\tau_{k+1} =0$, then $\tau_{k} <0$.
Generally, $$\{ \tau_{k+1} =j \} = \{ \tau_{k+1} < j \} \cap \{X_{j} \in B\} \in \mathcal{F}_j$$
And using the inductive assumption for the first set, measurability and the fact that $\{X_n\}$ is adapted to the filtration with the property that $\forall n: \ \mathcal{F}_n \subset \mathcal{F}_{n+1}$, we get that $\{ \tau_{k+1} \le n \} \in \mathcal{F}_n$
Is everything correct here?
|
9dca5aa0ae2d808d927aff959b378d58cda56119e112abfd29c9a9104e77b40b | ['fa8d1d8aec9948c7b6d85c3261e6692e'] | I am using the following code to save attachments from an email into a folder, now I want to add a if clause or conditions which says only save attachments with a .pdf extension.
Can someone please show me how I can change my code to get this to happen, thanks in advance
Public Sub SaveAttachments()
Dim objOL As Outlook.Application
Dim objMsg As Outlook.MailItem 'Object
Dim objAttachments As Outlook.Attachments
Dim objSelection As Outlook.Selection
Dim i As Long
Dim lngCount As Long
Dim strFile As String
Dim strFolderpath As String
Dim strDeletedFiles As String
' Get the path to your My Documents folder
On Error Resume Next
' Instantiate an Outlook Application object.
Set objOL = CreateObject("Outlook.Application")
' Get the collection of selected objects.
Set objSelection = objOL.ActiveExplorer.Selection
' The attachment folder needs to exist
' You can change this to another folder name of your choice
' Set the Attachment folder.
strFolderpath = "\\UKSH000-FILE06\Purchasing\New_Supplier_Set_Ups_&_Audits\ATTACHMENTS\TEST\"
' Check each selected item for attachments.
For Each objMsg In objSelection
Set objAttachments = objMsg.Attachments
lngCount = objAttachments.Count
If lngCount > 0 Then
' Use a count down loop for removing items
' from a collection. Otherwise, the loop counter gets
' confused and only every other item is removed.
For i = lngCount To 1 Step -1
' Get the file name.
strFile = objAttachments.Item(i).FileName
' Combine with the path to the Temp folder.
strFile = strFolderpath & strFile
' Save the attachment as a file.
objAttachments.Item(i).SaveAsFile strFile
Next i
End If
Next
ExitSub:
Set objAttachments = Nothing
Set objMsg = Nothing
Set objSelection = Nothing
Set objOL = Nothing
End Sub
| 5eb3029262adcb9d5ee998f0ebcc573e735104d84529405ab874cac556dc8a01 | ['fa8d1d8aec9948c7b6d85c3261e6692e'] | I am trying to use vba code to print an area of excel (AC120:AT128) when a cell value contains "X"
At the moment my code prints out the whole spread sheet but I only want it to print out the selected cell area.
Can someone please show me how I can achieve this? thanks in advance.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim celltxt As String
celltxt = ActiveSheet.Range("AQ98").Text
If InStr(1, celltxt, "X") Then
Dim ws As Worksheet
For Each ws In Worksheets
If ws.Range("AQ98") = "X" Then
ws.PrintOut
End If
Next ws
Else
End If
End Sub
|
d6dec11d5cc8ab9e003e7c2ea3f627d8d5130902d6b076ca602ffc2d7e582f2c | ['fa94e1551af149088c8eccf6267e27e3'] | I am working in SQL Server on a project. and I have this data
Column1
B.Ed
B.Ed
B.Ed
PTC
PTC
Now what I want with this data is that in SQL Server it should create two new columns named as B.Ed and PTC and insert "1" in fields when they occur in Column1. This is how the Output should
I have a guess that it will be done with subqueries and I tried to understand them but couldn't understand the concept. So if you can help we with SQL query that can implement what I am trying to achieve here. Sorry about formatting but I hope you all are getting my point.
| 5bffdf1d0dcdee4db34cbdbfb5ce972b766b7b9a48283e519f2349f5ecc1db3f | ['fa94e1551af149088c8eccf6267e27e3'] | I have written the code print only those words greater then length 5.
Now i want to print words that start and end with same letter.
Please note that it should be done in C# using regex library.
Code to print words greater than 5.
String str="programing world is nooooooot funnnnnnn";
Regex reg=new Regex("^[a-zA-Z_\\w]\\w*$");
String[] words=str.Split(' ');
for(int i=0;i<words.length;i++)
{
String temp=words[i];
if(Regex.IsMatch(temp,@"[a-zA-Z]{5}"))
Console.Writeline(temp);
}
|
2ea38278e21b349e466f98509f89e5d750a03d04e0a4344769b13880352210eb | ['faa13610c1344b7ca28b0ca9ef9c1963'] | When you check if the typed value is Y or N, if the value is wrong, you ask the user to type again a new value, making a recursive call. However, when this recurisve call ends, the method continues till the end, printing the value typed first. The right implementation should be this:
if (!("Y".equals(repeatRun) || "N".equals(repeatRun))) {
System.out.println("Please enter the correct value. (Y/N)");
repeatRun = this.recursionMethod();
}
else {
System.out.println("value of the entered variable->"+repeatRun);
}
return repeatRun;
| fab9eecb376d04b7eb619a20cae4c548bd3e06f609dd9d1cf03eb34145e62c39 | ['faa13610c1344b7ca28b0ca9ef9c1963'] | If you can use Java8, you can solve this problem easily. Declare the method as follows:
private static List<Set<String>> loadFiles(File[] files, Supplier<Set> setSupplier, Charset charSet)
Change your problem line to:
Set<String> set = setSupplier.get();
Then, in each call to this method, the setSupplier param can be easily provided using method references: HashSet<IP_ADDRESS>new, TreeSet<IP_ADDRESS>new...
|
360a4e4d3dbde7d8bfb120a51244c0f0f93c6650faf49b66a648e834d9fcd839 | ['faba7dbc24244afdb240027700a30651'] | My project run Liferay Tomcat server, but from few days its give some warning message continuously that fill server console log .
00:53:42,902 WARN [http-bio-80-exec-177][SecurityPortletContainerWrapper:623] Reject process action for http://www.myurl.com/welcome on 49
What is the meaning of this warning, we did not change any setting.
Please tell me how we solve this issue.
| a545e35446e9d56a313010424b9dbb68f08d90b12c527bebf9340fb422887f90 | ['faba7dbc24244afdb240027700a30651'] | My java thermal printer code not able to print long receipt(more than A4 sheet size). Its work fine normally, but in case where there is too much items in cart then it generate half print. My code is under mentioned-
public PrintReceipt(Map<String,String> hm){
/*
product details code..
*/
try{
input = new FileInputStream("C:/printer.properties");
prop.load(input);
printerName=prop.getProperty("receiptPrinter");
System.out.println("Printer Name "+printerName);
}catch(Exception exception){
System.out.println("Properties file not found");
}
PrintService[] pservices = PrintServiceLookup.lookupPrintServices(null,null);
for (int i = 0; i < pservices.length; i++) {
if (pservices[i].getName().equalsIgnoreCase(printerName)) {
job = PrinterJob.getPrinterJob();
PageFormat pf = job.defaultPage();
double margin = 1.0D;
Paper paper = new Paper();
paper.setSize(216D, paper.getHeight());
paper.setImageableArea(margin, margin, paper.getWidth() - margin * 1.5D, paper.getHeight() - margin * 1.5D);
pf.setPaper(paper);
job.setCopies(1);
pf.setOrientation(1);
job.setPrintable(this, pf);
try
{
job.print();
}
catch(PrinterException ex)
{
System.out.println("Printing failed");
}
}
}
}
public int print(Graphics graphics, PageFormat pageFormat, int pageIndex)
throws PrinterException {
if(pageIndex > 0)
return 1;
Graphics2D g2d = (Graphics2D)graphics;
double width = pageFormat.getImageableWidth();
double height = pageFormat.getImageableHeight();
g2d.translate((int) pageFormat.getImageableX(),(int) pageFormat.getImageableY());
Font font = new Font("Monospaced",Font.BOLD,8);
g2d.setFont(font);
try {
/*
* Draw Image*
*/
int x=50 ;
int y=10;
int imagewidth=100;
int imageheight=50;
BufferedImage read = ImageIO.read(new File("C:/hotel.png"));
g2d.drawImage(read,x,y,imagewidth,imageheight,null); //draw image
g2d.drawString("-- * Resturant * --", 20,y+60);
g2d.drawLine(10, y+70, 180, y+70); //draw line
} catch (IOException e) {
e.printStackTrace();
}
try{
/*Draw Header*/
/*
product details code..
*/
/*Footer*/
//end of the receipt
}
catch(Exception r){
r.printStackTrace();
}
return 0;
}
Please let me know how can i generate long receipt print by correcting my code or if you have any better solution to do this.
|
8f538052d193e51438a03121f9c68a1f151c87d663c89315475a00325370db3f | ['fafd39e7838848b2bc23084c1d45f917'] | I am trying to plot both horizontal and vertical lines on a histogram that will be accurate to changing limits on both the x and y axes. I was using the line(X,Y) function, but cannot find a useful way to get the lines to be set depending on the parameters of the graph window.
| a1640ccb3c7960bd361aad7244f9204f521a4f58c7481a6ed540d85d5ba991ec | ['fafd39e7838848b2bc23084c1d45f917'] | I have multiple arrays that I need to identify and interpolate to a set number. the set number will be the 'length?' of the biggest array. I need to How could I identify each array length and create a loop to interpolate each array to that specific length? Sorry if I am not providing enough detail.
|
86f2d4fd43fbfb6e575537f9500ad611899f4774c86d4cd581747838653f278b | ['fb0fbacb39b7443c8942a99b97722008'] | How can I map this using RestKit? I want to generalize this as much as possible because each key represents the name of a Parking Lot and if any parking lot is added I don't need to change the code.
{
Arco Do Cego:
{
address: "Parque do Arco Cego, Avenida João Crisóstomo, 1000-178 Lisboa",
campus: "Alameda",
description: "Parque Estacionamento do Arco do Cego",
freeSlots: 68,
latlng: "<PHONE_NUMBER>,-9.14313902",
name: "Arco do Cego",
total: 70,
workingHours: "24h"
}
}
And I wanted something like this:
import Foundation
import CoreData
@objc(ParkingSpots)
class ParkingSpots: NSManagedObject {
@NSManaged var id: String
@NSManaged var parks: NSSet
}
@objc(Park)
class Park: NSManagedObject {
@NSManaged var address: String
@NSManaged var campus: String
@NSManaged var desc: String
@NSManaged var freeSlots: NSNumber
@NSManaged var latlng: String
@NSManaged var name: String
@NSManaged var total: NSNumber
@NSManaged var workingHours: String
@NSManaged var parkingSpot: ParkingSpots
}
In Java I would:
for (Map.Entry<String, JsonElement> entry : jObj.entrySet()) {
String name = entry.getKey();
Parking parking = gson.fromJson(entry.getValue(), Parking.class);
parking.setName(name);
}
Thank you. I am using iOS8 and swift
| e785a37371f796b1e4654e8612542d66e4f5a7cdf234760ef87275b4f6b6bf4b | ['fb0fbacb39b7443c8942a99b97722008'] | There isn't much documentation on this, however I could find a Elasticsearch team member response to another question. Stating:
You're correct that all Kibana saved objects are stored in Elasticsearch, in the .kibana index. It doesn't write anything to the filesystem (save for maybe some temporary files, but even that I'm pretty sure doesn't happen).
Therefore, I would say that only temporary information is stored in the path.data and all the relevant information (for either persistence or for monitorization) is stored under the .kibana index.
Can someone else confirm this?
|
5d3eb5033c0bbfb318d233fa2619893ad0e46ac4137519d192a2b96318da80a5 | ['fb13901b08844b18bf3a05174d92cfc9'] | I'm currently building an app (Electron) and i need to connect it with a c++ library. I have done most of the binding using the NodeJS c++ addons, but i'm missing an important part that is related with receiving the events generated by the c++ library on my Javascript code.
void Event1(int64_t id)
{
ArrayBufferAllocator allocator;
Isolate<IP_ADDRESS>CreateParams create_params;
create_params.array_buffer_allocator = &allocator;
Isolate* isolate = Isolate<IP_ADDRESS>New(create_params);
{
v8<IP_ADDRESS>Locker locker(isolate);
Isolate<IP_ADDRESS>Scope isolate_scope(isolate);
HandleScope handle_scope(isolate);
Local<Context> context = Context<IP_ADDRESS>New(isolate);
Context<IP_ADDRESS>Scope context_scope(context);
v8<IP_ADDRESS>Local<v8<IP_ADDRESS>Value> argv[1] = {
Nan<IP_ADDRESS>New("OnWillPlayTrack").ToLocalChecked(), // event name
};
Nan<IP_ADDRESS>MakeCallback(isolate->GetCurrentContext()->Global(),"emit", 1, argv);
}
isolate->Dispose();
}
The Event1 is being called by the c++ lib, that has nothing to do with V8, and now I want to fire an event to JavaScript, back to Node (EventEmitter?).
I think that the biggest problem is that most of the v8 functions now need an Isolate, and most of the examples found throughout the web are pretty old.
The Event1 code crashes at MakeCallBack with:
Thread 24 Crashed:: App
0 libnode.dylib 0x000000010a81e35b v8<IP_ADDRESS>String<IP_ADDRESS>NewFromOneByte(v8<IP_ADDRESS>Isolate*, unsigned char const*, v8<IP_ADDRESS>String<IP_ADDRESS>NewStringType, int) + 43
1 libnode.dylib 0x000000010a4b042f node<IP_ADDRESS>OneByteString(v8<IP_ADDRESS>Isolate*, char const*, int) + 15
2 libnode.dylib 0x000000010a4ba1b2 node<IP_ADDRESS>MakeCallback(node<IP_ADDRESS>Environment*, v8<IP_ADDRESS>Local<v8<IP_ADDRESS>Object>, char const*, int, v8<IP_ADDRESS>Local<v8<IP_ADDRESS>Value>*) + 50
3 libnode.dylib 0x000000010a4ba240 node<IP_ADDRESS>MakeCallback(v8<IP_ADDRESS>Isolate*, v8<IP_ADDRESS>Local<v8<IP_ADDRESS>Object>, char const*, int, v8<IP_ADDRESS>Local<v8<IP_ADDRESS><IP_ADDRESS> App
0 libnode.dylib 0x000000010a81e35b v8::String::NewFromOneByte(v8::Isolate*, unsigned char const*, v8::String::NewStringType, int) + 43
1 libnode.dylib 0x000000010a4b042f node::OneByteString(v8::Isolate*, char const*, int) + 15
2 libnode.dylib 0x000000010a4ba1b2 node::MakeCallback(node::Environment*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*) + 50
3 libnode.dylib 0x000000010a4ba240 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, char const*, int, v8::Local<v8::Value>*) + 96
4 addon.node 0x0000000110e62e1f Event1(long long) + 291 (v8.h:6721)
Any help will be greatly appreciated!
| 87a33919e5790597a709bb19024259c923c62fedee8196411eb576c669c357ca | ['fb13901b08844b18bf3a05174d92cfc9'] | Try something like this:
var tTable = "<table border=\"0\">";
var newArray = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"];
var newTr = "";
for (var i = 0; i < newArray.length; i++) {
if(i % 3 == 0)
newTr += (i > 0) ? "</tr><tr>" : "<tr>"
newTr += "<td>" + newArray[i] + "</td>";
}
newTr+="</tr>";
tTable += newTr;
document.write(tTable);
As you start with element i = 0, you need to be careful because 0/3 = 0.
In my example code, i check, like you, if we are at the the 3º element of the row, but i put a "special" condition when i = 0.
So, in the first element we only create the row (), and for the next 3rd elements, we close the previous row and create a new one.
|
2267d1bad8b3618754ee1f2ed8cb10124d9dcd0b05df49fec3427a8fe47e927f | ['fb1aa31eca6a461eacd87b1fb4b479d0'] | I have a pandas dataframe like the one below. I would like to build a correlation matrix that establishes the relationship between product ownership and the profit/cost/rev for a series of customer records.
prod_owned_a prod_owned_b profit cost rev
0 1 0 100 75 175
1 0 1 125 100 225
2 1 0 100 75 175
3 1 1 225 175 400
4 0 1 125 100 225
Ideally, the matrix will have all prod_owned along one axis with profit/cost/rev along another. I would like to avoid including the correlation between prod_owned_a and prod_owned_b in the correlation matrix.
Question: How can I select specific columns for each axis? Thank you!
| b7e2d1aa5b2909f1c3cc372f49300aa029672c4ea0f676eacdf611864f157576 | ['fb1aa31eca6a461eacd87b1fb4b479d0'] | I have a data frame, address, like the one below:
P_o_box House_num
0 22 100
1 22 100
2 22 101
3 23 102
4 26 104
I'd like to create a new pd.dataframe, specific_address, that only returns specific values for 'P_o_Box' and 'House_num'. My code returns instead a data frame of boolean values. How can I only include the VALUES of the address dataframe to my new dataframe, specific_address?
specific_address = pd.DataFrame({'P_o_box': address['P_o_box'] == 22,
'House_num': address['House_num'] == 100})
|
e9d3e445ae148f212d2b8cd0679ce01da4c71a7f04e28aa759f63b185220676c | ['fb25e140ad704099aa1d3da81947db39'] | I have a datatable thru which a user can page and select a record for display ..
The record replaces the the entire datatable with another one via an Ajax call
.. On the second
datatable is a button to allow you to return to the first .. Currently when you
do so you are returned to the start of the first table .. What i want to do is
store the state of the first datatable (current page, offset, max records .. )
when a record is selected so i can restore it when they go back to it ..
Actually storing the info is not so much of a problem - it's how to reapply it
so my first table is as the user left it .??
I had a look around and found some code ..
YAHOO.util.Event.onDOMReady(function(e) {
var offset = new YAHOO.util.Element('offset').get('value');
var max = new YAHOO.util.Element('max').get('value');
var state = GRAILSUI.receiptBatchList.getState();
state.sorting = state.sortedBy;
state.pagination.recordOffset = offset;
state.paginator.rowsPerPage = max;
var query = GRAILSUI.receiptBatchList.buildQueryString(state);
GRAILSUI.receiptBatchList.getDataSource().sendRequest(query,{
success : GRAILSUI.receiptBatchList.onDataReturnReplaceRows,
failure : GRAILSUI.receiptBatchList.onDataReturnReplaceRows,
scope : GRAILSUI.receiptBatchList,
argument: state
});
where offset and max are just hiden values on the page but i can't get this to work and i'd really hoped it would be reasonably quick
to implement ..
Any suggestions ?
TIA ..
| ba17e5592334483d1fc8d746209848c3cdd22efb826cc0661ee483a26b015133 | ['fb25e140ad704099aa1d3da81947db39'] | I'm playing with the datatable implementation in the Easygrid plugin and I have to say i love it but I have a question . If i use datatable directly (ie outside of Easygrid) to decorate a table i get a global search box defined above my table . If i use the Easygrid implementation and define my grid in a controller I get filters added for each column but no search box - it is added but then removed somehow either by easygrid itself or some parameter passed to datatable . How can I restore the search box and is this a bug as i would have thought the default implementation of datatable supplied via easygrid should match the default implementation supplied by the vanilla datatable itself? I'm using Grails 2.3.7 and Easygrid 1.6.2 .. Thanks
|
e2f11e42d874657027502689dbf03df0ead0b1a28e5fcb98db66ef9b9e1511f0 | ['fb2742e8d4e84fafa0ebe003fed7085f'] | You can try it by changing your main color through script.
You can create a ToggleButton, add an Image component and then you get your Toggle component via script :
Toggle myToggleButton = GameObject.Find("MyButtonName").GetComponent<Toggle>();
Then you add a script to your button :
myToggleButton.onValueChanged.AddListener(MyButtonAction);
And your MyButtonAction() method can look like this :
void MyButtonAction(bool state){
if(state)
toggle.GetComponent<Image>().color = Color.green;
else
toggle.GetComponent<Image>().color = Color.ref;
}
Or if you don't want to add an Image component to your toggle, you can play with the myToggleButton.colors
By the way, you can choose the initial state of a toggle button, so the highlighted color can be the default one if the toggle state is true by default.
| c80f5aa941a1b487017847f44ace24ec50dc8ff656f3234a636e6d2154d6803b | ['fb2742e8d4e84fafa0ebe003fed7085f'] | I see a lot of different problem that may exists :
So here is what you should test :
First you should try :
GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
If your player gameObject has an unique name, try to use
Transform playerTransform = GameObject.Find("MyPlayerName").transform
If it still doesn't work, if this script is assign to your player, you can access the gameObject by using this
If your script isn't attach to your player gameobject, you can set your player gameobject as a public attribute to your script. And then in the editor, grab your player gameobject and put it in the right case of your class attribute. In this case your declaration should be :
public GameObject myPlayer;
But before testing any of these methods, you should test if the problem comes from the GameObject.FindGameObjectWithTag by simply using your player name in this editor. Let assumes that your gameobject player name is MyFantasticPlayer. Then try this :
`GameObject myPlayer = GameObject.FindGameObjectWithTag("Player");
if(myPlayer.name == "MyFantasticPlayer")
{
Debug.Log("Not problem with FindGameObjectWithTag");
}else{
Debug.Log("Problem");
}`
And if your Debug log says problem, maybe try to catch an exception.
|
708575d4e10f4b3f0bc20b236e9e84dcc512bf76994ed869269589a36dba2596 | ['fb2a1a143b634def91f04d07aa7e05c8'] | function fillInAddress() {
var place = autocomplete.getPlace();
var geocoder = new google.maps.Geocoder();
var latitude;
var longitude;
geocoder.geocode({ 'address': place.formatted_address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
latitude = results[0].geometry.location.lat();
longitude = results[0].geometry.location.lng();
} else {
alert("Request failed.")
}
});
document.getElementById("long").value = longitude;
document.getElementById("lat").value = latitude;
}
I cant access latitude and longitude outside geocode() function. Please help.
| c54ecc43016473c2f531202c3caaa019d25504900f872d381657b022e06da098 | ['fb2a1a143b634def91f04d07aa7e05c8'] | I am trying to maintain a series of data nodes in neo4j using cypher.
So i am creating a node with current date and timestamp. I also need to create a connection between current and most recent node.
So I need to check if nodes already exists if they do then get the node with latest date and create
(latest:Node)<-[:next]-(prev:Node).
If the nodes does not exist then just create a node with current date.
Thanks
|
3f06f84ac1390bb1ce5d0eaf61ade8aa3303b018d000cf4a7407d6eae4712eec | ['fb32e4b2017c4dba91add6022133e2c0'] | Concerning the statement "`I guess that someone assumed I use PHP`", it is far more likely that this is an automated attack whereby an adversary is currently scanning entire ranges of hosts and IPs for this ThinkPHP remote code execution vulnerability. They wouldn't have even tried to guess whether or not your application is PHP-based — this is more of a "spray-and-pray" process. | 8894551e275d359f1f8f22fd0f198a4b2b826d91396e6ad510e0f5009ee45c6f | ['fb32e4b2017c4dba91add6022133e2c0'] | I cannot say for sure why `wpscan` cannot find the exact version of your plugin in your case, but it most probably means it is not leaked anywhere in the places it tries to retrieve plugin version numbers from passively (https://github.com/wpscanteam/wpscan/blob/master/app/finders/plugin_version/readme.rb). You could try playing around with various `wpscan` flags to see if you get better results. Run `wpscan --hh` to see the full list of options. |
071dfd2c6ff3c8830771863be062d45e690de3433adeafb2abfd093ca115c174 | ['fb4816d8148c4f88a080b9af3cf907dc'] | An async function returns a Promise.
So your resolveCookies function will also return a Promise as you noticed.
You need to either chain the console.log with a .then e.g.
resolveCookies().then(console.log);
Or if you need to set it to a variable like final you need to await that Promise too. In that case you need an async IIFE:
(async () => {
const final = await resolveCookies();
console.log(final);
})();
| 7ee8a2a70e05f57b86dc96e3b8b8bdad6570f70727e8385053be3d4f8242934c | ['fb4816d8148c4f88a080b9af3cf907dc'] | The constructor should be used only to initialize the state. You should not call this.setState in the contructor you should indeed try to move TimelineMax to componentDidMount. Moreover because this.setState is asynchronous calling it multiple times won't work e.g.
class Counter extends React.Component{
constructor(props){
super(props)
//initial state set up
this.state = {value:0}
}
componentDidMount(){
//updating state, OUTPUT will be 1
this.setState({value:this.state.value+1})
this.setState({value:this.state.value+1})
this.setState({value:this.state.value+1})
this.setState({value:this.state.value+1})
}
render(){
return <div>Message:{this.state.value}</div>
}
}
I believe this is why your module doesn't work. So you should either use the callback to this.SetState that is triggered after the state is updated or use componentDidUpdate
docs ref
|
c7afb19ba507f9e49e1107891ce5b65e8dd0ebf00cc892e1e2000c77a2dec785 | ['fb65e5074caa42efb080449313a814ef'] | Had a similar problem with ffmpeg.exe (4.3.1),
but everything works fine with ffmpeg-20200802-b48397e-win64-static,
since mp3_mf is not used in the standard container there
(WAV/MP3 in your problem, AVI in my problem).
So if you can't switch to a different ffmpeg version,
you should force it to use libmp3lame, not just mp3
and the use of (System?)-codec mp3_mf :
So don't use: -f mp3
Instead use (or add): -c:a libmp3lame
| 13eb54838fab7f878c9c4182c194c437a6aeef242b77f42c36d08c186b364e4a | ['fb65e5074caa42efb080449313a814ef'] | After I faild again and again to find the answer I wrote these Script:
<!-- : first Line of "JustPopdBack.cmd"-Script (a CMD+Script for Windows)
@echo off %debug%
setLocal enableExtensions
:: Copyleft 2017 <PERSON> (aka <PERSON>) - Licence: GNU-GPLv3
:: ----------------------------------------------------------------------------
:: Cause it seems stupid to make a short Script long just for Right
<IP_ADDRESS> of the Author, so the Licence-Text is not embeded in this Script.
<IP_ADDRESS> !!! Please have a look on <http://www.gnu.org/licenses/>
:: if you still don't know the GNU-GPLv3.
:: ----------------------------------------------------------------------------
:: This is just a free and open TestScript
<IP_ADDRESS> Feel free to used or modify but please mark this work (how as done).
:: -----------------------------------------------------------------------------
title JustPopdBack-Test
color 0a %= cause I like LightGreen on Black =%
echo.
echo. Just a Test-Script for PushD and PopD Command
echo.
echo. To use it please Enter some Directorys first
echo. Don't shy to use diffrent Drives (C:\ or D:\ etc. )
echo. ...and feel free to use the TAB-Key then...
echo. Lets PushD in this Dir and after just Enter Nothing Popd out.
::******************************************************************************
:dLoop for UserQuest and Pushd in
echo.
set "NxtDir="
set /P "NxtDir=NextDir? :\> "
if defined NxtDir (PushD %NxtDir% & goTo dLoop)
::------------------------------------------------------------------------------
echo.
echo. Lets see the PushD History
pushD
echo. now try again with "For /F"-Loop a PopD Back.
for /f %%a in ('pushD') do (echo %%a && PopD)
echo.
echo This don't work - did you know why?
timeOut -1
:*******************************************************************************
:PopDback that will work
PopD && Echo. Uh I PopD'd - let's'ee PushD now: && PushD && goTo PopDback
:: but I don't like that - can you help to make me happy ?
--------------------------------------------------------------------------------
timeout -1
color
exit /b %= That the End of this Script =%
<IP_ADDRESS><IP_ADDRESS> Copyleft 2017 Markus Merkle (aka Mäx) - Licence: GNU-GPLv3
<IP_ADDRESS> ----------------------------------------------------------------------------
<IP_ADDRESS> Cause it seems stupid to make a short Script long just for Right
:: of the Author, so the Licence-Text is not embeded in this Script.
:: !!! Please have a look on <http://www.gnu.org/licenses/>
<IP_ADDRESS> if you still don't know the GNU-GPLv3.
<IP_ADDRESS> ----------------------------------------------------------------------------
<IP_ADDRESS> This is just a free and open TestScript
:: Feel free to used or modify but please mark this work (how as done).
<IP_ADDRESS> -----------------------------------------------------------------------------
title JustPopdBack-Test
color 0a %= cause I like LightGreen on Black =%
echo.
echo. Just a Test-Script for PushD and PopD Command
echo.
echo. To use it please Enter some Directorys first
echo. Don't shy to use diffrent Drives (C:\ or D:\ etc. )
echo. ...and feel free to use the TAB-Key then...
echo. Lets PushD in this Dir and after just Enter Nothing Popd out.
<IP_ADDRESS>******************************************************************************
:dLoop for UserQuest and Pushd in
echo.
set "NxtDir="
set /P "NxtDir=NextDir? :\> "
if defined NxtDir (PushD %NxtDir% & goTo dLoop)
<IP_ADDRESS>------------------------------------------------------------------------------
echo.
echo. Lets see the PushD History
pushD
echo. now try again with "For /F"-Loop a PopD Back.
for /f %%a in ('pushD') do (echo %%a && PopD)
echo.
echo This don't work - did you know why?
timeOut -1
:*******************************************************************************
:PopDback that will work
PopD && Echo. Uh I PopD'd - let's'ee PushD now: && PushD && goTo PopDback
<IP_ADDRESS> but I don't like that - can you help to make me happy ?
--------------------------------------------------------------------------------
timeout -1
color
exit /b %= That the End of this Script =%
:: Thnx to all my Teachers
<IP_ADDRESS> ...but the realy ones not the called & most have just 60 Minutes for me...
I hope you see why I wrote this Script and also hope all you like to give me many comments so we can find out what is going wrong here and maybe there ...
(hey not in my Head - I hope :-)
My Targed of this Post is a Working of
for /f %a in ('PushD') do PopD
|
437d448536eb0313236b01f3170c5de66bfab1c26119bf8292016e4722b9ba1c | ['fb72df107bde49f482ce947f915ad355'] | I am trying to minimize the loss using SGD, but its throwing error while I am using SGD, I am trying to do it in tensorflow 2.0, one additional parameter that is causing issue is var_list
import tensorflow as tf
import numpy
import matplotlib.pyplot as plt
rng = numpy.random
print(rng)
# Parameters
learning_rate = 0.01
training_epochs = 1000
display_step = 50
# Training Data
train_X = numpy.asarray([3.3,4.4,5.5,6.71,6.93,4.168,9.779,6.182,7.59,2.167,
7.042,10.791,5.313,7.997,5.654,9.27,3.1])
train_Y = numpy.asarray([1.7,2.76,2.09,3.19,<PHONE_NUMBER>,1.573,3.366,2.596,2.53,1.221,
2.827,3.465,1.65,2.904,2.42,2.94,1.3])
n_samples = train_X.shape
print(n_samples)
X = tf.Variable(train_X, name = 'X' ,dtype = 'float32')
Y = tf.Variable(train_Y, name = 'Y' ,dtype = 'float32')
print(X)
# Set model weights
W = tf.Variable(rng.randn(), name="weight")
b = tf.Variable(rng.randn(), name="bias")
print(W)
print(b)
# Construct a linear model
pred = tf.add(tf.multiply(X, W), b)
# Mean squared error. reduce_sum just calculates the sum of the parameters given.
cost = tf.reduce_sum(tf.pow(pred-Y, 2))/(2*n_samples)
# Gradient descent
# Note, minimize() knows to modify W and b because Variable objects are trainable=True by default
#optimizer = tf.train.GradientDescentOptimizer(learning_rate).minimize(cost)
optimizer = tf.optimizers.SGD(name='SGD').minimize(cost)
#optimizer = tf.SGD(learning_rate).minimize(cost)
# Initialize the variables (i.e. assign their default value)
init = tf.global_variables_initializer()
| f87b837d0c5293ffd74d773e68ba370d6dd9f2b934bee68d38701ae60d0a179a | ['fb72df107bde49f482ce947f915ad355'] | nltk.ne_chunk returns a nested nltk.tree.Tree object so you would have to traverse the Tree object to get to the NEs. You can use list comprehension to do the same.
import nltk
my_sent = "WASHINGTON -- In the wake of a string of abuses by New York police officers in the 1990s, <PERSON>, the top federal prosecutor in Brooklyn, spoke forcefully about the pain of a broken trust that African-Americans felt and said the responsibility for repairing generations of miscommunication and mistrust fell to law enforcement."
word = nltk.word_tokenize(my_sent)
pos_tag = nltk.pos_tag(word)
chunk = nltk.ne_chunk(pos_tag)
NE = [ " ".join(w for w, t in ele) for ele in chunk if isinstance(ele, nltk.Tree)]
print (NE)
|
8014a97ff6593ea924ee7fee999ef57248c6933982faa59e4fb8ab0c7d2c9046 | ['fb7591272e6d41dc8547d1eb3555b9e6'] | I want to add a button to my login control but it won't let me. I guess the build in login class works in a different way.
<asp:login
ID="seamenLogin" runat="server"
TitleText="<strong>Inloggning till sjöläkarwebben. Läkarintyg enligt Manilakonventionen</strong>"
InstructionText="<br/>Förutsättningar för att använda systemet, ansökan om lösenord<br/>och mer information bl.a.
om Manila finns på sidan<br/><a href='http:'>http:</a><br/><br/>
Inloggning med <a class='linkbutton' href='https:/' (BankID, Mobil BankID, ...)</a><br/><br/><br/>
Inloggning med användarnamn och lösenord kan fortfarande användas men vi<br/>rekommenderar att du övergår till inloggning med e-legitimation redan nu.<br/><br/>"
UserNameLabelText="Användarnamn:"
PasswordRecoveryText="Har du glömt ditt lösenord?<br/>Här kan du beställa nytt. Det sänds i rekommenderat brev till din folkbokföringsadress."
HelpPageUrl="http://www.transportstyrelsen.se/sv/Om-webbplatsen/Inloggning-till-vara-fordonstjanster/E-legitimation/Problem-med-din-e-legitimation/"
<TitleTextStyle CssClass="heading1" HorizontalAlign="Left"/>
<LabelStyle CssClass="textboxnamn" HorizontalAlign="Left" Width="100px"/>
<InstructionTextStyle HorizontalAlign="Left" />
<LoginButtonStyle CssClass="loginbutton"/>
</asp:login>
How do I add a simple button to this code?
| 6d3a2ecb7d7a5183b4865eb192503b54065d01020cdcced8995d009dd3c3ab9f | ['fb7591272e6d41dc8547d1eb3555b9e6'] | Hi i'm working on a link inside a asp:login and I want to add a "variable" from the web config instead of hard coding the link directly inside the aspx.
<asp:login
ID="seamenLogin" runat="server"
Inloggning med <a class='linkbutton' href='https:// (BankID, Mobil BankID, ...)</a><br/><br/><br/>
</asp:login>
My web.config:
<appSettings>
<add key="autoemail" value="<EMAIL_ADDRESS>" />
</appSettings>
I want the text "<EMAIL_ADDRESS>" to be a link inside the login aspx.
Does anyone know how to make it so?
|
f53e6ac33e2b4ccfd7aaa6df33434945f97c7c4ee404d19fd1c0e9c1fb959076 | ['fb83013845d74f44a092eabb0baad83f'] | With Roslyn being open source, code analysis tools are right at your fingertips, and they're written for performance. (Right now they're in pre-release).
However, I can't speak to the performance cost of loading the assembly.
Install the tools using nuget:
Install-Package Microsoft.CodeAnalysis -Pre
Ask your question:
var isValid = Microsoft.CodeAnalysis.CSharp.SyntaxFacts.IsValidIdentifier("I'mNotValid");
Console.WriteLine(isValid); // False
| e27777ba01898e81075d4f82698b60c5c6f6a0ba5621ab8ed8da147df1ed136d | ['fb83013845d74f44a092eabb0baad83f'] | The answer to the corollary question: How do you put them back together?
function stitch($infilePrefix, $outFile) {
$ostream = [System.Io.File]<IP_ADDRESS>OpenWrite($outFile)
$chunkNum = 1
$infileName = "$infilePrefix$chunkNum"
$offset = 0
while(Test-Path $infileName) {
$bytes = [System.IO.File]<IP_ADDRESS>ReadAllBytes($infileName)
$ostream.Write($bytes, 0, $bytes.Count)
Write-Host "read $infileName"
$chunkNum += 1
$infileName = "$infilePrefix$chunkNum"
}
$ostream.close();
}
|
0c12bf204430f9d1317e61031cf153a3b0d2ac8feca1b77cc90427768575baff | ['fb84b2921dd2478a88dcc6a50a512897'] | There is a space somewhere in a memory where the values are stored. These memory is then located through address which is usually represented by hexadecimal number, or sometimes binary number. So, these numbers are hard to remember for programmer, so they used the term variable to refer to that memory location in a easy way, or you can say higher abstraction. So, x is just a name that refers to some location in the memory which contains value of 5. That's all!
| 5eaf724b6267a922ea18589261349e8b649fb2af1753658c93e5a05853a68ec9 | ['fb84b2921dd2478a88dcc6a50a512897'] | I worked on similar problem. What I did was, I used session_id. First, you need a table(say, product_list) to hold the product list for temporary purpose. Populate each product to this table along with session_id. This will help you to identify the association of product_list with the active user. On checkout copy the record from product_list to your shopping_cart table and delete the record from product_list.
Try this, it might help you with the current problem.
|
8a2291c8e35cfb4d534838e9324c5248441596ac5004e433034dc064a40191e5 | ['fb8bb2de000b4a278e7189aa1973f334'] | I was found the solution with .
<p:dialog id="idSchemaDlg5" widgetVar="schemaDlg" styleClass="maxSizeDialog" position="90,250" style="max-width:1000px;max-height: 1000px;" header="Schéma des circuits">
<h:form id="schemaFormId" dir="#{login.dir}">
<ui:repeat value="#{historyGenerationBean.schemaList}" var="fileCircuits" varStatus="schemaNum">
<ui:repeat value="#{fileCircuits}" var="pictureNamesList">
<table>
<tbody>
<tr>
<ui:repeat value="#{pictureNamesList}" var="imageName">
<td>
<h:panelGrid columns="1">
<p:commandLink action="#{historyGenerationBean.fetchMlpppInformation}" update=":schemaFormId" >
<p:graphicImage value="#{imageStreamer.image}">
<f:param name="imgName" value="#{imageName}" />
</p:graphicImage>
<f:param name="imgName2" value="#{imageName}" />
</p:commandLink>
<h:outputText value="#{imageName}" style="width:50%; font-family: Tahoma, Geneva, sans-serif; font-size:70%;color:black;background-color:transparent;text-align:left;"/>
</h:panelGrid>
</td>
</ui:repeat>
</tr>
</tbody>
</table>
</ui:repeat>
</h:form>
</p:dialog>
Many thanks to everyone who helped me(@BalusC too).
| d9a7cd753c6b654a96402a75eaaa9b9d5229b097cf94f0fc107d69e0a747a943 | ['fb8bb2de000b4a278e7189aa1973f334'] | I have found the solution to my problem with this code :
Sub CommentCodeModule(wb As Workbook)
Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As VBIDE.CodeModule
Dim WordToFind As String
Dim SL As Long ' start line
Dim EL As Long ' end line
Dim SC As Long ' start column
Dim EC As Long ' end column
Dim Found As Boolean
Dim LineNum As Long
Set VBProj = wb.VBProject
Set VBComp = VBProj.VBComponents("Module3")
Set CodeMod = VBComp.CodeModule
WordToFind = "test"
With CodeMod
SL = 1
EL = .CountOfLines
SC = 1
EC = 255
Found = .Find(target:=FindWhat, StartLine:=SL, StartColumn:=SC, _
EndLine:=EL, EndColumn:=EC, _
wholeword:=True, MatchCase:=False, patternsearch:=False)
Do Until Found = False
Debug.Print "Found at: Line: " & CStr(SL) & " Column: " & CStr(SC)
EL = .CountOfLines
SC = EC + 1
EC = 255
Found = .Find(target:=FindWhat, StartLine:=SL, StartColumn:=SC, _
EndLine:=EL, EndColumn:=EC, _
wholeword:=True, MatchCase:=False, patternsearch:=False)
Loop
LineNum = SL
.DeleteLines LineNum
.InsertLines LineNum, " ' test"
End With
End Sub
Thanks to everyone that helped me.
|
164d3076e9bdd6720d23cbcc27ecb429e60bd76ed5eb3cbf3685124d9af5f8a1 | ['fba4082c6457485685500956731e82f1'] | I am trying to use Google Apps Script to output a formatted RSS feed of upcoming events from a calendar that I can then insert into a Mailchimp Template.
This is the HTML I am using to generate the rss feed:
<rss version="2.0">
<channel>
<title><?= "Title" ?></title>
<? var cal = CalendarApp.getCalendarById('CalendarID');
var today = new Date();
var future = today.addDays(90); //Uses separate function to add days to look ahead
var events = cal.getEvents(today, future);
for (var t in events) { ?>
<item>
<? var start = new Date(events[t].getStartTime())
var date = Utilities.formatDate(start, 'GMT', 'dd/MM/yyyy')
var title = events[t].getTitle()
var time = start.toTimeString().substring(0, 5) ?>
<title><?= date+' - '+time ?></title>
<description><?= title ?></description>
</item>
<? } ?>
</channel>
</rss>
This is the doGet() script the URL calls:
function doGet() {
return ContentService.createTextOutput(HtmlService.createTemplateFromFile("rss").evaluate().getContent())
.setMimeType(ContentService.MimeType.RSS);
}
But whenever I pass it through feedburner or any other RSS Reader it comes up with the same response:
The URL does not appear to reference a valid XML file. We encountered
the following problem: Error on line 921: The element type "meta" must
be terminated by the matching end-tag ""
Even though the call loads fine in a normal browser window as a RSS feed.
I have also the tired the GAS RSS example using the XKCD feed (found here) and I am getting same response.
Any thoughts on what I am doing wrong I have set the web app permissions to Execute as me and Anyone, even anonymous. As said the in the example. Have tried other combinations with no luck as well.
Thanks
| f4c21a266c292da8fc5ce12c5055c56745bc98f905aeab21a7164cf7cd6d6a1b | ['fba4082c6457485685500956731e82f1'] | I am trying to write a script that will take a list of expenses from a google sheet and append them to a already existing table in a google docs template. At the moment I have this (the reason it says names is because I am testing with dummy data of names and ages):
function myFunction() {
var ss = SpreadsheetApp.getActive();
var sheet = ss.getActiveSheet()
var numRows = sheet.getLastRow()
var numColumns = sheet.getLastColumn()
var data = sheet.getRange(1, 1, numRows, numColumns).getValues()
var doc = DocumentApp.openById('13l6O8nmEZgJiZnzumWihsRVOZiq_8vUj6PtBtb9My_0')
var body = doc.getBody()
var tables = body.getTables()
var table = tables[1]
for (var i = 1; i < data.length; i++){
var row = data[i]
var name = row[0]
var age = row[1]
var state = row[2]
var done = 'Done'
//Check to see if line has already been processed or not
if (!state){
sheet.getRange(i + 1, 3).setValue(done)
//Slices out the blank state value
var slice = row.slice(0, numColumns-1)
table.appendTableRow(slice)
}
}
}
This just adds a new table to the document but I can't find way to add rows to an existing table of the data I can add indvidual cells one per row but that isn't useful and can't seem to/don't understand how the appendtoRow instruction works. Any thoughts on how best to do this?
|
3837c04875edcb44b07af0785e20d752aca60b6262e12e64f8acab1955200143 | ['fba64a4a10a74e69a81fdcbb41943a06'] | It would be a big security issue if browsers could request folder listings - that's why Tomcat turns that capability off by default now.
But, the browser could locate all matches to the wildcards referenced by the pages it caches. This approach would still be problematic (like, what about images not initially used but set dynamically by JavaScript, etc., and it would require that all cached items not only be downloaded but parsed as well).
| 85b350dc87e3e76758f71fb91e575401cc0ad055733d4a2557ad1c5a1c1c27b0 | ['fba64a4a10a74e69a81fdcbb41943a06'] | I have a design with two columns, which are both floating divs. Each of those, in turn, contains a set of divs with label and and input, also both floating.
As I narrow my browser window with the simple sample below, the outer blocks wrap first (in Chrome and FF), and then eventually the inner blocks wrap. While this is fine in many situations, there are also scenarios where I would prefer that the inner blocks wrap first, to preserve the concept of two major columns as long as possible.
Is there any way for me to control which set of divs wraps first?
<div style="float:left">
<div style="clear:left;padding:1em">
<div style="float:left;width:10em">Name 1</div>
<input style="float:left;width:12em" />
</div>
</div>
<div style="float:left;padding:1em">
<div style="clear:left">
<div style="float:left;width:10em">Name 2</div>
<input style="float:left;width:12em" />
</div>
</div>
|
556a418e078081259e4ae1aa4cb6905547be3fd925f4a49b332979529f51c8d6 | ['fbadcb00414f4547831ea5c8add9f6dd'] | I've got to grips with static routes and dynamic routes in Nuxt.
However, I'm trying to work out if it's possible to have effectively unlimited nested pages.
For example, in a standard CMS such as Wordpress I can define a deep nest of pages such as:
*hostname.com/page/other-page/another/yet-another/one-more/final-page*
I suppose I could define an unnecessarily deep page structure, such as:
- /_level1
- index.vue
/_level2
- index.vue
/ _level3
- index.vue
/level4
-index.vue
...and so on. But this doesn't feel particularly efficient or scalable, and introduces lots of duplicate code and maintenance problems.
Is there a better way to achieve this?
| 197ac5ec0fcfdfac321d84b50a78c20a8190d4d0eb4c56693eba3963fcad3b7c | ['fbadcb00414f4547831ea5c8add9f6dd'] | I'm currently building a Schema.org template for an ecommerce website, for the purposes of generating a Google Shopping Feed.
I'm struggling to understand the correct way to define a sale price - i.e. a product which has a temporary reduced price.
The options I've considered areL
a single "Offer" with multiple "PriceSpecification" items
multiple "Offer" items with a single "PriceSpecification"
or maybe something else completely?
Single "Offer" with multiple "PriceSpecification" items
"offers": {
"@type": "Offer",
"url": "https://kx.com/url",
"itemCondition": "http://schema.org/UsedCondition",
"availability": "http://schema.org/InStock",
"PriceSpecification": [
{
"@type": "PriceSpecification",
"price": 15.00,
"priceCurrency": "USD"
},
{
"@type": "PriceSpecification",
"price": 15.00,
"priceCurrency": "USD",
"validFrom": "2020-01-01",
"validThrough": "2020-02-01",
}
],
},
Multiple "Offer" items with a single "PriceSpecification"
"offers": [
{
"@type": "Offer",
"url": "https://kx.com/url",
"itemCondition": "http://schema.org/UsedCondition",
"availability": "http://schema.org/InStock",
"PriceSpecification": [
{
"@type": "PriceSpecification",
"price": 15.00,
"priceCurrency": "USD"
}
],
},
{
"@type": "Offer",
"url": "https://kx.com/url",
"itemCondition": "http://schema.org/UsedCondition",
"availability": "http://schema.org/InStock",
"PriceSpecification": [
{
"@type": "PriceSpecification",
"price": 15.00,
"priceCurrency": "USD",
"validFrom": "2020-01-01",
"validThrough": "2020-02-01",
}
],
}
]
},
Or is it something completely different? I'm struggling to find any conclusive documentation around this.
|
31cdb35b93865190c4cb669365ed1348295802e121f87627368a7c07329ed7a7 | ['fbb638aacc4440a6aac1f2a9ff10aa12'] | <Route path={`${match.url}/servers`}
component={isAuthenticated
? asyncComponent(() => import('./Servers'))
: <Redirect to="/home" />} />
this is probably not valid, your <Redirect to="/home" /> will be evaluated right away in render and its result will be provided to component, not actually the Redirect component.
One thing you could try is changing it to () => <Redirect to="/home" />
this way you are basically providing an "inline SFC" to component which is only evaluated when it is actually being rendered by Route when isAuthenticated is falsy.
| 4816afb21c3ef1183baa443a3423087c0aea6027af2556042d79419f0ab2fdae | ['fbb638aacc4440a6aac1f2a9ff10aa12'] | In your code, I see you are trying to pass params to el - which is not a function.
You can simply add a parameter in your ErrorMessages view's render method to take errors:
//in your Skymama.Views.ErrorMessages...
render: function (templateData) {
this.$el.html(this.template(templateData));
}
and in your error handler:
$("#error_messages").append(errorView.render({errors: failureErrors}));
There are various ways to improve this, e.g. you can make failureErrors a collection and pass it to the errorView, and use collection events to handle the rendering.
|
fdb9eca454a693a5b6720fe98c6baccd56a9562cd8aad390fcde699410d80e99 | ['fbb91bd2e7ab4b8bb75c14fbd2688c69'] | I have a custom application written in C++ that controls the resolution and other settings on a monitor connected to an embedded system. Sometimes the system is booted headless and run via VNC, but can have a monitor plugged in later (post boot). If that happens he monitor is fed no video until the monitor is enabled. I have found calling "displayswitch /clone" brings the monitor up, but I need to know when the monitor is connected. I have a timer that runs every 5 seconds and looks for the monitor, but I need some API call that can tell me if the monitor is connected.
Here is a bit of psudocode to describe what I'm after (what is executed when the timer expires every 5 seconds).
if(If monitor connected)
{
ShellExecute("displayswitch.exe /clone);
}else
{
//Do Nothing
}
I have tried GetSystemMetrics(SM_CMONITORS) to return the number of monitors, but it returns 1 if the monitor is connected or not. Any other ideas?
Thanks!
| b40f0aac863221efeea0a49f66c8abb2354f00dfdb83bfb94e98e10828b299a8 | ['fbb91bd2e7ab4b8bb75c14fbd2688c69'] | I am trying to deploy an application to a target machine and am getting a side-by-side configuration error. I traced it and found that the application is trying to reference AxisMediaControl.X.dll instead of AxisMediaControl.dll. I recently converted to a new version of Embarcadero (10 Seattle) and assume I've missed something in my config. Let me know how I can remove this extra X in the filename in the reference path.
Thanks!
|
5115a27b55dc172e883467757fbc1e8c3324a36c66fb6b65cb0394466072bd38 | ['fbb9ce80c87f4763a01359d9868a57c4'] | I have an app with 2 modules (default and module1). The dispatch.yaml looks below . ( The app is a python application deployed on google app engine).
application: myapp
dispatch:
# Default module serves the typical web resources and all static resources.
- url: "*/favicon.ico"
module: default
# Send all mobile traffic to the mobile frontend.
- url: "*/mobile/*"
module: module1
This seems to work successfully.
But after a live deployment is complete, where can we go and confirm the same in google engine console ( like cron.yaml lists the jobs ) about the current routing in place. This will be very useful to debug live issues, to understand current routing ( dispatch.yaml ) .
| af192ac536d438cd207f739e46a38282f29fff75e38f6d826625ce9409e3c0fc | ['fbb9ce80c87f4763a01359d9868a57c4'] | I am running a haproxy server , that serves a particular traffic and the customers continue to report the connections get dropped from their end. Not sure what could be causing this.
My sysctl.conf looks as below.
net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 1024 65023
net.ipv4.tcp_max_syn_backlog = 10240
net.ipv4.tcp_max_tw_buckets = 400000
net.ipv4.tcp_max_orphans = 60000
net.ipv4.tcp_synack_retries = 3
net.core.somaxconn = 10000
ulimit -n returns 65535 as well.
My /etc/haproxy/haproxy.cfg looks as below
global
maxconn 50000 # Max simultaneous connections from an upstream server
spread-checks 5 # Distribute health checks with some randomness
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
defaults # Apply to all services
log global
mode http
option httplog
maxconn 25000
balance roundrobin
option abortonclose # abort request if client closes output channel while waiting
option httpclose # add "Connection:close" header if it is missing
option forwardfor # insert x-forwarded-for header
option redispatch # any server can handle any session
retries 3
timeout client 60s
timeout connect 30s
timeout server 30s
timeout check 30s
timeout http-request 6s
stats enable
stats uri /stats # Real path redacted
stats realm Haproxy\ Statistics
stats auth root:*******! # Real credentials redacted
#monitor-uri /monitor # Returns 200 if we're up; real path redacted
errorfile 503 /etc/haproxy/errors/503.http
frontend incoming *:80
reqadd X-Forwarded-Proto:\ http
monitor-uri /haproxy_test
default_backend my_app
backend my_app
balance roundrobin
option httpchk /api/health
server my_server_A <IP_ADDRESS>:80 check inter 5000 fastinter 1000 fall 3 rise 1 weight 1 maxconn 5000
server my_server_B <IP_ADDRESS>:80 check inter 5000 fastinter 1000 fall 3 rise 1 weight 1 maxconn 5000
What could be the setting that can lead to connections dropping from the other side. Most of the reported dropouts were from the Dublin, Ireland and the servers are in West US, if that helps.
|
24bbede6a280062bab0067f0308daedc38fe3022acbf48fc0734dc147a7d255f | ['fbb9e4528c1a4456a93de725b3499ad6'] | All volumes and other directory settings ideally point to the same location. In your nginx.conf you have root /var/www/public; but in your yal you use /var/www. That might be you problem.
As for steps to proceed, you can check what directories your service actually uses by using the command the following command after you spin up your docker-compose.yml file :
docker-compose exec yourServiceName sh
replace yourServiceName with any service you have defined in your yaml. So app , web or database in your yaml above. And that command will take you into the shell (sh) of the container speicified. You can also replace sh with other commands to perform other actions with your container.
| 3f9f36f2afbc99363be5012bea8f4a3636cd645dcbc80bebf7d06fc0c899a0d4 | ['fbb9e4528c1a4456a93de725b3499ad6'] | From git 2.10 upwards it is also possible to use the gitconfig sshCommand setting. Docs state :
If this variable is set, git fetch and git push will use the specified command instead of ssh when they need to connect to a remote system. The command is in the same form as the GIT_SSH_COMMAND environment variable and is overridden when the environment variable is set.
An usage example would be: git config core.sshCommand "ssh -i ~/.ssh/[insert_your_keyname]
In some cases this doesn't work because ssh_config overriding the command, in this case try ssh -i ~/.ssh/[insert_your_keyname] -F /dev/null to not use the ssh_config.
|
8c5bf67963aac2e3212b36095e7857e6f718a0e7db814c478124fe15be51d8ff | ['fbc0efa097e44befb66227ba75f39fc2'] | My business app requires a feature to let the user draw a signature on a UIView with his finger and save it (via button click in the toolbar) so it can be attached to an unit. These units are going to be uploaded to a server once the work is finished and already support camera picture attachments that are uploaded via Base64, so I simply want to convert the signature taken to an UIImage.
First of all, I needed a solution to draw the signature, I quickly found some sample code from Apple that seemed to meet my requirements: GLPaint
I integrated this sample code into my project with slight modifications since I work with ARC and Storyboards and didn't want the sound effects and the color palette etc., but the drawing code is a straight copy.
The integration seemed to be successful since I was able to draw the signatures on the view. So, next step was to add a save/image conversion function for the drawn signatures.
I've done endless searches and rolled dozens of threads with similar problems asked and most of them pointed to the exact same solution:
(Assumptions)
drawingView: subclassed UIView where the drawing is done on.)
<QuartzCore/QuartzCore.h> and QuartzCore.framework are included
CoreGraphics.framework is included
OpenGLES.framework is included
- (void) saveAsImage:(UIView*) drawingView
{
UIGraphicsBeginImageContext(drawingView.bounds.size);
[drawingView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentContext();
UIGraphicsEndImageContext();
}
Finally my problem: This code doesn't work for me as it always returns a blank image. Since I've already integrated support for picture attachments taken with the iPhone camera, I initially assumpted that the image processing code should work on the signature images as well.
But.. after some resultless searching I dropped that assumption, took the original GLPaint project and just added the few lines above and some code that just shows the image and it was also completely blank. So it is either an issue with that code not working on self-drawn content on UIViews or anything I'm missing.
I am basically out of ideas on this issue and hope some people can help me with it.
Best regards
<PERSON>
| 337c80f5659d9c868d8e12062152295d954450ccccba36833b155e6f01b39e0c | ['fbc0efa097e44befb66227ba75f39fc2'] | Hello Android developers,
I've got a problem with the Android SearchView widget. What I'm trying to do is to attach a "live" text filter to my ListView (text input automatically refreshes filter results). It works actually fine and it was no huge effort to get it working on my ListActivity with these lines:
private SearchView listFilter;
this.listFilter = (SearchView) findViewById(R.id.listFilter);
this.listFilter.setOnQueryTextListener(this);
this.listFilter.setSubmitButtonEnabled(false);
this.getListView().setOnItemClickListener(this);
this.getListView().setTextFilterEnabled(true);
// from OnQueryTextListener
public boolean onQueryTextChange(String newText) {
if (newText.isEmpty()) {
this.getListView().clearTextFilter();
} else {
this.getListView().setFilterText(newText);
}
return true;
}
And here the xml widget declaration
<SearchView
android:id="@+id/listFilter"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:iconifiedByDefault="false"
android:queryHint="enter text to filter" />
Now what my problem is that every time I enter text into the SearchView, a strange text field pops up instantly showing the same text as I just entered which is kind of useless since I can see my input in the SearchView itself and it partly blocks the sight on my list entries, which is just annoying.
Is there any way to prevent that text field from popping up on typing into the SearchView? I couldn't find any property neither on the xml defined widget options nor on the java class reference.
I know there is another way to provide the filter functionality by using EditText and TextWatcher, but then I have to handle the filtering all by myself and couldn't profit from the SearchView handling it for me.
Any suggestions are appreciated.
Best regards
<PERSON>
|
d9daaa5fde85ae54aa584ad8e00ad4768a6c6949282ba3bff39333a58ba96042 | ['fbcb1dfb5a4b499582dba2b27a6ac573'] | OK I have changed my source code to get fix the issue on the WS_EX_LAYERED Window form by adding two forms on the main app one of them is alphablend true with 200 value as a background and the second is normal as the front window while the main App is totally transparent with the property transparent color and here is the link of my first beta solution https://1drv.ms/u/s!Alu0WnpJr3ruhTB68XOMcpd3mB5u
Finally I have a little issue with the background form that can't be a container for any controls or even the hit test doesn't work on it.... I hope to accept my idea even has not complete yet....
| c3ca06e602b5578ab70dc302baf35a26a7cbcc47c2d0dc8302b09d0acc0f31eb | ['fbcb1dfb5a4b499582dba2b27a6ac573'] | i have this code here :
type
TMyColors = (mcWhite, mcRed, mcBlue);
TMyFields = (mfField1, mfField2, mfField3);
....
implementation
uses
TypInfo;
{$R *.dfm}
function Get_ClassFieldName(ATypeKind: TUnknown_Class; ADataIndex: Byte):string;
begin
Result := GetEnumName(System.TypeInfo(ATypeKind), Ord(ATypeKind(ADataIndex)));
end;
procedure TForm1.Btn_1Click(Sender: TObject);
begin
ShowMessage(Get_ClassFieldName(TMyColors, 0) + ' | ' + Get_ClassFieldName(TMyFields, 0));
end;
what i want is to replace my TUnknown_Class Parameter with the right one if it possible.
|
a500e73d751d4f17ce17208d57e3001bc32c1ded4603d8c873d8f4c5709724de | ['fbcd7f47c5504870ae8c1a00f7f97ed5'] | I have a few files which I am planning to plot in Matlab. I have loaded the files and I wanted to plot it in real time. As in I want to see it as it is being plotted.
%clear
[filename, pathname] = uigetfile('*.raw;*.prc', 'Pick raw or processed data file');
N=str2double(filename(5:6));
Fs = 145.3*10^3;
T = 1/Fs; % Sampling period
if isequal(filename(end-2:end),'raw')
% load raw data file
fid = fopen([pathname filename],'r','l');
A=fread(fid,inf,'*uint16')'; %s=ftell(fid);
B=bitand(A, hex2dec('0FFF')); C=bitshift(A,-12);
channels=sort(C(1:N));
rawdata(int16(numel(A)/N)+2,N)=uint16(0); % Need to add +2 due to data loss
for ii=1:N
%rawdata(:,ii)=B(C==channels(ii)); can't use due to data loss
temp=B(C==channels(ii));
rawdata(1:numel(temp),ii)=temp;
end
plot<PHONE_NUMBER>*single(rawdata))
legend(int2str(channels'))
else
%load processed file
fid = fopen([pathname filename],'r','b');
A= fread(fid,inf,'*single')';
prcdata=reshape(A,N,[])';
%Find time
N = size(prcdata(:,1),1);
t=T*(0:N-1)';
for u = 1:N;
x=0:(T*(0:u-1)');
plot(x,prcdata(:,4));
drawnow;
end
end
| 1497a63d8f74296c9f187c68e6f9db210078e5d3a41d4feb4dcf19e0b863b506 | ['fbcd7f47c5504870ae8c1a00f7f97ed5'] | I have a matrix in the form of a text file, I was hoping to scan it using MATLAB, and scan for the maximum value in between 2 points (1.5 and 2) and use that as a threshold.
I wrote a code but it rerturned an error.
[filename, pathname] = uigetfile('*txt', 'Pick text file');
data = dlmread(fullfile(pathname, filename));
t=data(:,1);
N = size(t,1);
m= max(data(1.5,2));
figure;
threshold = m;
Error in file (line 214)
m= max(data(1.5,2));
|
a9591c42405a71d68d7209f21219ee57bde05fcf6c395f182ac487bf919847ee | ['fbd05834348440bdb8f987709782a4ec'] | I have a function that returns an std<IP_ADDRESS>vector of a class that contains a std<IP_ADDRESS>unique_ptr as member. I need to store this vector object on the heap so I can pass it through a C-style DLL interface.
See the following code sample:
#include <iostream>
#include <cstdlib>
#include <memory>
#include <vector>
// I have control over the following two classes
class SomeBigClassWithManyMembers { };
class MyClass
{
std<IP_ADDRESS>unique_ptr<SomeBigClassWithManyMembers> up;
public:
static const std<IP_ADDRESS>vector<MyClass> GetMany()
{
// imagine this does lots of work
return std<IP_ADDRESS>vector<MyClass>(50);
}
// following code is suggested in https://stackoverflow.com/questions/31430533/move-assignable-class-containing-vectorunique-ptrt but doesn't help
/*
MyClass() { }
MyClass(MyClass&& other): up{std<IP_ADDRESS>move(other.up)} { }
MyClass& operator=(MyClass&& other)
{
up = std<IP_ADDRESS>move(other.up);
return *this;
}
*/
};
// Imagine that I can't change this C-style code - it's a fixed interface provided by someone else
struct NastyCStyleStruct
{
void* v;
};
void NastyCStyleInterface(NastyCStyleStruct s) { printf("%u", (unsigned int)((std<IP_ADDRESS>vector<MyClass>*)s.v)->size()); }
int main()
{
NastyCStyleStruct s;
s.v = new std<IP_ADDRESS>vector<MyClass>(std<IP_ADDRESS>move(MyClass<IP_ADDRESS>GetMany()));
NastyCStyleInterface(s);
return 0;
}
Note that in my actual code, the vector needs to outlive the function in which it is created (because this is being done in a DLL), so writing
auto vec = MyClass<IP_ADDRESS>GetMany();
s.v = &vec;
would not suffice. The vector must be stored on the heap.
The trouble here is that the code seems to try to use the (non-existent) copy constructor of MyClass. I can't understand why the copy constructor is being invoked, because I am explicitly asking for move semantics with std<IP_ADDRESS>move. Not even initialising s.v to a fresh new std<IP_ADDRESS>vector of the appropriate size and calling the three-argument version of std<IP_ADDRESS>move works.
Errors from g++:
In file included from /usr/include/c++/7/memory:64:0,
from stackq.cpp:4:
/usr/include/c++/7/bits/stl_construct.h: In instantiation of ‘void std<IP_ADDRESS>_Construct(_T1*, _Args&& ...) [with _T1 = MyClass; _Args = {const MyClass&}]’:
/usr/include/c++/7/bits/stl_uninitialized.h:83:18: required from ‘static _ForwardIterator std<IP_ADDRESS>__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx<IP_ADDRESS>__normal_iterator<const MyClass*, std<IP_ADDRESS>vector<MyClass> >; _ForwardIterator = MyClass*; bool _TrivialValueTypes = false]’
/usr/include/c++/7/bits/stl_uninitialized.h:134:15: required from ‘_ForwardIterator std<IP_ADDRESS>uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx<IP_ADDRESS>__normal_iterator<const MyClass*, std<IP_ADDRESS>vector<MyClass> >; _ForwardIterator = MyClass*]’
/usr/include/c++/7/bits/stl_uninitialized.h:289:37: required from ‘_ForwardIterator std<IP_ADDRESS>__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std<IP_ADDRESS>allocator<_Tp>&) [with _InputIterator = __gnu_cxx<IP_ADDRESS>__normal_iterator<const MyClass*, std<IP_ADDRESS>vector<MyClass> >; _ForwardIterator = MyClass*; _Tp = MyClass]’
/usr/include/c++/7/bits/stl_vector.h:331:31: required from ‘std<IP_ADDRESS>vector<_Tp, _Alloc>::vector(const std<IP_ADDRESS>vector<_Tp, _Alloc>&) [with _Tp = MyClass; _Alloc = std<IP_ADDRESS>allocator<MyClass>]’
stackq.cpp:43:65: required from here
/usr/include/c++/7/bits/stl_construct.h:75:7: error: use of deleted function ‘MyClass<IP_ADDRESS>MyClass(const MyClass&)’
{ ::new(static_cast<void*>(__p)) _T1(std<IP_ADDRESS>forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stackq.cpp:10:7: note: ‘MyClass<IP_ADDRESS>MyClass(const MyClass&)’ is implicitly deleted because the default definition would be ill-formed:
class MyClass
^~~~~~~
stackq.cpp:10:7: error: use of deleted function ‘std<IP_ADDRESS>unique_ptr<_Tp, _Dp>::unique_ptr(const std<IP_ADDRESS>unique_ptr<_Tp, _Dp>&) [with _Tp = SomeBigClassWithManyMembers; _Dp = std<IP_ADDRESS><IP_ADDRESS>__uninit_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const MyClass*, std::vector<MyClass> >; _ForwardIterator = MyClass*; bool _TrivialValueTypes = false]’
/usr/include/c++/7/bits/stl_uninitialized.h:134:15: required from ‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator, _ForwardIterator) [with _InputIterator = __gnu_cxx::__normal_iterator<const MyClass*, std::vector<MyClass> >; _ForwardIterator = MyClass*]’
/usr/include/c++/7/bits/stl_uninitialized.h:289:37: required from ‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator, _ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = __gnu_cxx::__normal_iterator<const MyClass*, std::vector<MyClass> >; _ForwardIterator = MyClass*; _Tp = MyClass]’
/usr/include/c++/7/bits/stl_vector.h:331:31: required from ‘std::vector<_Tp, _Alloc><IP_ADDRESS>vector(const std::vector<_Tp, _Alloc>&) [with _Tp = MyClass; _Alloc = std::allocator<MyClass>]’
stackq.cpp:43:65: required from here
/usr/include/c++/7/bits/stl_construct.h:75:7: error: use of deleted function ‘MyClass::MyClass(const MyClass&)’
{ <IP_ADDRESS>new(static_cast<void*>(__p)) _T1(std::forward<_Args>(__args)...); }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
stackq.cpp:10:7: note: ‘MyClass::MyClass(const MyClass&)’ is implicitly deleted because the default definition would be ill-formed:
class MyClass
^~~~~~~
stackq.cpp:10:7: error: use of deleted function ‘std::unique_ptr<_Tp, _Dp><IP_ADDRESS>unique_ptr(const std::unique_ptr<_Tp, _Dp>&) [with _Tp = SomeBigClassWithManyMembers; _Dp = std::default_delete<SomeBigClassWithManyMembers>]’
In file included from /usr/include/c++/7/memory:80:0,
from stackq.cpp:4:
/usr/include/c++/7/bits/unique_ptr.h:388:7: note: declared here
unique_ptr(const unique_ptr&) = delete;
^~~~~~~~~~
How can I repair this code so that the vector object itself is stored on the heap?
| 320364322c54c55606cea1a10553052fb967bbc6f2be3190b68d2cc8dc3acebc | ['fbd05834348440bdb8f987709782a4ec'] | The DXF specification says that group code 1071 is "A long value which contains a truetype font’s pitch and family, charset, and italic and bold flags". As NGLN has pointed out, the bit masks 0x1000000 and 0x2000000 identify italic and bold text respectively.
Pitch, family and charset are properties of the Windows GDI LOGFONT struct; the actual values are given in the WMF specification (pitch, family, charset). From what I can tell, the rightmost four bits represent pitch, the next four bits represent family, and the next eight bits represent charset.
Here's a typical 1071 value:
0000 0000 0000 0000 0000 0000 0010 0010
BI _charset_ fmly ptch
This font is non-bold, non-italic, ANSI charset (pretty meaningless these days), Swiss family (i.e. sans-serif), and variable pitch (i.e. not monospaced).
As for writing DXF files, AutoCAD seems happy to accept 1071 values with pitch, charset and family all zero.
AutoCAD text styles do not contain information on underline and strikethrough.
|
33568893d9fbab64360ef1eccdaeee8dd0e4c4d20853d16123b4b2b7ba8924f0 | ['fbd640d9232e490abf578fefded97640'] | I have a content type called resources and one of the fields is a file field where users can upload content such as a pdf, video, docx, swf etc...
What I am trying to do is allow user to upload a zip file and unpack it on the server then let the user select the main file to be displayed.
So for example if someone had a swf file which has videos they can upload the zip then the server will unzip the files and the user can select the swf file as the main file to display.
I have managed to build a module to unzip the file on hook_node_submit, but not sure how to progress this to get the required functionality as explained above.
Does anyone have any suggestions?
| 3483ef3a657dcfcf181d369219dcf159fb197793f816ef9e81494e25c07b8761 | ['fbd640d9232e490abf578fefded97640'] | I wonder if there is any studied and documented correlation between people who are more prone to having this response (such as those who gag at the site of blood) and some sort of specific eating-related events during childhood. I'm going to pursue that and see if I can find anything. I am also becoming more convinced that this may be a CogSci topic. |
6ec7eae8bdf439f42f16c7df2fce40d462e50da745d587b45765b733525c4dad | ['fbec274a54a044539229d817e001449a'] | Im working on a project using subsonic 2.1. For a simple search query i've the following code:
DAL.ItemCollection coll = new DAL.ItemCollection();
SubSonic.Select s = new SubSonic.Select();
s.From(DAL.Item.Schema);
s.Where("Title").Like("%" + q + "%").Or("Tags").Like("%" + q + "%").And("IsActive").IsEqualTo(true);
if (fid > 0)
{
s.And("CategoryID").IsEqualTo(fid);
Session["TotalSearchResults"] = null;
}
s.Top(maxitems);
//We'll get the recordcount before paged results
total = s.GetRecordCount();
s.Paged(pageindex, pagesize);
s.OrderDesc("Hits");
s.OrderDesc("Points");
s.OrderDesc("NumberOfVotes");
coll = s.ExecuteAsCollection<DAL.ItemCollection>();
Now the thing is, when my fid (FilterId) is larger then 0, the CategoryID filter does not work. It hits the breakpoint no problem but it's not getting filtered. Does it have something do do with the LIKE query? It works perfectly if i remove the if part and current s.where and change the query do this:
s.Where("CategoryID").IsEqualTo(fid);
Do I miss something important here?
Kind regards,
<PERSON>
| 0b924fced8bc93c1ae5018f5c57478ecc33994695b7ccb6f32e9e7b6ae90f5c1 | ['fbec274a54a044539229d817e001449a'] | I can't get Google's Dynamic DNS API to work for a wildcard domain.
I can get defined subdomains to update their IP just fine but I always get nohost when i attempt to update the wildcard's IP.
This page https://support.google.com/domains/answer/6147083?hl=en doesn't mention wildcard domains.
|
b39a1f305748ca90fd5e8440ef736f22fdf91bf68eebc4fc1e9e6989ca2475a2 | ['fbfc61105a1c4e2ab908fa70deeecb6b'] | whenever i am trying to execute the second table which is DATABASE_TABLE1 it is showing no such table error
it is not showing error when i am inserting in the first table but it showing in the second table
package com.example.billpay;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
public class Process {
public static final String KEY_FNAME="person_fname";
public static final String KEY_LNAME="person_lname";
public static final String KEY_EMAIL="person_email";
public static final String KEY_PHNO="person_pno";
public static final String KEY_UNAME="person_uname";
public static final String KEY_PASS="person_pass";
public static final String KEY_EID="person_electricityid";
public static final String KEY_EBID="person_eid";
public static final String KEY_EMONTH="bill_month";
public static final String KEY_EBREAD="bill_reading";
public static final String KEY_EBAMOUNT="bill_amount";
private static final String DATABASE_NAME="bill";
private static final String DATABASE_TABLE="electric";
private static final String DATABASE_TABLE1="electricbill";
private static final int DATABASE_VERSION=1;
private DbHelper ourHelper;
private final Context ourContext;
private SQLiteDatabase ourDatabase;
private static class DbHelper extends SQLiteOpenHelper{
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
// TODO Auto-generated constructor stub
}
@Override
public void onCreate(SQLiteDatabase db) {
// TODO Auto-generated method stub
db.execSQL("CREATE TABLE " + DATABASE_TABLE + " (" +
KEY_UNAME + " TEXT PRIMARY KEY, " +
KEY_FNAME + " TEXT NOT NULL, " +
KEY_LNAME + " TEXT NOT NULL, " +
KEY_EMAIL + " TEXT NOT NULL, " +
KEY_PHNO + " INTEGER NOT NULL, " +
KEY_PASS + " TEXT NOT NULL, " +
KEY_EID + " TEXT NOT NULL, " +
" FOREIGN KEY ("+KEY_EID+") REFERENCES "+DATABASE_TABLE1+" ("+KEY_EBID+"));"
);
//creation of second table
db.execSQL("CREATE TABLE " + DATABASE_TABLE1 + " (" +
KEY_EBID + " TEXT PRIMARY KEY, " +
KEY_EMONTH + " TEXT NOT NULL, " +
KEY_EBREAD + " TEXT NOT NULL, " +
KEY_EBAMOUNT + " TEXT NOT NULL); "
);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
// TODO Auto-generated method stub
db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE);
db.execSQL("DROP TABLE IF EXISTS " + DATABASE_TABLE1);
onCreate(db);
}
}
public Process(Context c){
ourContext=c;
}
public Process open() throws SQLException{
ourHelper = new DbHelper(ourContext);
ourDatabase = ourHelper.getWritableDatabase();
return this;
}
public void close(){
ourHelper.close();
}
public long createEntry(String pfname, String plname, String pemail,
String puname, String ppass, String pphno, String peid ) {
// TODO Auto-generated method stub
ContentValues cv = new ContentValues();
cv.put(KEY_FNAME, pfname);
cv.put(KEY_LNAME, plname);
cv.put(KEY_EMAIL, pemail);
cv.put(KEY_UNAME, puname);
cv.put(KEY_PASS, ppass);
cv.put(KEY_PHNO, pphno);
cv.put(KEY_EID, peid);
return ourDatabase.insert(DATABASE_TABLE, null, cv);
}
public String getData() {
// TODO Auto-generated method stub
String[] columns = new String[]{ KEY_FNAME, KEY_LNAME, KEY_EMAIL, KEY_UNAME, KEY_PASS, KEY_PHNO, KEY_EID };
Cursor c=ourDatabase.query(DATABASE_TABLE, columns, null , null , null , null , null);
String result = "";
int gfname=c.getColumnIndex(KEY_FNAME);
int glname=c.getColumnIndex(KEY_LNAME);
int gemail=c.getColumnIndex(KEY_EMAIL);
int guname=c.getColumnIndex(KEY_UNAME);
int gpass=c.getColumnIndex(KEY_PASS);
int gphno=c.getColumnIndex(KEY_PHNO);
int geid=c.getColumnIndex(KEY_EID);
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()){
result= result + c.getString(gfname) + " " + c.getString(glname) + " " + c.getString(gemail) + " "
+ c.getString(guname) + " " + c.getString(gpass) + " " + c.getString(gphno) + c.getString(geid) + "\n";
}
return result;
}
public String getpass(String k) {
// TODO Auto-generated method stub
String[] columns = new String[]{ KEY_FNAME, KEY_LNAME, KEY_EMAIL, KEY_UNAME, KEY_PASS, KEY_PHNO};
Cursor c=ourDatabase.query(DATABASE_TABLE, columns, KEY_UNAME + "='" + k + "'", null, null, null, null);
if (c != null){
c.moveToFirst();
String rpassword = c.getString(4);
return rpassword;
}
return null;
}
//second DATABASE function
public long createeentry(String peid, String pemonth, String peamount,
String pereading) {
// TODO Auto-generated method stub
ContentValues ph = new ContentValues();
ph.put( KEY_EBID, peid);
ph.put( KEY_EMONTH, pemonth);
ph.put( KEY_EBREAD, pereading);
ph.put( KEY_EBAMOUNT, peamount);
return ourDatabase.insert(DATABASE_TABLE1, null, ph);
}
public String getedata() {
// TODO Auto-generated method stub
String col[]= new String[] { KEY_EBID, KEY_EMONTH, KEY_EBREAD, KEY_EBAMOUNT };
Cursor l= ourDatabase.query(DATABASE_TABLE1, col, null, null, null, null, null);
String eresult="";
int peid=l.getColumnIndex(KEY_EBID);
int pemonth=l.getColumnIndex(KEY_EMONTH);
int peread=l.getColumnIndex(KEY_EBREAD);
int pamount=l.getColumnIndex(KEY_EBAMOUNT);
for (l.moveToFirst(); !l.isAfterLast(); l.moveToNext()){
eresult= eresult + l.getString(peid) + " " + l.getString(pemonth) + " " + l.getString(peread) + " "
+ l.getString(pamount) + "\n";
}
return eresult;
}}
i am also using a foreign key atrribute.Hope that i am using it coreect
here is the error which is coming up
04-24 14:31:37.864: E/SQLiteLog(16297): (1) no such table: electricbill
04-24 14:32:09.080: D/AndroidRuntime<PHONE_NUMBER>): Shutting down VM
04-24 14:32:09.081: W/dalvikvm<PHONE_NUMBER>): threadid=1: thread exiting with uncaught exception (group=0x40e06908)
| 1db31f568103c6bcff554ef32a50ce50d978e848b39b9a00d315e32b99a73d90 | ['fbfc61105a1c4e2ab908fa70deeecb6b'] | how to return an array from a class.i am trying to do but it is showing an error
public String gettobill(String <PERSON>) {
// TODO Auto-generated method stub
String col[]= new String[] { KEY_EBID, KEY_EMONTH, KEY_EBREAD, KEY_EBAMOUNT };
Cursor l=ourDatabase.query(DATABASE_TABLE1, col, KEY_EBID + "='" + bill + "'", null, null, null, null);
String[] eresult;
int peid=l.getColumnIndex(KEY_EBID);
int pemonth=l.getColumnIndex(KEY_EMONTH);
int peread=l.getColumnIndex(KEY_EBREAD);
int pamount=l.getColumnIndex(KEY_EBAMOUNT);
for (l.moveToFirst(); !l.isAfterLast(); l.moveToNext()){
eresult[0]= l.getString(peid);
eresult[1]=l.getString(pemonth);
eresult[2]=l.getString(peread);
eresult[4]=l.getString(pamount);
}
return eresult;
}
|
30821285ae83a2b894fdab915f7b1f1be74831defd70b86b919c3247f6c31318 | ['fbff2e0c98f94a6386bab14599d28743'] | I have a web application where the users can add objects to the scene, move it around, change the rotation etc. But, I have a drop down which decides the unit system to be followed on the whole page for various parameters. The drop down, on change should go through a page refresh. This causes the whole scene to be reset. Is there any way to save the scene and then reload it to the previous state in three js?
| 6de0757f9c4df93b69a957c9d46340e6912781576afaa2791359ac58c6e309d6 | ['fbff2e0c98f94a6386bab14599d28743'] | To get the X-axis labels to be whole numbers try this:
for(int m=0;m<maximum_possible_value;m++){
mRenderer.addXTextLabel(m, Integer.toString(m));
}
mRenderer.setXLabels(0);
mRenderer.setShowCustomTextGrid(true);
This will set all the X axis labels to be whole number values. maximum_possible_value is the maximum possible value in the x axis.
|
0637b5540732ba407bae7edf9fbcbee97c5ea587f23f5add8dd94328d0e7083d | ['fc0850896275414490137b20f7d49f8d'] | The execution environment in Node.JS also lacks a native DOM implementation. I think it's fair to say that Node.JS and HTML5 Web Workers share certain restrictions.
There are ways to simulate a DOM implementation for the purpose of using jQuery in Node.JS. If you still want to use jQuery in Web Workers, I think you should search for the Node.JS solutions and see if they apply.
| abda694c8add22ca90c39b281d2c3c687d27e34d59ba8dd1b63912aa8bc670aa | ['fc0850896275414490137b20f7d49f8d'] | I just did a comparison of browser developer features for a talk I'll be giving this week:
https://docs.google.com/presentation/d/1WcKbHP2khcqpAZf-JnjoNHFRMhR3efUGlahpC5DKFkA/edit
Internet Explorer 10
still has very few compelling and differentiating developer features
offers dodgy simulators for older versions of IE
Opera
really powerful and complete developer tools (Dragonfly)
moving to Chromium-based code, so may as well use Google Chrome
Safari
only differentiating feature is integration with iOS 6: remote debugging, etc
Firefox
cool, sexy, fun unique 3D View
nice Responsive Web Design mode
like Opera, the log is noisy when it encounters weird CSS and deprecated features
still lacks features that the others have, although adding FireBug helps
Google Chrome, my personal favourite and arguably the best
can do everything Safari can do (except the iOS stuff)
superior performance profiling tools
can live-preview in-browser changes to JavaScript code, not just CSS and HTML like the others
helpful audits with best-practice suggestions
feels like it was actually designed to help me develop better
|
6161ab75c9de51d87e31b856560b62afacefe4c8e32d38393ee13732fabcf985 | ['fc0a996f5d3a46c3b258d5fafb6c98df'] | Hi guys I need to use linq for querying a datatable in C#.
My scenario is that i need to filter the data in a datatable using Linq.
If single condition means my query is working using the following query,
EnumerableRowCollection query = from contact in
dtContacts.AsEnumerable()
where contact["FirstName"].ToString().StartsWith(SearchText) select contact;
It displays the required data and working good. In case of multiple conditions means i need to add the && operator dynamically and add the condition inside the query because the filtering may change dynamically.
after getting the conditions in a string i get like this,
contact[FirstName].ToString().ToLower().Contains(Mani.ToLower()) &&
contact[LastName].ToString().ToLower().Startswith(S.ToLower()) &&
contact[EmailAddress].ToString().ToLower().Contains(mani.ToLower())
and store it in a variable queryString
now i need to execute the linq query from a string
EnumerableRowCollection query = from contact in
dtContacts.AsEnumerable() where queryString select contact;
Kindly give me a solution to execute the where clause from string inside the linq query
| 6c18e93b01adc208fca3433ff1cc888d774b8b87e8d546a9a13a2b18905fd88b | ['fc0a996f5d3a46c3b258d5fafb6c98df'] | You shall not insert the List using SqlBulkCopy.
Refer this link for SqlBulkCopy
You need to construct the data either to a datatable or datarow or a reader to write it to the database using SqlBulkCopy.
Also you should not add values to an identity column, from your comments I assume [ID] is your identity column. The below example has a datatable (dtStudent) with 2 columns Student and Grade, it will writes all the records into the database
using (SqlBulkCopy bulkCopy = new SqlBulkCopy(strConnection))
{
bulkCopy.ColumnMappings.Add("Student", "Student");
bulkCopy.ColumnMappings.Add("Grade", "Grade");
bulkCopy.DestinationTableName = "Student";
bulkCopy.WriteToServer(dtStudent);
}
You can also insert using DataRow[], refer the above mentioned link
|
195e67b6473c942634c8a85cfe89e60fb81670025bde5783ef6900807333432f | ['fc17d7ce992849fcb77182aff21ff0a0'] | It doesn’t seem like a very good dialogue. I would guess they want “says”, “comes”, and “speaks”, but I agree with you that this is a bad example dialogue. I suppose - as pointed out by someone else - that it’s supposed to prompt you to imagine the context. Perhaps <PERSON> is being humorous in saying that she supposes he is speaking Japanese because that’s an easier answer than wondering what, specifically, he is saying.
| 10ac519af00dfae7bbc3a3325903676cd16a41f953c8c870aa7d8aaca6a7a9d2 | ['fc17d7ce992849fcb77182aff21ff0a0'] | I would use “what got into her?” to ask about her response to a single situation, whereas “what has gotten into her?” would more likely be asked about the way she is acting over a period of time.
<PERSON> got mad about something <PERSON> said during the meeting. She stood abruptly and stormed out of the room.
<PERSON> looked surprised. “What got into her?”
Or if this has recently become a pattern of behavior for <PERSON>:
<PERSON> looked surprised. “What has gotten into her? This is the third meeting this week where she’s caused a scene, and she won’t tell anyone what’s wrong. It’s so unlike her.”
|
ff885192169d728a8d6a2951d82af6967d0eff7fe17d598ecb4a53fb23b7e8ab | ['fc22066d3cd7409bbea787695b6034d0'] | yes, i want a raster where all categories are combined, so that there is only one raster left with which i can do other calculation stuff. I already have part 1, 2 and 4 and the middle part 3 is also calculated now (so all NDVI parts have their Emissivity Value). I tried combine raster, which looked to work fine, but there are too many unique values, which creates a range from 0-255, and not a range from 0,970-0,999 (like it should be for emissivity). | 1b8b7ef1f76d4114644fc5da5924032a50e25e4a176691e1109a582d1d9346c4 | ['fc22066d3cd7409bbea787695b6034d0'] | You're most likely connecting both devices from the same public IP (behind NAT). If this is the case, you'll need to try your phone's cellular connection or use PPTP. You may have to configure the VPN gateway to use PPTP and forward the correct ports through your firewall/router.
|
ced6c3b15367b6451b628944a4e2f78a80e5d6ecf40668d4ca92fff9332a53c6 | ['fc28c45a89904c2f93de4e3549e6af45'] | Your NodeJs-Express cannot send request to payu money until payUmoney itself has authorized you,
That is why you got CORS error,
CORS means- Cross Origin Resource Sharing
That means when you are trying to reach www.example1.com from www.example2.com.
So the solution to this problem is that you have to set CORS filter in the PayUmoney server in which you are redirecting to.
You can't just send it to any server or App which is deployed because they always disable CORS filter for security measures.
If you want to check your redirecting feature,
This is what you can do,
make another NodeJs server running which is listening to API calls.
and add these lines in app.js(server-side):
app.all('/*', function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
res.header("Access-Control-Allow-Methods", "GET, POST, PUT");
next();
});
Note: where app is a reference to express (var app = require('express');).
Now redirect to this Newly created NodeJs app,
Your redirect feature will definitely work.
Hope this helps,
Regards
<PERSON>
| 3c78aa7345a9c5087836256fea803664370146a2086c1192a2d44b61d7bab63c | ['fc28c45a89904c2f93de4e3549e6af45'] | since i was struggling in making API calls to apache server from my angular app running in node-express,
So i was unable to call apache server with POST calls inspite of setting the CORS filter in most of the ways available,
So someone suggested rather of making calls from AngularJs(Frontend) , make it from NodeJs(Backend-server) which serves your angulas(frontEnd) code.
So kindly assisst me in this as to what exactly is the difference between making API call's from frontEnd to any server or from the backend(server) of the same frontEnd ??
What factors makes it more preferable over the other one ?
Is it proxy or CORS thing which effects FrontEnd based API calls ?
Thanking all in advance
<PERSON>
|
9a9ca07540dfc7e10672eb3daaad5eba5662de118263ad2b734afeabf2556e6f | ['fc4e223a17d6496fb3fc7d9f2fba3b7d'] | The solution was to extend AbstractTableModel instead of DefaultTableModel. I also had to include appropriately overloaded versions of two methods of AbstractTableModel:
@Override
public boolean isCellEditable(int row, int col) {
return true;
}
@Override
public void setValueAt(Object value, int row, int col) {
Data.get(row)[col] = (String) value;
fireTableCellUpdated(row, col);
}
| a985c5e86b7b142a9d0b08ccdb37e9a68bc319c6cb52481a6914e19318622586 | ['fc4e223a17d6496fb3fc7d9f2fba3b7d'] | For those looking to use omega as a quick-fix, here's one way to get the goal into a form where it can be applied:
inversion H.
inversion H1.
rewrite negb_true_iff in H3.
apply beq_nat_false in H3.
omega.
For why omega works after we do this and not when the goal was in the original state, here is a great answer by Github user <PERSON>:
"You don't need to think about plus_comm or similar lemmas here, because omega can solve those easy problems. Your goals are almost trivial, but the reason why omega hesistates to clear the goals is just because the minus between nat is not the same as the one we already know; 2-5=0, since there is no notion of negative in nat. So if you don't provide the fact that st X is greater than zero, omega cannot clear the goal for you. But you already have that condition in H1. Therefore, the only thing you should do is to simplify H1 and apply lemmas to H1 to make it st X<>0 .Then omega can properly work."
|
91ef4873e24114c472597f3f10a15d5dfe55990b8d32126cf65b7a2446b69609 | ['fc6043be03654bb1b73fed70dffb061f'] | The two structures used in my code, one is nested
struct Class
{
std<IP_ADDRESS>string name;
int units;
char grade;
};
struct Student
{
std<IP_ADDRESS>string name;
int id;
int num;
double gpa;
Class classes[20];
};
I am trying to figure out a way to sort the structures within the all_students[100] array in order of their ID's in ascending order. My thought was, to start counting at position 1 and then compare that to the previous element. If it was smaller than the previous element then I would have a temporary array of type Student to equate it to, then it would be a simple matter of switching them places within the all_students array. However, when I print the results, one of the elements ends up being garbage numbers, and not in order. This is for an intermediate C++ class in University and we are not allowed to use pointers or vectors since he has not taught us this yet. Anything not clear feel free to ask me.
The function to sort the structures based on ID
void sort_id(Student all_students[100], const int SIZE)
{
Student temporary[1];
int counter = 1;
while (counter < SIZE + 1)
{
if (all_students[counter].id < all_students[counter - 1].id)
{
temporary[0] = all_students[counter];
all_students[counter] = all_students[counter - 1];
all_students[counter - 1] = temporary[0];
counter = 1;
}
counter++;
}
display(all_students, SIZE);
}
| 65a514125eb8ed045e6df82d287154b54227662f4175cb4f5ed4d325e5813a5c | ['fc6043be03654bb1b73fed70dffb061f'] | I have three divs with a class name of .column , on the bottom, before my body tag I have a small script which is supposed to get these divs and put them into an array so that I can work on them. I've done this before so I don't know what may be causing this problem this time.
var columns = Array.prototype.splice.call(document.querySelectorAll('.column'));
document.write("Size: " + columns.length);
The above code particularly Array.prototype.splice.call(document.querySelectorAll('.column')); is supposed to turn the node list returned by querySelectorAll into a workable array. However, whenever I write the length of var columns it always returns 0, this can't be possible since I have three divs with that class.
Now, when I do:
var columnsNodes = document.querySelectorAll('.column');
document.write(columnsNodes.length);
And I write it to the document it returns 3, which is correct. This is leading me to believe that something about converting the node list to an array is not working, which is odd because I've done it before on multiple occasions. Does anyone have any idea what could be causing this?
Stuff I've done:
checked spelling multiple times
inserted parent div before call eg: ('.parentDiv .column');
deleted the id's associated with .column
Nothing has worked, please give me your input.
|
3d18e0cac7837f24287e910b0107cbd5a3e7c05984a8c6f0cf6257daab6ec206 | ['fc610afb531541b7890d00392ec133af'] | I need a stable way to attempt to run an unsigned executable on an iOS device in order to test if the device has been jailbroken (i.e. allows the running of unsigned code).
I have written a small executable which essentially does nothing.
int main(int argc, char *argv[]) {
return 23;
}
Which I have compiled and run successfully on an iOS device (both Jailbroken and not).
I have then added this executable to an App bundle and deployed the app to an iOS device.
This results in a read only version of the executable on the device. I attempted to chmod this file to give it execute permissions, but this failed, so I copied it into the tmp directory for the app, where I was able to chmod with executable permissions.
Other questions have suggested using execve to call the executable, but this will replace the running process with the new one, which will kill the app. Fork() always fails, so that is not an option. System() requires a shell, and it would be possible to have a jailbreak without a shell which still allows unsigned code to run, so that's out. Popen() forks, so that won't work.
Interestingly, from what I have discovered, calling execv on my executable in a normal device causes an "Operation not permitted" error, whereas calling it on a jailbroken device causes a "Permission denied" error. This alone would work for jailbreak detection, except for the case that if a jailbreak ever occurs in which the execv is allowed to proceed, the App will then crash immediately as it's process will be replaced.
According to this, iBooks performs jailbreak detection doing this, but it appears to use the fairplayd binary to perform it's execve calls.
Does anyone have any suggestions for either running an executable or using fairplayd?
| 014c3af663a9d7a91fb7a29c78cd6d375167d429d6550e34da3e673222705b0f | ['fc610afb531541b7890d00392ec133af'] | I have attempted to package an executable in an IOS app by adding the executable file from a project whose main() function simply returns an integer to my project.
This file is copied onto the phone when deploying, but is copied without execute permissions.
Attempting to chmod the file to give it execute results in an "Operation not permitted" error, despite the file owner being the same as the current user (mobile).
|
bd5c2660355c6eb9e6eebceb09f5629646673694a2fef5cc2267c0e245f4c6c7 | ['fc6dde1ba2834a0d9d31a09c1294d60c'] | What would the rest mass of a rocket need to be if it carries a payload of 1kg and is accelerated to 1/2 c and then decelerated to a stop.
Assume:
1 - energy required is obtained via fusion of hydrogen fuel carried on board
Second question:
Alternatively, what would the rest mass need to be if energy required is obtained via matter/anti-matter annihilation?
| 0f424c96b95e99ecfa7e9888afb3613800246f373180e675479fbf1b4c5ae616 | ['fc6dde1ba2834a0d9d31a09c1294d60c'] | Thanks, you're right. On second inspection, Google Photos actually does share GPS, but it looks like the photos actually didn't include GPS data when taken. All the photos in the shared album were taken by iPhones, so perhaps iPhone's default is to not include location data in the photo? |
b28a431b02504b6ee12a6683c10650e7faec83ef1733b51efc6be1224e0fb668 | ['fc70c8197d5340f3863f6262df9c4487'] | I am to send over 1 million request to an api programatically. Looks like every 200 requests I get throttled and need to wait 5 min before sending another 200. How can I do this through c# code? I've looked at timers, but I'm confused how the logic works. Can someone please help me with this?
Thank you so much!
| 4a5bac85b7cd93421394f89b89d19162b98f0f8b81b38a980e73a375638f3011 | ['fc70c8197d5340f3863f6262df9c4487'] | I have an xml file, Body.xml:
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<MyNumbers xmlns="http://google.com/">
<number1>1</number1>
<number2>1</number2>
<number3>1234</number3>
<number4>1</number5>
</MyNumbers>
</soap12:Body>
</soap12:Envelope>
I want to programatically change the number in number3 tag... from a list of numbers.
How can I do this?
Thank you!
|
dc90b8b8aa91e09f58fe949afdd57e1a4507d6d5ad86971edc45b70986cf10ad | ['fc72432b32174787a116576c5333852b'] | Somehow I ended up at this question, even though it is dated I wanted to mention it should be possible to use Brotli compression now using Firebase Cloud Functions. I havent tested it yet, but since you can run your own node.js code via Cloud Functions I don't see any reason why this would not work. Afcourse using Cloud Functions could slow down your app, so be sure to test carefully going this approach. It might not give the loading boost you are hoping for.
| 2d2e7a75aeb85257bc0dfbf3c94c4170428230eb7809a0cff056ef0cf4b423f2 | ['fc72432b32174787a116576c5333852b'] | I think your code could work if it didnt have so many syntax errors. It's document.getElementById, not document.getElementbyId. Beside that you should also end a variable declaration with ;
It all depends on the final rendered page though. We dont know what the final php output is.
I strongly advice you to use a external JavaScript file. Inline JS is bad.
|
5d3ca795b666abfee466224c715db46bd0c63957ae2f5617ad750359b9781dfb | ['fc9561a836b144499864dc98dc55b579'] | Another alternative is to write a script (ant or whatever) to build and deploy your app to the ubuntu server. Then start the app with remote debugging enabled:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=8998,server=y -jar theApp.jar
Then use Eclipse to remote debug the app.
http://www.eclipsezone.com/eclipse/forums/t53459.html
| 51695e2ecabb537d3b2a10d2f7d1a170a6431db55d2690102189a7d4d6d0d6a8 | ['fc9561a836b144499864dc98dc55b579'] | A couple of things you may want to take a look at. First is Java integration with Windows System tray.
http://docs.oracle.com/javase/tutorial/uiswing/misc/systemtray.html
http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/
The other is to run a "listener" in the background perhaps as a Windows service.
This service listens for messages and pops them into a window. The window can be dismissed (hidden) without stopping the service. http://edn.embarcadero.com/article/32068
|
65f5c45561360f07a6f5c8df0077bfd28c1dfc771bc3ca850f121899363560b4 | ['fc9fc42d2d2943c69d03703e5e48228a'] | I'm trying to limit the incoming and outgoing bandwidth with latency through a specific port using TC but I can't get it to work 100%. I'm not sure if I've done it correctly.
When I ping google, the latency is added. I have used iperf to test the bandwidth through port 5001. The bandwidth throttle seems to work on the client where I have applied the settings below (client as iperf -s, incoming), however if I use this client (outgoing) to connect to another one, the bandwidth is restricted to 1-2 mbit instead of the expected 5mbit.
What I would like to, for example, is to have the latency set to 100ms, bandwidth outgoing/incoming throttled to 5mbit, all these rules applied to port 5001. Am I on the correct path or have I misunderstood the concept of tc?
Ip link add name ifb0 type ifb 2>/dev/null || :
Ip link set dev ifb0 up
Tc qdisc add dev ifb0 root handle 1: htb
Tc class dev ifb0 parent 1: classid 1:20 htb rate 5mbit
Tc qdisc add dev ifb0 parent 1:20 handle 20: sfq perturb 10
Tc filter add dev ifb0 parent 1: protocol ip prio 1 basic match ‘cmp(u16 at 2 layer transport eq 5001)’ flowid 1:20
Tc qdisc add dev ens192 root netem delay 200ms
Tc qdisc add dev ens192 ingress
Tc filter add add dev ens192 ingress protocol ip basic match ‘cmp(u16 at 2 layer transport eq 5001)’ action mirred egress redirect dev ifb0
| 5ec53c75abc527c70db21979cfb4d3f997da7274017f5a52de59845cd1c894fe | ['fc9fc42d2d2943c69d03703e5e48228a'] | I have a text document where every line has an opening tag. I need to add a matching closing tag at the end of each line.
For example:
What I have:<exe>Example text between tags.
What I need:<exe>Example text between tags.</exe>
I am new to "Find & Replace" in Notepad++ but I've had some success formatting this document to my needs. Can someone provides some guidance/tips?
|
b6983dcddcfb47fd7f324558545d136686141d36050540d0444c097d76eeb842 | ['fca5aa31d1734f768383e8f4adc137ba'] | I'm new to java Booleans and was wondering how I could return true/false within a do/while loop (without it beeing in the main method). Something like this.
public class Class1 {
static boolean success = false;
public static void main(String[] args) {
while(Method1());
}
private static boolean Method1() {
do {
//Do something
}
while (success);
}
However, it Java doesn't seem to pick up on success beeing a boolean variable? Could anyone please explain to me..?
Thanks in advance.
| 98221dfc72b2f0d206b0d8e930efa457276ed3e60ea3f7a7931a29574c86aaee | ['fca5aa31d1734f768383e8f4adc137ba'] | So my problem is simple. I have Users and Workspaces. A user can have many workspaces and workspaces can have many users. However, the problem comes when I want to add in a fourth party.
I want to check if the user is in the correct workspace before the user can get/post/put/delete.
I used to do this by doing a simple check like this:
var workspace = _workspaceService.GetById(User.WorkspaceId);
private Workspace getWorkspace(int id)
{
var workspace = _context.Workspace.Find(id);
if (workspace == null) throw new KeyNotFoundException("Workspace not found");
return workspace;
}
Where User.WorkspaceId was a foreign key linking up with WorkspaceId and I could do if checks to see the workspace properties. However, it has come to my attention that a user might have use to be a part of more than one workspace.
So, I've configured a many to many relationship in my database.
modelBuilder.Entity<WorkspaceReference>(entity =>
{
entity.HasKey(bc => new { bc.WorkspaceId, bc.UserId });
entity.ToTable("workspace_reference");
entity.HasIndex(e => e.UserId)
.HasName("fk_workspaceref_userid_idx");
entity.HasIndex(e => e.WorkspaceId)
.HasName("fk_workspaceref_workspaceid_idx");
entity.Property(e => e.UserId)
.HasColumnName("user_id")
.HasColumnType("int(11)");
entity.Property(e => e.WorkspaceId)
.HasColumnName("workspace_id")
.HasColumnType("int(11)");
entity.HasOne(d => d.User)
.WithMany(a => a.WorkspaceReferences)
.HasForeignKey(d => d.UserId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_workspaceref_userid");
entity.HasOne(d => d.Workspace)
.WithMany(c => c.WorkspaceReferences)
.HasForeignKey(d => d.WorkspaceId)
.OnDelete(DeleteBehavior.ClientSetNull)
.HasConstraintName("fk_workspaceref_workspaceid");
});
This all shows up well when I do a get requested and I receive the Workspaces.
For instance I would like to do:
if(workspace.WorkspaceAllowEdit == 0) { return BadRequest("You're not allowed to edit"); }
Is there any way to do a simple check like I did before or would I have to use a list and loop through them each time?
|
a2490d4c215d68a40e0b436ed5458b79a6687fd5f74b49497f66c2796c910586 | ['fcb1e6915c4e4e1587cf2e9dca6ae7a4'] | I'm trying to create a map, with an option wich adds names to the dif. streets. My plan was to include this feature with checkboxes and usemap-information.
Due to my limited understanding on how these components work together, I hit a stand-still, here is my non-functional code:
<head>
<script>
var checkbox1 = document.getElementById("checkbox1");
var <PERSON> = document.getElementById("post_location");
function visVei(){
if (checkbox1.checked){posting="
<map name='kartet_info' style='cursor:help'>
<Area shape=poly coords=326, 463, 278, 103, 286, 101, 336, 464 onmouseover=writeText2('Prinsen Gate'); onmouseout=writeText2('');/></map>"
}
}
</script>
</head>
This is supposed to get written to:
<span id="post_location" style="display:none;"></span>
once
<form action="">
<input type="checkbox" class="check_1" id="checkbox1" onchange="visVei();"><span class="in_check_1">Gatenavn</span></input>
</form>
Is checked off.
| 4683f0746c7e428fa6878efe08724ddd73982e9d7545bce2d193e035ab5eab38 | ['fcb1e6915c4e4e1587cf2e9dca6ae7a4'] | I'm trying to gain a better js-knowledge, and got a little problem.
I want to give a option more than one vaule, and from what i could find other places, arrays with split was the best solution. But I can't get it to work.
One side of the script is supposed to calculate a price, dependent on the selected destionation, while the other is the name on the destinaton.
<form name="ORDER" method="post" >
<select name="destination" id="destination_trV">
<OPTION VALUE="10,Cannes"> Cannes</option>
</form>
I want one part to grab the "10" to use this calculation purposes, and another to grab "Cannes" to write.
var dest_1 = (document.getElementById("destination_trV").value);
var vari_1 = dest_1.split(",",1);
var vari_2 = dest_1.split(",",1,2);
this is supposed to write out "10"
document.getElementById("linje5").innerHTML="Priceclass: " + vari_1 + "<br>";
this is supposed to write out "Cannes"
document.getElementById("linje6").innerHTML="Destination: " + vari_2 + "<br>";
But this doesn't work :)
|
25bce692866ceab84e67d8924c7b1093b976a67511bb1af900e01088731c9ba9 | ['fcc9c5dfda34417d83687b16dbae758b'] | Well, both devices should understand wifi direct protocol. so we should use special programs to do that.
you can use this for android
the principal of connecting via wifi direct is similar like blootooth connection.
for computers, you should use direct connection with ad hoc feature in adapter settings, i bet this could help (link)
| 1fa8382719a77f7d205e293f5e6bb3dcffe751b44118cb51e7d31eb7a0f43231 | ['fcc9c5dfda34417d83687b16dbae758b'] | If you have asus wifi router, you can check modified firmware, in the latest version added possibility to make home media center from your router with so called 'apps + transmission' with 'Trans.BT (RTN13U)' virtual server integrated into the wifi router.
by this clickable
For other trademarks, you can check google, so maybe youll find something similar.
|
8b1033cdc9471b47fdd24c50e9f179b94c84c06abb994092ffd6d2084907173d | ['fcf0bb07c4f4469d840c9e07d4e58eb8'] | The easiest way to get cats is to play in creative mode. Build a huge fence area. Then in the eggs list you should find ocelot eggs as one of the egg items. After throwing your desired amount of ocelot eggs equip fish and crouch toward the animal after a while the ocelot should be tamed and will turn into a random cat type.
| eaa54c43ec3533b7fd0ad6f957abb55bcdc83f4d6a76549899d9c5d55da25749 | ['fcf0bb07c4f4469d840c9e07d4e58eb8'] | BINGO! I've been stuck by that problem for some time... I connected by SSH and couldn't launch Gtk programs (plain X11, like "xeyes", worked however). DISPLAY was correct. Actually, the resolution of "localhost" wasn't! If I set manually DISPLAY=<IP_ADDRESS>:10.0, or DISPLAY=::1:10.0 it does work. Editing /etc/hosts seems to have no effect; and DNS is correctly configured ("dig localhost" correclty report both <IP_ADDRESS><IP_ADDRESS>1:10.0 it does work. Editing /etc/hosts seems to have no effect; and DNS is correctly configured ("dig localhost" correclty report both 127.0.0.1 and <IP_ADDRESS>1) So, it seems to be a bug in whatever does DNS resolution for X11 connections in Gtk (gtk? gdk? glib? other?). |
7bce72cde21056fab76d765515c02b8d0d593d8404e1fb609ede6b885db7432a | ['fcf17269207649f5ad317625fa6f5dde'] | git ls-files --deleted | xargs git rm
is the best option to add only deleted files.
Here is some other options.
git add . => Add all (tracked and modified)/new files in the working tree.
git add -u => Add all modified/removed files which are tracked.
git add -A => Add all (tracked and modified)/(tracked and removed)/new files in the working tree.
git commit -a -m "commit message" - Add and commit modified/removed files which are tracked.
| 55e91ca40de3b149c33e847f13995f2929607660cf69211f1cf8a5e892ad4060 | ['fcf17269207649f5ad317625fa6f5dde'] | I am using http://nvie.com/posts/a-successful-git-branching-model/ As far as I understand, main repo in this model should be a bare repo.
In the blog it is stated that "The repository setup that we use and that works well with this branching model, is that with a central “truth” repo." (http://nvie.com/posts/a-successful-git-branching-model/) Does it means central repo should be bare?
Where i can run testing and bug fixing? Is following a best approach?
1) Set up a testing server as clone of central repo.
2) pull from central repo regularly to get new features and bug fixes(for the bugs reported in testing server).
3) Do test and bug fix of big features in developers repo itself.
|
e5d2748866a812f7c5b21626a1ee44ad826d7f4734a776c84dca713b4fe6c874 | ['fd05e4b7be7145d88b111379010e23c8'] | Yes, i am using this to mount default configs. Just use subPath and the file name in subPath. Find below sample it works like a charm
spec:
selector:
matchLabels:
name: some_name
template:
spec:
containers:
- args:
- bash
- entrypoint.sh
image: xyz
imagePullPolicy: IfNotPresent
name: some_name
volumeMounts:
- mountPath: /full/path/to/be/mounted/default.json
name: config
subPath: default.json
volumes:
- configMap:
defaultMode: 420
name: config
| 0a4f4d3addb0ba50a4f422934a0d4bf460a2f15443970d681697525e57db615f | ['fd05e4b7be7145d88b111379010e23c8'] | Something similar happened to me in my case it was pv & pvc , which I forcefully removed by setting finalizers to null. Check if you could do similar with ns
kubectl patch pvc <pvc-name> -p '{"metadata":{"finalizers":null}}'
For namespaces it'd be
kubectl patch ns <ns-name> -p '{"spec":{"finalizers":null}}'
|
803673afe4f3b1bd06a62b41d7914a6bbcdc3b0293033868711bce8ac046746b | ['fd2ad871e1ed453d946e1f9a9d9012b8'] | I am working with an API that states to use JWTs in the Authorization header for each request, and says that exp and iat are not optional. How do I determine what values I should use for iat and exp? Does it matter? What is stopping me from setting iat time to far in the past and exp time to whatever I'd like?
RFC7519 says about iat
The "iat" (issued at) claim identifies the time at which the JWT was
issued. This claim can be used to determine the age of the JWT. Its
value MUST be a number containing a NumericDate value. Use of this
claim is OPTIONAL.
and exp
The "exp" (expiration time) claim identifies the expiration time on
or after which the JWT MUST NOT be accepted for processing. The
processing of the "exp" claim requires that the current date/time
MUST be before the expiration date/time listed in the "exp" claim.
| fe112c69b4a129ba081699fc15e3104f337687bfc789781d7167394de847a206 | ['fd2ad871e1ed453d946e1f9a9d9012b8'] | Out of seemingly nowhere my production server is getting a chunking error on a specific request. No config files have been changed on the server and nothing else on the server has changed. I'm not even sure where to start in debugging this error.
This chunking error only happens on 1 GET request with query params.
On Chrome the error is:
net<IP_ADDRESS>ERR_INCOMPLETE_CHUNKED_ENCODING 200 (Ok).
To make sure this was not a Chrome specific issue, I tried on Firefox but the same thing happens although with a different error SyntaxError: JSON.parse: unterminated string at line . Inspecting the response shows that Firefox is receiving some of the JSON from the request, but not all of it.
On the server I used cURL to GET the URL with the exact same query params and got this error: ncurl: (18) transfer closed with outstanding read data remaining. If I use HTTP 1.0 nothing changes, but if I add the header "Expect: " , at some point the request stops receiving data.
cURL is not the issue here, I need this request to work with the Javascript AJAX request. The file that makes this request has not been altered for 7 months.
The expected return of this request is between 50 - 200 rows from the database. If I do a SELECT query directly on the database, there is no problem.
Where do I start to look? Log files have no information of interest and the server has plenty of memory and cpu.
Our server is Ubuntu 16.04 and Apache 2.4. Our API is DreamFactory; no settings there have been changed either.
|
f0e6b5821fb65aacd57d66fc8d2ce31b83241ba4a22d6c88bc350949dd494118 | ['fd2bd3b3f95d4c05be1464473e910292'] | The replace() method is expecting a string for the second parameter and you've passed it an array, hence the TypeError.
You can take the two names in the names array and append them together with a space in the middle using the join method. Try this:
print row.replace("[name here]", ' '.join(names))
| 42c59c8d08ec851ab45e6e6d0b077545f9d323d116e10d3f8946e0817e4dd18c | ['fd2bd3b3f95d4c05be1464473e910292'] | The parameter to the constructor for GreenPool is the number of worker threads that will be used. By passing the number 4, you are telling it to call self.do_work by a maximum of four times simultaneously. Since you call spawn ten times, you've queued up 10 "jobs", so that's how many times do_work will get called. The amount of parallelism (4 in this case) doesn't affect the number of times your tasks get execute, but instead limits the amount of threads that may run simultaneously.
|
7e325c16eb4e591c124bd3602b90ac3058cca7dc2cf666e3fb246be60f7ea154 | ['fd2c3bfafbcb4174b91c8ffc661f8b45'] | $(window).resize should be the correct function but you also need to call the function to check initially to ensure the menu is shown correctly
//initialize the hamburger menu once on ready
$(document).ready(function() {
var <PERSON> = $('.hamburger');
//Hamburger Function
ham.show();
ham.click(function() {
$('.menu').toggle();
});
//call the checkWindowWith by yourself on ready
checkWindowWidth();
});
//register the resize function
$(window).resize(checkWindowWidth);
function checkWindowWidth() {
var width = $(window).width();
if (width <= 750) {
$('.hamburger').show();
$('.nav').hide();
} else {
$('.hamburger').hide();
$('nav').show();
}
}
jsfiddle demo
| 9333066d7a7e30646ffe7bc8e3070c47a0292f677d43587b6f6edd70433673ba | ['fd2c3bfafbcb4174b91c8ffc661f8b45'] | The strange behavior on a click is because you add a event listener each time the load or resize event is triggered.
You have to move the event binding outside the load/resize event handler.
//ACCORDION BUTTON ACTION
jQuery(function() {
jQuery('h3').click(function() {
if(jQuery(this).data("slided") === true) {
jQuery(this).next().slideUp('normal');
jQuery(this).data("slided", false);
} else {
jQuery('h3').data('slided',false);
jQuery('.sec').slideUp('normal');
jQuery(this).next().slideDown('normal');
jQuery(this).data("slided", true);
}
});
});
jQuery(window).on("load resize",function(e){
if(jQuery(window).width() <= 500) {
//HIDE THE DIVS ON PAGE LOAD
jQuery(".sec").hide();
} else {
jQuery(".sec").show();
}
});
jsfiddle
|
89624cebef3706d1bbe47433651f58b7850980f8dcf3ac8c070f88ef89b44a25 | ['fd3bf2891ebe487a80fe27be569d5c15'] | i stuck here about some Php codes. I hope you can help me.
I'm just new at sorting array values. So..
I wrote some codes about student averages by classes. But here when i sad to sort by desc to value arsort() he is just sorts keys by desc.
how can i resolve this?
Array
(
[11] => Array
(
[354] => 0
[325] => 0
[312] => 0
[313] => 0
[314] => 0
[307] => 0
[308] => 0
[309] => 0
[316] => 0
[317] => 0
[323] => 0
[350] => 0
[347] => 0
)
[6] => Array
(
[16] => 84.444444444447
[7] => 57.777777777778
[13] => 41.666666666667
[12] => 31.111111111111
[8] => 0
[14] => 0
[11] => 0
[10] => 0
[2] => 0
[9] => 0
[4] => 0
[3] => 0
[43] => 88.333333333335
[41] => 81.666666666665
[51] => 79.25925925926
[44] => 76
[53] => 73.333333333335
[42] => 72
[52] => 62.777777777777
[54] => 51.851851851853
[38] => 45
[35] => 0
[50] => 0
)
)
He is just sorting the keys. But i sad arsort() about the values. Anyway, how can do it with my values.
i want to sort values by desc.
| d55e0884219b4073ba5357553f24de3182aeba52e641231f489403151465c515 | ['fd3bf2891ebe487a80fe27be569d5c15'] | I found a solution like this!
I hope this helps!
function pie(perc) {
var rightPie = 180;
var leftPie = 360;
var rightDeg = null;
var leftDeg = null;
// 180 == 50 x perc ?
var x = 180 * perc / 50;
var newPerc = x;
if (newPerc < 180) {
rightDeg = rightPie + newPerc;
}
else if (newPerc <= 360 && newPerc >= 180) {
rightDeg = 360;
leftDeg = newPerc - 180;
}
if (rightDeg != null) {
$('body').prepend('<style> .right-pie .char:before { -moz-transform: rotate('+rightDeg+'deg); -ms-transform: rotate('+rightDeg+'deg); -webkit-transform: rotate('+rightDeg+'deg); -o-transform: rotate('+rightDeg+'deg); transform: rotate('+rightDeg+'deg); } </style> ');
}
if (leftDeg != null) {
$('body').prepend('<style> .left-pie .char:before { -moz-transform: rotate('+leftDeg+'deg); -ms-transform: rotate('+leftDeg+'deg); -webkit-transform: rotate('+leftDeg+'deg); -o-transform: rotate('+leftDeg+'deg); transform: rotate('+leftDeg+'deg); } </style> ');
}
//$('.log').prepend(newPerc+' - '+leftDeg + ' -- '+ rightDeg);
}
// set pie
pie(26);
.gen-holder {
width: 500px;
height: 500px;
position: relative;
}
.right-pie {
width: 250px;
height: 500px;
background: url(http://crf.ngo/view/img/orphan-s-right.png) no-repeat left center;
background-size: 200px 400px;
position: absolute;
right: 0px;
top: 0px;
content: " ";
z-index: 15;
overflow: hidden;
}
.right-pie .char {
position: relative;
width: 500px;
height: 500px;
-moz-transform-origin: left center;
-ms-transform-origin: left center;
-o-transform-origin: left center;
-webkit-transform-origin: left center;
transform-origin: left center;
left: 0px;
}
.right-pie .char:before {
content: '';
position: absolute;
width: 250px;
height: 500px;
border-radius: 250px 0 0 250px;
background: #fff;
-moz-transform-origin: right center;
-ms-transform-origin: right center;
-o-transform-origin: right center;
-webkit-transform-origin: right center;
transform-origin: right center;
left: -250px;
z-index: 20;
}
.left-pie {
width: 250px;
height: 500px;
background: url(http://crf.ngo/view/img/orphan-s-left.png) no-repeat right center;
background-size: 200px 400px;
position: absolute;
left: 0px;
top: 0px;
content: " ";
z-index: 45;
overflow: hidden;
}
.left-pie .char {
position: relative;
width: 500px;
height: 500px;
-moz-transform-origin: left center;
-ms-transform-origin: left center;
-o-transform-origin: left center;
-webkit-transform-origin: left center;
transform-origin: left center;
left: 0px;
}
.left-pie .char:before {
content: '';
position: absolute;
width: 250px;
height: 500px;
border-radius: 250px 0 0 250px;
background: #fff;
-moz-transform-origin: right center;
-ms-transform-origin: right center;
-o-transform-origin: right center;
-webkit-transform-origin: right center;
transform-origin: right center;
left: 0px;
z-index: 20;
}
.image-holder {
float: left;
width: 350px;
height: 350px;
text-align: center;
-webkit-mask-image: url(http://crf.ngo/view/img/orphan-mask-1.png);
mask-image: url(http://crf.ngo/view/img/orphan-mask-1.png);
background-size: cover;
background-position: center center;
margin-left: 75px;
margin-top: 75px;
position: relative;
z-index: 50;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="gen-holder">
<div class="image-holder" style="background-image: url(https://c1.staticflickr.com/9/8594/16537918922_cef77dead4_h.jpg)">
</div>
<div class="right-pie">
<div class="char"></div>
</div>
<div class="left-pie">
<div class="char"></div>
</div>
</div>
<div class="log"></div>
|
b0745f23975fcf5cecce488b607bed8b08fc86e23f47d0ac2c83699057ac86cb | ['fd4d3b96b235454fa7710ae47846a7ee'] | Using FastAPI for Python 3.7+ I have the following BaseDocument class:
class BaseDocument(BaseModel):
name: str
category: str
description = "Base Document"
type: str
class Config:
schema_extra = {
"example": {
"name": "stack_instance_document_example",
"description":
"an example of a document, using the stack_instance type",
"example_field": "Random",
"category": "items",
"type": "example_document"
}
}
And a subclassing model:
class ExampleModel(BaseModel):
name: str
type = "example_document"
category = "items"
"example_field": str
Now, if I do an API call for a put using the class_config schema extra example, where I am expecting a BaseDocument and I use .dict() on that BaseDocument, the resulting dict does NOT include the "example_field" key.
For instance,
@router.put('')
def put_document(document: BaseDocument):
"""Update (or create) the document with a specific type and an optional name given in the payload"""
logger.info(f"[PutDocument] API PUT request with data: {BaseDocument}")
task = DocumentTask({
'channel': 'worker',
'document': document.dict(),
'subtype': "PUT_DOCUMENT"
})
....
The document.dict() in my logs only has the fields of the BaseDocument. Anyway to get a dict representation of the complete document?
| 938f2b95d1a77e1384e5d4280bf000c83c4683c3b408f38778742130aee86ab9 | ['fd4d3b96b235454fa7710ae47846a7ee'] | I'm having difficulty in using sort in python.
Basically, I have a list like this, containing tuples that have a String and a Dictionary.
The string is the name and contains a timestamp of the format '%Y-%m-%d_%Hh%Mm%Ss'
Example:
[
[
"/lfs_store/history/snapshot_stack_instance_document_example_2020-05-12_05h14m58s.json",
{
"category": "history",
"description": "an example of a document, using the stack_instance type",
"name": "stack_instance_document_example_2020-05-12_05h14m58s",
"type": "snapshot"
}
],
[
"/lfs_store/history/snapshot_stack_instance_document_example_2020-05-11_11h53m27s.json",
{
"category": "history",
"description": "an example of a document, using the stack_instance type",
"name": "stack_instance_document_example_2020-05-11_11h53m27s",
"type": "snapshot"
}
],
[
"/lfs_store/history/snapshot_stack_instance_document_example_2020-05-11_11h49m26s.json",
{
"category": "history",
"description": "an example of a document, using the stack_instance type",
"name": "stack_instance_document_example_2020-05-11_11h49m26s",
"type": "snapshot"
}
],
[
"/lfs_store/history/snapshot_stack_instance_document_example_2020-05-11_11h50m27s.json",
{
"category": "history",
"description": "an example of a document, using the stack_instance type",
"name": "stack_instance_document_example_2020-05-11_11h50m27s",
"type": "snapshot"
}
],
[
"/lfs_store/history/snapshot_stack_instance_document_example_2020-05-11_11h50m54s.json",
{
"category": "history",
"description": "an example of a document, using the stack_instance type",
"name": "stack_instance_document_example_2020-05-11_11h50m54s",
"type": "snapshot"
}
],
[
"/lfs_store/history/snapshot_stack_instance_document_example2_2020-05-11_10h23m09s.json",
{
"category": "history",
"description": "an example of a document, using the stack_instance type",
"name": "stack_instance_document_example2_2020-05-11_10h23m09s",
"type": "snapshot"
}
],
[
"/lfs_store/history/snapshot_stack_instance_document_example2_2020-05-11_10h22m37s.json",
{
"category": "history",
"description": "an example of a document, using the stack_instance type",
"name": "stack_instance_document_example2_2020-05-11_10h22m37s",
"type": "snapshot"
}
]
]
I'd like this list to be sorted according to the timestamp, preferably with the most recent one being the first element.
I have been trying to do so through the sorted() method of Python but getting stuck.
It will probably be a combination of regex and a lambda function but I have not managed to get it to work.
Can anybody help?
|
1c35566611a989090cd7042c4608908cf71536faf8c294975f7883fa7267e73d | ['fd6e7431a14449579080c17b94f9f9b3'] | I'm new to sails.js but I've been reading a bunch of the documentation for the last couple of days so I feel like I have a basic grasp on the platform. But I can't seem to get custom grunt tasks added and registered. I've tried a few ways and none of them seem to work. So I figured I'd keep it simple and just register a task with one of the existing register files, but I'm still not about to get this method to work.
So I've added the following Gruntfile to tasks/config/comp.js
module.exports = function(grunt) {
grunt.config.set('comp', {
dev: {
options: {
module: 'system',
moduleResolution: 'node',
target: 'es3',
experimentalDecorators: true,
emitDecoratorMetadata: true,
noImplicitAny: false
},
files: [{
expand: true,
cwd: 'assets/js/',
src: [ '**/*.ts' ],
dest: '.tmp/public/js',
ext: '.js'
}]
}
});
grunt.loadNpmTasks('grunt-ts');
};
And I added the following line to tasks/register/compileAssets.js
/**
* `compileAssets`
*
* ---------------------------------------------------------------
*
* This Grunt tasklist is not designed to be used directly-- rather
* it is a helper called by the `default`, `prod`, `build`, and
* `buildProd` tasklists.
*
* For more information see:
* http://sailsjs.org/documentation/anatomy/my-app/tasks/register/compile-assets-js
*
*/
module.exports = function(grunt) {
grunt.registerTask('compileAssets', [
'clean:dev',
'jst:dev',
'less:dev',
'copy:dev',
'coffee:dev',
'comp:dev'
]);
};
However whenever I run sails lift I get the following error
info: Starting app...
info:
info: .-..-.
info:
info: Sails <| .-..-.
info: v0.12.13 |\
info: /|.\
info: / || \
info: ,' |' \
info: .-'.-==|/_--'
info: --'-------'
info: __---___--___---___--___---___--___
info: ____---___--___---___--___---___--___-__
info:
info: Server lifted inC:\Users\josh\Documents\PGW`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press + C at any time.
debug: -------------------------------------------------------
debug: :: Thu Jun <PHONE_NUMBER><IP_ADDRESS> Thu Jun 08 2017 16:32:01 GMT-0600 (Mountain Daylight Time)
debug: Environment : development
debug: Port : 1337
debug: -------------------------------------------------------
error: ** Grunt <IP_ADDRESS> An error occurred. **
error:
Aborted due to warnings.
Warning: Task "comp:dev" not found.
error: Looks like a Grunt error occurred--
error: Please fix it, then restart Sails to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.
error: Troubleshooting tips:
error:
error: *-> Are "grunt" and related grunt task modules installed locally? Run npm install if you're not sure.
error:
error: *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
error:
error: *-> Or maybe you don't have permissions to access the .tmp directory?
error: e.g., C:\Users\josh\Documents\PGW\.tmp ?
error:
error: If you think this might be the case, try running:
error: sudo chown -R YOUR_COMPUTER_USER_NAME C:\Users\josh\Documents\PGW.tmp
I've been banging my head against this for hours and I don't understand why sails lift won't run my task. I feel like I've followed the directions well between reading the sails docs and other stackoverflow articles. Can someone help me understand what I'm missing here?
Thanks
| 76b7cd1f7cf959fa37b1772bedc10343603ac7f368a57933d15523d254164a23 | ['fd6e7431a14449579080c17b94f9f9b3'] | In PHP I'm attempting to build a form that needs to check for an ID in one table and if it exists it should create a record in another table. So far, that works but the issue I'm having is when I attempt to handle the case if the ID I checked for didn't exist. If it doesn't exist I'd like to create another one. But every time I try it, I get 500 errors from the server when I fetch the results.
Essentially I made the following function
function trySQL($con, $query, $params) {
$stmt = $con->prepare($query);
$result = $stmt->execute($params);
$id = $stmt->insert_id;
return array($stmt,$result,$id);
}
I call this function multiple times through out my php code but when I call it more then once and attempt to fetch the results it breaks.
$custINSquery = "
INSERT INTO custs (
FirstName,
LastName,
EmailAddress,
PhoneNumber
) VALUES (
:FirstName,
:LastName,
:EmailAddress,
:PhoneNumber
)
";
$createJob = "
INSERT INTO jobs (
custs_id,
StAddress,
State,
ZipCode,
MoistureLocation,
status_id
) VALUES (
:custs_id,
:StAddress,
:State,
:ZipCode,
:IssueDesc,
:status_id
)
";
$custSELquery = "SELECT id, FirstName, LastName, EmailAddress FROM custs WHERE FirstName = :FirstName AND LastName = :LastName AND EmailAddress = :EmailAddress";
$custSELquery_params = array(
':FirstName' => $_POST['FirstName'],
':LastName' => $_POST['LastName'],
':EmailAddress' => $_POST['EmailAddress']
);
$checkcust = trySQL($db, $custSELquery, $custSELquery_params);
$row = $checkcust[0]->fetch();
if(!$row){
$custINSquery_params = array(
':FirstName' => $_POST['FirstName'],
':LastName' => $_POST['LastName'],
':EmailAddress' => $_POST['EmailAddress'],
':PhoneNumber' => $_POST['PhoneNumber']
);
$custins = trySQL($db, $custINSquery, $custINSquery_params);
$custsel = trySQL($db, $custSELquery, $custSELquery_params);
$custs_id = $custsel[0]->fetch();
if ($custs_id != null) {
$createJobParam = array(
':custs_id' => $custs_id,
':StAddress' => $_POST['StAddress'],
':State' => $_POST['State'],
':ZipCode' => $_POST['ZipCode'],
':IssueDesc' => $_POST['MoistureLocation'],
':status_id' => $_POST['status_id']
);
$jobins = trySQL($db, $createJob, $createJobParam);
$jobres = $jobins[0]->fetch();
die("um...");
if ($jobres) {
# code...
die("looks like I made it");
}
}
} else {
$createJobParam = array(
':custs_id' => $row['id'],
':StAddress' => $_POST['StAddress'],
':State' => $_POST['State'],
':ZipCode' => $_POST['ZipCode'],
':IssueDesc' => $_POST['MoistureLocation'],
':status_id' => $_POST['status_id']
);
$data['success'] = true;
$data['message'] = 'Success!';
}
Additional Notes: When I look through the php doc's they are saying that I could use the inserted_id thing in order to get the ID that I inserted previously but when I try that it just gives me nulls with this set up.
Any help would be appreciated.
Thanks!
|
7219009ec32e69e12040ccbcc7855ba96bf8dc1a892251317e4819655da68e8c | ['fda55354691c4a3a9c91f7a9d878fbf1'] | <PERSON> I'm using the MVC pattern to design the application and this class is into the Model, so yes, they are for the most simple POJO classes with only getter and setters. Even if there are other little methods I can move them into a Class in a higher level of abstraction of the Controller | 51f8417975a634708e0574167d39077cbf8ac6c4ae6d86e1df2a3f027bca6759 | ['fda55354691c4a3a9c91f7a9d878fbf1'] | Turns out, I still don't know the speed of the SPI clock. I thought that the speed is 26MHz, but inside the documentation there is a "description" for some flags, where the SPI cycle is 7.519ns, which is 133MHz. Can anybody please help understanding it? I tried to provide all info inside the question. If there is anything missing, let me know please. |
f4b82871faee012336ea8f97027aec4a8ae93ed2b253da590d1cd45ef38accea | ['fdacbb654dd04ae69f446df8b90d6ba8'] | In my case, bluetooth worked when i installed blueman - Graphical bluetooth manager.
I see that my wireless network adapter is different from yours, but blueman can fix your Bluetooth problem. I have the Qualcomm Atheros QCA6174 and i use the Ubuntu 16.04.
The blueman is a part of Ubuntu repository, so you can use this commands.
sudo apt-get update
sudo apt-get install blueman
When you install blueman, some dependencies are also installed. See the list of dependencies on the official blueman package page.
Additional information about my Qualcomm Atheros QCA6174.
The firmware used as driver is ath10k_pci, as can see in output after run the following command:
sudo lspci -knn | grep Net -A2; lsusb
Output:
03:00.0 Network controller [0280]: Qualcomm Atheros QCA6174 802.11ac Wireless Network Adapter [168c:003e] (rev 32)
Subsystem: Dell QCA6174 802.11ac Wireless Network Adapter [1028:0310]
Kernel driver in use: ath10k_pci
Kernel modules: ath10k_pci
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 006: ID 0cf3:e007 Atheros Communications, Inc.
Bus 001 Device 005: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 001 Device 004: ID 0bda:5689 Realtek Semiconductor Corp.
Bus 001 Device 003: ID 1c4f:0002 SiGma Micro Keyboard TRACER Gamma Ivory
Bus 001 Device 002: ID 275d:0ba6
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
| a836eac72e66239fa5dd18215997c1db61962becbcfbfa3fe7c4339ec8e2f89f | ['fdacbb654dd04ae69f446df8b90d6ba8'] | I tested a simple Dockerfile based on an example copied from this repository.
My Dockerfile looks like this:
FROM php:7.2-apache
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions gd
COPY index.php /var/www/html/
Before building, I create a php file, index.php, to copy to my new image.
<?php
phpinfo();
?>
Then, I build and run my new image with these commands:
docker build -t php7-with-gd -f Dockerfile .
docker run -d --rm -p 88:80 --name test-phpgd php7-with-gd
And my output page with the PHP information looks like this.
|
e7fd5895d2448e5054107c2d07adf06665c0bc7928846d2a66c5028138c2d851 | ['fdc87a9054f549e4936873b0296c57d6'] | I've made some coconut yoghurt from powdered coconut milk, tapioca flour, maple syrup and a spoonful of store-bought yoghurt. The mixture (apart from the old yoghurt) was simmered for a while, and the utensils had boiling water run over them from the kettle - except, come to think of it, the spoon used for the old yoghurt.
I left it for 24h in an incubator. It has a good consistency, but it has a pinkish patch and some yellow on top. The pink patch has a slight stringyness to it. I removed that part and gave it a stir and now it looks great, but I'm suspicious of it.
Has it spoiled?
| 33a0ec40b6a3b8ed2ec4721dd5afd69a76cfe020ad94ece0f1a4db27b412a507 | ['fdc87a9054f549e4936873b0296c57d6'] | It's not so much an idiom as it is slang. Here's a video explaining "been ages" http://learningenglish.voanews.com/media/video/1664835.html . When you realise how the phrase can be used as "It's been ages" you can figure out how substituting "it's" with "you've" works. |
b1a502fae766bcf7c3f5e08b2051db2305db30b7bc027e1f0d8d2d48d7ad07f4 | ['fdd82c1d50e4498f839783f5803325ff'] | I have made a simple project to test the permission classes but it's not working.
when I define these permission classes globally then it worked but when I tried to define it class level then it is not working.
I have checked many times but it's not working
then I check for compatibility issues but I don't understand
I am using python 3.8.2
Django =2.2.5 `
drf version is 3.11
I don't know where is the problem
from django.shortcuts import render
from testapp.models import Employee
from testapp.serializers import EmployeeSerializer
from rest_framework.viewsets import ModelViewSet
from rest_framework.authentication import TokenAuthentication
from rest_framework.permissions import IsAuthenticated,AllowAny,IsAuthenticatedOrReadOnly
from testapp.permissions import IsReadOnly
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework_simplejwt.views import TokenObtainPairView,TokenRefreshView
# Create your views here.
class EmployeeCRUDCBV(ModelViewSet):
queryset=Employee.objects.all()
serializer_class=EmployeeSerializer
# authentication_classes=[TokenAuthentication,]
authentication_classes=[TokenObtainPairView,]
# permissions_classes=[IsAuthenticatedOrReadOnly,]
permissions_classes=[IsAuthenticated,]
| f8b63e549d8eabcd6b2018f2ebfb2c76336d630a7589faf11df1dc49e8f8ebbe | ['fdd82c1d50e4498f839783f5803325ff'] | hello I have implemented JWT in my test project using this package "djangorestframework-jwt"
I have generated the token by giving my "username" and "password"
but the problem is that I am getting this output bypassing my token with the endpoint
I am using postman to test API,Django=2.2.12, python 3.7.6
I am not getting my data from the database
{"eno":["This field is required."],"ename":["This field is required."],"esal":["This field is required."],"eaddr":["This field is required."]}
|
0fb56b42085b1d155eba80340146503cb6c4810428d6e9ed443dcfb551ecdcb7 | ['fddbcb08c00447b8a11384458d91aea8'] | Solved:
I needed to download the .dll from github instead of using the nuget package.
Though it is quit complicate to compile oneself the .dll:
First, one needs to create a new VS project and a new local repository to clone the solution found on github.
Unfortunately, the project openTK can't be built (three errors). Therefore OpenTK.GLControl can't be built :-(
Secondly, one needs to copy the opentk.dll found with nuget in the right folder
Thirdly, one can build OpenTK.GLControl.dll
Finally, add it manually in the toolbox.
See:
https://github.com/opentk/opentk/issues/37#issuecomment-219860160
| 3fc6ccf4a74eaa37faa2b189cfb7247f1c215221894c86f89d22ffbae12e0294 | ['fddbcb08c00447b8a11384458d91aea8'] | solution here: https://threejs.org/docs/#api/loaders/TextureLoader
this is the code to solve my problem:
var url = "https://codefisher.org/static/images/pastel-svg/256/bullet-star.png";
var loader = new THREE.TextureLoader();
var spriteMaterial;
loader.load(url,
function(texture)
{
spriteMaterial = new THREE.SpriteMaterial( { map: texture, color: 0x0000ff } );
}
);
var sprite = new THREE.Sprite( spriteMaterial );
|
cee69b678631c39e9a795ff796bbcf4671d6d8fc701ea2083e6c521bc2136c18 | ['fdde8ba565114818b95cf2a22fcab858'] | $stmt =$dbh->prepare('SELECT * FROM config WHERE group=:group AND name=:name');
$stmt->bindParam(':group',$group, PDO<IP_ADDRESS>PARAM_STR);
$stmt->bindParam(':name',$name, PDO<IP_ADDRESS>PARAM_STR);
Gives exception:
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server
version for the right syntax to use near 'group=? AND name=?' at line 1
Tried to put the parameters in the execute function, same message.
PDO options i've set are:
PDO<IP_ADDRESS>ATTR_ERRMODE=> PDO<IP_ADDRESS>ERRMODE_EXCEPTION,
PDO<IP_ADDRESS>ATTR_DEFAULT_FETCH_MODE => PDO<IP_ADDRESS>FETCH_ASSOC,
PDO<IP_ADDRESS>ATTR_EMULATE_PREPARES => FALSE,
| 70b60ee375c579afa14d9b38d908664e6e050eefb8a03ce2918ad2000b963ff4 | ['fdde8ba565114818b95cf2a22fcab858'] | Think you could try something like this:
SELECT
Name
Issue
SLC
Values.value
FROM
Table-2
LEFT JOIN
(
SELECT 'Rank1' descrip, Rank1 value FROM Table-1
UNION ALL
SELECT 'Rank2' descrip, Rank1 value FROM Table-1
UNION ALL
SELECT 'Rank3' descrip, Rank1 value FROM Table-1
UNION ALL
SELECT 'Rank4' descrip, Rank1 value FROM Table-1
) as Values
ON Values.descrip = Issue
based on Mysql Convert Column to row (Pivot table )
|
624b59042a95735ac53008f48b15d3f8ea425557b00abc79b348b599e1351405 | ['fde8d57c86d64e56b8ae209863e5d568'] | So if $\sum_nc_n<+\infty$, $c_n\underset{n\infty}{\rightarrow}0$ so there exists a $n\in\mathbf{N}$ such that $c_n<1$. So there exists $n\in\mathbf{N}$ such that $f^n$ is a contraction. So by the fixed-point theorem, $f^n$ has an unique fixed-point $x$.
Because $f^{n+1}(x)=f^n\big(f(x)\big)=f\big(f^n(x)\big)=f(x)$, we conclude that $f(x)$ is also a fixed-point of $f^n$ so by unicity $f(x)=x$ and hence $f$ has a fixed-point. Unicity comes from the fact if $y$ is another fixed point of $f$, it is also a fixed-point of $f^n$ so $y=x$.
| 26fb5cd7fd801434eb932a6149c21396a340db83e4116362a0f6e7f3c1432dcf | ['fde8d57c86d64e56b8ae209863e5d568'] | So I have a view-based NSTableView connected to an array. The table view originally has 2 items, however when I try to add an object using an IBAction, the object somehow disappears during the last iteration of tableView:viewForTableColumn:row: when the table view asks for the view of that row. The code following:
-(IBAction)addTask:(id)sender
{
NSString *task = @"New";
[todaysTasks addObject:task];
[tableView reloadData];
}
-(NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
{
return todaysTasks.count;
}
-(NSView *)tableView:(NSTableView *)tv viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
{
NSTableCellView *cellView = [tableView makeViewWithIdentifier:tableColumn.identifier owner:self];
NSLog (@"%@", todaysTasks);
TDTodaysTask *task = [todaysTasks objectAtIndex:row];
[cellView.textField setStringValue:task.taskName];
return cellView;
}
produces a log with
2014-06-19 16:59:35.211 Today[4513:303] (
Test,
Test,
New
)
2014-06-19 16:59:35.212 Today[4513:303] (
Test,
Test,
New
)
2014-06-19 16:59:35.214 Today[4513:303] (
Test,
Test //"New" somehow disappears for no reason
)
2014-06-19 16:59:35.215 Today[4513:303] *** -[__NSArrayM objectAtIndex:]: index 2 beyond bounds [0 .. 1]
when I use addTask: which makes no sense to me as I have not used removeObjectAtIndex: at all throughout my project. If I try add 2 objects instead in addTask: the previous 2 NSLogs produces the right output however the last one still outputs only the 2 results. A more detailed analysis of the memory address shows the last log has a much more different memory address than the previous logs, which is shown below.
2014-06-19 17:07:11.205 Today[4590:303] 0x60800024b5b0
2014-06-19 17:07:11.205 Today[4590:303] 0x60800024b5b0
2014-06-19 17:07:11.207 Today[4590:303] 0x60800024a260 //Address changes but I have not changed the array at all
I have absolutely no idea why this is happening so if anyone has any idea why this is happening that would be great.
|
383a6097b03aff9c5e4be068e14dba1054a9f491ba51ef70a60742b93479a0c5 | ['fdf1d44935514f2ebff19e4d8042921f'] | Thought I'd answer here since this came up first in my Google search and there's no answer (outside of <PERSON>'s creative answer :)) that generically replaces the last occurrence of a string of characters when the text to replace might not be at the end of the string.
if (!String.prototype.replaceLast) {
String.prototype.replaceLast = function(find, replace) {
var index = this.lastIndexOf(find);
if (index >= 0) {
return this.substring(0, index) + replace + this.substring(index + find.length);
}
return this.toString();
};
}
var str = 'one two, one three, one four, one';
// outputs: one two, one three, one four, finish
console.log(str.replaceLast('one', 'finish'));
// outputs: one two, one three, one four; one
console.log(str.replaceLast(',', ';'));
| 1aecef7b60324e397fd29d5f510c68b9da5fe986c8678fdadeefb1dc1b90dd57 | ['fdf1d44935514f2ebff19e4d8042921f'] | I think I found a solution that will work for us.
I plan on creating a snapshot off of the development stream after each successful deployment to production. Bug fixes/smaller projects will work off of this snapshot. That way I can keep anything I'm currently working on in DEV from getting inherited into my bug fix. When I'm ready to deploy my bug fix, I'll create another snapshot and re-parent my big project there. Then I'll revert the change package in QA and development, re-parent my bug fix to development, and promote as normal.
It's a slightly modified version of what's explained in this article: https://accurev.wordpress.com/2008/03/27/pattern-for-stable-development/
|
64069281c5db77fa95b3ca8954155e3f85027aecd07fdfad7485fe570960c1a7 | ['fdf290a84b0f426992fab161a687c982'] | I tried Disk Drill. The recover lost hfs partition turned up northing.
Do you think I Will I will be able to still get the directory structure back?
I guess I didn't think they would remove the confirmation prompt that asked you if you wanted to erase things. The old one had a clear warning prompt. They removed this In the new version of disk utility. Wish I knew what apple was smoking. | b57a68d68706f77769fc62631395131f04e34c00cb5f20f7e5e37276437f97d4 | ['fdf290a84b0f426992fab161a687c982'] | So was trying to backup my time machine drive onto another disk, but I got an message about it being case sensitive. So I was playing around with Disk Utility in El-Capitan, I was on the partition tab and I dropped it down to non case sensitive hit apply. There was no confirmation, and no warning. It started erasing the drive.
I yanked out the USB Cable literally no more than a half a second after I hit apply. When I plugged it back in it was not picking up my partition. I doubt it had enough time to actually erase anything. So my question is.. It there a way to make the drive whole again? Will i get the full directory structure back?
It is a standard hdd.
I tried a handful of automated tools, and got nowhere.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.