problem
stringlengths
26
131k
labels
class label
2 classes
fprintf printing garbage to txt file : <p>I'm having trouble with strings and c.</p> <p>I'm trying to do something very simple: converting an int into a string and printing it into a txt file in the following fashion.</p> <pre><code>const char * test_string() { char s[5]; int num = 123; sprintf(s, "%d", num); return s; } int save() { FILE *fh = fopen("test.txt", "w"); const char * text = test_string(); fprintf(fh, "%s", text); fclose(fh); } </code></pre> <p>Yet, for this simple task, I'm getting the following result:</p> <pre><code>Üþ( </code></pre> <p>I'd like some assistance with this problem. Thanks in advance.</p>
0debug
Multiple Function Definition Error Makefile? : <p>So this shouldn't be giving nearly as much trouble as it is, but I'm trying to create a more efficient makefile using wildcard operators as opposed to the tedious method I used to employ where you go through and make each individual object file and then link them together. But, for whatever reason, Whenever I try to run 'make' it gives me this:</p> <pre><code>multiple definition of 'ScreenMgr::ScreenMgr()' /path/to/ScrenMgr.cpp:4: first defined here </code></pre> <p>then it also gives me another error immediately after this one that says:</p> <pre><code>undefined reference to main collect2: error: ld returned 1 exit status </code></pre> <p>Though before these errors, my .o are produced and placed in the proper directory, so the error must be with the linker. I can include the c++ source if somebody thinks it'll help, but the files are practically empty as it is (Though I still put header guards in), because I just wanted to ensure that everything links properly first, so I can deal with problems like this without having to worry about the code as well. The directory structure looks like:</p> <pre><code>-MsSolver |--src | |--main.cpp | |--ScreenMgr.cpp |--include | |--ScreenMgr.h |--build #empty directory | |--Makefile |: |--bin </code></pre> <p>and here's the makefile:</p> <pre><code>CC:=g++ DEBUG:=-g CFLAGS:=-Wall $(DEBUG) LDFLAGS:=-Wall $(DEBUG) SRCDIR:=$(PWD)/src BUILDDIR:=$(PWD)/build INCDIR:=$(PWD)/include BINDIR:=$(PWD)/bin FILES:=ScreenMgr main INCLUDES:=-I$(INCDIR) SRCS:=$(patsubst %,$(SRCDIR)/%.cpp,$(FILES)) OBJS:=$(patsubst %,$(BUILDDIR)/%.o,$(FILES)) LIBS:=-lX11 TARGET:=mssolver #create executable and link $(BINDIR)/$(TARGET): $(OBJS) $(CC) $(LFLAGS) $(INCLUDES) $(LIBS) $(OBJS) -o $@ #Compile objs $(BUILDIR)/%.o: $(SRCS) $(CC) $(CFLAGS) -c $&lt; -o $@ clean: rm -f $(BUILDDIR)/*.o $(BINDIR)/*.o $(INCDIR)/*.swp $(SRCDIR)/*.swp </code></pre>
0debug
how to add my button in refrence in java? : i want to add and sub counter but i can only added "add" in R.Java [![enter image description here][1]][1]and can't added "sub" in R.Java .and i have this error in my program "btnsub cannot be resolved or is not a field"? Thank you; [1]: http://i.stack.imgur.com/R6Gyd.jpg
0debug
how to fetch data using json and php : How to fetch json result using mysql connection $conn = new mysqli("localhost", 'root', "", "laravel"); $query = mysqli_query($conn,"select * from customers"); while($result2=mysqli_fetch_assoc($query)) { echo "Name: ".$result2['customerName']; echo "<br/>"; } <html lang="en"> <head> <meta charset="UTF-8"> <title>JSON</title> </head> <body> <div id="demo"></div> <script> var xmlhttp = new XMLHttpRequest(); var url = "connection.php"; xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { myFunction(xmlhttp.responseText); } } xmlhttp.open("GET", url, true); xmlhttp.send(); function myFunction(response) { var arr = JSON.parse(response); var out = $result2; document.getElementById("demo").innerHTML = out; } </script> </body> </html> how to fetch the result using json and php and i want to know ajax for json will work or not
0debug
Is it possible to delete all registry keys that can be deleted without being stopped by one undeletable key using C#? : When you use the Registry Editor GUI to delete keys and you delete a subkey tree with undeletable keys inside it (e.g. key in use, insufficient permission), it will try to delete what it can without the undeletable keys stopping the operation. This does not seem to be the case with the Microsoft.Win32 library in C#. Using an external program like reg.exe works, but I'm trying to look for a solution that does not require an external application. private void DelHKLM() { try { using (RegistryKey desiredKey = Registry.LocalMachine.OpenSubKey("SOFTWARE", true)) { desiredKey.DeleteSubKeyTree("Policies"); } } } The anticipated result is for the program to not give any exceptions and delete the subkey tree "Policies", but instead, it throws an "UnauthorizedAccessException" because the keys are in use. Note: I am running my program as Administrator and I do have permissions to the key as demonstrated through the registry editor. So, my question is: **Is there any way to achieve what the Registry Editor does in C#, preferably using native libraries?**
0debug
static int apc_read_packet(AVFormatContext *s, AVPacket *pkt) { if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0) return AVERROR(EIO); pkt->stream_index = 0; return 0; }
1threat
i need help over is redirect in php : //hello, please I need help with this php multi-user redirect code. when you //log in is able to access the database but I doest redirect the user to its //page. please i am new to in PHP? <?php require 'database-config.php'; session_start(); $username = ""; $password = ""; if(isset($_POST['username'])){ $username = $_POST['username']; } if (isset($_POST['password'])) { $password = $_POST['password']; } $q = 'SELECT * FROM user_mgnt WHERE username=:username AND password=:password'; $query = $dbh->prepare($q); $query->execute(array(':username' => $username, ':password' => $password)); if($query->rowCount() == 0){ header('Location: index.php?err=1'); }else{ $row = $query->fetch(PDO::FETCH_ASSOC); session_regenerate_id(); $_SESSION['sess_user_id'] = $row['id']; $_SESSION['sess_username'] = $row['username']; $_SESSION['sess_userrole'] = $row['role']; echo $_SESSION['sess_username']; echo $_SESSION['sess_userrole']; session_write_close(); if( $_SESSION['sess_userrole'] == "Admin"){ header('Location: Dashboard.php'); } elseif ( $_SESSION['sess_userrole'] == "Employee"){ header('Location: emp_dashboard.php'); } elseif ( $_SESSION['sess_userrole'] == "Registrar"){ header('Location: Registration_Dashboard.php'); } elseif ( $_SESSION['sess_userrole'] == "Accountant"){ header('Location: Account_Dashboard.php'); } else{ header('Location: emp_dashboard.php'); } } ?>
0debug
How i can use findViewById() in Android Studio? : --------------------------------Español------------------------------------- Básicamente el problema es que, a la hora de querer usar el método de "FindViewById" o "GetSystemService" o demás no me deja. Únicamente me deja utilizarlos en MainActivity, quería saber como puedo solucionar este problema. Soy nuevo en android Studio y básicamente estoy aprendiendo --------------------------------English------------------------------------- Basically the problem is that, when you want to use the method "FindViewById" or "GetSystemService" or other does not let me. He only lets me use them in MainActivity, I wanted to know how I can solve this problem. I'm new to android Studio and I'm basically learning # MainAtivity # public class SectionsPagerAdapter extends FragmentPagerAdapter { public SectionsPagerAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { switch (position){ case 0: tap1alarmas tap1 = new tap1alarmas(); return tap1; case 1: tap2tips tap2 = new tap2tips(); return tap2; case 2: tap3estadisticas tap3 = new tap3estadisticas(); return tap3; default: return null; } } # Fragment "Tap1alarmas" # import android.app.AlarmManager; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.TextView; import android.widget.TimePicker; import java.util.Calendar; public class tap1alarmas extends Fragment { AlarmManager alarm_manager; TimePicker alarm_timepicker; TextView update_text; tap1alarmas context; private MainActivity.SectionsPagerAdapter mSectionsPagerAdapter; private ViewPager mViewPager; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.context = this; //Inicizaliar alarmmanager alarm_manager = (AlarmManager) getSystemService(ALARM_SERVICE); //Inicializar timepicker alarm_timepicker = (TimePicker) findViewById(R.id.TimePicker); //Text uptate`enter code here` update_text = (TextView) findViewById(R.id.update_text);
0debug
Read a file name and create a column with it : <p>i have a filename called shoes_2016, how do I create a dataframe column called year and extract out the year according to the filename.</p>
0debug
Read/write MS office document(excel,word) without OLE in perl : <p>How can I read a MS office document(excel, word) without using WIN32::OLE in perl so we can do it in any place we want (like a server).</p>
0debug
static uint64_t omap2_inth_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque; int offset = addr; int bank_no, line_no; struct omap_intr_handler_bank_s *bank = NULL; if ((offset & 0xf80) == 0x80) { bank_no = (offset & 0x60) >> 5; if (bank_no < s->nbanks) { offset &= ~0x60; bank = &s->bank[bank_no]; } } switch (offset) { case 0x00: return 0x21; case 0x10: return (s->autoidle >> 2) & 1; case 0x14: return 1; case 0x40: return s->sir_intr[0]; case 0x44: return s->sir_intr[1]; case 0x48: return (!s->mask) << 2; case 0x4c: return 0; case 0x50: return s->autoidle & 3; case 0x80: return bank->inputs; case 0x84: return bank->mask; case 0x88: case 0x8c: return 0; case 0x90: return bank->swi; case 0x94: return 0; case 0x98: return bank->irqs & ~bank->mask & ~bank->fiq; case 0x9c: return bank->irqs & ~bank->mask & bank->fiq; case 0x100 ... 0x300: bank_no = (offset - 0x100) >> 7; if (bank_no > s->nbanks) break; bank = &s->bank[bank_no]; line_no = (offset & 0x7f) >> 2; return (bank->priority[line_no] << 2) | ((bank->fiq >> line_no) & 1); } OMAP_BAD_REG(addr); return 0; }
1threat
decode_cabac_residual_internal(const H264Context *h, H264SliceContext *sl, int16_t *block, int cat, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff, int is_dc, int chroma422) { static const int significant_coeff_flag_offset[2][14] = { { 105+0, 105+15, 105+29, 105+44, 105+47, 402, 484+0, 484+15, 484+29, 660, 528+0, 528+15, 528+29, 718 }, { 277+0, 277+15, 277+29, 277+44, 277+47, 436, 776+0, 776+15, 776+29, 675, 820+0, 820+15, 820+29, 733 } }; static const int last_coeff_flag_offset[2][14] = { { 166+0, 166+15, 166+29, 166+44, 166+47, 417, 572+0, 572+15, 572+29, 690, 616+0, 616+15, 616+29, 748 }, { 338+0, 338+15, 338+29, 338+44, 338+47, 451, 864+0, 864+15, 864+29, 699, 908+0, 908+15, 908+29, 757 } }; static const int coeff_abs_level_m1_offset[14] = { 227+0, 227+10, 227+20, 227+30, 227+39, 426, 952+0, 952+10, 952+20, 708, 982+0, 982+10, 982+20, 766 }; static const uint8_t significant_coeff_flag_offset_8x8[2][63] = { { 0, 1, 2, 3, 4, 5, 5, 4, 4, 3, 3, 4, 4, 4, 5, 5, 4, 4, 4, 4, 3, 3, 6, 7, 7, 7, 8, 9,10, 9, 8, 7, 7, 6,11,12,13,11, 6, 7, 8, 9,14,10, 9, 8, 6,11, 12,13,11, 6, 9,14,10, 9,11,12,13,11,14,10,12 }, { 0, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 7, 7, 8, 4, 5, 6, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,11,12,11, 9, 9,10,10, 8,13,13, 9, 9,10,10, 8,13,13, 9, 9,10,10,14,14,14,14,14 } }; static const uint8_t sig_coeff_offset_dc[7] = { 0, 0, 1, 1, 2, 2, 2 }; static const uint8_t coeff_abs_level1_ctx[8] = { 1, 2, 3, 4, 0, 0, 0, 0 }; static const uint8_t coeff_abs_levelgt1_ctx[2][8] = { { 5, 5, 5, 5, 6, 7, 8, 9 }, { 5, 5, 5, 5, 6, 7, 8, 8 }, }; static const uint8_t coeff_abs_level_transition[2][8] = { { 1, 2, 3, 3, 4, 5, 6, 7 }, { 4, 4, 4, 4, 5, 6, 7, 7 } }; int index[64]; int last; int coeff_count = 0; int node_ctx = 0; uint8_t *significant_coeff_ctx_base; uint8_t *last_coeff_ctx_base; uint8_t *abs_level_m1_ctx_base; #if !ARCH_X86 #define CABAC_ON_STACK #endif #ifdef CABAC_ON_STACK #define CC &cc CABACContext cc; cc.range = sl->cabac.range; cc.low = sl->cabac.low; cc.bytestream= sl->cabac.bytestream; #if !UNCHECKED_BITSTREAM_READER || ARCH_AARCH64 cc.bytestream_end = sl->cabac.bytestream_end; #endif #else #define CC &sl->cabac #endif significant_coeff_ctx_base = sl->cabac_state + significant_coeff_flag_offset[MB_FIELD(sl)][cat]; last_coeff_ctx_base = sl->cabac_state + last_coeff_flag_offset[MB_FIELD(sl)][cat]; abs_level_m1_ctx_base = sl->cabac_state + coeff_abs_level_m1_offset[cat]; if( !is_dc && max_coeff == 64 ) { #define DECODE_SIGNIFICANCE( coefs, sig_off, last_off ) \ for(last= 0; last < coefs; last++) { \ uint8_t *sig_ctx = significant_coeff_ctx_base + sig_off; \ if( get_cabac( CC, sig_ctx )) { \ uint8_t *last_ctx = last_coeff_ctx_base + last_off; \ index[coeff_count++] = last; \ if( get_cabac( CC, last_ctx ) ) { \ last= max_coeff; \ break; \ } \ } \ }\ if( last == max_coeff -1 ) {\ index[coeff_count++] = last;\ } const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD(sl)]; #ifdef decode_significance coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index, last_coeff_ctx_base, sig_off); } else { if (is_dc && chroma422) { DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]); } else { coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index, last_coeff_ctx_base-significant_coeff_ctx_base); } #else DECODE_SIGNIFICANCE( 63, sig_off[last], ff_h264_last_coeff_flag_offset_8x8[last] ); } else { if (is_dc && chroma422) { DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]); } else { DECODE_SIGNIFICANCE(max_coeff - 1, last, last); } #endif } av_assert2(coeff_count > 0); if( is_dc ) { if( cat == 3 ) h->cbp_table[sl->mb_xy] |= 0x40 << (n - CHROMA_DC_BLOCK_INDEX); else h->cbp_table[sl->mb_xy] |= 0x100 << (n - LUMA_DC_BLOCK_INDEX); sl->non_zero_count_cache[scan8[n]] = coeff_count; } else { if( max_coeff == 64 ) fill_rectangle(&sl->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1); else { av_assert2( cat == 1 || cat == 2 || cat == 4 || cat == 7 || cat == 8 || cat == 11 || cat == 12 ); sl->non_zero_count_cache[scan8[n]] = coeff_count; } } #define STORE_BLOCK(type) \ do { \ uint8_t *ctx = coeff_abs_level1_ctx[node_ctx] + abs_level_m1_ctx_base; \ \ int j= scantable[index[--coeff_count]]; \ \ if( get_cabac( CC, ctx ) == 0 ) { \ node_ctx = coeff_abs_level_transition[0][node_ctx]; \ if( is_dc ) { \ ((type*)block)[j] = get_cabac_bypass_sign( CC, -1); \ }else{ \ ((type*)block)[j] = (get_cabac_bypass_sign( CC, -qmul[j]) + 32) >> 6; \ } \ } else { \ int coeff_abs = 2; \ ctx = coeff_abs_levelgt1_ctx[is_dc && chroma422][node_ctx] + abs_level_m1_ctx_base; \ node_ctx = coeff_abs_level_transition[1][node_ctx]; \ \ while( coeff_abs < 15 && get_cabac( CC, ctx ) ) { \ coeff_abs++; \ } \ \ if( coeff_abs >= 15 ) { \ int j = 0; \ while (get_cabac_bypass(CC) && j < 30) { \ j++; \ } \ \ coeff_abs=1; \ while( j-- ) { \ coeff_abs += coeff_abs + get_cabac_bypass( CC ); \ } \ coeff_abs+= 14U; \ } \ \ if( is_dc ) { \ ((type*)block)[j] = get_cabac_bypass_sign( CC, -coeff_abs ); \ }else{ \ ((type*)block)[j] = ((int)(get_cabac_bypass_sign( CC, -coeff_abs ) * qmul[j] + 32)) >> 6; \ } \ } \ } while ( coeff_count ); if (h->pixel_shift) { STORE_BLOCK(int32_t) } else { STORE_BLOCK(int16_t) } #ifdef CABAC_ON_STACK sl->cabac.range = cc.range ; sl->cabac.low = cc.low ; sl->cabac.bytestream= cc.bytestream; #endif }
1threat
static inline int ohci_put_ed(OHCIState *ohci, uint32_t addr, struct ohci_ed *ed) { return put_dwords(ohci, addr, (uint32_t *)ed, sizeof(*ed) >> 2); }
1threat
static void qpeg_decode_intra(const uint8_t *src, uint8_t *dst, int size, int stride, int width, int height) { int i; int code; int c0, c1; int run, copy; int filled = 0; int rows_to_go; rows_to_go = height; height--; dst = dst + height * stride; while((size > 0) && (rows_to_go > 0)) { code = *src++; size--; run = copy = 0; if(code == 0xFC) break; if(code >= 0xF8) { c0 = *src++; c1 = *src++; size -= 2; run = ((code & 0x7) << 16) + (c0 << 8) + c1 + 2; } else if (code >= 0xF0) { c0 = *src++; size--; run = ((code & 0xF) << 8) + c0 + 2; } else if (code >= 0xE0) { run = (code & 0x1F) + 2; } else if (code >= 0xC0) { c0 = *src++; c1 = *src++; size -= 2; copy = ((code & 0x3F) << 16) + (c0 << 8) + c1 + 1; } else if (code >= 0x80) { c0 = *src++; size--; copy = ((code & 0x7F) << 8) + c0 + 1; } else { copy = code + 1; } if(run) { int p; p = *src++; size--; for(i = 0; i < run; i++) { dst[filled++] = p; if (filled >= width) { filled = 0; dst -= stride; rows_to_go--; if(rows_to_go <= 0) break; } } } else { size -= copy; for(i = 0; i < copy; i++) { dst[filled++] = *src++; if (filled >= width) { filled = 0; dst -= stride; rows_to_go--; if(rows_to_go <= 0) break; } } } } }
1threat
what is default puppet username and password? i am trying to login for the first time. Thanks : what is default puppet username and password? i am trying to login for the first time. Thanks just installed and i need to configure using web. And i do not know the username and password. is anybody know what is puppet default username and password
0debug
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags) { AVDictionaryEntry *t = NULL; AVDictionary *tmp = NULL; int ret = 0; if (!options) return 0; while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) { ret = av_opt_set(obj, t->key, t->value, search_flags); if (ret == AVERROR_OPTION_NOT_FOUND) av_dict_set(&tmp, t->key, t->value, 0); else if (ret < 0) { av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value); break; } ret = 0; } av_dict_free(options); *options = tmp; return ret; }
1threat
Tkinter, is it possible to def button(a,b,c,e) : <p>I'm a newbie so I'm possibly missing other way to do something like this. Im trying to: </p> <pre><code>def button(a,b,c,d,e,f): a=ttk.Button(b,text=c,command=d) a.grid(row=e, column=f) </code></pre> <p>so that i can creat buttons like this:</p> <pre><code>button(a,b,c,d,e,f) </code></pre>
0debug
Is GT9800 supported compute_20? : I have NVIDIA GT9800 and CUDA-programm(sample). If I specify code generation as compute_20,sm_20 then the error "invalid device function" occured. With compute_11,sm_11 all correct. Why?
0debug
static int uhci_handle_td(UHCIState *s, UHCIQueue *q, uint32_t qh_addr, UHCI_TD *td, uint32_t td_addr, uint32_t *int_mask) { int len = 0, max_len; bool spd; bool queuing = (q != NULL); uint8_t pid = td->token & 0xff; UHCIAsync *async = uhci_async_find_td(s, td_addr); if (async) { if (uhci_queue_verify(async->queue, qh_addr, td, td_addr, queuing)) { assert(q == NULL || q == async->queue); q = async->queue; } else { uhci_queue_free(async->queue, "guest re-used pending td"); async = NULL; if (q == NULL) { q = uhci_queue_find(s, td); if (q && !uhci_queue_verify(q, qh_addr, td, td_addr, queuing)) { uhci_queue_free(q, "guest re-used qh"); q = NULL; if (q) { q->valid = 32; if (!(td->ctrl & TD_CTRL_ACTIVE)) { if (async) { uhci_queue_free(async->queue, "pending td non-active"); if (td->ctrl & TD_CTRL_IOC) { *int_mask |= 0x01; return TD_RESULT_NEXT_QH; if (async) { if (queuing) { return TD_RESULT_ASYNC_CONT; if (!async->done) { UHCI_TD last_td; UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs, asyncs_head); uhci_read_td(s, &last_td, last->td_addr); uhci_queue_fill(async->queue, &last_td); return TD_RESULT_ASYNC_CONT; uhci_async_unlink(async); goto done; if (q == NULL) { USBDevice *dev = uhci_find_device(s, (td->token >> 8) & 0x7f); USBEndpoint *ep = usb_ep_get(dev, pid, (td->token >> 15) & 0xf); q = uhci_queue_new(s, qh_addr, td, ep); async = uhci_async_alloc(q, td_addr); max_len = ((td->token >> 21) + 1) & 0x7ff; spd = (pid == USB_TOKEN_IN && (td->ctrl & TD_CTRL_SPD) != 0); usb_packet_setup(&async->packet, pid, q->ep, td_addr, spd, (td->ctrl & TD_CTRL_IOC) != 0); qemu_sglist_add(&async->sgl, td->buffer, max_len); usb_packet_map(&async->packet, &async->sgl); switch(pid) { case USB_TOKEN_OUT: case USB_TOKEN_SETUP: len = usb_handle_packet(q->ep->dev, &async->packet); if (len >= 0) len = max_len; break; case USB_TOKEN_IN: len = usb_handle_packet(q->ep->dev, &async->packet); break; default: usb_packet_unmap(&async->packet, &async->sgl); uhci_async_free(async); s->status |= UHCI_STS_HCPERR; uhci_update_irq(s); return TD_RESULT_STOP_FRAME; if (len == USB_RET_ASYNC) { uhci_async_link(async); if (!queuing) { uhci_queue_fill(q, td); return TD_RESULT_ASYNC_START; async->packet.result = len; done: len = uhci_complete_td(s, td, async, int_mask); usb_packet_unmap(&async->packet, &async->sgl); uhci_async_free(async); return len;
1threat
Creating figure with exact size and no padding (and legend outside the axes) : <p>I am trying to make some figures for a scientific article, so I want my figures to have a specific size. I also see that Matplotlib by default adds a lot of padding on the border of the figures, which I don't need (since the figures will be on a white background anyway).</p> <p>To set a specific figure size I simply use <code>plt.figure(figsize = [w, h])</code>, and I add the argument <code>tight_layout = {'pad': 0}</code> to remove the padding. This works perfectly, and even works if I add a title, y/x-labels etc. Example:</p> <pre><code>fig = plt.figure( figsize = [3,2], tight_layout = {'pad': 0} ) ax = fig.add_subplot(111) plt.title('title') ax.set_ylabel('y label') ax.set_xlabel('x label') plt.savefig('figure01.pdf') </code></pre> <p>This creates a pdf file with exact size 3x2 (inches).</p> <p><a href="https://i.stack.imgur.com/rA2d5.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rA2d5.png" alt="figure01.png"></a></p> <p>The issue I have is that when I for example add a text box outside the axis (typically a legend box), Matplotlib does not make room for the text box like it does when adding titles/axis labels. Typically the text box is cut off, or does not show in the saved figure at all. Example:</p> <pre><code>plt.close('all') fig = plt.figure( figsize = [3,2], tight_layout = {'pad': 0} ) ax = fig.add_subplot(111) plt.title('title') ax.set_ylabel('y label') ax.set_xlabel('x label') t = ax.text(0.7, 1.1, 'my text here', bbox = dict(boxstyle = 'round')) plt.savefig('figure02.pdf') </code></pre> <p><a href="https://i.stack.imgur.com/IiwkM.png" rel="noreferrer"><img src="https://i.stack.imgur.com/IiwkM.png" alt="figure02.png"></a></p> <p>A solution I found elsewhere on SO was to add the argument <code>bbox_inches = 'tight'</code> to the savefig command. The text box is now included like I wanted, but the pdf is now the wrong size. It seems like Matplotlib just makes the figure bigger, instead of reducing the size of the axes like it does when adding titles and x/y-labels.</p> <p>Example:</p> <pre><code>plt.close('all') fig = plt.figure( figsize = [3,2], tight_layout = {'pad': 0} ) ax = fig.add_subplot(111) plt.title('title') ax.set_ylabel('y label') ax.set_xlabel('x label') t = ax.text(0.7, 1.1, 'my text here', bbox = dict(boxstyle = 'round')) plt.savefig('figure03.pdf', bbox_inches = 'tight') </code></pre> <p><a href="https://i.stack.imgur.com/5Es2Q.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5Es2Q.png" alt="figure03.png"></a></p> <p>(This figure is 3.307x2.248)</p> <p>Is there any solution to this that covers most cases with a legend just outside the axes?</p>
0debug
Cannot convert decimal(4,2) to decimal(10,2) : <p>I have <a href="https://i.stack.imgur.com/YI0a5.png" rel="nofollow noreferrer">this field in my table.</a> I need to make it decimal(10,2), but when I tried to do it, <a href="https://i.stack.imgur.com/8y8iv.png" rel="nofollow noreferrer">I receive an error</a>.</p>
0debug
document.getElementById('input').innerHTML = user_input;
1threat
How to check if weak_ptr is empty (non-assigned)? : <p>Is there a way to distinguish between an assigned (possibly expired) weak_ptr and a non-assigned one.</p> <pre><code>weak_ptr&lt;int&gt; w1; weak_ptr&lt;int&gt; w2 = ...; </code></pre> <p>I understand the following checks for either non-assignment or expiry, but is there a (cheaper?) check for only non-assignment?</p> <pre><code>if (!w.lock()) { /* either not assigned or expired */ } </code></pre>
0debug
I want to compare the each and every value in a java map with another value : If a value matches with another value then, i want to get the key,value pair corresponding to that value into a new map and values that doesn't match i.e unique key,value pairs into another map. Eg: Map<String,Double> map = new HashMap<String,Double>(); map.put("First",123.12345); //data1 map.put("Second",234.3456); //data2 map.put("Third",576.9876); //data3 map.put("Fourth",123.12345);//data4 map.put("Fifth",234.3456); //data5 map.put("Sixth",999.8888); //data6 map.put("Seventh",677.4578); //data7 Now here (data1 and data4) values (data2 and data5) and match and i want to store these (key,value) pairs in a new Map Similarly data3, data and data7 have unique values and i want to store these (key,value) pairs in another new Map. Any help is appreciated..... Thanks in advance.....
0debug
static QmpOutputVisitor *to_qov(Visitor *v) { return container_of(v, QmpOutputVisitor, visitor); }
1threat
void OPPROTO op_sti(void) { raise_exception(EXCP0D_GPF); }
1threat
static inline void write_mem(IVState *s, uint64_t off, const void *buf, size_t len) { QTestState *qtest = global_qtest; global_qtest = s->qtest; qpci_memwrite(s->dev, s->mem_base + off, buf, len); global_qtest = qtest; }
1threat
void s390_cpu_do_interrupt(CPUState *cs) { S390CPU *cpu = S390_CPU(cs); CPUS390XState *env = &cpu->env; qemu_log_mask(CPU_LOG_INT, "%s: %d at pc=%" PRIx64 "\n", __func__, cs->exception_index, env->psw.addr); s390_cpu_set_state(CPU_STATE_OPERATING, cpu); if ((env->psw.mask & PSW_MASK_MCHECK) && (cs->exception_index == -1)) { if (env->pending_int & INTERRUPT_MCHK) { cs->exception_index = EXCP_MCHK; } } if ((env->psw.mask & PSW_MASK_EXT) && cs->exception_index == -1 && (env->pending_int & INTERRUPT_EXT)) { cs->exception_index = EXCP_EXT; } if ((env->psw.mask & PSW_MASK_IO) && (cs->exception_index == -1)) { if (env->pending_int & INTERRUPT_IO) { cs->exception_index = EXCP_IO; } } switch (cs->exception_index) { case EXCP_PGM: do_program_interrupt(env); break; case EXCP_SVC: do_svc_interrupt(env); break; case EXCP_EXT: do_ext_interrupt(env); break; case EXCP_IO: do_io_interrupt(env); break; case EXCP_MCHK: do_mchk_interrupt(env); break; } cs->exception_index = -1; if (!env->pending_int) { cs->interrupt_request &= ~CPU_INTERRUPT_HARD; } }
1threat
static void hash32_bat_601_size(CPUPPCState *env, target_ulong *blp, int *validp, target_ulong batu, target_ulong batl) { target_ulong bl; int valid; bl = (batl & BATL32_601_BL) << 17; LOG_BATS("b %02x ==> bl " TARGET_FMT_lx " msk " TARGET_FMT_lx "\n", (uint8_t)(batl & BATL32_601_BL), bl, ~bl); valid = !!(batl & BATL32_601_V); *blp = bl; *validp = valid; }
1threat
static void v9fs_getattr(void *opaque) { int32_t fid; size_t offset = 7; ssize_t retval = 0; struct stat stbuf; V9fsFidState *fidp; uint64_t request_mask; V9fsStatDotl v9stat_dotl; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; pdu_unmarshal(pdu, offset, "dq", &fid, &request_mask); fidp = get_fid(pdu, fid); if (fidp == NULL) { retval = -ENOENT; goto out_nofid; } retval = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (retval < 0) { goto out; } stat_to_v9stat_dotl(s, &stbuf, &v9stat_dotl); if (request_mask & P9_STATS_GEN) { retval = v9fs_co_st_gen(pdu, &fidp->path, stbuf.st_mode, &v9stat_dotl); if (retval < 0) { goto out; } v9stat_dotl.st_result_mask |= P9_STATS_GEN; } retval = offset; retval += pdu_marshal(pdu, offset, "A", &v9stat_dotl); out: put_fid(pdu, fidp); out_nofid: trace_v9fs_getattr_return(pdu->tag, pdu->id, v9stat_dotl.st_result_mask, v9stat_dotl.st_mode, v9stat_dotl.st_uid, v9stat_dotl.st_gid); complete_pdu(s, pdu, retval); }
1threat
override ToString() behave with Binding : see below `XAML`: <Window x:Class="TabControl.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:TabControl" Title="MainWindow" Height="300" Width="300" xmlns:Interact="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}" > <Window.Resources> <Style TargetType="{x:Type DataGridRow}" x:Key="myStyle"> <Style.Triggers> <DataTrigger Binding="{Binding IsTrend.Value}" Value="True" > <Setter Property="Background" Value="Gold"/> </DataTrigger> </Style.Triggers> </Style> </Window.Resources> <ScrollViewer> <DataGrid ItemsSource="{Binding list}" x:Name="myGrid" RowStyle="{StaticResource myStyle}" > <DataGrid.Columns> <DataGridTextColumn Header="Name" Binding="{Binding Path=Name.Value,Mode=TwoWay}" /> </DataGrid.Columns> </DataGrid> </ScrollViewer> </Window> ***Source of `DataGrid`*** private ObservableCollection<dynamic> GetDynamicOrders2() { var retVal = new ObservableCollection<dynamic>(); for (int i = 0; i < 50; i++) { dynamic eo = new ExpandoObject(); eo.Name = new CellContent("Order" + i); eo.IsTrend = new CellContent(i % 2 == 0); retVal.Add(eo); } return retVal; } ***Class*** public sealed class CellContent : INotifyPropertyChanged { private object _value; public object Value { get { return _value; } set { _value = value; OnPropertyChanged("Value"); } } public CellContent(object value) { Value = value; } public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(string propertyName) { var handler = PropertyChanged; if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName)); } } To remove `.Value` from every binding I `override` `ToString()` method. public override string ToString() { return Value.ToString(); } and Binding is changed as: <DataGridTextColumn Header="Name" Binding="{Binding Path=Name,Mode=TwoWay}" /> ***But It's behaving differently for `DataTrigger` and `Column` Binding. Can someone explain why and How? Why is `DataTrigger` not working after the change?***
0debug
Is there any way to debug chrome in any IOS device : <p>Is there any way to debug chrome browser on IOS device?</p> <p>If there is no way, how i can approach to bug in chrome on ios?</p> <p>Searched the web and didn't find sufficient answer.</p>
0debug
How to make a tablet screen open on command? : <p>i want to make my samsung galaxy tab 3 t111 screen to be permanent open only when it's connected to the microUSB. Trying to make a car navigation.</p>
0debug
updating table in sql : <p>I have data from an sql query which i need to update in a table. Im saving the output of this query as a csv file. When i do load this file in sql though using the import export wizard, the data is all jumbled up as the columns have shifted in a lot of cases. So unrelated data is updated in many columns. </p> <p>What could be the reason for this and please suggest a resolution.</p> <p>Regards, Priyesh</p>
0debug
static int get_segment32(CPUPPCState *env, struct mmu_ctx_hash32 *ctx, target_ulong eaddr, int rw, int type) { hwaddr hash; target_ulong vsid; int ds, pr, target_page_bits; int ret, ret2; target_ulong sr, pgidx; pr = msr_pr; ctx->eaddr = eaddr; sr = env->sr[eaddr >> 28]; ctx->key = (((sr & SR32_KP) && (pr != 0)) || ((sr & SR32_KS) && (pr == 0))) ? 1 : 0; ds = !!(sr & SR32_T); ctx->nx = !!(sr & SR32_NX); vsid = sr & SR32_VSID; target_page_bits = TARGET_PAGE_BITS; LOG_MMU("Check segment v=" TARGET_FMT_lx " %d " TARGET_FMT_lx " nip=" TARGET_FMT_lx " lr=" TARGET_FMT_lx " ir=%d dr=%d pr=%d %d t=%d\n", eaddr, (int)(eaddr >> 28), sr, env->nip, env->lr, (int)msr_ir, (int)msr_dr, pr != 0 ? 1 : 0, rw, type); pgidx = (eaddr & ~SEGMENT_MASK_256M) >> target_page_bits; hash = vsid ^ pgidx; ctx->ptem = (vsid << 7) | (pgidx >> 10); LOG_MMU("pte segment: key=%d ds %d nx %d vsid " TARGET_FMT_lx "\n", ctx->key, ds, ctx->nx, vsid); ret = -1; if (!ds) { if (type != ACCESS_CODE || ctx->nx == 0) { LOG_MMU("htab_base " TARGET_FMT_plx " htab_mask " TARGET_FMT_plx " hash " TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, hash); ctx->hash[0] = hash; ctx->hash[1] = ~hash; ctx->raddr = (hwaddr)-1ULL; LOG_MMU("0 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " ptem=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ctx->ptem, ctx->hash[0]); ret = find_pte32(env, ctx, 0, rw, type, target_page_bits); if (ret < 0) { LOG_MMU("1 htab=" TARGET_FMT_plx "/" TARGET_FMT_plx " vsid=" TARGET_FMT_lx " api=" TARGET_FMT_lx " hash=" TARGET_FMT_plx "\n", env->htab_base, env->htab_mask, vsid, ctx->ptem, ctx->hash[1]); ret2 = find_pte32(env, ctx, 1, rw, type, target_page_bits); if (ret2 != -1) { ret = ret2; } } #if defined(DUMP_PAGE_TABLES) if (qemu_log_enabled()) { hwaddr curaddr; uint32_t a0, a1, a2, a3; qemu_log("Page table: " TARGET_FMT_plx " len " TARGET_FMT_plx "\n", sdr, mask + 0x80); for (curaddr = sdr; curaddr < (sdr + mask + 0x80); curaddr += 16) { a0 = ldl_phys(curaddr); a1 = ldl_phys(curaddr + 4); a2 = ldl_phys(curaddr + 8); a3 = ldl_phys(curaddr + 12); if (a0 != 0 || a1 != 0 || a2 != 0 || a3 != 0) { qemu_log(TARGET_FMT_plx ": %08x %08x %08x %08x\n", curaddr, a0, a1, a2, a3); } } } #endif } else { LOG_MMU("No access allowed\n"); ret = -3; } } else { target_ulong sr; LOG_MMU("direct store...\n"); sr = env->sr[eaddr >> 28]; if ((sr & 0x1FF00000) >> 20 == 0x07f) { ctx->raddr = ((sr & 0xF) << 28) | (eaddr & 0x0FFFFFFF); ctx->prot = PAGE_READ | PAGE_WRITE | PAGE_EXEC; return 0; } switch (type) { case ACCESS_INT: break; case ACCESS_CODE: return -4; case ACCESS_FLOAT: return -4; case ACCESS_RES: return -4; case ACCESS_CACHE: ctx->raddr = eaddr; return 0; case ACCESS_EXT: return -4; default: qemu_log("ERROR: instruction should not need " "address translation\n"); return -4; } if ((rw == 1 || ctx->key != 1) && (rw == 0 || ctx->key != 0)) { ctx->raddr = eaddr; ret = 2; } else { ret = -2; } } return ret; }
1threat
Linq string filed range based selection : i want do range based filtration on linq query but property type is string even though it stored numerical data is there way to do this VOUCHERNO property type is string but now new request came to do range base selection from to it stores numbers
0debug
Get part numbers for all parts supplied by more than one supplier. : Im confused with the above query, what it is trying to say and what will be the Oracle Query for that. I have the following table: > Supp(S_No, S_Name, Status, City) > Supp2(S_No, P_No, Quantity)
0debug
Valgrind on macOS Sierra : <p>I following this guide:</p> <p><a href="http://valgrind.org/downloads/repository.html">valgrind installation guide</a></p> <p>After I have downloading the package, and I have run the sh script, but when I launch the <code>make install</code> command, it couldn't create the folder because it don't have the permission (even though I have used the <code>sudo</code> command).</p> <p>Furthermore I tried with brew but I have this error: </p> <blockquote> <p>valgrind: This formula either does not compile or function as expected on macOS versions newer than El Capitan due to an upstream incompatibility.</p> <p>Error: An unsatisfied requirement failed this build.</p> </blockquote>
0debug
SocketAddress *socket_address_crumple(SocketAddressFlat *addr_flat) { SocketAddress *addr = g_new(SocketAddress, 1); switch (addr_flat->type) { case SOCKET_ADDRESS_FLAT_TYPE_INET: addr->type = SOCKET_ADDRESS_KIND_INET; addr->u.inet.data = QAPI_CLONE(InetSocketAddress, &addr_flat->u.inet); break; case SOCKET_ADDRESS_FLAT_TYPE_UNIX: addr->type = SOCKET_ADDRESS_KIND_UNIX; addr->u.q_unix.data = QAPI_CLONE(UnixSocketAddress, &addr_flat->u.q_unix); break; case SOCKET_ADDRESS_FLAT_TYPE_VSOCK: addr->type = SOCKET_ADDRESS_KIND_VSOCK; addr->u.vsock.data = QAPI_CLONE(VsockSocketAddress, &addr_flat->u.vsock); break; case SOCKET_ADDRESS_FLAT_TYPE_FD: addr->type = SOCKET_ADDRESS_KIND_FD; addr->u.fd.data = QAPI_CLONE(String, &addr_flat->u.fd); break; default: abort(); } return addr; }
1threat
static void test_visitor_in_fail_list(TestInputVisitorData *data, const void *unused) { int64_t i64 = -1; Error *err = NULL; Visitor *v; v = visitor_input_test_init(data, "[ 1, 2, 3 ]"); visit_type_int(v, NULL, &i64, &error_abort); g_assert_cmpint(i64, ==, 1); visit_type_int(v, NULL, &i64, &error_abort); g_assert_cmpint(i64, ==, 2); visit_check_list(v, &err); }
1threat
Cannot find module "service" (with spaces) : <p><a href="https://i.stack.imgur.com/iY8lv.png" rel="nofollow noreferrer">Sublime Screenshot</a></p> <p>I don't understand why am I getting this error. I am including the correct name. Any help is appropriated.</p>
0debug
Angular 4: Mock ElementRef : <p>I'm trying to figure out how to mock an <code>ElementRef</code> that is injected into a component. My component is as follows:</p> <p><strong>app.component.ts:</strong></p> <pre><code>import { Component, ElementRef } from '@angular/core'; import { AppService } from './app.service'; @Component({ selector: 'app-root', templateUrl: './app/app.component.html', styleUrls: ['./app/app.component.css'] }) export class AppComponent { title = 'app works!'; constructor(private _elementRef: ElementRef, private _appService: AppService) { console.log(this._elementRef); console.log(this._appService); } } </code></pre> <p>and my test spec as follows:</p> <p><strong>app.component.spec.ts:</strong></p> <pre><code>import { TestBed, async } from '@angular/core/testing'; import { ElementRef, Injectable } from '@angular/core'; import { AppComponent } from './app.component'; import { AppService } from './app.service'; @Injectable() export class MockElementRef { nativeElement: {} } @Injectable() export class MockAppService { } describe('AppComponent', () =&gt; { beforeEach(async(() =&gt; { TestBed.configureTestingModule({ declarations: [ AppComponent ], providers: [ {provide: ElementRef, useClass: MockElementRef}, {provide: AppService, useClass: MockAppService} ] }).compileComponents(); })); ... }); </code></pre> <p>When the tests are ran, the output from the <code>console.log</code>'s in constructor of <code>app.component.ts</code> is:</p> <p><a href="https://i.stack.imgur.com/63m25.png" rel="noreferrer"><img src="https://i.stack.imgur.com/63m25.png" alt="console output"></a></p> <p>As you can see, it's injecting the <code>MockAppService</code> but not the <code>MockElementRef</code> (even though they are both mocked in the same way).</p> <p>This <a href="https://stackoverflow.com/questions/38623065/angular2-inject-elementref-in-unit-test">SO post suggests</a> to set it up as you would any other mock, however I've noticed that this is for Angular 2 - so am wondering if things have changed in Angular 4?</p> <p>A Plunker with the above code and Jasmine tests can be found <a href="https://plnkr.co/edit/gTjUg396RI2SmSvGWjKd?p=preview" rel="noreferrer">here</a>. Run the Plunker then click the "Run Unit Tests" link in order to start the unit tests. The console output can be observed in developer tools/Firebug.</p>
0debug
noexcept specifier mysteriously breaks compilation (clang, gcc disagree) : <p>The code in question is</p> <pre><code>#include &lt;functional&gt; #include &lt;utility&gt; template &lt;typename F&gt; void for_each(F&amp;&amp;) noexcept {} template &lt;typename F, typename T, typename... Us&gt; void for_each(F&amp;&amp; f, T&amp;&amp; v, Us&amp;&amp;... us) { std::invoke(std::forward&lt;F&gt;(f), std::forward&lt;T&gt;(v)); for_each(std::forward&lt;F&gt;(f), std::forward&lt;Us&gt;(us)...); } void func(void*) noexcept {} int main() { for_each(func, nullptr); } </code></pre> <p>It compiles on <a href="https://wandbox.org/permlink/kWMYa4q1zkkYOJlR" rel="noreferrer">gcc 8</a>, but fails on <a href="https://wandbox.org/permlink/BBNBHck5NFIrvLGx" rel="noreferrer">clang 6</a> with the following error:</p> <pre><code>/opt/wandbox/clang-6.0.0/include/c++/v1/type_traits:4198:19: error: invalid application of 'sizeof' to a function type static_assert(sizeof(_Tp) &gt; 0, "Type must be complete."); ^~~~~~~~~~~ /opt/wandbox/clang-6.0.0/include/c++/v1/type_traits:4203:15: note: in instantiation of template class 'std::__1::__check_complete&lt;void (void *) noexcept&gt;' requested here : private __check_complete&lt;_Tp&gt; ^ /opt/wandbox/clang-6.0.0/include/c++/v1/type_traits:4496:15: note: in instantiation of template class 'std::__1::__check_complete&lt;void (&amp;)(void *) noexcept&gt;' requested here : private __check_complete&lt;_Fp&gt; ^ /opt/wandbox/clang-6.0.0/include/c++/v1/type_traits:4559:9: note: in instantiation of template class 'std::__1::__invokable_r&lt;void, void (&amp;)(void *) noexcept, nullptr_t &amp;&amp;&gt;' requested here __invokable&lt;_Fp, _Args...&gt;::value, ^ /opt/wandbox/clang-6.0.0/include/c++/v1/type_traits:4568:14: note: in instantiation of template class 'std::__1::__invoke_of&lt;void (&amp;)(void *) noexcept, nullptr_t &amp;&amp;&gt;' requested here : public __invoke_of&lt;_Fp, _Args...&gt; ^ /opt/wandbox/clang-6.0.0/include/c++/v1/type_traits:4573:22: note: in instantiation of template class 'std::__1::result_of&lt;void (&amp;(nullptr_t &amp;&amp;))(void *) noexcept&gt;' requested here template &lt;class _Tp&gt; using result_of_t = typename result_of&lt;_Tp&gt;::type; ^ /opt/wandbox/clang-6.0.0/include/c++/v1/functional:2349:1: note: in instantiation of template type alias 'result_of_t' requested here result_of_t&lt;_Fn&amp;&amp;(_Args&amp;&amp;...)&gt; ^ prog.cc:9:3: note: while substituting deduced template arguments into function template 'invoke' [with _Fn = void (&amp;)(void *) noexcept, _Args = &lt;nullptr_t&gt;] std::invoke(std::forward&lt;F&gt;(f), std::forward&lt;T&gt;(v)); ^ prog.cc:16:3: note: in instantiation of function template specialization 'for_each&lt;void (&amp;)(void *) noexcept, nullptr_t&gt;' requested here for_each(func, nullptr); ^ 1 error generated. </code></pre> <p>Remove the <code>noexcept</code> specifier on <code>func()</code></p> <pre><code>void func(void*) /* noexcept */ {} </code></pre> <p>It then compiles. I don't get this. Is this a compiler bug? </p>
0debug
Is it safe to show the AWS cognito pool ID in my html? : <p>I am building a serverless website with AWS Cognito, Lambda, S3 and a dozen more of their services. My HTML/JS in my login page has the cognito pool ID. How safe is this? I know that it is best practise to hide sensitive stuff. But this is not client-server. Its all client if im honest. I do access some sensitive data via a lambda call. But even this call requires some plain-text sensitive inputs like the user ID. </p> <pre><code> &lt;script src="https://sdk.amazonaws.com/js/aws-sdk-2.3.7.min.js"&gt; &lt;/script&gt; &lt;script&gt; AWS.config.region = 'XX-XXXX-1'; AWS.config.credentials = new AWS.CognitoIdentityCredentials({ IdentityPoolId: 'XX-XXXX-1:XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX' }); var lambda = new AWS.Lambda(); &lt;/script&gt; </code></pre> <p>I really dont like the poolID visible. An attacker can copy this and brute force my cognito IDs. Any ideas to hide it?</p>
0debug
Python: Function produces different output after coverting it to a generator function : I created the following algorithm to create a function for the generation of the Baum-Sweet-Sequence ([Wikipedia][1]) def baum_sweettest(number_as_byte): counter = 0 for bit in str(number_as_byte): print("bit = ", bit) if bit == "0": counter += 1 if bit == "1": if counter%2 !=0 or counter == 1: counter = 0 return 0 print("counter = ", counter) if counter%2 !=0 or counter == 1: counter = 0 return 0 else: return 1 print(baum_sweettest(110)) I am fairly new to Python so I am aware, that this is probably far from the best way to solve it. Any feedback on this is welcome, however I am primarily interested in why this function creates different results, when converted to the following generator-function: def baum_sweet(): yield 1 counter = 0 for n in range(1,1000): number_as_binary = bin(n)[2::] for bit in str(number_as_binary): if bit == "0": counter += 1 if bit == "1": if counter%2 !=0 or counter == 1: counter = 0 yield 0 if counter%2 !=0 or counter == 1: counter = 0 yield 0 else: counter = 0 yield 1 baum_sweettest returns 0 when tested for the number 6 (110) which is correct. The generator-object created by baum_sweet delivers yields correct results up to the number 6, where it yields 1. Since the algorithm is the same in both cases I guess this is due to a different behavior in generator functions. Reading through the documentation I found, that those are not terminated, but rather just continued until the next yield-statement. So I made shure, that my counter will be reset manually before every yield. However the generator-version of my algorithm still yields different results at some point, as the same algorithm in a "non-generator-function". Can someone elaborate why those two functions return/yield different results? [1]: https://en.wikipedia.org/wiki/Baum%E2%80%93Sweet_sequence
0debug
static void pc_init1(MemoryRegion *system_memory, MemoryRegion *system_io, ram_addr_t ram_size, const char *boot_device, const char *kernel_filename, const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, int pci_enabled, int kvmclock_enabled) { int i; ram_addr_t below_4g_mem_size, above_4g_mem_size; PCIBus *pci_bus; ISABus *isa_bus; PCII440FXState *i440fx_state; int piix3_devfn = -1; qemu_irq *cpu_irq; qemu_irq *gsi; qemu_irq *i8259; qemu_irq *smi_irq; GSIState *gsi_state; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; BusState *idebus[MAX_IDE_BUS]; ISADevice *rtc_state; ISADevice *floppy; MemoryRegion *ram_memory; MemoryRegion *pci_memory; MemoryRegion *rom_memory; DeviceState *icc_bridge; FWCfgState *fw_cfg = NULL; PcGuestInfo *guest_info; if (xen_enabled() && xen_hvm_init() != 0) { fprintf(stderr, "xen hardware virtual machine initialisation failed\n"); exit(1); } icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE); object_property_add_child(qdev_get_machine(), "icc-bridge", OBJECT(icc_bridge), NULL); pc_cpus_init(cpu_model, icc_bridge); pc_acpi_init("acpi-dsdt.aml"); if (kvm_enabled() && kvmclock_enabled) { kvmclock_create(); } if (ram_size >= 0xe0000000 ) { above_4g_mem_size = ram_size - 0xe0000000; below_4g_mem_size = 0xe0000000; } else { above_4g_mem_size = 0; below_4g_mem_size = ram_size; } if (pci_enabled) { pci_memory = g_new(MemoryRegion, 1); memory_region_init(pci_memory, NULL, "pci", INT64_MAX); rom_memory = pci_memory; } else { pci_memory = NULL; rom_memory = system_memory; } guest_info = pc_guest_info_init(below_4g_mem_size, above_4g_mem_size); guest_info->has_pci_info = has_pci_info; if (ram_size <= 0x80000000) guest_info->pci_info.w32.begin = 0x80000000; else if (ram_size <= 0xc0000000) guest_info->pci_info.w32.begin = 0xc0000000; else guest_info->pci_info.w32.begin = 0xe0000000; if (!xen_enabled()) { fw_cfg = pc_memory_init(system_memory, kernel_filename, kernel_cmdline, initrd_filename, below_4g_mem_size, above_4g_mem_size, rom_memory, &ram_memory, guest_info); } gsi_state = g_malloc0(sizeof(*gsi_state)); if (kvm_irqchip_in_kernel()) { kvm_pc_setup_irq_routing(pci_enabled); gsi = qemu_allocate_irqs(kvm_pc_gsi_handler, gsi_state, GSI_NUM_PINS); } else { gsi = qemu_allocate_irqs(gsi_handler, gsi_state, GSI_NUM_PINS); } if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, system_memory, system_io, ram_size, below_4g_mem_size, 0x100000000ULL - below_4g_mem_size, 0x100000000ULL + above_4g_mem_size, (sizeof(hwaddr) == 4 ? 0 : ((uint64_t)1 << 62)), pci_memory, ram_memory); } else { pci_bus = NULL; i440fx_state = NULL; isa_bus = isa_bus_new(NULL, system_io); no_hpet = 1; } isa_bus_irqs(isa_bus, gsi); if (kvm_irqchip_in_kernel()) { i8259 = kvm_i8259_init(isa_bus); } else if (xen_enabled()) { i8259 = xen_interrupt_controller_init(); } else { cpu_irq = pc_allocate_cpu_irq(); i8259 = i8259_init(isa_bus, cpu_irq[0]); } for (i = 0; i < ISA_NUM_IRQS; i++) { gsi_state->i8259_irq[i] = i8259[i]; } if (pci_enabled) { ioapic_init_gsi(gsi_state, "i440fx"); } qdev_init_nofail(icc_bridge); pc_register_ferr_irq(gsi[13]); pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL); pc_basic_device_init(isa_bus, gsi, &rtc_state, &floppy, xen_enabled()); pc_nic_init(isa_bus, pci_bus); ide_drive_get(hd, MAX_IDE_BUS); if (pci_enabled) { PCIDevice *dev; if (xen_enabled()) { dev = pci_piix3_xen_ide_init(pci_bus, hd, piix3_devfn + 1); } else { dev = pci_piix3_ide_init(pci_bus, hd, piix3_devfn + 1); } idebus[0] = qdev_get_child_bus(&dev->qdev, "ide.0"); idebus[1] = qdev_get_child_bus(&dev->qdev, "ide.1"); } else { for(i = 0; i < MAX_IDE_BUS; i++) { ISADevice *dev; dev = isa_ide_init(isa_bus, ide_iobase[i], ide_iobase2[i], ide_irq[i], hd[MAX_IDE_DEVS * i], hd[MAX_IDE_DEVS * i + 1]); idebus[i] = qdev_get_child_bus(DEVICE(dev), "ide.0"); } } pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, floppy, idebus[0], idebus[1], rtc_state); if (pci_enabled && usb_enabled(false)) { pci_create_simple(pci_bus, piix3_devfn + 2, "piix3-usb-uhci"); } if (pci_enabled && acpi_enabled) { i2c_bus *smbus; smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1); smbus = piix4_pm_init(pci_bus, piix3_devfn + 3, 0xb100, gsi[9], *smi_irq, kvm_enabled(), fw_cfg); smbus_eeprom_init(smbus, 8, NULL, 0); } if (pci_enabled) { pc_pci_device_init(pci_bus); } if (has_pvpanic) { pvpanic_init(isa_bus); } }
1threat
Android Studio Warning: Using incompatible plugins for the annotation processing : <p>After update Android Studio to 2.3 version I have warning:</p> <blockquote> <p>Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior.</p> </blockquote> <p>Any solutions? My app stopped working...</p>
0debug
Regex Currency formatting in c# (Xamarin) : <p>While entering a Currency value in the Text Field, with help of Regex how do I, automatically make the Comma's to appear while the user is entering the values in a Numeric Text Field.</p> <p>Eg:</p> <p>$1</p> <p>$15</p> <p>$153</p> <p>$1,530</p> <p>$15,306</p> <p>$1,53,068</p> <p>Comma's should automatically be replaced as i keep inserting digits.</p>
0debug
static int parse_metadata(DBEContext *s) { int i, ret, key = parse_key(s), mtd_size; if ((ret = convert_input(s, 1, key)) < 0) return ret; skip_bits(&s->gb, 4); mtd_size = get_bits(&s->gb, 10); if (!mtd_size) { av_log(s->avctx, AV_LOG_ERROR, "Invalid metadata size\n"); return AVERROR_INVALIDDATA; } if ((ret = convert_input(s, mtd_size, key)) < 0) return ret; skip_bits(&s->gb, 14); s->prog_conf = get_bits(&s->gb, 6); if (s->prog_conf > MAX_PROG_CONF) { av_log(s->avctx, AV_LOG_ERROR, "Invalid program configuration\n"); return AVERROR_INVALIDDATA; } s->nb_channels = nb_channels_tab[s->prog_conf]; s->nb_programs = nb_programs_tab[s->prog_conf]; s->fr_code = get_bits(&s->gb, 4); s->fr_code_orig = get_bits(&s->gb, 4); if (!sample_rate_tab[s->fr_code] || !sample_rate_tab[s->fr_code_orig]) { av_log(s->avctx, AV_LOG_ERROR, "Invalid frame rate code\n"); return AVERROR_INVALIDDATA; } skip_bits_long(&s->gb, 88); for (i = 0; i < s->nb_channels; i++) s->ch_size[i] = get_bits(&s->gb, 10); s->mtd_ext_size = get_bits(&s->gb, 8); s->meter_size = get_bits(&s->gb, 8); skip_bits_long(&s->gb, 10 * s->nb_programs); for (i = 0; i < s->nb_channels; i++) { s->rev_id[i] = get_bits(&s->gb, 4); skip_bits1(&s->gb); s->begin_gain[i] = get_bits(&s->gb, 10); s->end_gain[i] = get_bits(&s->gb, 10); } if (get_bits_left(&s->gb) < 0) { av_log(s->avctx, AV_LOG_ERROR, "Read past end of metadata\n"); return AVERROR_INVALIDDATA; } skip_input(s, mtd_size + 1); return 0; }
1threat
Concat two dataframes wit common columns : <p>I have two dataframes with same columns. Only one column has different values. I want to concatenate the two without duplication.</p> <pre class="lang-py prettyprint-override"><code>df2 = pd.DataFrame({'key': ['K0', 'K1', 'K2'],'cat': ['C0', 'C1', 'C2'],'B': ['B0', 'B1', 'B2']}) df1 = pd.DataFrame({'key': ['K0', 'K1', 'K2'],'cat': ['C0', 'C1', 'C2'],'B': ['A0', 'A1', 'A2']}) df1 Out[630]: key cat B 0 K0 C0 A0 1 K1 C1 A1 2 K2 C2 A2 df2 Out[631]: key cat B 0 K0 C0 B0 1 K1 C1 B1 2 K2 C2 B2 </code></pre> <p>I tried:</p> <pre class="lang-py prettyprint-override"><code>result = pd.concat([df1, df2], axis=1) result Out[633]: key cat B key cat B 0 K0 C0 A0 K0 C0 B0 1 K1 C1 A1 K1 C1 B1 2 K2 C2 A2 K2 C2 B2 </code></pre> <p>The desired output:</p> <pre><code> key cat B_df1 B_df2 0 K0 C0 A0 B0 1 K1 C1 A1 B1 2 K2 C2 A2 B2 </code></pre> <p>NOTE: I could drop duplicates afterwards and rename columns but that doesn't seem efficient</p>
0debug
OpenNLP vs Stanford CoreNLP : <p>I've been doing a little comparison of these two packages and am not sure which direction to go in. What I am looking for briefly is:</p> <ol> <li>Named Entity Recognition (people, places, organizations and such).</li> <li>Gender identification.</li> <li>A decent training API.</li> </ol> <p>From what I can tell, OpenNLP and Stanford CoreNLP expose pretty similar capabilities. However, Stanford CoreNLP looks like it has a lot more activity whereas OpenNLP has only had a few commits in the last six months.</p> <p>Based on what I saw, OpenNLP appears to be easier to train new models and might be more attractive for that reason alone. However, my question is what would others start with as the basis for adding NLP features to a Java app? I'm mostly worried as to whether OpenNLP is "just mature" versus semi-abandoned.</p>
0debug
HTML Input: Require URL to end in specific filetype : <p>How can I make a URL Input form require the input to be both a valid URL, and end in a specific filetype.</p> <p>For example, this is my input:</p> <p><code>&lt;input name="bg" placeholder="https://website.com/image" type="url"&gt;</code></p> <p>As you can see, It is using the URL type, which restricts it to a valid http:// domain, but I would like the input field to only accept .png, .jpg, and .gif files.</p> <p>Can this be achieved through html or javascript, and if so, how?</p> <p>Thanks!</p>
0debug
static int read_table(AVFormatContext *avctx, AVStream *st, int (*parse)(AVFormatContext *avctx, AVStream *st, const char *name, int size)) { int count, i; AVIOContext *pb = avctx->pb; avio_skip(pb, 4); count = avio_rb32(pb); avio_skip(pb, 4); for (i = 0; i < count; i++) { char name[17]; int size; avio_read(pb, name, 16); name[sizeof(name) - 1] = 0; size = avio_rb32(pb); if (size < 0) { av_log(avctx, AV_LOG_ERROR, "entry size %d is invalid\n", size); return AVERROR_INVALIDDATA; } if (parse(avctx, st, name, size) < 0) { avpriv_request_sample(avctx, "Variable %s", name); avio_skip(pb, size); } } return 0; }
1threat
Creating a nested dictionary from a flattened dictionary : <p>I have a flattened dictionary which I want to make into a nested one, of the form</p> <pre><code>flat = {'X_a_one': 10, 'X_a_two': 20, 'X_b_one': 10, 'X_b_two': 20, 'Y_a_one': 10, 'Y_a_two': 20, 'Y_b_one': 10, 'Y_b_two': 20} </code></pre> <p>I want to convert it to the form</p> <pre><code>nested = {'X': {'a': {'one': 10, 'two': 20}, 'b': {'one': 10, 'two': 20}}, 'Y': {'a': {'one': 10, 'two': 20}, 'b': {'one': 10, 'two': 20}}} </code></pre> <p>The structure of the flat dictionary is such that there should not be any problems with ambiguities. I want it to work for dictionaries of arbitrary depth, but performance is not really an issue. I've seen lots of methods for flattening a nested dictionary, but basically none for nesting a flattened dictionary. The values stored in the dictionary are either scalars or strings, never iterables.</p> <p>So far I have got something which can take the input </p> <pre><code>test_dict = {'X_a_one': '10', 'X_b_one': '10', 'X_c_one': '10'} </code></pre> <p>to the output</p> <pre><code>test_out = {'X': {'a_one': '10', 'b_one': '10', 'c_one': '10'}} </code></pre> <p>using the code</p> <pre><code>def nest_once(inp_dict): out = {} if isinstance(inp_dict, dict): for key, val in inp_dict.items(): if '_' in key: head, tail = key.split('_', 1) if head not in out.keys(): out[head] = {tail: val} else: out[head].update({tail: val}) else: out[key] = val return out test_out = nest_once(test_dict) </code></pre> <p>But I'm having trouble working out how to make this into something which recursively creates all levels of the dictionary.</p> <p>Any help would be appreciated!</p> <p>(As for why I want to do this: I have a file whose structure is equivalent to a nested dict, and I want to store this file's contents in the attributes dictionary of a NetCDF file and retrieve it later. However NetCDF only allows you to put flat dictionaries as the attributes, so I want to unflatten the dictionary I previously stored in the NetCDF file.)</p>
0debug
get current url 0th index value in angular 7 : <p>The url is <a href="http://localhost:4200/horizontal/ecommerce/product-edit/men/2" rel="nofollow noreferrer">http://localhost:4200/horizontal/ecommerce/product-edit/men/2</a> I want to get horizontal value</p>
0debug
How to access a remote MySQL database from Android Application : <p>I need some help I've made a simple login application in android with a MySQL database and the PHP script and I'm using XAMPP. Everything works and the database takes the entries but only when my phone is connected to the same internet connection as my server is. When I try doing the same, suppose while my phone is connected to 3G, IT DOESN'T WORK</p>
0debug
How to edit an item in a state array? : <p>So here is my state:</p> <pre><code>this.state = { ids: ['A', 'E', 'C'] }; </code></pre> <p>How would I go about modifying the state so that 'E' at index 1 is changed to 'B'? Like for example:</p> <pre><code>this.setState({ ids[1]: 'B' }); </code></pre> <p>How would this be done?</p>
0debug
How to remove spaces to make a combination of strings : <p>I've been trying to figure out the best approach to combining words in a string to make combinations of that string. I'm trying to do this for a class project. If the string is "The quick fox", I need to find a way to output "Thequick fox", "the quickfox", and "thequickfox". I've tried using string.split and gluing them back together, but haven't had a lot of luck. The issues is the string input could be of any size.</p>
0debug
How to set stackoverflow page local time : Since I have became a user on stack-overflow, I'm having issues with the time stamps on questions and comments. The time stamp is not taking my local time zone. I have looked around in the profile settings and searched for a solution but no luck. Any idea ?
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
static void pty_chr_state(CharDriverState *chr, int connected) { PtyCharDriver *s = chr->opaque; if (!connected) { if (s->fd_tag) { io_remove_watch_poll(s->fd_tag); s->fd_tag = 0; } s->connected = 0; pty_chr_rearm_timer(chr, 1000); } else { if (s->timer_tag) { g_source_remove(s->timer_tag); s->timer_tag = 0; } if (!s->connected) { qemu_chr_be_generic_open(chr); s->connected = 1; s->fd_tag = io_add_watch_poll(s->fd, pty_chr_read_poll, pty_chr_read, chr); } } }
1threat
executing a python script in PHP / Django : I made a python script (a URL extractor with selenium)(myurl.py) and I want to print the output URL into an HTML button. I'm using Django.
0debug
Compare object fields in if statement and 2 arraylists : <p>I'm trying to do a method that checks if a book is rented and then if the book is in a directory. But I get a variable might not have been initialized error on checkIsBookAvailableToRent. I wonder it means the variable may be the out of scope. Can you help me improve this method, please?</p> <pre><code>package com.company.model; import java.util.ArrayList; import java.util.List; public class BookDirectory { private static List&lt;Book&gt; bookDirectoryList = new ArrayList&lt;Book&gt;(); RentDirectory rentedBooksList = new RentDirectory(); Book book = new Book(""); public boolean isBookAvailableToRent(String title){ boolean checkIsBookAvailableToRent; book.setTitle(title); for (Book bookInRentDirectory : rentedBooksList.getRentedBooks()) { if (bookInRentDirectory.getTitle().equals(book.getTitle())) { checkIsBookAvailableToRent = false; } else { for (Book bookInBookDirectory : bookDirectoryList) { if (bookInBookDirectory.getTitle().equals(book.getTitle())) { checkIsBookAvailableToRent = true; } else { checkIsBookAvailableToRent = false; } } } } return checkIsBookAvailableToRent; } public List&lt;Book&gt; getBookDirectory() { return bookDirectoryList; } </code></pre> <p>}</p>
0debug
static void vfio_listener_region_add(MemoryListener *listener, MemoryRegionSection *section) { VFIOContainer *container = container_of(listener, VFIOContainer, iommu_data.listener); hwaddr iova, end; void *vaddr; int ret; assert(!memory_region_is_iommu(section->mr)); if (vfio_listener_skipped_section(section)) { DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n", section->offset_within_address_space, section->offset_within_address_space + int128_get64(int128_sub(section->size, int128_one()))); return; } if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) != (section->offset_within_region & ~TARGET_PAGE_MASK))) { error_report("%s received unaligned region", __func__); return; } iova = TARGET_PAGE_ALIGN(section->offset_within_address_space); end = (section->offset_within_address_space + int128_get64(section->size)) & TARGET_PAGE_MASK; if (iova >= end) { return; } vaddr = memory_region_get_ram_ptr(section->mr) + section->offset_within_region + (iova - section->offset_within_address_space); DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n", iova, end - 1, vaddr); memory_region_ref(section->mr); ret = vfio_dma_map(container, iova, end - iova, vaddr, section->readonly); if (ret) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", " "0x%"HWADDR_PRIx", %p) = %d (%m)", container, iova, end - iova, vaddr, ret); } }
1threat
Want to compare two csv files in java and want to have the complete details removed of one csv file from the other by comparing the 1st column : public class CompareCSV { public static void main(String args[]) throws FileNotFoundException, IOException { String path="C:\\csv\\"; String file1="file1.csv"; String file2="file2.csv"; String file3="file3.csv"; ArrayList<String> al1=new ArrayList<String>(); ArrayList<String> al2=new ArrayList<String>(); BufferedReader CSVFile1 = new BufferedReader(new FileReader("/C:/Users/bida0916/Desktop/macro.csv")); String dataRow1 = CSVFile1.readLine(); while (dataRow1 != null) { String[] dataArray1 = dataRow1.split(","); for (String item1:dataArray1) { al1.add(item1); } dataRow1 = CSVFile1.readLine(); } CSVFile1.close(); BufferedReader CSVFile2 = new BufferedReader(new FileReader("C:/Users/bida0916/Desktop/Deprecated.csv")); String dataRow2 = CSVFile2.readLine(); while (dataRow2 != null) { String[] dataArray2 = dataRow2.split(","); for (String item2:dataArray2) { al2.add(item2); } dataRow2 = CSVFile2.readLine(); } CSVFile2.close(); for(String bs:al2) { al1.remove(bs); } int size=al1.size(); System.out.println(size); try { FileWriter writer=new FileWriter("C:/Users/bida0916/Desktop/NewMacro.csv"); while(size!=0) { size--; writer.append(""+al1.get(size)); writer.append('\n'); } writer.flush(); writer.close(); } catch(IOException e) { e.printStackTrace(); } } } I want to compare two csv files in java and want to have the complete details removed of one csv file from the other by comparing the first column of both the files. Currently I am getting a csv file with one column only having all details jumbled up.
0debug
int ff_xvmc_field_start(MpegEncContext *s, AVCodecContext *avctx) { struct xvmc_pix_fmt *last, *next, *render = (struct xvmc_pix_fmt*)s->current_picture.f.data[2]; const int mb_block_count = 4 + (1 << s->chroma_format); assert(avctx); if (!render || render->xvmc_id != AV_XVMC_ID || !render->data_blocks || !render->mv_blocks || (unsigned int)render->allocated_mv_blocks > INT_MAX/(64*6) || (unsigned int)render->allocated_data_blocks > INT_MAX/64 || !render->p_surface) { av_log(avctx, AV_LOG_ERROR, "Render token doesn't look as expected.\n"); return -1; } if (render->filled_mv_blocks_num) { av_log(avctx, AV_LOG_ERROR, "Rendering surface contains %i unprocessed blocks.\n", render->filled_mv_blocks_num); return -1; } if (render->allocated_mv_blocks < 1 || render->allocated_data_blocks < render->allocated_mv_blocks*mb_block_count || render->start_mv_blocks_num >= render->allocated_mv_blocks || render->next_free_data_block_num > render->allocated_data_blocks - mb_block_count*(render->allocated_mv_blocks-render->start_mv_blocks_num)) { av_log(avctx, AV_LOG_ERROR, "Rendering surface doesn't provide enough block structures to work with.\n"); return -1; } render->picture_structure = s->picture_structure; render->flags = s->first_field ? 0 : XVMC_SECOND_FIELD; render->p_future_surface = NULL; render->p_past_surface = NULL; switch(s->pict_type) { case AV_PICTURE_TYPE_I: return 0; case AV_PICTURE_TYPE_B: next = (struct xvmc_pix_fmt*)s->next_picture.f.data[2]; if (!next) return -1; if (next->xvmc_id != AV_XVMC_ID) return -1; render->p_future_surface = next->p_surface; case AV_PICTURE_TYPE_P: last = (struct xvmc_pix_fmt*)s->last_picture.f.data[2]; if (!last) last = render; if (last->xvmc_id != AV_XVMC_ID) return -1; render->p_past_surface = last->p_surface; return 0; } return -1; }
1threat
error: two or more data types in declaration of ‘setTime’ : I am getting this error-> error: two or more data types in declaration of ‘setTime’ for this line of code void ClockType::setTime (int hours, int minutes, int seconds)
0debug
Facebook Audience Network Ads integration Issue : <p>E/FBAudienceNetwork: You are using custom Application class and don't call AudienceNetworkAds.isInAdsProcess(). Multi-process support will be disabled. Please call AudienceNetworkAds.isInAdsProcess() if you want to support multi-process mode.</p> <pre><code>implementation 'com.facebook.android:audience-network-sdk:5.1.0' implementation 'com.mopub.mediation:facebookaudiencenetwork:5.1.0.2' </code></pre> <p>am using FAN along with Mopub.</p> <p>How to fix the above issue? Thanks in advance.</p>
0debug
React Navigation pass props in TabNavigator : <p>I have props what are loaded from the server on the initial screen. I want to pass them to the rest of the tab screens. However, I have not found any examples online. I know of the screenProps, but have no idea how to set it up. All methods I have tried, have resulted in errors.</p> <pre><code>const EProj = TabNavigator({ Home: { screen: HomeScreen }, Map: { screen: MapG }, Login: { screen: Login }, Profile: { screen: Profile }, }, { tabBarPosition: 'bottom', animationEnabled: true, tabBarOptions: { activeTintColor: '#1abc9c', }, }); </code></pre> <p>This is my screen setup. Where should I place the screenProps?</p> <pre><code>&lt;EProj screenProps={cats} /&gt; </code></pre> <p>Any good examples how to set this up would be helpful. Thanks in advance.</p> <p>HomeScreen setup:</p> <pre><code>class HomeScreen extends React.Component { static navigationOptions = { tabBarLabel: 'Home', }; ... componentWillMount(){ console.log("Starting to load assets from server!"); this.onLoadCats(); /*starts asset loading*/ } render() { return ( &lt;View style={styles.container}&gt; &lt;Text&gt;Welcome to alpha 1.17 This is hard system test.&lt;/Text&gt; &lt;AssetsLoad catsL={this.state.catsL} /&gt; &lt;/View&gt; ); } } </code></pre>
0debug
static PayloadContext *h264_new_context(void) { PayloadContext *data = av_mallocz(sizeof(PayloadContext) + FF_INPUT_BUFFER_PADDING_SIZE); if (data) { data->cookie = MAGIC_COOKIE; } return data; }
1threat
How can i logout from google account when i click my logout button in my android project : <p>i tried this code in to my project the compiler will show the following error.</p> <p>this is my code. </p> <pre><code>Auth.GoogleSignInApi.signOut(mGoogleApiClient).setResultCallback(new ResultCallback&lt;Status&gt;() { @Override public void onResult(Status status) { } }); </code></pre> <p>and this is my error</p> <pre><code>cannot be cast to com.google.android.gms.common.api.GoogleApiClient$OnConnectionFailedListener </code></pre>
0debug
static void io_mem_init(void) { int i; cpu_register_io_memory_fixed(IO_MEM_ROM, error_mem_read, unassigned_mem_write, NULL); cpu_register_io_memory_fixed(IO_MEM_UNASSIGNED, unassigned_mem_read, unassigned_mem_write, NULL); cpu_register_io_memory_fixed(IO_MEM_NOTDIRTY, error_mem_read, notdirty_mem_write, NULL); for (i=0; i<5; i++) io_mem_used[i] = 1; io_mem_watch = cpu_register_io_memory(watch_mem_read, watch_mem_write, NULL); #ifdef CONFIG_KQEMU if (kqemu_phys_ram_base) { phys_ram_dirty = qemu_vmalloc(kqemu_phys_ram_size >> TARGET_PAGE_BITS); memset(phys_ram_dirty, 0xff, kqemu_phys_ram_size >> TARGET_PAGE_BITS); } #endif }
1threat
static void dsound_write_sample (HWVoiceOut *hw, uint8_t *dst, int dst_len) { int src_len1 = dst_len; int src_len2 = 0; int pos = hw->rpos + dst_len; st_sample_t *src1 = hw->mix_buf + hw->rpos; st_sample_t *src2 = NULL; if (pos > hw->samples) { src_len1 = hw->samples - hw->rpos; src2 = hw->mix_buf; src_len2 = dst_len - src_len1; pos = src_len2; } if (src_len1) { hw->clip (dst, src1, src_len1); } if (src_len2) { dst = advance (dst, src_len1 << hw->info.shift); hw->clip (dst, src2, src_len2); } hw->rpos = pos % hw->samples; }
1threat
Loading model with custom loss + keras : <p>In Keras, if you need to have a custom loss with additional parameters, we can use it like mentioned on <a href="https://datascience.stackexchange.com/questions/25029/custom-loss-function-with-additional-parameter-in-keras">https://datascience.stackexchange.com/questions/25029/custom-loss-function-with-additional-parameter-in-keras</a></p> <pre><code>def penalized_loss(noise): def loss(y_true, y_pred): return K.mean(K.square(y_pred - y_true) - K.square(y_true - noise), axis=-1) return loss </code></pre> <p>The above method works when I am training the model. However, once the model is trained I am having difficulty in loading the model. When I try to use the custom_objects parameter in load_model like below</p> <pre><code>model = load_model(modelFile, custom_objects={'penalized_loss': penalized_loss} ) </code></pre> <p>it complains <code>ValueError: Unknown loss function:loss</code></p> <p>Is there any way to pass in the loss function as one of the custom losses in <code>custom_objects</code> ? From what I can gather, the inner function is not in the namespace during load_model call. Is there any easier way to load the model or use a custom loss with additional parameters</p>
0debug
Printing part of a .txt file : <p>Hello again and sorry in advance if this a duplicate but I'm a desperate point and I just have to ask!</p> <p>I'm writing a program in c for a school project, I'm almost done but I got stuck. I have a txt file shown in this image: <a href="http://i.stack.imgur.com/RDafL.jpg" rel="nofollow">cars.txt</a></p> <p>What I need to do with it at this point is print the listed colors but every different color must be printed only once. Same with the car manufacturers but that's for later.</p> <p>I'm completely out of ideas... Any help will be greatly appreciated...</p>
0debug
static void nbd_refresh_filename(BlockDriverState *bs, QDict *options) { BDRVNBDState *s = bs->opaque; QDict *opts = qdict_new(); QObject *saddr_qdict; Visitor *ov; const char *host = NULL, *port = NULL, *path = NULL; if (s->saddr->type == SOCKET_ADDRESS_KIND_INET) { const InetSocketAddress *inet = s->saddr->u.inet.data; if (!inet->has_ipv4 && !inet->has_ipv6 && !inet->has_to) { host = inet->host; port = inet->port; } } else if (s->saddr->type == SOCKET_ADDRESS_KIND_UNIX) { path = s->saddr->u.q_unix.data->path; } qdict_put(opts, "driver", qstring_from_str("nbd")); if (path && s->export) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nbd+unix: } else if (path && !s->export) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nbd+unix: } else if (host && s->export) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nbd: } else if (host && !s->export) { snprintf(bs->exact_filename, sizeof(bs->exact_filename), "nbd: } ov = qobject_output_visitor_new(&saddr_qdict); visit_type_SocketAddress(ov, NULL, &s->saddr, &error_abort); visit_complete(ov, &saddr_qdict); visit_free(ov); qdict_put_obj(opts, "server", saddr_qdict); if (s->export) { qdict_put(opts, "export", qstring_from_str(s->export)); } if (s->tlscredsid) { qdict_put(opts, "tls-creds", qstring_from_str(s->tlscredsid)); } qdict_flatten(opts); bs->full_open_options = opts; }
1threat
static int parse_vlan(DeviceState *dev, Property *prop, const char *str) { VLANState **ptr = qdev_get_prop_ptr(dev, prop); int id; if (sscanf(str, "%d", &id) != 1) return -EINVAL; *ptr = qemu_find_vlan(id, 1); if (*ptr == NULL) return -ENOENT; return 0; }
1threat
static int mkv_write_header(AVFormatContext *s) { MatroskaMuxContext *mkv = s->priv_data; AVIOContext *pb = s->pb; ebml_master ebml_header; AVDictionaryEntry *tag; int ret, i, version = 2; int64_t creation_time; if (!strcmp(s->oformat->name, "webm")) mkv->mode = MODE_WEBM; else mkv->mode = MODE_MATROSKAv2; if (mkv->mode != MODE_WEBM || av_dict_get(s->metadata, "stereo_mode", NULL, 0) || av_dict_get(s->metadata, "alpha_mode", NULL, 0)) version = 4; for (i = 0; i < s->nb_streams; i++) { if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_ATRAC3 || s->streams[i]->codecpar->codec_id == AV_CODEC_ID_COOK || s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RA_288 || s->streams[i]->codecpar->codec_id == AV_CODEC_ID_SIPR || s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV10 || s->streams[i]->codecpar->codec_id == AV_CODEC_ID_RV20) { av_log(s, AV_LOG_ERROR, "The Matroska muxer does not yet support muxing %s\n", avcodec_get_name(s->streams[i]->codecpar->codec_id)); return AVERROR_PATCHWELCOME; } if (s->streams[i]->codecpar->codec_id == AV_CODEC_ID_OPUS || av_dict_get(s->streams[i]->metadata, "stereo_mode", NULL, 0) || av_dict_get(s->streams[i]->metadata, "alpha_mode", NULL, 0)) version = 4; } mkv->tracks = av_mallocz_array(s->nb_streams, sizeof(*mkv->tracks)); if (!mkv->tracks) { ret = AVERROR(ENOMEM); goto fail; } ebml_header = start_ebml_master(pb, EBML_ID_HEADER, 0); put_ebml_uint (pb, EBML_ID_EBMLVERSION , 1); put_ebml_uint (pb, EBML_ID_EBMLREADVERSION , 1); put_ebml_uint (pb, EBML_ID_EBMLMAXIDLENGTH , 4); put_ebml_uint (pb, EBML_ID_EBMLMAXSIZELENGTH , 8); put_ebml_string (pb, EBML_ID_DOCTYPE , s->oformat->name); put_ebml_uint (pb, EBML_ID_DOCTYPEVERSION , version); put_ebml_uint (pb, EBML_ID_DOCTYPEREADVERSION , 2); end_ebml_master(pb, ebml_header); mkv->segment = start_ebml_master(pb, MATROSKA_ID_SEGMENT, 0); mkv->segment_offset = avio_tell(pb); mkv->main_seekhead = mkv_start_seekhead(pb, mkv->segment_offset, 10); if (!mkv->main_seekhead) { ret = AVERROR(ENOMEM); goto fail; } ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_INFO, avio_tell(pb)); if (ret < 0) goto fail; ret = start_ebml_master_crc32(pb, &mkv->info_bc, mkv, &mkv->info, MATROSKA_ID_INFO, 0); if (ret < 0) return ret; pb = mkv->info_bc; put_ebml_uint(pb, MATROSKA_ID_TIMECODESCALE, 1000000); if ((tag = av_dict_get(s->metadata, "title", NULL, 0))) put_ebml_string(pb, MATROSKA_ID_TITLE, tag->value); if (!(s->flags & AVFMT_FLAG_BITEXACT)) { put_ebml_string(pb, MATROSKA_ID_MUXINGAPP, LIBAVFORMAT_IDENT); if ((tag = av_dict_get(s->metadata, "encoding_tool", NULL, 0))) put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, tag->value); else put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, LIBAVFORMAT_IDENT); if (mkv->mode != MODE_WEBM) { uint32_t segment_uid[4]; AVLFG lfg; av_lfg_init(&lfg, av_get_random_seed()); for (i = 0; i < 4; i++) segment_uid[i] = av_lfg_get(&lfg); put_ebml_binary(pb, MATROSKA_ID_SEGMENTUID, segment_uid, 16); } } else { const char *ident = "Lavf"; put_ebml_string(pb, MATROSKA_ID_MUXINGAPP , ident); put_ebml_string(pb, MATROSKA_ID_WRITINGAPP, ident); } if (ff_parse_creation_time_metadata(s, &creation_time, 0) > 0) { int64_t date_utc = (creation_time - 978307200000000LL) * 1000; uint8_t date_utc_buf[8]; AV_WB64(date_utc_buf, date_utc); put_ebml_binary(pb, MATROSKA_ID_DATEUTC, date_utc_buf, 8); } mkv->duration = 0; mkv->duration_offset = avio_tell(pb); if (!mkv->is_live) { int64_t metadata_duration = get_metadata_duration(s); if (s->duration > 0) { int64_t scaledDuration = av_rescale(s->duration, 1000, AV_TIME_BASE); put_ebml_float(pb, MATROSKA_ID_DURATION, scaledDuration); av_log(s, AV_LOG_DEBUG, "Write early duration from recording time = %" PRIu64 "\n", scaledDuration); } else if (metadata_duration > 0) { int64_t scaledDuration = av_rescale(metadata_duration, 1000, AV_TIME_BASE); put_ebml_float(pb, MATROSKA_ID_DURATION, scaledDuration); av_log(s, AV_LOG_DEBUG, "Write early duration from metadata = %" PRIu64 "\n", scaledDuration); } else { put_ebml_void(pb, 11); } } if (s->pb->seekable && !mkv->is_live) put_ebml_void(s->pb, avio_tell(pb)); else end_ebml_master_crc32(s->pb, &mkv->info_bc, mkv, mkv->info); pb = s->pb; mkv->stream_durations = av_mallocz(s->nb_streams * sizeof(int64_t)); mkv->stream_duration_offsets = av_mallocz(s->nb_streams * sizeof(int64_t)); ret = mkv_write_tracks(s); if (ret < 0) goto fail; for (i = 0; i < s->nb_chapters; i++) mkv->chapter_id_offset = FFMAX(mkv->chapter_id_offset, 1LL - s->chapters[i]->id); if (mkv->mode != MODE_WEBM) { ret = mkv_write_chapters(s); if (ret < 0) goto fail; ret = mkv_write_attachments(s); if (ret < 0) goto fail; ret = mkv_write_tags(s); if (ret < 0) goto fail; } if (!s->pb->seekable && !mkv->is_live) mkv_write_seekhead(pb, mkv); mkv->cues = mkv_start_cues(mkv->segment_offset); if (!mkv->cues) { ret = AVERROR(ENOMEM); goto fail; } if (pb->seekable && mkv->reserve_cues_space) { mkv->cues_pos = avio_tell(pb); put_ebml_void(pb, mkv->reserve_cues_space); } av_init_packet(&mkv->cur_audio_pkt); mkv->cur_audio_pkt.size = 0; mkv->cluster_pos = -1; avio_flush(pb); if (pb->seekable) { if (mkv->cluster_time_limit < 0) mkv->cluster_time_limit = 5000; if (mkv->cluster_size_limit < 0) mkv->cluster_size_limit = 5 * 1024 * 1024; } else { if (mkv->cluster_time_limit < 0) mkv->cluster_time_limit = 1000; if (mkv->cluster_size_limit < 0) mkv->cluster_size_limit = 32 * 1024; } return 0; fail: mkv_free(mkv); return ret; }
1threat
gitlab Request to merge branch-A into develop (3 commits behind) should I worry? : <p>When creating a merge request in gitlab I often get a message: Request to merge branch-A into develop ([x] commits behind) what does gitlab want to tell me? should I worry or do I need to fix something (what)?</p>
0debug
PHP & MySQL: Good/efficient of showing statistics from thousands of rows on each page load : <p>I know this is the wrong way to go about it, but I have a database filled with stats about vehicles that are imported from excel files.</p> <p>For each vehicle(about 100 currently, updated each three days) I have from 500 to 2000 rows of data which is used to build graphs regarding fuel consumption, distance driven etc.. This is fairly simple and it takes from 1 to 3 seconds to load, but I also need the total stats and compare it against each car.</p> <p>So if I build the graph for car id 1, I want to see the difference between its fuel consumption and the global fuel consumption (of all existing cars).</p> <p>Is there a way of doing this without querying not only the single car but also all cars on each page load ?</p> <p>Thank you</p>
0debug
codeignetor call another controller funtion in a controller : I am trying to call a function Commanfuntion in controller Return_test witch is located in Assesst_test controller. Example : class Assign_test extends REST_Controller { function __construct() { parent::__construct(); } function Commanfuntion() { //code } } ------------------------------------------------------------------------ class Return_test extends REST_Controller { function __construct() { parent::__construct(); } function Return() { //here i want to call Commanfuntion located in class Assesst_test } }
0debug
void vhost_dev_stop(struct vhost_dev *hdev, VirtIODevice *vdev) { int i, r; for (i = 0; i < hdev->nvqs; ++i) { vhost_virtqueue_cleanup(hdev, vdev, hdev->vqs + i, i); } vhost_client_sync_dirty_bitmap(&hdev->client, 0, (target_phys_addr_t)~0x0ull); r = vdev->binding->set_guest_notifiers(vdev->binding_opaque, false); if (r < 0) { fprintf(stderr, "vhost guest notifier cleanup failed: %d\n", r); fflush(stderr); } assert (r >= 0); hdev->started = false; g_free(hdev->log); hdev->log = NULL; hdev->log_size = 0; }
1threat
Matching data in sql and display it through php : <p>I'm trying to do matchmaking website. Currently I have two tables which are user profile and their partner profile(which is the requirement that those users hope for). I have to match this two table by using mysql and php. maybe fuzzy logic? For example, user A hopes for tall partner, then system will match the partner that closes to this user and display on his wall. But the problem is, i had do many research and still run out of idea of how to do it. Can anyone please help me or give me some advices?Thanks.</p> <p>Below is what i trying to do but still have no idea.</p> <p><a href="https://i.stack.imgur.com/R8tR4.png" rel="nofollow noreferrer">coding</a></p>
0debug
Python type hint for (any) class : <p>I want to type hint the following function:</p> <pre><code>def get_obj_class(self) -&gt; *class*: return self.o.__class__ </code></pre> <p><code>self.o</code> could be of any type, it's determined at runtime.</p> <p><code>*class*</code> obviously is not the answer here, because it's invalid syntax. But what <em>is</em> the right answer? I could not find any documentation on this, any help is appreciated.</p> <hr> <p>On a similar note, if I have a function <code>f(cls: *class*)</code> which returns an instance of <code>cls</code>, is there a way to type hint the return value appropriately?</p>
0debug
for loop to get tapply means by group across many subjects : I'm trying to do some data analysis as follows: I have about 100 subjects, each of whom have a file containing 40,000 lines of numbers. I also have an index file with 40,000 corresponding lines containing group number. I am trying to get the means of each group, for each subject. I can do this easily for one subject with tapply, like this: ```tapply(df$numbers, df$group, mean)``` I can also load in a data frame containing the filenames of each subject's data. What I'd like to do is create a for loop in which I can get the output of the above tapply function for each subject, probably by looping over the filenames and pulling in each one as a new data frame (maybe??). And ultimately I'll want to output this to a .csv with subject names as rows and group names as columns. Right now I'm very stuck. Can anyone provide some insight? Thanks!
0debug
static void sun4m_hw_init(const struct hwdef *hwdef, int ram_size, DisplayState *ds, const char *cpu_model) { CPUState *env, *envs[MAX_CPUS]; unsigned int i; void *iommu, *espdma, *ledma, *main_esp; const sparc_def_t *def; qemu_irq *cpu_irqs[MAX_CPUS], *slavio_irq, *slavio_cpu_irq, *espdma_irq, *ledma_irq; sparc_find_by_name(cpu_model, &def); if (def == NULL) { fprintf(stderr, "Unable to find Sparc CPU definition\n"); exit(1); } for(i = 0; i < smp_cpus; i++) { env = cpu_init(); cpu_sparc_register(env, def); envs[i] = env; if (i == 0) { qemu_register_reset(main_cpu_reset, env); } else { qemu_register_reset(secondary_cpu_reset, env); env->halted = 1; } register_savevm("cpu", i, 3, cpu_save, cpu_load, env); cpu_irqs[i] = qemu_allocate_irqs(cpu_set_irq, envs[i], MAX_PILS); } for (i = smp_cpus; i < MAX_CPUS; i++) cpu_irqs[i] = qemu_allocate_irqs(dummy_cpu_set_irq, NULL, MAX_PILS); cpu_register_physical_memory(0, ram_size, 0); iommu = iommu_init(hwdef->iommu_base); slavio_intctl = slavio_intctl_init(hwdef->intctl_base, hwdef->intctl_base + 0x10000ULL, &hwdef->intbit_to_level[0], &slavio_irq, &slavio_cpu_irq, cpu_irqs, hwdef->clock_irq); espdma = sparc32_dma_init(hwdef->dma_base, slavio_irq[hwdef->esp_irq], iommu, &espdma_irq); ledma = sparc32_dma_init(hwdef->dma_base + 16ULL, slavio_irq[hwdef->le_irq], iommu, &ledma_irq); if (graphic_depth != 8 && graphic_depth != 24) { fprintf(stderr, "qemu: Unsupported depth: %d\n", graphic_depth); exit (1); } tcx_init(ds, hwdef->tcx_base, phys_ram_base + ram_size, ram_size, hwdef->vram_size, graphic_width, graphic_height, graphic_depth); if (nd_table[0].model == NULL || strcmp(nd_table[0].model, "lance") == 0) { lance_init(&nd_table[0], hwdef->le_base, ledma, *ledma_irq); } else if (strcmp(nd_table[0].model, "?") == 0) { fprintf(stderr, "qemu: Supported NICs: lance\n"); exit (1); } else { fprintf(stderr, "qemu: Unsupported NIC: %s\n", nd_table[0].model); exit (1); } nvram = m48t59_init(slavio_irq[0], hwdef->nvram_base, 0, hwdef->nvram_size, 8); for (i = 0; i < MAX_CPUS; i++) { slavio_timer_init(hwdef->counter_base + (target_phys_addr_t)(i * TARGET_PAGE_SIZE), slavio_cpu_irq[i], 0); } slavio_timer_init(hwdef->counter_base + 0x10000ULL, slavio_irq[hwdef->clock1_irq], 2); slavio_serial_ms_kbd_init(hwdef->ms_kb_base, slavio_irq[hwdef->ms_kb_irq]); slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq], serial_hds[1], serial_hds[0]); fdctrl_init(slavio_irq[hwdef->fd_irq], 0, 1, hwdef->fd_base, fd_table); main_esp = esp_init(bs_table, hwdef->esp_base, espdma, *espdma_irq); for (i = 0; i < MAX_DISKS; i++) { if (bs_table[i]) { esp_scsi_attach(main_esp, bs_table[i], i); } } slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->power_base, slavio_irq[hwdef->me_irq]); if (hwdef->cs_base != (target_phys_addr_t)-1) cs_init(hwdef->cs_base, hwdef->cs_irq, slavio_intctl); }
1threat
how to pull up specific records in MySQL : I have some SQL i would like to pull up some records with a certain criteria please help, thank you :) **SQL Statement:** `SELECT b.*, e.Lastname, e.Firstname, e.ID_SC, e.Program, r.BReasonDetails FROM tblbadgetemporaryborrower b INNER JOIN (SELECT e.*, p.Program FROM tblemployee e INNER JOIN tblemployeeprogram p ON p.ID_P = e.ID_P) e ON e.EmployeeID = b.EmployeeID INNER JOIN tblbadgetemporaryborrowerreason r ON r.ID_BR = b.ID_BR HAVING e.ID_SC = {$_GET['ID_SC']} ORDER BY b.EmployeeID ASC` **Here's what i have:** **Q:** How can i pull up the employee data with `Lost` reason only [![enter image description here][1]][1] [1]: http://i.stack.imgur.com/vN6x0.png
0debug
void ff_put_h264_qpel8_mc01_msa(uint8_t *dst, const uint8_t *src, ptrdiff_t stride) { avc_luma_vt_qrt_8w_msa(src - (stride * 2), stride, dst, stride, 8, 0); }
1threat
npm update broke npm : <p>I just followed <a href="https://stackoverflow.com/questions/6237295/how-can-i-update-node-js-and-npm-to-the-next-versions">this guide</a> to update npm (as my nodered camera module wasn't working) and ran</p> <pre><code>npm install -g npm </code></pre> <p>but now my npm install seems completely broken. If I just type </p> <pre><code>npm </code></pre> <p>or </p> <pre><code>npm update </code></pre> <p>I get </p> <blockquote> <p>/usr/local/lib/node_modules/npm/bin/npm-cli.js:79 let notifier = require('update-notifier')({pkg}) ^^^</p> <p>SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode</p> </blockquote> <p>I've tried </p> <pre><code>sudo apt-get remove npm sudo apt-get install npm </code></pre> <p>but the reinstall didn't help.</p> <p>I think my node version needs upgrading from v4.8.2 but I thought that was only possible with npm?</p>
0debug
static int usb_msd_handle_data(USBDevice *dev, USBPacket *p) { MSDState *s = (MSDState *)dev; int ret = 0; struct usb_msd_cbw cbw; uint8_t devep = p->devep; uint8_t *data = p->data; int len = p->len; switch (p->pid) { case USB_TOKEN_OUT: if (devep != 2) goto fail; switch (s->mode) { case USB_MSDM_CBW: if (len != 31) { fprintf(stderr, "usb-msd: Bad CBW size"); goto fail; } memcpy(&cbw, data, 31); if (le32_to_cpu(cbw.sig) != 0x43425355) { fprintf(stderr, "usb-msd: Bad signature %08x\n", le32_to_cpu(cbw.sig)); goto fail; } DPRINTF("Command on LUN %d\n", cbw.lun); if (cbw.lun != 0) { fprintf(stderr, "usb-msd: Bad LUN %d\n", cbw.lun); goto fail; } s->tag = le32_to_cpu(cbw.tag); s->data_len = le32_to_cpu(cbw.data_len); if (s->data_len == 0) { s->mode = USB_MSDM_CSW; } else if (cbw.flags & 0x80) { s->mode = USB_MSDM_DATAIN; } else { s->mode = USB_MSDM_DATAOUT; } DPRINTF("Command tag 0x%x flags %08x len %d data %d\n", s->tag, cbw.flags, cbw.cmd_len, s->data_len); s->residue = 0; s->scsi_len = 0; s->req = scsi_req_new(s->scsi_dev, s->tag, 0, NULL); scsi_req_enqueue(s->req, cbw.cmd); if (s->mode != USB_MSDM_CSW && s->residue == 0) { scsi_req_continue(s->req); } ret = len; break; case USB_MSDM_DATAOUT: DPRINTF("Data out %d/%d\n", len, s->data_len); if (len > s->data_len) goto fail; s->usb_buf = data; s->usb_len = len; if (s->scsi_len) { usb_msd_copy_data(s); } if (s->residue && s->usb_len) { s->data_len -= s->usb_len; if (s->data_len == 0) s->mode = USB_MSDM_CSW; s->usb_len = 0; } if (s->usb_len) { DPRINTF("Deferring packet %p\n", p); s->packet = p; ret = USB_RET_ASYNC; } else { ret = len; } break; default: DPRINTF("Unexpected write (len %d)\n", len); goto fail; } break; case USB_TOKEN_IN: if (devep != 1) goto fail; switch (s->mode) { case USB_MSDM_DATAOUT: if (s->data_len != 0 || len < 13) goto fail; s->packet = p; ret = USB_RET_ASYNC; break; case USB_MSDM_CSW: DPRINTF("Command status %d tag 0x%x, len %d\n", s->result, s->tag, len); if (len < 13) goto fail; usb_msd_send_status(s, p); s->mode = USB_MSDM_CBW; ret = 13; break; case USB_MSDM_DATAIN: DPRINTF("Data in %d/%d, scsi_len %d\n", len, s->data_len, s->scsi_len); if (len > s->data_len) len = s->data_len; s->usb_buf = data; s->usb_len = len; if (s->scsi_len) { usb_msd_copy_data(s); } if (s->residue && s->usb_len) { s->data_len -= s->usb_len; memset(s->usb_buf, 0, s->usb_len); if (s->data_len == 0) s->mode = USB_MSDM_CSW; s->usb_len = 0; } if (s->usb_len) { DPRINTF("Deferring packet %p\n", p); s->packet = p; ret = USB_RET_ASYNC; } else { ret = len; } break; default: DPRINTF("Unexpected read (len %d)\n", len); goto fail; } break; default: DPRINTF("Bad token\n"); fail: ret = USB_RET_STALL; break; } return ret; }
1threat
static void parse_forced_key_frames(char *kf, OutputStream *ost, AVCodecContext *avctx) { char *p; int n = 1, i; int64_t t; for (p = kf; *p; p++) if (*p == ',') n++; ost->forced_kf_count = n; ost->forced_kf_pts = av_malloc(sizeof(*ost->forced_kf_pts) * n); if (!ost->forced_kf_pts) { av_log(NULL, AV_LOG_FATAL, "Could not allocate forced key frames array.\n"); exit(1); } p = kf; for (i = 0; i < n; i++) { char *next = strchr(p, ','); if (next) *next++ = 0; t = parse_time_or_die("force_key_frames", p, 1); ost->forced_kf_pts[i] = av_rescale_q(t, AV_TIME_BASE_Q, avctx->time_base); p = next; } }
1threat
static void mc_block(uint8_t *dst, uint8_t *src, uint8_t *tmp, int stride, int b_w, int b_h, int dx, int dy){ int x, y; START_TIMER for(y=0; y < b_h+5; y++){ for(x=0; x < b_w; x++){ int a0= src[x ]; int a1= src[x + 1]; int a2= src[x + 2]; int a3= src[x + 3]; int a4= src[x + 4]; int a5= src[x + 5]; int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); if(dx<8) tmp[x]= (32*a2*( 8-dx) + am* dx + 128)>>8; else tmp[x]= ( am*(16-dx) + 32*a3*(dx-8) + 128)>>8; } tmp += stride; src += stride; } tmp -= (b_h+5)*stride; for(y=0; y < b_h; y++){ for(x=0; x < b_w; x++){ int a0= tmp[x + 0*stride]; int a1= tmp[x + 1*stride]; int a2= tmp[x + 2*stride]; int a3= tmp[x + 3*stride]; int a4= tmp[x + 4*stride]; int a5= tmp[x + 5*stride]; int am= 20*(a2+a3) - 5*(a1+a4) + (a0+a5); if(dy<8) dst[x]= (32*a2*( 8-dy) + am* dy + 128)>>8; else dst[x]= ( am*(16-dy) + 32*a3*(dy-8) + 128)>>8; } dst += stride; tmp += stride; } STOP_TIMER("mc_block") }
1threat
Drawing route direction between two locations using Google Map Swift 4.0 : <p>I am having trouble rendering the JSON response onto the map. I am trying to make an app that you can enter in the a destination and google maps will make a route based on your current location.</p> <p>I successfully can print out the JSON response in the console</p> <p>But I am unsure as to how I can make a route using a polyline.</p> <p>Everything I look at online is out of date </p> <p>any help would be great thanks.</p> <p>If you could point me to a tutorial it would be great!</p> <p>thanks :)</p>
0debug
static int jpeg2000_decode_packets_po_iteration(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile, int RSpoc, int CSpoc, int LYEpoc, int REpoc, int CEpoc, int Ppoc) { int ret = 0; int layno, reslevelno, compno, precno, ok_reslevel; int x, y; int tp_index = 0; int step_x, step_y; switch (Ppoc) { case JPEG2000_PGOD_RLCP: av_log(s->avctx, AV_LOG_DEBUG, "Progression order RLCP\n"); ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; for (layno = 0; layno < LYEpoc; layno++) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; if (reslevelno < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno; ok_reslevel = 1; for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++) if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } break; case JPEG2000_PGOD_LRCP: av_log(s->avctx, AV_LOG_DEBUG, "Progression order LRCP\n"); for (layno = 0; layno < LYEpoc; layno++) { ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; if (reslevelno < codsty->nreslevels) { Jpeg2000ResLevel *rlevel = tile->comp[compno].reslevel + reslevelno; ok_reslevel = 1; for (precno = 0; precno < rlevel->num_precincts_x * rlevel->num_precincts_y; precno++) if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } break; case JPEG2000_PGOD_CPRL: av_log(s->avctx, AV_LOG_DEBUG, "Progression order CPRL\n"); for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; step_x = 32; step_y = 32; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; case JPEG2000_PGOD_RPCL: av_log(s->avctx, AV_LOG_WARNING, "Progression order RPCL\n"); ok_reslevel = 1; for (reslevelno = RSpoc; ok_reslevel && reslevelno < REpoc; reslevelno++) { ok_reslevel = 0; step_x = 30; step_y = 30; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; if (reslevelno < codsty->nreslevels) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; unsigned prcx, prcy; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; if (reslevelno >= codsty->nreslevels) continue; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; ok_reslevel = 1; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; case JPEG2000_PGOD_PCRL: av_log(s->avctx, AV_LOG_WARNING, "Progression order PCRL\n"); step_x = 32; step_y = 32; for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; step_x = FFMIN(step_x, rlevel->log2_prec_width + reducedresno); step_y = FFMIN(step_y, rlevel->log2_prec_height + reducedresno); } } step_x = 1<<step_x; step_y = 1<<step_y; for (y = tile->coord[1][0]; y < tile->coord[1][1]; y = (y/step_y + 1)*step_y) { for (x = tile->coord[0][0]; x < tile->coord[0][1]; x = (x/step_x + 1)*step_x) { for (compno = CSpoc; compno < CEpoc; compno++) { Jpeg2000Component *comp = tile->comp + compno; Jpeg2000CodingStyle *codsty = tile->codsty + compno; Jpeg2000QuantStyle *qntsty = tile->qntsty + compno; int xc = x / s->cdx[compno]; int yc = y / s->cdy[compno]; for (reslevelno = RSpoc; reslevelno < FFMIN(codsty->nreslevels, REpoc); reslevelno++) { unsigned prcx, prcy; uint8_t reducedresno = codsty->nreslevels - 1 -reslevelno; Jpeg2000ResLevel *rlevel = comp->reslevel + reslevelno; if (yc % (1 << (rlevel->log2_prec_height + reducedresno)) && y != tile->coord[1][0]) continue; if (xc % (1 << (rlevel->log2_prec_width + reducedresno)) && x != tile->coord[0][0]) continue; prcx = ff_jpeg2000_ceildivpow2(xc, reducedresno) >> rlevel->log2_prec_width; prcy = ff_jpeg2000_ceildivpow2(yc, reducedresno) >> rlevel->log2_prec_height; prcx -= ff_jpeg2000_ceildivpow2(comp->coord_o[0][0], reducedresno) >> rlevel->log2_prec_width; prcy -= ff_jpeg2000_ceildivpow2(comp->coord_o[1][0], reducedresno) >> rlevel->log2_prec_height; precno = prcx + rlevel->num_precincts_x * prcy; if (prcx >= rlevel->num_precincts_x || prcy >= rlevel->num_precincts_y) { av_log(s->avctx, AV_LOG_WARNING, "prc %d %d outside limits %d %d\n", prcx, prcy, rlevel->num_precincts_x, rlevel->num_precincts_y); continue; } for (layno = 0; layno < LYEpoc; layno++) { if ((ret = jpeg2000_decode_packet(s, tile, &tp_index, codsty, rlevel, precno, layno, qntsty->expn + (reslevelno ? 3 * (reslevelno - 1) + 1 : 0), qntsty->nguardbits)) < 0) return ret; } } } } } break; default: break; } return ret; }
1threat
Vba code to drag a particular value of a range of cells : I am new to macros please help me with below requirement I have two columns in a sheet. The second column contains some set of dates for each value of first column. I want to drag the first column with respect to second column till there are dates. There is a one line seperation between different names in first column and second column....
0debug
Accessing instance variable from separate class in java : <p>I'm working on programming my own tic tac toe game in javafx, but seem to have stumbled across some fundamental mechanic that I don't understand in dealing with classes. I tried to simplify my problem for this question. I just want to create a Game object containing a two dimensional string array and then print off the strings from that array through another class' method. I get a null pointer exception when I run this code. Any help would be greatly appreciated. Cheers.</p> <pre><code>package testing; import javafx.application.Application; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) { Game g = new Game(); g.addMove("X", 1, 0); g.addMove("O", 0, 1); GUI.printBoard(g); } public static void main(String[] args) { launch(args); } } package testing; public class Game { private String[][] board; public Game() { this.board = new String[3][3]; } public String[][] getBoard() { return this.board; } public void addMove(String s, int row, int col) { this.board[row][col] = s; } } package testing; public class GUI { public static void printBoard(Game g) { String[][] board = g.getBoard(); for (int row = 0; row &lt; 3; row++) { for (int col = 0; col &lt; 3; col++) { if (board[row][col].equals("X")) System.out.println(board[row][col]); else if (board[row][col].equals("O")) System.out.println(board[row][col]); } } } } </code></pre>
0debug
Find the view located in the end of RecyclerView? : <p>The below code is to locate the view on the first position. How do I locate the view on the last position <strong><em>simply &amp; efficiently</em></strong>?</p> <pre><code>TextView textView = (TextView)myRecyclerView.findViewHolderForAdapterPosition(0).itemView.findViewById(R.id.myTV); //this is first position </code></pre>
0debug
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ')' : <p>I use PHP 5.5. I try to add an arrow instead of a colon, but it still does not work. How to fix the code so that it works? My code: <pre><code> function add($a,$b){ return $a + $b; } function div($a,$b){ return $a / $b; } $server = new soap_server(); $server-&gt;configureWSDL("Jemix WS ","urn:http://jemiaymen.com"); $server-&gt;register("add", array('a'::'xsd:int','b'::'xsd:int'), array('return'-&gt;'xsd:int'), // namespace "http://jemiaymen.com", // soapaction false, // style 'rpc', // use 'encoded', // description 'A simple add web method'); $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''; $server::service($HTTP_RAW_POST_DATA); ?&gt; </code></pre>
0debug
static uint64_t omap_tcmi_read(void *opaque, target_phys_addr_t addr, unsigned size) { struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque; uint32_t ret; if (size != 4) { return omap_badwidth_read32(opaque, addr); } switch (addr) { case 0x00: case 0x04: case 0x08: case 0x0c: case 0x10: case 0x14: case 0x18: case 0x1c: case 0x24: case 0x28: case 0x2c: case 0x30: case 0x3c: case 0x40: return s->tcmi_regs[addr >> 2]; case 0x20: ret = s->tcmi_regs[addr >> 2]; s->tcmi_regs[addr >> 2] &= ~1; return ret; } OMAP_BAD_REG(addr); return 0; }
1threat
static av_always_inline void hl_decode_mb_predict_luma(H264Context *h, int mb_type, int is_h264, int simple, int transform_bypass, int pixel_shift, int *block_offset, int linesize, uint8_t *dest_y, int p) { MpegEncContext * const s = &h->s; void (*idct_add)(uint8_t *dst, DCTELEM *block, int stride); void (*idct_dc_add)(uint8_t *dst, DCTELEM *block, int stride); int i; int qscale = p == 0 ? s->qscale : h->chroma_qp[p-1]; block_offset += 16*p; if(IS_INTRA4x4(mb_type)){ if(simple || !s->encoding){ if(IS_8x8DCT(mb_type)){ if(transform_bypass){ idct_dc_add = idct_add = s->dsp.add_pixels8; }else{ idct_dc_add = h->h264dsp.h264_idct8_dc_add; idct_add = h->h264dsp.h264_idct8_add; } for(i=0; i<16; i+=4){ uint8_t * const ptr= dest_y + block_offset[i]; const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; if(transform_bypass && h->sps.profile_idc==244 && dir<=1){ h->hpc.pred8x8l_add[dir](ptr, h->mb + (i*16+p*256 << pixel_shift), linesize); }else{ const int nnz = h->non_zero_count_cache[ scan8[i+p*16] ]; h->hpc.pred8x8l[ dir ](ptr, (h->topleft_samples_available<<i)&0x8000, (h->topright_samples_available<<i)&0x4000, linesize); if(nnz){ if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16+p*256)) idct_dc_add(ptr, h->mb + (i*16+p*256 << pixel_shift), linesize); else idct_add (ptr, h->mb + (i*16+p*256 << pixel_shift), linesize); } } } }else{ if(transform_bypass){ idct_dc_add = idct_add = s->dsp.add_pixels4; }else{ idct_dc_add = h->h264dsp.h264_idct_dc_add; idct_add = h->h264dsp.h264_idct_add; } for(i=0; i<16; i++){ uint8_t * const ptr= dest_y + block_offset[i]; const int dir= h->intra4x4_pred_mode_cache[ scan8[i] ]; if(transform_bypass && h->sps.profile_idc==244 && dir<=1){ h->hpc.pred4x4_add[dir](ptr, h->mb + (i*16+p*256 << pixel_shift), linesize); }else{ uint8_t *topright; int nnz, tr; uint64_t tr_high; if(dir == DIAG_DOWN_LEFT_PRED || dir == VERT_LEFT_PRED){ const int topright_avail= (h->topright_samples_available<<i)&0x8000; assert(s->mb_y || linesize <= block_offset[i]); if(!topright_avail){ if (pixel_shift) { tr_high= ((uint16_t*)ptr)[3 - linesize/2]*0x0001000100010001ULL; topright= (uint8_t*) &tr_high; } else { tr= ptr[3 - linesize]*0x01010101; topright= (uint8_t*) &tr; } }else topright= ptr + (4 << pixel_shift) - linesize; }else topright= NULL; h->hpc.pred4x4[ dir ](ptr, topright, linesize); nnz = h->non_zero_count_cache[ scan8[i+p*16] ]; if(nnz){ if(is_h264){ if(nnz == 1 && dctcoef_get(h->mb, pixel_shift, i*16+p*256)) idct_dc_add(ptr, h->mb + (i*16+p*256 << pixel_shift), linesize); else idct_add (ptr, h->mb + (i*16+p*256 << pixel_shift), linesize); }else ff_svq3_add_idct_c(ptr, h->mb + i*16+p*256, linesize, qscale, 0); } } } } } }else{ h->hpc.pred16x16[ h->intra16x16_pred_mode ](dest_y , linesize); if(is_h264){ if(h->non_zero_count_cache[ scan8[LUMA_DC_BLOCK_INDEX+p] ]){ if(!transform_bypass) h->h264dsp.h264_luma_dc_dequant_idct(h->mb+(p*256 << pixel_shift), h->mb_luma_dc[p], h->dequant4_coeff[p][qscale][0]); else{ static const uint8_t dc_mapping[16] = { 0*16, 1*16, 4*16, 5*16, 2*16, 3*16, 6*16, 7*16, 8*16, 9*16,12*16,13*16,10*16,11*16,14*16,15*16}; for(i = 0; i < 16; i++) dctcoef_set(h->mb+p*256, pixel_shift, dc_mapping[i], dctcoef_get(h->mb_luma_dc[p], pixel_shift, i)); } } }else ff_svq3_luma_dc_dequant_idct_c(h->mb+p*256, h->mb_luma_dc[p], qscale); } }
1threat