problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
UICollectionView with autosizing cells incorrectly positions supplementary view : <p>I am using a UICollectionView with a Flow Layout and trying to get the collectionView to size the cells appropriately according to AutoLayout constraints.</p>
<p>While the cells work as intended, I am running in to issues with the layout of any supplementary views that I add to the CollectionView.</p>
<p>Specifically, the supplementaryView will be in the wrong position (i.e., the y origin is incorrect) on initial layout, before 'correcting' itself after I scroll.</p>
<p><a href="https://i.stack.imgur.com/zkS1T.png" rel="noreferrer"><img src="https://i.stack.imgur.com/zkS1T.png" alt="enter image description here"></a></p>
<p>For reference, here is how I am configuring my cell sizing:</p>
<p><strong>1. Set the collectionViewLayout's estimated item size</strong></p>
<pre><code>let collectionView: UICollectionView = {
let layout = UICollectionViewFlowLayout()
layout.estimatedItemSize = CGSizeMake(375, 50.0)
layout.minimumInteritemSpacing = 0.0
layout.minimumLineSpacing = 0.0
let view = UICollectionView(frame: CGRectZero, collectionViewLayout: layout)
view.backgroundColor = UIColor.whiteColor()
view.alwaysBounceVertical = true
return view
}()
</code></pre>
<p><strong>2. Use subclasses of AutoLayoutCollectionViewCell</strong></p>
<pre><code>class AutoLayoutCollectionViewCell: UICollectionViewCell {
override func preferredLayoutAttributesFittingAttributes(layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
layoutIfNeeded()
layoutAttributes.bounds.size.height = systemLayoutSizeFittingSize(UILayoutFittingCompressedSize).height
return layoutAttributes
}
}
</code></pre>
<p>Note that at this point, everything works as intended.</p>
<p>The next step is where we fail.</p>
<p><strong>3. Provide a reference size for a header</strong></p>
<pre><code>func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
return CGSizeMake(CGRectGetWidth(collectionView.frame), 30.0)
</code></pre>
<p>}</p>
<p>My question is: Why does this happen? How can I get this to correct? How am I supposed to handle supplementary views within a collectionView that self-sizes its cells??</p>
| 0debug
|
static void property_get_tm(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
TMProperty *prop = opaque;
Error *err = NULL;
struct tm value;
prop->get(obj, &value, &err);
if (err) {
goto out;
}
visit_start_struct(v, name, NULL, 0, &err);
if (err) {
goto out;
}
visit_type_int32(v, "tm_year", &value.tm_year, &err);
if (err) {
goto out_end;
}
visit_type_int32(v, "tm_mon", &value.tm_mon, &err);
if (err) {
goto out_end;
}
visit_type_int32(v, "tm_mday", &value.tm_mday, &err);
if (err) {
goto out_end;
}
visit_type_int32(v, "tm_hour", &value.tm_hour, &err);
if (err) {
goto out_end;
}
visit_type_int32(v, "tm_min", &value.tm_min, &err);
if (err) {
goto out_end;
}
visit_type_int32(v, "tm_sec", &value.tm_sec, &err);
if (err) {
goto out_end;
}
out_end:
error_propagate(errp, err);
err = NULL;
visit_end_struct(v, errp);
out:
error_propagate(errp, err);
}
| 1threat
|
$_SERVER['HTTP_REFERER'] and RewriteCond %{HTTP_REFERER} : Some problem.
.htaccess:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^example\.com
RewriteRule ^(.*)$ http://example.com/$1 [R=301,L]
RewriteRule ^page([0-9]+).html$ index.php?page=$1
RewriteRule ^p([0-9]+)-([a-zA-Z0-9_]+).html$ index.php?id_post=$1&title_post=$2
RewriteRule ^([a-zA-Z0-9_\-]+)/page([0-9]+).html$ index.php?mpoint=$1&page=$2 [L]
RewriteRule ^([a-zA-Z0-9_\-]+).html$ index.php?mpoint=$1
RewriteRule ^.*.html$ index.php?mpoint=$1
RewriteCond %{HTTP_REFERER} ^www.example111.com$ [NC,OR]
RewriteCond %{HTTP_REFERER} ^example222.ml$
RewriteRule .* – [F]
index.php
echo $_SERVER['HTTP_REFERER'];
result: http://www.example111.com/xxxx/yyy.html
**Why RewriteCond dont work?**
| 0debug
|
static void qemu_chr_fe_write_log(CharDriverState *s,
const uint8_t *buf, size_t len)
{
size_t done = 0;
ssize_t ret;
if (s->logfd < 0) {
return;
}
while (done < len) {
do {
ret = write(s->logfd, buf + done, len - done);
if (ret == -1 && errno == EAGAIN) {
g_usleep(100);
}
} while (ret == -1 && errno == EAGAIN);
if (ret <= 0) {
return;
}
done += ret;
}
}
| 1threat
|
How to perfect forward a member variable : <p>Consider the following code:</p>
<pre class="lang-cpp prettyprint-override"><code>template<typename T> void foo(T&& some_struct)
{
bar(std::forward</* what to put here? */>(some_struct.member));
}
</code></pre>
<p>In the case of forwarding the whole struct I would do <code>std::forward<T>(some_struct)</code>. But how do I get the correct type when forwarding a member?</p>
<p>One idea I had was using <code>decltype(some_struct.member)</code>, but that seems to always yield the base type of that member (as defined in the struct definition).</p>
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
int bdrv_truncate(BlockDriverState *bs, int64_t offset)
{
BlockDriver *drv = bs->drv;
int ret;
if (!drv)
return -ENOMEDIUM;
if (!drv->bdrv_truncate)
return -ENOTSUP;
if (bs->read_only)
return -EACCES;
ret = drv->bdrv_truncate(bs, offset);
if (ret == 0) {
ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);
bdrv_dirty_bitmap_truncate(bs);
bdrv_parent_cb_resize(bs);
}
return ret;
}
| 1threat
|
static void vtd_init(IntelIOMMUState *s)
{
memset(s->csr, 0, DMAR_REG_SIZE);
memset(s->wmask, 0, DMAR_REG_SIZE);
memset(s->w1cmask, 0, DMAR_REG_SIZE);
memset(s->womask, 0, DMAR_REG_SIZE);
s->iommu_ops.translate = vtd_iommu_translate;
s->root = 0;
s->root_extended = false;
s->dmar_enabled = false;
s->iq_head = 0;
s->iq_tail = 0;
s->iq = 0;
s->iq_size = 0;
s->qi_enabled = false;
s->iq_last_desc_type = VTD_INV_DESC_NONE;
s->next_frcd_reg = 0;
s->cap = VTD_CAP_FRO | VTD_CAP_NFR | VTD_CAP_ND | VTD_CAP_MGAW |
VTD_CAP_SAGAW | VTD_CAP_MAMV | VTD_CAP_PSI;
s->ecap = VTD_ECAP_QI | VTD_ECAP_IRO;
vtd_reset_context_cache(s);
vtd_reset_iotlb(s);
vtd_define_long(s, DMAR_VER_REG, 0x10UL, 0, 0);
vtd_define_quad(s, DMAR_CAP_REG, s->cap, 0, 0);
vtd_define_quad(s, DMAR_ECAP_REG, s->ecap, 0, 0);
vtd_define_long(s, DMAR_GCMD_REG, 0, 0xff800000UL, 0);
vtd_define_long_wo(s, DMAR_GCMD_REG, 0xff800000UL);
vtd_define_long(s, DMAR_GSTS_REG, 0, 0, 0);
vtd_define_quad(s, DMAR_RTADDR_REG, 0, 0xfffffffffffff000ULL, 0);
vtd_define_quad(s, DMAR_CCMD_REG, 0, 0xe0000003ffffffffULL, 0);
vtd_define_quad_wo(s, DMAR_CCMD_REG, 0x3ffff0000ULL);
vtd_define_long(s, DMAR_FSTS_REG, 0, 0, 0x11UL);
vtd_define_long(s, DMAR_FECTL_REG, 0x80000000UL, 0x80000000UL, 0);
vtd_define_long(s, DMAR_FEDATA_REG, 0, 0x0000ffffUL, 0);
vtd_define_long(s, DMAR_FEADDR_REG, 0, 0xfffffffcUL, 0);
vtd_define_long(s, DMAR_FEUADDR_REG, 0, 0, 0);
vtd_define_long(s, DMAR_PMEN_REG, 0, 0, 0);
vtd_define_quad(s, DMAR_IQH_REG, 0, 0, 0);
vtd_define_quad(s, DMAR_IQT_REG, 0, 0x7fff0ULL, 0);
vtd_define_quad(s, DMAR_IQA_REG, 0, 0xfffffffffffff007ULL, 0);
vtd_define_long(s, DMAR_ICS_REG, 0, 0, 0x1UL);
vtd_define_long(s, DMAR_IECTL_REG, 0x80000000UL, 0x80000000UL, 0);
vtd_define_long(s, DMAR_IEDATA_REG, 0, 0xffffffffUL, 0);
vtd_define_long(s, DMAR_IEADDR_REG, 0, 0xfffffffcUL, 0);
vtd_define_long(s, DMAR_IEUADDR_REG, 0, 0, 0);
vtd_define_quad(s, DMAR_IOTLB_REG, 0, 0Xb003ffff00000000ULL, 0);
vtd_define_quad(s, DMAR_IVA_REG, 0, 0xfffffffffffff07fULL, 0);
vtd_define_quad_wo(s, DMAR_IVA_REG, 0xfffffffffffff07fULL);
vtd_define_quad(s, DMAR_FRCD_REG_0_0, 0, 0, 0);
vtd_define_quad(s, DMAR_FRCD_REG_0_2, 0, 0, 0x8000000000000000ULL);
}
| 1threat
|
Group Numbers based on Level in sql server database : Hi I have requirement in sql server database where i have to group the data as mentioned below. If the Level is more than 2 then it has to be grouped under level 2 (ex: 1.1.1,1.1.2 are rolled up under 1.1.) and if there isn't any level 2 available then have to create a second level based on the level 3 Numbers (ex: 1.2.1)
Source Required
Column Col1 Col 2
1 1
1.1. 1.1.
1.1.1. 1.1. 1.1.1.
1.1.2. 1.1. 1.1.2.
1.2.1 1.2. 1.2.1
1.3. 1.3.
1.3.1. 1.3. 1.3.1.
1.3.2. 1.3. 1.3.2.
1.4.1. 1.4. 1.4.1..
Thanks
| 0debug
|
How do you train a neural network without an exact answer? : <p>Most neural networks use backpropagation to learn, but from how I've understood it you need an exact answer to what the outputs should be for this to work. What I want to do is to learn a walker bot to walk, and have a score or fitness variable to evaluate it. Any ideas on how you could do this in for example python or keras?</p>
| 0debug
|
static UserDefTwo *nested_struct_create(void)
{
UserDefTwo *udnp = g_malloc0(sizeof(*udnp));
udnp->string0 = strdup("test_string0");
udnp->dict1 = g_malloc0(sizeof(*udnp->dict1));
udnp->dict1->string1 = strdup("test_string1");
udnp->dict1->dict2 = g_malloc0(sizeof(*udnp->dict1->dict2));
udnp->dict1->dict2->userdef = g_new0(UserDefOne, 1);
udnp->dict1->dict2->userdef->base = g_new0(UserDefZero, 1);
udnp->dict1->dict2->userdef->base->integer = 42;
udnp->dict1->dict2->userdef->string = strdup("test_string");
udnp->dict1->dict2->string = strdup("test_string2");
udnp->dict1->dict3 = g_malloc0(sizeof(*udnp->dict1->dict3));
udnp->dict1->has_dict3 = true;
udnp->dict1->dict3->userdef = g_new0(UserDefOne, 1);
udnp->dict1->dict3->userdef->base = g_new0(UserDefZero, 1);
udnp->dict1->dict3->userdef->base->integer = 43;
udnp->dict1->dict3->userdef->string = strdup("test_string");
udnp->dict1->dict3->string = strdup("test_string3");
return udnp;
}
| 1threat
|
Different Screen Size : <p>Hey guys i just wanna ask When ever we display a background picture in our activity we placed the picture in the drawable folder with sub different folder like </p>
<pre><code>drawable layout_hdpi or layout_mdpi or layout_ldpi or layout_xhdpi
</code></pre>
<p>and there is a specific density and dimension for each folder so that it can support multiple devices etc .</p>
<p>i want to ask that do i need to modify my picture for each folder like if my picture dimension is 3000*3000</p>
<p>first i have to modify it to 720*1280 for xhdpi and then put it in layout_xhdpi folder then i modify it for hdpi i.e 400*800 dimension and so on ..
It will take much time to do .Is There is any other easy method
Thanks in Advance !!</p>
| 0debug
|
Date Convertion : Im getting this type of data in DateandTime Column in SQl.
1803301611.1803301611
and i have to convert this data in a date format.
Anyone please help me out in this.
The DateandTime Column date type is Varchar(5)
| 0debug
|
How do i save the values from a huffman codification : im doing a huffman compression in c++ using opencv, i already have the codes for the tones of grey, but im confused about what to do with it, is there a way to replace the values in the image? do I have to create other mat?
ps. My huffman codes are strings, do i need to change them?
| 0debug
|
void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
{
if (min_size < *size)
return ptr;
min_size = FFMAX(min_size + min_size / 16 + 32, min_size);
ptr = av_realloc(ptr, min_size);
if (!ptr)
min_size = 0;
*size = min_size;
return ptr;
}
| 1threat
|
How floating-point convert to integer with truncate? : <pre><code>int a = atof("4.60") * 100;
int b = atof("6.60") * 100;
printf("a:%d",a); //<==== here print a:459
printf("b:%d",b); //<==== here print b:660
</code></pre>
<p>In IEEE 754, 4.60 is 4.599999999... and 6.60 is 6.5999999...
I expect print b will show 659 too.
How does the truncate work? </p>
| 0debug
|
Scroll div next to other divs : <p>I'm having a lay-out like this:</p>
<p><a href="https://i.stack.imgur.com/Ix1v7.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Ix1v7.png" alt="enter image description here"></a></p>
<p>The left column should scroll down (till the next category) when scroling to bottom. </p>
<p>My HTML looks like this:</p>
<pre><code> <div class="wrapper gray-bg">
<div class="centered">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-5 col-lg-4 information group">
<h1>Glas</h1>
<hr>
<p class="info">
</p>
<p>Wil je een maximale <strong>lichtinval</strong> en maximale <strong>isolatie</strong>, maar hou je ook van een <strong>strak design</strong>?&nbsp;Kies dan voor onze vlakke lichtkoepels met dubbelwandig of 3-dubbel glas. Ze zien er niet alleen geweldig uit, maar scoren op alle vlakken ongelooflijk goed.</p>
<p></p>
<div class="buttons">
<a href="" class="button">bekijk referenties</a>
<a href="/nl/professional/contact" class="button gray">Vraag offerte</a>
</div>
</div>
<div class="col col-xs-12 col-sm-12 col-md-7 col-lg-8 product-container flex-row">
<div class="col-xs-12 col-md-12 col-lg-6 flex-container">
<div class="product">
<div class="image" style="background-image: url('https://exmple.com/media/cache/product_thumbnail/uploads/fa5256f2004f96761a87427be6db1e8d2e2fd983.jpeg');">
<span>new</span>
</div>
<h1>exmple iWindow2 ™</h1>
<hr>
<h2>Superisolerende lichtkoepel met 2-wandig glas</h2>
<ul class="findplace">
<li>Scoort erg goed qua isolatie: Ut-waarde 1,0 W/m²K</li>
<li>Strak, eigentijds design</li>
<li>Doorvalveilig</li>
<li>Slanke omkadering, slechts 28 mm</li>
<li>Vaste of opengaande uitvoering</li>
</ul>
<div class="bottom-buttons">
<a href="/nl/professional/product/exmple-iwindow2#prijs" class="col col-xs-3 col-md-6 col-lg-3">
<i class="fa fa-euro"></i>
<p>Prijs</p>
</a>
<a href="/nl/professional/product/exmple-iwindow2#technische_specs" class="col col-xs-3 col-md-6 col-lg-3 custom">
<i class="fa fa-drafting-compass"></i>
<p>Technische specs</p>
</a>
<a href="/nl/professional/product/exmple-iwindow2#brochures" class="col col-xs-3 col-md-6 col-lg-3">
<i class="fa fa-file-text"></i>
<p>Brochures</p>
</a>
<a href="/nl/professional/product/exmple-iwindow2#montage" class="col col-xs-3 col-md-6 col-lg-3">
<i class="fa fa-map"></i>
<p>Montage</p>
</a>
</div>
</div>
</div>
<div class="col-xs-12 col-md-12 col-lg-6 flex-container">
<div class="product">
<div class="image" style="background-image: url('https://exmple.com/media/cache/product_thumbnail/uploads/e2b4180f8d9109c79350817d46e9c184080e8353.jpeg');">
<span>new</span>
</div>
<h1>exmple iWindow3 ™</h1>
<hr>
<h2>Superisolerende lichtkoepel met 3-wandig glas</h2>
<ul class="findplace">
<li>Scoort erg goed qua isolatie: Ut-waarde 0,5 W/m²K</li>
<li>Strak, eigentijds design</li>
<li>Doorvalveilig</li>
<li>Slanke omkadering, slechts 55mm</li>
<li>Vaste of opengaande uitvoering</li>
</ul>
<div class="bottom-buttons">
<a href="/nl/professional/product/exmple-iwindow3#prijs" class="col col-xs-3 col-md-6 col-lg-3">
<i class="fa fa-euro"></i>
<p>Prijs</p>
</a>
<a href="/nl/professional/product/exmple-iwindow3#technische_specs" class="col col-xs-3 col-md-6 col-lg-3 custom">
<i class="fa fa-drafting-compass"></i>
<p>Technische specs</p>
</a>
<a href="/nl/professional/product/exmple-iwindow3#brochures" class="col col-xs-3 col-md-6 col-lg-3">
<i class="fa fa-file-text"></i>
<p>Brochures</p>
</a>
<a href="/nl/professional/product/exmple-iwindow3#montage" class="col col-xs-3 col-md-6 col-lg-3">
<i class="fa fa-map"></i>
<p>Montage</p>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</code></pre>
<p>But I have no idea on how to make sure the left content is scrolling down when the other content on the right is not. I this doable with some javascript code?</p>
<p>Can you help me?</p>
| 0debug
|
Insert line in a specfic line in a file : <p>I have a very simple question but I don't find the answer ...</p>
<p>I have a file (data.txt) it contains </p>
<pre><code>A
B
C
D
E
F
</code></pre>
<p>I just want to make function to insert line where I want in this file.</p>
<p>Like : Insert('Bouh', 3)</p>
<p>Render :</p>
<pre><code>A
B
C
D
Bouh
E
F
</code></pre>
<p>Any idea please ?</p>
| 0debug
|
int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx)
{
int ret;
if ((ret = query_formats(graph, log_ctx)) < 0)
return ret;
pick_formats(graph);
return 0;
}
| 1threat
|
Simple VBA IF statement problem. Only Else is printed : I am in the first steps of learning VBA and I am facing a problem that seems to be huge. I have a simple if statement that only the else value is printed. Please can anyone help me to understand my mistake?
The code is the following:
Sub checkifstatement()
Dim result As String
Dim rng As Range
Set rng = Application.InputBox("Select a range", "Obtain Range Object", Type:=8)
rngoff = rng.Offset(, 1)
For Each c In rng
If c.Value >= 0.5 Then
rngoff = 1
Else
rngoff = "smaller"
End If
Next c
End Sub
Also if after the else I replace the code with the:
Range("B" & c.Row) = "smaller"
it works fine. I cannot understand why I have a problem here.
Regards.
| 0debug
|
matlab data file to pandas DataFrame : <p>Is there a standard way to convert <em>matlab</em> <code>.mat</code> (matlab formated data) files to Panda <code>DataFrame</code>? </p>
<p>I am aware that a workaround is possible by using <code>scipy.io</code> but I am wondering whether there is a straightforward way to do it.</p>
| 0debug
|
Memory Leak in class destructor : I am constructing a Polynomial class in C++. Currently I am reading in input and creating a Polynomial object with a degree and coefficient (double) array.
Ex.
6x^3+7.4x^2-3.0x+9
Polynomial
----------
degree = 3
coefficients[0] = 6
coefficients[1] = 7.4
coefficients[2] = 3.0
coefficients[3] = 9
I am getting an error when I am deleting an instance of my class. I am not sure what the problem is exactly...along with a `SEGFAULT` my error looks like:
Segmentation fault: 11
0x00007ffff71fdfbd in malloc_printerr (ptr=<optimized out>,
str=0x7ffff7304ad8 "free(): invalid next size (fast)", action=<optimized out>) at malloc.c:4983
_int_free (have_lock=0, p=<optimized out>, av=<optimized out>) at malloc.c:3850
__GI___libc_free (mem=<optimized out>) at malloc.c:2960
Please help, thanks!
My default constructor looks like:
/* Constructor for Polynomial */
Polynomial::Polynomial ()
{
degree = 0;
coefficients = new double [1];
coefficients[0] = 0;
}
My destructor looks like:
/* Destructor for Polynomial */
Polynomial::~Polynomial ()
{
delete [] coefficients; <--ERROR HERE
}
My implementation inside my main() looks like this:
vector<Polynomial> Polys;
Polynomial *P1 = new Polynomial();
...
P1->degree = degreeInt;
P1->coefficients[idx] = coefficient;
Polys.push_back(*P1);
delete P1; <-- ERROR HERE
// Pushed Polynomial to Vector, create a new Polynomial object
P1 = new Polynomial();
| 0debug
|
static int rtsp_parse_request(HTTPContext *c)
{
const char *p, *p1, *p2;
char cmd[32];
char url[1024];
char protocol[32];
char line[1024];
int len;
RTSPMessageHeader header1 = { 0 }, *header = &header1;
c->buffer_ptr[0] = '\0';
p = c->buffer;
get_word(cmd, sizeof(cmd), &p);
get_word(url, sizeof(url), &p);
get_word(protocol, sizeof(protocol), &p);
av_strlcpy(c->method, cmd, sizeof(c->method));
av_strlcpy(c->url, url, sizeof(c->url));
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
if (avio_open_dyn_buf(&c->pb) < 0) {
c->pb = NULL;
return -1;
}
if (strcmp(protocol, "RTSP/1.0") != 0) {
rtsp_reply_error(c, RTSP_STATUS_VERSION);
goto the_end;
}
while (*p != '\n' && *p != '\0')
p++;
if (*p == '\n')
p++;
while (*p != '\0') {
p1 = memchr(p, '\n', (char *)c->buffer_ptr - p);
if (!p1)
break;
p2 = p1;
if (p2 > p && p2[-1] == '\r')
p2--;
if (p2 == p)
break;
len = p2 - p;
if (len > sizeof(line) - 1)
len = sizeof(line) - 1;
memcpy(line, p, len);
line[len] = '\0';
ff_rtsp_parse_line(header, line, NULL, NULL);
p = p1 + 1;
}
c->seq = header->seq;
if (!strcmp(cmd, "DESCRIBE"))
rtsp_cmd_describe(c, url);
else if (!strcmp(cmd, "OPTIONS"))
rtsp_cmd_options(c, url);
else if (!strcmp(cmd, "SETUP"))
rtsp_cmd_setup(c, url, header);
else if (!strcmp(cmd, "PLAY"))
rtsp_cmd_play(c, url, header);
else if (!strcmp(cmd, "PAUSE"))
rtsp_cmd_interrupt(c, url, header, 1);
else if (!strcmp(cmd, "TEARDOWN"))
rtsp_cmd_interrupt(c, url, header, 0);
else
rtsp_reply_error(c, RTSP_STATUS_METHOD);
the_end:
len = avio_close_dyn_buf(c->pb, &c->pb_buffer);
c->pb = NULL;
if (len < 0) {
return -1;
}
c->buffer_ptr = c->pb_buffer;
c->buffer_end = c->pb_buffer + len;
c->state = RTSPSTATE_SEND_REPLY;
return 0;
}
| 1threat
|
void tcg_dump_info(FILE *f,
int (*cpu_fprintf)(FILE *f, const char *fmt, ...))
{
TCGContext *s = &tcg_ctx;
int64_t tot;
tot = s->interm_time + s->code_time;
cpu_fprintf(f, "JIT cycles %" PRId64 " (%0.3f s at 2.4 GHz)\n",
tot, tot / 2.4e9);
cpu_fprintf(f, "translated TBs %" PRId64 " (aborted=%" PRId64 " %0.1f%%)\n",
s->tb_count,
s->tb_count1 - s->tb_count,
s->tb_count1 ? (double)(s->tb_count1 - s->tb_count) / s->tb_count1 * 100.0 : 0);
cpu_fprintf(f, "avg ops/TB %0.1f max=%d\n",
s->tb_count ? (double)s->op_count / s->tb_count : 0, s->op_count_max);
cpu_fprintf(f, "deleted ops/TB %0.2f\n",
s->tb_count ?
(double)s->del_op_count / s->tb_count : 0);
cpu_fprintf(f, "avg temps/TB %0.2f max=%d\n",
s->tb_count ?
(double)s->temp_count / s->tb_count : 0,
s->temp_count_max);
cpu_fprintf(f, "cycles/op %0.1f\n",
s->op_count ? (double)tot / s->op_count : 0);
cpu_fprintf(f, "cycles/in byte %0.1f\n",
s->code_in_len ? (double)tot / s->code_in_len : 0);
cpu_fprintf(f, "cycles/out byte %0.1f\n",
s->code_out_len ? (double)tot / s->code_out_len : 0);
if (tot == 0)
tot = 1;
cpu_fprintf(f, " gen_interm time %0.1f%%\n",
(double)s->interm_time / tot * 100.0);
cpu_fprintf(f, " gen_code time %0.1f%%\n",
(double)s->code_time / tot * 100.0);
cpu_fprintf(f, "liveness/code time %0.1f%%\n",
(double)s->la_time / (s->code_time ? s->code_time : 1) * 100.0);
cpu_fprintf(f, "cpu_restore count %" PRId64 "\n",
s->restore_count);
cpu_fprintf(f, " avg cycles %0.1f\n",
s->restore_count ? (double)s->restore_time / s->restore_count : 0);
dump_op_count();
}
| 1threat
|
Create XML Schema in VB : I have VB Script.
In the Function
Private Function generateXMLSchema(ZRouteName) As String
Dim generatedXmlSchema As String ="<Name>tEST 250504</Name>"
Here Name Element is Static.
I want to `ZRouteName` instead of Static Data.
"<Name>"ZRouteName"</Name>"
I am getting Error.: Sysntax Error
Please help to rectify this.
Thanks In Advance
Prat
| 0debug
|
C#: How can I add a list of values into a msql WHERE IN clause : I have a list of values and want to use it in a query but how can I add each value with quotes into mysql where clause.
List <string> customerlist = new List<string>();
sql = SELECT * FROM customerlist WHERE custid IN customerlist
I am getting the error
[![enter image description here][1]][1]
I need to add quotes around them. Can you advice how I can do that please?
[1]: https://i.stack.imgur.com/GpSAM.png
| 0debug
|
static inline int coef_test_compression(int coef)
{
int tmp = coef >> 2;
int res = ff_ctz(tmp);
if (res > 1)
return 1;
else if (res == 1)
return 0;
else if (ff_ctz(tmp >> 1) > 0)
return 0;
else
return 1;
}
| 1threat
|
Ganarate Random Ruby values : I want to generate random name using Ruby code. I tested this Ruby code:
def random_card_holder
Faker::Name.first_name + " " + Faker::Name.last_name
end
But I get validation error. Is this code valid?
| 0debug
|
static void unassign_storage(SCLPDevice *sclp, SCCB *sccb)
{
MemoryRegion *mr = NULL;
AssignStorage *assign_info = (AssignStorage *) sccb;
sclpMemoryHotplugDev *mhd = get_sclp_memory_hotplug_dev();
assert(mhd);
ram_addr_t unassign_addr = (assign_info->rn - 1) * mhd->rzm;
MemoryRegion *sysmem = get_system_memory();
if ((unassign_addr % MEM_SECTION_SIZE == 0) &&
(unassign_addr >= mhd->padded_ram_size)) {
mhd->standby_state_map[(unassign_addr -
mhd->padded_ram_size) / MEM_SECTION_SIZE] = 0;
mr = memory_region_find(sysmem, unassign_addr, 1).mr;
memory_region_unref(mr);
if (mr) {
int i;
int is_removable = 1;
ram_addr_t map_offset = (unassign_addr - mhd->padded_ram_size -
(unassign_addr - mhd->padded_ram_size)
% mhd->standby_subregion_size);
for (i = 0;
i < (mhd->standby_subregion_size / MEM_SECTION_SIZE);
i++) {
if (mhd->standby_state_map[i + map_offset / MEM_SECTION_SIZE]) {
is_removable = 0;
break;
}
}
if (is_removable) {
memory_region_del_subregion(sysmem, mr);
object_unref(OBJECT(mr));
}
}
}
sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_COMPLETION);
}
| 1threat
|
Get id for use as variable data in ajax call JQUERY : I cannot get the id from links calling the same ajax function.
The 30+ links are generated dynamically, as follows:-
<a href="javascript:void(0)" id="105">Item 105</a>
<a href="javascript:void(0)" id="379">Item 379</a>
<a href="javascript:void(0)" id="534">Item 534</a>
etc
This is my latest attempt, after much googling, including http://stackoverflow.com/questions/11687217/variable-data-in-ajax-call-jquery):-
$(this).click(function(){
var $id = $(this).attr('id');
$.ajax({url: "somefile.asp", data: {sellerid: <%=sellerid%>, uid: <%=uid%>, itinid: $id}, success: function(result){
$("#content").html(result);
}});
});
The ajax works fine (but with fixed result) for each link when I test with for example:- var $id = 379;
Grateful for any help! Thanks
| 0debug
|
How to Group by json array by two same key : <p>How to group by based on two json key which is f and b
My json array </p>
<pre><code>var json=[
{ s:'s', f:1, b:1, q:2 },
{ s:'s', f:1, b:1, q:3 },
{ s:'s', f:2, b:1, q:2 },
{ s:'s', f:2, b:1, q:2 },
{ s:'s', f:1, b:2, q:2 },
{ s:'s', f:1, b:2, q:2 },
{ s:'s', f:0, b:1, q:2 },
{ s:'s', f:0, b:1, q:2 },
{ s:'s', f:1, b:0, q:2 },
{ s:'s', f:1, b:0, q:2 },
{ s:'s', f:0, b:0, q:2 },
{ s:'s', f:0, b:0, q:2 },
</code></pre>
<p>];</p>
<p>Expected Output</p>
<pre><code> var op=[
{ s:'s', f:1, b:1, q:5 },
{ s:'s', f:2, b:1, q:4 },
{ s:'s', f:1, b:2, q:4 },
{ s:'s', f:0, b:1, q:4 },
{ s:'s', f:1, b:0, q:4 },
{ s:'s', f:0, b:0, q:4 },
</code></pre>
<p>];</p>
| 0debug
|
this is my mysql query and how to write in codeigniter : SELECT MAX(A.BID),B.* FROM tbl_bid A INNER JOIN wl_customers B ON A.customers_id=B.customers_id
WHERE portfolio_id='16'
| 0debug
|
void do_smbios_option(const char *optarg)
{
#ifdef TARGET_I386
if (smbios_entry_add(optarg) < 0) {
fprintf(stderr, "Wrong smbios provided\n");
exit(1);
}
#endif
}
| 1threat
|
static coroutine_fn void do_co_req(void *opaque)
{
int ret;
Coroutine *co;
SheepdogReqCo *srco = opaque;
int sockfd = srco->sockfd;
SheepdogReq *hdr = srco->hdr;
void *data = srco->data;
unsigned int *wlen = srco->wlen;
unsigned int *rlen = srco->rlen;
co = qemu_coroutine_self();
qemu_aio_set_fd_handler(sockfd, NULL, restart_co_req, co);
ret = send_co_req(sockfd, hdr, data, wlen);
if (ret < 0) {
goto out;
}
qemu_aio_set_fd_handler(sockfd, restart_co_req, NULL, co);
ret = qemu_co_recv(sockfd, hdr, sizeof(*hdr));
if (ret < sizeof(*hdr)) {
error_report("failed to get a rsp, %s", strerror(errno));
ret = -errno;
goto out;
}
if (*rlen > hdr->data_length) {
*rlen = hdr->data_length;
}
if (*rlen) {
ret = qemu_co_recv(sockfd, data, *rlen);
if (ret < *rlen) {
error_report("failed to get the data, %s", strerror(errno));
ret = -errno;
goto out;
}
}
ret = 0;
out:
qemu_aio_set_fd_handler(sockfd, NULL, NULL, NULL);
srco->ret = ret;
srco->finished = true;
}
| 1threat
|
Difference between Spark RDD's take(1) and first() : <p>I used to think that <code>rdd.take(1)</code> and <code>rdd.first()</code> are exactly the same. However I began to wonder if this is really true after my colleague pointed me to <a href="http://spark.apache.org/docs/latest/api/python/pyspark.html#pyspark.RDD" rel="noreferrer">Spark's officiation documentation on RDD</a>:</p>
<blockquote>
<p><strong>first()</strong>: Return the first element in this RDD.</p>
<p><strong>take(num)</strong>: Take the first num elements of the RDD.
It works by first scanning one partition, and use the results from that partition to estimate the number of additional partitions needed to satisfy the limit.</p>
</blockquote>
<p>My questions are:</p>
<ol>
<li>Is the underlying implementation of <code>first()</code> the same as <code>take(1)</code>?</li>
<li>Suppose <code>rdd1</code> and <code>rdd2</code> are constructed from the same csv, can I safely assume that <code>rdd1.take(1)</code> and <code>rdd2.first()</code> will <strong>always</strong> return the same result, i.e., the first row of the csv? What if <code>rdd1</code> and <code>rdd2</code> are partitioned differently? </li>
</ol>
| 0debug
|
Dinamic array don't allocate the same numbers of elements than stack array : <p>I'm trying to create an array of 18 elements of BYTE whit calloc but don't know why calloc only give me back only 8 elements, I did it manually in the stack and the program works.</p>
<pre><code>int arrsize;
BYTE copyrow[18];
arrsize = sizeof(copyrow);
</code></pre>
<p>When i compile here arrsize = to 18, so, evrething is fine.
But when I use calloc:</p>
<pre><code>int arrsize;
BYTE *copyrow;
copyrow = calloc(18, sizeof(BYTE));
arrsize = sizeof(copyrow);
</code></pre>
<p>Now the compiler say arrsize = to 8, so I don't know what's happening here. Need help.</p>
| 0debug
|
What is going wrong with my code? It outputs not even no matter what i do : print "input a number please. "
TestNumber = gets
if TestNumber % 2 == 0
print "The number is even"
else
print "The number is not even"
end
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
how to create int to string like this 50-> "00050" : <p>Hello i am trying to process character arrays.
I want to assign the number 50 as string value "00050". How can I do it ?</p>
<pre><code>enter code here
string strRpc(int NumstrRpcSendLen)
{
int digit = Convert.ToInt32( Math.Floor(Math.Log10(NumstrRpcSendLen + 5) + 1));
int len = 0;
char[] d = new char[5];
string result= null;
while (len<5)
{
if (len<digit)
{
d[len] = '0';
}
else
{
}
len++;
}
return result;
}
</code></pre>
| 0debug
|
void palette8tobgr15(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette)
{
unsigned i;
for(i=0; i<num_pixels; i++)
((uint16_t *)dst)[i] = bswap_16(((uint16_t *)palette)[ src[i] ]);
}
| 1threat
|
static void test_port(int port)
{
struct qhc uhci;
g_assert(port > 0);
qusb_pci_init_one(qs->pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4);
uhci_port_test(&uhci, port - 1, UHCI_PORT_CCS);
}
| 1threat
|
static void patch_instruction(VAPICROMState *s, X86CPU *cpu, target_ulong ip)
{
CPUState *cs = CPU(cpu);
CPUX86State *env = &cpu->env;
VAPICHandlers *handlers;
uint8_t opcode[2];
uint32_t imm32 = 0;
target_ulong current_pc = 0;
target_ulong current_cs_base = 0;
uint32_t current_flags = 0;
if (smp_cpus == 1) {
handlers = &s->rom_state.up;
} else {
handlers = &s->rom_state.mp;
}
if (!kvm_enabled()) {
cpu_get_tb_cpu_state(env, ¤t_pc, ¤t_cs_base,
¤t_flags);
if (use_icount) {
--cs->icount_decr.u16.low;
}
}
pause_all_vcpus();
cpu_memory_rw_debug(cs, ip, opcode, sizeof(opcode), 0);
switch (opcode[0]) {
case 0x89:
patch_byte(cpu, ip, 0x50 + modrm_reg(opcode[1]));
patch_call(s, cpu, ip + 1, handlers->set_tpr);
break;
case 0x8b:
patch_byte(cpu, ip, 0x90);
patch_call(s, cpu, ip + 1, handlers->get_tpr[modrm_reg(opcode[1])]);
break;
case 0xa1:
patch_call(s, cpu, ip, handlers->get_tpr[0]);
break;
case 0xa3:
patch_call(s, cpu, ip, handlers->set_tpr_eax);
break;
case 0xc7:
patch_byte(cpu, ip, 0x68);
cpu_memory_rw_debug(cs, ip + 6, (void *)&imm32, sizeof(imm32), 0);
cpu_memory_rw_debug(cs, ip + 1, (void *)&imm32, sizeof(imm32), 1);
patch_call(s, cpu, ip + 5, handlers->set_tpr);
break;
case 0xff:
patch_byte(cpu, ip, 0x50);
patch_call(s, cpu, ip + 1, handlers->get_tpr_stack);
break;
default:
abort();
}
resume_all_vcpus();
if (!kvm_enabled()) {
tb_lock();
tb_gen_code(cs, current_pc, current_cs_base, current_flags, 1);
cpu_loop_exit_noexc(cs);
}
}
| 1threat
|
what is string.setStr1/2/3(calledString) do ?? and what will return string; return? : <pre><code>TripleString pull()
{
string calledString;
TripleString string;
calledString = randString();
string.setStr1(calledString);
calledString = randString();
string.setStr2(calledString);
calledString = randString();
string.setStr3(calledString);
calledString = randString();
return string;
}
</code></pre>
<p>This method is used to get the random string from randString() and see if it meets the requirement by using string.setStr();</p>
| 0debug
|
why does std::allocator::deallocate require a size? : <p><code>std::allocator</code> is an abstraction over the underlying memory model, which wraps the functionality of calling <code>new</code> and <code>delete</code>. <code>delete</code> doesn't need a size though, but <a href="http://en.cppreference.com/w/cpp/memory/allocator/deallocate" rel="noreferrer">deallocate()</a> <em>requires</em> it. </p>
<blockquote>
<p><strong>void deallocate( T* p, std::size_t n );</strong><br>
"The argument n must be equal to the first argument of the call to
allocate() that originally produced p; otherwise, the behavior is
undefined." </p>
</blockquote>
<p>Why? </p>
<p>Now I either have to make additional calculations before deallocating, or start storing the sizes that I passed to allocate. If I didn't use the allocator I wouldn't have to do this.</p>
| 0debug
|
Simple way to visualize a TensorFlow graph in Jupyter? : <p>The official way to visualize a TensorFlow graph is with TensorBoard, but sometimes I just want a quick look at the graph when I'm working in Jupyter.</p>
<p>Is there a quick solution, ideally based on TensorFlow tools, or standard SciPy packages (like matplotlib), but if necessary based on 3rd party libraries?</p>
| 0debug
|
rdt_free_extradata (PayloadContext *rdt)
{
ff_rm_free_rmstream(rdt->rmst[0]);
if (rdt->rmctx)
av_close_input_stream(rdt->rmctx);
av_freep(&rdt->mlti_data);
av_free(rdt);
}
| 1threat
|
static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val)
{
sh_serial_state *s = opaque;
unsigned char ch;
#ifdef DEBUG_SERIAL
printf("sh_serial: write offs=0x%02x val=0x%02x\n",
offs, val);
#endif
switch(offs) {
case 0x00:
s->smr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0x7b : 0xff);
return;
case 0x04:
s->brr = val;
return;
case 0x08:
s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfa : 0xff);
if (!(val & (1 << 5)))
s->flags |= SH_SERIAL_FLAG_TEND;
if ((s->feat & SH_SERIAL_FEAT_SCIF) && s->txi) {
qemu_set_irq(s->txi, val & (1 << 7));
}
if (!(val & (1 << 6))) {
qemu_set_irq(s->rxi, 0);
}
return;
case 0x0c:
if (s->chr) {
ch = val;
qemu_chr_write(s->chr, &ch, 1);
}
s->dr = val;
s->flags &= ~SH_SERIAL_FLAG_TDE;
return;
#if 0
case 0x14:
ret = 0;
break;
#endif
}
if (s->feat & SH_SERIAL_FEAT_SCIF) {
switch(offs) {
case 0x10:
if (!(val & (1 << 6)))
s->flags &= ~SH_SERIAL_FLAG_TEND;
if (!(val & (1 << 5)))
s->flags &= ~SH_SERIAL_FLAG_TDE;
if (!(val & (1 << 4)))
s->flags &= ~SH_SERIAL_FLAG_BRK;
if (!(val & (1 << 1)))
s->flags &= ~SH_SERIAL_FLAG_RDF;
if (!(val & (1 << 0)))
s->flags &= ~SH_SERIAL_FLAG_DR;
if (!(val & (1 << 1)) || !(val & (1 << 0))) {
if (s->rxi) {
qemu_set_irq(s->rxi, 0);
}
}
return;
case 0x18:
s->fcr = val;
switch ((val >> 6) & 3) {
case 0:
s->rtrg = 1;
break;
case 1:
s->rtrg = 4;
break;
case 2:
s->rtrg = 8;
break;
case 3:
s->rtrg = 14;
break;
}
if (val & (1 << 1)) {
sh_serial_clear_fifo(s);
s->sr &= ~(1 << 1);
}
return;
case 0x20:
s->sptr = val & 0xf3;
return;
case 0x24:
return;
}
}
else {
#if 0
switch(offs) {
case 0x0c:
ret = s->dr;
break;
case 0x10:
ret = 0;
break;
case 0x1c:
ret = s->sptr;
break;
}
#endif
}
fprintf(stderr, "sh_serial: unsupported write to 0x%02x\n", offs);
assert(0);
}
| 1threat
|
remove .php permanently from url : <p>I want to remove .php extension from my url,
so I edited <code>.htaccess</code> to add this code</p>
<pre><code>RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
</code></pre>
<p>And the code works fine but only when I intentionally remove .php from the URL
and I want it to be an automatic process so is it possible?</p>
| 0debug
|
Code build continues after build fails : <p>I'm building a CI/CD pipeline using git, codebuild and elastic beanstalk. </p>
<p>During codebuild execution when build fails due to syntax error of a test case, I see codebuild progress to next stage and ultimatly go on to produce the artifacts. </p>
<p>My understanding was if the build fails, execution should stop. is this a correct behavior ?</p>
<p>Please see the buildspec below.</p>
<pre><code>version: 0.2
phases:
install:
commands:
- echo Installing package.json..
- npm install
- echo Installing Mocha...
- npm install -g mocha
pre_build:
commands:
- echo Installing source NPM placeholder dependencies...
build:
commands:
- echo Build started on `date`
- echo Compiling the Node.js code
- mocha modules/**/tests/*.js
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- modules/*
- node_modules/*
- package.json
- config/*
- server.js
</code></pre>
| 0debug
|
static void v9fs_xattrwalk(void *opaque)
{
int64_t size;
V9fsString name;
ssize_t err = 0;
size_t offset = 7;
int32_t fid, newfid;
V9fsFidState *file_fidp;
V9fsFidState *xattr_fidp = NULL;
V9fsPDU *pdu = opaque;
V9fsState *s = pdu->s;
pdu_unmarshal(pdu, offset, "dds", &fid, &newfid, &name);
trace_v9fs_xattrwalk(pdu->tag, pdu->id, fid, newfid, name.data);
file_fidp = get_fid(pdu, fid);
if (file_fidp == NULL) {
err = -ENOENT;
goto out_nofid;
}
xattr_fidp = alloc_fid(s, newfid);
if (xattr_fidp == NULL) {
err = -EINVAL;
goto out;
}
v9fs_path_copy(&xattr_fidp->path, &file_fidp->path);
if (name.data[0] == 0) {
size = v9fs_co_llistxattr(pdu, &xattr_fidp->path, NULL, 0);
if (size < 0) {
err = size;
clunk_fid(s, xattr_fidp->fid);
goto out;
}
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.copied_len = -1;
if (size) {
xattr_fidp->fs.xattr.value = g_malloc(size);
err = v9fs_co_llistxattr(pdu, &xattr_fidp->path,
xattr_fidp->fs.xattr.value,
xattr_fidp->fs.xattr.len);
if (err < 0) {
clunk_fid(s, xattr_fidp->fid);
goto out;
}
}
offset += pdu_marshal(pdu, offset, "q", size);
err = offset;
} else {
size = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
&name, NULL, 0);
if (size < 0) {
err = size;
clunk_fid(s, xattr_fidp->fid);
goto out;
}
xattr_fidp->fs.xattr.len = size;
xattr_fidp->fid_type = P9_FID_XATTR;
xattr_fidp->fs.xattr.copied_len = -1;
if (size) {
xattr_fidp->fs.xattr.value = g_malloc(size);
err = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
&name, xattr_fidp->fs.xattr.value,
xattr_fidp->fs.xattr.len);
if (err < 0) {
clunk_fid(s, xattr_fidp->fid);
goto out;
}
}
offset += pdu_marshal(pdu, offset, "q", size);
err = offset;
}
trace_v9fs_xattrwalk_return(pdu->tag, pdu->id, size);
out:
put_fid(pdu, file_fidp);
if (xattr_fidp) {
put_fid(pdu, xattr_fidp);
}
out_nofid:
complete_pdu(s, pdu, err);
v9fs_string_free(&name);
}
| 1threat
|
Chart.js 2.0 doughnut tooltip percentages : <p>I have worked with chart.js 1.0 and had my doughnut chart tooltips displaying percentages based on data divided by dataset, but I'm unable to replicate this with chart 2.0.</p>
<p>I have searched high and low and have not found a working solution. I know that it will go under options but everything I've tried has made the pie dysfunctional at best.</p>
<pre><code><html>
<head>
<title>Doughnut Chart</title>
<script src="../dist/Chart.bundle.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<style>
canvas {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
}
</style>
</head>
<body>
<div id="canvas-holder" style="width:75%">
<canvas id="chart-area" />
</div>
<script>
var randomScalingFactor = function() {
return Math.round(Math.random() * 100);
};
var randomColorFactor = function() {
return Math.round(Math.random() * 255);
};
var randomColor = function(opacity) {
return 'rgba(' + randomColorFactor() + ',' + randomColorFactor() + ',' + randomColorFactor() + ',' + (opacity || '.3') + ')';
};
var config = {
type: 'doughnut',
data: {
datasets: [{
data: [
486.5,
501.5,
139.3,
162,
263.7,
],
backgroundColor: [
"#F7464A",
"#46BFBD",
"#FDB45C",
"#949FB1",
"#4D5360",
],
label: 'Expenditures'
}],
labels: [
"Hospitals: $486.5 billion",
"Physicians & Professional Services: $501.5 billion",
"Long Term Care: $139.3 billion",
"Prescription Drugs: $162 billion",
"Other Expenditures: $263.7 billion"
]
},
options: {
responsive: true,
legend: {
position: 'bottom',
},
title: {
display: false,
text: 'Chart.js Doughnut Chart'
},
animation: {
animateScale: true,
animateRotate: true
}
}
};
window.onload = function() {
var ctx = document.getElementById("chart-area").getContext("2d");
window.myDoughnut = new Chart(ctx, config);{
}
};
</script>
</body>
</html>
</code></pre>
| 0debug
|
What are the iPhone 11 / 11 Pro / 11 Pro Max media queries : <p>What are the correct CSS media queries used to target Apple's 2019 devices?</p>
<p>The iPhone 11, iPhone 11 Pro and iPhone 11 Pro Max.</p>
| 0debug
|
def ncr_modp(n, r, p):
C = [0 for i in range(r+1)]
C[0] = 1
for i in range(1, n+1):
for j in range(min(i, r), 0, -1):
C[j] = (C[j] + C[j-1]) % p
return C[r]
| 0debug
|
static int ffm_probe(AVProbeData *p)
{
if (p->buf_size >= 4 &&
p->buf[0] == 'F' && p->buf[1] == 'F' && p->buf[2] == 'M' &&
p->buf[3] == '1')
return AVPROBE_SCORE_MAX + 1;
return 0;
}
| 1threat
|
Saving data (numbers), swift app? : I'm learning application development working on a quizz game, I'd like to add statistics to the game. For example, the average score since the app has been downloaded. How can I store the scores on the device in order to reuse them after the app has been closed ?
| 0debug
|
I like to know how to split a string on the basis of delimeters : I have a csv file which comprises of 5 columns of which i need only two columns which are seperated by pipe(|) delimeter.Here are few of them---
SERIAL_NO|N|1385,45,871,104|1|?
CUST_ID|N|1704,211,552,71|1|?
PROD_TYPE|A|367,286,1167,74|1|?
BRANCH_CODE|N|1892,429,254,74|1|?
BRANCH_NAME|A|682,412,774,72|1|?
DATE|N|2022,581,241,82-1863,581,137,75-1697,581,153,85|1|?
I want just the 0th and 2nd index data in a list so that i can feed that data to a image on the basis of given coordinates i am going to do cropping in image and save those images with file name same as the 0th index data.
In order to make it more clear here is what i want to do i have a image whose coordinates are in csv file(like this 1385,45,871,104)and after cropping on the basis of given coordinates i want to save file with the name of 0th index data of that row which is(SERIAL_NO).i have to do that for all the rows and some rows have more than one coordinates which was divided by - symbol.
So anybody who have idea how to do this kindly help i will be thankful to you.
| 0debug
|
SELECT statement with if ELSE MSSQL : I have a table looks like this:
> `ref doc`
> `ref001 3`
> `ref001 3`
> `ref002 1`
> `ref002 4`
> `ref002 1`
I want to use SELECT with IF ELSE STATEMENT similarly to this idea:
`SELECT MAX(ref), if(ref=ref then MAX(doc)) else SUM(doc)`
Sample output:
ref001 3
ref002 6
| 0debug
|
int kvmppc_get_htab_fd(bool write)
{
struct kvm_get_htab_fd s = {
.flags = write ? KVM_GET_HTAB_WRITE : 0,
.start_index = 0,
};
if (!cap_htab_fd) {
fprintf(stderr, "KVM version doesn't support saving the hash table\n");
return -1;
}
return kvm_vm_ioctl(kvm_state, KVM_PPC_GET_HTAB_FD, &s);
}
| 1threat
|
Publishing a release build with debuggable true : I would like to publish a a library with debuggable true on release build types. This would help me debug that library. What are the potential problems if this library goes into production? Is it secure ? What difference does it make when released with debuggable as false?
```
buildTypes {
release {
minifyEnabled true
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
```
| 0debug
|
-bash: syntax error near unexpected token `('. help please : I am programming using IDL and unfortunately I decided to name a file using "(" and now I want to remove this file using "rm" but every time I try I get this same error message. It seems that I cannot copy or delete or doing anything with the file.
Any help please?
Thank you very much
| 0debug
|
MemoryRegionSection memory_region_find(MemoryRegion *mr,
hwaddr addr, uint64_t size)
{
MemoryRegionSection ret = { .mr = NULL };
MemoryRegion *root;
AddressSpace *as;
AddrRange range;
FlatView *view;
FlatRange *fr;
addr += mr->addr;
for (root = mr; root->parent; ) {
root = root->parent;
addr += root->addr;
}
as = memory_region_to_address_space(root);
range = addrrange_make(int128_make64(addr), int128_make64(size));
view = as->current_map;
fr = flatview_lookup(view, range);
if (!fr) {
return ret;
}
while (fr > view->ranges && addrrange_intersects(fr[-1].addr, range)) {
--fr;
}
ret.mr = fr->mr;
ret.address_space = as;
range = addrrange_intersection(range, fr->addr);
ret.offset_within_region = fr->offset_in_region;
ret.offset_within_region += int128_get64(int128_sub(range.start,
fr->addr.start));
ret.size = range.size;
ret.offset_within_address_space = int128_get64(range.start);
ret.readonly = fr->readonly;
memory_region_ref(ret.mr);
return ret;
}
| 1threat
|
static int aiocb_needs_copy(struct qemu_paiocb *aiocb)
{
if (aiocb->aio_flags & QEMU_AIO_SECTOR_ALIGNED) {
int i;
for (i = 0; i < aiocb->aio_niov; i++)
if ((uintptr_t) aiocb->aio_iov[i].iov_base % 512)
return 1;
}
return 0;
}
| 1threat
|
Extract a given ancestor path form a deeper path in MS-DOS : I have no idea how to get what described here using an MS-DOS batch script:
__pseudo-code__
```
set aPath=C:\just\a\long\path\to\a\file\in\the\file\system
set aDir=file
... some logic here
echo %result%
```
Should print
```
C:\just\a\long\path\to\a\file
```
__ONLY MS-DOS SOLUTIONS ARE WELCOME__ no Powershell code nor external tools, please. I'm looking for a pure MS-DOS solution.
| 0debug
|
static uint64_t integratorcm_read(void *opaque, target_phys_addr_t offset,
unsigned size)
{
integratorcm_state *s = (integratorcm_state *)opaque;
if (offset >= 0x100 && offset < 0x200) {
if (offset >= 0x180)
return 0;
return integrator_spd[offset >> 2];
}
switch (offset >> 2) {
case 0:
return 0x411a3001;
case 1:
return 0;
case 2:
return s->cm_osc;
case 3:
return s->cm_ctrl;
case 4:
return 0x00100000;
case 5:
if (s->cm_lock == 0xa05f) {
return 0x1a05f;
} else {
return s->cm_lock;
}
case 6:
hw_error("integratorcm_read: CM_LMBUSCNT");
case 7:
return s->cm_auxosc;
case 8:
return s->cm_sdram;
case 9:
return s->cm_init;
case 10:
hw_error("integratorcm_read: CM_REFCT");
case 12:
return s->cm_flags;
case 14:
return s->cm_nvflags;
case 16:
return s->int_level & s->irq_enabled;
case 17:
return s->int_level;
case 18:
return s->irq_enabled;
case 20:
return s->int_level & 1;
case 24:
return s->int_level & s->fiq_enabled;
case 25:
return s->int_level;
case 26:
return s->fiq_enabled;
case 32:
case 33:
case 34:
case 35:
return 0;
default:
hw_error("integratorcm_read: Unimplemented offset 0x%x\n",
(int)offset);
return 0;
}
}
| 1threat
|
i am makeing a traffic light with python turtle and at the end of the sequance i want all the lights to blink yellow : this is my code all i want is for three turtles to move/blink at the same time
like a broken traffic light.
i cant figure out how to do it.
if you want to see all of my code let me now by an answer
#flash
speed(20)
#pens
pen1 = Turtle()
pen2 = Turtle()
pen3 = Turtle()
#loop
def loop():
while True:
pen1.penup()
pen1.color('yellow')
pen1.goto(0,90)
pen1.begin_fill()
pen1.pendown()
pen1.circle(40)
pen1.penup()
pen1.end_fill()
pen1.color('black')
time.sleep(1)
pen1.begin_fill()
pen1.pendown()
pen1.circle(40)
pen1.penup()
pen1.end_fill()
time.sleep(1)
while True:
pen2.penup()
pen2.color('yellow')
pen2.goto(0,-140)
pen2.begin_fill()
pen2.pendown()
pen2.circle(40)
pen2.penup()
pen2.end_fill()
pen2.color('black')
time.sleep(1)
pen2.begin_fill()
pen2.pendown()
pen2.circle(40)
pen2.penup()
pen2.end_fill()
time.sleep(1)
return loop()
| 0debug
|
Is there anyway to develop a gui using HTML,CSS,JavaScript and use java for the backend? : <p>I'm building a point of sale system of my senior capstone and I really don't have much knowledge on building GUIs in java but I have made many UIs using HTML, CSS, and javascript. Just wondering if there is a way to combine the two.</p>
| 0debug
|
static int bdrv_open_common(BlockDriverState *bs, const char *filename,
int flags, BlockDriver *drv)
{
int ret, open_flags;
assert(drv != NULL);
bs->file = NULL;
bs->total_sectors = 0;
bs->is_temporary = 0;
bs->encrypted = 0;
bs->valid_key = 0;
bs->open_flags = flags;
bs->buffer_alignment = 512;
pstrcpy(bs->filename, sizeof(bs->filename), filename);
if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv)) {
return -ENOTSUP;
}
bs->drv = drv;
bs->opaque = qemu_mallocz(drv->instance_size);
if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE))
bs->enable_write_cache = 1;
open_flags = flags & ~(BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
if (bs->is_temporary) {
open_flags |= BDRV_O_RDWR;
}
if (drv->bdrv_file_open) {
ret = drv->bdrv_file_open(bs, filename, open_flags);
} else {
ret = bdrv_file_open(&bs->file, filename, open_flags);
if (ret >= 0) {
ret = drv->bdrv_open(bs, open_flags);
}
}
if (ret < 0) {
goto free_and_fail;
}
bs->keep_read_only = bs->read_only = !(open_flags & BDRV_O_RDWR);
ret = refresh_total_sectors(bs, bs->total_sectors);
if (ret < 0) {
goto free_and_fail;
}
#ifndef _WIN32
if (bs->is_temporary) {
unlink(filename);
}
#endif
return 0;
free_and_fail:
if (bs->file) {
bdrv_delete(bs->file);
bs->file = NULL;
}
qemu_free(bs->opaque);
bs->opaque = NULL;
bs->drv = NULL;
return ret;
}
| 1threat
|
weird typecasting ((ClassPathXmlApplicationContext) context).close(); : <p>I am learning java and spring on the way, I have the following code for which I do not understand how typecasting works:</p>
<pre><code>public class App {
public static void main(String[] args) {
ApplicationContext context = new ClassPathXmlApplicationContext("com/voja/spring/test/beans/beans.xml");
((ClassPathXmlApplicationContext) context).close();
}
}
</code></pre>
<p>So the following:</p>
<pre><code>((ClassPathXmlApplicationContext) context).close();
</code></pre>
<p>is what I don't get.</p>
<p>My thinking is that it should be like:</p>
<pre><code>(ClassPathXmlApplicationContext) context.close();
</code></pre>
<p>But that gives an error.</p>
<p>The way it is now it's how it's supposed to be, but I don't get how is the method invoked on it, and why is <code>(ClassPathXmlApplicationContext) context</code> inside brackets, and once again how can a method be appended to this?</p>
| 0debug
|
how do i get the bottom offset of a scroll div from windowheight : Please see img the height i want from the reb box div bottom offset from window [See image for refrence][1]
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
//want offset bottom of box after some scroll of body scroll
<!-- language: lang-css -->
.divHasScroll{height:200px; width:350px; background:red; overflow:auto}
<!-- language: lang-html -->
<div class="divHasScroll">
<p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p><p> text in box</p>
</div>
<p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p><p> text in window scrolling section</p>
<!-- end snippet -->
[1]: https://i.stack.imgur.com/lVsGb.jpg
| 0debug
|
Vue Axios CORS policy: No 'Access-Control-Allow-Origin' : <p>I build an app use vue and codeigniter, but I have a problem when I try to get api, I got this error on console</p>
<pre><code>Access to XMLHttpRequest at 'http://localhost:8888/project/login'
from origin 'http://localhost:8080' has been blocked by CORS policy:
Request header field access-control-allow-origin is not allowed
by Access-Control-Allow-Headers in preflight response.
</code></pre>
<p>I have been try like this on front-end (main.js)</p>
<pre><code>axios.defaults.headers.common['Content-Type'] = 'application/x-www-form-urlencoded'
axios.defaults.headers.common['Access-Control-Allow-Origin'] = '*';
</code></pre>
<p>and this on backend (controller)</p>
<pre><code>header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");
</code></pre>
<p>and vue login method</p>
<pre><code>this.axios.post('http://localhost:8888/project/login', this.data, {
headers: {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, PATCH, PUT, DELETE, OPTIONS",
"Access-Control-Allow-Headers": "Origin, Content-Type, X-Auth-Token"
}
}).then(res => {
console.log(res);
}).catch(err => {
console.log(err.response);
});
</code></pre>
<p>I've searched and tried in stackoverflow but does not work, how I can solve it? thank you so much for your help</p>
| 0debug
|
static void xhci_er_reset(XHCIState *xhci, int v)
{
XHCIInterrupter *intr = &xhci->intr[v];
XHCIEvRingSeg seg;
if (intr->erstsz == 0) {
intr->er_start = 0;
intr->er_size = 0;
return;
}
if (intr->erstsz != 1) {
DPRINTF("xhci: invalid value for ERSTSZ: %d\n", intr->erstsz);
xhci_die(xhci);
return;
}
dma_addr_t erstba = xhci_addr64(intr->erstba_low, intr->erstba_high);
pci_dma_read(PCI_DEVICE(xhci), erstba, &seg, sizeof(seg));
le32_to_cpus(&seg.addr_low);
le32_to_cpus(&seg.addr_high);
le32_to_cpus(&seg.size);
if (seg.size < 16 || seg.size > 4096) {
DPRINTF("xhci: invalid value for segment size: %d\n", seg.size);
xhci_die(xhci);
return;
}
intr->er_start = xhci_addr64(seg.addr_low, seg.addr_high);
intr->er_size = seg.size;
intr->er_ep_idx = 0;
intr->er_pcs = 1;
DPRINTF("xhci: event ring[%d]:" DMA_ADDR_FMT " [%d]\n",
v, intr->er_start, intr->er_size);
}
| 1threat
|
Ansible Cloudwatch rule reports failed invocations : <p>I have created an AWS lambda that works well when I test it and when I create a cron job manually through a cloudwatch rule.</p>
<p>It reports metrics as invocations (not failed) and also logs with details about the execution.</p>
<p>Then I decided to remove that manually created cloudwatch rule in order to create one with ansible. </p>
<pre><code> - name: Create lambda service.
lambda:
name: "{{ item.name }}"
state: present
zip_file: "{{ item.zip_file }}"
runtime: 'python2.7'
role: 'arn:aws:iam::12345678901:role/lambda_ecr_delete'
handler: 'main.handler'
region: 'eu-west-2'
environment_variables: "{{ item.env_vars }}"
with_items:
- name: lamda_ecr_cleaner
zip_file: assets/scripts/ecr-cleaner.zip
env_vars:
'DRYRUN': '0'
'IMAGES_TO_KEEP': '20'
'REGION': 'eu-west-2'
register: new_lambda
- name: Schedule a cloudwatch event.
cloudwatchevent_rule:
name: ecr_delete
schedule_expression: "rate(1 day)"
description: Delete old images in ecr repo.
targets:
- id: ecr_delete
arn: "{{ item.configuration.function_arn }}"
with_items: "{{ new_lambda.results }}"
</code></pre>
<p>That creates almost the exact same cloudwatch rule. The only difference I can see with the manually created one is in the targets, the lambda version / alias is set to Default when created manually while it is set to version, with a corresponding version number when created with ansible.</p>
<p>The cloudwatch rule created with ansible has only failed invocations.</p>
<p>Any idea why this is? I can't see any logs. Is there a way I can set the version to Default as well with the cloudwatchevent_rule module in ansible?</p>
| 0debug
|
How to set the right path to image in java : I am trying to load and draw it with paint method in java whatever the way I write the path it always shows an exception
java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(Unknown Source)
I have the image at the same folder with the class
This is the line that I am loading image in
Image img = ImageIO.read(getClass().getResourceAsStream("pepsi.png"));
| 0debug
|
From a list, how to Print from certain string to certain string : <p>I want to print the Strings in a list.</p>
<p>For example, if my list contains like below, I would like to print the strings between Deer to Crazy, but not Deer and crazy.</p>
<p>['black', 'white', 'Deer', 'Blue', 'More', 'Crazy']</p>
| 0debug
|
How to add Pie Chart in my Android project : I want to add a Pie Chart in my Android project. If I have 95 car, 60 bus, 106 bicycle and so on. Please let me know if anyone have any suggestions...
| 0debug
|
static int usb_qdev_init(DeviceState *qdev, DeviceInfo *base)
{
USBDevice *dev = DO_UPCAST(USBDevice, qdev, qdev);
USBDeviceInfo *info = DO_UPCAST(USBDeviceInfo, qdev, base);
int rc;
pstrcpy(dev->product_desc, sizeof(dev->product_desc), info->product_desc);
dev->info = info;
dev->auto_attach = 1;
QLIST_INIT(&dev->strings);
rc = usb_claim_port(dev);
if (rc != 0) {
goto err;
}
rc = dev->info->init(dev);
if (rc != 0) {
goto err;
}
if (dev->auto_attach) {
rc = usb_device_attach(dev);
if (rc != 0) {
goto err;
}
}
return 0;
err:
usb_qdev_exit(qdev);
return rc;
}
| 1threat
|
Parallel operations with Promise.all? : <p>I'm led to believe that Promise.all executes all the functions you pass it in parallel and doesn't care what order the returned promises finish.</p>
<p>But when I write this test code:</p>
<pre><code>function Promise1(){
return new Promise(function(resolve, reject){
for(let i = 0; i < 10; i++){
console.log("Done Err!");
}
resolve(true)
})
}
function Promise2(){
return new Promise(function(resolve, reject){
for(let i = 0; i < 10; i++){
console.log("Done True!");
}
resolve(true)
})
}
Promise.all([
Promise1(),
Promise2()
])
.then(function(){
console.log("All Done!")
})
</code></pre>
<p>The result I get is this</p>
<pre><code>Done Err!
Done Err!
Done Err!
Done Err!
Done Err!
Done Err!
Done Err!
Done Err!
Done Err!
Done Err!
Done True!
Done True!
Done True!
Done True!
Done True!
Done True!
Done True!
Done True!
Done True!
Done True!
Done!
</code></pre>
<p>But if they're running in parallel wouldn't I expect them to be executing at the same time and give me a result like this?</p>
<pre><code>Done Err!
Done True!
Done Err!
Done True!
Done Err!
Done True!
Done Err!
Done True!
Etc. Etc.?
</code></pre>
<p>Or am I missing something in the way I'm doing it?</p>
| 0debug
|
static int block_save_live(Monitor *mon, QEMUFile *f, int stage, void *opaque)
{
int ret;
DPRINTF("Enter save live stage %d submitted %d transferred %d\n",
stage, block_mig_state.submitted, block_mig_state.transferred);
if (stage < 0) {
blk_mig_cleanup(mon);
return 0;
}
if (block_mig_state.blk_enable != 1) {
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
return 1;
}
if (stage == 1) {
init_blk_migration(mon, f);
set_dirty_tracking(1);
}
flush_blks(f);
ret = qemu_file_get_error(f);
if (ret) {
blk_mig_cleanup(mon);
return ret;
}
blk_mig_reset_dirty_cursor();
if (stage == 2) {
while ((block_mig_state.submitted +
block_mig_state.read_done) * BLOCK_SIZE <
qemu_file_get_rate_limit(f)) {
if (block_mig_state.bulk_completed == 0) {
if (blk_mig_save_bulked_block(mon, f) == 0) {
block_mig_state.bulk_completed = 1;
}
} else {
if (blk_mig_save_dirty_block(mon, f, 1) == 0) {
break;
}
}
}
flush_blks(f);
ret = qemu_file_get_error(f);
if (ret) {
blk_mig_cleanup(mon);
return ret;
}
}
if (stage == 3) {
assert(block_mig_state.submitted == 0);
while (blk_mig_save_dirty_block(mon, f, 0) != 0);
blk_mig_cleanup(mon);
qemu_put_be64(f, (100 << BDRV_SECTOR_BITS) | BLK_MIG_FLAG_PROGRESS);
ret = qemu_file_get_error(f);
if (ret) {
return ret;
}
monitor_printf(mon, "Block migration completed\n");
}
qemu_put_be64(f, BLK_MIG_FLAG_EOS);
return ((stage == 2) && is_stage2_completed());
}
| 1threat
|
Difference between SDK vs LIB? : <p>What is the difference between an SDK vs Library and any examples of custom implementation in Java ?</p>
<p>BR
/norbix</p>
| 0debug
|
POWERPC_FAMILY(POWER7)(ObjectClass *oc, void *data)
{
DeviceClass *dc = DEVICE_CLASS(oc);
PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc);
dc->fw_name = "PowerPC,POWER7";
dc->desc = "POWER7";
pcc->pvr = CPU_POWERPC_POWER7_BASE;
pcc->pvr_mask = CPU_POWERPC_POWER7_MASK;
pcc->init_proc = init_proc_POWER7;
pcc->check_pow = check_pow_nocheck;
pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB |
PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES |
PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE |
PPC_FLOAT_FRSQRTES |
PPC_FLOAT_STFIWX |
PPC_FLOAT_EXT |
PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ |
PPC_MEM_SYNC | PPC_MEM_EIEIO |
PPC_MEM_TLBIE | PPC_MEM_TLBSYNC |
PPC_64B | PPC_ALTIVEC |
PPC_SEGMENT_64B | PPC_SLBI |
PPC_POPCNTB | PPC_POPCNTWD;
pcc->insns_flags2 = PPC2_VSX | PPC2_DFP | PPC2_DBRX | PPC2_ISA205 |
PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 |
PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 |
PPC2_FP_TST_ISA206;
pcc->msr_mask = (1ull << MSR_SF) |
(1ull << MSR_VR) |
(1ull << MSR_VSX) |
(1ull << MSR_EE) |
(1ull << MSR_PR) |
(1ull << MSR_FP) |
(1ull << MSR_ME) |
(1ull << MSR_FE0) |
(1ull << MSR_SE) |
(1ull << MSR_DE) |
(1ull << MSR_FE1) |
(1ull << MSR_IR) |
(1ull << MSR_DR) |
(1ull << MSR_PMM) |
(1ull << MSR_RI) |
(1ull << MSR_LE);
pcc->mmu_model = POWERPC_MMU_2_06;
#if defined(CONFIG_SOFTMMU)
pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault;
#endif
pcc->excp_model = POWERPC_EXCP_POWER7;
pcc->bus_model = PPC_FLAGS_INPUT_POWER7;
pcc->bfd_mach = bfd_mach_ppc64;
pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE |
POWERPC_FLAG_BE | POWERPC_FLAG_PMM |
POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR |
POWERPC_FLAG_VSX;
pcc->l1_dcache_size = 0x8000;
pcc->l1_icache_size = 0x8000;
pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr;
}
| 1threat
|
Applying MethodImplOptions.AggressiveInlining to F# functions : <p>The attribute <code>System.Runtime.CompilerServices.MethodImplAttribute</code> can be used to give hints to the JIT compiler about how to handle the decorated method. In particular, the option <code>MethodImplOptions.AggressiveInlining</code> instructs the compiler to inline the affected method if possible. Unfortunately the F# compiler seems to simply ignore this attribute when generating IL.</p>
<p>Example: The following C# code</p>
<pre><code>[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int Inc(int x) => x + 1;
</code></pre>
<p>is translated to</p>
<pre><code>.method public hidebysig static int32 Inc(int32 x) cil managed aggressiveinlining
{
.maxstack 8
IL_0000: ldarg.0
IL_0001: ldc.i4.1
IL_0002: add
IL_0003: ret
}
</code></pre>
<p>Note the "aggressiveinlining" flag.</p>
<p>This F# code however</p>
<pre><code>[<MethodImpl(MethodImplOptions.AggressiveInlining)>]
let inc x = x + 1
</code></pre>
<p>becomes</p>
<pre><code>.method public static int32 inc(int32 x) cil managed
{
.maxstack 8
IL_0000: nop
IL_0001: ldarg.0
IL_0002: ldc.i4.1
IL_0003: add
IL_0004: ret
}
</code></pre>
<p>No "aggressiveinlining". I also tried to apply the attribute to static and non-static methods of proper classes (<code>type ...</code>), but the result is the same.</p>
<p>If however I apply it to a custom indexer, like so</p>
<pre><code>type Dummy =
member self.Item
with [<MethodImpl(MethodImplOptions.AggressiveInlining)>] get x = x + 1
</code></pre>
<p>the resulting IL is</p>
<pre><code>.method public hidebysig specialname instance int32 get_Item(int32 x) cil managed
{
.custom instance void [mscorlib]System.Runtime.CompilerServices.MethodImplAttribute::.ctor(valuetype [mscorlib]System.Runtime.CompilerServices.MethodImplOptions) = ( 01 00 00 01 00 00 00 00 )
.maxstack 8
IL_0000: nop
IL_0001: ldarg.1
IL_0002: ldc.i4.1
IL_0003: add
IL_0004: ret
}
</code></pre>
<p>... though I'm not sure whether that is equivalent to the "aggressiveinling" flag generated by the C# compiler.</p>
<p>Is that behavior desired/expected? Is it a bug in the F# compiler?</p>
<p>(Note: I'm aware of the F# <code>inline</code> keyword, but that only works for F# clients of my library, not C# consumers.)</p>
| 0debug
|
connection.query('SELECT * FROM users WHERE username = ' + input_string)
| 1threat
|
Code Elegance: Java Strings : <p>A program that takes the first two characters of a string and adds them to the front and back of the string. Which version is better?</p>
<pre><code>public String front22(String str) {
if(str.length()>2) return str.substring(0,2)+str+str.substring(0,2);
return str+str+str;
}
</code></pre>
<p>or</p>
<pre><code>public String front22(String str) {
// First figure the number of chars to take
int take = 2;
if (take > str.length()) {
take = str.length();
}
String front = str.substring(0, take);
return front + str + front;
}
</code></pre>
<p>The former strikes me as more elegant. The latter is easier to understand. Any other suggestions for improvement of either is more than welcome!</p>
| 0debug
|
How to add 10 number in listbox with a little code? : I code this it's fine but can I code a little ?
If D = 10 Then
ListBox3.Items.Add(1)
ListBox3.Items.Add(2)
ListBox3.Items.Add(3)
ListBox3.Items.Add(4)
ListBox3.Items.Add(5)
ListBox3.Items.Add(6)
ListBox3.Items.Add(7)
ListBox3.Items.Add(8)
ListBox3.Items.Add(9)
ListBox3.Items.Add(10)
End If
if you don't understand my question you can read the example
we can code
Dim A As Integer
Dim B As Integer
Dim C As Integer
Dim D As Integer
but we can code a little like this
Dim A, B, C, D As Integer
| 0debug
|
void virtqueue_fill(VirtQueue *vq, const VirtQueueElement *elem,
unsigned int len, unsigned int idx)
{
VRingUsedElem uelem;
trace_virtqueue_fill(vq, elem, len, idx);
virtqueue_unmap_sg(vq, elem, len);
idx = (idx + vq->used_idx) % vq->vring.num;
uelem.id = elem->index;
uelem.len = len;
vring_used_write(vq, &uelem, idx);
| 1threat
|
static void phys_sections_clear(PhysPageMap *map)
{
while (map->sections_nb > 0) {
MemoryRegionSection *section = &map->sections[--map->sections_nb];
phys_section_destroy(section->mr);
}
g_free(map->sections);
g_free(map->nodes);
}
| 1threat
|
Displaying current username in _Layout view : <p>I am wanting to display the current ApplicationUsers Firstname+Lastname on my navigation bar on my _Layout view. I've found that you can pass your viewbag from the current RenderedBody controller like so:</p>
<pre><code> private readonly IHttpContextAccessor _httpContext;
private readonly UserManager<ApplicationUser> _userManager;
private readonly ApplicationUser _user;
public HomeController(IHttpContextAccessor httpContextAccessor, UserManager<ApplicationUser> userManager) {
_httpContext = httpContextAccessor;
_userManager = userManager;
_user = _userManager.Users.Single(u => u.Id == _httpContext.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value);
}
</code></pre>
<p>And in a controller:</p>
<pre><code>public IActionResult Index()
{
ViewBag.Username = $"{_user.FirstName} {_user.Surname}";
return View();
}
</code></pre>
<p>Finally in my _Layout View:</p>
<pre><code><strong class="font-bold">@ViewBag.Username</strong>
</code></pre>
<p>This method seems like it's going against the grain and would be a huge pain to do for every view. What would be the standard in achieving this?</p>
| 0debug
|
[PHP][JavaScript] Formating : I would like to set the display to none. I want to change the value of the display when the man click to the submit button. After that the form's display changes to none.
But this code is not working.
<!DOCTYPE html>
<?php
include_once 'header.php'
?>
<html>
<head>
<meta charset="utf-8">
<title>Submit</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<form class="submit" method="post">
<input id="ceg" type="text" name="ceg" placeholder="Cég neve"><br>
<input id="ceg" type="text" name="kontakt" placeholder="Kapcsolattartó neve"><br>
<input id="ceg" type="email" name="" placeholder="Kapcsolattartó email címe"><br>
<input id="ceg" type="text" name="" placeholder="Munkakör leírása (20 szó)"><br>
<h1>Témakör</h1>
<input type="radio" name="menu" value="1">1</input><br>
<input type="radio" name="menu" value="2">2</input><br>
<input type="radio" name="menu" value="3">3</input><br>
<input type="submit" name="submit" value="submit" onload="myFunction">
</form>
<script>
function myFunction() {
var x = document.getElementsByClassName("submit");
x.style.display = "none";
}
</script>
</body>
</html>
| 0debug
|
Angular 4 - using objects for option values in a select list : <p>I know that similar questions have been asked, but I've found none with a good answer. I want to create a select list in an Angular form, where the value for each option is an object. Also, I do NOT want to use 2 way data binding. e.g. if my Component has these fields:</p>
<pre>
lUsers: any[] = [
{ Name: 'Billy Williams', Gender: 'male' },
{ Name: 'Sally Ride', Gender: 'female'}
];
curUser: any;
</pre>
<p>I would like my HTML template to contain this:</p>
<pre>
<select #selectElem (change)="setNewUser(selectElem.value)">
<option *ngFor="let user of lUsers" [ngValue]="user">
{{user.Name}}
</option>
</select>
</pre>
<p>With this code, though, my setNewUser() function receives the contents of the selected user's Name field. Why it picks that specific field, I have no idea. What I expect is that it would receive the "value" of the selected option, which I specifically set to a user object.</p>
<p>Note that I used ngValue instead of value in the option. That was by suggestion of others on SO. If I use value instead, what happens is that the object gets converted to the string '[Object object]', which is what setNewUser() receives, which is useless.</p>
<p>FYI, I'm working on Windows 10, using angular 4.0.0 with @angular/cli 1.1.2. Here is the setNewUser() method:</p>
<pre>
setNewUser(user: User): void {
console.log(user);
this.curUser = user;
} // setNewUser()
</pre>
<p>I am determining just what exactly is being passed to it both my logging it, and also including this on the template: <code><pre>{{curUser}}</pre></code></p>
| 0debug
|
Understanding a little syntaxis : load data infile 'D:\\diiet\\subir\\a.txt'
Into table reporte_dts_empresa_2015_sut CHARACTER SET latin1
fields terminated by '\t' why I have to do this step?
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
I am new on sql, i am trying to create a table whith excel data
i already done it, but im not sure how.
| 0debug
|
static target_ulong h_read(PowerPCCPU *cpu, sPAPREnvironment *spapr,
target_ulong opcode, target_ulong *args)
{
CPUPPCState *env = &cpu->env;
target_ulong flags = args[0];
target_ulong pte_index = args[1];
uint8_t *hpte;
int i, ridx, n_entries = 1;
if ((pte_index * HASH_PTE_SIZE_64) & ~env->htab_mask) {
return H_PARAMETER;
}
if (flags & H_READ_4) {
pte_index &= ~(3ULL);
n_entries = 4;
}
hpte = env->external_htab + (pte_index * HASH_PTE_SIZE_64);
for (i = 0, ridx = 0; i < n_entries; i++) {
args[ridx++] = ldq_p(hpte);
args[ridx++] = ldq_p(hpte + (HASH_PTE_SIZE_64/2));
hpte += HASH_PTE_SIZE_64;
}
return H_SUCCESS;
}
| 1threat
|
Should I block certain charecters from my EditTexts for security reasons? : I've been programming for about 6 months now, but also did a bit if code about 10 years ago.
I remember back then I had to block some characters from text fields for security purposes, so people won't type in some code that would cause harm.
Is it still relevant in 2019? Should I be worried about anything of that sort?
I am using Cloud Firestore as my server.
** My app would allow all languages, so I can't limit what characters ARE allowed as there are way too many.
| 0debug
|
Why i can't get my array from another class : I have an activity, in which i have to use function from another class DataBase . In DataBase code have to get information from my FireBase database, and then return ArrayList<String> as a result. But when i use function `takeDataFromFirebase` my array in null, it's size is null. How i can get the array with FireBase information to my actvity?
public class DataBase{
public ArrayList<String> arraylist = new ArrayList<>();
public ArrayList<String> takeDataFromFirebase(DatabaseReference dRef) {
usersRef = dRef.child(USERS_CHILD);
ValueEventListener valueEventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot ds : dataSnapshot.getChildren()) {
String userKey = ds.getKey();
DatabaseReference messagesRef = usersRef.child(userKey).child(USER_MESSAGES);
ValueEventListener eventListener = new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot) {
for(DataSnapshot dSnapshot : dataSnapshot.getChildren()) {
messageText = dSnapshot.child(USER_MESSAGE_TEXT).getValue(String.class);
arrayList.add(messageText);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
messagesRef.addListenerForSingleValueEvent(eventListener);
}
}
@Override
public void onCancelled(DatabaseError databaseError) {}
};
usersRef.addListenerForSingleValueEvent(valueEventListener);
return null;
}
}
and my activity where i use this method:
public class Categories extends AppCompatActivity{
private static final String TAG = "CATEGORIES";
FirebaseAuth mAuth;
private ListView all_problems_list_view;
private Button add_problem_button, signOut;
private static long back_pressed;
FirebaseDatabase mDataBase;
DatabaseReference dRef;
DatabaseReference userRef;
DataBase dataBaseFunctions;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(layout.activity_categories);
dataBaseFunctions = new DataBase();
mAuth = FirebaseAuth.getInstance();
mDataBase = FirebaseDatabase.getInstance();
dRef = mDataBase.getReference();
userRef = dRef.child("Users");
//region add all items
all_problems_list_view = (ListView) findViewById(id.all_problems_list_view);
add_problem_button = (Button) findViewById(id.add_problem_button);
signOut = (Button) findViewById(id.SignOutBut);
//endregion
//region set onClick to buttons
signOut.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
logout();
}
});
add_problem_button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(Categories.this, sendEmailActivity.class));
}
});
//endregiond
ArrayList<String> list = dataBaseFunctions.takeDataFromFirebase(dRef);
ArrayAdapter<String> adapter = new ArrayAdapter<>(this,
android.R.layout.simple_list_item_1, list);
all_problems_list_view.setAdapter(adapter);
}
| 0debug
|
static int rawvideo_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int packet_size, ret, width, height;
AVStream *st = s->streams[0];
width = st->codec->width;
height = st->codec->height;
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
if (packet_size < 0)
return -1;
ret= av_get_packet(s->pb, pkt, packet_size);
pkt->pts=
pkt->dts= pkt->pos / packet_size;
pkt->stream_index = 0;
if (ret != packet_size)
return AVERROR(EIO);
return 0;
}
| 1threat
|
No handlers could be found for logger : <p>I am newbie to python. I was trying logging in python and I came across <strong>No handlers could be found for logger</strong> error while trying to print some warning through logger instance. Below is the code I tried</p>
<pre><code>import logging
logger=logging.getLogger('logger')
logger.warning('The system may break down')
</code></pre>
<p>And I get this error <strong>No handlers could be found for logger "logger"</strong></p>
<p>What's confusing me is when I first try to print warning using <code>logging</code> and then through <code>logger</code> , it works fine, like</p>
<pre><code>>>> import logging
>>> logging.warning('This is a WARNING!!!!')
WARNING:root:This is a WARNING!!!!
>>>
>>> logger.warning('WARNING!!!!')
WARNING:logger:WARNING!!!!
</code></pre>
<p>Can someone throw some light on what's happening in second scenario? </p>
| 0debug
|
static int svq3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
SVQ3Context *svq3 = avctx->priv_data;
H264Context *h = &svq3->h;
MpegEncContext *s = &h->s;
int buf_size = avpkt->size;
int m, mb_type, left;
uint8_t *buf;
if (buf_size == 0) {
if (s->next_picture_ptr && !s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->next_picture;
s->next_picture_ptr = NULL;
*data_size = sizeof(AVFrame);
}
return 0;
}
s->mb_x = s->mb_y = h->mb_xy = 0;
if (svq3->watermark_key) {
svq3->buf = av_fast_realloc(svq3->buf, &svq3->buf_size,
buf_size+FF_INPUT_BUFFER_PADDING_SIZE);
if (!svq3->buf)
return AVERROR(ENOMEM);
memcpy(svq3->buf, avpkt->data, buf_size);
buf = svq3->buf;
} else {
buf = avpkt->data;
}
init_get_bits(&s->gb, buf, 8*buf_size);
if (svq3_decode_slice_header(avctx))
return -1;
s->pict_type = h->slice_type;
s->picture_number = h->slice_num;
if (avctx->debug&FF_DEBUG_PICT_INFO){
av_log(h->s.avctx, AV_LOG_DEBUG, "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n",
av_get_picture_type_char(s->pict_type), svq3->halfpel_flag, svq3->thirdpel_flag,
s->adaptive_quant, s->qscale, h->slice_num);
}
s->current_picture.pict_type = s->pict_type;
s->current_picture.key_frame = (s->pict_type == AV_PICTURE_TYPE_I);
if (s->last_picture_ptr == NULL && s->pict_type == AV_PICTURE_TYPE_B)
return 0;
if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I)
|| avctx->skip_frame >= AVDISCARD_ALL)
return 0;
if (s->next_p_frame_damaged) {
if (s->pict_type == AV_PICTURE_TYPE_B)
return 0;
else
s->next_p_frame_damaged = 0;
}
if (ff_h264_frame_start(h) < 0)
return -1;
if (s->pict_type == AV_PICTURE_TYPE_B) {
h->frame_num_offset = (h->slice_num - h->prev_frame_num);
if (h->frame_num_offset < 0) {
h->frame_num_offset += 256;
}
if (h->frame_num_offset == 0 || h->frame_num_offset >= h->prev_frame_num_offset) {
av_log(h->s.avctx, AV_LOG_ERROR, "error in B-frame picture id\n");
return -1;
}
} else {
h->prev_frame_num = h->frame_num;
h->frame_num = h->slice_num;
h->prev_frame_num_offset = (h->frame_num - h->prev_frame_num);
if (h->prev_frame_num_offset < 0) {
h->prev_frame_num_offset += 256;
}
}
for (m = 0; m < 2; m++){
int i;
for (i = 0; i < 4; i++){
int j;
for (j = -1; j < 4; j++)
h->ref_cache[m][scan8[0] + 8*i + j]= 1;
if (i < 3)
h->ref_cache[m][scan8[0] + 8*i + j]= PART_NOT_AVAILABLE;
}
}
for (s->mb_y = 0; s->mb_y < s->mb_height; s->mb_y++) {
for (s->mb_x = 0; s->mb_x < s->mb_width; s->mb_x++) {
h->mb_xy = s->mb_x + s->mb_y*s->mb_stride;
if ( (get_bits_count(&s->gb) + 7) >= s->gb.size_in_bits &&
((get_bits_count(&s->gb) & 7) == 0 || show_bits(&s->gb, (-get_bits_count(&s->gb) & 7)) == 0)) {
skip_bits(&s->gb, svq3->next_slice_index - get_bits_count(&s->gb));
s->gb.size_in_bits = 8*buf_size;
if (svq3_decode_slice_header(avctx))
return -1;
}
mb_type = svq3_get_ue_golomb(&s->gb);
if (s->pict_type == AV_PICTURE_TYPE_I) {
mb_type += 8;
} else if (s->pict_type == AV_PICTURE_TYPE_B && mb_type >= 4) {
mb_type += 4;
}
if (mb_type > 33 || svq3_decode_mb(svq3, mb_type)) {
av_log(h->s.avctx, AV_LOG_ERROR, "error while decoding MB %d %d\n", s->mb_x, s->mb_y);
return -1;
}
if (mb_type != 0) {
ff_h264_hl_decode_mb (h);
}
if (s->pict_type != AV_PICTURE_TYPE_B && !s->low_delay) {
s->current_picture.mb_type[s->mb_x + s->mb_y*s->mb_stride] =
(s->pict_type == AV_PICTURE_TYPE_P && mb_type < 8) ? (mb_type - 1) : -1;
}
}
ff_draw_horiz_band(s, 16*s->mb_y, 16);
}
left = buf_size*8 - get_bits_count(&s->gb);
if (s->mb_y != s->mb_height || s->mb_x != s->mb_width) {
av_log(avctx, AV_LOG_INFO, "frame num %d incomplete pic x %d y %d left %d\n", avctx->frame_number, s->mb_y, s->mb_x, left);
}
if (left < 0) {
av_log(avctx, AV_LOG_ERROR, "frame num %d left %d\n", avctx->frame_number, left);
return -1;
}
MPV_frame_end(s);
if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
*(AVFrame *) data = *(AVFrame *) &s->current_picture;
} else {
*(AVFrame *) data = *(AVFrame *) &s->last_picture;
}
if (s->last_picture_ptr || s->low_delay) {
*data_size = sizeof(AVFrame);
}
return buf_size;
}
| 1threat
|
I dont understand a c# line of code and cant find the answer online : Helo, I´m starting to learn C# and .net in my university and I'm having a hard time figuring out how some example code works.
My problem is with the following sintax. The class componentes is a sublcass of Form1.
public class componente
{
public string nombre { get; set; }
public componente siguiente;
}
What i dont understand is the line "public componente siguiente". I have searched in google and stack overflow but I dont know the name of that and cant finde an answer.
I don't understand if It is a variable, a method, etc.
Thanks in advance.
| 0debug
|
HTML / CSS table looks different in Internet Explorer and Chrome : I'm trying to create a heatmap using html, css, javascript.
I got everything working perfect... in Chrome. In Internet Explorer, the table cells are 3-4 times taller, so the table looks weird. The picture below shows how it looks in Chrome.
[![enter image description here][1]][1]
This picture is from Internet Explorer
[![enter image description here][2]][2]
[1]: https://i.stack.imgur.com/caDHB.png
[2]: https://i.stack.imgur.com/IiOXI.png
This is my css.
table {
tr th {
vertical-align: middle;
&.xLabel {
text-align: center;
}
&.yLabel {
text-align: right;
}
}
tr {
td {
color: white;
text-align: center;
vertical-align: middle;
height: 30px;
}
}
}
Does anyone have an idea for a fix?
| 0debug
|
how to sort card in symfony : <p>i am beginner in <code>symfony</code> and I want to sort (with <code>SYMFONY</code> 3) a hand of 10 <code>cards</code> (given randomly to the user) according to this order :
Category order : DIAMOND – HEART – SPADES – CLUB.
Value order : AS – 2 – 3 – 4 – 5 – 6 – 7 – 8 – 9 – 10 – JACK – QUEEN – KING .
For exemple : i recover the user’s 10 random cards through a JSON file : </p>
<pre><code>{
"cards":[
{
"category":"DIAMOND",
"value":"TEN"
},
{
"category":"CLUB",
"value":"ACE"
},
{
"category":"DIAMOND",
"value":"QUEEN"
},
{
"category":"SPADES",
"value":"SEVEN"
},
{
"category":"DIAMOND",
"value":"NINE"
},
{
"category":"HEART",
"value":"QUEEN"
},
{
"category":"CLUB",
"value":"TEN"
},
{
"category":"HEART",
"value":"FIVE"
},
{
"category":"HEART",
"value":"SEVEN"
}
]
}
</code></pre>
<p>The sorted cards become : ACE CLUB /FIVE HEART / SIX CLUB/ SEVEN HEART / SEVEN SPADES / NINE DIAMOND / TEN DIAMOND /TEN CLUB/ QUEEN DIAMOND/ QUEEN HEART
I Don’t know how to start ?</p>
| 0debug
|
use NLP to identify similar phrase/words : <p>In our raw data, we know there're dirty data. For example, City name may be "Kunming", "Kun-Ming" or "kunming(city)", they all refer to a city named "Kun Ming". If we have a standard dictionary of city names, how can we clean our data using NLP. I'm thinking about building a multiple-label (city name) classification model. It will predict any words as "kun,ming" to a label refer to "Kun Ming".</p>
<p>Or maybe define a similarity function to take a raw city name as input and compare to every standard city names in the dictionary and return the highest similarity score one. That is f("Kunming") will compare "kunming" to "city a","city b"... and return "kunming".</p>
<p>I'm only using city name as an example. We also have other column that have longer string value that can implement bag of words.</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.