problem stringlengths 26 131k | labels class label 2 classes |
|---|---|
Prefer default export eslint error : <p>I am getting this eslint error:</p>
<blockquote>
<p>Prefer default export</p>
</blockquote>
<pre><code>import React, { Component } from 'react';
class HomePage extends Component {
render() {
return (
<div className="Section">HomePage</div>
);
}
}
export { HomePage };
</code></pre>
<p><strong>I have tried doing:</strong>
<code>export { default as Homepage };</code> </p>
<p>and then I get a fatal parsing error.</p>
<p>Then I changed it to:</p>
<pre><code>export default HomePage;
</code></pre>
<p>Which clears the eslint error.</p>
<p>But then throws:</p>
<blockquote>
<p>'./HomePage' does not contain an export named 'HomePage'.</p>
</blockquote>
<p>Because I am calling HomePage like this:
<code>import { HomePage } from './HomePage';</code></p>
<p>If I remove the brackets then I get this error:</p>
<blockquote>
<p>"export 'default' (imported as 'HomePage') was not found in
'./HomePage'</p>
</blockquote>
<pre><code>import HomePage from './HomePage';
<PrivateRoute exact path="/" component={HomePage} />
</code></pre>
<p>What would be the proper way of changing this to the preferred default export?</p>
| 0debug |
static void loop_filter(H264Context *h){
MpegEncContext * const s = &h->s;
uint8_t *dest_y, *dest_cb, *dest_cr;
int linesize, uvlinesize, mb_x, mb_y;
const int end_mb_y= s->mb_y + FRAME_MBAFF;
const int old_slice_type= h->slice_type;
if(h->deblocking_filter) {
for(mb_x= 0; mb_x<s->mb_width; mb_x++){
for(mb_y=end_mb_y - FRAME_MBAFF; mb_y<= end_mb_y; mb_y++){
int list, mb_xy, mb_type;
mb_xy = h->mb_xy = mb_x + mb_y*s->mb_stride;
h->slice_num= h->slice_table[mb_xy];
mb_type= s->current_picture.mb_type[mb_xy];
h->list_count= h->list_counts[mb_xy];
if(FRAME_MBAFF)
h->mb_mbaff = h->mb_field_decoding_flag = !!IS_INTERLACED(mb_type);
s->mb_x= mb_x;
s->mb_y= mb_y;
dest_y = s->current_picture.data[0] + (mb_x + mb_y * s->linesize ) * 16;
dest_cb = s->current_picture.data[1] + (mb_x + mb_y * s->uvlinesize) * 8;
dest_cr = s->current_picture.data[2] + (mb_x + mb_y * s->uvlinesize) * 8;
if (MB_FIELD) {
linesize = h->mb_linesize = s->linesize * 2;
uvlinesize = h->mb_uvlinesize = s->uvlinesize * 2;
if(mb_y&1){
dest_y -= s->linesize*15;
dest_cb-= s->uvlinesize*7;
dest_cr-= s->uvlinesize*7;
}
} else {
linesize = h->mb_linesize = s->linesize;
uvlinesize = h->mb_uvlinesize = s->uvlinesize;
}
backup_mb_border(h, dest_y, dest_cb, dest_cr, linesize, uvlinesize, 0);
if(fill_filter_caches(h, mb_type) < 0)
continue;
h->chroma_qp[0] = get_chroma_qp(h, 0, s->current_picture.qscale_table[mb_xy]);
h->chroma_qp[1] = get_chroma_qp(h, 1, s->current_picture.qscale_table[mb_xy]);
if (FRAME_MBAFF) {
ff_h264_filter_mb (h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
} else {
ff_h264_filter_mb_fast(h, mb_x, mb_y, dest_y, dest_cb, dest_cr, linesize, uvlinesize);
}
}
}
}
h->slice_type= old_slice_type;
s->mb_x= 0;
s->mb_y= end_mb_y - FRAME_MBAFF;
}
| 1threat |
Why won't python understand Pillow? : <p>I just downloaded Pillow and every time I try to import the module it shows an error, saying there is no module named Pillow. I am using the newest version of python, and it says that Pillow has been downloaded through 2.7 in the files directory. If anyone knows the answer that would be greatly appreciated. Thanks, Jamal</p>
| 0debug |
How to ordering the the JSON data in a given format using Angular.js/Javascript : I need one help.I need to format some array of data using Angular.js/Javascript.I am explaining the code below.
var response=[{
day_id:1,
day_name:"Monday",
subcat_id:"2",
cat_id:"1",
comment:"hii"
}, {
day_id:1,
day_name:"Monday",
subcat_id:"1",
cat_id:"2",
comment:"hello"
}
{
day_id:2,
day_name:"Tuesday",
subcat_id:"3",
cat_id:"2",
comment:"hii"
}
]
I have the above given array.I need to convert it as per following format
var responseNew = {
data: [{
day_name: "Monday",
day_id:1
answers:[{
cat_id:1,
subcat_id:1,
comment:'hii'
},{
cat_id:1,
subcat_id:2,
comment:'hello'
}]
}, {
day_name: "Tuesday",
day_id:2
answers:[{
cat_id:3,
subcat_id:2,
comment:'hello'
}]
}, {
day_name: "Wednesday"
day_id:3
}, {
day_name: "Thursday"
day_id:4
}, {
day_name: "Friday"
day_id:5
}, {
day_name: "Saturday",
day_id:6
}, {
day_name: "Sunday"
day_id:7
}]
};
Here i want to convert my first array into the second format.Here one condition is if other day_id is not present its simple set the day name and day id in static as given above.Please help me.
| 0debug |
How to make multiple request and wait until data is come from all the requests in retrofit 2.0 - android : <p>current code:</p>
<pre><code>Retrofit retrofit = new Retrofit.Builder()
.baseUrl(Constant.BASEURL)
.addConverterFactory(GsonConverterFactory.create())
.build();
APIService service = retrofit.create(APIService.class);
Call<ResponseWrap> call = service.getNewsData();
call.enqueue(new Callback<ResponseWrap>() {
@Override
public void onResponse(Call<ResponseWrap> call1, Response<ResponseWrap> response) {
if (response.isSuccess()) {
ResponseWrap finalRes = response.body();
for(int i=0; i<finalRes.getResponse().getResults().size(); ++i){
String title = finalRes.getResponse().getResults().get(i).getWebTitle();
News n = new News(titleCategory, title, null);
newsList.add(n);
}
AdapterRecommendation adapter = new AdapterRecommendation(getApplicationContext(), newsList);
listView.setAdapter(adapter);
}
else{
Toast.makeText(getApplicationContext(), "onResponse - something wrong" + response.message(), Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure(Call<ResponseWrap> call1, Throwable t) {
Toast.makeText(getApplicationContext(), "exception: " + t.getMessage(), Toast.LENGTH_LONG).show();
}
});
</code></pre>
<p>works fine.</p>
<p>Now i want to make multiple calls (number of call will be decided at run time) and all calls gives data in same format. data from all calls needs to be add to newsList. Once data is available from all calls and added to newsList, call</p>
<pre><code>AdapterRecommendation adapter = new AdapterRecommendation(getApplicationContext(), newsList);
listView.setAdapter(adapter);
</code></pre>
<p>Can anyone help me what is the best way to get data from multiple calls and wait until all request is not over in retrofit 2.0.</p>
| 0debug |
void usb_device_attach(USBDevice *dev, Error **errp)
{
USBBus *bus = usb_bus_from_device(dev);
USBPort *port = dev->port;
char devspeed[32], portspeed[32];
assert(port != NULL);
assert(!dev->attached);
usb_mask_to_str(devspeed, sizeof(devspeed), dev->speedmask);
usb_mask_to_str(portspeed, sizeof(portspeed), port->speedmask);
trace_usb_port_attach(bus->busnr, port->path,
devspeed, portspeed);
if (!(port->speedmask & dev->speedmask)) {
error_setg(errp, "Warning: speed mismatch trying to attach"
" usb device \"%s\" (%s speed)"
" to bus \"%s\", port \"%s\" (%s speed)",
dev->product_desc, devspeed,
bus->qbus.name, port->path, portspeed);
return;
}
dev->attached++;
usb_attach(port);
}
| 1threat |
static int proxy_name_to_path(FsContext *ctx, V9fsPath *dir_path,
const char *name, V9fsPath *target)
{
if (dir_path) {
v9fs_string_sprintf((V9fsString *)target, "%s/%s",
dir_path->data, name);
} else {
v9fs_string_sprintf((V9fsString *)target, "%s", name);
}
target->size++;
return 0;
}
| 1threat |
Bring application to foreground in ios : <p>Im working in a ios application. when my application is in background, i need to wake it up without user interaction. Is there any way to achieve that? Thanks in advance.</p>
| 0debug |
How to build a system that gets GPS data from 4000+ embedded devices and processes it in real time : <p>I want to develop a system that has 4000 embedded devices that send their GPS data every 10 second to the system and this system is expected to handle this amount of data flow and required to perform mathematical operations on these data. I want this system to be open for upgrades so it should handle adding more devices. What kind of devices should I use and what kind of software should they run?
Should the devices have OS'es or not? If they should what OS should they run? Thank you for your time in advance.</p>
| 0debug |
static char *get_human_readable_size(char *buf, int buf_size, int64_t size)
{
static const char suffixes[NB_SUFFIXES] = "KMGT";
int64_t base;
int i;
if (size <= 999) {
snprintf(buf, buf_size, "%" PRId64, size);
} else {
base = 1024;
for (i = 0; i < NB_SUFFIXES; i++) {
if (size < (10 * base)) {
snprintf(buf, buf_size, "%0.1f%c",
(double)size / base,
suffixes[i]);
break;
} else if (size < (1000 * base) || i == (NB_SUFFIXES - 1)) {
snprintf(buf, buf_size, "%" PRId64 "%c",
((size + (base >> 1)) / base),
suffixes[i]);
break;
}
base = base * 1024;
}
}
return buf;
}
| 1threat |
JQuery - To change text label to a link : I would like to replace the text label with a hyperlink when user select a checkbox one at a time.
Right now, one is checked, the rest change as well. Would it be posible if the name remains the same for all input?
Any help is greatly appreciated.
This is not working correctly.
.link { display: none }
$('input#chkbox').change(function(){
if($(this).is(':checked')) {
$('#clink').show();
$('#label').hide();
} else {
$('#label').show();
$('#clink').hide();
}
});
<label>
<input type="chkbox" name="item"βββββββββββββββββββββββββββββ value="1"βββββββββββββββββ/>
<span id="label">SELECT TO COMPARE</span>
<a class="link" href="#">COMPARE</a>
</label>
<label>
<input type="chkbox" name="item"βββββββββββββββββββββββββββββ value="2"βββββββββββββββββ/>
<span id="label">SELECT TO COMPARE</span>
<a class="link" href="#">COMPARE</a>
</label>
<label>
<input type="chkbox" name="item"βββββββββββββββββββββββββββββ value="3"βββββββββββββββββ/>
<span id="label">SELECT TO COMPARE</span>
<a class="link" href="#">COMPARE</a>
</label>
<label>
<input type="chkbox" name="item"βββββββββββββββββββββββββββββ value="4"βββββββββββββββββ/>
<span id="label">SELECT TO COMPARE</span>
<a class="link" href="#">COMPARE</a>
</label> | 0debug |
Advanced RecyclerView library - code examples : <p><a href="https://github.com/h6ah4i/android-advancedrecyclerview" rel="noreferrer">https://github.com/h6ah4i/android-advancedrecyclerview</a></p>
<p>This seems to be a great library in terms of what functionality it offers. However, it lacks good documentation. It has a "tutorial" on <code>Swipeable</code> items, but like some other people I couldn't follow it. </p>
<p>Does anyone have a working example or can anyone make a simple Use Case of swiping an item and showing a button under it using this library? It would be useful for lots of people interested in this functionality.</p>
| 0debug |
def find_lucas(n):
if (n == 0):
return 2
if (n == 1):
return 1
return find_lucas(n - 1) + find_lucas(n - 2) | 0debug |
static void virtio_pci_device_plugged(DeviceState *d, Error **errp)
{
VirtIOPCIProxy *proxy = VIRTIO_PCI(d);
VirtioBusState *bus = &proxy->bus;
bool legacy = virtio_pci_legacy(proxy);
bool modern;
bool modern_pio = proxy->flags & VIRTIO_PCI_FLAG_MODERN_PIO_NOTIFY;
uint8_t *config;
uint32_t size;
VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
if (!proxy->ignore_backend_features &&
!virtio_has_feature(vdev->host_features, VIRTIO_F_VERSION_1)) {
virtio_pci_disable_modern(proxy);
if (!legacy) {
error_setg(errp, "Device doesn't support modern mode, and legacy"
" mode is disabled");
error_append_hint(errp, "Set disable-legacy to off\n");
return;
}
}
modern = virtio_pci_modern(proxy);
config = proxy->pci_dev.config;
if (proxy->class_code) {
pci_config_set_class(config, proxy->class_code);
}
if (legacy) {
if (virtio_host_has_feature(vdev, VIRTIO_F_IOMMU_PLATFORM)) {
error_setg(errp, "VIRTIO_F_IOMMU_PLATFORM was supported by"
"neither legacy nor transitional device.");
return ;
}
pci_set_word(config + PCI_SUBSYSTEM_VENDOR_ID,
pci_get_word(config + PCI_VENDOR_ID));
pci_set_word(config + PCI_SUBSYSTEM_ID, virtio_bus_get_vdev_id(bus));
} else {
pci_set_word(config + PCI_VENDOR_ID,
PCI_VENDOR_ID_REDHAT_QUMRANET);
pci_set_word(config + PCI_DEVICE_ID,
0x1040 + virtio_bus_get_vdev_id(bus));
pci_config_set_revision(config, 1);
}
config[PCI_INTERRUPT_PIN] = 1;
if (modern) {
struct virtio_pci_cap cap = {
.cap_len = sizeof cap,
};
struct virtio_pci_notify_cap notify = {
.cap.cap_len = sizeof notify,
.notify_off_multiplier =
cpu_to_le32(virtio_pci_queue_mem_mult(proxy)),
};
struct virtio_pci_cfg_cap cfg = {
.cap.cap_len = sizeof cfg,
.cap.cfg_type = VIRTIO_PCI_CAP_PCI_CFG,
};
struct virtio_pci_notify_cap notify_pio = {
.cap.cap_len = sizeof notify,
.notify_off_multiplier = cpu_to_le32(0x0),
};
struct virtio_pci_cfg_cap *cfg_mask;
virtio_pci_modern_regions_init(proxy);
virtio_pci_modern_mem_region_map(proxy, &proxy->common, &cap);
virtio_pci_modern_mem_region_map(proxy, &proxy->isr, &cap);
virtio_pci_modern_mem_region_map(proxy, &proxy->device, &cap);
virtio_pci_modern_mem_region_map(proxy, &proxy->notify, ¬ify.cap);
if (modern_pio) {
memory_region_init(&proxy->io_bar, OBJECT(proxy),
"virtio-pci-io", 0x4);
pci_register_bar(&proxy->pci_dev, proxy->modern_io_bar_idx,
PCI_BASE_ADDRESS_SPACE_IO, &proxy->io_bar);
virtio_pci_modern_io_region_map(proxy, &proxy->notify_pio,
¬ify_pio.cap);
}
pci_register_bar(&proxy->pci_dev, proxy->modern_mem_bar_idx,
PCI_BASE_ADDRESS_SPACE_MEMORY |
PCI_BASE_ADDRESS_MEM_PREFETCH |
PCI_BASE_ADDRESS_MEM_TYPE_64,
&proxy->modern_bar);
proxy->config_cap = virtio_pci_add_mem_cap(proxy, &cfg.cap);
cfg_mask = (void *)(proxy->pci_dev.wmask + proxy->config_cap);
pci_set_byte(&cfg_mask->cap.bar, ~0x0);
pci_set_long((uint8_t *)&cfg_mask->cap.offset, ~0x0);
pci_set_long((uint8_t *)&cfg_mask->cap.length, ~0x0);
pci_set_long(cfg_mask->pci_cfg_data, ~0x0);
}
if (proxy->nvectors) {
int err = msix_init_exclusive_bar(&proxy->pci_dev, proxy->nvectors,
proxy->msix_bar_idx);
if (err) {
if (err != -ENOTSUP) {
error_report("unable to init msix vectors to %" PRIu32,
proxy->nvectors);
}
proxy->nvectors = 0;
}
}
proxy->pci_dev.config_write = virtio_write_config;
proxy->pci_dev.config_read = virtio_read_config;
if (legacy) {
size = VIRTIO_PCI_REGION_SIZE(&proxy->pci_dev)
+ virtio_bus_get_vdev_config_len(bus);
size = pow2ceil(size);
memory_region_init_io(&proxy->bar, OBJECT(proxy),
&virtio_pci_config_ops,
proxy, "virtio-pci", size);
pci_register_bar(&proxy->pci_dev, proxy->legacy_io_bar_idx,
PCI_BASE_ADDRESS_SPACE_IO, &proxy->bar);
}
}
| 1threat |
Convert CURRENT_TIMESTAMP to only Y-m-d : <p>I have a column named "timestamp" in my DB with datatype <code>timestamp</code> and standard <code>CURRENT_TIMESTAMP</code>.</p>
<p>When I echo it (<code>echo $row['timestamp'];</code>) i get this:</p>
<pre><code>2016-01-18 21:06:37
2016-01-19 12:32:16
2016-01-19 20:52:41
</code></pre>
<p>But I want it to turn out like this:</p>
<pre><code>2016-01-18
2016-01-19
2016-01-19
</code></pre>
<p>How should I do that? <code>Strftime</code> or something?</p>
| 0debug |
Prettify compiling C++ from Command Line : <p>I'm playing with compiling C++ from native Windows CMD via VS 2017 compiler (vsvarsall.bat setup).</p>
<p>Is there any way to reduce the output of <code>cl</code> command, like Microsoft rigths for compiler and linker?</p>
<p>Also, offtop question: is it possible to compile code with UNICODE or ANSI strings (like I'm able to build from Visual Studio IDE), or am I gotta use manual <code>#define</code>s? </p>
| 0debug |
static void machine_set_kernel_irqchip(Object *obj, bool value, Error **errp)
{
MachineState *ms = MACHINE(obj);
ms->kernel_irqchip = value;
}
| 1threat |
Fullscreen gradient not working CSS : <p>I want to put a gradient background in my website in HTML, but it isn't fullscreen!<br>
My code:<br></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.princip, .body, .html {
width:100%;
height:100%;
/* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffbfbf+0,23538a+100 */
background: rgb(255,191,191); /* Old browsers */
background: -moz-linear-gradient(45deg, rgba(255,191,191,1) 0%, rgba(35,83,138,1) 100%); /* FF3.6-15 */
background: -webkit-linear-gradient(45deg, rgba(255,191,191,1) 0%,rgba(35,83,138,1) 100%); /* Chrome10-25,Safari5.1-6 */
background: linear-gradient(45deg, rgba(255,191,191,1) 0%,rgba(35,83,138,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffbfbf', endColorstr='#23538a',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}</code></pre>
</div>
</div>
</p>
<p>There is still a little margin on the sides...</p>
| 0debug |
Cannot read property 'string' of undefined | React.PropTypes | LayoutPropTypes.js : <p>After deleting and reinstalling my node_modules folder, I'm facing an issue that I don't understand in LayoutPropTypes.js file.</p>
<p>In <code>node_modules/react-native/Libraries/StyleSheet/LayoutPropTypes.js</code>
The following variable is undefined : <code>var ReactPropTypes = require('React').PropTypes;</code></p>
<p>react-native: 0.45.1
react: 16.0.0-alpha.12</p>
| 0debug |
Crashlytics: How to see user name/email/id in crash details? : <p>I am using Crashlytics for collecting crashes from iOS app.
To make crash more specific I want to see user name/email/id in crash details.<br>
For this goal I use such code:</p>
<pre><code>[Crashlytics setUserIdentifier:@"userID"];
[Crashlytics setUserEmail:@"user@email.com"];
[Crashlytics setUserName:@"userName"];
</code></pre>
<p>When crash happens I cannot find a way to see this information in crash details.<br>
I see such screen:<br>
<a href="https://i.stack.imgur.com/rSajR.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rSajR.png" alt="enter image description here"></a></p>
<p>Question: How can I see user name/email/id in crash details?</p>
| 0debug |
sql server query data issue : **hi**
i have some employe data in my table in given format..
id name head month sal
1 A basic jan 1000
1 A hra jan 500
1 A basic feb 1000
1 A hra feb 500
1 A basic mar 1000
1 A hra mar 500
1 A basic apr 1000
1 A hra apr 500
1 A basic may 1000
1 A hra may 500
1 A basic june 1000
1 A hra june 500
1 A basic july 1000
1 A hra july 500
1 A basic aug 1000
1 A hra aug 500
1 A basic sep 1000
1 A hra sep 500
1 A basic oct 1000
1 A hra oct 500
1 A basic nov 1000
1 A hra nov 500
1 A basic dec 1000
1 A hra dec 500
2 B basic mar 2000
2 B hra mar 500
2 B basic apr 2000
2 B hra apr 500
2 B basic may 2000
2 B hra may 500
2 B basic june 2000
2 B hra june 500
2 B basic july 2000
2 B hra july 500
2 B basic aug 2000
2 B hra aug 500
2 B basic sep 2000
2 B hra sep 500
2 B basic oct 2000
2 B hra oct 500
2 B basic nov 2000
2 B hra nov 500
2 B basic dec 2000
2 B hra dec 500
3 C basic jan 5000
3 C hra jan 500
3 C basic feb 5000
3 C hra feb 500
3 C basic mar 5000
3 C hra mar 500
3 C basic apr 5000
3 C hra apr 500
3 C basic may 5000
3 C hra may 500
3 C basic june 5000
3 C hra june 500
3 C basic july 5000
3 C hra july 500
3 C basic aug 5000
3 C hra aug 500
3 C basic sep 5000
3 C hra sep 500
and i want to result in given formate..
id name head apr may jun jul aug sep oct nov dec jan feb mar total
1 A basic 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 12000
1 A hra 500 500 500 500 500 500 500 500 500 500 500 500 6000
2 B basic 2000 2000 2000 2000 2000 2000 2000 2000 2000 0 0 2000 24000
2 B hra 500 500 500 500 500 500 500 500 500 0 0 500 6000
3 C basic 5000 5000 5000 5000 5000 5000 0 0 0 5000 5000 5000 60000
3 C hra 500 500 500 500 500 500 0 0 0 500 500 500 6000
| 0debug |
How to get file name without file extension : <p>Im trying to get file name without its extension, i have the following code that let me take the file name with extension which is </p>
<pre><code>var docName = new DirectoryInfo("C:\\files\\").GetFiles("*.docx");
</code></pre>
<p>with that code im taking all of the file names then use them on </p>
<pre><code> for(int a = 0; a < docLength; a++)
{
Consol.WriteLine("Your File Name : {0}", docName[a] ) // this part is just ex.
}
</code></pre>
<p>when i execute the program it will list the file names like</p>
<pre><code>Test.txt
test.docx
</code></pre>
<p>and etc.</p>
<p>how can i get the document names without their extensions like</p>
<pre><code>test
</code></pre>
| 0debug |
About insertion and retieval of data in Datawindow : iam new to powerbuilder ,iam learning basic pb rightnow..
im not yet good at coding i need a help from anyone regarding a module iam doing right now. I have created an employee master table, and created two datawindows one is tabular and freeform for this table ,now i have allocated these datawindows in a single window one is front and other is back .my requirement is i want to insert the row in freeform view and reflect them back in tabular,during insertion it should check all scenarios like whether an empty row is there or not, if yes then it should set the focus to that empty row instead of inserting an empty row again.when double clicked on particular row in tabular it should retrieve that record in freeform view while hiding tabular datawindow. when i right click and select tabular view when iam in freeform view it should show me tabular view and vice versa..i need coding for all these can anyone help me out with this please thanks in advance !! | 0debug |
I want to perform login and logout in ios : <p>I applied login and logout using variables but it's not successfully perform.
I want to perform login and logout functionality in ios, how can i achieve the functionality. I am new in ios please help me out. </p>
| 0debug |
static void openpic_load_IRQ_queue(QEMUFile* f, IRQ_queue_t *q)
{
unsigned int i;
for (i = 0; i < BF_WIDTH(MAX_IRQ); i++)
qemu_get_be32s(f, &q->queue[i]);
qemu_get_sbe32s(f, &q->next);
qemu_get_sbe32s(f, &q->priority);
}
| 1threat |
static void RENAME(yuv2rgb32_1)(SwsContext *c, const int16_t *buf0,
const int16_t *ubuf[2], const int16_t *bguf[2],
const int16_t *abuf0, uint8_t *dest,
int dstW, int uvalpha, int y)
{
const int16_t *ubuf0 = ubuf[0], *ubuf1 = ubuf[1];
const int16_t *buf1= buf0;
if (uvalpha < 2048) {
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1(%%REGBP, %5)
YSCALEYUV2RGB1_ALPHA(%%REGBP)
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (abuf0), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
} else {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1(%%REGBP, %5)
"pcmpeqd %%mm7, %%mm7 \n\t"
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
}
} else {
if (CONFIG_SWSCALE_ALPHA && c->alpPixBuf) {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1b(%%REGBP, %5)
YSCALEYUV2RGB1_ALPHA(%%REGBP)
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (abuf0), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
} else {
__asm__ volatile(
"mov %%"REG_b", "ESP_OFFSET"(%5) \n\t"
"mov %4, %%"REG_b" \n\t"
"push %%"REG_BP" \n\t"
YSCALEYUV2RGB1b(%%REGBP, %5)
"pcmpeqd %%mm7, %%mm7 \n\t"
WRITEBGR32(%%REGb, 8280(%5), %%REGBP, %%mm2, %%mm4, %%mm5, %%mm7, %%mm0, %%mm1, %%mm3, %%mm6)
"pop %%"REG_BP" \n\t"
"mov "ESP_OFFSET"(%5), %%"REG_b" \n\t"
:: "c" (buf0), "d" (buf1), "S" (ubuf0), "D" (ubuf1), "m" (dest),
"a" (&c->redDither)
);
}
}
}
| 1threat |
Infinite yield possible on 'ReplicatedStorage:WaitForChild("Animations")' : local RS = game:GetService("ReplicatedStorage")
local Event = Instance.new("RemoteEvent", RS)
Event.Name = "PunchEvent"
local function FiredEvent(Player)
local Character = game.Workspace:WaitForChild(Player.Name)
local Animation = RS:WaitForChild("Animations"):GetChildren()[math.random(1, #RS.Animations:GetChildren())]
print(Animation)
local RandomAnim = Character.Humanoid:LoadAnimation(Animation)
RandomAnim:Play()
local Damage = script.Damage:Clone()
if Animation.Name == "Right Arm" then
Damage.Parent = Character:WaitForChild("Right Arm")
end
Damage.Disabled = false
wait(1.4)
Damage:Destroy()
end
Event.OnServerEvent:Connect(FiredEvent)[enter image description here][1]
[1]: https://i.stack.imgur.com/Uy7U8.png | 0debug |
Group by consecutive index numbers : <p>I was wondering if there is a way to groupby consecutive index numbers and move the groups in different columns. Here is an example of the DataFrame I'm using:</p>
<pre><code> 0
0 19218.965703
1 19247.621650
2 19232.651322
9 19279.216956
10 19330.087371
11 19304.316973
</code></pre>
<p>And my idea is to gruoup by sequential index numbers and get something like this:</p>
<pre><code> 0 1
0 19218.965703 19279.216956
1 19247.621650 19330.087371
2 19232.651322 19304.316973
</code></pre>
<p>Ive been trying to split my data by blocks of 3 and then groupby but I was looking more about something that can be used to group and rearrange sequential index numbers.
Thank you!</p>
| 0debug |
Implementing concurrent_vector according to intel blog : <p>I am trying to implement a thread-safe lockless container, analogous to std::vector, according to this <a href="https://software.intel.com/en-us/blogs/2008/07/24/tbbconcurrent_vector-secrets-of-memory-organization" rel="noreferrer">https://software.intel.com/en-us/blogs/2008/07/24/tbbconcurrent_vector-secrets-of-memory-organization</a></p>
<p>From what I understood, to prevent re-allocations and invalidating all iterators on all threads, instead of a single contiguous array, they add new contiguous blocks.<br>
Each block they add is with a size of increasing powers of 2, so they can use log(index) to find the proper segment where an item at [index] is supposed to be. </p>
<p>From what I gather, they have a static array of pointers to segments, so they can quickly access them, however they don't know how many segments the user wants, so they made a small initial one and if the amount of segments exceeds the current count, they allocate a huge one and switch to using that one.</p>
<p>The problem is, adding a new segment can't be done in a lockless thread safe manner or at least I haven't figured out how. I can atomically increment the current size, but only that.<br>
And also switching from the small to the large array of segment pointers involves a big allocation and memory copies, so I can't understand how they are doing it. </p>
<p>They have some code posted online, but all the important functions are without available source code, they are in their Thread Building Blocks DLL. Here is some code that demonstrates the issue:</p>
<pre><code>template<typename T>
class concurrent_vector
{
private:
int size = 0;
int lastSegmentIndex = 0;
union
{
T* segmentsSmall[3];
T** segmentsLarge;
};
void switch_to_large()
{
//Bunch of allocations, creates a T* segmentsLarge[32] basically and reassigns all old entries into it
}
public:
concurrent_vector()
{
//The initial array is contiguous just for the sake of cache optimization
T* initialContiguousBlock = new T[2 + 4 + 8]; //2^1 + 2^2 + 2^3
segmentsSmall[0] = initialContiguousBlock;
segmentsSmall[1] = initialContiguousBlock + 2;
segmentsSmall[2] = initialContiguousBlock + 2 + 4;
}
void push_back(T& item)
{
if(size > 2 + 4 + 8)
{
switch_to_large(); //This is the problem part, there is no possible way to make this thread-safe without a mutex lock. I don't understand how Intel does it. It includes a bunch of allocations and memory copies.
}
InterlockedIncrement(&size); //Ok, so size is atomically increased
//afterwards adds the item to the appropriate slot in the appropriate segment
}
};
</code></pre>
| 0debug |
static ssize_t qcow2_crypto_hdr_init_func(QCryptoBlock *block, size_t headerlen,
void *opaque, Error **errp)
{
BlockDriverState *bs = opaque;
BDRVQcow2State *s = bs->opaque;
int64_t ret;
int64_t clusterlen;
ret = qcow2_alloc_clusters(bs, headerlen);
if (ret < 0) {
error_setg_errno(errp, -ret,
"Cannot allocate cluster for LUKS header size %zu",
headerlen);
return -1;
}
s->crypto_header.length = headerlen;
s->crypto_header.offset = ret;
clusterlen = size_to_clusters(s, headerlen) * s->cluster_size;
ret = bdrv_pwrite_zeroes(bs->file,
ret + headerlen,
clusterlen - headerlen, 0);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not zero fill encryption header");
return -1;
}
return ret;
} | 1threat |
Nginx reverse proxy error:14077438:SSL SSL_do_handshake() failed : <p>So i am using following settings to create one reverse proxy for site as below. </p>
<pre><code> server {
listen 80;
server_name mysite.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /home/ubuntu/p3;
location / {
proxy_pass https://mysiter.com/;
proxy_redirect https://mysiter.com/ $host;
proxy_set_header Accept-Encoding "";
}
}
</code></pre>
<p>But getting BAD GATE WAY 502 error and below is the log.</p>
<pre><code>2016/08/13 09:42:28 [error] 26809#0: *60 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 103.255.5.68, server: mysite.com, request: "GET / HTTP/1.1", upstream: "https://105.27.188.213:443/", host: "mysite.com"
2016/08/13 09:42:28 [error] 26809#0: *60 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 103.255.5.68, server: mysite.com, request: "GET / HTTP/1.1", upstream: "https://105.27.188.213:443/", host: "mysite.com"
</code></pre>
<p>Any help will be greatly appreciated. </p>
| 0debug |
Find element by id in react-testing-library : <p>I'm using <a href="https://github.com/kentcdodds/react-testing-library" rel="noreferrer">react-testing-libarary</a> to test my react application. For some reason, I need to be able to find the element by <code>id</code> and not <code>data-testid</code>. There is no way to achieve this in the documentation.</p>
<p>Is there a way to achieve this?</p>
<p>I've the rendered output as:</p>
<pre><code>const dom = render(<App />);
</code></pre>
<p>I'm looking for something in line of:</p>
<pre><code>const input = dom.getElemenById('firstinput');
//or
const input = dom.getById('firstinput');
</code></pre>
| 0debug |
static int vorbis_floor1_decode(vorbis_context *vc,
vorbis_floor_data *vfu, float *vec)
{
vorbis_floor1 *vf = &vfu->t1;
GetBitContext *gb = &vc->gb;
uint16_t range_v[4] = { 256, 128, 86, 64 };
unsigned range = range_v[vf->multiplier - 1];
uint16_t floor1_Y[258];
uint16_t floor1_Y_final[258];
int floor1_flag[258];
unsigned partition_class, cdim, cbits, csub, cval, offset, i, j;
int book, adx, ady, dy, off, predicted, err;
if (!get_bits1(gb))
return 1;
floor1_Y[0] = get_bits(gb, ilog(range - 1));
floor1_Y[1] = get_bits(gb, ilog(range - 1));
av_dlog(NULL, "floor 0 Y %d floor 1 Y %d \n", floor1_Y[0], floor1_Y[1]);
offset = 2;
for (i = 0; i < vf->partitions; ++i) {
partition_class = vf->partition_class[i];
cdim = vf->class_dimensions[partition_class];
cbits = vf->class_subclasses[partition_class];
csub = (1 << cbits) - 1;
cval = 0;
av_dlog(NULL, "Cbits %u\n", cbits);
if (cbits)
cval = get_vlc2(gb, vc->codebooks[vf->class_masterbook[partition_class]].vlc.table,
vc->codebooks[vf->class_masterbook[partition_class]].nb_bits, 3);
for (j = 0; j < cdim; ++j) {
book = vf->subclass_books[partition_class][cval & csub];
av_dlog(NULL, "book %d Cbits %u cval %u bits:%d\n",
book, cbits, cval, get_bits_count(gb));
cval = cval >> cbits;
if (book > -1) {
floor1_Y[offset+j] = get_vlc2(gb, vc->codebooks[book].vlc.table,
vc->codebooks[book].nb_bits, 3);
} else {
floor1_Y[offset+j] = 0;
}
av_dlog(NULL, " floor(%d) = %d \n",
vf->list[offset+j].x, floor1_Y[offset+j]);
}
offset+=cdim;
}
floor1_flag[0] = 1;
floor1_flag[1] = 1;
floor1_Y_final[0] = floor1_Y[0];
floor1_Y_final[1] = floor1_Y[1];
for (i = 2; i < vf->x_list_dim; ++i) {
unsigned val, highroom, lowroom, room, high_neigh_offs, low_neigh_offs;
low_neigh_offs = vf->list[i].low;
high_neigh_offs = vf->list[i].high;
dy = floor1_Y_final[high_neigh_offs] - floor1_Y_final[low_neigh_offs];
adx = vf->list[high_neigh_offs].x - vf->list[low_neigh_offs].x;
ady = FFABS(dy);
err = ady * (vf->list[i].x - vf->list[low_neigh_offs].x);
off = err / adx;
if (dy < 0) {
predicted = floor1_Y_final[low_neigh_offs] - off;
} else {
predicted = floor1_Y_final[low_neigh_offs] + off;
}
val = floor1_Y[i];
highroom = range-predicted;
lowroom = predicted;
if (highroom < lowroom) {
room = highroom * 2;
} else {
room = lowroom * 2;
}
if (val) {
floor1_flag[low_neigh_offs] = 1;
floor1_flag[high_neigh_offs] = 1;
floor1_flag[i] = 1;
if (val >= room) {
if (highroom > lowroom) {
floor1_Y_final[i] = av_clip_uint16(val - lowroom + predicted);
} else {
floor1_Y_final[i] = av_clip_uint16(predicted - val + highroom - 1);
}
} else {
if (val & 1) {
floor1_Y_final[i] = av_clip_uint16(predicted - (val + 1) / 2);
} else {
floor1_Y_final[i] = av_clip_uint16(predicted + val / 2);
}
}
} else {
floor1_flag[i] = 0;
floor1_Y_final[i] = av_clip_uint16(predicted);
}
av_dlog(NULL, " Decoded floor(%d) = %u / val %u\n",
vf->list[i].x, floor1_Y_final[i], val);
}
ff_vorbis_floor1_render_list(vf->list, vf->x_list_dim, floor1_Y_final, floor1_flag, vf->multiplier, vec, vf->list[1].x);
av_dlog(NULL, " Floor decoded\n");
return 0;
}
| 1threat |
static bool memory_region_dispatch_read(MemoryRegion *mr,
hwaddr addr,
uint64_t *pval,
unsigned size)
{
if (!memory_region_access_valid(mr, addr, size, false)) {
*pval = unassigned_mem_read(mr, addr, size);
return true;
}
*pval = memory_region_dispatch_read1(mr, addr, size);
adjust_endianness(mr, pval, size);
return false;
}
| 1threat |
HOW TO UPDATE AND OUTPUT DATABASE WITHOUT RELOADING THE PAGE? : I'm sorry if this may seem so redundant. But I tried my best to understand other posts' problems that is same as mine but still i can't get into any solutions. So just please bare with me this time.
Okay. So I have a data which is a name. And I am having an **input type=text** where the value is equals to the name, together with a **button type=submit**. So what i'm trying to do is that, i want to change and update the name in my database and also output the new name without reloading the page at once because i want to run a JS function (Not Alert but a Toast Notification) which is i cannot do. So to shorten, ( EDIT -> UPDATE -> SHOW = without reloading the page). Please help me. Thank you in advance.
**profile.php (FORM CODE)**
<form action="profile.php" method="GET">
<input type="text" id="changename" name="changename" class="form-control" placeholder="New Name" required>
<button id="btnchange" type="submit"></button>
</form>
**profile.php (PHP CODE)**
<?php
if(isset($_POST['changename'])) {
require 'connect.php';
$newname = $_POST['changename'];
$user_id = $_SESSION['temp_user'];
$sql = "UPDATE login SET login_name='$newname' WHERE user_id='$user_id'";
if(mysqli_query($conn, $sql)){
header('location: profile.php');
// MY JS FUNCTION HERE //
}
mysqli_close($conn);
}
?>
| 0debug |
static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = pflash_cfi01_realize;
dc->props = pflash_cfi01_properties;
dc->vmsd = &vmstate_pflash;
set_bit(DEVICE_CATEGORY_STORAGE, dc->categories);
} | 1threat |
How can i use loop "while" in GUI? : I have function
```java
public String namefunction(){while(true){
StringBuilder a = new StringBuilder();
do something
return a;
}}
```
And now i would like to create GUI and JButton.
But i would like to get result from ```namefunction()``` after ONE LOOP after i click this button. How can i do it?
```java
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(myButton1)) {
tekst4.setText(namefunction());
}}
``` | 0debug |
Return pointer to a structure - C : i have this program, where you enter two dates into two structures (same type), and then I want a function to find which date i entered is the later date. It compares only year and month. Once the later date is found, i want the function to return a pointer to the structure with the later date. I then want to print out the later date.
This is what I have so far, but I get errors and I'm not sure about the pointer syntax.
#include <stdio.h>
struct date{
int year;
int month;
int day;
};
main()
{
struct date dates[2];
int i = 0, res = 0;
for ( i = 0 ; i < 2 ; i++){
printf("Enter a year!");
scanf("%d", &dates[i].year);
printf("Enter a month!");
scanf("%d", &dates[i].month);
printf("Enter a day!");
scanf("%d", &dates[i].day);
}
res = later(&dates[1], &dates[2]);
printf("%d", &res);
}
int later(struct date *one, struct date *two){
if (one->year > two->year){
return *one;
}
else if (one->year == two->year){
if(one->month > two->month){
return *one;
}
else
return *two;
}
else {
return *two;
}
} | 0debug |
static void scsi_destroy(SCSIDevice *dev)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
scsi_disk_purge_requests(s);
blockdev_mark_auto_del(s->qdev.conf.dinfo->bdrv);
}
| 1threat |
In oracle 11g ,How to insert large data(more than field size) in specific field without changing datatype : I have large data (more than 4000 character) and i have field with varchar2(4000) datatype.I am just trying to insert that data in field without changing datatype.
Is thi possible? Please take me out from this problem.
Thank you in advanced. | 0debug |
Object *object_new_with_propv(const char *typename,
Object *parent,
const char *id,
Error **errp,
va_list vargs)
{
Object *obj;
ObjectClass *klass;
Error *local_err = NULL;
klass = object_class_by_name(typename);
if (!klass) {
error_setg(errp, "invalid object type: %s", typename);
return NULL;
}
if (object_class_is_abstract(klass)) {
error_setg(errp, "object type '%s' is abstract", typename);
return NULL;
}
obj = object_new(typename);
if (object_set_propv(obj, &local_err, vargs) < 0) {
goto error;
}
object_property_add_child(parent, id, obj, &local_err);
if (local_err) {
goto error;
}
if (object_dynamic_cast(obj, TYPE_USER_CREATABLE)) {
user_creatable_complete(obj, &local_err);
if (local_err) {
object_unparent(obj);
goto error;
}
}
object_unref(OBJECT(obj));
return obj;
error:
if (local_err) {
error_propagate(errp, local_err);
}
object_unref(obj);
return NULL;
}
| 1threat |
how are function parameters initialized implicitly? : <p>I'm attempting to understand how are <code>image</code> and <code>imageData</code> populated. They are not declared anywhere. How does the parent function know what values to pass to these two parameters?</p>
<pre><code>var Jimp = require("jimp");
module.exports = function (context, myBlob) {
Jimp.read(myBlob, function(err, image) {
image.getBuffer(Jimp.MIME_TIFF, function(error, imageData) {
context.bindings.outputBlob = imageData;
context.done();
});
});
};
</code></pre>
| 0debug |
Why I didn't see Auto-Renewable Subscription in iTunes Connect : <p>Why I didn't see Auto-Renewable Subscription in iTunes Connect -> In-App Purchases -> Select the In-App Purchase you want to create.</p>
<p>I see only Consumable, Non-Consumable, Non-Renewing Subscription
<a href="https://i.stack.imgur.com/FUbRQ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/FUbRQ.png" alt="enter image description here"></a></p>
| 0debug |
Why does Windows 10 start extra threads in my program? : <p>With Visual Studio 2015, in a new, empty C++ project, build the following for Console application:</p>
<pre><code>int main() {
return 0;
}
</code></pre>
<p>Set a break point on the return and launch the program in the debugger. On Windows 7, as of the break point, this program has only one thread. But on Windows 10, it has five(!) threads: the main thread and four "worker threads" waiting on a synchronization object.</p>
<p>Who's starting up the thread pool (or how do I find out)?</p>
| 0debug |
static inline void gen_op_eval_fbg(TCGv dst, TCGv src,
unsigned int fcc_offset)
{
gen_mov_reg_FCC0(dst, src, fcc_offset);
tcg_gen_xori_tl(dst, dst, 0x1);
gen_mov_reg_FCC1(cpu_tmp0, src, fcc_offset);
tcg_gen_and_tl(dst, dst, cpu_tmp0);
}
| 1threat |
static int64_t qemu_next_alarm_deadline(void)
{
int64_t delta;
int64_t rtdelta;
if (!use_icount && vm_clock->active_timers) {
delta = vm_clock->active_timers->expire_time -
qemu_get_clock_ns(vm_clock);
} else {
delta = INT32_MAX;
}
if (host_clock->active_timers) {
int64_t hdelta = host_clock->active_timers->expire_time -
qemu_get_clock_ns(host_clock);
if (hdelta < delta) {
delta = hdelta;
}
}
if (rt_clock->active_timers) {
rtdelta = (rt_clock->active_timers->expire_time -
qemu_get_clock_ns(rt_clock));
if (rtdelta < delta) {
delta = rtdelta;
}
}
return delta;
}
| 1threat |
static DeviceState *qbus_find_dev(BusState *bus, char *elem)
{
DeviceState *dev;
LIST_FOREACH(dev, &bus->children, sibling) {
if (dev->id && strcmp(dev->id, elem) == 0) {
return dev;
}
}
LIST_FOREACH(dev, &bus->children, sibling) {
if (strcmp(dev->info->name, elem) == 0) {
return dev;
}
}
LIST_FOREACH(dev, &bus->children, sibling) {
if (dev->info->alias && strcmp(dev->info->alias, elem) == 0) {
return dev;
}
}
return NULL;
}
| 1threat |
Javascript show div after a few clicks : I'm new in Javascript and I can't find the answer for my question. Is it possible that my javascript views a div after if you clicked 5 times? If this is the case, how can I make this possible?
Thanks! | 0debug |
get all colors in a pixelated image in android : i am using android studio and i want to get all colors in a pixelated image. I have a pixelated image of 50x50 size. here is that image
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/xrpVo.jpg
I'm reading all pixels in it by using that code.
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.abc);
for(int x=0; x<50; x++){
for(int y=0; y<50; y++){
pixelColor = bmp.getPixel(x,y);
if(pixelColor == Color.BLACK) {
//The pixel is black
}
else if(pixelColor == Color.WHITE) {
//The pixel was white
}
}
}
But the problem is that, image has also black color in it and in my code black color condition never get true. i want to extract all colors in that image. please let me know where i'm doing wrong. Thank you. | 0debug |
Object Mapping for XML - MOXy Alternative : I've been looking for an object mapper that can use XPath to map variables from one object or an XML web service response to another object. Most preferred approach is through annotations.
The closest I've found is MOXy (https://www.eclipse.org/eclipselink/documentation/2.4/moxy/advanced_concepts005.htm). Here's an example:
@XmlPath("node[@name='first-name']/text()")
private String firstName;
However it doesn't support the xpath 'parent' (http://stackoverflow.com/questions/8404134/eclipselink-moxy-xmlpath-support-for-axes-parent/8405140#8405140) or 'child'(http://stackoverflow.com/questions/9582249/eclipselink-moxy-xpath-selecting-all-child-elements-of-the-current-node-or-all) checks.
ie: this is an example of what I want to be able to do:
XML:
<Customer>
<Field>
<Type>Code</Type>
<Value>abc</Value>
</Field>
<Field>
<Type>Name</Type>
<Value>cde</Value>
</Field>
...
</Customer>
Java
@XmlPath("Customer/Field[child::Type='Code']/Value/text()")
private String CustomerCode;
Does anyone know of alternatives to MOXy that offers xpath support for parent/child checks, or a work around to MOXy for parent/child checks?
| 0debug |
SQLite database is locked in C# : i have 2 quaries but on update `cmd2.ExecuteNonQuery();` it throw exception database is locked
if (txt_balance.Text != "")
{
using ( SQLiteConnection con = new SQLiteConnection(obj.getDbSourceFile))
{
con.Open();
SQLiteCommand cmd1 = new SQLiteCommand("SELECT [supplier_balance] FROM [s_supplier] where supplier_name='" + comboPurchaseSupplier.Text + "'", con);
SQLiteDataReader DR = cmd1.ExecuteReader();
// hfcconn.Close();
if (DR.HasRows)
{
if (DR.Read())
{
//hfcconn.Open();
using (SQLiteConnection con2 = new SQLiteConnection(obj.getDbSourceFile))
{
SQLiteCommand cmd2 = new SQLiteCommand("update [s_supplier] set supplier_balance=" + (DR.GetInt32(0) + Convert.ToInt32(txt_balance.Text)) + " where supplier_name='" + comboPurchaseSupplier.Text + "'", con2);
con2.Open();
cmd2.ExecuteNonQuery();
DR.Dispose();
// con.Close();
}
}
}
// con.Close();
}
}
| 0debug |
I want make a list for who is the richest user using JSON : <p>I want to make a list of the richest user using JSON</p>
<p>So there's my code</p>
<p><code>var users = {'Johnny': {points: 20}, 'Kyle': {points: 30}};
</code></p>
<p>I want it logged in console like</p>
<p><code>1. Kyle points: 30
2. Johnny points: 20
</code></p>
<p>So how?</p>
| 0debug |
Looking for example code of a JavaFx TableView with only one Button inside a column? : <p>What I am trying to create is a scrollable all button GUI layout. I was able to achieve this with 4 different ListViews but I didn't like the four scroll bars attached to the list views. The number of buttons will be figured out at run-time because it will depend on the number of entries in a database. I Think a TableView will be better for my situation.</p>
<p><a href="https://i.stack.imgur.com/Neo1J.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Neo1J.png" alt="enter image description here"></a></p>
| 0debug |
Carbon - why addMonths() change the day of month? : <p>Here's the simple example (today is 2016-08-29):</p>
<pre><code>var_dump(Carbon::now());
var_dump(Carbon::now()->addMonths(6));
</code></pre>
<p>Output:</p>
<pre><code>object(Carbon\Carbon)#303 (3) {
["date"] => string(26) "2016-08-29 15:37:11.000000"
}
object(Carbon\Carbon)#303 (3) {
["date"] => string(26) "2017-03-01 15:37:11.000000"
}
</code></pre>
<p>For <code>Carbon::now()->addMonths(6)</code> I'm expecting <code>2017-02-29</code>, not <code>2017-03-01</code>.</p>
<p>Am I missing something about date modifications?</p>
| 0debug |
static int audio_pcm_info_eq (struct audio_pcm_info *info, audsettings_t *as)
{
int bits = 8, sign = 0;
switch (as->fmt) {
case AUD_FMT_S8:
sign = 1;
case AUD_FMT_U8:
break;
case AUD_FMT_S16:
sign = 1;
case AUD_FMT_U16:
bits = 16;
break;
case AUD_FMT_S32:
sign = 1;
case AUD_FMT_U32:
bits = 32;
break;
}
return info->freq == as->freq
&& info->nchannels == as->nchannels
&& info->sign == sign
&& info->bits == bits
&& info->swap_endianness == (as->endianness != AUDIO_HOST_ENDIANNESS);
}
| 1threat |
static void openpic_reset (void *opaque)
{
openpic_t *opp = (openpic_t *)opaque;
int i;
opp->glbc = 0x80000000;
opp->frep = ((OPENPIC_EXT_IRQ - 1) << 16) | ((MAX_CPU - 1) << 8) | VID;
opp->veni = VENI;
opp->pint = 0x00000000;
opp->spve = 0x000000FF;
opp->tifr = 0x003F7A00;
opp->micr = 0x00000000;
for (i = 0; i < opp->max_irq; i++) {
opp->src[i].ipvp = 0xA0000000;
opp->src[i].ide = 0x00000000;
}
for (i = 0; i < MAX_CPU; i++) {
opp->dst[i].pctp = 0x0000000F;
opp->dst[i].pcsr = 0x00000000;
memset(&opp->dst[i].raised, 0, sizeof(IRQ_queue_t));
memset(&opp->dst[i].servicing, 0, sizeof(IRQ_queue_t));
}
for (i = 0; i < MAX_TMR; i++) {
opp->timers[i].ticc = 0x00000000;
opp->timers[i].tibc = 0x80000000;
}
#if MAX_DBL > 0
opp->dar = 0x00000000;
for (i = 0; i < MAX_DBL; i++) {
opp->doorbells[i].dmr = 0x00000000;
}
#endif
#if MAX_MBX > 0
for (i = 0; i < MAX_MBX; i++) {
opp->mailboxes[i].mbr = 0x00000000;
}
#endif
opp->glbc = 0x00000000;
} | 1threat |
static int verify_md5(HEVCContext *s, AVFrame *frame)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
int pixel_shift = desc->comp[0].depth_minus1 > 7;
int i, j;
if (!desc)
return AVERROR(EINVAL);
av_log(s->avctx, AV_LOG_DEBUG, "Verifying checksum for frame with POC %d: ",
s->poc);
#if HAVE_BIGENDIAN
if (pixel_shift && !s->checksum_buf) {
av_fast_malloc(&s->checksum_buf, &s->checksum_buf_size,
FFMAX3(frame->linesize[0], frame->linesize[1],
frame->linesize[2]));
if (!s->checksum_buf)
return AVERROR(ENOMEM);
}
#endif
for (i = 0; frame->data[i]; i++) {
int width = s->avctx->coded_width;
int height = s->avctx->coded_height;
int w = (i == 1 || i == 2) ? (width >> desc->log2_chroma_w) : width;
int h = (i == 1 || i == 2) ? (height >> desc->log2_chroma_h) : height;
uint8_t md5[16];
av_md5_init(s->md5_ctx);
for (j = 0; j < h; j++) {
const uint8_t *src = frame->data[i] + j * frame->linesize[i];
#if HAVE_BIGENDIAN
if (pixel_shift) {
s->dsp.bswap16_buf((uint16_t*)s->checksum_buf,
(const uint16_t*)src, w);
src = s->checksum_buf;
}
#endif
av_md5_update(s->md5_ctx, src, w << pixel_shift);
}
av_md5_final(s->md5_ctx, md5);
if (!memcmp(md5, s->md5[i], 16)) {
av_log (s->avctx, AV_LOG_DEBUG, "plane %d - correct ", i);
print_md5(s->avctx, AV_LOG_DEBUG, md5);
av_log (s->avctx, AV_LOG_DEBUG, "; ");
} else {
av_log (s->avctx, AV_LOG_ERROR, "mismatching checksum of plane %d - ", i);
print_md5(s->avctx, AV_LOG_ERROR, md5);
av_log (s->avctx, AV_LOG_ERROR, " != ");
print_md5(s->avctx, AV_LOG_ERROR, s->md5[i]);
av_log (s->avctx, AV_LOG_ERROR, "\n");
return AVERROR_INVALIDDATA;
}
}
av_log(s->avctx, AV_LOG_DEBUG, "\n");
return 0;
}
| 1threat |
def largest_subset(a, n):
dp = [0 for i in range(n)]
dp[n - 1] = 1;
for i in range(n - 2, -1, -1):
mxm = 0;
for j in range(i + 1, n):
if a[j] % a[i] == 0 or a[i] % a[j] == 0:
mxm = max(mxm, dp[j])
dp[i] = 1 + mxm
return max(dp) | 0debug |
I need Advice in building Neural Network in tweets emotion classification? : I got dataset of four emotion labelled tweets (anger,joy,fear,sad). I transformed tweets to vector looks like that (avg. of frequency distribution to anger tokens, word2vec similarity to anger, avg. of anger in emotion lexicon, avg. of anger in hashtag lexicon) and so for the other emotion set (joy,fear, and sad), is that vector a valid to train my network ?
| 0debug |
static int gdb_handle_vcont(GDBState *s, const char *p)
{
int res, idx, signal = 0;
char cur_action;
char *newstates;
unsigned long tmp;
CPUState *cpu;
#ifdef CONFIG_USER_ONLY
int max_cpus = 1;
CPU_FOREACH(cpu) {
max_cpus = max_cpus <= cpu->cpu_index ? cpu->cpu_index + 1 : max_cpus;
}
#endif
newstates = g_new0(char, max_cpus);
CPU_FOREACH(cpu) {
newstates[cpu->cpu_index] = 1;
}
res = 0;
while (*p) {
if (*p++ != ';') {
res = -ENOTSUP;
goto out;
}
cur_action = *p++;
if (cur_action == 'C' || cur_action == 'S') {
cur_action = tolower(cur_action);
res = qemu_strtoul(p + 1, &p, 16, &tmp);
if (res) {
goto out;
}
signal = gdb_signal_to_target(tmp);
} else if (cur_action != 'c' && cur_action != 's') {
res = -ENOTSUP;
goto out;
}
if ((p[0] == ':' && p[1] == '-' && p[2] == '1') || (p[0] != ':')) {
if (*p == ':') {
p += 3;
}
for (idx = 0; idx < max_cpus; idx++) {
if (newstates[idx] == 1) {
newstates[idx] = cur_action;
}
}
} else if (*p == ':') {
p++;
res = qemu_strtoul(p, &p, 16, &tmp);
if (res) {
goto out;
}
cpu = tmp ? find_cpu(tmp) : first_cpu;
if (!cpu) {
res = -EINVAL;
goto out;
}
if (newstates[cpu->cpu_index] == 1) {
newstates[cpu->cpu_index] = cur_action;
}
}
}
s->signal = signal;
gdb_continue_partial(s, newstates);
out:
g_free(newstates);
return res;
}
| 1threat |
how to parse this json getting in the response : i know this is invalid json but i am getting this json in response from creditswitch api i cannot change this response but i want to parse this json
when i replace this just details key like
{
"statusCode": "00",
"statusDescription": {
"customerNo": 283375350,
"accountStatus": "OPEN",
"firstname": "ADVENTURE",
"lastname": "MOBILE",
"customerType": "SUD",
"invoicePeriod": 1,
"dueDate": "2018-09-29T00:00:00+01:00"
}
}
i get valid json but how to remove that 1st part of json i dont know any solution over it following is the original json i am getting.
{
"details": {
"number": "10553886499",
"requestType": "VALIDATE_DEVICE_NUMBER"
},
"serviceId": "AQA"
}
{
"statusCode": "00",
"statusDescription": {
"customerNo": 283375350,
"accountStatus": "OPEN",
"firstname": "ADVENTURE",
"lastname": "MOBILE",
"customerType": "SUD",
"invoicePeriod": 1,
"dueDate": "2018-09-29T00:00:00+01:00"
}
} | 0debug |
Cache docker images on Travis CI : <p>Is it possible to cache docker images on Travis CI? Attempting to cache the <code>/var/lib/docker/aufs/diff</code> folder and <code>/var/lib/docker/repositories-aufs</code> file with cache.directories in the travis.yml doesn't seem to work since they require root.</p>
| 0debug |
void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f)
{
SaveStateEntry *se;
QTAILQ_FOREACH(se, &savevm_handlers, entry) {
if (se->save_live_state) {
se->save_live_state(mon, f, -1, se->opaque);
}
}
}
| 1threat |
Checkbox not working with materializecss - HTML, CSS : <p>I can't seem to get checkbox to work whilst using the materializecss, as anyone else came cross this issue and managed to fix it?</p>
<p>The library I am using: </p>
<pre><code><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
</code></pre>
<p>Checkbox without library - <a href="https://jsfiddle.net/d2yk4sbv/2/" rel="noreferrer">https://jsfiddle.net/d2yk4sbv/2/</a></p>
<pre><code> <div><label> <input type=checkbox> label 1 </label></div>
</code></pre>
<p>Checkbox with library - <a href="https://jsfiddle.net/d2yk4sbv/" rel="noreferrer">https://jsfiddle.net/d2yk4sbv/</a></p>
<pre><code> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/css/materialize.min.css">
<div><label> <input type=checkbox> label 1 </label></div>
</code></pre>
<p>The checkbox seems to be working fine without the library but the problem is, my application depends on using the materializecss so I can't afford to not use it :(</p>
<p>Link to the materializecss website - <a href="http://materializecss.com/" rel="noreferrer">http://materializecss.com/</a></p>
| 0debug |
Symfony can changing the 'secret' parameter break anything? : <p>In the <strong>parameters.yml</strong> file there is a parameter named <strong>secret</strong> which defaults to <code>ThisTokenIsNotSoSecretChangeIt</code> but it should be changed to something else.</p>
<p>What happens if the value of this parameter is changed in production? Can it break anything? </p>
| 0debug |
React-Native: Unable to open device settings from my android app : <p>I'm using React-Native (^0.35.0) for making Android application. There is scenario where I need to check whether internet connectivity is present or not. If there is no internet connectivity then I need show a button which will open device settings (through which user can enable his connectivity).</p>
<p>I'm Using <strong>Linking</strong> library provided by react-native.</p>
<p>I am trying in followin way:</p>
<pre><code>componentWillMount(){
Linking.canOpenURL('app-settings:')
.then(supported => {
if (!supported) {
console.log('Can\'t handle url: ' + url);
} else {
return Linking.openURL('app-settings:');
}
}).catch(err => console.error('An error occurred', err));
}
</code></pre>
<p>then above code gives- console <strong>Can't handle url:app-settings:</strong></p>
<p>When I tried following:</p>
<pre><code>componentWillMount(){
Linking.canOpenURL('app-settings:')
.then(supported => {
return Linking.openURL('app-settings:');
}).catch(err => console.error('An error occurred', err));
}
</code></pre>
<p>Above code gives- <strong>Error: Could not open URL 'app-settings:': No Activity found to handle Intent { act=android.intent.action.VIEW dat=app-settings: flg=0x10000000 }</strong></p>
<p>Is there anything that I am missing here? or Is there is need to change in any other file like <strong>AndroidMainfest.xml</strong>, <strong>MainActivity.java</strong>, etc..</p>
| 0debug |
how to resolve this issue? : <pre><code>this is my code
package pack;
import java.awt.*;
import javax.swing.*;
public class MySwing
{
MySwing()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame f = new JFrame("This is my Frame");
JTabbedPane jtb= new JTabbedPane();
JPanel p1 = new JPanel();
JPanel p2 = new JPanel();
JPanel p3 = new JPanel();jtb.addTab("employee Info", p1);
jtb.addTab("employee Dept", p2); jtb.addTab("employee Salary", p3);
f.add(jtb);
JLabel l = new JLabel("User Name");
l.setForeground(Color.blue);
JTextField tf = new JTextField(20); tf.setFont(new Font("Coronet",Font.BOLD,20));
tf.setHorizontalAlignment(JTextField.RIGHT); tf.setBackground(Color.black);
tf.setForeground(Color.yellow);
JLabel l1 = new JLabel("Password: ");
JPasswordField pf = new JPasswordField(20);
JTextArea ta = new JTextArea(10,20);
JScrollPane sp = new JScrollPane(ta);
String str[]={"select the city","Noida","Delhi","Faridabad"};
JComboBox c= new JComboBox(str);
JList li = new JList(str);
JCheckBox cb1= new JCheckBox("I.Sc",true);
JCheckBox cb2= new JCheckBox("B.Sc"); JCheckBox cb3= new JCheckBox("M.Sc");
ButtonGroup cbg = new ButtonGroup(); JRadioButton cb4= new JRadioButton("Male",true);
JRadioButton cb5= new JRadioButton("Female",false);
cbg.add(cb4);cbg.add(cb5);
JButton b = new JButton("save");
p1.add(l);p1.add(tf);p1.add(l1);p1.add(pf);p2.add(sp);p2.add(c);p2.add(li);p2.add(cb1);p2.add(cb2);p2.add(cb3);
p3.add(cb4);p3.add(cb5);p3.add(b);
f.setSize(600,400); f.setLocation(200,100);
f.setVisible(true); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String arg[])
{
new MySwing();
}
}
</code></pre>
<p><strong>here this is the issue
MySwing.java uses unchecked or unsafe operations
recompile with -xlint:unchecked for details
help me to resolve this
this is not a error
but my system doesn't run it
resolve it</strong></p>
| 0debug |
hello guys I have problems with this code in unity 3D can someone help me? :
C# Example
Builds an asset bundle from the selected objects in the project view.
Once compiled go to "Menu" -> "Assets" and select one of the choices
to build the Asset Bundle
using UnityEngine;
using UnityEditor;
public class ExportAssetBundles {
[MenuItem("Assets/Build AssetBundle From Selection - Track dependencies")]
static void ExportResource () {
// Bring up save panel
string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
if (path.Length != 0) {
// Build the resource file from the active selection.
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path,
BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.Android);
Selection.objects = selection;
}
}
[MenuItem("Assets/Build AssetBundle From Selection - No dependency tracking")]
static void ExportResourceNoTrack () {
// Bring up save panel
string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
if (path.Length != 0) {
// Build the resource file from the active selection.
BuildPipeline.BuildAssetBundle(Selection.activeObject, Selection.objects, path);
}
}
} | 0debug |
static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame_ptr, AVPacket *avpkt)
{
AVFrame *frame = data;
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end;
int buf_size = avpkt->size;
VmdAudioContext *s = avctx->priv_data;
int block_type, silent_chunks, audio_chunks;
int ret;
uint8_t *output_samples_u8;
int16_t *output_samples_s16;
if (buf_size < 16) {
av_log(avctx, AV_LOG_WARNING, "skipping small junk packet\n");
*got_frame_ptr = 0;
return buf_size;
}
block_type = buf[6];
if (block_type < BLOCK_TYPE_AUDIO || block_type > BLOCK_TYPE_SILENCE) {
av_log(avctx, AV_LOG_ERROR, "unknown block type: %d\n", block_type);
return AVERROR(EINVAL);
}
buf += 16;
buf_size -= 16;
silent_chunks = 0;
if (block_type == BLOCK_TYPE_INITIAL) {
uint32_t flags;
if (buf_size < 4) {
av_log(avctx, AV_LOG_ERROR, "packet is too small\n");
return AVERROR(EINVAL);
}
flags = AV_RB32(buf);
silent_chunks = av_popcount(flags);
buf += 4;
buf_size -= 4;
} else if (block_type == BLOCK_TYPE_SILENCE) {
silent_chunks = 1;
buf_size = 0;
}
audio_chunks = buf_size / s->chunk_size;
frame->nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) /
avctx->channels;
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
output_samples_u8 = frame->data[0];
output_samples_s16 = (int16_t *)frame->data[0];
if (silent_chunks > 0) {
int silent_size = avctx->block_align * silent_chunks;
if (s->out_bps == 2) {
memset(output_samples_s16, 0x00, silent_size * 2);
output_samples_s16 += silent_size;
} else {
memset(output_samples_u8, 0x80, silent_size);
output_samples_u8 += silent_size;
}
}
if (audio_chunks > 0) {
buf_end = buf + buf_size;
while (buf < buf_end) {
if (s->out_bps == 2) {
decode_audio_s16(output_samples_s16, buf, s->chunk_size,
avctx->channels);
output_samples_s16 += avctx->block_align;
} else {
memcpy(output_samples_u8, buf, s->chunk_size);
output_samples_u8 += avctx->block_align;
}
buf += s->chunk_size;
}
}
*got_frame_ptr = 1;
return avpkt->size;
}
| 1threat |
db.execute('SELECT * FROM employees WHERE id = ' + user_input) | 1threat |
Call another activity using onPostExecute method list item click event in AsyncTask (Android) : Hello i am working on a project which populating SQLite database table for list view and using simple array adapter.
I'm using Asyntask for that purpose and i have problem when <br>
1) **i want to call another activity** and <br>
2) **pass some values which i get from the `setOnItemClickListener`**
I need to archive this two things in `onPostExecute` `setOnItemClickListener` method. This is my Code for that.
package com.me.doctor.doctor_me;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.AsyncTask;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.Toast;
public class BackgroundTask extends AsyncTask<String,Doctor,String> {
Context ctx;
DoctorAdapter doctorAdapter;
Activity activity;
ListView listView;
Doctor doctor;
DisplayDoctor displayDoctor;
BackgroundTask(Context ctx){
this.ctx = ctx;
activity = (Activity) ctx;
doctor = new Doctor();
displayDoctor = new DisplayDoctor();
}
@Override
protected String doInBackground(String... strings) {
String method = strings[0];
DatabaseOperation databaseOperation = new DatabaseOperation(ctx);
if(method.equals("get_info")){
listView = activity.findViewById(R.id.display_list_view);
SQLiteDatabase db = databaseOperation.getReadableDatabase();
Cursor cursor = databaseOperation.getInformation(db);
doctorAdapter = new DoctorAdapter(ctx,R.layout.display_doctor_row);
String name, category, hospital;
int id;
while(cursor.moveToNext()){
id = cursor.getInt(cursor.getColumnIndex("d_id"));
name = cursor.getString(cursor.getColumnIndex("d_name"));
category = cursor.getString(cursor.getColumnIndex("d_category"));
hospital = cursor.getString(cursor.getColumnIndex("d_hospital"));
Doctor doctor = new Doctor(id,name,category,hospital);
publishProgress(doctor);
}
return "get_info";
}
return null;
}
@Override
protected void onProgressUpdate(Doctor... values) {
// add each of doctor class object add method inside the adapter class
doctorAdapter.add(values[0]);
}
@Override
protected void onPostExecute(String s) {
if(s.equals("get_info")){
listView.setAdapter(doctorAdapter);
listView.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
final int position, long id) {
Doctor doctor = (Doctor)parent.getItemAtPosition(position);
String ID = Integer.toString(doctor.getId());
Toast.makeText(ctx,ID,Toast.LENGTH_LONG).show();
// I need fire another activity and pass some values which i getting here
}
});
}else{
Toast.makeText(ctx,s,Toast.LENGTH_LONG).show();
}
}
}
And this is the class which call to the AsyncTask Class
package com.me.doctor.doctor_me;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class DisplayDoctor extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.display_doctor_layout);
BackgroundTask backgroundTask = new BackgroundTask(this);
backgroundTask.execute("get_info");
}
}
Somebody can give me a solution? I had investigate close question inside here but i'm not found a solution that why put this question as new.
| 0debug |
host_memory_backend_memory_complete(UserCreatable *uc, Error **errp)
{
HostMemoryBackend *backend = MEMORY_BACKEND(uc);
HostMemoryBackendClass *bc = MEMORY_BACKEND_GET_CLASS(uc);
Error *local_err = NULL;
void *ptr;
uint64_t sz;
if (bc->alloc) {
bc->alloc(backend, &local_err);
if (local_err) {
goto out;
}
ptr = memory_region_get_ram_ptr(&backend->mr);
sz = memory_region_size(&backend->mr);
if (backend->merge) {
qemu_madvise(ptr, sz, QEMU_MADV_MERGEABLE);
}
if (!backend->dump) {
qemu_madvise(ptr, sz, QEMU_MADV_DONTDUMP);
}
#ifdef CONFIG_NUMA
unsigned long lastbit = find_last_bit(backend->host_nodes, MAX_NODES);
unsigned long maxnode = (lastbit + 1) % (MAX_NODES + 1);
unsigned flags = MPOL_MF_STRICT | MPOL_MF_MOVE;
if (maxnode && backend->policy == MPOL_DEFAULT) {
error_setg(errp, "host-nodes must be empty for policy default,"
" or you should explicitly specify a policy other"
" than default");
return;
} else if (maxnode == 0 && backend->policy != MPOL_DEFAULT) {
error_setg(errp, "host-nodes must be set for policy %s",
HostMemPolicy_lookup[backend->policy]);
return;
}
assert(sizeof(backend->host_nodes) >=
BITS_TO_LONGS(MAX_NODES + 1) * sizeof(unsigned long));
assert(maxnode <= MAX_NODES);
if (mbind(ptr, sz, backend->policy,
maxnode ? backend->host_nodes : NULL, maxnode + 1, flags)) {
if (backend->policy != MPOL_DEFAULT || errno != ENOSYS) {
error_setg_errno(errp, errno,
"cannot bind memory to host NUMA nodes");
return;
}
}
#endif
if (backend->prealloc) {
os_mem_prealloc(memory_region_get_fd(&backend->mr), ptr, sz,
&local_err);
if (local_err) {
goto out;
}
}
}
out:
error_propagate(errp, local_err);
}
| 1threat |
NSData() convert to string : let startDate=NSDate().dateByAddingTimeInterval(-60*60*24)
let endDate=NSDate().dateByAddingTimeInterval(60*60*24*3)
lblStart.text = i.startDate
I want the startdate show in a label. How can i convert it to a string.
Swift 7.3 | 0debug |
static void blk_mig_lock(void)
{
qemu_mutex_lock(&block_mig_state.lock);
}
| 1threat |
Please can help me to visualize the modifiyers to the obiects in the program :
Can you help me to visualize at each turn of the for loop to see the changes of elements at each round of the loop
because it modify elements(labels ) only when it exit from the for
It is a bubble sort Graphics explanation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace BubbleSortRappresentazione_grafica
{
public partial class MainWindow : Window
{
int[] v;
public MainWindow()
{
InitializeComponent();
Random rnd = new Random();
v = new int[10];
for (int j = 0; j < 10; j++)
{
v[j] = rnd.Next(0, 100);
}
_0.Height = v[0] + 20;
_1.Height = v[1] + 20;
_2.Height = v[2] + 20;
_3.Height = v[3] + 20;
_4.Height = v[4] + 20;
_5.Height = v[5] + 20;
_6.Height = v[6] + 20;
_7.Height = v[7] + 20;
_8.Height = v[8] + 20;
_9.Height = v[9] + 20;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
// algoritmo ordinamento
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
if (v[j] > v[i])
{
int tmp = v[j];
v[j] = v[i];
v[i] = tmp;
_0.Height = v[0] + 20;
_0.Content = v[0];
_1.Height = v[1] + 20;
_1.Content = v[1] ;
_2.Height = v[2] + 20;
_2.Content = v[2];
_3.Height = v[3] + 20;
_3.Content = v[3] ;
_4.Height = v[4] + 20;
_4.Content = v[4];
_5.Height = v[5] + 20;
_5.Content = v[5];
_6.Height = v[6] + 20;
_6.Content = v[6];
_7.Height = v[7] + 20;
_7.Content = v[7];
_8.Height = v[8] + 20;
_8.Content = v[8];
_9.Height = v[9] + 20;
_9.Content = v[9];
Thread.Sleep(100);
}
}
}
}
}
}
| 0debug |
What's the difference between exposing nginx as load balancer vs Ingress controller? : <p>I understood Ingress can be used when we want to expose multiple service/routes with a single Load Balancer / public IP.</p>
<p>Now I want to expose my Nginx server to public. I have two choices</p>
<ol>
<li>Set <code>service type as LoadBalancer</code> voila I got public IP</li>
<li>Use <a href="https://github.com/kubernetes/ingress-nginx" rel="noreferrer">Nginx Ingress Controller</a></li>
</ol>
<p>Now I can get my job done with Option 1 when or why would I choose Option 2 whats the advantage of having nginx with Ingress without Ingress ?</p>
| 0debug |
Java program to find a pallindrome : <p>I am a beginner in Java programming.
I was a making a program to find if the entered word is a pallindrome or not can someone please tell me the logic i should use to make the given program?</p>
| 0debug |
How to create a div box with dynamic width based on text content? : <p>I want to create a simple <code>div</code> that shrinks and expands according to the content contained.</p>
<p><a href="https://jsfiddle.net/qa5dr0x8/" rel="noreferrer">https://jsfiddle.net/qa5dr0x8/</a></p>
<pre><code><body>
<div style="border: 1px solid red; padding: 15px; width:auto;">
test text
</div>
</body>
</code></pre>
<p>Result: the red box expands to the full width of the page. Why?</p>
| 0debug |
my app was not installing. please help me in this. installation failed while the process : [enter image description here][1]
hai! when am installing the app-debug.apk file of my project in android studio to my android device. it shows app not installed. but the same working good in emulators.
[1]: https://i.stack.imgur.com/ZNydY.png | 0debug |
Bash redirect and process questions : [image][1]
[1]: https://i.stack.imgur.com/zXkz0.png
hi,why use ">" no data, use ">>" have data,thanks very much
GNU bash, version 4.4.12 | 0debug |
void slirp_select_fill(int *pnfds,
fd_set *readfds, fd_set *writefds, fd_set *xfds)
{
Slirp *slirp;
struct socket *so, *so_next;
int nfds;
if (QTAILQ_EMPTY(&slirp_instances)) {
return;
}
global_readfds = NULL;
global_writefds = NULL;
global_xfds = NULL;
nfds = *pnfds;
do_slowtimo = 0;
QTAILQ_FOREACH(slirp, &slirp_instances, entry) {
do_slowtimo |= ((slirp->tcb.so_next != &slirp->tcb) ||
(&slirp->ipq.ip_link != slirp->ipq.ip_link.next));
for (so = slirp->tcb.so_next; so != &slirp->tcb;
so = so_next) {
so_next = so->so_next;
if (time_fasttimo == 0 && so->so_tcpcb->t_flags & TF_DELACK) {
time_fasttimo = curtime;
}
if (so->so_state & SS_NOFDREF || so->s == -1) {
continue;
}
if (so->so_state & SS_FACCEPTCONN) {
FD_SET(so->s, readfds);
UPD_NFDS(so->s);
continue;
}
if (so->so_state & SS_ISFCONNECTING) {
FD_SET(so->s, writefds);
UPD_NFDS(so->s);
continue;
}
if (CONN_CANFSEND(so) && so->so_rcv.sb_cc) {
FD_SET(so->s, writefds);
UPD_NFDS(so->s);
}
if (CONN_CANFRCV(so) &&
(so->so_snd.sb_cc < (so->so_snd.sb_datalen/2))) {
FD_SET(so->s, readfds);
FD_SET(so->s, xfds);
UPD_NFDS(so->s);
}
}
for (so = slirp->udb.so_next; so != &slirp->udb;
so = so_next) {
so_next = so->so_next;
if (so->so_expire) {
if (so->so_expire <= curtime) {
udp_detach(so);
continue;
} else {
do_slowtimo = 1;
}
}
if ((so->so_state & SS_ISFCONNECTED) && so->so_queued <= 4) {
FD_SET(so->s, readfds);
UPD_NFDS(so->s);
}
}
for (so = slirp->icmp.so_next; so != &slirp->icmp;
so = so_next) {
so_next = so->so_next;
if (so->so_expire) {
if (so->so_expire <= curtime) {
icmp_detach(so);
continue;
} else {
do_slowtimo = 1;
}
}
if (so->so_state & SS_ISFCONNECTED) {
FD_SET(so->s, readfds);
UPD_NFDS(so->s);
}
}
}
*pnfds = nfds;
}
| 1threat |
static void virgl_resource_attach_backing(VirtIOGPU *g,
struct virtio_gpu_ctrl_command *cmd)
{
struct virtio_gpu_resource_attach_backing att_rb;
struct iovec *res_iovs;
int ret;
VIRTIO_GPU_FILL_CMD(att_rb);
trace_virtio_gpu_cmd_res_back_attach(att_rb.resource_id);
ret = virtio_gpu_create_mapping_iov(&att_rb, cmd, NULL, &res_iovs);
if (ret != 0) {
cmd->error = VIRTIO_GPU_RESP_ERR_UNSPEC;
return;
}
virgl_renderer_resource_attach_iov(att_rb.resource_id,
res_iovs, att_rb.nr_entries);
}
| 1threat |
static void mdct512(AC3MDCTContext *mdct, int32_t *out, int16_t *in)
{
int i, re, im, n, n2, n4;
int16_t *rot = mdct->rot_tmp;
IComplex *x = mdct->cplx_tmp;
n = 1 << mdct->nbits;
n2 = n >> 1;
n4 = n >> 2;
for (i = 0; i <n4; i++)
rot[i] = -in[i + 3*n4];
memcpy(&rot[n4], &in[0], 3*n4*sizeof(*in));
for (i = 0; i < n4; i++) {
re = ((int)rot[ 2*i] - (int)rot[ n-1-2*i]) >> 1;
im = -((int)rot[n2+2*i] - (int)rot[n2-1-2*i]) >> 1;
CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i]);
}
fft(mdct, x, mdct->nbits - 2);
for (i = 0; i < n4; i++) {
re = x[i].re;
im = x[i].im;
CMUL(out[n2-1-2*i], out[2*i], re, im, mdct->xsin1[i], mdct->xcos1[i]);
}
}
| 1threat |
PLEASE HELP ME WITH IF AND ELIF STATEMENTS : # Kinematics clculator
print('Kinematics Calculator')
print('If either one of the three values(s,v,t) is not given then put its value = 1')
s = float(input('Enter your distance = '))
print(s)
t = float(input('Enter your time = '))
print(t)
v = float(input('Enter your velocity = '))
print(v)
if 'v == 1' :
print('velocity = '+ str(s/t))
elif 't == 1' :
print('time = '+ str(s/v))
else :
's == 1'
print('distance = '+ str(v*t))
Help me correct this code.
whenever i try to calculate anything else than "velocity"
it always uses the first print command i.e
print('velocity = '+ str(s/t)) | 0debug |
(C++) How to obtain sub-array from an array WITHOUT nested loops? : <p>Still a beginner to coding, but is there a way to obtain sub-array from an array without the use of nested loops i.e. more traditional methods? </p>
| 0debug |
Max-height doesn't work with percentual values : <p>I have div in which is input which a don't want to be hidden when user scroll upper. And in that div is second div in wich are chat messages. But on first div is <code>max-height</code> in percentual value and it's bugged. When I put there value in pixels it works but percentual values not. Can it get fixed?</p>
| 0debug |
static void tcx_init(hwaddr addr, qemu_irq irq, int vram_size, int width,
int height, int depth)
{
DeviceState *dev;
SysBusDevice *s;
dev = qdev_create(NULL, "SUNW,tcx");
qdev_prop_set_uint32(dev, "vram_size", vram_size);
qdev_prop_set_uint16(dev, "width", width);
qdev_prop_set_uint16(dev, "height", height);
qdev_prop_set_uint16(dev, "depth", depth);
qdev_prop_set_uint64(dev, "prom_addr", addr);
qdev_init_nofail(dev);
s = SYS_BUS_DEVICE(dev);
sysbus_mmio_map(s, 0, addr);
sysbus_mmio_map(s, 1, addr + 0x04000000ULL);
sysbus_mmio_map(s, 2, addr + 0x06000000ULL);
sysbus_mmio_map(s, 3, addr + 0x0c000000ULL);
sysbus_mmio_map(s, 4, addr + 0x0e000000ULL);
sysbus_mmio_map(s, 5, addr + 0x00700000ULL);
sysbus_mmio_map(s, 6, addr + 0x00200000ULL);
if (depth == 8) {
sysbus_mmio_map(s, 7, addr + 0x00300000ULL);
} else {
sysbus_mmio_map(s, 7, addr + 0x00301000ULL);
}
sysbus_mmio_map(s, 8, addr + 0x00240000ULL);
sysbus_mmio_map(s, 9, addr + 0x00280000ULL);
sysbus_mmio_map(s, 10, addr + 0x00800000ULL);
sysbus_mmio_map(s, 11, addr + 0x02000000ULL);
sysbus_mmio_map(s, 12, addr + 0x0a000000ULL);
if (depth == 8) {
sysbus_mmio_map(s, 13, addr + 0x00301000ULL);
}
sysbus_connect_irq(s, 0, irq);
}
| 1threat |
Get HTML Code from a website after it completed loading : <p>I am trying to get the HTML Code from a specific website async with the following code:</p>
<pre><code>var response = await httpClient.GetStringAsync("url");
</code></pre>
<p>But the problem is that the website usually takes another second to load the other parts of it. Which I need, so the question is if I can load the site first and read the content after a certain amount of time.</p>
<p>Sorry if this question already got answered, but I didn't really know what to search for.</p>
<p>Thanks,
Twenty
<hr></p>
<h1>Edit #1</h1>
<p>If you want to try it yourself the URL is <code>http://iloveradio.de/iloveradio/</code>, I need the Title and the Artist which do not immediately load.</p>
| 0debug |
Mathematical derivation of O(n3) complexity for general three nested loops : http://stackoverflow.com/questions/526728/time-complexity-of-nested-for-loop goes into the mathematical derivation through summation of two loops O(n2) complexity.
I tried an exercise to derive how i can get O(n3) for the following examples of three nested loops.
Simple three nested loops.
--
for (int i = 1; i < n; i++)
for (int j = 1; j < n; j++)
for (int k = 1; k < n; k++)
print(i * k * j);
Summation is
= (n + n + n + .... + n) + (n + n + n + ... + n) + ... + (n + n + n + ... + n)
= n2 + n2 + .... + n2
n times n2 = O(n3)
Three nested loops not run n times from beginning
---
for(int i = 1; i < n; i++)
for(int j = i; j < n; j++)
for(int k = j; k < n; k++)
print(i *j * k)
The above is a pretty common form of nested loops and i believe the summation would be something as follows
= (n + (n -1) + (n -2) + (n - 3) + ... + 1)
+ ((n -1) + (n - 2) + (n - 3) +... + 1)
+ ((n -2) + (n -3) + (n - 4) + ... + 1)
+ ...
+ ((n - (n -2)) + 1)
= n(n - 1) /2 + (n-1) (n -2) / 2 + (n-2)(n-3)/2 + .... + 1
=
*From here i am slightly not sure if my logic is correct . I believe
each of the above evaluate to a polynomial whose greatest value is n2 and as thats what we care about in time complexity, the above equation breaks down to.*
= n2 + n2 + n2 +... +n2
= which is n times n2 = O(n3).
Is my assumption correct?
Three nested loops not run n times from end
--
for(int i = 1; i < n; i++)
for(int j = 1; j < i; j++)
for(int k = 1; k < j; k++)
print(i *j * k)
If the above was a two nested loop the summation would have been 1 + 2 + 3 + 4 + ... + n. However, for the three nested occurence i am deducing it to be
= 1 + (1 + 2) + (1 + 2 + 3) + (1 + 2 + 3) + (1 + 2 + 3 + .... + n)
From here i am not sure how to derive O(n3) or how the above summation would be further simplified.
| 0debug |
How to split 4113.52318N in two parts in php : <p>I want to split 4113.52318N in two parts like
41 and 13.52318N
And after that I want to remove N from the second value.</p>
<p>any help please?</p>
| 0debug |
Bootstrap footer at the bottom of the page : <p>I have read a lot of posts about this but I still didn't find an answer.
<strong>I have a footer that I want to be at the end of the page, not fixed.</strong>
The problem is that the footer is where the content ends. Look at picture.
<a href="https://i.stack.imgur.com/bThVl.png" rel="noreferrer"><img src="https://i.stack.imgur.com/bThVl.png" alt="enter image description here"></a></p>
<p>This is my HTML:</p>
<pre><code><!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title> Mobtech - Privatni korisnici </title>
<!--Ubaci bootstrap css -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="css/basic-template.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed" rel="stylesheet">
</head>
<body>
<!--Navigation bar -->
<nav class="navbar navbar-default" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-container">
<span class="sr-only"> Pokazi i sakrij navigaciju </span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#">
<span> <img src="Slike/logo.png" alt="LogoSlika"/> </span>
<font face="Roboto Condensed" size="4" color="green"> Mobtech </font>
</a>
</div>
<div class="collapse navbar-collapse" id="navbar-container">
<ul class="nav navbar-nav navbar-right">
<li><a href="index.html"> PoΔetna strana </a> </li>
<li class="active"><a href="#"> Privatni korisnici </a> </li>
<li><a href="poslovni.html"> Poslovni korisnici </a> </li>
<li><a href="uredjaji.html"> UreΔaji </a> </li>
<li><a href="onama.html"> O Nama </a> </li>
</ul>
</div>
</div>
</nav>
<br />
<div class="container"> <!--Container -->
<div class="row">
<!-- Kolona na velikom ekranu (lg) prikazuje duzinu jedne kolone, Ekstra small (xs) prikazuje 4 kolone -->
<div class="col-lg-12 bg-success">
<p> Outer div </p>
<div class="col-lg-6 bg-primary">
<p> Inner div </p>
</div>
</div>
</div>
</div>
<!-- Footer -->
<footer class="mojFooter">
<font face="Roboto Condensed" size="4"> <center>
<div class="container">
<div class="row" style="margin-top: 7px;">
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &copy; Copyright Ivan ProΕ‘iΔ 2016.</p>
</div>
<div class="bottom-footer">
<div class="col-md-12">
<ul class="footer-nav">
<li> <a href="https://www.facebook.com/"> Facebook </a> </li>
<li> <a href="https://twitter.com/"> Twitter </a> </li>
<li> <a href="https://plus.google.com/"> Google+ </a> </li>
</ul>
</div>
</div>
</div>
</font> </center>
</footer>
<!-- JavaScript fajl -->
<script src="js/jquery.min.js"></script>
<!-- Kompresovan JavaScript fajl -->
<script src="js/bootstrap.min.js"></script>
</body>
</html>
</code></pre>
<p>This is my CSS, for the footer only:</p>
<pre><code> .mojFooter{
background-color: #f8f8f8;
color: #00a651;
padding-top: 0px;
border-top: 1px solid #e7e7e7;
margin-bottom: 0px;
}
.bottom-footer{
border-top: 1px solid #00a651;
margin-top: 0px;
padding-top: 7px;
color: #00a651;
}
.footer-nav li{
display: inline;
padding: 0px 40px;
}
.footer-nav a{
color: grey;
text-decoration: none;
}
</code></pre>
| 0debug |
What is the question mark operator mean in C#? : <p>First off, I already know about ternary statements. However, I recently saw a piece of code like this:</p>
<pre><code>public void DoSomething(Result result)
{
return result?.Actions?.Utterance;
}
</code></pre>
<p>What is the question mark operator used for here?</p>
| 0debug |
gitk will not start on Mac: unknown color name "lime" : <p>I've installed git on a mac via <code>brew install git</code>. When I try to start gitk I get the following error:</p>
<pre><code>Error in startup script: unknown color name "lime"
(processing "-fore" option)
invoked from within
"$ctext tag conf m2 -fore [lindex $mergecolors 2]"
(procedure "makewindow" line 347)
invoked from within
"makewindow"
(file "/usr/local/bin/gitk" line 12434)
</code></pre>
<p>It appears that my Mac doesn't have a color named <code>lime</code>. </p>
<p>Can I add a lime color to the environment, or is there a better fix? </p>
<p>The git version is 2.7.0, and the Mac is running Yosemite 10.10.5</p>
| 0debug |
static void netfilter_set_status(Object *obj, const char *str, Error **errp)
{
NetFilterState *nf = NETFILTER(obj);
NetFilterClass *nfc = NETFILTER_GET_CLASS(obj);
if (strcmp(str, "on") && strcmp(str, "off")) {
error_setg(errp, "Invalid value for netfilter status, "
"should be 'on' or 'off'");
return;
}
if (nf->on == !strcmp(str, "on")) {
return;
}
nf->on = !nf->on;
if (nfc->status_changed) {
nfc->status_changed(nf, errp);
}
}
| 1threat |
static void hscroll(AVCodecContext *avctx)
{
AnsiContext *s = avctx->priv_data;
int i;
if (s->y < avctx->height - s->font_height) {
s->y += s->font_height;
return;
}
i = 0;
for (; i < avctx->height - s->font_height; i++)
memcpy(s->frame->data[0] + i * s->frame->linesize[0],
s->frame->data[0] + (i + s->font_height) * s->frame->linesize[0],
avctx->width);
for (; i < avctx->height; i++)
memset(s->frame->data[0] + i * s->frame->linesize[0],
DEFAULT_BG_COLOR, avctx->width);
}
| 1threat |
Thread t = new Thread(new ThreadStart(Program1.ThreadMethod)); : Thread t = new Thread(new ThreadStart(Program1.ThreadMethod));
i want to know why we write in constuctor new ThreadStart(Program1.ThreadMethod)
please explain
| 0debug |
What are the security risks of using Gitlab CI shared test runners? : <p>I am trying to host a new project with Gitlab. It is a private Python project. I was able to test some initial tests with Gitlab CI.</p>
<p>I don't use cache while running tests,</p>
<p>While exploring the runner section in settings, there is a warning shown,</p>
<blockquote>
<p>GitLab Runners do not offer secure isolation between projects that
they do builds for. You are TRUSTING all GitLab users who can push
code to project A, B or C to run shell scripts on the machine hosting
runner X.</p>
</blockquote>
<p>what are the security risks in using a shared test runner? Is it safe to run private projects on a shared runner? What precautions can be taken while running tests on a shared runner?</p>
<p>Thank you for any insight.</p>
| 0debug |
How to extends button function on its container :
<div class="hotspot">
<div class="productName">Bag</div>
<div class="productPrice">20$</div>
<button>Some action</button>
</div>
I need to extends the button function on all its container and hide it with opacity 0.
I have a situation like this: https://codepen.io/andrew_88/pen/jemBgm
I need to extend the function of my button on all the hotspot container and I want to hide it graphically (opacity: 0); I want to toggle the class "visible" only when I click on pseudoclass before (the red rectangle) and not when I click into the div (productName, productPrice, button). I can't find a solution for doing it.
| 0debug |
static int qemu_rdma_post_send_control(RDMAContext *rdma, uint8_t *buf,
RDMAControlHeader *head)
{
int ret = 0;
RDMAWorkRequestData *wr = &rdma->wr_data[RDMA_WRID_CONTROL];
struct ibv_send_wr *bad_wr;
struct ibv_sge sge = {
.addr = (uint64_t)(wr->control),
.length = head->len + sizeof(RDMAControlHeader),
.lkey = wr->control_mr->lkey,
};
struct ibv_send_wr send_wr = {
.wr_id = RDMA_WRID_SEND_CONTROL,
.opcode = IBV_WR_SEND,
.send_flags = IBV_SEND_SIGNALED,
.sg_list = &sge,
.num_sge = 1,
};
DDDPRINTF("CONTROL: sending %s..\n", control_desc[head->type]);
assert(head->len <= RDMA_CONTROL_MAX_BUFFER - sizeof(*head));
memcpy(wr->control, head, sizeof(RDMAControlHeader));
control_to_network((void *) wr->control);
if (buf) {
memcpy(wr->control + sizeof(RDMAControlHeader), buf, head->len);
}
if (ibv_post_send(rdma->qp, &send_wr, &bad_wr)) {
return -1;
}
if (ret < 0) {
fprintf(stderr, "Failed to use post IB SEND for control!\n");
return ret;
}
ret = qemu_rdma_block_for_wrid(rdma, RDMA_WRID_SEND_CONTROL);
if (ret < 0) {
fprintf(stderr, "rdma migration: send polling control error!\n");
}
return ret;
}
| 1threat |
Is it possible to show the restart policy of a running Docker container? : <p>When I create containers I'm specifying a restart policy, but this is not shown in <code>docker ps</code>, and it doesn't appear any format string shows this either.</p>
<p>Does anyone know how to see the restart policy of a running container(s)?</p>
| 0debug |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.