id stringlengths 5 11 | text stringlengths 0 146k | title stringclasses 1
value |
|---|---|---|
doc_23510600 |
If the value being converted is in the range of values that can be represented but the value cannot be represented exactly, it is an implementation-defined choice of either the next lower or higher representable value.
[intro.abstract] p2 says
Certain aspects and operations of the abstract machine are described in t... | |
doc_23510601 | int r; // result of log_2(v) goes here
union { unsigned int u[2]; double d; } t; // temp
t.u[__FLOAT_WORD_ORDER==LITTLE_ENDIAN] = 0x43300000;
t.u[__FLOAT_WORD_ORDER!=LITTLE_ENDIAN] = v;
t.d -= 4503599627370496.0;
r = (t.u[__FLOAT_WORD_ORDER==LITTLE_ENDIAN] >> 20) - 0x3FF;
return r;
I am trying to replic... | |
doc_23510602 | foo(){
int i = 5;
i += 4;
}
how is this allocated on the stack differently in these two architectures?
A: For Microsoft's x64 ABI, have a look at http://msdn.microsoft.com/en-us/library/7kcdt6fy.aspx under "Stack Usage". It is considerably different from their x86 ABI.
Other x64 ABIs (Linux, OS X, etc) are pr... | |
doc_23510603 | I have a button, when it is clicked I want to open a confirmation dialog and if it is OK the answer I do the $.post() of the form after that.
This is the function that I use inside the onclick event of the button:
function bconfirm(text)
{
var res;
bootbox.confi... | |
doc_23510604 | I'm unsure why and was wondering if anyone could help clarify why I am
getting this behaviour. This is a link to my developer space.
.cd-header {
position: sticky;
position: -webkit-sticky;
top: 0; /* required */
z-index:9999;
}
<header class="cd-header">
<nav class="navbar navbar-expand-lg" id="mainN... | |
doc_23510605 | Here is script part of my package.json:
"build": "node utils/build.js",
"watch": "webpack --watch & webpack-dev-server --inline --progress --colors"
}
My webpack.config.js: (I have a bunch of content scripts listed as separate entry point as well that I omitted)
path = require("path"),
env = require... | |
doc_23510606 |
<?php
session_start();
include('dbconfig.php');
if(empty($_SESSION['email'])){
header('Location:login.php');
}
$status = $_POST['status'];
$sql = mysql_query("SELECT * FROM task WHERE t_delete_on='0' AND t_status='$status'");
$count=mysql_num_rows($sql);
$return = array();
if($count > 0){
... | |
doc_23510607 |
I am trying to find the position of the rectangle in the image. Considering the top part of the image as reference, how can I find the position of the rectangle? I want the coordinates of the four vertices.
I have tried findContours and bounded rectangle method but have not been able to get the coordinates. Help would... | |
doc_23510608 | https://msdn.microsoft.com/en-us/windows/uwp/packaging/install-universal-windows-apps-with-the-winappdeploycmd-tool to sideload an app on a phone.
I am having trouble understanding what is meant by .appx file.
WinAppDeployCmd install -file "Downloads\MyApp.appx" -ip 192.168.0.1 -pin A1B2C3
I creqate dhte app package... | |
doc_23510609 | 1. longDescription":"\u003cul\u003e \u003cli\u003eTender grill’d bites made " (unicode and symbol combination)
2. longDescription":"Goodness You Can See™" (all decoded, to be picked as is)
3. longDescription":"With a wide variety of headphones, \u003cbr /\u003e \u003cb\u003e\u003cbr /\u003eBlackWeb Flat CAT6 Net... | |
doc_23510610 |
A: I am not aware of a full list. It might be easier to claim that most of JDK, as of Java 6, is directly supported; certainly most (if not all) of java.util and java.lang, much of java.util.concurrent, and then combinations thereof via List/Map/arrays.
It might be a good idea to suggest creation of a list of supporte... | |
doc_23510611 | Is there any better way to handle scenarios like this with web-driver, Java etc (to get rid of AutoIt) ?
If AutoIt is the only way to handle it, how can we make it to provide more accuracy ?
A: You can actually upload files using selenium by using sendKeys on the file element like this:
findElement(By.id("fileUpload")... | |
doc_23510612 |
A: It sounds like you are looking for the command "df". Unfortunately, the output and options depend on whatever flavor of UNIX you happen to be using.
Type "man df" or try "df -h" on a command line to learn more.
Here's an example from my Mac:
kim-burgaards-macbook-pro:~ kim$ df
Filesystem 512-blocks Used A... | |
doc_23510613 | - __init__.py
- module.py
- test_module.py
in which the module module.py is imported inside the file test_module.py as follows:
from . import module
Of course, when I just run test_module.py I get an error
> python test_module.py
Traceback (most recent call last):
File "test_module.py", line 4, in <module>
from... | |
doc_23510614 | using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ServiceModel.Description;
using Microsoft.Xrm.Sdk.Client;
using System.Net;
using Microsoft.Xrm.Sdk;
public partial class _Default : System.Web.UI.Page
{
protecte... | |
doc_23510615 |
Here is my code
class EventTile extends StatelessWidget {
final EventEntity event;
final UserEntity user;
const EventTile({super.key, required this.event, required this.user});
@override
Widget build(BuildContext context) {
return ListTile(
contentPadding: const EdgeInsets.symmetric(horizontal: ... | |
doc_23510616 | C:\Users\MyName\Documents\Net Beans Projects\MyProject\dist
I then need to move that build Jar file to a new location (where my other project will use it). Someplace like:
C:\SmartFoxServer_2X\SFS2X\extensions\MyOtherProject
Is there a way to configure NetBeans to send the build jar file to both locations? FYI, I am... | |
doc_23510617 | java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
I have remote login enabled from preferences.
zak-keirns-imac:~ zak$ ls -l .ssh
total 40
-rw------- 1 zak staff 2252 Dec 13 12:28 authorized_keys
-rw------- 1 zak staff 6... | |
doc_23510618 | To do this I've created a SQLiteDatabase, which I want to convert into a string array to be put into an array adapter, which can then be fed into the spinner.
Database details are:
DATABASE_NAME = "carddb"
DATABASE_TABLE = "cardtable"
Then the column I wish to read the values from is:
KEY_CARDDETAILS = "_carddetails";
... | |
doc_23510619 | From Wikipedia I gather that profilers based on sample functions usually work by sending an interrupt to the OS and querying the program's current instruction pointer. Now my knowledge about assembly is a little rusty, so I'm wondering what it means if the instruction pointer points to method m at any given time? I.e. ... | |
doc_23510620 | I'm curious because -2 ** 2 is invalid, which I would expect to be either -1 * Math.pow(2, 2) or Math.pow(-2, 2) but not neither
We're currently writing many math equations using JavaScript, and I'm wondering if there is anything to worry about with regards to using -t for example.
Does this always perform -1 * t, reg... | |
doc_23510621 | Here's how I select the top 5 scores, ranked first by score and second by time if score is equal:
public Cursor gethmLeaderboard(SQLiteDatabase db){
String[] columns = {TableInfo.LB_RANK, TableInfo.LB_SCORE, TableInfo.LB_TIME};
Cursor c = db.query(TableInfo.TABLE_HM, null, null, null, null, null, TableIn... | |
doc_23510622 | $file = ("C:\Users\THINKPAD\Downloads\my_file_name.png");
$filetype=filetype($file);
$filename=basename($file);
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$filename);
header('Content-Transfer-Encoding: binary');
he... | |
doc_23510623 | Here is my formdata that I need to send to backend.
{
education: {
name: "naziv edukacije ovde celavi",
company: 1,
app: 1,
category: 1
},
slides: [
{
serial_num: 1,
text: "test slajda",
image: File
},
{
serial_num: 2,
text: "text slajda 2",
im... | |
doc_23510624 | extension FacebookLoginViewController: FBSDKLoginButtonDelegate {
func loginButton(loginButton: FBSDKLoginButton!, didCompleteWithResult result: FBSDKLoginManagerLoginResult!, error: NSError!) {
print("\(error)")
if error == nil && result.isCancelled == false {
//success
}
}
... | |
doc_23510625 | I have an application where the user can upload the video and then via youtube api uploads them to a certain youtube channel. This app is hosted in an amazon host. Great so far!
Due to ssl reasons i have to deploy this app in a different host. So i make an exact instance of my host. But the problem is that i get this e... | |
doc_23510626 | There is any way to start an Activity without selecting anything by default?
A: You should add this to its parent layout
android:focusable="true" android:focusableInTouchMode="true"
| |
doc_23510627 | here's my code
private class CAdapter extends BaseAdapter {
private LayoutInflater mInflater;
private ArrayList<Entity> list;
private Context context;
String Status;
CAdapter(Context context,
ArrayList<Entity> getC) {
this.context = context;
... | |
doc_23510628 | InputStream input = new ByteArrayInputStream(lc.getTable());
For a further processing of the file I need a FileInputStream. But I don't want to save the file on the hard disk first to read it again.
Can this be done or does the file have to be written out first?
A: Not really. Then the further processing is overspeci... | |
doc_23510629 | Is there any additional documentation around this?
| |
doc_23510630 | Do I simply underline both of them like I would a normal primary key? Or am I supposed to write it another way?
| |
doc_23510631 | short a=0;
Console.Write(Marshal.SizeOf(a));
shows 2
But if I see the IL code i see :
/*1*/ IL_0000: ldc.i4.0
/*2*/ IL_0001: stloc.0
/*3*/ IL_0002: ldloc.0
/*4*/ IL_0003: box System.Int16
/*5*/ IL_0008: call System.Runtime.InteropServices.Marshal.SizeOf
/*6*/ IL_000D: c... | |
doc_23510632 | If Target.Address = "$D$16" Then
If Target.Value > 0 Then
Activate
Sheets("6. Local").Rows("54").EntireRow.Hidden = False
End If
End If
If Target.Address = "$D$31" Then
If Target.Value > 0 Then
Activate
Sheets("6. Local").Rows("54").EntireRow.Hidden = False
End If
End If... | |
doc_23510633 | var gdOption = document.createElement("OPTION");
for (var i = 0; i < document.getElementById("ListBox_AllItems").length; i++) {
if (document.getElementById("ListBox_AllItems").options[i].selected == true) {
gdOption.text = document.getElementById("ListBox_AllItems").option... | |
doc_23510634 | The hardware gets upgraded to a Windows 10 IoT Enterprise based system.
I did not find which .NET version ships with the operating system.
Is it a good idea to use an older .NET version like 4.5 or should I target a newer version?
| |
doc_23510635 | When a user signs up to my membership, on success of account creation I have a database field 'first_visit' set to 1.
They then get taken to a welcome page. On that welcome page, I have some straight forward code that detects if that database 'first visit' flag is 1. If it is, a php $first_visit variable is set true on... | |
doc_23510636 | >my message
>>forwarded message1
>>>forwarded message1.2
>>forwarded message2
But I don't know maximum depth of such forward messages, so I cannot just create prototypes for each situation.
For now I use Loader component to load component recursively, but there is 2 bugs. Firstly, it is very slow, so if I had 100 mess... | |
doc_23510637 | Columns in table_a and& table_b are different.
How to use a trigger to complete?
| |
doc_23510638 | how do I code (I am using php for mysql insert)
to remove all spaces and replace space with "-" (trying to change it to "weburl format" ie removing spaces)
Thanks
A: Here's the method I use to santize strings for SEF urls:
$slug = trim(strtolower($value));
$slug = preg_replace('/[^a-z0-9 _-]/', '', $slug);
... | |
doc_23510639 |
A: This is done at build time, you'll find the auto-generated .g.cs files back in the obj\Debug directory of your project. Not exactly the kind of code you'd want to write, it is only correct code, not pretty code. Typical for code generators. But sure, it can be helpful to study it and see how XAML declarations ge... | |
doc_23510640 | test.h
#ifndef TEST_H
#define TEST_H
void test();
#endif
test.c
#include "test.h"
#include <stdio.h>
void test() {
printf("Hello from C!")
}
main.go
package main
// #include "test.h"
import "C"
import "fmt"
func main() {
C.test()
}
Imagine I have much more C code. This C code takes a while to compile. ... | |
doc_23510641 |
*
*http://tablesorter.com/docs/
*http://www.pengoworks.com/workshop/jquery/tablesorter/tablesorter.htm
I have a pretty simple question. In the mod functionality, how can I display the total visible row count above the table? I understand it will require a textbox to display the result, but how do I get that value? ... | |
doc_23510642 | class MyClass:
def __init__(self, *args):
self.Input = args
def __add__(self, Other):
Output = MyClass()
Output.Input = self.Input + Other.Input
return Output
def __str__(self):
Output = ""
for Item in self.Input:
Output += Item
Output += " "
retur... | |
doc_23510643 | (As in, not for individual nodes, but for the whole graph for comparing nodes, using Freeman's method for doing this).
I need to compare a number of different graphs and I wish to use four different centrality measures for comparing them:
*
*Closeness
*Betweenness
*Degree
*Eigenvector
Currently networkx doesn't... | |
doc_23510644 | Can you help me?
A: I got it, thanks anyways. I hope this information could help someone else
.centered {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
| |
doc_23510645 | <div id ="element">
<span>Hey</span>
<div>
<span>What up?</spa>
</div>
Yeah more text here.
</div>
How can I get all of the text in the note and it's descendants in a single text line with a space between each new child? I am looking for.
'Hey What up? Yeah more text here.'
I tried:
var text ... | |
doc_23510646 | I tried to put a viewPager in a fragment and write the code on OnCreatedView but it gives me error!!!
I tried this one but the fragments goes for every fragment in the activity!
pageradapter.kt
class pagerAdapter(fm:FragmentManager):FragmentStatePagerAdapter(fm){
override fun getItem(position: Int): Fragment? {
r... | |
doc_23510647 | So I have a function that is triggered on change that will "change" other drop downs based on a class selector (notice "drop downS", there could be more than one). This proxy change does not trigger the function and so fails. How can I get it to work?
Code
$(document).ready(function () {
var activeDropBox = null;
... | |
doc_23510648 | X=[[x for x in range(y)] for y in range(3)]
but this code does not work
X=[x for x in range(y) for y in range(3)]
What difference it makes when list is used instead of direct loop. Generally for multiple loops it works from left to right. in this case the loops are working from right to left so we able to use y befor... | |
doc_23510649 |
A: extends your pagerAdapter with FragmentStatePagerAdapter instead of FragmentPagerAdapter . As documentation: FragmentPagerAdapter load all fragment at once and if the fragment load then it's obvious that api's also call.
| |
doc_23510650 | I seen some example like here and here but they are using their own buttons to turn on or off flash, here I want to use the default one by enabling it.
Any suggestions would be appreciated.
A: You need to set the camera's auto-exposure mode to one of the flash-using ones; generally that's either AE_MODE_ON_AUTO_FLASH ... | |
doc_23510651 | I've checked the data I'm pulling in and it is the correct name. Currently the issue may be that I'm passing it in as a string. However, without this it returns an error : 'Splitter' object has no attribute 'endswith'
Please see the error and my code below. Thanks for your help!
Code
Models.py
Error Message
OSError at ... | |
doc_23510652 | {
"apiUrl": "https://localhost:3001/",
"externalUrl": "https://localhost:3002/"
}
The desired outcome
I can build the web app once and deploy it anywhere, updating the config values at deploy time e.g. for dev apiUrl should be https://localhost:4001/, in prod apiUrl should be https://localhost:5001/.
The config sh... | |
doc_23510653 | I am trying to achieve a blur around the margins of a custom shaped figure which is actually an image with transparency around that figure? I keep getting this error each time I use the blur() function : java.lang.RuntimeException: vector::_M_fill_insert, still I used cvSmooth but it just blurs the entire image... so... | |
doc_23510654 | Please, note that I have strong Java background ( this affects my style of thinking and the architecture ).
*
*How to prevent SQL injection in SailsJS?
Basically, I have:
User.query(query, function(err, result) {
if (err)
return next(err);
//
res.json({ data : stepsCount });
});
But where/how should I put ... | |
doc_23510655 | Here is my code:
public function loginAction()
{
$this->layout('layout/login-layout.phtml');
$login_error = false;
$loginForm = new LoginForm();
$form_elements = json_encode($loginForm->form_elements);
if ($this->request->isPost()) {
$post = $this->request->getPost();
$loginForm->set... | |
doc_23510656 | def mag(x):
return math.sqrt(sum(i**2 for i in x))
The above works, but I cannot believe that I must specify such a trivial and core function myself.
A: Fastest way I found is via inner1d. Here's how it compares to other numpy methods:
import numpy as np
from numpy.core.umath_tests import inner1d
V = np.random.... | |
doc_23510657 | "Error creating bean with name 'entityManagerFactory' Invocation of init method failed; nested exception is org.hibernate.AnnotationException: Unable to map collection com.model.User.roles"
This is my role class:
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Genera... | |
doc_23510658 | man is the name of the variable that I used to load the obj in threejs using OBJLoader.
function render(time)
{
let valueOfSlider = document.getElementById('mySlider').value
scene.remove(man)
if (valueOfSlider == 1){
console.log("I want arrayMin to be set")
m... | |
doc_23510659 | FILETIME, LUID, and LUID_AND_ATTRIBUTES structs declared in Windows header as follows:
typedef struct FILETIME {
DWORD dwLowDateTime;
DWORD dwHighDateTime;
}
typedef struct LUID {
ULONG LowPart;
LONG HighPart;
}
typedef struct LUID_AND_ATTRIBUTES {
LUID Luid;
DWORD Attr... | |
doc_23510660 |
$(document).ready(function() {
$('.all-product-cart').click(function() {
$('button.btn.an_productattributes-add-to-cart-btn.js-an_productattributes-add-to-cart').each(function() {
var likeElement = $(this);
likeElement.css("background-color", "yellow");
});
});
});
A: Not su... | |
doc_23510661 | I was reading on the internet about EOF but anything seems to work for me.
Thank you in advance and best Regards.
#!/usr/bin/perl
print "Dime tus numeros\n";
@numb =<STDIN>;
$cua = 0;
$count = 0;
$array = "@numb";
$max = @numb; #tamaño array
$joined = join('',@numb); #metemos array en sacalar juntandolo sin espac... | |
doc_23510662 | It tells me to Insert '<#LocalizedStringKey#>, ' to fix this but I'm not sure why it's needed or what I should put in as the Localized String Key.
var body: some View {
NavigationView{
if #available(iOS 14.0, *) {
List{
ForEach(result) { (log: Expense... | |
doc_23510663 | The issue I have run into I have to make 2 spinners one to select an upload category and another to select a client, I am in testing phase with this now, the problem is my Spinner doesnt populate with the JSON data at all the json data is stored in a ASP file if that matters
I have only been coding for about 2 weeks so... | |
doc_23510664 | list1 = [[1, 2],
[3, 4],
[5, 6],
[7, 8]]
list2 = [10, 11, 12, 13]
What is the best way to change list1 so it becomes the following list in python?
[[1, 2, 10],
[3, 4, 11],
[5, 6, 12],
[7, 8, 13]]
A: You can use zip:
[x + [y] for x, y in zip(list1, list2)]
# [[1, 2, 10], [3, 4, 11], [5, ... | |
doc_23510665 | CASE
WHEN [DATA 1] = 1 THEN ('A')
WHEN [DATA 1] = 2 THEN ('B')
WHEN [DATA 1] = 2 THEN ('C')
ELSE ('HELP')
END
WHEN [DATA 1] = 2 THEN I would be ok with the value Being B or C. I am comparing this to another Data Item that contains the A,B,C value. When [DATA 1] = 2 and has value C populated it shows on the exception... | |
doc_23510666 |
Multipass login is for store owners who have a separate website and a Shopify store. It redirects users from the website to the Shopify store and seamlessly logs them in with the same email address they used to sign up for the original website. If no account with that email address exists yet, one is created. There is... | |
doc_23510667 | I am using Alarm Manager to make my widget update nay time i want (if to sue XML its only once in 30 min) so i made a pending intent and wrote it like in the examples that i found but , its updates only once when i compile the program.
Here is mu code:
@Override
public void onUpdate(Context context, AppWidgetManage... | |
doc_23510668 | Once this done, he then asked me to import some existing Git repository into the actual server. Once he copied the folder, I discovered that the files where some .repo folder, and in it i had some other folders or documents : branches (folder), config (document), description (d), HEAD (d), hooks (f), info (f), objects ... | |
doc_23510669 | This behavior was observed in gcc from msys2 11.2.0
However, the result was as expected when compiled from and run in Ubuntu gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
Is this behavior undefined in C? What is causing the main problem here?
Test Case: compile and run by giving a argument
Eg: gcc main.c -o main.exe <br> .... | |
doc_23510670 | If anyone has any links to some good explicit tutorials please post them down, or maybe you can give me a few short instructions on how to start.
I have used MySQL and MsSQL, and connected with both of them, but embedded databases are very different as far as I can see.
A: Take a look at this:
*
*Interbase and Fir... | |
doc_23510671 | public function testAdd(): void
{
$this->enableCsrfToken();
$this->enableSecurityToken();
$user = ['username'=>'jone','email'=>'pitocms@yahoo.com', 'password'=>'123'];
$this->post('users/add',$user);
$this->assertRedirect('/users');
$count = $this->Users->find('a... | |
doc_23510672 | process.nextTick(function() { throw err; });
^
TypeError: Cannot read property 'forEach' of undefined
at C:\Users\Forrest\Desktop\loc8r\app_api\controllers\locations.js:39:10
"Loc" is the name of my model, and my controller looks like this
module.exports.locationsListByDistan... | |
doc_23510673 | <Workspace name="RealTimeRiskUSD_UA" path="C:\workspace" IsAdmin="false" />
This is what i tried.
echo off
set path1="<Workspace "
set name="name="RealTimeRiskUSD_UA""
set path2="path="C:\workspace" IsAdmin="false" />"
set fullpath=%path1%%name%%path2%
echo %path1%
echo %name%
echo %path2%
echo %fullpath%
I also tri... | |
doc_23510674 | This is a stripped down version of a function I have which iterates over a date range and assigns a unique integer to each...
When working with large datasets, running this several times over different date ranges, I'm getting a fatal error, assigning too much memory to the script and it dies in this loop...
Fatal e... | |
doc_23510675 | Thank you in advance!
| |
doc_23510676 | Here's code
private boolean getText(String url, String name) throws IOException {
if(url!=null){
FileWriter fstream = new FileWriter(PATH+"/"+name+".txt");
BufferedWriter out = new BufferedWriter(fstream);
URL _url = new URL(url);
int code = ((HttpURLConnection) _url.openConnection(... | |
doc_23510677 | Unfortunately it just puts the date out in the file and the other values directly in the shell, like you command this with an echo
activemq
aomaap-report
aomaap-stats
5.14.1
5.14.1.rar
1.1.2
1.1.2.war
2.1.1
2.1.1.war
intil10377.echbruedom.local
the date is shown im my *.csv file:
Tue Jul 30 10:44:44 CEST 2019
~
~
~
~
... | |
doc_23510678 | So I have somthng like:
gcc <...other options...> -L ./some/path -l somelibrary
When libsomelibrary.so does not exist this gives an error. I want it to continue in this case without linking. Is that possible? - some linker option?
A: You can replace
gcc <...other options...> -L ./some/path -l somelibrary
in Makefile ... | |
doc_23510679 |
let showdown = require("showdown");
let jQuery = require("jquery");
let flowchart = require("flowchart.js");
function decodeLang(text) {
return text
.replace(/¨D/g, '$')
.replace(/¨T/g, '¨')
.trim();
}
let flowchartExt = function () {
let matches = [];
jQuery(document.head... | |
doc_23510680 | ||
doc_23510681 |
I have syslog-ng setup as follows:
You can see the connections established
This is the inputs.conf for the splunk universal forwarder:
But still no data is being received by splunk:
Am I missing something? And how would I go about troubleshooting the issue and fixing it?
| |
doc_23510682 | document.getElementById("myVideo").play();
I want to setup similar functionality with my own custom function that will work with all html elements in the document.
I know I can bind a custom function to a single html element using prototype:
HTMLElement.prototype.myFunction = function() { ... };
However I want to bi... | |
doc_23510683 | public class MyClassConfig : IEntityTypeConfiguration<MyClass>
{
public void Configure(EntityTypeBuilder<MyClass> entity)
{
entity.ToTable(
name: "MyClass_View",
schema: DbContext.Schema);
}
}
In some queries, I do not need all the column... | |
doc_23510684 |
*
*I have a set of databases, which are all build with exactly the same schema
*they all contain disjoint sets of data
I now would like to combine all those separate DBs in a single one. So basically a stupid copy & paste.
However, I currently think of one difficulty, namely that I have to keep the foreign key re... | |
doc_23510685 | -(void) update {
if (_followingEnabled == YES || _isLeader == YES) {
switch (currentDirection) {
case up:
self.position = CGPointMake(self.position.x, self.position.y + speed);
// making a line of characters
if (self.position.x < _idealX && _isLeader == NO) {
self.position = CG... | |
doc_23510686 | $response = file_get_contents($url . $guid . $api_key);
$response = json_decode($api_user);
But sometimes the API is not available, and the scrip throws errors. How can I validate to check if the request was successful?
I have tried:
if($response = json_decode(file_get_contents($url . $guid . $api_key))) {
// succes... | |
doc_23510687 | dados <- data.frame(a = c("A", "B", "C"), b = c(1,2,3))
new_record <- data.frame(a = "G", b = 99)
# replace row
dados[2, ] <- new_record[1, ]
This doesn't work. What's the easiest way to make it work?
A: If you want to / have to keep the column a as factor, you can adjust the factor levels first and then create the ... | |
doc_23510688 | Is there a way to do that?, If there's no, what can I do?
A: You can use an Object[] to do this. But please don't. If you feel that you need to mix different types in a single array, maybe it's time to reconsider your design (here's an idea: convert the Strings to Integers or even ints before storing them). It simply ... | |
doc_23510689 | while (!Console.KeyAvailable){//do stuff}
It works, but it echos the key that was pressed back to the prompt. Is there a better method?
edit:
To clarify more, the loop runs and if hit the letter j the loop ends and the program exits. However, I get the following output at the prompt:
C:\>j
A: If you want to exit fr... | |
doc_23510690 | elasticsearch create search query
first, search field is keyword type
data
"hits" : [
{
"_index" : "search_event",
"_type" : "_doc",
"_score" : 5.179434,
"_source" : {
"search_keyword" : [
{
"search" : "or",
"keyword" : "developer",... | |
doc_23510691 | ERROR: type should be string, got "https://projecteuler.net/problem=3\nProblem:\nThe prime factors of 13195 are 5, 7, 13 and 29.\nWhat is the largest prime factor of the number 600851475143?\nBecause this is a puzzle, I would prefer not to use canned Ruby methods. So here it goes...\nCurrent Logic:\nnum is the number we’re looking for prime factors of.\ncandidate is a potential prime factor\nsqrt is the square root of num \nuntil candidate >= sqrt\n\nI borrowed this idea from Sieves of Eratosthenes for finding prime numbers, where the algorithm checks for divisibility of every number up to the square root of num. candidate is the number to test if num has a divisor. \nif num % candidate == 0\n...\nend\n\nThe goal is to check if num is divisible by anything (has factors). \nIf num is not divisible by candidate, then candidate will increment by 1 until the until statement is true or until num is divisible by candidate.\nIf num is divisible by candidate, then we know candidate is prime and it gets inserted into prime_factor. Then recursion happens to test the newly defined num.\nprime_factors << num\n\nIf the until loop is true, then that num does NOT have a divisor and therefore is prime. As a result, it gets inserted into prime_factors.\nIssue:\nThe problem is not that it's timing out but rather that it's giving the wrong answer. It appears that my code loops more than needed. I added some logging to it. I am not sure why but I think it has something to do with the recursion piece. Admittedly, I never use recursion in my code and wanted to use it to expand my skill set. So recursion in general is fuzzy to me conceptually speaking. Any reading would be helpful too.\nWhat should happen:\nprime_factors = [2,2,19]\nprime_factors.last = 19 \nWhat actual happens:\nprime_factors = [2,2,19,19,38]\nprime_factors.last = 38\nThe whole code:\ndef largest_prime_factor(num,prime_factors)\n puts \"beg fx: num: #{num}, prime_factors: #{prime_factors}\n candidate = 2\n sqrt = Math.sqrt(num)\n loop_count = 0\n until candidate >= sqrt\n if num % candidate == 0\n num = num / candidate\n prime_factors << candidate\n largest_prime_factor(num,prime_factors)\n end\n candidate += 1\n loop_count +=1\n end\n puts \"outside loop: candidate >= sqrt is #{candidate >= sqrt} num: #{num}, prime_factors: #{prime_factors}, candidate: #{candidate}, sqrt: #{sqrt}, loop: #{loop_count}\" \n gets\n prime_factors << num\n prime_factors.last\nend \n\n\nA: So it looks like, as you have suggested, the issue is the recursion logic.\nJust because you call a function recursively doesn't mean that the \"parent\" stops working - he just sits and waits for the \"child\" to finish, and then keeps going. This is where this \"over looping\" is happening. The code is actually not over looping but rather, finishing up.\nYou can see this in your puts statement. Notice, after the loop stops, sqrt increases because script now running the parent code, not the after the recursive piece (child) finishes. \nFor the fix, I did 2 things:\n1. Create a Boolean that indicates that the code block has gone through recursion. If so, run this code, else... run something else.\n2. If candidate is not 2, then increment by 2. This skips testing all even numbers except for 2. There is no need to test for other even numbers since it's not a prime.\ndef largest_prime_factor(num,prime_factors,recursive)\n candidate = 2\n until candidate >= Math.sqrt(num)\n recursive = false\n if num % candidate == 0\n num = num / candidate\n recursive = true\n prime_factors << candidate\n largest_prime_factor(num,prime_factors,recursive)\n end\n break if recursive\n candidate == 2 ? candidate += 1 : candidate += 2\n end\n prime_factors << num unless recursive\n prime_factors.last\nend\n\n" | |
doc_23510692 | This is the code to convert image to base64 string
imgToBase64 (url, callback) {
if (!window.FileReader) {
callback(null);
return;
}
const xhr = new XMLHttpRequest();
xhr.responseType = 'blob';
xhr.onload = function () {
const reader = new File... | |
doc_23510693 | var birthday = "";
$('#birthday').change(function () {
var selectedDay = $(this).find(":selected").text();
alert(selectedDay);
birthday = selectedDay + "-";
$("#birthdaytext" ).text(birthday);
})
I want to have a div with the selected date in this div, eg 03-02-1970.
How can I make this jquery that the text date is on... | |
doc_23510694 | I have two jars one that contains same package which is org.apache.axis. I am putting one jar in <Jboss-home>/server/default/lib & another jar in <my-app-war>WEB-INF/lib.
It is required to put both jars in the class path. No way to remove one of the jar. So I need to keep both jars. & It is giving me following error
ja... | |
doc_23510695 |
.TheDiv {
background-color: orange;
height: 100px;
width: 200px;
}
.TheLabel {
background-color: green;
position: relative;
left: 30px;
}
<div class="TheDiv">
<label class="TheLabel">See this label is going past the div</label><br>
<label class="TheLabel">See this label is going past the ... | |
doc_23510696 | Hey, I followed every step of the lecture but couldn´t get the bars filled with the height correspondly. Even when I change the height attribute by hand, it doesn´t shows the change on the page
ChartBar.js
Child component of charts
import React from "react";
import "./ChartBars.css";
const ChartBars = (props) => {
... | |
doc_23510697 | Working in Salesforce Marketing Cloud, I'm trying to build a sample list that I can setup to update automatically so the records I'm testing against are never stale. I only need one example from each account to do my testing. Since I want to make sure the record isn't stale, I want to select the most recent record assi... | |
doc_23510698 | import tensorflow
print(tensorflow.version)
print("\n")
print(tensorflow.path)
I expect to get the exact tensorflow's path. But I got a list, containing three paths, I want to know which one should I choose.
The output is shown as below:
1.15.2
['/tensorflow-1.15.2/python3.6/tensorflow_core/python/keras/api/_v1', ... | |
doc_23510699 | public class TestLeaksOnFinish extends Activity
{
static int ctr = 0;
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView t = new TextView(this);
t.setText("Hello World! "+ctr++);
setContentView(t);
}
}
When I run this multipl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.