problem
stringlengths
26
131k
labels
class label
2 classes
How to fit C# application in every resolution : <p>i want to know how to fit c# application in every Resolution my c# application open in my computer is perfect but when i install this application on my client machine so it's show half application.</p> <p>What I have tried:</p> <pre><code>this.WindowState = FormWindowState.Maximized; this.Location = new Point(0, 0); this.Size = Screen.PrimaryScreen.WorkingArea.Size; </code></pre>
0debug
static void sigp_restart(CPUState *cs, run_on_cpu_data arg) { S390CPU *cpu = S390_CPU(cs); SigpInfo *si = arg.host_ptr; struct kvm_s390_irq irq = { .type = KVM_S390_RESTART, }; switch (s390_cpu_get_state(cpu)) { case CPU_STATE_STOPPED: cpu_synchronize_state(cs); do_restart_interrupt(&cpu->env); s390_cpu_set_state(CPU_STATE_OPERATING, cpu); break; case CPU_STATE_OPERATING: kvm_s390_vcpu_interrupt(cpu, &irq); break; } si->cc = SIGP_CC_ORDER_CODE_ACCEPTED; }
1threat
static void lsi_do_command(LSIState *s) { SCSIDevice *dev; uint8_t buf[16]; uint32_t id; int n; DPRINTF("Send command len=%d\n", s->dbc); if (s->dbc > 16) s->dbc = 16; pci_dma_read(PCI_DEVICE(s), s->dnad, buf, s->dbc); s->sfbr = buf[0]; s->command_complete = 0; id = (s->select_tag >> 8) & 0xf; dev = scsi_device_find(&s->bus, 0, id, s->current_lun); if (!dev) { lsi_bad_selection(s, id); return; } assert(s->current == NULL); s->current = g_malloc0(sizeof(lsi_request)); s->current->tag = s->select_tag; s->current->req = scsi_req_new(dev, s->current->tag, s->current_lun, buf, s->current); n = scsi_req_enqueue(s->current->req); if (n) { if (n > 0) { lsi_set_phase(s, PHASE_DI); } else if (n < 0) { lsi_set_phase(s, PHASE_DO); } scsi_req_continue(s->current->req); } if (!s->command_complete) { if (n) { lsi_add_msg_byte(s, 2); lsi_add_msg_byte(s, 4); lsi_set_phase(s, PHASE_MI); s->msg_action = 1; lsi_queue_command(s); } else { lsi_set_phase(s, PHASE_DI); } } }
1threat
How to do audit on Hyperledger? : How to do audit on Hyperledger? In the link of below: [https://github.com/hyperledger/fabric/blob/ffbf21a5b781b938f4168def6541f6fbae792d31/docs/biz/usecases.md][1] [https://github.com/hyperledger/fabric/blob/cca26e6d9aa9e6fab2b5c17d311709130b52c46e/docs/protocol-spec.md][2] There are audit introductions, so how to do audit setting/configuration, coding , etc. [1]: https://github.com/hyperledger/fabric/blob/ffbf21a5b781b938f4168def6541f6fbae792d31/docs/biz/usecases.md [2]: https://github.com/hyperledger/fabric/blob/cca26e6d9aa9e6fab2b5c17d311709130b52c46e/docs/protocol-spec.md
0debug
static int vaapi_encode_mjpeg_init_picture_params(AVCodecContext *avctx, VAAPIEncodePicture *pic) { VAAPIEncodeContext *ctx = avctx->priv_data; VAEncPictureParameterBufferJPEG *vpic = pic->codec_picture_params; VAAPIEncodeMJPEGContext *priv = ctx->priv_data; vpic->reconstructed_picture = pic->recon_surface; vpic->coded_buf = pic->output_buffer; vpic->picture_width = ctx->input_width; vpic->picture_height = ctx->input_height; vpic->pic_flags.bits.profile = 0; vpic->pic_flags.bits.progressive = 0; vpic->pic_flags.bits.huffman = 1; vpic->pic_flags.bits.interleaved = 0; vpic->pic_flags.bits.differential = 0; vpic->sample_bit_depth = 8; vpic->num_scan = 1; vpic->num_components = 3; vpic->component_id[0] = 1; vpic->component_id[1] = 2; vpic->component_id[2] = 3; priv->component_subsample_h[0] = 2; priv->component_subsample_v[0] = 2; priv->component_subsample_h[1] = 1; priv->component_subsample_v[1] = 1; priv->component_subsample_h[2] = 1; priv->component_subsample_v[2] = 1; vpic->quantiser_table_selector[0] = 0; vpic->quantiser_table_selector[1] = 1; vpic->quantiser_table_selector[2] = 1; vpic->quality = priv->quality; pic->nb_slices = 1; return 0; }
1threat
make navigation transparent when on home page otherwise default : <p>I am creating a navigation in which I try to put two backgrounds 1. Transparent (Only show when a user at homepage) 2. Default Color(When a user visit other pages)</p> <p>I try to solve this using javascript by checking up the address bar URL but then I realize that I am unable to catch the Home page URL.</p> <p>Does anyone know how to solve this problem?</p>
0debug
static int tcp_open(URLContext *h, const char *uri, int flags) { struct sockaddr_in dest_addr; char hostname[1024], *q; int port, fd = -1; TCPContext *s; const char *p; fd_set wfds; int fd_max, ret; struct timeval tv; socklen_t optlen; s = av_malloc(sizeof(TCPContext)); if (!s) return -ENOMEM; h->priv_data = s; p = uri; if (!strstart(p, "tcp: goto fail; q = hostname; while (*p != ':' && *p != '/' && *p != '\0') { if ((q - hostname) < sizeof(hostname) - 1) *q++ = *p; p++; } *q = '\0'; if (*p != ':') goto fail; p++; port = strtoul(p, (char **)&p, 10); if (port <= 0 || port >= 65536) goto fail; dest_addr.sin_family = AF_INET; dest_addr.sin_port = htons(port); if (resolve_host(&dest_addr.sin_addr, hostname) < 0) goto fail; fd = socket(PF_INET, SOCK_STREAM, 0); if (fd < 0) goto fail; fcntl(fd, F_SETFL, O_NONBLOCK); redo: ret = connect(fd, (struct sockaddr *)&dest_addr, sizeof(dest_addr)); if (ret < 0) { if (errno == EINTR) goto redo; if (errno != EINPROGRESS) goto fail; for(;;) { if (url_interrupt_cb()) { ret = -EINTR; goto fail1; } fd_max = fd; FD_ZERO(&wfds); FD_SET(fd, &wfds); tv.tv_sec = 0; tv.tv_usec = 100 * 1000; ret = select(fd_max + 1, NULL, &wfds, NULL, &tv); if (ret > 0 && FD_ISSET(fd, &wfds)) break; } optlen = sizeof(ret); getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen); if (ret != 0) goto fail; } s->fd = fd; return 0; fail: ret = AVERROR_IO; fail1: if (fd >= 0) close(fd); av_free(s); return ret; }
1threat
static uint32_t hpet_time_after(uint64_t a, uint64_t b) { return ((int32_t)(b) - (int32_t)(a) < 0); }
1threat
Cluster and Fork mode difference in PM2 : <p>I've searched a lot to figure out this question, but I didn't get clear explanation. Is there only one difference thing that clustered app can be scaled out and forked app cannot be?</p> <p>PM2's public site explains Cluster mode can do <a href="http://pm2.keymetrics.io/docs/usage/cluster-mode/" rel="noreferrer">these feature</a> but no one says about pros of Fork mode (maybe, it can get <code>NODE_APP_INSTANCE</code> variable).</p> <p>I feel like Cluster might be part of Fork because Fork seems like to be used in general. So, I guess Fork means just 'forked process' from the point of PM2 and Cluster means 'forked process that is able to be scaled out'. Then, why should I use Fork mode?</p>
0debug
static void nand_command(NANDFlashState *s) { unsigned int offset; switch (s->cmd) { case NAND_CMD_READ0: s->iolen = 0; break; case NAND_CMD_READID: s->ioaddr = s->io; s->iolen = 0; nand_pushio_byte(s, s->manf_id); nand_pushio_byte(s, s->chip_id); nand_pushio_byte(s, 'Q'); if (nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP) { nand_pushio_byte(s, (s->buswidth == 2) ? 0x55 : 0x15); } else { nand_pushio_byte(s, 0xc0); } break; case NAND_CMD_RANDOMREAD2: case NAND_CMD_NOSERIALREAD2: if (!(nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP)) break; offset = s->addr & ((1 << s->addr_shift) - 1); s->blk_load(s, s->addr, offset); if (s->gnd) s->iolen = (1 << s->page_shift) - offset; else s->iolen = (1 << s->page_shift) + (1 << s->oob_shift) - offset; break; case NAND_CMD_RESET: nand_reset(DEVICE(s)); break; case NAND_CMD_PAGEPROGRAM1: s->ioaddr = s->io; s->iolen = 0; break; case NAND_CMD_PAGEPROGRAM2: if (s->wp) { s->blk_write(s); } break; case NAND_CMD_BLOCKERASE1: break; case NAND_CMD_BLOCKERASE2: s->addr &= (1ull << s->addrlen * 8) - 1; s->addr <<= nand_flash_ids[s->chip_id].options & NAND_SAMSUNG_LP ? 16 : 8; if (s->wp) { s->blk_erase(s); } break; case NAND_CMD_READSTATUS: s->ioaddr = s->io; s->iolen = 0; nand_pushio_byte(s, s->status); break; default: printf("%s: Unknown NAND command 0x%02x\n", __FUNCTION__, s->cmd); } }
1threat
Checking number of parameters passed in a function : I'm writing a bash function that takes a directory D as a parameter. If given no parameter, D should be ".", if 2 or more parameters are passed in, the function should output an error and exit the program. But my function is not working. Please help!! ```` dir=$@ if [ $# -e 1 ]; then dir=$1 else if [ $# -e 0 ]; then dir="." else echo "Too many operands." exit 1 fi ````
0debug
How to merge two array value matching by key value using Node.js/Javascript : I need one help. I need to match two array and merge by matching key value using Javascript/Node.js. I am explaining my code below. var userData=[{'email':'a@gmail.com','name':'Raj'},{'email':'b@gmail.com','name':'Rahul'}]; var userData1=[{'email':'a@gmail.com','address':'abcdf'},{'email':'b@gmail.com','address':'bbsr'}]; Here I have two array and I need to merge both array by matching the `email` value and the expected output is like below. var finalArr=[{'email':'a@gmail.com','name':'Raj','address':'abcdf'},{'email':'b@gmail.com','name':'Rahul','address':'bbsr'}]; Please help me to do this.
0debug
int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f) { AudioFrame *new_frame; AudioFrame *queue_end = afq->frame_queue; while (queue_end && queue_end->next) queue_end = queue_end->next; if (!(new_frame = av_malloc(sizeof(*new_frame)))) return AVERROR(ENOMEM); new_frame->next = NULL; new_frame->duration = f->nb_samples; if (f->pts != AV_NOPTS_VALUE) { new_frame->pts = av_rescale_q(f->pts, afq->avctx->time_base, (AVRational){ 1, afq->avctx->sample_rate }); afq->next_pts = new_frame->pts + new_frame->duration; } else { new_frame->pts = AV_NOPTS_VALUE; afq->next_pts = AV_NOPTS_VALUE; } if (!queue_end) afq->frame_queue = new_frame; else queue_end->next = new_frame; afq->remaining_samples += f->nb_samples; #ifdef DEBUG ff_af_queue_log_state(afq); #endif return 0; }
1threat
Schedule a .Net Core console application on windows using Task Scheduler : <p>Is it possible to schedule a .net core console application to run every day at a specific time using the Task Scheduler?</p>
0debug
How can i display time and date in notification? : How can i send a notification for user with the time and date? After user have done the appointment, it will send a notification for user to let user know the date and time.Anyone can help me? [This is my data of date and time store in firebase][1] [1]: https://i.stack.imgur.com/8Sb8L.png
0debug
MigrationState *unix_start_outgoing_migration(Monitor *mon, const char *path, int64_t bandwidth_limit, int detach, int blk, int inc) { FdMigrationState *s; struct sockaddr_un addr; int ret; addr.sun_family = AF_UNIX; snprintf(addr.sun_path, sizeof(addr.sun_path), "%s", path); s = qemu_mallocz(sizeof(*s)); s->get_error = unix_errno; s->write = unix_write; s->close = unix_close; s->mig_state.cancel = migrate_fd_cancel; s->mig_state.get_status = migrate_fd_get_status; s->mig_state.release = migrate_fd_release; s->mig_state.blk = blk; s->mig_state.shared = inc; s->state = MIG_STATE_ACTIVE; s->mon = NULL; s->bandwidth_limit = bandwidth_limit; s->fd = socket(PF_UNIX, SOCK_STREAM, 0); if (s->fd < 0) { dprintf("Unable to open socket"); goto err_after_alloc; } socket_set_nonblock(s->fd); if (!detach) { migrate_fd_monitor_suspend(s, mon); } do { ret = connect(s->fd, (struct sockaddr *)&addr, sizeof(addr)); if (ret == -1) ret = -(s->get_error(s)); if (ret == -EINPROGRESS || ret == -EWOULDBLOCK) qemu_set_fd_handler2(s->fd, NULL, NULL, unix_wait_for_connect, s); } while (ret == -EINTR); if (ret < 0 && ret != -EINPROGRESS && ret != -EWOULDBLOCK) { dprintf("connect failed\n"); goto err_after_open; } else if (ret >= 0) migrate_fd_connect(s); return &s->mig_state; err_after_open: close(s->fd); err_after_alloc: qemu_free(s); return NULL; }
1threat
static av_cold int vp8_free(AVCodecContext *avctx) { VP8Context *ctx = avctx->priv_data; vpx_codec_destroy(&ctx->encoder); av_freep(&ctx->twopass_stats.buf); av_freep(&avctx->coded_frame); av_freep(&avctx->stats_out); free_frame_list(ctx->coded_frame_list); return 0; }
1threat
VBA How to paste data a certain number of times : I have 2 lines: L39 = DR L40 = CR And I want to copy those two lines down a certain number of times. I have already calculated that using variable Template_row. So if Template_row = 128, I would want those 128 rows to be filled down with DR & CR.
0debug
When I use Deployment in Kubernetes, what's the differences between apps/v1beta1 and extensions/v1beta1? : <p>I use the <a href="https://raw.githubusercontent.com/kubernetes/kubernetes.github.io/master/docs/tutorials/stateless-application/deployment.yaml" rel="noreferrer">yaml file</a>, which is in the Kubernetes official document, to create a Deployment in Kubernetes, and it uses <code>apiVersion: apps/v1beta1</code> at the top. Then I typed <code>kubectl create -f deployment.yaml</code> to create this Deployment, but it occured an error as following: </p> <pre> error: error validating "deployment.yaml": error validating data: couldn't find type: v1beta1.Deployment; if you choose to ignore these errors, turn validation off with --validate=false` </pre> <p>After some search, I changed <code>apiVersion: apps/v1beta1</code> to <code>extensions/v1beta1</code>, and then recreate the Deployment with the yaml file, and it worked fine.<br> So, I wanna know what's the differences between <code>apps/v1beta1</code> and <code>extensions/v1beta1</code>. Is it pertinent to the Kubernetes version? </p> <pre> # kubectl version Client Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.4", GitCommit:"7243c69eb523aa4377bce883e7c0dd76b84709a1", GitTreeState:"clean", BuildDate:"2017-03-07T23:53:09Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"5", GitVersion:"v1.5.4", GitCommit:"7243c69eb523aa4377bce883e7c0dd76b84709a1", GitTreeState:"clean", BuildDate:"2017-03-07T23:34:32Z", GoVersion:"go1.7.4", Compiler:"gc", Platform:"linux/amd64"} </pre>
0debug
How to create a subfolders for each items when having a database : I was a hard time giving this a title as I am not sure what this is called. Anyhow, my question is how can do folders for each item when a have a database. Take this site as an example, whenever you click on a question it takes you to a new page with the following format: http://stackoverflow.com/questions/some_id_number/question_title I originally thought the way to go about this is to programmatically create a folder and a file (the page for this particular new item, a .php page per se) on the insertion of a new item on my table and then inside my php page require the page to filled out with the info retrieved. Help pointing me in the right direction, as well as comments. Oh and you are one of those who like to down vote please at least tell me why, don't just down vote and run.
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
Hi! I wonder why we have to use setter and getter methods to define sth? : ***Using Setter and Getter** class sum { int a; int b; int c; public void setSum(int a, int b) { c = a + b; } public int getSum() { return c; } public static void main(String[] args) { sum s = new sum(); s.setSum(10,7); System.out.println("Sum: " + s.getSum()); } } ***Using just only one method (getter)** class sum1 { int a; int b; int c; public int getSum(int a, int b) { c = a+b; return c; } public static void main(String[] args) { sum1 s1 = new sum1(); System.out.println("Sum: " + s1.getSum(7,10)); } } **I would like to know why the teacher encouraged me to use Setter and Getter when both coding ways result the same (17)....I am new to Java and want to ask you guys what specific reason lies behind using Setter and Getter! Thank you so much~**
0debug
i am not able to figure out What is printed to the console : what will be the output of the following code ?`enter code here` String[] letters = {"laid","leave","lean","ease","east","legals","revo","fights","limit","live "}; int result = Stream.of(letters) .filter(w -> isVowel(w.charAt(3))) .mapToInt(w -> w.length()) .filter(w -> w % 2 == 0) .sum(); System.out.println(result);
0debug
GoogleTrans API Error - Expecting value: line 1 column 1 (char 0) : <p>I am having this error when translating thousands of text data in an iteration:</p> <pre><code>Expecting value: line 1 column 1 (char 0) </code></pre> <p>My code for translating big amounts of text:</p> <pre><code>translatedList = [] for index, row in df.iterrows(): newrow = copy.deepcopy(row) try: # translate the 'text' column translated = translator.translate(row['text'], dest='en') newrow['translated'] = translated.text except Exception as e: print(str(e)) continue translatedList.append(newrow) </code></pre> <p>I receive this error after translating about 2-3k rows. </p>
0debug
Why is "bdefh" the output of a java recursion code in which the call to the method preceds and follows the System.out.print? : Is anyone able to figure out how this recursion code works and why it outputs what it does? maybe you could include the steps it goes through to get to what it outputs? Thank you so much! The code is attached... ( it outputs bdefh). the language is java. Please also note that I am a beginner.
0debug
int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){ if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/4) return 0; av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h); return -1; }
1threat
static int get_block_status(BlockDriverState *bs, int64_t offset, int64_t bytes, MapEntry *e) { int64_t ret; int depth; BlockDriverState *file; bool has_offset; int nb_sectors = bytes >> BDRV_SECTOR_BITS; assert(bytes < INT_MAX); depth = 0; for (;;) { ret = bdrv_get_block_status(bs, offset >> BDRV_SECTOR_BITS, nb_sectors, &nb_sectors, &file); if (ret < 0) { return ret; } assert(nb_sectors); if (ret & (BDRV_BLOCK_ZERO|BDRV_BLOCK_DATA)) { break; } bs = backing_bs(bs); if (bs == NULL) { ret = 0; break; } depth++; } has_offset = !!(ret & BDRV_BLOCK_OFFSET_VALID); *e = (MapEntry) { .start = offset, .length = nb_sectors * BDRV_SECTOR_SIZE, .data = !!(ret & BDRV_BLOCK_DATA), .zero = !!(ret & BDRV_BLOCK_ZERO), .offset = ret & BDRV_BLOCK_OFFSET_MASK, .has_offset = has_offset, .depth = depth, .has_filename = file && has_offset, .filename = file && has_offset ? file->filename : NULL, }; return 0; }
1threat
springboot embedded tomcat and tomcat-embed-jasper : <p>I sometimes see these following declaration in pom.xml...</p> <pre><code> &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt; &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;javax.servlet&lt;/groupId&gt; &lt;artifactId&gt;jstl&lt;/artifactId&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.apache.tomcat.embed&lt;/groupId&gt; &lt;artifactId&gt;tomcat-embed-jasper&lt;/artifactId&gt; &lt;scope&gt;provided&lt;/scope&gt; &lt;/dependency&gt; .... </code></pre> <p>as you can see, spring-boot-starter-web was declared as well as tomcat-embed-jasper.</p> <p>isn't it spring-boot-starter-web already have an embedded tomcat? why some developers still declare tomcat-embed-jasper along with boot-starter-web? or is there any reason?</p>
0debug
How to return parts of a string with regular expression : <p>I have multiple strings in the format:</p> <pre><code>"s mus_musculus.1 3003214 6673 + 195471971 ctctcctatggcggggaaggtgcctggatgtctaaagc-----------------ctgaa-atggggatctatcccagaagctgtgtagcttctgcctgtcccagaagctgtgttgtttct" </code></pre> <p>How can I use regular expressions to pull out the first number sequence (ie 3003214), and then the final sequence of "c, t, a, g, and -"? </p> <p>I have tried various regular expression builders but have not been able to figure it out. </p> <p>Any help would be greatly appreciated! </p>
0debug
Creating a list of lists into a dictionary : <p>I'm trying to find a code that transforms a list of lists into a dictionary. Lets say I have a list that is </p> <pre><code>list_one = [['id1', 'id2', id3', 'id4', 'id5'], ['1', 'Cat', '400', 'Fur', '50'], ['2', 'Dog', '500', 'Smelly', '60']] </code></pre> <p>The dictionary should have keys to number each list in dictionaries in this format</p> <pre><code>new_dict = {1.0: {'id1': 1, 'id2': 'Cat', 'id3': 400, 'id4': 'Fur', 'id5': 50}, 2.0: {'id1': 2, 'id2': 'Dog', 'id3': 500, 'id4': 'Smelly' 'id5': 60} </code></pre> <p>Can such a conversion be done in list comprehension or through a for loop? </p>
0debug
Profiling iOS Today Widget (Instruments) : <p>is that a way to analyze other targets in Instruments? I am trying to profile my widget target there but Instruments keep displaying a dialog saying "please take appropriate action to initiate the launch of <code>com.appId.widget</code>".</p> <p>Any ideas?</p>
0debug
def make_flip(ch): return '1' if (ch == '0') else '0' def get_flip_with_starting_charcter(str, expected): flip_count = 0 for i in range(len( str)): if (str[i] != expected): flip_count += 1 expected = make_flip(expected) return flip_count def min_flip_to_make_string_alternate(str): return min(get_flip_with_starting_charcter(str, '0'),get_flip_with_starting_charcter(str, '1'))
0debug
void HELPER(set_r13_banked)(CPUState *env, uint32_t mode, uint32_t val) { env->banked_r13[bank_number(mode)] = val; }
1threat
Has angular been replaced with typescript? : <p>So I went through a good tutorial of Angular 1.x. I visited angular.io to have a look at Angular 2. All I can see is Typescript, Javascript, and Dart references. Is what I learnt about Angular pointless now and should I start learning Typescript?</p> <p>Thanks</p>
0debug
Add attributes to implode : i need add to $attr['ids'] array with $gallery_setting. function the_featured_image_gallery( $atts = array() ) { $gallery_setting = get_theme_mod( 'featured_image_gallery' ); if ( is_array( $gallery_setting ) && ! empty( $gallery_setting ) ) { $atts['ids'] = implode( ',', $gallery_setting ); echo gallery_shortcode( $atts ); } } Idealy, i would like: echo gallery_shortcode( $atts, array( 'order' => 'ASC', 'size' => 'full', 'link' => 'none' ) ); But i know what it does not work. Thanks in advance for the help.
0debug
How to get data and time from the date object in javascript : <p>How can we get date and time from the date object. So if we have a date object such as Date 2099-09-06T06:30:00.000Z , how can we get date and time as different values from it. I am using ExtJs, so if we can do in Extjs too would be great.</p>
0debug
Copy complete virtualenv to another pc : <p>I have a <code>virtualenv</code> located at <code>/home/user/virtualenvs/Environment</code>. Now I need this environment at another PC. So I installed <code>virtualenv-clone</code> and used it to clone <code>/Environment</code>. Then I copied it to the other PC via USB. I can activate it with <code>source activate</code>, but when I try to start the python interpreter with <code>sudo ./Environment/bin/python</code> I get</p> <pre><code>./bin/python: 1: ./bin/python: Syntax Error: "(" unexpected </code></pre> <p>Executing it without sudo gives me an error telling me that there is an error in the binaries format. But how can this be? I just copied it. Or is there a better way to do this? I can not just use <code>pip freeze</code> because there are some packages in <code>/Environment/lib/python2.7/site-packages/</code> which I wrote myself and I need to copy them, too. As I understand it <code>pip freeze</code> just creates a list of packages which pip then downloads and installs.</p>
0debug
Date.now().toISOString() throwing error "not a function" : <p>I am running Node v6.4.0 on Windows 10. In one of my Javascript files I am trying to get an ISO date string from the Date object:</p> <pre><code>let timestamp = Date.now().toISOString(); </code></pre> <p>This throws: Date.now(...).toISOString is not a function</p> <p>Looking through stackoverflow this should work...possible bug in Node?</p>
0debug
Not generation of core : <pre><code>#include&lt;stdio.h&gt; #include &lt;stdlib.h&gt; int *ip_range ; int main() { ip_range = (int *) malloc(1); ip_range[0]=2; ip_range[10]=2; ip_range[20]=2; ip_range[33787]=12444; printf("%d\n", ip_range[33787]); } </code></pre> <p>I have malloc just 1 block then why it is accessible till 33787 and generating core on 33788.</p>
0debug
static void gen_sse(CPUX86State *env, DisasContext *s, int b, target_ulong pc_start, int rex_r) { int b1, op1_offset, op2_offset, is_xmm, val; int modrm, mod, rm, reg; SSEFunc_0_epp sse_fn_epp; SSEFunc_0_eppi sse_fn_eppi; SSEFunc_0_ppi sse_fn_ppi; SSEFunc_0_eppt sse_fn_eppt; TCGMemOp ot; b &= 0xff; if (s->prefix & PREFIX_DATA) b1 = 1; else if (s->prefix & PREFIX_REPZ) b1 = 2; else if (s->prefix & PREFIX_REPNZ) b1 = 3; else b1 = 0; sse_fn_epp = sse_op_table1[b][b1]; if (!sse_fn_epp) { goto unknown_op; } if ((b <= 0x5f && b >= 0x10) || b == 0xc6 || b == 0xc2) { is_xmm = 1; } else { if (b1 == 0) { is_xmm = 0; } else { is_xmm = 1; } } if (s->flags & HF_TS_MASK) { gen_exception(s, EXCP07_PREX, pc_start - s->cs_base); return; } if (s->flags & HF_EM_MASK) { illegal_op: gen_illegal_opcode(s); return; } if (is_xmm && !(s->flags & HF_OSFXSR_MASK) && ((b != 0x38 && b != 0x3a) || (s->prefix & PREFIX_DATA))) { goto unknown_op; } if (b == 0x0e) { if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) { goto unknown_op; } gen_helper_emms(cpu_env); return; } if (b == 0x77) { gen_helper_emms(cpu_env); return; } if (!is_xmm) { gen_helper_enter_mmx(cpu_env); } modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7); if (is_xmm) reg |= rex_r; mod = (modrm >> 6) & 3; if (sse_fn_epp == SSE_SPECIAL) { b |= (b1 << 8); switch(b) { case 0x0e7: if (mod == 3) { goto illegal_op; } gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); break; case 0x1e7: case 0x02b: case 0x12b: if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); break; case 0x3f0: if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); break; case 0x22b: case 0x32b: if (mod == 3) goto illegal_op; gen_lea_modrm(env, s, modrm); if (b1 & 1) { gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(0))); gen_op_st_v(s, MO_32, cpu_T0, cpu_A0); } break; case 0x6e: #ifdef TARGET_X86_64 if (s->dflag == MO_64) { gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0); tcg_gen_st_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); } else #endif { gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); gen_helper_movl_mm_T0_mmx(cpu_ptr0, cpu_tmp2_i32); } break; case 0x16e: #ifdef TARGET_X86_64 if (s->dflag == MO_64) { gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); gen_helper_movq_mm_T0_xmm(cpu_ptr0, cpu_T0); } else #endif { gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 0); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); gen_helper_movl_mm_T0_xmm(cpu_ptr0, cpu_tmp2_i32); } break; case 0x6f: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); } else { rm = (modrm & 7); tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx)); tcg_gen_st_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); } break; case 0x010: case 0x110: case 0x028: case 0x128: case 0x16f: case 0x26f: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movo(offsetof(CPUX86State,xmm_regs[reg]), offsetof(CPUX86State,xmm_regs[rm])); } break; case 0x210: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0))); } break; case 0x310: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } break; case 0x012: case 0x112: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(1))); } break; case 0x212: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(2))); } gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2))); break; case 0x312: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); break; case 0x016: case 0x116: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(1))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } break; case 0x216: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(1))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3)), offsetof(CPUX86State,xmm_regs[rm].ZMM_L(3))); } gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(1))); gen_op_movl(offsetof(CPUX86State,xmm_regs[reg].ZMM_L(2)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(3))); break; case 0x178: case 0x378: { int bit_index, field_length; if (b1 == 1 && reg != 0) goto illegal_op; field_length = cpu_ldub_code(env, s->pc++) & 0x3F; bit_index = cpu_ldub_code(env, s->pc++) & 0x3F; tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[reg])); if (b1 == 1) gen_helper_extrq_i(cpu_env, cpu_ptr0, tcg_const_i32(bit_index), tcg_const_i32(field_length)); else gen_helper_insertq_i(cpu_env, cpu_ptr0, tcg_const_i32(bit_index), tcg_const_i32(field_length)); } break; case 0x7e: #ifdef TARGET_X86_64 if (s->dflag == MO_64) { tcg_gen_ld_i64(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx)); gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1); } else #endif { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx.MMX_L(0))); gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1); } break; case 0x17e: #ifdef TARGET_X86_64 if (s->dflag == MO_64) { tcg_gen_ld_i64(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); gen_ldst_modrm(env, s, modrm, MO_64, OR_TMP0, 1); } else #endif { tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_ldst_modrm(env, s, modrm, MO_32, OR_TMP0, 1); } break; case 0x27e: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); } gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1))); break; case 0x7f: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, fpregs[reg].mmx)); } else { rm = (modrm & 7); gen_op_movq(offsetof(CPUX86State,fpregs[rm].mmx), offsetof(CPUX86State,fpregs[reg].mmx)); } break; case 0x011: case 0x111: case 0x029: case 0x129: case 0x17f: case 0x27f: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_sto_env_A0(s, offsetof(CPUX86State, xmm_regs[reg])); } else { rm = (modrm & 7) | REX_B(s); gen_op_movo(offsetof(CPUX86State,xmm_regs[rm]), offsetof(CPUX86State,xmm_regs[reg])); } break; case 0x211: if (mod != 3) { gen_lea_modrm(env, s, modrm); tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); gen_op_st_v(s, MO_32, cpu_T0, cpu_A0); } else { rm = (modrm & 7) | REX_B(s); gen_op_movl(offsetof(CPUX86State,xmm_regs[rm].ZMM_L(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_L(0))); } break; case 0x311: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); } break; case 0x013: case 0x113: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { goto illegal_op; } break; case 0x017: case 0x117: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(1))); } else { goto illegal_op; } break; case 0x71: case 0x72: case 0x73: case 0x171: case 0x172: case 0x173: if (b1 >= 2) { goto unknown_op; } val = cpu_ldub_code(env, s->pc++); if (is_xmm) { tcg_gen_movi_tl(cpu_T0, val); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(1))); op1_offset = offsetof(CPUX86State,xmm_t0); } else { tcg_gen_movi_tl(cpu_T0, val); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(0))); tcg_gen_movi_tl(cpu_T0, 0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,mmx_t0.MMX_L(1))); op1_offset = offsetof(CPUX86State,mmx_t0); } sse_fn_epp = sse_op_table2[((b - 1) & 3) * 8 + (((modrm >> 3)) & 7)][b1]; if (!sse_fn_epp) { goto unknown_op; } if (is_xmm) { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op1_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x050: rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_movmskps(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x150: rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_movmskpd(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x02a: case 0x12a: gen_helper_enter_mmx(cpu_env); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,mmx_t0); gen_ldq_env_A0(s, op2_offset); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } op1_offset = offsetof(CPUX86State,xmm_regs[reg]); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); switch(b >> 8) { case 0x0: gen_helper_cvtpi2ps(cpu_env, cpu_ptr0, cpu_ptr1); break; default: case 0x1: gen_helper_cvtpi2pd(cpu_env, cpu_ptr0, cpu_ptr1); break; } break; case 0x22a: case 0x32a: ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); op1_offset = offsetof(CPUX86State,xmm_regs[reg]); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); if (ot == MO_32) { SSEFunc_0_epi sse_fn_epi = sse_op_table3ai[(b >> 8) & 1]; tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); sse_fn_epi(cpu_env, cpu_ptr0, cpu_tmp2_i32); } else { #ifdef TARGET_X86_64 SSEFunc_0_epl sse_fn_epl = sse_op_table3aq[(b >> 8) & 1]; sse_fn_epl(cpu_env, cpu_ptr0, cpu_T0); #else goto illegal_op; #endif } break; case 0x02c: case 0x12c: case 0x02d: case 0x12d: gen_helper_enter_mmx(cpu_env); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,xmm_t0); gen_ldo_env_A0(s, op2_offset); } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } op1_offset = offsetof(CPUX86State,fpregs[reg & 7].mmx); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); switch(b) { case 0x02c: gen_helper_cvttps2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x12c: gen_helper_cvttpd2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x02d: gen_helper_cvtps2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x12d: gen_helper_cvtpd2pi(cpu_env, cpu_ptr0, cpu_ptr1); break; } break; case 0x22c: case 0x32c: case 0x22d: case 0x32d: ot = mo_64_32(s->dflag); if (mod != 3) { gen_lea_modrm(env, s, modrm); if ((b >> 8) & 1) { gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.ZMM_Q(0))); } else { gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); } op2_offset = offsetof(CPUX86State,xmm_t0); } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op2_offset); if (ot == MO_32) { SSEFunc_i_ep sse_fn_i_ep = sse_op_table3bi[((b >> 7) & 2) | (b & 1)]; sse_fn_i_ep(cpu_tmp2_i32, cpu_env, cpu_ptr0); tcg_gen_extu_i32_tl(cpu_T0, cpu_tmp2_i32); } else { #ifdef TARGET_X86_64 SSEFunc_l_ep sse_fn_l_ep = sse_op_table3bq[((b >> 7) & 2) | (b & 1)]; sse_fn_l_ep(cpu_T0, cpu_env, cpu_ptr0); #else goto illegal_op; #endif } gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0xc4: case 0x1c4: s->rip_offset = 1; gen_ldst_modrm(env, s, modrm, MO_16, OR_TMP0, 0); val = cpu_ldub_code(env, s->pc++); if (b1) { val &= 7; tcg_gen_st16_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[reg].ZMM_W(val))); } else { val &= 3; tcg_gen_st16_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[reg].mmx.MMX_W(val))); } break; case 0xc5: case 0x1c5: if (mod != 3) goto illegal_op; ot = mo_64_32(s->dflag); val = cpu_ldub_code(env, s->pc++); if (b1) { val &= 7; rm = (modrm & 7) | REX_B(s); tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_regs[rm].ZMM_W(val))); } else { val &= 3; rm = (modrm & 7); tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx.MMX_W(val))); } reg = ((modrm >> 3) & 7) | rex_r; gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x1d6: if (mod != 3) { gen_lea_modrm(env, s, modrm); gen_stq_env_A0(s, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(0))); } else { rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0)), offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0))); gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(1))); } break; case 0x2d6: gen_helper_enter_mmx(cpu_env); rm = (modrm & 7); gen_op_movq(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(0)), offsetof(CPUX86State,fpregs[rm].mmx)); gen_op_movq_env_0(offsetof(CPUX86State,xmm_regs[reg].ZMM_Q(1))); break; case 0x3d6: gen_helper_enter_mmx(cpu_env); rm = (modrm & 7) | REX_B(s); gen_op_movq(offsetof(CPUX86State,fpregs[reg & 7].mmx), offsetof(CPUX86State,xmm_regs[rm].ZMM_Q(0))); break; case 0xd7: case 0x1d7: if (mod != 3) goto illegal_op; if (b1) { rm = (modrm & 7) | REX_B(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,xmm_regs[rm])); gen_helper_pmovmskb_xmm(cpu_tmp2_i32, cpu_env, cpu_ptr0); } else { rm = (modrm & 7); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, offsetof(CPUX86State,fpregs[rm].mmx)); gen_helper_pmovmskb_mmx(cpu_tmp2_i32, cpu_env, cpu_ptr0); } reg = ((modrm >> 3) & 7) | rex_r; tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp2_i32); break; case 0x138: case 0x038: b = modrm; if ((b & 0xf0) == 0xf0) { goto do_0f_38_fx; } modrm = cpu_ldub_code(env, s->pc++); rm = modrm & 7; reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (b1 >= 2) { goto unknown_op; } sse_fn_epp = sse_op_table6[b].op[b1]; if (!sse_fn_epp) { goto unknown_op; } if (!(s->cpuid_ext_features & sse_op_table6[b].ext_mask)) goto illegal_op; if (b1) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod == 3) { op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]); } else { op2_offset = offsetof(CPUX86State,xmm_t0); gen_lea_modrm(env, s, modrm); switch (b) { case 0x20: case 0x30: case 0x23: case 0x33: case 0x25: case 0x35: gen_ldq_env_A0(s, op2_offset + offsetof(ZMMReg, ZMM_Q(0))); break; case 0x21: case 0x31: case 0x24: case 0x34: tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, op2_offset + offsetof(ZMMReg, ZMM_L(0))); break; case 0x22: case 0x32: tcg_gen_qemu_ld_tl(cpu_tmp0, cpu_A0, s->mem_index, MO_LEUW); tcg_gen_st16_tl(cpu_tmp0, cpu_env, op2_offset + offsetof(ZMMReg, ZMM_W(0))); break; case 0x2a: gen_ldo_env_A0(s, op1_offset); return; default: gen_ldo_env_A0(s, op2_offset); } } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod == 3) { op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } else { op2_offset = offsetof(CPUX86State,mmx_t0); gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, op2_offset); } } if (sse_fn_epp == SSE_SPECIAL) { goto unknown_op; } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); if (b == 0x17) { set_cc_op(s, CC_OP_EFLAGS); } break; case 0x238: case 0x338: do_0f_38_fx: b = modrm | (b1 << 8); modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; switch (b) { case 0x3f0: case 0x3f1: do_crc32: if (!(s->cpuid_ext_features & CPUID_EXT_SSE42)) { goto illegal_op; } if ((b & 0xff) == 0xf0) { ot = MO_8; } else if (s->dflag != MO_64) { ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32); } else { ot = MO_64; } tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[reg]); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); gen_helper_crc32(cpu_T0, cpu_tmp2_i32, cpu_T0, tcg_const_i32(8 << ot)); ot = mo_64_32(s->dflag); gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x1f0: case 0x1f1: if (s->prefix & PREFIX_REPNZ) { goto do_crc32; } case 0x0f0: case 0x0f1: if (!(s->cpuid_ext_features & CPUID_EXT_MOVBE)) { goto illegal_op; } if (s->dflag != MO_64) { ot = (s->prefix & PREFIX_DATA ? MO_16 : MO_32); } else { ot = MO_64; } gen_lea_modrm(env, s, modrm); if ((b & 1) == 0) { tcg_gen_qemu_ld_tl(cpu_T0, cpu_A0, s->mem_index, ot | MO_BE); gen_op_mov_reg_v(ot, reg, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_regs[reg], cpu_A0, s->mem_index, ot | MO_BE); } break; case 0x0f2: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); tcg_gen_andc_tl(cpu_T0, cpu_regs[s->vex_v], cpu_T0); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); break; case 0x0f7: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); { TCGv bound, zero; gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); tcg_gen_ext8u_tl(cpu_A0, cpu_regs[s->vex_v]); tcg_gen_shr_tl(cpu_T0, cpu_T0, cpu_A0); bound = tcg_const_tl(ot == MO_64 ? 63 : 31); zero = tcg_const_tl(0); tcg_gen_movcond_tl(TCG_COND_LEU, cpu_T0, cpu_A0, bound, cpu_T0, zero); tcg_temp_free(zero); tcg_gen_extract_tl(cpu_A0, cpu_regs[s->vex_v], 8, 8); tcg_gen_movcond_tl(TCG_COND_LEU, cpu_A0, cpu_A0, bound, cpu_A0, bound); tcg_temp_free(bound); tcg_gen_movi_tl(cpu_T1, 1); tcg_gen_shl_tl(cpu_T1, cpu_T1, cpu_A0); tcg_gen_subi_tl(cpu_T1, cpu_T1, 1); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_T1); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_LOGICB + ot); } break; case 0x0f5: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); tcg_gen_ext8u_tl(cpu_T1, cpu_regs[s->vex_v]); { TCGv bound = tcg_const_tl(ot == MO_64 ? 63 : 31); tcg_gen_setcond_tl(TCG_COND_LT, cpu_cc_src, cpu_T1, bound); tcg_gen_movcond_tl(TCG_COND_GT, cpu_T1, cpu_T1, bound, bound, cpu_T1); tcg_temp_free(bound); } tcg_gen_movi_tl(cpu_A0, -1); tcg_gen_shl_tl(cpu_A0, cpu_A0, cpu_T1); tcg_gen_andc_tl(cpu_T0, cpu_T0, cpu_A0); gen_op_mov_reg_v(ot, reg, cpu_T0); gen_op_update1_cc(); set_cc_op(s, CC_OP_BMILGB + ot); break; case 0x3f6: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); switch (ot) { default: tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); tcg_gen_trunc_tl_i32(cpu_tmp3_i32, cpu_regs[R_EDX]); tcg_gen_mulu2_i32(cpu_tmp2_i32, cpu_tmp3_i32, cpu_tmp2_i32, cpu_tmp3_i32); tcg_gen_extu_i32_tl(cpu_regs[s->vex_v], cpu_tmp2_i32); tcg_gen_extu_i32_tl(cpu_regs[reg], cpu_tmp3_i32); break; #ifdef TARGET_X86_64 case MO_64: tcg_gen_mulu2_i64(cpu_T0, cpu_T1, cpu_T0, cpu_regs[R_EDX]); tcg_gen_mov_i64(cpu_regs[s->vex_v], cpu_T0); tcg_gen_mov_i64(cpu_regs[reg], cpu_T1); break; #endif } break; case 0x3f5: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); if (ot == MO_64) { tcg_gen_mov_tl(cpu_T1, cpu_regs[s->vex_v]); } else { tcg_gen_ext32u_tl(cpu_T1, cpu_regs[s->vex_v]); } gen_helper_pdep(cpu_regs[reg], cpu_T0, cpu_T1); break; case 0x2f5: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); if (ot == MO_64) { tcg_gen_mov_tl(cpu_T1, cpu_regs[s->vex_v]); } else { tcg_gen_ext32u_tl(cpu_T1, cpu_regs[s->vex_v]); } gen_helper_pext(cpu_regs[reg], cpu_T0, cpu_T1); break; case 0x1f6: case 0x2f6: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_ADX)) { goto illegal_op; } else { TCGv carry_in, carry_out, zero; int end_op; ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); TCGV_UNUSED(carry_in); carry_out = (b == 0x1f6 ? cpu_cc_dst : cpu_cc_src2); switch (s->cc_op) { case CC_OP_ADCX: if (b == 0x1f6) { carry_in = cpu_cc_dst; end_op = CC_OP_ADCX; } else { end_op = CC_OP_ADCOX; } break; case CC_OP_ADOX: if (b == 0x1f6) { end_op = CC_OP_ADCOX; } else { carry_in = cpu_cc_src2; end_op = CC_OP_ADOX; } break; case CC_OP_ADCOX: end_op = CC_OP_ADCOX; carry_in = carry_out; break; default: end_op = (b == 0x1f6 ? CC_OP_ADCX : CC_OP_ADOX); break; } if (TCGV_IS_UNUSED(carry_in)) { if (s->cc_op != CC_OP_ADCX && s->cc_op != CC_OP_ADOX) { gen_compute_eflags(s); } carry_in = cpu_tmp0; tcg_gen_extract_tl(carry_in, cpu_cc_src, ctz32(b == 0x1f6 ? CC_C : CC_O), 1); } switch (ot) { #ifdef TARGET_X86_64 case MO_32: tcg_gen_ext32u_i64(cpu_regs[reg], cpu_regs[reg]); tcg_gen_ext32u_i64(cpu_T0, cpu_T0); tcg_gen_add_i64(cpu_T0, cpu_T0, cpu_regs[reg]); tcg_gen_add_i64(cpu_T0, cpu_T0, carry_in); tcg_gen_ext32u_i64(cpu_regs[reg], cpu_T0); tcg_gen_shri_i64(carry_out, cpu_T0, 32); break; #endif default: zero = tcg_const_tl(0); tcg_gen_add2_tl(cpu_T0, carry_out, cpu_T0, zero, carry_in, zero); tcg_gen_add2_tl(cpu_regs[reg], carry_out, cpu_regs[reg], carry_out, cpu_T0, zero); tcg_temp_free(zero); break; } set_cc_op(s, end_op); } break; case 0x1f7: case 0x2f7: case 0x3f7: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); if (ot == MO_64) { tcg_gen_andi_tl(cpu_T1, cpu_regs[s->vex_v], 63); } else { tcg_gen_andi_tl(cpu_T1, cpu_regs[s->vex_v], 31); } if (b == 0x1f7) { tcg_gen_shl_tl(cpu_T0, cpu_T0, cpu_T1); } else if (b == 0x2f7) { if (ot != MO_64) { tcg_gen_ext32s_tl(cpu_T0, cpu_T0); } tcg_gen_sar_tl(cpu_T0, cpu_T0, cpu_T1); } else { if (ot != MO_64) { tcg_gen_ext32u_tl(cpu_T0, cpu_T0); } tcg_gen_shr_tl(cpu_T0, cpu_T0, cpu_T1); } gen_op_mov_reg_v(ot, reg, cpu_T0); break; case 0x0f3: case 0x1f3: case 0x2f3: case 0x3f3: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI1) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); switch (reg & 7) { case 1: tcg_gen_neg_tl(cpu_T1, cpu_T0); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_T1); gen_op_mov_reg_v(ot, s->vex_v, cpu_T0); gen_op_update2_cc(); set_cc_op(s, CC_OP_BMILGB + ot); break; case 2: tcg_gen_mov_tl(cpu_cc_src, cpu_T0); tcg_gen_subi_tl(cpu_T0, cpu_T0, 1); tcg_gen_xor_tl(cpu_T0, cpu_T0, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s, CC_OP_BMILGB + ot); break; case 3: tcg_gen_mov_tl(cpu_cc_src, cpu_T0); tcg_gen_subi_tl(cpu_T0, cpu_T0, 1); tcg_gen_and_tl(cpu_T0, cpu_T0, cpu_cc_src); tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); set_cc_op(s, CC_OP_BMILGB + ot); break; default: goto unknown_op; } break; default: goto unknown_op; } break; case 0x03a: case 0x13a: b = modrm; modrm = cpu_ldub_code(env, s->pc++); rm = modrm & 7; reg = ((modrm >> 3) & 7) | rex_r; mod = (modrm >> 6) & 3; if (b1 >= 2) { goto unknown_op; } sse_fn_eppi = sse_op_table7[b].op[b1]; if (!sse_fn_eppi) { goto unknown_op; } if (!(s->cpuid_ext_features & sse_op_table7[b].ext_mask)) goto illegal_op; s->rip_offset = 1; if (sse_fn_eppi == SSE_SPECIAL) { ot = mo_64_32(s->dflag); rm = (modrm & 7) | REX_B(s); if (mod != 3) gen_lea_modrm(env, s, modrm); reg = ((modrm >> 3) & 7) | rex_r; val = cpu_ldub_code(env, s->pc++); switch (b) { case 0x14: tcg_gen_ld8u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_B(val & 15))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_UB); } break; case 0x15: tcg_gen_ld16u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_W(val & 7))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_LEUW); } break; case 0x16: if (ot == MO_32) { tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); if (mod == 3) { tcg_gen_extu_i32_tl(cpu_regs[rm], cpu_tmp2_i32); } else { tcg_gen_qemu_st_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } } else { #ifdef TARGET_X86_64 tcg_gen_ld_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(val & 1))); if (mod == 3) { tcg_gen_mov_i64(cpu_regs[rm], cpu_tmp1_i64); } else { tcg_gen_qemu_st_i64(cpu_tmp1_i64, cpu_A0, s->mem_index, MO_LEQ); } #else goto illegal_op; #endif } break; case 0x17: tcg_gen_ld32u_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); if (mod == 3) { gen_op_mov_reg_v(ot, rm, cpu_T0); } else { tcg_gen_qemu_st_tl(cpu_T0, cpu_A0, s->mem_index, MO_LEUL); } break; case 0x20: if (mod == 3) { gen_op_mov_v_reg(MO_32, cpu_T0, rm); } else { tcg_gen_qemu_ld_tl(cpu_T0, cpu_A0, s->mem_index, MO_UB); } tcg_gen_st8_tl(cpu_T0, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_B(val & 15))); break; case 0x21: if (mod == 3) { tcg_gen_ld_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State,xmm_regs[rm] .ZMM_L((val >> 6) & 3))); } else { tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State,xmm_regs[reg] .ZMM_L((val >> 4) & 3))); if ((val >> 0) & 1) tcg_gen_st_i32(tcg_const_i32(0 ), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(0))); if ((val >> 1) & 1) tcg_gen_st_i32(tcg_const_i32(0 ), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(1))); if ((val >> 2) & 1) tcg_gen_st_i32(tcg_const_i32(0 ), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(2))); if ((val >> 3) & 1) tcg_gen_st_i32(tcg_const_i32(0 ), cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(3))); break; case 0x22: if (ot == MO_32) { if (mod == 3) { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[rm]); } else { tcg_gen_qemu_ld_i32(cpu_tmp2_i32, cpu_A0, s->mem_index, MO_LEUL); } tcg_gen_st_i32(cpu_tmp2_i32, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_L(val & 3))); } else { #ifdef TARGET_X86_64 if (mod == 3) { gen_op_mov_v_reg(ot, cpu_tmp1_i64, rm); } else { tcg_gen_qemu_ld_i64(cpu_tmp1_i64, cpu_A0, s->mem_index, MO_LEQ); } tcg_gen_st_i64(cpu_tmp1_i64, cpu_env, offsetof(CPUX86State, xmm_regs[reg].ZMM_Q(val & 1))); #else goto illegal_op; #endif } break; } return; } if (b1) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod == 3) { op2_offset = offsetof(CPUX86State,xmm_regs[rm | REX_B(s)]); } else { op2_offset = offsetof(CPUX86State,xmm_t0); gen_lea_modrm(env, s, modrm); gen_ldo_env_A0(s, op2_offset); } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod == 3) { op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } else { op2_offset = offsetof(CPUX86State,mmx_t0); gen_lea_modrm(env, s, modrm); gen_ldq_env_A0(s, op2_offset); } } val = cpu_ldub_code(env, s->pc++); if ((b & 0xfc) == 0x60) { set_cc_op(s, CC_OP_EFLAGS); if (s->dflag == MO_64) { val |= 1 << 8; } } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_eppi(cpu_env, cpu_ptr0, cpu_ptr1, tcg_const_i32(val)); break; case 0x33a: b = modrm | (b1 << 8); modrm = cpu_ldub_code(env, s->pc++); reg = ((modrm >> 3) & 7) | rex_r; switch (b) { case 0x3f0: if (!(s->cpuid_7_0_ebx_features & CPUID_7_0_EBX_BMI2) || !(s->prefix & PREFIX_VEX) || s->vex_l != 0) { goto illegal_op; } ot = mo_64_32(s->dflag); gen_ldst_modrm(env, s, modrm, ot, OR_TMP0, 0); b = cpu_ldub_code(env, s->pc++); if (ot == MO_64) { tcg_gen_rotri_tl(cpu_T0, cpu_T0, b & 63); } else { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); tcg_gen_rotri_i32(cpu_tmp2_i32, cpu_tmp2_i32, b & 31); tcg_gen_extu_i32_tl(cpu_T0, cpu_tmp2_i32); } gen_op_mov_reg_v(ot, reg, cpu_T0); break; default: goto unknown_op; } break; default: unknown_op: gen_unknown_opcode(env, s); return; } } else { switch(b) { case 0x70: case 0xc6: case 0xc2: s->rip_offset = 1; break; default: break; } if (is_xmm) { op1_offset = offsetof(CPUX86State,xmm_regs[reg]); if (mod != 3) { int sz = 4; gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,xmm_t0); switch (b) { case 0x50 ... 0x5a: case 0x5c ... 0x5f: case 0xc2: if (b1 == 2) { sz = 2; } else if (b1 == 3) { sz = 3; } break; case 0x2e: case 0x2f: if (b1 == 0) { sz = 2; } else { sz = 3; } break; } switch (sz) { case 2: gen_op_ld_v(s, MO_32, cpu_T0, cpu_A0); tcg_gen_st32_tl(cpu_T0, cpu_env, offsetof(CPUX86State,xmm_t0.ZMM_L(0))); break; case 3: gen_ldq_env_A0(s, offsetof(CPUX86State, xmm_t0.ZMM_D(0))); break; default: gen_ldo_env_A0(s, op2_offset); break; } } else { rm = (modrm & 7) | REX_B(s); op2_offset = offsetof(CPUX86State,xmm_regs[rm]); } } else { op1_offset = offsetof(CPUX86State,fpregs[reg].mmx); if (mod != 3) { gen_lea_modrm(env, s, modrm); op2_offset = offsetof(CPUX86State,mmx_t0); gen_ldq_env_A0(s, op2_offset); } else { rm = (modrm & 7); op2_offset = offsetof(CPUX86State,fpregs[rm].mmx); } } switch(b) { case 0x0f: val = cpu_ldub_code(env, s->pc++); sse_fn_epp = sse_op_table5[val]; if (!sse_fn_epp) { goto unknown_op; } if (!(s->cpuid_ext2_features & CPUID_EXT2_3DNOW)) { goto illegal_op; } tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0x70: case 0xc6: val = cpu_ldub_code(env, s->pc++); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_ppi = (SSEFunc_0_ppi)sse_fn_epp; sse_fn_ppi(cpu_ptr0, cpu_ptr1, tcg_const_i32(val)); break; case 0xc2: val = cpu_ldub_code(env, s->pc++); if (val >= 8) goto unknown_op; sse_fn_epp = sse_op_table4[val][b1]; tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; case 0xf7: if (mod != 3) goto illegal_op; tcg_gen_mov_tl(cpu_A0, cpu_regs[R_EDI]); gen_extu(s->aflag, cpu_A0); gen_add_A0_ds_seg(s); tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_eppt = (SSEFunc_0_eppt)sse_fn_epp; sse_fn_eppt(cpu_env, cpu_ptr0, cpu_ptr1, cpu_A0); break; default: tcg_gen_addi_ptr(cpu_ptr0, cpu_env, op1_offset); tcg_gen_addi_ptr(cpu_ptr1, cpu_env, op2_offset); sse_fn_epp(cpu_env, cpu_ptr0, cpu_ptr1); break; } if (b == 0x2e || b == 0x2f) { set_cc_op(s, CC_OP_EFLAGS); } } }
1threat
static int decode_block(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr) { EXRContext *s = avctx->priv_data; AVFrame *const p = s->picture; EXRThreadData *td = &s->thread_data[threadnr]; const uint8_t *channel_buffer[4] = { 0 }; const uint8_t *buf = s->buf; uint64_t line_offset, uncompressed_size; uint16_t *ptr_x; uint8_t *ptr; uint32_t data_size; uint64_t line, col = 0; uint64_t tile_x, tile_y, tile_level_x, tile_level_y; const uint8_t *src; int axmax = (avctx->width - (s->xmax + 1)) * 2 * s->desc->nb_components; int bxmin = s->xmin * 2 * s->desc->nb_components; int i, x, buf_size = s->buf_size; int c, rgb_channel_count; float one_gamma = 1.0f / s->gamma; avpriv_trc_function trc_func = avpriv_get_trc_function_from_trc(s->apply_trc_type); int ret; line_offset = AV_RL64(s->gb.buffer + jobnr * 8); if (s->is_tile) { if (line_offset > buf_size - 20) return AVERROR_INVALIDDATA; src = buf + line_offset + 20; tile_x = AV_RL32(src - 20); tile_y = AV_RL32(src - 16); tile_level_x = AV_RL32(src - 12); tile_level_y = AV_RL32(src - 8); data_size = AV_RL32(src - 4); if (data_size <= 0 || data_size > buf_size) return AVERROR_INVALIDDATA; if (tile_level_x || tile_level_y) { avpriv_report_missing_feature(s->avctx, "Subres tile before full res tile"); return AVERROR_PATCHWELCOME; } if (s->xmin || s->ymin) { avpriv_report_missing_feature(s->avctx, "Tiles with xmin/ymin"); return AVERROR_PATCHWELCOME; } line = s->tile_attr.ySize * tile_y; col = s->tile_attr.xSize * tile_x; if (line < s->ymin || line > s->ymax || col < s->xmin || col > s->xmax) return AVERROR_INVALIDDATA; td->ysize = FFMIN(s->tile_attr.ySize, s->ydelta - tile_y * s->tile_attr.ySize); td->xsize = FFMIN(s->tile_attr.xSize, s->xdelta - tile_x * s->tile_attr.xSize); if (col) { bxmin = 0; } if ((col + td->xsize) != s->xdelta) axmax = 0; td->channel_line_size = td->xsize * s->current_channel_offset; uncompressed_size = td->channel_line_size * (uint64_t)td->ysize; } else { if (line_offset > buf_size - 8) return AVERROR_INVALIDDATA; src = buf + line_offset + 8; line = AV_RL32(src - 8); if (line < s->ymin || line > s->ymax) return AVERROR_INVALIDDATA; data_size = AV_RL32(src - 4); if (data_size <= 0 || data_size > buf_size) return AVERROR_INVALIDDATA; td->ysize = FFMIN(s->scan_lines_per_block, s->ymax - line + 1); td->xsize = s->xdelta; td->channel_line_size = td->xsize * s->current_channel_offset; uncompressed_size = td->channel_line_size * (uint64_t)td->ysize; if ((s->compression == EXR_RAW && (data_size != uncompressed_size || line_offset > buf_size - uncompressed_size)) || (s->compression != EXR_RAW && (data_size > uncompressed_size || line_offset > buf_size - data_size))) { return AVERROR_INVALIDDATA; } } if (data_size < uncompressed_size || s->is_tile) { av_fast_padded_malloc(&td->tmp, &td->tmp_size, uncompressed_size); if (!td->tmp) return AVERROR(ENOMEM); } if (data_size < uncompressed_size) { av_fast_padded_malloc(&td->uncompressed_data, &td->uncompressed_size, uncompressed_size + 64); if (!td->uncompressed_data) return AVERROR(ENOMEM); ret = AVERROR_INVALIDDATA; switch (s->compression) { case EXR_ZIP1: case EXR_ZIP16: ret = zip_uncompress(s, src, data_size, uncompressed_size, td); break; case EXR_PIZ: ret = piz_uncompress(s, src, data_size, uncompressed_size, td); break; case EXR_PXR24: ret = pxr24_uncompress(s, src, data_size, uncompressed_size, td); break; case EXR_RLE: ret = rle_uncompress(s, src, data_size, uncompressed_size, td); break; case EXR_B44: case EXR_B44A: ret = b44_uncompress(s, src, data_size, uncompressed_size, td); break; } if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "decode_block() failed.\n"); return ret; } src = td->uncompressed_data; } if (!s->is_luma) { channel_buffer[0] = src + td->xsize * s->channel_offsets[0]; channel_buffer[1] = src + td->xsize * s->channel_offsets[1]; channel_buffer[2] = src + td->xsize * s->channel_offsets[2]; rgb_channel_count = 3; } else { channel_buffer[0] = src + td->xsize * s->channel_offsets[1]; rgb_channel_count = 1; } if (s->channel_offsets[3] >= 0) channel_buffer[3] = src + td->xsize * s->channel_offsets[3]; ptr = p->data[0] + line * p->linesize[0] + (col * s->desc->nb_components * 2); for (i = 0; i < td->ysize; i++, ptr += p->linesize[0]) { const uint8_t * a; const uint8_t *rgb[3]; for (c = 0; c < rgb_channel_count; c++){ rgb[c] = channel_buffer[c]; } if (channel_buffer[3]) a = channel_buffer[3]; ptr_x = (uint16_t *) ptr; memset(ptr_x, 0, bxmin); ptr_x += s->xmin * s->desc->nb_components; if (s->pixel_type == EXR_FLOAT) { if (trc_func) { for (x = 0; x < td->xsize; x++) { union av_intfloat32 t; for (c = 0; c < rgb_channel_count; c++) { t.i = bytestream_get_le32(&rgb[c]); t.f = trc_func(t.f); *ptr_x++ = exr_flt2uint(t.i); } if (channel_buffer[3]) *ptr_x++ = exr_flt2uint(bytestream_get_le32(&a)); } } else { for (x = 0; x < td->xsize; x++) { union av_intfloat32 t; int c; for (c = 0; c < rgb_channel_count; c++) { t.i = bytestream_get_le32(&rgb[c]); if (t.f > 0.0f) t.f = powf(t.f, one_gamma); *ptr_x++ = exr_flt2uint(t.i); } if (channel_buffer[3]) *ptr_x++ = exr_flt2uint(bytestream_get_le32(&a)); } } } else if (s->pixel_type == EXR_HALF) { for (x = 0; x < td->xsize; x++) { int c; for (c = 0; c < rgb_channel_count; c++) { *ptr_x++ = s->gamma_table[bytestream_get_le16(&rgb[c])]; } if (channel_buffer[3]) *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); } } else if (s->pixel_type == EXR_UINT) { for (x = 0; x < td->xsize; x++) { for (c = 0; c < rgb_channel_count; c++) { *ptr_x++ = bytestream_get_le32(&rgb[c]) >> 16; } if (channel_buffer[3]) *ptr_x++ = bytestream_get_le32(&a) >> 16; } } memset(ptr_x, 0, axmax); channel_buffer[0] += td->channel_line_size; channel_buffer[1] += td->channel_line_size; channel_buffer[2] += td->channel_line_size; if (channel_buffer[3]) channel_buffer[3] += td->channel_line_size; } return 0; }
1threat
Cocoapods error: linker command failed with exit code 1 (use -v to see invocation) : <p>First time using cocoa pods (latest version) for dependencies in the latest Xcode 7.2.1 with Swift 2.1. I initialize my project folder and then edit the podfile and add my dependencies. When I run <code>pod install</code> it runs without a hitch until I open my project and try to build. I've tried this with two separate projects (one being brand new for testing) and I get <code>linker command failed with exit code 1 (use -v to see invocation)</code> for both. My pod file looks like this:</p> <pre><code>platform :ios, '8.0' #8.0 is minimum supported, right? use_frameworks! target 'Testing Frameworks' do pod 'Alamofire', '~&gt; 3.0' end </code></pre>
0debug
void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, DeviceState *dev, Error **errp) { PCIDevice *pdev = PCI_DEVICE(dev); int slot = PCI_SLOT(pdev->devfn); int bsel = acpi_pcihp_get_bsel(pdev->bus); if (bsel < 0) { error_setg(errp, "Unsupported bus. Bus doesn't have property '" ACPI_PCIHP_PROP_BSEL "' set"); return; } if (!dev->hotplugged) { return; } s->acpi_pcihp_pci_status[bsel].up |= (1U << slot); acpi_send_event(DEVICE(hotplug_dev), ACPI_PCI_HOTPLUG_STATUS); }
1threat
static void tgen64_ori(TCGContext *s, TCGReg dest, tcg_target_ulong val) { static const S390Opcode oi_insns[4] = { RI_OILL, RI_OILH, RI_OIHL, RI_OIHH }; static const S390Opcode nif_insns[2] = { RIL_OILF, RIL_OIHF }; int i; if (val == 0) { return; } if (facilities & FACILITY_EXT_IMM) { for (i = 0; i < 4; i++) { tcg_target_ulong mask = (0xffffull << i*16); if ((val & mask) != 0 && (val & ~mask) == 0) { tcg_out_insn_RI(s, oi_insns[i], dest, val >> i*16); return; } } for (i = 0; i < 2; i++) { tcg_target_ulong mask = (0xffffffffull << i*32); if ((val & mask) != 0 && (val & ~mask) == 0) { tcg_out_insn_RIL(s, nif_insns[i], dest, val >> i*32); return; } } tgen64_ori(s, dest, val & 0x00000000ffffffffull); tgen64_ori(s, dest, val & 0xffffffff00000000ull); } else { for (i = 0; i < 4; i++) { tcg_target_ulong mask = (0xffffull << i*16); if ((val & mask) != 0) { tcg_out_insn_RI(s, oi_insns[i], dest, val >> i*16); } } } }
1threat
How do I separate out a sub-series in R? : I've got a csv file: id,device_id,type,value,timestamp 1432,4,temperature,21,2015-06-01T00:00:00Z 1433,4,motion,0,2015-06-01T00:00:15Z 1434,4,power,0,2015-06-01T00:00:30Z 1435,4,battery,4.16,2015-06-01T00:00:46Z 1448,4,temperature,21,2015-06-01T00:17:00Z 1449,4,motion,0,2015-06-01T00:17:15Z 1450,4,power,0,2015-06-01T00:17:30Z 1451,4,battery,4.16,2015-06-01T00:17:45Z 1464,4,temperature,21,2015-06-01T00:33:57Z ...... containing various sensor readings. It looks as though it represents four different time series, temperature, motion, power, and battery, with each reading taken at a slightly different time. Can I easily read in this file in R, and manipulate the data, say to plot the four graphs against the time? Or should I just pre-process it (e.g. in python or with grep) to make four different time series csvs first?
0debug
sql - how to make sure one admin account in database will not get deleted : I have tblUserAccounts with columns Username, Password, and UserLevel. It currently have only one row with Admin UserLevel. And in my C# program, only admin accounts can update / delete accounts. How can I prevent someone to delete all rows from tblUserAccounts and make sure there's always at least one Admin account? Help please...
0debug
Change platform on Elastic Beanstalk from PHP to Node.js : <p>I'm trying to change the platform on an existing Elastic Beanstalk instance from PHP 7 to Node.js. However, via the AWS Dashboard, I can only change/upgrade the version of PHP. </p> <p>Is it currently possible to make this change through the dashboard or command line? </p>
0debug
static void ne2000_write(void *opaque, target_phys_addr_t addr, uint64_t data, unsigned size) { NE2000State *s = opaque; if (addr < 0x10 && size == 1) { ne2000_ioport_write(s, addr, data); } else if (addr == 0x10) { if (size <= 2) { ne2000_asic_ioport_write(s, addr, data); } else { ne2000_asic_ioport_writel(s, addr, data); } } else if (addr == 0x1f && size == 1) { ne2000_reset_ioport_write(s, addr, data); } }
1threat
hello guys look my app i am facing weird & unexpected issue in android app : Hello guys my app is ready to install But problem faced when i install & debug app in device it's show 2 apps install in device (one open with Splashscreen & another open without Splashscreen ) plz find my error. here is manifest file below <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.soft.prmk.alle" android:versionCode="1" android:versionName="1.0" > <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <application android:hardwareAccelerated="true" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".SplashScreen" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest>
0debug
def sum_list(lst1,lst2): res_list = [lst1[i] + lst2[i] for i in range(len(lst1))] return res_list
0debug
how can I make BottomNavigationBar stick on top of keyboard flutter : <p>I am trying to make a simple chat app, so I created a scaffold and my body, will be the messages and my <code>bottomNavigationBar</code> would be my typing field and sending icon. </p> <p>I added a text field but when typing the navigation bar is hidden by the keyboard.</p> <p>this is the code of my <code>BottomNavigationBar</code> :</p> <pre><code>bottomNavigationBar: new Container( height: ScreenSize.height/12, /*color: Colors.red,*/ child: new Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: &lt;Widget&gt;[ new Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: &lt;Widget&gt;[ new Container( child: new Icon(Icons.send), width:ScreenSize.width/6, ), ], ), new Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: &lt;Widget&gt;[ Material( child: new Container( child: new TextField( autofocus: false, decoration: InputDecoration( contentPadding: EdgeInsets.all(9.0), border: InputBorder.none, hintText: 'Please enter a search term', ), ), width:ScreenSize.width*4/6, ), elevation: 4.0, /*borderRadius: new BorderRadius.all(new Radius.circular(45.0)),*/ clipBehavior: Clip.antiAlias, type: MaterialType.card, ) ], ), new Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: &lt;Widget&gt;[ new Container( child: Text('HELLO C1'), color: Colors.green, width:ScreenSize.width/6, ), ], ) ], ), ), </code></pre> <p>here is how it looks when focused :</p> <p><a href="https://i.stack.imgur.com/Ui883.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Ui883.png" alt="enter image description here"></a></p>
0debug
automatic login from email link : <p>I'm trying to create a link in (PHP), when clicked user automatically login in the website passing the authentication. Example: like Facebook is sending the link to verified your account after clicking browser open the Facebook and the user is login</p>
0debug
def lcopy(xs): return xs[:]
0debug
static void vfio_listener_region_add(MemoryListener *listener, MemoryRegionSection *section) { VFIOContainer *container = container_of(listener, VFIOContainer, listener); hwaddr iova, end; Int128 llend, llsize; void *vaddr; int ret; VFIOHostDMAWindow *hostwin; bool hostwin_found; if (vfio_listener_skipped_section(section)) { trace_vfio_listener_region_add_skip( section->offset_within_address_space, section->offset_within_address_space + int128_get64(int128_sub(section->size, int128_one()))); return; } if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) != (section->offset_within_region & ~TARGET_PAGE_MASK))) { error_report("%s received unaligned region", __func__); return; } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); llend = int128_make64(section->offset_within_address_space); llend = int128_add(llend, section->size); llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK)); if (int128_ge(int128_make64(iova), llend)) { return; } end = int128_get64(int128_sub(llend, int128_one())); if (container->iommu_type == VFIO_SPAPR_TCE_v2_IOMMU) { VFIOHostDMAWindow *hostwin; hwaddr pgsize = 0; QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) { if (ranges_overlap(hostwin->min_iova, hostwin->max_iova - hostwin->min_iova + 1, section->offset_within_address_space, int128_get64(section->size))) { ret = -1; goto fail; } } ret = vfio_spapr_create_window(container, section, &pgsize); if (ret) { goto fail; } vfio_host_win_add(container, section->offset_within_address_space, section->offset_within_address_space + int128_get64(section->size) - 1, pgsize); } hostwin_found = false; QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) { if (hostwin->min_iova <= iova && end <= hostwin->max_iova) { hostwin_found = true; break; } } if (!hostwin_found) { error_report("vfio: IOMMU container %p can't map guest IOVA region" " 0x%"HWADDR_PRIx"..0x%"HWADDR_PRIx, container, iova, end); ret = -EFAULT; goto fail; } memory_region_ref(section->mr); if (memory_region_is_iommu(section->mr)) { VFIOGuestIOMMU *giommu; trace_vfio_listener_region_add_iommu(iova, end); giommu = g_malloc0(sizeof(*giommu)); giommu->iommu = section->mr; giommu->iommu_offset = section->offset_within_address_space - section->offset_within_region; giommu->container = container; giommu->n.notify = vfio_iommu_map_notify; giommu->n.notifier_flags = IOMMU_NOTIFIER_ALL; QLIST_INSERT_HEAD(&container->giommu_list, giommu, giommu_next); memory_region_register_iommu_notifier(giommu->iommu, &giommu->n); memory_region_iommu_replay(giommu->iommu, &giommu->n, false); return; } vaddr = memory_region_get_ram_ptr(section->mr) + section->offset_within_region + (iova - section->offset_within_address_space); trace_vfio_listener_region_add_ram(iova, end, vaddr); llsize = int128_sub(llend, int128_make64(iova)); ret = vfio_dma_map(container, iova, int128_get64(llsize), vaddr, section->readonly); if (ret) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx", %p) = %d (%m)", container, iova, int128_get64(llsize), vaddr, ret); goto fail; } return; fail: if (!container->initialized) { if (!container->error) { container->error = ret; } } else { hw_error("vfio: DMA mapping failed, unable to continue"); } }
1threat
How to separate from 1 column to multiple column MS SQL SERVER : i have table need to separate the data to multiple column. "Site Name","PJ.143 USJ 1| 2A (MP)","PMAC ID:","0067","Channel No:","01" How to separate from 1 column to multiple column MS SQL SERVER Thanks.
0debug
progblem with triggers in pl/sql : SQL> get f:/sqlprog/trigger_3; 1 create or replace trigger t2 before insert or update on programmer for each row 2 declare 3 cursor c1 is select prof1, prof2 from programmer; 4 beign 5 for r1 in c1 loop 6 if r1.pname=:new.pname then 7 if :new.prof1=: new.prof2 then 8 raise_application_error(-20091,'prof1 and prof2 should not be same'); 9 end if; 10 end if; 11 end loop; 12* end; SQL> / Warning: Trigger created with compilation errors. SQL> show errors Errors for TRIGGER T2: LINE/COL ERROR -------- ----------------------------------------------------------------- 4/1 PLS-00103: Encountered the symbol "FOR" when expecting one of the following: constant exception <an identifier> <a double-quoted delimited-identifier> table long double ref char time timestamp interval date binary national character nchar 6/15 PLS-00103: Encountered the symbol ":" when expecting one of the following: ( - + all case mod new null <an identifier> <a double-quoted delimited-identifier> <a bind variable> LINE/COL ERROR -------- ----------------------------------------------------------------- continue any avg count current max min prior some sql stddev sum variance execute forall merge time timestamp interval date <a string literal with character set specification> <a number> <a single-quoted SQL string> pipe <an alternatively-quoted string literal with character set specification> <an alternative SQL> these are the errors which i encountered and the table regarding programmer is given below prof1=proficieny 1 prof2= proficieny 2 SQL> desc programmer; Name Null? Type ----------------------------------------- -------- ---------------------------- PNAME VARCHAR2(20) DOB DATE DOJ DATE SEX CHAR(1) PROF1 VARCHAR2(10) PROF2 VARCHAR2(10) SALARY NUMBER(5) i dont have any idea why i am getting them pls help me out thank youin advance.
0debug
Dynamic char array from class dont printing the proper result : <p>i am making a project in which user will add the info of car and one function will show all the available cars.But the i cannot be able to copy names of car from one array to another here is the code.</p> <pre><code>#include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;stdio.h&gt; #include &lt;conio.h&gt; #include &lt;string.h&gt; using namespace std; const int SIZE=10; class car { public: int car_no=0; char car_name[SIZE][20]; char car_model[SIZE][20]; char car_colour[SIZE][20]; char reg_id[SIZE][20]; int rate_per_day[SIZE]; char cars_in_lot[SIZE][20]; }; addcar() { char choice; do{ car*newcar=new car; cout&lt;&lt;"\t\t\t\t(-&gt;) Name : "; cin&gt;&gt;newcar-&gt;car_name[newcar-&gt;car_no]; strcpy(newcar-&gt;cars_in_lot[newcar-&gt;car_no],newcar-&gt;car_name[newcar-&gt;car_no]); cout&lt;&lt;endl; cout&lt;&lt;"\t\t\t\t(-&gt;) reg!str@t!0n number : "; cin&gt;&gt;newcar-&gt;reg_id[newcar-&gt;car_no]; cout&lt;&lt;endl; cout&lt;&lt;"\t\t\t\t(-&gt;) c0l0ur : "; cin&gt;&gt;newcar-&gt;car_colour[newcar-&gt;car_no]; cout&lt;&lt;endl; cout&lt;&lt;"\t\t\t\t(-&gt;) Model : "; cin&gt;&gt;newcar-&gt;car_model[newcar-&gt;car_no]; cout&lt;&lt;endl; cout&lt;&lt;"\t\t\t\t(-&gt;) Rate of Rent Per Day : "; cin&gt;&gt;newcar-&gt;rate_per_day[newcar-&gt;car_no]; newcar-&gt;car_no++; cout&lt;&lt;"Want to add another car [y/n]"&lt;&lt;endl; cin&gt;&gt;choice; }while(choice == 'y' || choice == 'Y'); } void show_cars_in_lot() { cout&lt;&lt;"Avaialable Cars in Lot are : "&lt;&lt;endl; car*newcar=new car; for(int i=0;i&lt;SIZE;i++) cout&lt;&lt;i+1&lt;&lt;"\t"&lt;&lt;newcar-&gt;cars_in_lot[i]&lt;&lt;"\t"&lt;&lt;newcar-&gt;car_colour[i] &lt;&lt;"\t"&lt;&lt;newcar-&gt;car_model[i]&lt;&lt;"\t"&lt;&lt;newcar-&gt;reg_id[i]&lt;&lt;endl; getch(); } void display1() { cout&lt;&lt;"\t\t\t(1) Show Cars in Lot"&lt;&lt;endl; cout&lt;&lt;"\t\t\t(2) Add Cars"&lt;&lt;endl; }// end of display1 int main() { char option; int desire_car; do { int choice; display1(); cout&lt;&lt;"Enter Your Choice : "; cin&gt;&gt;choice; switch(choice) { case 1: show_cars_in_lot();break; case 2: addcar();break; default: cout&lt;&lt;"You Entered Wrong Input"&lt;&lt;endl; } cout&lt;&lt;"Go To Main Menu [y/n]";cin&gt;&gt;option; }while(option == 'y' || option == 'Y'); return 0; } </code></pre>
0debug
Schema.org in JSON LD format recognized by Google, but Facebook pixel helper does not detect it : <p>I have added schema.org tags in <code>JSON LD</code> format using <code>&lt;script&gt;</code>, when I test my page using <a href="https://search.google.com/structured-data/testing-tool/u/0/" rel="noreferrer">Google structured data testing tool</a>, I can see all my tags.</p> <p>But, when I installed <a href="https://chrome.google.com/webstore/detail/facebook-pixel-helper/fdgfkebogiimcoedlicjlajpkdmockpc?hl=en" rel="noreferrer">Facebook pixel helper chrome extension</a> to test my page, schema.org tags were shown as blank. Not sure why Facebook pixel helper is not able to detect it.</p> <p>Would appreciate any help.</p>
0debug
Is it possible to return only a part of an object? : <p>I have a class with 10 variables, for example. I create an instance of it and I return it, and, obviously, it returns the 10 variables.</p> <p>What I'd like to know is if is it possible to return an object made of (for example) the 5 first variables.</p>
0debug
void vnc_display_open(const char *id, Error **errp) { VncDisplay *vs = vnc_display_find(id); QemuOpts *opts = qemu_opts_find(&qemu_vnc_opts, id); QemuOpts *sopts, *wsopts; const char *share, *device_id; QemuConsole *con; bool password = false; bool reverse = false; const char *vnc; const char *has_to; char *h; bool has_ipv4 = false; bool has_ipv6 = false; const char *websocket; bool tls = false, x509 = false; #ifdef CONFIG_VNC_TLS const char *path; #endif bool sasl = false; #ifdef CONFIG_VNC_SASL int saslErr; #endif #if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL) int acl = 0; #endif int lock_key_sync = 1; if (!vs) { error_setg(errp, "VNC display not active"); return; } vnc_display_close(vs); if (!opts) { return; } vnc = qemu_opt_get(opts, "vnc"); if (!vnc || strcmp(vnc, "none") == 0) { return; } sopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); wsopts = qemu_opts_create(&socket_optslist, NULL, 0, &error_abort); h = strrchr(vnc, ':'); if (h) { char *host = g_strndup(vnc, h - vnc); qemu_opt_set(sopts, "host", host, &error_abort); qemu_opt_set(wsopts, "host", host, &error_abort); qemu_opt_set(sopts, "port", h+1, &error_abort); g_free(host); } else { error_setg(errp, "no vnc port specified"); goto fail; } has_to = qemu_opt_get(opts, "to"); has_ipv4 = qemu_opt_get_bool(opts, "ipv4", false); has_ipv6 = qemu_opt_get_bool(opts, "ipv6", false); if (has_to) { qemu_opt_set(sopts, "to", has_to, &error_abort); qemu_opt_set(wsopts, "to", has_to, &error_abort); } if (has_ipv4) { qemu_opt_set(sopts, "ipv4", "on", &error_abort); qemu_opt_set(wsopts, "ipv4", "on", &error_abort); } if (has_ipv6) { qemu_opt_set(sopts, "ipv6", "on", &error_abort); qemu_opt_set(wsopts, "ipv6", "on", &error_abort); } password = qemu_opt_get_bool(opts, "password", false); if (password && fips_get_state()) { error_setg(errp, "VNC password auth disabled due to FIPS mode, " "consider using the VeNCrypt or SASL authentication " "methods as an alternative"); goto fail; } reverse = qemu_opt_get_bool(opts, "reverse", false); lock_key_sync = qemu_opt_get_bool(opts, "lock-key-sync", true); sasl = qemu_opt_get_bool(opts, "sasl", false); #ifndef CONFIG_VNC_SASL if (sasl) { error_setg(errp, "VNC SASL auth requires cyrus-sasl support"); goto fail; } #endif tls = qemu_opt_get_bool(opts, "tls", false); #ifdef CONFIG_VNC_TLS path = qemu_opt_get(opts, "x509"); if (!path) { path = qemu_opt_get(opts, "x509verify"); if (path) { vs->tls.x509verify = true; } } if (path) { x509 = true; if (vnc_tls_set_x509_creds_dir(vs, path) < 0) { error_setg(errp, "Failed to find x509 certificates/keys in %s", path); goto fail; } } #else if (tls) { error_setg(errp, "VNC TLS auth requires gnutls support"); goto fail; } #endif #if defined(CONFIG_VNC_TLS) || defined(CONFIG_VNC_SASL) acl = qemu_opt_get_bool(opts, "acl", false); #endif share = qemu_opt_get(opts, "share"); if (share) { if (strcmp(share, "ignore") == 0) { vs->share_policy = VNC_SHARE_POLICY_IGNORE; } else if (strcmp(share, "allow-exclusive") == 0) { vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE; } else if (strcmp(share, "force-shared") == 0) { vs->share_policy = VNC_SHARE_POLICY_FORCE_SHARED; } else { error_setg(errp, "unknown vnc share= option"); goto fail; } } else { vs->share_policy = VNC_SHARE_POLICY_ALLOW_EXCLUSIVE; } vs->connections_limit = qemu_opt_get_number(opts, "connections", 32); websocket = qemu_opt_get(opts, "websocket"); if (websocket) { #ifdef CONFIG_VNC_WS vs->ws_enabled = true; qemu_opt_set(wsopts, "port", websocket, &error_abort); #else error_setg(errp, "Websockets protocol requires gnutls support"); goto fail; #endif } #ifdef CONFIG_VNC_JPEG vs->lossy = qemu_opt_get_bool(opts, "lossy", false); #endif vs->non_adaptive = qemu_opt_get_bool(opts, "non-adaptive", false); if (!vs->lossy) { vs->non_adaptive = true; } #ifdef CONFIG_VNC_TLS if (acl && x509 && vs->tls.x509verify) { char *aclname; if (strcmp(vs->id, "default") == 0) { aclname = g_strdup("vnc.x509dname"); } else { aclname = g_strdup_printf("vnc.%s.x509dname", vs->id); } vs->tls.acl = qemu_acl_init(aclname); if (!vs->tls.acl) { fprintf(stderr, "Failed to create x509 dname ACL\n"); exit(1); } g_free(aclname); } #endif #ifdef CONFIG_VNC_SASL if (acl && sasl) { char *aclname; if (strcmp(vs->id, "default") == 0) { aclname = g_strdup("vnc.username"); } else { aclname = g_strdup_printf("vnc.%s.username", vs->id); } vs->sasl.acl = qemu_acl_init(aclname); if (!vs->sasl.acl) { fprintf(stderr, "Failed to create username ACL\n"); exit(1); } g_free(aclname); } #endif vnc_display_setup_auth(vs, password, sasl, tls, x509); #ifdef CONFIG_VNC_SASL if ((saslErr = sasl_server_init(NULL, "qemu")) != SASL_OK) { error_setg(errp, "Failed to initialize SASL auth: %s", sasl_errstring(saslErr, NULL, NULL)); goto fail; } #endif vs->lock_key_sync = lock_key_sync; device_id = qemu_opt_get(opts, "display"); if (device_id) { DeviceState *dev; int head = qemu_opt_get_number(opts, "head", 0); dev = qdev_find_recursive(sysbus_get_default(), device_id); if (dev == NULL) { error_setg(errp, "Device '%s' not found", device_id); goto fail; } con = qemu_console_lookup_by_device(dev, head); if (con == NULL) { error_setg(errp, "Device %s is not bound to a QemuConsole", device_id); goto fail; } } else { con = NULL; } if (con != vs->dcl.con) { unregister_displaychangelistener(&vs->dcl); vs->dcl.con = con; register_displaychangelistener(&vs->dcl); } if (reverse) { int csock; vs->lsock = -1; #ifdef CONFIG_VNC_WS vs->lwebsock = -1; #endif if (strncmp(vnc, "unix:", 5) == 0) { csock = unix_connect(vnc+5, errp); } else { csock = inet_connect(vnc, errp); } if (csock < 0) { goto fail; } vnc_connect(vs, csock, false, false); } else { if (strncmp(vnc, "unix:", 5) == 0) { vs->lsock = unix_listen(vnc+5, NULL, 0, errp); vs->is_unix = true; } else { vs->lsock = inet_listen_opts(sopts, 5900, errp); if (vs->lsock < 0) { goto fail; } #ifdef CONFIG_VNC_WS if (vs->ws_enabled) { vs->lwebsock = inet_listen_opts(wsopts, 0, errp); if (vs->lwebsock < 0) { if (vs->lsock != -1) { close(vs->lsock); vs->lsock = -1; } goto fail; } } #endif } vs->enabled = true; qemu_set_fd_handler2(vs->lsock, NULL, vnc_listen_regular_read, NULL, vs); #ifdef CONFIG_VNC_WS if (vs->ws_enabled) { qemu_set_fd_handler2(vs->lwebsock, NULL, vnc_listen_websocket_read, NULL, vs); } #endif } qemu_opts_del(sopts); qemu_opts_del(wsopts); return; fail: qemu_opts_del(sopts); qemu_opts_del(wsopts); vs->enabled = false; #ifdef CONFIG_VNC_WS vs->ws_enabled = false; #endif }
1threat
Fatal error: use of unimplemented initializer in custom navigationcontroller : <p>I'm creating a custom navigation controller. I have something like this:</p> <pre><code>public class CustomNavigationController: UINavigationController { // MARK: - Life Cycle override init(rootViewController: UIViewController) { super.init(rootViewController: rootViewController) delegate = self } required public init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) delegate = self } } </code></pre> <p>I wanted to test this out so I created a CustomNavigationController like this:</p> <pre><code>CustomNavigationController(rootViewController: ViewController()) </code></pre> <p>When I run the app I get this:</p> <pre><code>fatal error: use of unimplemented initializer 'init(nibName:bundle:)' for class 'TestApp.CustomNavigationController' </code></pre> <p>I don't see the problem, can anyone help me out?</p>
0debug
static void neon_store_scratch(int scratch, TCGv var) { tcg_gen_st_i32(var, cpu_env, offsetof(CPUARMState, vfp.scratch[scratch])); dead_tmp(var); }
1threat
A field of a struct which consists of 3 items. How can this compile? : <p>I've seen code like this:</p> <pre><code>type Product struct { Name string `db:"product_name"` Id int `db:"id"` } type Stocks { Name string `db:"stock_name"` Price float `db:"price"` Type string `db:"type"` } </code></pre> <p>Although this code compiles, how can it be? A member of a struct must consist of a name and a following type. However, here there's also <code>db:"product_name"</code> which is the 3rd member</p> <p>How can this be valid? What's <code>db:"product_name"</code> from the perspective of Go?</p>
0debug
static void update_odml_entry(AVFormatContext *s, int stream_index, int64_t ix) { AVIOContext *pb = s->pb; AVIContext *avi = s->priv_data; AVIStream *avist = s->streams[stream_index]->priv_data; int64_t pos; int au_byterate, au_ssize, au_scale; avio_flush(pb); pos = avio_tell(pb); avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); ffio_wfourcc(pb, "indx"); avio_skip(pb, 8); avio_wl32(pb, avi->riff_id); avio_skip(pb, 16 * avi->riff_id); avio_wl64(pb, ix); avio_wl32(pb, pos - ix); ff_parse_specific_params(s->streams[stream_index], &au_byterate, &au_ssize, &au_scale); if (s->streams[stream_index]->codec->codec_type == AVMEDIA_TYPE_AUDIO && au_ssize > 0) { uint32_t audio_segm_size = (avist->audio_strm_length - avist->indexes.audio_strm_offset); if ((audio_segm_size % au_ssize > 0) && !avist->sample_requested) { avpriv_request_sample(s, "OpenDML index duration for audio packets with partial frames"); avist->sample_requested = 1; } avio_wl32(pb, audio_segm_size / au_ssize); } else avio_wl32(pb, avist->indexes.entry); avio_seek(pb, pos, SEEK_SET); }
1threat
Environment variable set in batch file cannot be accessed in the C code compiled by the file : <p>I'm setting a var using <code>set TEST_VAR=5</code> and then I'm compiling a C code. Error found during compilation is TEST_VAR is an undeclared variable.</p>
0debug
Passing data with unwind segue : <p>I created two view controllers. I created a segue from the first to the second to pass data. Now I want to pass data from the second view controller to the first one. I went through many similar questions and I'm not able to implement those as I lack the knowledge on how unwinding works. </p> <p><strong>ViewController.swift</strong></p> <pre><code>class ViewController: UIViewController { var dataRecieved: String? @IBOutlet weak var labelOne: UILabel! @IBAction func buttonOne(sender: UIButton) { performSegueWithIdentifier("viewNext", sender: self) } override func prepareForSegue(segue: (UIStoryboardSegue!), sender: AnyObject!) { var svc: viewControllerB = segue.destinationViewController as! viewControllerB svc.dataPassed = labelOne.text } } </code></pre> <p>This will pass the data to dataPassed in view controller "viewControllerB". Say, now I want to pass some data from viewControllerB to dataRecieved in ViewController. How can I do this with only unwind segue and not by using delegate. I'm quite new to swift, would appreciate a detailed explanation.</p>
0debug
How can you get python to detect strings from integers : <p>In my program I need a hand in trying to get python to say that a input is invalid, the code asks for numbers, if you input a letter I would like it to say its invalid rather than breaking, is there any way I can do this?</p>
0debug
Need to hide button until quiz is submitted : <p>I am needing to hide the button at the bottom that says "chapter two" until the quiz above is submitted. There is already a class being added when the quiz is submitted that is called "qmn_results_page"</p> <p>So, ideally, I can write something that would say when "qmn_results_page" is on the page, show "quiz_button"</p> <p>Is this a thing? Javascript is not my forte! </p> <p>Here is the link: <a href="http://adventuretoward.com/client/kids247/chapter-one-questions/" rel="nofollow noreferrer">http://adventuretoward.com/client/kids247/chapter-one-questions/</a></p>
0debug
static int mov_create_chapter_track(AVFormatContext *s, int tracknum) { MOVMuxContext *mov = s->priv_data; MOVTrack *track = &mov->tracks[tracknum]; AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; int i, len; uint8_t chapter_properties[43] = { 0, 0, 0, 0, 0, 0, 0, 1, }; track->mode = mov->mode; track->tag = MKTAG('t','e','x','t'); track->timescale = MOV_TIMESCALE; track->enc = avcodec_alloc_context3(NULL); if (!track->enc) track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; track->enc->extradata = av_malloc(sizeof(chapter_properties)); if (track->enc->extradata == NULL) track->enc->extradata_size = sizeof(chapter_properties); memcpy(track->enc->extradata, chapter_properties, sizeof(chapter_properties)); for (i = 0; i < s->nb_chapters; i++) { AVChapter *c = s->chapters[i]; AVDictionaryEntry *t; int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.duration = end - pkt.dts; if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { len = strlen(t->value); pkt.size = len + 2; pkt.data = av_malloc(pkt.size); AV_WB16(pkt.data, len); memcpy(pkt.data + 2, t->value, len); ff_mov_write_packet(s, &pkt); av_freep(&pkt.data); } } return 0; }
1threat
Ruby: split number into equal parts or what's closest to that : I have a random number and I would like to divide it into several parts (addends) with conditions that a part can not be more than 20 and the parts must be as close to each other as possible. For example, if my random number is 41, addends should be 14, 14, 13. If random number is 60 addends should be 20, 20, 20. If random number is 21 addends should be 11 and 10 and so on. My code is in Ruby (Rails) so I would most appreciate an answer which gives an efficient implementation of this in Ruby, though pseudo-code or other programming languages are welcome as well. **Update:** --- This is what I found for arrays but I really need to do this thing with numbers: http://stackoverflow.com/questions/12374645/splitting-an-array-into-equal-parts-in-ruby
0debug
I am stuck with this code, kindly guide me - get & set methods in Java? : <p>I am stuck in this below code, especially the below part</p> <pre><code>public String getBalanceForCid(double balance){ double b = 0; if (cid = custid) b = balance; else b; return b; } </code></pre> <p>Please guide me the right way.</p> <h2>Here is full code fyr</h2> <pre><code>package practices; public class Bank { public Bank(){ cid = 0; cname = ""; actno = 0; balance = 0; } public Bank(int custid, String custname, int custno, double custbal){ cid = custid; cname = custname; actno = custno; balance = custbal; } public void setCustid(int custid){ cid = custid; } public void setCustname(String custname){ cname = custname; } public void setCustno(int custno){ actno = custno; } public void setCustbal(double custbal){ balance = custbal; } public int getCustoid(){ return cid; } public String getCustname(){ return cname; } public int getCustno(){ return actno; } public double getCustbal(){ return balance; } public String getBalanceForCid(double balance){ double b = 0; if (cid = custid) b = balance; else b; return b; } private int cid; private String cname; private int actno; private double balance; } </code></pre> <p>above is my challenge (I am typing this message here again because I am getting message from SOF to add more details</p>
0debug
Can't find node_modules after deployment : <p><strong>This title might be a bit misleading but please bear with me for a while.</strong></p> <p>I have made a simple <code>Angular2</code> app on visual studio 2015 and now I have <code>published it on Azure</code>.</p> <p>Having node_modules in the development environment was perfect but after deploying it shows error saying can't find node_modules.</p> <p>Here is how I am referring in my development env in <strong><em>index.html</em></strong>-</p> <pre><code>&lt;!-- Polyfill(s) for older browsers --&gt; &lt;script src="/node_modules/core-js/client/shim.min.js"&gt;&lt;/script&gt; &lt;script src="/node_modules/zone.js/dist/zone.js"&gt;&lt;/script&gt; &lt;script src="/node_modules/reflect-metadata/Reflect.js"&gt;&lt;/script&gt; &lt;script src="/node_modules/systemjs/dist/system.src.js"&gt;&lt;/script&gt; &lt;script src="/systemjs.config.js"&gt;&lt;/script&gt; </code></pre> <p>Its also referred in <strong><em>system.config.js</em></strong>-</p> <pre><code>/** * System configuration for Angular 2 samples * Adjust as necessary for your application needs. */ (function(global) { // map tells the System loader where to look for things var map = { 'app': '/app', // 'dist', '@angular': '/node_modules/@angular', 'angular2-in-memory-web-api': '/node_modules/angular2-in-memory-web-api', 'rxjs': '/node_modules/rxjs' }; // packages tells the System loader how to load when no filename and/or no extension var packages = { 'app': { main: 'main.js', defaultExtension: 'js' }, 'rxjs': { defaultExtension: 'js' }, 'angular2-in-memory-web-api': { main: 'index.js', defaultExtension: 'js' }, }; var ngPackageNames = [ 'common', 'compiler', 'core', 'forms', 'http', 'platform-browser', 'platform-browser-dynamic', 'router', 'router-deprecated', 'upgrade', ]; // Individual files (~300 requests): function packIndex(pkgName) { packages['@angular/'+pkgName] = { main: 'index.js', defaultExtension: 'js' }; } // Bundled (~40 requests): function packUmd(pkgName) { packages['@angular/'+pkgName] = { main: '/bundles/' + pkgName + '.umd.js', defaultExtension: 'js' }; } // Most environments should use UMD; some (Karma) need the individual index files var setPackageConfig = System.packageWithIndex ? packIndex : packUmd; // Add package entries for angular packages ngPackageNames.forEach(setPackageConfig); // No umd for router yet packages['@angular/router'] = { main: 'index.js', defaultExtension: 'js' }; var config = { map: map, packages: packages }; System.config(config); })(this); </code></pre> <p>The error makes sense as I have a .gitignore file which doesn't let the node_modules to deploy to server. </p> <p>Can someone please assist as to how I can run it after deploying and what change could be done with the above references in order to make it work.</p>
0debug
Nested rows in bootsrap grid : I would create grid in Bootstrap 3.3.7 which is nested in another parent grid. Here's the HTML **Parent component** <div> <div class="row"> <div class="col-md-3 border">.col-md-3</div> // <div class="col-md-9 border"> <nested-app></nested-app> // should have 9 cols </div> </div> </div> **Nested component** // Should have 9 cols <div class="row"> <div class="col-md-1 border">.col-md</div> <div class="col-md-3 border">.col-md-4</div> <div class="col-md-4 border">.col-md-4</div> <div class="col-md-4 border">.col-md-4</div> </div> The problem is that the width of `col-md-1` inside nested component is not the same as `col-md-1` in parent component. [here's an example][1] ( open in new windows for desktop view) So my question how can I make same size of columns as parent grid in nested grid ? [1]: https://stackblitz.com/edit/angular-bootstrap-grid?file=app/app.component.ts
0debug
def slope(x1,y1,x2,y2): return (float)(y2-y1)/(x2-x1)
0debug
Swift unexpectedly found nil when there is actual value : <p>I have following code:</p> <pre><code>class User { var listsDict : [String : List]! func addList (list : List) -&gt; Void { print(list.name) listsDict[list.name] = list } func listForName (name: String) -&gt; List? { return listsDict[name] } } class List { let name : String var movies : Set&lt;String&gt; init(name: String){ self.name = name movies = Set&lt;String&gt;() } func printList (){ print(movies) } } var list = List(name: "List") list.movies = Set&lt;String&gt;(["LOTR", "SAW", "POC"]) list.printList() var johny = User() johny.addList(list: list) </code></pre> <p>When i call <code>johny.addList(list: list)</code> i got an error:</p> <pre><code>unexpectedly found nil while unwrapping an Optional value </code></pre> <p>But there is a value. I created instance of list previously and even print in log name of list (and it successfully printed). Why i got an error?</p>
0debug
static av_cold int cook_decode_init(AVCodecContext *avctx) { COOKContext *q = avctx->priv_data; const uint8_t *edata_ptr = avctx->extradata; const uint8_t *edata_ptr_end = edata_ptr + avctx->extradata_size; int extradata_size = avctx->extradata_size; int s = 0; unsigned int channel_mask = 0; int samples_per_frame; int ret; q->avctx = avctx; if (extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n"); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size); if (!avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR_INVALIDDATA; } av_lfg_init(&q->random_state, 0); ff_audiodsp_init(&q->adsp); while (edata_ptr < edata_ptr_end) { if (extradata_size >= 8) { q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr); samples_per_frame = bytestream_get_be16(&edata_ptr); q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } if (extradata_size >= 8) { bytestream_get_be32(&edata_ptr); q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr); q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } q->subpacket[s].samples_per_channel = samples_per_frame / avctx->channels; q->subpacket[s].bits_per_subpacket = avctx->block_align * 8; q->subpacket[s].log2_numvector_size = 5; q->subpacket[s].total_subbands = q->subpacket[s].subbands; q->subpacket[s].num_channels = 1; av_log(avctx, AV_LOG_DEBUG, "subpacket[%i].cookversion=%x\n", s, q->subpacket[s].cookversion); q->subpacket[s].joint_stereo = 0; switch (q->subpacket[s].cookversion) { case MONO: if (avctx->channels != 1) { avpriv_request_sample(avctx, "Container channels != 1"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "MONO\n"); break; case STEREO: if (avctx->channels != 1) { q->subpacket[s].bits_per_subpdiv = 1; q->subpacket[s].num_channels = 2; } av_log(avctx, AV_LOG_DEBUG, "STEREO\n"); break; case JOINT_STEREO: if (avctx->channels != 2) { avpriv_request_sample(avctx, "Container channels != 2"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "JOINT_STEREO\n"); if (avctx->extradata_size >= 16) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; } if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } break; case MC_COOK: av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n"); if (extradata_size >= 4) channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr); if (av_get_channel_layout_nb_channels(q->subpacket[s].channel_mask) > 1) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; q->subpacket[s].samples_per_channel = samples_per_frame >> 1; if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } } else q->subpacket[s].samples_per_channel = samples_per_frame; break; default: avpriv_request_sample(avctx, "Cook version %d", q->subpacket[s].cookversion); return AVERROR_PATCHWELCOME; } if (s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) { av_log(avctx, AV_LOG_ERROR, "different number of samples per channel!\n"); return AVERROR_INVALIDDATA; } else q->samples_per_channel = q->subpacket[0].samples_per_channel; q->subpacket[s].numvector_size = (1 << q->subpacket[s].log2_numvector_size); if (q->subpacket[s].total_subbands > 53) { avpriv_request_sample(avctx, "total_subbands > 53"); return AVERROR_PATCHWELCOME; } if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 2 * q->subpacket[s].joint_stereo)) { av_log(avctx, AV_LOG_ERROR, "js_vlc_bits = %d, only >= %d and <= 6 allowed!\n", q->subpacket[s].js_vlc_bits, 2 * q->subpacket[s].joint_stereo); return AVERROR_INVALIDDATA; } if (q->subpacket[s].subbands > 50) { avpriv_request_sample(avctx, "subbands > 50"); return AVERROR_PATCHWELCOME; } q->subpacket[s].gains1.now = q->subpacket[s].gain_1; q->subpacket[s].gains1.previous = q->subpacket[s].gain_2; q->subpacket[s].gains2.now = q->subpacket[s].gain_3; q->subpacket[s].gains2.previous = q->subpacket[s].gain_4; q->num_subpackets++; s++; if (s > MAX_SUBPACKETS) { avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS); return AVERROR_PATCHWELCOME; } } init_pow2table(); init_gain_table(q); init_cplscales_table(q); if ((ret = init_cook_vlc_tables(q))) return ret; if (avctx->block_align >= UINT_MAX / 2) return AVERROR(EINVAL); q->decoded_bytes_buffer = av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); if ((ret = init_cook_mlt(q))) return ret; if (1) { q->scalar_dequant = scalar_dequant_float; q->decouple = decouple_float; q->imlt_window = imlt_window_float; q->interpolate = interpolate_float; q->saturate_output = saturate_output_float; } if (q->samples_per_channel != 256 && q->samples_per_channel != 512 && q->samples_per_channel != 1024) { avpriv_request_sample(avctx, "samples_per_channel = %d", q->samples_per_channel); return AVERROR_PATCHWELCOME; } avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (channel_mask) avctx->channel_layout = channel_mask; else avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; #ifdef DEBUG dump_cook_context(q); #endif return 0; }
1threat
How to ssh another VM without password : <p>Now, I have two SuSe11SP3 VM. I want to ssh another VM without password. Because I often use <code>scp</code> to copy files between the two VMs. But the password is too long, I don't want to change password. I know maybe I can use publickey, my question is how can I achieve by using script.</p>
0debug
Alphabetize in Perl - Assignment due Sunday : here is the prompt I have: Write a Perl program that reads in an arbitrary number of strings from the command line and displays them sorted alphabetically. Here's what I have: #!/usr/bin/perl use strict; use warnings; # read command line arguments # verify correct input and display error and quit if input is valid # (1) quit unless we have the correct number of command-line args my $numargs=string $num_args = $#ARGV + 1; if ($num_args != 2) { exit; } if ($num_args > 2) { my $num_args eq string print "Enter multiple random strings of letters, separated by spaces: "; exit; } # (2) If we get multiple command arguments, assume they are # separate strings of random letters my @string = ARGV if ($string eq ARGV) { my $string=ARGV } # sort strings my @sorted_string = sort @string; # display sorted string print "Here is your sorted list: "@sorted_string"\n"; The errors I'm getting is about naming, but my professor said I'm close. Any help is much appreciated!
0debug
from array import array def positive_count(nums): n = len(nums) n1 = 0 for x in nums: if x > 0: n1 += 1 else: None return round(n1/n,2)
0debug
how to save a scikit-learn pipline with keras regressor inside to disk? : <p>I have a scikit-learn pipline with kerasRegressor in it:</p> <pre><code>estimators = [ ('standardize', StandardScaler()), ('mlp', KerasRegressor(build_fn=baseline_model, nb_epoch=5, batch_size=1000, verbose=1)) ] pipeline = Pipeline(estimators) </code></pre> <p>After, training the pipline, I am trying to save to disk using joblib...</p> <pre><code>joblib.dump(pipeline, filename , compress=9) </code></pre> <p>But I am getting an error:</p> <blockquote> <p>RuntimeError: maximum recursion depth exceeded</p> </blockquote> <p>How would you save the pipeline to disk?</p>
0debug
Create View with two ViewModels : <p>I am working on online resume building project using ASP.NET MVC and let me tell you that I am not that much familiar with MVC.I have two view models, one for the information about experience and another for other resume details.Basically one person can have more than one experiece that is, resumeVM have one to many relationship with experienceVM and my view models look like this;</p> <pre><code>public class ResumeVM { //some variables public List&lt;ExperienceVM&gt; experience { get; set;} } public class ExperienceVM { //some experience details } </code></pre> <p>Now the problem is how do i create view in order to let user enter as many experience as he likes.I guess I can create UI using javascript but I don't know how can I store those values into list and save those data in the respective table.Can somebody throw light quickly on this about how to proceed?? </p>
0debug
static void musicpal_register_devices(void) { sysbus_register_dev("mv88w8618_pic", sizeof(mv88w8618_pic_state), mv88w8618_pic_init); sysbus_register_dev("mv88w8618_pit", sizeof(mv88w8618_pit_state), mv88w8618_pit_init); sysbus_register_dev("mv88w8618_flashcfg", sizeof(mv88w8618_flashcfg_state), mv88w8618_flashcfg_init); sysbus_register_dev("mv88w8618_eth", sizeof(mv88w8618_eth_state), mv88w8618_eth_init); sysbus_register_dev("mv88w8618_wlan", sizeof(SysBusDevice), mv88w8618_wlan_init); sysbus_register_dev("musicpal_lcd", sizeof(musicpal_lcd_state), musicpal_lcd_init); sysbus_register_withprop(&musicpal_gpio_info); sysbus_register_dev("musicpal_key", sizeof(musicpal_key_state), musicpal_key_init); }
1threat
static bool virtio_blk_sect_range_ok(VirtIOBlock *dev, uint64_t sector, size_t size) { if (sector & dev->sector_mask) { if (size % dev->conf->logical_block_size) { return true;
1threat
static int decode_main_header(NUTContext *nut){ AVFormatContext *s= nut->avf; ByteIOContext *bc = &s->pb; uint64_t tmp, end; unsigned int stream_count; int i, j, tmp_stream, tmp_mul, tmp_pts, tmp_size, count, tmp_res; end= get_packetheader(nut, bc, 1); end += url_ftell(bc) - 4; GET_V(tmp , tmp >=2 && tmp <= 3) GET_V(stream_count , tmp > 0 && tmp <=MAX_STREAMS) nut->max_distance = get_v(bc); if(nut->max_distance > 65536){ av_log(s, AV_LOG_DEBUG, "max_distance %d\n", nut->max_distance); nut->max_distance= 65536; } GET_V(nut->time_base_count, tmp>0 && tmp<INT_MAX / sizeof(AVRational)) nut->time_base= av_malloc(nut->time_base_count * sizeof(AVRational)); for(i=0; i<nut->time_base_count; i++){ GET_V(nut->time_base[i].num, tmp>0 && tmp<(1ULL<<31)) GET_V(nut->time_base[i].den, tmp>0 && tmp<(1ULL<<31)) if(ff_gcd(nut->time_base[i].num, nut->time_base[i].den) != 1){ av_log(s, AV_LOG_ERROR, "time base invalid\n"); return -1; } } tmp_pts=0; tmp_mul=1; tmp_stream=0; for(i=0; i<256;){ int tmp_flags = get_v(bc); int tmp_fields= get_v(bc); if(tmp_fields>0) tmp_pts = get_s(bc); if(tmp_fields>1) tmp_mul = get_v(bc); if(tmp_fields>2) tmp_stream= get_v(bc); if(tmp_fields>3) tmp_size = get_v(bc); else tmp_size = 0; if(tmp_fields>4) tmp_res = get_v(bc); else tmp_res = 0; if(tmp_fields>5) count = get_v(bc); else count = tmp_mul - tmp_size; while(tmp_fields-- > 6) get_v(bc); if(count == 0 || i+count > 256){ av_log(s, AV_LOG_ERROR, "illegal count %d at %d\n", count, i); return -1; } if(tmp_stream >= stream_count){ av_log(s, AV_LOG_ERROR, "illegal stream number\n"); return -1; } for(j=0; j<count; j++,i++){ if (i == 'N') { nut->frame_code[i].flags= FLAG_INVALID; j--; continue; } nut->frame_code[i].flags = tmp_flags ; nut->frame_code[i].pts_delta = tmp_pts ; nut->frame_code[i].stream_id = tmp_stream; nut->frame_code[i].size_mul = tmp_mul ; nut->frame_code[i].size_lsb = tmp_size+j; nut->frame_code[i].reserved_count = tmp_res ; } } assert(nut->frame_code['N'].flags == FLAG_INVALID); if(skip_reserved(bc, end) || check_checksum(bc)){ av_log(s, AV_LOG_ERROR, "Main header checksum mismatch\n"); return -1; } nut->stream = av_mallocz(sizeof(StreamContext)*stream_count); for(i=0; i<stream_count; i++){ av_new_stream(s, i); } return 0; }
1threat
what is the default weight initializer for conv in pytorch? : <p>The question <a href="https://stackoverflow.com/questions/49433936/how-to-initialize-weights-in-pytorch">How to initialize weights in PyTorch?</a> shows how to initialize the weights in <code>Pytorch</code>. However, what is the default weight initializer for <code>Conv</code>and <code>Dense</code> in <code>Pytorch</code>? What distribution does <code>Pytorch</code> use?</p>
0debug
How to use the EditorFor to fill in the model property(string) with the same name? : In my case, I need to fill in one property of model with several identical "input", using EditorFor. @model EditFormApplication.Models.NewForm @using (Html.BeginForm("EditForm", "Home", FormMethod.Post)) } @Html.EditorFor(model => model.Field) @Html.EditorFor(model => model.Field) @Html.EditorFor(model => model.Field) <input type="submit" value="save"> } @Html.EditorFor(model => model.Field) may be much more. namespace EditFormApplication.Models { public class NewForm { public string Field { get; set; } } } or how the model should look for this view?
0debug
Parse a String using PHP : I am trying to parse a string but I am having a hard time. Here is an example piece of data. I need to get the part highlighted in bold so I can lookup the name up in our database. [AZ - Domestic] **Acme Technologies LLC** - (8484383)" So far, here is what I have tried: $string = '[AZ - Domestic] Acme Technologies LLC - (8484383)"'; $start = stripos($string, ']'); $end = strripos($string , '-'); echo substr($string, $start, $end); But this is giving me this result: **] Acme Technologies LLC - (8484383)"** But what I really need is this **Acme Technologies LLC**. I have tried all the php functions I know of to get this result but cannot seem to do so. Any help is greatly appreciated!
0debug
I'm tring to increase the stack size in Visual Studio 2017 : I keep getting a stack Overflow! Probably my code could be written a lot better, I know. But I just need to increase the stack size for just one routine (a recursion with a very big array :-( ) I was told to solve it like that: In my Project -> Properties -> Configuration Properties -> Linker -> System -> Stack Reserve Size : But I can't get to that screen. I can go to Project -> Properties and that's where it ends. [enter image description here][1] I used all of the above items, but I never saw an option to increase the stack size... Using Visual Studio 2017 Community with c# Thank you [1]: https://i.stack.imgur.com/mw03d.jpg
0debug
Quadratic equation program in C# : Could you tell me what's wrong with my code for calculating quadratic equation? Don't be cringed out on the way of my work, because i'm in still very new to the program. class Program { static void Main(string[] args) { double a, b, c, x1, x2, x, D; String A; String B; String C; Console.Write("a="); A = Console.ReadLine(); Console.Write("b="); B = Console.ReadLine(); Console.Write("c="); C = Console.ReadLine(); a = Convert.ToDouble(A); b = Convert.ToDouble(B); c = Convert.ToDouble(C); D =(b * b - 4 * a * c); if (D > 0) { x1 = (-b + Math.Sqrt(D)) / (2 * a); x2 = (-b - Math.Sqrt(D)) / (2 * a); Console.WriteLine("x1=" + x1); Console.WriteLine("x2=" + x2); } else if (D < 0) { D = -D; x1 = (-b + Math.Sqrt(D)) / (2 * a); x2 = (-b - Math.Sqrt(D)) / (2 * a); } else { x = (-b / (2 * a)); Console.WriteLine("x=" + x); } Console.ReadKey(); } }
0debug
Visualization of the distribution of times over different trials : <p>I want to visualize the distribution of times using their median and IQR for the control (blue) and the intervention (orange) group of different trials like in my example created by powerpoint.</p> <p>I have only aggregated data in the following format:</p> <pre><code>trial.name (string) group.A.median (int) group.A.lower (int) group.A.upper (int) group.B.median (int) group.B.lower (int) group.B.upper (int) </code></pre> <p>Is it possible to visualize the data as suggested in my example by means of ggfplot2 or another package using R?</p> <p>If not, any other suggestion besides powerpoint?</p> <p>I would really appreciate your help!</p> <p><a href="https://i.stack.imgur.com/6Zf7X.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6Zf7X.png" alt="plot example"></a></p>
0debug
Outlook - Select specific user for VBA script : I have written a code to limit the number of emails for To, CC and BCC fields, The code works fine. The only problem I am facing is that the code affects all the users and not for a specific user which I select. e.g: user1@xyz.com user2@xyz.com I want to work this code only for `"user1@xyz.com"`. But the code is running in whole outlook session. If there are any option I can choose the user in the code, please help me with that. I have pasted the code below: Private Sub Application_ItemSend(ByVal Element As Object, Cancel As Boolean) Dim aaa() As String Dim bbb() As String Dim ccc() As String aaa = Split(Element.To, ";") bbb = Split(Element.CC, ";") ccc = Split(Element.BCC, ";") If (UBound(aaa) + 1) + (UBound(bbb) + 1) + (UBound(ccc) + 1) > 10 Then MsgBox ("You have added too many recipients! Please contact your Administrator."), vbExclamation, "Authorization required!" Cancel = True End If End Sub Any help on this would be greatly appreciated.
0debug
File.ReadAllText does not return full content in c# : In my c# progran, I have an image which is successfully stored in a byte[ ] data called bytes. I successively write it into a .txt file using the following code using (FileStream file = new FileStream("text.text", FileMode.Create, FileAccess.Write)) { file.Write(bytes, 0, numToWrite); file.Close(); } The above code stores the exact content I wish to store. Whenever I wish to read the content of the file, text.txt, into textbox I only get the first line or little part of the first line. But when I open the file, text.txt, I see the complete content. This is the code I use to read the file string kk = File.ReadAllText("text.txt");
0debug
Inject a service into an Ember Object [not an Ember Controller] : <p>I'm trying to inject an Ember service into an Ember Object but keep getting the following error:</p> <pre><code>"Assertion Failed: Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container." </code></pre> <p>My code looks essentially something like the following:</p> <pre><code>const Model = Ember.Object.extend({ store: Ember.inject.service(), destroyRecord() {...}, serialize() {...}, deserialize() {...}, }); let newModel = Model.create(); newModel.get('store'); </code></pre> <p><strong>Note</strong>: it does work if I inject the service into a Controller, but not an object. Haven't had any luck trying to figure out how to register the Object with the Ember container.</p>
0debug
int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size){ int i, j; uint32_t c; if (bits < 8 || bits > 32 || poly >= (1LL<<bits)) return -1; if (ctx_size != sizeof(AVCRC)*257 && ctx_size != sizeof(AVCRC)*1024) return -1; for (i = 0; i < 256; i++) { if (le) { for (c = i, j = 0; j < 8; j++) c = (c>>1)^(poly & (-(c&1))); ctx[i] = c; } else { for (c = i << 24, j = 0; j < 8; j++) c = (c<<1) ^ ((poly<<(32-bits)) & (((int32_t)c)>>31) ); ctx[i] = av_bswap32(c); } } ctx[256]=1; #if !CONFIG_SMALL if(ctx_size >= sizeof(AVCRC)*1024) for (i = 0; i < 256; i++) for(j=0; j<3; j++) ctx[256*(j+1) + i]= (ctx[256*j + i]>>8) ^ ctx[ ctx[256*j + i]&0xFF ]; #endif return 0; }
1threat
static void kvm_arm_gic_get(GICState *s) { uint32_t reg; int i; int cpu; if (!kvm_arm_gic_can_save_restore(s)) { DPRINTF("Cannot get kernel gic state, no kernel interface"); return; } kvm_gicd_access(s, 0x0, 0, &reg, false); s->enabled = reg & 1; kvm_gicd_access(s, 0x4, 0, &reg, false); s->num_irq = ((reg & 0x1f) + 1) * 32; s->num_cpu = ((reg & 0xe0) >> 5) + 1; if (s->num_irq > GIC_MAXIRQ) { fprintf(stderr, "Too many IRQs reported from the kernel: %d\n", s->num_irq); abort(); } kvm_gicd_access(s, 0x8, 0, &reg, false); for_each_irq_reg(i, s->num_irq, 1) { kvm_gicd_access(s, 0x80 + (i * 4), 0, &reg, false); if (reg != 0) { fprintf(stderr, "Unsupported GICD_IGROUPRn value: %08x\n", reg); abort(); } } for (i = 0; i < s->num_irq; i++) { memset(&s->irq_state[i], 0, sizeof(s->irq_state[0])); } kvm_dist_get(s, 0x100, 1, s->num_irq, translate_enabled); kvm_dist_get(s, 0x200, 1, s->num_irq, translate_pending); kvm_dist_get(s, 0x300, 1, s->num_irq, translate_active); kvm_dist_get(s, 0xc00, 2, s->num_irq, translate_trigger); kvm_dist_get(s, 0x400, 8, s->num_irq, translate_priority); kvm_dist_get(s, 0x800, 8, s->num_irq, translate_targets); kvm_dist_get(s, 0xf10, 8, GIC_NR_SGIS, translate_sgisource); for (cpu = 0; cpu < s->num_cpu; cpu++) { kvm_gicc_access(s, 0x00, cpu, &reg, false); s->cpu_enabled[cpu] = (reg & 1); kvm_gicc_access(s, 0x04, cpu, &reg, false); s->priority_mask[cpu] = (reg & 0xff); kvm_gicc_access(s, 0x08, cpu, &reg, false); s->bpr[cpu] = (reg & 0x7); kvm_gicc_access(s, 0x1c, cpu, &reg, false); s->abpr[cpu] = (reg & 0x7); for (i = 0; i < 4; i++) { kvm_gicc_access(s, 0xd0 + i * 4, cpu, &reg, false); s->apr[i][cpu] = reg; } } }
1threat
static void targa_decode_rle(AVCodecContext *avctx, TargaContext *s, const uint8_t *src, uint8_t *dst, int w, int h, int stride, int bpp) { int i, x, y; int depth = (bpp + 1) >> 3; int type, count; int diff; diff = stride - w * depth; x = y = 0; while(y < h){ type = *src++; count = (type & 0x7F) + 1; type &= 0x80; if((x + count > w) && (x + count + 1 > (h - y) * w)){ av_log(avctx, AV_LOG_ERROR, "Packet went out of bounds: position (%i,%i) size %i\n", x, y, count); return; } for(i = 0; i < count; i++){ switch(depth){ case 1: *dst = *src; break; case 2: *((uint16_t*)dst) = AV_RL16(src); break; case 3: dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; break; case 4: *((uint32_t*)dst) = AV_RL32(src); break; } dst += depth; if(!type) src += depth; x++; if(x == w){ x = 0; y++; dst += diff; } } if(type) src += depth; } }
1threat
Can these multiple if statements be condensed? : <p>I made a simple program that tells the user what cards are still in a deck based on the cards seen.If one looks at the code you can see that there are several if statements that do almost the same thing. Could anyone help me condense these?</p> <pre class="lang-py prettyprint-override"><code>for card in cards_seen: if card.endswith('C') == True: Deck["clubs"].remove(card) if card.endswith('D') == True: Deck["diamonds"].remove(card) if card.endswith('H') == True: Deck["hearts"].remove(card) if card.endswith('S') == True: Deck["spades"].remove(card) </code></pre>
0debug
JQuery if x Checkboxes checked change link : i need a jquery script. I have three Chechboxes and two links. If all three checkboxes are checked, it show link 1. If only 1 or 2 checkboxes are checked, it show link 2. Thanks in advance.
0debug
alert('Hello ' + user_input);
1threat
void sparc_cpu_list(FILE *f, int (*cpu_fprintf)(FILE *f, const char *fmt, ...)) { unsigned int i; for (i = 0; i < ARRAY_SIZE(sparc_defs); i++) { (*cpu_fprintf)(f, "Sparc %16s IU " TARGET_FMT_lx " FPU %08x MMU %08x NWINS %d ", sparc_defs[i].name, sparc_defs[i].iu_version, sparc_defs[i].fpu_version, sparc_defs[i].mmu_version, sparc_defs[i].nwindows); print_features(f, cpu_fprintf, CPU_DEFAULT_FEATURES & ~sparc_defs[i].features, "-"); print_features(f, cpu_fprintf, ~CPU_DEFAULT_FEATURES & sparc_defs[i].features, "+"); (*cpu_fprintf)(f, "\n"); } (*cpu_fprintf)(f, "Default CPU feature flags (use '-' to remove): "); print_features(f, cpu_fprintf, CPU_DEFAULT_FEATURES, NULL); (*cpu_fprintf)(f, "\n"); (*cpu_fprintf)(f, "Available CPU feature flags (use '+' to add): "); print_features(f, cpu_fprintf, ~CPU_DEFAULT_FEATURES, NULL); (*cpu_fprintf)(f, "\n"); (*cpu_fprintf)(f, "Numerical features (use '=' to set): iu_version " "fpu_version mmu_version nwindows\n"); }
1threat