problem
stringlengths
26
131k
labels
class label
2 classes
void do_raise_exception_err (uint32_t exception, int error_code) { #if 0 printf("Raise exception %3x code : %d\n", exception, error_code); #endif switch (exception) { case EXCP_PROGRAM: if (error_code == EXCP_FP && msr_fe0 == 0 && msr_fe1 == 0) return; break; default: break; } env->exception_index = exception; env->error_code = error_code; cpu_loop_exit(); }
1threat
Flatten and restructure linq in Asp.Net : <p>I want to restructure the original <strong>json data with a list of trips</strong> and <strong>return a converted and flatten list</strong> based on the <strong>boarding points</strong> and the <strong>dropping points</strong> using <strong>Linq</strong>. Below is the example of original json data and the result that I want. How do I do that? Please help. Thanks.</p> <p>Original Json:</p> <pre><code>[{ tripId: 1, name: "abc express", boardingTimes: [ { time: 1200, id: 12, name: "A" }, { time: 1215, id: 14, name: "B" } ], droppingTimes: [{ time: 1400, id: 15, name: "C" }] }] </code></pre> <p>Result: </p> <pre><code>[{ tripId: 1, name: "abc express", boardingTimes: { time: 1200, id: 12, name: "A" }, droppingTimes: { time: 1400, id: 15, name: "C" } }, tripId: 1, name: "abc express", boardingTimes: { time: 1215, id: 14, name: "B" }, droppingTimes: { time: 1400, id: 15, name: "C" } ] </code></pre>
0debug
void init_clocks(void) { QEMUClockType type; for (type = 0; type < QEMU_CLOCK_MAX; type++) { qemu_clock_init(type); } #ifdef CONFIG_PRCTL_PR_SET_TIMERSLACK prctl(PR_SET_TIMERSLACK, 1, 0, 0, 0); #endif }
1threat
How to make verlet integration collisions more stable? : <p>I'm not using any engine, but instead trying to build my own softbody dynamics for fun using verlet integeration. I made a cube defined by 4x4 points with segments keeping its shape like so:</p> <p><a href="https://i.stack.imgur.com/3RzPH.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/3RzPH.jpg" alt="The structure of my box"></a></p> <p>I have the points collide against the edges of the scene and it seems to work fine. Though I do get some cases where the points collapses in itself and it'll create a dent instead of maintaining its box shape. For example, if it's a high enough velocity and it lands on its corner it tends to crumble:</p> <p><a href="https://i.stack.imgur.com/KmNiK.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/KmNiK.jpg" alt="enter image description here"></a></p> <p>I must be doing something wrong or out of order when solving the collision. Here's how I'm handling it. It's in Javascript, though the language doesn't matter, feel free to reply with any language:</p> <pre><code>sim = function() { // Sim all points. for (let i = 0; i &lt; this.points.length; i++) { this.points[i].sim(); } // Keep in bounds. let border = 100; for (let i = 0; i &lt; this.points.length; i++) { let p = this.points[i]; let vx = p.pos.x - p.oldPos.x; let vy = p.pos.y - p.oldPos.y; if (p.pos.y &gt; height - border) { // Bottom screen p.pos.y = height - border; p.oldPos.y = p.pos.y + vy; } else if (p.pos.y &lt; 0 + border) { // Top screen p.pos.y = 0 + border; p.oldPos.y = p.pos.y + vy; } if (p.pos.x &lt; 0 + border) { // Left screen p.pos.x = 0 + border; p.oldPos.x = p.pos.x + vx; } else if (p.pos.x &gt; width - border) { // Right screen p.pos.x = width - border; p.oldPos.x = p.pos.x + vx; } } // Sim its segments. let timesteps = 20; for (let ts = 0; ts &lt; timesteps; ts++) { for (let i = 0; i &lt; this.segments.length; i++) { this.segments[i].sim(); } } } </code></pre> <p>Please let me know if I need to post any other details.</p>
0debug
Using the Tkinter module in Python 3.5 : import time, random from tkinter import * class Box( Frame ): def __init__( self ): # __init__ runs when Box() executes Frame.__init__( self ) # Frame is the top level component self.pack() self.master.title( "Canvas animation" ) self.master.geometry( "400x400" ) # size in pixels label = Label(self, text=" Bubbles ") label.grid(row=1, column=1) # create Canvas component self.myCanvas = Canvas( self ) self.myCanvas.grid(row=2, column=1) self.myCanvas.config(bg = 'cyan', height = 350, width = 350) self.balls = [] #list of balls belongs to the Box self.paint() self.animate() def paint( self ): #create a list of balls for i in range(35): x1, y1 = random.randint(35,315), random.randint(35,315) x2, y2 = x1 + 30 , y1 + 30 #size ballObjectId = self.myCanvas.create_oval\ ( x1, y1, x2, y2, fill = '') self.balls.append([ballObjectId, x1, y1]) self.myCanvas.update() print ("paint done") def animate( self ): #animate the list of balls for i in range(1000): for i in range(len(self.balls)): self.myCanvas.delete(self.balls[i][0]) #delete and redraw to move self.balls[i][1] += random.randint(-2,2) #change coordinates self.balls[i][2] += random.randint(-10,0) x1, y1 = self.balls[i][1], self.balls[i][2] x2, y2 = x1 + random.randint(30,31) , y1 + random.randint(30,31) self.balls[i][0]=(self.myCanvas.create_oval\ ( x1, y1, x2, y2, fill = '')) self.myCanvas.update() def main(): Box().mainloop() if __name__ == "__main__": main() This is the code I have so far. The problem I can't seem to solve is I need the balls to move a different speeds and also have different sizes. The final step I need to do is have the balls go to the top and come back up from the bottom. So the final product should be balls of multiple sizes traveling at different speeds to the top of the canvas then appearing back at the bottom. Thanks for any help!
0debug
The most easier LocalStorage example in JS : i know that there were similar question about it, but can you explain in the most easy way how can i use localStorage when user insert data in one page, but this data should be used in another file. for example: in registration.html we have <input name="name" type="text" id="firstname"> <input type="button" value="OK" > in cabinet.html i want to see: Hello, *inputed name* i need to perform it using JAVASCRIPT. Thank a lot for your answers.
0debug
Android Capture Image and record voice through service even if device is locked : I am working on my fyp and i am developing android antilost so how can i make service that will capture image or record voice even when device is locked i figured how to trigger that service. but how to write code that will do the job even if device is locked?
0debug
Convert rank and partition query to SqlAlchemy : <p>I would like to convert the following query to SqlAlchemy, but the documentation isn't very helpful:</p> <pre><code>select * from ( select *, RANK() OVER (PARTITION BY id ORDER BY date desc) AS RNK from table1 ) d where RNK = 1 </code></pre> <p>Any suggestions?</p>
0debug
Python 3 - Get n greatest values in dict : <p>I have a dict, with strings as keys and lists as values and want to find the n keys with the longest lists (length). </p> <p>How could I approach this problem?</p>
0debug
Could not find play-services-basement.aar : <p>Yesterday I tried building my app and everything worked fine.</p> <p>Today, without any changes to the project... All of a sudden I'm greeted with this warning message telling me:</p> <pre><code>Error:Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:11.0.1). Searched in the following locations: https://jcenter.bintray.com/com/google/android/gms/play-services-basement/11.0.1/play-services-basement-11.0.1.aar </code></pre> <p>Is anyone experiencing the same sort of issue?</p> <p>If you follow the link where it's searching for the package it basically gets downloaded instantly through the browser. I suppose something has changed on the server side? Perhaps naming conventions?</p> <p>It looks like it's looking for: play-services-basement.aar and fetches play-services-basement-11.0.1.aar instead? Could this be a naming convention or gradle issue?</p>
0debug
how does a router advertise itself and the hotspot? : <p>In which protocol does router use to advertise itself and the network(including the name of the netwrok, like hotspot)? I haven't found it on the interent, do you have any ideas?</p>
0debug
int qio_channel_socket_connect_sync(QIOChannelSocket *ioc, SocketAddressLegacy *addr, Error **errp) { int fd; trace_qio_channel_socket_connect_sync(ioc, addr); fd = socket_connect(addr, NULL, NULL, errp); if (fd < 0) { trace_qio_channel_socket_connect_fail(ioc); return -1; } trace_qio_channel_socket_connect_complete(ioc, fd); if (qio_channel_socket_set_fd(ioc, fd, errp) < 0) { close(fd); return -1; } return 0; }
1threat
What to download in order to make nltk.tokenize.word_tokenize work? : <p>I am going to use <code>nltk.tokenize.word_tokenize</code> on a cluster where my account is very limited by space quota. At home, I downloaded all <code>nltk</code> resources by <code>nltk.download()</code> but, as I found out, it takes ~2.5GB.</p> <p>This seems a bit overkill to me. Could you suggest what are the minimal (or almost minimal) dependencies for <code>nltk.tokenize.word_tokenize</code>? So far, I've seen <code>nltk.download('punkt')</code> but I am not sure whether it is sufficient and what is the size. What exactly should I run in order to make it work?</p>
0debug
static int mov_read_enda(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; int little_endian = get_be16(pb); dprintf(c->fc, "enda %d\n", little_endian); if (little_endian == 1) { switch (st->codec->codec_id) { case CODEC_ID_PCM_S24BE: st->codec->codec_id = CODEC_ID_PCM_S24LE; break; case CODEC_ID_PCM_S32BE: st->codec->codec_id = CODEC_ID_PCM_S32LE; break; case CODEC_ID_PCM_F32BE: st->codec->codec_id = CODEC_ID_PCM_F32LE; break; case CODEC_ID_PCM_F64BE: st->codec->codec_id = CODEC_ID_PCM_F64LE; break; default: break; } } return 0; }
1threat
static inline bool object_property_is_link(ObjectProperty *prop) { return strstart(prop->type, "link<", NULL); }
1threat
int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) { VP8Context *s = avctx->priv_data; VP8ThreadData *td = &s->thread_data[jobnr]; VP8ThreadData *next_td = NULL, *prev_td = NULL; VP8Frame *curframe = s->curframe; int mb_y, num_jobs = s->num_jobs; int ret; td->thread_nr = threadnr; for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) { if (mb_y >= s->mb_height) break; td->thread_mb_pos = mb_y << 16; ret = s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr); if (ret < 0) return ret; if (s->deblock_filter) s->filter_mb_row(avctx, tdata, jobnr, threadnr); update_pos(td, mb_y, INT_MAX & 0xFFFF); s->mv_min.y -= 64; s->mv_max.y -= 64; if (avctx->active_thread_type == FF_THREAD_FRAME) ff_thread_report_progress(&curframe->tf, mb_y, 0); } return 0; }
1threat
Need Regular Expression Logic to find string in C# : I want to find a particular string (word) from a sentence. Given String: "In a given health plan your Plan Name: Medical and Plan Type: PPO whose effective date: 2019-01-01 and coverage value $100 and $200". 1) if I pass "Plan Name:" then my output would be "Medical". 2) if I pass "Plan Type:" then my output would be "PPO". 3) if I pass "effective date:" then my output would be "2019-01-01". 4) if I pass "coverage value" then in this case I need two value. Min value "$100" and MAX value "$200". Similarly I need email address from a given sentence. There could be scenario where I just need to pic a date, email or a numeric value from a given sentence. In this case I do not have any previous value to match. I need a regular expression logic that covers all above requirements. Thanks Udai Mathur I tried but I need all the scenario.
0debug
Create a program that asks the user for an age. It tells them their grade (9, 10, 11 or 12) based on their response. Python : age = (int(input("How old are you?"))) if (age == 14 or age ==15): print ("you are in grade 9") if (age == 15): print("or") if (age == 15 or age == 16): print ("you are in grade 10") if (age == 16): print("or") if (age == 16 or age == 17): print ("you are in grade 11") if (age == 17): print ("or") if (age == 17 or age == 18): print ("you are in grade 12")
0debug
PHP equivalent of Python's requests.get : <p>I'm trying to access an API using PHP but for which the tutorial is only written in Python. The tutorial shows how to retrieve the data from a URL using</p> <p>res = requests.get(API_URL, auth=(UID, SECRET))</p> <p>Please can someone tell me what the equivalent statement would be in PHP, thanks.</p>
0debug
Parsing server logs python : I've been struggling to try and parse some server logs with python and regex. I want to be able parse useragent string in these lines and then eventually put them into a Panda Dataframe or a simple excel spreadsheet. So the following extract: 14/Aug/2018:00:44:50 +0000] 330 95.144.101.0, 34.255.205.1 GET pixelg.adswizz.com /one.png 200 - AlexaMediaPlayer/2.0.201528.0 (Linux;Android 5.1.1) ExoPlayerLib/1.5.9 client=VillaPlus&oid=2069&cid=22599&ad=54063&cr=August2018&target=25plus&action=ae&eventId=&cb=8874209&listenerId=f78d5ea146e92c4666efd2a389a8d2e8f6174bfc6777496e5e22735c426c&zone=679 - pixelg.adswizz.com https 533 TLSv1.2 DHE-RSA-AES128-GCM-SHA256, "15/Aug/2018:23:03:17 +0000] 330 79.77.250.195, 34.245.112.20 GET pixelg.adswizz.com /one.png 200 - Smooth/38 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) devicemap=mobile_tablet - pixelg.adswizz.com http 357 - - 0.000, 15/Aug/2018:23:17:01 +0000] 330 77.100.181.37 GET pixelg.adswizz.com /one.png 200 https://www.bonne-terre-data-layer.com/tag-manager.html?consumer=m.skybet.com Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 SkyBet/6.8b474 (Sky Bet Mobile App) client=SkyBet&event_id=Summer17&action=clientsitevisit&event=/my-bets - pixelg.adswizz.com https 605 TLSv1.2 DHE-RSA-AES128-GCM-SHA256 0.000, 14/Aug/2018:01:00:55 +0000] 330 86.178.205.6, 34.244.204.228 GET pixelg.adswizz.com /one.png 200 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 client=MyHermes&oid=&cid=22731&ad=54477&cr=Hermes&target=selfemploy&action=ae&eventId=&cb=7699694&listenerId=0610d2ed750ab9f692daff922e1b2c04&zone=87 - pixelg.adswizz.com https 546 TLSv1.2 DHE-RSA-AES128-GCM-SHA256 Becomes in a list: AlexaMediaPlayer/2.0.201528.0 (Linux;Android 5.1.1) ExoPlayerLib/1.5.9, Smooth/38 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X), Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 SkyBet/6.8b474 (Sky Bet Mobile App), Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 Specifically I'm stuck on how to create the regex to pick up the user agent string in these different line formats. I would expect the code to look something like this: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> import re listofLines = ["[14/Aug/2018:00:44:50 +0000] 330 95.144.101.0, 34.255.205.1 GET pixelg.adswizz.com /one.png 200 - AlexaMediaPlayer/2.0.201528.0 (Linux;Android 5.1.1) ExoPlayerLib/1.5.9 client=VillaPlus&oid=2069&cid=22599&ad=54063&cr=August2018&target=25plus&action=ae&eventId=&cb=8874209&listenerId=f78d5ea146e92c4666efd2a389a8d2e8f6174bfc6777496e5e22735c426c&zone=679 - pixelg.adswizz.com https 533 TLSv1.2 DHE-RSA-AES128-GCM-SHA256", "[15/Aug/2018:23:03:17 +0000] 330 79.77.250.195, 34.245.112.20 GET pixelg.adswizz.com /one.png 200 - Smooth/38 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) devicemap=mobile_tablet - pixelg.adswizz.com http 357 - - 0.000", "[15/Aug/2018:23:17:01 +0000] 330 77.100.181.37 GET pixelg.adswizz.com /one.png 200 https://www.bonne-terre-data-layer.com/tag-manager.html?consumer=m.skybet.com Mozilla/5.0 (iPhone; CPU iPhone OS 11_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15G77 SkyBet/6.8b474 (Sky Bet Mobile App) client=SkyBet&event_id=Summer17&action=clientsitevisit&event=/my-bets - pixelg.adswizz.com https 605 TLSv1.2 DHE-RSA-AES128-GCM-SHA256 0.000", "[14/Aug/2018:01:00:55 +0000] 330 86.178.205.6, 34.244.204.228 GET pixelg.adswizz.com /one.png 200 - Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36 client=MyHermes&oid=&cid=22731&ad=54477&cr=Hermes&target=selfemploy&action=ae&eventId=&cb=7699694&listenerId=0610d2ed750ab9f692daff922e1b2c04&zone=87 - pixelg.adswizz.com https 546 TLSv1.2 DHE-RSA-AES128-GCM-SHA256"] regexuseragent = r"[200 |200 - ]" for line in listofLines: if re.findall(regexuseragent,line): print(regexuseragent) else: print("no useragent") <!-- end snippet -->
0debug
int ff_hevc_decode_nal_pps(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; HEVCSPS *sps = NULL; int pic_area_in_ctbs; int log2_diff_ctb_min_tb_size; int i, j, x, y, ctb_addr_rs, tile_id; int ret = 0; unsigned int pps_id = 0; AVBufferRef *pps_buf; HEVCPPS *pps = av_mallocz(sizeof(*pps)); if (!pps) return AVERROR(ENOMEM); pps_buf = av_buffer_create((uint8_t *)pps, sizeof(*pps), hevc_pps_free, NULL, 0); if (!pps_buf) { av_freep(&pps); return AVERROR(ENOMEM); } av_log(s->avctx, AV_LOG_DEBUG, "Decoding PPS\n"); pps->loop_filter_across_tiles_enabled_flag = 1; pps->num_tile_columns = 1; pps->num_tile_rows = 1; pps->uniform_spacing_flag = 1; pps->disable_dbf = 0; pps->beta_offset = 0; pps->tc_offset = 0; pps->log2_max_transform_skip_block_size = 2; pps_id = get_ue_golomb_long(gb); if (pps_id >= MAX_PPS_COUNT) { av_log(s->avctx, AV_LOG_ERROR, "PPS id out of range: %d\n", pps_id); ret = AVERROR_INVALIDDATA; goto err; } pps->sps_id = get_ue_golomb_long(gb); if (pps->sps_id >= MAX_SPS_COUNT) { av_log(s->avctx, AV_LOG_ERROR, "SPS id out of range: %d\n", pps->sps_id); ret = AVERROR_INVALIDDATA; goto err; } if (!s->sps_list[pps->sps_id]) { av_log(s->avctx, AV_LOG_ERROR, "SPS %u does not exist.\n", pps->sps_id); ret = AVERROR_INVALIDDATA; goto err; } sps = (HEVCSPS *)s->sps_list[pps->sps_id]->data; pps->dependent_slice_segments_enabled_flag = get_bits1(gb); pps->output_flag_present_flag = get_bits1(gb); pps->num_extra_slice_header_bits = get_bits(gb, 3); pps->sign_data_hiding_flag = get_bits1(gb); pps->cabac_init_present_flag = get_bits1(gb); pps->num_ref_idx_l0_default_active = get_ue_golomb_long(gb) + 1; pps->num_ref_idx_l1_default_active = get_ue_golomb_long(gb) + 1; pps->pic_init_qp_minus26 = get_se_golomb(gb); pps->constrained_intra_pred_flag = get_bits1(gb); pps->transform_skip_enabled_flag = get_bits1(gb); pps->cu_qp_delta_enabled_flag = get_bits1(gb); pps->diff_cu_qp_delta_depth = 0; if (pps->cu_qp_delta_enabled_flag) pps->diff_cu_qp_delta_depth = get_ue_golomb_long(gb); pps->cb_qp_offset = get_se_golomb(gb); if (pps->cb_qp_offset < -12 || pps->cb_qp_offset > 12) { av_log(s->avctx, AV_LOG_ERROR, "pps_cb_qp_offset out of range: %d\n", pps->cb_qp_offset); ret = AVERROR_INVALIDDATA; goto err; } pps->cr_qp_offset = get_se_golomb(gb); if (pps->cr_qp_offset < -12 || pps->cr_qp_offset > 12) { av_log(s->avctx, AV_LOG_ERROR, "pps_cr_qp_offset out of range: %d\n", pps->cr_qp_offset); ret = AVERROR_INVALIDDATA; goto err; } pps->pic_slice_level_chroma_qp_offsets_present_flag = get_bits1(gb); pps->weighted_pred_flag = get_bits1(gb); pps->weighted_bipred_flag = get_bits1(gb); pps->transquant_bypass_enable_flag = get_bits1(gb); pps->tiles_enabled_flag = get_bits1(gb); pps->entropy_coding_sync_enabled_flag = get_bits1(gb); if (pps->tiles_enabled_flag) { pps->num_tile_columns = get_ue_golomb_long(gb) + 1; pps->num_tile_rows = get_ue_golomb_long(gb) + 1; if (pps->num_tile_columns == 0 || pps->num_tile_columns >= sps->width) { av_log(s->avctx, AV_LOG_ERROR, "num_tile_columns_minus1 out of range: %d\n", pps->num_tile_columns - 1); ret = AVERROR_INVALIDDATA; goto err; } if (pps->num_tile_rows == 0 || pps->num_tile_rows >= sps->height) { av_log(s->avctx, AV_LOG_ERROR, "num_tile_rows_minus1 out of range: %d\n", pps->num_tile_rows - 1); ret = AVERROR_INVALIDDATA; goto err; } pps->column_width = av_malloc_array(pps->num_tile_columns, sizeof(*pps->column_width)); pps->row_height = av_malloc_array(pps->num_tile_rows, sizeof(*pps->row_height)); if (!pps->column_width || !pps->row_height) { ret = AVERROR(ENOMEM); goto err; } pps->uniform_spacing_flag = get_bits1(gb); if (!pps->uniform_spacing_flag) { uint64_t sum = 0; for (i = 0; i < pps->num_tile_columns - 1; i++) { pps->column_width[i] = get_ue_golomb_long(gb) + 1; sum += pps->column_width[i]; } if (sum >= sps->ctb_width) { av_log(s->avctx, AV_LOG_ERROR, "Invalid tile widths.\n"); ret = AVERROR_INVALIDDATA; goto err; } pps->column_width[pps->num_tile_columns - 1] = sps->ctb_width - sum; sum = 0; for (i = 0; i < pps->num_tile_rows - 1; i++) { pps->row_height[i] = get_ue_golomb_long(gb) + 1; sum += pps->row_height[i]; } if (sum >= sps->ctb_height) { av_log(s->avctx, AV_LOG_ERROR, "Invalid tile heights.\n"); ret = AVERROR_INVALIDDATA; goto err; } pps->row_height[pps->num_tile_rows - 1] = sps->ctb_height - sum; } pps->loop_filter_across_tiles_enabled_flag = get_bits1(gb); } pps->seq_loop_filter_across_slices_enabled_flag = get_bits1(gb); pps->deblocking_filter_control_present_flag = get_bits1(gb); if (pps->deblocking_filter_control_present_flag) { pps->deblocking_filter_override_enabled_flag = get_bits1(gb); pps->disable_dbf = get_bits1(gb); if (!pps->disable_dbf) { pps->beta_offset = get_se_golomb(gb) * 2; pps->tc_offset = get_se_golomb(gb) * 2; if (pps->beta_offset/2 < -6 || pps->beta_offset/2 > 6) { av_log(s->avctx, AV_LOG_ERROR, "pps_beta_offset_div2 out of range: %d\n", pps->beta_offset/2); ret = AVERROR_INVALIDDATA; goto err; } if (pps->tc_offset/2 < -6 || pps->tc_offset/2 > 6) { av_log(s->avctx, AV_LOG_ERROR, "pps_tc_offset_div2 out of range: %d\n", pps->tc_offset/2); ret = AVERROR_INVALIDDATA; goto err; } } } pps->scaling_list_data_present_flag = get_bits1(gb); if (pps->scaling_list_data_present_flag) { set_default_scaling_list_data(&pps->scaling_list); ret = scaling_list_data(s, &pps->scaling_list, sps); if (ret < 0) goto err; } pps->lists_modification_present_flag = get_bits1(gb); pps->log2_parallel_merge_level = get_ue_golomb_long(gb) + 2; if (pps->log2_parallel_merge_level > sps->log2_ctb_size) { av_log(s->avctx, AV_LOG_ERROR, "log2_parallel_merge_level_minus2 out of range: %d\n", pps->log2_parallel_merge_level - 2); ret = AVERROR_INVALIDDATA; goto err; } pps->slice_header_extension_present_flag = get_bits1(gb); if (get_bits1(gb)) { int pps_range_extensions_flag = get_bits1(gb); get_bits(gb, 7); if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) { pps_range_extensions(s, pps, sps); } } pps->col_bd = av_malloc_array(pps->num_tile_columns + 1, sizeof(*pps->col_bd)); pps->row_bd = av_malloc_array(pps->num_tile_rows + 1, sizeof(*pps->row_bd)); pps->col_idxX = av_malloc_array(sps->ctb_width, sizeof(*pps->col_idxX)); if (!pps->col_bd || !pps->row_bd || !pps->col_idxX) { ret = AVERROR(ENOMEM); goto err; } if (pps->uniform_spacing_flag) { if (!pps->column_width) { pps->column_width = av_malloc_array(pps->num_tile_columns, sizeof(*pps->column_width)); pps->row_height = av_malloc_array(pps->num_tile_rows, sizeof(*pps->row_height)); } if (!pps->column_width || !pps->row_height) { ret = AVERROR(ENOMEM); goto err; } for (i = 0; i < pps->num_tile_columns; i++) { pps->column_width[i] = ((i + 1) * sps->ctb_width) / pps->num_tile_columns - (i * sps->ctb_width) / pps->num_tile_columns; } for (i = 0; i < pps->num_tile_rows; i++) { pps->row_height[i] = ((i + 1) * sps->ctb_height) / pps->num_tile_rows - (i * sps->ctb_height) / pps->num_tile_rows; } } pps->col_bd[0] = 0; for (i = 0; i < pps->num_tile_columns; i++) pps->col_bd[i + 1] = pps->col_bd[i] + pps->column_width[i]; pps->row_bd[0] = 0; for (i = 0; i < pps->num_tile_rows; i++) pps->row_bd[i + 1] = pps->row_bd[i] + pps->row_height[i]; for (i = 0, j = 0; i < sps->ctb_width; i++) { if (i > pps->col_bd[j]) j++; pps->col_idxX[i] = j; } pic_area_in_ctbs = sps->ctb_width * sps->ctb_height; pps->ctb_addr_rs_to_ts = av_malloc_array(pic_area_in_ctbs, sizeof(*pps->ctb_addr_rs_to_ts)); pps->ctb_addr_ts_to_rs = av_malloc_array(pic_area_in_ctbs, sizeof(*pps->ctb_addr_ts_to_rs)); pps->tile_id = av_malloc_array(pic_area_in_ctbs, sizeof(*pps->tile_id)); pps->min_tb_addr_zs_tab = av_malloc_array((sps->tb_mask+2) * (sps->tb_mask+2), sizeof(*pps->min_tb_addr_zs_tab)); if (!pps->ctb_addr_rs_to_ts || !pps->ctb_addr_ts_to_rs || !pps->tile_id || !pps->min_tb_addr_zs_tab) { ret = AVERROR(ENOMEM); goto err; } for (ctb_addr_rs = 0; ctb_addr_rs < pic_area_in_ctbs; ctb_addr_rs++) { int tb_x = ctb_addr_rs % sps->ctb_width; int tb_y = ctb_addr_rs / sps->ctb_width; int tile_x = 0; int tile_y = 0; int val = 0; for (i = 0; i < pps->num_tile_columns; i++) { if (tb_x < pps->col_bd[i + 1]) { tile_x = i; break; } } for (i = 0; i < pps->num_tile_rows; i++) { if (tb_y < pps->row_bd[i + 1]) { tile_y = i; break; } } for (i = 0; i < tile_x; i++) val += pps->row_height[tile_y] * pps->column_width[i]; for (i = 0; i < tile_y; i++) val += sps->ctb_width * pps->row_height[i]; val += (tb_y - pps->row_bd[tile_y]) * pps->column_width[tile_x] + tb_x - pps->col_bd[tile_x]; pps->ctb_addr_rs_to_ts[ctb_addr_rs] = val; pps->ctb_addr_ts_to_rs[val] = ctb_addr_rs; } for (j = 0, tile_id = 0; j < pps->num_tile_rows; j++) for (i = 0; i < pps->num_tile_columns; i++, tile_id++) for (y = pps->row_bd[j]; y < pps->row_bd[j + 1]; y++) for (x = pps->col_bd[i]; x < pps->col_bd[i + 1]; x++) pps->tile_id[pps->ctb_addr_rs_to_ts[y * sps->ctb_width + x]] = tile_id; pps->tile_pos_rs = av_malloc_array(tile_id, sizeof(*pps->tile_pos_rs)); if (!pps->tile_pos_rs) { ret = AVERROR(ENOMEM); goto err; } for (j = 0; j < pps->num_tile_rows; j++) for (i = 0; i < pps->num_tile_columns; i++) pps->tile_pos_rs[j * pps->num_tile_columns + i] = pps->row_bd[j] * sps->ctb_width + pps->col_bd[i]; log2_diff_ctb_min_tb_size = sps->log2_ctb_size - sps->log2_min_tb_size; pps->min_tb_addr_zs = &pps->min_tb_addr_zs_tab[1*(sps->tb_mask+2)+1]; for (y = 0; y < sps->tb_mask+2; y++) { pps->min_tb_addr_zs_tab[y*(sps->tb_mask+2)] = -1; pps->min_tb_addr_zs_tab[y] = -1; } for (y = 0; y < sps->tb_mask+1; y++) { for (x = 0; x < sps->tb_mask+1; x++) { int tb_x = x >> log2_diff_ctb_min_tb_size; int tb_y = y >> log2_diff_ctb_min_tb_size; int ctb_addr_rs = sps->ctb_width * tb_y + tb_x; int val = pps->ctb_addr_rs_to_ts[ctb_addr_rs] << (log2_diff_ctb_min_tb_size * 2); for (i = 0; i < log2_diff_ctb_min_tb_size; i++) { int m = 1 << i; val += (m & x ? m * m : 0) + (m & y ? 2 * m * m : 0); } pps->min_tb_addr_zs[y * (sps->tb_mask+2) + x] = val; } } if (get_bits_left(gb) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Overread PPS by %d bits\n", -get_bits_left(gb)); goto err; } av_buffer_unref(&s->pps_list[pps_id]); s->pps_list[pps_id] = pps_buf; return 0; err: av_buffer_unref(&pps_buf); return ret; }
1threat
How to load a pickle file from S3 to use in AWS Lambda? : <p>I am currently trying to load a pickled file from S3 into AWS lambda and store it to a list (the pickle is a list).</p> <p>Here is my code:</p> <pre><code>import pickle import boto3 s3 = boto3.resource('s3') with open('oldscreenurls.pkl', 'rb') as data: old_list = s3.Bucket("pythonpickles").download_fileobj("oldscreenurls.pkl", data) </code></pre> <p>I get the following error even though the file exists:</p> <pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'oldscreenurls.pkl' </code></pre> <p>Any ideas?</p>
0debug
SwiftUI: Tabview, keep state when changing tab : <p>I create an application, with several tabs, for each tab there is a webview.</p> <p>My webview:</p> <pre><code>struct WebView : UIViewRepresentable { let request: URLRequest func makeUIView(context: Context) -&gt; WKWebView { return WKWebView() } func updateUIView(_ uiView: WKWebView, context: Context) { uiView.load(request) } } </code></pre> <p>The problem when im changing tab, the web view recreate again. I want create the webviews only once, then every time I change tab, it keeped state And webview will not recharge each time</p> <p>My code:</p> <pre><code>struct ContentView: View { var body: some View { TabView { WebView(request: URLRequest(url: URL(string: "https://www.google.com/")!)) .tabItem { Image(systemName: "1.circle") Text("Messenger") }.tag(0) WebView(request: URLRequest(url: URL(string: "https://facebook.com/login")!)) .tabItem { Image(systemName: "2.circle") Text("Trello") }.tag(1) } } } </code></pre>
0debug
static const MXFCodecUL *mxf_get_essence_container_ul(enum CodecID type) { const MXFCodecUL *uls = ff_mxf_essence_container_uls; while (uls->id != CODEC_ID_NONE) { if (uls->id == type) break; uls++; } return uls; }
1threat
static int parse_bintree(Indeo3DecodeContext *ctx, AVCodecContext *avctx, Plane *plane, int code, Cell *ref_cell, const int depth, const int strip_width) { Cell curr_cell; int bytes_used; if (depth <= 0) { av_log(avctx, AV_LOG_ERROR, "Stack overflow (corrupted binary tree)!\n"); return AVERROR_INVALIDDATA; } curr_cell = *ref_cell; if (code == H_SPLIT) { SPLIT_CELL(ref_cell->height, curr_cell.height); ref_cell->ypos += curr_cell.height; ref_cell->height -= curr_cell.height; } else if (code == V_SPLIT) { if (curr_cell.width > strip_width) { curr_cell.width = (curr_cell.width <= (strip_width << 1) ? 1 : 2) * strip_width; } else SPLIT_CELL(ref_cell->width, curr_cell.width); ref_cell->xpos += curr_cell.width; ref_cell->width -= curr_cell.width; } while (1) { RESYNC_BITSTREAM; switch (code = get_bits(&ctx->gb, 2)) { case H_SPLIT: case V_SPLIT: if (parse_bintree(ctx, avctx, plane, code, &curr_cell, depth - 1, strip_width)) return AVERROR_INVALIDDATA; break; case INTRA_NULL: if (!curr_cell.tree) { curr_cell.mv_ptr = 0; curr_cell.tree = 1; } else { RESYNC_BITSTREAM; code = get_bits(&ctx->gb, 2); if (code >= 2) { av_log(avctx, AV_LOG_ERROR, "Invalid VQ_NULL code: %d\n", code); return AVERROR_INVALIDDATA; } if (code == 1) av_log(avctx, AV_LOG_ERROR, "SkipCell procedure not implemented yet!\n"); CHECK_CELL copy_cell(ctx, plane, &curr_cell); return 0; } break; case INTER_DATA: if (!curr_cell.tree) { if (!ctx->need_resync) ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3]; curr_cell.mv_ptr = &ctx->mc_vectors[*(ctx->next_cell_data++) << 1]; curr_cell.tree = 1; UPDATE_BITPOS(8); } else { if (!ctx->need_resync) ctx->next_cell_data = &ctx->gb.buffer[(get_bits_count(&ctx->gb) + 7) >> 3]; CHECK_CELL bytes_used = decode_cell(ctx, avctx, plane, &curr_cell, ctx->next_cell_data, ctx->last_byte); if (bytes_used < 0) return AVERROR_INVALIDDATA; UPDATE_BITPOS(bytes_used << 3); ctx->next_cell_data += bytes_used; return 0; } break; } } return 0; }
1threat
C++ template: The static member in a global object is not initialized : <p>I have a piece of simple C++ code, in which I defined a template and a global object by specializing the template. The object constructor accesses a static member in the specialized template. But it turns out the static member is not initialized at that point. But for a local object (defined in the body of a function), it works. I'm confused...</p> <p>My c++ compiler is: g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609</p> <pre><code>///////////////////////// template&lt;typename T&gt; class TB{ public: const char *_name; TB(const char * str):_name(str){ cout &lt;&lt; "constructor is called:" &lt;&lt; _name &lt;&lt; endl; }; virtual ~TB(){ cout &lt;&lt; "destructor is called:" &lt;&lt; _name &lt;&lt; endl; }; }; template&lt;typename T&gt; class TA{ public: const char *_name; TA(const char * str):_name(str){ cout &lt;&lt; "constructor is called:" &lt;&lt; _name &lt;&lt; endl; cout &lt;&lt; tb._name &lt;&lt;endl; }; virtual ~TA(){ cout &lt;&lt; "destructor is called:" &lt;&lt; _name &lt;&lt; endl; }; static TB&lt;T&gt; tb; }; template&lt;typename T&gt; TB&lt;T&gt; TA&lt;T&gt;::tb("static-tb"); TA&lt;int&gt; ta("global-ta"); int main(int argc,char ** argv){ cout &lt;&lt; "program started." &lt;&lt; endl; cout &lt;&lt; "program stopped." &lt;&lt; endl; return 0; } ///////////////////////// // OUTPUT: constructor is called:global-ta // yes, only such a single line. </code></pre> <p>If I put the definition of ta in main() like the following, it works.</p> <pre><code>int main(int argc,char ** argv){ cout &lt;&lt; "program started." &lt;&lt; endl; TA&lt;int&gt; ta("local-ta"); cout &lt;&lt; "program stopped." &lt;&lt; endl; return 0; } ///////////////////// // OUTPUT: constructor is called:static-tb program started. constructor is called:local-ta static-tb program stopped. destructor is called:local-ta destructor is called:static-tb // end of output </code></pre>
0debug
static uint32_t hpet_ram_readl(void *opaque, target_phys_addr_t addr) { HPETState *s = opaque; uint64_t cur_tick, index; DPRINTF("qemu: Enter hpet_ram_readl at %" PRIx64 "\n", addr); index = addr; if (index >= 0x100 && index <= 0x3ff) { uint8_t timer_id = (addr - 0x100) / 0x20; HPETTimer *timer = &s->timer[timer_id]; if (timer_id > s->num_timers) { DPRINTF("qemu: timer id out of range\n"); return 0; } switch ((addr - 0x100) % 0x20) { case HPET_TN_CFG: return timer->config; case HPET_TN_CFG + 4: return timer->config >> 32; case HPET_TN_CMP: return timer->cmp; case HPET_TN_CMP + 4: return timer->cmp >> 32; case HPET_TN_ROUTE: return timer->fsb; case HPET_TN_ROUTE + 4: return timer->fsb >> 32; default: DPRINTF("qemu: invalid hpet_ram_readl\n"); break; } } else { switch (index) { case HPET_ID: return s->capability; case HPET_PERIOD: return s->capability >> 32; case HPET_CFG: return s->config; case HPET_CFG + 4: DPRINTF("qemu: invalid HPET_CFG + 4 hpet_ram_readl \n"); return 0; case HPET_COUNTER: if (hpet_enabled(s)) { cur_tick = hpet_get_ticks(s); } else { cur_tick = s->hpet_counter; } DPRINTF("qemu: reading counter = %" PRIx64 "\n", cur_tick); return cur_tick; case HPET_COUNTER + 4: if (hpet_enabled(s)) { cur_tick = hpet_get_ticks(s); } else { cur_tick = s->hpet_counter; } DPRINTF("qemu: reading counter + 4 = %" PRIx64 "\n", cur_tick); return cur_tick >> 32; case HPET_STATUS: return s->isr; default: DPRINTF("qemu: invalid hpet_ram_readl\n"); break; } } return 0; }
1threat
static uint8_t send_read_command(void) { uint8_t drive = 0; uint8_t head = 0; uint8_t cyl = 0; uint8_t sect_addr = 1; uint8_t sect_size = 2; uint8_t eot = 1; uint8_t gap = 0x1b; uint8_t gpl = 0xff; uint8_t msr = 0; uint8_t st0; uint8_t ret = 0; floppy_send(CMD_READ); floppy_send(head << 2 | drive); g_assert(!get_irq(FLOPPY_IRQ)); floppy_send(cyl); floppy_send(head); floppy_send(sect_addr); floppy_send(sect_size); floppy_send(eot); floppy_send(gap); floppy_send(gpl); uint8_t i = 0; uint8_t n = 2; for (; i < n; i++) { msr = inb(FLOPPY_BASE + reg_msr); if (msr == 0xd0) { break; } sleep(1); } if (i >= n) { return 1; } st0 = floppy_recv(); if (st0 != 0x40) { ret = 1; } floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); floppy_recv(); return ret; }
1threat
Knowing how many repeat the letters in the String : <p>i have an interview Question which is Knowing repeat the letters in the String i solve it like this </p> <pre><code>String str = "my name is Java Developer"; int count = 0; for (int i = 0; i &lt; str.length(); i++) { for (int j = 0; j &lt; str.length(); j++) { if (str.charAt(i) == str.charAt(j)) { count = count + 1; } } System.out.print(count + " "); count = 0; } </code></pre> <p>but my problem was 1 - avoid the space from count 2-there is repeated character counted like m in 'my' and m in 'name' i don't want to repeat the count for the characters 3- i want to solve it in another way plus this one </p> <p>thank you ,,</p>
0debug
Why We Don't Need To Import the java.lang package to use the Integer Class(Wrapper Classes) In Java : <p>Suppose i want to make the object of an <strong>Integer</strong>(not int) Class,Since the Integer Class is in another package, i should have to import the java.lang package for creating the object of the <strong>Integer Class</strong>.But I didn't import the package ,yet compiler doesn't give me an error. </p>
0debug
create_iovec(QEMUIOVector *qiov, char **argv, int nr_iov, int pattern) { size_t *sizes = calloc(nr_iov, sizeof(size_t)); size_t count = 0; void *buf, *p; int i; for (i = 0; i < nr_iov; i++) { char *arg = argv[i]; long long len; len = cvtnum(arg); if (len < 0) { printf("non-numeric length argument -- %s\n", arg); return NULL; } if (len > UINT_MAX) { printf("too large length argument -- %s\n", arg); return NULL; } if (len & 0x1ff) { printf("length argument %lld is not sector aligned\n", len); return NULL; } sizes[i] = len; count += len; } qemu_iovec_init(qiov, nr_iov); buf = p = qemu_io_alloc(count, pattern); for (i = 0; i < nr_iov; i++) { qemu_iovec_add(qiov, p, sizes[i]); p += sizes[i]; } free(sizes); return buf; }
1threat
How to run the Go executable file generated after building the Go file? : <p>After I build the main.go file using <code>go build go.main</code>, I get the main executable file. How do I run the main file? If I do <code>go run main.go</code>, it automatically builds + runs the executable. But I want to know the command to run the already build executable file.</p>
0debug
What are scars useful for? : <p>In the paper titled "The Zipper" by Huet, he also mentions scars as a variation of zippers. Compared to zippers, which became pretty well known in the Haskell community, scars are pretty much unheard of. There is very little information about them in the paper itself and anywhere on the internet from what I could find.</p> <p>So I have to ask, are they just not useful at all or is there something they are useful for, but most people just don't know about them?</p>
0debug
How to convert subarray to an array without repeating the array value : Array ( [0] => Array ( [id] => 21153 [genre] => ["History","Drama", "Thriller"] ) [1] => Array ( [id] => 21152 [genre] => ["ACTION"] ) [2] => Array ( [id] => 21151 [genre] => ["ROMANTIC"] ) [3] => Array ( [id] => 21150 [genre] => ["Drama"] ) ) I have with the above array and I want to convert that array to an unique array as mentioned below, and there should be any duplicate values. Array( [History] => "History" [ACTION] => "ACTION" [ROMANTIC] => "ROMANTIC" [Drama] => "Drama" [Thriller]=>"Thriller" )
0debug
How to determine what version of python3 tkinter is installed on my linux machine? : <p>Hi have been scavenging the web for answers on how to do this but there was no direct answer. Does anyone know how I can find the version number of tkinter?</p>
0debug
Searh engine using url : Hey i started making site for songs. It is lyrics site and i wanted a search engine that works something like picture below. [Like this][1] [1]: https://i.stack.imgur.com/Z76qF.png anybody help?
0debug
static uint32_t uhci_ioport_readw(void *opaque, uint32_t addr) { UHCIState *s = opaque; uint32_t val; addr &= 0x1f; switch(addr) { case 0x00: val = s->cmd; break; case 0x02: val = s->status; break; case 0x04: val = s->intr; break; case 0x06: val = s->frnum; break; case 0x10 ... 0x1f: { UHCIPort *port; int n; n = (addr >> 1) & 7; if (n >= NB_PORTS) goto read_default; port = &s->ports[n]; val = port->ctrl; } break; default: read_default: val = 0xff7f; break; } #ifdef DEBUG printf("uhci readw port=0x%04x val=0x%04x\n", addr, val); #endif return val; }
1threat
Ranking list RecyclerView Android : <p>I'm pretty new to Android development. Want to ask how to make the first three rank special than others? For example, I will set a gold badge/icon for 1st rank, 2nd rank will be silver and so on? </p> <p><a href="https://i.stack.imgur.com/b6VxG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b6VxG.jpg" alt="enter image description here"></a></p>
0debug
static int spapr_populate_drconf_memory(sPAPRMachineState *spapr, void *fdt) { MachineState *machine = MACHINE(spapr); int ret, i, offset; uint64_t lmb_size = SPAPR_MEMORY_BLOCK_SIZE; uint32_t prop_lmb_size[] = {0, cpu_to_be32(lmb_size)}; uint32_t nr_lmbs = (machine->maxram_size - machine->ram_size)/lmb_size; uint32_t *int_buf, *cur_index, buf_len; int nr_nodes = nb_numa_nodes ? nb_numa_nodes : 1; buf_len = nr_lmbs * SPAPR_DR_LMB_LIST_ENTRY_SIZE * sizeof(uint32_t) + sizeof(uint32_t); cur_index = int_buf = g_malloc0(buf_len); offset = fdt_add_subnode(fdt, 0, "ibm,dynamic-reconfiguration-memory"); ret = fdt_setprop(fdt, offset, "ibm,lmb-size", prop_lmb_size, sizeof(prop_lmb_size)); if (ret < 0) { goto out; } ret = fdt_setprop_cell(fdt, offset, "ibm,memory-flags-mask", 0xff); if (ret < 0) { goto out; } ret = fdt_setprop_cell(fdt, offset, "ibm,memory-preservation-time", 0x0); if (ret < 0) { goto out; } int_buf[0] = cpu_to_be32(nr_lmbs); cur_index++; for (i = 0; i < nr_lmbs; i++) { sPAPRDRConnector *drc; sPAPRDRConnectorClass *drck; uint64_t addr = i * lmb_size + spapr->hotplug_memory.base;; uint32_t *dynamic_memory = cur_index; drc = spapr_dr_connector_by_id(SPAPR_DR_CONNECTOR_TYPE_LMB, addr/lmb_size); g_assert(drc); drck = SPAPR_DR_CONNECTOR_GET_CLASS(drc); dynamic_memory[0] = cpu_to_be32(addr >> 32); dynamic_memory[1] = cpu_to_be32(addr & 0xffffffff); dynamic_memory[2] = cpu_to_be32(drck->get_index(drc)); dynamic_memory[3] = cpu_to_be32(0); dynamic_memory[4] = cpu_to_be32(numa_get_node(addr, NULL)); if (addr < machine->ram_size || memory_region_present(get_system_memory(), addr)) { dynamic_memory[5] = cpu_to_be32(SPAPR_LMB_FLAGS_ASSIGNED); } else { dynamic_memory[5] = cpu_to_be32(0); } cur_index += SPAPR_DR_LMB_LIST_ENTRY_SIZE; } ret = fdt_setprop(fdt, offset, "ibm,dynamic-memory", int_buf, buf_len); if (ret < 0) { goto out; } cur_index = int_buf; int_buf[0] = cpu_to_be32(nr_nodes); int_buf[1] = cpu_to_be32(4); cur_index += 2; for (i = 0; i < nr_nodes; i++) { uint32_t associativity[] = { cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(0x0), cpu_to_be32(i) }; memcpy(cur_index, associativity, sizeof(associativity)); cur_index += 4; } ret = fdt_setprop(fdt, offset, "ibm,associativity-lookup-arrays", int_buf, (cur_index - int_buf) * sizeof(uint32_t)); out: g_free(int_buf); return ret; }
1threat
How to prevent CMake from issuing /IMPLIB : <p>I have a CMake build that sends /IMPLIB to the linker on Windows. This is a problem in my case because the argument to implib is the same path as one of the input files. It looks to me that CMake will <em>always</em> issue /IMPLIB when building with Visual Studio, and the passed argument cannot be modified. Is there a way to control this behaviour?</p>
0debug
static int vc1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size, n_slices = 0, i, ret; VC1Context *v = avctx->priv_data; MpegEncContext *s = &v->s; AVFrame *pict = data; uint8_t *buf2 = NULL; const uint8_t *buf_start = buf; int mb_height, n_slices1; struct { uint8_t *buf; GetBitContext gb; int mby_start; } *slices = NULL, *tmp; if (buf_size == 0 || (buf_size == 4 && AV_RB32(buf) == VC1_CODE_ENDOFSEQ)) { if (s->low_delay == 0 && s->next_picture_ptr) { if ((ret = av_frame_ref(pict, s->next_picture_ptr->f)) < 0) return ret; s->next_picture_ptr = NULL; *got_frame = 1; } return 0; } if (avctx->codec_id == AV_CODEC_ID_VC1 || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { int buf_size2 = 0; buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (IS_MARKER(AV_RB32(buf))) { const uint8_t *start, *end, *next; int size; next = buf; for (start = buf, end = buf + buf_size; next < end; start = next) { next = find_next_marker(start + 4, end); size = next - start - 4; if (size <= 0) continue; switch (AV_RB32(start)) { case VC1_CODE_FRAME: if (avctx->hwaccel) buf_start = start; buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); break; case VC1_CODE_FIELD: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; break; } case VC1_CODE_ENTRYPOINT: buf_size2 = vc1_unescape_buffer(start + 4, size, buf2); init_get_bits(&s->gb, buf2, buf_size2 * 8); ff_vc1_decode_entry_point(avctx, v, &s->gb); break; case VC1_CODE_SLICE: { int buf_size3; tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(start + 4, size, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = get_bits(&slices[n_slices].gb, 9); n_slices++; break; } } } } else if (v->interlace && ((buf[0] & 0xC0) == 0xC0)) { const uint8_t *divider; int buf_size3; divider = find_next_marker(buf, buf + buf_size); if ((divider == (buf + buf_size)) || AV_RB32(divider) != VC1_CODE_FIELD) { av_log(avctx, AV_LOG_ERROR, "Error in WVC1 interlaced frame\n"); goto err; } else { tmp = av_realloc(slices, sizeof(*slices) * (n_slices+1)); if (!tmp) goto err; slices = tmp; slices[n_slices].buf = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!slices[n_slices].buf) goto err; buf_size3 = vc1_unescape_buffer(divider + 4, buf + buf_size - divider - 4, slices[n_slices].buf); init_get_bits(&slices[n_slices].gb, slices[n_slices].buf, buf_size3 << 3); slices[n_slices].mby_start = s->mb_height >> 1; n_slices1 = n_slices - 1; n_slices++; } buf_size2 = vc1_unescape_buffer(buf, divider - buf, buf2); } else { buf_size2 = vc1_unescape_buffer(buf, buf_size, buf2); } init_get_bits(&s->gb, buf2, buf_size2*8); } else init_get_bits(&s->gb, buf, buf_size*8); if (v->res_sprite) { v->new_sprite = !get_bits1(&s->gb); v->two_sprites = get_bits1(&s->gb); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { if (v->new_sprite) { avctx->width = avctx->coded_width = v->sprite_width; avctx->height = avctx->coded_height = v->sprite_height; } else { goto image; } } } if (s->context_initialized && (s->width != avctx->coded_width || s->height != avctx->coded_height)) { ff_vc1_decode_end(avctx); } if (!s->context_initialized) { if (ff_msmpeg4_decode_init(avctx) < 0) goto err; if (ff_vc1_decode_init_alloc_tables(v) < 0) { ff_mpv_common_end(s); goto err; } s->low_delay = !avctx->has_b_frames || v->res_sprite; if (v->profile == PROFILE_ADVANCED) { s->h_edge_pos = avctx->coded_width; s->v_edge_pos = avctx->coded_height; } } v->pic_header_flag = 0; v->first_pic_header_flag = 1; if (v->profile < PROFILE_ADVANCED) { if (ff_vc1_parse_frame_header(v, &s->gb) < 0) { goto err; } } else { if (ff_vc1_parse_frame_header_adv(v, &s->gb) < 0) { goto err; } } v->first_pic_header_flag = 0; if ((avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) && s->pict_type != AV_PICTURE_TYPE_I) { av_log(v->s.avctx, AV_LOG_ERROR, "Sprite decoder: expected I-frame\n"); goto err; } s->current_picture.f->pict_type = s->pict_type; s->current_picture.f->key_frame = s->pict_type == AV_PICTURE_TYPE_I; if (s->last_picture_ptr == NULL && (s->pict_type == AV_PICTURE_TYPE_B || s->droppable)) { goto end; } if ((avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == AV_PICTURE_TYPE_B) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) { goto end; } if (s->next_p_frame_damaged) { if (s->pict_type == AV_PICTURE_TYPE_B) goto end; else s->next_p_frame_damaged = 0; } if (ff_mpv_frame_start(s, avctx) < 0) { goto err; } s->current_picture_ptr->f->repeat_pict = 0; if (v->rff) { s->current_picture_ptr->f->repeat_pict = 1; } else if (v->rptfrm) { s->current_picture_ptr->f->repeat_pict = v->rptfrm * 2; } s->me.qpel_put = s->qdsp.put_qpel_pixels_tab; s->me.qpel_avg = s->qdsp.avg_qpel_pixels_tab; if (avctx->hwaccel) { if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0) goto err; if (avctx->hwaccel->decode_slice(avctx, buf_start, (buf + buf_size) - buf_start) < 0) goto err; if (avctx->hwaccel->end_frame(avctx) < 0) goto err; } else { int header_ret = 0; ff_mpeg_er_frame_start(s); v->bits = buf_size * 8; v->end_mb_x = s->mb_width; if (v->field_mode) { s->current_picture.f->linesize[0] <<= 1; s->current_picture.f->linesize[1] <<= 1; s->current_picture.f->linesize[2] <<= 1; s->linesize <<= 1; s->uvlinesize <<= 1; } mb_height = s->mb_height >> v->field_mode; if (!mb_height) { av_log(v->s.avctx, AV_LOG_ERROR, "Invalid mb_height.\n"); goto err; } for (i = 0; i <= n_slices; i++) { if (i > 0 && slices[i - 1].mby_start >= mb_height) { if (v->field_mode <= 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice %d starts beyond " "picture boundary (%d >= %d)\n", i, slices[i - 1].mby_start, mb_height); continue; } v->second_field = 1; v->blocks_off = s->mb_width * s->mb_height << 1; v->mb_off = s->mb_stride * s->mb_height >> 1; } else { v->second_field = 0; v->blocks_off = 0; v->mb_off = 0; } if (i) { v->pic_header_flag = 0; if (v->field_mode && i == n_slices1 + 2) { if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Field header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } else if (get_bits1(&s->gb)) { v->pic_header_flag = 1; if ((header_ret = ff_vc1_parse_frame_header_adv(v, &s->gb)) < 0) { av_log(v->s.avctx, AV_LOG_ERROR, "Slice header damaged\n"); if (avctx->err_recognition & AV_EF_EXPLODE) goto err; continue; } } } if (header_ret < 0) continue; s->start_mb_y = (i == 0) ? 0 : FFMAX(0, slices[i-1].mby_start % mb_height); if (!v->field_mode || v->second_field) s->end_mb_y = (i == n_slices ) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); else s->end_mb_y = (i <= n_slices1 + 1) ? mb_height : FFMIN(mb_height, slices[i].mby_start % mb_height); ff_vc1_decode_blocks(v); if (i != n_slices) s->gb = slices[i].gb; } if (v->field_mode) { v->second_field = 0; s->current_picture.f->linesize[0] >>= 1; s->current_picture.f->linesize[1] >>= 1; s->current_picture.f->linesize[2] >>= 1; s->linesize >>= 1; s->uvlinesize >>= 1; if (v->s.pict_type != AV_PICTURE_TYPE_BI && v->s.pict_type != AV_PICTURE_TYPE_B) { FFSWAP(uint8_t *, v->mv_f_next[0], v->mv_f[0]); FFSWAP(uint8_t *, v->mv_f_next[1], v->mv_f[1]); } } av_dlog(s->avctx, "Consumed %i/%i bits\n", get_bits_count(&s->gb), s->gb.size_in_bits); if (!v->field_mode) ff_er_frame_end(&s->er); } ff_mpv_frame_end(s); if (avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || avctx->codec_id == AV_CODEC_ID_VC1IMAGE) { image: avctx->width = avctx->coded_width = v->output_width; avctx->height = avctx->coded_height = v->output_height; if (avctx->skip_frame >= AVDISCARD_NONREF) goto end; #if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER if (vc1_decode_sprites(v, &s->gb)) goto err; #endif if ((ret = av_frame_ref(pict, v->sprite_output_frame)) < 0) goto err; *got_frame = 1; } else { if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) { if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->current_picture_ptr); *got_frame = 1; } else if (s->last_picture_ptr != NULL) { if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0) goto err; ff_print_debug_info(s, s->last_picture_ptr); *got_frame = 1; } } end: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return buf_size; err: av_free(buf2); for (i = 0; i < n_slices; i++) av_free(slices[i].buf); av_free(slices); return -1; }
1threat
static void qmp_deserialize(void **native_out, void *datap, VisitorFunc visit, Error **errp) { QmpSerializeData *d = datap; QString *output_json; QObject *obj_orig, *obj; obj_orig = qmp_output_get_qobject(d->qov); output_json = qobject_to_json(obj_orig); obj = qobject_from_json(qstring_get_str(output_json)); QDECREF(output_json); d->qiv = qmp_input_visitor_new(obj, true); qobject_decref(obj_orig); qobject_decref(obj); visit(d->qiv, native_out, errp); }
1threat
All rows getting update in sql server : I am trying to update a single row but found all rows are getting update. Stucted since morning. Idon't want to use datatable also create proc [dbo].[spUserProfile] @FirstName nvarchar(50), @MiddleName nvarchar(50), @LastName nvarchar(50), @Mobile nvarchar(50), @Aadhar nvarchar(50), @PAN nvarchar(50), @Address text, @CityID int, @PinCode int, @StateID int, @CountryID int AS Begin update tblUserProfiles Set FirstName = @FirstName, MiddleName = @MiddleName, LastName = @LastName, Mobile = @Mobile, Aadhar = @Aadhar, PAN = @PAN, Address = @Address, CityID = @CityID, PinCode = @PinCode, StateID = @StateID, CountryID = @CountryID, UserID = UserId End please give me a solution to me and error what i am missing
0debug
Setting differnet onclick listener to each button in recyclerview : hi im making a cheats app which have cheat codes for a game (gtav) how can i set a differen onclicklistener to each button in reyclerview for example i have a button in recycleview called copytoclip board and i want each button in the recycler view to copy a different text how can i do that? **recycler_view_list** <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="true" android:paddingLeft="16dp" android:paddingRight="16dp" android:paddingTop="10dp" android:paddingBottom="10dp" android:clickable="true" android:background="?android:attr/selectableItemBackground" android:orientation="vertical"> <TextView android:id="@+id/title" android:textSize="16dp" android:textStyle="bold" android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/cheat" android:layout_below="@id/title" android:layout_width="match_parent" android:layout_height="wrap_content" /> <TextView android:id="@+id/description" android:layout_below="@+id/cheat" android:layout_gravity="bottom" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Copy" android:id="@+id/cpytocp" android:layout_gravity="top|right" /> </LinearLayout> **list** public class Cheats { private String title, cheat, description; public Cheats(){ } public Cheats( String title, String cheat, String description){ this.title = title; this.cheat = cheat; this.description = description; } public String getTitle(){ return title; } public void setTitle(String name){ this.title = name; } public String getCheat(){ return cheat; } public void setCheat(String cheat){ this.cheat = cheat; } public String getDescription(){ return description; } public void setDescription(String description) { this.description = description; } } **adapter** `public class CheatsAdapter extends` `RecyclerView.Adapter`<CheatsAdapter.MyViewHolder> `{` private List<Cheats> cheatList; public class MyViewHolder extends RecyclerView.ViewHolder{ public TextView title, cheat, description; public MyViewHolder(View view){ super(view); title = (TextView)view.findViewById(R.id.title); cheat = (TextView) view.findViewById(R.id.cheat); description = (TextView) view.findViewById(R.id.description); } } public CheatsAdapter(List<Cheats> cheatList){ this.cheatList = cheatList; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType){ View itemView = LayoutInflater.from(parent.getContext()) .inflate(R.layout.cheat_list, parent, false); return new MyViewHolder(itemView); } @Override public void onBindViewHolder(MyViewHolder holder, int position) { Cheats cheats = cheatList.get(position); holder.title.setText(cheats.getTitle()); holder.cheat.setText(cheats.getCheat()); holder.description.setText(cheats.getDescription()); } @Override public int getItemCount(){ return cheatList.size(); } }
0debug
Shopify - Add new custom tab to product detail page : <p>I have a Shopify based website. On my product details page I have 3 tabs already one that shows the product description the other that shows website shipping info and a third that shows the customer reviews for the product. However I need to add a new column called "care" and I would then need to when creating/editing a product within the Shopify admin to be able to enter in the products unique care information that is unique to each product. </p> <p>I found this tutorial but it was not helpful in how to add a new content to a product <a href="https://help.shopify.com/themes/customization/products/add-tabs-to-product-descriptions" rel="nofollow noreferrer">https://help.shopify.com/themes/customization/products/add-tabs-to-product-descriptions</a></p> <p>Any suggested tutorials that would help me? I am comfortable with html and even php I just do not know what files to edit. The site has jquery already installed and bootstrap.</p> <p>thanks</p>
0debug
How do I convert string to list in Python? : <p>How do I convert <strong><em>def stringParametre(x)</em></strong> x to a list so that if x is hello then it will become a list like ["H","E","l","l","O"] . Capitals don't matter .</p>
0debug
Is there a way to keep screen awake in a progressive-web-app? : <p>I plan to make a progressive web app to display the time remaining in a meeting. I need this to keep the display always on. Is there any way for a progressive web app to avoid screen to go to sleep and blank ?</p>
0debug
static void probe_group_enter(const char *name, int type) { int64_t count = -1; octx.prefix = av_realloc(octx.prefix, sizeof(PrintElement) * (octx.level + 1)); if (!octx.prefix || !name) { fprintf(stderr, "Out of memory\n"); exit(1); } if (octx.level) { PrintElement *parent = octx.prefix + octx.level -1; if (parent->type == ARRAY) count = parent->nb_elems; parent->nb_elems++; } octx.prefix[octx.level++] = (PrintElement){name, type, count, 0}; }
1threat
CSS. Non rectangular rectangle : I'm currently doing some, atleast for me, advanced CSS. I want to make a rectangle (preferable without using canvas) that looks somewhat like the image below. The blue box is what i want to make. [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/ZO7Uj.png
0debug
static int get_phys_addr_mpu(CPUARMState *env, uint32_t address, int access_type, int is_user, hwaddr *phys_ptr, int *prot) { int n; uint32_t mask; uint32_t base; *phys_ptr = address; for (n = 7; n >= 0; n--) { base = env->cp15.c6_region[n]; if ((base & 1) == 0) continue; mask = 1 << ((base >> 1) & 0x1f); mask = (mask << 1) - 1; if (((base ^ address) & ~mask) == 0) break; } if (n < 0) return 2; if (access_type == 2) { mask = env->cp15.c5_insn; } else { mask = env->cp15.c5_data; } mask = (mask >> (n * 4)) & 0xf; switch (mask) { case 0: return 1; case 1: if (is_user) return 1; *prot = PAGE_READ | PAGE_WRITE; break; case 2: *prot = PAGE_READ; if (!is_user) *prot |= PAGE_WRITE; break; case 3: *prot = PAGE_READ | PAGE_WRITE; break; case 5: if (is_user) return 1; *prot = PAGE_READ; break; case 6: *prot = PAGE_READ; break; default: return 1; } *prot |= PAGE_EXEC; return 0; }
1threat
I am trying to make a little game in python but somethings not working : <p>This is the code:</p> <pre><code>secret_number = 7 guess = input("What number am i thinking of?") if secret_number == guess: print("Yay you got it") else: print("No that's not it") </code></pre> <p>When I run the code I always get "No that's not it" even if I guessed the right number.</p>
0debug
Wierd Error I recieve from Tkinter in Python, I have no idea : So, I was going to attempt to make a tkinter project but as i tried to run for like the third time it gives me this error: Traceback (most recent call last): File "/Users/cool/Documents/STM Wisepay Service.py", line 63, in <module> app = App(root) File "/Users/cool/Documents/STM Wisepay Service.py", line 20, in __init__ self.create_buttons() File "/Users/cool/Documents/STM Wisepay Service.py", line 30, in create_buttons tk.Button(button_frame, text = "Add to Debt", commmand = self.debt).grid(column = 6, row = 5) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 2366, in __init__ Widget.__init__(self, master, 'button', cnf, kw) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/tkinter/__init__.py", line 2296, in __init__ (widgetName, self._w) + extra + self._options(cnf)) _tkinter.TclError: unknown option "-commmand" What can I do to fix this? What are the problems with my code? Here is my code: https://pastebin.com/mWPEFbpz
0debug
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; int64_t max_frames = INT64_MAX; char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; char *buf = NULL, *arg = NULL, *preset = NULL; AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); exit_program(1); } if (oc->nb_streams - 1 < o->nb_streamid_map) st->id = o->streamid_map[oc->nb_streams - 1]; output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; ost->file_index = nb_output_files; ost->index = idx; ost->st = st; st->codec->codec_type = type; ost->enc = choose_codec(o, oc, st, type); if (ost->enc) { ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st); } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { do { buf = get_line(s); if (!buf[0] || buf[0] == '#') { av_free(buf); continue; } if (!(arg = strchr(buf, '='))) { av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); exit_program(1); } *arg++ = 0; av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); av_free(buf); } while (!s->eof_reached); avio_close(s); } if (ret) { av_log(NULL, AV_LOG_FATAL, "Preset %s specified for stream %d:%d, but could not be opened.\n", preset, ost->file_index, ost->index); exit_program(1); } MATCH_PER_STREAM_OPT(max_frames, i64, max_frames, oc, st); ost->max_frames = max_frames; MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { if (next = strchr(bsf, ',')) *next++ = 0; if (!(bsfc = av_bitstream_filter_init(bsf))) { av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf); exit_program(1); } if (bsfc_prev) bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; bsfc_prev = bsfc; bsf = next; } MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st); if (codec_tag) { uint32_t tag = strtol(codec_tag, &next, 0); if (*next) tag = AV_RL32(codec_tag); st->codec->codec_tag = tag; } MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st); if (qscale >= 0 || same_quant) { st->codec->flags |= CODEC_FLAG_QSCALE; st->codec->global_quality = FF_QP2LAMBDA * qscale; } if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; }
1threat
static void smp_parse(QemuOpts *opts) { if (opts) { unsigned cpus = qemu_opt_get_number(opts, "cpus", 0); unsigned sockets = qemu_opt_get_number(opts, "sockets", 0); unsigned cores = qemu_opt_get_number(opts, "cores", 0); unsigned threads = qemu_opt_get_number(opts, "threads", 0); if (cpus == 0 || sockets == 0) { sockets = sockets > 0 ? sockets : 1; cores = cores > 0 ? cores : 1; threads = threads > 0 ? threads : 1; if (cpus == 0) { cpus = cores * threads * sockets; } } else if (cores == 0) { threads = threads > 0 ? threads : 1; cores = cpus / (sockets * threads); } else if (threads == 0) { threads = cpus / (cores * sockets); } else if (sockets * cores * threads < cpus) { error_report("cpu topology: " "sockets (%u) * cores (%u) * threads (%u) < " "smp_cpus (%u)", sockets, cores, threads, cpus); exit(1); } max_cpus = qemu_opt_get_number(opts, "maxcpus", cpus); if (sockets * cores * threads > max_cpus) { error_report("cpu topology: " "sockets (%u) * cores (%u) * threads (%u) > " "maxcpus (%u)", sockets, cores, threads, max_cpus); exit(1); } smp_cpus = cpus; smp_cores = cores > 0 ? cores : 1; smp_threads = threads > 0 ? threads : 1; } if (max_cpus == 0) { max_cpus = smp_cpus; } if (max_cpus > MAX_CPUMASK_BITS) { error_report("unsupported number of maxcpus"); exit(1); } if (max_cpus < smp_cpus) { error_report("maxcpus must be equal to or greater than smp"); exit(1); } if (smp_cpus > 1 || smp_cores > 1 || smp_threads > 1) { Error *blocker = NULL; error_setg(&blocker, QERR_REPLAY_NOT_SUPPORTED, "smp"); replay_add_blocker(blocker); } }
1threat
registration form validate username before press Register : <p>my site running on php I like to add registration users form, with unique username.How make validation username before sending request to DB " Press Registration".</p>
0debug
Is there any way to set environment variables in Visual Studio Code? : <p>Could you please help me, how to setup environment variables in visual studio code?</p>
0debug
Modifying a @FetchRequest : <p>Xcode beta 5 introduced <code>@FetchRequest</code> for SwiftUI.</p> <p>I have a View, which has a <code>@FetchRequest</code>. The <code>NSFetchRequest</code> is created within a manager that makes a static instance of itself available to property wrappers (they cannot use self). The same instance is passed to the view at creation. </p> <p>What I want is for the <code>FetchRequest</code> to be updated, when <code>self.manager.reverse.toggle()</code> is called, in order for the view to change its ordering of objects. Unfortunately it seems like <code>Manager.fetchRequest()</code> is only called once and then never again, even when I create new objects and transition between different views. </p> <p>I am looking for suggestions on how to modify a fetch request that is made with the new property wrapper, so that I can resort my objects based on user actions.</p> <pre class="lang-swift prettyprint-override"><code>struct MainView: some View { @ObservedObject var manager: Manager @FetchRequest(fetchRequest: Manager.shared.fetchRequest()) var ts: FetchedResults var body: some View { NavigationView { List(ts, id: \.self) { t in Text(t.name) } }.navigationBarItems(trailing: Button(action: { self.manager.reverse.toggle() }) { Text("Reverse")} } } final class Manager: ObservableObject { @Published var reverse: Bool = false // Since property wrappers cannot use self, we make a shared instance // available statically. This same instance is also given to the view. public static let shared = Manager() func fetchRequest(reverse: Bool = false) -&gt; NSFetchRequest&lt;T&gt; { let request: NSFetchRequest&lt;T&gt; = T.fetchRequest() request.sortDescriptors = [ NSSortDescriptor( key: "name", ascending: !self.reverse ) ] return request } } </code></pre>
0debug
av_cold void ff_vp8dsp_init(VP8DSPContext *dsp) { dsp->vp8_luma_dc_wht = vp8_luma_dc_wht_c; dsp->vp8_luma_dc_wht_dc = vp8_luma_dc_wht_dc_c; dsp->vp8_idct_add = vp8_idct_add_c; dsp->vp8_idct_dc_add = vp8_idct_dc_add_c; dsp->vp8_idct_dc_add4y = vp8_idct_dc_add4y_c; dsp->vp8_idct_dc_add4uv = vp8_idct_dc_add4uv_c; dsp->vp8_v_loop_filter16y = vp8_v_loop_filter16_c; dsp->vp8_h_loop_filter16y = vp8_h_loop_filter16_c; dsp->vp8_v_loop_filter8uv = vp8_v_loop_filter8uv_c; dsp->vp8_h_loop_filter8uv = vp8_h_loop_filter8uv_c; dsp->vp8_v_loop_filter16y_inner = vp8_v_loop_filter16_inner_c; dsp->vp8_h_loop_filter16y_inner = vp8_h_loop_filter16_inner_c; dsp->vp8_v_loop_filter8uv_inner = vp8_v_loop_filter8uv_inner_c; dsp->vp8_h_loop_filter8uv_inner = vp8_h_loop_filter8uv_inner_c; dsp->vp8_v_loop_filter_simple = vp8_v_loop_filter_simple_c; dsp->vp8_h_loop_filter_simple = vp8_h_loop_filter_simple_c; VP8_MC_FUNC(0, 16); VP8_MC_FUNC(1, 8); VP8_MC_FUNC(2, 4); VP8_BILINEAR_MC_FUNC(0, 16); VP8_BILINEAR_MC_FUNC(1, 8); VP8_BILINEAR_MC_FUNC(2, 4); if (ARCH_ARM) ff_vp8dsp_init_arm(dsp); if (ARCH_PPC) ff_vp8dsp_init_ppc(dsp); if (ARCH_X86) ff_vp8dsp_init_x86(dsp); }
1threat
import emails from outlook 2013 with exchange server with excel vba : This is regarding import emails from outlook 2013 code works perfectly with home desktop as outlook 2013 is connected to SMTP/POP server...but the same code does not work in my office as outlook 2013 is connected exchange server.. **Error at .Senderemailaddress** Many thanks
0debug
How to disable widget tree printing in flutter CLI (Pressing "T" key accidently is annoying) : <p>I accidentally press the key "T" in terminal when I reach to "R" to hot reload and always my app's widget tree is printed and it takes minutes to finish so It annoyes me so much. I really need to turn this feature off if it's possible but I don't know how.</p>
0debug
Which number appeared once? : <blockquote> <p>Given a list of 2n-1 numbers: all between 1 to n, all but one occur twice. Determine the number that occurs only once. Multiple ways preferred. </p> </blockquote> <p>I think the problem is at fault, how can you determine which number without knowing the list of numbers?</p>
0debug
static int qemu_rdma_source_init(RDMAContext *rdma, Error **errp, bool pin_all) { int ret, idx; Error *local_err = NULL, **temp = &local_err; rdma->pin_all = pin_all; ret = qemu_rdma_resolve_host(rdma, temp); if (ret) { goto err_rdma_source_init; } ret = qemu_rdma_alloc_pd_cq(rdma); if (ret) { ERROR(temp, "rdma migration: error allocating pd and cq! Your mlock()" " limits may be too low. Please check $ ulimit -a # and " "search for 'ulimit -l' in the output"); goto err_rdma_source_init; } ret = qemu_rdma_alloc_qp(rdma); if (ret) { ERROR(temp, "rdma migration: error allocating qp!"); goto err_rdma_source_init; } ret = qemu_rdma_init_ram_blocks(rdma); if (ret) { ERROR(temp, "rdma migration: error initializing ram blocks!"); goto err_rdma_source_init; } for (idx = 0; idx < RDMA_WRID_MAX; idx++) { ret = qemu_rdma_reg_control(rdma, idx); if (ret) { ERROR(temp, "rdma migration: error registering %d control!", idx); goto err_rdma_source_init; } } return 0; err_rdma_source_init: error_propagate(errp, local_err); qemu_rdma_cleanup(rdma); return -1; }
1threat
The result of php code is wrong? : When i tried to code a simple php code, i had a problem that the result had showed some things which weren't expected such as "***' . "\n"; echo'*** ". Where is my code wrong? Here is my code: <html> <head> <title>Putting Data in the DB</title> </head> <body> <?php /*insert students into DB*/ if(isset($_POST["submit"])) { $db = mysql_connect("mysql", "martin"); mysql_select_db("martin"); $date=date("Y-m-d"); /* Get the current date in the right SQL format */ $sql="INSERT INTO students VALUES(NULL,'" . $_POST["f_name"] . "','" . $_POST["l_name"] . "'," . $_POST["student_id"] . ",'" . $_POST["email"] . "','" . $date . "'," . $_POST["gr"] . ")"; /* construct the query */ mysql_query($sql); /* execute the query */ mysql_close(); echo"<h3>Thank you. The data has been entered.</h3> \n"; echo'<p><a href="data_in.php">Back to registration</a></p>' . "\n"; echo'<p><a href="data_out.php">View the student lists</a></p>' ."\n"; } <html> <head> <title>Putting Data in the DB</title> </head> <body> <?php /*insert students into DB*/ if(isset($_POST["submit"])) { $db = mysql_connect("mysql", "martin"); mysql_select_db("martin"); $date=date("Y-m-d"); /* Get the current date in the right SQL format */ $sql="INSERT INTO students VALUES(NULL,'" . $_POST["f_name"] . "','" . $_POST["l_name"] . "'," . $_POST["student_id"] . ",'" . $_POST["email"] . "','" . $date . "'," . $_POST["gr"] . ")"; /* construct the query */ mysql_query($sql); /* execute the query */ mysql_close(); echo"<h3>Thank you. The data has been entered.</h3> \n"; echo'<p><a href="data_in.php">Back to registration</a></p>' . "\n"; echo'<p><a href="data_out.php">View the student lists</a></p>' ."\n"; } Result is here: > Thank you. The data has been entered. \n"; echo' Back to registration > > ' . "\n"; echo' View the student lists > > ' ."\n"; } Thank you. The data has been entered. \n"; echo' Back to > registration > > ' . "\n"; echo' View the student lists > > ' ."\n"; }
0debug
Time complexity of typecasting dictionary to list in Python : <p>If we have a dictionary with 'n' key-value pairs, then, does typecasting it to a list a linear time operation (i.e. O(n))?</p>
0debug
The Current .Net SDK does not support targeting .Net Core 2.2 Target .Net Core 2.1 or Lower : <p>I have some projects in the preview version of .net core 2.2 preview 3. It was working fine until i updated my VS Studio Community Edition to Version 15.9.2. After that targeting .net core 2.2 preview is no longer possible. When i do <code>dotnet --list-sdks</code> I get a list of the SDKs installed including 2.2.100-preview3.</p> <p><a href="https://i.stack.imgur.com/esQ3h.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/esQ3h.gif" alt="SDKs Installed"></a></p> <p>After updating VS Studio, the list now only shows <a href="https://i.stack.imgur.com/OTYqP.png" rel="noreferrer"><img src="https://i.stack.imgur.com/OTYqP.png" alt="VS Set Target Framework"></a></p> <p>I have followed similar questions but could not resolve the issue. Any pointers?</p>
0debug
Make SQL query fail on trying to delete non-existent record : <p>Is there standard SQL syntax for causing query to fail when a query tries to delete a non-existent entity? E.g.</p> <pre><code>DELETE FROM entity WHERE id = 501; </code></pre> <p>does not fail, even when there is no entity with id = 501. Can it be done in cross-database way?</p>
0debug
static int enable_write_target(BDRVVVFATState *s, Error **errp) { BlockDriver *bdrv_qcow = NULL; QemuOpts *opts = NULL; int ret; int size = sector2cluster(s, s->sector_count); s->used_clusters = calloc(size, 1); array_init(&(s->commits), sizeof(commit_t)); s->qcow_filename = g_malloc(1024); ret = get_tmp_filename(s->qcow_filename, 1024); if (ret < 0) { error_setg_errno(errp, -ret, "can't create temporary file"); goto err; } bdrv_qcow = bdrv_find_format("qcow"); if (!bdrv_qcow) { error_setg(errp, "Failed to locate qcow driver"); ret = -ENOENT; goto err; } opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort); qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512); qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:"); ret = bdrv_create(bdrv_qcow, s->qcow_filename, opts, errp); qemu_opts_del(opts); if (ret < 0) { goto err; } s->qcow = NULL; ret = bdrv_open(&s->qcow, s->qcow_filename, NULL, NULL, BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, bdrv_qcow, errp); if (ret < 0) { goto err; } #ifndef _WIN32 unlink(s->qcow_filename); #endif bdrv_set_backing_hd(s->bs, bdrv_new()); s->bs->backing_hd->drv = &vvfat_write_target; s->bs->backing_hd->opaque = g_new(void *, 1); *(void**)s->bs->backing_hd->opaque = s; return 0; err: g_free(s->qcow_filename); s->qcow_filename = NULL; return ret; }
1threat
Javascript for loop with if statement not reaching the else if statement : <p>why wont this reach the else if and return (i + 0) / 2? Also, why wont the alert give me i + 0 for a 2 digit value? (ie: 10, 20, 30, 40, etc. Any help would be appreciated.</p> <pre><code>var key= "OSN0MSA9991UNAAM8ELDPBD9F57BD6PU6BVBN54CDLEGDSUSNS"; var x = 0; if (key[20] != "P" || key[18] != "P") { x = 0; for (i=0;i&lt;10;i++) { if (key[26] == i) { x = i + 0; alert(x); } }; } else if (key[20] == "P") { for (i=9;i&gt;-1;i--) { if (key[26] == i) { x = (i + 0) / 2; alert(x); } }; }; </code></pre>
0debug
What's the difference between MySQLdb, mysqlclient and MySQL connector/Python? : <p>So I've been trying to do some database update with python and while setting up the whole dev environment, I came across these three things which made me dizzy.</p> <ol> <li><p>There's <a href="http://mysql-python.sourceforge.net/MySQLdb.html" rel="noreferrer">MySQLdb</a></p></li> <li><p>There's <a href="https://pypi.python.org/pypi/mysqlclient" rel="noreferrer">mysqlclient</a></p></li> <li>And then there's a <a href="https://dev.mysql.com/doc/connector-python/en/" rel="noreferrer">mysql connector python</a></li> </ol> <p>What's each of them, the difference and where to use them? Thanks</p>
0debug
Scala | operator '=>' and other these types of operator : <p>can some help me to under stand this code and operator types used or may be used here</p> <pre><code>def times [A](f: =&gt;A): Unit={ def loop(current: Int): Unit= if(current &gt; 0){ f loop(current - 1) } loop(x) } </code></pre>
0debug
i want play video through url of you tube in android application plz help me? : i want play video through url of you tube in android application plz help me??i want play video Using Video View .
0debug
static int qemu_rdma_close(void *opaque) { DPRINTF("Shutting down connection.\n"); QEMUFileRDMA *r = opaque; if (r->rdma) { qemu_rdma_cleanup(r->rdma); g_free(r->rdma); } g_free(r); return 0; }
1threat
static bool release_pending(sPAPRDRConnector *drc) { return drc->awaiting_release; }
1threat
static BlockBackend *img_open_file(const char *filename, QDict *options, const char *fmt, int flags, bool writethrough, bool quiet, bool force_share) { BlockBackend *blk; Error *local_err = NULL; if (!options) { options = qdict_new(); } if (fmt) { qdict_put_str(options, "driver", fmt); } if (force_share) { qdict_put_bool(options, BDRV_OPT_FORCE_SHARE, true); } blk = blk_new_open(filename, NULL, options, flags, &local_err); if (!blk) { error_reportf_err(local_err, "Could not open '%s': ", filename); return NULL; } blk_set_enable_write_cache(blk, !writethrough); if (img_open_password(blk, filename, flags, quiet) < 0) { blk_unref(blk); return NULL; } return blk; }
1threat
Elasticsearch :found jar hell in test classpath : <p>I want to perform unit testing in Elasticsearch for that I am using <code>Java-test-framework</code><br> I am using <code>Elasticsearch-1.6.0</code> and referring to these link for help <a href="https://www.elastic.co/guide/en/elasticsearch/reference/1.6/using-elasticsearch-test-classes.html" rel="noreferrer">https://www.elastic.co/guide/en/elasticsearch/reference/1.6/using-elasticsearch-test-classes.html</a> <a href="https://github.com/elastic/elasticsearch/blob/master/core/src/test/java/org/elasticsearch/action/search/SearchRequestBuilderTests.java" rel="noreferrer">https://github.com/elastic/elasticsearch/blob/master/core/src/test/java/org/elasticsearch/action/search/SearchRequestBuilderTests.java</a></p> <p>here is the code </p> <pre><code>class CampaignESTest extends ESTestCase { def getCLient():MockTransportClient={ val settings = Settings.builder() .put(Environment.PATH_HOME_SETTING.getKey(), Files.createTempDir().toString()) .build(); val client = new MockTransportClient(settings); client } } class CampaignTestSearch extends PlaySpec{ val client=new CampaignESTest val response = client.prepareSearch("dbtest") .setTypes(CAMPAIGN_COLLECTION_NAME) .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .addFields("uuid","campaignName","artworkID","activationDate","_source") .setQuery(query) .execute() .actionGet() } </code></pre> <p>I am getting these exceptions </p> <pre><code> Exception encountered when attempting to run a suite with class name: org.scalatest.DeferredAbortedSuite *** ABORTED *** [info] java.lang.ExceptionInInitializerError: [info] at org.elasticsearch.test.ESTestCase.&lt;clinit&gt;(ESTestCase.java:138) [info] at testcontrollers.campaign.CampaignTestSearch.&lt;init&gt;(CampaignTestSearch.scala:40) [info] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [info] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [info] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [info] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [info] at java.lang.Class.newInstance(Class.java:442) [info] at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:468) [info] at sbt.ForkMain$Run$2.call(ForkMain.java:296) [info] at sbt.ForkMain$Run$2.call(ForkMain.java:286) [info] ... [info] Cause: java.lang.RuntimeException: found jar hell in test classpath [info] at org.elasticsearch.bootstrap.BootstrapForTesting.&lt;clinit&gt;(BootstrapForTesting.java:90) [info] at org.elasticsearch.test.ESTestCase.&lt;clinit&gt;(ESTestCase.java:138) [info] at testcontrollers.campaign.CampaignTestSearch.&lt;init&gt;(CampaignTestSearch.scala:40) [info] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [info] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [info] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [info] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [info] at java.lang.Class.newInstance(Class.java:442) [info] at org.scalatest.tools.Framework$ScalaTestTask.execute(Framework.scala:468) [info] at sbt.ForkMain$Run$2.call(ForkMain.java:296) [info] ... [info] Cause: java.nio.file.NoSuchFileException: /home/testproject/target/web/classes/test [info] at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86) [info] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) [info] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) [info] at sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55) [info] at sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:144) [info] at sun.nio.fs.LinuxFileSystemProvider.readAttributes(LinuxFileSystemProvider.java:99) [info] at java.nio.file.Files.readAttributes(Files.java:1737) [info] at java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:219) [info] at java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276) [info] at java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322) </code></pre> <p>getting an exception on this line </p> <pre><code>val client=new CampaignESTest </code></pre> <p>in class <code>CampaignTestSearch</code></p> <p>here are the dependencies in <code>build.sbt</code> file </p> <pre><code>libraryDependencies ++= Seq(filters, "org.scalatest" %% "scalatest" % "2.2.6" % "test"withSources() withJavadoc(), "org.scalatestplus" %% "play" % "1.4.0-M3" % "test", "com.esotericsoftware.kryo" % "kryo" % "2.10", "org.mongodb" %% "casbah" % "2.8.0", "org.slf4j" % "slf4j-api" % "1.6.4", "org.elasticsearch" % "elasticsearch" % "1.6.0", "org.elasticsearch.test" % "framework" % "5.0.0" % "test", "org.apache.lucene" % "lucene-test-framework" % "4.10.4" % "test", "com.carrotsearch.randomizedtesting" % "randomizedtesting-runner" % "1.6.0" % "test", "org.apache.lucene" % "lucene-codecs" % "4.10.4" % "test", "org.apache.logging.log4j" % "log4j-core" % "2.8.2", "org.apache.logging.log4j" % "log4j-slf4j-impl" % "2.8.2" , "org.apache.logging.log4j" % "log4j-api" % "2.8.2", "com.typesafe.akka" %% "akka-actor" % "2.3.6", "com.typesafe.akka" % "akka-testkit_2.11" % "2.3.6", "ch.qos.logback" % "logback-core" % "1.0.9", "com.github.nscala-time" %% "nscala-time" % "2.0.0", "com.hazelcast" % "hazelcast" % "3.5", "com.hazelcast" % "hazelcast-client" % "3.5", "com.twitter" % "chill-bijection_2.11" % "0.7.0", "com.github.slugify" % "slugify" % "2.1.3" , "org.mindrot" % "jbcrypt" % "0.3m", "org.codehaus.groovy" % "groovy-all" % "2.4.0", "org.apache.lucene" % "lucene-expressions" % "4.10.4", "com.restfb" % "restfb" % "1.19.0", "org.twitter4j" % "twitter4j-core" % "4.0.0", "org.scribe" % "scribe" % "1.3.5", "com.google.code.gson" % "gson" % "2.6.2", "com.google.oauth-client" % "google-oauth-client" % "1.20.0", "com.google.api.client" % "google-api-client-auth-oauth2" % "1.2.0-alpha", "com.google.api-client" % "google-api-client" % "1.20.0", "com.google.http-client" % "google-http-client-jackson" % "1.20.0", "com.google.apis" % "google-api-services-oauth2" % "v2-rev120-1.20.0", "com.google.oauth-client" % "google-oauth-client-appengine" % "1.20.0", "com.google.oauth-client" % "google-oauth-client-java6" % "1.20.0", "com.google.oauth-client" % "google-oauth-client-jetty" % "1.20.0", "com.google.oauth-client" % "google-oauth-client-servlet" % "1.20.0", "com.google.apis" % "google-api-services-calendar" % "v3-rev120-1.19.1", "com.google.inject" % "guice" % "3.0", "org.mockito" % "mockito-all" % "1.10.19") </code></pre> <p>How can these exception will be resolved ? also I have tried the solution given here <a href="https://stackoverflow.com/questions/38712251/java-jar-hell-runtime-exception">Java Jar hell Runtime Exception</a> Bit when i try to create a class <code>JarHell</code> in <code>org/elasticsearch/bootstarp</code> package it won't let me create it saying type already exists I also tried searching the Class but did not found ,please guide </p>
0debug
long do_rt_sigreturn(CPUS390XState *env) { rt_sigframe *frame; abi_ulong frame_addr = env->regs[15]; sigset_t set; trace_user_do_rt_sigreturn(env, frame_addr); if (!lock_user_struct(VERIFY_READ, frame, frame_addr, 1)) { goto badframe; } target_to_host_sigset(&set, &frame->uc.tuc_sigmask); set_sigmask(&set); if (restore_sigregs(env, &frame->uc.tuc_mcontext)) { goto badframe; } if (do_sigaltstack(frame_addr + offsetof(rt_sigframe, uc.tuc_stack), 0, get_sp_from_cpustate(env)) == -EFAULT) { goto badframe; } unlock_user_struct(frame, frame_addr, 0); return -TARGET_QEMU_ESIGRETURN; badframe: unlock_user_struct(frame, frame_addr, 0); force_sig(TARGET_SIGSEGV); return 0; }
1threat
static void uhci_async_cancel_all(UHCIState *s) { UHCIQueue *queue; UHCIAsync *curr, *n; QTAILQ_FOREACH(queue, &s->queues, next) { QTAILQ_FOREACH_SAFE(curr, &queue->asyncs, next, n) { uhci_async_unlink(curr); uhci_async_cancel(curr); } uhci_queue_free(queue); } }
1threat
Pygame Grid and Entry, Correct Alignment : [What I want][1] [1]: https://i.stack.imgur.com/xneY2.png How would I implement this in TkInter with Python? Two numbers are input as the width and height, and are then saved to Mapwidth and Mapheight respectively. When the Confirm button is hit, the window closes.
0debug
Conceptual - How does arithmetic work on a basic level in Java and code in general? : Excuse me for the vagueness of the question, but I'm a relatively new programmer. How exactly does the computer know how to do arithmetic? Does every language - specifically Java, have an add, subtract, addition, subtraction, modular division class? If so, how does the class scan for the operator signs?
0debug
static int decode_vol_header(MpegEncContext *s, GetBitContext *gb){ int width, height, vo_ver_id; skip_bits(gb, 1); s->vo_type= get_bits(gb, 8); if (get_bits1(gb) != 0) { vo_ver_id = get_bits(gb, 4); skip_bits(gb, 3); } else { vo_ver_id = 1; s->aspect_ratio_info= get_bits(gb, 4); if(s->aspect_ratio_info == FF_ASPECT_EXTENDED){ s->avctx->sample_aspect_ratio.num= get_bits(gb, 8); s->avctx->sample_aspect_ratio.den= get_bits(gb, 8); }else{ s->avctx->sample_aspect_ratio= pixel_aspect[s->aspect_ratio_info]; if ((s->vol_control_parameters=get_bits1(gb))) { int chroma_format= get_bits(gb, 2); if(chroma_format!=1){ av_log(s->avctx, AV_LOG_ERROR, "illegal chroma format\n"); s->low_delay= get_bits1(gb); if(get_bits1(gb)){ get_bits(gb, 15); skip_bits1(gb); get_bits(gb, 15); skip_bits1(gb); get_bits(gb, 15); skip_bits1(gb); get_bits(gb, 3); get_bits(gb, 11); skip_bits1(gb); get_bits(gb, 15); skip_bits1(gb); }else{ if(s->picture_number==0) s->low_delay=0; s->shape = get_bits(gb, 2); if(s->shape != RECT_SHAPE) av_log(s->avctx, AV_LOG_ERROR, "only rectangular vol supported\n"); if(s->shape == GRAY_SHAPE && vo_ver_id != 1){ av_log(s->avctx, AV_LOG_ERROR, "Gray shape not supported\n"); skip_bits(gb, 4); check_marker(gb, "before time_increment_resolution"); s->avctx->time_base.den = get_bits(gb, 16); if(!s->avctx->time_base.den){ av_log(s->avctx, AV_LOG_ERROR, "time_base.den==0\n"); s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; if (s->time_increment_bits < 1) s->time_increment_bits = 1; check_marker(gb, "before fixed_vop_rate"); if (get_bits1(gb) != 0) { s->avctx->time_base.num = get_bits(gb, s->time_increment_bits); }else s->avctx->time_base.num = 1; s->t_frame=0; if (s->shape != BIN_ONLY_SHAPE) { if (s->shape == RECT_SHAPE) { skip_bits1(gb); width = get_bits(gb, 13); skip_bits1(gb); height = get_bits(gb, 13); skip_bits1(gb); if(width && height && !(s->width && s->codec_tag == ff_get_fourcc("MP4S"))){ s->width = width; s->height = height; s->progressive_sequence= s->progressive_frame= get_bits1(gb)^1; s->interlaced_dct=0; if(!get_bits1(gb) && (s->avctx->debug & FF_DEBUG_PICT_INFO)) av_log(s->avctx, AV_LOG_INFO, "MPEG4 OBMC not supported (very likely buggy encoder)\n"); if (vo_ver_id == 1) { s->vol_sprite_usage = get_bits1(gb); } else { s->vol_sprite_usage = get_bits(gb, 2); if(s->vol_sprite_usage==STATIC_SPRITE) av_log(s->avctx, AV_LOG_ERROR, "Static Sprites not supported\n"); if(s->vol_sprite_usage==STATIC_SPRITE || s->vol_sprite_usage==GMC_SPRITE){ if(s->vol_sprite_usage==STATIC_SPRITE){ s->sprite_width = get_bits(gb, 13); skip_bits1(gb); s->sprite_height= get_bits(gb, 13); skip_bits1(gb); s->sprite_left = get_bits(gb, 13); skip_bits1(gb); s->sprite_top = get_bits(gb, 13); skip_bits1(gb); s->num_sprite_warping_points= get_bits(gb, 6); s->sprite_warping_accuracy = get_bits(gb, 2); s->sprite_brightness_change= get_bits1(gb); if(s->vol_sprite_usage==STATIC_SPRITE) s->low_latency_sprite= get_bits1(gb); if (get_bits1(gb) == 1) { s->quant_precision = get_bits(gb, 4); if(get_bits(gb, 4)!=8) av_log(s->avctx, AV_LOG_ERROR, "N-bit not supported\n"); if(s->quant_precision!=5) av_log(s->avctx, AV_LOG_ERROR, "quant precision %d\n", s->quant_precision); } else { s->quant_precision = 5; if((s->mpeg_quant=get_bits1(gb))){ int i, v; for(i=0; i<64; i++){ int j= s->dsp.idct_permutation[i]; v= ff_mpeg4_default_intra_matrix[i]; s->intra_matrix[j]= v; s->chroma_intra_matrix[j]= v; v= ff_mpeg4_default_non_intra_matrix[i]; s->inter_matrix[j]= v; s->chroma_inter_matrix[j]= v; if(get_bits1(gb)){ int last=0; for(i=0; i<64; i++){ int j; v= get_bits(gb, 8); if(v==0) break; last= v; j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ]; s->intra_matrix[j]= v; s->chroma_intra_matrix[j]= v; for(; i<64; i++){ int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ]; s->intra_matrix[j]= last; s->chroma_intra_matrix[j]= last; if(get_bits1(gb)){ int last=0; for(i=0; i<64; i++){ int j; v= get_bits(gb, 8); if(v==0) break; last= v; j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ]; s->inter_matrix[j]= v; s->chroma_inter_matrix[j]= v; for(; i<64; i++){ int j= s->dsp.idct_permutation[ ff_zigzag_direct[i] ]; s->inter_matrix[j]= last; s->chroma_inter_matrix[j]= last; if(vo_ver_id != 1) s->quarter_sample= get_bits1(gb); else s->quarter_sample=0; if(!get_bits1(gb)) av_log(s->avctx, AV_LOG_ERROR, "Complexity estimation not supported\n"); s->resync_marker= !get_bits1(gb); s->data_partitioning= get_bits1(gb); if(s->data_partitioning){ s->rvlc= get_bits1(gb); if(vo_ver_id != 1) { s->new_pred= get_bits1(gb); if(s->new_pred){ av_log(s->avctx, AV_LOG_ERROR, "new pred not supported\n"); skip_bits(gb, 2); skip_bits1(gb); s->reduced_res_vop= get_bits1(gb); if(s->reduced_res_vop) av_log(s->avctx, AV_LOG_ERROR, "reduced resolution VOP not supported\n"); else{ s->new_pred=0; s->reduced_res_vop= 0; s->scalability= get_bits1(gb); if (s->scalability) { GetBitContext bak= *gb; int ref_layer_id; int ref_layer_sampling_dir; int h_sampling_factor_n; int h_sampling_factor_m; int v_sampling_factor_n; int v_sampling_factor_m; s->hierachy_type= get_bits1(gb); ref_layer_id= get_bits(gb, 4); ref_layer_sampling_dir= get_bits1(gb); h_sampling_factor_n= get_bits(gb, 5); h_sampling_factor_m= get_bits(gb, 5); v_sampling_factor_n= get_bits(gb, 5); v_sampling_factor_m= get_bits(gb, 5); s->enhancement_type= get_bits1(gb); if( h_sampling_factor_n==0 || h_sampling_factor_m==0 || v_sampling_factor_n==0 || v_sampling_factor_m==0){ s->scalability=0; *gb= bak; }else av_log(s->avctx, AV_LOG_ERROR, "scalability not supported\n"); return 0;
1threat
How to access color from App.xaml in C# in Xamarin Forms? : <p>In App.xaml I have this code:</p> <pre><code>&lt;Application.Resources&gt; &lt;ResourceDictionary&gt; &lt;Color x:Key="Yellow"&gt;#ffd966&lt;/Color&gt; &lt;/ResourceDictionary&gt; &lt;/Application.Resources&gt; </code></pre> <p>and in C# I have this code:</p> <pre class="lang-cs prettyprint-override"><code>public Color BackgroundColor { get { return IsSelected ? Color.Yellow : Color.White; } } </code></pre> <p>And I would like to change Color.Yellow with color from App.xaml. How can I reference color from App.xaml in C#?</p>
0debug
What is the best practice for organizing a piece of reusable code? Python : I am building a text-based encryption and decryption game. There are different levels, and each level uses a different cipher for encrypting a text. I am trying to figure out the best practice for the series of questions and prompts (the narrative) I give the user to determine if he wants to practice, do the test, encrypt, or decrypt. 90% of the narrative is the same for each level, so I don't want to repeat myself with identical code. What is the best way to do this? My first thought was to define a function that contained the general script, and to call the specific functions as parameters. (This is what I have attempted to do below). But I seem to run into a scope problem. When I call the caesar() function as one of the arguments in the script() function, I need to enter the text to be encryprted, but this text isn't provided by the user until the script() function has already started running. Should I be using a Class to define the narrative portion of the program, and then inherit to more specific types? Or should I just repeat the narrative code at the different levels? Here is the narrative script(): def script(encrypt, decrypt): """Asks user if they want to practice (encode or decode) or take the test, and calls the corresponding function.""" encrypt = encrypt decrypt = decrypt while True: print('Type Q to quit. Type M to return to the main menu.') prac_test = input('would you like to practice or take the test? P/T') if prac_test.lower() == 'p': choice = input('Would you like to encrypt or decrypt? E/D ') if choice.lower() == 'e': text = input('Enter the text you would like to encode: ') encrypt elif choice.lower() == 'd': text = input('Enter the text you would like to decode: ') key = int(input('Enter the key: ')) decrypt else: print('You must enter either "E" or "D" to encode or decode a text. ') elif prac_test.lower() == 't': text = random.choice(text_list) encrypted_text = encrypt print(encrypted_text[0]) answer = input('s/nCan you decode this string? ') if answer.lower() == ran_str.lower(): print('Congrats! You solved level 1!\n') pass elif answer != ran_str: print("Sorry, that's not correct. Why don't you practice some more?\n") script(encrypt, decrypt) elif prac_test.lower() == 'q': exit() elif prac_test.lower() == 'm': break else: print('Please enter a valid choice.') Here is one of the levels using a caesar cipher: def caesar(mode, text, key=None): """ ... The dictionaries that convert between letters and numbers are stored in the .helper file, imported above. """ mode = mode if mode == 'encrypt': key = random.randint(1, 25) elif mode == 'decrypt': key = key str_key = str(key) text = text.lower() # converts each letter of the text to a number num_list = [alph_to_num[s] if s in alph else s for s in text] if mode == 'encrypt': # adds key-value to each number new_list = [num_to_alph[(n + key) % 26] if n in num else n for n in num_list] elif mode == 'decrypt': # subtracts key-value from each number new_list = [num_to_alph[(n - key) % 26] if n in num else n for n in num_list] new_str = '' for i in new_list: new_str += i return new_str, str_key And here is who I would try to use them together: script(caesar('encrypt' text), caesar('decrypt', text, key)) Please instruct me on the best way to organize this reusable narrative code. Thank you.
0debug
static int filter_query_formats(AVFilterContext *ctx) { int ret, i; AVFilterFormats *formats; AVFilterChannelLayouts *chlayouts; AVFilterFormats *samplerates; enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type : ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type : AVMEDIA_TYPE_VIDEO; if ((ret = ctx->filter->query_formats(ctx)) < 0) { av_log(ctx, AV_LOG_ERROR, "Query format failed for '%s': %s\n", ctx->name, av_err2str(ret)); return ret; } for (i = 0; i < ctx->nb_inputs; i++) sanitize_channel_layouts(ctx, ctx->inputs[i]->out_channel_layouts); for (i = 0; i < ctx->nb_outputs; i++) sanitize_channel_layouts(ctx, ctx->outputs[i]->in_channel_layouts); formats = ff_all_formats(type); if (!formats) return AVERROR(ENOMEM); ff_set_common_formats(ctx, formats); if (type == AVMEDIA_TYPE_AUDIO) { samplerates = ff_all_samplerates(); if (!samplerates) return AVERROR(ENOMEM); ff_set_common_samplerates(ctx, samplerates); chlayouts = ff_all_channel_layouts(); if (!chlayouts) return AVERROR(ENOMEM); ff_set_common_channel_layouts(ctx, chlayouts); } return 0; }
1threat
How do I identify and label similar rows in a pandas data frame : I have a data set and I want to identify and label similar rows as such in python: [1, 1000] [1] [2, 10 ] [2] [2, 100 ] [3] [2, 10 ] -> [2] [3, 1000] [4] [2, 100 ] [3] [2, 10 ] [2]
0debug
static void nvdimm_build_nfit(GSList *device_list, GArray *table_offsets, GArray *table_data, GArray *linker) { GArray *structures = nvdimm_build_device_structure(device_list); unsigned int header; acpi_add_table(table_offsets, table_data); header = table_data->len; acpi_data_push(table_data, sizeof(NvdimmNfitHeader)); g_array_append_vals(table_data, structures->data, structures->len); build_header(linker, table_data, (void *)(table_data->data + header), "NFIT", sizeof(NvdimmNfitHeader) + structures->len, 1, NULL, NULL); g_array_free(structures, true); }
1threat
static inline int ppcemb_tlb_check(CPUState *env, ppcemb_tlb_t *tlb, target_phys_addr_t *raddrp, target_ulong address, uint32_t pid, int ext, int i) { target_ulong mask; if (!(tlb->prot & PAGE_VALID)) { qemu_log("%s: TLB %d not valid\n", __func__, i); return -1; } mask = ~(tlb->size - 1); LOG_SWTLB("%s: TLB %d address " TARGET_FMT_lx " PID %u <=> " TARGET_FMT_lx " " TARGET_FMT_lx " %u\n", __func__, i, address, pid, tlb->EPN, mask, (uint32_t)tlb->PID); if (tlb->PID != 0 && tlb->PID != pid) return -1; if ((address & mask) != tlb->EPN) return -1; *raddrp = (tlb->RPN & mask) | (address & ~mask); #if (TARGET_PHYS_ADDR_BITS >= 36) if (ext) { *raddrp |= (target_phys_addr_t)(tlb->RPN & 0xF) << 32; } #endif return 0; }
1threat
static void default_drive(int enable, int snapshot, int use_scsi, BlockInterfaceType type, int index, const char *optstr) { QemuOpts *opts; if (type == IF_DEFAULT) { type = use_scsi ? IF_SCSI : IF_IDE; } if (!enable || drive_get_by_index(type, index)) { return; } opts = drive_add(type, index, NULL, optstr); if (snapshot) { drive_enable_snapshot(opts, NULL); } if (!drive_init(opts, use_scsi)) { exit(1); } }
1threat
static void modified_levinson_durbin(int *window, int window_entries, int *out, int out_entries, int channels, int *tap_quant) { int i; int *state = av_calloc(window_entries, sizeof(*state)); memcpy(state, window, 4* window_entries); for (i = 0; i < out_entries; i++) { int step = (i+1)*channels, k, j; double xx = 0.0, xy = 0.0; #if 1 int *x_ptr = &(window[step]); int *state_ptr = &(state[0]); j = window_entries - step; for (;j>0;j--,x_ptr++,state_ptr++) { double x_value = *x_ptr; double state_value = *state_ptr; xx += state_value*state_value; xy += x_value*state_value; } #else for (j = 0; j <= (window_entries - step); j++); { double stepval = window[step+j]; double stateval = window[j]; xx += stateval*stateval; xy += stepval*stateval; } #endif if (xx == 0.0) k = 0; else k = (int)(floor(-xy/xx * (double)LATTICE_FACTOR / (double)(tap_quant[i]) + 0.5)); if (k > (LATTICE_FACTOR/tap_quant[i])) k = LATTICE_FACTOR/tap_quant[i]; if (-k > (LATTICE_FACTOR/tap_quant[i])) k = -(LATTICE_FACTOR/tap_quant[i]); out[i] = k; k *= tap_quant[i]; #if 1 x_ptr = &(window[step]); state_ptr = &(state[0]); j = window_entries - step; for (;j>0;j--,x_ptr++,state_ptr++) { int x_value = *x_ptr; int state_value = *state_ptr; *x_ptr = x_value + shift_down(k*state_value,LATTICE_SHIFT); *state_ptr = state_value + shift_down(k*x_value, LATTICE_SHIFT); } #else for (j=0; j <= (window_entries - step); j++) { int stepval = window[step+j]; int stateval=state[j]; window[step+j] += shift_down(k * stateval, LATTICE_SHIFT); state[j] += shift_down(k * stepval, LATTICE_SHIFT); } #endif } av_free(state); }
1threat
static void gen_tlbsx_40x(DisasContext *ctx) { #if defined(CONFIG_USER_ONLY) gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); #else TCGv t0; if (unlikely(ctx->pr)) { gen_inval_exception(ctx, POWERPC_EXCP_PRIV_OPC); return; } t0 = tcg_temp_new(); gen_addr_reg_index(ctx, t0); gen_helper_4xx_tlbsx(cpu_gpr[rD(ctx->opcode)], cpu_env, t0); tcg_temp_free(t0); if (Rc(ctx->opcode)) { int l1 = gen_new_label(); tcg_gen_trunc_tl_i32(cpu_crf[0], cpu_so); tcg_gen_brcondi_tl(TCG_COND_EQ, cpu_gpr[rD(ctx->opcode)], -1, l1); tcg_gen_ori_i32(cpu_crf[0], cpu_crf[0], 0x02); gen_set_label(l1); } #endif }
1threat
static int gdb_get_spe_reg(CPUState *env, uint8_t *mem_buf, int n) { if (n < 32) { #if defined(TARGET_PPC64) stl_p(mem_buf, env->gpr[n] >> 32); #else stl_p(mem_buf, env->gprh[n]); #endif return 4; } if (n == 33) { stq_p(mem_buf, env->spe_acc); return 8; } if (n == 34) { memset(mem_buf, 0, 4); return 4; } return 0; }
1threat
Identityserver 4 and Azure AD : <p>I'm looking into using Identity Server 4 for authentication within a C# based MVC application. I'd like to use accounts stored in Azure AD as a source of valid users but the documentation only seems to refer to Google and OpenID &amp; only mentions Azure in passing.</p> <p>Does anybody know of any good documentation and/or tutorials on how to use Azure AD in the context of using it with Identity Server 4? </p>
0debug
Where can I put a startup script in Jupyter? : <p>I'm looking for a way to put my startup script in Jupyter. In IPython, I put it under the <code>$IPYTHON_DIR/profile_default/startup/</code>. </p> <p>In Jupyter, it seems that the config file should be <code>$JUPYTER_CONFIG_DIR/jupyter_notebook_config.py</code>. However, I would like to use my startup file, which import a slew of Python libraries at the launch of the kernel.</p> <p>Where can I put such file in Jupyter?</p>
0debug
Compare a MySql table with an excel table using java : I have a marks table with attributes student_id and total_marks. Here student_id refers to the primary key of student table. I have same marks table stored as an Excel file. Now I want to write a java program to find out the students who are having a mismatch between data in MySql database and Excel file.
0debug
Convert List to String and back to List Python 3 : <p>If I type:</p> <pre><code>&gt;&gt;&gt; list(str([0, 0, 0])) </code></pre> <p>I get: <code>['[', '0', ',', ' ', '0', ',', ' ', '0', ']']</code></p> <p>How would I make it so that I get <code>[0, 0, 0]</code> instead?</p>
0debug
How to insert a list as a key in Python dictionary : <p>I'm using Python 3.5 and I want to know if its possible or if there's a way to use a list as a key in a dictionary in this way.</p> <pre><code>dict = {['a', 'c', 'b']: 1, ['a', 'b', 'c']: 2, ['b', 'a', 'c']: 5} </code></pre> <p>I need so hard to work with lists as keys... </p> <p>Thank you! </p>
0debug
Node Modular Architecture : <p>I am building a nodejs application that is fairly large now. In an attempt to avoid a monolithic node application I have gone down the architectural route of a more modular system breaking out several components into separate npm modules. These are published using npm and installed in the dependent modules. I have about 6 different modules (which I would want to break out in to more) and now it has become difficult to manage the packages.</p> <p><strong>The problems</strong> are:</p> <ol> <li>There is nested dependency so if I change module A and module B depends on module A and module C depends on module B, then when I update module A I need to publish a new version of it, which then means I need to update it in module B, which means I also need to publish of that and then finally I need to install that new version in module A ... you can see where that might be a pain. What's more the updating of the versions in all the package.json is manual and so error prone, and waiting for each publish is time consuming.</li> <li>Modules can share npm dependencies and so sometimes conflicts occur when packages get updated. The more modules the higher the chance of conflict.</li> </ol> <p><strong>The benefits</strong> are that we have a very modular system where libraries can be reused easily and there is a clear hierarchy of modules enforced as there can't be any circular dependencies.</p> <p><strong>Possible solutions</strong> are:</p> <ol> <li><p><strong>Monolith</strong> - To manage the dependencies as a single app in a single repository with each module just becoming a services. This means that only one update is necessary and all the module apis will be in sync. However, referencing the libraries in the code might be a bit of a pain (as I believe they will have to be referenced relative to the local file), I am not sure how a structural hierarchy between the modules can be enforced and code reuse will be harder with modules outside the repository.</p></li> <li><p><strong>Microservices</strong> - To make each module a micro service. This maintains all the benefits of the modular system, but I am concerned that it will add a lot of complexity to the build and managing all the services will become a full time job in itself.</p></li> <li><p><strong>Keep going</strong> - Work out a way to keep the current architecture but remove the trouble of pushing updates etc. Maybe scripts to update versions and shrinkwrap to ensure correct dependencies. I think this would both be difficult and would potentially lead it to being a monolithic system of a different variety.</p></li> </ol> <p>Option 1 seems the most manageable to me but I don't want to lose the modular structure if I don't have to.</p> <p>This is quite a broad question, but any suggestions/advice/comments would be really helpful.</p> <p>Thanks</p>
0debug
iOS 10.1 and Xcode 8 issue : <p>Just installed iOS 10.1 (non beta) today, as well as the latest (non-beta) version of Xcode via the App Store and am encountering the following error:</p> <p><a href="https://i.stack.imgur.com/tdDCX.png"><img src="https://i.stack.imgur.com/tdDCX.png" alt="enter image description here"></a></p> <p>My Xcode version:</p> <p><a href="https://i.stack.imgur.com/zMB2X.png"><img src="https://i.stack.imgur.com/zMB2X.png" alt="enter image description here"></a></p> <p>Any and all suggestions would be welcome! Anyone else running into this?</p>
0debug
Function if in javascript ever return true : I have the function below: $("#botao").on("click", function(){ s = $("#municipio").val(); alert(s); if (s == 1){ $("#imagem").attr("src","https://gatolovers.com.br/uf/popup1.png"); $("#mensagem").html('Uhul! Nós atendemos sua região. Temos uma unidade de atendimento pertinho de você. Ligue agora mesmo e faça um orçamento.'); }else{ $("#imagem").attr("src","https://gatolovers.com.br/uf/popup0.png"); $("#mensagem").html('Ops! Ainda não estamos na sua cidade. Mas muito em breve levaremos a melhor empresa de Redes de Proteção para sua região, consulte nosso plano de expansão.'); } }); Independs of `s` be 0 or 1, the function ever return the first block.
0debug
how to get the dates in an array in ios swift : I have an array like ["2018-03-21 11:09:25","2018-03-22 11:09:25","2018-03-23 11:09:25","2018-03-24 11:09:25"] I need to display only dates[2018-03-21] in this array. How to split this array?
0debug
R Functions Return Value : <p>I am a new R user coming from the world of Java and SQL. I have been struggling the with the configuration or format of data that functions return in R. So far I have encountered three:</p> <ul> <li>Return actual data: for example, if you search through a data.frame, the return will be the rows that matched the search condition (a sub data.frame)</li> <li>Return indices: for example, if you search through a data.frame, the result will be the indices of the rows that matched the search condition (1,3,20,22, ... etc)</li> <li>Return a logical vector: for example, if you search through a data.frame, the return will a be a vector with 0s for the records that did not match and 1s for the records that matched (1,0,0,0,1,0,1,... etc). The size of the vector will be the exact number of records in the data.frame</li> </ul> <p>The inconsistency in the format of data returned is causing me a lot of confusion. Is there any way that I could convert between these formats or at least tell which format a function will return. </p> <p>I tried looking into these resources but I could find a answer to my question <a href="https://www.statmethods.net/management/subset.html" rel="nofollow noreferrer">https://www.statmethods.net/management/subset.html</a></p> <p><a href="https://www.r-bloggers.com/5-ways-to-subset-a-data-frame-in-r/" rel="nofollow noreferrer">https://www.r-bloggers.com/5-ways-to-subset-a-data-frame-in-r/</a></p> <p><a href="https://stat.ethz.ch/R-manual/R-devel/library/base/html/logical.html" rel="nofollow noreferrer">https://stat.ethz.ch/R-manual/R-devel/library/base/html/logical.html</a></p> <p>Thank you</p>
0debug