problem
stringlengths
26
131k
labels
class label
2 classes
int css_do_ssch(SubchDev *sch, ORB *orb) { SCSW *s = &sch->curr_status.scsw; PMCW *p = &sch->curr_status.pmcw; int ret; if (!(p->flags & (PMCW_FLAGS_MASK_DNV | PMCW_FLAGS_MASK_ENA))) { ret = -ENODEV; goto out; } if (s->ctrl & SCSW_STCTL_STATUS_PEND) { ret = -EINPROGRESS; goto out; } if (s->ctrl & (SCSW_FCTL_START_FUNC | SCSW_FCTL_HALT_FUNC | SCSW_FCTL_CLEAR_FUNC)) { ret = -EBUSY; goto out; } if (channel_subsys.chnmon_active) { css_update_chnmon(sch); } sch->channel_prog = orb->cpa; s->ctrl |= (SCSW_FCTL_START_FUNC | SCSW_ACTL_START_PEND); s->flags &= ~SCSW_FLAGS_MASK_PNO; do_subchannel_work(sch, orb); ret = 0; out: return ret; }
1threat
How can I access member variables of a vector of objects that is a member variable from a class? : <p>I do know how to access member variables given a vector of objects but suppose </p> <p>if I have a class called "layer" that is </p> <pre><code>class layer{ public: layer(.... that initializes "val" .... ); vector&lt;vector&lt;double&gt;&gt; getval(){return val;} private: vector&lt;vector&lt;double&gt;&gt; val; } </code></pre> <p>and then suppose there is another class that is </p> <pre><code>class Net{ public: Net( ..... that initializes "nn" ..... ); vector&lt;layer&gt; getnn(){ return nn; } private: vector&lt;layer&gt; nn; } </code></pre> <p>So in the main function, I could create an object like </p> <pre><code>Net n( ....... ) </code></pre> <p>and in the main function I could get vector of objects via </p> <pre><code>n.getnn(); </code></pre> <p>but the question is how could I get the specific, given i index, </p> <pre><code>vector&lt;vector&lt;double&gt;&gt; val </code></pre> <p>at nn[i]</p>
0debug
static void do_tb_flush(CPUState *cpu, run_on_cpu_data tb_flush_count) { tb_lock(); if (tcg_ctx.tb_ctx.tb_flush_count != tb_flush_count.host_int) { goto done; } #if defined(DEBUG_TB_FLUSH) printf("qemu: flush code_size=%ld nb_tbs=%d avg_tb_size=%ld\n", (unsigned long)(tcg_ctx.code_gen_ptr - tcg_ctx.code_gen_buffer), tcg_ctx.tb_ctx.nb_tbs, tcg_ctx.tb_ctx.nb_tbs > 0 ? ((unsigned long)(tcg_ctx.code_gen_ptr - tcg_ctx.code_gen_buffer)) / tcg_ctx.tb_ctx.nb_tbs : 0); #endif if ((unsigned long)(tcg_ctx.code_gen_ptr - tcg_ctx.code_gen_buffer) > tcg_ctx.code_gen_buffer_size) { cpu_abort(cpu, "Internal error: code buffer overflow\n"); } CPU_FOREACH(cpu) { int i; for (i = 0; i < TB_JMP_CACHE_SIZE; ++i) { atomic_set(&cpu->tb_jmp_cache[i], NULL); } } tcg_ctx.tb_ctx.nb_tbs = 0; qht_reset_size(&tcg_ctx.tb_ctx.htable, CODE_GEN_HTABLE_SIZE); page_flush_tb(); tcg_ctx.code_gen_ptr = tcg_ctx.code_gen_buffer; atomic_mb_set(&tcg_ctx.tb_ctx.tb_flush_count, tcg_ctx.tb_ctx.tb_flush_count + 1); done: tb_unlock(); }
1threat
unable to insert into mysql table using pyhton : I'm trying to insert rows in my sql table using a csv file in python. There are five columns (id(autoincrement, primary, int),Event(int), Edition(int), Subscription(varchar), Daystogo(varchar) My csv has 4 columns (Event, Edition, Subscription, Daystogo). I want to insert these into the table and let id be assigned in autoincremental way. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> mydb = mysql.connector.connect( user='user', password='password', host='host', database='opm') mycursor = mydb.cursor() csv_data=csv.reader("mycsvfile.csv") for row in csv_data: print(row) mycursor.execute("INSERT INTO opm (Event, Edition, Subscription, Daystogo) VALUES (%s,%s,%s,%s)", (int,int,str, str)) <!-- end snippet --> This is the error that i have been receiving <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> csv_data=csv.reader("mycsvfile.csv") for row in csv_data: print(row) mycursor.execute("INSERT INTO opm (Event, Edition, Subscription, Daystogo) VALUES (%s,%s,%s,%s)", (int,int,str, str)) ['m'] Traceback (most recent call last): File "<ipython-input-51-5b5e2c804099>", line 4, in <module> mycursor.execute("INSERT INTO opm (Event, Edition, Subscription, Daystogo) VALUES (%s,%s,%s,%s)", (int,int,str, str)) File "E:\Data Science\pyWork\PyProjects\Program\lib\site-packages\mysql\connector\cursor.py", line 547, in execute psub = _ParamSubstitutor(self._process_params(params)) File "E:\Data Science\pyWork\PyProjects\Program\lib\site-packages\mysql\connector\cursor.py", line 430, in _process_params "Failed processing format-parameters; %s" % err) ProgrammingError: Failed processing format-parameters; Python 'type' cannot be converted to a MySQL type <!-- end snippet --> Please help me out how can I insert the rows in mysql table
0debug
Exclude property from type : <p>I'd like to exclude a single property from the type. How can I do that?</p> <p>For example I have</p> <pre><code>interface XYZ { x: number; y: number; z: number; } </code></pre> <p>And I want to exclude property <code>z</code> to get</p> <pre><code>type XY = { x: number, y: number }; </code></pre>
0debug
How do you set the badge position with reCAPTCHA v3? : <p>I would like to use an inline badge with v3, but there is no documentation on badge position for v3.</p>
0debug
query = 'SELECT * FROM customers WHERE email = ' + email_input
1threat
GraphQL and Microservices : <p>At my company we've decided on a microservice architecture for a new project. We've taken a look at GraphQL and realised its potential and advantages for using as our single API endpoint.</p> <p>What we disagree on is how the communication should be done between GraphQL and each micro service. Some argue for REST, others say we should also have a graphQL endpoint for each service. </p> <p>I was wondering what are some of the pros and cons of each. For example, having everything in graphQL seems a bit redundant, as we'd be replicating parts of the schema in each service. On the other hand, we're using GraphQL to avoid some REST pitfalls. We're afraid having REST endpoints will nullify the advantages gained from gQL.</p> <p>Has anyone come across a similar dilemma? None of us are experienced with GraphQL, so is there some obvious pro and con here that we might be missing?</p> <p>Thanks in advance!</p>
0debug
Micro frontend architecture advice : <p>We have several web applications that we wish to present under one single page application. We are looking for a micro-frontend architecture/framework to use. As we see it, these are our options for implementation:</p> <ol> <li>Using the single-spa open source framework: <a href="https://github.com/CanopyTax/single-spa" rel="noreferrer">https://github.com/CanopyTax/single-spa</a></li> <li>Using Iframes (friendly Iframes) the hosting application (the shell) and loading each application according to the current url.</li> <li>Writing our own Javascript framework</li> <li>Other?</li> </ol> <p>The current state is a monolith FE application that consumes the other child-application as internal 3rd party packages. This approach is not scalable for us, because the hosting application is building all the products together, and nothing is really separated.</p> <p>Our requirements are the usual requirements for micro-frontend: 1. Independent development - Each team can choose their own frameworks and build their products regardless the other products.</p> <ol start="2"> <li><p>Independent deployment - Each application can be upgraded in production without downtime and without interfering the other applications.</p></li> <li><p>Shared components - We're using Angular4 in our applications, and we have a proprietary 3rd party library (shared components and logic) that we've already wrote that should be shared among all of the products for similar look and feel. </p></li> <li><p>We would like to have the ability to upgrade each application's framework (Angular, RXjs, Typescript etc and also for our proprietary component library) without caring about the other applications.</p></li> </ol> <p>We tried to use the single-spa framework but we have some issues and we are currently found our-self thinking if this is the right approach for us, or should we try a different approach.</p> <p>The issues we have using the single-spa are: 1. Assets loading is problematic. (We must have the assets files on the root folder of the hosting application, and we suffer from assets conflicts when switching to another application). 2. We still don't know how to handle global styling for all applications (We use sass for styling and it must be complied together with the local styles for each application) 3. Upgrade angular framework (or all other frameworks) is not possible for one application, it's all or nothing (since we have one instance of angular). 4. We have to implement a different bundling for development other side the hosting application (the shell).</p> <p>When we think about the Iframe (using friendly Iframe) solution, we visualize a full separation between all child-application, and tend to believe this is a more suitable approach for us.</p> <p>Are there any pitfalls for using Iframes?</p> <p>Thanks, Daniel</p>
0debug
static void virtio_ccw_scsi_realize(VirtioCcwDevice *ccw_dev, Error **errp) { VirtIOSCSICcw *dev = VIRTIO_SCSI_CCW(ccw_dev); DeviceState *vdev = DEVICE(&dev->vdev); DeviceState *qdev = DEVICE(ccw_dev); Error *err = NULL; char *bus_name; if (qdev->id) { bus_name = g_strdup_printf("%s.0", qdev->id); virtio_device_set_child_bus_name(VIRTIO_DEVICE(vdev), bus_name); g_free(bus_name); } qdev_set_parent_bus(vdev, BUS(&ccw_dev->bus)); object_property_set_bool(OBJECT(vdev), true, "realized", &err); if (err) { error_propagate(errp, err); } }
1threat
static int qpa_init_out (HWVoiceOut *hw, audsettings_t *as) { int error; static pa_sample_spec ss; audsettings_t obt_as = *as; PAVoiceOut *pa = (PAVoiceOut *) hw; ss.format = audfmt_to_pa (as->fmt, as->endianness); ss.channels = as->nchannels; ss.rate = as->freq; obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness); pa->s = pa_simple_new ( conf.server, "qemu", PA_STREAM_PLAYBACK, conf.sink, "pcm.playback", &ss, NULL, NULL, &error ); if (!pa->s) { qpa_logerr (error, "pa_simple_new for playback failed\n"); goto fail1; } audio_pcm_init_info (&hw->info, &obt_as); hw->samples = conf.samples; pa->pcm_buf = audio_calloc (AUDIO_FUNC, hw->samples, 1 << hw->info.shift); if (!pa->pcm_buf) { dolog ("Could not allocate buffer (%d bytes)\n", hw->samples << hw->info.shift); goto fail2; } if (audio_pt_init (&pa->pt, qpa_thread_out, hw, AUDIO_CAP, AUDIO_FUNC)) { goto fail3; } return 0; fail3: free (pa->pcm_buf); pa->pcm_buf = NULL; fail2: pa_simple_free (pa->s); pa->s = NULL; fail1: return -1; }
1threat
static int xen_pt_byte_reg_write(XenPCIPassthroughState *s, XenPTReg *cfg_entry, uint8_t *val, uint8_t dev_value, uint8_t valid_mask) { XenPTRegInfo *reg = cfg_entry->reg; uint8_t writable_mask = 0; uint8_t throughable_mask = get_throughable_mask(s, reg, valid_mask); writable_mask = reg->emu_mask & ~reg->ro_mask & valid_mask; cfg_entry->data = XEN_PT_MERGE_VALUE(*val, cfg_entry->data, writable_mask); *val = XEN_PT_MERGE_VALUE(*val, dev_value, throughable_mask); return 0; }
1threat
Allow AlfaNumeric and other symbol using javascipt : I have use this code for allow numeric only in textbox, but how make Caharkey only allow AlfaNumeric and other symbol like **-./** (dash,dot,slash) this my code for allow Numeric function NumericKey(evt){ var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } thankyou
0debug
static void build_trampolines(TCGContext *s) { static void * const qemu_ld_helpers[16] = { [MO_UB] = helper_ret_ldub_mmu, [MO_SB] = helper_ret_ldsb_mmu, [MO_LEUW] = helper_le_lduw_mmu, [MO_LESW] = helper_le_ldsw_mmu, [MO_LEUL] = helper_le_ldul_mmu, [MO_LEQ] = helper_le_ldq_mmu, [MO_BEUW] = helper_be_lduw_mmu, [MO_BESW] = helper_be_ldsw_mmu, [MO_BEUL] = helper_be_ldul_mmu, [MO_BEQ] = helper_be_ldq_mmu, }; static void * const qemu_st_helpers[16] = { [MO_UB] = helper_ret_stb_mmu, [MO_LEUW] = helper_le_stw_mmu, [MO_LEUL] = helper_le_stl_mmu, [MO_LEQ] = helper_le_stq_mmu, [MO_BEUW] = helper_be_stw_mmu, [MO_BEUL] = helper_be_stl_mmu, [MO_BEQ] = helper_be_stq_mmu, }; int i; TCGReg ra; for (i = 0; i < 16; ++i) { if (qemu_ld_helpers[i] == NULL) { continue; } while ((uintptr_t)s->code_ptr & 15) { tcg_out_nop(s); } qemu_ld_trampoline[i] = s->code_ptr; if (SPARC64 || TARGET_LONG_BITS == 32) { ra = TCG_REG_O3; } else { tcg_out_arithi(s, TCG_REG_O1, TCG_REG_O2, 32, SHIFT_SRLX); ra = TCG_REG_O4; } tcg_out_mov(s, TCG_TYPE_PTR, ra, TCG_REG_O7); tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_O0, TCG_AREG0); tcg_out_call_nodelay(s, qemu_ld_helpers[i]); tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_O7, ra); } for (i = 0; i < 16; ++i) { if (qemu_st_helpers[i] == NULL) { continue; } while ((uintptr_t)s->code_ptr & 15) { tcg_out_nop(s); } qemu_st_trampoline[i] = s->code_ptr; if (SPARC64) { emit_extend(s, TCG_REG_O2, i); ra = TCG_REG_O4; } else { ra = TCG_REG_O1; if (TARGET_LONG_BITS == 64) { tcg_out_arithi(s, ra, ra + 1, 32, SHIFT_SRLX); ra += 2; } else { ra += 1; } if ((i & MO_SIZE) == MO_64) { tcg_out_arithi(s, ra, ra + 1, 32, SHIFT_SRLX); ra += 2; } else { ra += 1; } ra += 1; } if (ra >= TCG_REG_O6) { tcg_out_st(s, TCG_TYPE_PTR, TCG_REG_O7, TCG_REG_CALL_STACK, TCG_TARGET_CALL_STACK_OFFSET); ra = TCG_REG_G1; } tcg_out_mov(s, TCG_TYPE_PTR, ra, TCG_REG_O7); tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_O0, TCG_AREG0); tcg_out_call_nodelay(s, qemu_st_helpers[i]); tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_O7, ra); } }
1threat
static bool bdrv_requests_pending_all(void) { BlockDriverState *bs; QTAILQ_FOREACH(bs, &bdrv_states, device_list) { if (bdrv_requests_pending(bs)) { return true; } } return false; }
1threat
Center a div to the page while inline with another div : <p>I need to align an element to the center of the screen while having an element to the left of it.</p> <p>I can achieve this with float left and setting the padding of the center element to match the width of the floated element. But, in this case I will not always know the width.</p> <p>I do not know how better to explain this. Searchs have failed me.</p>
0debug
static int shorten_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; ShortenContext *s = avctx->priv_data; int i, input_buf_size = 0; int16_t *samples = data; int ret; if(s->max_framesize == 0){ void *tmp_ptr; s->max_framesize= 1024; tmp_ptr = av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); if (!tmp_ptr) { av_log(avctx, AV_LOG_ERROR, "error allocating bitstream buffer\n"); return AVERROR(ENOMEM); } s->bitstream = tmp_ptr; } if(1 && s->max_framesize){ buf_size= FFMIN(buf_size, s->max_framesize - s->bitstream_size); input_buf_size= buf_size; if(s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size){ memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); s->bitstream_index=0; } memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size); buf= &s->bitstream[s->bitstream_index]; buf_size += s->bitstream_size; s->bitstream_size= buf_size; if(buf_size < s->max_framesize){ *data_size = 0; return input_buf_size; } } init_get_bits(&s->gb, buf, buf_size*8); skip_bits(&s->gb, s->bitindex); if (!s->blocksize) { if ((ret = read_header(s)) < 0) return ret; *data_size = 0; } else { int cmd; int len; cmd = get_ur_golomb_shorten(&s->gb, FNSIZE); if (cmd > FN_VERBATIM) { av_log(avctx, AV_LOG_ERROR, "unknown shorten function %d\n", cmd); if (s->bitstream_size > 0) { s->bitstream_index++; s->bitstream_size--; } return -1; } if (!is_audio_command[cmd]) { switch (cmd) { case FN_VERBATIM: len = get_ur_golomb_shorten(&s->gb, VERBATIM_CKSIZE_SIZE); while (len--) { get_ur_golomb_shorten(&s->gb, VERBATIM_BYTE_SIZE); } break; case FN_BITSHIFT: s->bitshift = get_ur_golomb_shorten(&s->gb, BITSHIFTSIZE); break; case FN_BLOCKSIZE: { int blocksize = get_uint(s, av_log2(s->blocksize)); if (blocksize > s->blocksize) { av_log(avctx, AV_LOG_ERROR, "Increasing block size is not supported\n"); return AVERROR_PATCHWELCOME; } if (!blocksize || blocksize > MAX_BLOCKSIZE) { av_log(avctx, AV_LOG_ERROR, "invalid or unsupported " "block size: %d\n", blocksize); return AVERROR(EINVAL); } s->blocksize = blocksize; break; } case FN_QUIT: break; } *data_size = 0; } else { int residual_size = 0; int channel = s->cur_chan; int32_t coffset; if (cmd != FN_ZERO) { residual_size = get_ur_golomb_shorten(&s->gb, ENERGYSIZE); if (s->version == 0) residual_size--; } if (s->nmean == 0) coffset = s->offset[channel][0]; else { int32_t sum = (s->version < 2) ? 0 : s->nmean / 2; for (i=0; i<s->nmean; i++) sum += s->offset[channel][i]; coffset = sum / s->nmean; if (s->version >= 2) coffset >>= FFMIN(1, s->bitshift); } if (cmd == FN_ZERO) { for (i=0; i<s->blocksize; i++) s->decoded[channel][i] = 0; } else { if ((ret = decode_subframe_lpc(s, cmd, channel, residual_size, coffset)) < 0) return ret; } if (s->nmean > 0) { int32_t sum = (s->version < 2) ? 0 : s->blocksize / 2; for (i=0; i<s->blocksize; i++) sum += s->decoded[channel][i]; for (i=1; i<s->nmean; i++) s->offset[channel][i-1] = s->offset[channel][i]; if (s->version < 2) s->offset[channel][s->nmean - 1] = sum / s->blocksize; else s->offset[channel][s->nmean - 1] = (sum / s->blocksize) << s->bitshift; } for (i=-s->nwrap; i<0; i++) s->decoded[channel][i] = s->decoded[channel][i + s->blocksize]; fix_bitshift(s, s->decoded[channel]); s->cur_chan++; if (s->cur_chan == s->channels) { samples = interleave_buffer(samples, s->channels, s->blocksize, s->decoded); s->cur_chan = 0; *data_size = (int8_t *)samples - (int8_t *)data; } else { *data_size = 0; } } } s->bitindex = get_bits_count(&s->gb) - 8*((get_bits_count(&s->gb))/8); i= (get_bits_count(&s->gb))/8; if (i > buf_size) { av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size); s->bitstream_size=0; s->bitstream_index=0; return -1; } if (s->bitstream_size) { s->bitstream_index += i; s->bitstream_size -= i; return input_buf_size; } else return i; }
1threat
static const IntelHDAReg *intel_hda_reg_find(IntelHDAState *d, target_phys_addr_t addr) { const IntelHDAReg *reg; if (addr >= sizeof(regtab)/sizeof(regtab[0])) { goto noreg; } reg = regtab+addr; if (reg->name == NULL) { goto noreg; } return reg; noreg: dprint(d, 1, "unknown register, addr 0x%x\n", (int) addr); return NULL; }
1threat
Custom Keyboard UI in Mobile Browser : <p>I have some problem with user request to custom keyboard UI when using in pwa application in textarea form. is that possible to custom that keyboard? or custom keyboard is only change with setting phone?</p>
0debug
static void icp_control_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { switch (offset >> 2) { case 1: case 2: case 3: break; default: hw_error("icp_control_write: Bad offset %x\n", (int)offset); } }
1threat
static int epzs_motion_search4(MpegEncContext * s, int block, int *mx_ptr, int *my_ptr, int P[6][2], int pred_x, int pred_y, int xmin, int ymin, int xmax, int ymax, uint8_t *ref_picture) { int best[2]={0, 0}; int d, dmin; UINT8 *new_pic, *old_pic; const int pic_stride= s->linesize; const int pic_xy= ((s->mb_y*2 + (block>>1))*pic_stride + s->mb_x*2 + (block&1))*8; UINT16 *mv_penalty= s->mv_penalty[s->f_code] + MAX_MV; int quant= s->qscale; const int shift= 1+s->quarter_sample; new_pic = s->new_picture[0] + pic_xy; old_pic = ref_picture + pic_xy; dmin = pix_abs8x8(new_pic, old_pic, pic_stride); if ((s->mb_y == 0 || s->first_slice_line || s->first_gob_line) && block<2) { CHECK_MV4(P[1][0]>>shift, P[1][1]>>shift) }else{ CHECK_MV4(P[4][0]>>shift, P[4][1]>>shift) if(dmin<Z_THRESHOLD){ *mx_ptr= P[4][0]>>shift; *my_ptr= P[4][1]>>shift; return dmin; } CHECK_MV4(P[1][0]>>shift, P[1][1]>>shift) CHECK_MV4(P[2][0]>>shift, P[2][1]>>shift) CHECK_MV4(P[3][0]>>shift, P[3][1]>>shift) } CHECK_MV4(P[0][0]>>shift, P[0][1]>>shift) CHECK_MV4(P[5][0]>>shift, P[5][1]>>shift) dmin= small_diamond_search4MV(s, best, dmin, new_pic, old_pic, pic_stride, pred_x, pred_y, mv_penalty, quant, xmin, ymin, xmax, ymax, shift); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; }
1threat
Error trying to generate token using .NET JWT library : <p>I'm trying to use package System.IdentityModel.Tokens.Jwt to generate a token. I found some code samples online, was pretty straightforward, but then I'm running into an error that I can't figure out. Here's the code I'm using (has been modified slightly for brevity):</p> <pre><code>&lt;%@ Application Language="C#" %&gt; &lt;%@ Import Namespace="System" %&gt; &lt;%@ Import Namespace="System.Text" %&gt; &lt;%@ Import Namespace="System.Reflection" %&gt; &lt;%@ Import Namespace="System.Collections" %&gt; &lt;%@ Import Namespace="System.IdentityModel.Tokens" %&gt; &lt;%@ Import Namespace="System.IdentityModel.Tokens.Jwt" %&gt; &lt;%@ Import Namespace="System.Security.Claims" %&gt; &lt;%@ Import Namespace="System.IdentityModel.Protocols.WSTrust" %&gt; &lt;script runat="server"&gt; public class TestClass { public static string GetJwtToken() { var tokenHandler = new JwtSecurityTokenHandler(); var input = "anyoldrandomtext"; var securityKey = new byte[input.Length * sizeof(char)]; Buffer.BlockCopy(input.ToCharArray(), 0, securityKey, 0, securityKey.Length); var now = DateTime.UtcNow; var tokenDescriptor = new SecurityTokenDescriptor { Subject = new ClaimsIdentity(new[] { new Claim( ClaimTypes.UserData, "IsValid", ClaimValueTypes.String, "(local)" ) }), TokenIssuerName = "self", AppliesToAddress = "https://www.mywebsite.com", Lifetime = new Lifetime(now, now.AddMinutes(60)), SigningCredentials = new SigningCredentials(new InMemorySymmetricSecurityKey(securityKey), "http://www.w3.org/2001/04/xmldsig-more#hmac-sha256", "http://www.w3.org/2001/04/xmlenc#sha256"), }; var token = tokenHandler.CreateToken(tokenDescriptor); var tokenString = tokenHandler.WriteToken(token); return tokenString; } } &lt;/script&gt; </code></pre> <p>I keep getting the following error at line 113 (var token = tokenHandler.CreateToken(tokenDescriptor);):</p> <p><em>Argument 1: cannot convert from 'System.IdentityModel.Tokens.SecurityTokenDescriptor' to 'Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor'</em></p> <p>But I've seen many examples online doing things exactly as I've done them. I also ran into this article (<a href="https://msdn.microsoft.com/en-us/library/jj157089(v=vs.110).aspx" rel="noreferrer">https://msdn.microsoft.com/en-us/library/jj157089(v=vs.110).aspx</a>) that states the following:</p> <blockquote> <p>In WIF 3.5, all of the WIF classes were contained in the Microsoft.IdentityModel assembly (microsoft.identitymicrosoft.identitymodel.dll). In WIF 4.5, the WIF classes have been split across the following assemblies: mscorlib (mscorlib.dll), System.IdentityModel (System.IdentityModel.dll), System.IdentityModel.Services (System.IdentityModel.Services.dll), and System.ServiceModel (System.ServiceModel.dll).</p> <p>The WIF 3.5 classes were all contained in one of the Microsoft.IdentityModel namespaces; for example, Microsoft.IdentityModel, Microsoft.IdentityModel.Tokens, Microsoft.IdentityModel.Web, and so on. In WIF 4.5, the WIF classes are now spread across the System.IdentityModel namespaces, the System.Security.Claims namespace, and the System.ServiceModel.Security namespace. In addition to this reorganization, some WIF 3.5 classes have been dropped in WIF 4.5.</p> </blockquote> <p>I tried for debugging sake to switch to use the Microsoft.* namespace for the SecurityTokenDescriptor, and then I get another series of errors saying TokenIssuerName, AppliesToAddress, and Lifetime aren't valid properties for that class. Yet when I look at the docs online, seems like those properties do exist on Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor. Yet in my Visual Studio, when I do Go to Definition for that class, they're not there, leading me to believe that there's some kind of configuration issue in my Visual Studio. In my package manager, it shows I have Microsoft.IdentityModel.Tokens v5.0.0 installed. I also changed the project to .NET framework 4.5.1 since the JWT library requires it. Beyond that, I don't know where else to look.</p>
0debug
static void sysbus_ahci_realize(DeviceState *dev, Error **errp) { SysBusDevice *sbd = SYS_BUS_DEVICE(dev); SysbusAHCIState *s = SYSBUS_AHCI(dev); ahci_init(&s->ahci, dev, NULL, s->num_ports); sysbus_init_mmio(sbd, &s->ahci.mem); sysbus_init_irq(sbd, &s->ahci.irq); }
1threat
def jacobsthal_num(n): dp = [0] * (n + 1) dp[0] = 0 dp[1] = 1 for i in range(2, n+1): dp[i] = dp[i - 1] + 2 * dp[i - 2] return dp[n]
0debug
JSONArray in response cannot be converted : <p>I am getting a JSONObject in response from an API</p> <pre><code>{ "contact": null, "error": false, "msg": "get Contacts successfully", "synccontactstimestamp": "2018-02-07 11:34:40.0", "contactjson": "[{\"contactName\":\"4B9B4474C091D55A981ADBB7893FB4E1\",\"contactNumber\":\"0F8F3E9514D329F32CE7B03B9D276D72\"}, {\"contactName\":\"12E09C05C0E456AC2398BDA841986609\",\"contactNumber\":\"035774DB94BFE24BDEDA0B4B45F1372A0CC8EE72A457C3AAA35F79627FD13728\"}, {\"contactName\":\"9344BBF08ACACC4C85A9B83C55BA93C0\",\"contactNumber\":\"E1633601A6632356DB2F08058CA42504\"}, {\"contactName\":\"CCF51D9C27123ACD19F163F6C2BCCD28\",\"contactNumber\":\"89DD6C0E185D1067AC45CEE12DFA6A07\"}, {\"contactName\":\"A8309A8EC81E4DF50306FE4651D63F53\",\"contactNumber\":\"E8781EE87E9036B794BE44D7411FBFCF\"} </code></pre> <p>I am trying to get this JSONArray with key "contactjson" but it gives an exception <code>Value of string type cannot be converted to JSONArray.</code></p> <p>Any idea how to fetch this?</p>
0debug
static SocketAddress *sd_socket_address(const char *path, const char *host, const char *port) { SocketAddress *addr = g_new0(SocketAddress, 1); if (path) { addr->type = SOCKET_ADDRESS_KIND_UNIX; addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); addr->u.q_unix.data->path = g_strdup(path); } else { addr->type = SOCKET_ADDRESS_KIND_INET; addr->u.inet.data = g_new0(InetSocketAddress, 1); addr->u.inet.data->host = g_strdup(host ?: SD_DEFAULT_ADDR); addr->u.inet.data->port = g_strdup(port ?: stringify(SD_DEFAULT_PORT)); } return addr; }
1threat
Instant App - Digital Asset Links Protocol : <p>Whenever I tried to upload my instant app apks to Play store, it gives the following error : </p> <ul> <li><strong>Your site 'www.mywebsitename.com' has not been linked through the Digital Assets Link protocol to your app. Please link your site through the Digital Assets Link protocol to your app.</strong></li> </ul> <p>However, whenever I execute <a href="https://developers.google.com/digital-asset-links/tools/generator" rel="noreferrer">https://developers.google.com/digital-asset-links/tools/generator</a>, it gives success for associating with my app and web site. Any idea why am I getting this error? What may cause this?</p> <p>Thanks for help in advance.</p>
0debug
void qemu_input_event_send_key_delay(uint32_t delay_ms) { if (!kbd_timer) { kbd_timer = timer_new_ms(QEMU_CLOCK_VIRTUAL, qemu_input_queue_process, &kbd_queue); if (queue_count < queue_limit) { qemu_input_queue_delay(&kbd_queue, kbd_timer, delay_ms ? delay_ms : kbd_default_delay_ms);
1threat
How to echo same sentence random times in php? : <p>I need to implement this method to my webpage. I want to echo the same sentence random times every time someone refresh my php webpage.</p> <p>For example: Hello World!</p>
0debug
void qemu_iovec_add(QEMUIOVector *qiov, void *base, size_t len) { assert(qiov->nalloc != -1); if (qiov->niov == qiov->nalloc) { qiov->nalloc = 2 * qiov->nalloc + 1; qiov->iov = g_realloc(qiov->iov, qiov->nalloc * sizeof(struct iovec)); } qiov->iov[qiov->niov].iov_base = base; qiov->iov[qiov->niov].iov_len = len; qiov->size += len; ++qiov->niov; }
1threat
DISAS_INSN(fsave) { qemu_assert(0, "FSAVE not implemented"); }
1threat
Pytest "Error: could not load path/to/conftest.py" : <p>I get the following error when I try to run <code>pytest repo/tests/test_file.py</code>:</p> <pre><code>$ pytest repo/tests/test_file.py Traceback (most recent call last): File "/Users/marlo/anaconda3/envs/venv/lib/python3.6/site-packages/_pytest/config.py", line 329, in _getconftestmodules return self._path2confmods[path] KeyError: local('/Users/marlo/repo/tests/test_file.py') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/marlo/anaconda3/envs/venv/lib/python3.6/site-packages/_pytest/config.py", line 329, in _getconftestmodules return self._path2confmods[path] KeyError: local('/Users/marlo/repo/tests') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/marlo/anaconda3/envs/venv/lib/python3.6/site-packages/_pytest/config.py", line 362, in _importconftest return self._conftestpath2mod[conftestpath] KeyError: local('/Users/marlo/repo/conftest.py') During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/marlo/anaconda3/envs/venv/lib/python3.6/site-packages/_pytest/config.py", line 368, in _importconftest mod = conftestpath.pyimport() File "/Users/marlo/anaconda3/envs/venv/lib/python3.6/site-packages/py/_path/local.py", line 686, in pyimport raise self.ImportMismatchError(modname, modfile, self) py._path.local.LocalPath.ImportMismatchError: ('conftest', '/home/venvuser/venv/conftest.py', local('/Users/marlo/repo/conftest.py')) ERROR: could not load /Users/marlo/repo/conftest.py </code></pre> <p>My repo structure is</p> <pre><code>lib/ -tests/ -test_file.py app/ -test_settings.py pytest.ini conftest.py ... </code></pre> <p>Other people have run this code fine, and according to <a href="https://stackoverflow.com/questions/33964355/how-to-i-organize-my-pytest-tests-if-im-not-distributing-them-with-my-package">this question</a> (and <a href="https://stackoverflow.com/questions/18558666/how-do-i-get-py-test-to-recognize-conftest-py-in-a-subdirectory">this one</a>), my structure is good and I am not missing any files. I can only conclude that something about my computer or project set-up is not right. If you have any suggestions or insights that I may be missing, please send them my way!</p> <p>-------------------------------MORE DETAILS------------------------------</p> <p><strong>test_file.py</strong>:</p> <pre><code>def func(x): return x + 1 def test_answer(): assert func(3) == 5 </code></pre> <p><strong>pytest.ini</strong>:</p> <pre><code>[pytest] DJANGO_SETTINGS_MODULE = app.test_settings python_files = tests.py test_* *_tests.py *test.py </code></pre>
0debug
repeat every wordcount repeat of every word : I want to write a code that count repeat of every word in a string,words separate each other with some character that input as a string...why my code don't work? please answer soon! import java.util.Scanner; public class repeat { public static void main(String[] args) { Scanner ss = new Scanner(System.in); System.out.println("Please write a string:"); String s = ss.nextLine(); System.out.println("Please write a character:"); String w = ss.nextLine(); int i = 0; int j = 0; int k = 0; int y=0; for (i=0 ;i < s.length() ;i++) { for (j = 0; j < w.length(); j++) { if (w.charAt(j) == s.charAt(i) && i!=y && i!=0 && i!=s.length() -1 ) { k += 1; y=i+1; } } } i = 0; j = 0; y = 0; int r = 0; k++; System.out.println(k); String[] a = new String[k]; for (r=0 ;r < k-1 ;r++) { for (j=1 ;j < s.length() ;j++) { for (i = 1; i < w.length(); i++) { if (w.charAt(i) == s.charAt(j)) { a[r] = s.substring(y, j); y = j+1; } } } System.out.println(a[r]); } a[k-1] = s.substring(y+1,s.length()); i = 0; int[] b = new int[k]; while (i <k) { b[i] = 0; i++; } i = j = 0; while (i < k) { while (j != i && j < k) { if (a[i] == a[j]) { a[j] = null; b[i]++; } j++; } i++; } i = j = 0; while (i < k) { if (a[i] != null) { System.out.println(a[i] + " " + b[i]); } i++; } } }
0debug
Can I make a float number in a C program always round up : <p>Can I make a float number in a C program always round up</p>
0debug
QML ListModel.onRowsAboutToBeRemoved arguments : <p>I'd like to know the arguments for the automatically-generated QML function onRowsAboutToBeRemoved (of the ListModel component.) Specifically, I need to know what the index value is called so I can do operations on the row about to be removed before the action takes place.</p>
0debug
Getting NullPointer Exception when i try to set a value : <p>im getting a NullPointerException when i try to set a value into a method.</p> <pre><code> if (Settings.settings.containsKey("message")) { String sc_message = Settings.settings.get("message"); jda.getPresence().setGame(Game.playing(sc_message)); } </code></pre> <p>but when i let print out the String in Console, i get the right String of the configuration file. (Settings.settings.get("message") Just gets his value from a config)</p>
0debug
Explain this bit of code to a beginner : <pre><code>for x in xrange(12): if x % 2 == 1: continue print x </code></pre> <p>i know what it does, but the language doesn't make sense to me. In particular the second line is where i am lost.</p>
0debug
Duplicate String : I have a task to find duplicate elements and write a method to return a boolean value. Code below is what I have for it. import java.util.ArrayList; import java.util.List; public class DuplicateEle { public static void main(String args[]) { String[] arr = { "hello", "hi", "hello", "howru" }; DuplicateEle de = new DuplicateEle(); for (int i = 0; i < arr.length; i++) { boolean isDup = de.isDuplicate(arr[i]); System.out.println(arr[i]+" is duplicate :" +isDup); } } List<String> dList = new ArrayList<String>(); private boolean isDuplicate(String str) { boolean isDup = false; if (dList.contains(str)) { isDup = true; } else dList.add(str); return isDup; } } It works as expected. output : hello is duplicate :false hi is duplicate :false hello is duplicate :true howru is duplicate :false I want to find the time complexity for the above code. I am looking into the tutorial for time complexity about how it works. http://www.geeksforgeeks.org/analysis-of-algorithms-set-4-analysis-of-loops/ Can someone please give me inputs on the above code and help me understand how time complexity works please ? Thank you in advance !
0debug
Automatically generate TypeScript client code for ASP.NET Core controllers : <p>I'm searching for a way to automatically generate the TypesScript client code from a ASP.NET Core Web-Application (Currently using Visual Studio 2017RC and webpack).</p> <p>Are there any existing tools to generate the TypeScript client either in the build pipeline from visual studio or with webpack? I tried to use swagger middleware and then generate to client from the swagger URL, but I'm not sure if the intermediate swagger generation is the right tool for the job. Also the disconnectedness from the build tools is not ideal.</p>
0debug
how to connect oracle database using C# : <p>I like to connect oracle trough C# by the using following string</p> <p>"CONNECT username/password@[//]host[:port][/service_name]"</p> <p>Please help.</p>
0debug
Python-AttributeError: 'list' object has no attribute 'T' : I have been trying to implement a neural network in python that uses back propagation and keep getting the above error. How can I go about eliminating it. The code runs for one epoch without calculating the error in the system hence it is not able to back propagate the error across the network import numpy as np X = [0.4, 0.7] y = [0.1] class Neural_Network(object): def __init__(self): #parameters self.inputSize = 2 self.outputSize = 1 self.hiddenSize = 2 #weights self.W1 = [[0.1, 0.4], [0.2, -0.2]] # (2x2) weight matrix from input to hidden layer self.W2 = np.array([0.2, -0.5])[np.newaxis] # (2x1) weight matrix from hidden to output layer def forward(self, X): #forward propagation through our network self.z = np.dot(X, self.W1) # dot product of X (input) and first set of 3x2 weights self.z2 = self.sigmoid(self.z) # activation function self.z3 = np.dot(self.z2, self.W2.T) # dot product of hidden layer (z2) and second set of 3x1 weights o = self.sigmoid(self.z3) # final activation function return o def sigmoid(self, s): # activation function return 1/(1+np.exp(-s)) def sigmoidPrime(self, s): #derivative of sigmoid return s * (1 - s) def backward(self, X, y, o): # backward propgate through the network self.o_error = y - o # error in output self.o_delta = self.o_error*self.sigmoidPrime(o) # applying derivative of sigmoid to error self.z2_error = self.o_delta.dot(self.W2) # z2 error: how much our hidden layer weights contributed to output error self.z2_delta = self.z2_error*self.sigmoidPrime(self.z2) # applying derivative of sigmoid to z2 error self.W1 += X.T.dot(self.z2_delta) # adjusting first set (input --> hidden) weights self.W2 += self.z2.T.dot(self.o_delta) # adjusting second set (hidden --> output) weights def train (self, X, y): o = self.forward(X) self.backward(X, y, o) NN = Neural_Network() for i in xrange(1000): # trains the NN 1,000 times print "Input: \n" + str(X) print "Actual Output: \n" + str(y) print "Predicted Output: \n" + str(NN.forward(X)) print "Loss: \n" + str(np.mean(np.square(y - NN.forward(X)))) # mean sum squared loss print "\n" NN.train(X, y) The error I am getting is File "C:/Users/Aaa/AppData/Local/Temp/abc.py", line 43, in backward self.W1 += X.T.dot(self.z2_delta) # adjusting first set (input --> hidden) weights AttributeError: 'list' object has no attribute 'T'
0debug
How to get list & total number of friends who are invited using FB.Mobile.AppInvite while integrating Facebook SDK in Unity3D : <p>I am using new Facebook sdk v7.5.0, i tried hard to get the list of the friends who are invited and also unable to get the total number, how many friends are invited in callback of FB.Mobile.AppInvite(). </p>
0debug
void spapr_events_init(sPAPRMachineState *spapr) { QTAILQ_INIT(&spapr->pending_events); spapr->check_exception_irq = xics_alloc(spapr->icp, 0, 0, false); spapr->epow_notifier.notify = spapr_powerdown_req; qemu_register_powerdown_notifier(&spapr->epow_notifier); spapr_rtas_register(RTAS_CHECK_EXCEPTION, "check-exception", check_exception); spapr_rtas_register(RTAS_EVENT_SCAN, "event-scan", event_scan); }
1threat
How to add more Css properties in this Javascript : Javascript experts can anyone tell me how to add or assign more properties to this given javascript. $('#mydoom').each(function () { if ($(this).css('visibility') == 'hidden') { document.location.href = "http://www.example.com"; } }); you see the above script has only one css tag/property **visibility:hidden**, how can i add more properties... some like thats; **example**: $('#mydoom').each(function () { if ($(this).css('visibility') == 'hidden') ($(this).css('display') == 'none') ($(this).css('font-size') == '25px') ($(this).css('color') == 'red') { document.location.href = "http://www.example.com"; } }); You see the above scripts holds many properties...so how can i do that, this is not working which i show you above as example.
0debug
How to get iTunes connect Team ID and Team name? : <p>I'm writing down an <code>Appfile</code> for <strong><code>fastlane</code></strong>, my problem is I already have the <code>team_name</code> and <code>team_id</code> in Apple Dev Center but I can't get the <code>iTunes Connect ID</code>/<strong><code>itc_team_id</code></strong>. I'm working with different team. How do I get it? Any guide would be great. Thanks</p>
0debug
static av_cold int ulti_decode_init(AVCodecContext *avctx) { UltimotionDecodeContext *s = avctx->priv_data; s->avctx = avctx; s->width = avctx->width; s->height = avctx->height; s->blocks = (s->width / 8) * (s->height / 8); avctx->pix_fmt = AV_PIX_FMT_YUV410P; s->ulti_codebook = ulti_codebook; s->frame = av_frame_alloc(); if (!s->frame) return AVERROR(ENOMEM); return 0; }
1threat
exist hosting for ruby rack apps? : <p>exist hosting for ruby rack apps?</p> <p>Please help me</p>
0debug
So im stuck on how to add multiple numbers after I find them : I get all of the numbers from 0 to 1000 that are multiples of three but could someone help me on how to add those numbers together now im just really stuck on that part public class Hi { public static void main(String[] args){ for(int i = 0; i<1000; i++){ if(i % 3 == 0) System.out.println(i); } } }
0debug
How to Publish Visual Studio Database Project in VS 2015 : <p>I was unable to google this.</p> <p>We have an existing database project (sql server).</p> <p>Some new files (scripts) were added.</p> <p>We have an existing server / database where some new scripts need to be run into that context.</p> <p>In Visual Studio 2015, how can I accomplish this?</p> <p>I was told to stay inside Visual Studio 2015. Ideally, I'd like to issue one command vs one for each individual script.</p>
0debug
static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp, unsigned int substr) { SubStream *s = &m->substream[substr]; unsigned int ch; if (s->param_presence_flags & PARAM_PRESENCE) if (get_bits1(gbp)) s->param_presence_flags = get_bits(gbp, 8); if (s->param_presence_flags & PARAM_BLOCKSIZE) if (get_bits1(gbp)) { s->blocksize = get_bits(gbp, 9); if (s->blocksize > MAX_BLOCKSIZE) { av_log(m->avctx, AV_LOG_ERROR, "block size too large\n"); s->blocksize = 0; return -1; } } if (s->param_presence_flags & PARAM_MATRIX) if (get_bits1(gbp)) { if (read_matrix_params(m, s, gbp) < 0) return -1; } if (s->param_presence_flags & PARAM_OUTSHIFT) if (get_bits1(gbp)) for (ch = 0; ch <= s->max_matrix_channel; ch++) { s->output_shift[ch] = get_sbits(gbp, 4); dprintf(m->avctx, "output shift[%d] = %d\n", ch, s->output_shift[ch]); } if (s->param_presence_flags & PARAM_QUANTSTEP) if (get_bits1(gbp)) for (ch = 0; ch <= s->max_channel; ch++) { ChannelParams *cp = &m->channel_params[ch]; s->quant_step_size[ch] = get_bits(gbp, 4); cp->sign_huff_offset = calculate_sign_huff(m, substr, ch); } for (ch = s->min_channel; ch <= s->max_channel; ch++) if (get_bits1(gbp)) { if (read_channel_params(m, substr, gbp, ch) < 0) return -1; } return 0; }
1threat
Spriung boot data source initialization error can some help me to resolve the issue, It's little bit urgent : 2016-08-10 11:51:29.938 INFO 4336 --- [ main] com.employee.EmployeeApplication : No active profile set, falling back to default profiles: default 2016-08-10 11:51:29.938 DEBUG 4336 --- [ main] o.s.boot.SpringApplication : Loading source class com.employee.EmployeeApplication 2016-08-10 11:51:29.961 DEBUG 4336 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'classpath:/application.yml' 2016-08-10 11:51:29.961 DEBUG 4336 --- [ main] o.s.b.c.c.ConfigFileApplicationListener : Loaded config file 'classpath:/application.yml' for profile default 2016-08-10 11:51:29.961 INFO 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@17486b3: startup date [Wed Aug 10 11:51:29 IST 2016]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@1cabb2a 2016-08-10 11:51:29.970 DEBUG 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Bean factory for org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@17486b3: org.springframework.beans.factory.support.DefaultListableBeanFactory@30646a: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,org.springframework.context.event.internalEventListenerProcessor,org.springframework.context.event.internalEventListenerFactory,employeeApplication]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@70f8a6 2016-08-10 11:51:41.990 DEBUG 4336 --- [ main] o.s.b.a.AutoConfigurationPackages : @EnableAutoConfiguration was declared on a class in the package 'com.employee'. Automatic @Repository and @Entity scanning is enabled. 2016-08-10 11:51:42.472 WARN 4336 --- [ main] o.s.c.a.ConfigurationClassPostProcessor : Cannot enhance @Configuration bean definition 'refreshScope' since its singleton instance has been created too early. The typical cause is a non-static @Bean method with a BeanDefinitionRegistryPostProcessor return type: Consider declaring such methods as 'static'. 2016-08-10 11:51:42.785 INFO 4336 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=d17d6c85-cdf2-3621-87fd-0420958f449a 2016-08-10 11:51:42.808 INFO 4336 --- [ main] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring 2016-08-10 11:51:43.091 INFO 4336 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [class org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$12e0b249] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-08-10 11:51:43.233 INFO 4336 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$2efab546] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-08-10 11:51:43.247 INFO 4336 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration' of type [class org.springframework.cloud.autoconfigure.RefreshEndpointAutoConfiguration$$EnhancerBySpringCGLIB$$d859b73c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2016-08-10 11:51:43.261 DEBUG 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource@e64760] 2016-08-10 11:51:43.261 DEBUG 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Using ApplicationEventMulticaster [org.springframework.context.event.SimpleApplicationEventMulticaster@5fd2b1] 2016-08-10 11:51:44.354 DEBUG 4336 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\Shadab%20Ahmed\.m2\repository\org\springframework\boot\spring-boot\1.3.6.RELEASE\spring-boot-1.3.6.RELEASE.jar 2016-08-10 11:51:44.354 DEBUG 4336 --- [ main] .t.TomcatEmbeddedServletContainerFactory : Code archive: C:\Users\Shadab%20Ahmed\.m2\repository\org\springframework\boot\spring-boot\1.3.6.RELEASE\spring-boot-1.3.6.RELEASE.jar 2016-08-10 11:51:44.356 DEBUG 4336 --- [ main] .t.TomcatEmbeddedServletContainerFactory : None of the document roots [src/main/webapp, public, static] point to a directory and will be ignored. 2016-08-10 11:51:44.544 INFO 4336 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8091 (http) 2016-08-10 11:51:44.579 INFO 4336 --- [ main] o.apache.catalina.core.StandardService : Starting service Tomcat 2016-08-10 11:51:44.583 INFO 4336 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.0.36 2016-08-10 11:51:45.030 INFO 4336 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2016-08-10 11:51:45.031 INFO 4336 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 15070 ms 2016-08-10 11:51:45.232 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Added existing Servlet initializer bean 'dispatcherServletRegistration'; order=2147483647, resource=class path resource [org/springframework/boot/autoconfigure/web/DispatcherServletAutoConfiguration$DispatcherServletConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'metricFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/actuate/autoconfigure/MetricFilterAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'characterEncodingFilter'; order=-2147483648, resource=class path resource [org/springframework/boot/autoconfigure/web/HttpEncodingAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'hiddenHttpMethodFilter'; order=-10000, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'httpPutFormContentFilter'; order=-9900, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'requestContextFilter'; order=-105, resource=class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'webRequestLoggingFilter'; order=2147483637, resource=class path resource [org/springframework/boot/actuate/autoconfigure/TraceWebFilterAutoConfiguration.class] 2016-08-10 11:51:46.114 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.e.ServletContextInitializerBeans : Created Filter initializer for bean 'applicationContextIdFilter'; order=2147483647, resource=class path resource [org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration.class] 2016-08-10 11:51:46.127 INFO 4336 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean : Mapping servlet: 'dispatcherServlet' to [/] 2016-08-10 11:51:46.142 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'metricFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'webRequestLoggingFilter' to: [/*] 2016-08-10 11:51:46.143 INFO 4336 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean : Mapping filter: 'applicationContextIdFilter' to: [/*] 2016-08-10 11:51:46.225 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.web.OrderedRequestContextFilter : Initializing filter 'requestContextFilter' 2016-08-10 11:51:46.229 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.web.OrderedRequestContextFilter : Filter 'requestContextFilter' configured successfully 2016-08-10 11:51:46.230 DEBUG 4336 --- [ost-startStop-1] iguration$ApplicationContextHeaderFilter : Initializing filter 'applicationContextIdFilter' 2016-08-10 11:51:46.230 DEBUG 4336 --- [ost-startStop-1] iguration$ApplicationContextHeaderFilter : Filter 'applicationContextIdFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] .s.b.c.w.OrderedHttpPutFormContentFilter : Initializing filter 'httpPutFormContentFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] .s.b.c.w.OrderedHttpPutFormContentFilter : Filter 'httpPutFormContentFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Initializing filter 'metricFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.autoconfigure.MetricsFilter : Filter 'metricFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedHiddenHttpMethodFilter : Initializing filter 'hiddenHttpMethodFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedHiddenHttpMethodFilter : Filter 'hiddenHttpMethodFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedCharacterEncodingFilter : Initializing filter 'characterEncodingFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.c.w.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured successfully 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Initializing filter 'webRequestLoggingFilter' 2016-08-10 11:51:46.231 DEBUG 4336 --- [ost-startStop-1] o.s.b.a.trace.WebRequestTraceFilter : Filter 'webRequestLoggingFilter' configured successfully 2016-08-10 11:51:46.338 WARN 4336 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). 2016-08-10 11:51:46.532 INFO 4336 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat 2016-08-10 11:51:46.734 ERROR 4336 --- [ main] o.s.boot.SpringApplication : Application startup failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:368) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1054) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:829) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538) ~[spring-context-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) ~[spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:760) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:360) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:306) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174) [spring-boot-1.3.6.RELEASE.jar:1.3.6.RELEASE] at com.employee.EmployeeApplication.main(EmployeeApplication.java:11) [classes/:na] Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.sql.DataSource org.springframework.boot.autoconfigure.orm.jpa.JpaBaseConfiguration.dataSource; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 26 common frames omitted Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceAutoConfiguration$NonEmbeddedConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1123) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1018) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 28 common frames omitted Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 40 common frames omitted Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active). at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.getDriverClassName(DataSourceProperties.java:180) ~[spring-boot-autoconfigure-1.3.6.RELEASE.jar:1.3.6.RELEASE] at org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration$NonEmbeddedConfiguration.dataSource(DataSourceAutoConfiguration.java:121) ~[spring-boot-autoconfigure-1.3.6.RELEASE.jar:1.3.6.RELEASE] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_11] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_11] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_11] at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_11] at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.2.7.RELEASE.jar:4.2.7.RELEASE] ... 41 common frames omitted Application.yml file content is server: port: 8091 debug: true spring: application: name: employee-app --- spring: profiles: local #hibernate config jpa: database-platform: org.hibernate.dialect.Oracle10gDialect hibernate: ddl-auto: update #Spring Boot Config for Oracle datasource: driver-class-name: oracle.jdbc.OracleDriver url: jdbc:oracle:thin:@localhost:1521:xe username: system password: root logging: level: org.springframework.security: INFO --- spring: profiles: default #hibernate config jpa: database-platform: org.hibernate.dialect.Oracle10gDialect #Spring Boot Config for Oracle datasource: driver-class-name: oracle.jdbc.OracleDriver url: jdbc:oracle:thin:@localhost:1521:xe username: system password: root logging: level: org.springframework.security: INFO
0debug
static int decode_q_branch(SnowContext *s, int level, int x, int y){ const int w= s->b_width << s->block_max_depth; const int rem_depth= s->block_max_depth - level; const int index= (x + y*w) << rem_depth; int trx= (x+1)<<rem_depth; const BlockNode *left = x ? &s->block[index-1] : &null_block; const BlockNode *top = y ? &s->block[index-w] : &null_block; const BlockNode *tl = y && x ? &s->block[index-w-1] : left; const BlockNode *tr = y && trx<w && ((x&1)==0 || level==0) ? &s->block[index-w+(1<<rem_depth)] : tl; int s_context= 2*left->level + 2*top->level + tl->level + tr->level; int res; if(s->keyframe){ set_blocks(s, level, x, y, null_block.color[0], null_block.color[1], null_block.color[2], null_block.mx, null_block.my, null_block.ref, BLOCK_INTRA); return 0; } if(level==s->block_max_depth || get_rac(&s->c, &s->block_state[4 + s_context])){ int type, mx, my; int l = left->color[0]; int cb= left->color[1]; int cr= left->color[2]; unsigned ref = 0; int ref_context= av_log2(2*left->ref) + av_log2(2*top->ref); int mx_context= av_log2(2*FFABS(left->mx - top->mx)) + 0*av_log2(2*FFABS(tr->mx - top->mx)); int my_context= av_log2(2*FFABS(left->my - top->my)) + 0*av_log2(2*FFABS(tr->my - top->my)); type= get_rac(&s->c, &s->block_state[1 + left->type + top->type]) ? BLOCK_INTRA : 0; if(type){ pred_mv(s, &mx, &my, 0, left, top, tr); l += get_symbol(&s->c, &s->block_state[32], 1); if (s->nb_planes > 2) { cb+= get_symbol(&s->c, &s->block_state[64], 1); cr+= get_symbol(&s->c, &s->block_state[96], 1); } }else{ if(s->ref_frames > 1) ref= get_symbol(&s->c, &s->block_state[128 + 1024 + 32*ref_context], 0); if (ref >= s->ref_frames) { av_log(s->avctx, AV_LOG_ERROR, "Invalid ref\n"); return AVERROR_INVALIDDATA; } pred_mv(s, &mx, &my, ref, left, top, tr); mx+= get_symbol(&s->c, &s->block_state[128 + 32*(mx_context + 16*!!ref)], 1); my+= get_symbol(&s->c, &s->block_state[128 + 32*(my_context + 16*!!ref)], 1); } set_blocks(s, level, x, y, l, cb, cr, mx, my, ref, type); }else{ if ((res = decode_q_branch(s, level+1, 2*x+0, 2*y+0)) < 0 || (res = decode_q_branch(s, level+1, 2*x+1, 2*y+0)) < 0 || (res = decode_q_branch(s, level+1, 2*x+0, 2*y+1)) < 0 || (res = decode_q_branch(s, level+1, 2*x+1, 2*y+1)) < 0) return res; } return 0; }
1threat
Converting a string with decimal pointers and thousand seperators interchangeably to a float in PHP : <p>I was wondering how to be able to convert any string to a float with the thousand separators and decimal pointers being able to be switched around. This is very useful when dealing with both European and American formats. E.g. <code>'2,192,520.12'</code> or <code>'2.192.520,12'</code></p>
0debug
How to change the text and icon color of selected menu item on Navigation Drawer programmatically using java : <p>I am a beginner in Android Development. Using android's default Navigation drawer activity I am developing an application. One of the requirements of this app is to change the background colors of layouts (including navigation drawer header color) randomly at run time. </p> <p>Now everything is going fine except the color of the selected menu item on navigation drawer is still <strong>blue</strong>. like this :</p> <p><a href="https://i.stack.imgur.com/7hCPk.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/7hCPk.jpg" alt="enter image description here"></a></p> <p><strong>Now what I want is as the background color of other layouts is pink the selected menu item on the navigation bar should also be pink (I mean the text color and the icon should be pink) like this :</strong></p> <p><a href="https://i.stack.imgur.com/eCJO1.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/eCJO1.jpg" alt="enter image description here"></a></p> <p><strong>Can anyone please tell how to achieve it programatically in code as I have to change selected text and icon colors at runtime randomly.</strong></p> <p>Here's the menu xml file for reference:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;menu xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;group android:checkableBehavior="single"&gt; &lt;item android:id="@+id/nav_quiz_all" android:icon="@drawable/ic_public_black_24dp" android:checked="true" android:title="All Countries Quiz"/&gt; &lt;item android:id="@+id/nav_quiz_bookmarked" android:icon="@drawable/ic_favorite_black_24dp" android:title="Favorite Quiz"/&gt; &lt;/group&gt; &lt;item android:title="Communicate"&gt; &lt;menu&gt; &lt;item android:id="@+id/nav_rate" android:icon="@drawable/ic_star_black_24dp" android:title="Rate this app"/&gt; &lt;item android:id="@+id/nav_share" android:icon="@drawable/ic_share_black_24dp" android:title="Share"/&gt; &lt;item android:id="@+id/nav_feedback" android:icon="@drawable/ic_feedback_black_24dp" android:title="Feedback"/&gt; &lt;item android:id="@+id/nav_about" android:icon="@drawable/ic_info_black_24dp" android:title="About"/&gt; &lt;/menu&gt; &lt;/item&gt; &lt;item android:id="@+id/nav_settings" android:icon="@drawable/ic_settings_black_24dp" android:title="Settings"/&gt; &lt;/menu&gt; </code></pre>
0debug
static av_noinline void emulated_edge_mc_sse(uint8_t *buf, ptrdiff_t buf_stride, const uint8_t *src, ptrdiff_t src_stride, int block_w, int block_h, int src_x, int src_y, int w, int h) { emulated_edge_mc(buf, buf_stride, src, src_stride, block_w, block_h, src_x, src_y, w, h, vfixtbl_sse, &ff_emu_edge_vvar_sse, hfixtbl_sse, #if ARCH_X86_64 &ff_emu_edge_hvar_sse #else &ff_emu_edge_hvar_mmx #endif ); }
1threat
How to write Facebook App that continuously update profile picture : <p>I want to know if its possible to create Facebook app that continuously update users profile picture. I can't see anything in the docs. Do you know if this is possible and if so any docs on implementing it?</p> <p>Thanks in advance.</p>
0debug
static void arm_idct_put(UINT8 *dest, int line_size, DCTELEM *block) { j_rev_dct_ARM (block); put_pixels_clamped(block, dest, line_size); }
1threat
sql sum with limit : I have a mysql table with that is called transactions and have the following fields user varchar, amount float I want to make a group by like this SELECT user, SUM(amount) as S FROM (SELECT * FROM transactions ORDER BY amount DESC ) t GROUP BY user, s but i want to limit the sum only on the top 10 ammounts. Is it possible to do that with plain sql?
0debug
Is there a way to convert javascript Date object to string but retain the format as displayed when console.log is used on the Date object? : <p>I want to convert the date object to string but I want it in the same format as it is displayed when I do <code>console.log(new Date())</code> which is something like '2019-05-21T11:55:39.496Z' and not the usual extended format we get when we do <code>console.log(new Date().toString())</code> which is something like this 'Tue May 21 2019 17:28:51 GMT+0530 (India Standard Time)'.</p>
0debug
static void disas_sparc_insn(DisasContext * dc) { unsigned int insn, opc, rs1, rs2, rd; insn = ldl_code(dc->pc); opc = GET_FIELD(insn, 0, 1); rd = GET_FIELD(insn, 2, 6); switch (opc) { case 0: { unsigned int xop = GET_FIELD(insn, 7, 9); int32_t target; switch (xop) { #ifdef TARGET_SPARC64 case 0x1: { int cc; target = GET_FIELD_SP(insn, 0, 18); target = sign_extend(target, 18); target <<= 2; cc = GET_FIELD_SP(insn, 20, 21); if (cc == 0) do_branch(dc, target, insn, 0); else if (cc == 2) do_branch(dc, target, insn, 1); else goto jmp_insn; } case 0x3: { target = GET_FIELD_SP(insn, 0, 13) | (GET_FIELD_SP(insn, 20, 21) << 14); target = sign_extend(target, 16); target <<= 2; rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); do_branch_reg(dc, target, insn); goto jmp_insn; } case 0x5: { int cc = GET_FIELD_SP(insn, 20, 21); if (gen_trap_ifnofpu(dc)) goto jmp_insn; target = GET_FIELD_SP(insn, 0, 18); target = sign_extend(target, 19); target <<= 2; do_fbranch(dc, target, insn, cc); goto jmp_insn; } #endif case 0x2: { target = GET_FIELD(insn, 10, 31); target = sign_extend(target, 22); target <<= 2; do_branch(dc, target, insn, 0); goto jmp_insn; } case 0x6: { if (gen_trap_ifnofpu(dc)) goto jmp_insn; target = GET_FIELD(insn, 10, 31); target = sign_extend(target, 22); target <<= 2; do_fbranch(dc, target, insn, 0); goto jmp_insn; } case 0x4: #define OPTIM #if defined(OPTIM) if (rd) { #endif uint32_t value = GET_FIELD(insn, 10, 31); gen_movl_imm_T0(value << 10); gen_movl_T0_reg(rd); #if defined(OPTIM) } #endif break; case 0x0: default: } break; } break; case 1: { target_long target = GET_FIELDs(insn, 2, 31) << 2; #ifdef TARGET_SPARC64 if (dc->pc == (uint32_t)dc->pc) { gen_op_movl_T0_im(dc->pc); } else { gen_op_movq_T0_im64(dc->pc >> 32, dc->pc); } #else gen_op_movl_T0_im(dc->pc); #endif gen_movl_T0_reg(15); target += dc->pc; gen_mov_pc_npc(dc); dc->npc = target; } goto jmp_insn; case 2: { unsigned int xop = GET_FIELD(insn, 7, 12); if (xop == 0x3a) { int cond; rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELD(insn, 25, 31); #if defined(OPTIM) if (rs2 != 0) { #endif gen_movl_simm_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } else { rs2 = GET_FIELD(insn, 27, 31); #if defined(OPTIM) if (rs2 != 0) { #endif gen_movl_reg_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } cond = GET_FIELD(insn, 3, 6); if (cond == 0x8) { save_state(dc); gen_op_trap_T0(); } else if (cond != 0) { #ifdef TARGET_SPARC64 int cc = GET_FIELD_SP(insn, 11, 12); flush_T2(dc); save_state(dc); if (cc == 0) gen_cond[0][cond](); else if (cc == 2) gen_cond[1][cond](); else #else flush_T2(dc); save_state(dc); gen_cond[0][cond](); #endif gen_op_trapcc_T0(); } gen_op_next_insn(); gen_op_movl_T0_0(); gen_op_exit_tb(); dc->is_br = 1; goto jmp_insn; } else if (xop == 0x28) { rs1 = GET_FIELD(insn, 13, 17); switch(rs1) { case 0: #ifndef TARGET_SPARC64 case 0x01 ... 0x0e: case 0x0f: case 0x10 ... 0x1f: #endif gen_op_movtl_T0_env(offsetof(CPUSPARCState, y)); gen_movl_T0_reg(rd); break; #ifdef TARGET_SPARC64 case 0x2: gen_op_rdccr(); gen_movl_T0_reg(rd); break; case 0x3: gen_op_movl_T0_env(offsetof(CPUSPARCState, asi)); gen_movl_T0_reg(rd); break; case 0x4: gen_op_rdtick(); gen_movl_T0_reg(rd); break; case 0x5: if (dc->pc == (uint32_t)dc->pc) { gen_op_movl_T0_im(dc->pc); } else { gen_op_movq_T0_im64(dc->pc >> 32, dc->pc); } gen_movl_T0_reg(rd); break; case 0x6: gen_op_movl_T0_env(offsetof(CPUSPARCState, fprs)); gen_movl_T0_reg(rd); break; case 0xf: break; case 0x13: if (gen_trap_ifnofpu(dc)) goto jmp_insn; gen_op_movtl_T0_env(offsetof(CPUSPARCState, gsr)); gen_movl_T0_reg(rd); break; case 0x17: gen_op_movtl_T0_env(offsetof(CPUSPARCState, tick_cmpr)); gen_movl_T0_reg(rd); break; case 0x18: gen_op_rdtick(); gen_movl_T0_reg(rd); break; case 0x19: gen_op_movtl_T0_env(offsetof(CPUSPARCState, stick_cmpr)); gen_movl_T0_reg(rd); break; case 0x10: case 0x11: case 0x12: case 0x14: case 0x15: case 0x16: #endif default: } #if !defined(CONFIG_USER_ONLY) #ifndef TARGET_SPARC64 } else if (xop == 0x29) { if (!supervisor(dc)) goto priv_insn; gen_op_rdpsr(); gen_movl_T0_reg(rd); break; #endif } else if (xop == 0x2a) { if (!supervisor(dc)) goto priv_insn; #ifdef TARGET_SPARC64 rs1 = GET_FIELD(insn, 13, 17); switch (rs1) { case 0: gen_op_rdtpc(); break; case 1: gen_op_rdtnpc(); break; case 2: gen_op_rdtstate(); break; case 3: gen_op_rdtt(); break; case 4: gen_op_rdtick(); break; case 5: gen_op_movtl_T0_env(offsetof(CPUSPARCState, tbr)); break; case 6: gen_op_rdpstate(); break; case 7: gen_op_movl_T0_env(offsetof(CPUSPARCState, tl)); break; case 8: gen_op_movl_T0_env(offsetof(CPUSPARCState, psrpil)); break; case 9: gen_op_rdcwp(); break; case 10: gen_op_movl_T0_env(offsetof(CPUSPARCState, cansave)); break; case 11: gen_op_movl_T0_env(offsetof(CPUSPARCState, canrestore)); break; case 12: gen_op_movl_T0_env(offsetof(CPUSPARCState, cleanwin)); break; case 13: gen_op_movl_T0_env(offsetof(CPUSPARCState, otherwin)); break; case 14: gen_op_movl_T0_env(offsetof(CPUSPARCState, wstate)); break; case 31: gen_op_movtl_T0_env(offsetof(CPUSPARCState, version)); break; case 15: default: } #else gen_op_movl_T0_env(offsetof(CPUSPARCState, wim)); #endif gen_movl_T0_reg(rd); break; } else if (xop == 0x2b) { #ifdef TARGET_SPARC64 gen_op_flushw(); #else if (!supervisor(dc)) goto priv_insn; gen_op_movtl_T0_env(offsetof(CPUSPARCState, tbr)); gen_movl_T0_reg(rd); #endif break; #endif } else if (xop == 0x34) { if (gen_trap_ifnofpu(dc)) goto jmp_insn; rs1 = GET_FIELD(insn, 13, 17); rs2 = GET_FIELD(insn, 27, 31); xop = GET_FIELD(insn, 18, 26); switch (xop) { case 0x1: gen_op_load_fpr_FT0(rs2); gen_op_store_FT0_fpr(rd); break; case 0x5: gen_op_load_fpr_FT1(rs2); gen_op_fnegs(); gen_op_store_FT0_fpr(rd); break; case 0x9: gen_op_load_fpr_FT1(rs2); gen_op_fabss(); gen_op_store_FT0_fpr(rd); break; case 0x29: gen_op_load_fpr_FT1(rs2); gen_op_fsqrts(); gen_op_store_FT0_fpr(rd); break; case 0x2a: gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fsqrtd(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x2b: goto nfpu_insn; case 0x41: gen_op_load_fpr_FT0(rs1); gen_op_load_fpr_FT1(rs2); gen_op_fadds(); gen_op_store_FT0_fpr(rd); break; case 0x42: gen_op_load_fpr_DT0(DFPREG(rs1)); gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_faddd(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x43: goto nfpu_insn; case 0x45: gen_op_load_fpr_FT0(rs1); gen_op_load_fpr_FT1(rs2); gen_op_fsubs(); gen_op_store_FT0_fpr(rd); break; case 0x46: gen_op_load_fpr_DT0(DFPREG(rs1)); gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fsubd(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x47: goto nfpu_insn; case 0x49: gen_op_load_fpr_FT0(rs1); gen_op_load_fpr_FT1(rs2); gen_op_fmuls(); gen_op_store_FT0_fpr(rd); break; case 0x4a: gen_op_load_fpr_DT0(DFPREG(rs1)); gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fmuld(); gen_op_store_DT0_fpr(rd); break; case 0x4b: goto nfpu_insn; case 0x4d: gen_op_load_fpr_FT0(rs1); gen_op_load_fpr_FT1(rs2); gen_op_fdivs(); gen_op_store_FT0_fpr(rd); break; case 0x4e: gen_op_load_fpr_DT0(DFPREG(rs1)); gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fdivd(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x4f: goto nfpu_insn; case 0x69: gen_op_load_fpr_FT0(rs1); gen_op_load_fpr_FT1(rs2); gen_op_fsmuld(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x6e: goto nfpu_insn; case 0xc4: gen_op_load_fpr_FT1(rs2); gen_op_fitos(); gen_op_store_FT0_fpr(rd); break; case 0xc6: gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fdtos(); gen_op_store_FT0_fpr(rd); break; case 0xc7: goto nfpu_insn; case 0xc8: gen_op_load_fpr_FT1(rs2); gen_op_fitod(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0xc9: gen_op_load_fpr_FT1(rs2); gen_op_fstod(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0xcb: goto nfpu_insn; case 0xcc: goto nfpu_insn; case 0xcd: goto nfpu_insn; case 0xce: goto nfpu_insn; case 0xd1: gen_op_load_fpr_FT1(rs2); gen_op_fstoi(); gen_op_store_FT0_fpr(rd); break; case 0xd2: gen_op_load_fpr_DT1(rs2); gen_op_fdtoi(); gen_op_store_FT0_fpr(rd); break; case 0xd3: goto nfpu_insn; #ifdef TARGET_SPARC64 case 0x2: gen_op_load_fpr_DT0(DFPREG(rs2)); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x6: gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fnegd(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0xa: gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fabsd(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x81: gen_op_load_fpr_FT1(rs2); gen_op_fstox(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x82: gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fdtox(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x84: gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fxtos(); gen_op_store_FT0_fpr(rd); break; case 0x88: gen_op_load_fpr_DT1(DFPREG(rs2)); gen_op_fxtod(); gen_op_store_DT0_fpr(DFPREG(rd)); break; case 0x3: case 0x7: case 0xb: case 0x83: case 0x8c: goto nfpu_insn; #endif default: } } else if (xop == 0x35) { #ifdef TARGET_SPARC64 int cond; #endif if (gen_trap_ifnofpu(dc)) goto jmp_insn; rs1 = GET_FIELD(insn, 13, 17); rs2 = GET_FIELD(insn, 27, 31); xop = GET_FIELD(insn, 18, 26); #ifdef TARGET_SPARC64 if ((xop & 0x11f) == 0x005) { cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_FT0(rd); gen_op_load_fpr_FT1(rs2); rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); flush_T2(dc); gen_cond_reg(cond); gen_op_fmovs_cc(); gen_op_store_FT0_fpr(rd); break; } else if ((xop & 0x11f) == 0x006) { cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_DT0(rd); gen_op_load_fpr_DT1(rs2); flush_T2(dc); rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); gen_cond_reg(cond); gen_op_fmovs_cc(); gen_op_store_DT0_fpr(rd); break; } else if ((xop & 0x11f) == 0x007) { goto nfpu_insn; } #endif switch (xop) { #ifdef TARGET_SPARC64 case 0x001: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_FT0(rd); gen_op_load_fpr_FT1(rs2); flush_T2(dc); gen_fcond[0][cond](); gen_op_fmovs_cc(); gen_op_store_FT0_fpr(rd); break; case 0x002: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_DT0(rd); gen_op_load_fpr_DT1(rs2); flush_T2(dc); gen_fcond[0][cond](); gen_op_fmovd_cc(); gen_op_store_DT0_fpr(rd); break; case 0x003: goto nfpu_insn; case 0x041: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_FT0(rd); gen_op_load_fpr_FT1(rs2); flush_T2(dc); gen_fcond[1][cond](); gen_op_fmovs_cc(); gen_op_store_FT0_fpr(rd); break; case 0x042: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_DT0(rd); gen_op_load_fpr_DT1(rs2); flush_T2(dc); gen_fcond[1][cond](); gen_op_fmovd_cc(); gen_op_store_DT0_fpr(rd); break; case 0x043: goto nfpu_insn; case 0x081: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_FT0(rd); gen_op_load_fpr_FT1(rs2); flush_T2(dc); gen_fcond[2][cond](); gen_op_fmovs_cc(); gen_op_store_FT0_fpr(rd); break; case 0x082: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_DT0(rd); gen_op_load_fpr_DT1(rs2); flush_T2(dc); gen_fcond[2][cond](); gen_op_fmovd_cc(); gen_op_store_DT0_fpr(rd); break; case 0x083: goto nfpu_insn; case 0x0c1: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_FT0(rd); gen_op_load_fpr_FT1(rs2); flush_T2(dc); gen_fcond[3][cond](); gen_op_fmovs_cc(); gen_op_store_FT0_fpr(rd); break; case 0x0c2: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_DT0(rd); gen_op_load_fpr_DT1(rs2); flush_T2(dc); gen_fcond[3][cond](); gen_op_fmovd_cc(); gen_op_store_DT0_fpr(rd); break; case 0x0c3: goto nfpu_insn; case 0x101: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_FT0(rd); gen_op_load_fpr_FT1(rs2); flush_T2(dc); gen_cond[0][cond](); gen_op_fmovs_cc(); gen_op_store_FT0_fpr(rd); break; case 0x102: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_DT0(rd); gen_op_load_fpr_DT1(rs2); flush_T2(dc); gen_cond[0][cond](); gen_op_fmovd_cc(); gen_op_store_DT0_fpr(rd); break; case 0x103: goto nfpu_insn; case 0x181: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_FT0(rd); gen_op_load_fpr_FT1(rs2); flush_T2(dc); gen_cond[1][cond](); gen_op_fmovs_cc(); gen_op_store_FT0_fpr(rd); break; case 0x182: cond = GET_FIELD_SP(insn, 14, 17); gen_op_load_fpr_DT0(rd); gen_op_load_fpr_DT1(rs2); flush_T2(dc); gen_cond[1][cond](); gen_op_fmovd_cc(); gen_op_store_DT0_fpr(rd); break; case 0x183: goto nfpu_insn; #endif case 0x51: gen_op_load_fpr_FT0(rs1); gen_op_load_fpr_FT1(rs2); #ifdef TARGET_SPARC64 gen_fcmps[rd & 3](); #else gen_op_fcmps(); #endif break; case 0x52: gen_op_load_fpr_DT0(DFPREG(rs1)); gen_op_load_fpr_DT1(DFPREG(rs2)); #ifdef TARGET_SPARC64 gen_fcmpd[rd & 3](); #else gen_op_fcmpd(); #endif break; case 0x53: goto nfpu_insn; case 0x55: gen_op_load_fpr_FT0(rs1); gen_op_load_fpr_FT1(rs2); #ifdef TARGET_SPARC64 gen_fcmps[rd & 3](); #else gen_op_fcmps(); #endif break; case 0x56: gen_op_load_fpr_DT0(DFPREG(rs1)); gen_op_load_fpr_DT1(DFPREG(rs2)); #ifdef TARGET_SPARC64 gen_fcmpd[rd & 3](); #else gen_op_fcmpd(); #endif break; case 0x57: goto nfpu_insn; default: } #if defined(OPTIM) } else if (xop == 0x2) { rs1 = GET_FIELD(insn, 13, 17); if (rs1 == 0) { if (IS_IMM) { rs2 = GET_FIELDs(insn, 19, 31); gen_movl_simm_T1(rs2); } else { rs2 = GET_FIELD(insn, 27, 31); gen_movl_reg_T1(rs2); } gen_movl_T1_reg(rd); } else { gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 19, 31); if (rs2 != 0) { gen_movl_simm_T1(rs2); gen_op_or_T1_T0(); } } else { rs2 = GET_FIELD(insn, 27, 31); if (rs2 != 0) { gen_movl_reg_T1(rs2); gen_op_or_T1_T0(); } } gen_movl_T0_reg(rd); } #endif #ifdef TARGET_SPARC64 } else if (xop == 0x25) { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 20, 31); gen_movl_simm_T1(rs2); } else { rs2 = GET_FIELD(insn, 27, 31); gen_movl_reg_T1(rs2); } gen_op_sll(); gen_movl_T0_reg(rd); } else if (xop == 0x26) { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 20, 31); gen_movl_simm_T1(rs2); } else { rs2 = GET_FIELD(insn, 27, 31); gen_movl_reg_T1(rs2); } if (insn & (1 << 12)) gen_op_srlx(); else gen_op_srl(); gen_movl_T0_reg(rd); } else if (xop == 0x27) { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 20, 31); gen_movl_simm_T1(rs2); } else { rs2 = GET_FIELD(insn, 27, 31); gen_movl_reg_T1(rs2); } if (insn & (1 << 12)) gen_op_srax(); else gen_op_sra(); gen_movl_T0_reg(rd); #endif } else if (xop < 0x36) { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 19, 31); gen_movl_simm_T1(rs2); } else { rs2 = GET_FIELD(insn, 27, 31); gen_movl_reg_T1(rs2); } if (xop < 0x20) { switch (xop & ~0x10) { case 0x0: if (xop & 0x10) gen_op_add_T1_T0_cc(); else gen_op_add_T1_T0(); break; case 0x1: gen_op_and_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0x2: gen_op_or_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0x3: gen_op_xor_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0x4: if (xop & 0x10) gen_op_sub_T1_T0_cc(); else gen_op_sub_T1_T0(); break; case 0x5: gen_op_andn_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0x6: gen_op_orn_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0x7: gen_op_xnor_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0x8: if (xop & 0x10) gen_op_addx_T1_T0_cc(); else gen_op_addx_T1_T0(); break; #ifdef TARGET_SPARC64 case 0x9: gen_op_mulx_T1_T0(); break; #endif case 0xa: gen_op_umul_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0xb: gen_op_smul_T1_T0(); if (xop & 0x10) gen_op_logic_T0_cc(); break; case 0xc: if (xop & 0x10) gen_op_subx_T1_T0_cc(); else gen_op_subx_T1_T0(); break; #ifdef TARGET_SPARC64 case 0xd: gen_op_udivx_T1_T0(); break; #endif case 0xe: gen_op_udiv_T1_T0(); if (xop & 0x10) gen_op_div_cc(); break; case 0xf: gen_op_sdiv_T1_T0(); if (xop & 0x10) gen_op_div_cc(); break; default: } gen_movl_T0_reg(rd); } else { switch (xop) { case 0x20: gen_op_tadd_T1_T0_cc(); gen_movl_T0_reg(rd); break; case 0x21: gen_op_tsub_T1_T0_cc(); gen_movl_T0_reg(rd); break; case 0x22: gen_op_tadd_T1_T0_ccTV(); gen_movl_T0_reg(rd); break; case 0x23: gen_op_tsub_T1_T0_ccTV(); gen_movl_T0_reg(rd); break; case 0x24: gen_op_mulscc_T1_T0(); gen_movl_T0_reg(rd); break; #ifndef TARGET_SPARC64 case 0x25: gen_op_sll(); gen_movl_T0_reg(rd); break; case 0x26: gen_op_srl(); gen_movl_T0_reg(rd); break; case 0x27: gen_op_sra(); gen_movl_T0_reg(rd); break; #endif case 0x30: { switch(rd) { case 0: gen_op_xor_T1_T0(); gen_op_movtl_env_T0(offsetof(CPUSPARCState, y)); break; #ifndef TARGET_SPARC64 case 0x01 ... 0x0f: case 0x10 ... 0x1f: break; #else case 0x2: gen_op_wrccr(); break; case 0x3: gen_op_movl_env_T0(offsetof(CPUSPARCState, asi)); break; case 0x6: gen_op_movl_env_T0(offsetof(CPUSPARCState, fprs)); break; case 0xf: #if !defined(CONFIG_USER_ONLY) if (supervisor(dc)) gen_op_sir(); #endif break; case 0x13: if (gen_trap_ifnofpu(dc)) goto jmp_insn; gen_op_movtl_env_T0(offsetof(CPUSPARCState, gsr)); break; case 0x17: #if !defined(CONFIG_USER_ONLY) if (!supervisor(dc)) #endif gen_op_movtl_env_T0(offsetof(CPUSPARCState, tick_cmpr)); break; case 0x18: #if !defined(CONFIG_USER_ONLY) if (!supervisor(dc)) #endif gen_op_movtl_env_T0(offsetof(CPUSPARCState, stick_cmpr)); break; case 0x19: #if !defined(CONFIG_USER_ONLY) if (!supervisor(dc)) #endif gen_op_movtl_env_T0(offsetof(CPUSPARCState, stick_cmpr)); break; case 0x10: case 0x11: case 0x12: case 0x14: case 0x15: case 0x16: #endif default: } } break; #if !defined(CONFIG_USER_ONLY) case 0x31: { if (!supervisor(dc)) goto priv_insn; #ifdef TARGET_SPARC64 switch (rd) { case 0: gen_op_saved(); break; case 1: gen_op_restored(); break; default: } #else gen_op_xor_T1_T0(); gen_op_wrpsr(); save_state(dc); gen_op_next_insn(); gen_op_movl_T0_0(); gen_op_exit_tb(); dc->is_br = 1; #endif } break; case 0x32: { if (!supervisor(dc)) goto priv_insn; gen_op_xor_T1_T0(); #ifdef TARGET_SPARC64 switch (rd) { case 0: gen_op_wrtpc(); break; case 1: gen_op_wrtnpc(); break; case 2: gen_op_wrtstate(); break; case 3: gen_op_wrtt(); break; case 4: gen_op_wrtick(); break; case 5: gen_op_movtl_env_T0(offsetof(CPUSPARCState, tbr)); break; case 6: gen_op_wrpstate(); save_state(dc); gen_op_next_insn(); gen_op_movl_T0_0(); gen_op_exit_tb(); dc->is_br = 1; break; case 7: gen_op_movl_env_T0(offsetof(CPUSPARCState, tl)); break; case 8: gen_op_movl_env_T0(offsetof(CPUSPARCState, psrpil)); break; case 9: gen_op_wrcwp(); break; case 10: gen_op_movl_env_T0(offsetof(CPUSPARCState, cansave)); break; case 11: gen_op_movl_env_T0(offsetof(CPUSPARCState, canrestore)); break; case 12: gen_op_movl_env_T0(offsetof(CPUSPARCState, cleanwin)); break; case 13: gen_op_movl_env_T0(offsetof(CPUSPARCState, otherwin)); break; case 14: gen_op_movl_env_T0(offsetof(CPUSPARCState, wstate)); break; default: } #else gen_op_wrwim(); #endif } break; #ifndef TARGET_SPARC64 case 0x33: { if (!supervisor(dc)) goto priv_insn; gen_op_xor_T1_T0(); gen_op_movtl_env_T0(offsetof(CPUSPARCState, tbr)); } break; #endif #endif #ifdef TARGET_SPARC64 case 0x2c: { int cc = GET_FIELD_SP(insn, 11, 12); int cond = GET_FIELD_SP(insn, 14, 17); if (IS_IMM) { rs2 = GET_FIELD_SPs(insn, 0, 10); gen_movl_simm_T1(rs2); } else { rs2 = GET_FIELD_SP(insn, 0, 4); gen_movl_reg_T1(rs2); } gen_movl_reg_T0(rd); flush_T2(dc); if (insn & (1 << 18)) { if (cc == 0) gen_cond[0][cond](); else if (cc == 2) gen_cond[1][cond](); else } else { gen_fcond[cc][cond](); } gen_op_mov_cc(); gen_movl_T0_reg(rd); break; } case 0x2d: gen_op_sdivx_T1_T0(); gen_movl_T0_reg(rd); break; case 0x2e: { if (IS_IMM) { rs2 = GET_FIELD_SPs(insn, 0, 12); gen_movl_simm_T1(rs2); optimize: popc(constant) } else { rs2 = GET_FIELD_SP(insn, 0, 4); gen_movl_reg_T1(rs2); } gen_op_popc(); gen_movl_T0_reg(rd); } case 0x2f: { int cond = GET_FIELD_SP(insn, 10, 12); rs1 = GET_FIELD(insn, 13, 17); flush_T2(dc); gen_movl_reg_T0(rs1); gen_cond_reg(cond); if (IS_IMM) { rs2 = GET_FIELD_SPs(insn, 0, 10); gen_movl_simm_T1(rs2); } else { rs2 = GET_FIELD_SP(insn, 0, 4); gen_movl_reg_T1(rs2); } gen_movl_reg_T0(rd); gen_op_mov_cc(); gen_movl_T0_reg(rd); break; } case 0x36: { int opf = GET_FIELD_SP(insn, 5, 13); rs1 = GET_FIELD(insn, 13, 17); rs2 = GET_FIELD(insn, 27, 31); switch (opf) { case 0x018: if (gen_trap_ifnofpu(dc)) goto jmp_insn; gen_movl_reg_T0(rs1); gen_movl_reg_T1(rs2); gen_op_alignaddr(); gen_movl_T0_reg(rd); break; case 0x01a: if (gen_trap_ifnofpu(dc)) goto jmp_insn; break; case 0x048: if (gen_trap_ifnofpu(dc)) goto jmp_insn; gen_op_load_fpr_DT0(rs1); gen_op_load_fpr_DT1(rs2); gen_op_faligndata(); gen_op_store_DT0_fpr(rd); break; default: } break; } #endif default: } } } else if (xop == 0x36 || xop == 0x37) { #ifdef TARGET_SPARC64 #else goto ncp_insn; #endif #ifdef TARGET_SPARC64 } else if (xop == 0x39) { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 19, 31); #if defined(OPTIM) if (rs2) { #endif gen_movl_simm_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } else { rs2 = GET_FIELD(insn, 27, 31); #if defined(OPTIM) if (rs2) { #endif gen_movl_reg_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } gen_op_restore(); gen_mov_pc_npc(dc); gen_op_movl_npc_T0(); dc->npc = DYNAMIC_PC; goto jmp_insn; #endif } else { rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 19, 31); #if defined(OPTIM) if (rs2) { #endif gen_movl_simm_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } else { rs2 = GET_FIELD(insn, 27, 31); #if defined(OPTIM) if (rs2) { #endif gen_movl_reg_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } switch (xop) { case 0x38: { if (rd != 0) { #ifdef TARGET_SPARC64 if (dc->pc == (uint32_t)dc->pc) { gen_op_movl_T1_im(dc->pc); } else { gen_op_movq_T1_im64(dc->pc >> 32, dc->pc); } #else gen_op_movl_T1_im(dc->pc); #endif gen_movl_T1_reg(rd); } gen_mov_pc_npc(dc); gen_op_movl_npc_T0(); dc->npc = DYNAMIC_PC; } goto jmp_insn; #if !defined(CONFIG_USER_ONLY) && !defined(TARGET_SPARC64) case 0x39: { if (!supervisor(dc)) goto priv_insn; gen_mov_pc_npc(dc); gen_op_movl_npc_T0(); dc->npc = DYNAMIC_PC; gen_op_rett(); } goto jmp_insn; #endif case 0x3b: gen_op_flush_T0(); break; case 0x3c: save_state(dc); gen_op_save(); gen_movl_T0_reg(rd); break; case 0x3d: save_state(dc); gen_op_restore(); gen_movl_T0_reg(rd); break; #if !defined(CONFIG_USER_ONLY) && defined(TARGET_SPARC64) case 0x3e: { switch (rd) { case 0: if (!supervisor(dc)) goto priv_insn; dc->npc = DYNAMIC_PC; dc->pc = DYNAMIC_PC; gen_op_done(); goto jmp_insn; case 1: if (!supervisor(dc)) goto priv_insn; dc->npc = DYNAMIC_PC; dc->pc = DYNAMIC_PC; gen_op_retry(); goto jmp_insn; default: } } break; #endif default: } } break; } break; case 3: { unsigned int xop = GET_FIELD(insn, 7, 12); rs1 = GET_FIELD(insn, 13, 17); gen_movl_reg_T0(rs1); if (IS_IMM) { rs2 = GET_FIELDs(insn, 19, 31); #if defined(OPTIM) if (rs2 != 0) { #endif gen_movl_simm_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } else { rs2 = GET_FIELD(insn, 27, 31); #if defined(OPTIM) if (rs2 != 0) { #endif gen_movl_reg_T1(rs2); gen_op_add_T1_T0(); #if defined(OPTIM) } #endif } if (xop < 4 || (xop > 7 && xop < 0x14 && xop != 0x0e) || \ (xop > 0x17 && xop < 0x1d ) || \ (xop > 0x2c && xop < 0x33) || xop == 0x1f) { switch (xop) { case 0x0: gen_op_ldst(ld); break; case 0x1: gen_op_ldst(ldub); break; case 0x2: gen_op_ldst(lduh); break; case 0x3: gen_op_ldst(ldd); gen_movl_T0_reg(rd + 1); break; case 0x9: gen_op_ldst(ldsb); break; case 0xa: gen_op_ldst(ldsh); break; case 0xd: gen_op_ldst(ldstub); break; case 0x0f: gen_movl_reg_T1(rd); gen_op_ldst(swap); break; #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x10: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_lda(insn, 1, 4, 0); break; case 0x11: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_lduba(insn, 1, 1, 0); break; case 0x12: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_lduha(insn, 1, 2, 0); break; case 0x13: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_ldda(insn, 1, 8, 0); gen_movl_T0_reg(rd + 1); break; case 0x19: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_ldsba(insn, 1, 1, 1); break; case 0x1a: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_ldsha(insn, 1, 2 ,1); break; case 0x1d: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_ldstuba(insn, 1, 1, 0); break; case 0x1f: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_movl_reg_T1(rd); gen_op_swapa(insn, 1, 4, 0); break; #ifndef TARGET_SPARC64 case 0x30: case 0x31: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: goto ncp_insn; break; (void) &gen_op_stfa; (void) &gen_op_stdfa; (void) &gen_op_ldfa; (void) &gen_op_lddfa; #else #if !defined(CONFIG_USER_ONLY) (void) &gen_op_cas; (void) &gen_op_casx; #endif #endif #endif #ifdef TARGET_SPARC64 case 0x08: gen_op_ldst(ldsw); break; case 0x0b: gen_op_ldst(ldx); break; case 0x18: gen_op_ldswa(insn, 1, 4, 1); break; case 0x1b: gen_op_ldxa(insn, 1, 8, 0); break; case 0x2d: goto skip_move; case 0x30: gen_op_ldfa(insn, 1, 8, 0); break; case 0x33: gen_op_lddfa(insn, 1, 8, 0); break; case 0x3d: goto skip_move; case 0x32: goto nfpu_insn; #endif default: } gen_movl_T1_reg(rd); #ifdef TARGET_SPARC64 skip_move: ; #endif } else if (xop >= 0x20 && xop < 0x24) { if (gen_trap_ifnofpu(dc)) goto jmp_insn; switch (xop) { case 0x20: gen_op_ldst(ldf); gen_op_store_FT0_fpr(rd); break; case 0x21: gen_op_ldst(ldf); gen_op_ldfsr(); break; case 0x22: goto nfpu_insn; case 0x23: gen_op_ldst(lddf); gen_op_store_DT0_fpr(DFPREG(rd)); break; default: } } else if (xop < 8 || (xop >= 0x14 && xop < 0x18) || \ xop == 0xe || xop == 0x1e) { gen_movl_reg_T1(rd); switch (xop) { case 0x4: gen_op_ldst(st); break; case 0x5: gen_op_ldst(stb); break; case 0x6: gen_op_ldst(sth); break; case 0x7: flush_T2(dc); gen_movl_reg_T2(rd + 1); gen_op_ldst(std); break; #if !defined(CONFIG_USER_ONLY) || defined(TARGET_SPARC64) case 0x14: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_sta(insn, 0, 4, 0); break; case 0x15: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_stba(insn, 0, 1, 0); break; case 0x16: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif gen_op_stha(insn, 0, 2, 0); break; case 0x17: #ifndef TARGET_SPARC64 if (IS_IMM) if (!supervisor(dc)) goto priv_insn; #endif flush_T2(dc); gen_movl_reg_T2(rd + 1); gen_op_stda(insn, 0, 8, 0); break; #endif #ifdef TARGET_SPARC64 case 0x0e: gen_op_ldst(stx); break; case 0x1e: gen_op_stxa(insn, 0, 8, 0); break; #endif default: } } else if (xop > 0x23 && xop < 0x28) { if (gen_trap_ifnofpu(dc)) goto jmp_insn; switch (xop) { case 0x24: gen_op_load_fpr_FT0(rd); gen_op_ldst(stf); break; case 0x25: gen_op_stfsr(); gen_op_ldst(stf); break; case 0x26: goto nfpu_insn; case 0x27: gen_op_load_fpr_DT0(DFPREG(rd)); gen_op_ldst(stdf); break; default: } } else if (xop > 0x33 && xop < 0x3f) { #ifdef TARGET_SPARC64 switch (xop) { case 0x34: gen_op_stfa(insn, 0, 0, 0); break; case 0x37: gen_op_stdfa(insn, 0, 0, 0); break; case 0x3c: gen_op_casa(insn, 0, 4, 0); break; case 0x3e: gen_op_casxa(insn, 0, 8, 0); break; case 0x36: goto nfpu_insn; default: } #else #endif } else } break; } if (dc->npc == DYNAMIC_PC) { dc->pc = DYNAMIC_PC; gen_op_next_insn(); } else if (dc->npc == JUMP_PC) { gen_branch2(dc, (long)dc->tb, dc->jump_pc[0], dc->jump_pc[1]); dc->is_br = 1; } else { dc->pc = dc->npc; dc->npc = dc->npc + 4; } jmp_insn: return; illegal_insn: save_state(dc); gen_op_exception(TT_ILL_INSN); dc->is_br = 1; return; #if !defined(CONFIG_USER_ONLY) priv_insn: save_state(dc); gen_op_exception(TT_PRIV_INSN); dc->is_br = 1; return; #endif nfpu_insn: save_state(dc); gen_op_fpexception_im(FSR_FTT_UNIMPFPOP); dc->is_br = 1; return; #ifndef TARGET_SPARC64 ncp_insn: save_state(dc); gen_op_exception(TT_NCP_INSN); dc->is_br = 1; return; #endif }
1threat
void AcpiCpuHotplug_add(ACPIGPE *gpe, AcpiCpuHotplug *g, CPUState *cpu) { CPUClass *k = CPU_GET_CLASS(cpu); int64_t cpu_id; *gpe->sts = *gpe->sts | ACPI_CPU_HOTPLUG_STATUS; cpu_id = k->get_arch_id(CPU(cpu)); g->sts[cpu_id / 8] |= (1 << (cpu_id % 8)); }
1threat
int qemu_paio_cancel(int fd, struct qemu_paiocb *aiocb) { int ret; pthread_mutex_lock(&lock); if (!aiocb->active) { TAILQ_REMOVE(&request_list, aiocb, node); aiocb->ret = -ECANCELED; ret = QEMU_PAIO_CANCELED; } else if (aiocb->ret == -EINPROGRESS) ret = QEMU_PAIO_NOTCANCELED; else ret = QEMU_PAIO_ALLDONE; pthread_mutex_unlock(&lock); return ret; }
1threat
How to filter invisible files in c#? : <p>I want to find all the invisible files in a folder in C#. I can enumerate the files </p> <pre><code>var files = from file in Directory.EnumerateFiles(@"c:\", "*.txt", SearchOption.AllDirectories) select new { File = file }; </code></pre>
0debug
error while executing phyton code : from os import popen from string import split, join from re import match import subprocess import os # execute the code and pipe the result to a string rtr_table = [elem.strip().split() for elem in popen("route print").read().split("Metric\n")[1].split("\n") if match("^[0-9]", elem.strip())] #print "Active default gateway:", rtr_table[0][2] x=rtr_table[0][2] #x has a.a.a.a y = x[:x.rfind(".")] # y has a.a.a # in order to test in range of 1 to 255 for the default gateway for i in range(1,255): #ping by sending 1 packet and wait for 500 milli seconds test = "ping -n 1 -w 500 %s.%d" % (y,i) process = subprocess.Popen(test, shell=True, stdout=subprocess.PIPE) # give it time to respond process.wait() # optional check (0 --> success) #print process.returncode # read the result to a string result_str = process.stdout.read() # test it ... # print result_str #from arp we get mac address and corresponding ip address and state as we use '-a' lines=os.popen('arp -a') for line in lines: print line sh-4.3$ python main.py File "main.py", line 20 test = "ping -n 1 -w 500 %s.%d" % (y,i) ^ IndentationError: expected an indented block please go through the above code and please identify the error it looks like in test ="ping " line is getting some IndentationError please help me regarding this error.
0debug
How to mock psycopg2 cursor object? : <p>I have this code segment in Python2:</p> <pre><code>def super_cool_method(): con = psycopg2.connect(**connection_stuff) cur = con.cursor(cursor_factory=DictCursor) cur.execute("Super duper SQL query") rows = cur.fetchall() for row in rows: # do some data manipulation on row return rows </code></pre> <p>that I'd like to write some unittests for. I'm wondering how to use <code>mock.patch</code> in order to patch out the cursor and connection variables so that they return a fake set of data? I've tried the following segment of code for my unittests but to no avail:</p> <pre><code>@mock.patch("psycopg2.connect") @mock.patch("psycopg2.extensions.cursor.fetchall") def test_super_awesome_stuff(self, a, b): testing = super_cool_method() </code></pre> <p>But I seem to get the following error:</p> <pre><code>TypeError: can't set attributes of built-in/extension type 'psycopg2.extensions.cursor' </code></pre>
0debug
static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, unsigned *lossp, unsigned consider) { const AVPixFmtDescriptor *src_desc = av_pix_fmt_desc_get(src_pix_fmt); const AVPixFmtDescriptor *dst_desc = av_pix_fmt_desc_get(dst_pix_fmt); int src_color, dst_color; int src_min_depth, src_max_depth, dst_min_depth, dst_max_depth; int ret, loss, i, nb_components; int score = INT_MAX - 1; if (dst_pix_fmt >= AV_PIX_FMT_NB || dst_pix_fmt <= AV_PIX_FMT_NONE) return ~0; *lossp = loss = 0; if (dst_pix_fmt == src_pix_fmt) return INT_MAX; if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0) return ret; if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0) return ret; src_color = get_color_type(src_desc); dst_color = get_color_type(dst_desc); if (dst_pix_fmt == AV_PIX_FMT_PAL8) nb_components = FFMIN(src_desc->nb_components, 4); else nb_components = FFMIN(src_desc->nb_components, dst_desc->nb_components); for (i = 0; i < nb_components; i++) { int depth_minus1 = (dst_pix_fmt == AV_PIX_FMT_PAL8) ? 7/nb_components : (dst_desc->comp[i].depth - 1); if (src_desc->comp[i].depth - 1 > depth_minus1 && (consider & FF_LOSS_DEPTH)) { loss |= FF_LOSS_DEPTH; score -= 65536 >> depth_minus1; } } if (consider & FF_LOSS_RESOLUTION) { if (dst_desc->log2_chroma_w > src_desc->log2_chroma_w) { loss |= FF_LOSS_RESOLUTION; score -= 256 << dst_desc->log2_chroma_w; } if (dst_desc->log2_chroma_h > src_desc->log2_chroma_h) { loss |= FF_LOSS_RESOLUTION; score -= 256 << dst_desc->log2_chroma_h; } if (dst_desc->log2_chroma_w == 1 && src_desc->log2_chroma_w == 0 && dst_desc->log2_chroma_h == 1 && src_desc->log2_chroma_h == 0 ) { score += 512; } } if(consider & FF_LOSS_COLORSPACE) switch(dst_color) { case FF_COLOR_RGB: if (src_color != FF_COLOR_RGB && src_color != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_GRAY: if (src_color != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV: if (src_color != FF_COLOR_YUV) loss |= FF_LOSS_COLORSPACE; break; case FF_COLOR_YUV_JPEG: if (src_color != FF_COLOR_YUV_JPEG && src_color != FF_COLOR_YUV && src_color != FF_COLOR_GRAY) loss |= FF_LOSS_COLORSPACE; break; default: if (src_color != dst_color) loss |= FF_LOSS_COLORSPACE; break; } if(loss & FF_LOSS_COLORSPACE) score -= (nb_components * 65536) >> FFMIN(dst_desc->comp[0].depth - 1, src_desc->comp[0].depth - 1); if (dst_color == FF_COLOR_GRAY && src_color != FF_COLOR_GRAY && (consider & FF_LOSS_CHROMA)) { loss |= FF_LOSS_CHROMA; score -= 2 * 65536; } if (!pixdesc_has_alpha(dst_desc) && (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))) { loss |= FF_LOSS_ALPHA; score -= 65536; } if (dst_pix_fmt == AV_PIX_FMT_PAL8 && (consider & FF_LOSS_COLORQUANT) && (src_pix_fmt != AV_PIX_FMT_PAL8 && (src_color != FF_COLOR_GRAY || (pixdesc_has_alpha(src_desc) && (consider & FF_LOSS_ALPHA))))) { loss |= FF_LOSS_COLORQUANT; score -= 65536; } *lossp = loss; return score; }
1threat
static void omap_ppm_save(const char *filename, uint8_t *data, int w, int h, int linesize, Error **errp) { FILE *f; uint8_t *d, *d1; unsigned int v; int ret, y, x, bpp; f = fopen(filename, "wb"); if (!f) { error_setg(errp, "failed to open file '%s': %s", filename, strerror(errno)); return; } ret = fprintf(f, "P6\n%d %d\n%d\n", w, h, 255); if (ret < 0) { goto write_err; } d1 = data; bpp = linesize / w; for (y = 0; y < h; y ++) { d = d1; for (x = 0; x < w; x ++) { v = *(uint32_t *) d; switch (bpp) { case 2: ret = fputc((v >> 8) & 0xf8, f); if (ret == EOF) { goto write_err; } ret = fputc((v >> 3) & 0xfc, f); if (ret == EOF) { goto write_err; } ret = fputc((v << 3) & 0xf8, f); if (ret == EOF) { goto write_err; } break; case 3: case 4: default: ret = fputc((v >> 16) & 0xff, f); if (ret == EOF) { goto write_err; } ret = fputc((v >> 8) & 0xff, f); if (ret == EOF) { goto write_err; } ret = fputc((v) & 0xff, f); if (ret == EOF) { goto write_err; } break; } d += bpp; } d1 += linesize; } out: fclose(f); return; write_err: error_setg(errp, "failed to write to file '%s': %s", filename, strerror(errno)); unlink(filename); goto out; }
1threat
How can i use GroupBy and than Map over Dataset : i'm working with datasets and trying to groupby and than use map. i am managing to do it with RDD's but with dataset after groupby i dont have to option to use map. there is a way i can do it?
0debug
static void monitor_json_emitter(Monitor *mon, const QObject *data) { QString *json; json = qobject_to_json(data); assert(json != NULL); mon->mc->print_enabled = 1; monitor_printf(mon, "%s\n", qstring_get_str(json)); mon->mc->print_enabled = 0; QDECREF(json); }
1threat
I need to make my app work in background even if its closed : <p>Im beginner with android, I want to make my app work a cyclic behavior in background even if it’s closed. Can someone help me? Thanks!</p>
0debug
is possible that : "SELECT COUNT (*) < SELECT COUNT (VALUE)?" : the result value SELECT COUNT (*) to be smaller than the value SELECT COUNT (VALUE)? And why ? Explain the answer please
0debug
Output colored logs from django with through supervisor and docker-compose : <p>My objective is to get <strong>colorized</strong> logs of my <strong>Django</strong> webservice in <strong>docker-compose logs</strong>.</p> <ol> <li><p>I use docker-compose to manage a list of web services based on Django framework.</p></li> <li><p>Each container, run a <em>my_init</em> bash script, which in turn run a <em>runit</em> (this is historic in my case) script which runs a <em>supervisord</em> process:</p> <pre><code>my_init---runsvdir-+-runsv---run---supervisord-+-gunicorn---gunicorn | |-nginx---8*[nginx] | |-python---9*[python] | |-python---python (Django) | `-redis-server---2*[{redis-server}] `-runsv </code></pre></li> <li><p>The Django server is interfaced in WSGI with a <strong>Gunicorn</strong>, and served through a <strong>Nginx</strong></p></li> <li><p>The supervisord conf is the following:</p> <pre><code>[supervisord] http_port=/var/tmp/supervisor.sock ; (default is to run a UNIX domain socket server) stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:gunicorn_core_service] #environment=myapp_VENV=/opt/myapp/venv/ environment=PYTHONPATH=/opt/myapp/myappServer/myappServer command = /opt/myapp/venv/bin/gunicorn wsgi -b 0.0.0.0:8000 --timeout 90 --access-logfile /dev/stdout --error-logfile /dev/stderr directory = /opt/myapp/myappServer user = root autostart=true autorestart=true redirect_stderr=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 [program:django-celery] command=/opt/myapp/venv/bin/python ./manage.py celery --app=myappServer.celeryapp:app worker -B --loglevel=INFO directory=/opt/myapp/myappServer numprocs=1 stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 redirect_stderr=true autostart=true autorestart=true startsecs=10 [program:nginx] command=nginx -g "daemon off;" #user = root autostart=true autorestart=true redirect_stderr=true stdout_logfile=/dev/stdout stdout_logfile_maxbytes=0 stderr_logfile=/dev/stderr stderr_logfile_maxbytes=0 </code></pre></li> <li><p>Since docker can only log once process, the logs of all the process of my container are forwarded to <strong>/dev/stdout</strong> and <strong>/dev/stderr</strong></p></li> <li><p>And I use <a href="https://pypi.python.org/pypi/colorlog">colorlog</a> as color formatter to colorize Django logs:</p> <pre><code>'formatters': { 'color': { '()': 'colorlog.ColoredFormatter', 'format': '%(log_color)s%(levelname)-8s %(message)s', 'log_colors': { 'DEBUG': 'bold_black', 'INFO': 'white', 'WARNING': 'yellow', 'ERROR': 'red', 'CRITICAL': 'bold_red', }, } }, </code></pre> <ul> <li>When I run the service from inside the container <pre>./manage.py runserver</pre> the logs are colorized.</li> <li>However from outside, the docker-compose logs are not colorized.</li> </ul></li> </ol> <p>I tried to add <pre>tty: true</pre> in my services as described <a href="https://github.com/docker/compose/issues/2231">here</a>, but it seems it doesn\'t work anymore.</p> <p>Any idea?</p>
0debug
static int analyze(const uint8_t *buf, int size, int packet_size, int *index) { int stat[TS_MAX_PACKET_SIZE]; int i; int x = 0; int best_score = 0; memset(stat, 0, packet_size * sizeof(int)); for (x = i = 0; i < size - 3; i++) { if (buf[i] == 0x47 && !(buf[i + 1] & 0x80) && (buf[i + 3] & 0x30)) { stat[x]++; if (stat[x] > best_score) { best_score = stat[x]; if (index) *index = x; } } x++; if (x == packet_size) x = 0; } return best_score; }
1threat
static TAPState *net_tap_fd_init(VLANState *vlan, const char *model, const char *name, int fd) { TAPState *s; s = qemu_mallocz(sizeof(TAPState)); s->fd = fd; s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s); s->vc->fd_readv = tap_receive_iov; qemu_set_fd_handler(s->fd, tap_send, NULL, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); return s; }
1threat
Append text to an HTML tag using javascript : <p>I am looking to use Jquery append to append text to a pre existing div element. I also want to have several element 'templates' and append more text into those elements (see snippet).</p> <pre class="lang-js prettyprint-override"><code>var template = { template1: "&lt;p class='someclass'&gt;&lt;/p&gt;" }, o = $('.divClass'); o.append(template.template1); // Append text inside P tag </code></pre>
0debug
how I ca create a route with search url using express : using express how I can create a route such as, when the url /search?s=<SEARCH> is invoked, answers with {status:200, message:"ok", data:<SEARCH>} if <SEARCH> is provided, and {status:500, error:true, message:"you have to provide a search"} if it is not. Be sure to set the http status to 500 too.
0debug
ArrayList add() function overwrites all the elements (processing/java) : <p>So I am trying to shuffle the same ArrayList (knots) 50 times in a for-loop and adding the shuffled list to another ArrayList (gen0). But every time I add a new ArrayList it overwrites all existing ArrayList-elements to the same ArrayList I just added, can someone tell me why?</p> <pre class="lang-java prettyprint-override"><code>ArrayList&lt;ArrayList&gt; seed(ArrayList&lt;PVector&gt; knots) { ArrayList&lt;ArrayList&gt; gen0 = new ArrayList&lt;ArrayList&gt;(); for(int i=1; i&lt;=50; i++) { Collections.shuffle(knots); gen0.add(knots); } return gen0; }``` </code></pre>
0debug
int bdrv_create_file(const char *filename, QemuOpts *opts, Error **errp) { BlockDriver *drv; Error *local_err = NULL; int ret; drv = bdrv_find_protocol(filename, true, errp); if (drv == NULL) { return -ENOENT; } ret = bdrv_create(drv, filename, opts, &local_err); if (local_err) { error_propagate(errp, local_err); } return ret; }
1threat
Xamarin forms :Taille d'une image à l'intérieur d'un carousel view : j'ai une carousel view à l'intérieur d'un stasklayout qui est aussi à l'intérieur d'une scroll view ,le carousel view contient une image qui s'affiche en miniature ,le voulais que l'image s'affiche en taille réelle.Comment faire s'il vous plait ?
0debug
C# print exhadecimal code from int into string : I need to save a `string` with the `hexadecimal code` of an `int`. For example the `hexadecimal` value for the `int 15` is `xoooF`. My problem is that I have to save this code in a `string` like this: int myint = myStringLength; //this value might change string myIntExhCode = myint.convertThisIntoMyCode(); //and the string has to be exactly "/xoooF" So in this question I have two problmes: - The first is how to automatically convert an `int` into the `hexadecimal` code like `15 = xoooF` - The second is how to create a string containing `/xoooF` because any try of concatenating strings like this resulted into a `//xoooF` and this is not correct since in output I need the `string` to be converted into the `ascii code`. How can I achieve those two tasks? Any help will be appreciated
0debug
Conversion failed when converting date and/or time from character string select app.[Pap_id], reg.[p_id],[p_name],[p_age],[p_gender],[p_mob : Conversion failed when converting date and/or time from character string. "select app.[Pap_id], reg.[p_id],[p_name],[p_age],[p_gender],[p_mob],[p_specificId],app.[ap_date],app.[reqst_txt] from [dbo].[tblpatientReg] reg inner join [dbo].[tblAppoinment] app on app.[P_id]=reg.[p_id] where app.[p_status] =1 order by convert(date,app.[ap_date] ,105) asc"
0debug
How to efficiently calculate prefix sum of frequencies of characters in a string? : <p>Say, I have a string</p> <pre><code>s = 'AAABBBCAB' </code></pre> <p>How can I efficiently calculate the prefix sum of frequencies of each character in the string, i.e.:</p> <pre><code>psum = [{'A': 1}, {'A': 2}, {'A': 3}, {'A': 3, 'B': 1}, {'A': 3, 'B': 2}, {'A': 3, 'B': 3}, {'A': 3, 'B': 3, 'C': 1}, {'A': 4, 'B': 3, 'C': 1}, {'A': 4, 'B': 4, 'C': 1}] </code></pre>
0debug
static int get_int16(QEMUFile *f, void *pv, size_t size) { int16_t *v = pv; qemu_get_sbe16s(f, v); return 0; }
1threat
TypeScript custom declaration files for untyped npm modules : <p>I am consuming a React component called <a href="https://github.com/bsidelinger912/shiitake" rel="noreferrer">shiitake</a> from npm into my project where I use TypeScript. That library does not have TypeScript declarations so I thought I would write one. The declaration file looks like below (it may not be complete but don't worry about it too much):</p> <pre><code>import * as React from 'react'; declare module 'shiitake' { export interface ShiitakeProps { lines: number; } export default class Shiitake extends React.Component&lt;ShiitakeProps, any&gt; { } } </code></pre> <p>I have put this inside <code>./typings/shiitake.d.ts</code> file and on VS Code, I am seeing the below error:</p> <blockquote> <p>[ts] Invalid module name in augmentation. Module 'shiitake' resolves to an untyped module at 'd:/dev/foo/foobar.foo.Client.Web/node_modules/shiitake/dist/index.js', which cannot be augmented.</p> </blockquote> <p>On the consumption side, I am still getting the same error even if with the above declaration (since I have <code>noImplicitAny</code> compiler switch turned on):</p> <pre><code>/// &lt;reference path="../../../../typings/shiitake.d.ts" /&gt; import * as React from 'react'; import Shiitake from 'shiitake'; </code></pre> <blockquote> <p>[ts] Could not find a declaration file for module 'shiitake'. 'd:/dev/foo/foobar.foo.Client.Web/node_modules/shiitake/dist/index.js' implicitly has an 'any' type.</p> </blockquote> <p>The standard why of acquiring declaration files for this type of modules is through <a href="https://blog.mariusschulz.com/2016/10/23/typescript-2-0-acquiring-type-declaration-files" rel="noreferrer"><code>@types/</code> way</a> and it works well. However, I cannot get the custom typings work. Any thoughts?</p>
0debug
How to redirect only the root path in nginx? : <p>I only want to redirect the root path from domain A to domain B. For example, if user type in <a href="https://www.a.com/" rel="noreferrer">https://www.a.com/</a> or <a href="https://www.a.com" rel="noreferrer">https://www.a.com</a> or <a href="http://a.com" rel="noreferrer">http://a.com</a> all redirect to <a href="https://www.b.com/" rel="noreferrer">https://www.b.com/</a>, but if user type in <a href="https://www.a.com/something/" rel="noreferrer">https://www.a.com/something/</a> then it keep there without redirect.</p> <p>I tried the following:</p> <pre><code>location / { return 301 https://www.b.com/; } </code></pre> <p>but it redirect all to www.b.com even user type in <a href="https://www.a.com/something/" rel="noreferrer">https://www.a.com/something/</a>.</p>
0debug
Injecting DbContext into service layer : <p>How am I supposed to inject my <code>MyDbContext</code> into my database service layer <code>MyService</code>?</p> <p><strong>Startup.cs</strong></p> <pre><code>public void ConfigureServices(IServiceCollection services) { services.AddDbContext&lt;MyDbContext&gt;(options =&gt; options.UseSqlServer(Configuration["ConnectionStrings:DefaultConnection"])); services.AddMvc(); } </code></pre> <p><strong>MyDbContext.cs</strong></p> <pre><code>public partial class MyDbContext : DbContext { public virtual DbSet&lt;User&gt; User { get; set; } public MyDbContext(DbContextOptions&lt;MyDbContext&gt; options) :base(options) { } } </code></pre> <p><strong>appsettings.json</strong></p> <pre><code>{ "Logging": { "IncludeScopes": false, "LogLevel": { "Default": "Debug", "System": "Information", "Microsoft": "Information" } }, "ConnectionStrings": { "DefaultConnection": "Server=MyServer;Database=MyDatabase;user id=MyUser;password=MyPassword;" } } </code></pre> <p><strong>MyService.cs</strong></p> <pre><code>public class MyService { public User GetUser(string username) { // Should i remove this call and get the reference from the injection somehow? MyDbContext db_context = new MyDbContext(optionsBuilder.Options); using (db_context) { var users = from u in db_context.User where u.WindowsLogin == username select u; if (users.Count() == 1) { return users.First(); } return null; } } } </code></pre> <p>In my <code>GetUser</code> method, I know I am supposed to be using my injected <code>MyDbContext</code> here but I am not quite sure how to fetch it. Which piece of the puzzle am I missing?</p>
0debug
Array To String Conversion PHP Error Message : <p>I'm getting some data from MySQL table like this:</p> <pre><code>if(isset($_GET['pro_id'])) { $product_id = $_GET['pro_id']; $get_product = "select * from products where product_id='$product_id'"; $run_product = mysqli_query($con,$get_product); while($row_results=mysqli_fetch_array($run_product)) { $pro_details1 = $row_results['product_details1']; $pro_details2 = $row_results['product_details2']; $pro_details3 = $row_results['product_details3']; function boldifyTitle($pd){ $pd = explode(':', $pd); $pd[0] = "&lt;b&gt;$pd&lt;/b&gt;"; if(empty($pd[1])) $pd[1] = ""; return implode(':', $pd); } if(!empty($pro_details1)){ echo "&lt;li&gt;".boldifyTitle($pro_details1)."&lt;/li&gt;"; } } } </code></pre> <p>As you can see I have used a function called <code>boldifyTitle()</code> which takes an argument and that argument can be one of the <code>pro_details</code> variables (in this example <code>$pro_details1</code>).</p> <p>But whenever I run this I get this error:</p> <p><strong>Notice: Array to string conversion on line 14</strong></p> <p>And line 14 is this:</p> <pre><code>$pd[0] = "&lt;b&gt;$pd&lt;/b&gt;"; </code></pre> <p>So what is wrong here?</p>
0debug
static int cloop_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCloopState *s = bs->opaque; uint32_t offsets_size, max_compressed_block_size = 1, i; int ret; bs->file = bdrv_open_child(NULL, options, "file", bs, &child_file, false, errp); if (!bs->file) { return -EINVAL; } bdrv_set_read_only(bs, true); ret = bdrv_pread(bs->file, 128, &s->block_size, 4); if (ret < 0) { return ret; } s->block_size = be32_to_cpu(s->block_size); if (s->block_size % 512) { error_setg(errp, "block_size %" PRIu32 " must be a multiple of 512", s->block_size); return -EINVAL; } if (s->block_size == 0) { error_setg(errp, "block_size cannot be zero"); return -EINVAL; } if (s->block_size > MAX_BLOCK_SIZE) { error_setg(errp, "block_size %" PRIu32 " must be %u MB or less", s->block_size, MAX_BLOCK_SIZE / (1024 * 1024)); return -EINVAL; } ret = bdrv_pread(bs->file, 128 + 4, &s->n_blocks, 4); if (ret < 0) { return ret; } s->n_blocks = be32_to_cpu(s->n_blocks); if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) { error_setg(errp, "n_blocks %" PRIu32 " must be %zu or less", s->n_blocks, (UINT32_MAX - 1) / sizeof(uint64_t)); return -EINVAL; } offsets_size = (s->n_blocks + 1) * sizeof(uint64_t); if (offsets_size > 512 * 1024 * 1024) { error_setg(errp, "image requires too many offsets, " "try increasing block size"); return -EINVAL; } s->offsets = g_try_malloc(offsets_size); if (s->offsets == NULL) { error_setg(errp, "Could not allocate offsets table"); return -ENOMEM; } ret = bdrv_pread(bs->file, 128 + 4 + 4, s->offsets, offsets_size); if (ret < 0) { goto fail; } for (i = 0; i < s->n_blocks + 1; i++) { uint64_t size; s->offsets[i] = be64_to_cpu(s->offsets[i]); if (i == 0) { continue; } if (s->offsets[i] < s->offsets[i - 1]) { error_setg(errp, "offsets not monotonically increasing at " "index %" PRIu32 ", image file is corrupt", i); ret = -EINVAL; goto fail; } size = s->offsets[i] - s->offsets[i - 1]; if (size > 2 * MAX_BLOCK_SIZE) { error_setg(errp, "invalid compressed block size at index %" PRIu32 ", image file is corrupt", i); ret = -EINVAL; goto fail; } if (size > max_compressed_block_size) { max_compressed_block_size = size; } } s->compressed_block = g_try_malloc(max_compressed_block_size + 1); if (s->compressed_block == NULL) { error_setg(errp, "Could not allocate compressed_block"); ret = -ENOMEM; goto fail; } s->uncompressed_block = g_try_malloc(s->block_size); if (s->uncompressed_block == NULL) { error_setg(errp, "Could not allocate uncompressed_block"); ret = -ENOMEM; goto fail; } if (inflateInit(&s->zstream) != Z_OK) { ret = -EINVAL; goto fail; } s->current_block = s->n_blocks; s->sectors_per_block = s->block_size/512; bs->total_sectors = s->n_blocks * s->sectors_per_block; qemu_co_mutex_init(&s->lock); return 0; fail: g_free(s->offsets); g_free(s->compressed_block); g_free(s->uncompressed_block); return ret; }
1threat
static inline uint32_t ldl_phys_internal(hwaddr addr, enum device_endian endian) { uint8_t *ptr; uint32_t val; MemoryRegionSection *section; section = phys_page_find(address_space_memory.dispatch, addr >> TARGET_PAGE_BITS); if (!(memory_region_is_ram(section->mr) || memory_region_is_romd(section->mr))) { addr = memory_region_section_addr(section, addr); val = io_mem_read(section->mr, addr, 4); #if defined(TARGET_WORDS_BIGENDIAN) if (endian == DEVICE_LITTLE_ENDIAN) { val = bswap32(val); } #else if (endian == DEVICE_BIG_ENDIAN) { val = bswap32(val); } #endif } else { ptr = qemu_get_ram_ptr((memory_region_get_ram_addr(section->mr) & TARGET_PAGE_MASK) + memory_region_section_addr(section, addr)); switch (endian) { case DEVICE_LITTLE_ENDIAN: val = ldl_le_p(ptr); break; case DEVICE_BIG_ENDIAN: val = ldl_be_p(ptr); break; default: val = ldl_p(ptr); break; } } return val; }
1threat
opts_type_uint64(Visitor *v, uint64_t *obj, const char *name, Error **errp) { OptsVisitor *ov = DO_UPCAST(OptsVisitor, visitor, v); const QemuOpt *opt; const char *str; unsigned long long val; char *endptr; if (ov->list_mode == LM_UNSIGNED_INTERVAL) { *obj = ov->range_next.u; return; } opt = lookup_scalar(ov, name, errp); if (!opt) { return; } str = opt->str; assert(ov->list_mode == LM_NONE || ov->list_mode == LM_IN_PROGRESS); if (parse_uint(str, &val, &endptr, 0) == 0 && val <= UINT64_MAX) { if (*endptr == '\0') { *obj = val; processed(ov, name); return; } if (*endptr == '-' && ov->list_mode == LM_IN_PROGRESS) { unsigned long long val2; str = endptr + 1; if (parse_uint_full(str, &val2, 0) == 0 && val2 <= UINT64_MAX && val <= val2) { ov->range_next.u = val; ov->range_limit.u = val2; ov->list_mode = LM_UNSIGNED_INTERVAL; *obj = ov->range_next.u; return; } } } error_set(errp, QERR_INVALID_PARAMETER_VALUE, opt->name, (ov->list_mode == LM_NONE) ? "a uint64 value" : "a uint64 value or range"); }
1threat
Shell cmd "date" without new line in the end : <p>I want to output a line of date using date command, but it's end with a "\n" which I don't need it, currently, I use:</p> <pre><code>echo -n `date +"[%m-%d %H:%M:%S]"` </code></pre> <p>or </p> <pre><code>date +"[%m-%d %H:%M:%S]"|tr -d "\n" </code></pre> <p>Are there any built-in parameter for "date" to do that?</p>
0debug
Difference between @cached_property and @lru_cache decorator : <p>I am new to Django. Would be really helpful if someone can tell the difference between @cached_property and @lru_cache decorator in Django. Also when should I use which decorator in Django. Use cases would be really helpful. Thanks. </p>
0debug
void bitmap_set(unsigned long *map, long start, long nr) { unsigned long *p = map + BIT_WORD(start); const long size = start + nr; int bits_to_set = BITS_PER_LONG - (start % BITS_PER_LONG); unsigned long mask_to_set = BITMAP_FIRST_WORD_MASK(start); while (nr - bits_to_set >= 0) { *p |= mask_to_set; nr -= bits_to_set; bits_to_set = BITS_PER_LONG; mask_to_set = ~0UL; p++; } if (nr) { mask_to_set &= BITMAP_LAST_WORD_MASK(size); *p |= mask_to_set; } }
1threat
Thread Safety in ArrayList : <p>Why the ArrayList class in Java doesn't implemented with thread safety. But prior class Vector is implemented with thread safety ? Is there any particular reason for not implementing with thread safe ?</p>
0debug
What is POSIX PSE51 that Adaptive AUTOSAR based on? : <h1>What is POSIX PSE51 that Adaptive AUTOSAR based on?</h1> <p>While studying Adaptive AUTOSAR, I found 'Adaptive AUTOSAR is based on POSIX PSE51'.</p> <p>However, I cloudn't understand what is POSIX PSE51.</p> <p>Someone can answer this question?</p> <p>I want to know following...</p> <ul> <li>Where can I read the paper of POSIX PSE51?</li> <li>What is API supported in POSIX PSE51?</li> <li>Adaptive AUTOSAR will become like Linux? File System, System Call and so on.</li> </ul>
0debug
document.write('<script src="evil.js"></script>');
1threat
static void hb_regs_write(void *opaque, target_phys_addr_t offset, uint64_t value, unsigned size) { uint32_t *regs = opaque; if (offset == 0xf00) { if (value == 1 || value == 2) { qemu_system_reset_request(); } else if (value == 3) { qemu_system_shutdown_request(); } } regs[offset/4] = value; }
1threat
Suggestions on how to update Angular version : <p>I have an angular project which has the version 6.1 But I've installed some custom libraries using <code>npm</code>.</p> <p>So my question is: What should I take care for updating?</p> <p>I mean: Do I have to use an external tool? Or. Should I check every library dependency for upgrading the verions?</p> <p>Thanks in advance.</p>
0debug
void qemu_input_event_send_key_qcode(QemuConsole *src, QKeyCode q, bool down) { KeyValue *key = g_new0(KeyValue, 1); key->kind = KEY_VALUE_KIND_QCODE; key->qcode = q; qemu_input_event_send_key(src, key, down); }
1threat
bool memory_region_is_skip_dump(MemoryRegion *mr) { return mr->skip_dump; }
1threat