problem
stringlengths
26
131k
labels
class label
2 classes
javascript not able to update value of input box : <p>I have some input box. Here is the HTML</p> <pre><code>&lt;input name="dog_shipping_price" class="input" id="shipping_price_&lt;?php echo $id; ?&gt;" value="&lt;?php echo $shipping_price; ?&gt;" /&gt; </code></pre> <p>In some javascript i am trying to update its value</p> <pre><code>$('.shipping_price_'+item.id).val(parseFloat(item.shipping_price)); </code></pre> <p>i also tried </p> <pre><code>$('.dog_shipping_price').val(parseFloat(item.shipping_price)); </code></pre> <p>i verified that <code>item.id</code> is the right value and item.shipping_price is also there with the following:</p> <pre><code>console.log(parseFloat(item.shipping_price)); </code></pre> <p>when i run my code the input box value is not updated</p>
0debug
How can I get ONLY POST request's status code (without body) : <p>Title is say. I need only status code. Not response body.</p> <pre><code>package main import ( "fmt" "net/http" ) func main() { req, _ := http.NewRequest("POST", "http://api.example.com/getUserList", nil) res, _ := http.DefaultClient.Do(req) // &lt;-- 300KB Full page downloading here fmt.Print("status code", res.StatusCode) } </code></pre> <p>How can i interrupt response stream after got status code? (or its possible?)</p> <p>Thanks</p>
0debug
How to read from a file using Haskell? : <p>I am trying to read from a file. I want to split each line from a file into its own string. I am thinking of using the lines command in order to make a list of Strings of all the lines. I then plan to use the words command to spilt each line into a list of words. However, I am very new to functional programming/Haskell, and I don't fully understand the syntax. So, to begin, how do you read each line from a file and store it? </p> <p>I attempted the following code, but it does not compile. </p> <pre><code>main :: IO () main = do contents &lt;- readFile "input.txt" contents1 = lines contents </code></pre>
0debug
Android OSS license plugin crash on tapping menu items : <p>I've been trying out the <a href="https://developers.google.com/android/guides/opensource#how_licenses_are_determined" rel="noreferrer">Google APIs for Android OSS licenses</a> tool and come across an issue.</p> <p>The activity is being launched from a library module that contains the preferences aspect to my app. However, the Play Services code is crashing a lot! Has anyone seen this upon tapping the found OSS list items?</p> <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.oceanlife/com.google.android.gms.oss.licenses.OssLicensesActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.-wrap12(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6119) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.app.ActionBar.setTitle(java.lang.CharSequence)' on a null object reference at com.google.android.gms.oss.licenses.OssLicensesActivity.onCreate(Unknown Source) at android.app.Activity.performCreate(Activity.java:6679) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)  at android.app.ActivityThread.-wrap12(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)  at android.os.Handler.dispatchMessage(Handler.java:102)  at android.os.Looper.loop(Looper.java:154)  at android.app.ActivityThread.main(ActivityThread.java:6119)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)  </code></pre> <p>Here are the actions leading to that action;</p> <p><a href="https://i.stack.imgur.com/jyMbR.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/jyMbR.gif" alt="replication"></a></p>
0debug
Hi Guys, am new to codeigniter, i used active record to update my data in my database and its updated inside the database, : am new to codeigniter, i used active record to update my data in my database and its updated inside the database, but after updating data inside the database, i want it to redirect back to my Edit Page showing the updated data from my database.. i have tried all my possible best but its not working.. pls help.. my codeigniter version is 2.7 <!--THIS IS MY CONTROLLER--> <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class account extends CI_Controller { function __construct() { parent::__construct(); } public function index(){ $username = $this->input->post('username'); $password = $this->input->post('password'); $result = $this->login_model->database($username, $password); if ($result == TRUE){ $data['posts'] = $result; $data['subview'] = 'testview'; $this->load->view('display', $data); }else{ echo "invalid password"; }; } public function edit(){ $id = $this->input->post('id'); $name = $this->input->post('name'); $email = $this->input->post('email'); $telephone = $this->input->post('telephone'); $result = $this->login_model->update($id, $name, $email, $telephone); if ($result == TRUE){ redirect('account/edit'); } } } <!-- end snippet --> <!--THIS IS MY MODEL--> <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class login_model extends CI_Model { function __construct() { parent::__construct(); } public function database($username, $password) { $this->db->select('*'); $this->db->from('user'); $this->db->where('username', $username); $this->db->where('password', $password); $this->db->limit(1); $query = $this->db->get(); if($query->num_rows() ==1){ return $query->result(); }else{ return false; } } public function update($id){ $data = array( 'id' => $this->input->post('id'), 'name' => $this->input->post('name'), 'email' => $this->input->post('email'), 'telephone' => $this->input->post('telephone'), ); $this->db->where('id', $id); $this->db->update('user', $data); } } <!-- end snippet -->
0debug
static int hdev_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVRawState *s = bs->opaque; Error *local_err = NULL; int ret; #if defined(__APPLE__) && defined(__MACH__) const char *filename = qdict_get_str(options, "filename"); if (strstart(filename, "/dev/cdrom", NULL)) { kern_return_t kernResult; io_iterator_t mediaIterator; char bsdPath[ MAXPATHLEN ]; int fd; kernResult = FindEjectableCDMedia( &mediaIterator ); kernResult = GetBSDPath(mediaIterator, bsdPath, sizeof(bsdPath), flags); if ( bsdPath[ 0 ] != '\0' ) { strcat(bsdPath,"s0"); fd = qemu_open(bsdPath, O_RDONLY | O_BINARY | O_LARGEFILE); if (fd < 0) { bsdPath[strlen(bsdPath)-1] = '1'; } else { qemu_close(fd); } filename = bsdPath; qdict_put(options, "filename", qstring_from_str(filename)); } if ( mediaIterator ) IOObjectRelease( mediaIterator ); } #endif s->type = FTYPE_FILE; ret = raw_open_common(bs, options, flags, 0, &local_err); if (ret < 0) { if (local_err) { error_propagate(errp, local_err); } return ret; } bs->sg = hdev_is_sg(bs); if (flags & BDRV_O_RDWR) { ret = check_hdev_writable(s); if (ret < 0) { raw_close(bs); error_setg_errno(errp, -ret, "The device is not writable"); return ret; } } return ret; }
1threat
static int vc1_decode_p_mb_intfr(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; int mqdiff, mquant; int ttmb = v->ttfrm; int mb_has_coeffs = 1; int dmv_x, dmv_y; int val; int first_block = 1; int dst_idx, off; int skipped, fourmv = 0, twomv = 0; int block_cbp = 0, pat, block_tt = 0; int idx_mbmode = 0, mvbp; int stride_y, fieldtx; mquant = v->pq; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; if (!skipped) { if (v->fourmvswitch) idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_4MV_MBMODE_VLC_BITS, 2); else idx_mbmode = get_vlc2(gb, v->mbmode_vlc->table, VC1_INTFR_NON4MV_MBMODE_VLC_BITS, 2); switch (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0]) { case MV_PMODE_INTFR_4MV: fourmv = 1; v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; v->blk_mv_type[s->block_index[2]] = 0; v->blk_mv_type[s->block_index[3]] = 0; break; case MV_PMODE_INTFR_4MV_FIELD: fourmv = 1; v->blk_mv_type[s->block_index[0]] = 1; v->blk_mv_type[s->block_index[1]] = 1; v->blk_mv_type[s->block_index[2]] = 1; v->blk_mv_type[s->block_index[3]] = 1; break; case MV_PMODE_INTFR_2MV_FIELD: twomv = 1; v->blk_mv_type[s->block_index[0]] = 1; v->blk_mv_type[s->block_index[1]] = 1; v->blk_mv_type[s->block_index[2]] = 1; v->blk_mv_type[s->block_index[3]] = 1; break; case MV_PMODE_INTFR_1MV: v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; v->blk_mv_type[s->block_index[2]] = 0; v->blk_mv_type[s->block_index[3]] = 0; break; } if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { for (i = 0; i < 4; i++) { s->current_picture.motion_val[1][s->block_index[i]][0] = 0; s->current_picture.motion_val[1][s->block_index[i]][1] = 0; } v->is_intra[s->mb_x] = 0x3f; s->mb_intra = 1; s->current_picture.mb_type[mb_pos] = MB_TYPE_INTRA; fieldtx = v->fieldtx_plane[mb_pos] = get_bits1(gb); mb_has_coeffs = get_bits1(gb); if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); v->s.ac_pred = v->acpred_plane[mb_pos] = get_bits1(gb); GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; s->y_dc_scale = s->y_dc_scale_table[mquant]; s->c_dc_scale = s->c_dc_scale_table[mquant]; dst_idx = 0; for (i = 0; i < 6; i++) { v->a_avail = v->c_avail = 0; v->mb_type[0][s->block_index[i]] = 1; s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); if (i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if (i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i & 4) ? v->codingset2 : v->codingset); if ((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; v->vc1dsp.vc1_inv_trans_8x8(s->block[i]); if (i < 4) { stride_y = s->linesize << fieldtx; off = (fieldtx) ? ((i & 1) * 8) + ((i & 2) >> 1) * s->linesize : (i & 1) * 8 + 4 * (i & 2) * s->linesize; } else { stride_y = s->uvlinesize; off = 0; } s->idsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, stride_y); } } else { mb_has_coeffs = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][3]; if (mb_has_coeffs) cbp = 1 + get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); if (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_2MV_FIELD) { v->twomvbp = get_vlc2(gb, v->twomvbp_vlc->table, VC1_2MV_BLOCK_PATTERN_VLC_BITS, 1); } else { if ((ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV) || (ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][0] == MV_PMODE_INTFR_4MV_FIELD)) { v->fourmvbp = get_vlc2(gb, v->fourmvbp_vlc->table, VC1_4MV_BLOCK_PATTERN_VLC_BITS, 1); } } s->mb_intra = v->is_intra[s->mb_x] = 0; for (i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = 0; fieldtx = v->fieldtx_plane[mb_pos] = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][1]; dst_idx = 0; if (fourmv) { mvbp = v->fourmvbp; for (i = 0; i < 6; i++) { if (i < 4) { dmv_x = dmv_y = 0; val = ((mvbp >> (3 - i)) & 1); if (val) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); } ff_vc1_pred_mv_intfr(v, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0], 0); ff_vc1_mc_4mv_luma(v, i, 0, 0); } else if (i == 4) { ff_vc1_mc_4mv_chroma4(v, 0, 0, 0); } } } else if (twomv) { mvbp = v->twomvbp; dmv_x = dmv_y = 0; if (mvbp & 2) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); } ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], 0); ff_vc1_mc_4mv_luma(v, 0, 0, 0); ff_vc1_mc_4mv_luma(v, 1, 0, 0); dmv_x = dmv_y = 0; if (mvbp & 1) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); } ff_vc1_pred_mv_intfr(v, 2, dmv_x, dmv_y, 2, v->range_x, v->range_y, v->mb_type[0], 0); ff_vc1_mc_4mv_luma(v, 2, 0, 0); ff_vc1_mc_4mv_luma(v, 3, 0, 0); ff_vc1_mc_4mv_chroma4(v, 0, 0, 0); } else { mvbp = ff_vc1_mbmode_intfrp[v->fourmvswitch][idx_mbmode][2]; dmv_x = dmv_y = 0; if (mvbp) { get_mvdata_interlaced(v, &dmv_x, &dmv_y, 0); } ff_vc1_pred_mv_intfr(v, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0], 0); ff_vc1_mc_1mv(v, 0); } if (cbp) GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && cbp) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i = 0; i < 6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); if (!fieldtx) off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); else off = (i & 4) ? 0 : ((i & 1) * 8 + ((i > 1) * s->linesize)); if (val) { pat = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i & 4) ? s->uvlinesize : (s->linesize << fieldtx), (i & 4) && (s->flags & CODEC_FLAG_GRAY), &block_tt); block_cbp |= pat << (i << 2); if (!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; for (i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; v->blk_mv_type[s->block_index[0]] = 0; v->blk_mv_type[s->block_index[1]] = 0; v->blk_mv_type[s->block_index[2]] = 0; v->blk_mv_type[s->block_index[3]] = 0; ff_vc1_pred_mv_intfr(v, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0], 0); ff_vc1_mc_1mv(v, 0); } if (s->mb_x == s->mb_width - 1) memmove(v->is_intra_base, v->is_intra, sizeof(v->is_intra_base[0])*s->mb_stride); return 0; }
1threat
Perl Parser Error - premature end of data problems : I'm very new to both Perl and XML. So please be patient with me. I am running into periodic problems with a Perl sub that creates an XML request file, sends it to UPS, takes the XML response file, extracts the data, then carries on with the script. The problem I'm finding is that occasionally it seems to get hung up on the XML. Either it stops and posts the XML response file on the screen as a "software error", or it kicks an error that says `:2: parser error : Premature end of data in tag (insert bit of XML tag here)` I'm guessing that the problem is from the XML request/response sub not finishing completely before the script tries to move on, but I'm not having any luck in figuring out how to avoid this, or stall the page load until the script is done. I can't seem to recreate the error reliably enough either to debug. I can run it, and get an error, but then the next 20/30 loads are all fine. Is there a way to maybe watch for something to not return right and then attempt to reload the page again, or... something. Not knowing what the problem is, i'm really stuck on not having a clue how to work around it. I can post the sub and what not if that would help. Thank you!
0debug
static uint64_t fw_cfg_data_mem_read(void *opaque, hwaddr addr, unsigned size) { FWCfgState *s = opaque; uint8_t buf[8]; unsigned i; for (i = 0; i < size; ++i) { buf[i] = fw_cfg_read(s); } switch (size) { case 1: return buf[0]; case 2: return lduw_he_p(buf); case 4: return (uint32_t)ldl_he_p(buf); case 8: return ldq_he_p(buf); } abort(); }
1threat
I want to update this query after 5 sec , anyone help plz : 1. I want to update this query after 5 sec , for refreshing the div function cart_count(){ $.ajax({ url : "functions.php", method : "POST", data : {cart_count:1}, success : function(data){ $(".badge").html(data); } }) }
0debug
Footer is not fixed at the bottom (tried most of the answers in stack overflow) : The footer is not fixed at the bottom when the contents of the page are less than the window height. Tried many methods. Nothing seems to work. Below is the screenshot.Please help. contents more than window size:[![][1]][1] contents less than window height: [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/Num3i.png [2]: https://i.stack.imgur.com/s5eoh.png
0debug
GetFiles - Explaination : can anyone tell me what this code do? Thanks in advance! string[] fileName = dirInfo.GetFiles("*.pdf").Select(fi => fi.Name).FirstOrDefault(name => name != "Thumbs.db").Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
0debug
Android emulator Failed to create Vulkan instance : <p>When creating new Android emulator in Ubuntu shows following error, does this affect my vulkan game development?</p> <pre><code>queryCoreProfileSupport: swap interval not found emulator: ERROR: VkCommonOperations.cpp:496: Failed to create Vulkan instance. emulator: WARNING: Ignoring invalid http proxy: Bad format: invalid port number (must be decimal) </code></pre> <p>My AVD device specification are added below.</p> <p><a href="https://i.stack.imgur.com/cfeIB.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cfeIB.png" alt="enter image description here"></a></p>
0debug
Weird headers c++ : <p>On <code>A.h</code> i do not have to <code>#include</code> anything or use namespace for anything. </p> <p>On the other header, <code>B.h</code> i have to include <code>vector</code> and <code>using namespace std</code>. Both of this headers are not linked. Seems to be a file problem. When i copy the contents of <code>A.h</code> (without any problems) to <code>B.h</code>, i still get a compiler error saying <code>string</code> is not a type name and <code>vector</code> is not a template although the compiler did not state anything when the same content was on <code>A.h</code>. I am coding c++ on visual studio. What is going on?</p>
0debug
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; static int counter = 0; int i; init_get_bits(&gb, buf, buf_size * 8); if (s->theora && get_bits1(&gb)) { av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); for (i = 0; i < 3; i++) s->last_qps[i] = s->qps[i]; s->nqps=0; do{ s->qps[s->nqps++]= get_bits(&gb, 6); } while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb)); for (i = s->nqps; i < 3; i++) s->qps[i] = -1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", counter, s->qps[0]); counter++; if (s->qps[0] != s->last_qps[0]) init_loop_filter(s); for (i = 0; i < s->nqps; i++) if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0]) init_dequantizer(s, i); if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe) return buf_size; if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); skip_bits(&gb, 4); if (s->version) { s->version = get_bits(&gb, 5); if (counter == 1) av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); } if (s->last_frame.data[0] == s->golden_frame.data[0]) { if (s->golden_frame.data[0]) avctx->release_buffer(avctx, &s->golden_frame); s->last_frame= s->golden_frame; } else { if (s->golden_frame.data[0]) avctx->release_buffer(avctx, &s->golden_frame); if (s->last_frame.data[0]) avctx->release_buffer(avctx, &s->last_frame); } s->golden_frame.reference = 3; if(avctx->get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } s->current_frame= s->golden_frame; if (!s->pixel_addresses_initialized) { vp3_calculate_pixel_addresses(s); s->pixel_addresses_initialized = 1; } } else { s->current_frame.reference = 3; if (!s->pixel_addresses_initialized) { av_log(s->avctx, AV_LOG_ERROR, "vp3: first frame not a keyframe\n"); return -1; } if(avctx->get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "vp3: get_buffer() failed\n"); return -1; } } s->current_frame.qscale_table= s->qscale_table; s->current_frame.qstride= 0; init_frame(s, &gb); if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); return -1; } if (unpack_modes(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); return -1; } if (unpack_vectors(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); return -1; } if (unpack_block_qpis(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n"); return -1; } if (unpack_dct_coeffs(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); return -1; } for (i = 0; i < s->macroblock_height; i++) render_slice(s, i); apply_loop_filter(s); *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; if ((s->last_frame.data[0]) && (s->last_frame.data[0] != s->golden_frame.data[0])) avctx->release_buffer(avctx, &s->last_frame); s->last_frame= s->current_frame; s->current_frame.data[0]= NULL; return buf_size; }
1threat
multiple if statemant in AWK : Please help. I have a file, that look like 01/11/2015;998978000000;4890********3290;5735;ITUNES.COM/BILL;LU;Cross_border_rub;4065;17;915;INSUFF FUNDS;51;0; delimeter ";" (13 cols) I'm trying to calculate 9 column for all line awk -F';' -vOFS=';' '{ gsub(",", ".", $9); print }' file | awk -F ';' '$0 = NR-1";"$0' | awk -F ';' -vOFS=';' '{bar[$1]=$1;a[$1]=$2;b[$1]=$3;c[$1]=$4;d[$1]=$5;e[$1]=$6;f[$1]=$7;g[$1]=$8;h[$1]=$9;k[$1]=$10;l[$1]=$11;l[$1]=$12;m[$1]=$13;p[$1]=$14;}; if($7="International") {income=0.0162*h[i]+0.0425*h[i]}; else if($7="Domestic") {income=0.0188*h[i]}; else if($7="Cross_border_rub") {income=0.0162*h[i]+0.025*h[i]}END{for(i in bar) print income";"a[i],b[i],c[i],d[i],e[i],f[i],g[i],h[i],k[i],l[i],m[i],p[i]}' How exactly multiple if statement correctly work in awk? Big thanks!!!
0debug
How to make a button stop counting below 0? Java : Hi guys im stuck with this code if anyone could help me out it would be awesome private static String labelPrefix = "Number of boats added: "; private int numClicks = 0; JLabel addb = new JLabel(labelPrefix + "0 "); JButton del = new JButton("Delete Boat!"); panel.add(addb); addb.setText(labelPrefix + --numClicks); del.setVisible(true); when delete button is pressed it counts down from labelPrefix.. but i need it to stop at 0 and not go to negative side..any ideas how i could do it without changing alot?
0debug
broken h1 link displays 404 error page : h1 link is supposed to link to #section1. I can't figure out where along the lines this action broke. Any help would be greatly appreciated! https://codepen.io/fjenpen/pen/pROPov <div class="nav"> <ul id="menu" style="list-style-type: none;"> <li><a href="Section1" style="text-decoration:none"><h1>Our Brands</h1> </a></li> </ul> </div> <div class="main"> <div id="Section1" class="content"> <p>View our brands</p> </div>
0debug
static inline void validate_seg(int seg_reg, int cpl) { int dpl; uint32_t e2; e2 = env->segs[seg_reg].flags; dpl = (e2 >> DESC_DPL_SHIFT) & 3; if (!(e2 & DESC_CS_MASK) || !(e2 & DESC_C_MASK)) { if (dpl < cpl) { cpu_x86_load_seg_cache(env, seg_reg, 0, 0, 0, 0); } } }
1threat
Getting a indentation error while web scrapping using python : <p>I am trying a scrape a website using python and beautiful soup.As you can see in the attached screen shot when i tried to search the word "infinix" in the extracted links above it gave me the indentation error.As soon as i write the code in the screen shot and hit enter it is giving me an error. I want to find the word "infinix" in the extracted links with tags. <a href="https://i.stack.imgur.com/5dHBp.png" rel="nofollow noreferrer">enter image description here</a></p>
0debug
Is there any way to guess the value which generated by MD5 hashkey? : <p>I have written java code to generate HashKey with MD5. Is there any tool or mechanism to find/guess the value which generated.</p> <p>If so, please suggest me to make it more secure.</p>
0debug
static void close_connection(HTTPContext *c) { HTTPContext **cp, *c1; int i, nb_streams; AVFormatContext *ctx; URLContext *h; AVStream *st; cp = &first_http_ctx; while ((*cp) != NULL) { c1 = *cp; if (c1 == c) { *cp = c->next; } else { cp = &c1->next; if (c->fd >= 0) close(c->fd); if (c->fmt_in) { for(i=0;i<c->fmt_in->nb_streams;i++) { st = c->fmt_in->streams[i]; if (st->codec.codec) { avcodec_close(&st->codec); av_close_input_file(c->fmt_in); nb_streams = 0; if (c->stream) nb_streams = c->stream->nb_streams; for(i=0;i<nb_streams;i++) { ctx = c->rtp_ctx[i]; if (ctx) { av_free(ctx); h = c->rtp_handles[i]; if (h) { url_close(h); if (c->stream) current_bandwidth -= c->stream->bandwidth; av_freep(&c->pb_buffer); av_free(c->buffer); av_free(c); nb_connections--;
1threat
static void v9fs_mkdir(void *opaque) { V9fsPDU *pdu = opaque; size_t offset = 7; int32_t fid; struct stat stbuf; V9fsQID qid; V9fsString name; V9fsFidState *fidp; gid_t gid; int mode; int err = 0; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, "dsdd", &fid, &name, &mode, &gid); if (err < 0) { trace_v9fs_mkdir(pdu->tag, pdu->id, fid, name.data, mode, gid); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = v9fs_co_mkdir(pdu, fidp, &name, mode, fidp->uid, gid, &stbuf); if (err < 0) { goto out; stat_to_qid(&stbuf, &qid); err = pdu_marshal(pdu, offset, "Q", &qid); if (err < 0) { goto out; err += offset; trace_v9fs_mkdir_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, err); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name);
1threat
def max_sum_subseq(A): n = len(A) if n == 1: return A[0] look_up = [None] * n look_up[0] = A[0] look_up[1] = max(A[0], A[1]) for i in range(2, n): look_up[i] = max(look_up[i - 1], look_up[i - 2] + A[i]) look_up[i] = max(look_up[i], A[i]) return look_up[n - 1]
0debug
Play videos directly on website using html code : I have written some html code to play video directly from youtube. My code is like this: <div class="col-md-6"> <h2 class="line-bottom mt-0">University <span class="text-theme-colored2">Video</span></h2> <div class="row"> <div class="col-md-12"> <div class="box-hover-effect play-button"> <div class="effect-wrapper"> <div class="thumb"> <img class="img-fullwidth" src="images/about/5.jpg" alt="project"> </div> <div class="overlay-shade bg-theme-colored"></div> <div class="video-button"></div> <a class="hover-link" data-lightbox-gallery="youtube-video" href="https://www.youtube.com/watch?v=om4qTKMuPPs" title="Youtube Video">Youtube Video</a> </div> </div> </div> </div> </div> But, after clicking the play button, nothing is happening. Is there anything wrong in my code? How will I play the video?
0debug
Python, Seaborn FacetGrid change titles : <p>I am trying to create a FacetGrid in Seaborn</p> <p>My code is currently:</p> <pre><code>g = sns.FacetGrid(df_reduced, col="ActualExternal", margin_titles=True) bins = np.linspace(0, 100, 20) g.map(plt.hist, "ActualDepth", color="steelblue", bins=bins, width=4.5) </code></pre> <p>This gives my the Figure</p> <p><a href="https://i.stack.imgur.com/wtM3Q.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/wtM3Q.jpg" alt="My FacetGrid"></a></p> <p>Now, instead of "ActualExternal =0.0" and "ActualExternal =1.0" I would like the titles "Internal" and "External"</p> <p>And, instead of "ActualDepth" I would like the xlabel to say "Percentage Depth"</p> <p>Finally, I would like to add a ylabel of "Number of Defects".</p> <p>I've tried Googling and have tried a few things but so far no success. Please can you help me?</p> <p>Thanks</p>
0debug
How to replace/mask first n digit/string of map values in Scala : <p>I have a map in Scala like ( 1 -> 224343 , 2 -> 094533 , 3 -> 930069) and I want to replace first N digits/strings of map values with xxxx . so the desired output will be (1 -> xxxx43 , 2 -> xxxx33.....)</p>
0debug
JSON Web Token expiration : <p>On most of the JWT (JSON Web Token) tutorial (e.g: <a href="https://jwt.io/introduction/" rel="noreferrer">this</a> and <a href="https://www.toptal.com/java/rest-security-with-jwt-spring-security-and-java" rel="noreferrer">this</a>) are saying, once validated you can use the incoming token to get client information without validating it from the DB.</p> <p>My question is, how invalid user situation is maintained then? What I mean is, lets say a client just got a JWT token which expires in one week. But for very specific reason lets say we decided to invalidate the user, and don't want the user to access our API. But still that user has a token which is valid and user can access the API. </p> <p>Of course if we take a round trip to DB for each request then we can validate if the account is valid or invalid. My question is, what is the best way to take care this kind of situation for long lived tokens.</p> <p>Thanks in advance.</p>
0debug
static int ffm_is_avail_data(AVFormatContext *s, int size) { FFMContext *ffm = s->priv_data; int64_t pos, avail_size; int len; len = ffm->packet_end - ffm->packet_ptr; if (size <= len) return 1; pos = avio_tell(s->pb); if (!ffm->write_index) { if (pos == ffm->file_size) return AVERROR_EOF; avail_size = ffm->file_size - pos; } else { if (pos == ffm->write_index) { if (ffm->server_attached) return AVERROR(EAGAIN); else return AVERROR_INVALIDDATA; } else if (pos < ffm->write_index) { avail_size = ffm->write_index - pos; } else { avail_size = (ffm->file_size - pos) + (ffm->write_index - FFM_PACKET_SIZE); } } avail_size = (avail_size / ffm->packet_size) * (ffm->packet_size - FFM_HEADER_SIZE) + len; if (size <= avail_size) return 1; else if (ffm->server_attached) return AVERROR(EAGAIN); else return AVERROR_INVALIDDATA; }
1threat
static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c, int64_t timestamp, int flags) { const AVDVProfile *sys = av_dv_codec_profile2(c->vst->codec->width, c->vst->codec->height, c->vst->codec->pix_fmt, c->vst->codec->time_base); int64_t offset; int64_t size = avio_size(s->pb) - s->internal->data_offset; int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size; offset = sys->frame_size * timestamp; if (size >= 0 && offset > max_offset) offset = max_offset; else if (offset < 0) offset = 0; return offset + s->internal->data_offset; }
1threat
iOS UITableViewCell , How to get this appearance? : [![Customized UITableViewCell][1]][1] [1]: http://i.stack.imgur.com/2hYii.png **How to customize UITableViewCell to get this appearance ?** Is it possible to achieve this , without using a custom UIView for UITableViewCell?
0debug
How can I get file's directory by just typing it's name. (C++) : Is there a way to globally search for a file name + .exe or whatever, and then get it's directory. That means, let's say i have a file called "food.txt" in my deep C drive. I want to get it's directory, no matter where i put it in my pc by just typing it's name.
0debug
Looking for c# packet capture library : <p>i'm writing C# code in visual studio2015 and im looking for packet capture library </p> <p>my goal is to reject some non-allowed packets and ddos attack</p>
0debug
How is WordPiece tokenization helpful to effectively deal with rare words problem in NLP? : <p>I have seen that NLP models such as <a href="https://github.com/google-research/bert" rel="noreferrer">BERT</a> utilize WordPiece for tokenization. In WordPiece, we split the tokens like <strong><code>playing</code></strong> to <strong><code>play</code></strong> and <strong><code>##ing</code></strong>. It is mentioned that it covers a wider spectrum of Out-Of-Vocabulary (OOV) words. Can someone please help me explain how WordPiece tokenization is actually done, and how it handles effectively helps to rare/OOV words? </p>
0debug
Change Password IN MVC not working : I have CI application which has change password functionality but somehow its returning nothing. Below is code whic I have written in MVC fomrat **Controller** <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Password extends CI_Controller { public function __construct() { parent::__construct(); //$this->load->model('person_model','person'); $this->load->model('password_model'); //$this->load->model('invoice_model','invoice'); } public function index() { $this->load->helper('url'); $this->load->view('manpass'); } public function edit_password() { $uderid = $this->session->userdata('user_id'); // update data if($_POST) { if($this->input->post('old_password')!=''){ $this->form_validation->set_rules('old_password','Old password', 'trim|required|xss_clean|addslashes|encode_php_tags |callback_oldpass_check'); $this->form_validation->set_rules('new_password','New password', 'trim|required|xss_clean|addslashes|encode_php_tags|min_length['.PASS_MIN_LEN.']|md5'); $this->form_validation->set_rules('conf_password', 'Confirm password', 'trim|required|xss_clean|addslashes|encode_php_tags|min_length['.PASS_MIN_LEN.']|matches[new_password]|md5'); if($this->form_validation->run() == TRUE) { $data =array( 'password' => $this->input->post('conf_password')); $this->main->update('user','user_id',$uderid,$data); $this->change_password('Password updated successfully'); } else{ $this->change_password(); } } else{ redirect(base_url().'user' , '301'); } } var_dump(); } function oldpass_check($oldpass) { $user_id = $this->session->userdata('user_id'); $result = $this->main->check_oldpassword($oldpass,$user_id); if($result ==0) { $this->form_validation->set_message('oldpass_check', "%s doesn't match."); return FALSE ; } else { return TRUE ; } } } **Model** <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Password_model extends CI_Model { public function check_oldpassword($oldpass,$user_id) { $this->db->where('user_id', $user_id); $this->db->where('password', md5($oldpass)); $query = $this->db->get('user'); //data table return $query->num_rows(); } } **View** <div class="content-wrapper"> <div class="container-fluid"> <!-- Breadcrumbs--> <ol class="breadcrumb"> <li class="breadcrumb-item"> <a href="#">Home</a> </li> <li class="breadcrumb-item active">Password Management</li> </ol> <!-- Change Password--> <div class="row"> <div class="col-lg-6"> <form role="form" name="form1" id="form1" action="" method="post"> <div class="form-group"> <label>Old Password</label> <input type="text" name="old_password" id="old_password" class="form-control"> </div> <div class="form-group"> <label>New Password</label> <input type="text" name="new_password" id="new_password" class="form-control"> </div> <div class="form-group"> <label>Confirm Password</label> <input type="text" name="conf_password" id="conf_password" class="form-control"> </div> <button type="submit" name="submit" class="btn btn-primary">Change Password</button> <button type="reset" name="cancel" class="btn btn-danger">Cancel</button> </form> </div> </div> </div> <!-- /.container-fluid--> <!-- /.content-wrapper--> </div> </div> I am not sure where I am missing the link and where the data flow is missing. Please help. The loader is loading the correct form but its nopt displaying any error message whcih i have included in controller
0debug
FFMPEG: Too many packets buffered for output stream 0:1 : <p>I want to add a logo to a video using FFMPEG. I encountered this error: "Too many packets buffered for output stream 0:1.", "Conversion Failed.". I tried with diffent pictures and videos, always got the same error. Google didn't help much either. I found a thread </p> <pre><code>C:\Users\Anwender\OneDrive - IT-Center Engels\_Programmierung &amp; Scripting\delphi\_ITCE\Tempater\Win32\Debug\ffmpeg\bin&gt;ffmpeg ^ Mehr? -i C:\Users\Anwender\Videos\CutErgebnis.mp4 ^ Mehr? -i C:\Users\Anwender\Pictures\pic.png ^ Mehr? -filter_complex "overlay=0:0" ^ Mehr? C:\Users\Anwender\Videos\Logo.mp4 ffmpeg version N-90054-g474194a8d0 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 7.2.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-cuda --enable-cuvid --enable-d3d11va --enable-nvenc --enable-dxva2 --enable-avisynth libavutil 56. 7.101 / 56. 7.101 libavcodec 58. 11.101 / 58. 11.101 libavformat 58. 9.100 / 58. 9.100 libavdevice 58. 1.100 / 58. 1.100 libavfilter 7. 12.100 / 7. 12.100 libswscale 5. 0.101 / 5. 0.101 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Anwender\Videos\CutErgebnis.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.9.100 comment : Captured with Snagit 13.1.3.7993 : Microphone - Mikrofon (Steam Streaming Microphone) : Duration: 00:01:51.99, start: 0.015011, bitrate: 148 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1918x718 [SAR 1:1 DAR 959:359], 149 kb/s, 14.79 fps, 15 tbr, 15k tbn, 30 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s (default) Metadata: handler_name : SoundHandler Input #1, png_pipe, from 'C:\Users\Anwender\Pictures\pic.png': Duration: N/A, bitrate: N/A Stream #1:0: Video: png, pal8(pc), 400x400, 25 tbr, 25 tbn, 25 tbc File 'C:\Users\Anwender\Videos\Logo.mp4' already exists. Overwrite ? [y/N] y Stream mapping: Stream #0:0 (h264) -&gt; overlay:main (graph 0) Stream #1:0 (png) -&gt; overlay:overlay (graph 0) overlay (graph 0) -&gt; Stream #0:0 (libx264) Stream #0:1 -&gt; #0:1 (aac (native) -&gt; aac (native)) Press [q] to stop, [?] for help Too many packets buffered for output stream 0:1. [aac @ 000001f4c5257a40] Qavg: 65305.387 [aac @ 000001f4c5257a40] 2 frames left in the queue on closing Conversion failed! </code></pre> <p>My FFMPEG Version: ffmpeg-20180322-ed0e0fe-win64-static</p> <p>Details about the Video:</p> <pre><code> C:\Users\Anwender\OneDrive - IT-Center Engels\_Programmierung &amp; Scripting\delphi\_ITCE\Tempater\Win32\Debug\ffmpeg-20180322-ed0e0fe-win64-static\bin&gt;ffprobe.exe C:\Users\Anwender\Videos\CutErgebnis.mp4 ffprobe version N-90399-ged0e0fe102 Copyright (c) 2007-2018 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth libavutil 56. 11.100 / 56. 11.100 libavcodec 58. 15.100 / 58. 15.100 libavformat 58. 10.100 / 58. 10.100 libavdevice 58. 2.100 / 58. 2.100 libavfilter 7. 13.100 / 7. 13.100 libswscale 5. 0.102 / 5. 0.102 libswresample 3. 0.101 / 3. 0.101 libpostproc 55. 0.100 / 55. 0.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\Users\Anwender\Videos\CutErgebnis.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf58.9.100 comment : Captured with Snagit 13.1.3.7993 : Microphone - Mikrofon (Steam Streaming Microphone) : Duration: 00:01:51.99, start: 0.015011, bitrate: 148 kb/s Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1918x718 [SAR 1:1 DAR 959:359], 149 kb/s, 14.79 fps, 15 tbr, 15k tbn, 30 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 1 kb/s (default) Metadata: handler_name : SoundHandler </code></pre>
0debug
static int ism_write_header(AVFormatContext *s) { SmoothStreamingContext *c = s->priv_data; int ret = 0, i; AVOutputFormat *oformat; mkdir(s->filename, 0777); oformat = av_guess_format("ismv", NULL, NULL); if (!oformat) { ret = AVERROR_MUXER_NOT_FOUND; goto fail; } c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams); if (!c->streams) { ret = AVERROR(ENOMEM); goto fail; } for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; AVFormatContext *ctx; AVStream *st; AVDictionary *opts = NULL; char buf[10]; if (!s->streams[i]->codec->bit_rate) { av_log(s, AV_LOG_ERROR, "No bit rate set for stream %d\n", i); ret = AVERROR(EINVAL); goto fail; } snprintf(os->dirname, sizeof(os->dirname), "%s/QualityLevels(%d)", s->filename, s->streams[i]->codec->bit_rate); mkdir(os->dirname, 0777); ctx = avformat_alloc_context(); if (!ctx) { ret = AVERROR(ENOMEM); goto fail; } os->ctx = ctx; ctx->oformat = oformat; ctx->interrupt_callback = s->interrupt_callback; if (!(st = avformat_new_stream(ctx, NULL))) { ret = AVERROR(ENOMEM); goto fail; } avcodec_copy_context(st->codec, s->streams[i]->codec); st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, ism_write, ism_seek); if (!ctx->pb) { ret = AVERROR(ENOMEM); goto fail; } snprintf(buf, sizeof(buf), "%d", c->lookahead_count); av_dict_set(&opts, "ism_lookahead", buf, 0); av_dict_set(&opts, "movflags", "frag_custom", 0); if ((ret = avformat_write_header(ctx, &opts)) < 0) { goto fail; } os->ctx_inited = 1; avio_flush(ctx->pb); av_dict_free(&opts); s->streams[i]->time_base = st->time_base; if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { c->has_video = 1; os->stream_type_tag = "video"; if (st->codec->codec_id == AV_CODEC_ID_H264) { os->fourcc = "H264"; } else if (st->codec->codec_id == AV_CODEC_ID_VC1) { os->fourcc = "WVC1"; } else { av_log(s, AV_LOG_ERROR, "Unsupported video codec\n"); ret = AVERROR(EINVAL); goto fail; } } else { c->has_audio = 1; os->stream_type_tag = "audio"; if (st->codec->codec_id == AV_CODEC_ID_AAC) { os->fourcc = "AACL"; os->audio_tag = 0xff; } else if (st->codec->codec_id == AV_CODEC_ID_WMAPRO) { os->fourcc = "WMAP"; os->audio_tag = 0x0162; } else { av_log(s, AV_LOG_ERROR, "Unsupported audio codec\n"); ret = AVERROR(EINVAL); goto fail; } os->packet_size = st->codec->block_align ? st->codec->block_align : 4; } get_private_data(os); } if (!c->has_video && c->min_frag_duration <= 0) { av_log(s, AV_LOG_WARNING, "no video stream and no min frag duration set\n"); ret = AVERROR(EINVAL); } ret = write_manifest(s, 0); fail: if (ret) ism_free(s); return ret; }
1threat
static bool sdhci_can_issue_command(SDHCIState *s) { if (!SDHC_CLOCK_IS_ON(s->clkcon) || !(s->pwrcon & SDHC_POWER_ON) || (((s->prnsts & SDHC_DATA_INHIBIT) || s->stopped_state) && ((s->cmdreg & SDHC_CMD_DATA_PRESENT) || ((s->cmdreg & SDHC_CMD_RESPONSE) == SDHC_CMD_RSP_WITH_BUSY && !(SDHC_COMMAND_TYPE(s->cmdreg) == SDHC_CMD_ABORT))))) { return false; } return true; }
1threat
How to get class of an object? : <p>I need to get the exact class of an object to raise TypeError and print it on to the console.</p> <pre><code>def diff(a,b): retset = [] if not isinstance(a,set) or not isinstance(b,set): raise TypeError("Unsupported operand type(s) for -: '{}' and '{}'".format(type(a),type(b))) else: for item in a: if not item in b: retset.append(item) return set(retset) </code></pre> <p>if I pass args that are not sets, for example, 1 set and 1 list, this outputs Unsupported operand type(s) for -: class 'set' and class 'list'</p> <p>whereas I want the output as unsupported operand type(s) for -: 'set' and 'list'</p> <p>Is there a specific built-in functions like type()?</p>
0debug
How to go about adding a link/reference to another method in documentation Xcode? : <p>I am adding some description to my method in class. This is how I achieved this:</p> <p><a href="https://i.stack.imgur.com/1przA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1przA.png" alt="enter image description here"></a></p> <p>And it looks like this upon clicking...</p> <p><a href="https://i.stack.imgur.com/WqCwW.png" rel="noreferrer"><img src="https://i.stack.imgur.com/WqCwW.png" alt="enter image description here"></a></p> <p>How can I make the underlined method clickable? I want it to be referenced so that when a user clicks on it, they are directed to a particular web page for documentation. </p> <p>Is it even possible? Thanks in advance, any help will be appreciated</p>
0debug
regex for minimum 8 character,beside letters add number or symbol or both : <p>Examples which should Satisfy: test@1234 (accept) TestTo^12 (accept) test!5655(accept) Test!@$&amp;(accept) testtesttest(should not accept) Beside Letter i want atleast one number or symbol.If both is available that is fine.</p>
0debug
Using Google API for Python- where do I get the client_secrets.json file from? : <p>I am looking into using the Google API to allow users to create/ edit calendar entries in a company calendar (Google calendar) from within iCal.</p> <p>I'm following the instructions at: <a href="https://developers.google.com/api-client-library/python/auth/web-app" rel="noreferrer">https://developers.google.com/api-client-library/python/auth/web-app</a></p> <p>Step 2 says that I will need the application's <code>client ID</code> and <code>client secret</code>. I can see the <code>client ID</code> in the 'Credentials' page for my app, but I have no idea what the <code>client secret</code> is or where I get that from- anyone know what this is? How do I download it? Where can I get the value from to update the field?</p>
0debug
gitlab ci cache no matching files : <p>I try to build apk with gitlab runner</p> <p>When I build apk, I don't want download all build pacakage everytime</p> <p>so i try to caching .gradle/caches and .gradle/wrappers</p> <p>following is my gitlab-ci.yml</p> <pre><code>sdk_build_job image: myimage:latest stage: sdk-build script: ... cache: key: gradle-cache - /root/.gradle/caches - /root/.gradle/wrapper </code></pre> <p>but create gradle-cache always make an warning </p> <pre><code>Creating cache gradle-cache... WARNING: /root/.gradle/caches: no matching files WARNING: /root/.gradle/wrapper: no matching files Archive is up to date! </code></pre> <p>I don't know why can't find caches and wrapper directory</p> <p>When i into docker container and find the folders, there were well positioned</p> <pre><code>root@runner-3d9fa57b-project-4-concurrent-0:~/.gradle# pwd /root/.gradle root@runner-3d9fa57b-project-4-concurrent-0:~/.gradle# ls -al total 28 drwxr-xr-x 7 root root 4096 Dec 28 02:21 . drwx------ 1 root root 4096 Dec 28 02:19 .. drwxr-xr-x 6 root root 4096 Dec 28 02:20 caches drwxr-xr-x 3 root root 4096 Dec 28 02:19 daemon drwxr-xr-x 4 root root 4096 Dec 28 02:19 native drwxr-xr-x 2 root root 4096 Dec 28 02:21 workers drwxr-xr-x 3 root root 4096 Dec 28 02:19 wrapper </code></pre> <p>Please help me.......</p>
0debug
Print a pdf without visually opening it : <p>The thing I want to build is that by clicking a button I want to trigger the print of a PDF file, but without opening it.</p> <pre><code>+-----------+ | Print PDF | +-----------+ ^ Click *---------&gt; printPdf(pdfUrl) </code></pre> <p>The way how I first tried it is to use an iframe:</p> <pre><code>var $iframe = null; // This is supposed to fix the onload bug on IE, but it's not fired window.printIframeOnLoad = function() { if (!$iframe.attr("src")) { return; } var PDF = $iframe.get(0); PDF.focus(); try { // This doesn't work on IE anyways PDF.contentWindow.print(); // I think on IE we can do something like this: // PDF.document.execCommand("print", false, null); } catch (e) { // If we can't print it, we just open it in the current window window.location = url; } }; function printPdf(url) { if ($iframe) { $iframe.remove(); } $iframe = $('&lt;iframe&gt;', { class: "hide", id: "idPdf", // Supposed to be a fix for IE onload: "window.printIframeOnLoad()", src: url }); $("body").prepend($iframe); } </code></pre> <p>This works on Safari (desktop &amp; iOS) and Chrome (can we generalize it maybe to webkit?).</p> <p>On Firefox, <code>PDF.contentWindow.print()</code> ends with a <code>permission denied</code> error (even the pdf is loaded from the same domain).</p> <p>On IE (11), the <code>onload</code> handler is just not working.</p> <hr> <p>Now, my question is: is there another better way to print the pdf without visually opening it to the user?</p> <p>The cross browser thing is critical here. We should support as many browsers as possible.</p> <p>What's the best way to achieve this? Is my start a good one? How to complete it?</p> <p><sub>We are now in 2016 and I feel like this is still a pain to implement across the browsers.</sub></p>
0debug
How can I modify Jenkins Configuration Global Security from linux server? : In Jenkins UI, I have the below section under http://XXXXXX:YYYY/configureSecurity/ [![OpenID Federated Login][1]][1] where can I find this definition in Server (Linux RHEL)? I tried to grep for it in jenkins-production folder but couldn't find anything. is there a way to change the checkbox for 'Enable script security for Job DSL scripts' from server? [1]: https://i.stack.imgur.com/vilN1.png
0debug
How to make a reset button to swift application? : There is four NavigationController views connected by segues. In three views I input variables by UITextField's and in the last i have label with counting result. I try to make a button, that reset application to "0%" and opens initialViewController. How could I do this?
0debug
How to convert Automation element in to UITestControl : <p>I came across one scenario where I have to identify object using Windows UI automation element.</p> <p>I want to convert this object back to UITestControl, so that I can use inbuilt methods like waitforcontrol ready etc.</p> <p>How Can I do this?</p> <p>regards,</p> <p>User232482</p>
0debug
How to import data into google colab from google drive? : <p>I have some data files uploaded on my google drive. I want to import those files into google colab.</p> <p>The REST API method and PyDrive method show how to create a new file and upload it on drive and colab. Using that, I am unable to figure out how to read the data files already present on my drive in my python code.</p> <p>I am a total newbie to this. Can someone help me out?</p>
0debug
static int joint_decode(COOKContext *q, COOKSubpacket *p, float *mlt_buffer1, float *mlt_buffer2) { int i, j, ret; int decouple_tab[SUBBAND_SIZE]; float *decode_buffer = q->decode_buffer_0; int idx, cpl_tmp; float f1, f2; const float *cplscale; memset(decouple_tab, 0, sizeof(decouple_tab)); memset(decode_buffer, 0, sizeof(q->decode_buffer_0)); memset(mlt_buffer1, 0, 1024 * sizeof(*mlt_buffer1)); memset(mlt_buffer2, 0, 1024 * sizeof(*mlt_buffer2)); decouple_info(q, p, decouple_tab); if ((ret = mono_decode(q, p, decode_buffer)) < 0) return ret; for (i = 0; i < p->js_subband_start; i++) { for (j = 0; j < SUBBAND_SIZE; j++) { mlt_buffer1[i * 20 + j] = decode_buffer[i * 40 + j]; mlt_buffer2[i * 20 + j] = decode_buffer[i * 40 + 20 + j]; } } idx = (1 << p->js_vlc_bits) - 1; for (i = p->js_subband_start; i < p->subbands; i++) { cpl_tmp = cplband[i]; idx -= decouple_tab[cpl_tmp]; cplscale = q->cplscales[p->js_vlc_bits - 2]; f1 = cplscale[decouple_tab[cpl_tmp]]; f2 = cplscale[idx - 1]; q->decouple(q, p, i, f1, f2, decode_buffer, mlt_buffer1, mlt_buffer2); idx = (1 << p->js_vlc_bits) - 1; } return 0; }
1threat
How to oAuth Google API from Lambda AWS? : <p>I am building Alexa Skill for Google calendar. The client side code works as expected on local machine because I can authenticate the local machine using the link. But, when I deploy the code on AWS Lambda there is no way that I can authenticate as I cannot input code via AWS console.</p> <p>I am getting trouble in setting up authentication of Google Calendar API when deployed on AWS lambda.</p> <p>This documentation doesn't help much to me <a href="https://developers.google.com/gmail/api/auth/web-server" rel="noreferrer">Google Implementing Server Side Authentication</a> </p>
0debug
how to make a back up of whole android studio 3.0.1 : tell me how to make a full backup of Android studio 3.0.1 as I want to format my PC but I don't want to download Android studio again and its data should not be lost it so help me please
0debug
av_cold int ff_vp8_decode_init(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; int ret; s->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_YUV420P; avctx->internal->allocate_progress = 1; ff_videodsp_init(&s->vdsp, 8); ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1); ff_vp8dsp_init(&s->vp8dsp); if ((ret = vp8_init_frames(s)) < 0) { ff_vp8_decode_free(avctx); return ret; } return 0; }
1threat
Google Data Studio & AWS MySQL SSL Connection : <p>I am trying to remotely connect Google Data Studio with our MySQL Database, which is hosted on an AWS instance. To allow for a secure connection, we added SSL access to the AWS's MySQL database user as recommended in the <a href="https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.SSLSupport" rel="noreferrer">documentation</a>:</p> <pre><code>GRANT USAGE ON *.* TO 'encrypted_user'@'%' REQUIRE SSL; </code></pre> <p>The problem here is that AWS, unlike <a href="https://cloud.google.com/sql/docs/mysql/configure-ssl-instance" rel="noreferrer">GOOGLE CloudSQL</a>, only generates a <strong>Server certificate</strong>, and not a <strong>Client certificate</strong>, nor a <strong>Client private key</strong> (as far as I can tell). Both the latter is needed to enable SSL for Google Data Studio &amp; MySQL connection. </p> <p><a href="https://i.stack.imgur.com/fWIfj.png" rel="noreferrer"><img src="https://i.stack.imgur.com/fWIfj.png" alt="enter image description here"></a></p> <p>Just to add a side-note, we also white-listed Google's recommended IPs as listed <a href="https://support.google.com/datastudio/answer/7088031?hl=en" rel="noreferrer">here</a>. There are a lot of users in this <a href="https://www.en.advertisercommunity.com/t5/Data-Studio/Unable-to-connect-DataStudio-to-MySQL-data-on-hosting-company/m-p/1650272" rel="noreferrer">thread</a> complaining that white-listing specific IPs does not work, they had to add wildcard on the subnets. So we have also added addresses of the /16 subnets for each IP: </p> <pre><code>64.18.%.% 64.233.%.% 66.102.%.% 66.249.%.% 72.14.%.% 74.125.%.% 108.177.%.% 173.194.%.% 207.126.%.% 209.85.%.% 216.58.%.% 216.239.%.% </code></pre> <p>Finally, one does not need to restart the AWS firewall after white-listing new IPs, it is immediately in-effect. </p> <p><strong>My Questions:</strong></p> <ul> <li><p>Is there absolutely no way to create a client certificate and a client private key on MySQL hosted on AWS ?</p></li> <li><p>I would really want to use SSL between Google Data Studio (GDS) and our MySQL-DB, but the GDS-UI does not allow us to connect without filling in the client certificate and client private key. Is there any work around at the moment for me to allow this secure connection ? </p></li> </ul> <p>Thanks in advance!</p>
0debug
static int parse_audio_var(AVFormatContext *avctx, AVStream *st, const char *name, int size) { AVIOContext *pb = avctx->pb; if (!strcmp(name, "__DIR_COUNT")) { st->nb_frames = var_read_int(pb, size); } else if (!strcmp(name, "AUDIO_FORMAT")) { st->codec->codec_id = var_read_int(pb, size); } else if (!strcmp(name, "COMPRESSION")) { st->codec->codec_tag = var_read_int(pb, size); } else if (!strcmp(name, "DEFAULT_VOL")) { var_read_metadata(avctx, name, size); } else if (!strcmp(name, "NUM_CHANNELS")) { st->codec->channels = var_read_int(pb, size); st->codec->channel_layout = (st->codec->channels == 1) ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO; } else if (!strcmp(name, "SAMPLE_RATE")) { st->codec->sample_rate = var_read_int(pb, size); avpriv_set_pts_info(st, 33, 1, st->codec->sample_rate); } else if (!strcmp(name, "SAMPLE_WIDTH")) { st->codec->bits_per_coded_sample = var_read_int(pb, size) * 8; } else return -1; return 0; }
1threat
size_t slirp_socket_can_recv(struct in_addr guest_addr, int guest_port) { struct iovec iov[2]; struct socket *so; if (!link_up) return 0; so = slirp_find_ctl_socket(guest_addr, guest_port); if (!so || so->so_state & SS_NOFDREF) return 0; if (!CONN_CANFRCV(so) || so->so_snd.sb_cc >= (so->so_snd.sb_datalen/2)) return 0; return sopreprbuf(so, iov, NULL); }
1threat
Can not run the java file sample in android studio, any one can help me? thx : I just download the sample file in android developers site(https://developer.android.com/training/multiscreen/index.html), then open this using android studio. But I found the run button is disable and I can't find any way to execute this.(just like this http://chuantu.biz/t5/34/1474269694x3394677986.jpg) Any one can tall me how to run this file in android developers?Thank so much
0debug
I need to get results from one minus another in range numbers with python : <p>Hi i need to make a code to get a results betwen two numbers. I have start number 1000. I want to get all numbers from 1000 - 500 in a desired range like I give in example. </p> <p>I need one number minus another than minus one more time and loop this in range of numbers. Like I give you in example.</p> <p>1000 - 10 = 990 Than I need number 990 - 40 = 950 and all that in loop till 500. I need to have code to do this. </p> <pre><code>1000, 990 950, 940 900, 890 850, 840 800, 790 750, 740 700, 690 650, 640 600, 590 550, 540 </code></pre> <p>I tried with this</p> <pre><code>import math x = 1000 y = 10 z = x-y d = 40 print(x, z, sep=', ') </code></pre> <p>When I tried with range </p> <pre><code>for x in range(1000, 500, -40): print(x) </code></pre> <p>I get this </p> <pre><code>1000 960 920 880 840 800 760 720 680 640 600 560 520 </code></pre> <p>I don't know how to mix this two and get what I need. Can someone to direct me how to do this?</p>
0debug
static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, AVPacket *pkt) { unsigned char chunk_preamble[CHUNK_PREAMBLE_SIZE]; int chunk_type; int chunk_size; unsigned char opcode_preamble[OPCODE_PREAMBLE_SIZE]; unsigned char opcode_type; unsigned char opcode_version; int opcode_size; unsigned char scratch[1024]; int i, j; int first_color, last_color; int audio_flags; unsigned char r, g, b; unsigned int width, height; chunk_type = load_ipmovie_packet(s, pb, pkt); if (chunk_type != CHUNK_DONE) return chunk_type; if (url_feof(pb)) return CHUNK_EOF; if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) return CHUNK_BAD; chunk_size = AV_RL16(&chunk_preamble[0]); chunk_type = AV_RL16(&chunk_preamble[2]); av_dlog(NULL, "chunk type 0x%04X, 0x%04X bytes: ", chunk_type, chunk_size); switch (chunk_type) { case CHUNK_INIT_AUDIO: av_dlog(NULL, "initialize audio\n"); break; case CHUNK_AUDIO_ONLY: av_dlog(NULL, "audio only\n"); break; case CHUNK_INIT_VIDEO: av_dlog(NULL, "initialize video\n"); break; case CHUNK_VIDEO: av_dlog(NULL, "video (and audio)\n"); break; case CHUNK_SHUTDOWN: av_dlog(NULL, "shutdown\n"); break; case CHUNK_END: av_dlog(NULL, "end\n"); break; default: av_dlog(NULL, "invalid chunk\n"); chunk_type = CHUNK_BAD; break; } while ((chunk_size > 0) && (chunk_type != CHUNK_BAD)) { if (url_feof(pb)) { chunk_type = CHUNK_EOF; break; } if (avio_read(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != CHUNK_PREAMBLE_SIZE) { chunk_type = CHUNK_BAD; break; } opcode_size = AV_RL16(&opcode_preamble[0]); opcode_type = opcode_preamble[2]; opcode_version = opcode_preamble[3]; chunk_size -= OPCODE_PREAMBLE_SIZE; chunk_size -= opcode_size; if (chunk_size < 0) { av_dlog(NULL, "chunk_size countdown just went negative\n"); chunk_type = CHUNK_BAD; break; } av_dlog(NULL, " opcode type %02X, version %d, 0x%04X bytes: ", opcode_type, opcode_version, opcode_size); switch (opcode_type) { case OPCODE_END_OF_STREAM: av_dlog(NULL, "end of stream\n"); avio_skip(pb, opcode_size); break; case OPCODE_END_OF_CHUNK: av_dlog(NULL, "end of chunk\n"); avio_skip(pb, opcode_size); break; case OPCODE_CREATE_TIMER: av_dlog(NULL, "create timer\n"); if ((opcode_version > 0) || (opcode_size != 6)) { av_dlog(NULL, "bad create_timer opcode\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } s->frame_pts_inc = ((uint64_t)AV_RL32(&scratch[0])) * AV_RL16(&scratch[4]); av_dlog(NULL, " %.2f frames/second (timer div = %d, subdiv = %d)\n", 1000000.0 / s->frame_pts_inc, AV_RL32(&scratch[0]), AV_RL16(&scratch[4])); break; case OPCODE_INIT_AUDIO_BUFFERS: av_dlog(NULL, "initialize audio buffers\n"); if ((opcode_version > 1) || (opcode_size > 10)) { av_dlog(NULL, "bad init_audio_buffers opcode\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } s->audio_sample_rate = AV_RL16(&scratch[4]); audio_flags = AV_RL16(&scratch[2]); s->audio_channels = (audio_flags & 1) + 1; s->audio_bits = (((audio_flags >> 1) & 1) + 1) * 8; if ((opcode_version == 1) && (audio_flags & 0x4)) s->audio_type = AV_CODEC_ID_INTERPLAY_DPCM; else if (s->audio_bits == 16) s->audio_type = AV_CODEC_ID_PCM_S16LE; else s->audio_type = AV_CODEC_ID_PCM_U8; av_dlog(NULL, "audio: %d bits, %d Hz, %s, %s format\n", s->audio_bits, s->audio_sample_rate, (s->audio_channels == 2) ? "stereo" : "mono", (s->audio_type == AV_CODEC_ID_INTERPLAY_DPCM) ? "Interplay audio" : "PCM"); break; case OPCODE_START_STOP_AUDIO: av_dlog(NULL, "start/stop audio\n"); avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_BUFFERS: av_dlog(NULL, "initialize video buffers\n"); if ((opcode_version > 2) || (opcode_size > 8) || opcode_size < 4 || opcode_version == 2 && opcode_size < 8 ) { av_dlog(NULL, "bad init_video_buffers opcode\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } width = AV_RL16(&scratch[0]) * 8; height = AV_RL16(&scratch[2]) * 8; if (width != s->video_width) { s->video_width = width; s->changed++; } if (height != s->video_height) { s->video_height = height; s->changed++; } if (opcode_version < 2 || !AV_RL16(&scratch[6])) { s->video_bpp = 8; } else { s->video_bpp = 16; } av_dlog(NULL, "video resolution: %d x %d\n", s->video_width, s->video_height); break; case OPCODE_UNKNOWN_06: case OPCODE_UNKNOWN_0E: case OPCODE_UNKNOWN_10: case OPCODE_UNKNOWN_12: case OPCODE_UNKNOWN_13: case OPCODE_UNKNOWN_14: case OPCODE_UNKNOWN_15: av_dlog(NULL, "unknown (but documented) opcode %02X\n", opcode_type); avio_skip(pb, opcode_size); break; case OPCODE_SEND_BUFFER: av_dlog(NULL, "send buffer\n"); avio_skip(pb, opcode_size); break; case OPCODE_AUDIO_FRAME: av_dlog(NULL, "audio frame\n"); s->audio_chunk_offset = avio_tell(pb); s->audio_chunk_size = opcode_size; avio_skip(pb, opcode_size); break; case OPCODE_SILENCE_FRAME: av_dlog(NULL, "silence frame\n"); avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_MODE: av_dlog(NULL, "initialize video mode\n"); avio_skip(pb, opcode_size); break; case OPCODE_CREATE_GRADIENT: av_dlog(NULL, "create gradient\n"); avio_skip(pb, opcode_size); break; case OPCODE_SET_PALETTE: av_dlog(NULL, "set palette\n"); if (opcode_size > 0x304) { av_dlog(NULL, "demux_ipmovie: set_palette opcode too large\n"); chunk_type = CHUNK_BAD; break; } if (avio_read(pb, scratch, opcode_size) != opcode_size) { chunk_type = CHUNK_BAD; break; } first_color = AV_RL16(&scratch[0]); last_color = first_color + AV_RL16(&scratch[2]) - 1; if ((first_color > 0xFF) || (last_color > 0xFF)) { av_dlog(NULL, "demux_ipmovie: set_palette indexes out of range (%d -> %d)\n", first_color, last_color); chunk_type = CHUNK_BAD; break; } j = 4; for (i = first_color; i <= last_color; i++) { r = scratch[j++] * 4; g = scratch[j++] * 4; b = scratch[j++] * 4; s->palette[i] = (0xFFU << 24) | (r << 16) | (g << 8) | (b); s->palette[i] |= s->palette[i] >> 6 & 0x30303; } s->has_palette = 1; break; case OPCODE_SET_PALETTE_COMPRESSED: av_dlog(NULL, "set palette compressed\n"); avio_skip(pb, opcode_size); break; case OPCODE_SET_DECODING_MAP: av_dlog(NULL, "set decoding map\n"); s->decode_map_chunk_offset = avio_tell(pb); s->decode_map_chunk_size = opcode_size; avio_skip(pb, opcode_size); break; case OPCODE_VIDEO_DATA: av_dlog(NULL, "set video data\n"); s->video_chunk_offset = avio_tell(pb); s->video_chunk_size = opcode_size; avio_skip(pb, opcode_size); break; default: av_dlog(NULL, "*** unknown opcode type\n"); chunk_type = CHUNK_BAD; break; } } s->next_chunk_offset = avio_tell(pb); if ((chunk_type == CHUNK_VIDEO) || (chunk_type == CHUNK_AUDIO_ONLY)) chunk_type = load_ipmovie_packet(s, pb, pkt); return chunk_type; }
1threat
static int vfio_setup_pcie_cap(VFIOPCIDevice *vdev, int pos, uint8_t size, Error **errp) { uint16_t flags; uint8_t type; flags = pci_get_word(vdev->pdev.config + pos + PCI_CAP_FLAGS); type = (flags & PCI_EXP_FLAGS_TYPE) >> 4; if (type != PCI_EXP_TYPE_ENDPOINT && type != PCI_EXP_TYPE_LEG_END && type != PCI_EXP_TYPE_RC_END) { error_setg(errp, "assignment of PCIe type 0x%x " "devices is not currently supported", type); return -EINVAL; } if (!pci_bus_is_express(vdev->pdev.bus)) { PCIBus *bus = vdev->pdev.bus; PCIDevice *bridge; while (!pci_bus_is_root(bus)) { bridge = pci_bridge_get_device(bus); bus = bridge->bus; } if (pci_bus_is_express(bus)) { return 0; } } else if (pci_bus_is_root(vdev->pdev.bus)) { if (type == PCI_EXP_TYPE_ENDPOINT) { vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS, PCI_EXP_TYPE_RC_END << 4, PCI_EXP_FLAGS_TYPE); if (size > PCI_EXP_LNKCTL) { vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP, 0, ~0); vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0); vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA, 0, ~0); #ifndef PCI_EXP_LNKCAP2 #define PCI_EXP_LNKCAP2 44 #endif #ifndef PCI_EXP_LNKSTA2 #define PCI_EXP_LNKSTA2 50 #endif if (size > PCI_EXP_LNKCAP2) { vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP2, 0, ~0); vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL2, 0, ~0); vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA2, 0, ~0); } } } else if (type == PCI_EXP_TYPE_LEG_END) { return 0; } } else { if (type == PCI_EXP_TYPE_RC_END) { vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS, PCI_EXP_TYPE_ENDPOINT << 4, PCI_EXP_FLAGS_TYPE); vfio_add_emulated_long(vdev, pos + PCI_EXP_LNKCAP, PCI_EXP_LNK_MLW_1 | PCI_EXP_LNK_LS_25, ~0); vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKCTL, 0, ~0); } vfio_add_emulated_word(vdev, pos + PCI_EXP_LNKSTA, pci_get_word(vdev->pdev.config + pos + PCI_EXP_LNKSTA), PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_SLS); } if ((flags & PCI_EXP_FLAGS_VERS) == 0) { vfio_add_emulated_word(vdev, pos + PCI_CAP_FLAGS, 1, PCI_EXP_FLAGS_VERS); } pos = pci_add_capability(&vdev->pdev, PCI_CAP_ID_EXP, pos, size, errp); if (pos < 0) { return pos; } vdev->pdev.exp.exp_cap = pos; return pos; }
1threat
I'm fairly new to Linq and EF. Having problems comparing strings in Linq entities and SQL : Any way the comparison of strings is incorrect? I've already tried the String.Equals or CompareTo but those return boolean values, i read for Linq the comparison String == string is like a WHERE statement from SQL. public IHttpActionResult GetMultifiberResult(string partNumber) { var list = db.MultifiberResults.Where(s => s.PartNumber == partNumber).ToList(); return Ok(list); } list should return a bunch of values where the column PartNumber from the DB is equal to parameter partNumber. When I search using int comparison it does find matches in an int column but not with varchar columns. Controller always returns empty and the count is 0.
0debug
vu_queue_pop(VuDev *dev, VuVirtq *vq, size_t sz) { unsigned int i, head, max; VuVirtqElement *elem; unsigned out_num, in_num; struct iovec iov[VIRTQUEUE_MAX_SIZE]; struct vring_desc *desc; int rc; if (unlikely(dev->broken)) { return NULL; } if (vu_queue_empty(dev, vq)) { return NULL; } smp_rmb(); out_num = in_num = 0; max = vq->vring.num; if (vq->inuse >= vq->vring.num) { vu_panic(dev, "Virtqueue size exceeded"); return NULL; } if (!virtqueue_get_head(dev, vq, vq->last_avail_idx++, &head)) { return NULL; } if (vu_has_feature(dev, VIRTIO_RING_F_EVENT_IDX)) { vring_set_avail_event(vq, vq->last_avail_idx); } i = head; desc = vq->vring.desc; if (desc[i].flags & VRING_DESC_F_INDIRECT) { if (desc[i].len % sizeof(struct vring_desc)) { vu_panic(dev, "Invalid size for indirect buffer table"); } max = desc[i].len / sizeof(struct vring_desc); desc = vu_gpa_to_va(dev, desc[i].addr); i = 0; } do { if (desc[i].flags & VRING_DESC_F_WRITE) { virtqueue_map_desc(dev, &in_num, iov + out_num, VIRTQUEUE_MAX_SIZE - out_num, true, desc[i].addr, desc[i].len); } else { if (in_num) { vu_panic(dev, "Incorrect order for descriptors"); return NULL; } virtqueue_map_desc(dev, &out_num, iov, VIRTQUEUE_MAX_SIZE, false, desc[i].addr, desc[i].len); } if ((in_num + out_num) > max) { vu_panic(dev, "Looped descriptor"); } rc = virtqueue_read_next_desc(dev, desc, i, max, &i); } while (rc == VIRTQUEUE_READ_DESC_MORE); if (rc == VIRTQUEUE_READ_DESC_ERROR) { return NULL; } elem = virtqueue_alloc_element(sz, out_num, in_num); elem->index = head; for (i = 0; i < out_num; i++) { elem->out_sg[i] = iov[i]; } for (i = 0; i < in_num; i++) { elem->in_sg[i] = iov[out_num + i]; } vq->inuse++; return elem; }
1threat
MySQL. 3 tables, How to subtract table A - table B then update to table C? : <p>I have 3 tables (inprod, outprod, Products), I want to update it every time a new row comes in. What I want to know is, how can I update it in a single query using Join? The columns affected are ProdName and stocksIn, exists in these 3 tables. Simply put, products = inprod - outprod.</p>
0debug
Cant add border to Button using XML : <p>I just wanted to add a broder to my Button but its not working.</p> <p>Main xml script:</p> <p><a href="https://i.stack.imgur.com/yg7cT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yg7cT.png" alt="enter image description here"></a></p> <p>button_style4.xml:</p> <p><a href="https://i.stack.imgur.com/YlSN7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YlSN7.png" alt="enter image description here"></a></p> <p>The Button appears normaly in the App and it works as I want it to work just the border is not appearing... Someone find the fault?</p>
0debug
Saving a Postman header value into a variable throughout requests in a collection : <p>Good afternoon Stackers,</p> <p>I am trying to automate my test suite in Postman so that I don't have to manually go into each request and change that header value to what I initially put in the first request. </p> <p>My test suite currently looks like:</p> <p>First Request:</p> <pre><code>var headerValue = postman.setGlobalVariable('Number', headerValue); console.log("Number is: " + headerValue); </code></pre> <p>Second Request Header:</p> <pre><code>Number - {{headerValue}} </code></pre> <p>I would expect headerValue to have the value of 'Number' since I have set it as a global variable but it is coming back as undefined. I'm not sure what I am doing wrong.</p>
0debug
static void qcow_aio_write_cb(void *opaque, int ret) { QCowAIOCB *acb = opaque; BlockDriverState *bs = acb->common.bs; BDRVQcowState *s = bs->opaque; int index_in_cluster; const uint8_t *src_buf; int n_end; acb->hd_aiocb = NULL; if (ret >= 0) { ret = qcow2_alloc_cluster_link_l2(bs, acb->cluster_offset, &acb->l2meta); } run_dependent_requests(&acb->l2meta); if (ret < 0) goto done; acb->nb_sectors -= acb->n; acb->sector_num += acb->n; acb->buf += acb->n * 512; if (acb->nb_sectors == 0) { ret = 0; goto done; } index_in_cluster = acb->sector_num & (s->cluster_sectors - 1); n_end = index_in_cluster + acb->nb_sectors; if (s->crypt_method && n_end > QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors) n_end = QCOW_MAX_CRYPT_CLUSTERS * s->cluster_sectors; acb->cluster_offset = qcow2_alloc_cluster_offset(bs, acb->sector_num << 9, index_in_cluster, n_end, &acb->n, &acb->l2meta); if (!acb->cluster_offset && acb->l2meta.depends_on != NULL) { LIST_INSERT_HEAD(&acb->l2meta.depends_on->dependent_requests, acb, next_depend); return; } if (!acb->cluster_offset || (acb->cluster_offset & 511) != 0) { ret = -EIO; goto done; } if (s->crypt_method) { if (!acb->cluster_data) { acb->cluster_data = qemu_mallocz(QCOW_MAX_CRYPT_CLUSTERS * s->cluster_size); } qcow2_encrypt_sectors(s, acb->sector_num, acb->cluster_data, acb->buf, acb->n, 1, &s->aes_encrypt_key); src_buf = acb->cluster_data; } else { src_buf = acb->buf; } acb->hd_iov.iov_base = (void *)src_buf; acb->hd_iov.iov_len = acb->n * 512; qemu_iovec_init_external(&acb->hd_qiov, &acb->hd_iov, 1); acb->hd_aiocb = bdrv_aio_writev(s->hd, (acb->cluster_offset >> 9) + index_in_cluster, &acb->hd_qiov, acb->n, qcow_aio_write_cb, acb); if (acb->hd_aiocb == NULL) goto done; return; done: if (acb->qiov->niov > 1) qemu_vfree(acb->orig_buf); acb->common.cb(acb->common.opaque, ret); qemu_aio_release(acb); }
1threat
av_cold void ff_snow_common_end(SnowContext *s) { int plane_index, level, orientation, i; av_freep(&s->spatial_dwt_buffer); av_freep(&s->temp_dwt_buffer); av_freep(&s->spatial_idwt_buffer); av_freep(&s->temp_idwt_buffer); av_freep(&s->run_buffer); s->m.me.temp= NULL; av_freep(&s->m.me.scratchpad); av_freep(&s->m.me.map); av_freep(&s->m.me.score_map); av_freep(&s->m.obmc_scratchpad); av_freep(&s->block); av_freep(&s->scratchbuf); av_freep(&s->emu_edge_buffer); for(i=0; i<MAX_REF_FRAMES; i++){ av_freep(&s->ref_mvs[i]); av_freep(&s->ref_scores[i]); if(s->last_picture[i]->data[0]) { av_assert0(s->last_picture[i]->data[0] != s->current_picture->data[0]); } av_frame_free(&s->last_picture[i]); } for(plane_index=0; plane_index < s->nb_planes; plane_index++){ for(level=s->spatial_decomposition_count-1; level>=0; level--){ for(orientation=level ? 1 : 0; orientation<4; orientation++){ SubBand *b= &s->plane[plane_index].band[level][orientation]; av_freep(&b->x_coeff); } } } av_frame_free(&s->mconly_picture); av_frame_free(&s->current_picture); }
1threat
hi im new and need a timer in batch : hi im currently working whit batch and made a prank thing (obligates you to close your pc) and an override section for me to get all my coding back so i wanted the person whit the wrong code to have my prank activate in 20 minutes i would like suggestions on how to do it plz :system cls set /p assurance=are you sure you want to do this (I AM NOT RESPONSABLE FOR ANY DAMAGE DONE BY THIS COMMAND IF YOU ACCEPT TO MOVE ON.I WARN YOU THE ONLY WAY TO STOP THIS COMMAND IS RESTART YOUR PC.) echo -accept and move on echo or echo -stop this command pause if %assurance%==accept and move on goto initiate if %assurance%==stop this command goto home :wrong cls echo you have 20 minutes :initiate cls echo KILL CODE ACTIVATED ACTIVATED HAVE FUN!!! :killer start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start start goto killer :override cls echo i need the override code to activate this command. set /p code=code: if %code%==42 is the answer to life but my answer is 2029 goto right if not %code%==42 is the answer to life but my answer is 2029 goto wrong :right
0debug
void bdrv_round_to_clusters(BlockDriverState *bs, int64_t offset, unsigned int bytes, int64_t *cluster_offset, unsigned int *cluster_bytes) { BlockDriverInfo bdi; if (bdrv_get_info(bs, &bdi) < 0 || bdi.cluster_size == 0) { *cluster_offset = offset; *cluster_bytes = bytes; } else { int64_t c = bdi.cluster_size; *cluster_offset = QEMU_ALIGN_DOWN(offset, c); *cluster_bytes = QEMU_ALIGN_UP(offset - *cluster_offset + bytes, c); } }
1threat
Function should be called until my array become empty : <p>I'm having an array of data, i need to call a API Function and use my array value. Each time the API is hitting respected value should be deleted and my function should be called until the array becomes empty. </p>
0debug
Securing Spring Boot API with API key and secret : <p>I would like to secure the Spring Boot API so it is accessible only for the clients that has valid API key and secret. However, there is no authentication (standard login with username and password) inside the program as all data is anonymous. All I'm trying to achieve is that all API requests can be used only for specific third party front-end.</p> <p>I found a lot of articles about how to secure the Spring Boot API with user authentication. But I don't need user authentication. What I am thinking of is just provide my client with API key and secret so he has access to the endpoints.</p> <p>Could you please suggest me how can I achieve this? Thank you!</p>
0debug
Intellij idea auto import across files : <p>I have auto import enabled in idea, but it requires me to open the file in the editor (like it should). Now, i have done some regex magic, which means across 100+ classes i am using new classes that need to be imported. Since its all done with find/replace, those files have never been opened in the editor, and therefore the new classes havent been auto imported. Is there any way to run auto import unambiguous references across all files? cause currently, i have to compile, and then open all the files from the errors window? Optimize imports aparently doesnt do new imports.</p>
0debug
Why does my mergesort algorithm not work? : here's my code for a mergesort in java: public class MergeSort { public static void mergesort(int[] input) { int inputSize = input.length; if(inputSize < 2) { return; } int[] left = new int[inputSize/2]; int[] right = new int[inputSize/2]; int count = 0; for(int i=0; i < inputSize/2; i++) { left[i] = input[i]; } for(int i=inputSize/2; i<inputSize; i++) { right[count] = input[i]; count++; } mergesort(left); mergesort(right); merge(left, right, input); } public static int[] merge(int[] returnArr, int[] left, int[] right) { int leftSize = left.length; int rightSize = right.length; int i = 0; int j =0; int k = 0; int count = 0; while(i < leftSize && j < rightSize) { if(left[i] <= right[j]) { returnArr[k] = left[i]; i++; } else { returnArr[k] = right[j]; j++; } k++; } while(i<leftSize) { returnArr[k] = left[i]; i++; k++; } while(j < rightSize) { returnArr[k] = right[j]; j++; k++; } for(int x=0; x<returnArr.length; x++) { System.out.print(returnArr[x]); } return returnArr; } public static void main(String[] args) { int[] array = {3,4,6,2,7,1,8,6}; mergesort(array); } } My issue is that I'm getting an out of bounds exception. I'm using the debugger and have found that after mergesort(left) and mergesort(right) have finished recursively running, the arrays left and right, which go into the merge function, have the values [3] and [4] respectively, which is correct. But when the debugger jumps into the merge function, left has value [3] and right, for some reason is length 2 and has the value [3,4]. This is the source of my out of bounds exception, though I'm not sure why when the merge function runs for its first time, it changes the value of "right".
0debug
static void vc1_decode_skip_blocks(VC1Context *v) { MpegEncContext *s = &v->s; ff_er_add_slice(s, 0, s->start_mb_y, s->mb_width - 1, s->end_mb_y - 1, ER_MB_END); s->first_slice_line = 1; for (s->mb_y = s->start_mb_y; s->mb_y < s->end_mb_y; s->mb_y++) { s->mb_x = 0; ff_init_block_index(s); ff_update_block_index(s); if (s->last_picture.f.data[0]) { memcpy(s->dest[0], s->last_picture.f.data[0] + s->mb_y * 16 * s->linesize, s->linesize * 16); memcpy(s->dest[1], s->last_picture.f.data[1] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); memcpy(s->dest[2], s->last_picture.f.data[2] + s->mb_y * 8 * s->uvlinesize, s->uvlinesize * 8); } ff_draw_horiz_band(s, s->mb_y * 16, 16); s->first_slice_line = 0; } s->pict_type = AV_PICTURE_TYPE_P; }
1threat
int usb_claim_port(USBDevice *dev) { USBBus *bus = usb_bus_from_device(dev); USBPort *port; assert(dev->port == NULL); if (dev->port_path) { QTAILQ_FOREACH(port, &bus->free, next) { if (strcmp(port->path, dev->port_path) == 0) { break; } } if (port == NULL) { error_report("Error: usb port %s (bus %s) not found (in use?)", dev->port_path, bus->qbus.name); return -1; } } else { if (bus->nfree == 1 && strcmp(object_get_typename(OBJECT(dev)), "usb-hub") != 0) { usb_create_simple(bus, "usb-hub"); } if (bus->nfree == 0) { error_report("Error: tried to attach usb device %s to a bus " "with no free ports", dev->product_desc); return -1; } port = QTAILQ_FIRST(&bus->free); } trace_usb_port_claim(bus->busnr, port->path); QTAILQ_REMOVE(&bus->free, port, next); bus->nfree--; dev->port = port; port->dev = dev; QTAILQ_INSERT_TAIL(&bus->used, port, next); bus->nused++; return 0; }
1threat
Is there a DynamoDB max partition size of 10GB for a single partition key value? : <p>I've read lots of DynamoDB docs on designing partition keys and sort keys, but I think I must be missing something fundamental.</p> <p>If you have a bad partition key design, what happens when the data for a SINGLE partition key value exceeds 10GB?</p> <p>The 'Understand Partition Behaviour' section states:</p> <p>"A single partition can hold approximately 10 GB of data"</p> <p>How can it partition a single partition key?</p> <p><a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html#GuidelinesForTables.Partitions" rel="noreferrer">http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html#GuidelinesForTables.Partitions</a></p> <p>The docs also talk about limits with a local secondary index being limited to 10GB of data after which you start getting errors.</p> <p>"The maximum size of any item collection is 10 GB. This limit does not apply to tables without local secondary indexes; only tables that have one or more local secondary indexes are affected."</p> <p><a href="http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LSI.html#LSI.ItemCollections" rel="noreferrer">http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/LSI.html#LSI.ItemCollections</a></p> <p>That I can understand. So does it have some other magic for partitioning the data for a single partition key if it exceeds 10GB. Or does it just keep growing that partition? And what are the implications of that for your key design?</p> <p>The background to the question is that I've seen lots of examples of using something like a TenantId as a partition key in a multi-tentant environment. But that seems limiting if a specific TenantId could have more than 10 GB of data.</p> <p>I must be missing something?</p>
0debug
How to change cursor color in flutter : <p>Dears, I have 2 qestions in flutter If you don't mind. </p> <p><strong>1- How to change the color of the cursor as it default blue and I don't like it</strong></p> <p><strong>2- how can I make the text at the bottom of the screen whatever the screen size. ??</strong></p> <p>Thank you in advance. </p> <p><a href="https://i.stack.imgur.com/1wj8G.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/1wj8G.jpg" alt="enter image description here"></a></p>
0debug
How to cast System.Windows.Forms.RichTextBox.Text as String C#? : I have this `RichTextBox rtEvents` from click-drag in form designer and I want to cast the `rtEvents` value into string. [This solution doesn't works ][1], because I am not using `System.Windows.Controls.RichTextBox` I am using C# VS2013, I don't want to use `.Windows.Controls.*` because its difficult for me to design the form without click-drag. Is there any other way or workaround for it? [1]: http://stackoverflow.com/questions/4125310/how-to-get-a-wpf-rich-textbox-into-a-string
0debug
phpmailer undefined variable : <p>Hi i am getting this erorrs but i dont know where the problem is. I´ill be grateful for any advice.</p> <p>Notice: Undefined variable: headers in C:\wamp\www\restaurace\kongresform.php on line 59</p> <p>Notice: Undefined variable: messageb in C:\wamp\www\restaurace\kongresform.php on line 72</p> <pre><code> if (empty($errors)) { //If everything is OK // send an email // Obtain file upload vars // Headers $headers.= "From: $emailfr \n"; $headers.= "BCC: $emailcc "; // creates a boundary string. It must be unique $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; // Add the headers for a file attachment $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . "boundary=\"{$mime_boundary}\""; $messageb.="Dobrý den,&lt;br&gt;\n"; $messageb.="Jméno a přijímení: &lt;b&gt;".$namefrom."&lt;/b&gt;&lt;br&gt;\n"; $messageb.="Email: &lt;b&gt;".$email."&lt;/b&gt;&lt;br&gt;\n"; $messageb.="Prostor pro poznámky: ".$message."&lt;br&gt;&lt;br&gt;\n"; $messageb.="S pozdravom&lt;br&gt;\n"; $messageb.="tým Fincentrum Reality&lt;br&gt;\n"; $messageb.="&lt;br&gt;\n"; $messageb.="========================================================================&lt;br&gt;\n"; $messageb.="Tento e-mail byl odeslaný automaticky z webu. Prosím, neodpovídejte na něj.&lt;br&gt;\n"; $messageb.="========================================================================&lt;br&gt;\n"; $subject="Potvrzení\n"; // PHP Mailer $mail = new PHPMailer; //$mail-&gt;SMTPDebug = 3; // Enable verbose debug output $mail-&gt;isSMTP(); // Set mailer to use SMTP $mail-&gt;Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers $mail-&gt;SMTPAuth = true; // Enable SMTP authentication $mail-&gt;Username = 'mattoni.resta.test@gmail.com'; // SMTP username $mail-&gt;Password = 'mattonirestaurace'; // SMTP password $mail-&gt;SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail-&gt;Port = 587; // TCP port to connect to $mail-&gt;setFrom($emailfr); $mail-&gt;addAddress($to); // Add a recipient //$mail-&gt;addReplyTo('webform@fincentrum.com', 'Information'); //$mail-&gt;addCC($emailcc); $mail-&gt;addBCC($emailcc); //$mail-&gt;addAttachment('/var/tmp/file.tar.gz'); // Add attachments //$mail-&gt;addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name $mail-&gt;isHTML(true); // Set email format to HTML $mail-&gt;Subject = $subject; $mail-&gt;Body = $messageb; $mail-&gt;CharSet = 'UTF-8'; //$mail-&gt;AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail-&gt;send()) { exit("Mail could not be sent. Sorry! An error has occurred, please report this to the website administrator.\n"); //echo 'Mailer Error: ' . $mail-&gt;ErrorInfo; } else { echo '&lt;div id="formfeedback"&gt;&lt;h3&gt;Děkujeme za Vaší zprávu!&lt;/h3&gt;&lt;p&gt;'. $thanksmessage .'&lt;/p&gt;&lt;/div&gt;'; unset($_SESSION['yellloForm']); print_form(); } // end of if !mail } </code></pre>
0debug
void unix_start_outgoing_migration(MigrationState *s, const char *path, Error **errp) { unix_nonblocking_connect(path, unix_wait_for_connect, s, errp); }
1threat
static int tscc2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; TSCC2Context *c = avctx->priv_data; GetByteContext gb; uint32_t frame_type, size; int i, val, len, pos = 0; int num_mb = c->mb_width * c->mb_height; int ret; bytestream2_init(&gb, buf, buf_size); frame_type = bytestream2_get_byte(&gb); if (frame_type > 1) { av_log(avctx, AV_LOG_ERROR, "Incorrect frame type %"PRIu32"\n", frame_type); return AVERROR_INVALIDDATA; } if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { return ret; } if (frame_type == 0) { *got_frame = 1; if ((ret = av_frame_ref(data, c->pic)) < 0) return ret; return buf_size; } if (bytestream2_get_bytes_left(&gb) < 4) { av_log(avctx, AV_LOG_ERROR, "Frame is too short\n"); return AVERROR_INVALIDDATA; } c->quant[0] = bytestream2_get_byte(&gb); c->quant[1] = bytestream2_get_byte(&gb); if (c->quant[0] < 2 || c->quant[0] > NUM_VLC_SETS + 1 || c->quant[1] < 2 || c->quant[1] > NUM_VLC_SETS + 1) { av_log(avctx, AV_LOG_ERROR, "Invalid quantisers %d / %d\n", c->quant[0], c->quant[1]); return AVERROR_INVALIDDATA; } for (i = 0; i < 3; i++) { c->q[0][i] = tscc2_quants[c->quant[0] - 2][i]; c->q[1][i] = tscc2_quants[c->quant[1] - 2][i]; } bytestream2_skip(&gb, 1); size = bytestream2_get_le32(&gb); if (size > bytestream2_get_bytes_left(&gb)) { av_log(avctx, AV_LOG_ERROR, "Slice properties chunk is too large\n"); return AVERROR_INVALIDDATA; } for (i = 0; i < size; i++) { val = bytestream2_get_byte(&gb); len = val & 0x3F; val >>= 6; if (pos + len > num_mb) { av_log(avctx, AV_LOG_ERROR, "Too many slice properties\n"); return AVERROR_INVALIDDATA; } memset(c->slice_quants + pos, val, len); pos += len; } if (pos < num_mb) { av_log(avctx, AV_LOG_ERROR, "Too few slice properties (%d / %d)\n", pos, num_mb); return AVERROR_INVALIDDATA; } for (i = 0; i < c->mb_height; i++) { size = bytestream2_peek_byte(&gb); if (size & 1) { size = bytestream2_get_byte(&gb) - 1; } else { size = bytestream2_get_le32(&gb) >> 1; } if (!size) { int skip_row = 1, j, off = i * c->mb_width; for (j = 0; j < c->mb_width; j++) { if (c->slice_quants[off + j] == 1 || c->slice_quants[off + j] == 2) { skip_row = 0; break; } } if (!skip_row) { av_log(avctx, AV_LOG_ERROR, "Non-skip row with zero size\n"); return AVERROR_INVALIDDATA; } } if (bytestream2_get_bytes_left(&gb) < size) { av_log(avctx, AV_LOG_ERROR, "Invalid slice size (%"PRIu32"/%u)\n", size, bytestream2_get_bytes_left(&gb)); return AVERROR_INVALIDDATA; } ret = tscc2_decode_slice(c, i, buf + bytestream2_tell(&gb), size); if (ret) { av_log(avctx, AV_LOG_ERROR, "Error decoding slice %d\n", i); return ret; } bytestream2_skip(&gb, size); } *got_frame = 1; if ((ret = av_frame_ref(data, c->pic)) < 0) return ret; return buf_size; }
1threat
static int do_decode(AVCodecContext *avctx, AVPacket *pkt) { int got_frame; int ret; av_assert0(!avctx->internal->buffer_frame->buf[0]); if (!pkt) pkt = avctx->internal->buffer_pkt; avctx->refcounted_frames = 1; if (avctx->internal->draining_done) return AVERROR_EOF; if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { ret = avcodec_decode_video2(avctx, avctx->internal->buffer_frame, &got_frame, pkt); if (ret >= 0 && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED)) ret = pkt->size; } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame, &got_frame, pkt); } else { ret = AVERROR(EINVAL); } if (ret == AVERROR(EAGAIN)) ret = pkt->size; if (avctx->internal->draining && !got_frame) avctx->internal->draining_done = 1; if (ret < 0) return ret; if (ret >= pkt->size) { av_packet_unref(avctx->internal->buffer_pkt); } else { int consumed = ret; if (pkt != avctx->internal->buffer_pkt) { av_packet_unref(avctx->internal->buffer_pkt); if ((ret = av_packet_ref(avctx->internal->buffer_pkt, pkt)) < 0) return ret; } avctx->internal->buffer_pkt->data += consumed; avctx->internal->buffer_pkt->size -= consumed; avctx->internal->buffer_pkt->pts = AV_NOPTS_VALUE; avctx->internal->buffer_pkt->dts = AV_NOPTS_VALUE; } if (got_frame) av_assert0(avctx->internal->buffer_frame->buf[0]); return 0; }
1threat
How to tell cmake to compile .cu files with NVCC C++ instead of NVCC C? : I have 2 files that form a small CUDA library from my previous program (which works well, btw) written on C++. The header for this library is: #ifndef __cudaLU__ #define __cudaLU__ #include <assert.h> #include <cuda_runtime.h> #include <cusolverDn.h> #include <cusolverSp.h> #include <cusparse.h> #include <cuComplex.h> #include <stdlib.h> void denseLS(int dim, std::complex<float> * A, std::complex<float> * b ); void sparseLS(int dim, std::complex<float> *csrVal, int *csrRowPtr, int *csrColInd, std::complex<float> *vecVal); #endif And I want to use this library in my old-as-the-hills C program just by setting procedure in the head of my main.c file: extern void denseLS(int dim, float complex *A, float complex *b); And it fails with a bunch of similar errors. Few of them are: ..NA/cudaLS.cu(115): error: namespace "std" has no member "complex" ..NA/cudaLS.cu(115): error: expected a ")" ..NA/cudaLS.cu(137): error: identifier "csrRowPtr" is undefined ..NA/cudaLS.cu(169): error: identifier "csrColInd" is undefined ..NA/cudaLS.cu(170): error: identifier "csrVal" is undefined ..NA/cudaLS.cu(171): error: identifier "vecVal" is undefined I tried to make a change std::complex<float> -> float complex and nothing works. Still same errors (without std error, ofc). The cmake instructions file cmake_minimum_required(VERSION 3.8) project(NA) set(CMAKE_C_STANDARD 11) find_package(GSL REQUIRED) find_package(CUDA REQUIRED) include_directories("${CUDA_INCLUDE_DIRS}") cuda_add_library(solvers STATIC cudaLS.cu cudaLS.h) target_link_libraries(solvers ${CUDA_LIBRARIES} ${CUDA_cusparse_LIBRARY} ${CUDA_cusolver_LIBRARY}) target_compile_features(solvers PUBLIC cxx_std_11) set_target_properties( solvers PROPERTIES CUDA_SEPARABLE_COMPILATION ON) add_executable(NA main.c) set_target_properties(NA PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_link_libraries(NA PRIVATE GSL::gsl m solvers) What am I doing wrong pals?
0debug
Why doesn't this code work properly???I mean,why does it not show anything when I run it? : <p>Is there any problem in overloading methods?I really think it should work but it doesn't.<hr/></p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #include &lt;vector&gt; using namespace std; class BIGINT { vector&lt;int&gt; big_number; public: BIGINT(){} BIGINT(int); BIGINT(string); BIGINT operator+(const BIGINT&amp;)const; BIGINT operator+(int)const; BIGINT&amp; operator+=(const BIGINT&amp;); BIGINT&amp; operator==(const BIGINT&amp;); vector&lt;int&gt; get_bn() { return big_number; } friend ostream&amp; operator&lt;&lt;(ostream&amp; out,const BIGINT&amp;); }; </code></pre> <p>//constructors</p> <pre><code>BIGINT::BIGINT(int n) { vector&lt;int&gt; temp; while (n &gt; 0) { int a; a = n % 10; n /= 10; temp.push_back(a); } for (int i = temp.size() - 1;i &gt; 0;i--) { big_number.push_back(temp[i]); } } BIGINT::BIGINT(string sn) { vector&lt;char&gt; temp; for (int i = 0;i &lt; sn.size();i++) { temp.push_back(sn[i]); } for (int i = 0;i &lt; temp.size();i++) { big_number.push_back(temp[i]-48); } } </code></pre> <p>//overloading operator+</p> <pre><code>BIGINT BIGINT::operator+(const BIGINT&amp; bn) const { BIGINT temp; int size; int k = 0; if (bn.big_number.size()&gt;big_number.size()) size = big_number.size(); else size = bn.big_number.size(); for (int i = size - 1;i &gt; 0;i--) { if(k) { if (big_number[i] + bn.big_number[i]&gt;9) { temp.big_number.push_back(big_number[i] + bn.big_number[i] - 10 + 1); k = 1; } else { temp.big_number.push_back(big_number[i] + bn.big_number[i] + 1); k = 0; } } else { if(big_number[i]+bn.big_number[i]&gt;9) { temp.big_number.push_back(big_number[i] + bn.big_number[i] - 10); k = 1; } else { temp.big_number.push_back(big_number[i] + bn.big_number[i]); k = 0; } } } return temp; } BIGINT BIGINT::operator+(int n)const { BIGINT temp; int size; int k = 0; vector&lt;int&gt; temp_int; while (n &gt; 0) { int a; a = n % 10; n /= 10; temp_int.push_back(a); } if (temp_int.size()&gt;big_number.size()) size = big_number.size(); else size = temp_int.size(); for (int i = size - 1;i &gt; 0;i--) { if (k) { if (big_number[i] + temp_int[i]&gt;9) { temp.big_number.push_back(big_number[i] + temp_int[i] - 10 + 1); k = 1; } else { temp.big_number.push_back(big_number[i] + temp_int[i] + 1); k = 0; } } else { if (big_number[i] + temp_int[i]&gt;9) { temp.big_number.push_back(big_number[i] + temp_int[i] - 10); k = 1; } else { temp.big_number.push_back(big_number[i] + temp_int[i]); k = 0; } } } return temp; } BIGINT operator+(int n, BIGINT bn) { BIGINT temp; int size; int k = 0; vector&lt;int&gt; temp_int; while (n &gt; 0) { int a; a = n % 10; n /= 10; temp_int.push_back(a); } if (temp_int.size()&gt;bn.get_bn().size()) size = bn.get_bn().size(); else size = temp_int.size(); for (int i = size - 1;i &gt; 0;i--) { if (k) { if (bn.get_bn()[i] + temp_int[i]&gt;9) { temp.get_bn().push_back(bn.get_bn()[i] + temp_int[i] - 10 + 1); k = 1; } else { temp.get_bn().push_back(bn.get_bn()[i] + temp_int[i] + 1); k = 0; } } else { if (bn.get_bn()[i] + temp_int[i]&gt;9) { temp.get_bn().push_back(bn.get_bn()[i] + temp_int[i] - 10); k = 1; } else { temp.get_bn().push_back(bn.get_bn()[i] + temp_int[i]); k = 0; } } } return temp; } </code></pre> <p>//overloading operator+=</p> <pre><code>BIGINT&amp; BIGINT::operator+=(const BIGINT&amp; bn) { int size; int k = 0; if (bn.big_number.size()&gt;big_number.size()) size = big_number.size(); else size = bn.big_number.size(); for (int i = size - 1;i &gt; 0;i--) { if (k) { if (big_number[i] + bn.big_number[i]&gt;9) { big_number[i] = big_number[i] + bn.big_number[i] - 10 + 1; k = 1; } else { big_number[i] = big_number[i] + bn.big_number[i] + 1; k = 0; } } else { if (big_number[i] + bn.big_number[i]&gt;9) { big_number[i] = big_number[i] + bn.big_number[i] - 10; k = 1; } else { big_number[i] = big_number[i] + bn.big_number[i]; k = 0; } } } return *this; } </code></pre> <p>//overloading operator==</p> <pre><code>BIGINT&amp; BIGINT::operator==(const BIGINT&amp; bn) { for (int i = 0;i &lt; big_number.size();i++) { big_number[i] == bn.big_number[i]; } return *this; } </code></pre> <p>//overloading operator&lt;&lt;</p> <pre><code>ostream&amp; operator&lt;&lt;(ostream&amp; out, const BIGINT&amp; bn) { for (int i = 0;i &lt; bn.big_number.size();i++) { out &lt;&lt; bn.big_number[i]; } return out; } </code></pre> <p>//main</p> <pre><code>int main() { BIGINT a(123); BIGINT b(2); BIGINT c; c = a + b; cout &lt;&lt; c &lt;&lt; endl; system("pause"); return 0; } </code></pre>
0debug
Can I setup AWS Cognito User Pool Identity Providers with Cloudformation? : <p>I want to setup a cognito user pool and configure my google identity provider automatically with a cloudformation yml file.</p> <p>I checked all the documentation but could not find anything even close to doing this. Any idea on how to do it?</p> <p><a href="https://i.stack.imgur.com/OVB31.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OVB31.png" alt="enter image description here"></a></p>
0debug
Can I configure my browser to let my web app receive a right-click instead of the browser itself? : <p>I want to be able to use a right-click in a single page (react) app. Every time I right click, the browser handles it instead of letting my app handle it. This seems to happen with Chrome and Safari. Is there a way to tell either browser to pass the right-click to the web app?</p>
0debug
When a pod can't be scheduled, what does the 3 in "Insufficient cpu (3)" refer to? : <p>When I create a Pod that cannot be scheduled because there are no nodes with sufficient CPU to meet the Pod's CPU request, the events output from <code>kubectl describe pod/...</code> contain a message like <code>No nodes are available that match all of the following predicates:: Insufficient cpu (3)</code>.</p> <p>What does the <code>(3)</code> in <code>Insufficient cpu (3)</code> mean?</p> <p>For example, if I try to create a pod that requests 24 CPU when all of my nodes only have 4 CPUs:</p> <pre><code>$ kubectl describe pod/large-cpu-request Name: large-cpu-request Namespace: default Node: / Labels: &lt;none&gt; Annotations: &lt;none&gt; Status: Pending IP: Controllers: &lt;none&gt; Containers: cpuhog: ... Requests: cpu: 24 ... Events: FirstSeen LastSeen Count From SubObjectPath Type Reason Message --------- -------- ----- ---- ------------- -------- ------ ------- 23m 30s 84 default-scheduler Warning FailedScheduling No nodes are available that match all of the following predicates:: Insufficient cpu (3). </code></pre> <p>At other times I have seen event messages like <code>No nodes are available that match all of the following predicates:: Insufficient cpu (2), PodToleratesNodeTaints (1)</code> when a pod's resource requests were too high, so the 3 does not seem like a constant number - nor does it seem related to my 24 CPU request either.</p>
0debug
How to assign a value to an enum? : <p>Trying to assign a value to the <code>_cat.CatType.</code></p> <p>I was wondering how to do this without getting a null reference error?</p> <pre><code>using System; public class Program { private CatClass _cat; public void Main() { _cat.CatType = CatType.Active; Console.WriteLine(_cat.CatType.ToString()); } public enum CatType { New, Active, Inactive } public class CatClass { public CatType CatType { get; set; } } } </code></pre> <p>Ideally I want to assign it something like this <code>_cat.CatType = CatType.Active</code></p>
0debug
Need explaination : Sorry, can anyone explain me about this statement mean **Sup objRef;** . this block code is not error and i understand how to instantiate class. but I don't why in this example they(the book owner) have write this **Sup objRef;** after instantiate class. Please explain me. I am a newbie for Java. <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> package basic.code; class Sup{ void who(){ System.out.println("Who in Sup"); } } class Sup1 extends Sup{ void who(){ System.out.println("Who in Sup1"); } } class Sup2 extends Sup{ void who(){ System.out.println("Who in Sup2"); } } public class DynamicMethodDispatch { public static void main(String[] args) { // TODO Auto-generated method stub Sup obj = new Sup(); Sup1 obj1 = new Sup1(); Sup2 obj2 = new Sup2(); Sup objRef; objRef = obj; objRef.who(); objRef = obj1; objRef.who(); obj2.who(); } } <!-- end snippet -->
0debug
ConcurrentModificationException when attempting to removeAll on a list (not iterating) : <p>Some weird behaviour here as I'm not iterating through the list.</p> <pre><code>public boolean deleteEvents(ArrayList&lt;EventsModel&gt; list) { boolean success = false; synchronized (lock) { ArrayList&lt;EventsModel&gt; listClone = (ArrayList&lt;EventsModel&gt;) list.clone(); success = processDelete(listClone); } return success; } private boolean processDelete(List&lt;EventsModel&gt; list) { boolean success = false; if (list.size() &gt; 999) { List&lt;EventsModel&gt; subList = list.subList(0, 998); list.removeAll(subList); // blows up with ConcurrentModificationException // } else { // } return success; } </code></pre> <p>Am I not using <code>removeAll</code> correctly? </p>
0debug
public DbObject(Context context) { dbHelper = new DictionaryDatabase(context); this.db = dbHelper.getReadableDatabase(); : Please Explain the given code , what does it means and how it works. Here "DictionaryDatabse" is class name in which DataBase Name and Version is defined. Ill be thankful to you cordly. public DbObject(Context context) { dbHelper = new DictionaryDatabase(context); this.db = dbHelper.getReadableDatabase();}
0debug
Javascript variable not working in echo.... : My code : <?php echo ' <script>var p=0;for(var i=0;i<=5;i++){p++;}alert("ques".p);? > The value of p is displayed as 0.
0debug
how to make calculations in SQL server? : <p>How to make calculation in SQL server? There are two tables I have join them and i need to insert a new column that Will make a calculation for me. This is a small project for my course please help me. <a href="https://i.stack.imgur.com/EGzHX.png" rel="nofollow noreferrer">There are two tables</a> <a href="https://i.stack.imgur.com/yuWiq.png" rel="nofollow noreferrer">This is how I need it</a></p>
0debug
int bdrv_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BlockDriver *drv = bs->drv; if (!drv) return -ENOMEDIUM; if (sector_num == 0 && bs->boot_sector_enabled && nb_sectors > 0) { memcpy(buf, bs->boot_sector_data, 512); sector_num++; nb_sectors--; buf += 512; if (nb_sectors == 0) return 0; } if (drv->bdrv_pread) { int ret, len; len = nb_sectors * 512; ret = drv->bdrv_pread(bs, sector_num * 512, buf, len); if (ret < 0) return ret; else if (ret != len) return -EINVAL; else { bs->rd_bytes += (unsigned) len; bs->rd_ops ++; return 0; } } else { return drv->bdrv_read(bs, sector_num, buf, nb_sectors); } }
1threat
bitcoin and blockchain dev options : <p>I don't know if this is the best place to ask this, but I'm not looking for help on a specific problem. I'm looking into block chain technology and some bit coin stuff. Ran into someone that does a lot of articles on the subject and was curious about it.</p> <p>Since its new(ish) technology and still up and coming, I'm wonder if it would be interesting to get involved somehow and help shape and/or add to it in some way.</p> <p>What types of development is going on out there on this technology these days. All the reading material I can find online related to development and block chain is 4+years old. I'm sure its much different today. Anyone know of some good resources for learning about the technology, what type of development opportunities there are (python preferred) and just general info?</p> <p>thanks</p>
0debug
static void ahci_test_identify(AHCIQState *ahci) { RegD2HFIS *d2h = g_malloc0(0x20); RegD2HFIS *pio = g_malloc0(0x20); RegH2DFIS fis; AHCICommandHeader cmd; PRD prd; uint32_t reg, data_ptr; uint16_t buff[256]; unsigned i; int rc; uint8_t cx; uint64_t table; g_assert(ahci != NULL); i = ahci_port_select(ahci); g_test_message("Selected port %u for test", i); ahci_port_clear(ahci, i); table = ahci_alloc(ahci, CMD_TBL_SIZ(1)); g_assert(table); ASSERT_BIT_CLEAR(table, 0x7F); data_ptr = ahci_alloc(ahci, 512); g_assert(data_ptr); cx = ahci_pick_cmd(ahci, i); memset(&cmd, 0x00, sizeof(cmd)); cmd.flags = 5; cmd.flags |= 0x400; cmd.prdtl = 1; cmd.prdbc = 0; cmd.ctba = table; prd.dba = cpu_to_le64(data_ptr); prd.res = 0; prd.dbc = cpu_to_le32(511 | 0x80000000); memset(&fis, 0x00, sizeof(fis)); fis.fis_type = 0x27; fis.command = 0xEC; fis.device = 0; fis.flags = 0x80; g_assert_cmphex(ahci_px_rreg(ahci, i, AHCI_PX_IS), ==, 0); memwrite(table, &fis, sizeof(fis)); memwrite(table + 0x80, &prd, sizeof(prd)); ahci_set_command_header(ahci, i, cx, &cmd); g_assert_cmphex(ahci_px_rreg(ahci, i, AHCI_PX_IS), ==, 0); ahci_px_wreg(ahci, i, AHCI_PX_CI, (1 << cx)); while (BITSET(ahci_px_rreg(ahci, i, AHCI_PX_TFD), AHCI_PX_TFD_STS_BSY)) { usleep(50); } reg = ahci_px_rreg(ahci, i, AHCI_PX_IS); ASSERT_BIT_SET(reg, AHCI_PX_IS_DHRS); ASSERT_BIT_SET(reg, AHCI_PX_IS_PSS); ASSERT_BIT_CLEAR(reg, AHCI_PX_IS_DPS); ahci_px_wreg(ahci, i, AHCI_PX_IS, AHCI_PX_IS_DHRS | AHCI_PX_IS_PSS | AHCI_PX_IS_DPS); g_assert_cmphex(ahci_px_rreg(ahci, i, AHCI_PX_IS), ==, 0); reg = ahci_px_rreg(ahci, i, AHCI_PX_SERR); g_assert_cmphex(reg, ==, 0); reg = ahci_px_rreg(ahci, i, AHCI_PX_TFD); ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_STS_ERR); ASSERT_BIT_CLEAR(reg, AHCI_PX_TFD_ERR); ahci_get_command_header(ahci, i, cx, &cmd); g_assert_cmphex(512, ==, cmd.prdbc); memread(ahci->port[i].fb + 0x20, pio, 0x20); memread(ahci->port[i].fb + 0x40, d2h, 0x20); g_assert_cmphex(pio->fis_type, ==, 0x5f); g_assert_cmphex(d2h->fis_type, ==, 0x34); g_assert_cmphex(pio->flags, ==, d2h->flags); g_assert_cmphex(pio->status, ==, d2h->status); g_assert_cmphex(pio->error, ==, d2h->error); reg = ahci_px_rreg(ahci, i, AHCI_PX_TFD); g_assert_cmphex((reg & AHCI_PX_TFD_ERR), ==, pio->error); g_assert_cmphex((reg & AHCI_PX_TFD_STS), ==, pio->status); g_assert_cmphex(le16_to_cpu(pio->res4), ==, cmd.prdbc); memread(data_ptr, &buff, 512); string_bswap16(&buff[10], 20); rc = memcmp(&buff[10], "testdisk ", 20); g_assert_cmphex(rc, ==, 0); string_bswap16(&buff[23], 8); rc = memcmp(&buff[23], "version ", 8); g_assert_cmphex(rc, ==, 0); g_free(d2h); g_free(pio); }
1threat
Heroku installs Bundler then throws error Bundler 2.0.1 : <p>I'm attempting to deploy a Rails app to Heroku. It's been a while since I deployed anything there, but I'm at a loss for what's going on here. </p> <p>It's a fairly basic Rails 5 application. Deployment goes through the Gemfile smoothly then fails with an error requesting that I install Bundler v 2.0.1. Here's the fun bit of the log:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>remote: Fetching devise 4.6.2 remote: Installing sass-rails 5.0.7 remote: Installing devise 4.6.2 remote: Bundle complete! 26 Gemfile dependencies, 78 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into `./vendor/bundle` remote: Post-install message from i18n: remote: remote: HEADS UP! i18n 1.1 changed fallbacks to exclude default locale. remote: But that may break your application. remote: remote: Please check your Rails app for 'config.i18n.fallbacks = true'. remote: If you're using I18n (&gt;= 1.1.0) and Rails (&lt; 5.2.2), this should be remote: 'config.i18n.fallbacks = [I18n.default_locale]'. remote: If not, fallbacks will be broken in your app by I18n 1.1.x. remote: remote: For more info see: remote: https://github.com/svenfuchs/i18n/releases/tag/v1.1.0 remote: remote: Post-install message from sass: remote: remote: Ruby Sass has reached end-of-life and should no longer be used. remote: remote: * If you use Sass as a command-line tool, we recommend using Dart Sass, the new remote: primary implementation: https://sass-lang.com/install remote: remote: * If you use Sass as a plug-in for a Ruby web framework, we recommend using the remote: sassc gem: https://github.com/sass/sassc-ruby#readme remote: remote: * For more details, please refer to the Sass blog: remote: https://sass-lang.com/blog/posts/7828841 remote: remote: Removing bundler (2.0.1) remote: Bundle completed (47.21s) remote: Cleaning up the bundler cache. remote: -----&gt; Installing node-v10.14.1-linux-x64 remote: Detected manifest file, assuming assets were compiled locally remote: -----&gt; Detecting rails configuration remote: -----&gt; Detecting rake tasks remote: remote: ! remote: ! Could not detect rake tasks remote: ! ensure you can run `$ bundle exec rake -P` against your app remote: ! and using the production group of your Gemfile. remote: ! Activating bundler (2.0.1) failed: remote: ! Could not find 'bundler' (2.0.1) required by your /tmp/build_94d6a4f5d4fbb862672998d5d06d2506/Gemfile.lock. remote: ! To update to the latest version installed on your system, run `bundle update --bundler`. remote: ! To install the missing version, run `gem install bundler:2.0.1` remote: ! Checked in 'GEM_PATH=/tmp/build_94d6a4f5d4fbb862672998d5d06d2506/vendor/bundle/ruby/2.7.0', execute `gem env` for more information remote: ! remote: ! To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'` remote: ! remote: /app/tmp/buildpacks/b7af5642714be4eddaa5f35e2b4c36176b839b4abcd9bfe57ee71c358d71152b4fd2cf925c5b6e6816adee359c4f0f966b663a7f8649b0729509d510091abc07/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError) remote: ensure you can run `$ bundle exec rake -P` against your app remote: and using the production group of your Gemfile. remote: Activating bundler (2.0.1) failed: remote: Could not find 'bundler' (2.0.1) required by your /tmp/build_94d6a4f5d4fbb862672998d5d06d2506/Gemfile.lock. remote: To update to the latest version installed on your system, run `bundle update --bundler`. remote: To install the missing version, run `gem install bundler:2.0.1` remote: Checked in 'GEM_PATH=/tmp/build_94d6a4f5d4fbb862672998d5d06d2506/vendor/bundle/ruby/2.7.0', execute `gem env` for more information remote: remote: To install the version of bundler this project requires, run `gem install bundler -v '2.0.1'`</code></pre> </div> </div> </p> <p>I don't understand what's going on as Heroku seems to be running through the deployment just fine, then removes bundler, then throws an error on rake tasks and asks for bundler again. I've performed <code>RAILS_ENV=production bundle exec rake assets:precompile</code> already, and it's showing up to date. I must be missing something here, hopefully someone with more recent experience in Heroku can point it out. </p> <p><strong>Edit</strong> I've run the <code>bundle exec rake -P</code> command as well with no failures</p>
0debug
How do I replicate Gmail's "to" field where each item is an indivisible span? : <p>I want to replicate the functionality of Gmail's "to" field where:</p> <ul> <li>Each address is actually a div or span containing information</li> <li>The user treats each email address as an atomic, indivisible element -- e.g. backspace will delete it with backspace</li> <li>Elements are added by autocomplete. The implementation of autocomplete is outside of scope of this question. It's only here to clarify that an element is not just "text".</li> </ul> <p>Initially, I thought it should be a contenteditable element. However, inspecting Gmail's elements more closely, it looks to me like it's an element that just responds to keydown events</p> <p>Is there an accepted, easy way to do this, other than implementing the element (as well as key navigation) by hand?</p>
0debug
C language Typedef struct format : Can someone tell me how can I declare a typedef struct in other typedef struct? `typedef struct { char* type; char* destination; float price; typedef struct { int date; int month; int year; }date; }Offer; ` I tried something like this but I don't know if its correctly. I want to declare in typedef struct another typedef struct for date format. Thanks
0debug
static bool coroutine_fn yield_and_check(BackupBlockJob *job) { if (block_job_is_cancelled(&job->common)) { return true; } if (job->common.speed) { uint64_t delay_ns = ratelimit_calculate_delay(&job->limit, job->sectors_read); job->sectors_read = 0; block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, delay_ns); } else { block_job_sleep_ns(&job->common, QEMU_CLOCK_REALTIME, 0); } if (block_job_is_cancelled(&job->common)) { return true; } return false; }
1threat
static void kvm_log_stop(MemoryListener *listener, MemoryRegionSection *section) { int r; r = kvm_dirty_pages_log_change(section->offset_within_address_space, int128_get64(section->size), false); if (r < 0) { abort(); } }
1threat