problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
How to enable type checking in TSLint under WebStorm? : <p>I have some rules in my tslint.json that require the --type-check functionality. WebStorm doesn't give me a way to add the command-line argument and to the TSLint plugin. It also doesn't give me a way to enable it from the GUI.</p>
<p>As a result TSLint crashes and the TSLint plugin reports an error and I can't see the inspections.</p>
<p>It works when I run TSLint from the command-line with the --type-check argument, but I need the inspections in the IDE.</p>
<p>Does anyone have a workaround for this situation?</p>
| 0debug
|
static int decode_i_block(FourXContext *f, int16_t *block)
{
int code, i, j, level, val;
if (get_bits_left(&f->gb) < 2){
av_log(f->avctx, AV_LOG_ERROR, "%d bits left before decode_i_block()\n", get_bits_left(&f->gb));
return -1;
}
val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
if (val >> 4)
av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n");
if (val)
val = get_xbits(&f->gb, val);
val = val * dequant_table[0] + f->last_dc;
f->last_dc = block[0] = val;
i = 1;
for (;;) {
code = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
if (code == 0)
break;
if (code == 0xf0) {
i += 16;
} else {
level = get_xbits(&f->gb, code & 0xf);
i += code >> 4;
if (i >= 64) {
av_log(f->avctx, AV_LOG_ERROR, "run %d oveflow\n", i);
return 0;
}
j = ff_zigzag_direct[i];
block[j] = level * dequant_table[j];
i++;
if (i >= 64)
break;
}
}
return 0;
}
| 1threat
|
Exception Threat in java : Hi guys I have " Exception threat " I create public class student and give it three classes NAME of student and ID of student and GPA of student. when I run the code and enter information student1 it's good but when i enter student2 the code made skip for name of student2 and give me student id and GPA so can I remedy this. [enter image description here][1]
[enter image description here][2]
[1]: https://i.stack.imgur.com/OIGY0.png
[2]: https://i.stack.imgur.com/Dw0pM.png
| 0debug
|
dropdown values lost after page reload , please help me in my coding .thanks in advance : [enter image description here][1]
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-js -->
javascript code for sending value to server through ajax[in my code , status can be different for different vulnerable name . upon choosing one status value among 3 option , stored it in database by sending value to server through ajax.but after refresh webpage, selected value is lost , i want to see selected option values even after page reloads, i am new here so unable to upload image directly please visit link once. ][1]
enter code here
<script>
function statusval(value,vulname,vul_id) {
var sv = value;
var vn = vulname;
var vi = vul_id;
if (window.XMLHttpRequest) {
xmlhttp=new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
var data = "s_name=" + sv + "&v_name=" + vn + "&v_id=" + vi;
xmlhttp.open("POST","status.php",true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.send(data);
}
</script>
<!-- language: lang-html -->
<form method='post' action='status.php' id='status' >
<select name = 'status' id='status' onchange='statusval(this.value,\"$_vulname\",\"$_vul_id\")'>
<option value=''>Status</option>
<option value='Open'>Open</option>
<option value='closed'>Closed</option>
<option value='Partially Fixed'>Partially Fixed</option>
</select>
<input type='hidden' name='vulname' value='$_vulname' id='vulname'>
<input type='hidden' name='vul_id' value='$_vul_id' id='vul_id'>
</form>
<!-- end snippet -->
[1]: https://i.stack.imgur.com/uttYG.png
| 0debug
|
Kafka - difference between Log end offset(LEO) vs High Watermark(HW) : <p>What is the difference between <code>LEO and HW</code> in Replica ( <code>Leader Replica</code>)?</p>
<p>Will they contain the same number? I can understand HW is the <code>last committed message offset</code>.</p>
<p>When LEO will be updated and how?</p>
| 0debug
|
When I start android studio I got errors : Error:CreateProcess error=216, This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information to see whether you need a x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher
| 0debug
|
In the following code I am trying to use pythons pillow/Pil library : In the following code I am trying to use pythons pillow/Pil library. This is the first time using this and I am just trying to open my image to make sure it is working. I have my code I used below. I just googled an image and saved it using the name smallhouse.jpg. However I am running into the following errors below.
import numpy as np
from PIL import Image
img = Image.open('smallhouse.jpg')
img.show()
This is the error I am getting. Do I need to download a Pil package? I am using Jupiter notebook
---------------------------------------------------------------------------
FileNotFoundError Traceback (most recent call last)
<ipython-input-10-e26e3b39215f> in <module>()
1 import numpy as np
2 from PIL import Image
----> 3 img = Image.open('smallhouse.jpg')
4 img.show()
~\Anaconda3\lib\site-packages\PIL\Image.py in open(fp, mode)
2546
2547 if filename:
-> 2548 fp = builtins.open(filename, "rb")
2549 exclusive_fp = True
2550
FileNotFoundError: [Errno 2] No such file or directory: 'smallhouse.jpg'
| 0debug
|
ISABus *isa_bus_new(DeviceState *dev)
{
if (isabus) {
fprintf(stderr, "Can't create a second ISA bus\n");
return NULL;
}
if (NULL == dev) {
dev = qdev_create(NULL, "isabus-bridge");
qdev_init(dev);
}
isabus = FROM_QBUS(ISABus, qbus_create(&isa_bus_info, dev, NULL));
return isabus;
}
| 1threat
|
String to String array in java : I have an incoming array of string from a source:
["abc", "xyz", "123"]
I want to parse this as a string array `String[]` and iterate over it.
This is what I have:
//value = incoming String
String[] contentUrlList = new String[] {value};
for (int i = 0; i < contentUrlList.length; i++) {
String contentUri = contentUrlList[i];
}
But I can print the length of string array it is 1.
System.out.println(contentUrlList.length);
How can I parse the incoming String that each string is an index of the String array?
| 0debug
|
int coroutine_fn bdrv_co_preadv(BdrvChild *child,
int64_t offset, unsigned int bytes, QEMUIOVector *qiov,
BdrvRequestFlags flags)
{
BlockDriverState *bs = child->bs;
BlockDriver *drv = bs->drv;
BdrvTrackedRequest req;
uint64_t align = bs->bl.request_alignment;
uint8_t *head_buf = NULL;
uint8_t *tail_buf = NULL;
QEMUIOVector local_qiov;
bool use_local_qiov = false;
int ret;
if (!drv) {
return -ENOMEDIUM;
}
ret = bdrv_check_byte_request(bs, offset, bytes);
if (ret < 0) {
return ret;
}
bdrv_inc_in_flight(bs);
if (bs->copy_on_read && !(flags & BDRV_REQ_NO_SERIALISING)) {
flags |= BDRV_REQ_COPY_ON_READ;
}
if (offset & (align - 1)) {
head_buf = qemu_blockalign(bs, align);
qemu_iovec_init(&local_qiov, qiov->niov + 2);
qemu_iovec_add(&local_qiov, head_buf, offset & (align - 1));
qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size);
use_local_qiov = true;
bytes += offset & (align - 1);
offset = offset & ~(align - 1);
}
if ((offset + bytes) & (align - 1)) {
if (!use_local_qiov) {
qemu_iovec_init(&local_qiov, qiov->niov + 1);
qemu_iovec_concat(&local_qiov, qiov, 0, qiov->size);
use_local_qiov = true;
}
tail_buf = qemu_blockalign(bs, align);
qemu_iovec_add(&local_qiov, tail_buf,
align - ((offset + bytes) & (align - 1)));
bytes = ROUND_UP(bytes, align);
}
tracked_request_begin(&req, bs, offset, bytes, BDRV_TRACKED_READ);
ret = bdrv_aligned_preadv(bs, &req, offset, bytes, align,
use_local_qiov ? &local_qiov : qiov,
flags);
tracked_request_end(&req);
bdrv_dec_in_flight(bs);
if (use_local_qiov) {
qemu_iovec_destroy(&local_qiov);
qemu_vfree(head_buf);
qemu_vfree(tail_buf);
}
return ret;
}
| 1threat
|
What is a good way to allow only one non null field in an object : <p>I want to write a class with more than 1 fields of different types but at any time, there is one and only one field of an instance object having non null value.</p>
<p>What I did so far does not look really clean.</p>
<pre class="lang-java prettyprint-override"><code>class ExclusiveField {
private BigInteger numericParam;
private String stringParam;
private LocalDateTime dateParam;
public void setNumericParam(BigInteger numericParam) {
unsetAll();
this.numericParam = Objects.requireNonNull(numericParam);
}
public void setStringParam(String stringParam) {
unsetAll();
this.stringParam = Objects.requireNonNull(stringParam);
}
public void setDateParam(LocalDateTime dateParam) {
unsetAll();
this.dateParam = Objects.requireNonNull(dateParam);
}
private void unsetAll() {
this.numericParam = null;
this.stringParam = null;
this.dateParam = null;
}
}
</code></pre>
<p>Does Java support this pattern somehow or is there a more decent way to do it?</p>
| 0debug
|
Chart.js - Styling Legend : <p>I'm making a chart with chart.js and I'm trying to figure out how I can change the label/legend styling.
I want to remove the rectangle part and instead use a circle. I've read that you can make your custom legend (using legendCallback), but for the life of me I cannot figure out how to do it. This is how my chart looks now - <a href="https://i.stack.imgur.com/9vAJJ.jpg" rel="noreferrer">image</a>.</p>
<p>This is my HTML:</p>
<pre><code><div class="container">
<canvas id="myChart"></canvas>
</div>
</code></pre>
<p>And this is my JS:</p>
<pre><code>var ctx = document.getElementById("myChart");
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: ["Red", "Blue", "Yellow", "Green", "Purple", "Orange"],
datasets: [{
label: 'Link One',
data: [1, 2, 3, 2, 1, 1.5, 1],
backgroundColor: [
'#D3E4F3'
],
borderColor: [
'#D3E4F3',
'rgba(54, 162, 235, 1)',
'rgba(255, 206, 86, 1)',
'rgba(75, 192, 192, 1)',
'rgba(153, 102, 255, 1)',
'rgba(255, 159, 64, 1)'
],
borderWidth: 1
}]
},
options: {
legend: {
display: true,
position: 'bottom',
labels: {
fontColor: '#333',
}
}
}
});
</code></pre>
<p>I'm new to JS in general, so please be as specific as possible with your answers. Thank you so much!</p>
| 0debug
|
Convert list of list into single list : <p>Currently I have a list of lists</p>
<p><code>l=[['asd'],['fgd']].</code></p>
<p>I want to turn it into a list </p>
<p><code>goal_list=['asd','fgd']</code></p>
<p>but I do not know how to turn a list into the value inside it - does anyone have an idea how to this efficiently?</p>
| 0debug
|
sql query command : i am new on sql and i need to find a command in order to generate a report regarding a table i have:
column1 Tax Amount
350 45 x
6500 53 y
800 25 z
i need to calculate x, y and z. I need to do the math: =IF(column1<=5000,column1+tax,column1) - (in words) i need to calculate x/y/z as the sum of column1+Tax with the options: if column1 is smaller or equal than 5000 then x=column1+tax;
If column1>5000 then x or y or z should have the column1 value as a result.
Can you help me to find the sql query that calculates x or y or z?
Many thanks
| 0debug
|
Most efficient method of finding the number of common factors of two numbers using Golang : I have two numbers for example the numbers are 12 and 16.
> factors of 12 are 1, 2, 3, 4, 6, 12
>
> factors of 16 are 1, 2, 4, 8, 16
>
> common factors of these two numbers are 1, 2 and 4.
So the number of common factors are 3. I need to build a Golang program for finding the number common factors of two numbers. But the program should be efficient and with minimum number of loops or without loops.
| 0debug
|
return statement does not work in forEach loop : <p>I'm trying to write a function <code>returnIndex</code> that returns the index of an object in an array, e.g. <code>myArr = [{ "name": "Bob", "age": 4 }, { "name": "Kirk", "age": 11 }]</code>, by passing in a given key/value pair: e.g. <code>returnIndex(myArr, "name", "Bob")</code> should return <code>0</code>.</p>
<p>I tried this:</p>
<pre><code>const myArr = [{ "name": "Bob", "age": 4 }, { "name": "Kirk", "age": 11 }]
const returnIndex = (arr, key, value) => {
arr.forEach((item, index) => {
if (item[key] === value) { return index }
})
}
const i = returnIndex(myArr, "name", "Bob")
console.log(i)
</code></pre>
<p><strong>I get undefined i in the console.</strong></p>
<p>But when I create a throw-away variable i:</p>
<pre><code>const myArr = [{ "name": "Bob", "age": 4 }, { "name": "Kirk", "age": 11 }]
const returnIndex = (arr, key, value) => {
let i
arr.forEach((item, index) => {
if (item[key] === value) { i = index }
})
return i
}
const i = returnIndex(myArr, "name", "Bob")
console.log(i)
</code></pre>
<p><strong>Then it works.</strong> Why is it that I cannot return index directly but have to set up a throw-away variable i? I don't understand this -- Help please!</p>
<p>Also if you have a better way to solve this problem, please do share. Cheers!</p>
| 0debug
|
Python: How can i invert string "0110010" without using loops? : <p>I need to invert "0110010" , and have "1001101: in the output without using loops, because the length of this string may be 10**9
. how can i realize this?</p>
| 0debug
|
Convert a string to date for database : <p>I am trying to convert a string into a date type, so I can save the current time someone last logged in, into my database. The field in the database takes the date type only and not a string representation of it.</p>
<p>Here is my code for getting the current date and formatting it: </p>
<pre><code>DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date date = new Date();
carrier.setLastUpdateDate(dateFormat.format(date));
</code></pre>
<hr>
<p>Error:</p>
<p><strong>incompatible types: String cannot be converted to Date</strong></p>
| 0debug
|
How can i display NO. of songs in place of UILABEL -Objective C : How can i count artist song from itunes library display NO. of songs in place of UILABEL -Objective C
| 0debug
|
how could i get both the final hidden state and sequence in a LSTM layer when using a bidirectional wrapper : <p>i have followed the steps in <a href="https://machinelearningmastery.com/return-sequences-and-return-states-for-lstms-in-keras/" rel="noreferrer">https://machinelearningmastery.com/return-sequences-and-return-states-for-lstms-in-keras/</a>
But when it comes to the Bidirectional lstm, i tried this</p>
<pre><code>lstm, state_h, state_c = Bidirectional(LSTM(128, return_sequences=True, return_state= True))(input)
</code></pre>
<p>but it won't work.</p>
<p>is there some approach to get both the final hidden state and sequence in a LSTM layer when using a bidirectional wrapper</p>
| 0debug
|
static int parse_h264_sdp_line(AVFormatContext *s, int st_index,
PayloadContext *h264_data, const char *line)
{
AVStream *stream;
AVCodecContext *codec;
const char *p = line;
if (st_index < 0)
return 0;
stream = s->streams[st_index];
codec = stream->codec;
assert(h264_data->cookie == MAGIC_COOKIE);
if (av_strstart(p, "framesize:", &p)) {
char buf1[50];
char *dst = buf1;
while (*p && *p == ' ') p++;
while (*p && *p != ' ') p++;
while (*p && *p == ' ') p++;
while (*p && *p != '-' && (dst - buf1) < sizeof(buf1) - 1) {
*dst++ = *p++;
}
*dst = '\0';
codec->width = atoi(buf1);
codec->height = atoi(p + 1);
codec->pix_fmt = PIX_FMT_YUV420P;
} else if (av_strstart(p, "fmtp:", &p)) {
return ff_parse_fmtp(stream, h264_data, p, sdp_parse_fmtp_config_h264);
} else if (av_strstart(p, "cliprect:", &p)) {
}
return 0;
}
| 1threat
|
static int macio_newworld_initfn(PCIDevice *d)
{
MacIOState *s = MACIO(d);
NewWorldMacIOState *ns = NEWWORLD_MACIO(d);
SysBusDevice *sysbus_dev;
MemoryRegion *timer_memory = g_new(MemoryRegion, 1);
int i;
int cur_irq = 0;
int ret = macio_common_initfn(d);
if (ret < 0) {
return ret;
}
sysbus_dev = SYS_BUS_DEVICE(&s->cuda);
sysbus_connect_irq(sysbus_dev, 0, ns->irqs[cur_irq++]);
if (s->pic_mem) {
memory_region_add_subregion(&s->bar, 0x40000, s->pic_mem);
}
for (i = 0; i < ARRAY_SIZE(ns->ide); i++) {
qemu_irq irq0 = ns->irqs[cur_irq++];
qemu_irq irq1 = ns->irqs[cur_irq++];
ret = macio_initfn_ide(s, &ns->ide[i], irq0, irq1, 0x16 + (i * 4));
if (ret < 0) {
return ret;
}
}
memory_region_init_io(timer_memory, OBJECT(s), &timer_ops, NULL, "timer",
0x1000);
memory_region_add_subregion(&s->bar, 0x15000, timer_memory);
return 0;
}
| 1threat
|
static void qemu_account_warp_timer(void)
{
if (!use_icount || !icount_sleep) {
return;
}
if (!runstate_is_running()) {
return;
}
if (!replay_checkpoint(CHECKPOINT_CLOCK_WARP_ACCOUNT)) {
return;
}
timer_del(icount_warp_timer);
icount_warp_rt();
}
| 1threat
|
static void mem_commit(MemoryListener *listener)
{
AddressSpace *as = container_of(listener, AddressSpace, dispatch_listener);
AddressSpaceDispatch *cur = as->dispatch;
AddressSpaceDispatch *next = as->next_dispatch;
next->nodes = next_map.nodes;
next->sections = next_map.sections;
phys_page_compact_all(next, next_map.nodes_nb);
as->dispatch = next;
g_free(cur);
}
| 1threat
|
static uint64_t ivshmem_io_read(void *opaque, hwaddr addr,
unsigned size)
{
IVShmemState *s = opaque;
uint32_t ret;
switch (addr)
{
case INTRMASK:
ret = ivshmem_IntrMask_read(s);
break;
case INTRSTATUS:
ret = ivshmem_IntrStatus_read(s);
break;
case IVPOSITION:
if (s->shm_fd >= 0) {
ret = s->vm_id;
} else {
ret = -1;
}
break;
default:
IVSHMEM_DPRINTF("why are we reading " TARGET_FMT_plx "\n", addr);
ret = 0;
}
return ret;
}
| 1threat
|
Keyboard shortcut for code chunk in R Markdown for windows gives í : <p>Using RStudio for windows. Help says keyboard shortcut for inserting code chunk is Ctrl + Alt + i, which should give me:</p>
<pre><code>```{r}
```
</code></pre>
<p>Instead, I get <strong>í</strong> (accented i, not bold...)</p>
<p>What is the keyboard shortcut to insert code chunks in this case?</p>
| 0debug
|
static void thread_pool_init_one(ThreadPool *pool, AioContext *ctx)
{
if (!ctx) {
ctx = qemu_get_aio_context();
}
memset(pool, 0, sizeof(*pool));
event_notifier_init(&pool->notifier, false);
pool->ctx = ctx;
qemu_mutex_init(&pool->lock);
qemu_cond_init(&pool->check_cancel);
qemu_cond_init(&pool->worker_stopped);
qemu_sem_init(&pool->sem, 0);
pool->max_threads = 64;
pool->new_thread_bh = aio_bh_new(ctx, spawn_thread_bh_fn, pool);
QLIST_INIT(&pool->head);
QTAILQ_INIT(&pool->request_list);
aio_set_event_notifier(ctx, &pool->notifier, event_notifier_ready);
}
| 1threat
|
int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
uint8_t* buf, int buf_size)
{
int size, i;
uint8_t *ppcm[4] = {0};
if (buf_size < DV_PROFILE_BYTES ||
!(c->sys = avpriv_dv_frame_profile(c->sys, buf, buf_size)) ||
buf_size < c->sys->frame_size) {
return -1;
}
size = dv_extract_audio_info(c, buf);
for (i = 0; i < c->ach; i++) {
c->audio_pkt[i].size = size;
c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate;
ppcm[i] = c->audio_buf[i];
}
dv_extract_audio(buf, ppcm, c->sys);
if (c->sys->height == 720) {
if (buf[1] & 0x0C) {
c->audio_pkt[2].size = c->audio_pkt[3].size = 0;
} else {
c->audio_pkt[0].size = c->audio_pkt[1].size = 0;
c->abytes += size;
}
} else {
c->abytes += size;
}
size = dv_extract_video_info(c, buf);
av_init_packet(pkt);
pkt->data = buf;
pkt->size = size;
pkt->flags |= AV_PKT_FLAG_KEY;
pkt->stream_index = c->vst->id;
pkt->pts = c->frames;
c->frames++;
return size;
}
| 1threat
|
Don't understand why (5 | -2) > 0 is False where (5 or -2) > 0 is True : <p>This is a pretty trivial question that I haven't been able to find the answer to. </p>
<p>Here is the problem. I have the following array:</p>
<pre><code>vals = [-5, 2]
</code></pre>
<p>And I want to check whether <code>val[0]</code> or <code>val[1]</code> is greater than 0. If either is true, then I should output True.</p>
<p>My immediate thought was to use; <code>(vals[1] or vals[0]) > 0)</code> but I'm finding that <code>(5 | -2) > 0</code> is False where <code>(5 or -2) > 0</code> is True</p>
<p>Any clarification would be much appreciated. </p>
| 0debug
|
malformed module path "xxxx/xxxx/uuid" missing dot in first path element when migrating from GOPATH based dep to go mod : <pre>
$ go version
1.13.3
</pre>
<p>I have a folder structure as follows:</p>
<pre><code>GOPATH
+---src
+--- my-api-server
+--- my-auth-server
+--- main.go
+--- my-utils
+--- uuid
+--- uuid.go
</code></pre>
<p><code>my-auth-server</code> uses <code>my-api-server/my-utils/uuid</code> as a depenency</p>
<p>Now, when I used the GOPATH based module system, this worked fine. But when using go modules, when I run <code>go run main.go</code> in <code>my-auth-server</code> it returned error:</p>
<pre><code>build command-line-arguments: cannot load my-api-server/my-utils/uuid: malformed module path "my-api-server/my-utils/uuid": missing dot in first path element
</code></pre>
<p>Any idea how to solve this?</p>
| 0debug
|
I want to sort the correlation between the residual of a time series regression and several prospective X independent variables : And, I want the correlations to be ranked by absolute correlation. And, I also want the output show the name of each X variable with its absolute correlation and its actual correlation (showing the sign).
Using the following codes I was able to calculate the correlation between the residuals (object res1) and the X variables (located within the data2 dataframe).
cor(data2, res1, method = c("pearson"))
The above code generated the output below that shows vertically in the console.
[,1]
x1 0.45683210
x2 0.62858863
x3 0.08457911
x4 0.41022052
Next, using the following code I was able to rank those correlations by their absolute value using the sort() function.
abs(cor(data2, res1, method = c("pearson")))
abs1<-abs(cor(data2, res1, method = c("pearson")))
sort(abs1, decreasing = TRUE)
And, I got the following output.
[1] 0.62858863 0.45683210 0.41022052 0.08457911
I want to generate an output that looks like a table or a dataframe. In the first column you would have the labels of the X variable, in the second column you would have their absolute correlation, and in the third column you would have the actual correlation with their sign. And, this vertical tabular list would be ranked in descending order. I think I have all the info I need. I just need the codes to generate the output as specified.
| 0debug
|
se puede crear metodos "globales" para usar en varios fragment a la vez? : disculpen la pregunta, estoy seguro que lo hay, pero no logro ver como podría hacerlo, me imagino que creando un archivo java que guarde los métodos globales y así usarlos en los fragment que requiera, si por favor me pueden ayudar de como hacerlo, y si me pueden dar un ejemplo seria de gran ayuda
no he probado nada, porque no consigo algo que hable de eso, quiero probar en todos los fragment que tengo si hay conexión y si no la hay, que me cierre la aplicación, ya el código que tengo funciona bien, pero me parece que estoy asiendo algo mal al colocar los mismos métodos el todos los fragment
private void verificarconexion() {
//para saber si hay internet
ConnectivityManager connectivityManager = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
if (networkInfo != null && networkInfo.isConnected()) {
if (networkInfo.getType() == ConnectivityManager.TYPE_WIFI) {
// Estas conectado a un Wi-Fi
Log.d("MIAPP", " Nombre red Wi-Fi: " + networkInfo.getExtraInfo());
}
} else {
//Intent salida=new Intent( Intent.ACTION_MAIN); //Llamando a la activity principal
Toast.makeText(getContext(), "no tienes internet", Toast.LENGTH_LONG).show();
mostrarsalir();
}
//para saber si hay internet
}
private void mostrarsalir() {
final CharSequence[] opciones={"Aceptar","Cancelar"};
final AlertDialog.Builder builder=new AlertDialog.Builder(getContext());
builder.setCancelable(false);
builder.setTitle("No se detectan redes de internet");
builder.setItems(opciones, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (opciones[i].equals("Aceptar")){
getActivity().finish();
System.exit(0);
int p = android.os.Process.myPid();
android.os.Process.killProcess(p);
}else{
getActivity().finish();
System.exit(0);
int p = android.os.Process.myPid();
android.os.Process.killProcess(p);
}
}
});
builder.show();
}
quisiera porder escribir el metodo en un lugar donde lo pueda llamar desde cualquier fragment, porque si quiero cambiar una letra del mensaje que muestro, no tenga que buscar en todos los fragment donde esta el metodo
| 0debug
|
Implementing a message subscriber in node.js : <p>This maybe very naive question but I don't have much experience with node. js. It's for first time I am implementing a backend of flask application that updates database and provides REST API for frontend, I have written frontend in Vue. js. Since the application is separate I have used ‘pika‘ and rabbits to write a dispatcher. The status message published to queue are also required to be displayed in front end, so I am thinking it should be more sensible to write a subscribe r in node. js to display in my Vue.js app. </p>
<p>Please direct me to the right approach of doing this! Any help will be great ly appreciated. </p>
<p>Thanks </p>
| 0debug
|
Automating CSV file merging and cleaning preferably by using Batch or Powershell : I'm not a code guy and have spent whole day trying to get this done without success, hoping I can get some help from the experts.
I have a folder called Vehicles, within which are two sub-folders - Automobiles and Trucks. Each of sub-folders contain two CSV files which have identical (to that sub-folder) headers/structure.
What I'm trying to accomplish:
1. Take the two CSV files in Automobiles folder merge them without duplicating headers and name the merged file as Automobiles.csv
2. Delete all rows in Automobiles.csv where 6th column (header is Fuel_Type) is "Diesel" (without the quotes) then move the file from sub-folder to main Vehicles folder.
3. Take the two CSV files in Trucks folder merge them without duplicating headers and name merge file as Trucks.csv
3. For merged file in trucks folder remove all rows where 6th column (header is "Fuel_Type") is "Diesel" (without the quotes) then move the file from sub-folder to main Vehicles folder.
Obviously if someone can help with 1 and 2 I can manipulate it for 3 and 4.
5. BONUS POINTS :) take the Automobiles.csv and Trucks.csv files and create Vehicles.xls file with Automobiles and Trucks tabs.
Few details - files are pretty large, each CSV can up to 350 thousand rows x 150 columns and be 200 MB in size each. All the Batch scripts that I tried to put together removing headers seemed to freeze with larger files.
Due to user permissions on work computers would strongly prefer to use something that is native to Windows7/8 and doesn't require additional software, but would consider other options if nothing native is available.
Thanks in advance!
| 0debug
|
Python - An object instantiated outside of a function. How can I access from the fuction? : Tried to access as argument of the function. Not working!
object = class()
def foo(object):
object.method
foo()
Not working! Can't remember the error message. But its obviously not working!
| 0debug
|
While loop for 300seconds in python : <p>I am new in python
I want to run my while loop for 300seconds or upto 300s
After 300seconds it must terminate
How I can write program in python
Plz help.</p>
| 0debug
|
Excel - How to subtract a Fixed number from each cell separately and then sum the results in one cell ? : Am trying to subtract a fixed number from all cells in column separately, and then sum the result in one cell, i want all this function in one cell, its easy to do it each one alone but i want to mix it in one cell.
here is my example: I want my fixed number (300) to be subtracted from each cell in column **A** and then sum the results from them in one cell (**B1**) = 530
**A** **B**
**1** 200 530
**2** 300
**3** 70
**4** 100
| 0debug
|
static QList *get_cpus(QDict **resp)
{
*resp = qmp("{ 'execute': 'query-cpus' }");
g_assert(*resp);
g_assert(qdict_haskey(*resp, "return"));
return qdict_get_qlist(*resp, "return");
}
| 1threat
|
how to apply check until required amount is paid for my C# program? : i am stuck with some thing. i am trying to make a back deposit system that requires user to deposit amount of 65000, account holder should be keep deposing money until full amount of 65000 is paid. i tried to do this with do while loop but it is just working as variable and not checking how much money is paid . here is sample of code:
int user_fee;
int deposited=65000;
do
{
Console.WriteLine("please enter fee");
user_fee = Convert.ToInt32(Console.ReadLine());
obj.Fee = user_fee;
} while (user_fee<= deposited);
| 0debug
|
static void fdctrl_connect_drives(FDCtrl *fdctrl)
{
unsigned int i;
FDrive *drive;
for (i = 0; i < MAX_FD; i++) {
drive = &fdctrl->drives[i];
fd_init(drive);
fd_revalidate(drive);
if (drive->bs) {
bdrv_set_removable(drive->bs, 1);
}
}
}
| 1threat
|
void qemu_check_nic_model(NICInfo *nd, const char *model)
{
const char *models[2];
models[0] = model;
models[1] = NULL;
qemu_check_nic_model_list(nd, models, model);
}
| 1threat
|
int qemu_timedate_diff(struct tm *tm)
{
time_t seconds;
if (rtc_date_offset == -1)
if (rtc_utc)
seconds = mktimegm(tm);
else {
struct tm tmp = *tm;
tmp.tm_isdst = -1;
seconds = mktime(&tmp);
}
else
seconds = mktimegm(tm) + rtc_date_offset;
return seconds - time(NULL);
}
| 1threat
|
Use json to generate output eventemitter : <p>The title almost said what I want to express.I wonder is there any way to generate output eventemitter by json in Angular. so i can get the certain
type of event and i can do other operations outside.</p>
| 0debug
|
static int fits_write_packet(AVFormatContext *s, AVPacket *pkt)
{
write_image_header(s);
avio_write(s->pb, pkt->data, pkt->size);
return 0;
}
| 1threat
|
Unable to open terminal in mac : <p>I am unable to open the terminal or iTerm in my Mac OS, since my last update using brew. Not sure what I upgraded using brew :(</p>
<p>Below is the error message I get when I open terminal. Any help is much appreciated.</p>
<pre><code>dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.6.dylib
Referenced from: /usr/local/bin/bash
Reason: image not found
[Process completed]
</code></pre>
<p>Thanks in advance!</p>
| 0debug
|
qio_channel_websock_source_check(GSource *source)
{
QIOChannelWebsockSource *wsource = (QIOChannelWebsockSource *)source;
GIOCondition cond = 0;
if (wsource->wioc->rawinput.offset) {
cond |= G_IO_IN;
}
if (wsource->wioc->rawoutput.offset < QIO_CHANNEL_WEBSOCK_MAX_BUFFER) {
cond |= G_IO_OUT;
}
return cond & wsource->condition;
}
| 1threat
|
D3.js : Uncaught TypeError: Cannot read property 'document' of undefined : <p>I'm having a really weird problem with d3.js initilization. In the d3.js script, at the very beginning, it tries to get <code>var d3_document = this.document;</code> but it pops the following error:</p>
<pre><code>Uncaught TypeError: Cannot read property 'document' of undefined
</code></pre>
<p>when debugging, <code>this.document</code> returns undefined. </p>
<p>I'm using <code>yo webapp</code> to generate the project. It uses bower as package manager and gulp for the build process (that uses babel for the ES2015 features).</p>
<p>The funny thing is that I've tested it with xampp and it works fine!</p>
<p>I would appreciate some advice!Thnx!</p>
| 0debug
|
How to make clicks on part of model in Vuforia (without Unity)? : <p>I want to make clickable cell of the palette in Vuforia <strong>(without Unity)</strong> by tap on screen:
<a href="https://i.stack.imgur.com/TEnG6.jpg"><img src="https://i.stack.imgur.com/TEnG6.jpg" alt="enter image description here"></a></p>
<p>I found Dominoes example with similar functionality and do that: </p>
<ul>
<li><p>create one plate object and multiply cells objects</p></li>
<li><p>call isTapOnSetColor function with parameter x, y (click coordinates) on tap and get coordinates, </p></li>
<li><p>coordinates is correct, but get the id/name of part of objects is wrong</p></li>
</ul>
<p>I think problem with this line:</p>
<pre><code>boolean bool = checkIntersectionLine(matrix44F, lineStart, lineEnd);
</code></pre>
<p>In the Dominoes example this was:</p>
<pre><code>bool intersection = checkIntersectionLine(domino->pickingTransform, lineStart, lineEnd);
</code></pre>
<p>But I don't know what does do <code>domino->pickingTransform</code> and paste instead of this line modelViewMatrix (Tool.convertPose2GLMatrix(trackableResult.getPose()).getData())</p>
<p>Full code of my touch function: <a href="http://pastebin.com/My4CkxHa">http://pastebin.com/My4CkxHa</a></p>
<p>Can you help me to make clicks or may be another way (not Unity) to do that?</p>
| 0debug
|
if(process.env.NODE_ENV === 'production') always false : <p>When trying to build an angular-webpack application by running the build command from this scripts list on the package.json:</p>
<pre><code>"scripts": {
"test": "NODE_ENV=test karma start",
"build": "if exist dist rd /s /q dist && mkdir dist && set NODE_ENV=production && webpack && cp app/index.html dist/index.html",
"start": "webpack-dev-server --content-base app"
},
</code></pre>
<p>this is the result on the console : </p>
<pre><code>$ npm run build
> webpack-ng-egg@1.0.0 build M:\Learning webpack\egghead.io - AngularJS - Angula
r and Webpack for Modular Applications\webpack-ng-egg
> if exist dist rd /s /q dist && mkdir dist && set NODE_ENV='production' && webp
ack && cp app/index.html dist/index.html
process.env.NODE_ENV : 'production'
process.env.NODE_ENV === 'production' ???? : false
Hash: c3136b0024cbd48ccb2e
Version: webpack 1.13.2
Time: 3185ms
Asset Size Chunks Chunk Names
bundle.js 1.23 MB 0 [emitted] main
+ 10 hidden modules
</code></pre>
<p>this is how looks like the webpack.config.js file :</p>
<pre><code> var webpack = require('webpack');
var path = require('path');
var config = {
context: path.resolve(__dirname, "app"),
entry:'./app.js',
output: {
path : __dirname + '/app',
filename:'bundle.js' // il ne sera pas généré dans le code, juste en mémoire
},
plugins:[
new webpack.DefinePlugin({
ON_TEST:process.env.NODE_ENV === 'test'
})
],
module:{
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel', // 'babel-loader' is also a legal name to reference
query: {
presets: ['es2015']
}
},
{ test: /\.css$/,
loader: "style-loader!css-loader",
exclude: /(node_modules|bower_components)/
},
{
test: /\.html$/,
exclude: /(node_modules|bower_components)/,
loader: 'raw', // 'babel-loader' is also a legal name to reference
},
{ test: /\.styl$/,
loader: 'style-loader!css-loader!stylus-loader',
exclude: /(node_modules|bower_components)/
}
]
},
devServer:{
//contentBase:path.join(__dirname, 'dist') // ceci est juste un exemple, si dist est l'endroit ou on aurait généré les fichiers
inline:true, // les mises à jour de style ne sont plus affichés instantnément avec cette option donc j'ai ajouté le watch:true et çà marché!!!
watch:true
}
/*resolve: {
extensions: ['', '.js', '.jsx', '.css']
},
resolveLoader: {
root: require('path').resolve(__dirname, "node_modules")
}*/
}
console.log("process.env.NODE_ENV : " + process.env.NODE_ENV);
console.log("process.env.NODE_ENV === 'production' ???? : " + (process.env.NODE_ENV == 'production'));
//config.output.path = path.resolve(__dirname, "dist");
//console.log("config.output.path : " + config.output.path);
if(process.env.NODE_ENV === 'production') {
console.log("this is the prod env!!!!!!!!!!");
config.output.path = path.resolve(__dirname, "dist");
}
module.exports = config;
</code></pre>
<p>the problem here is that when testing <code>(process.env.NODE_ENV === 'production')</code> it never returns true even that it's supposed to be (see what is logged on the console above). I have tried to chage to a simple equality instead the strict one but still get false all the time.</p>
| 0debug
|
How to pair sublists of (x,y) cell coordinates? : I have a list of 60 lists (representing 60 images). Each of these 60 lists contains 30 sublists, each sub-list corresponding to a cell's coordinates.
The goal is to track each cell's coordinates, in other words, to pair each sublist (cell) of the bigger list to all of the other sublists of each bigger list (the image). Thus, in the end, we shall obtain 60 lists: each list is a cell's coordinates over the 60 images. That way I can calculate each cell's speed.
`[[[[99, 87, 10], [212, 271, 10], [224, 394, 10], [394, 178, 10], [155, 91, 10], [297, 107, 10], [406, 52, 10], [349, 427, 10], [149, 118, 10], [184, 199, 10], [185, 247, 10], [62, 232, 10], [63, 71, 10], [205, 46, 10], [381, 74, 10], [255, 389, 10], [98, 143, 9], [99, 373, 10], [55, 341, 10], [89, 195, 10], [305, 182, 10], [263, 255, 9], [345, 62, 9], [226, 235, 9], [242, 142, 9], [379, 35, 9], [391, 265, 9], [205, 151, 9], [335, 397, 9], [122, 211, 9]]], [[[347, 425, 10], [64, 75, 10], [399, 184, 10], [178, 244, 10], [292, 106, 10], [379, 35, 10], [383, 71, 10], [184, 200, 10], [212, 271, 10], [406, 52, 10], [302, 181, 10], [149, 87, 10], [245, 142, 10], [221, 238, 10], [93, 145, 10], [211, 146, 10], [51, 339, 10], [223, 392, 9], [97, 93, 10], [345, 61, 9], [63, 230, 9], [91, 197, 10], [141, 121, 10], [262, 263, 10], [392, 259, 9], [100, 369, 9], [207, 44, 9], [127, 212, 9], [254, 389, 9]]], [[[212, 269, 9], [383, 71, 10], [184, 200, 10], [296, 178, 10], [69, 80, 10], [173, 247, 10], [409, 56, 10], [140, 122, 10], [207, 45, 10], [394, 257, 10], [403, 187, 10], [64, 224, 10], [91, 205, 10], [148, 87, 10], [51, 337, 10], [223, 392, 10], [218, 148, 10], [93, 99, 10], [248, 143, 10], [339, 59, 10], [91, 145, 10], [323, 400, 10], [261, 263, 10], [289, 106, 9], [254, 382, 10], [343, 422, 9], [134, 214, 9], [217, 242, 9], [383, 40, 9], [103, 363, 9]]], [[[383, 74, 10], [208, 271, 10], [220, 146, 10], [253, 143, 10], [394, 257, 10], [212, 43, 10], [321, 401, 10], [212, 239, 10], [343, 422, 10], [136, 123, 10], [383, 43, 10], [93, 103, 10], [135, 214, 10], [333, 56, 10], [409, 59, 10], [110, 359, 10], [177, 205, 10], [260, 263, 10], [293, 177, 10], [69, 80, 9], [409, 190, 10], [50, 331, 10], [92, 207, 9], [254, 380, 9], [148, 87, 9], [169, 250, 9], [65, 219, 9], [220, 385, 9], [283, 107, 9], [87, 149, 9]]], [[[95, 106, 10], [110, 356, 10], [317, 406, 10], [223, 383, 10], [344, 421, 10], [136, 124, 10], [142, 88, 10], [164, 256, 10], [47, 328, 10], [253, 376, 10], [277, 107, 10], [68, 82, 10], [383, 45, 10], [255, 142, 10], [214, 41, 10], [291, 176, 10], [221, 146, 9], [412, 193, 10], [409, 61, 10], [171, 206, 10], [260, 263, 10], [207, 237, 10], [95, 211, 9], [65, 217, 9], [395, 255, 10], [208, 271, 9], [326, 53, 9], [136, 215, 9], [86, 154, 9], [385, 79, 9]]], [[[343, 418, 9], [203, 271, 10], [113, 353, 10], [254, 368, 10], [67, 82, 10], [135, 88, 10], [315, 406, 10], [214, 40, 10], [223, 145, 10], [269, 106, 10], [407, 58, 10], [225, 386, 10], [97, 111, 10], [259, 145, 10], [169, 201, 10], [205, 238, 10], [399, 249, 9], [254, 261, 9], [387, 80, 9], [97, 215, 10], [142, 215, 9], [83, 157, 9], [47, 327, 9], [284, 173, 9], [413, 195, 9], [59, 212, 9], [136, 128, 9], [161, 259, 9], [320, 50, 9], [382, 46, 9]]], [[[45, 322, 10], [134, 129, 10], [142, 214, 10], [75, 154, 10], [262, 142, 10], [311, 406, 10], [278, 169, 10], [257, 361, 10], [97, 115, 10], [119, 351, 10], [215, 35, 10], [169, 203, 10], [223, 140, 10], [383, 47, 10], [253, 260, 10], [202, 271, 10], [202, 236, 10], [412, 200, 10], [413, 52, 9], [97, 219, 10], [343, 413, 10], [401, 247, 9], [268, 103, 10], [160, 261, 9], [64, 82, 9], [387, 79, 9], [316, 51, 9], [58, 211, 9], [134, 91, 9]]], [[[195, 274, 10], [313, 47, 10], [97, 219, 10], [415, 205, 10], [73, 158, 10], [57, 83, 10], [169, 201, 10], [57, 209, 10], [232, 382, 10], [266, 103, 10], [159, 261, 10], [275, 167, 10], [399, 241, 10], [387, 77, 10], [225, 134, 10], [267, 139, 9], [343, 410, 9], [413, 49, 9], [143, 214, 10], [251, 261, 10], [199, 235, 9], [257, 361, 10], [41, 317, 9], [122, 350, 10], [304, 409, 9], [91, 119, 9], [128, 130, 9], [215, 31, 9], [133, 91, 9], [381, 49, 9]]], [[[233, 382, 9], [130, 93, 10], [69, 160, 10], [41, 317, 10], [398, 236, 10], [190, 281, 10], [89, 119, 10], [143, 215, 10], [217, 28, 10], [125, 129, 10], [344, 404, 10], [247, 262, 10], [413, 47, 10], [167, 200, 10], [395, 76, 10], [297, 412, 10], [271, 137, 10], [309, 49, 10], [49, 83, 10], [263, 358, 10], [55, 202, 9], [379, 50, 9], [154, 265, 9], [223, 129, 9], [415, 205, 9], [130, 353, 9], [191, 233, 9], [275, 167, 9], [100, 221, 9], [263, 97, 9]]], [[[146, 223, 9], [261, 92, 10], [183, 283, 9], [267, 355, 9], [382, 49, 10], [397, 76, 10], [46, 76, 10], [68, 160, 10], [43, 315, 10], [123, 91, 10], [412, 47, 10], [417, 206, 10], [272, 137, 10], [236, 383, 10], [345, 401, 10], [273, 167, 10], [99, 223, 10], [223, 128, 9], [133, 353, 10], [307, 43, 10], [119, 124, 10], [188, 238, 9], [153, 265, 10], [398, 231, 9], [57, 199, 10], [218, 27, 9], [297, 412, 9], [166, 195, 9], [245, 260, 9], [89, 119, 9]]], [[[218, 21, 10], [225, 122, 10], [268, 171, 10], [41, 313, 10], [122, 91, 10], [344, 398, 10], [295, 417, 10], [239, 388, 10], [242, 259, 10], [62, 163, 10], [184, 241, 10], [148, 225, 10], [303, 41, 10], [149, 265, 10], [137, 356, 9], [279, 139, 10], [88, 119, 10], [100, 230, 10], [400, 230, 9], [260, 92, 9], [418, 206, 10], [401, 75, 9], [167, 188, 9], [44, 76, 10], [58, 196, 9], [412, 47, 9], [269, 349, 9], [119, 123, 9], [385, 50, 9]]], [[[403, 77, 10], [412, 41, 10], [57, 195, 10], [271, 349, 10], [172, 286, 10], [44, 73, 10], [41, 309, 10], [299, 37, 10], [419, 208, 10], [383, 49, 10], [400, 229, 10], [245, 389, 10], [237, 256, 10], [57, 166, 10], [118, 124, 10], [151, 231, 10], [255, 91, 10], [184, 243, 10], [88, 121, 10], [118, 88, 10], [100, 231, 10], [224, 115, 9], [295, 419, 10], [267, 173, 10], [345, 397, 9], [283, 136, 9], [142, 268, 9], [137, 359, 9], [167, 181, 9], [217, 15, 9]]], [[[179, 248, 10], [250, 86, 10], [297, 35, 10], [58, 166, 10], [170, 287, 10], [292, 422, 10], [152, 231, 10], [220, 112, 10], [215, 13, 10], [268, 178, 10], [41, 308, 10], [277, 347, 10], [100, 237, 10], [421, 207, 10], [56, 194, 10], [245, 389, 10], [403, 238, 10], [139, 269, 10], [410, 35, 10], [81, 124, 10], [235, 255, 10], [284, 137, 10], [169, 179, 10], [141, 365, 10], [346, 395, 9], [116, 88, 9], [118, 124, 9], [385, 52, 9], [38, 69, 9], [407, 83, 9]]], [[[285, 136, 10], [285, 424, 10], [169, 178, 10], [409, 83, 10], [165, 291, 10], [248, 392, 10], [115, 123, 10], [405, 29, 10], [61, 195, 10], [82, 127, 10], [247, 87, 10], [269, 183, 10], [279, 346, 10], [217, 11, 10], [151, 232, 10], [43, 304, 10], [351, 391, 10], [405, 241, 10], [58, 166, 10], [388, 57, 10], [35, 63, 9], [293, 34, 10], [113, 86, 10], [178, 250, 9], [100, 245, 9], [214, 109, 9], [235, 256, 10], [421, 208, 9], [139, 271, 9], [145, 369, 9]]], [[[67, 199, 10], [410, 88, 10], [227, 257, 10], [136, 279, 10], [209, 106, 10], [56, 169, 10], [217, 10, 10], [40, 301, 10], [389, 57, 10], [109, 80, 10], [147, 373, 10], [250, 395, 10], [291, 133, 10], [113, 129, 10], [243, 88, 10], [152, 233, 10], [163, 295, 10], [410, 243, 10], [423, 212, 10], [269, 187, 10], [33, 57, 9], [83, 127, 9], [283, 428, 9], [170, 175, 9], [355, 385, 9], [178, 256, 9], [405, 29, 9], [290, 34, 9], [101, 251, 9], [284, 344, 9]]], [[[409, 89, 10], [236, 91, 9], [106, 74, 10], [283, 429, 9], [355, 379, 10], [421, 213, 10], [37, 301, 10], [416, 248, 10], [283, 33, 10], [179, 263, 10], [391, 56, 10], [267, 191, 10], [225, 257, 10], [135, 285, 10], [153, 375, 10], [100, 256, 9], [209, 104, 9], [83, 128, 9], [292, 131, 9], [163, 297, 10], [112, 129, 10], [52, 172, 9], [291, 343, 9], [170, 166, 9], [31, 53, 9], [215, 9, 10], [155, 239, 9], [403, 29, 9], [71, 197, 9], [257, 397, 9]]], [[[281, 433, 9], [235, 89, 10], [359, 373, 10], [278, 28, 10], [409, 89, 10], [422, 248, 10], [262, 399, 10], [161, 302, 10], [295, 344, 10], [159, 379, 10], [387, 55, 10], [215, 8, 10], [111, 136, 10], [33, 295, 10], [51, 173, 10], [109, 69, 10], [134, 285, 10], [81, 136, 10], [292, 130, 10], [173, 160, 9], [401, 28, 9], [77, 197, 10], [219, 253, 10], [105, 257, 10], [208, 101, 9], [157, 247, 9], [29, 51, 9], [179, 269, 9], [267, 193, 9]]], [[[178, 153, 10], [401, 29, 10], [262, 199, 9], [153, 253, 9], [412, 94, 10], [207, 98, 10], [427, 244, 10], [163, 382, 10], [85, 196, 10], [112, 141, 10], [77, 142, 10], [418, 217, 10], [105, 260, 10], [278, 21, 10], [295, 125, 10], [359, 371, 9], [46, 177, 9], [134, 284, 10], [32, 293, 9], [29, 46, 10], [177, 274, 10], [217, 247, 10], [290, 430, 9], [235, 91, 10], [158, 309, 9], [265, 401, 9], [302, 344, 9], [382, 52, 9], [111, 67, 9]]], [[[275, 17, 10], [412, 103, 9], [207, 98, 10], [76, 149, 10], [109, 266, 10], [299, 119, 10], [400, 26, 10], [151, 257, 10], [217, 243, 10], [376, 49, 10], [159, 311, 10], [261, 199, 10], [267, 401, 10], [297, 429, 10], [175, 278, 10], [220, 9, 10], [415, 217, 10], [181, 148, 9], [89, 199, 10], [31, 43, 9], [43, 184, 10], [235, 83, 9], [164, 386, 9], [31, 293, 10], [361, 367, 9], [431, 247, 9], [304, 345, 9], [131, 287, 9], [111, 58, 9]]], [[[299, 119, 10], [77, 151, 10], [399, 26, 10], [187, 145, 10], [205, 91, 10], [92, 199, 10], [301, 422, 10], [165, 386, 10], [409, 218, 10], [127, 292, 10], [224, 13, 10], [307, 344, 10], [106, 271, 10], [40, 188, 10], [374, 50, 10], [117, 149, 10], [273, 16, 10], [361, 367, 10], [29, 296, 10], [433, 249, 10], [256, 202, 10], [411, 109, 10], [236, 77, 9], [151, 259, 9], [160, 313, 9], [173, 280, 9], [116, 56, 9], [218, 239, 9], [268, 403, 9], [33, 37, 9]]], [[[313, 349, 10], [367, 47, 10], [395, 22, 10], [201, 88, 10], [172, 281, 10], [97, 200, 10], [125, 296, 10], [187, 145, 10], [226, 14, 10], [433, 250, 10], [271, 404, 10], [297, 413, 10], [401, 219, 10], [307, 116, 10], [79, 158, 10], [116, 153, 10], [39, 31, 10], [163, 314, 10], [105, 272, 10], [25, 297, 9], [166, 387, 10], [250, 202, 10], [364, 359, 10], [151, 261, 10], [35, 193, 9], [219, 238, 9], [233, 70, 9], [266, 17, 9], [410, 110, 9]]], [[[226, 15, 10], [151, 261, 9], [21, 296, 10], [247, 201, 10], [364, 50, 10], [389, 20, 10], [271, 404, 10], [314, 349, 10], [194, 143, 10], [410, 112, 10], [32, 199, 10], [167, 386, 10], [107, 272, 10], [113, 159, 10], [401, 219, 10], [121, 46, 10], [307, 109, 10], [219, 237, 10], [364, 357, 10], [299, 412, 10], [235, 63, 10], [79, 159, 9], [123, 298, 10], [169, 283, 9], [103, 194, 9], [194, 86, 9], [433, 251, 9], [41, 26, 9], [263, 17, 9], [166, 313, 9]]], [[[407, 113, 10], [109, 271, 10], [147, 262, 10], [226, 16, 10], [118, 164, 10], [118, 302, 10], [123, 39, 10], [16, 296, 10], [309, 107, 10], [169, 284, 10], [399, 223, 10], [301, 411, 10], [241, 58, 10], [80, 161, 10], [431, 242, 10], [241, 201, 10], [31, 207, 10], [109, 193, 10], [364, 353, 10], [320, 353, 10], [197, 147, 10], [263, 19, 9], [358, 51, 9], [46, 23, 9], [191, 79, 9], [220, 237, 9], [386, 20, 9], [166, 314, 9], [167, 385, 9], [271, 404, 9]]], [[[203, 151, 9], [167, 319, 10], [191, 79, 10], [364, 347, 10], [272, 405, 10], [27, 212, 10], [111, 193, 10], [167, 285, 10], [221, 230, 10], [241, 56, 10], [13, 298, 10], [313, 100, 10], [398, 223, 10], [322, 353, 10], [45, 21, 10], [379, 21, 10], [110, 273, 10], [117, 304, 10], [357, 51, 10], [260, 17, 9], [170, 385, 9], [125, 38, 10], [302, 410, 9], [238, 203, 9], [400, 116, 9], [145, 263, 10], [230, 17, 9], [431, 236, 9], [80, 163, 9], [124, 166, 9]]], [[[361, 341, 10], [124, 166, 10], [117, 195, 10], [325, 353, 10], [395, 226, 10], [224, 232, 10], [394, 115, 10], [315, 97, 10], [193, 75, 10], [272, 403, 10], [22, 217, 10], [9, 303, 9], [230, 17, 10], [355, 50, 10], [431, 231, 9], [113, 273, 9], [171, 382, 9], [237, 207, 10], [169, 290, 9], [173, 323, 10], [259, 17, 9], [81, 161, 10], [207, 151, 9], [127, 37, 9], [377, 22, 9], [239, 55, 9], [115, 311, 9], [305, 409, 9], [43, 16, 9], [145, 269, 9]]], [[[392, 226, 9], [357, 340, 10], [167, 295, 10], [315, 92, 10], [392, 112, 10], [237, 207, 10], [371, 23, 10], [176, 325, 10], [16, 221, 10], [231, 23, 10], [143, 272, 10], [122, 199, 10], [8, 305, 10], [113, 274, 10], [130, 32, 10], [225, 232, 10], [196, 69, 10], [261, 10, 10], [239, 52, 10], [331, 357, 10], [38, 11, 10], [88, 165, 9], [429, 229, 9], [172, 379, 9], [274, 405, 9], [352, 50, 9], [110, 316, 9], [127, 169, 9], [311, 405, 9], [214, 151, 9]]], [[[91, 169, 10], [125, 169, 10], [365, 17, 10], [142, 271, 10], [386, 230, 10], [163, 298, 10], [386, 112, 10], [170, 376, 10], [232, 202, 10], [10, 313, 10], [316, 86, 10], [347, 53, 10], [131, 27, 10], [357, 338, 10], [331, 357, 10], [218, 151, 10], [179, 326, 9], [225, 231, 10], [231, 22, 10], [116, 274, 10], [241, 49, 9], [313, 403, 10], [278, 409, 9], [430, 224, 9], [11, 224, 9], [37, 9, 10], [109, 323, 9], [199, 63, 9], [125, 203, 9]]], [[[385, 109, 9], [278, 409, 9], [10, 223, 9], [331, 357, 9], [215, 230, 10], [10, 320, 10], [100, 326, 10], [221, 153, 10], [315, 403, 10], [429, 223, 10], [169, 369, 10], [115, 280, 10], [263, 11, 10], [37, 9, 10], [157, 303, 10], [203, 62, 10], [229, 23, 10], [379, 230, 9], [127, 170, 10], [182, 323, 9], [359, 17, 10], [142, 271, 9], [91, 169, 9], [127, 208, 9], [131, 26, 9], [357, 331, 9], [317, 83, 9], [343, 58, 9], [239, 49, 9]]], [[[281, 413, 10], [29, 13, 10], [211, 224, 10], [356, 329, 10], [187, 319, 10], [128, 211, 10], [265, 11, 10], [167, 369, 10], [130, 175, 10], [139, 268, 10], [334, 353, 10], [206, 59, 10], [99, 167, 10], [233, 52, 10], [428, 223, 10], [379, 104, 10], [134, 25, 10], [97, 327, 10], [314, 79, 10], [316, 403, 10], [152, 303, 10], [338, 62, 9], [111, 286, 10], [233, 201, 9], [226, 159, 9], [377, 230, 9], [10, 326, 9], [224, 22, 9], [357, 19, 9]]], [[[375, 232, 10], [137, 25, 10], [317, 401, 10], [10, 328, 10], [335, 352, 10], [353, 20, 10], [206, 58, 10], [379, 103, 10], [225, 23, 10], [310, 73, 10], [271, 15, 10], [353, 326, 10], [188, 315, 10], [285, 419, 10], [92, 323, 10], [233, 51, 10], [128, 213, 10], [231, 196, 10], [13, 217, 10], [163, 368, 9], [230, 164, 9], [208, 219, 9], [337, 62, 9], [23, 13, 9], [423, 217, 9], [110, 286, 9], [133, 175, 9], [137, 268, 9], [149, 303, 9], [101, 167, 9]]], [[[225, 164, 10], [188, 309, 10], [373, 237, 9], [145, 25, 10], [9, 329, 10], [419, 214, 10], [325, 399, 10], [131, 267, 10], [227, 193, 10], [285, 419, 10], [308, 67, 10], [89, 323, 10], [231, 21, 10], [335, 352, 10], [207, 215, 10], [353, 320, 9], [110, 291, 10], [337, 62, 9], [105, 163, 10], [232, 52, 9], [19, 15, 9], [207, 59, 9], [13, 214, 9], [272, 19, 9], [377, 100, 9], [135, 181, 9], [135, 217, 9], [149, 303, 9], [349, 19, 9]]], [[[236, 55, 9], [88, 323, 10], [337, 346, 10], [286, 422, 10], [333, 400, 10], [347, 19, 10], [350, 313, 10], [417, 207, 10], [112, 292, 10], [129, 265, 10], [159, 374, 10], [235, 20, 10], [205, 51, 10], [149, 23, 10], [274, 21, 10], [340, 70, 10], [9, 329, 10], [16, 16, 9], [371, 97, 9], [308, 61, 9], [136, 218, 9], [370, 239, 10], [227, 195, 9], [149, 303, 9], [136, 182, 9], [107, 161, 9], [16, 211, 9], [226, 166, 9], [191, 305, 9], [201, 211, 9]]], [[[363, 243, 9], [334, 400, 9], [226, 194, 10], [143, 217, 10], [347, 308, 10], [151, 302, 10], [83, 325, 10], [129, 263, 10], [286, 425, 10], [236, 21, 10], [155, 375, 10], [19, 203, 10], [9, 337, 10], [337, 77, 10], [197, 203, 10], [195, 303, 10], [205, 44, 9], [155, 28, 10], [220, 164, 10], [347, 19, 10], [307, 55, 10], [112, 158, 9], [235, 59, 9], [370, 98, 9], [115, 299, 10], [339, 343, 10], [137, 184, 9], [15, 16, 9], [415, 201, 9], [275, 22, 9]]], [[[277, 23, 10], [206, 43, 10], [149, 214, 10], [230, 194, 10], [304, 52, 10], [335, 79, 10], [239, 25, 10], [339, 341, 10], [127, 256, 10], [116, 155, 10], [196, 203, 10], [340, 21, 10], [161, 32, 9], [139, 183, 10], [19, 195, 10], [151, 375, 9], [14, 16, 9], [151, 298, 9], [237, 67, 9], [85, 325, 9], [9, 341, 10], [121, 298, 10], [415, 196, 10], [357, 245, 10], [196, 302, 9], [285, 431, 9], [220, 166, 9], [368, 98, 9], [346, 305, 9], [337, 401, 9]]], [[[161, 32, 9], [367, 98, 9], [214, 165, 10], [331, 83, 9], [10, 15, 10], [151, 214, 10], [236, 74, 10], [339, 335, 10], [127, 253, 10], [205, 38, 10], [230, 194, 10], [290, 431, 10], [280, 28, 10], [416, 190, 10], [83, 326, 10], [335, 26, 10], [115, 154, 10], [119, 298, 10], [195, 201, 10], [141, 183, 10], [304, 46, 10], [22, 193, 10], [357, 247, 10], [151, 298, 9], [199, 298, 9], [239, 25, 9], [339, 301, 9], [343, 403, 9], [146, 377, 9]]], [[[165, 37, 9], [236, 75, 10], [208, 167, 9], [346, 406, 10], [247, 28, 10], [11, 14, 10], [200, 292, 10], [331, 88, 10], [121, 298, 10], [416, 190, 10], [13, 344, 10], [122, 247, 10], [359, 248, 10], [291, 431, 10], [202, 35, 10], [333, 301, 10], [338, 334, 10], [232, 197, 9], [329, 29, 9], [149, 295, 9], [151, 213, 10], [23, 194, 10], [193, 195, 9], [146, 377, 9], [275, 35, 9], [80, 328, 9], [358, 97, 9], [146, 179, 9], [117, 151, 9], [305, 45, 9]]], [[[117, 292, 10], [119, 143, 10], [328, 28, 10], [417, 183, 10], [200, 197, 10], [358, 99, 10], [171, 40, 10], [329, 93, 10], [205, 167, 10], [200, 32, 10], [149, 178, 10], [28, 194, 10], [307, 45, 10], [327, 298, 10], [338, 332, 10], [142, 380, 10], [299, 431, 9], [151, 213, 10], [359, 250, 10], [20, 345, 10], [273, 38, 10], [11, 13, 10], [202, 290, 9], [238, 197, 9], [247, 28, 9], [346, 407, 9], [76, 328, 9], [235, 77, 9], [121, 239, 9], [149, 291, 9]]], [[[149, 209, 10], [328, 94, 10], [200, 166, 10], [358, 99, 10], [21, 345, 10], [241, 197, 10], [147, 286, 10], [232, 82, 10], [308, 51, 10], [349, 411, 10], [356, 254, 10], [413, 176, 10], [170, 43, 10], [273, 38, 10], [329, 29, 10], [247, 23, 10], [118, 292, 10], [141, 381, 10], [76, 327, 9], [299, 430, 10], [197, 25, 10], [122, 139, 9], [200, 197, 10], [28, 193, 9], [121, 237, 9], [149, 177, 9], [328, 296, 9], [203, 286, 9]]], [[[26, 346, 10], [248, 197, 10], [341, 326, 10], [171, 46, 10], [201, 283, 10], [123, 139, 10], [197, 167, 10], [201, 197, 10], [304, 430, 10], [232, 83, 10], [147, 285, 10], [412, 173, 10], [141, 382, 10], [199, 23, 10], [327, 295, 10], [351, 418, 10], [355, 254, 10], [151, 207, 10], [148, 171, 10], [31, 191, 10], [119, 292, 10], [75, 326, 9], [274, 44, 9], [335, 37, 9], [358, 106, 9], [313, 57, 9], [251, 20, 9], [119, 235, 9]]], [[[305, 427, 10], [326, 99, 10], [352, 422, 10], [128, 136, 10], [148, 170, 10], [226, 88, 10], [27, 347, 10], [121, 231, 10], [254, 21, 10], [201, 281, 10], [341, 322, 10], [355, 262, 10], [152, 201, 10], [202, 202, 10], [339, 39, 10], [73, 323, 9], [137, 389, 10], [193, 165, 10], [314, 57, 10], [149, 283, 10], [356, 109, 10], [37, 187, 10], [327, 293, 10], [411, 175, 9], [121, 292, 9], [277, 47, 9], [171, 47, 9], [197, 17, 9], [10, 8, 9]]], [[[39, 184, 10], [203, 207, 9], [147, 164, 10], [152, 200, 10], [355, 267, 10], [17, 11, 10], [321, 103, 10], [339, 40, 10], [151, 281, 10], [346, 319, 10], [356, 116, 10], [136, 392, 10], [257, 19, 10], [316, 59, 10], [71, 322, 10], [307, 425, 10], [185, 169, 10], [171, 50, 10], [29, 347, 9], [260, 195, 10], [411, 171, 10], [277, 47, 10], [325, 292, 10], [199, 10, 9], [355, 424, 10], [119, 291, 9], [131, 137, 10], [122, 230, 9], [201, 274, 9], [221, 89, 9]]], [[[203, 209, 10], [200, 10, 10], [20, 11, 10], [261, 17, 10], [316, 59, 10], [320, 109, 10], [167, 56, 10], [353, 118, 10], [35, 344, 10], [154, 283, 10], [323, 291, 10], [305, 417, 10], [407, 164, 10], [355, 267, 10], [281, 53, 9], [136, 397, 10], [69, 317, 10], [346, 317, 10], [263, 195, 10], [135, 136, 10], [205, 269, 9], [221, 89, 10], [359, 431, 10], [127, 225, 9], [147, 194, 9], [38, 182, 9], [345, 45, 10], [121, 291, 9], [151, 160, 9], [185, 169, 9]]], [[[209, 266, 10], [139, 134, 10], [319, 110, 10], [349, 46, 10], [356, 274, 10], [261, 17, 10], [157, 159, 10], [39, 179, 10], [69, 313, 10], [37, 344, 10], [405, 157, 10], [141, 190, 10], [182, 170, 10], [350, 121, 10], [349, 314, 9], [323, 289, 10], [26, 11, 10], [359, 433, 10], [158, 285, 9], [130, 223, 10], [284, 57, 9], [319, 58, 9], [124, 287, 9], [266, 196, 9], [311, 413, 9], [165, 61, 9], [213, 88, 9], [136, 397, 9], [203, 211, 9], [200, 10, 9]]], [[[203, 214, 10], [130, 284, 10], [316, 110, 10], [40, 173, 10], [325, 58, 10], [310, 412, 10], [357, 433, 10], [405, 155, 10], [349, 122, 10], [352, 49, 10], [68, 313, 10], [212, 266, 10], [39, 344, 10], [160, 287, 10], [201, 8, 10], [130, 219, 10], [184, 171, 10], [213, 87, 10], [136, 399, 10], [139, 187, 9], [139, 135, 10], [263, 13, 10], [322, 287, 10], [266, 195, 9], [164, 62, 9], [357, 281, 9], [157, 158, 9], [286, 58, 9], [26, 10, 9], [353, 309, 9]]], [[[217, 265, 10], [361, 281, 10], [350, 431, 10], [309, 411, 10], [329, 59, 10], [46, 345, 10], [358, 52, 10], [128, 401, 10], [272, 191, 10], [131, 284, 10], [139, 133, 10], [206, 217, 10], [315, 111, 10], [128, 217, 10], [137, 184, 10], [349, 123, 10], [157, 160, 10], [31, 8, 10], [40, 167, 10], [213, 85, 10], [320, 285, 10], [290, 58, 9], [209, 10, 9], [163, 292, 9], [399, 151, 9], [184, 175, 9], [268, 10, 9], [159, 67, 9], [353, 309, 9]]], [[[331, 59, 10], [365, 281, 10], [61, 310, 10], [291, 59, 10], [363, 55, 10], [158, 68, 10], [214, 11, 10], [275, 189, 10], [399, 151, 10], [208, 79, 10], [310, 113, 10], [349, 124, 10], [122, 401, 10], [320, 285, 10], [167, 292, 10], [44, 160, 10], [269, 8, 10], [309, 409, 10], [123, 212, 10], [187, 179, 10], [349, 431, 10], [220, 265, 10], [137, 279, 9], [51, 338, 9], [203, 220, 9], [137, 183, 10], [37, 13, 9], [157, 160, 9], [139, 133, 9], [352, 308, 9]]], [[[352, 308, 10], [316, 281, 10], [118, 405, 10], [369, 281, 10], [37, 13, 10], [332, 59, 10], [346, 131, 10], [363, 53, 10], [220, 265, 10], [297, 61, 10], [393, 147, 10], [142, 275, 10], [143, 188, 9], [137, 129, 10], [170, 292, 10], [271, 8, 10], [203, 221, 9], [157, 68, 9], [308, 115, 9], [205, 79, 9], [52, 339, 9], [275, 188, 9], [347, 431, 9], [157, 161, 9], [43, 154, 9], [53, 309, 9], [122, 211, 9], [311, 403, 9]]], [[[143, 275, 9], [205, 79, 9], [155, 67, 10], [46, 307, 10], [369, 280, 10], [280, 188, 10], [160, 163, 10], [205, 223, 10], [148, 193, 10], [389, 146, 10], [171, 293, 10], [119, 208, 10], [221, 266, 10], [346, 135, 10], [315, 398, 10], [297, 61, 10], [43, 153, 10], [333, 58, 10], [115, 405, 9], [368, 50, 10], [219, 11, 9], [134, 125, 9], [58, 344, 9], [339, 431, 9], [278, 11, 9], [193, 185, 9], [315, 277, 9], [353, 307, 9], [38, 14, 9], [307, 115, 9]]], [[[225, 268, 10], [341, 140, 10], [193, 185, 10], [39, 307, 10], [314, 275, 10], [165, 164, 10], [368, 50, 10], [117, 203, 10], [206, 223, 10], [301, 64, 10], [335, 57, 10], [286, 191, 10], [220, 13, 10], [333, 429, 10], [149, 191, 10], [38, 15, 10], [111, 404, 10], [131, 124, 10], [386, 139, 10], [373, 275, 10], [171, 301, 10], [283, 13, 10], [41, 148, 9], [58, 344, 9], [355, 307, 9], [202, 74, 9], [145, 280, 9], [301, 116, 9], [319, 392, 9]]], [[[357, 302, 10], [149, 191, 10], [290, 14, 10], [308, 271, 10], [230, 275, 10], [146, 281, 10], [327, 391, 10], [127, 124, 10], [143, 57, 10], [201, 67, 10], [105, 407, 10], [207, 229, 10], [374, 45, 10], [41, 147, 10], [327, 427, 10], [177, 304, 10], [337, 59, 9], [295, 119, 9], [381, 137, 10], [221, 11, 10], [290, 188, 9], [37, 309, 10], [375, 269, 9], [169, 167, 9], [305, 67, 9], [40, 17, 9], [191, 191, 9], [59, 345, 9], [339, 145, 9]]], [[[207, 231, 9], [200, 65, 10], [305, 67, 10], [380, 139, 10], [44, 143, 10], [359, 302, 10], [376, 44, 10], [45, 17, 10], [191, 193, 10], [335, 153, 10], [35, 309, 10], [119, 121, 10], [117, 196, 10], [147, 285, 10], [231, 278, 10], [291, 116, 10], [319, 425, 10], [100, 407, 9], [143, 56, 9], [289, 187, 10], [334, 391, 9], [340, 57, 9], [182, 307, 10], [149, 191, 9], [65, 349, 9], [307, 271, 9], [290, 14, 9], [229, 11, 9], [375, 265, 9], [169, 169, 9]]], [[[49, 19, 10], [167, 169, 10], [344, 55, 10], [142, 55, 10], [68, 347, 10], [338, 385, 10], [359, 298, 10], [193, 193, 10], [287, 117, 10], [152, 191, 10], [46, 140, 10], [29, 309, 10], [117, 119, 10], [314, 423, 10], [205, 235, 10], [93, 404, 10], [152, 291, 10], [374, 261, 10], [295, 182, 10], [379, 43, 9], [295, 16, 9], [231, 286, 9], [231, 11, 9], [307, 268, 9], [115, 190, 9], [376, 137, 9], [197, 62, 9], [310, 71, 9], [337, 157, 9]]], [[[171, 166, 10], [25, 309, 9], [307, 424, 10], [191, 316, 10], [364, 293, 10], [152, 191, 10], [152, 292, 10], [193, 59, 10], [196, 199, 10], [296, 181, 10], [307, 266, 10], [231, 11, 10], [343, 50, 10], [296, 17, 10], [68, 349, 10], [287, 118, 10], [337, 159, 10], [115, 118, 10], [371, 257, 10], [339, 382, 10], [141, 49, 10], [235, 291, 10], [47, 140, 10], [202, 238, 9], [53, 20, 9], [376, 137, 9], [311, 79, 9], [93, 403, 9], [112, 187, 9], [385, 39, 9]]], [[[110, 117, 10], [339, 382, 10], [154, 292, 10], [196, 202, 10], [298, 178, 10], [178, 164, 10], [238, 14, 10], [304, 425, 10], [375, 135, 10], [386, 40, 10], [52, 23, 10], [153, 191, 10], [308, 259, 10], [191, 322, 10], [344, 45, 10], [141, 46, 10], [235, 293, 10], [201, 247, 10], [111, 184, 10], [88, 398, 9], [22, 308, 10], [70, 350, 10], [283, 118, 9], [299, 19, 10], [368, 253, 10], [191, 62, 10], [364, 293, 9], [337, 164, 9], [49, 139, 9], [313, 85, 9]]], [[[335, 167, 10], [303, 26, 10], [347, 43, 10], [369, 289, 9], [203, 251, 10], [236, 296, 10], [387, 39, 10], [301, 175, 10], [101, 118, 10], [188, 65, 10], [203, 206, 10], [375, 135, 10], [279, 122, 10], [154, 190, 10], [315, 85, 10], [105, 181, 10], [245, 16, 9], [53, 23, 10], [85, 398, 10], [346, 385, 10], [302, 427, 10], [22, 310, 10], [185, 160, 10], [76, 353, 9], [154, 296, 9], [141, 41, 10], [363, 253, 9], [310, 253, 9], [53, 139, 9], [187, 327, 9]]], [[[241, 299, 10], [211, 206, 10], [80, 392, 10], [159, 187, 10], [57, 29, 10], [349, 385, 10], [248, 16, 10], [76, 358, 10], [370, 289, 10], [391, 39, 10], [347, 39, 10], [94, 119, 10], [208, 257, 10], [189, 159, 10], [307, 32, 10], [188, 68, 10], [153, 303, 10], [57, 137, 10], [23, 311, 10], [185, 328, 10], [373, 131, 9], [275, 128, 9], [310, 253, 9], [142, 33, 9], [333, 167, 10], [100, 175, 9], [319, 85, 9], [362, 251, 9], [298, 431, 9], [305, 172, 9]]], [[[61, 136, 9], [296, 430, 10], [213, 203, 10], [356, 386, 10], [97, 169, 10], [371, 127, 10], [314, 37, 10], [310, 248, 10], [323, 86, 10], [349, 33, 10], [370, 287, 10], [275, 130, 10], [251, 15, 10], [333, 169, 10], [245, 305, 10], [140, 28, 10], [305, 172, 10], [22, 317, 10], [86, 122, 10], [196, 160, 10], [152, 311, 10], [355, 253, 9], [160, 187, 9], [187, 70, 9], [211, 259, 10], [59, 29, 10], [75, 394, 9], [183, 326, 9], [394, 39, 9], [76, 365, 9]]], [[[98, 165, 10], [319, 37, 10], [355, 253, 10], [247, 305, 10], [370, 119, 10], [256, 16, 10], [293, 431, 10], [183, 71, 10], [62, 37, 10], [309, 241, 10], [63, 137, 10], [203, 163, 10], [326, 93, 10], [362, 387, 10], [153, 316, 10], [273, 135, 10], [335, 159, 10], [141, 27, 10], [350, 33, 10], [86, 122, 10], [69, 399, 10], [181, 323, 10], [400, 35, 9], [376, 290, 10], [305, 171, 9], [219, 199, 9], [214, 260, 9], [165, 182, 9], [22, 317, 9], [75, 365, 9]]], [[[86, 122, 10], [225, 194, 10], [253, 309, 9], [351, 254, 10], [320, 37, 10], [152, 316, 10], [76, 370, 10], [22, 320, 10], [293, 430, 10], [329, 100, 10], [365, 386, 10], [403, 33, 10], [309, 176, 10], [205, 164, 10], [308, 239, 10], [61, 37, 10], [135, 21, 10], [171, 183, 10], [364, 117, 10], [355, 28, 10], [273, 142, 10], [217, 261, 9], [61, 135, 9], [64, 405, 9], [380, 289, 10], [95, 164, 9], [178, 73, 9], [333, 157, 9], [257, 15, 9]]], [[[171, 73, 9], [362, 116, 10], [57, 410, 10], [271, 149, 10], [206, 166, 10], [308, 238, 10], [58, 133, 10], [409, 29, 10], [173, 182, 10], [333, 157, 10], [355, 26, 10], [308, 177, 10], [261, 14, 10], [23, 326, 10], [181, 331, 10], [95, 164, 10], [225, 256, 10], [368, 386, 10], [350, 254, 10], [293, 428, 9], [335, 103, 9], [152, 317, 9], [134, 15, 10], [254, 309, 9], [226, 193, 9], [61, 44, 9], [85, 118, 9], [325, 40, 9], [79, 375, 9], [381, 289, 9]]]]`
| 0debug
|
VS Code search.exclude doesn't work : <p>I can't make <code>search.exclude</code> settings to work, so that it excludes <code>build</code> folder.</p>
<p>Here's screenshot:
<a href="https://i.stack.imgur.com/Q8Ydq.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Q8Ydq.png" alt="enter image description here"></a></p>
| 0debug
|
How to convert working bsh script to ksh script : I am unfamiliar with ksh scripting and I need this converted to a working ksh script asap.
`egrep "^[^#;]" /etc/security/user |
while read x;
do
if [[ $x == '^\S+:' ]]; then
section=$x;
fi;
if [[ $section == 'nobody:' ]]; then
echo $x;
fi;
done`
The contents of /etc/security/user are as follows:
`sys:
admin = true
expires = 0101000070
login = false
rlogin = false
adm:
admin = true
login = false
rlogin = false
nobody:
admin = true
expires = 0101000070
login = false
rlogin = false
invscout:
admin = true`
My goal is to be able to specify which user I would like to grab the parameters from and have it echo just that user's parameters. For example if I specify "nobody" in the command the shell should output:
admin = true
expires = 0101000070
login = false
rlogin = false
I understand ksh does not support pattern matching regular expression the same as bash does but am having trouble successfully converting the command. Any and all help would be greatly appreciated. The command without and spaces is as follows:
`grep "^[^#;]" /etc/security/user | while read x; do if [[ $x =~ '^\S+:' ]]; then section=$x; fi; if [[ $section == 'nobody' ]]; then echo $x; fi; done`
| 0debug
|
Convert from one date format to another in javascript : <p>I want to convert this date 16:07:19 to format as July 19, 2016 in javascript. Should i implement the complete functionality or do we have any readily available thing to use in javascript to do the same? Kindly help. Thanks in advance!</p>
| 0debug
|
def smallest_Divisor(n):
if (n % 2 == 0):
return 2;
i = 3;
while (i*i <= n):
if (n % i == 0):
return i;
i += 2;
return n;
| 0debug
|
static int copy_moof(AVFormatContext *s, const char* infile, const char *outfile, int64_t size)
{
AVIOContext *in, *out;
int ret = 0;
if ((ret = avio_open2(&in, infile, AVIO_FLAG_READ, &s->interrupt_callback, NULL)) < 0)
return ret;
if ((ret = avio_open2(&out, outfile, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) {
avio_close(in);
return ret;
}
while (size > 0) {
uint8_t buf[8192];
int n = FFMIN(size, sizeof(buf));
n = avio_read(in, buf, n);
if (n <= 0) {
ret = AVERROR(EIO);
break;
}
avio_write(out, buf, n);
size -= n;
}
avio_flush(out);
avio_close(out);
avio_close(in);
return ret;
}
| 1threat
|
Why I can't found the loader element from parent element? : here is the full code: https://codepen.io/dotku/pen/gyVZqj?editors=1011
```html
<div id="carousel">
<span class="loader">Loading...</span>
</div>
```
```js
if (!containerElement) {
console.log('Carousel element is required.')
return;
} else {
console.log(
'Carousel element is found',
document.querySelector(`#${containerID}`)
);
}
```
I have a checking statement, but the document.querySelector won't return the loader, why?
| 0debug
|
How i break out while loop in this case? : i don't know how to break out while loop when turtle arrived on t.ycor == 0
import turtle
import msvcrt
turtle.setup(700, 300, 0, 0)
t=turtle.Turtle()
t.up()
t.goto(-300,0)
t.down()
t.write("Start\n(" + str(t.xcor()) + ", " + str(t.ycor()) + ")", False,
"center", ("",15))
while True:
if msvcrt.kbhit():
c = msvcrt.getch().decode(encoding = 'UTF-8')
if c == 'j':
t.left(3)
elif c == 'k':
t.right(3)
elif c == 'g':
t.forward(5)
t.right(3)
while t.ycor() > 0:
t.forward(10)
t.right(3)
i want to break out out side while loop when turtle arrived t.ycor == 0 after arc.
but i don't know how....
| 0debug
|
TypeScript check for empty string : <p>Is there a way for TypeScript to statically check for an empty string? Is there a way to statically require a non-empty string to be passed to a function?</p>
<pre><code>let fn = function(a:string){
};
fn('');
</code></pre>
<p>or</p>
<pre><code>let a = '';
fn(a);
</code></pre>
<p>Can TS help us here?</p>
| 0debug
|
std::conditional vs std::enable_if : <p>I have a hashing function that can take any object type and hash it, it uses <code>std::hash</code> internally. Because <code>std::hash</code> does not support enum types I've created overloads of the function, 1 for enumerations using <code>std::underlying_type</code> and 1 for other types:</p>
<pre><code>template <typename T, typename std::enable_if<std::is_enum<T>::value>::type* = nullptr>
static std::size_t Hash(T const & t)
{
return std::hash<typename std::underlying_type<T>::type>()(t);
}
template <typename T, typename std::enable_if<!std::is_enum<T>::value>::type* = nullptr>
static std::size_t Hash(T const & t)
{
return std::hash<T>()(t);
}
</code></pre>
<p>This is working fine.
I then tried to put it all into a single function with <code>std::conditional</code>:</p>
<pre><code>template <typename T>
static std::size_t Hash(T const & t)
{
typedef typename std::conditional<std::is_enum<T>::value, std::hash<typename std::underlying_type<T>::type>, std::hash<T>>::type Hasher;
return Hasher()(t);
}
</code></pre>
<p>Main:</p>
<pre><code>enum test
{
TEST = 2
};
int main() {
Hash<test>(TEST);
Hash<int>(5);
std::cin.get();
return 0;
}
</code></pre>
<p>This however, gave me an <a href="http://ideone.com/CKckZD" rel="noreferrer">error</a> :</p>
<blockquote>
<p>/usr/include/c++/5/type_traits:2190:38: error: 'int' is not an enumeration type
typedef __underlying_type(_Tp) type;</p>
</blockquote>
<p>I do understand the error but I don't understand why, I thought <code>std::conditional</code> would prevent these compile-time errors because <code><int></code> uses <code>std::hash<T></code> instead of <code>std::hash<typename std::underlying_type<T>::type></code> at compile-time.</p>
<p>What am I doing wrong here, is there a way I can merge the 2 functions?</p>
| 0debug
|
Beginner question - passing strings to a React function : I have a background in C# and am just starting to learn React. My question is I'm sure very basic, but for some reason I'm struggling to figure out what I'm doing wrong. I expect someone on here will be able to answer this in a flash. I have created a simple function to accept the parameters name and email, and display them on screen. This is my first piece of React code. Once I conquer this, I'll learn how to loop through the same function to build a list, and then work on getting data from an external source into that list. Here is my code:
```
import React from "react";
import ReactDOM from "react-dom";
import "./styles.css";
const datarow = props => <div><b>Name:{props.myname}</b><br></br><b>Email:{props.email}</b></div>;
function App() {
return <datarow myname='James' email='james@place.org' />;
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
```
When I execute this within CodeSandbox however, the resulting page is blank. No compile errors are occurring however. What am I doing wrong? My expectation is I should be able to pass name and email into this function and get a result on-screen.
| 0debug
|
New to VBS. Expecting end of statement on 60'th character. : When I put the END at the 60'th character. It says it needs an 'expected statement'
Here's the code. Set colComputers2 = objWMIService.Get("Win32_ScheduledJob") end T = "C:\AntiVirusNet.vbs"D = "********" & Hou & "" & Min & "00.000000+000"
Help???
| 0debug
|
Remove nTh record from array using loop : <p>I'm writing a program that reads a .csv file, and then loops through it removing every 10th record it encounters before outputting it.</p>
<p>I've been stuck on what I believe is a syntax issue for a while now and just can't seem to nail it. Anyone mind having a look? </p>
<pre><code>lines = []
i = 0
elements = []
element2 = []
output = []
file = File.open("./properties.csv", "r")
while (line = file.gets)
i += 1
# use split to break array up using commas
arr = line.split(',')
elements.push({ id: arr[0], streetAddress: arr[1], town: arr[2], valuationDate: arr[3], value: arr[4] })
end
file.close
# filter out blanks and nill rows
x = elements.select { |elements| elements[:id].to_i >= 0.1}
# Loop to remove every 10th record
e = 0
d = 1
loop do x.length
if e == (10 * d)
d ++
e ++
else
x = elements.select[e]
e ++
end
puts x
puts "#{x.length} house in list, #{d} records skipped."
CSV FILE
ID,Street address,Town,Valuation date,Value
1,1 Northburn RD,WANAKA,1/1/2015,280000
2,1 Mount Ida PL,WANAKA,1/1/2015,280000
3,1 Mount Linton AVE,WANAKA,1/1/2015,780000
4,1 Kamahi ST,WANAKA,1/1/2015,155000
5,1 Kapuka LANE,WANAKA,1/1/2015,149000
6,1 Mohua MEWS,WANAKA,1/1/2015,560000
7,1 Kakapo CT,WANAKA,1/1/2015,430000
8,1 Mt Gold PL,WANAKA,1/1/2015,1260000
9,1 Penrith Park DR,WANAKA,1/1/2015,1250000
10,1 ATHERTON PL,WANAKA,1/1/2015,650000
11,1 WAIMANA PL,WANAKA,1/1/2015,780000
12,1 ROTO PL,WANAKA,1/1/2015,1470000
13,1 Toms WAY,WANAKA,1/1/2015,2230000
14,1 MULBERRY LANE,WANAKA,1/1/2015,415000
15,1 Range View PL,WANAKA,1/1/2015,300000
16,1 Clearview ST,WANAKA,1/1/2015,1230000
17,1 Clutha PL,WANAKA,1/1/2015,700000
18,1 Centre CRES,WANAKA,1/1/2015,295000
19,1 Valley CRES,WANAKA,1/1/2015,790000
20,1 Edgewood PL,WANAKA,1/1/2015,365000
21,1 HUNTER CRES,WANAKA,1/1/2015,335000
22,1 KOWHAI DR,WANAKA,1/1/2015,480000
23,1 RIMU LANE,WANAKA,1/1/2015,465000
24,1 CHERRY CT,WANAKA,1/1/2015,495000
25,1 COLLINS ST,WANAKA,1/1/2015,520000
26,1 AUBREY RD,WANAKA,1/1/2015,985000
27,1 EELY POINT RD,WANAKA,1/1/2015,560000
28,1 LINDSAY PL,WANAKA,1/1/2015,385000
29,1 WINDERS ST,WANAKA,1/1/2015,760000
30,1 Manuka CRES,WANAKA,1/1/2015,510000
31,1 WILEY RD,WANAKA,1/1/2015,420000
32,1 Baker GR,WANAKA,1/1/2015,820000
33,1 Briar Bank DR,WANAKA,1/1/2015,1260000
34,1 LAKESIDE RD,WANAKA,1/1/2015,440000
35,1 PLANTATION RD,WANAKA,1/1/2015,345000
36,1 Allenby PL,WANAKA,1/1/2015,640000
37,1 ROB ROY LANE,WANAKA,1/1/2015,380000
38,1 Ansted PL,WANAKA,1/1/2015,590000
39,1 Fastness CRES,WANAKA,1/1/2015,640000
40,1 APOLLO PL,WANAKA,1/1/2015,385000
41,1 AEOLUS PL,WANAKA,1/1/2015,370000
42,1 Peak View RDGE,WANAKA,1/1/2015,1750000
43,1 Moncrieff PL,WANAKA,1/1/2015,530000
44,1 Islington PL,WANAKA,1/1/2015,190000
45,1 Hidden Hills DR,WANAKA,1/1/2015,1280000
46,1 Weatherall CL,WANAKA,1/1/2015,425000
47,1 Terranova PL,WANAKA,1/1/2015,900000
48,1 Cliff Wilson ST,WANAKA,1/1/2015,1200000
49,1 TOTARA TCE,WANAKA,1/1/2015,460000
50,1 Koru WAY,WANAKA,1/1/2015,570000
51,1 Bovett PL,Wanaka,1/1/2015,495000
52,1 Pearce PL,Wanaka,1/1/2015,675000
53,1 Ironside DR,WANAKA,1/1/2015,570000
54,1 Bob Lee PL,WANAKA,1/1/2015,610000
55,1 Hogan LANE,WANAKA,1/1/2015,395000
56,1 ARDMORE ST,WANAKA,1/1/2015,1190000
57,1 Bullock Creek LANE,WANAKA,1/1/2015,11125000
58,1 DUNMORE ST,WANAKA,1/1/2015,1300000
59,1 Primary LANE,WANAKA,1/1/2015,430000
60,1 SYCAMORE PL,WANAKA,1/1/2015,720000
61,1 FAULKS TCE,WANAKA,1/1/2015,780000
62,1 Alpha CL,WANAKA,1/1/2015,500000
63,1 Coromandel ST,WANAKA,1/1/2015,530000
64,1 Niger ST,WANAKA,1/1/2015,475000
65,1 Maggies Way,WANAKA,1/1/2015,375000
66,1 Hollyhock LANE,QUEENSTOWN,1/1/2015,1080000
67,1 ELDERBERRY CRES,WANAKA,1/1/2015,1340000
68,1 Foxglove HTS,WANAKA,1/1/2015,2520000
69,1 MEADOWSTONE DR,WANAKA,1/1/2015,650000
70,1 OAKWOOD PL,WANAKA,1/1/2015,580000
71,1 MEADOWBROOK PL,WANAKA,1/1/2015,645000
72,1 Jessies CRES,WANAKA,1/1/2015,320000
73,1 Lansdown ST,WANAKA,1/1/2015,700000
74,1 Stonebrook DR,WANAKA,1/1/2015,640000
75,1 Hyland ST,WANAKA,1/1/2015,500000
76,1 TAPLEY PADDOCK,WANAKA,1/1/2015,720000
77,1 Homestead CL,WANAKA,1/1/2015,1750000
78,1 NORMAN TCE,WANAKA,1/1/2015,620000
79,1 Sunrise Bay DR,WANAKA,1/1/2015,3000000
80,1 LARCH PL,WANAKA,1/1/2015,570000
81,1 MILL END,WANAKA,1/1/2015,600000
82,1 Bills WAY,WANAKA,1/1/2015,750000
83,1 Heuchan LANE,WANAKA,1/1/2015,610000
84,1 SARGOOD DR,WANAKA,1/1/2015,455000
85,1 Frederick ST,WANAKA,1/1/2015,455000
86,1 Connell TCE,WANAKA,1/1/2015,600000
87,1 Soho ST,QUEENSTOWN,1/1/2015,320000
88,1 Hikuwai DR,ALBERT TOWN,1/1/2015,280000
89,1 Harrier LANE,WANAKA,1/1/2015,1000000
90,1 Ewing PL,WANAKA,1/1/2015,780000
91,1 Sherwin AVE,ALBERT TOWN,1/1/2015,440000
92,1 Hardie PL,WANAKA,1/1/2015,830000
93,1 Finch ST,ALBERT TOWN,1/1/2015,540000
94,1 Poppy LANE,ALBERT TOWN,1/1/2015,395000
95,1 Warbler LANE,ALBERT TOWN,1/1/2015,410000
96,1 Balneaves LANE,WANAKA,1/1/2015,250000
97,1 Mill Green,Arrowtown,1/1/2015,800000
</code></pre>
| 0debug
|
python 2.7 : find nested keys in dictionary : I have several dictionaries , dictionary keys are tupples.
Keys are always same length in each dictionary.
I'd like to find nested keys and print them .
dictionaries example :
dic_1 =
{
(u'A_String', u'B_String', u'C_String', u'D_String', u'E_String'): 111,
(u'A_String', u'B_String', u'C_String', u'D_String' ,u'F_String'): 112
}
dic_2 =
{
(u'A_String', u'B_String', u'C_String', u'D_String'): 300,
(u'A_String', u'B_String', u'C_String', u'F_String'): 301,
}
dic_3 =
{
(u'A_String', u'B_String', u'C_String'): 200,
(u'A_String', u'B_String', u'F_String'): 201,
}
First row in dic_3 is nested in first row in dic_2 and dic_1
First row in dic_2 is nested in first row of dic_1
I tried :
for key in dic_1:
print '-',key
for k in dic_2:
if k in tuple(key):
print '--', k
for i in dic_3:
if i in tuple(k):
print '---', i
Thank you in advance !
| 0debug
|
static av_cold int png_enc_init(AVCodecContext *avctx)
{
PNGEncContext *s = avctx->priv_data;
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
avctx->coded_frame->key_frame = 1;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
ff_huffyuvencdsp_init(&s->hdsp);
s->filter_type = av_clip(avctx->prediction_method,
PNG_FILTER_VALUE_NONE,
PNG_FILTER_VALUE_MIXED);
if (avctx->pix_fmt == AV_PIX_FMT_MONOBLACK)
s->filter_type = PNG_FILTER_VALUE_NONE;
return 0;
}
| 1threat
|
how to solve Array to string conversion error..? : for($i=0;$i<=count($_FILES['myfile']['name']);$i++)
{
ERROR LINE---> move_uploaded_file($_FILES['myfile']['tmp_name'] [$i],"img/".$_FILES['myfile']['name'][$i]);
-----> $path="img/".$_FILES['myfile']['name'];
}
| 0debug
|
static int qcow_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors)
{
BDRVQcowState *s = bs->opaque;
int ret, index_in_cluster, n, n1;
uint64_t cluster_offset;
while (nb_sectors > 0) {
n = nb_sectors;
cluster_offset = qcow2_get_cluster_offset(bs, sector_num << 9, &n);
index_in_cluster = sector_num & (s->cluster_sectors - 1);
if (!cluster_offset) {
if (bs->backing_hd) {
n1 = qcow2_backing_read1(bs->backing_hd, sector_num, buf, n);
if (n1 > 0) {
BLKDBG_EVENT(bs->file, BLKDBG_READ_BACKING);
ret = bdrv_read(bs->backing_hd, sector_num, buf, n1);
if (ret < 0)
return -1;
}
} else {
memset(buf, 0, 512 * n);
}
} else if (cluster_offset & QCOW_OFLAG_COMPRESSED) {
if (qcow2_decompress_cluster(bs, cluster_offset) < 0)
return -1;
memcpy(buf, s->cluster_cache + index_in_cluster * 512, 512 * n);
} else {
BLKDBG_EVENT(bs->file, BLKDBG_READ);
ret = bdrv_pread(bs->file, cluster_offset + index_in_cluster * 512, buf, n * 512);
if (ret != n * 512)
return -1;
if (s->crypt_method) {
qcow2_encrypt_sectors(s, sector_num, buf, buf, n, 0,
&s->aes_decrypt_key);
}
}
nb_sectors -= n;
sector_num += n;
buf += n * 512;
}
return 0;
}
| 1threat
|
int virtio_scsi_read_many(VDev *vdev,
ulong sector, void *load_addr, int sec_num)
{
int sector_count;
int f = vdev->blk_factor;
unsigned int data_size;
do {
sector_count = MIN_NON_ZERO(sec_num, vdev->config.scsi.max_sectors);
data_size = sector_count * virtio_get_block_size() * f;
if (!scsi_read_10(vdev, sector * f, sector_count * f, load_addr,
data_size)) {
virtio_scsi_verify_response(&resp, "virtio-scsi:read_many");
}
load_addr += data_size;
sector += sector_count;
sec_num -= sector_count;
} while (sec_num > 0);
return 0;
}
| 1threat
|
Hi, im a JAVA student and i get the following message when compiling, trying to build a GUI for Java : <p>jGRASP wedge program "C:\Program Files (x86)\jGRASP\jbin\sys_run" does not exist. You may need to build a wedge on this system.</p>
| 0debug
|
JAVA NullPointerException error (School project) : <pre><code>import android.app.ProgressDialog;
import android.content.Context;
import android.os.AsyncTask;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import java.io.InputStream;
import java.lang.reflect.Array;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
/**
* Created by Tim on 17-8-2016.
*/
public class ReadRss extends AsyncTask<Void, Void, Void> {
Context context;
//The URL where the app needs to get the information from
String address = "http://www.sciencemag.org/rss/news_current.xml";
ProgressDialog progressDialog;
ArrayList<FeedItem>feedItems;
RecyclerView recyclerView;
URL url;
//The loading (Loading feed...) message
public ReadRss(Context context, RecyclerView recyclerView){
this.recyclerView = recyclerView;
this.context = context;
progressDialog = new ProgressDialog(context);
progressDialog.setMessage("Loading feed...");
}
@Override
//Shows the user that the page is loading (Loading feed...)
protected void onPreExecute() {
progressDialog.show();
super.onPreExecute();
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
progressDialog.dismiss();
MyAdapter adapter = new MyAdapter(context, feedItems);
recyclerView.setLayoutManager(new LinearLayoutManager(context));
recyclerView.addItemDecoration(new VerticalSpace(50));
recyclerView.setAdapter(adapter);
}
@Override
protected Void doInBackground(Void... voids) {
processXml(Getdata());
return null;
}
//!!!!!This part ensures all the data is collected from the feed and it is made ready
//so it can be used by recycler view
private void processXml(Document data) {
if (data!=null) {
//Add all feedItems to an ArrayList
feedItems = new ArrayList<>();
//Object that will store root elements
Element root = data.getDocumentElement();
//Node object that will show channel
Node channel = root.getChildNodes().item(1);
//Store all child of channel element
NodeList items = channel.getChildNodes();
//Loop trough each child element of items
for (int i=0; i<items.getLength(); i++){
Node currentchild = items.item(i);
//Check that node is item node by using an if statement
if (currentchild.getNodeName().equalsIgnoreCase("item")){
FeedItem item = new FeedItem();
//Store childs in NodeList of current item
NodeList itemchilds = currentchild.getChildNodes();
//For loop to loop through all childs of item tag
for (int j=0; j<itemchilds.getLength(); j++){
//Store current node
Node current = itemchilds.item(j);
//Check node is title, description, pubDate, link or thumbnail node by if else conditions
if (current.getNodeName().equalsIgnoreCase("title")){
//If node is title, description, pubDate, link or thumbnail then set textcontent of our current node
item.setTitle(current.getTextContent());
}else if (current.getNodeName().equalsIgnoreCase("description")){
item.setDescription(current.getTextContent());
}else if (current.getNodeName().equalsIgnoreCase("pubDate")){
item.setPubDate(current.getTextContent());
}else if (current.getNodeName().equalsIgnoreCase("link")){
item.setLink(current.getTextContent());
}else if (current.getNodeName().equalsIgnoreCase("media:thumbnail")){
//This will return a thumbnail url
String url = current.getAttributes().item(0).getTextContent();
item.setThumbnailUrl(url);
}
}
//feedItems to be added to the ArrayList<FeedItem>
feedItems.add(item);
}
}
}
}
public Document Getdata() {
try {
url = new URL(address);
//Open connection by using Http url connection object
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
//Sets request method as GET
connection.setRequestMethod("GET");
InputStream inputStream = connection.getInputStream();
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = builderFactory.newDocumentBuilder();
Document xmlDoc = builder.parse(inputStream);
return xmlDoc;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
}
</code></pre>
<p>When adding this code for a RSS Reader to our final project (for school) we are getting this error:</p>
<pre><code>08-21 16:53:27.583 2734-2734/com.example.codru.stendensocial E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.codru.stendensocial, PID: 2734
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView.setLayoutManager(android.support.v7.widget.RecyclerView$LayoutManager)' on a null object reference
at com.example.codru.stendensocial.ReadRss.onPostExecute(ReadRss.java:61)
at com.example.codru.stendensocial.ReadRss.onPostExecute(ReadRss.java:28)
at android.os.AsyncTask.finish(AsyncTask.java:651)
at android.os.AsyncTask.-wrap1(AsyncTask.java)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:668)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
</code></pre>
<p>We don't know how to fix this. We read something about adding final in front of setLayoutManager, but could not figure out how to do this.</p>
<p>Any help would be highly appreciated!</p>
<p>~ Tim</p>
| 0debug
|
How to refresh text in Matplotlib? : <p>I wrote this code to read data from an excel file and to plot them. For a certain x-value, I desire to know the y-values of all the lines so I create a slider to change this x-value but I'm not able to refresh the text which prints the y-value.</p>
<p>The code is this</p>
<pre><code>import numpy as np
from openpyxl import load_workbook as ld
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
from matplotlib.widgets import Slider
wb = ld(filename='example.xlsx')
data = wb['data']
time = wb['time']
row = data.max_row
column = data.max_column
x = np.ones((row, column))
y = np.ones((row, column))
result = np.ones(row)
for i in range(0, row):
for j in range(0, column):
x[i][j] = time.cell(row=i+1, column=j+1).value
y[i][j] = data.cell(row=i+1, column=j+1).value
fig, ax = plt.subplots()
plt.subplots_adjust(left=0.25, bottom=0.25)
plt.plot(x[0], y[0], label='line1')
plt.plot(x[1], y[1], label='line2')
plt.plot(x[2], y[2], label='line3')
line, = plt.plot((np.amin(x), np.amin(x)), (np.amin(y), np.amax(y)))
plt.legend()
plt.grid(True)
axtime = plt.axes([0.25, 0.1, 0.65, 0.03])
stime = Slider(axtime, 'time', np.amin(x), np.amax(x), valinit=np.amin(x))
def y_text(r):
ax.text(10, 8, str(r), style='italic')
def find(t):
global x, y, result
for i in range(0, row):
for j in range(0, column):
if x[i][j] == t or (t < x[i][j] and j == 0) or (t > x[i][j] and j == column):
result[i] = y[i][j]
elif x[i][j] < t < x[i][j+1]:
result[i] = ((t-x[i][j])/(x[i][j+1]-x[i][j]))*(y[i][j+1]-y[i][j])+y[i][j]
return result
def update(val):
line.set_xdata(stime.val)
find(stime.val)
y_text(stime.val)
fig.canvas.draw()
stime.on_changed(update)
plt.show()
</code></pre>
<p>and the result is this</p>
<p><a href="https://i.stack.imgur.com/ZVRRP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ZVRRP.png" alt="enter image description here"></a></p>
<p>As you can see the text is overwritten.</p>
| 0debug
|
How to print String ArrayList? : <p>I have a loop in which i put <code>splited</code> parts of a string using object. Need to put them in a <code>ArrayList</code> and print the list, hod do i do that?</p>
<p>I tried to use for loop too, to print it.</p>
<pre><code>for(int i = 0; i < parts.length; i += 4) {
p.name = parts[i];
p.lastName = parts[i + 1];
p.dateBirth = LocalDate.parse(parts[i + 2], df1);
p.placeBirth = parts [i + 3];
}
ArrayList lista = new ArrayList();
lista.add(parts);
</code></pre>
<p>It should print things from <code>ArrayList</code> which i should add.</p>
| 0debug
|
void qemu_clock_warp(QEMUClockType type)
{
int64_t deadline;
if (type != QEMU_CLOCK_VIRTUAL || !use_icount) {
return;
}
icount_warp_rt(NULL);
if (!all_cpu_threads_idle() || !qemu_clock_has_timers(QEMU_CLOCK_VIRTUAL)) {
timer_del(icount_warp_timer);
return;
}
if (qtest_enabled()) {
return;
}
vm_clock_warp_start = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
if ((deadline < 0) || (deadline > INT32_MAX)) {
deadline = INT32_MAX;
}
if (deadline > 0) {
timer_mod(icount_warp_timer, vm_clock_warp_start + deadline);
} else if (deadline == 0) {
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
}
}
| 1threat
|
long disas_insn(DisasContext *s, uint8_t *pc_start)
{
int b, prefixes, aflag, dflag;
int shift, ot;
int modrm, reg, rm, mod, reg_addr, op, opreg, offset_addr, val;
unsigned int next_eip;
s->pc = pc_start;
prefixes = 0;
aflag = s->code32;
dflag = s->code32;
s->override = -1;
next_byte:
b = ldub(s->pc);
s->pc++;
switch (b) {
case 0xf3:
prefixes |= PREFIX_REPZ;
goto next_byte;
case 0xf2:
prefixes |= PREFIX_REPNZ;
goto next_byte;
case 0xf0:
prefixes |= PREFIX_LOCK;
goto next_byte;
case 0x2e:
s->override = R_CS;
goto next_byte;
case 0x36:
s->override = R_SS;
goto next_byte;
case 0x3e:
s->override = R_DS;
goto next_byte;
case 0x26:
s->override = R_ES;
goto next_byte;
case 0x64:
s->override = R_FS;
goto next_byte;
case 0x65:
s->override = R_GS;
goto next_byte;
case 0x66:
prefixes |= PREFIX_DATA;
goto next_byte;
case 0x67:
prefixes |= PREFIX_ADR;
goto next_byte;
case 0x9b:
prefixes |= PREFIX_FWAIT;
goto next_byte;
}
if (prefixes & PREFIX_DATA)
dflag ^= 1;
if (prefixes & PREFIX_ADR)
aflag ^= 1;
s->prefix = prefixes;
s->aflag = aflag;
s->dflag = dflag;
if (prefixes & PREFIX_LOCK)
gen_op_lock();
reswitch:
switch(b) {
case 0x0f:
b = ldub(s->pc++) | 0x100;
goto reswitch;
case 0x00 ... 0x05:
case 0x08 ... 0x0d:
case 0x10 ... 0x15:
case 0x18 ... 0x1d:
case 0x20 ... 0x25:
case 0x28 ... 0x2d:
case 0x30 ... 0x35:
case 0x38 ... 0x3d:
{
int op, f, val;
op = (b >> 3) & 7;
f = (b >> 1) & 3;
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
switch(f) {
case 0:
modrm = ldub(s->pc++);
reg = ((modrm >> 3) & 7) + OR_EAX;
mod = (modrm >> 6) & 3;
rm = modrm & 7;
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T0_A0[ot]();
opreg = OR_TMP0;
} else {
opreg = OR_EAX + rm;
}
gen_op(s, op, ot, opreg, reg);
if (mod != 3 && op != 7) {
gen_op_st_T0_A0[ot]();
}
break;
case 1:
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
reg = ((modrm >> 3) & 7) + OR_EAX;
rm = modrm & 7;
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T1_A0[ot]();
opreg = OR_TMP1;
} else {
opreg = OR_EAX + rm;
}
gen_op(s, op, ot, reg, opreg);
break;
case 2:
val = insn_get(s, ot);
gen_opi(s, op, ot, OR_EAX, val);
break;
}
}
break;
case 0x80:
case 0x81:
case 0x83:
{
int val;
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
rm = modrm & 7;
op = (modrm >> 3) & 7;
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T0_A0[ot]();
opreg = OR_TMP0;
} else {
opreg = rm + OR_EAX;
}
switch(b) {
default:
case 0x80:
case 0x81:
val = insn_get(s, ot);
break;
case 0x83:
val = (int8_t)insn_get(s, OT_BYTE);
break;
}
gen_opi(s, op, ot, opreg, val);
if (op != 7 && mod != 3) {
gen_op_st_T0_A0[ot]();
}
}
break;
case 0x40 ... 0x47:
ot = dflag ? OT_LONG : OT_WORD;
gen_inc(s, ot, OR_EAX + (b & 7), 1);
break;
case 0x48 ... 0x4f:
ot = dflag ? OT_LONG : OT_WORD;
gen_inc(s, ot, OR_EAX + (b & 7), -1);
break;
case 0xf6:
case 0xf7:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
rm = modrm & 7;
op = (modrm >> 3) & 7;
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T0_A0[ot]();
} else {
gen_op_mov_TN_reg[ot][0][rm]();
}
switch(op) {
case 0:
val = insn_get(s, ot);
gen_op_movl_T1_im(val);
gen_op_testl_T0_T1_cc();
s->cc_op = CC_OP_LOGICB + ot;
break;
case 2:
gen_op_notl_T0();
if (mod != 3) {
gen_op_st_T0_A0[ot]();
} else {
gen_op_mov_reg_T0[ot][rm]();
}
break;
case 3:
gen_op_negl_T0_cc();
if (mod != 3) {
gen_op_st_T0_A0[ot]();
} else {
gen_op_mov_reg_T0[ot][rm]();
}
s->cc_op = CC_OP_SUBB + ot;
break;
case 4:
switch(ot) {
case OT_BYTE:
gen_op_mulb_AL_T0();
break;
case OT_WORD:
gen_op_mulw_AX_T0();
break;
default:
case OT_LONG:
gen_op_mull_EAX_T0();
break;
}
s->cc_op = CC_OP_MUL;
break;
case 5:
switch(ot) {
case OT_BYTE:
gen_op_imulb_AL_T0();
break;
case OT_WORD:
gen_op_imulw_AX_T0();
break;
default:
case OT_LONG:
gen_op_imull_EAX_T0();
break;
}
s->cc_op = CC_OP_MUL;
break;
case 6:
switch(ot) {
case OT_BYTE:
gen_op_divb_AL_T0();
break;
case OT_WORD:
gen_op_divw_AX_T0();
break;
default:
case OT_LONG:
gen_op_divl_EAX_T0();
break;
}
break;
case 7:
switch(ot) {
case OT_BYTE:
gen_op_idivb_AL_T0();
break;
case OT_WORD:
gen_op_idivw_AX_T0();
break;
default:
case OT_LONG:
gen_op_idivl_EAX_T0();
break;
}
break;
default:
goto illegal_op;
}
break;
case 0xfe:
case 0xff:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
rm = modrm & 7;
op = (modrm >> 3) & 7;
if (op >= 2 && b == 0xfe) {
goto illegal_op;
}
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
if (op != 3 && op != 5)
gen_op_ld_T0_A0[ot]();
} else {
gen_op_mov_TN_reg[ot][0][rm]();
}
switch(op) {
case 0:
gen_inc(s, ot, OR_TMP0, 1);
if (mod != 3)
gen_op_st_T0_A0[ot]();
else
gen_op_mov_reg_T0[ot][rm]();
break;
case 1:
gen_inc(s, ot, OR_TMP0, -1);
if (mod != 3)
gen_op_st_T0_A0[ot]();
else
gen_op_mov_reg_T0[ot][rm]();
break;
case 2:
if (s->dflag == 0)
gen_op_andl_T0_ffff();
gen_op_jmp_T0();
next_eip = s->pc - s->cs_base;
gen_op_movl_T0_im(next_eip);
gen_push_T0(s);
s->is_jmp = 1;
break;
case 3:
gen_op_movl_T0_seg(R_CS);
gen_push_T0(s);
next_eip = s->pc - s->cs_base;
gen_op_movl_T0_im(next_eip);
gen_push_T0(s);
gen_op_ld_T1_A0[ot]();
gen_op_addl_A0_im(1 << (ot - OT_WORD + 1));
gen_op_lduw_T0_A0();
gen_movl_seg_T0(s, R_CS);
gen_op_movl_T0_T1();
gen_op_jmp_T0();
s->is_jmp = 1;
break;
case 4:
if (s->dflag == 0)
gen_op_andl_T0_ffff();
gen_op_jmp_T0();
s->is_jmp = 1;
break;
case 5:
gen_op_ld_T1_A0[ot]();
gen_op_addl_A0_im(1 << (ot - OT_WORD + 1));
gen_op_lduw_T0_A0();
gen_movl_seg_T0(s, R_CS);
gen_op_movl_T0_T1();
gen_op_jmp_T0();
s->is_jmp = 1;
break;
case 6:
gen_push_T0(s);
break;
default:
goto illegal_op;
}
break;
case 0x84:
case 0x85:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
rm = modrm & 7;
reg = (modrm >> 3) & 7;
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
gen_op_mov_TN_reg[ot][1][reg + OR_EAX]();
gen_op_testl_T0_T1_cc();
s->cc_op = CC_OP_LOGICB + ot;
break;
case 0xa8:
case 0xa9:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
val = insn_get(s, ot);
gen_op_mov_TN_reg[ot][0][OR_EAX]();
gen_op_movl_T1_im(val);
gen_op_testl_T0_T1_cc();
s->cc_op = CC_OP_LOGICB + ot;
break;
case 0x98:
if (dflag)
gen_op_movswl_EAX_AX();
else
gen_op_movsbw_AX_AL();
break;
case 0x99:
if (dflag)
gen_op_movslq_EDX_EAX();
else
gen_op_movswl_DX_AX();
break;
case 0x1af:
case 0x69:
case 0x6b:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = ((modrm >> 3) & 7) + OR_EAX;
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
if (b == 0x69) {
val = insn_get(s, ot);
gen_op_movl_T1_im(val);
} else if (b == 0x6b) {
val = insn_get(s, OT_BYTE);
gen_op_movl_T1_im(val);
} else {
gen_op_mov_TN_reg[ot][1][reg]();
}
if (ot == OT_LONG) {
gen_op_imull_T0_T1();
} else {
gen_op_imulw_T0_T1();
}
gen_op_mov_reg_T0[ot][reg]();
s->cc_op = CC_OP_MUL;
break;
case 0x1c0:
case 0x1c1:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
if (mod == 3) {
rm = modrm & 7;
gen_op_mov_TN_reg[ot][0][reg]();
gen_op_mov_TN_reg[ot][1][rm]();
gen_op_addl_T0_T1_cc();
gen_op_mov_reg_T0[ot][rm]();
gen_op_mov_reg_T1[ot][reg]();
} else {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_mov_TN_reg[ot][0][reg]();
gen_op_ld_T1_A0[ot]();
gen_op_addl_T0_T1_cc();
gen_op_st_T0_A0[ot]();
gen_op_mov_reg_T1[ot][reg]();
}
s->cc_op = CC_OP_ADDB + ot;
break;
case 0x1b0:
case 0x1b1:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
gen_op_mov_TN_reg[ot][1][reg]();
if (mod == 3) {
rm = modrm & 7;
gen_op_mov_TN_reg[ot][0][rm]();
gen_op_cmpxchg_T0_T1_EAX_cc[ot]();
gen_op_mov_reg_T0[ot][rm]();
} else {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T0_A0[ot]();
gen_op_cmpxchg_T0_T1_EAX_cc[ot]();
gen_op_st_T0_A0[ot]();
}
s->cc_op = CC_OP_SUBB + ot;
break;
case 0x1c7:
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
if (mod == 3)
goto illegal_op;
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_cmpxchg8b();
s->cc_op = CC_OP_EFLAGS;
break;
case 0x50 ... 0x57:
gen_op_mov_TN_reg[OT_LONG][0][b & 7]();
gen_push_T0(s);
break;
case 0x58 ... 0x5f:
ot = dflag ? OT_LONG : OT_WORD;
gen_pop_T0(s);
gen_op_mov_reg_T0[ot][b & 7]();
gen_pop_update(s);
break;
case 0x60:
gen_pusha(s);
break;
case 0x61:
gen_popa(s);
break;
case 0x68:
case 0x6a:
ot = dflag ? OT_LONG : OT_WORD;
if (b == 0x68)
val = insn_get(s, ot);
else
val = (int8_t)insn_get(s, OT_BYTE);
gen_op_movl_T0_im(val);
gen_push_T0(s);
break;
case 0x8f:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
gen_pop_T0(s);
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 1);
gen_pop_update(s);
break;
case 0xc8:
{
int level;
val = lduw(s->pc);
s->pc += 2;
level = ldub(s->pc++);
gen_enter(s, val, level);
}
break;
case 0xc9:
if (s->ss32) {
gen_op_mov_TN_reg[OT_LONG][0][R_EBP]();
gen_op_mov_reg_T0[OT_LONG][R_ESP]();
} else {
gen_op_mov_TN_reg[OT_WORD][0][R_EBP]();
gen_op_mov_reg_T0[OT_WORD][R_ESP]();
}
gen_pop_T0(s);
ot = dflag ? OT_LONG : OT_WORD;
gen_op_mov_reg_T0[ot][R_EBP]();
gen_pop_update(s);
break;
case 0x06:
case 0x0e:
case 0x16:
case 0x1e:
gen_op_movl_T0_seg(b >> 3);
gen_push_T0(s);
break;
case 0x1a0:
case 0x1a8:
gen_op_movl_T0_seg((b >> 3) & 7);
gen_push_T0(s);
break;
case 0x07:
case 0x17:
case 0x1f:
gen_pop_T0(s);
gen_movl_seg_T0(s, b >> 3);
gen_pop_update(s);
break;
case 0x1a1:
case 0x1a9:
gen_pop_T0(s);
gen_movl_seg_T0(s, (b >> 3) & 7);
gen_pop_update(s);
break;
case 0x88:
case 0x89:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
gen_ldst_modrm(s, modrm, ot, OR_EAX + reg, 1);
break;
case 0xc6:
case 0xc7:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
if (mod != 3)
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
val = insn_get(s, ot);
gen_op_movl_T0_im(val);
if (mod != 3)
gen_op_st_T0_A0[ot]();
else
gen_op_mov_reg_T0[ot][modrm & 7]();
break;
case 0x8a:
case 0x8b:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
gen_op_mov_reg_T0[ot][reg]();
break;
case 0x8e:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
if (reg >= 6 || reg == R_CS)
goto illegal_op;
gen_movl_seg_T0(s, reg);
break;
case 0x8c:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
if (reg >= 6)
goto illegal_op;
gen_op_movl_T0_seg(reg);
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 1);
break;
case 0x1b6:
case 0x1b7:
case 0x1be:
case 0x1bf:
{
int d_ot;
d_ot = dflag + OT_WORD;
ot = (b & 1) + OT_BYTE;
modrm = ldub(s->pc++);
reg = ((modrm >> 3) & 7) + OR_EAX;
mod = (modrm >> 6) & 3;
rm = modrm & 7;
if (mod == 3) {
gen_op_mov_TN_reg[ot][0][rm]();
switch(ot | (b & 8)) {
case OT_BYTE:
gen_op_movzbl_T0_T0();
break;
case OT_BYTE | 8:
gen_op_movsbl_T0_T0();
break;
case OT_WORD:
gen_op_movzwl_T0_T0();
break;
default:
case OT_WORD | 8:
gen_op_movswl_T0_T0();
break;
}
gen_op_mov_reg_T0[d_ot][reg]();
} else {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
if (b & 8) {
gen_op_lds_T0_A0[ot]();
} else {
gen_op_ldu_T0_A0[ot]();
}
gen_op_mov_reg_T0[d_ot][reg]();
}
}
break;
case 0x8d:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
s->override = -1;
val = s->addseg;
s->addseg = 0;
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
s->addseg = val;
gen_op_mov_reg_A0[ot - OT_WORD][reg]();
break;
case 0xa0:
case 0xa1:
case 0xa2:
case 0xa3:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (s->aflag)
offset_addr = insn_get(s, OT_LONG);
else
offset_addr = insn_get(s, OT_WORD);
gen_op_movl_A0_im(offset_addr);
{
int override, must_add_seg;
must_add_seg = s->addseg;
if (s->override >= 0) {
override = s->override;
must_add_seg = 1;
} else {
override = R_DS;
}
if (must_add_seg) {
gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base));
}
}
if ((b & 2) == 0) {
gen_op_ld_T0_A0[ot]();
gen_op_mov_reg_T0[ot][R_EAX]();
} else {
gen_op_mov_TN_reg[ot][0][R_EAX]();
gen_op_st_T0_A0[ot]();
}
break;
case 0xd7:
gen_op_movl_A0_reg[R_EBX]();
gen_op_addl_A0_AL();
if (s->aflag == 0)
gen_op_andl_A0_ffff();
{
int override, must_add_seg;
must_add_seg = s->addseg;
override = R_DS;
if (s->override >= 0) {
override = s->override;
must_add_seg = 1;
} else {
override = R_DS;
}
if (must_add_seg) {
gen_op_addl_A0_seg(offsetof(CPUX86State,seg_cache[override].base));
}
}
gen_op_ldub_T0_A0();
gen_op_mov_reg_T0[OT_BYTE][R_EAX]();
break;
case 0xb0 ... 0xb7:
val = insn_get(s, OT_BYTE);
gen_op_movl_T0_im(val);
gen_op_mov_reg_T0[OT_BYTE][b & 7]();
break;
case 0xb8 ... 0xbf:
ot = dflag ? OT_LONG : OT_WORD;
val = insn_get(s, ot);
reg = OR_EAX + (b & 7);
gen_op_movl_T0_im(val);
gen_op_mov_reg_T0[ot][reg]();
break;
case 0x91 ... 0x97:
ot = dflag ? OT_LONG : OT_WORD;
reg = b & 7;
rm = R_EAX;
goto do_xchg_reg;
case 0x86:
case 0x87:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
if (mod == 3) {
rm = modrm & 7;
do_xchg_reg:
gen_op_mov_TN_reg[ot][0][reg]();
gen_op_mov_TN_reg[ot][1][rm]();
gen_op_mov_reg_T0[ot][rm]();
gen_op_mov_reg_T1[ot][reg]();
} else {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_mov_TN_reg[ot][0][reg]();
if (!(prefixes & PREFIX_LOCK))
gen_op_lock();
gen_op_ld_T1_A0[ot]();
gen_op_st_T0_A0[ot]();
if (!(prefixes & PREFIX_LOCK))
gen_op_unlock();
gen_op_mov_reg_T1[ot][reg]();
}
break;
case 0xc4:
op = R_ES;
goto do_lxx;
case 0xc5:
op = R_DS;
goto do_lxx;
case 0x1b2:
op = R_SS;
goto do_lxx;
case 0x1b4:
op = R_FS;
goto do_lxx;
case 0x1b5:
op = R_GS;
do_lxx:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
if (mod == 3)
goto illegal_op;
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T1_A0[ot]();
gen_op_addl_A0_im(1 << (ot - OT_WORD + 1));
gen_op_lduw_T0_A0();
gen_movl_seg_T0(s, op);
gen_op_mov_reg_T1[ot][reg]();
break;
case 0xc0:
case 0xc1:
shift = 2;
grp2:
{
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
rm = modrm & 7;
op = (modrm >> 3) & 7;
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T0_A0[ot]();
opreg = OR_TMP0;
} else {
opreg = rm + OR_EAX;
}
if (shift == 0) {
gen_shift(s, op, ot, opreg, OR_ECX);
} else {
if (shift == 2) {
shift = ldub(s->pc++);
}
gen_shifti(s, op, ot, opreg, shift);
}
if (mod != 3) {
gen_op_st_T0_A0[ot]();
}
}
break;
case 0xd0:
case 0xd1:
shift = 1;
goto grp2;
case 0xd2:
case 0xd3:
shift = 0;
goto grp2;
case 0x1a4:
op = 0;
shift = 1;
goto do_shiftd;
case 0x1a5:
op = 0;
shift = 0;
goto do_shiftd;
case 0x1ac:
op = 1;
shift = 1;
goto do_shiftd;
case 0x1ad:
op = 1;
shift = 0;
do_shiftd:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
rm = modrm & 7;
reg = (modrm >> 3) & 7;
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T0_A0[ot]();
} else {
gen_op_mov_TN_reg[ot][0][rm]();
}
gen_op_mov_TN_reg[ot][1][reg]();
if (shift) {
val = ldub(s->pc++);
val &= 0x1f;
if (val) {
gen_op_shiftd_T0_T1_im_cc[ot - OT_WORD][op](val);
if (op == 0 && ot != OT_WORD)
s->cc_op = CC_OP_SHLB + ot;
else
s->cc_op = CC_OP_SARB + ot;
}
} else {
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_shiftd_T0_T1_ECX_cc[ot - OT_WORD][op]();
s->cc_op = CC_OP_DYNAMIC;
}
if (mod != 3) {
gen_op_st_T0_A0[ot]();
} else {
gen_op_mov_reg_T0[ot][rm]();
}
break;
case 0xd8 ... 0xdf:
modrm = ldub(s->pc++);
mod = (modrm >> 6) & 3;
rm = modrm & 7;
op = ((b & 7) << 3) | ((modrm >> 3) & 7);
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
switch(op) {
case 0x00 ... 0x07:
case 0x10 ... 0x17:
case 0x20 ... 0x27:
case 0x30 ... 0x37:
{
int op1;
op1 = op & 7;
switch(op >> 4) {
case 0:
gen_op_flds_FT0_A0();
break;
case 1:
gen_op_fildl_FT0_A0();
break;
case 2:
gen_op_fldl_FT0_A0();
break;
case 3:
default:
gen_op_fild_FT0_A0();
break;
}
gen_op_fp_arith_ST0_FT0[op1]();
if (op1 == 3) {
gen_op_fpop();
}
}
break;
case 0x08:
case 0x0a:
case 0x0b:
case 0x18:
case 0x1a:
case 0x1b:
case 0x28:
case 0x2a:
case 0x2b:
case 0x38:
case 0x3a:
case 0x3b:
switch(op & 7) {
case 0:
gen_op_fpush();
switch(op >> 4) {
case 0:
gen_op_flds_ST0_A0();
break;
case 1:
gen_op_fildl_ST0_A0();
break;
case 2:
gen_op_fldl_ST0_A0();
break;
case 3:
default:
gen_op_fild_ST0_A0();
break;
}
break;
default:
switch(op >> 4) {
case 0:
gen_op_fsts_ST0_A0();
break;
case 1:
gen_op_fistl_ST0_A0();
break;
case 2:
gen_op_fstl_ST0_A0();
break;
case 3:
default:
gen_op_fist_ST0_A0();
break;
}
if ((op & 7) == 3)
gen_op_fpop();
break;
}
break;
case 0x0d:
gen_op_fldcw_A0();
break;
case 0x0f:
gen_op_fnstcw_A0();
break;
case 0x1d:
gen_op_fpush();
gen_op_fldt_ST0_A0();
break;
case 0x1f:
gen_op_fstt_ST0_A0();
gen_op_fpop();
break;
case 0x2f:
gen_op_fnstsw_A0();
break;
case 0x3c:
gen_op_fpush();
gen_op_fbld_ST0_A0();
break;
case 0x3e:
gen_op_fbst_ST0_A0();
gen_op_fpop();
break;
case 0x3d:
gen_op_fpush();
gen_op_fildll_ST0_A0();
break;
case 0x3f:
gen_op_fistll_ST0_A0();
gen_op_fpop();
break;
default:
goto illegal_op;
}
} else {
opreg = rm;
switch(op) {
case 0x08:
gen_op_fpush();
gen_op_fmov_ST0_STN((opreg + 1) & 7);
break;
case 0x09:
gen_op_fxchg_ST0_STN(opreg);
break;
case 0x0a:
switch(rm) {
case 0:
break;
default:
goto illegal_op;
}
break;
case 0x0c:
switch(rm) {
case 0:
gen_op_fchs_ST0();
break;
case 1:
gen_op_fabs_ST0();
break;
case 4:
gen_op_fldz_FT0();
gen_op_fcom_ST0_FT0();
break;
case 5:
gen_op_fxam_ST0();
break;
default:
goto illegal_op;
}
break;
case 0x0d:
{
switch(rm) {
case 0:
gen_op_fpush();
gen_op_fld1_ST0();
break;
case 1:
gen_op_fpush();
gen_op_fldl2t_ST0();
break;
case 2:
gen_op_fpush();
gen_op_fldl2e_ST0();
break;
case 3:
gen_op_fpush();
gen_op_fldpi_ST0();
break;
case 4:
gen_op_fpush();
gen_op_fldlg2_ST0();
break;
case 5:
gen_op_fpush();
gen_op_fldln2_ST0();
break;
case 6:
gen_op_fpush();
gen_op_fldz_ST0();
break;
default:
goto illegal_op;
}
}
break;
case 0x0e:
switch(rm) {
case 0:
gen_op_f2xm1();
break;
case 1:
gen_op_fyl2x();
break;
case 2:
gen_op_fptan();
break;
case 3:
gen_op_fpatan();
break;
case 4:
gen_op_fxtract();
break;
case 5:
gen_op_fprem1();
break;
case 6:
gen_op_fdecstp();
break;
default:
case 7:
gen_op_fincstp();
break;
}
break;
case 0x0f:
switch(rm) {
case 0:
gen_op_fprem();
break;
case 1:
gen_op_fyl2xp1();
break;
case 2:
gen_op_fsqrt();
break;
case 3:
gen_op_fsincos();
break;
case 5:
gen_op_fscale();
break;
case 4:
gen_op_frndint();
break;
case 6:
gen_op_fsin();
break;
default:
case 7:
gen_op_fcos();
break;
}
break;
case 0x00: case 0x01: case 0x04 ... 0x07:
case 0x20: case 0x21: case 0x24 ... 0x27:
case 0x30: case 0x31: case 0x34 ... 0x37:
{
int op1;
op1 = op & 7;
if (op >= 0x20) {
gen_op_fp_arith_STN_ST0[op1](opreg);
if (op >= 0x30)
gen_op_fpop();
} else {
gen_op_fmov_FT0_STN(opreg);
gen_op_fp_arith_ST0_FT0[op1]();
}
}
break;
case 0x02:
gen_op_fmov_FT0_STN(opreg);
gen_op_fcom_ST0_FT0();
break;
case 0x03:
gen_op_fmov_FT0_STN(opreg);
gen_op_fcom_ST0_FT0();
gen_op_fpop();
break;
case 0x15:
switch(rm) {
case 1:
gen_op_fmov_FT0_STN(1);
gen_op_fucom_ST0_FT0();
gen_op_fpop();
gen_op_fpop();
break;
default:
goto illegal_op;
}
break;
case 0x1c:
switch(rm) {
case 2:
gen_op_fclex();
break;
case 3:
gen_op_fninit();
break;
default:
goto illegal_op;
}
break;
case 0x2a:
gen_op_fmov_STN_ST0(opreg);
break;
case 0x2b:
gen_op_fmov_STN_ST0(opreg);
gen_op_fpop();
break;
case 0x2c:
gen_op_fmov_FT0_STN(opreg);
gen_op_fucom_ST0_FT0();
break;
case 0x2d:
gen_op_fmov_FT0_STN(opreg);
gen_op_fucom_ST0_FT0();
gen_op_fpop();
break;
case 0x33:
switch(rm) {
case 1:
gen_op_fmov_FT0_STN(1);
gen_op_fcom_ST0_FT0();
gen_op_fpop();
gen_op_fpop();
break;
default:
goto illegal_op;
}
break;
case 0x3c:
switch(rm) {
case 0:
gen_op_fnstsw_EAX();
break;
default:
goto illegal_op;
}
break;
default:
goto illegal_op;
}
}
break;
case 0xa4:
case 0xa5:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (prefixes & PREFIX_REPZ) {
gen_string_ds(s, ot, gen_op_movs + 9);
} else {
gen_string_ds(s, ot, gen_op_movs);
}
break;
case 0xaa:
case 0xab:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (prefixes & PREFIX_REPZ) {
gen_string_es(s, ot, gen_op_stos + 9);
} else {
gen_string_es(s, ot, gen_op_stos);
}
break;
case 0xac:
case 0xad:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (prefixes & PREFIX_REPZ) {
gen_string_ds(s, ot, gen_op_lods + 9);
} else {
gen_string_ds(s, ot, gen_op_lods);
}
break;
case 0xae:
case 0xaf:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (prefixes & PREFIX_REPNZ) {
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_string_es(s, ot, gen_op_scas + 9 * 2);
s->cc_op = CC_OP_DYNAMIC;
} else if (prefixes & PREFIX_REPZ) {
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_string_es(s, ot, gen_op_scas + 9);
s->cc_op = CC_OP_DYNAMIC;
} else {
gen_string_es(s, ot, gen_op_scas);
s->cc_op = CC_OP_SUBB + ot;
}
break;
case 0xa6:
case 0xa7:
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (prefixes & PREFIX_REPNZ) {
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_string_ds(s, ot, gen_op_cmps + 9 * 2);
s->cc_op = CC_OP_DYNAMIC;
} else if (prefixes & PREFIX_REPZ) {
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_string_ds(s, ot, gen_op_cmps + 9);
s->cc_op = CC_OP_DYNAMIC;
} else {
gen_string_ds(s, ot, gen_op_cmps);
s->cc_op = CC_OP_SUBB + ot;
}
break;
case 0x6c:
case 0x6d:
if (s->cpl > s->iopl || s->vm86) {
gen_op_gpf(pc_start - s->cs_base);
} else {
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (prefixes & PREFIX_REPZ) {
gen_string_es(s, ot, gen_op_ins + 9);
} else {
gen_string_es(s, ot, gen_op_ins);
}
}
break;
case 0x6e:
case 0x6f:
if (s->cpl > s->iopl || s->vm86) {
gen_op_gpf(pc_start - s->cs_base);
} else {
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
if (prefixes & PREFIX_REPZ) {
gen_string_ds(s, ot, gen_op_outs + 9);
} else {
gen_string_ds(s, ot, gen_op_outs);
}
}
break;
case 0xe4:
case 0xe5:
if (s->cpl > s->iopl || s->vm86) {
gen_op_gpf(pc_start - s->cs_base);
} else {
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
val = ldub(s->pc++);
gen_op_movl_T0_im(val);
gen_op_in[ot]();
gen_op_mov_reg_T1[ot][R_EAX]();
}
break;
case 0xe6:
case 0xe7:
if (s->cpl > s->iopl || s->vm86) {
gen_op_gpf(pc_start - s->cs_base);
} else {
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
val = ldub(s->pc++);
gen_op_movl_T0_im(val);
gen_op_mov_TN_reg[ot][1][R_EAX]();
gen_op_out[ot]();
}
break;
case 0xec:
case 0xed:
if (s->cpl > s->iopl || s->vm86) {
gen_op_gpf(pc_start - s->cs_base);
} else {
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
gen_op_mov_TN_reg[OT_WORD][0][R_EDX]();
gen_op_in[ot]();
gen_op_mov_reg_T1[ot][R_EAX]();
}
break;
case 0xee:
case 0xef:
if (s->cpl > s->iopl || s->vm86) {
gen_op_gpf(pc_start - s->cs_base);
} else {
if ((b & 1) == 0)
ot = OT_BYTE;
else
ot = dflag ? OT_LONG : OT_WORD;
gen_op_mov_TN_reg[OT_WORD][0][R_EDX]();
gen_op_mov_TN_reg[ot][1][R_EAX]();
gen_op_out[ot]();
}
break;
case 0xc2:
val = ldsw(s->pc);
s->pc += 2;
gen_pop_T0(s);
if (s->ss32)
gen_op_addl_ESP_im(val + (2 << s->dflag));
else
gen_op_addw_ESP_im(val + (2 << s->dflag));
if (s->dflag == 0)
gen_op_andl_T0_ffff();
gen_op_jmp_T0();
s->is_jmp = 1;
break;
case 0xc3:
gen_pop_T0(s);
gen_pop_update(s);
if (s->dflag == 0)
gen_op_andl_T0_ffff();
gen_op_jmp_T0();
s->is_jmp = 1;
break;
case 0xca:
val = ldsw(s->pc);
s->pc += 2;
gen_pop_T0(s);
if (s->dflag == 0)
gen_op_andl_T0_ffff();
gen_op_jmp_T0();
gen_pop_update(s);
gen_pop_T0(s);
gen_movl_seg_T0(s, R_CS);
gen_pop_update(s);
if (s->ss32)
gen_op_addl_ESP_im(val + (2 << s->dflag));
else
gen_op_addw_ESP_im(val + (2 << s->dflag));
s->is_jmp = 1;
break;
case 0xcb:
gen_pop_T0(s);
if (s->dflag == 0)
gen_op_andl_T0_ffff();
gen_op_jmp_T0();
gen_pop_update(s);
gen_pop_T0(s);
gen_movl_seg_T0(s, R_CS);
gen_pop_update(s);
s->is_jmp = 1;
break;
case 0xcf:
gen_pop_T0(s);
if (s->dflag == 0)
gen_op_andl_T0_ffff();
gen_op_jmp_T0();
gen_pop_update(s);
gen_pop_T0(s);
gen_movl_seg_T0(s, R_CS);
gen_pop_update(s);
gen_pop_T0(s);
if (s->dflag) {
if (s->vm86)
gen_op_movl_eflags_T0_vm(pc_start - s->cs_base);
else
gen_op_movl_eflags_T0();
} else {
if (s->vm86)
gen_op_movw_eflags_T0_vm(pc_start - s->cs_base);
else
gen_op_movw_eflags_T0();
}
gen_pop_update(s);
s->cc_op = CC_OP_EFLAGS;
s->is_jmp = 1;
break;
case 0xe8:
{
unsigned int next_eip;
ot = dflag ? OT_LONG : OT_WORD;
val = insn_get(s, ot);
next_eip = s->pc - s->cs_base;
val += next_eip;
if (s->dflag == 0)
val &= 0xffff;
gen_op_movl_T0_im(next_eip);
gen_push_T0(s);
gen_op_jmp_im(val);
s->is_jmp = 1;
}
break;
case 0x9a:
{
unsigned int selector, offset;
ot = dflag ? OT_LONG : OT_WORD;
offset = insn_get(s, ot);
selector = insn_get(s, OT_WORD);
gen_op_movl_T0_seg(R_CS);
gen_push_T0(s);
next_eip = s->pc - s->cs_base;
gen_op_movl_T0_im(next_eip);
gen_push_T0(s);
gen_op_movl_T0_im(selector);
gen_movl_seg_T0(s, R_CS);
gen_op_jmp_im((unsigned long)offset);
s->is_jmp = 1;
}
break;
case 0xe9:
ot = dflag ? OT_LONG : OT_WORD;
val = insn_get(s, ot);
val += s->pc - s->cs_base;
if (s->dflag == 0)
val = val & 0xffff;
gen_op_jmp_im(val);
s->is_jmp = 1;
break;
case 0xea:
{
unsigned int selector, offset;
ot = dflag ? OT_LONG : OT_WORD;
offset = insn_get(s, ot);
selector = insn_get(s, OT_WORD);
gen_op_movl_T0_im(selector);
gen_movl_seg_T0(s, R_CS);
gen_op_jmp_im((unsigned long)offset);
s->is_jmp = 1;
}
break;
case 0xeb:
val = (int8_t)insn_get(s, OT_BYTE);
val += s->pc - s->cs_base;
if (s->dflag == 0)
val = val & 0xffff;
gen_op_jmp_im(val);
s->is_jmp = 1;
break;
case 0x70 ... 0x7f:
val = (int8_t)insn_get(s, OT_BYTE);
goto do_jcc;
case 0x180 ... 0x18f:
if (dflag) {
val = insn_get(s, OT_LONG);
} else {
val = (int16_t)insn_get(s, OT_WORD);
}
do_jcc:
next_eip = s->pc - s->cs_base;
val += next_eip;
if (s->dflag == 0)
val &= 0xffff;
gen_jcc(s, b, val, next_eip);
s->is_jmp = 1;
break;
case 0x190 ... 0x19f:
modrm = ldub(s->pc++);
gen_setcc(s, b);
gen_ldst_modrm(s, modrm, OT_BYTE, OR_TMP0, 1);
break;
case 0x140 ... 0x14f:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
gen_setcc(s, b);
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T1_A0[ot]();
} else {
rm = modrm & 7;
gen_op_mov_TN_reg[ot][1][rm]();
}
gen_op_cmov_reg_T1_T0[ot - OT_WORD][reg]();
break;
case 0x9c:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
if (s->vm86)
gen_op_movl_T0_eflags_vm();
else
gen_op_movl_T0_eflags();
gen_push_T0(s);
break;
case 0x9d:
gen_pop_T0(s);
if (s->dflag) {
if (s->vm86)
gen_op_movl_eflags_T0_vm(pc_start - s->cs_base);
else
gen_op_movl_eflags_T0();
} else {
if (s->vm86)
gen_op_movw_eflags_T0_vm(pc_start - s->cs_base);
else
gen_op_movw_eflags_T0();
}
gen_pop_update(s);
s->cc_op = CC_OP_EFLAGS;
break;
case 0x9e:
gen_op_mov_TN_reg[OT_BYTE][0][R_AH]();
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_movb_eflags_T0();
s->cc_op = CC_OP_EFLAGS;
break;
case 0x9f:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_movl_T0_eflags();
gen_op_mov_reg_T0[OT_BYTE][R_AH]();
break;
case 0xf5:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_cmc();
s->cc_op = CC_OP_EFLAGS;
break;
case 0xf8:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_clc();
s->cc_op = CC_OP_EFLAGS;
break;
case 0xf9:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_stc();
s->cc_op = CC_OP_EFLAGS;
break;
case 0xfc:
gen_op_cld();
break;
case 0xfd:
gen_op_std();
break;
case 0x1ba:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
op = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
rm = modrm & 7;
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
gen_op_ld_T0_A0[ot]();
} else {
gen_op_mov_TN_reg[ot][0][rm]();
}
val = ldub(s->pc++);
gen_op_movl_T1_im(val);
if (op < 4)
goto illegal_op;
op -= 4;
gen_op_btx_T0_T1_cc[ot - OT_WORD][op]();
s->cc_op = CC_OP_SARB + ot;
if (op != 0) {
if (mod != 3)
gen_op_st_T0_A0[ot]();
else
gen_op_mov_reg_T0[ot][rm]();
}
break;
case 0x1a3:
op = 0;
goto do_btx;
case 0x1ab:
op = 1;
goto do_btx;
case 0x1b3:
op = 2;
goto do_btx;
case 0x1bb:
op = 3;
do_btx:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
rm = modrm & 7;
gen_op_mov_TN_reg[OT_LONG][1][reg]();
if (mod != 3) {
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
if (ot == OT_WORD)
gen_op_add_bitw_A0_T1();
else
gen_op_add_bitl_A0_T1();
gen_op_ld_T0_A0[ot]();
} else {
gen_op_mov_TN_reg[ot][0][rm]();
}
gen_op_btx_T0_T1_cc[ot - OT_WORD][op]();
s->cc_op = CC_OP_SARB + ot;
if (op != 0) {
if (mod != 3)
gen_op_st_T0_A0[ot]();
else
gen_op_mov_reg_T0[ot][rm]();
}
break;
case 0x1bc:
case 0x1bd:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
gen_ldst_modrm(s, modrm, ot, OR_TMP0, 0);
gen_op_bsx_T0_cc[ot - OT_WORD][b & 1]();
gen_op_mov_reg_T0[ot][reg]();
s->cc_op = CC_OP_LOGICB + ot;
break;
case 0x27:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_daa();
s->cc_op = CC_OP_EFLAGS;
break;
case 0x2f:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_das();
s->cc_op = CC_OP_EFLAGS;
break;
case 0x37:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_aaa();
s->cc_op = CC_OP_EFLAGS;
break;
case 0x3f:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_aas();
s->cc_op = CC_OP_EFLAGS;
break;
case 0xd4:
val = ldub(s->pc++);
gen_op_aam(val);
s->cc_op = CC_OP_LOGICB;
break;
case 0xd5:
val = ldub(s->pc++);
gen_op_aad(val);
s->cc_op = CC_OP_LOGICB;
break;
case 0x90:
break;
case 0xcc:
gen_op_int3((long)pc_start);
s->is_jmp = 1;
break;
case 0xcd:
val = ldub(s->pc++);
gen_op_int_im(val, pc_start - s->cs_base);
s->is_jmp = 1;
break;
case 0xce:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_into();
break;
case 0xfa:
if (!s->vm86) {
if (s->cpl <= s->iopl)
gen_op_cli();
else
gen_op_gpf(pc_start - s->cs_base);
} else {
if (s->iopl == 3)
gen_op_cli();
else
gen_op_cli_vm();
}
break;
case 0xfb:
if (!s->vm86) {
if (s->cpl <= s->iopl)
gen_op_sti();
else
gen_op_gpf(pc_start - s->cs_base);
} else {
if (s->iopl == 3)
gen_op_sti();
else
gen_op_sti_vm(pc_start - s->cs_base);
}
break;
case 0x62:
ot = dflag ? OT_LONG : OT_WORD;
modrm = ldub(s->pc++);
reg = (modrm >> 3) & 7;
mod = (modrm >> 6) & 3;
if (mod == 3)
goto illegal_op;
gen_op_mov_reg_T0[ot][reg]();
gen_lea_modrm(s, modrm, ®_addr, &offset_addr);
if (ot == OT_WORD)
gen_op_boundw();
else
gen_op_boundl();
break;
case 0x1c8 ... 0x1cf:
reg = b & 7;
gen_op_mov_TN_reg[OT_LONG][0][reg]();
gen_op_bswapl_T0();
gen_op_mov_reg_T0[OT_LONG][reg]();
break;
case 0xd6:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
gen_op_salc();
break;
case 0xe0:
case 0xe1:
if (s->cc_op != CC_OP_DYNAMIC)
gen_op_set_cc_op(s->cc_op);
case 0xe2:
case 0xe3:
val = (int8_t)insn_get(s, OT_BYTE);
next_eip = s->pc - s->cs_base;
val += next_eip;
if (s->dflag == 0)
val &= 0xffff;
gen_op_loop[s->aflag][b & 3](val, next_eip);
s->is_jmp = 1;
break;
case 0x131:
gen_op_rdtsc();
break;
case 0x1a2:
gen_op_cpuid();
break;
case 0xf4:
if (s->cpl == 0) {
} else {
gen_op_gpf(pc_start - s->cs_base);
}
break;
default:
goto illegal_op;
}
if (s->prefix & PREFIX_LOCK)
gen_op_unlock();
return (long)s->pc;
illegal_op:
return -1;
}
| 1threat
|
the polynomial interpolation of degree 4 : For the provided data set, write equations for calculating the polynomial interpolation of degree 4 and find the formula for f by hand.
x = [1, 2, 3, 4, 5]
y = f(x) = [5, 31, 121, 341, 781]
| 0debug
|
Python, error decoding incorrect paddling with decode64 : with the code that im using everytime there is a "?" on the coded menssage i get an error back "Incorrect Paddling".Obs using a decoder online i get the value for value1 but for value2 where should be a "?" it dosent work.
the code is:`data = 'Value'`
`data = base64.b64decode(data)`
value1= Y2FyZGFza2RzZG9wZmtzZGFvZ2tsZGZna2zDtmRmZ2vDtnhkZmtsw7ZkZmtnw7ZsZGZrZ2zDtmRma3hnw7ZkZmtnbMO2ZGZrZ3B3YWZ1aXNkZnVpc2dmYXN5aWZnc3lmZ2FzeWZnc3V5ZGZnc2R1eWZnc3VnZnN1eWdmc3lmDQpmc2R1ZmdzaWRhZmdheWlmZ2FzeWZnYXNkeWZnYXNmeWdhc2Z5YXNnZnlhc2Zhcw0KZnNmYXNmc2FmYXNkZmFzZGZhc2Zhc2RmDQphZnNhZGZzZGZzZGZzZGYNCg==
value2= Y29udGludWE_DQo=
| 0debug
|
void do_subfmeo_64 (void)
{
T1 = T0;
T0 = ~T0 + xer_ca - 1;
if (likely(!((uint64_t)~T1 & ((uint64_t)~T1 ^ (uint64_t)T0) &
(1ULL << 63)))) {
xer_ov = 0;
} else {
xer_so = 1;
xer_ov = 1;
}
if (likely((uint64_t)T1 != UINT64_MAX))
xer_ca = 1;
}
| 1threat
|
Do missing foreign keys in the database have an effect on sql generated by EF? : <p>I'm working on a database-first ASP.NET MVC application. Looking at the database the foreign keys are very inconsistent, basically they are only there if it was specified in the SQL scripts that created the tables. In most cases they are not there.</p>
<p>However, looking in the edmx model, I can see that it is aware of the foreign keys i.e. it has correctly identified the navigation properties.</p>
<p>My question is, does the missing foreign keys in the actual database have an effect on the sql genereted by Entity Framework? By effect I mean negative impact on performance.</p>
<p>I can't really figure out if it matters or not.</p>
<p>Just to clarify, in the database I'm expanding tables and looking for the red key which indicates a foreign key. I'm also looking in the subfolder: "Keys".</p>
| 0debug
|
How to mock/replace getter function of object with Jest? : <p>In Sinon I can do the following:</p>
<pre><code>var myObj = {
prop: 'foo'
};
sinon.stub(myObj, 'prop').get(function getterFn() {
return 'bar';
});
myObj.prop; // 'bar'
</code></pre>
<p>But how can I do the same with Jest?
I can't just overwrite the function with something like <code>jest.fn()</code>, because it won't replace the getter </p>
<blockquote>
<p>"can't set the value of get"</p>
</blockquote>
| 0debug
|
static void ehci_queues_rip_unused(EHCIState *ehci, int async, int flush)
{
EHCIQueueHead *head = async ? &ehci->aqueues : &ehci->pqueues;
uint64_t maxage = FRAME_TIMER_NS * ehci->maxframes * 4;
EHCIQueue *q, *tmp;
QTAILQ_FOREACH_SAFE(q, head, next, tmp) {
if (q->seen) {
q->seen = 0;
q->ts = ehci->last_run_ns;
continue;
}
if (!flush && ehci->last_run_ns < q->ts + maxage) {
continue;
}
ehci_free_queue(q);
}
}
| 1threat
|
Really "basic" sorry... I Can't see how to create a simple EXE in VB.net. I Can't even see how to publish my app simply : <p>I have used VB5 extensively and it created exe files - easy to deploy without having to install much else. I will be really disappointed if my recent use of "modern" .net (I moved over for extra features) means I can't even create the age old simple exe file... What a pain! Hope I'm wrong...</p>
| 0debug
|
how to optimize this mysql query - %a% or : SELECT DISTINCT u.id AS userId,u.type AS userType FROM User AS u,Personal AS p,Company AS c WHERE (p.realName LIKE
'%adf%' AND u.type=1 AND u.id=p.userId) OR (c.name LIKE
'%grge%' AND u.id=c.userId) LIMIT 0 , 10000
| 0debug
|
Can't update decimal field in mssql using c# : When I execute this query:
UPDATE test_temp SET
test_temp.aut_z3 = 0,
test_temp.slo_z3 = 0,
test_temp.ita_z3 = 0
WHERE test_temp.product_id_part_1 = 10877
AND test_temp.product_id_part_2 = 0
using SSMS it works. But if I try to do the same in C# using Dapper then noting happens.
Any idea why?
| 0debug
|
iscsi_set_events(IscsiLun *iscsilun)
{
struct iscsi_context *iscsi = iscsilun->iscsi;
int ev;
ev = POLLIN;
ev |= iscsi_which_events(iscsi);
if (ev != iscsilun->events) {
aio_set_fd_handler(iscsilun->aio_context,
iscsi_get_fd(iscsi),
iscsi_process_read,
(ev & POLLOUT) ? iscsi_process_write : NULL,
iscsilun);
}
iscsilun->events = ev;
}
| 1threat
|
static int read_packet(ByteIOContext *pb, uint8_t *buf, int raw_packet_size)
{
int skip, len;
for(;;) {
len = get_buffer(pb, buf, TS_PACKET_SIZE);
if (len != TS_PACKET_SIZE)
return AVERROR(EIO);
if (buf[0] != 0x47) {
url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR);
if (mpegts_resync(pb) < 0)
return AVERROR_INVALIDDATA;
else
continue;
} else {
skip = raw_packet_size - TS_PACKET_SIZE;
if (skip > 0)
url_fskip(pb, skip);
break;
}
}
return 0;
}
| 1threat
|
static inline void RENAME(yuvPlanartouyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst,
long width, long height,
long lumStride, long chromStride, long dstStride, long vertLumPerChroma)
{
long y;
const long chromWidth= width>>1;
for(y=0; y<height; y++)
{
#ifdef HAVE_MMX
asm volatile(
"xor %%"REG_a", %%"REG_a" \n\t"
ASMALIGN(4)
"1: \n\t"
PREFETCH" 32(%1, %%"REG_a", 2) \n\t"
PREFETCH" 32(%2, %%"REG_a") \n\t"
PREFETCH" 32(%3, %%"REG_a") \n\t"
"movq (%2, %%"REG_a"), %%mm0 \n\t"
"movq %%mm0, %%mm2 \n\t"
"movq (%3, %%"REG_a"), %%mm1 \n\t"
"punpcklbw %%mm1, %%mm0 \n\t"
"punpckhbw %%mm1, %%mm2 \n\t"
"movq (%1, %%"REG_a",2), %%mm3 \n\t"
"movq 8(%1, %%"REG_a",2), %%mm5 \n\t"
"movq %%mm0, %%mm4 \n\t"
"movq %%mm2, %%mm6 \n\t"
"punpcklbw %%mm3, %%mm0 \n\t"
"punpckhbw %%mm3, %%mm4 \n\t"
"punpcklbw %%mm5, %%mm2 \n\t"
"punpckhbw %%mm5, %%mm6 \n\t"
MOVNTQ" %%mm0, (%0, %%"REG_a", 4)\n\t"
MOVNTQ" %%mm4, 8(%0, %%"REG_a", 4)\n\t"
MOVNTQ" %%mm2, 16(%0, %%"REG_a", 4)\n\t"
MOVNTQ" %%mm6, 24(%0, %%"REG_a", 4)\n\t"
"add $8, %%"REG_a" \n\t"
"cmp %4, %%"REG_a" \n\t"
" jb 1b \n\t"
::"r"(dst), "r"(ysrc), "r"(usrc), "r"(vsrc), "g" (chromWidth)
: "%"REG_a
);
#else
#if __WORDSIZE >= 64
int i;
uint64_t *ldst = (uint64_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for(i = 0; i < chromWidth; i += 2){
uint64_t k, l;
k = uc[0] + (yc[0] << 8) +
(vc[0] << 16) + (yc[1] << 24);
l = uc[1] + (yc[2] << 8) +
(vc[1] << 16) + (yc[3] << 24);
*ldst++ = k + (l << 32);
yc += 4;
uc += 2;
vc += 2;
}
#else
int i, *idst = (int32_t *) dst;
const uint8_t *yc = ysrc, *uc = usrc, *vc = vsrc;
for(i = 0; i < chromWidth; i++){
#ifdef WORDS_BIGENDIAN
*idst++ = (uc[0] << 24)+ (yc[0] << 16) +
(vc[0] << 8) + (yc[1] << 0);
#else
*idst++ = uc[0] + (yc[0] << 8) +
(vc[0] << 16) + (yc[1] << 24);
#endif
yc += 2;
uc++;
vc++;
}
#endif
#endif
if((y&(vertLumPerChroma-1))==(vertLumPerChroma-1) )
{
usrc += chromStride;
vsrc += chromStride;
}
ysrc += lumStride;
dst += dstStride;
}
#ifdef HAVE_MMX
asm( EMMS" \n\t"
SFENCE" \n\t"
:::"memory");
#endif
}
| 1threat
|
db.execute('SELECT * FROM products WHERE product_id = ' + product_input)
| 1threat
|
How to list indexes created for table in postgres : <p>Could you tell me how to check what indexes are created for some table in postgresql ? </p>
| 0debug
|
Spark - How to write a single csv file WITHOUT folder? : <p>Suppose that <code>df</code> is a dataframe in Spark. The way to write <code>df</code> into a single CSV file is </p>
<p><code>df.coalesce(1).write.option("header", "true").csv("name.csv")</code></p>
<p>This will write the dataframe into a CSV file contained in a folder called <code>name.csv</code> but the actual CSV file will be called something like <code>part-00000-af091215-57c0-45c4-a521-cd7d9afb5e54.csv</code>. </p>
<p>I would like to know if it is possible to avoid the folder <code>name.csv</code> and to have the actual CSV file called <code>name.csv</code> and not <code>part-00000-af091215-57c0-45c4-a521-cd7d9afb5e54.csv</code>. The reason is that I need to write several CSV files which later on I will read together in Python, but my Python code makes use of the actual CSV names and also needs to have all the single CSV files in a folder (and not a folder of folders).</p>
<p>Any help is appreciated.</p>
| 0debug
|
Swift 4.0 Table View Cell Button, Change Button Image once Clicked : Currently my project has a Table View Controller with a button and text on each row. I am having a problem figuring out how to change the image of the button on a particular row once it is clicked.
Currently I have a button event function that is called every-time a button in a row is clicked. The problem I am having is I have no idea how to access a that particular button in the row that was clicked and only change the image of that button.
Here is my code:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! TableViewCell
// Setting Text and images
cell.batchName.text = processes[indexPath.item].batch_name
cell.startTime.text = processes[indexPath.item].starttime
cell.endTime.text = processes[indexPath.item].endtime
cell.slaTime.text = processes[indexPath.item].SLA
var statusColor = UIColor.black
// Calling Button event function
cell.starButton.addTarget(self, action: #selector(favoriteStarClicked), for: UIControlEvents.touchUpInside)
return cell
}
@IBAction func favoriteStarClicked(_ sender: Any) {
// Need to change the image of the button that was clicked
}
| 0debug
|
docker compose override a ports property instead of merging it : <p>My docker compose configs look like this:</p>
<p>docker-compose.yml</p>
<pre><code>version: '3.5'
services:
nginx:
ports:
- 8080:8080
</code></pre>
<p>docker-compose.prod.yml</p>
<pre><code>version: '3.5'
services:
nginx:
ports:
- 80:80
</code></pre>
<p>Now, when I run command: <code>docker-compose -f docker-compose.yml -f docker-compose.prod.yml up</code> the nginx exposes on host machine two ports: <code>8000</code> and <code>80</code>, because it merges ports properties:</p>
<pre><code>version: '3.5'
services:
nginx:
ports:
- 8080:8080
- 80:80
</code></pre>
<p>Is there a way to override it? I want to expose only port <code>80</code></p>
| 0debug
|
void bdrv_dirty_bitmap_deserialize_part(BdrvDirtyBitmap *bitmap,
uint8_t *buf, uint64_t start,
uint64_t count, bool finish)
{
hbitmap_deserialize_part(bitmap->bitmap, buf, start, count, finish);
}
| 1threat
|
memcpy rewrite not working : <p>Hi could anyone explain why this memcpy function does not work ?</p>
<pre><code>void *ft_memcpy(void *dst, const void *src, size_t n)
{
while (n--)
*(char *)dst++ = *(char *)src++;
return (dst);
}
</code></pre>
| 0debug
|
Flutter divider widget not appearing : <p>I'm currently learning how to build apps using the Flutter SDK and Android Studio. My problem is that I need to add a Divider widget between the 'Administrative' text and the rest of the Card but as you can see in the screenshot below, the divider isn't showing up. I've tried changing the size (In which case the space between the two texts just increases) and I've tried setting the color to see if it was defaulting to transparent on my phone. Nothing works!</p>
<p>Here's my code for the Card Widget State:</p>
<pre><code>class BBSCardState extends State<BBSCard>{
@override
Widget build(BuildContext context) {
return new Padding(
padding: const EdgeInsets.only(top: 16.0, bottom: 16.0, left: 12.0, right: 12.0),
child: new Card(
child: new Row(
children: <Widget>[
new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Padding(
padding: const EdgeInsets.only(top: 22.0, bottom: 8.0),
child: new Text("Administrative", style: new TextStyle(color: new Color.fromARGB(255, 117, 117, 117), fontSize: 32.0, fontWeight: FontWeight.bold)),
),
new Divider(),
new Text("text")
],
),
],
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.center,
)
)
);
}
}
</code></pre>
<p>And here's the screenshot of what the card looks like:</p>
<p><a href="https://i.stack.imgur.com/ApMnP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ApMnP.png" alt="The divider does not appear between the two texts"></a></p>
<p><strong>Also:</strong>
Is there any way to increase the size of the actual line from the Divider? (Not just the spacing) </p>
<p>Thanks!</p>
| 0debug
|
Script to Identify the DOTNET FRAMEWORK VERSION : I need to know that how can I find which Dotnet Framework version is installed through SCRIPT.
I found one website as below.
[WEBSITE FOR DOTNET SCRIPT][1]
[1]: https://stackoverflow.com/questions/199080/how-do-i-detect-what-net-framework-versions-and-service-packs-are-installed
I found some code there to identify the DONET VERSION.
BUT IT IS NOT WORKING. OR I DO NOT KNOW HOW TO RUN IT ?
Can you please help me to develop any script which can be run on CMD and collect DOTNET FRAMEWORK VERSION.
Thanks
Adeel Imtiaz
| 0debug
|
Switch Expressions in Java 13 : <p>The biggest change in Java 13 is the replacement of the keyword break in the switch expression by yield. The background is the better differentiation between switch statement (with possible break) and expressions (with yield). The yield statement exits the switch and returns the result of the current branch, similar to a return.</p>
| 0debug
|
static void scsi_disk_unit_attention_reported(SCSIDevice *dev)
{
SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
if (s->media_changed) {
s->media_changed = false;
s->qdev.unit_attention = SENSE_CODE(MEDIUM_CHANGED);
}
}
| 1threat
|
static void xtensa_sim_init(MachineState *machine)
{
XtensaCPU *cpu = NULL;
CPUXtensaState *env = NULL;
ram_addr_t ram_size = machine->ram_size;
const char *cpu_model = machine->cpu_model;
const char *kernel_filename = machine->kernel_filename;
int n;
if (!cpu_model) {
cpu_model = XTENSA_DEFAULT_CPU_MODEL;
}
for (n = 0; n < smp_cpus; n++) {
cpu = XTENSA_CPU(cpu_generic_init(TYPE_XTENSA_CPU, cpu_model));
if (cpu == NULL) {
error_report("unable to find CPU definition '%s'",
cpu_model);
exit(EXIT_FAILURE);
}
env = &cpu->env;
env->sregs[PRID] = n;
qemu_register_reset(sim_reset, cpu);
sim_reset(cpu);
}
if (env) {
XtensaMemory sysram = env->config->sysram;
sysram.location[0].size = ram_size;
xtensa_create_memory_regions(&env->config->instrom, "xtensa.instrom");
xtensa_create_memory_regions(&env->config->instram, "xtensa.instram");
xtensa_create_memory_regions(&env->config->datarom, "xtensa.datarom");
xtensa_create_memory_regions(&env->config->dataram, "xtensa.dataram");
xtensa_create_memory_regions(&env->config->sysrom, "xtensa.sysrom");
xtensa_create_memory_regions(&sysram, "xtensa.sysram");
}
if (serial_hds[0]) {
xtensa_sim_open_console(serial_hds[0]);
}
if (kernel_filename) {
uint64_t elf_entry;
uint64_t elf_lowaddr;
#ifdef TARGET_WORDS_BIGENDIAN
int success = load_elf(kernel_filename, translate_phys_addr, cpu,
&elf_entry, &elf_lowaddr, NULL, 1, EM_XTENSA, 0, 0);
#else
int success = load_elf(kernel_filename, translate_phys_addr, cpu,
&elf_entry, &elf_lowaddr, NULL, 0, EM_XTENSA, 0, 0);
#endif
if (success > 0) {
env->pc = elf_entry;
}
}
}
| 1threat
|
Split Artist - Title Javascript : I have the following script:
const Parser = require('../src');
const radioStation = new Parser('http://stream.com/live_32.aac');
radioStation.on('metadata', function(metadata) {
console.log([metadata.StreamTitle]);
});
The output of the console is: Artist - Title
I want to split the Artist and Title.
I found something like:
str.split(separator)
But it's not working correct.
Does any one have a solution?
| 0debug
|
static int vc1_decode_i_block_adv(VC1Context *v, DCTELEM block[64], int n, int coded, int codingset, int mquant)
{
GetBitContext *gb = &v->s.gb;
MpegEncContext *s = &v->s;
int dc_pred_dir = 0;
int run_diff, i;
int16_t *dc_val;
int16_t *ac_val, *ac_val2;
int dcdiff;
int a_avail = v->a_avail, c_avail = v->c_avail;
int use_pred = s->ac_pred;
int scale;
int q1, q2 = 0;
int mb_pos = s->mb_x + s->mb_y * s->mb_stride;
if (n < 4) {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_luma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
} else {
dcdiff = get_vlc2(&s->gb, ff_msmp4_dc_chroma_vlc[s->dc_table_index].table, DC_VLC_BITS, 3);
}
if (dcdiff < 0){
av_log(s->avctx, AV_LOG_ERROR, "Illegal DC VLC\n");
return -1;
}
if (dcdiff)
{
if (dcdiff == 119 )
{
if (mquant == 1) dcdiff = get_bits(gb, 10);
else if (mquant == 2) dcdiff = get_bits(gb, 9);
else dcdiff = get_bits(gb, 8);
}
else
{
if (mquant == 1)
dcdiff = (dcdiff<<2) + get_bits(gb, 2) - 3;
else if (mquant == 2)
dcdiff = (dcdiff<<1) + get_bits(gb, 1) - 1;
}
if (get_bits(gb, 1))
dcdiff = -dcdiff;
}
dcdiff += vc1_pred_dc(&v->s, v->overlap, mquant, n, v->a_avail, v->c_avail, &dc_val, &dc_pred_dir);
*dc_val = dcdiff;
if (n < 4) {
block[0] = dcdiff * s->y_dc_scale;
} else {
block[0] = dcdiff * s->c_dc_scale;
}
run_diff = 0;
i = 0;
i = 1;
if(!a_avail) dc_pred_dir = 1;
if(!c_avail) dc_pred_dir = 0;
if(!a_avail && !c_avail) use_pred = 0;
ac_val = s->ac_val[0][0] + s->block_index[n] * 16;
ac_val2 = ac_val;
scale = mquant * 2 + v->halfpq;
if(dc_pred_dir)
ac_val -= 16;
else
ac_val -= 16 * s->block_wrap[n];
q1 = s->current_picture.qscale_table[mb_pos];
if(dc_pred_dir && c_avail) q2 = s->current_picture.qscale_table[mb_pos - 1];
if(!dc_pred_dir && a_avail) q2 = s->current_picture.qscale_table[mb_pos - s->mb_stride];
if(n && n<4) q2 = q1;
if(coded) {
int last = 0, skip, value;
const int8_t *zz_table;
int k;
if(v->s.ac_pred) {
if(!dc_pred_dir)
zz_table = vc1_horizontal_zz;
else
zz_table = vc1_vertical_zz;
} else
zz_table = vc1_normal_zz;
while (!last) {
vc1_decode_ac_coeff(v, &last, &skip, &value, codingset);
i += skip;
if(i > 63)
break;
block[zz_table[i++]] = value;
}
if(use_pred) {
if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
if(dc_pred_dir) {
for(k = 1; k < 8; k++)
block[k << 3] += (ac_val[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
} else {
for(k = 1; k < 8; k++)
block[k] += (ac_val[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
} else {
if(dc_pred_dir) {
for(k = 1; k < 8; k++)
block[k << 3] += ac_val[k];
} else {
for(k = 1; k < 8; k++)
block[k] += ac_val[k + 8];
}
}
}
for(k = 1; k < 8; k++) {
ac_val2[k] = block[k << 3];
ac_val2[k + 8] = block[k];
}
for(k = 1; k < 64; k++)
if(block[k]) {
block[k] *= scale;
if(!v->pquantizer)
block[k] += (block[k] < 0) ? -mquant : mquant;
}
if(use_pred) i = 63;
} else {
int k;
memset(ac_val2, 0, 16 * 2);
if(dc_pred_dir) {
if(use_pred) {
memcpy(ac_val2, ac_val, 8 * 2);
if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k] = (ac_val2[k] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
}
} else {
if(use_pred) {
memcpy(ac_val2 + 8, ac_val + 8, 8 * 2);
if(q2 && q1!=q2) {
q1 = q1 * 2 + ((q1 == v->pq) ? v->halfpq : 0) - 1;
q2 = q2 * 2 + ((q2 == v->pq) ? v->halfpq : 0) - 1;
for(k = 1; k < 8; k++)
ac_val2[k + 8] = (ac_val2[k + 8] * q2 * vc1_dqscale[q1 - 1] + 0x20000) >> 18;
}
}
}
if(use_pred) {
if(dc_pred_dir) {
for(k = 1; k < 8; k++) {
block[k << 3] = ac_val2[k] * scale;
if(!v->pquantizer && block[k << 3])
block[k << 3] += (block[k << 3] < 0) ? -mquant : mquant;
}
} else {
for(k = 1; k < 8; k++) {
block[k] = ac_val2[k + 8] * scale;
if(!v->pquantizer && block[k])
block[k] += (block[k] < 0) ? -mquant : mquant;
}
}
i = 63;
}
}
s->block_last_index[n] = i;
return 0;
}
| 1threat
|
static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
const char *devaddr,
const char *opts_str)
{
Error *local_err = NULL;
QemuOpts *opts;
PCIBus *bus;
int ret, devfn;
bus = pci_get_bus_devfn(&devfn, devaddr);
if (!bus) {
monitor_printf(mon, "Invalid PCI device address %s\n", devaddr);
return NULL;
}
if (!((BusState*)bus)->allow_hotplug) {
monitor_printf(mon, "PCI bus doesn't support hotplug\n");
return NULL;
}
opts = qemu_opts_parse(qemu_find_opts("net"), opts_str ? opts_str : "", 0);
if (!opts) {
return NULL;
}
qemu_opt_set(opts, "type", "nic");
ret = net_client_init(opts, 0, &local_err);
if (error_is_set(&local_err)) {
qerror_report_err(local_err);
error_free(local_err);
return NULL;
}
if (nd_table[ret].devaddr) {
monitor_printf(mon, "Parameter addr not supported\n");
return NULL;
}
return pci_nic_init(&nd_table[ret], "rtl8139", devaddr);
}
| 1threat
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.