problem
stringlengths
26
131k
labels
class label
2 classes
why can't return assignment statement : <p>In IDLE, I write a function and intend to return a value. but it can't return</p> <pre><code>&gt;&gt;&gt; def grade(value): if value &gt; 100: return (value=100) if value &lt;0: return (value=0) SyntaxError: invalid syntax </code></pre> <p>why can't return? but when I change to</p> <pre><code>value = 100 return value </code></pre> <p>It can work</p>
0debug
how to select 1 date field with 3 tags : Good day, i'm making query that select 1 datefield 3 times. `select t1.datefield date_1, t1.datefield date_3, t1.datefield date_3 from table t1 where t1.datefield BETWEEN TO_DATE('01/07/2016', 'dd/mm/yyyy') AND TO_DATE('31/07/2016', 'dd/mm/yyyy')` i need date_1 between July 01 and July 31, date_2 between August 01 and August 31, date_3 between Septembre 01 and September 30 How can i do that?
0debug
Nested constexpr-if statement in discarded branch is still evaluated? : <p>It appears to me that a constexpr-if statement that is inside the discarded branch of another constexpr-if statement is evaluated in MSVC (version 15.7.3).</p> <p>Consider the following code:</p> <pre><code>#include &lt;tuple&gt; #include &lt;type_traits&gt; template &lt;size_t I&gt; int test() { if constexpr(I != 0) { return 0; } else { // This branch is discarded, but it seems that the constexpr-if below is still evaulated? if constexpr(std::is_same_v&lt;int, std::tuple_element_t&lt;I, std::tuple&lt;int&gt;&gt;&gt;) { // some constexpr check that is valid only when I == 0 return 1; } else { return 2; } } } int main() { test&lt;1&gt;(); return 0; } </code></pre> <p>The code above fails to compile in MSVC, because <code>std::tuple_element_t</code> will fail a static assertion when <code>I</code> exceeds the bounds of the tuple. This suggests that somehow the code in the discarded branch was evaluated as well, even though it is dependent on the template parameter <code>I</code>.</p> <p>According to <a href="http://en.cppreference.com/w/cpp/language/if#Constexpr_If" rel="noreferrer">cppreference</a>, constexpr-if requires that "the discarded statement can't be ill-formed for every possible specialization", but I'm having a hard time deciding if this is the case here.</p> <p>It also seems that GCC and Clang accepts this code without issue (tested on Compiler Explorer).</p> <p>Is the compilation error acceptable by the C++ standard, or is MSVC non-compliant here?</p> <p>(Also, if what I'm expecting the code to do isn't guaranteed by the standard, is there another way to accomplish nested constexpr-if statements?)</p>
0debug
powershell generate word list from two csv files and export to csv : I'm trying to use powershell to import two csv files, one csv is called accts and one is called names. The accts file has 8 numbers and the names files has 4 names. I need to output a combination where the end goal is to output a list of 32 words with the prefix of STX. I'll take this list of 32 and create 32 AD objects. Ideally I need to also run a check to see if the word/AD object already exists. accts: 12345 23456 34567 45678 56789 67890 78901 89012 names: john dave joe mike output should be: stx-12345-john stx-23456-john stx-34567-john stx-45678-john stx-56789-john stx-67890-john stx-78901-john stx-89012-john stx-12345-dave stx-23456-dave stx-34567-dave stx-45678-dave stx-56789-dave stx-67890-dave stx-78901-dave stx-89012-dave etc I've thought about trying to use arrays, but perhaps that would be to complex. Any advice? Sorry I don't do a lot of PS on a consistent basis.
0debug
static uint64_t malta_fpga_read(void *opaque, hwaddr addr, unsigned size) { MaltaFPGAState *s = opaque; uint32_t val = 0; uint32_t saddr; saddr = (addr & 0xfffff); switch (saddr) { case 0x00200: val = 0x00000000; break; case 0x00208: #ifdef TARGET_WORDS_BIGENDIAN val = 0x00000012; #else val = 0x00000010; #endif break; case 0x00210: val = 0x00; break; case 0x00408: val = s->leds; break; case 0x00508: val = s->brk; break; case 0x00a00: val = s->gpout; break; case 0x00a08: if (s->i2csel) val = s->i2cout; else val = 0x00; break; case 0x00b00: val = ((s->i2cin & ~1) | eeprom24c0x_read()); break; case 0x00b08: val = s->i2coe; break; case 0x00b10: val = s->i2cout; break; case 0x00b18: val = s->i2csel; break; default: #if 0 printf ("malta_fpga_read: Bad register offset 0x" TARGET_FMT_lx "\n", addr); #endif break; } return val; }
1threat
When using insert statement using array is giving error : Sqlserv php eoor when inserting using array oprtion ARRAY PREPRATION foreach ($data as $rs) { $params []="({$rs->hd},'{$rs->dvn}',{$rs->mth},{$rs->yr},{$rs->stid},{$rs->prcd},'{$rs->prnm}',{$rs->prte},{$rs->ssl},{$rs->clsk},1)"; } INSERT INTO STATEMENT: $SqlInsert="insert into SQl_test (Ss_Hq_cd,Ss_division,Ss_month,Ss_yr,Ss_stk_Id,Ss_prod_cod,Ss_prod_name,ss_prod_rate,Ss_Sale,Ss_Cl_stk,ss_tran_stat) values(?,?,?,?,?,?,?,?,?,?,?) "; $stmt = sqlsrv_query( $conn, $SqlInsert,$params); EROOR: Error in statement preparation\/execution.\n"Array ( [0] => Array ( [0] => 22018 [SQLSTATE] => 22018 [1] => 245 [code] => 245 [2] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Conversion failed when converting the varchar value '(757,'MAIN',12,2018,100899,1250,'xyz',0,100,45,1)' to data type int. [message] => [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Conversion failed when converting the varchar value '(757,'MAIN',12,2018,100899,1250,'xyz',0,100,45,1)' to data type int. ) )
0debug
Difference between deep copy and shallow copy : <p>I am not able to get understand what is difference between deep copy and shallow copy. Please make me understand with the simple example. Thanks</p>
0debug
Copying variable contents to clipboard while debugging in Visual Studio Code : <p>I'm debugging in Visual Studio Code and I have a JSON object that I would like to copy as text to the clipboard. </p> <p>Is this possible inside of Visual Studio Code?</p>
0debug
START_TEST(unterminated_escape) { QObject *obj = qobject_from_json("\"abc\\\""); fail_unless(obj == NULL); }
1threat
static int assigned_device_pci_cap_init(PCIDevice *pci_dev) { AssignedDevice *dev = DO_UPCAST(AssignedDevice, dev, pci_dev); PCIRegion *pci_region = dev->real_device.regions; int ret, pos; pci_set_byte(pci_dev->config + PCI_CAPABILITY_LIST, 0); pci_set_word(pci_dev->config + PCI_STATUS, pci_get_word(pci_dev->config + PCI_STATUS) & ~PCI_STATUS_CAP_LIST); pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSI, 0); if (pos != 0 && kvm_check_extension(kvm_state, KVM_CAP_ASSIGN_DEV_IRQ)) { if (!check_irqchip_in_kernel()) { return -ENOTSUP; } dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI; ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSI, pos, 10); if (ret < 0) { return ret; } pci_dev->msi_cap = pos; pci_set_word(pci_dev->config + pos + PCI_MSI_FLAGS, pci_get_word(pci_dev->config + pos + PCI_MSI_FLAGS) & PCI_MSI_FLAGS_QMASK); pci_set_long(pci_dev->config + pos + PCI_MSI_ADDRESS_LO, 0); pci_set_word(pci_dev->config + pos + PCI_MSI_DATA_32, 0); pci_set_word(pci_dev->wmask + pos + PCI_MSI_FLAGS, PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE); pci_set_long(pci_dev->wmask + pos + PCI_MSI_ADDRESS_LO, 0xfffffffc); pci_set_word(pci_dev->wmask + pos + PCI_MSI_DATA_32, 0xffff); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSIX, 0); if (pos != 0 && kvm_device_msix_supported(kvm_state)) { int bar_nr; uint32_t msix_table_entry; if (!check_irqchip_in_kernel()) { return -ENOTSUP; } dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX; ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSIX, pos, 12); if (ret < 0) { return ret; } pci_dev->msix_cap = pos; pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS, pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) & PCI_MSIX_FLAGS_QSIZE); pci_set_word(pci_dev->wmask + pos + PCI_MSIX_FLAGS, PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL); msix_table_entry = pci_get_long(pci_dev->config + pos + PCI_MSIX_TABLE); bar_nr = msix_table_entry & PCI_MSIX_FLAGS_BIRMASK; msix_table_entry &= ~PCI_MSIX_FLAGS_BIRMASK; dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry; dev->msix_max = pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS); dev->msix_max &= PCI_MSIX_FLAGS_QSIZE; dev->msix_max += 1; } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_PM, 0); if (pos) { uint16_t pmc; ret = pci_add_capability(pci_dev, PCI_CAP_ID_PM, pos, PCI_PM_SIZEOF); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, PCI_PM_SIZEOF); pmc = pci_get_word(pci_dev->config + pos + PCI_CAP_FLAGS); pmc &= (PCI_PM_CAP_VER_MASK | PCI_PM_CAP_DSI); pci_set_word(pci_dev->config + pos + PCI_CAP_FLAGS, pmc); pci_set_word(pci_dev->config + pos + PCI_PM_CTRL, PCI_PM_CTRL_NO_SOFT_RESET); pci_set_byte(pci_dev->config + pos + PCI_PM_PPB_EXTENSIONS, 0); pci_set_byte(pci_dev->config + pos + PCI_PM_DATA_REGISTER, 0); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_EXP, 0); if (pos) { uint8_t version, size = 0; uint16_t type, devctl, lnksta; uint32_t devcap, lnkcap; version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS); version &= PCI_EXP_FLAGS_VERS; if (version == 1) { size = 0x14; } else if (version == 2) { size = MIN(0x3c, PCI_CONFIG_SPACE_SIZE - pos); if (size < 0x34) { error_report("%s: Invalid size PCIe cap-id 0x%x", __func__, PCI_CAP_ID_EXP); return -EINVAL; } else if (size != 0x3c) { error_report("WARNING, %s: PCIe cap-id 0x%x has " "non-standard size 0x%x; std size should be 0x3c", __func__, PCI_CAP_ID_EXP, size); } } else if (version == 0) { uint16_t vid, did; vid = pci_get_word(pci_dev->config + PCI_VENDOR_ID); did = pci_get_word(pci_dev->config + PCI_DEVICE_ID); if (vid == PCI_VENDOR_ID_INTEL && did == 0x10ed) { size = 0x3c; } } if (size == 0) { error_report("%s: Unsupported PCI express capability version %d", __func__, version); return -EINVAL; } ret = pci_add_capability(pci_dev, PCI_CAP_ID_EXP, pos, size); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, size); type = pci_get_word(pci_dev->config + pos + PCI_EXP_FLAGS); type = (type & PCI_EXP_FLAGS_TYPE) >> 4; if (type != PCI_EXP_TYPE_ENDPOINT && type != PCI_EXP_TYPE_LEG_END && type != PCI_EXP_TYPE_RC_END) { error_report("Device assignment only supports endpoint assignment," " device type %d", type); return -EINVAL; } devcap = pci_get_long(pci_dev->config + pos + PCI_EXP_DEVCAP); devcap &= ~PCI_EXP_DEVCAP_FLR; pci_set_long(pci_dev->config + pos + PCI_EXP_DEVCAP, devcap); devctl = pci_get_word(pci_dev->config + pos + PCI_EXP_DEVCTL); devctl = (devctl & (PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_PAYLOAD)) | PCI_EXP_DEVCTL_RELAX_EN | PCI_EXP_DEVCTL_NOSNOOP_EN; pci_set_word(pci_dev->config + pos + PCI_EXP_DEVCTL, devctl); devctl = PCI_EXP_DEVCTL_BCR_FLR | PCI_EXP_DEVCTL_AUX_PME; pci_set_word(pci_dev->wmask + pos + PCI_EXP_DEVCTL, ~devctl); pci_set_word(pci_dev->config + pos + PCI_EXP_DEVSTA, 0); lnkcap = pci_get_long(pci_dev->config + pos + PCI_EXP_LNKCAP); lnkcap &= (PCI_EXP_LNKCAP_SLS | PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_ASPMS | PCI_EXP_LNKCAP_L0SEL | PCI_EXP_LNKCAP_L1EL); pci_set_long(pci_dev->config + pos + PCI_EXP_LNKCAP, lnkcap); lnksta = pci_get_word(pci_dev->config + pos + PCI_EXP_LNKSTA); lnksta &= (PCI_EXP_LNKSTA_CLS | PCI_EXP_LNKSTA_NLW); pci_set_word(pci_dev->config + pos + PCI_EXP_LNKSTA, lnksta); if (version >= 2) { pci_set_long(pci_dev->config + pos + PCI_EXP_SLTCAP, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_SLTCTL, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_SLTSTA, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_RTCTL, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_RTCAP, 0); pci_set_long(pci_dev->config + pos + PCI_EXP_RTSTA, 0); } } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_PCIX, 0); if (pos) { uint16_t cmd; uint32_t status; ret = pci_add_capability(pci_dev, PCI_CAP_ID_PCIX, pos, 8); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, 8); cmd = pci_get_word(pci_dev->config + pos + PCI_X_CMD); cmd &= (PCI_X_CMD_DPERR_E | PCI_X_CMD_ERO | PCI_X_CMD_MAX_READ | PCI_X_CMD_MAX_SPLIT); pci_set_word(pci_dev->config + pos + PCI_X_CMD, cmd); status = pci_get_long(pci_dev->config + pos + PCI_X_STATUS); status &= ~(PCI_X_STATUS_BUS | PCI_X_STATUS_DEVFN); status |= (pci_bus_num(pci_dev->bus) << 8) | pci_dev->devfn; status &= ~(PCI_X_STATUS_SPL_DISC | PCI_X_STATUS_UNX_SPL | PCI_X_STATUS_SPL_ERR); pci_set_long(pci_dev->config + pos + PCI_X_STATUS, status); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_VPD, 0); if (pos) { ret = pci_add_capability(pci_dev, PCI_CAP_ID_VPD, pos, 8); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, 8); assigned_dev_direct_config_write(dev, pos + 2, 6); } for (pos = 0; (pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_VNDR, pos)); pos += PCI_CAP_LIST_NEXT) { uint8_t len = pci_get_byte(pci_dev->config + pos + PCI_CAP_FLAGS); ret = pci_add_capability(pci_dev, PCI_CAP_ID_VNDR, pos, len); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, len); assigned_dev_direct_config_write(dev, pos + 2, len - 2); } if ((pci_get_word(pci_dev->config + PCI_STATUS) & PCI_STATUS_CAP_LIST) != (assigned_dev_pci_read_byte(pci_dev, PCI_STATUS) & PCI_STATUS_CAP_LIST)) { dev->emulate_config_read[PCI_STATUS] |= PCI_STATUS_CAP_LIST; } return 0; }
1threat
How to use axios instead of ajax in datatable? : <p>I want to use axios to fetch data and load them to datatable. It is possible if I load all the data and render to datatable. But, what I want is load page number specific data. I don't want to load all the data at once it makes slow data loading. In short, I want to implement server side loading with axios in datatable. I have been stuck since long. Is there any way? Thanks.</p>
0debug
Shows connection is closed even if connection.open is present : This is the function to access the database; the connection string is perfect - There is another Function similar to this and it works fine. Please help me fix this ASAP. `Friend Shared Function AddMember(member As Object) As Task(Of Integer) Dim connection = New SqlConnection(Configuration.ConfigurationManager.ConnectionStrings("Carrel").ConnectionString) Dim query = New SqlCommand("INSERT INTO JSON (CATEGORY,DATA) VALUES ('MEM',@JSONString)", connection) Try Connection.Open() query.Parameters.Add(New SqlParameter("@JSONString", JsonConvert.SerializeObject(member))) Return query.ExecuteNonQueryAsync() Catch ex As Exception MsgBox(ex.ToString()) Throw Finally query.Connection.Close() End Try End Function`
0debug
Git. How to download new project file? : for example, in a project by another developer a new file was added. How using TortoiseGit I can download the file to your local repository?
0debug
static int usb_host_read_file(char *line, size_t line_size, const char *device_file, const char *device_name) { FILE *f; int ret = 0; char filename[PATH_MAX]; snprintf(filename, PATH_MAX, device_file, device_name); f = fopen(filename, "r"); if (f) { fgets(line, line_size, f); fclose(f); ret = 1; } else { term_printf("husb: could not open %s\n", filename); } return ret; }
1threat
static void bonito_spciconf_writel(void *opaque, target_phys_addr_t addr, uint32_t val) { PCIBonitoState *s = opaque; uint32_t pciaddr; uint16_t status; DPRINTF("bonito_spciconf_writel "TARGET_FMT_plx" val %x \n", addr, val); assert((addr&0x3)==0); pciaddr = bonito_sbridge_pciaddr(s, addr); if (pciaddr == 0xffffffff) { return; } s->pcihost->config_reg = (pciaddr) | (1u << 31); pci_data_write(s->pcihost->bus, s->pcihost->config_reg, val, 4); status = pci_get_word(s->dev.config + PCI_STATUS); status &= ~(PCI_STATUS_REC_MASTER_ABORT | PCI_STATUS_REC_TARGET_ABORT); pci_set_word(s->dev.config + PCI_STATUS, status); }
1threat
can we have nested ? : operator in C language. explain if yes, then how : <p>I am learning to code in C language with my friend and my friend asks me Can we have nested ?: operator in C language? If yes, please send an easy describing it too.</p>
0debug
static void dmg_close(BlockDriverState *bs) { BDRVDMGState *s = bs->opaque; g_free(s->types); g_free(s->offsets); g_free(s->lengths); g_free(s->sectors); g_free(s->sectorcounts); g_free(s->compressed_chunk); g_free(s->uncompressed_chunk); inflateEnd(&s->zstream); }
1threat
How to count the numbers of records in a table : <p>What are 3 ways to get a count of the number of records in a table?</p>
0debug
static int build_feed_streams(void) { FFServerStream *stream, *feed; int i; for(stream = config.first_stream; stream; stream = stream->next) { feed = stream->feed; if (!feed) continue; if (stream->is_feed) { for(i=0;i<stream->nb_streams;i++) stream->feed_streams[i] = i; } else { for(i=0;i<stream->nb_streams;i++) stream->feed_streams[i] = add_av_stream(feed, stream->streams[i]); } } for(feed = config.first_feed; feed; feed = feed->next_feed) { int fd; if (avio_check(feed->feed_filename, AVIO_FLAG_READ) > 0) { AVFormatContext *s = NULL; int matches = 0; if (avformat_open_input(&s, feed->feed_filename, NULL, NULL) >= 0) { int ret = ffio_set_buf_size(s->pb, FFM_PACKET_SIZE); if (ret < 0) { http_log("Failed to set buffer size\n"); goto bail; } if (s->nb_streams == feed->nb_streams) { matches = 1; for(i=0;i<s->nb_streams;i++) { AVStream *sf, *ss; sf = feed->streams[i]; ss = s->streams[i]; if (sf->index != ss->index || sf->id != ss->id) { http_log("Index & Id do not match for stream %d (%s)\n", i, feed->feed_filename); matches = 0; } else { AVCodecContext *ccf, *ccs; ccf = sf->codec; ccs = ss->codec; #define CHECK_CODEC(x) (ccf->x != ccs->x) if (CHECK_CODEC(codec_id) || CHECK_CODEC(codec_type)) { http_log("Codecs do not match for stream %d\n", i); matches = 0; } else if (CHECK_CODEC(bit_rate) || CHECK_CODEC(flags)) { http_log("Codec bitrates do not match for stream %d\n", i); matches = 0; } else if (ccf->codec_type == AVMEDIA_TYPE_VIDEO) { if (CHECK_CODEC(time_base.den) || CHECK_CODEC(time_base.num) || CHECK_CODEC(width) || CHECK_CODEC(height)) { http_log("Codec width, height and framerate do not match for stream %d\n", i); matches = 0; } } else if (ccf->codec_type == AVMEDIA_TYPE_AUDIO) { if (CHECK_CODEC(sample_rate) || CHECK_CODEC(channels) || CHECK_CODEC(frame_size)) { http_log("Codec sample_rate, channels, frame_size do not match for stream %d\n", i); matches = 0; } } else { http_log("Unknown codec type\n"); matches = 0; } } if (!matches) break; } } else http_log("Deleting feed file '%s' as stream counts differ (%d != %d)\n", feed->feed_filename, s->nb_streams, feed->nb_streams); avformat_close_input(&s); } else http_log("Deleting feed file '%s' as it appears to be corrupt\n", feed->feed_filename); if (!matches) { if (feed->readonly) { http_log("Unable to delete feed file '%s' as it is marked readonly\n", feed->feed_filename); goto bail; } unlink(feed->feed_filename); } } if (avio_check(feed->feed_filename, AVIO_FLAG_WRITE) <= 0) { AVFormatContext *s = avformat_alloc_context(); if (!s) { http_log("Failed to allocate context\n"); goto bail; } if (feed->readonly) { http_log("Unable to create feed file '%s' as it is marked readonly\n", feed->feed_filename); goto bail; } if (avio_open(&s->pb, feed->feed_filename, AVIO_FLAG_WRITE) < 0) { http_log("Could not open output feed file '%s'\n", feed->feed_filename); goto bail; } s->oformat = feed->fmt; s->nb_streams = feed->nb_streams; s->streams = feed->streams; if (avformat_write_header(s, NULL) < 0) { http_log("Container doesn't support the required parameters\n"); goto bail; } av_freep(&s->priv_data); avio_closep(&s->pb); s->streams = NULL; s->nb_streams = 0; avformat_free_context(s); } fd = open(feed->feed_filename, O_RDONLY); if (fd < 0) { http_log("Could not open output feed file '%s'\n", feed->feed_filename); goto bail; } feed->feed_write_index = FFMAX(ffm_read_write_index(fd), FFM_PACKET_SIZE); feed->feed_size = lseek(fd, 0, SEEK_END); if (feed->feed_max_size && feed->feed_max_size < feed->feed_size) feed->feed_max_size = feed->feed_size; close(fd); } return 0; bail: return -1; }
1threat
How to compare randomly generated number with user entered number at run time in C? : <p>I am making Bubble game in c where randomly some numbers are generating on the console window and user need to enter that numbers appearing on the screen or console window and I need to compare that user input and random generated number and make that number invisible from the screen.</p> <p>I have used rand() function in c and for user input I have used getch() function and i have tried every type conversion but not getting the solution yet.</p> <pre><code>void main() { char temp1 = 0; char temp = 0; temp1 = rand()%10; temp = getch(); if(temp == temp1) printf("ok"); } </code></pre> <p>I want to compare randomly generated value and user input at run time and input given by the user by seeing on console's number is equal i want to exit.</p>
0debug
@SuppressWarnings vs @SuppressLint : <p>Can anyone explain to me the differences between <code>@SuppressWarnings</code> and <code>@SuppressLint</code>? When we should use one over another? </p> <p>I've read the documentation, but still don't get the differences. Explain using an example/sample code will be much appreciated. Thanks.</p>
0debug
My dud keeps falling through barrier : in unity i made a test sprite with this script but my dud falls through the ground when i jump fast or at random but stays on wail he is moving slow but falls through wen jumping/landing fast. Any help will be appreciated :) using UnityEngine; using System.Collections; public class code : MonoBehaviour { //void FixedUpdate() { /*if (Input.GetKey (KeyCode.LeftArrow)) { int Left = 1; } if (Input.GetKey (KeyCode.RightArrow)) { int Right = 1; } if (Input.GetKey(KeyCode.UpArrow)) { } */ public float speed1 = 6.0F; public float jumpSpeed = 8.0F; public float gravity = 20.0F; private Vector3 moveDirection = Vector3.zero; void FixedUpdate() { CharacterController controller = GetComponent<CharacterController>(); // is the controller on the ground? if (controller.isGrounded) { //Feed moveDirection with input. moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")); moveDirection = transform.TransformDirection(moveDirection); //Multiply it by speed. moveDirection *= speed1; //Jumping if (Input.GetButton("Jump")) moveDirection.y = jumpSpeed; if (Input.GetKey (KeyCode.UpArrow)) moveDirection.y = jumpSpeed; } //Applying gravity to the controller moveDirection.y -= gravity * Time.deltaTime; //Making the character move controller.Move(moveDirection * Time.deltaTime); } }
0debug
Comparing records in one table to another for large databases in PHP : <p>I have two tables in MySQL database. Lets say there are 1800 records in table 1 and 20000 records in table 2. Now I want to compare each record in table 1 to table 2 and update some fields in table 2 for the records that are matched. </p> <p>I want to know what is the most optimized way to do this.</p>
0debug
void vnc_disconnect_finish(VncState *vs) { int i; vnc_jobs_join(vs); vnc_lock_output(vs); vnc_qmp_event(vs, QAPI_EVENT_VNC_DISCONNECTED); buffer_free(&vs->input); buffer_free(&vs->output); buffer_free(&vs->ws_input); buffer_free(&vs->ws_output); qapi_free_VncClientInfo(vs->info); vnc_zlib_clear(vs); vnc_tight_clear(vs); vnc_zrle_clear(vs); #ifdef CONFIG_VNC_TLS vnc_tls_client_cleanup(vs); #endif #ifdef CONFIG_VNC_SASL vnc_sasl_client_cleanup(vs); #endif audio_del(vs); vnc_release_modifiers(vs); if (vs->initialized) { QTAILQ_REMOVE(&vs->vd->clients, vs, next); qemu_remove_mouse_mode_change_notifier(&vs->mouse_mode_notifier); } if (vs->vd->lock_key_sync) qemu_remove_led_event_handler(vs->led); vnc_unlock_output(vs); qemu_mutex_destroy(&vs->output_mutex); if (vs->bh != NULL) { qemu_bh_delete(vs->bh); } buffer_free(&vs->jobs_buffer); for (i = 0; i < VNC_STAT_ROWS; ++i) { g_free(vs->lossy_rect[i]); } g_free(vs->lossy_rect); g_free(vs); }
1threat
static inline void gen_neon_mull(TCGv_i64 dest, TCGv a, TCGv b, int size, int u) { TCGv_i64 tmp; switch ((size << 1) | u) { case 0: gen_helper_neon_mull_s8(dest, a, b); break; case 1: gen_helper_neon_mull_u8(dest, a, b); break; case 2: gen_helper_neon_mull_s16(dest, a, b); break; case 3: gen_helper_neon_mull_u16(dest, a, b); break; case 4: tmp = gen_muls_i64_i32(a, b); tcg_gen_mov_i64(dest, tmp); break; case 5: tmp = gen_mulu_i64_i32(a, b); tcg_gen_mov_i64(dest, tmp); break; default: abort(); } if (size < 2) { tcg_temp_free_i32(a); tcg_temp_free_i32(b); } }
1threat
flutter how can I create circle animation like this? : I'd like to implement circle animation for profile picture like instagram story something like [this][1]. How can I achieve this? [1]: https://www.youtube.com/watch?v=GDmR8jZWb04
0debug
warning: URGENT: building for watchOS simulator but linking object file built for iOS : <p>While integrating my java library converted by j2objc I'm receiving this message.</p> <blockquote> <p>ld: warning: URGENT: building for watchOS simulator, but linking in object file (/Users/admin/Documents/j2objc/dist/lib/libjre_emul.a(IOSArray.o)) built for iOS. Note: This will be an error in the future.</p> </blockquote> <p>I do not understand will my code work on real watchOS device? Or this is just a i386 build which works only in the simulator? What I have to do in this case?</p>
0debug
static void sample_queue_push(HintSampleQueue *queue, uint8_t *data, int size, int sample) { if (size <= 14) return; if (!queue->samples || queue->len >= queue->size) { HintSample *samples; samples = av_realloc(queue->samples, sizeof(HintSample) * (queue->size + 10)); if (!samples) return; queue->size += 10; queue->samples = samples; } queue->samples[queue->len].data = data; queue->samples[queue->len].size = size; queue->samples[queue->len].sample_number = sample; queue->samples[queue->len].offset = 0; queue->samples[queue->len].own_data = 0; queue->len++; }
1threat
In python, is math.acos() faster than numpy.arccos() for scalars? : <p>I'm doing some scientific computing in Python with a lot of geometric calculations, and I ran across a significant difference between using <code>numpy</code> versus the standard <code>math</code> library.</p> <pre><code>&gt;&gt;&gt; x = timeit.Timer('v = np.arccos(a)', 'import numpy as np; a = 0.6') &gt;&gt;&gt; x.timeit(100000) 0.15387153439223766 &gt;&gt;&gt; y = timeit.Timer('v = math.acos(a)', 'import math; a = 0.6') &gt;&gt;&gt; y.timeit(100000) 0.012333301827311516 </code></pre> <p>That's more than a 10x speedup! I'm using numpy for almost all standard math functions, and I just assumed it was optimized and at least as fast as <code>math</code>. For long enough vectors, numpy.arccos() will eventually win vs. looping with math.acos(), but since I only use the scalar case, is there any downside to using math.acos(), math.asin(), math.atan() across the board, instead of the numpy versions?</p>
0debug
Writing Unit Tests in Visual Studio Code : <p>I am new to using the Visual Studio Code in place of visual studios and i feel a little lost to how i can set up my program to include unit test. </p> <p>I created a c# console app and i would like to create a test file in which i can test my main program for the console app. I am reading about all these extensions documents but i am not getting what i am expecting. I created a test extension which i have added to my main app folder. Any helpful tips to how i can integrate unit tests the same way/similar that was done in visual studios. </p>
0debug
Xcode lldb error: can't print out Swift variable - get "$__lldb_injected_self.$__lldb_wrapped_expr_x" instead : <p>Sometimes, when trying to print out a variable in the debugger, the following error message is displayed:</p> <pre><code>error: warning: &lt;EXPR&gt;:12:9: warning: initialization of variable '$__lldb_error_result' was never used; consider replacing with assignment to '_' or removing it var $__lldb_error_result = __lldb_tmp_error ~~~~^~~~~~~~~~~~~~~~~~~~ _ error: &lt;EXPR&gt;:18:5: error: use of unresolved identifier '$__lldb_injected_self' $__lldb_injected_self.$__lldb_wrapped_expr_120( ^~~~~~~~~~~~~~~~~~~~~ </code></pre> <p>This is a known <code>lldb</code> bug (<a href="https://bugs.swift.org/browse/SR-6156" rel="noreferrer">https://bugs.swift.org/browse/SR-6156</a>), but perhaps someone knows a workaround that can be used until that bug is fixed?</p>
0debug
how to direct to a HTML page using a cookie? : <p>i'm working on a site currently that has a 15 second intro on the index.html - with a skip button (that leads to main.html) - and was wondering if it is possible to use a cookie to store info on user and thereby directing them straight to the main page on their second visit to the site?</p> <p>i've been doing webstuff for years but never had the need to use a cookie.</p> <p>anyone?</p>
0debug
App not compatible with buildpack - Heroku : <p>When I run <code>git push heroku master</code> this is what I get:</p> <pre><code>C:\Users\Emanuele-PC\Desktop\project-mm-beta&gt;git push heroku master Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 505 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----&gt; App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to project-mm-beta. remote: To https://git.heroku.com/project-mm-beta.git ! [remote rejected] master -&gt; master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/project-mm-beta.git' </code></pre> <p>The code I am trying to deploy is just one file (it's a test because it's my first time using Heroku) and it's written in Python. I have already set the buildpack (python) but it still doesn't work. How can I solve?</p>
0debug
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { H264Context *h = avctx->priv_data; MpegEncContext *s = &h->s; AVFrame *pict = data; int buf_index; s->flags= avctx->flags; s->flags2= avctx->flags2; if (buf_size == 0) { Picture *out; int i, out_idx; out = h->delayed_pic[0]; out_idx = 0; for(i=1; h->delayed_pic[i] && h->delayed_pic[i]->poc; i++) if(h->delayed_pic[i]->poc < out->poc){ out = h->delayed_pic[i]; out_idx = i; } for(i=out_idx; h->delayed_pic[i]; i++) h->delayed_pic[i] = h->delayed_pic[i+1]; if(out){ *data_size = sizeof(AVFrame); *pict= *(AVFrame*)out; } return 0; } if(h->is_avc && !h->got_avcC) { int i, cnt, nalsize; unsigned char *p = avctx->extradata; if(avctx->extradata_size < 7) { av_log(avctx, AV_LOG_ERROR, "avcC too short\n"); return -1; } if(*p != 1) { av_log(avctx, AV_LOG_ERROR, "Unknown avcC version %d\n", *p); return -1; } h->nal_length_size = 2; cnt = *(p+5) & 0x1f; p += 6; for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(decode_nal_units(h, p, nalsize) < 0) { av_log(avctx, AV_LOG_ERROR, "Decoding sps %d from avcC failed\n", i); return -1; } p += nalsize; } cnt = *(p++); for (i = 0; i < cnt; i++) { nalsize = AV_RB16(p) + 2; if(decode_nal_units(h, p, nalsize) != nalsize) { av_log(avctx, AV_LOG_ERROR, "Decoding pps %d from avcC failed\n", i); return -1; } p += nalsize; } h->nal_length_size = ((*(((char*)(avctx->extradata))+4))&0x03)+1; h->got_avcC = 1; } if(avctx->frame_number==0 && !h->is_avc && s->avctx->extradata_size){ if(decode_nal_units(h, s->avctx->extradata, s->avctx->extradata_size) < 0) return -1; } buf_index=decode_nal_units(h, buf, buf_size); if(buf_index < 0) return -1; if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){ if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0; av_log(avctx, AV_LOG_ERROR, "no frame!\n"); return -1; } if(!(s->flags2 & CODEC_FLAG2_CHUNKS) || (s->mb_y >= s->mb_height && s->mb_height)){ Picture *out = s->current_picture_ptr; Picture *cur = s->current_picture_ptr; int i, pics, cross_idr, out_of_order, out_idx; s->mb_y= 0; s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_H264; s->current_picture_ptr->pict_type= s->pict_type; if(!s->dropable) { execute_ref_pic_marking(h, h->mmco, h->mmco_index); h->prev_poc_msb= h->poc_msb; h->prev_poc_lsb= h->poc_lsb; } h->prev_frame_num_offset= h->frame_num_offset; h->prev_frame_num= h->frame_num; if (!FIELD_PICTURE) ff_er_frame_end(s); MPV_frame_end(s); if (s->first_field) { *data_size = 0; } else { cur->interlaced_frame = FIELD_OR_MBAFF_PICTURE; cur->top_field_first = cur->field_poc[0] < cur->field_poc[1]; if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames < h->sps.num_reorder_frames){ s->avctx->has_b_frames = h->sps.num_reorder_frames; s->low_delay = 0; } if( s->avctx->strict_std_compliance >= FF_COMPLIANCE_STRICT && !h->sps.bitstream_restriction_flag){ s->avctx->has_b_frames= MAX_DELAYED_PIC_COUNT; s->low_delay= 0; } pics = 0; while(h->delayed_pic[pics]) pics++; assert(pics <= MAX_DELAYED_PIC_COUNT); h->delayed_pic[pics++] = cur; if(cur->reference == 0) cur->reference = DELAYED_PIC_REF; out = h->delayed_pic[0]; out_idx = 0; for(i=1; h->delayed_pic[i] && h->delayed_pic[i]->poc; i++) if(h->delayed_pic[i]->poc < out->poc){ out = h->delayed_pic[i]; out_idx = i; } cross_idr = !h->delayed_pic[0]->poc || !!h->delayed_pic[i]; out_of_order = !cross_idr && out->poc < h->outputed_poc; if(h->sps.bitstream_restriction_flag && s->avctx->has_b_frames >= h->sps.num_reorder_frames) { } else if((out_of_order && pics-1 == s->avctx->has_b_frames && s->avctx->has_b_frames < MAX_DELAYED_PIC_COUNT) || (s->low_delay && ((!cross_idr && out->poc > h->outputed_poc + 2) || cur->pict_type == FF_B_TYPE))) { s->low_delay = 0; s->avctx->has_b_frames++; } if(out_of_order || pics > s->avctx->has_b_frames){ out->reference &= ~DELAYED_PIC_REF; for(i=out_idx; h->delayed_pic[i]; i++) h->delayed_pic[i] = h->delayed_pic[i+1]; } if(!out_of_order && pics > s->avctx->has_b_frames){ *data_size = sizeof(AVFrame); h->outputed_poc = out->poc; *pict= *(AVFrame*)out; }else{ av_log(avctx, AV_LOG_DEBUG, "no picture\n"); } } } assert(pict->data[0] || !*data_size); ff_print_debug_info(s, pict); #if 0 avctx->frame_number = s->picture_number - 1; #endif return get_consumed_bytes(s, buf_index, buf_size); }
1threat
Counting the no of elements in a data structure, printing the count for each position and decrement the iteration using recursion : Various signal towers are present in a city.Towers are aligned in a straight horizontal line(from left to right) and each tower transmits a signal in the right to left direction.Tower A shall block the signal of Tower B if Tower A is present to the left of Tower B and Tower A is taller than Tower B. So,the range of a signal of a given tower can be defined as : {(the number of contiguous towers just to the left of the given tower whose height is less than or equal to the height of the given tower) + 1}. #include <iostream> #include <vector> using namespace std; vector<int> res; void recursion(int a[],int x) { if (x >= 0) {// Taking the last element of the array as the max element int max = a[x], count = 0; for (int i = x; i >= 0; i--) {//Comparing the max with all the elements in the array if (max >= a[i]) { count++; } else { break; } } //Pushing the count of the current element in the vector. res.push_back(count); x = x - 1; recursion(a, x); } } int main() { int TestCase, n; cin >> TestCase; for (int l = 0; l < TestCase; l++) { cin >> n; int * arr = new int[n]; //Getting the elements for (int j = 0; j < n; j++) { cin >> arr[j]; } recursion(arr, n-1); //Iterating through the vector in reverse manner and printing //the result. for (auto it = res.rbegin(); it != res.rend(); ++it) { cout << *it << " "; } delete[] arr; } return 0; } First line contains an integer T specifying the number of test cases. Second line contains an integer n specifying the number of towers. Third line contains n space separated integers(H[i]) denoting the height of each tower. Print the range of each tower (separated by a space). Sample Input : 1 7 100 80 60 70 60 75 85 Sample Output : 1 1 1 2 1 4 6 My solution is correct but the time complexity is the issue. Is there any way to reduce time complexity?
0debug
How to check if device orientation is landscape left or right in swift? : <pre><code> if UIDeviceOrientationIsLandscape(UIDevice.currentDevice().orientation) { print("landscape") } if UIDeviceOrientationIsPortrait(UIDevice.currentDevice().orientation){ print("portrait") } </code></pre> <p>How can I check if it's landscape left or right?</p>
0debug
How to develop multiplayer game using Bluetooth : <p>Really I am new in game development. I have not any idea how to design the games for Android with Multiplayers. I searched a lot for that but did not get good tutorials. Kindly any expert suggest to me below things:</p> <p>1) How to develop games in Android? Which basic level languages should i need to learn?</p> <p>2) How to configure it in MultiPlayers game? Which one is best TCP or UDP.</p>
0debug
void qemu_set_version(const char *version) { qemu_version = version; }
1threat
static int jpeg2000_decode_packets(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile) { int ret, i; int tp_index = 0; s->bit_index = 8; if (tile->poc.nb_poc) { for (i=0; i<tile->poc.nb_poc; i++) { Jpeg2000POCEntry *e = &tile->poc.poc[i]; ret = jpeg2000_decode_packets_po_iteration(s, tile, e->RSpoc, e->CSpoc, e->LYEpoc, e->REpoc, e->CEpoc, e->Ppoc, &tp_index ); if (ret < 0) return ret; } } else { ret = jpeg2000_decode_packets_po_iteration(s, tile, 0, 0, tile->codsty[0].nlayers, 33, s->ncomponents, tile->codsty[0].prog_order, &tp_index ); } bytestream2_skip(&s->g, 2); return ret; }
1threat
How to create a template string to output object contents ? : <p>I have array of objects like this:</p> <pre><code>var students = [ { name : "Mike", track: "track-a", points : 40, }, { name : "james", track: "track-a", points : 61, }, ] students.forEach(myFunction); function myFunction (item, index) { for( var key in item ) { console.log(item[key]) } } </code></pre> <p>I want to output strings inside a div like this. If points > 50 I print pass otherwise I print failed then the name and track like this</p> <pre><code>Failed: Mike in track track-a Passed: james in track track-1 </code></pre> <p>How I can build a template string like this ?</p>
0debug
What is a good alternative for static stored properties of generic types in swift? : <p>Since static stored properties are not (yet) supported for generic types in swift, I wonder what is a good alternative.</p> <p>My specific use-case is that I want to build an ORM in swift. I have an <code>Entity</code> protocol which has an associatedtype for the primary key, since some entities will have an integer as their <code>id</code> and some will have a string etc. So that makes the <code>Entity</code> protocol generic.</p> <p>Now I also have an <code>EntityCollection&lt;T: Entity&gt;</code> type, which manages collections of entities and as you can see it is also generic. The goal of <code>EntityCollection</code> is that it lets you use collections of entities as if they were normal arrays without having to be aware that there's a database behind it. <code>EntityCollection</code> will take care of querying and caching and being as optimized as possible.</p> <p>I wanted to use static properties on the <code>EntityCollection</code> to store all the entities that have already been fetched from the database. So that if two separate instances of <code>EntityCollection</code> want to fetch the same entity from the database, the database will be queried only once.</p> <p>Do you guys have any idea how else I could achieve that?</p>
0debug
static void decode_init_vlc(H264Context *h){ static int done = 0; if (!done) { int i; done = 1; init_vlc(&chroma_dc_coeff_token_vlc, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 4*5, &chroma_dc_coeff_token_len [0], 1, 1, &chroma_dc_coeff_token_bits[0], 1, 1); for(i=0; i<4; i++){ init_vlc(&coeff_token_vlc[i], COEFF_TOKEN_VLC_BITS, 4*17, &coeff_token_len [i][0], 1, 1, &coeff_token_bits[i][0], 1, 1); } for(i=0; i<3; i++){ init_vlc(&chroma_dc_total_zeros_vlc[i], CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 4, &chroma_dc_total_zeros_len [i][0], 1, 1, &chroma_dc_total_zeros_bits[i][0], 1, 1); } for(i=0; i<15; i++){ init_vlc(&total_zeros_vlc[i], TOTAL_ZEROS_VLC_BITS, 16, &total_zeros_len [i][0], 1, 1, &total_zeros_bits[i][0], 1, 1); } for(i=0; i<6; i++){ init_vlc(&run_vlc[i], RUN_VLC_BITS, 7, &run_len [i][0], 1, 1, &run_bits[i][0], 1, 1); } init_vlc(&run7_vlc, RUN7_VLC_BITS, 16, &run_len [6][0], 1, 1, &run_bits[6][0], 1, 1); } }
1threat
Chrome DevTools: paused before potential out-of-memory crash : <p>In latest Chrome DevTools I can see a new information:</p> <p><a href="https://i.stack.imgur.com/65KAN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/65KAN.png" alt="enter image description here"></a></p> <p>Now, I'm not sure how to use this information. It seems to appear randomly in the app. How can I debug the app to avoid potential out-of-memory crashes? I checked in task manager that at the moment when this information appears the app uses about 55K memory which in case of this app is quite low (when it computes some data it can be much higher memory consumption).</p> <p>So I'm wondering if this information is accurate and there is a risk of crashing. If so, what should I do with it?</p>
0debug
Visitor *validate_test_init(TestInputVisitorData *data, const char *json_string, ...) { Visitor *v; va_list ap; va_start(ap, json_string); data->obj = qobject_from_jsonv(json_string, &ap); va_end(ap); g_assert(data->obj != NULL); data->qiv = qmp_input_visitor_new_strict(data->obj); g_assert(data->qiv != NULL); v = qmp_input_get_visitor(data->qiv); g_assert(v != NULL); return v; }
1threat
React Native Make View "Hug" the Top of the Keyboard : <p>Let's say I have a view that is positioned absolute at the bottom of the screen. This view contains a text input. When the text input is focused, I want the bottom of the view to touch the top of the keyboard. </p> <p>I've been messing around with KeyboardAvoidingView, but the keyboard keeps going over my view. Is it not possible to make this work with position absolute?</p> <p>What other method can I try? Thanks!</p>
0debug
Angular2 detect change in service : <p>I have one component in Angular2 which is changing a "lang" class variable in my service translate.service.ts. In another component I am fetching a dict with the translation on init. If the first component changes the services language later, I want to refetch the dict in the second component automatically. How do I do that?</p> <p>First component:</p> <pre><code> setLang(lang) { this._translateService.setLang(lang); } </code></pre> <p>Service:</p> <pre><code>dict = { "en": {}}; lang = "en"; setLang(lang) { this.lang = lang; } getLang() { return this.dict; } </code></pre> <p>Second component:</p> <pre><code>ngOnInit() { this.dict = this._translateService.getDict(); } </code></pre>
0debug
ios 13 - Custom SearchBar with UISearchBar _searchField not working : <p>Before Xcode-11-Beta (ios13) below code for custom searchbar value for key to get textField working fine. Now getting below crash log.</p> <blockquote> <p>'NSGenericException', reason: 'Access to UISearchBar's _searchField ivar is prohibited. This is an application bug'</p> </blockquote> <pre><code>- (UITextField *)textField { return [self valueForKey:@"_searchField"]; } </code></pre> <p>Any help appreciated. </p>
0debug
Multi Threading in API in C# : <p>I'm trying to create an Web Service that runs an asynchronous function with .Net Core Framework.</p> <p>This function must be executed in its own thread and return a new value that will be sent to the proper caller. The service must be listening for other calls while my async function is running, and start a new thread for each call. Once the thread is finished, I want the response to be sent to the original caller. I have tried this way :</p> <p>In my controller I have :</p> <pre><code>[Route("api/orchestration")] public class OrchController : Controller { [HttpGet("{value}")] public void RunOrchestration(int value) { Program.GetResultAsync(value); // Notice that no value is returned but it respects the asynchronicity and the multithreading as asked } } </code></pre> <p>In my main class I have :</p> <pre><code>public async static Task&lt;string&gt; GetResultAsync(int i) { return await OrchestrationAsync(i); } public static Task&lt;string&gt; OrchestrationAsync(int i) { return Task.Run&lt;string&gt;(() =&gt; { return r = Orchestration(i); }); } public static string Orchestration(Object i) { // This function is an orchestrator of microservices that talk asynchronously through a MOM // Just consider that it returns the value I want in a string return result; } </code></pre> <p>As you can see I want my function GetResultAsync to return a string with the value that will be sent to the caller. Yet I can't have something like this (see code below) because GetResultAsync returns a Task and not a string :</p> <pre><code>public string RunOrchestration(int value) { return r = Program.GetResultAsync(value); } </code></pre> <p>And if I put an await in RunOrchestration, it will wait for the response and will behave as a synchronous function.</p> <p>Anyone has an idea on how to get my response and give it back to the proper caller ?</p> <p>Thank's in advance ! :)</p>
0debug
How do I delete/remove an app from a Firebase project? : <p>Where is the delete/remove button???</p> <p>Attached is a screenshot of what I want to do.</p> <p><a href="https://i.stack.imgur.com/43ioI.png" rel="noreferrer"><img src="https://i.stack.imgur.com/43ioI.png" alt="firebase app delete"></a></p>
0debug
javascript regex to c# : I have a regex for validating Email Ids. ^(([\w]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$ I need to convert it C# format.Can any one help?What are the changes needed on the above JS Regex?
0debug
static void virtio_ccw_bus_class_init(ObjectClass *klass, void *data) { VirtioBusClass *k = VIRTIO_BUS_CLASS(klass); BusClass *bus_class = BUS_CLASS(klass); bus_class->max_dev = 1; k->notify = virtio_ccw_notify; k->vmstate_change = virtio_ccw_vmstate_change; k->query_guest_notifiers = virtio_ccw_query_guest_notifiers; k->set_guest_notifiers = virtio_ccw_set_guest_notifiers; k->save_queue = virtio_ccw_save_queue; k->load_queue = virtio_ccw_load_queue; k->save_config = virtio_ccw_save_config; k->load_config = virtio_ccw_load_config; k->device_plugged = virtio_ccw_device_plugged; k->post_plugged = virtio_ccw_post_plugged; k->device_unplugged = virtio_ccw_device_unplugged; k->ioeventfd_started = virtio_ccw_ioeventfd_started; k->ioeventfd_set_started = virtio_ccw_ioeventfd_set_started; k->ioeventfd_disabled = virtio_ccw_ioeventfd_disabled; k->ioeventfd_set_disabled = virtio_ccw_ioeventfd_set_disabled; k->ioeventfd_assign = virtio_ccw_ioeventfd_assign; }
1threat
static vscsi_req *vscsi_find_req(VSCSIState *s, uint32_t tag) { if (tag >= VSCSI_REQ_LIMIT || !s->reqs[tag].active) { return NULL; } return &s->reqs[tag]; }
1threat
R: Writing list with elements of different classed into a text file : How to write a list of different class variables into a text file consequently using R base functions? `write` and `cat` can't handle data.frames and `write.table` is specific to tables only. None of them handles lists properly. Sample list: > test [[1]] [1] "a" "b" "c" [[2]] [1] "d" "e" "f" [[3]] [1] 1 2 3 [[4]] X.g. X.h. X.i. 1 g h i [[5]] [[5]][[1]] [1] "k" [[5]][[2]] [1] "l" [[5]][[3]] [1] "m" "n" [[6]] [1] "2015-03-23 11:15:00 CET" It consists of character, numeric, POSIXlt time variable and another list. Desired result - a text file like that: a b c d e f 1 2 3 X.g. X.h. X.i. 1 g h i k l m n 2015-03-23 11:15:00
0debug
static inline void RENAME(yuv2packedX)(SwsContext *c, int16_t *lumFilter, int16_t **lumSrc, int lumFilterSize, int16_t *chrFilter, int16_t **chrSrc, int chrFilterSize, uint8_t *dest, int dstW, int dstY) { int dummy=0; switch(c->dstFormat) { #ifdef HAVE_MMX case IMGFMT_BGR32: { asm volatile( YSCALEYUV2RGBX WRITEBGR32(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR24: { asm volatile( YSCALEYUV2RGBX "lea (%%"REG_a", %%"REG_a", 2), %%"REG_b"\n\t" "add %4, %%"REG_b" \n\t" WRITEBGR24(%%REGb, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_b, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR15: { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g5Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR15(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_BGR16: { asm volatile( YSCALEYUV2RGBX #ifdef DITHER1XBPP "paddusb "MANGLE(b5Dither)", %%mm2\n\t" "paddusb "MANGLE(g6Dither)", %%mm4\n\t" "paddusb "MANGLE(r5Dither)", %%mm5\n\t" #endif WRITEBGR16(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; case IMGFMT_YUY2: { asm volatile( YSCALEYUV2PACKEDX "psraw $3, %%mm3 \n\t" "psraw $3, %%mm4 \n\t" "psraw $3, %%mm1 \n\t" "psraw $3, %%mm7 \n\t" WRITEYUY2(%4, %5, %%REGa) :: "r" (&c->redDither), "m" (dummy), "m" (dummy), "m" (dummy), "r" (dest), "m" (dstW) : "%"REG_a, "%"REG_d, "%"REG_S ); } break; #endif default: #ifdef HAVE_ALTIVEC if(c->dstFormat==IMGFMT_ABGR || c->dstFormat==IMGFMT_BGRA || c->dstFormat==IMGFMT_BGR24 || c->dstFormat==IMGFMT_RGB24 || c->dstFormat==IMGFMT_RGBA || c->dstFormat==IMGFMT_ARGB) altivec_yuv2packedX (c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); else #endif yuv2packedXinC(c, lumFilter, lumSrc, lumFilterSize, chrFilter, chrSrc, chrFilterSize, dest, dstW, dstY); break; } }
1threat
how to check wether a form input has file laravel? : <p>I want to check whether form has file or not of it has I want to upload it to server and save path if not then ignore and run old dB saved path query </p>
0debug
Submit Form With Added JSON Data : <p>I have a form on a webpage and I also have some JSON data in Javascript, how do I use JQuery to append the JSON data on form post? Here are some example:</p> <pre><code>&lt;form action="server.cshtml"&gt; &lt;/form&gt; &lt;script&gt; var data = { data1: "aaa", data2: "bbb" }; $("form").submit(); &lt;/script&gt; </code></pre>
0debug
static void flat(WaveformContext *s, AVFrame *in, AVFrame *out, int component, int intensity, int offset, int column) { const int plane = s->desc->comp[component].plane; const int mirror = s->mirror; const int c0_linesize = in->linesize[ plane + 0 ]; const int c1_linesize = in->linesize[(plane + 1) % s->ncomp]; const int c2_linesize = in->linesize[(plane + 2) % s->ncomp]; const int d0_linesize = out->linesize[ plane + 0 ]; const int d1_linesize = out->linesize[(plane + 1) % s->ncomp]; const int max = 255 - intensity; const int src_h = in->height; const int src_w = in->width; int x, y; if (column) { const int d0_signed_linesize = d0_linesize * (mirror == 1 ? -1 : 1); const int d1_signed_linesize = d1_linesize * (mirror == 1 ? -1 : 1); for (x = 0; x < src_w; x++) { const uint8_t *c0_data = in->data[plane + 0]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset * d0_linesize; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset * d1_linesize; uint8_t * const d0_bottom_line = d0_data + d0_linesize * (s->size - 1); uint8_t * const d0 = (mirror ? d0_bottom_line : d0_data); uint8_t * const d1_bottom_line = d1_data + d1_linesize * (s->size - 1); uint8_t * const d1 = (mirror ? d1_bottom_line : d1_data); for (y = 0; y < src_h; y++) { const int c0 = c0_data[x] + 256; const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128); uint8_t *target; int p; target = d0 + x + d0_signed_linesize * c0; update(target, max, intensity); for (p = c0 - c1; p < c0 + c1; p++) { target = d1 + x + d1_signed_linesize * p; update(target, max, 1); } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; } } } else { const uint8_t *c0_data = in->data[plane]; const uint8_t *c1_data = in->data[(plane + 1) % s->ncomp]; const uint8_t *c2_data = in->data[(plane + 2) % s->ncomp]; uint8_t *d0_data = out->data[plane] + offset; uint8_t *d1_data = out->data[(plane + 1) % s->ncomp] + offset; if (mirror) { d0_data += s->size - 1; d1_data += s->size - 1; } for (y = 0; y < src_h; y++) { for (x = 0; x < src_w; x++) { int c0 = c0_data[x] + 256; const int c1 = FFABS(c1_data[x] - 128) + FFABS(c2_data[x] - 128); uint8_t *target; int p; if (mirror) target = d0_data - c0; else target = d0_data + c0; update(target, max, intensity); for (p = c0 - c1; p < c0 + c1; p++) { if (mirror) target = d1_data - p; else target = d1_data + p; update(target, max, 1); } } c0_data += c0_linesize; c1_data += c1_linesize; c2_data += c2_linesize; d0_data += d0_linesize; d1_data += d1_linesize; } } envelope(s, out, plane, plane); envelope(s, out, plane, (plane + 1) % s->ncomp); }
1threat
Printing ArrayList<String> into output? : <p>So, i have ArrayList which i store animals in.</p> <pre><code>private ArrayList&lt;Animal&gt; catalog = new ArrayList&lt;&gt;(); </code></pre> <p>Now, i need to print the catalog into my output when i press 4 into my output.</p> <pre><code>case 4: System.out.println("List of animals: "); printIt(); //Function to print catalog break; </code></pre> <p>I tried to do it with </p> <pre><code> private boolean InList(String name) { for (int i = 0; i &lt; catalog.size(); i++) { if (name.equalsIgnoreCase(catalog.get(i).getName())) { return true; } } return false; } </code></pre> <p>But it's not working. Can you guys help me to get this piece of code?</p>
0debug
static void do_video_stats(OutputStream *ost, int frame_size) { AVCodecContext *enc; int frame_number; double ti1, bitrate, avg_bitrate; if (!vstats_file) { vstats_file = fopen(vstats_filename, "w"); if (!vstats_file) { perror("fopen"); exit(1); } } enc = ost->st->codec; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->frame_number; fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality / (float)FF_QP2LAMBDA); if (enc->flags&CODEC_FLAG_PSNR) fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0] / (enc->width * enc->height * 255.0 * 255.0))); fprintf(vstats_file,"f_size= %6d ", frame_size); ti1 = ost->sync_opts * av_q2d(enc->time_base); if (ti1 < 0.01) ti1 = 0.01; bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)video_size / 1024, ti1, bitrate, avg_bitrate); fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); } }
1threat
React Navigation: How to update navigation title for parent, when value comes from redux and gets updated in child? : <p>I'm using <a href="https://github.com/react-community/react-navigation" rel="noreferrer">react-navigation</a> and have a StackNavigator with a <strong>ParentScreen</strong> and a <strong>ChildScreen</strong>.</p> <p>Both screens have the same navigation bar with a dynamic value from redux. Implemented like described in <a href="https://github.com/react-community/react-navigation/issues/313" rel="noreferrer">Issue #313</a></p> <p>This works as expected. When I'm in DetailScreen and I update the value for the count variable, it also updates the value in the navigation bar.</p> <p>Problem is, if I go back to the parent scene, there is still the old value in the navigation bar. It doesn't update to the current value in redux store.</p> <p><strong>Child</strong></p> <p><img src="https://cloud.githubusercontent.com/assets/1635916/24911196/724641de-1eca-11e7-8a34-448c4b398f4f.png" alt="screen shot 2017-04-11 at 15 20 28"></p> <p><strong>Parent</strong> (when I go back)</p> <p><img src="https://cloud.githubusercontent.com/assets/1635916/24911239/97c723d8-1eca-11e7-9737-07d2e5851d6f.png" alt="screen shot 2017-04-11 at 15 21 31"></p> <p><strong>ChildScreen</strong></p> <pre><code>class ChildScreen extends Component { static navigationOptions = { title: ({ state }) =&gt; `Total: ${state.params &amp;&amp; state.params.count ? state.params.count : ''}` }; componentWillReceiveProps(nextProps) { if (nextProps.count != this.props.count) { this.props.navigation.setParams({ count: nextProps.count }); } } render() { return ( &lt;View&gt; &lt;Button onPress={() =&gt; this.props.increment()} title="Increment" /&gt; &lt;/View&gt; ); } } </code></pre> <p><strong>ParentScreen</strong></p> <pre><code>class ParentScreen extends Component { static navigationOptions = { title: ({ state }) =&gt; `Total: ${state.params &amp;&amp; state.params.count ? state.params.count : ''}` }; } </code></pre> <p>Any advice?</p>
0debug
Remove elements before they are added to the DOM : <p>A series of <code>.cell</code> elements are created on <code>document</code> load. They are only useful if also an <strong><code>img</code></strong> is added within them. I need to keep them from being created because they are linked to the creation of other <code>li</code> elements.</p> <p>Thank you.</p> <p>Source Code:</p> <pre><code>&lt;div class="main-container"&gt; &lt;div class="parent-container"&gt; &lt;div class="cell"&gt; !always added &lt;div class="container"&gt; !always added &lt;div class="screen"&gt;&lt;/div&gt; !always added &lt;img&gt; **!If added** &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;li&gt;Created even if not needed&lt;/li&gt; &lt;/div&gt; </code></pre>
0debug
tsconfig.json for project with `src` and `tests` : <p>I've got a (desired) structure like this:</p> <pre><code>- tsconfig.json - src - app.ts - tests - appTest.ts - appTest.js - dist - app.js </code></pre> <p>If there was no <code>tests</code> folder, a tsconfig.json like this would work fine:</p> <pre><code>{ "compilerOptions": { "outDir":"dist" }, "include" :[ "src/**/*.ts" ] } </code></pre> <p>However, if I add <code>tests/**/*.ts</code> to the <code>include</code> element, it also compiles my test files into <code>dist</code> and changes its folder structure (understandably, but undesirably).</p> <p>Can I tell TypeScript compiler to include test files in the project to support things like refactoring but omit them from output to <code>dist</code>? Specifically, I'd like the <code>.js</code> to be compiled in the <code>tests</code> directory as suggested in the structure above.</p>
0debug
int main() { int rt, rs; int achi, acli; int dsp; int acho, aclo; int resulth, resultl; int resdsp; achi = 0x05; acli = 0xB4CB; rs = 0xFF06; rt = 0xCB00; resulth = 0x04; resultl = 0x947438CB; __asm ("mthi %2, $ac1\n\t" "mtlo %3, $ac1\n\t" "maq_s.w.phr $ac1, %4, %5\n\t" "mfhi %0, $ac1\n\t" "mflo %1, $ac1\n\t" : "=r"(acho), "=r"(aclo) : "r"(achi), "r"(acli), "r"(rs), "r"(rt) ); assert(resulth == acho); assert(resultl == aclo); achi = 0x06; acli = 0xB4CB; rs = 0x8000; rt = 0x8000; resulth = 0x6; resultl = 0x8000b4ca; resdsp = 1; __asm ("mthi %3, $ac1\n\t" "mtlo %4, $ac1\n\t" "maq_s.w.phr $ac1, %5, %6\n\t" "mfhi %0, $ac1\n\t" "mflo %1, $ac1\n\t" "rddsp %2\n\t" : "=r"(acho), "=r"(aclo), "=r"(dsp) : "r"(achi), "r"(acli), "r"(rs), "r"(rt) ); assert(resulth == acho); assert(resultl == aclo); assert(((dsp >> 17) & 0x01) == resdsp); return 0; }
1threat
Is it possible pause & resume for Retrofit multipart request? : <p>We are using Retrofit multi-part for file uploading process.</p> <p>We want pause/resume when file uploading. </p> <p>I want to know its possible or not?</p> <p><strong>Code for multi-part file upload</strong></p> <pre><code> RequestBody requestFile = RequestBody.create(MediaType.parse("multipart/form-data"), file); // MultipartBody.Part is used to send also the actual file name MultipartBody.Part body =MultipartBody.Part.createFormData("image", file.getName(), requestFile); Call&lt;ResponseBody&gt; call= api.uploadFile(body); </code></pre>
0debug
Javascript Date Library that uses online API? Rather than client machine? : I'm writing a node.js package that I want to distribute. I want a function to run at a certain time... but I don't want to use any of the popular JS libraries because they use the client's machine to determine date - rather I don't want this to be alterable. Basically the script should break after a certain date and should not be able to be reverse by changing your PC's time. Is this possible? P.S. I have no desire to create another server to serve this date. But that's the outcome I want to achieve.
0debug
Python3 - TypeError: module.__init__() takes at most 2 arguments (3 given) : <p>Please don't mark as duplicate, other similar questions did not solve my issue.</p> <p>This is my setup</p> <pre><code>/main.py /actions/ListitAction.py /actions/ViewAction.py </code></pre> <p>Main.py:</p> <pre><code>from actions import ListitAction, ViewAction </code></pre> <p>ListitAction.py:</p> <pre><code>class ListitAction(object): def __init__(self): #some init behavior def build_uri(): return "test.uri" </code></pre> <p>ViewAction.py</p> <pre><code>from actions import ListitAction class ViewAction(ListitAction): def __init__(self, view_id): ListitAction.__init__(self) self.view_id = view_id def build_uri(): return "test" </code></pre> <p>Running:</p> <pre><code>$ python3 main.py </code></pre> <p>The only error message I receive is: </p> <pre><code>Traceback (most recent call last): File "/home/jlevac/workspace/project/listit.py", line 11, in &lt;module&gt; from actions import ListitAction, ViewAction, CommentsAction File "/home/jlevac/workspace/project/actions/ViewAction.py", line 3, in &lt;module&gt; class ViewAction(ListitAction): TypeError: module.__init__() takes at most 2 arguments (3 given) </code></pre> <p>Even if I try for the python3 console, I received the same error message:</p> <pre><code>$python3 from actions import ViewAction </code></pre> <p>I am new to Python, but not new to programming. I'm assuming that my error messages have to do with the import statements, but based on the message I can't really figure out what it means.</p> <p>Thanks</p>
0debug
PageView: Disable the default scrolling and replace it with Tap event : <p>If I have a <code>PageView</code>, how can I disable the default scroll behavior (swiping) and make it such that the next item is scrolled into view by tapping on a button instead?</p>
0debug
static void output_client_manifest(struct VideoFiles *files, const char *basename, int split) { char filename[1000]; FILE *out; int i, j; if (split) snprintf(filename, sizeof(filename), "Manifest"); else snprintf(filename, sizeof(filename), "%s.ismc", basename); out = fopen(filename, "w"); if (!out) { perror(filename); return; } fprintf(out, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"); fprintf(out, "<SmoothStreamingMedia MajorVersion=\"2\" MinorVersion=\"0\" " "Duration=\"%"PRId64 "\">\n", files->duration * 10); if (files->video_file >= 0) { struct VideoFile *vf = files->files[files->video_file]; int index = 0; fprintf(out, "\t<StreamIndex Type=\"video\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(video={start time})\">\n", files->nb_video_files, vf->chunks); for (i = 0; i < files->nb_files; i++) { vf = files->files[i]; if (!vf->is_video) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" MaxWidth=\"%d\" MaxHeight=\"%d\" " "CodecPrivateData=\"", index, vf->bitrate, vf->fourcc, vf->width, vf->height); for (j = 0; j < vf->codec_private_size; j++) fprintf(out, "%02X", vf->codec_private[j]); fprintf(out, "\" />\n"); index++; } vf = files->files[files->video_file]; for (i = 0; i < vf->chunks; i++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, vf->offsets[i].duration); fprintf(out, "\t</StreamIndex>\n"); } if (files->audio_file >= 0) { struct VideoFile *vf = files->files[files->audio_file]; int index = 0; fprintf(out, "\t<StreamIndex Type=\"audio\" QualityLevels=\"%d\" " "Chunks=\"%d\" " "Url=\"QualityLevels({bitrate})/Fragments(audio={start time})\">\n", files->nb_audio_files, vf->chunks); for (i = 0; i < files->nb_files; i++) { vf = files->files[i]; if (!vf->is_audio) continue; fprintf(out, "\t\t<QualityLevel Index=\"%d\" Bitrate=\"%d\" " "FourCC=\"%s\" SamplingRate=\"%d\" Channels=\"%d\" " "BitsPerSample=\"16\" PacketSize=\"%d\" " "AudioTag=\"%d\" CodecPrivateData=\"", index, vf->bitrate, vf->fourcc, vf->sample_rate, vf->channels, vf->blocksize, vf->tag); for (j = 0; j < vf->codec_private_size; j++) fprintf(out, "%02X", vf->codec_private[j]); fprintf(out, "\" />\n"); index++; } vf = files->files[files->audio_file]; for (i = 0; i < vf->chunks; i++) fprintf(out, "\t\t<c n=\"%d\" d=\"%d\" />\n", i, vf->offsets[i].duration); fprintf(out, "\t</StreamIndex>\n"); } fprintf(out, "</SmoothStreamingMedia>\n"); fclose(out); }
1threat
A list in the column header with ASP NET and Linq : <p>I have this structure <a href="https://i.stack.imgur.com/3Uf14.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Uf14.png" alt="enter image description here"></a></p> <p>and i want to get the following result <a href="https://i.stack.imgur.com/RD2wJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RD2wJ.png" alt="enter image description here"></a></p> <p>this means that i need to put the list of job in the header with Linq / C# , can you guys help with it ? i hope that my question is clear :)</p>
0debug
Codepipeline: Insufficient permissions Unable to access the artifact with Amazon S3 object key : <p>Hello I created a codepipeline project with the following configuration:</p> <ul> <li>Source Code in S3 pulled from Bitbucket.</li> <li>Build with CodeBuild, generating an docker image and storing it into a Amazon ECS repository.</li> <li>Deployment provider Amazon ECS.</li> </ul> <p>All the process works ok until when it tries to deploy, for some reason I am getting the following error during deployment:</p> <blockquote> <p>Insufficient permissions Unable to access the artifact with Amazon S3 object key 'FailedScanSubscriber/MyAppBuild/Wmu5kFy' located in the Amazon S3 artifact bucket 'codepipeline-us-west-2-913731893217'. The provided role does not have sufficient permissions.</p> </blockquote> <p>During the building phase, it is even able to create a new docker image in the ECS repository. </p> <p>I tried everything, changed IAM roles and policies, add full access to S3, I have even setted the S3 bucket as public, nothing worked. I am without options, if someone could help me that would be wonderful, I have poor experience with AWS, so any help is appreciated. </p>
0debug
I want to achieve similar background in react native but do not know how to do it? : <p><a href="https://i.stack.imgur.com/U40DM.png" rel="nofollow noreferrer">Here is the backround what i wanted to achieve</a></p>
0debug
document.write('<script src="evil.js"></script>');
1threat
JavaScript - Split words into letters and save them to an array : <p>I have this code:</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;meta charset="UTF-8"&gt; &lt;title&gt;Bad Grammar Generator&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="text" id="userIn"&gt; &lt;input type="button" name="name" id="btn" value="Bad Grammar-ify" onclick="badgrammar()"&gt; &lt;span id="output"&gt;&lt;/span&gt; &lt;script type="text/javascript"&gt; var userIn = document.getElementById("userIn").value; function badgrammar() { var userIn = document.getElementById("userIn").value; var output = document.getElementById("output"); var split = new Array(); split = userIn.split(" "); output.innerText = split; } &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>It works, but it splits user input into one word. How can I make it split user input down to the letter?</p> <p>Example:</p> <p>Input: <code>Hi there</code> Output: <code>H,i,t,h,e,r,e</code></p>
0debug
static void t_gen_lsr(TCGv d, TCGv a, TCGv b) { TCGv t0, t_31; t0 = tcg_temp_new(TCG_TYPE_TL); t_31 = tcg_temp_new(TCG_TYPE_TL); tcg_gen_shr_tl(d, a, b); tcg_gen_movi_tl(t_31, 31); tcg_gen_sub_tl(t0, t_31, b); tcg_gen_sar_tl(t0, t0, t_31); tcg_gen_and_tl(t0, t0, d); tcg_gen_xor_tl(d, d, t0); tcg_temp_free(t0); tcg_temp_free(t_31); }
1threat
search regex for Notepad++ : I am looking to create a regex for searching Notepad++ I have a notepad page with thousands of random codes such as: 415615610230 151156125611 161651651516 511111115165 I need to search the entire notepad for multiple codes with once search I know the regex would look like (415615610230|151156125611|161651651516) but what I need to do is build a regex like above by pasting in all my search criteria. If I have say 100,000 numbers I might need to search the 100,000 numbers for 20 codes/numbers. lets just say I want to search for 5155584865 5155584866 5155584867 5155584868 5155584869 5155584870 5155584871 5155584872 5155584873 5155584874 5155584875 5155584876 5155584877 5155584878 5155584879 5155584880 5155584881 5155584882 5155584883 5155584884 The regex should look like: (5155584865|5155584866|5155584867|5155584868|5155584869|5155584870|5155584871|5155584872|5155584873|5155584874|5155584875|5155584876|5155584877|5155584878|5155584879|5155584880|5155584881|5155584882|5155584883|5155584884) Is there a way to build the regex above by just pasting in 5155584865 5155584866 5155584867 5155584868 5155584869 5155584870 5155584871 5155584872 5155584873 5155584874 5155584875 5155584876 5155584877 5155584878 5155584879 5155584880 5155584881 5155584882 5155584883 5155584884 Or can anyone recommend an easier way to search the entire notepad document?
0debug
random array without repeat failed : <p>how to generate unique array item using fisher yate shuffle method? I found below code but doesn't worked.</p> <pre><code>function shuffle(array) { var i = array.length, j = 0, temp; while (i--) { j = Math.floor(Math.random() * (i+1)); // swap randomly chosen element with current element temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; } var ranNums = shuffle([1,2,3,4,5,6,7,8,9,10]); console.log(ranNums) </code></pre>
0debug
why am I getting null results?Please give me a solution : User Table (users): id,email,password Post table (posts) : id,user_id,title,body //here i am using Post Model My User Model contains: public function posts(){ return $this->hasOne('App\Post'); }
0debug
void palette8torgb16(const uint8_t *src, uint8_t *dst, unsigned num_pixels, const uint8_t *palette) { unsigned i; for(i=0; i<num_pixels; i++) ((uint16_t *)dst)[i] = ((uint16_t *)palette)[ src[i] ]; }
1threat
static void main_loop(void) { int r; #ifdef CONFIG_IOTHREAD qemu_system_ready = 1; qemu_cond_broadcast(&qemu_system_cond); #endif for (;;) { do { #ifdef CONFIG_PROFILER int64_t ti; #endif #ifndef CONFIG_IOTHREAD tcg_cpu_exec(); #endif #ifdef CONFIG_PROFILER ti = profile_getclock(); #endif main_loop_wait(qemu_calculate_timeout()); #ifdef CONFIG_PROFILER dev_time += profile_getclock() - ti; #endif } while (vm_can_run()); if (qemu_debug_requested()) { monitor_protocol_event(QEVENT_DEBUG, NULL); vm_stop(EXCP_DEBUG); } if (qemu_shutdown_requested()) { monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { vm_stop(0); no_shutdown = 0; } else break; } if (qemu_reset_requested()) { monitor_protocol_event(QEVENT_RESET, NULL); pause_all_vcpus(); qemu_system_reset(); resume_all_vcpus(); } if (qemu_powerdown_requested()) { monitor_protocol_event(QEVENT_POWERDOWN, NULL); qemu_irq_raise(qemu_system_powerdown); } if ((r = qemu_vmstop_requested())) { vm_stop(r); } } pause_all_vcpus(); }
1threat
what is the best from/email validation method in php? : <p>I know there is a best method which called "PREG MATCH" in php programming language. I want to know is there any other method in php for validation? and which is the best? what method I practice as a pro php developer? Thank you all :)</p>
0debug
Can I group * things from this data? : <p>I got data with ASCII form. </p> <p>I ran it with R, and these data have * marked when it is under other condition.</p> <p><a href="https://i.stack.imgur.com/UW0wJ.png" rel="nofollow noreferrer">enter image description here</a></p> <p>V1, V2, V3, V4, V5 don't mean anything different. All that matters is to classify between *-ed things.</p> <p>I tried c(V1,V2,V3,V4,V5) but it returns only the levels.</p> <p>I have no idea. Help me with it.</p> <p>Question. Can I specify *-ed things via some code?</p> <p>Is there a way to make these columned things in one data?</p>
0debug
Overload method for unique_ptr and shared_ptr is ambiguous with polymorphism : <p>Coding stuff after taking the hint from my <a href="https://stackoverflow.com/questions/53444116/ownership-with-a-physical-representation">previous question</a>'s answer, I ran into an issue with overloading Scene::addObject.</p> <p>To reiterate the relevant bits and make this self contained, with the least details possible:</p> <ul> <li>I have a hierarchy of objects inheriting from <code>Interface</code> of which there are <code>Foo</code>s and <code>Bar</code>s;</li> <li>I have a <code>Scene</code> which owns these objects;</li> <li><code>Foo</code>s are to be <code>unique_ptr</code>s and <code>Bar</code>s are to be <code>shared_ptr</code>s in my main (for reasons explained in the previous question);</li> <li>the <code>main</code> passes them to the <code>Scene</code> instance, which takes ownership.</li> </ul> <p>Minimal code example is <a href="https://coliru.stacked-crooked.com/a/fbd879ab9d4beb69" rel="noreferrer">this</a>:</p> <pre><code>#include &lt;memory&gt; #include &lt;utility&gt; class Interface { public: virtual ~Interface() = 0; }; inline Interface::~Interface() {} class Foo : public Interface { }; class Bar : public Interface { }; class Scene { public: void addObject(std::unique_ptr&lt;Interface&gt; obj); // void addObject(std::shared_ptr&lt;Interface&gt; obj); }; void Scene::addObject(std::unique_ptr&lt;Interface&gt; obj) { } //void Scene::addObject(std::shared_ptr&lt;Interface&gt; obj) //{ //} int main(int argc, char** argv) { auto scn = std::make_unique&lt;Scene&gt;(); auto foo = std::make_unique&lt;Foo&gt;(); scn-&gt;addObject(std::move(foo)); // auto bar = std::make_shared&lt;Bar&gt;(); // scn-&gt;addObject(bar); } </code></pre> <p>Uncommenting the commented lines results in:</p> <pre><code>error: call of overloaded 'addObject(std::remove_reference&lt;std::unique_ptr&lt;Foo, std::default_delete&lt;Foo&gt; &gt;&amp;&gt;::type)' is ambiguous scn-&gt;addObject(std::move(foo)); ^ main.cpp:27:6: note: candidate: 'void Scene::addObject(std::unique_ptr&lt;Interface&gt;)' void Scene::addObject(std::unique_ptr&lt;Interface&gt; obj) ^~~~~ main.cpp:31:6: note: candidate: 'void Scene::addObject(std::shared_ptr&lt;Interface&gt;)' void Scene::addObject(std::shared_ptr&lt;Interface&gt; obj) ^~~~~ </code></pre> <p>Uncommenting the shared and commenting the unique stuff also compiles, so I take it the problem is, like the compiler says, in the overload. However I need the overload as both these types will need to be stored in some kind of collection, and they are indeed kept as pointers to base (possibly all moved into <code>shared_ptr</code>s).</p> <p>I'm passing both by-value because I want to make clear I'm taking ownership in <code>Scene</code> (and upping the reference counter for the <code>shared_ptr</code>s). Not really clear to me where the issue lies at all, and I couldn't find any example of this elsewhere.</p>
0debug
Why does SyntaxNode.ReplaceNode change the SyntaxTree options? : <p>I'm trying to replace nodes within a syntax tree in Roslyn, and it's just about working, but with an annoyance which feels it <em>shouldn't</em> be a problem.</p> <p>The syntax tree is generated from a script, and I want the result to be a script-based syntax tree too - but for some reason, replacing a node in the tree creates a new syntax tree with changed options: the <code>Kind</code> becomes <code>Regular</code> instead of <code>Script</code>. That's fixable with <code>SyntaxTree.WithRootAndOptions</code> but it feels like I'm doing something wrong if I need to call that.</p> <p>Sample program:</p> <pre><code>using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Scripting; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Scripting; using System; using System.Linq; class Program { static void Main(string[] args) { Script script = CSharpScript.Create("Console.WriteLine(\"Before\")", ScriptOptions.Default.AddImports("System")); var compilation = script.GetCompilation(); var tree = compilation.SyntaxTrees.Single(); var after = SyntaxFactory.LiteralExpression( SyntaxKind.StringLiteralExpression, SyntaxFactory.Literal("After")); var root = tree.GetRoot(); var before = root.DescendantNodes().OfType&lt;LiteralExpressionSyntax&gt;().Single(); var newRoot = root.ReplaceNode(before, after); var fixedTree = newRoot.SyntaxTree.WithRootAndOptions(newRoot, tree.Options); Console.WriteLine(newRoot); // Console.WriteLine("After") Console.WriteLine(tree.Options.Kind); // Script Console.WriteLine(newRoot.SyntaxTree.Options.Kind); // Regular Console.WriteLine(fixedTree.Options.Kind); // Script } } </code></pre> <p>(Output is in comments.)</p> <p>Is this workaround actually correct, or is there some different way I should be replacing the node in the tree?</p>
0debug
def pair_OR_Sum(arr,n) : ans = 0 for i in range(0,n) : for j in range(i + 1,n) : ans = ans + (arr[i] ^ arr[j]) return ans
0debug
static void visit_nested_struct_list(Visitor *v, void **native, Error **errp) { visit_type_UserDefNestedList(v, (UserDefNestedList **)native, NULL, errp); }
1threat
Adjacency matrix of graph in c++ ( getting error while using malloc ) : #include <iostream> #include <cstdlib> using namespace std; class graph{ int v,e,**adj; public: graph(); }; graph::graph(){ graph *g = (graph*)malloc(sizeof(graph)); if(g){ cout << " error"; exit(1); } int u,V,i; cout << "Enter no of nodes and edges ? "; cin >> g->v ; cin >> g->e ; g->adj = (int**)malloc(sizeof(int) * sizeof(g->v * g->v )); for(u = 0 ; u <= g->v ; u++) for(V = 0 ; V <= g->v ; V++ ) g->adj[u][V] = 0; cout << " Enter connections ? "; for(i = 0 ; i <= g->e ; i++){ cin >> u ; cin >> V ; g->adj[u][V] = 1; g->adj[V][u] = 1; } cout << g; } int main(){ graph a; return 0; } I am trying to figure out whats the problem but unable to resolve by myself . please help ! i've researched for about 2 hours over this topic unfortunately did't found any proper help desk. i am learning data structure and implementing in c++ language. if you could able to advice me that'd be earnestly kind of you . thanks !
0debug
void ide_bus_reset(IDEBus *bus) { bus->unit = 0; bus->cmd = 0; ide_reset(&bus->ifs[0]); ide_reset(&bus->ifs[1]); ide_clear_hob(bus); if (bus->dma->aiocb) { #ifdef DEBUG_AIO printf("aio_cancel\n"); #endif bdrv_aio_cancel(bus->dma->aiocb); bus->dma->aiocb = NULL; } if (bus->dma->ops->reset) { bus->dma->ops->reset(bus->dma); } }
1threat
static int decode_0(AVCodecContext *avctx, uint8_t code, uint8_t *pkt) { PAFVideoDecContext *c = avctx->priv_data; uint32_t opcode_size, offset; uint8_t *dst, *dend, mask = 0, color = 0, a, b, p; const uint8_t *src, *send, *opcodes; int i, j, x = 0; i = bytestream2_get_byte(&c->gb); if (i) { if (code & 0x10) { int align; align = bytestream2_tell(&c->gb) & 3; if (align) bytestream2_skip(&c->gb, 4 - align); } do { a = bytestream2_get_byte(&c->gb); b = bytestream2_get_byte(&c->gb); p = (a & 0xC0) >> 6; dst = c->frame[p] + get_video_page_offset(avctx, a, b); dend = c->frame[p] + c->frame_size; offset = (b & 0x7F) * 2; j = bytestream2_get_le16(&c->gb) + offset; do { offset++; if (dst + 3 * avctx->width + 4 > dend) return AVERROR_INVALIDDATA; copy4h(avctx, dst); if ((offset & 0x3F) == 0) dst += avctx->width * 3; dst += 4; } while (offset < j); } while (--i); } dst = c->frame[c->current_frame]; do { a = bytestream2_get_byte(&c->gb); b = bytestream2_get_byte(&c->gb); p = (a & 0xC0) >> 6; src = c->frame[p] + get_video_page_offset(avctx, a, b); send = c->frame[p] + c->frame_size; if (src + 3 * avctx->width + 4 > send) return AVERROR_INVALIDDATA; copy_block4(dst, src, avctx->width, avctx->width, 4); i++; if ((i & 0x3F) == 0) dst += avctx->width * 3; dst += 4; } while (i < c->video_size / 16); opcode_size = bytestream2_get_le16(&c->gb); bytestream2_skip(&c->gb, 2); if (bytestream2_get_bytes_left(&c->gb) < opcode_size) return AVERROR_INVALIDDATA; opcodes = pkt + bytestream2_tell(&c->gb); bytestream2_skipu(&c->gb, opcode_size); dst = c->frame[c->current_frame]; for (i = 0; i < avctx->height; i += 4, dst += avctx->width * 3) { for (j = 0; j < avctx->width; j += 4, dst += 4) { int opcode, k = 0; if (x > opcode_size) return AVERROR_INVALIDDATA; if (j & 4) { opcode = opcodes[x] & 15; x++; } else { opcode = opcodes[x] >> 4; } while (block_sequences[opcode][k]) { offset = avctx->width * 2; code = block_sequences[opcode][k++]; switch (code) { case 2: offset = 0; case 3: color = bytestream2_get_byte(&c->gb); case 4: mask = bytestream2_get_byte(&c->gb); copy_color_mask(avctx, mask, dst + offset, color); break; case 5: offset = 0; case 6: a = bytestream2_get_byte(&c->gb); b = bytestream2_get_byte(&c->gb); p = (a & 0xC0) >> 6; src = c->frame[p] + get_video_page_offset(avctx, a, b); send = c->frame[p] + c->frame_size; case 7: if (src + offset + avctx->width + 4 > send) return AVERROR_INVALIDDATA; mask = bytestream2_get_byte(&c->gb); copy_src_mask(avctx, mask, dst + offset, src + offset); break; } } } } return 0; }
1threat
whats wrong in this ? im getting a[0-9]=0000?Any help will be appreciated : public class HexaDecimal { public String binary(String s) { String[] a= {"0000","0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"}; String k=""; for(int i=0;i<=s.length()-1;i++) { if(s.charAt(i)=='a'){k+=a[10];} else if(s.charAt(i)=='b'){ k+=a[11];} else if(s.charAt(i)=='c'){k+=a[12];} else if(s.charAt(i)=='d') {k+=a[13];} else if(s.charAt(i)=='e') {k+=a[14];} else if(s.charAt(i)=='f'){k+=a[15];} else{k+=a[i];} } return k; } }
0debug
how to display the link content as hyperlink link text name using html code. : how to display the link content as hyperlink link text name using html code. example <a href="file:///C:\Users\jy\Documents\data.xlsx">textname</a> i want the text name to show the value or data follow cell C9 value in the data.xlsx file thanks
0debug
static void parse_option_number(const char *name, const char *value, uint64_t *ret, Error **errp) { char *postfix; uint64_t number; number = strtoull(value, &postfix, 0); if (*postfix != '\0') { error_setg(errp, QERR_INVALID_PARAMETER_VALUE, name, "a number"); return; } *ret = number; }
1threat
static void monitor_find_completion(Monitor *mon, const char *cmdline) { char *args[MAX_ARGS]; int nb_args, len; if (parse_cmdline(cmdline, &nb_args, args) < 0) { return; } #ifdef DEBUG_COMPLETION for (i = 0; i < nb_args; i++) { monitor_printf(mon, "arg%d = '%s'\n", i, args[i]); } #endif len = strlen(cmdline); if (len > 0 && qemu_isspace(cmdline[len - 1])) { if (nb_args >= MAX_ARGS) { goto cleanup; } args[nb_args++] = g_strdup(""); } monitor_find_completion_by_table(mon, mon->cmd_table, args, nb_args); cleanup: free_cmdline_args(args, nb_args); }
1threat
static uint32_t qpi_mem_readw(void *opaque, target_phys_addr_t addr) { return 0; }
1threat
Curl error tlsv1 alert protocol version : <p>The following curl request returns an error. Can someone explain what is going wrong and how to correct it. I already tried to force curl to use different ssl versions (--sslv3 and --sslv2) but this did not work.</p> <pre><code>curl.exe --GET "https://www.expert.nl/" --verbose --insecure </code></pre> <p>Response:</p> <pre><code>* About to connect() to www.expert.nl port 443 (#0) * Trying 104.20.175.44... connected * SSLv3, TLS handshake, Client hello (1): * error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version * Closing connection #0 curl: (35) error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version </code></pre>
0debug
static int upload_texture(SDL_Texture *tex, AVFrame *frame, struct SwsContext **img_convert_ctx) { int ret = 0; switch (frame->format) { case AV_PIX_FMT_YUV420P: if (frame->linesize[0] < 0 || frame->linesize[1] < 0 || frame->linesize[2] < 0) { av_log(NULL, AV_LOG_ERROR, "Negative linesize is not supported for YUV.\n"); return -1; } ret = SDL_UpdateYUVTexture(tex, NULL, frame->data[0], frame->linesize[0], frame->data[1], frame->linesize[1], frame->data[2], frame->linesize[2]); break; case AV_PIX_FMT_BGRA: if (frame->linesize[0] < 0) { ret = SDL_UpdateTexture(tex, NULL, frame->data[0] + frame->linesize[0] * (frame->height - 1), -frame->linesize[0]); } else { ret = SDL_UpdateTexture(tex, NULL, frame->data[0], frame->linesize[0]); } break; default: *img_convert_ctx = sws_getCachedContext(*img_convert_ctx, frame->width, frame->height, frame->format, frame->width, frame->height, AV_PIX_FMT_BGRA, sws_flags, NULL, NULL, NULL); if (*img_convert_ctx != NULL) { uint8_t *pixels[4]; int pitch[4]; if (!SDL_LockTexture(tex, NULL, (void **)pixels, pitch)) { sws_scale(*img_convert_ctx, (const uint8_t * const *)frame->data, frame->linesize, 0, frame->height, pixels, pitch); SDL_UnlockTexture(tex); } } else { av_log(NULL, AV_LOG_FATAL, "Cannot initialize the conversion context\n"); ret = -1; } break; } return ret; }
1threat
static av_cold int prores_encode_init(AVCodecContext *avctx) { int i; ProresContext* ctx = avctx->priv_data; if (avctx->pix_fmt != PIX_FMT_YUV422P10LE) { av_log(avctx, AV_LOG_ERROR, "need YUV422P10\n"); return -1; } if (avctx->width & 0x1) { av_log(avctx, AV_LOG_ERROR, "frame width needs to be multiple of 2\n"); return -1; } if ((avctx->height & 0xf) || (avctx->width & 0xf)) { ctx->fill_y = av_malloc(DEFAULT_SLICE_MB_WIDTH << 9); ctx->fill_u = av_malloc(DEFAULT_SLICE_MB_WIDTH << 8); ctx->fill_v = av_malloc(DEFAULT_SLICE_MB_WIDTH << 8); } if (avctx->profile == FF_PROFILE_UNKNOWN) { avctx->profile = FF_PROFILE_PRORES_STANDARD; av_log(avctx, AV_LOG_INFO, "encoding with ProRes standard (apcn) profile\n"); } else if (avctx->profile < FF_PROFILE_PRORES_PROXY || avctx->profile > FF_PROFILE_PRORES_HQ) { av_log( avctx, AV_LOG_ERROR, "unknown profile %d, use [0 - apco, 1 - apcs, 2 - apcn (default), 3 - apch]\n", avctx->profile); return -1; } avctx->codec_tag = AV_RL32((const uint8_t*)profiles[avctx->profile].name); for (i = 1; i <= 16; i++) { scale_mat(QMAT_LUMA[avctx->profile] , ctx->qmat_luma[i - 1] , i); scale_mat(QMAT_CHROMA[avctx->profile], ctx->qmat_chroma[i - 1], i); } avctx->coded_frame = avcodec_alloc_frame(); avctx->coded_frame->key_frame = 1; avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; return 0; }
1threat
How to put a song in android? : <p>I have a game and I want to put a background song. I read that you have to put an mp3 in the raw folder, but I don't know where is it. Thanks.</p>
0debug
SwiftUI: NavigationLink not working if not in a List : <p>I guess it might be a bug in beta 3 as the NavigationView is all broken. But a view like that:</p> <pre><code>struct GenreBadge : View { @EnvironmentObject var store: Store&lt;AppState&gt; let genre: Genre var body: some View { NavigationLink(destination: MoviesGenreList(genre: genre).environmentObject(store)) { RoundedBadge(text: genre.name) } } } </code></pre> <p>is not triggering any push in the navigation stack. The view doens't seems interactive at all. If anyone found a workaround would be good, unless Apple is documenting this behaviour I would consider it broken until beta 4. </p>
0debug
static void x86_cpu_parse_featurestr(CPUState *cs, char *features, Error **errp) { X86CPU *cpu = X86_CPU(cs); char *featurestr; FeatureWord w; FeatureWordArray plus_features = { 0 }; FeatureWordArray minus_features = { 0 }; CPUX86State *env = &cpu->env; Error *local_err = NULL; featurestr = features ? strtok(features, ",") : NULL; while (featurestr) { char *val; if (featurestr[0] == '+') { add_flagname_to_bitmaps(featurestr + 1, plus_features, &local_err); } else if (featurestr[0] == '-') { add_flagname_to_bitmaps(featurestr + 1, minus_features, &local_err); } else if ((val = strchr(featurestr, '='))) { *val = 0; val++; feat2prop(featurestr); if (!strcmp(featurestr, "tsc-freq")) { int64_t tsc_freq; char *err; char num[32]; tsc_freq = qemu_strtosz_suffix_unit(val, &err, QEMU_STRTOSZ_DEFSUFFIX_B, 1000); if (tsc_freq < 0 || *err) { error_setg(errp, "bad numerical value %s", val); return; } snprintf(num, sizeof(num), "%" PRId64, tsc_freq); object_property_parse(OBJECT(cpu), num, "tsc-frequency", &local_err); } else { object_property_parse(OBJECT(cpu), val, featurestr, &local_err); } } else { feat2prop(featurestr); object_property_parse(OBJECT(cpu), "on", featurestr, &local_err); } if (local_err) { error_propagate(errp, local_err); return; } featurestr = strtok(NULL, ","); } if (cpu->host_features) { for (w = 0; w < FEATURE_WORDS; w++) { env->features[w] = x86_cpu_get_supported_feature_word(w, cpu->migratable); } } for (w = 0; w < FEATURE_WORDS; w++) { env->features[w] |= plus_features[w]; env->features[w] &= ~minus_features[w]; } }
1threat
SCSS formatter for angular 5 : <p>In our angular 5.2 project, we keep getting the below errors in scss files,</p> <p><a href="https://i.stack.imgur.com/B9cED.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/B9cED.png" alt="SCSS erros related to spaces"></a></p> <p>do we have a VS code plugin OR a Scss formatter which can take care these space issues in the scss??</p>
0debug