problem
stringlengths
26
131k
labels
class label
2 classes
How to put sapce between div in a bigger div? : I have a BIG `<div>` with 3 `<div>` inside. I want to put space between the 3 little `<div>` without define the size of the big `<div>` or put `margin-top` to each little `<div>`. Do you know how to that in CSS ?
0debug
static void imx_enet_do_tx(IMXFECState *s) { int frame_size = 0; uint8_t frame[ENET_MAX_FRAME_SIZE]; uint8_t *ptr = frame; uint32_t addr = s->tx_descriptor; while (1) { IMXENETBufDesc bd; int len; imx_enet_read_bd(&bd, addr); FEC_PRINTF("tx_bd %x flags %04x len %d data %08x option %04x " "status %04x\n", addr, bd.flags, bd.length, bd.data, bd.option, bd.status); if ((bd.flags & ENET_BD_R) == 0) { break; } len = bd.length; if (frame_size + len > ENET_MAX_FRAME_SIZE) { len = ENET_MAX_FRAME_SIZE - frame_size; s->regs[ENET_EIR] |= ENET_INT_BABT; } dma_memory_read(&address_space_memory, bd.data, ptr, len); ptr += len; frame_size += len; if (bd.flags & ENET_BD_L) { if (bd.option & ENET_BD_PINS) { struct ip_header *ip_hd = PKT_GET_IP_HDR(frame); if (IP_HEADER_VERSION(ip_hd) == 4) { net_checksum_calculate(frame, frame_size); } } if (bd.option & ENET_BD_IINS) { struct ip_header *ip_hd = PKT_GET_IP_HDR(frame); if (IP_HEADER_VERSION(ip_hd) == 4) { uint16_t csum; ip_hd->ip_sum = 0; csum = net_raw_checksum((uint8_t *)ip_hd, sizeof(*ip_hd)); ip_hd->ip_sum = cpu_to_be16(csum); } } qemu_send_packet(qemu_get_queue(s->nic), frame, len); ptr = frame; frame_size = 0; if (bd.option & ENET_BD_TX_INT) { s->regs[ENET_EIR] |= ENET_INT_TXF; } } if (bd.option & ENET_BD_TX_INT) { s->regs[ENET_EIR] |= ENET_INT_TXB; } bd.flags &= ~ENET_BD_R; imx_enet_write_bd(&bd, addr); if ((bd.flags & ENET_BD_W) != 0) { addr = s->regs[ENET_TDSR]; } else { addr += sizeof(bd); } } s->tx_descriptor = addr; imx_eth_update(s); }
1threat
static int a64_write_packet(struct AVFormatContext *s, AVPacket *pkt) { AVCodecContext *avctx = s->streams[0]->codec; A64MuxerContext *c = s->priv_data; int i, j; int ch_chunksize; int lifetime; int frame_count; int charset_size; int frame_size; int num_frames; switch (avctx->codec->id) { case CODEC_ID_A64_MULTI: case CODEC_ID_A64_MULTI5: if(c->interleaved) { if(avctx->extradata) { lifetime = AV_RB32(avctx->extradata + 0); frame_count = AV_RB32(avctx->extradata + 4); charset_size = AV_RB32(avctx->extradata + 8); frame_size = AV_RB32(avctx->extradata + 12); } else { av_log(avctx, AV_LOG_ERROR, "extradata not set\n"); return AVERROR(EINVAL); } ch_chunksize=charset_size/lifetime; if(pkt->data) num_frames = lifetime; else num_frames = c->prev_frame_count; for(i = 0; i < num_frames; i++) { if(pkt->data) { put_buffer(s->pb, pkt->data + ch_chunksize * i, ch_chunksize); } else { for(j = 0; j < ch_chunksize; j++) put_byte(s->pb, 0); } if(c->prev_pkt.data) { put_buffer(s->pb, c->prev_pkt.data + charset_size + frame_size * i, frame_size); } else { for(j = 0; j < frame_size; j++) put_byte(s->pb, 0); } } if(pkt->data) { av_new_packet(&c->prev_pkt, pkt->size); memcpy(c->prev_pkt.data, pkt->data, pkt->size); } c->prev_frame_count = frame_count; break; } default: if(pkt) put_buffer(s->pb, pkt->data, pkt->size); break; } put_flush_packet(s->pb); return 0; }
1threat
Connection to Azure MySQL server fails due to incorrect connection string : <p>When trying to connect to my MySQL server in Azure from mysql client, I get the following error, even though I am using the correct username and server name. How can I fix this?</p> <p><em>The connection string may not be right. Please visit portal for references.</em></p>
0debug
With cat command create a file which is a merge of 2 files(linux) : <p>What I'm trying to do:</p> <pre><code>With cat command create a file named Merge which is the merge of test.txt and Copy(in a different directory than test.txt) </code></pre> <p>Both <code>test.txt</code> and <code>Copy</code> contain the same content:</p> <pre><code>reglib test.txt </code></pre> <p>So what I expect is:</p> <pre><code>reglib test.txt reglib test.txt </code></pre> <p>What I've tried:</p> <pre><code>cat /home/eleve/Copy | cat test.txt &gt;Merge.txt cat /home/eleve/Copy &gt;Merge.txt | cat test.txt &gt;Merge.txt cat /home/eleve/Copy &gt;Merge.txt | cat test.txt &gt;&gt;Merge.txt </code></pre> <p>And all of those command gave me the same wrong result:</p> <pre><code>reglib test.txt </code></pre> <p>Can anyone please suggest me the right command? thanks.</p>
0debug
static void vaapi_encode_h264_write_sps(PutBitContext *pbc, VAAPIEncodeContext *ctx) { VAEncSequenceParameterBufferH264 *vseq = ctx->codec_sequence_params; VAAPIEncodeH264Context *priv = ctx->priv_data; VAAPIEncodeH264MiscSequenceParams *mseq = &priv->misc_sequence_params; int i; vaapi_encode_h264_write_nal_header(pbc, NAL_SPS, 3); u(8, mseq_var(profile_idc)); u(1, mseq_var(constraint_set0_flag)); u(1, mseq_var(constraint_set1_flag)); u(1, mseq_var(constraint_set2_flag)); u(1, mseq_var(constraint_set3_flag)); u(1, mseq_var(constraint_set4_flag)); u(1, mseq_var(constraint_set5_flag)); u(2, 0, reserved_zero_2bits); u(8, vseq_var(level_idc)); ue(vseq_var(seq_parameter_set_id)); if (mseq->profile_idc == 100 || mseq->profile_idc == 110 || mseq->profile_idc == 122 || mseq->profile_idc == 244 || mseq->profile_idc == 44 || mseq->profile_idc == 83 || mseq->profile_idc == 86 || mseq->profile_idc == 118 || mseq->profile_idc == 128 || mseq->profile_idc == 138) { ue(vseq_field(chroma_format_idc)); if (vseq->seq_fields.bits.chroma_format_idc == 3) u(1, mseq_var(separate_colour_plane_flag)); ue(vseq_var(bit_depth_luma_minus8)); ue(vseq_var(bit_depth_chroma_minus8)); u(1, mseq_var(qpprime_y_zero_transform_bypass_flag)); u(1, vseq_field(seq_scaling_matrix_present_flag)); if (vseq->seq_fields.bits.seq_scaling_matrix_present_flag) { av_assert0(0 && "scaling matrices not supported"); } } ue(vseq_field(log2_max_frame_num_minus4)); ue(vseq_field(pic_order_cnt_type)); if (vseq->seq_fields.bits.pic_order_cnt_type == 0) { ue(vseq_field(log2_max_pic_order_cnt_lsb_minus4)); } else if (vseq->seq_fields.bits.pic_order_cnt_type == 1) { u(1, mseq_var(delta_pic_order_always_zero_flag)); se(vseq_var(offset_for_non_ref_pic)); se(vseq_var(offset_for_top_to_bottom_field)); ue(vseq_var(num_ref_frames_in_pic_order_cnt_cycle)); for (i = 0; i < vseq->num_ref_frames_in_pic_order_cnt_cycle; i++) se(vseq_var(offset_for_ref_frame[i])); } ue(vseq_var(max_num_ref_frames)); u(1, mseq_var(gaps_in_frame_num_allowed_flag)); ue(vseq->picture_width_in_mbs - 1, pic_width_in_mbs_minus1); ue(vseq->picture_height_in_mbs - 1, pic_height_in_mbs_minus1); u(1, vseq_field(frame_mbs_only_flag)); if (!vseq->seq_fields.bits.frame_mbs_only_flag) u(1, vseq_field(mb_adaptive_frame_field_flag)); u(1, vseq_field(direct_8x8_inference_flag)); u(1, vseq_var(frame_cropping_flag)); if (vseq->frame_cropping_flag) { ue(vseq_var(frame_crop_left_offset)); ue(vseq_var(frame_crop_right_offset)); ue(vseq_var(frame_crop_top_offset)); ue(vseq_var(frame_crop_bottom_offset)); } u(1, vseq_var(vui_parameters_present_flag)); if (vseq->vui_parameters_present_flag) vaapi_encode_h264_write_vui(pbc, ctx); vaapi_encode_h264_write_trailing_rbsp(pbc); }
1threat
How to get first image form json response : How to get first image form the response from below response ["147038089457a43b5e47d2a_job1.jpg","147038089457a43b5e48065_job2.jpg","147038089457a43b5e4829c_jobo_3.jpg"] i have tried ng-repeat is not working here
0debug
How do i get a custom string extension in visual studo : <p>I am trying to get this method into my project how do i do it <a href="http://extensionmethod.net/1718/csharp/string/leftof" rel="nofollow noreferrer">http://extensionmethod.net/1718/csharp/string/leftof</a></p>
0debug
How to join tables with text column : I got 2 tables to merge t1 Continent Country City ----------------------- Europe Germany Munich NA Canada Ontario Asia Singapore (blank) Asia Japan Tokyo AND t2 Country Status ----------------- Germany Complete Canada Incomplete Singapore Complete Japan Complete I want to get the continent with 2nd highest "complete", what should I do? I am new to SQL and is trying hard to learn the basics but I cannot get this done. Thanks all
0debug
Adding an image before each new line Angular4 renderer : I am trying to add an image before each new line (img) Apple (img) Ball (img) Cat (img) Dog create() { this.tooltip = this.renderer.createElement('div'); this.tooltipTitle.split(',').forEach((text) => { this.renderer.appendChild(this.tooltip, this.renderer.createText(text)); this.renderer.appendChild(this.tooltip, this.renderer.createElement('br')); this.renderer.appendChild(document.body, this.tooltip); }); } this.renderer.addClass(this.tooltip,'classA') .classA{ positon:absolute; max-width: 150px; font-size: 14px; color: black; padding: 3px 8px; background: grey; border-radius: 4px; z-index: 100; opacity: 0; } So the addClass is adding styles to the whole tooltip.That is good and working what I am further trying is to add an image at beginning of new line as well
0debug
PHP: Check if file exists before truncate table : <p>Can someone please help me to make this script check if the file exists, before it truncate the table. If filename not exists, I want to stop the import.</p> <pre><code>&lt;?php //set the connection variables $hostname = "host"; $username = "username"; $password = "pass"; $database = "database"; $filename = "filename.csv"; //connect to mysql database $connection = mysqli_connect($hostname, $username, $password, $database) or die("Error " . mysqli_error($connection)); mysqli_query($connection, "TRUNCATE TABLE `my_tablename`"); // open the csv file $fp = fopen($filename,"r"); //parse the csv file row by row while(($row = fgetcsv($fp,"500",",")) != FALSE) { //insert csv data into mysql table $sql = "INSERT INTO Pristabell (Produkt, Pris, Rabattkr, Rabattprosent, Lagerstatus, Butikk, TAGS) VALUES('" . implode("','",$row) . "')"; if(!mysqli_query($connection, $sql)) { die('Error : ' . mysqli_error($conection)); } } fclose($fp); //close the db connection mysqli_close($connection); ?&gt; </code></pre> <p>Thanks :-)</p>
0debug
static void v9fs_lock(void *opaque) { int8_t status; V9fsFlock *flock; size_t offset = 7; struct stat stbuf; V9fsFidState *fidp; int32_t fid, err = 0; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; flock = g_malloc(sizeof(*flock)); pdu_unmarshal(pdu, offset, "dbdqqds", &fid, &flock->type, &flock->flags, &flock->start, &flock->length, &flock->proc_id, &flock->client_id); status = P9_LOCK_ERROR; if (flock->flags & ~P9_LOCK_FLAGS_BLOCK) { err = -EINVAL; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_fstat(pdu, fidp->fs.fd, &stbuf); if (err < 0) { goto out; } status = P9_LOCK_SUCCESS; out: put_fid(pdu, fidp); out_nofid: err = offset; err += pdu_marshal(pdu, offset, "b", status); trace_v9fs_lock_return(pdu->tag, pdu->id, status); complete_pdu(s, pdu, err); v9fs_string_free(&flock->client_id); g_free(flock); }
1threat
vapor toolbox broken after upgrading swift : <p>Vapor toolbox is crashing when trying to use it after upgrading to Swift 3.1.</p> <pre><code>dyld: lazy symbol binding failed: Symbol not found: __TTSfq4n_s___TFVSS13CharacterView38_measureExtendedGraphemeClusterForwardfT4fromVVSS17UnicodeScalarView5Index_Si Referenced from: /usr/local/bin/vapor Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib dyld: Symbol not found: __TTSfq4n_s___TFVSS13CharacterView38_measureExtendedGraphemeClusterForwardfT4fromVVSS17UnicodeScalarView5Index_Si Referenced from: /usr/local/bin/vapor Expected in: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/libswiftCore.dylib </code></pre>
0debug
How to stop mat-autocomplete to take custom user input values apart from given options? : <p>I am using mat-auto complete component from material.angular.io. The default behavior is user can input any value as well as it gives options to choose from. Also you can add your input to chosen values. You can check example here. <a href="https://stackblitz.com/angular/ngmvgralayd?file=app%2Fautocomplete-simple-" rel="noreferrer">https://stackblitz.com/angular/ngmvgralayd?file=app%2Fautocomplete-simple-</a> example.html</p> <p>here is the code I am using for generating auto complete input field. </p> <pre><code>&lt;form class="example-form"&gt; &lt;mat-form-field class="example-full-width"&gt; &lt;input type="text" placeholder="Pick one" aria-label="Number" matInput [formControl]="myControl" [matAutocomplete]="auto" disabled="true"&gt; &lt;mat-autocomplete #auto="matAutocomplete"&gt; &lt;mat-option *ngFor="let option of options" [value]="option"&gt; {{ option }} &lt;/mat-option&gt; &lt;/mat-autocomplete&gt; &lt;/mat-form-field&gt; &lt;/form&gt; </code></pre> <p>But I want the form field to take only values from the given option and want to prevent from entering any values by users apart from given option. How to achieve this? It is like select input with auto complete feature. </p>
0debug
How can I get data from the user to use it inside the constructors (C++) : <p>I want to get data from the user to use it inside the constructors, I mean I want to make user input variable a and use it inside the constructors :</p> <pre><code>#include &lt; iostream &gt; #include &lt; string &gt; using namespace std; class myClass{ public: myClass(int a ){ setNumber(a); } void setNumber(int y ){ number = y; } int getNumber() { return number; } private: int number; }; int main() { int a; myClass bo(int a); cout &lt;&lt;bo.getNumber(); cin&gt;&gt; a; return 0; } </code></pre>
0debug
static void numa_add(const char *optarg) { char option[128]; char *endptr; unsigned long long value, endvalue; unsigned long long nodenr; value = endvalue = 0ULL; optarg = get_opt_name(option, 128, optarg, ','); if (*optarg == ',') { optarg++; } if (!strcmp(option, "node")) { if (nb_numa_nodes >= MAX_NODES) { fprintf(stderr, "qemu: too many NUMA nodes\n"); exit(1); } if (get_param_value(option, 128, "nodeid", optarg) == 0) { nodenr = nb_numa_nodes; } else { nodenr = strtoull(option, NULL, 10); } if (nodenr >= MAX_NODES) { fprintf(stderr, "qemu: invalid NUMA nodeid: %llu\n", nodenr); exit(1); } if (get_param_value(option, 128, "mem", optarg) == 0) { node_mem[nodenr] = 0; } else { int64_t sval; sval = strtosz(option, &endptr); if (sval < 0 || *endptr) { fprintf(stderr, "qemu: invalid numa mem size: %s\n", optarg); exit(1); } node_mem[nodenr] = sval; } if (get_param_value(option, 128, "cpus", optarg) != 0) { value = strtoull(option, &endptr, 10); if (*endptr == '-') { endvalue = strtoull(endptr+1, &endptr, 10); } else { endvalue = value; } if (!(endvalue < MAX_CPUMASK_BITS)) { endvalue = MAX_CPUMASK_BITS - 1; fprintf(stderr, "A max of %d CPUs are supported in a guest\n", MAX_CPUMASK_BITS); } bitmap_set(node_cpumask[nodenr], value, endvalue-value+1); } nb_numa_nodes++; } else { fprintf(stderr, "Invalid -numa option: %s\n", option); exit(1); } }
1threat
React-Bootstrap link item in a navitem : <p>I'm having some styling issues using react-router and react-bootstrap. below is a snippet of the code</p> <pre><code>import { Route, RouteHandler, Link } from 'react-router'; import AuthService from '../services/AuthService' import { Button, Nav, Navbar, NavDropdown, MenuItem, NavItem } from 'react-bootstrap'; &lt;Nav pullRight&gt; &lt;NavItem eventKey={1}&gt; &lt;Link to="home"&gt;Home&lt;/Link&gt; &lt;/NavItem&gt; &lt;NavItem eventKey={2}&gt; &lt;Link to="book"&gt;Book Inv&lt;/Link&gt; &lt;/NavItem&gt; &lt;NavDropdown eventKey={3} title="Authorization" id="basic-nav-dropdown"&gt; &lt;MenuItem eventKey="3.1"&gt; &lt;a href="" onClick={this.logout}&gt;Logout&lt;/a&gt; &lt;/MenuItem&gt; &lt;/NavDropdown&gt; &lt;/Nav&gt; </code></pre> <p>This is what it looks like when it renders.</p> <p><a href="https://i.stack.imgur.com/h6aUI.png"><img src="https://i.stack.imgur.com/h6aUI.png" alt="enter image description here"></a></p> <p>I know that the <code>&lt;Link&gt;&lt;/Link&gt;</code> is causing this but I don't know why? I would like for this to be in-line.</p>
0debug
Converting DataTable to List<T> in C# error : I am trying to convert DataTable into generic list List<T>, I am getting an error of > cannot convert lambda expression to type string because it is not a > delegate type I have gone through several threads posted here on SO regarding this, most of them suggested using Entity and Linq namespaces, but still I am getting same error; here is my code DataTable csvData = GetDataTableFromCSVFile(csv_file_path); List<MyClass> lst = new List<MyClass>(); lst = (from l in csvData select new MyClass // getting red line under select { Address_1 = l.Address_1, //total of 29 columns Title = l.Title, Town_of_Birth = l.Town_of_Birth }).ToList();
0debug
Javascript - string + var alert : <p>I have trouble figuring out why is my alert command not working. I tried looking for an answer in other peoples' questions, but because I am a complete newbie, I was not able to find a solution. My console is giving me this error: practice.js:26 <em>Uncaught SyntaxError: missing ) after argument list</em> . Thank you for any advice. I'm in my first week of JavaScript so go easy on me please :)</p> <pre><code>var firstName = prompt("What is your first name?"); var lastName = prompt("What is your last name?"); firstName = firstName.toUpperCase(); lastName = lastName.toUpperCase(); var fullName = firstName + " " + lastName; var fullNameLength = fullName.length; alert("The string " + fullName + " is " fullNameLength + " characters long."); </code></pre>
0debug
NPE in own realization of LinkedList (Java) : <p>I'm a beginner in programming and I need to write some kind of own LinkedList, but only with <code>add(E element)</code> method and with Iterator's <code>hasNext()</code> and <code>next()</code>. Here is my code:</p> <pre><code> public class LinkedArray&lt;E&gt; implements Iterator&lt;E&gt; { private int size = 0; private int current = 0; private Node&lt;E&gt; first; private Node&lt;E&gt; last; private Objects[] objects = new Objects[10]; public void add(E value) { Node&lt;E&gt; element = new Node&lt;E&gt;(last, value, null); if (last != null) { element.next = element; } else { first = element; } last = element; size++; } @Override public boolean hasNext() { boolean result = false; try { if (objects[current + 1] != null) { result = true; } } catch (ArrayIndexOutOfBoundsException e) { result = false; } return result; } @Override public E next() { E result; try { current++; result = (get(current - 1)); } catch (ArrayIndexOutOfBoundsException a) { throw new NoSuchElementException("No more elements in list."); } return result; } public E get(int position) throws NullPointerException { Object result; if (this.objects[position] != null) { result = this.objects[position]; } else { throw new NullPointerException("Position is empty."); } return (E) result; } private class Node&lt;E&gt; { private E element; private Node&lt;E&gt; next; private Node&lt;E&gt; prev; Node(Node&lt;E&gt; prev, E element, Node&lt;E&gt; next) { this.element = element; this.next = next; this.prev = prev; } } } </code></pre> <p>But when I started to test add(E value)...</p> <pre><code>@Test public void test() { LinkedArray&lt;String&gt; arr = new LinkedArray&lt;&gt;(); String string = "Test"; arr.add(string); String result = arr.next(); assertThat(result, is("Test")); } </code></pre> <p>...I only get an error. What the problem is, why am I getting it wrong?</p>
0debug
static int decode_dvd_subtitles(AVSubtitle *sub_header, const uint8_t *buf, int buf_size) { int cmd_pos, pos, cmd, x1, y1, x2, y2, offset1, offset2, next_cmd_pos; int big_offsets, offset_size, is_8bit = 0; const uint8_t *yuv_palette = 0; uint8_t colormap[4], alpha[256]; int date; int i; int is_menu = 0; if (buf_size < 10) return -1; sub_header->rects = NULL; sub_header->num_rects = 0; sub_header->format = 0; sub_header->start_display_time = 0; sub_header->end_display_time = 0; if (AV_RB16(buf) == 0) { big_offsets = 1; offset_size = 4; cmd_pos = 6; } else { big_offsets = 0; offset_size = 2; cmd_pos = 2; } cmd_pos = READ_OFFSET(buf + cmd_pos); while ((cmd_pos + 2 + offset_size) < buf_size) { date = AV_RB16(buf + cmd_pos); next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2); dprintf(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n", cmd_pos, next_cmd_pos, date); pos = cmd_pos + 2 + offset_size; offset1 = -1; offset2 = -1; x1 = y1 = x2 = y2 = 0; while (pos < buf_size) { cmd = buf[pos++]; dprintf(NULL, "cmd=%02x\n", cmd); switch(cmd) { case 0x00: is_menu = 1; break; case 0x01: sub_header->start_display_time = (date << 10) / 90; break; case 0x02: sub_header->end_display_time = (date << 10) / 90; break; case 0x03: if ((buf_size - pos) < 2) goto fail; colormap[3] = buf[pos] >> 4; colormap[2] = buf[pos] & 0x0f; colormap[1] = buf[pos + 1] >> 4; colormap[0] = buf[pos + 1] & 0x0f; pos += 2; break; case 0x04: if ((buf_size - pos) < 2) goto fail; alpha[3] = buf[pos] >> 4; alpha[2] = buf[pos] & 0x0f; alpha[1] = buf[pos + 1] >> 4; alpha[0] = buf[pos + 1] & 0x0f; pos += 2; dprintf(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]); break; case 0x05: case 0x85: if ((buf_size - pos) < 6) goto fail; x1 = (buf[pos] << 4) | (buf[pos + 1] >> 4); x2 = ((buf[pos + 1] & 0x0f) << 8) | buf[pos + 2]; y1 = (buf[pos + 3] << 4) | (buf[pos + 4] >> 4); y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5]; if (cmd & 0x80) is_8bit = 1; dprintf(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2); pos += 6; break; case 0x06: if ((buf_size - pos) < 4) goto fail; offset1 = AV_RB16(buf + pos); offset2 = AV_RB16(buf + pos + 2); dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); pos += 4; break; case 0x86: if ((buf_size - pos) < 8) goto fail; offset1 = AV_RB32(buf + pos); offset2 = AV_RB32(buf + pos + 4); dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2); pos += 8; break; case 0x83: if ((buf_size - pos) < 768) goto fail; yuv_palette = buf + pos; pos += 768; break; case 0x84: if ((buf_size - pos) < 256) goto fail; for (i = 0; i < 256; i++) alpha[i] = 0xFF - buf[pos+i]; pos += 256; break; case 0xff: goto the_end; default: dprintf(NULL, "unrecognised subpicture command 0x%x\n", cmd); goto the_end; } } the_end: if (offset1 >= 0) { int w, h; uint8_t *bitmap; w = x2 - x1 + 1; if (w < 0) w = 0; h = y2 - y1; if (h < 0) h = 0; if (w > 0 && h > 0) { if (sub_header->rects != NULL) { for (i = 0; i < sub_header->num_rects; i++) { av_freep(&sub_header->rects[i]->pict.data[0]); av_freep(&sub_header->rects[i]->pict.data[1]); av_freep(&sub_header->rects[i]); } av_freep(&sub_header->rects); sub_header->num_rects = 0; } bitmap = av_malloc(w * h); sub_header->rects = av_mallocz(sizeof(*sub_header->rects)); sub_header->rects[0] = av_mallocz(sizeof(AVSubtitleRect)); sub_header->num_rects = 1; sub_header->rects[0]->pict.data[0] = bitmap; decode_rle(bitmap, w * 2, w, (h + 1) / 2, buf, offset1, buf_size, is_8bit); decode_rle(bitmap + w, w * 2, w, h / 2, buf, offset2, buf_size, is_8bit); if (is_8bit) { if (yuv_palette == 0) goto fail; sub_header->rects[0]->pict.data[1] = av_malloc(256 * 4); sub_header->rects[0]->nb_colors = 256; yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256); } else { sub_header->rects[0]->pict.data[1] = av_malloc(4 * 4); sub_header->rects[0]->nb_colors = 4; guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1], colormap, alpha, 0xffff00); } sub_header->rects[0]->x = x1; sub_header->rects[0]->y = y1; sub_header->rects[0]->w = w; sub_header->rects[0]->h = h; sub_header->rects[0]->type = SUBTITLE_BITMAP; sub_header->rects[0]->pict.linesize[0] = w; } } if (next_cmd_pos == cmd_pos) break; cmd_pos = next_cmd_pos; } if (sub_header->num_rects > 0) return is_menu; fail: if (sub_header->rects != NULL) { for (i = 0; i < sub_header->num_rects; i++) { av_freep(&sub_header->rects[i]->pict.data[0]); av_freep(&sub_header->rects[i]->pict.data[1]); av_freep(&sub_header->rects[i]); } av_freep(&sub_header->rects); sub_header->num_rects = 0; } return -1; }
1threat
static void gen_mtsrin(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_REG); return; } t0 = tcg_temp_new(); tcg_gen_shri_tl(t0, cpu_gpr[rB(ctx->opcode)], 28); tcg_gen_andi_tl(t0, t0, 0xF); gen_helper_store_sr(cpu_env, t0, cpu_gpr[rD(ctx->opcode)]); tcg_temp_free(t0); #endif }
1threat
MVC C# Searc Filter : I'm trying to filter records from my database. Checkbox value post controller when checkbox checked, I choose "a" and I show which record contains "a", I choose "a,b" and I'm showing "a - b - a,b " but I want to show just "a,b" My controller; public ActionResult GetProducts(List<string> filter) { List<Product> proc = new List<Product>(); foreach (var item in filter ) { var model = db.Product.Where(x => x.tMal.Contains(item)).ToList(); proc.AddRange(model); } return View(proc); How Can I do?
0debug
static void destroy_all_mappings(void) { destroy_l2_mapping(&phys_map, P_L2_LEVELS - 1); phys_map_nodes_reset(); }
1threat
def smallest_missing(A, left_element, right_element): if left_element > right_element: return left_element mid = left_element + (right_element - left_element) // 2 if A[mid] == mid: return smallest_missing(A, mid + 1, right_element) else: return smallest_missing(A, left_element, mid - 1)
0debug
static void test_validate_fail_union(TestInputVisitorData *data, const void *unused) { UserDefUnion *tmp = NULL; Error *err = NULL; Visitor *v; v = validate_test_init(data, "{ 'type': 'b', 'data' : { 'integer': 42 } }"); visit_type_UserDefUnion(v, &tmp, NULL, &err); g_assert(err); qapi_free_UserDefUnion(tmp); }
1threat
Namecheap webmail setup but can't receive email : <p>I'm trying to setup incoming email for my Amazon EC2 linux box. Namecheap Private Email records for domains with third-party DNS My domain's DNS is managed through NameCheap. They have a private email hosting service.</p> <p><a href="https://www.namecheap.com/hosting/email.aspx" rel="nofollow">https://www.namecheap.com/hosting/email.aspx</a></p> <p>Will this enable me to have a webmail interface where I can send / receive emails from my domain?</p>
0debug
passport deserializeUser method never called : <p>I have got 200 response for login request, but 401 for any futher auth check requests, because deserializeUser never called. I dived into passport source and noticed that passport checks whether req._passport.session.user exists, and if no it doesn't call deserializeUser. </p> <p>I have searched through other questions on stackoverflow, it seems i have specific case. </p> <p>There is single local strategy auth type, i use Ajax request to make login requests, CORS settings configured, <a href="http://localhost:8080">http://localhost:8080</a> - frontend, <a href="http://localhost:3000">http://localhost:3000</a> backend)</p> <p>I use bodyParse, cookieParser, express session, passport initialize and passport sessions. Express session secure:false configured as i run auth requests through http.</p> <p>You can find my project here (backend package.json is good to go, so you can use it, it has no missing dependencies, as for frontend not sure), at least you can check the code there.</p> <p>Backend <a href="https://github.com/rantiev/template-api">https://github.com/rantiev/template-api</a> Frontend <a href="https://github.com/rantiev/template-angular">https://github.com/rantiev/template-angular</a></p> <p>Express session configuration and CORS is here <a href="https://github.com/rantiev/template-api/blob/master/modules/appConfigure.js">https://github.com/rantiev/template-api/blob/master/modules/appConfigure.js</a></p> <pre><code>var path = require('path'); var bodyParser = require('body-parser'); var session = require('express-session'); var cookieParser = require('cookie-parser'); var MongoStore = require('connect-mongo')(session); module.exports = function (app, express, config, mongoose) { app.use(cookieParser()); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use(function (req, res, next) { // Website you wish to allow to connect res.setHeader('Access-Control-Allow-Origin', 'http://localhost:8080'); // Request methods you wish to allow res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE'); // Request headers you wish to allow res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With, X-AUTHENTICATION, X-IP, Content-Type, Origin, Accept, Cookie'); // Set to true if you need the website to include cookies in the requests sent // to the API (e.g. in case you use sessions) res.setHeader('Access-Control-Allow-Credentials', true); // Pass to next layer of middleware next(); }); /*app.use(function (req, res, next) { console.log('coockie is:', req.cookies); });*/ app.use(session({ saveUninitialized: false, resave: false, secret: config.sessionsSecretToken, cookie: { secure: false }, store: new MongoStore({ mongooseConnection: mongoose.connection }) })); app.use(express.static(path.join(__dirname, '..' , 'public'))); }; </code></pre> <p>Passport configuration is here <a href="https://github.com/rantiev/template-api/blob/master/api/authentication/authenticationR.js">https://github.com/rantiev/template-api/blob/master/api/authentication/authenticationR.js</a></p> <pre><code>var passport = require('passport'); var LocalStrategy = require('passport-local').Strategy; var rememberMe = require('../../modules/rememberMe'); var createAccessToken = require('../../modules/createAccessToken'); var bcrypt = require('bcrypt-nodejs'); var UserM = require('../users/userM'); module.exports = function (app, mainRouter, role) { passport.use(new LocalStrategy({ usernameField: 'email', passwordField: 'password' }, function (username, password, done) { UserM.findOneQ({email: username}) .then(function(user){ if (user &amp;&amp; bcrypt.compareSync(password, user.password)) { done(null, user); } else { done(null, false); } }) .catch(function(err){ done(err); }); })); passport.serializeUser(function (user, done) { console.log('serialize'); if (user) { createAccessToken(user, done); } else { done(null, false); } }); passport.deserializeUser(function (token, done) { console.log('deserialize'); UserM.findOneQ({accessToken: token}) .then(function(user){ if (user) { done(null, user); } else { done(null, false); } }) .catch(function(err){ done(err); }); }); app.use(passport.initialize()); app.use(passport.session()); mainRouter.post('/me', passport.authenticate('local'), function (req, res) { res.status(200).send(); }); mainRouter.get('/logout', function (req, res) { req.logout(); res.redirect('/'); }); mainRouter.get('/me', function (req, res) { if (!req.user) { res.status(401).send('Please Login!'); return; } var currentUser = { id: req.user._id, role: req.user.role }; res.status(200).json(currentUser); }); }; </code></pre>
0debug
How to add text at the last of the file using c++? : I am currently working on project and I need solution of that.I want to add some message at the end of file and also I want to change its extension. Since my programming skills are not so good please give syntax of that.
0debug
Javascript Map multiple values into list : <p>I currently have an array ... code goes like this:</p> <pre><code>namelist=[]; var namelist = mydata.cars.map( o =&gt; o.name ); </code></pre> <p>This gives me the name of the cars.</p> <p>What I want to do it to pass several values instead of just one so I get then call for them when needed. </p> <p>For example id and name.</p> <p>How can I do this?</p>
0debug
static int decode_sequence_header_adv(VC1Context *v, GetBitContext *gb) { v->res_rtm_flag = 1; v->level = get_bits(gb, 3); if (v->level >= 5) { av_log(v->s.avctx, AV_LOG_ERROR, "Reserved LEVEL %i\n",v->level); } v->chromaformat = get_bits(gb, 2); if (v->chromaformat != 1) { av_log(v->s.avctx, AV_LOG_ERROR, "Only 4:2:0 chroma format supported\n"); return -1; } v->frmrtq_postproc = get_bits(gb, 3); v->bitrtq_postproc = get_bits(gb, 5); v->postprocflag = get_bits1(gb); v->s.avctx->coded_width = (get_bits(gb, 12) + 1) << 1; v->s.avctx->coded_height = (get_bits(gb, 12) + 1) << 1; v->s.avctx->width = v->s.avctx->coded_width; v->s.avctx->height = v->s.avctx->coded_height; v->broadcast = get_bits1(gb); v->interlace = get_bits1(gb); v->tfcntrflag = get_bits1(gb); v->finterpflag = get_bits1(gb); skip_bits1(gb); av_log(v->s.avctx, AV_LOG_DEBUG, "Advanced Profile level %i:\nfrmrtq_postproc=%i, bitrtq_postproc=%i\n" "LoopFilter=%i, ChromaFormat=%i, Pulldown=%i, Interlace: %i\n" "TFCTRflag=%i, FINTERPflag=%i\n", v->level, v->frmrtq_postproc, v->bitrtq_postproc, v->s.loop_filter, v->chromaformat, v->broadcast, v->interlace, v->tfcntrflag, v->finterpflag); v->psf = get_bits1(gb); if (v->psf) { av_log(v->s.avctx, AV_LOG_ERROR, "Progressive Segmented Frame mode: not supported (yet)\n"); return -1; } v->s.max_b_frames = v->s.avctx->max_b_frames = 7; if (get_bits1(gb)) { int w, h, ar = 0; av_log(v->s.avctx, AV_LOG_DEBUG, "Display extended info:\n"); w = get_bits(gb, 14) + 1; h = get_bits(gb, 14) + 1; av_log(v->s.avctx, AV_LOG_DEBUG, "Display dimensions: %ix%i\n", w, h); if (get_bits1(gb)) ar = get_bits(gb, 4); if (ar && ar < 14) { v->s.avctx->sample_aspect_ratio = ff_vc1_pixel_aspect[ar]; } else if (ar == 15) { w = get_bits(gb, 8) + 1; h = get_bits(gb, 8) + 1; v->s.avctx->sample_aspect_ratio = (AVRational){w, h}; } else { av_reduce(&v->s.avctx->sample_aspect_ratio.num, &v->s.avctx->sample_aspect_ratio.den, v->s.avctx->height * w, v->s.avctx->width * h, 1 << 30); } av_log(v->s.avctx, AV_LOG_DEBUG, "Aspect: %i:%i\n", v->s.avctx->sample_aspect_ratio.num, v->s.avctx->sample_aspect_ratio.den); if (get_bits1(gb)) { if (get_bits1(gb)) { v->s.avctx->time_base.num = 32; v->s.avctx->time_base.den = get_bits(gb, 16) + 1; } else { int nr, dr; nr = get_bits(gb, 8); dr = get_bits(gb, 4); if (nr && nr < 8 && dr && dr < 3) { v->s.avctx->time_base.num = ff_vc1_fps_dr[dr - 1]; v->s.avctx->time_base.den = ff_vc1_fps_nr[nr - 1] * 1000; } } if (v->broadcast) { v->s.avctx->time_base.den *= 2; v->s.avctx->ticks_per_frame = 2; } } if (get_bits1(gb)) { v->color_prim = get_bits(gb, 8); v->transfer_char = get_bits(gb, 8); v->matrix_coef = get_bits(gb, 8); } } v->hrd_param_flag = get_bits1(gb); if (v->hrd_param_flag) { int i; v->hrd_num_leaky_buckets = get_bits(gb, 5); skip_bits(gb, 4); skip_bits(gb, 4); for (i = 0; i < v->hrd_num_leaky_buckets; i++) { skip_bits(gb, 16); skip_bits(gb, 16); } } return 0; }
1threat
static void virtio_blk_handle_write(VirtIOBlockReq *req, MultiReqBuffer *mrb) { BlockRequest *blkreq; uint64_t sector; sector = virtio_ldq_p(VIRTIO_DEVICE(req->dev), &req->out.sector); bdrv_acct_start(req->dev->bs, &req->acct, req->qiov.size, BDRV_ACCT_WRITE); trace_virtio_blk_handle_write(req, sector, req->qiov.size / 512); if (!virtio_blk_sect_range_ok(req->dev, sector, req->qiov.size)) { virtio_blk_rw_complete(req, -EIO); return; } if (mrb->num_writes == 32) { virtio_submit_multiwrite(req->dev->bs, mrb); } blkreq = &mrb->blkreq[mrb->num_writes]; blkreq->sector = sector; blkreq->nb_sectors = req->qiov.size / BDRV_SECTOR_SIZE; blkreq->qiov = &req->qiov; blkreq->cb = virtio_blk_rw_complete; blkreq->opaque = req; blkreq->error = 0; mrb->num_writes++; }
1threat
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration) { int64_t us; if (av_parse_time(&us, timestr, is_duration) < 0) { av_log(NULL, AV_LOG_FATAL, "Invalid %s specification for %s: %s\n", is_duration ? "duration" : "date", context, timestr); exit(1); } return us; }
1threat
How to check on Infiniti js : I want to write a duINF function that will check if the value is Infinity. console.log(duINF(Infinity))//true console.log(duINF(-Infinity))//true otherwise false. How to write duINF function.
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
static int decode_pic_timing(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; HEVCSPS *sps = (HEVCSPS*)s->sps_list[s->active_seq_parameter_set_id]->data; if (!sps) return(AVERROR(ENOMEM)); if (sps->vui.frame_field_info_present_flag) { int pic_struct = get_bits(gb, 4); s->picture_struct = AV_PICTURE_STRUCTURE_UNKNOWN; if (pic_struct == 2) { av_log(s->avctx, AV_LOG_DEBUG, "BOTTOM Field\n"); s->picture_struct = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; } else if (pic_struct == 1) { av_log(s->avctx, AV_LOG_DEBUG, "TOP Field\n"); s->picture_struct = AV_PICTURE_STRUCTURE_TOP_FIELD; } get_bits(gb, 2); get_bits(gb, 1); } return 1; }
1threat
def get_Char(strr): summ = 0 for i in range(len(strr)): summ += (ord(strr[i]) - ord('a') + 1) if (summ % 26 == 0): return ord('z') else: summ = summ % 26 return chr(ord('a') + summ - 1)
0debug
int vhost_dev_enable_notifiers(struct vhost_dev *hdev, VirtIODevice *vdev) { BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev))); VirtioBusState *vbus = VIRTIO_BUS(qbus); VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(vbus); int i, r; if (!k->set_host_notifier) { fprintf(stderr, "binding does not support host notifiers\n"); r = -ENOSYS; goto fail; } for (i = 0; i < hdev->nvqs; ++i) { r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, true); if (r < 0) { fprintf(stderr, "vhost VQ %d notifier binding failed: %d\n", i, -r); goto fail_vq; } } return 0; fail_vq: while (--i >= 0) { r = k->set_host_notifier(qbus->parent, hdev->vq_index + i, false); if (r < 0) { fprintf(stderr, "vhost VQ %d notifier cleanup error: %d\n", i, -r); fflush(stderr); } assert (r >= 0); } fail: return r; }
1threat
Remove the unwanted vertical bar at the end of the string JS : <p>I have quite a similar input to output code scenario as this one: <a href="http://plnkr.co/edit/eBjenGqgo3nbnmQ7XxF1?p=preview" rel="nofollow noreferrer">http://plnkr.co/edit/eBjenGqgo3nbnmQ7XxF1?p=preview</a></p> <p>I am using AngularJS 1.5.7. Ng directives that my input - ( first ) textarea uses are the same as those shown in Plunkr (ng-list, ng-trim...). My output, unlike the Plunkr example, is displayed inside a ( second ) textarea, but logic is quite similar. $scope.outputValue is an output array which I am converting to string, and implementing 1 RegExp afterwards: </p> <pre><code>$scope.outputValue = $scope.outputValue.toString(); $scope.outputValue = $scope.outputValue.replace(/,/g, " | "); </code></pre> <p>Problem is that the generated string always adds an extra " | " at the end of itself. Often times an output looks like this if the user passes a couple of empty array items inside a first textarea:</p> <pre><code>var foo = "one | two | three | four | | | | |"; </code></pre> <p>But what I really need to display is this:</p> <pre><code>var foo = "one | two | three | four"; </code></pre> <p>The only thing that is important is to remove all the "|" that get attached to the end of the string as a replacement of ',' but the output can have "|" values as well, therefore:</p> <pre><code>var foo = "one| | ||two| | three| | four||"; </code></pre> <p>would also be a valid output.</p> <p>Similar thing happens with Plunkr example, as it generates empty array items and separated by commas. </p> <p>Is there any RegExp that might be useful for this problem?</p> <p>Thanks, Nenad</p>
0debug
static void fw_cfg_init1(DeviceState *dev) { FWCfgState *s = FW_CFG(dev); MachineState *machine = MACHINE(qdev_get_machine()); uint32_t version = FW_CFG_VERSION; assert(!object_resolve_path(FW_CFG_PATH, NULL)); object_property_add_child(OBJECT(machine), FW_CFG_NAME, OBJECT(s), NULL); qdev_init_nofail(dev); fw_cfg_add_bytes(s, FW_CFG_SIGNATURE, (char *)"QEMU", 4); fw_cfg_add_bytes(s, FW_CFG_UUID, &qemu_uuid, 16); fw_cfg_add_i16(s, FW_CFG_NOGRAPHIC, (uint16_t)!machine->enable_graphics); fw_cfg_add_i16(s, FW_CFG_BOOT_MENU, (uint16_t)boot_menu); fw_cfg_bootsplash(s); fw_cfg_reboot(s); if (s->dma_enabled) { version |= FW_CFG_VERSION_DMA; } fw_cfg_add_i32(s, FW_CFG_ID, version); s->machine_ready.notify = fw_cfg_machine_ready; qemu_add_machine_init_done_notifier(&s->machine_ready); }
1threat
double ff_lpc_calc_ref_coefs_f(LPCContext *s, const float *samples, int len, int order, double *ref) { int i; double signal = 0.0f, avg_err = 0.0f; double autoc[MAX_LPC_ORDER+1] = {0}, error[MAX_LPC_ORDER+1] = {0}; const double a = 0.5f, b = 1.0f - a; for (i = 0; i < len; i++) { double weight = a - b*cos((2*M_PI*i)/(len - 1)); s->windowed_samples[i] = weight*samples[i]; } s->lpc_compute_autocorr(s->windowed_samples, len, order, autoc); signal = autoc[0]; compute_ref_coefs(autoc, order, ref, error); for (i = 0; i < order; i++) avg_err = (avg_err + error[i])/2.0f; return signal/avg_err; }
1threat
ERROR: Command errored out with exit status 1 while installing requirements : <pre><code> ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ib3vl4vt/web.py/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ib3vl4vt/web.py/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info cwd: /tmp/pip-install-ib3vl4vt/web.py/ Complete output (7 lines): Traceback (most recent call last): File "&lt;string&gt;", line 1, in &lt;module&gt; File "/tmp/pip-install-ib3vl4vt/web.py/setup.py", line 6, in &lt;module&gt; from web import __version__ File "/tmp/pip-install-ib3vl4vt/web.py/web/__init__.py", line 14, in &lt;module&gt; import utils, db, net, wsgi, http, webapi, httpserver, debugerror ModuleNotFoundError: No module named 'utils' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. </code></pre> <p>While installing requirements.txt in InsecureBankv2/AndroLabServer, I got this errors. Because of these problems, It seems like InsecureBankv2 app won't login to my server.</p> <p>What should I do to solve this problem?</p>
0debug
static void control_out(VirtIODevice *vdev, VirtQueue *vq) { VirtQueueElement elem; VirtIOSerial *vser; vser = DO_UPCAST(VirtIOSerial, vdev, vdev); while (virtqueue_pop(vq, &elem)) { handle_control_message(vser, elem.out_sg[0].iov_base); virtqueue_push(vq, &elem, elem.out_sg[0].iov_len); } virtio_notify(vdev, vq); }
1threat
Powershell - Find size of a particular folder inside all the sub folders : I'm creating a PowerShell script to email an audit report of all the websites I host on my windows server. I also want to print size of logs folder for every website. This is what I want. There are several websites in c:\inetpub\vhosts folder. Say abc.com and xyz.com are the websites. The log files are in c:\inetpub\vhosts\abc.com\default\logs. I just want to get the size of all such logs folders like below. --- 1. c:\inetpub\vhosts\abc.com\default\logs 100 MB 2. c:\inetpub\vhosts\xyz.com.com\default\logs 120 MB ... Just like displaying the folder size of c:\inetpub\vhosts\*\default\logs for every match of *. How can I do this with PowerShell? Any help is appreciated.
0debug
Send a message in a channel "only visible to you" : <p>I can not see in the slack API documentation the way for a bot to send a message in a channel that response to a user.</p> <p>The same way <code>slackbot</code> does reply when doing <code>/help</code>.</p> <p>Anyone can let me know if that is possible?</p> <p><a href="https://i.stack.imgur.com/VLuse.png" rel="noreferrer"><img src="https://i.stack.imgur.com/VLuse.png" alt="enter image description here"></a></p> <p>Notice the "Only visible to you". In the RTM manual they say that the messsage is of the same type as the event <a href="https://api.slack.com/events/message" rel="noreferrer">message</a>. I don't see any attributes that would say it is visible only to a certain user.</p>
0debug
static void omap_wd_timer_write(void *opaque, target_phys_addr_t addr, uint64_t value, unsigned size) { struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) opaque; if (size != 2) { return omap_badwidth_write16(opaque, addr, value); } switch (addr) { case 0x00: omap_timer_sync(&s->timer); s->timer.ptv = (value >> 9) & 7; s->timer.ar = (value >> 8) & 1; s->timer.st = (value >> 7) & 1; s->free = (value >> 1) & 1; omap_timer_update(&s->timer); break; case 0x04: s->timer.reset_val = value & 0xffff; break; case 0x08: if (!s->mode && ((value >> 15) & 1)) omap_clk_get(s->timer.clk); s->mode |= (value >> 15) & 1; if (s->last_wr == 0xf5) { if ((value & 0xff) == 0xa0) { if (s->mode) { s->mode = 0; omap_clk_put(s->timer.clk); } } else { s->reset = 1; qemu_system_reset_request(); } } s->last_wr = value & 0xff; break; default: OMAP_BAD_REG(addr); } }
1threat
Javascript regexp does not match date correctly : <p>I'm trying to filter out date results, but I think I may have the regular expression wrong.</p> <pre><code>if ((strSearchInx == 6) || (strSearchInx == 7)) { var regDate = new RegExp("/^\d{1,2}\/\d{1,2}\/\d{4}$/"); strSearchField = strSearchField.trim(); //alert(strSearchField); if (regDate.test(strSearchField) == false) { alert("Date does not match mm/dd/yyyy format. Please re-enter"); document.getElementById('searchfield').focus(); return false; } } </code></pre> <p>I've tested it against 8/3/2016 and it doesn't seem to let any response through: Is /^\d{1,2}/\d{1,2}/\d{4}$/ the correct regular expression?</p> <p>Thanks.</p>
0debug
Client OAuth Settings are not showing in my app advance settings in facebook login : <p>I am working and actually creating a login through facebook system and in order to redirect it, i am not getting any client OAuth settings in advance setting options while creating the app.</p>
0debug
How to add a JS function in a script block in JavaScript : <p>I need to create the below below element and add this to head section of the HTML file.</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> &lt;script type="text/javascript"&gt; //Var declarations - ABCCD (function(d) { //FUNCTION CODES }(document)); &lt;/script&gt;</code></pre> </div> </div> </p> <p>Everything is done but I am just getting issue with the above mentioned part. I have tried different options, but not able to add the function as it is mentioned.</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>var headtg = document.getElementsByTagName('head')[0]; var divElm = document.createElement('div'); var scpt = document.createElement('script'); scpt.type = 'text/javascript'; var A = "100"; var myfunc1 = function(d) { //LINES OF CODE }(document); divElm.className = "ABC_" + A; divElm.appendChild(scpt); headtg.appendChild(divElm); //Var declaration part var decvar = 'var A = 10;' scpt.appendChild(document.createTextNode(decvar)); scpt.innerHTML = myfunc1;</code></pre> </div> </div> </p> <p>But the function is not coming up within the script block and coming up as undefined.</p> <p>Please help</p>
0debug
Firebase FCM InternalServerError : <p>I implemented Firebase FCM in my app about a month ago, and it has worked great ever since, until today. When I am trying to send a push notification from my console, nothing ever shows up. I find this very strange considering it worked before I went to bed yesterday. I do also have a PHP script that sends push notifications (FCM) as well, which also was working - but when I try to use this to send a push notification, I get this: </p> <p><code>{"multicast_id":5593178441415796544,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InternalServerError"}]}</code></p> <p>I find this very strange. I Googled this, and I read something about re-generating my APNS certificates (because they might be wrong or something), which I thought was weird as well, due to the fact that I created new certificates yesterday as well (which was working). Now I have once again tried to delete, and generate new - without any luck. </p> <p>I also want to point out that when I go to my 'Cloud messaging' tab in Firebase, to configure my certificates, I am unable to delete - only re-upload. </p> <p>What could this possibly be? I have checked my certificates and my API key is correct. It was working 100% 10 hours ago.</p> <p>Could this be a Firebase problem, or how would I solve this? Help is much appreciated.</p>
0debug
static uint32_t read_u32(uint8_t *data, size_t offset) { return ((data[offset] << 24) | (data[offset + 1] << 16) | (data[offset + 2] << 8) | data[offset + 3]); }
1threat
static int decode_format80(VqaContext *s, int src_size, unsigned char *dest, int dest_size, int check_size) { int dest_index = 0; int count, opcode, start; int src_pos; unsigned char color; int i; start = bytestream2_tell(&s->gb); while (bytestream2_tell(&s->gb) - start < src_size) { opcode = bytestream2_get_byte(&s->gb); av_dlog(s->avctx, "opcode %02X: ", opcode); if (opcode == 0x80) return 0; if (dest_index >= dest_size) { av_log(s->avctx, AV_LOG_ERROR, "decode_format80 problem: dest_index (%d) exceeded dest_size (%d)\n", dest_index, dest_size); return AVERROR_INVALIDDATA; } if (opcode == 0xFF) { count = bytestream2_get_le16(&s->gb); src_pos = bytestream2_get_le16(&s->gb); av_dlog(s->avctx, "(1) copy %X bytes from absolute pos %X\n", count, src_pos); CHECK_COUNT(); CHECK_COPY(src_pos); for (i = 0; i < count; i++) dest[dest_index + i] = dest[src_pos + i]; dest_index += count; } else if (opcode == 0xFE) { count = bytestream2_get_le16(&s->gb); color = bytestream2_get_byte(&s->gb); av_dlog(s->avctx, "(2) set %X bytes to %02X\n", count, color); CHECK_COUNT(); memset(&dest[dest_index], color, count); dest_index += count; } else if ((opcode & 0xC0) == 0xC0) { count = (opcode & 0x3F) + 3; src_pos = bytestream2_get_le16(&s->gb); av_dlog(s->avctx, "(3) copy %X bytes from absolute pos %X\n", count, src_pos); CHECK_COUNT(); CHECK_COPY(src_pos); for (i = 0; i < count; i++) dest[dest_index + i] = dest[src_pos + i]; dest_index += count; } else if (opcode > 0x80) { count = opcode & 0x3F; av_dlog(s->avctx, "(4) copy %X bytes from source to dest\n", count); CHECK_COUNT(); bytestream2_get_buffer(&s->gb, &dest[dest_index], count); dest_index += count; } else { count = ((opcode & 0x70) >> 4) + 3; src_pos = bytestream2_get_byte(&s->gb) | ((opcode & 0x0F) << 8); av_dlog(s->avctx, "(5) copy %X bytes from relpos %X\n", count, src_pos); CHECK_COUNT(); CHECK_COPY(dest_index - src_pos); for (i = 0; i < count; i++) dest[dest_index + i] = dest[dest_index - src_pos + i]; dest_index += count; } } if (check_size) if (dest_index < dest_size) av_log(s->avctx, AV_LOG_ERROR, "decode_format80 problem: decode finished with dest_index (%d) < dest_size (%d)\n", dest_index, dest_size); return 0; }
1threat
',' expected. visual studio code : <pre><code>function checkWin(board, player){ let plays = board.reduce((a, e, i) =&gt; (e === player)) ? a.concat(i) : a, []); let gameWon = null; for (let [index,win] of winCombos.entries()){ </code></pre> <p>line three of code comes back with Uncaught SyntaxError: Missing initializer in destructuring declaration</p>
0debug
How to fix xcode bug "web filter is active"? : <p>Hello I am getting this in the log and im not sure what it is and why it is logging this message also does it have any bad affect on my app ? </p> <pre><code>2017-02-12 20:20:21.222930 goball [760:91949] WF: _userSettingsForUser mobile: { filterBlacklist = ( ); filterWhitelist = ( ); restrictWeb = 1; useContentFilter = 0; useContentFilterOverrides = 0; whitelistEnabled = 0; } 2017-02-12 20:20:21.223110 goball [760:91949] WF: _WebFilterIsActive returning: NO </code></pre>
0debug
why calls python both functions? : I have some problems to understand what happens here... This is my source: class Calc(): def __init__(self,Ideal,Limit,Value,Debug=None): self.Ideal = Ideal self.Limit = Limit self.Value = Value self.Debug = Debug self.Grade = self.GetGrade() self.LenGrade = self.GetLenGrade() def GetGrade(self): if self.Debug: print('calling GetGrade') return Grade def GetLenGrade(self): if self.Debug: print('calling GetLenGrade') return Grade When calling it with GradeMinLen += Calc(TargetLen, LimitMinLen, Length ,Debug=1).LenGrade I get always the output calling GetGrade calling GetLenGrade Why is python calling GetGrade?
0debug
React-Intl How to use FormattedMessage in input placeholder : <p>I'm unsure how to get the values from </p> <pre><code>&lt;FormattedMessage {...messages.placeholderIntlText} /&gt; </code></pre> <p>into a placeholder format like input:</p> <pre><code>&lt;input placeholder={&lt;FormattedMessage {...messages.placeholderIntlText} /&gt;} /&gt; </code></pre> <p>as it would return [Object object] in the actual placeholder. Is there a way to get the actual correct value?</p>
0debug
Replace all A's present in an Array with 15 in Swift 3.0. : Replace all A's present in an Array with 15 in Swift 3.0. Example my array is ["4", "5", "6", "A", "A", "Q", "A"] and i want to replace A by 15. Such as my final array becomes ["4", "5", "6", "15", "15", "Q", "15"].
0debug
How do i copy only 2882649 from String: "automation130214141113 (order # 2882649)" in Java selenium? : I am trying to copy only 2882649 from a string automation130214141113 (order # 2882649). Can anyone help me out?
0debug
Removing duplicates while preserving values : <p>I have a tabular table example here:</p> <pre><code>Jerry 2 John 3 Mark 4 John 1 Kevin 10 </code></pre> <p>I want to remove duplicate entries, John in this case, but want to preserve the value and add them up. Not sure if that made sense, but it should look like:</p> <pre><code>Jerry 2 John 4 Mark 4 Kevin 10 </code></pre> <p>Any ideas of how to do this in R? I know how to remove duplicates but not add up all of the duplicate values.</p> <p>Thanks.</p>
0debug
Java - NullPointerExceptioneven when variable has been set in constructor : <p>I have made this code, but it seems that it throws a NullPointerException even when it has been set. This is the code (I am aware my code is not future proof or optimised at all. Please do not comment about it). I have tried passing the reference to the method Main, but that doesn't seem to work.</p> <p>MainTest.java</p> <pre><code>public class MainTest { public static void main(String[] args) { for (int i = 0; i &lt; 500; i++) { Main main = new Main(); main.run(); } } } </code></pre> <p>Main.java</p> <pre><code>public class Main { Chicken[] chickenList = new Chicken[8388607]; int counter = 0; public void run() { for (int i = 0; i &lt; 4; i++) { chickenList[counter++] = new Chicken(Chicken.ADULT, this); } for (int i = 0; i &lt;= 7200; i++) { for (Chicken chicken : chickenList) { if (chicken != null) { if (chicken.getAdultOrBaby() == Chicken.ADULT) { chicken.layEgg(); } else { chicken.hasGrown(); } } else { break; } } } System.out.println(amountOfChickens()); } public void newChicken() { chickenList[counter++] = new Chicken(Chicken.CHILD, this); } public int amountOfChickens() { int amount = 0; for (Chicken chicken : chickenList) { if (chicken != null) { amount++; } else { return amount; } } return amount; } } </code></pre> <p>Chicken.java</p> <pre><code>import java.util.Random; public class Chicken { Random random = new Random(); private int timeAlive; private int timeSinceLastEgg; private int adultOrBaby; private int randomTimer; public static final int ADULT = 0; public static final int CHILD = 1; public static Main caller; public Chicken(int adultBaby, Main callers) { caller = callers; timeAlive = 0; timeSinceLastEgg = 0; adultOrBaby = adultBaby; if (adultOrBaby == ADULT) { randomTimer = newRandomTimer(); } } public int getAdultOrBaby() { return adultOrBaby; } public void hasGrown() { if (++timeAlive == 1200) { adultOrBaby = ADULT; } } private int newRandomTimer() { return random.nextInt(300); } public void layEgg() { timeAlive++; if ((++timeSinceLastEgg) == (300 + randomTimer)) { new Egg(caller); timeSinceLastEgg = 0; randomTimer = newRandomTimer(); } } } </code></pre> <p>Egg.java</p> <pre><code>import java.util.Random; public class Egg { Main caller; Random random = new Random(); private static final int WILL_HATCH = 2; private final int WILL_4 = 3; public Egg(Main callers) { if (random.nextInt(8) == WILL_HATCH) { if (random.nextInt(32) == WILL_4) { spawn4(); } else { spawn(); } } caller = callers; } private void spawn4() { for (int i = 0; i &lt; 4; i++) { caller.newChicken(); } } private void spawn() { caller.newChicken(); } } </code></pre> <p>And this is the output:</p> <pre><code>Exception in thread "main" java.lang.NullPointerException at Egg.spawn(Egg.java:27) at Egg.&lt;init&gt;(Egg.java:14) at Chicken.layEgg(Chicken.java:40) at Main.run(Main.java:13) at MainTest.main(MainTest.java:5) </code></pre>
0debug
How to sort an array that includes NaN's C++ : Have been trying to implement my code as a means to sort all integers including NaNs. However can not seem to find a function that would sort NaNs into my program. Code is able to sort other integers including infinities, however when a nan is entered the program recognizes the input but does not sort it to the start of the list. Any help would be appreciated. #include <stdio.h> #include <math.h> int main() { float array[100], swap; int c, d, n; printf("Enter the size of array\n"); scanf("%d", &n); printf("Enter %d integers\n", n); for (c = 0; c < n; c++) scanf("%f", &array[c]); for (c = 0; c < (n - 1); c++) { for (d = 0; d < n - c - 1; d++) { if (array[d] > array[d + 1]) { swap = array[d]; array[d] = array[d + 1]; array[d + 1] = swap; } } } printf("Sorted array in ascending order:\n"); for (c = 0; c < n; c++) printf("%f\n", array[c]); return 0; }
0debug
Firebase dynamic link support custom parameters? : <p>I am writing a App for a Open Source Conference.</p> <p>Originally each attendees will receive different link via email or SMS like</p> <p><a href="https://example.com/?token=fccfc8bfa07643a1ca8015cbe74f5f17" rel="noreferrer">https://example.com/?token=fccfc8bfa07643a1ca8015cbe74f5f17</a></p> <p>then use this link to open app, we can know the user is which attendee by the token.</p> <p>Firebase release a new feature Dynamic Links in I/O 2016, it provide better experience for users.</p> <p>I had try that, but I can't find any way to pass the custom parameters (the token) in dynamic links, how to use the same link with different parameters to my users?</p> <p>Thanks.</p>
0debug
static int alloc_refcount_block(BlockDriverState *bs, int64_t cluster_index, void **refcount_block) { BDRVQcow2State *s = bs->opaque; unsigned int refcount_table_index; int64_t ret; BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC); refcount_table_index = cluster_index >> s->refcount_block_bits; if (refcount_table_index < s->refcount_table_size) { uint64_t refcount_block_offset = s->refcount_table[refcount_table_index] & REFT_OFFSET_MASK; if (refcount_block_offset) { if (offset_into_cluster(s, refcount_block_offset)) { qcow2_signal_corruption(bs, true, -1, -1, "Refblock offset %#" PRIx64 " unaligned (reftable index: " "%#x)", refcount_block_offset, refcount_table_index); return load_refcount_block(bs, refcount_block_offset, refcount_block); *refcount_block = NULL; ret = qcow2_cache_flush(bs, s->l2_table_cache); if (ret < 0) { return ret; int64_t new_block = alloc_clusters_noref(bs, s->cluster_size); if (new_block < 0) { return new_block; #ifdef DEBUG_ALLOC2 fprintf(stderr, "qcow2: Allocate refcount block %d for %" PRIx64 " at %" PRIx64 "\n", refcount_table_index, cluster_index << s->cluster_bits, new_block); #endif if (in_same_refcount_block(s, new_block, cluster_index << s->cluster_bits)) { ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, refcount_block); if (ret < 0) { goto fail; memset(*refcount_block, 0, s->cluster_size); int block_index = (new_block >> s->cluster_bits) & (s->refcount_block_size - 1); s->set_refcount(*refcount_block, block_index, 1); } else { ret = update_refcount(bs, new_block, s->cluster_size, 1, false, QCOW2_DISCARD_NEVER); if (ret < 0) { goto fail; ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail; ret = qcow2_cache_get_empty(bs, s->refcount_block_cache, new_block, refcount_block); if (ret < 0) { goto fail; memset(*refcount_block, 0, s->cluster_size); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_WRITE); qcow2_cache_entry_mark_dirty(bs, s->refcount_block_cache, *refcount_block); ret = qcow2_cache_flush(bs, s->refcount_block_cache); if (ret < 0) { goto fail; if (refcount_table_index < s->refcount_table_size) { uint64_t data64 = cpu_to_be64(new_block); BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_ALLOC_HOOKUP); ret = bdrv_pwrite_sync(bs->file, s->refcount_table_offset + refcount_table_index * sizeof(uint64_t), &data64, sizeof(data64)); if (ret < 0) { goto fail; s->refcount_table[refcount_table_index] = new_block; s->max_refcount_table_index = MAX(s->max_refcount_table_index, refcount_table_index); return -EAGAIN; qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); BLKDBG_EVENT(bs->file, BLKDBG_REFTABLE_GROW); uint64_t blocks_used = DIV_ROUND_UP(MAX(cluster_index + 1, (new_block >> s->cluster_bits) + 1), s->refcount_block_size); uint64_t meta_offset = (blocks_used * s->refcount_block_size) * s->cluster_size; ret = qcow2_refcount_area(bs, meta_offset, 0, false, refcount_table_index, new_block); if (ret < 0) { return ret; ret = load_refcount_block(bs, new_block, refcount_block); if (ret < 0) { return ret; return -EAGAIN; fail: if (*refcount_block != NULL) { qcow2_cache_put(bs, s->refcount_block_cache, refcount_block); return ret;
1threat
sonar-maven-plugin: extending sonar.sources in multi-module project : <p>I want to extend <code>sonar.sources</code>, which by default is <code>pom.xml,src/main/java</code>, by <code>src/main/resources</code> in order to check XML files that are located there.</p> <p>This seemingly simple task turned out to be difficult since I have a multi-module maven project (> 100 modules, nested) with a lot of them don't have a <code>src/main/resources</code> folder and most of them not even a <code>src</code> folder (e.g. for packaging=pom). This leads to a build error if I set <code>sonar.sources</code> to <code>pom.xml,src/main/java,src/main/resources</code> or <code>pom.xml,src/main</code>:</p> <pre><code>[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.5:sonar (default-cli) on project xyz-parent: The directory 'C:\...\submodule\src\main\resources' does not exist for Maven module ... Please check the property sonar.sources -&gt; [Help 1] </code></pre> <p>The sonar-maven-plugin itself uses <code>${project.build.sourceDirectory}</code> to do it right in every module.</p> <p>I tried to use regular expressions to set <code>sonar.sources</code> to <code>src/main</code> by cutting off <code>/java</code> (or <code>\java</code> on Windows) via</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;build-helper-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.7&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;regex-property&lt;/id&gt; &lt;goals&gt; &lt;goal&gt;regex-property&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;name&gt;sonar.sources&lt;/name&gt; &lt;value&gt;${project.build.sourceDirectory}&lt;/value&gt; &lt;regex&gt;[/\\]+java$&lt;/regex&gt; &lt;replacement&gt;&lt;/replacement&gt; &lt;failIfNoMatch&gt;false&lt;/failIfNoMatch&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>But this does nothing and I have no idea to which lifecycle phase I should bind it to have it executed.</p> <p>Or is there a way to avoid the error due to missing directory in <code>sonar.sources</code>? According to <a href="https://github.com/SonarSource/sonar-maven/blob/master/src/main/java/org/sonarsource/scanner/maven/bootstrap/MavenProjectConverter.java#L433" rel="noreferrer">current sonar-maven source</a> missing directories are only ignored if the POM has <code>pom</code> packaging but not for <code>ear</code> or <code>jar</code> modules without resources.</p> <p>Or should I ensure <code>src/main</code> exists before sonar start? What hook may I use for that?</p>
0debug
static int rtsp_read_header(AVFormatContext *s, AVFormatParameters *ap) { RTSPState *rt = s->priv_data; int ret; ret = ff_rtsp_connect(s); if (ret) return ret; rt->real_setup_cache = av_mallocz(2 * s->nb_streams * sizeof(*rt->real_setup_cache)); if (!rt->real_setup_cache) return AVERROR(ENOMEM); rt->real_setup = rt->real_setup_cache + s->nb_streams * sizeof(*rt->real_setup); if (ap->initial_pause) { } else { if (rtsp_read_play(s) < 0) { ff_rtsp_close_streams(s); ff_rtsp_close_connections(s); return AVERROR_INVALIDDATA; } } return 0; }
1threat
In php class variable one equal second variable? : <p>This is my code:</p> <pre><code>class Config { static public $site = 'http://localhost/site/'; static public $style = $site . 'css/style.css'; // ... } </code></pre> <p>This is not work for me. I get white screen.</p> <pre><code>class Config { static public $site = 'http://localhost/site/'; static public $style = 'http://localhost/site/css/style.css'; // ... } </code></pre> <p>This is work. I get design and code. Work very well. My question is Why?</p>
0debug
static int print_uint8(DeviceState *dev, Property *prop, char *dest, size_t len) { uint8_t *ptr = qdev_get_prop_ptr(dev, prop); return snprintf(dest, len, "%" PRIu8, *ptr); }
1threat
Using Javascript to Build a Dynamic JSON array : <p>I want the JSON structure to be something like this:</p> <pre><code>var data = [{ "label": "Category A", "value": 20 }, { "label": "Category B", "value": 50 }, { "label": "Category C", "value": 30 }]; </code></pre> <p>I have a bunch of label and values that can be more than the 3 pairs above (it's dynamic). The data for each label and value will also be differnt (entered by the user).</p> <p>How do I create a JSON object like data when a user can enter as many label and value pairs with different data? Thanks,</p>
0debug
Creating a table throws SQL Exception : <p>I would like to create a simple SQL database with one table. Line 8 throws a SQLSyntaxErrorException.</p> <pre><code>public class LoadDatabase { public static void main(String[] args) { //if createConnection() returns a connection issue SQL Statements try (Connection connection = ConnectToDatabase.createConnection()){ Statement command = connection.createStatement(); //gives SQL command "create table" to database command.executeUpdate(ConnectToDatabase.CREATE_TABLE); command.close(); } catch (ClassNotFoundException e) { System.err.println("Could not find database driver"); } catch (SQLException e) { System.err.println("SQL Error"); e.printStackTrace(); } } } </code></pre> <p>This is the table</p> <pre><code>//SQL command to create a new table as constant variable public final static String CREATE_TABLE = "CREATE TABLE BOOK_INVENTORY (" + "TITLE VARCHAR, " + "AUTHOR VARCHAR, " + "PAGES INT, " + "ISBN VARCHAR, " + ")"; </code></pre>
0debug
Explicit conversion to long long returns 0 : When I multiply a long long value with a double value, I get a double value. To convert it back to long long, I use (long long). But the output I get is 0, when it should be 10. #include <bits/stdc++.h> using namespace std; int main() { long long n = 100; printf("%lld",(long long)0.1*n); return 0; }
0debug
Calculating the difference between two dates in Swift : <p>I've seen many approaches how to compute the difference between two dates in terms of a particular date component, e.g. in days, hours, months etc. (see <a href="https://stackoverflow.com/a/27184261/2062785">this answer on Stackoverflow</a>):</p> <pre><code>Calendar.current.dateComponents([.hour], from: fromDate, to: toDate).hour Calendar.current.dateComponents([.day], from: fromDate, to: toDate).day Calendar.current.dateComponents([.month], from: fromDate, to: toDate).month </code></pre> <p>What I haven't seen is how to make calculations with the actual <code>Date</code> objects. Something like</p> <pre><code>func computeNewDate(from fromDate: Date, to toDate: Date) -&gt; Date let delta = toDate - fromDate let today = Date() if delta &lt; 0 { return today } else { return today + delta } } </code></pre> <p>I have seen the <a href="https://developer.apple.com/documentation/foundation/dateinterval" rel="noreferrer"><code>DateInterval</code></a> type which as introduced in iOS 10 but according to the documentation</p> <blockquote> <p>[it] does not support reverse intervals i.e. intervals where the duration is less than 0 and the end date occurs earlier in time than the start date.</p> </blockquote> <p>That makes it inherently difficult to calculate with dates – especially when you don't know which one is the earlier date.</p> <p><strong>Is there any clean and neat approach to compute time differences between <code>Date</code>s directly</strong> (and adding them to <code>Date</code> instances again) <strong>without computing with their <code>timeIntervalSinceReferenceDate</code>?</strong></p>
0debug
Deployment - is it safe to GIT push on a live production : <p>I am currently looking forward to work with a bare git repository in order to deploy on a production server, i have a "post-receive" hook who use git checkout to update the production folder. The application is a PHP Website.</p> <p>In fact i'm wondering if it is absolutely safe to push on a production server with git while there is someone using the web-app, does git update the file in a transaction-like way by locking every update files or is he working files by files ? Is it possible that the user load the page and have the CSS of the old commit but the PHP of the new one ? (if he's very unlucky)</p> <p>TL;DR : Is there any risk to push while people use the website ?</p> <p>Sorry for my english ! Thanks for your help !</p>
0debug
Add div Element with class using javascript or jQuery : <pre><code>&lt;div class="status"&gt; &lt;span class="bar"&gt;&lt;/span&gt; &lt;div class="ep"&gt;Ep 12&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want to add another div like "ep" div in span with class "dub" with javascript or Jquery</p>
0debug
static QObject* bdrv_info_stats_bs(BlockDriverState *bs) { QObject *res; QDict *dict; res = qobject_from_jsonf("{ 'stats': {" "'rd_bytes': %" PRId64 "," "'wr_bytes': %" PRId64 "," "'rd_operations': %" PRId64 "," "'wr_operations': %" PRId64 "," "'wr_highest_offset': %" PRId64 "," "'flush_operations': %" PRId64 "} }", bs->nr_bytes[BDRV_ACCT_READ], bs->nr_bytes[BDRV_ACCT_WRITE], bs->nr_ops[BDRV_ACCT_READ], bs->nr_ops[BDRV_ACCT_WRITE], bs->wr_highest_sector * (uint64_t)BDRV_SECTOR_SIZE, bs->nr_ops[BDRV_ACCT_FLUSH]); dict = qobject_to_qdict(res); if (*bs->device_name) { qdict_put(dict, "device", qstring_from_str(bs->device_name)); } if (bs->file) { QObject *parent = bdrv_info_stats_bs(bs->file); qdict_put_obj(dict, "parent", parent); } return res; }
1threat
Auto complete box for movies : <p>Is it possible to make an auto-complete box using data from www.omdbapi.com(xml or json)? Or do you know any other way to make a movie auto-complete box? I would be grateful if you could find me a solution.</p> <p>Thank you.</p>
0debug
what's the purpose of "--no-use-binaries" in carthage : <p>As titled, what's the purpose of "--no-use-binaries" in carthage command line? if missing this, what could happen and what's the benefit to have this?</p>
0debug
How to test if each element of a matrix in R meets a condition? : <p>Another challenge here. Suppose I have a square matrix in R and I want to test if each element of this matrix meets some condition. The result would be a matrix of the same size with TRUE and FALSE as elements. How can we do this avoiding a "for" loop? Thank you!</p>
0debug
static int serial_can_receive(SerialState *s) { return !(s->lsr & UART_LSR_DR); }
1threat
void visit_type_uint32(Visitor *v, uint32_t *obj, const char *name, Error **errp) { int64_t value; if (!error_is_set(errp)) { if (v->type_uint32) { v->type_uint32(v, obj, name, errp); } else { value = *obj; v->type_int(v, &value, name, errp); if (value < 0 || value > UINT32_MAX) { error_set(errp, QERR_INVALID_PARAMETER_VALUE, name ? name : "null", "uint32_t"); return; } *obj = value; } } }
1threat
int read_file(const char *filename, char **bufptr, size_t *size) { FILE *f = fopen(filename, "rb"); if (!f) { av_log(NULL, AV_LOG_ERROR, "Cannot read file '%s': %s\n", filename, strerror(errno)); return AVERROR(errno); } fseek(f, 0, SEEK_END); *size = ftell(f); fseek(f, 0, SEEK_SET); *bufptr = av_malloc(*size + 1); if (!*bufptr) { av_log(NULL, AV_LOG_ERROR, "Could not allocate file buffer\n"); fclose(f); return AVERROR(ENOMEM); } fread(*bufptr, 1, *size, f); (*bufptr)[*size++] = '\0'; fclose(f); return 0; }
1threat
Rails - Add Column Name That Is An Array Of Date Ranges : <p>For my final project in my Intro To Ruby on Rails class, I have to make an e-commerce website. However, I decided to go more advanced than the scope of the class, so instead of the quantity of a service, I want that service to have an array of Date appointments.</p> <p>For example, if this is a massage service, I need each massage service to have "appointment" attributes so the user can know the following:</p> <p>"This massage service has the several open appointment ranges:</p> <p>03/21/2016 from 3:00pm to 5:00pm</p> <p>03/22/2016 from 2:00pm to 4:00pm</p> <p>03/23/2016 from 12:00pm to 2:00pm"</p> <p>How would I get this done?</p>
0debug
Progress bar with redux : <p>I have a background upload process in my react/redux application that updates very frequently. My reducer looks something like this:</p> <pre><code>export default function progressReducer(state = initialState, action = {}) { switch (action.type) { case PROGRESS_TOTAL_INCREASE: return Object.assign({}, state, {total: state.total + action.amount}); case PROGRESS_CURRENT_INCREASE: let current = state.current + action.amount, total = state.total; if (current &gt;= state.total &amp;&amp; false) { state.total = 0; current = 0; } return {total, current}; default: return state; } } </code></pre> <p>It works. Great. But the redux devtool log fills up <em>very</em> quickly with progress actions, drowning out any other actions. Is this the right approach, or should I be looking at a different way of creating these notifications?</p> <p>Thanks!</p>
0debug
How to wrap click function in jquery? : I just started to learn js and need a little help: I have the following function: window.onload = function call() { function greatFunction(elem) { //do stuff } var textEditor1 = $('#cl1').find('textarea'); textEditor1.on('focus change mousedown mouseout keyup mouseup', function () { greatFunction(this) }); var textEditor2 = $('#cl2').find('textarea'); textEditor2.on('focus change mousedown mouseout keyup mouseup', function () { greatFunction(this) }); var textEditor3 = $('#cl3').find('textarea'); textEditor3.on('focus change mousedown mouseout keyup mouseup', function () { greatFunction(this) }); } HTML: <div id="cl1" class="cl active"><textarea id="chatTextarea" class="chatTextarea"></textarea></div> <div id="cl2" class="cl"><textarea id="chatTextarea" class="chatTextarea"></textarea></div> <div id="cl3" class="cl"><textarea id="chatTextarea" class="chatTextarea"></textarea></div> My target is to wrap all three eventListener into one, but all I tried went wrong... Can anyone help? #Dontrepeatyourself #DRY
0debug
Fit a Logit/Probit regression model in R using Maximum Likelihood : <p>A simple question here:</p> <p>I'd like to know if there is any function in R that can fit a <strong>logit/probit</strong> regression model using <strong>maximum likelihood method</strong>?</p> <p>Currently, I'm using OLS method given by function <code>glm</code> (I hope it does use OLS method)... I read somewhere that probit/logit model with OLS method may have incidental parameter problem. So I'd like to try MLE method.</p> <p>Thank you for your help in advance!</p>
0debug
how to do repeated sequance check : the question is this: Question 3: Repeated Sequence Check The program should enter a string (possibly containing blanks), and determine whether the characters are in lexicographic order. For example” • “12AABab” is in order since each character is less than or equal to the one following it (‘1’ < ‘2’, ‘2’ < ‘A’, ‘B’ < ‘a’, etc.) according to the Unicode character sequence. • “abCDef” is out of order, because ‘b’ > ‘C’ (lower-case letters come after upper-case letters in the Unicode sequence). If the string is in order, the program should display “The input is in order”; otherwise, it should display “The input is out of order” The program should repeat this process until the user enters the string “quit”, regardless of case. It should not check the sequence of “quit”. Finally, the program should display “Goodbye”. Notes: • This program will require nested loops. The inner loop will check the sequence of the input, while the outer loop will repeat the input and check process. • Be sure to reinitialize all variables at the start of the outer loop. • A string of length 0 or 1 is considered to be in order by definition. what i could do best is:(i tried with 2 other different methods i could send it too if you like) package homelab03; import java.util.Scanner; public class Quest3deneme3 { public static void main(String[] args) { // TODO Auto-generated method stub String whole,remain,d,e; char h1,h2; int lenght,b,c,sayac; //int[] a; String[] a; Scanner keyboard = new Scanner(System.in); System.out.println("Enter an input string:"); whole = keyboard.nextLine(); whole=whole.replaceAll("\\s+",""); lenght=(int)whole.length(); //System.out.println(+lenght); remain=whole; sayac=0; c=0; b=0; a= new String[lenght]; //boolean cem = d.compareTo(e); while(b<lenght) { a[b]=remain.substring(b,b+1); remain=remain.substring(b+1); System.out.println(a[b]); d=a[b]; e=a[c]; while(a[b]<a[c] ) { sayac=sayac+1; h1=h2; } } if(sayac==lenght) { System.out.println("oley"); } else { System.out.println("nooo"); } } //a[b]=remain.substring(b,b+1); //remain=whole.substring(b+1); //System.out.println(a[b]); } note we havent learned a[b] <= this thing yet but i find it online if the solution wont require that that would be better. note 2: we havent learned regex either i think that might be dissalowed(i found some answers with that online but i think i wont get credit for that) thank you guys in advance
0debug
TRIGGER AFTER INSERT USING THE TABLE INSERTION : I have an issue with a trigger after inserting, here is the trigger I made : create or replace TRIGGER TRG_OPERATION_CARTE AFTER INSERT OR UPDATE ON Operation FOR EACH ROW DECLARE solde NUMBER := 0; ouvert NUMBER := 0; essai NUMBER := 0; code NUMBER := 0; plafondActuel NUMBER := 0; decouvertAuth NUMBER := 0; BEGIN SELECT SUM(montant) INTO plafondActuel FROM Operation WHERE dateoperation >= SYSDATE - 7 AND ncompte = :NEW.ncompte; SELECT plafond INTO decouvertAuth FROM Client Cl LEFT JOIN Compte Cp ON Cl.nclient = Cp.nclient WHERE Cp.ncompte = :NEW.ncompte; SELECT solde, ouvert, nbessais, code INTO solde, ouvert, essai, code FROM Compte WHERE Compte.ncompte = :NEW.ncompte; IF ouvert = 0 THEN INSERT INTO Incident (message,noperation) values ('Compte bloqué',:NEW.noperation); ELSE IF :NEW.codepropose = code THEN IF (solde + decouvertAuth) > :NEW.montant THEN IF (plafondActuel + :NEW.montant) > 300 THEN INSERT INTO Incident (message,noperation) values ('Lopération dépasse le plafond authorisé',:NEW.noperation); ELSE INSERT INTO Historique (montant,ncompte) values (:NEW.montant,:NEW.ncompte); END IF; ELSE INSERT INTO Incident (message,noperation) values ('Lopération dépasse le découvert authorisé',:NEW.noperation); END IF; ELSE essai := essai + 1; UPDATE Compte SET nbessais = essai WHERE Compte.ncompte = :NEW.ncompte; IF essai >=3 THEN UPDATE Compte SET ouvert = 0 WHERE Compte.ncompte = :NEW.ncompte; INSERT INTO Incident (message,noperation) values ('Compte bloqué, 3 tentatives échouées',:NEW.noperation); END IF; END IF; END IF; END; I am pretty sure that the algorithm and the Trigger are correct but I have an error : ***Cause: A trigger (or a user defined plsql function that is referenced in this statement) attempted to look at (or modify) a table that was in the middle of being modified by the statement which fired it.** ***Action: Rewrite the trigger (or function) so it does not read that table.** Here is the code for the tables : CREATE TABLE Client( nclient INT NOT NULL, nom VARCHAR(45) NOT NULL UNIQUE, plafond NUMERIC(10,2) DEFAULT 0, CHECK (plafond>=0), CONSTRAINT PK_Client PRIMARY KEY (nclient) ); CREATE TABLE Compte( ncompte INT NOT NULL, solde NUMERIC(10,2), ouvert NUMERIC(1) DEFAULT 1, nbessais INT, code Numeric(4), nclient NUMERIC(4), CONSTRAINT PK_Compte PRIMARY KEY (ncompte), CONSTRAINT FK_Compte_nclient_Client FOREIGN KEY (nclient) REFERENCES Client(nclient), CONSTRAINT CK_solde CHECK (solde>=0), CONSTRAINT CK_ouvert CHECK(ouvert between 0 and 1), CONSTRAINT CK_code CHECK (code>0) ); CREATE TABLE Operation( noperation INT NOT NULL, dateoperation DATE Default SYSDATE, codepropose NUMERIC(4), montant NUMERIC(10,2), ncompte INT, CONSTRAINT PK_Operation PRIMARY KEY (noperation), CONSTRAINT FK_Ope_ncompte_Compte FOREIGN KEY (ncompte) REFERENCES Compte(ncompte), CONSTRAINT CK_codepropose CHECK (codepropose>=0), CONSTRAINT CK_montant CHECK (montant>=0) ); CREATE TABLE Historique( nhistorique INT NOT NULL, dateoperation DATE DEFAULT SYSDATE, montant NUMERIC(10,2), ncompte INT, CONSTRAINT PK_Historique PRIMARY KEY (nhistorique) ); CREATE TABLE Incident( nincident INT NOT NULL, message VARCHAR(45), noperation INT, CONSTRAINT PK_Incident PRIMARY KEY (nincident), CONSTRAINT FK_Inc_noperation_Operation FOREIGN KEY (noperation) REFERENCES Operation(noperation) ); Here are some tests, everything is ok apart from the last insert : INSERT INTO Client (nom) values ('abderrahmane'); INSERT INTO Client (nom) values ('ben'); Select * FROM Client; INSERT INTO Compte (solde,nclient) values (200,1); INSERT INTO Compte (nclient,code) values (2,2403); INSERT INTO Compte (solde,nclient) values (2300,3); SELECT * FROM Compte; INSERT INTO Operation (montant,ncompte) values (200,2); INSERT INTO Operation (codepropose,ncompte) values (2010,2); INSERT INTO Operation (ncompte) values (1); INSERT INTO Operation (codepropose,montant,ncompte) values (2020,20,1); INSERT INTO Operation (codepropose,montant,ncompte,dateoperation) values (2030,30,2,'01/01/2001'); INSERT INTO Operation (codepropose,montant,ncompte) values (2030,30,3); SELECT * FROM Operation; INSERT INTO Historique (montant,ncompte) values (200,2); INSERT INTO Historique (dateoperation,ncompte) values ('15/04/16',2); INSERT INTO Historique (ncompte) values (1); INSERT INTO Historique (dateoperation,montant,ncompte) values ('15/04/16',20,1); INSERT INTO Historique (dateoperation,montant,ncompte) values ('15/04/16',30,3); SELECT * FROM Historique; INSERT INTO Incident (message,noperation) values ('Incident 1',2); INSERT INTO Incident (message,noperation) values ('Incident 2',8); INSERT INTO Incident (message,noperation) values ('Incident 3',1); SELECT * FROM Incident; UPDATE Compte SET ouvert = 0 WHERE nclient = 2; INSERT INTO Operation (montant,ncompte,codepropose) values (200,2,2403); SELECT * FROM Incident;
0debug
Python: number of words in line : <p>I have a file with a lot of lines. I need to count the number of words only in line 35. Is there an easy way to do so?</p>
0debug
bool st_change_trace_event_state(const char *tname, bool tstate) { TraceEvent *tp; tp = find_trace_event_by_name(tname); if (tp) { tp->state = tstate; return true; } return false; }
1threat
static void borzoi_init(int ram_size, int vga_ram_size, int boot_device, DisplayState *ds, const char **fd_filename, int snapshot, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model) { spitz_common_init(ram_size, vga_ram_size, ds, kernel_filename, kernel_cmdline, initrd_filename, borzoi, 0x33f); }
1threat
How to create sound devices for debian in docker? : <p>I'm using various docker containers which, under the covers are built on Debian sid. These images lack <code>/dev/snd</code> and <code>/dev/snd/seq</code>, which pretty much makes sense since they have no hardware audio card.</p> <p>Several pieces of software I'm using to generate MIDI files require these sequencer devices to be present. They're not necessarily used to send out audio, but the code itself dies in init if the sound devices do not exist. To be clear, I don't need to generate an audio signal within docker, rather I just need these to exist to make other software happy.</p> <p>So far, what I've tried is endlessly installing various alsa packages (<code>alsa-utils</code>, <code>alsa-oss</code>, and others) and trying to <code>modprobe</code> my way out of this, all with no luck.</p> <p>Within a docker container, what needs to happen to have valid audio devices even if dummy?</p>
0debug
How can i program my software to save its data to a particular server? : <p>I want to develop an messenger type software for windows using python, but i want to make my software to save all the data to a particular server, so please help me how can i ?</p>
0debug
static void new_audio_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec= NULL; AVCodecContext *audio_enc; enum CodecID codec_id; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!audio_stream_copy){ if (audio_codec_name) { codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1, avcodec_opts[AVMEDIA_TYPE_AUDIO]->strict_std_compliance); codec = avcodec_find_encoder_by_name(audio_codec_name); output_codecs[nb_output_codecs-1] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO); codec = avcodec_find_encoder(codec_id); } } avcodec_get_context_defaults3(st->codec, codec); ost->bitstream_filters = audio_bitstream_filters; audio_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; if(audio_codec_tag) audio_enc->codec_tag= audio_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if (audio_stream_copy) { st->stream_copy = 1; audio_enc->channels = audio_channels; audio_enc->sample_rate = audio_sample_rate; } else { audio_enc->codec_id = codec_id; set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); if (audio_qscale > QSCALE_NONE) { audio_enc->flags |= CODEC_FLAG_QSCALE; audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale; } audio_enc->channels = audio_channels; audio_enc->sample_fmt = audio_sample_fmt; audio_enc->sample_rate = audio_sample_rate; audio_enc->channel_layout = channel_layout; if (av_get_channel_layout_nb_channels(channel_layout) != audio_channels) audio_enc->channel_layout = 0; choose_sample_fmt(st, codec); choose_sample_rate(st, codec); } audio_enc->time_base= (AVRational){1, audio_sample_rate}; if (audio_language) { av_metadata_set2(&st->metadata, "language", audio_language, 0); av_freep(&audio_language); } audio_disable = 0; av_freep(&audio_codec_name); audio_stream_copy = 0; }
1threat
How to get the location of iPhone without "Find my iPhone"? : <p>I have an iPad Air 2 and my daughter has an iPhone 5s with a shared iCloud account. Both have the latest iOS version (10.1.1 as of this post). Previously both can find each other. But my daughter is now during teenage, she doesn't want me to track her. She turned off "Find my iPhone". Are there anyways to override this control without touching her iPhone? Thank you in advance. By the way, I also have a mac, perhaps it helps.</p>
0debug
How do you tell Karma to keep browser window open if tests fail? : <p>I'm currently trying to implement jasmine testing using karma and webpack, and the code is getting transpiled incorrectly, but I can't see what it is transpiled down to because the browser closes as soon as it opens and finds the syntax error. How can I configure karma or jasmine to keep the browser window open after an error occurs?</p>
0debug
Android Error While using ExifInterface : <p>I am trying to check the orientation of bitmap and flip it if there is a need, but I have error while applying the code. Here is my code while i am trying to flipp the image using ExifInterface:</p> <pre><code>@RequiresApi(api = Build.VERSION_CODES.N) public void flipping(Bitmap b) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); b.compress(Bitmap.CompressFormat.JPEG,100, bos); byte[] bitmapdata = bos.toByteArray(); ByteArrayInputStream bs = new ByteArrayInputStream(bitmapdata); try { ExifInterface exif = new ExifInterface(bs); int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_UNDEFINED); switch(orientation) { case ExifInterface.ORIENTATION_ROTATE_90: rotateImage(b, 90); break; case ExifInterface.ORIENTATION_ROTATE_180: rotateImage(b, 180); break; case ExifInterface.ORIENTATION_ROTATE_270: rotateImage(b, 270); break; case ExifInterface.ORIENTATION_NORMAL: default: break; } encoding(); } catch (IOException e) { e.printStackTrace(); } } public static Bitmap rotateImage(Bitmap source, float angle) { Matrix matrix = new Matrix(); matrix.postRotate(angle); return Bitmap.createBitmap(source, 0, 0, source.getWidth(), source.getHeight(), matrix, true); } </code></pre> <p>And here is the error:</p> <pre><code>java.lang.NoSuchMethodError: No direct method &lt;init&gt;(Ljava/io/InputStream;)V in class Landroid/media/ExifInterface; or its super classes (declaration of 'android.media.ExifInterface' appears in /system/framework/framework.jar) at com.sara.image_test.MainActivity.flipping(MainActivity.java:181) at com.sara.image_test.MainActivity.onActivityResult(MainActivity.java:66) at android.app.Activity.dispatchActivityResult(Activity.java:7165) at android.app.ActivityThread.deliverResults(ActivityThread.java:4994) at android.app.ActivityThread.handleSendResult(ActivityThread.java:5041) at android.app.ActivityThread.access$1600(ActivityThread.java:229) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1875) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:7325) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120) </code></pre>
0debug
how to change date format to mm/dd/yyyy to dd/mm/yyyy in c# : <p>im gettin the date in this format "3/16/2017 10:53:44 PM", how to get date in this format "16/3/2017 10:53:44 PM"</p> <pre><code>sample data "timestamp":"2017-03-16T17:23:44.860Z" desired op "16/3/2017 10:53:44 PM" code binModel.UpdatedTime = TimeZoneInfo.ConvertTimeFromUtc(Convert.ToDateTime(bin.timestamp), TimeZoneInfo.FindSystemTimeZoneById("India Standard Time")).ToString(); data type public String UpdatedTime { get; set; } </code></pre>
0debug
How to Create DropDown list with 13 days bunch : <p>Please help me,I want to create dropdown with 13 days of bunch as an option. for example : 2017-02-05 00:00:00.000 2017-02-18 23:59:59.000 2017-02-19 00:00:00.000 2017-03-04 23:59:59.000 ........</p> <p>U can give me a soltion in any technology(MVC code,JQuery,JavaScript).</p> <p>Thanks In Advance.</p>
0debug
Send array as part of x-www-form-urlencoded : <p>I want to send array using postman. the request looks like this: <a href="https://i.stack.imgur.com/cBLnd.png" rel="noreferrer"><img src="https://i.stack.imgur.com/cBLnd.png" alt="enter image description here"></a></p> <p>Im using postman to execute requests. I found on the internet to send array via form-data or raw. But I need them to be send as x-www-form-urlencoded. I tried it this way: <a href="https://i.stack.imgur.com/5a6Nh.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5a6Nh.png" alt="enter image description here"></a></p> <p>But its wrong because value ads is string not array.</p>
0debug
removing a specific character from a text file with python : I'm so new to python "and coding generally", and I was doing a tiny project and i'm facing a problem 44, 1, 6 23, 2, 7 49, 2, 3 53, 2, 1 68, 1, 6 71, 2, 7 I just need to remove the 3rd and the 6th character from each line, or more specifically the "," characters from the whole file. and i need to do it using my python code for line in my_file: ?????????????? anything can help, thanks.
0debug
How to keep application awake in flutter? : <p>How to keep an application from locking the screen in flutter?</p> <p>Is there a flag to turn it off an on? Does flutter SDK expose this?</p> <p>Something like <code>keepAwake(true);</code></p> <p>Thank you</p>
0debug