problem
stringlengths
26
131k
labels
class label
2 classes
Test for a cell not being fumulaically populated vs one with data sourced from a dfiferent cell : I have a spreadsheet that auto-populates column B to equal the cells in column A. Column C will be the cell in column A, one row down, but if the cell in column A of the same row and column A of the next row are the same, it wil be column A of two rows down. Using this formula: =IF(A5=A6,A7,A6). Right now, it prints data in one of the cells when they only contain the formula. I dont understand why.The right column below, which has 2 indigo, is an example of the problem, with 'empty' where the cells are not populated, they have a blank pick list. red red orange orange orange yellow yellow yellow green green green blue blue blue 0 empty 0 indigo empty 0 indigo indigo indigo violet ---------------------------- I don't mind the 0 being displayed, but the 3rd column up, right cell, is printing indigo, when it shouldn't be. The columns above that work fine. NOTE: The cell in column C, violet, has a slightly different formula, if the first cell matches the cell below, it sets it to the first data cell in column c, otherwise to the next cell in column A =if(a8=a9,a2,a9) What I need to see to reduce the risk of human error, is have either a zero, or nothing displayed in the cell which is showing the first indigo in column c.
0debug
How to save java script data from a loop to an array? : <p>How to save javascript data from a loop to an array?</p> <pre><code>for (i = 0; i &lt; jsonData.Data.Positions.length; i++) { var h = jsonData.Data.Positions[i].Oid; } </code></pre>
0debug
How to build Oauth2.0 using Appcelerator Titanium in Andriod : How to build Oauth2.0 using Appcelerator Titanium in Andriod any one please help me.Thanks for advance
0debug
i'm italian, sorry for my english : while working on my servlet I had this problem:[enter image description here][1] org.hibernate.HibernateException: /hibernate.cfg.xml not found org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:173) org.hibernate.cfg.Configuration.getConfigurationInputStream(Configuration.java:2093) org.hibernate.cfg.Configuration.configure(Configuration.java:2074) org.hibernate.cfg.Configuration.configure(Configuration.java:2054) com.dede.app1st.controller.AddUser.doPost(AddUser.java:26) javax.servlet.http.HttpServlet.service(HttpServlet.java:650) javax.servlet.http.HttpServlet.service(HttpServlet.java:731) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [1]: https://i.stack.imgur.com/92pwe.jpg
0debug
File download progress in the browser: Angular 4 : <p>I'm creating an application that consumes a REST api for downloading a file. The api returns the file right when you hit it. So I'm using the following logic to get the file:</p> <pre><code>downloadFile(file) { this.service.downloadFile(file.id).subscribe((fileData) =&gt; { const a = document.createElement('a'); document.body.appendChild(a); const blob = new Blob([data], { type: data.type }); const url = window.URL.createObjectURL(blob); a.href = url; a.download = file.name; a.click(); window.URL.revokeObjectURL(url); }); </code></pre> <p>}</p> <p>The above code works perfectly. BUT, it downloads the file in the browser when the whole file is downloaded, i.e., you wont see the progress of file download in the browser (how we usually see when we download a file usually in Chrome). You can see its downloading the file in the 'network' tab of the console, but only shows up when the whole file is downloaded. Can anybody give any idea how can I force it to download in the browser so that it shows the progress?</p>
0debug
(Newbie) invoking child nodes entity framework core : I`m new into this sort of Object programming, do you mind helping me? I have to invoke the child nodes, but specific fields, but I can`t figure out how, I`ve already looked into a huge amount of places, but it doesn`t seem to work. For exmaple, I want just the FirstName in the RepunicAccount, and all the other info from REpunicAccountType, or anything like it. My DbContext using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; using Models.Account; namespace Models.dbContext { public class RepunicContext : DbContext { public virtual DbSet<RepunicAccount> RepunicAccount { get; set; } public virtual DbSet<RepunicAccountType> RepunicAccountType { get; set; } protected override void OnConfiguring (DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer ("Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Repunic;Data Source=DESKTOP- 6I8LD45\\SQLEXPRESS_ERICH"); } public RepunicContext (DbContextOptions<RepunicContext> options) :base (options) { } public RepunicContext () { } } } My Model using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace Models.Account { public class RepunicAccount { public int ID { get; set; } public string Email { get; set; } public string Username { get; set; } public string Password { get; set; } public string FirstName { get; set; } public string LastName { get; set; } [ForeignKey ("ID_Type")] public int? ID_Type { get; set; } public ICollection<RepunicAccountType> TipoConta { get; set; } public DateTime? DataCadastro { get; set; } = DateTime.Now; public DateTime? DataAlteracao { get; set; } = DateTime.Now; } } My Child Node public class RepunicAccountType { [Key] public int ID_Type { get; set; } public string Descricao { get; set; } public DateTime DataCadastro { get; set; } = DateTime.Now; public DateTime DataAlteracao { get; set; } = DateTime.Now; } I Have a repository, that is where I do my coding, before putting into the controller, it`s pretty much the same in every place, but I`m going to send the example that I`m trying to use in both places. public IEnumerable<RepunicAccount> GetAllByIDType () { var data = db.RepunicAccount.Where (a => a.ID_Type != null).Include (p => p.types); var type = db.RepunicAccountType.OrderBy (b => b.Descricao); return data.ToList (); } The problem is, I don`t know how to invoke specific itens nor make anything else than ToList(); So, What should I do? If there is any more info that I can send, just ask me.
0debug
static void oledate_to_iso8601(char *buf, int buf_size, int64_t value) { time_t t = 631112400LL + 86400*av_int2dbl(value); strftime(buf, buf_size, "%Y-%m-%d %H:%M:%S", gmtime(&t)); }
1threat
I want to find all words using java regx, that starts with "#" and ends with space or "." : This is a sample string "hi #myname, you got #amount", I want to find all words using java regx, that starts with "#" and ends with space or "." example "#myname","#amount" I use Java.
0debug
The "GetDeploymentPathFromVsixManifest" task failed unexpectedly : <p>After installation of <code>visual studio 2017</code> getting his error for <code>VSIX projects</code> ... any suggestion to resolve the issue?<a href="https://i.stack.imgur.com/Fj5yg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Fj5yg.png" alt="enter image description here"></a></p> <pre><code>Severity Code Description Project File Line Suppression State Error The "GetDeploymentPathFromVsixManifest" task failed unexpectedly. System.Runtime.InteropServices.COMException (0x80070005): ExternalSettingsManager::GetScopePaths failed to initialize PkgDefManager for C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe at Microsoft.VisualStudio.Settings.ExternalSettingsManager.GetScopePaths(String applicationPath, String suffixOrName, String vsVersion, Boolean isLogged, Boolean isForIsolatedApplication) at Microsoft.VisualStudio.Settings.ExternalSettingsManager.CreateForApplication(String applicationPath) at Microsoft.VsSDK.Build.Tasks.ExtensionManagerUtilities.GetSettingsManagerForDevenv(String rootSuffix) at Microsoft.VsSDK.Build.Tasks.GetDeploymentPathFromVsixManifest.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.&lt;ExecuteInstantiatedTask&gt;d__26.MoveNext() MasterData </code></pre>
0debug
static int pl181_init(SysBusDevice *sbd) { DeviceState *dev = DEVICE(sbd); PL181State *s = PL181(dev); DriveInfo *dinfo; memory_region_init_io(&s->iomem, OBJECT(s), &pl181_ops, s, "pl181", 0x1000); sysbus_init_mmio(sbd, &s->iomem); sysbus_init_irq(sbd, &s->irq[0]); sysbus_init_irq(sbd, &s->irq[1]); qdev_init_gpio_out(dev, s->cardstatus, 2); dinfo = drive_get_next(IF_SD); s->card = sd_init(dinfo ? blk_bs(blk_by_legacy_dinfo(dinfo)) : NULL, false); if (s->card == NULL) { return -1; } return 0; }
1threat
How to run a jquery function in Angular 2 after every component finish loading : <p>I have tried all the life cycle hooks but can't get to accomplish the needed result. The result that I need is triggering a function that initialize many jquery plugins used for different elements on a single page after every single one of these elements (components) is loaded.</p> <p>So lets say that you have this structure.</p> <p>Home Page Slider Widgets Product rotators ..etc</p> <p>Every one of these elements has it's own component and all are children of the Home page parent component.</p> <p>And what I need here is to know when all the children components and the parent component is loaded so I trigger one jquery function to initialize every plugin on the page. </p>
0debug
I have some error in my code while running it ! plz Fix my error : [NEED HELP]( https://1drv.ms/w/s!An7kEWyTDHfzsRui8rYvBT8Dap2H?e=LWaxWt "I am doing my Assessment Task plz help me to complete my Assessment project link"): <br>**NEED HELP TO FIX MY ERROR to complete my Assessment project <br/> - why my code isn't running any error fix it - i have give a link of my project help me to complete it import java.util.Scanner; class MAPCalculator{ double map; double sbp; double dbp; public MAPCalculator(){ //no code needed } public double value(double sbp, double dbp){ this.sbp=sbp; this.dbp=dbp; return map; } public String category(double map){ //What to do in this function how to sent string String High="High"; String Low="Low"; String Normal="Normal"; return High; } } class Assignment2{ public static void main(String[] args){ double sbp[]= new double[5]; double dbp[]= new double[5]; double map; Scanner sc = new Scanner(System.in); for(int i=0;i<5;i++){ for(int j=0;j<5;j++){ System.out.print("Enter the Value of SBP(systolic blood pressure) "+(i+1)+"::->> "); sbp[i]=sc.nextInt(); System.out.print("Enter the Value of DBP(diastolic blood pressure) "+(i+1)+"::->> "); dbp[j]=sc.nextInt(); map = (sbp[i]+2*dbp[j])/3; } } MAPCalculator obj = new MAPCalculator(); obj.doublevalue(map); System.out.println("The MAP(mean arterial pressure) is::->>"+map+ "mm HG"); } }
0debug
How to go to the other round of two loop at the same time? : How to go to the other round of two loop at the same time? code : parameters = {'CT', 'Imp', 'F1', 'F2'}; Time = {'T0', 'T1', 'T2', 'T3', 'T4', 'T5', 'T6'}; for i_parameters = 1: numel(parameters) my_parameters = parameters{i_parameters}; for i_Time = 1 : numel (Time) my_time = Time{i_Time}; for j = 1 : 7 Difference.(my_parameters).(my_time) = [Diff.(my_parameters)(:,j); Diff.(my_parameters)(:,j+7); Diff.(my_parameters)(:,j+14); Diff.(my_parameters)(:,j+21); Diff.(my_parameters)(:,j+28)]; DiffMean.(my_parameters).(my_time) = mean(Difference.(my_parameters).(my_time)); Diffstd.(my_parameters).(my_time) = std(Difference.(my_parameters).(my_time)); end end end I would like to leave the loops `i` and` i_Time` at each turn and at the same time that I would like to apply: `i_Time = T0 then j = 1 / i_Time = T1 then j = 2 / i_Time = T2 then j = 3 / i_Time = T3 then j = 4 / i_Time = T4 then j = 5 / i_Time = T5 then j = 6 / i_Time = T6 then j = 7`
0debug
inline static void RENAME(hcscale)(SwsContext *c, uint16_t *dst, long dstWidth, uint8_t *src1, uint8_t *src2, int srcW, int xInc, int flags, int canMMX2BeUsed, int16_t *hChrFilter, int16_t *hChrFilterPos, int hChrFilterSize, void *funnyUVCode, int srcFormat, uint8_t *formatConvBuffer, int16_t *mmx2Filter, int32_t *mmx2FilterPos, uint8_t *pal) { if (srcFormat==PIX_FMT_YUYV422) { RENAME(yuy2ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_UYVY422) { RENAME(uyvyToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32) { if(c->chrSrcHSubSample) RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB32_1) { if(c->chrSrcHSubSample) RENAME(bgr32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else RENAME(bgr32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR24) { if(c->chrSrcHSubSample) RENAME(bgr24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR565) { if(c->chrSrcHSubSample) RENAME(bgr16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR555) { if(c->chrSrcHSubSample) RENAME(bgr15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(bgr15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32) { if(c->chrSrcHSubSample) RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_BGR32_1) { if(c->chrSrcHSubSample) RENAME(rgb32ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); else RENAME(rgb32ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1+ALT32_CORR, src2+ALT32_CORR, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB24) { if(c->chrSrcHSubSample) RENAME(rgb24ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb24ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB565) { if(c->chrSrcHSubSample) RENAME(rgb16ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb16ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (srcFormat==PIX_FMT_RGB555) { if(c->chrSrcHSubSample) RENAME(rgb15ToUV_half)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); else RENAME(rgb15ToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } else if (isGray(srcFormat) || srcFormat==PIX_FMT_MONOBLACK || PIX_FMT_MONOWHITE) { return; } else if (srcFormat==PIX_FMT_RGB8 || srcFormat==PIX_FMT_BGR8 || srcFormat==PIX_FMT_PAL8 || srcFormat==PIX_FMT_BGR4_BYTE || srcFormat==PIX_FMT_RGB4_BYTE) { RENAME(palToUV)(formatConvBuffer, formatConvBuffer+VOFW, src1, src2, srcW, (uint32_t*)pal); src1= formatConvBuffer; src2= formatConvBuffer+VOFW; } #ifdef HAVE_MMX if (!(flags&SWS_FAST_BILINEAR) || (!canMMX2BeUsed)) #else if (!(flags&SWS_FAST_BILINEAR)) #endif { RENAME(hScale)(dst , dstWidth, src1, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); RENAME(hScale)(dst+VOFW, dstWidth, src2, srcW, xInc, hChrFilter, hChrFilterPos, hChrFilterSize); } else { #if defined(ARCH_X86) #ifdef HAVE_MMX2 int i; #if defined(PIC) uint64_t ebxsave __attribute__((aligned(8))); #endif if (canMMX2BeUsed) { asm volatile( #if defined(PIC) "mov %%"REG_b", %6 \n\t" #endif "pxor %%mm7, %%mm7 \n\t" "mov %0, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "mov %2, %%"REG_d" \n\t" "mov %3, %%"REG_b" \n\t" "xor %%"REG_a", %%"REG_a" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" #ifdef ARCH_X86_64 #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "movl (%%"REG_b", %%"REG_a"), %%esi \n\t"\ "add %%"REG_S", %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #else #define FUNNY_UV_CODE \ "movl (%%"REG_b"), %%esi \n\t"\ "call *%4 \n\t"\ "addl (%%"REG_b", %%"REG_a"), %%"REG_c" \n\t"\ "add %%"REG_a", %%"REG_D" \n\t"\ "xor %%"REG_a", %%"REG_a" \n\t"\ #endif FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE "xor %%"REG_a", %%"REG_a" \n\t" "mov %5, %%"REG_c" \n\t" "mov %1, %%"REG_D" \n\t" "add $"AV_STRINGIFY(VOF)", %%"REG_D" \n\t" PREFETCH" (%%"REG_c") \n\t" PREFETCH" 32(%%"REG_c") \n\t" PREFETCH" 64(%%"REG_c") \n\t" FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE FUNNY_UV_CODE #if defined(PIC) "mov %6, %%"REG_b" \n\t" #endif :: "m" (src1), "m" (dst), "m" (mmx2Filter), "m" (mmx2FilterPos), "m" (funnyUVCode), "m" (src2) #if defined(PIC) ,"m" (ebxsave) #endif : "%"REG_a, "%"REG_c, "%"REG_d, "%"REG_S, "%"REG_D #if !defined(PIC) ,"%"REG_b #endif ); for (i=dstWidth-1; (i*xInc)>>16 >=srcW-1; i--) { dst[i] = src1[srcW-1]*128; dst[i+VOFW] = src2[srcW-1]*128; } } else { #endif long xInc_shr16 = (long) (xInc >> 16); uint16_t xInc_mask = xInc & 0xffff; asm volatile( "xor %%"REG_a", %%"REG_a" \n\t" "xor %%"REG_d", %%"REG_d" \n\t" "xorl %%ecx, %%ecx \n\t" ASMALIGN(4) "1: \n\t" "mov %0, %%"REG_S" \n\t" "movzbl (%%"REG_S", %%"REG_d"), %%edi \n\t" "movzbl 1(%%"REG_S", %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, (%%"REG_D", %%"REG_a", 2) \n\t" "movzbl (%5, %%"REG_d"), %%edi \n\t" "movzbl 1(%5, %%"REG_d"), %%esi \n\t" "subl %%edi, %%esi \n\t" - src[xx] "imull %%ecx, %%esi \n\t" "shll $16, %%edi \n\t" "addl %%edi, %%esi \n\t" *2*xalpha + src[xx]*(1-2*xalpha) "mov %1, %%"REG_D" \n\t" "shrl $9, %%esi \n\t" "movw %%si, "AV_STRINGIFY(VOF)"(%%"REG_D", %%"REG_a", 2) \n\t" "addw %4, %%cx \n\t" "adc %3, %%"REG_d" \n\t" "add $1, %%"REG_a" \n\t" "cmp %2, %%"REG_a" \n\t" " jb 1b \n\t" #if defined(ARCH_X86_64) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) :: "m" (src1), "m" (dst), "g" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #else :: "m" (src1), "m" (dst), "m" ((long)dstWidth), "m" (xInc_shr16), "m" (xInc_mask), #endif "r" (src2) : "%"REG_a, "%"REG_d, "%ecx", "%"REG_D, "%esi" ); #ifdef HAVE_MMX2 } #endif #else int i; unsigned int xpos=0; for (i=0;i<dstWidth;i++) { register unsigned int xx=xpos>>16; register unsigned int xalpha=(xpos&0xFFFF)>>9; dst[i]=(src1[xx]*(xalpha^127)+src1[xx+1]*xalpha); dst[i+VOFW]=(src2[xx]*(xalpha^127)+src2[xx+1]*xalpha); xpos+=xInc; } #endif } if(c->srcRange != c->dstRange && !(isRGB(c->dstFormat) || isBGR(c->dstFormat))){ int i; if(c->srcRange){ for (i=0; i<dstWidth; i++){ dst[i ]= (dst[i ]*1799 + 4081085)>>11; dst[i+VOFW]= (dst[i+VOFW]*1799 + 4081085)>>11; } }else{ for (i=0; i<dstWidth; i++){ dst[i ]= (FFMIN(dst[i ],30775)*4663 - 9289992)>>12; dst[i+VOFW]= (FFMIN(dst[i+VOFW],30775)*4663 - 9289992)>>12; } } } }
1threat
int parse_host_src_port(struct sockaddr_in *haddr, struct sockaddr_in *saddr, const char *input_str) { char *str = strdup(input_str); char *host_str = str; char *src_str; const char *src_str2; char *ptr; if ((ptr = strchr(str,','))) *ptr = '\0'; if ((src_str = strchr(input_str,'@'))) { *src_str = '\0'; src_str++; } if (parse_host_port(haddr, host_str) < 0) goto fail; src_str2 = src_str; if (!src_str || *src_str == '\0') src_str2 = ":0"; if (parse_host_port(saddr, src_str2) < 0) goto fail; free(str); return(0); fail: free(str); return -1; }
1threat
How can I analzye only specific sentences in R? : <p>I have a data set of 4,500 long texts that I analyze using R packages. I want to analyze only sentences that contain specific words, how can I do it? and can I use R to create a second set of all the sentences (which will be independent of the original set?) thanks</p>
0debug
What is an Embedding in Keras? : <p>Keras documentation isn't clear what this actually is. I understand we can use this to compress the input feature space into a smaller one. But how is this done from a neural design perspective? Is it an autoenocder, RBM?</p>
0debug
Calculate an MD5 checksum for a file in C without opening the file? : <p>I have a list of files in a directory and I want to calculate the MD5 checksum for each of the files. Is there a way to do this without opening the files? If not, what library do I use? Is it the md5 library? </p> <p>Thanks</p>
0debug
Remove brakets and special characters in string - Oracle : We have an input from user who provides source account ID and DB ID. problem here is the input will be: [222].[2] i need to filter first [222] as source account id, second value in[2] as DBID. Input: [222].[2] ([srcacct id].[database id]) we need to remove braces "[" and "." Output: Source Account id=222, DBID=2
0debug
static int oss_ctl_in (HWVoiceIn *hw, int cmd, ...) { OSSVoiceIn *oss = (OSSVoiceIn *) hw; switch (cmd) { case VOICE_ENABLE: { va_list ap; int poll_mode; va_start (ap, cmd); poll_mode = va_arg (ap, int); va_end (ap); if (poll_mode && oss_poll_in (hw)) { poll_mode = 0; } hw->poll_mode = poll_mode; } break; case VOICE_DISABLE: if (hw->poll_mode) { hw->poll_mode = 0; qemu_set_fd_handler (oss->fd, NULL, NULL, NULL); } break; } return 0; }
1threat
String backward another way : <p>I am very new to Python and I encountered one issue that I cannot understand. Let say I have string variable:</p> <pre><code>myVar = "abcdefgh" </code></pre> <p>I want to display it backward, no problem: </p> <pre><code>print(myVar[::-1]) </code></pre> <p>and I get hgfedcba. Nothing surprising here. I should get the same with this somewhat verbose code:</p> <pre><code>print(myVar[len(myVar)-1:0:-1]) </code></pre> <p>but this time the result is hgfedcb. Then I have tried not to subtract 1 from len(myVar) and the result was exactly the same. I do not understand why, especially that lines:</p> <pre><code>print(myVar[::1]) print(myVar[0:len(myVar):1]) </code></pre> <p>display the same results. </p> <p>So, my question is why print(myVar[len(myVar):0:-1]) does not display "a"?</p>
0debug
How to test Messages arriving in Azure IoTHub : <p>I have an event generator connected and publishing messages into an IoT hub. How do I check what message have arrived? I'd be interested in different ways to determine (programmatically, dashboard, etc)</p>
0debug
static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, unsigned long int req, void *buf, BlockDriverCompletionFunc *cb, void *opaque) { RawPosixAIOData *acb = g_slice_new(RawPosixAIOData); acb->bs = bs; acb->aio_type = QEMU_AIO_IOCTL; acb->aio_fildes = fd; acb->aio_offset = 0; acb->aio_ioctl_buf = buf; acb->aio_ioctl_cmd = req; return thread_pool_submit_aio(aio_worker, acb, cb, opaque); }
1threat
void qemu_console_copy(QEMUConsole *console, int src_x, int src_y, int dst_x, int dst_y, int w, int h) { if (active_console == console) { if (console->ds->dpy_copy) console->ds->dpy_copy(console->ds, src_x, src_y, dst_x, dst_y, w, h); else { console->ds->dpy_update(console->ds, dst_x, dst_y, w, h); } } }
1threat
static int nbd_co_send_reply(NBDRequest *req, struct nbd_reply *reply, int len) { NBDClient *client = req->client; int csock = client->sock; int rc, ret; qemu_co_mutex_lock(&client->send_lock); qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, nbd_restart_write, client); client->send_coroutine = qemu_coroutine_self(); if (!len) { rc = nbd_send_reply(csock, reply); if (rc == -1) { rc = -errno; } } else { socket_set_cork(csock, 1); rc = nbd_send_reply(csock, reply); if (rc != -1) { ret = qemu_co_send(csock, req->data, len); if (ret != len) { errno = EIO; rc = -1; } } if (rc == -1) { rc = -errno; } socket_set_cork(csock, 0); } client->send_coroutine = NULL; qemu_set_fd_handler2(csock, nbd_can_read, nbd_read, NULL, client); qemu_co_mutex_unlock(&client->send_lock); return rc; }
1threat
void HELPER(mvpg)(CPUS390XState *env, uint64_t r0, uint64_t r1, uint64_t r2) { env->cc_op = 0; #ifdef CONFIG_USER_ONLY memmove(g2h(r1), g2h(r2), TARGET_PAGE_SIZE); #else mvc_fast_memmove(env, TARGET_PAGE_SIZE, r1, r2); #endif }
1threat
FragmentManager and androidx FragmentManager : <p>I'm trying to setup in my app that is using androidX.</p> <p>My problem is that when I try to work with PlaceAutocompleteFragment I get errors because it is a fragment from <code>android.app.fragment</code> and my parent fragment is an androidx fragment: <code>androidx.fragment.app.Fragment</code> so it uses a <code>androidx.fragment.app.FragmentManager</code>instead of a <code>android.app.FragmentManager</code>.</p> <p>How can I work with "old" fragments in androidX?</p>
0debug
static void unplug_nic(PCIBus *b, PCIDevice *d) { if (pci_get_word(d->config + PCI_CLASS_DEVICE) == PCI_CLASS_NETWORK_ETHERNET) { qdev_unplug(&(d->qdev), NULL); } }
1threat
VBA append some columns to another column and also create a seperate column to contain the appended columns title headers : I am working on a research portal for a client, they have their data in an excel workbook and each sheet containing stock prices for a particular year. There are about 11 worksheets (each representing a year i.e sheet 2008 - 2019). To keep things simple, each sheet has a column for Company Symbol Ticker, then other series of columns each representing a trading day. So it looks like (Symbol Ticker, 04 Jan 2008, 05 Jan 2008,06 Jan 2008,..,31 Dec 2008). I want to store this data in a database but dont want to have that huge freaking number of columns in the database one major reason being that the trading days is not the same for all sheets(years). So how i want to store this data is have a date column in the database, values column , and the company's column , so basically (date,value,companyID). I have transposed the table and placed the companies IDs (1,2,3,...) on each corresponding value columns to identify the company that has values in a particular column. The next step now is to arrange these data in a 3 column (date,value,companyID) so that i can convert to CSV and import into the database. I know an excel macro can handle this very sure but cant figure out how to go about it as i am still a beginner in VBA. Thanks for your help in advance. ``` 1 2 3 02-Jan-14 0.50 44.69 39.00 03-Jan-14 0.50 44.01 39.00 06-Jan-14 0.50 43.50 39.00 07-Jan-14 0.50 43.66 37.50 08-Jan-14 0.50 43.99 39.00 09-Jan-14 0.50 44.00 39.00 10-Jan-14 0.50 44.00 40.00 13-Jan-14 0.50 43.50 40.01 15-Jan-14 0.50 43.99 41.00 16-Jan-14 0.50 44.13 41.06 17-Jan-14 0.50 44.25 41.06 20-Jan-14 0.50 44.39 41.06 21-Jan-14 0.50 44.39 41.06 22-Jan-14 0.50 44.39 43.11 ``` Expected result ``` 02-Jan-14 0.50 1 03-Jan-14 0.50 1 06-Jan-14 0.50 1 07-Jan-14 0.50 1 08-Jan-14 0.50 1 09-Jan-14 0.50 1 10-Jan-14 0.50 1 13-Jan-14 0.50 1 15-Jan-14 0.50 1 16-Jan-14 0.50 1 17-Jan-14 0.50 1 20-Jan-14 0.50 1 21-Jan-14 0.50 1 22-Jan-14 0.50 1 02-Jan-14 44.69 2 03-Jan-14 44.01 2 06-Jan-14 43.50 2 07-Jan-14 43.66 2 08-Jan-14 43.99 2 09-Jan-14 44.00 2 10-Jan-14 44.00 2 13-Jan-14 43.50 2 15-Jan-14 43.99 2 16-Jan-14 44.13 2 17-Jan-14 44.25 2 20-Jan-14 44.39 2 21-Jan-14 44.39 2 22-Jan-14 44.39 2 02-Jan-14 39.00 3 03-Jan-14 39.00 3 06-Jan-14 39.00 3 07-Jan-14 37.50 3 08-Jan-14 39.00 3 09-Jan-14 39.00 3 10-Jan-14 40.00 3 13-Jan-14 40.01 3 15-Jan-14 41.00 3 16-Jan-14 41.06 3 17-Jan-14 41.06 3 20-Jan-14 41.06 3 21-Jan-14 41.06 3 22-Jan-14 43.11 3 ```
0debug
static uint64_t sysctl_read(void *opaque, target_phys_addr_t addr, unsigned size) { MilkymistSysctlState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_TIMER0_COUNTER: r = (uint32_t)ptimer_get_count(s->ptimer0); r = s->regs[R_TIMER0_COMPARE] - r; break; case R_TIMER1_COUNTER: r = (uint32_t)ptimer_get_count(s->ptimer1); r = s->regs[R_TIMER1_COMPARE] - r; break; case R_GPIO_IN: case R_GPIO_OUT: case R_GPIO_INTEN: case R_TIMER0_CONTROL: case R_TIMER0_COMPARE: case R_TIMER1_CONTROL: case R_TIMER1_COMPARE: case R_ICAP: case R_DBG_SCRATCHPAD: case R_DBG_WRITE_LOCK: case R_CLK_FREQUENCY: case R_CAPABILITIES: case R_SYSTEM_ID: r = s->regs[addr]; break; default: error_report("milkymist_sysctl: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_milkymist_sysctl_memory_read(addr << 2, r); return r; }
1threat
How do i write this assemly lang.program so that it can double any number passed to it : ;DOUBLE This program prompt the user to enter ;a number <5, ;doubles the number, and outputs the result name double .model small .stack .data prompt db oah,odh,"Enter a number <5:$" msg db Oah,Odh,"Double your number is :" result db?,Oah,Odh,"$" .code start: mov ax,@data move ds,ax lea dx,prompt mov ah,9;dos fnto outputstring up to $ int 21h mov ab,1;dos fn toinput byte into al int 21h sub al,30h;Convert from ascii to integer add al,al add al,30h;Convert back to ascii mov result,al lea dx,msg mov ah,9 int 21h mo ax,4c00h;4c in ah is dos exit int 21h end start
0debug
Session Management in an android : <p>Can anybody suggest how to handle SessionManagement in an android app for a login screen after login I have 4 activities. on signing for different users different user's activity opens. I am getting 3 parameters from retrofit:- userId password and their designation in int(1,2,3,4) on getting different designations done of the 4 activities must open. please guide me how to do this. </p>
0debug
Why polygone is not right? : I tried make element with help of `SVG` <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="28" viewBox="0 0 200 28"> <polygon fill='red' stroke='gray' points='0,0 0,170 28,200 0,28z' /> </svg> <!-- end snippet --> I need such element, where is my mistake? [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/xYQn4.jpg
0debug
static void xenfb_update(void *opaque) { struct XenFB *xenfb = opaque; DisplaySurface *surface; int i; if (xenfb->c.xendev.be_state != XenbusStateConnected) return; if (!xenfb->feature_update) { xenfb->up_fullscreen = 1; } if (xenfb->do_resize) { pixman_format_code_t format; xenfb->do_resize = 0; switch (xenfb->depth) { case 16: case 32: format = qemu_default_pixman_format(xenfb->depth, true); surface = qemu_create_displaysurface_from (xenfb->width, xenfb->height, format, xenfb->row_stride, xenfb->pixels + xenfb->offset); break; default: surface = qemu_create_displaysurface(xenfb->width, xenfb->height); break; } dpy_gfx_replace_surface(xenfb->c.con, surface); xen_pv_printf(&xenfb->c.xendev, 1, "update: resizing: %dx%d @ %d bpp%s\n", xenfb->width, xenfb->height, xenfb->depth, is_buffer_shared(surface) ? " (shared)" : ""); xenfb->up_fullscreen = 1; } if (xenfb->up_fullscreen) { xen_pv_printf(&xenfb->c.xendev, 3, "update: fullscreen\n"); xenfb_guest_copy(xenfb, 0, 0, xenfb->width, xenfb->height); } else if (xenfb->up_count) { xen_pv_printf(&xenfb->c.xendev, 3, "update: %d rects\n", xenfb->up_count); for (i = 0; i < xenfb->up_count; i++) xenfb_guest_copy(xenfb, xenfb->up_rects[i].x, xenfb->up_rects[i].y, xenfb->up_rects[i].w, xenfb->up_rects[i].h); } else { xen_pv_printf(&xenfb->c.xendev, 3, "update: nothing\n"); } xenfb->up_count = 0; xenfb->up_fullscreen = 0; }
1threat
connection.query('SELECT * FROM users WHERE username = ' + input_string)
1threat
static uint32_t stellaris_enet_read(void *opaque, target_phys_addr_t offset) { stellaris_enet_state *s = (stellaris_enet_state *)opaque; uint32_t val; switch (offset) { case 0x00: DPRINTF("IRQ status %02x\n", s->ris); return s->ris; case 0x04: return s->im; case 0x08: return s->rctl; case 0x0c: return s->tctl; case 0x10: if (s->rx_fifo_len == 0) { if (s->np == 0) { BADF("RX underflow\n"); return 0; } s->rx_fifo_len = s->rx[s->next_packet].len; s->rx_fifo = s->rx[s->next_packet].data; DPRINTF("RX FIFO start packet len=%d\n", s->rx_fifo_len); } val = s->rx_fifo[0] | (s->rx_fifo[1] << 8) | (s->rx_fifo[2] << 16) | (s->rx_fifo[3] << 24); s->rx_fifo += 4; s->rx_fifo_len -= 4; if (s->rx_fifo_len <= 0) { s->rx_fifo_len = 0; s->next_packet++; if (s->next_packet >= 31) s->next_packet = 0; s->np--; DPRINTF("RX done np=%d\n", s->np); } return val; case 0x14: return s->macaddr[0] | (s->macaddr[1] << 8) | (s->macaddr[2] << 16) | (s->macaddr[3] << 24); case 0x18: return s->macaddr[4] | (s->macaddr[5] << 8); case 0x1c: return s->thr; case 0x20: return s->mctl; case 0x24: return s->mdv; case 0x28: return 0; case 0x2c: return s->mtxd; case 0x30: return s->mrxd; case 0x34: return s->np; case 0x38: return 0; case 0x3c: return 0; default: hw_error("stellaris_enet_read: Bad offset %x\n", (int)offset); return 0; } }
1threat
What is the difference between 'it' and 'test' in jest? : <p>I have two tests in my test group. One uses it the other one uses test, and they seem to be working very similarly. What is the difference between them?</p> <pre><code>describe('updateAll', () =&gt; { it('no force', () =&gt; { return updateAll(TableName, ["fileName"], {compandId: "test"}) .then(updatedItems =&gt; { let undefinedCount = 0; for (let item of updatedItems) { undefinedCount += item === undefined ? 1 : 0; } // console.log("result", result); expect(undefinedCount).toBe(updatedItems.length); }) }); test('force update', () =&gt; { return updateAll(TableName, ["fileName"], {compandId: "test"}, true) .then(updatedItems =&gt; { let undefinedCount = 0; for (let item of updatedItems) { undefinedCount += item === undefined ? 1 : 0; } // console.log("result", result); expect(undefinedCount).toBe(0); }) }); }); </code></pre> <p><strong>UPDATE:</strong></p> <p>It seems that <code>test</code> is in <a href="https://facebook.github.io/jest/docs/api.html" rel="noreferrer">the official API of Jest</a>, but <code>it</code> is not. </p>
0debug
Basic addition in notepad++/python : I am using notepad++ to write code for python and have a variable that I need to add 1 to for my next question. I am new to coding and would like to know how to achieve this. I would also like to phrase the question so that the answer (variable plus 1) is placed between text. Below, in my next line I would like it to read (for instance if the number is 3) How often do the 4 of you visit? I have tried different ways of framing my variable +1 within parentheses and quotation marks but at best, when run, it shows exactly what I wrote not the answer to the equation. famnumber = input ("How many of your family members still live there?") I would like the answer to appear within text as noted above if possible.
0debug
How do you use TypeApplications in Haskell? : <p>With <code>-XTypeApplications</code> in GHC 8.0, you can specify types explicitly with <code>@</code> preceding function arguments. What types does it exactly specify, especially when several <code>@</code> are introduced?</p>
0debug
how to convert an image to base64 image in flutter? : <p>I am actually trying to convert an image picked by <code>ImagePicker</code> in flutter to <code>base64</code> image. I am always getting the error. </p> <pre><code>FileSystemException: Cannot open file, path = 'file:///storage/emulated/0/Download/Abid_Wipro_neemuchwala1- 770x433.jpg' (OS Error: No such file or directory, errno = 2) E/flutter ( 5042): #0 _File.throwIfError (dart:io/file_impl.dart:628) E/flutter ( 5042): #1 _File.openSync (dart:io/file_impl.dart:472) E/flutter ( 5042): #2 _File.readAsBytesSync (dart:io/file_impl.dart:532) </code></pre> <p>the code i am using is this one.</p> <pre><code> File fileData; /////////////........... new Container( child: new FutureBuilder&lt;File&gt;( future: imageFile, builder: (BuildContext context, AsyncSnapshot&lt;File&gt; snapshot) { if (snapshot.connectionState == ConnectionState.done &amp;&amp; snapshot.data != null) { fileData = snapshot.data; return new Container( height: MediaQuery.of(context).size.height / 2, width: MediaQuery.of(context).size.width, margin: const EdgeInsets.all(4.0), decoration: new BoxDecoration( image: new DecorationImage( image: new FileImage(snapshot.data,), fit: BoxFit.cover ), ), ); } else if (snapshot.error != null) { return new Column(children: &lt;Widget&gt;[ centerWidget('Choose Image or Audio or Video'), _circleAvatar() ]); } else { return new Column(children: &lt;Widget&gt;[ centerWidget('Choose Image or Audio or Video'), _circleAvatar() ]); } }, ), ), ///////////////// File imageFile = new File(widget.fileData.uri.toString()); List&lt;int&gt; imageBytes = imageFile.readAsBytesSync(); String base64Image = base64Encode(imageBytes); </code></pre> <p>Please, can someone tell me where is it that i am making a mistake .</p> <p>Many thanks, Mahi</p>
0debug
How can I use created pivot table from Sql Server in C# mvc razor Html table? : I created a pivot table via Sql server and I want to use it in mvc c #. I have already looked at examples but mine is something different than examples in the internet. I want to list table as see photo that I have attached. Can someone help with this? Thank you in advance. [attached Image ][1] [1]: https://i.stack.imgur.com/yrGPd.jpg
0debug
How to Redirect to a certain route based on condition in Angular 2. : <p>I am creating one angular2-meteor app. </p> <pre><code>export const routes: Route[] = [{ path: '', redirectTo: "login", pathMatch: "full" }, { path: 'login', component: LoginComponent }, { path: 'csvtemplate', component: TemplateComponent, canActivate: ['canActivateForLoggedIn'], children: [{ path: '', redirectTo: 'dashboard' &lt;----how to add condition for multiple path }, { path:'dashboard', component: DashboardComponent }, { path: 'csvtimeline/:month/:year', component: CsvTimelineComponent }, { path: 'csvjson', component: CsvJsonComponent }] }]; </code></pre> <p>When i login to my app using LoginComponent it will go to TemplateComponent which have three child components </p> <ul> <li>dashboard</li> <li>csvtimeline</li> <li>csvjson</li> </ul> <p>Now i have by default set redirectTo to my dashboard component. but in place of this redirect i want to redirect to csvjson component or csvtimeline component based on login user profile.</p> <p>Suppose</p> <p><strong>If Login User is "Admin" he should be redirectTo - > dashboard Component</strong></p> <p><strong>If Login User is "Guest" then he should be redirectTo - > csvjson component</strong> </p> <p>i know we can do this in ngOnInit() of dashboard component for redirect.</p> <pre><code>if (this.user &amp;&amp; this.user.profile.role == 'Guest') { this._router.navigate(['csvtemplate/csvjson']); } </code></pre> <p>but i am looking for better option so i don't have to open dashboard component each time and it will directly go to csvjson component.</p>
0debug
How to display the values using the submit button on the html web page : For example when i give an input saying "Good Morning" in the submit button. I should be able to view my input on the Html web page.
0debug
Angular Flex Layout - Not working : <p>I tried to use 2.0.0-beta.9 in my app, a simple test doesn't work </p> <pre><code>&lt;div fxLayout="row"&gt; &lt;div&gt;1. One&lt;/div&gt; &lt;div&gt;2. Two&lt;/div&gt; &lt;div&gt;3. Three&lt;/div&gt; &lt;div&gt;4. Four&lt;/div&gt; &lt;/div&gt; </code></pre> <p>displays columns instead of rows</p> <p>I think I am importing the library properly</p> <pre><code>import {Component, NgModule} from '@angular/core' import {BrowserModule} from '@angular/platform-browser' import {FlexLayoutModule} from "@angular/flex-layout"; import {TestApp} from "./test-app"; @NgModule({ imports: [ BrowserModule, FlexLayoutModule ], declarations: [ TestApp ], bootstrap: [ TestApp ] }) export class TestAppModule { } </code></pre>
0debug
how to submit drop down value after click of button : <p>below coding works fine</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;select name="menu" id="menu"&gt; &lt;option value="http://www.google.com"&gt;ESPN&lt;/option&gt; &lt;option value="http://www.facebook.com"&gt;CNN&lt;/option&gt; &lt;/select&gt; &lt;script type="text/javascript"&gt; var urlmenu = document.getElementById( 'menu' ); urlmenu.onchange = function() { window.open( this.options[ this.selectedIndex ].value ); }; &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I need to add a button next to drop down which should allow link to work after clicking the button.</p>
0debug
i want google map like this Multiple Polyline ,can Multiple select : i want google map like this Multiple Polyline ,can Multiple select. i want google map like this Multiple Polyline ,can Multiple select. i want google map like this Multiple Polyline ,can Multiple select. Multiple Polyline [enter image description here][1] <!-- language: lang-js --> var geocoder; var map; var polyline; positions = [new google.maps.LatLng(37.441883,-122.143019), new google.maps.LatLng(37.45296,-122.181725)]; function initialize() { var map = new google.maps.Map( document.getElementById("map_canvas"), { center: new google.maps.LatLng(37.4419, -122.1419), zoom: 13, mapTypeId: google.maps.MapTypeId.ROADMAP }); $("#chkRouteLines").click(function () { if (!polyline || !polyline.setMap) { polyline = new google.maps.Polyline({ path: positions, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2, visible: true }); } if ($(this).is(':checked')) { polyline.setMap(map); } else { polyline.setMap(null); } }) } google.maps.event.addDomListener(window, "load", initialize); <!-- language: lang-css --> html, body, #map_canvas { height: 90%; width: 100%; margin: 0px; padding: 0px <!-- language: lang-html --> <div id="map_canvas" style="border: 2px solid #3872ac;"></div> <input id="chkRouteLines" value="click" type="checkbox" /> <!-- end snippet --> [1]: https://i.stack.imgur.com/ccbGV.png i want google map like this Multiple Polyline ,can Multiple select. i want google map like this Multiple Polyline ,can Multiple select. i want google map like this Multiple Polyline ,can Multiple select.
0debug
vba quarterly retuns : Can anybody tell me a VBA Function or button that would calculate quarterly returns only on a quarterly basis (i.e., first quarter return is based on January till March returns) without overlapping observations. The function that I'm using now is just the AVERAGE of, for example, returns from January until March, but the actual calculation cell is in April. An example of what I'm asking is in the picture link. I would like the function to run for the time period that I choose. https://i.stack.imgur.com/dw0BU.png Thank you very much!
0debug
How to display all array values from json in PHP? : <p>i am currently having problem displaying all array values for a particular type i am trying to fetch all the messages from the json </p> <p>Here is my code:</p> <pre><code>&lt;?php $request = 'https://devblogs.instavoice.com'; $response = file_get_contents($request); $jsonobj = json_decode($response,true); echo $jsonobj-&gt;status; echo $jsonobj[0]-&gt;msg_content; ?&gt; </code></pre> <p>Here is the json i am trying to fetch :</p> <pre><code>{"cmd":"fetch_vobolos","status":"ok","no_more_record":true,"blog_msgs":[{"from_blogger_id":17198634,"msg_id":19046254,"msg_content_type":"t","msg_content":"dsd\u0027.$msg.\u0027","duration":11,"msg_dt":1471675984000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046253,"msg_content_type":"t","msg_content":"rasdhulsdsa","duration":11,"msg_dt":1471675507000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046252,"msg_content_type":"t","msg_content":"rasdhulsdsa","duration":11,"msg_dt":1471675294000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046243,"msg_content_type":"t","msg_content":"ddsssd","duration":6,"msg_dt":1471670493000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false},{"from_blogger_id":17198634,"msg_id":19046242,"msg_content_type":"t","msg_content":"asdsdas","duration":7,"msg_dt":1471670413000,"annotation":"","blogger_display_name":"48669341","pic_uri":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","profileFolderName":"8488/","blogFolderName":"8488/","is_msg_base64":false,"msg_flow":"s","isReceivedMsg":false,"type":"vb","like_cnt":0,"comment_cnt":0,"shares_cnt":0,"is_self_liked":false,"is_self_commented":false,"is_self_shared":false,"is_shared":false,"linked_blog_id":0,"by_profile_picture_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic.jpg","by_profile_picture_thumbnail_URI":"http://devblogs.instavoice.com/vobolo/static-contents/images/default_profile_pic_thumbnail.jpg","source_app_type":"","is_tagged":false}],"last_blog_id":19046254,"before_blog_id":19046242,"device_id":61758} </code></pre> <p>I am having difficulty displaying all the messages on "msg_content" but it returns error.</p>
0debug
static int opt_sameq(void *optctx, const char *opt, const char *arg) { av_log(NULL, AV_LOG_WARNING, "Ignoring option '%s'\n", opt); return 0; }
1threat
TypeError: view must be a callable or a list/tuple in the case of include().hh : <pre><code>TypeError: view must be a callable or a list/tuple in the case of include(). </code></pre> <p>urls</p> <pre><code>from django.conf.urls import include, url from django.contrib import admin urlpatterns = [ url(r'^$',"newhomaa.views.home", name='home'), url(r'^admin/', include(admin.site.urls)), </code></pre> <p>views</p> <pre><code>from django.shortcuts import render def home(request): return render(request,"home.html",{}) </code></pre> <p>INSTALLED_APPS<br> = [</p> <pre><code>'newhomaa', </code></pre> <p>i need solv my Problem</p>
0debug
NxN Matrix of random numbers using nested for loop : <p>I skipped a semester and completely forgot the basics of coding and my new professor at my new campus is jumping right into coding problems instead of reviewing like i figured he would do. I am to write a program that creates a 4x4 matrix of random integer values from 0-9, and then reduces it to a 2x2 matrix of doubles by averaging the 4 quadrants. I vaguely remember how to do a random number generator but the matrix alludes me. If someone would be willing to help me and walk through it with me i would much appreciate it!</p> <p>An example of what it is suppose to look like would be something along the lines of this.</p> <p>Initial matrix</p> <p>8 9 0 8</p> <p>8 4 5 3</p> <p>3 0 1 1</p> <p>3 9 5 6</p> <p>Result matrix</p> <p>7.25 4.0</p> <p>3.75 3.25</p>
0debug
static int svq1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; SVQ1Context *s = avctx->priv_data; AVFrame *cur = data; uint8_t *current; int result, i, x, y, width, height; svq1_pmv *pmv; init_get_bits(&s->gb, buf, buf_size * 8); s->frame_code = get_bits(&s->gb, 22); if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60)) return AVERROR_INVALIDDATA; if (s->frame_code != 0x20) { uint32_t *src = (uint32_t *)(buf + 4); for (i = 0; i < 4; i++) src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i]; } result = svq1_decode_frame_header(avctx, cur); if (result != 0) { av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result); return result; } result = ff_set_dimensions(avctx, s->width, s->height); if (result < 0) return result; if ((avctx->skip_frame >= AVDISCARD_NONREF && s->nonref) || (avctx->skip_frame >= AVDISCARD_NONKEY && cur->pict_type != AV_PICTURE_TYPE_I) || avctx->skip_frame >= AVDISCARD_ALL) return buf_size; result = ff_get_buffer(avctx, cur, s->nonref ? 0 : AV_GET_BUFFER_FLAG_REF); if (result < 0) return result; pmv = av_malloc((FFALIGN(s->width, 16) / 8 + 3) * sizeof(*pmv)); if (!pmv) return AVERROR(ENOMEM); for (i = 0; i < 3; i++) { int linesize = cur->linesize[i]; if (i == 0) { width = FFALIGN(s->width, 16); height = FFALIGN(s->height, 16); } else { if (avctx->flags & CODEC_FLAG_GRAY) break; width = FFALIGN(s->width / 4, 16); height = FFALIGN(s->height / 4, 16); } current = cur->data[i]; if (cur->pict_type == AV_PICTURE_TYPE_I) { for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_block_intra(&s->gb, &current[x], linesize); if (result != 0) { av_log(avctx, AV_LOG_INFO, "Error in svq1_decode_block %i (keyframe)\n", result); goto err; } } current += 16 * linesize; } } else { uint8_t *previous = s->prev->data[i]; if (!previous || s->prev->width != s->width || s->prev->height != s->height) { av_log(avctx, AV_LOG_ERROR, "Missing reference frame.\n"); result = AVERROR_INVALIDDATA; goto err; } memset(pmv, 0, ((width / 8) + 3) * sizeof(svq1_pmv)); for (y = 0; y < height; y += 16) { for (x = 0; x < width; x += 16) { result = svq1_decode_delta_block(avctx, &s->hdsp, &s->gb, &current[x], previous, linesize, pmv, x, y, width, height); if (result != 0) { av_dlog(avctx, "Error in svq1_decode_delta_block %i\n", result); goto err; } } pmv[0].x = pmv[0].y = 0; current += 16 * linesize; } } } if (!s->nonref) { av_frame_unref(s->prev); result = av_frame_ref(s->prev, cur); if (result < 0) goto err; } *got_frame = 1; result = buf_size; err: av_free(pmv); return result; }
1threat
Google play dosn't make me to post my app : Google Play said : Warnings You imported an APK file that uses Google Play Services version 4030500. This APK file will only work with Android APIs level 9 or higher. You should not use this version of Google Play Services unless you have set the minSdkVersion value to 9 or higher in your manifest file. Your APK uses permissions that require privacy policies: (android.permission.READ_PHONE_STATE, android.permission.GET_ACCOUNTS)
0debug
VBA code to copy cells from a range (A1:T1) to a range whose address is a text value in another cell (A20) : I so hope someone can help me (a VBA Newbie) with a simple issue. In one cell (A20), I have a text address of another cell (let's say A366). I want to copy a range of cells (say A21:T21) to the target range whose address is in cell A20 (that example was A366). For the life of me, I have been totally unable to do what seems incredibly basic and easy. Help, please!
0debug
pandas.read_excel parameter "sheet_name" not working : <p>According to <a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_excel.html" rel="noreferrer">the doc</a>, <code>pandas.read_excel</code> has a parameter <code>sheet_name</code> that allows specifying which sheet is read. But when I am trying to read the second sheet from an excel file, no matter how I set the parameter (<code>sheet_name = 1</code>, <code>sheet_name = 'Sheet2'</code>), the dataframe always shows the first sheet, and passing a list of indices (<code>sheet_name = [0, 1]</code>) does not return a dictionary of dataframes but still the first sheet. What might be the problem here?</p>
0debug
Union fieds in a query : I Have table with A1,A2,A3,A4,B1,B2,B3,B4 fields. I need a select statement that union field : A1 and B1 in C1, A2 and B2 in C2,A3 and B3 in C3,A4 and B4 in C4 FOR EXAMPLE TABLE ONE A1 A2 A3 A4 B1 B2 B3 B4 1 1 1 1 0 0 0 0 2 2 2 2 0 0 0 0 0 0 0 0 3 3 3 3 I NEED RESULT LIKE THIS TABNE TWO C1 C2 C3 C4 1 1 1 1 2 2 2 2 3 3 3 3 Thanks in advance .
0debug
static int scsi_write_data(SCSIDevice *d, uint32_t tag) { SCSIGenericState *s = DO_UPCAST(SCSIGenericState, qdev, d); SCSIGenericReq *r; int ret; DPRINTF("scsi_write_data 0x%x\n", tag); r = scsi_find_request(s, tag); if (!r) { BADF("Bad write tag 0x%x\n", tag); scsi_command_complete(r, -EINVAL); return 0; } if (r->len == 0) { r->len = r->buflen; scsi_req_data(&r->req, r->len); return 0; } ret = execute_command(s->bs, r, SG_DXFER_TO_DEV, scsi_write_complete); if (ret == -1) { scsi_command_complete(r, -EINVAL); return 1; } return 0; }
1threat
How to turn off spell checking in CSS? : <p>Any attributes or some tweak to ignore the red-colored underline? or it's ignoreable due to browser settings?</p> <p><a href="https://i.stack.imgur.com/c24pg.png" rel="noreferrer"><img src="https://i.stack.imgur.com/c24pg.png" alt="enter image description here"></a></p>
0debug
Where is the Artifactory OSS source code located? : <p>I can download the latest Artifactory OSS release (5.2.1), but I can't seem to find its source code.</p> <p>The Artifactory documentation links to <a href="https://api.bintray.com/content/jfrog/artifactory/jfrog-artifactory-oss-$latest-sources.tar.gz;bt_package=jfrog-artifactory-oss-zip" rel="noreferrer">https://api.bintray.com/content/jfrog/artifactory/jfrog-artifactory-oss-$latest-sources.tar.gz;bt_package=jfrog-artifactory-oss-zip</a>, but there's no source at that address.</p> <p>Does anyone know what the real URL is, or if there's a public svn or git repo that I can clone?</p>
0debug
How to protect background service/alarms to be kill in newly launched devices in customized OS like oppo - coloros, vivo-funtouch os, Xiomi-MIUI os? : <p>I have a <code>WakefulBroadcastReceiver</code> with <code>IntentService</code>, every half hour alarm called and doing some stuff. I have already handle doze mode with <code>setExactAndAllowWhileIdle()</code> method.</p> <p>Some new smart phones with customized os recently launched in market they have their own customized os based on android os. Like oppo with color os, vivo with funtouch os, xiomi with MIUI os. In the OSs there is a feature to clear memory. They have one touch clear memory option. for example if user clear recent app list or remove app from recent app list app's all background service along with all alarms will be killed.</p> <p>How to work with these new OS?</p>
0debug
Preventing compiler optimizations while benchmarking : <p>I recently came across this brilliant cpp2015 talk <a href="https://www.youtube.com/watch?v=nXaxk27zwlk" rel="noreferrer">CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!"</a></p> <p>One of the techniques mentioned to prevent the compiler from optimizing code is using the below functions. </p> <pre><code>static void escape(void *p) { asm volatile("" : : "g"(p) : "memory"); } static void clobber() { asm volatile("" : : : "memory"); } void benchmark() { vector&lt;int&gt; v; v.reserve(1); escape(v.data()); v.push_back(10); clobber() } </code></pre> <p>I'm trying to understand this. Questions as follows.</p> <p>1) What is the advantage of an escape over clobber ?</p> <p>2) From the example above it looks like clobber() prevents the previous statement ( push_back ) to be optimized way. If that's the case why the below snippet is not correct ?</p> <pre><code> void benchmark() { vector&lt;int&gt; v; v.reserve(1); v.push_back(10); clobber() } </code></pre> <p>If this wasn't confusing enough, folly ( FB's threading lib ) has an even <a href="https://github.com/facebook/folly/blob/master/folly/Benchmark.h" rel="noreferrer">stranger implementation</a> </p> <p>Relevant snippet:</p> <pre><code>template &lt;class T&gt; void doNotOptimizeAway(T&amp;&amp; datum) { asm volatile("" : "+r" (datum)); } </code></pre> <p>My understanding is that the above snippet informs the compiler that the assembly block will writes to datum. But if the compiler finds there is no consumer of this datum it can still optimize out the entity producing datum right ?</p> <p>I assume this is not common knowledge and any help is appreciated !</p>
0debug
Will you please tell me how to set custom phpmd ruleset file in netbeans 8.1? : <p>I'm installing phpmd into netbeans and it gives me error also but what if I want to set my custom ruleset file in netbeans 8.1?</p>
0debug
How to use MongoDB with promises in Node.js? : <p>I've been trying to discover how to use MongoDB with Node.js and in the docs it seems the suggested way is to use callbacks. Now, I know that it is just a matter of preference, but I really prefer using promises.</p> <p>The problem is that I didn't find how to use them with MongoDB. Indeed, I've tried the following:</p> <pre><code>var MongoClient = require('mongodb').MongoClient; var url = 'mongodb://localhost:27017/example'; MongoClient.connect(url).then(function (err, db) { console.log(db); }); </code></pre> <p>And the result is <code>undefined</code>. In that case it seems this is not the way to do so.</p> <p>Is there any way to use mongo db inside Node with promises instead of callbacks?</p>
0debug
static void add_pid_to_pmt(MpegTSContext *ts, unsigned int programid, unsigned int pid) { struct Program *p = get_program(ts, programid); int i; if (!p) return; if (p->nb_pids >= MAX_PIDS_PER_PROGRAM) return; for (i = 0; i < MAX_PIDS_PER_PROGRAM; i++) if (p->pids[i] == pid) return; p->pids[p->nb_pids++] = pid; }
1threat
Need to write a result set in the form of Map<String, List<String>> to excel sheet : <p>I have a class that runs SQL query and returns the resultset in Map> format. Now, I need to store this data in an excel. Can anyone help me write the logic to store the result set I received to an excel sheet?</p>
0debug
How to asociate country table in job model cakephp : i have jobs and countries table Table - Jobs Column name = country_id Table - Countries Column name = id i am using find query on job table.. How to associate country table on job model so that when i run select query on job it automatically bind this relation jobs.country_id = Countries.id class Job extends AppModel { public $belongsTo = array( 'country' => array( 'className' => 'country', 'primaryKey' => 'id', 'foreignKey' => 'country_id', 'dependent' => true, 'conditions' => '', 'fields' => '', 'order' => '', 'limit' => '', 'offset' => '', 'exclusive' => '', 'finderQuery' => '', 'counterQuery' => '' ) ); }
0debug
How to URL encode in Python 3? : <p>I have tried to follow <a href="https://docs.python.org/3.0/library/urllib.parse.html" rel="noreferrer">the documentation</a> but was not able to use <code>urlparse.parse.quote_plus()</code> in <code>Python 3</code>:</p> <pre><code>from urllib.parse import urlparse params = urlparse.parse.quote_plus({'username': 'administrator', 'password': 'xyz'}) </code></pre> <p>I get</p> <blockquote> <p>AttributeError: 'function' object has no attribute 'parse'</p> </blockquote>
0debug
What is the property in property binding [class.selected]? : <p>I am learning angular 2 from <a href="https://angular.io/docs/ts/latest/tutorial/toh-pt2.html" rel="noreferrer">official hero tutorial</a>. </p> <pre><code>&lt;ul class="heroes"&gt; &lt;li *ngFor="let hero of heroes" [class.selected]="hero === selectedHero" (click)="onSelect(hero)"&gt; &lt;span class="badge"&gt;{{hero.id}}&lt;/span&gt; {{hero.name}} &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I've read the guide about property binding <a href="https://angular.io/docs/ts/latest/guide/template-syntax.html#!#property-binding" rel="noreferrer">here</a>, but still couldn't understand the following code:</p> <pre><code>[class.selected]="hero === selectedHero" </code></pre> <p><strong>Question 1:</strong> I know html tag has a class property, but class property does not have a key called "selected". The class property may have a value, which is string "selected". How come this property binding is valid? </p> <p><strong>Question 2:</strong> How does above property binding translated to class="selected" ?</p>
0debug
bool migration_has_failed(MigrationState *s) { return (s->state == MIG_STATE_CANCELLED || s->state == MIG_STATE_ERROR); }
1threat
How do I to flush redis db from python redis? : <p>Is there a way I can flush my redis db using <a href="https://pypi.python.org/pypi/redis/" rel="noreferrer">redis</a>?</p> <p>I'm looking for something like <code>redis.flushdb()</code> or <code>redis.flushall()</code></p>
0debug
Is there a way to Parse String to DateTime, when the string comes with different formats : <p>I am working on building a console application which read a .csv file and add the values to the database. now i have some CSV columns which store date time values. But those column sometimes contain the datatime with seconds while sometimes it does not. here is a sample of some data for the date field:-</p> <pre><code>03/30/2016 10:55:49 04/01/2016 11:02 </code></pre> <p>now when i try to parse the above string into a date-time as follow:-</p> <pre><code>formattedDateCreated = DateTime.ParseExact(fields[DateCreatedIndex], "MM/dd/yyyy HH:mm:ss", CultureInfo.InvariantCulture); </code></pre> <p>i will get the following exception when i try to parse the second date :-</p> <pre><code>String was not recognized as a valid DateTime </code></pre> <p>so can anyone advice on this please? how i can make my Parse more dynamic to work on date formats with seconds or without seconds?? Thanks</p>
0debug
Rails 5: How to remove a column from a database? : <p>What is the command for removing an existing column from a table using migration?</p> <p>The column I want to remove is: <code>country:string</code></p> <p>From the table: <code>sample_apps</code></p>
0debug
def first_Element(arr,n,k): count_map = {}; for i in range(0, n): if(arr[i] in count_map.keys()): count_map[arr[i]] += 1 else: count_map[arr[i]] = 1 i += 1 for i in range(0, n): if (count_map[arr[i]] == k): return arr[i] i += 1 return -1
0debug
else statement always runs after if and if else : #include <stdio.h> int main(int argc, const char * argv[]) { //run... printf("----------------CALC--------------\n"); printf("(1) Type in a letter to get a secret message: "); int validSecret = 0; char secretLetter; while(validSecret == 0){ scanf("%c",&secretLetter); if(secretLetter == 'b'){ printf("B\n"); } else if (secretLetter == 'r'){ printf("R\n"); } else if (secretLetter == 'k'){ printf("K\n"); } else { printf("Game over\n"); validSecret = 1; } } return 0; } If I enter a b the if statement executes correctly and prints a B and a new line but also prints game over. Its running the if and the else... This makes no sense.
0debug
Javascript - Cannot assign the value of a textbox to a variable : I'm trying to read the value from a textbox and it returns nothing. Javascript: var amount = document.getElementById("billAmt").value; document.getElementById('calculate').addEventListener('click', function() { console.log(amount); }); HTML: <input id="billamt" type="text" placeholder="Bill Amount"> <button type="button" id="calculate">Calculate!</button> On console it simply shows a white line, with the line number of the console.log statement.
0debug
How to create variable dynamically : I want to create table depending on user input value. But of max 7 column with first column as name of row, when user enters 9 value then it should create next table with two column. Then to those table i am giving value later in the prog from some computation. I tried this code but getting error vr={} num=0 for num in range(1,k): print site_count print 'num is',num vr[str(num)]=document.add_table(rows=13, cols=(7)) print vr['1'] for num in range(1,k+1): vr['num'].cell(1, 0).text='Subscribed BW' vr['num'].cell(2, 0).text='Peak LAN' vr['num'].cell(3, 0).text='Peak WAN-IN' vr['num'].cell(4, 0).text='Peak WAN-OUT' vr['num'].cell(5, 0).text='Recommended BW Capacity' vr['num'].cell(7, 0).text='Peak Compression' vr['num'].cell(9, 0).text='Optimized Traffic' vr['num'].cell(10, 0).text='Optimized Traffic%' vr['num'].cell(12, 0).text='Key Applications' vr['num'].style ='TableGrid' **ERROR as:** vr['num'].cell(1, 0).text='Subscribed BW' KeyError: 'num' Is there any other solution
0debug
static ssize_t spapr_vlan_receive(NetClientState *nc, const uint8_t *buf, size_t size) { VIOsPAPRDevice *sdev = DO_UPCAST(NICState, nc, nc)->opaque; VIOsPAPRVLANDevice *dev = (VIOsPAPRVLANDevice *)sdev; vlan_bd_t rxq_bd = vio_ldq(sdev, dev->buf_list + VLAN_RXQ_BD_OFF); vlan_bd_t bd; int buf_ptr = dev->use_buf_ptr; uint64_t handle; uint8_t control; dprintf("spapr_vlan_receive() [%s] rx_bufs=%d\n", sdev->qdev.id, dev->rx_bufs); if (!dev->isopen) { return -1; } if (!dev->rx_bufs) { return -1; } do { buf_ptr += 8; if (buf_ptr >= SPAPR_TCE_PAGE_SIZE) { buf_ptr = VLAN_RX_BDS_OFF; } bd = vio_ldq(sdev, dev->buf_list + buf_ptr); dprintf("use_buf_ptr=%d bd=0x%016llx\n", buf_ptr, (unsigned long long)bd); } while ((!(bd & VLAN_BD_VALID) || (VLAN_BD_LEN(bd) < (size + 8))) && (buf_ptr != dev->use_buf_ptr)); if (!(bd & VLAN_BD_VALID) || (VLAN_BD_LEN(bd) < (size + 8))) { return -1; } dev->rx_bufs--; dev->use_buf_ptr = buf_ptr; vio_stq(sdev, dev->buf_list + dev->use_buf_ptr, 0); dprintf("Found buffer: ptr=%d num=%d\n", dev->use_buf_ptr, dev->rx_bufs); if (spapr_vio_dma_write(sdev, VLAN_BD_ADDR(bd) + 8, buf, size) < 0) { return -1; } dprintf("spapr_vlan_receive: DMA write completed\n"); control = VLAN_RXQC_TOGGLE | VLAN_RXQC_VALID; if (rxq_bd & VLAN_BD_TOGGLE) { control ^= VLAN_RXQC_TOGGLE; } handle = vio_ldq(sdev, VLAN_BD_ADDR(bd)); vio_stq(sdev, VLAN_BD_ADDR(rxq_bd) + dev->rxq_ptr + 8, handle); vio_stl(sdev, VLAN_BD_ADDR(rxq_bd) + dev->rxq_ptr + 4, size); vio_sth(sdev, VLAN_BD_ADDR(rxq_bd) + dev->rxq_ptr + 2, 8); vio_stb(sdev, VLAN_BD_ADDR(rxq_bd) + dev->rxq_ptr, control); dprintf("wrote rxq entry (ptr=0x%llx): 0x%016llx 0x%016llx\n", (unsigned long long)dev->rxq_ptr, (unsigned long long)vio_ldq(sdev, VLAN_BD_ADDR(rxq_bd) + dev->rxq_ptr), (unsigned long long)vio_ldq(sdev, VLAN_BD_ADDR(rxq_bd) + dev->rxq_ptr + 8)); dev->rxq_ptr += 16; if (dev->rxq_ptr >= VLAN_BD_LEN(rxq_bd)) { dev->rxq_ptr = 0; vio_stq(sdev, dev->buf_list + VLAN_RXQ_BD_OFF, rxq_bd ^ VLAN_BD_TOGGLE); } if (sdev->signal_state & 1) { qemu_irq_pulse(sdev->qirq); } return size; }
1threat
static void pc_q35_init_1_5(QEMUMachineInitArgs *args) { has_pci_info = false; pc_q35_init(args); }
1threat
error C2039: 'IsNearDeath': is not a member of 'Nan::Persistent<v8::Object,v8 ::NonCopyablePersistentTraits<T>> : <p>I recently upgraded my <code>nodejs</code> to <code>v12.3.1</code>, and now when I try to run <code>npm install</code> in my project repository, I am getting the preceding errors. </p> <pre><code>error C2059: syntax error: ')' (compiling source file ..\src\custo m_importer_bridge.cpp) error C2660: 'v8::StringObject::New': function does not take 1 arg uments (compiling source file ..\src\sass_context_wrapper.cpp) node_modules\nan\nan_object_wrap.h(127): error C2039: 'IsNearDeath': is not a member of 'Nan::Persistent&lt;v8::Object,v 8::NonCopyablePersistentTraits&lt;T&gt;&gt;' </code></pre> <p><strong>Things I have tried</strong></p> <ul> <li>Deleted the node_modules folder and run <code>npm install</code></li> <li>Closed vscode and open the solution again</li> <li>update npm to the latest</li> </ul> <p>Anyone else are facing the same issue with <code>v12.3.1</code>?</p>
0debug
In ES6, export let m = 1; and m =1 expoort m ; why the former is true, the latter is false? : ``` export let m = 1; ``` ``` let m =1; expoort m; ``` I know the export of ES6 Module need to be an interface. The former export an interface,and the latter export number 1. I want to know why the former export an interface? I guess priority of operations, but I am not sure. Thanks.
0debug
static void aw_a10_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); dc->realize = aw_a10_realize; }
1threat
static int find_partition(BlockBackend *blk, int partition, off_t *offset, off_t *size) { struct partition_record mbr[4]; uint8_t data[512]; int i; int ext_partnum = 4; int ret; if ((ret = blk_read(blk, 0, data, 1)) < 0) { error_report("error while reading: %s", strerror(-ret)); exit(EXIT_FAILURE); } if (data[510] != 0x55 || data[511] != 0xaa) { return -EINVAL; } for (i = 0; i < 4; i++) { read_partition(&data[446 + 16 * i], &mbr[i]); if (!mbr[i].system || !mbr[i].nb_sectors_abs) { continue; } if (mbr[i].system == 0xF || mbr[i].system == 0x5) { struct partition_record ext[4]; uint8_t data1[512]; int j; if ((ret = blk_read(blk, mbr[i].start_sector_abs, data1, 1)) < 0) { error_report("error while reading: %s", strerror(-ret)); exit(EXIT_FAILURE); } for (j = 0; j < 4; j++) { read_partition(&data1[446 + 16 * j], &ext[j]); if (!ext[j].system || !ext[j].nb_sectors_abs) { continue; } if ((ext_partnum + j + 1) == partition) { *offset = (uint64_t)ext[j].start_sector_abs << 9; *size = (uint64_t)ext[j].nb_sectors_abs << 9; return 0; } } ext_partnum += 4; } else if ((i + 1) == partition) { *offset = (uint64_t)mbr[i].start_sector_abs << 9; *size = (uint64_t)mbr[i].nb_sectors_abs << 9; return 0; } } return -ENOENT; }
1threat
Put real time (non static) on qt (c++) : <p>i want put the real time on qt, but non static</p> <p>I have this code:</p> <pre><code>QDateTime dateTime = dateTime.currentDateTime(); QString dateTimeString = dateTime.toString("yyyy-MM-dd hh-mm-ss"); ui-&gt;data-&gt;setText(dateTimeString); </code></pre> <p>but it shows only a static dateTime and i want the real dateTime (change every second)</p>
0debug
Simple java calculator always outputs 0 : <p>I am new to java, i am trying to make a little calculator that takes the input of two numbers and an operator. This data is then taken into an if statement to calculate the answer. Then output into the console. I am having a problem though because with the:</p> <p>operator = Calc.next();</p> <p>Because i thought that the above line of code was correct for inputting a string but it doesn't work, whatever the numbers input to the calculator are, the answer seems to be output as zero.</p> <p>Please take the code from the pastebin link and look at it because i'm not sure what is going wrong. I would appreciate someone letting me know where i went wrong. </p> <p><a href="http://pastebin.com/B5PjkXwX" rel="nofollow">http://pastebin.com/B5PjkXwX</a></p> <p>Thanks</p>
0debug
Get Image from the Gallery and Show in ImageView : <p>I need to get an image from the gallery on a button click and show it into the imageview.</p> <p>I am doing it in the following way:</p> <pre><code> btn_image_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getImageFromAlbum(); } }); </code></pre> <p>The method Definition is as:</p> <pre><code> private void getImageFromAlbum(){ try{ Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); }catch(Exception exp){ Log.i("Error",exp.toString()); } } </code></pre> <p>The activity result method is</p> <pre><code> @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); try { bmp = getBitmapFromUri(selectedImage); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } image_view.setImageBitmap(bmp); //to know about the selected image width and height Toast.makeText(MainActivity.this, image_view.getDrawable().getIntrinsicWidth()+" &amp; "+image_view.getDrawable().getIntrinsicHeight(), Toast.LENGTH_SHORT).show(); } } </code></pre> <hr> <h2>The Problem</h2> <p>The problem I am facing is when the image resolution is high suppose that if the image size is of 5mp to 13mp. It won't loads up and show up into the image view.</p> <p>But the images with the low width and height are successfully loading into the image view!</p> <p>Can somebody tell me any issues with the code and what I am doing wrong? I just want to import the camera images from the gallery and show them in the image view!</p>
0debug
hey ive got an error and this is my error :Make sure to call FirebaseApp.initializeApp(Context) first : This is my code [enter image description here][1] and this is my gradle [enter image description here][2] this is my gradle project][3] [1]: https://i.stack.imgur.com/TTvXF.png [2]: https://i.stack.imgur.com/zBFJD.png [3]: https://i.stack.imgur.com/vPyMl.png
0debug
static int vmdk_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVVmdkState *s = bs->opaque; int ret; uint64_t n, index_in_cluster; VmdkExtent *extent = NULL; uint64_t cluster_offset; while (nb_sectors > 0) { extent = find_extent(s, sector_num, extent); if (!extent) { return -EIO; } ret = get_cluster_offset( bs, extent, NULL, sector_num << 9, 0, &cluster_offset); index_in_cluster = sector_num % extent->cluster_sectors; n = extent->cluster_sectors - index_in_cluster; if (n > nb_sectors) n = nb_sectors; if (ret) { if (bs->backing_hd) { if (!vmdk_is_cid_valid(bs)) return -EINVAL; ret = bdrv_read(bs->backing_hd, sector_num, buf, n); if (ret < 0) return ret; } else { memset(buf, 0, 512 * n); } } else { ret = bdrv_pread(extent->file, cluster_offset + index_in_cluster * 512, buf, n * 512); if (ret < 0) { return ret; } } nb_sectors -= n; sector_num += n; buf += n * 512; } return 0; }
1threat
static void SET_TYPE(resample_one)(ResampleContext *c, void *dst0, int dst_index, const void *src0, int src_size, int index, int frac) { FELEM *dst = dst0; const FELEM *src = src0; int i; int sample_index = index >> c->phase_shift; FELEM2 val = 0; FELEM *filter = ((FELEM *)c->filter_bank) + c->filter_length * (index & c->phase_mask); if (sample_index < 0) { for (i = 0; i < c->filter_length; i++) val += src[FFABS(sample_index + i) % src_size] * (FELEM2)filter[i]; } else if (c->linear) { FELEM2 v2 = 0; for (i = 0; i < c->filter_length; i++) { val += src[abs(sample_index + i)] * (FELEM2)filter[i]; v2 += src[abs(sample_index + i)] * (FELEM2)filter[i + c->filter_length]; } val += (v2 - val) * (FELEML)frac / c->src_incr; } else { for (i = 0; i < c->filter_length; i++) val += src[sample_index + i] * (FELEM2)filter[i]; } OUT(dst[dst_index], val); }
1threat
ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size) { FdMigrationState *s = opaque; ssize_t ret; do { ret = s->write(s, data, size); } while (ret == -1 && ((s->get_error(s)) == EINTR || (s->get_error(s)) == EWOULDBLOCK)); if (ret == -1) ret = -(s->get_error(s)); if (ret == -EAGAIN) qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s); return ret; }
1threat
Python logger per function or per module : <p>I am trying to start using logging in python and have read several blogs. One issue that is causing confusion for me is whether to create the logger per function or per module. In this <a href="https://fangpenlin.com/posts/2012/08/26/good-logging-practice-in-python/" rel="noreferrer">Blog: Good logging practice in Python</a> it is recommended to get a logger per function. For example:</p> <pre><code>import logging def foo(): logger = logging.getLogger(__name__) logger.info('Hi, foo') class Bar(object): def __init__(self, logger=None): self.logger = logger or logging.getLogger(__name__) def bar(self): self.logger.info('Hi, bar') </code></pre> <p>The reasoning given is that </p> <blockquote> <p>The logging.fileConfig and logging.dictConfig disables existing loggers by default. So, those setting in file will not be applied to your logger. It’s better to get the logger when you need it. It’s cheap to create or get a logger.</p> </blockquote> <p>The recommended way I read everywhere else is like as shown below. The blog states that this approach <code>"looks harmless, but actually, there is a pitfall"</code>.</p> <pre><code>import logging logger = logging.getLogger(__name__) def foo(): logger.info('Hi, foo') class Bar(object): def bar(self): logger.info('Hi, bar') </code></pre> <p>I find the former approach to be tedious as I would have to remember to get the logger in each function. Additionally getting the logger in each function is surely more expensive than once per module. Is the author of the blog advocating a non-issue? Would following logging best practices avoid this issue?</p>
0debug
static int nbd_receive_list(QIOChannel *ioc, char **name, Error **errp) { uint64_t magic; uint32_t opt; uint32_t type; uint32_t len; uint32_t namelen; *name = NULL; if (read_sync(ioc, &magic, sizeof(magic)) != sizeof(magic)) { error_setg(errp, "failed to read list option magic"); return -1; } magic = be64_to_cpu(magic); if (magic != NBD_REP_MAGIC) { error_setg(errp, "Unexpected option list magic"); return -1; } if (read_sync(ioc, &opt, sizeof(opt)) != sizeof(opt)) { error_setg(errp, "failed to read list option"); return -1; } opt = be32_to_cpu(opt); if (opt != NBD_OPT_LIST) { error_setg(errp, "Unexpected option type %x expected %x", opt, NBD_OPT_LIST); return -1; } if (read_sync(ioc, &type, sizeof(type)) != sizeof(type)) { error_setg(errp, "failed to read list option type"); return -1; } type = be32_to_cpu(type); if (type == NBD_REP_ERR_UNSUP) { return 0; } if (nbd_handle_reply_err(opt, type, errp) < 0) { return -1; } if (read_sync(ioc, &len, sizeof(len)) != sizeof(len)) { error_setg(errp, "failed to read option length"); return -1; } len = be32_to_cpu(len); if (type == NBD_REP_ACK) { if (len != 0) { error_setg(errp, "length too long for option end"); return -1; } } else if (type == NBD_REP_SERVER) { if (read_sync(ioc, &namelen, sizeof(namelen)) != sizeof(namelen)) { error_setg(errp, "failed to read option name length"); return -1; } namelen = be32_to_cpu(namelen); if (len != (namelen + sizeof(namelen))) { error_setg(errp, "incorrect option mame length"); return -1; } if (namelen > 255) { error_setg(errp, "export name length too long %d", namelen); return -1; } *name = g_new0(char, namelen + 1); if (read_sync(ioc, *name, namelen) != namelen) { error_setg(errp, "failed to read export name"); g_free(*name); *name = NULL; return -1; } (*name)[namelen] = '\0'; } else { error_setg(errp, "Unexpected reply type %x expected %x", type, NBD_REP_SERVER); return -1; } return 1; }
1threat
C# how do I pass text from form1 to form2 when "both forms are open" : I have two forms "which are both open". I want to send a datagridview cell value from form 1 (already open) to form 2 (already open). (I don't want to pass text on form load, but after some edits on the already open form). I've searched the web for days but I can't find one for already open forms. (Only those containing form.show() property).
0debug
Missing Script when I run npm start to create React app : <p>I'm trying to run the React server by running <code>npm start</code></p> <p>When I do this I get a missing script error:</p> <pre><code>λ npm start npm ERR! missing script: start npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Aristophanes\AppData\Roaming\npm-cache\_logs\2019-05-15T11_34_47_404Z-debug.log </code></pre> <p>Full error log:</p> <pre><code>0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli 'start' ] 2 info using npm@6.4.1 3 info using node@v11.1.0 4 verbose stack Error: missing script: start 4 verbose stack at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19) 4 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5 4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:115:5 4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:418:5 4 verbose stack at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:373:45) 4 verbose stack at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:416:3) 4 verbose stack at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:160:5) 4 verbose stack at ReadFileContext.&lt;anonymous&gt; (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:332:20) 4 verbose stack at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16) 4 verbose stack at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:242:13) 5 verbose cwd C:\Users\Aristophanes\eth-todo-list-react 6 verbose Windows_NT 10.0.17134 7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" 8 verbose node v11.1.0 9 verbose npm v6.4.1 10 error missing script: start </code></pre>
0debug
How do I make a user input of a picture with javascript? : <p>I have been working on my website and cant for the love of god find a way to actualy do this. I tried with but i cant get the picture to upload to my site. I dont know how to acess the information thats in the input. Is it even possible?</p>
0debug
Spring JPA Lock : <p>I am really insecure when it comes to locking in spring jpa.<br> So please consider this question as an clarification. I really hope I understood it correct, but my english is not so good for understanding complex blog posts.<br> So this is what I think I got from some articles: </p> <p>There are two basic types of locking: </p> <ul> <li><strong>optimistic</strong> should be used when less write operation are planned. read operation will not lock an object.<br> For example: You have an "money balance" float in an entity with an optimistic lock. Now two processes read this value and use it for calculating and stuff. One of them now changes the value and writes it to the database with an update. No error to this point.<br> But now the other process also changes the value and wants to update it. Now there is an error. This only happened because of the second update.<br> If the second process would have deleted the instance, nothing would have happend. </li> <li><strong>pessimistic</strong> should be used when much write operation are planned. read operation will lock an object.<br> For example: You have an "money balance" float in an entity with an pessimistic lock. One process reads the data/value with "findOne".<br> After this, an other process wants to read the data as well, what would be possible with an optimistic lock, but with the pessimistic lock he must now wait (no error, just wait).<br> When process 1 is ready (changing the value and updating it), process 2 can go on. </li> </ul> <p>First Questions: Is this correct so far? And when I now want to test this knollage, I can choose between this LockModeType's: </p> <ul> <li>OPTIMISTIC </li> <li>OPTIMISTIC_FORCE_INCREMENT </li> <li>PESSIMISTIC_READ </li> <li>PESSIMISTIC_WRITE </li> <li>PESSIMISTIC_FORCE_INCREMENT </li> </ul> <p>Why are there now so many sub-locks and what do they do? When "OPTIMISTIC" is the optimistic lock from the top I tried to understand, then what is "OPTIMISTIC_FORCE_INCEMENT"?<br> And what does an version update has to do with this? (or the <code>@version</code>?) </p> <p>Going on:<br> There are three basic uses of lock in Spring jpa: </p> <ol> <li><p>on a normal column, for example: </p> <pre><code>@Entity public class PersonEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Lock(LockModeType.PESSIMISTIC_WRITE) private String name; } </code></pre></li> <li><p>on a foreign key to an other table, for example: </p> <pre><code>@Entity public class PersonEntity { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; @Lock(LockModeType.PESSIMISTIC_WRITE) @OneToOne private Group group; } </code></pre></li> <li><p>on a table inside a repository, for example: </p> <pre><code>interface PersonRepository extends Repository&lt;Person, Long&gt; { @Lock(LockModeType.PESSIMISTIC_WRITE) Person findOne(Long id); } </code></pre></li> </ol> <p>Locking a Entity directly with </p> <pre><code>@Entity @Lock(LockModeType.PESSIMISTIC_WRITE) public class PersonEntity { } </code></pre> <p>is not possible. Therefore you can use 3 (locking inside a repository). </p> <p>Second Question: Is this correct? Did I forgot about a use of a locking? </p> <p>Going on:<br> The idea behind locking is, that other methods/processes have to wait until a lock is released (except by the optimistic lock, here a error is thrown).<br> The Lock is there as long as the instance/object is active or until the next commit.<br> There are two main possibilities to unlock an object: </p> <ol> <li><p>Within an transaction: In this full method the lock is active. But when the return comes, the lock will be removed. </p> <pre><code>@Transactional public void test(){ System.out.println("start, but not locked yet"); PersonEntity person1 = personRepository.findOne(1L); // locks this person or must wait, when locked System.out.println("now locked"); // do something return true; // now the lock will be deleted -&gt; unlocked again } </code></pre></li> <li><p>until the object is deleted: The data will be locked when the object is selected, and the data will be unlocked when the object is deleted. </p> <pre><code>public void test(){ System.out.println("start, but not locked yet"); PersonEntity person1 = personRepository.findOne(1L); // locks this person or must wait, when locked System.out.println("now locked"); // do something person1 = null; // now the lock will be deleted -&gt; unlocked again System.out.println("not locked anymore"); // do something more return true; } </code></pre></li> </ol> <p>Third Questions: is this correct so far? Does this function really can wait then the data is locked? Can an lock really be deleted when the object is set to <code>null</code>? </p> <p>Last words:<br> I really hope I will not annoy somebody. But like I said: it is really difficult for me to understand such complex structures in the english language :(<br> So thanks a lot for help in any form :) I really appreciate any little help. regardless of whether you give me links for more understanding or answering my questions directly :)</p>
0debug
c++ Basic If_else Statements : I am a beginner of c++ This is the line of code I have written using if,else statements #include <iostream> #include <stdio.h> using namespace std; int main() { int a =5; if(a) { printf("if %d\n" , ++a); } else printf("else %d\n" , a); } what happens is if I take int a =5 it prints the value "if 6" and if I Take int a =0 it prints the value "else 0" Why is it happening what is the reason?
0debug
What is the best bitmap size to insert into android studo? : <p>I have a couple images that I am adding to android studio, however, I will the error that, the bitmap is to large. Additionally, larger bitmaps will increase my heap amount and create my app to run slower, therefore, I am asking what the ideal image size to upload is for a reasonable sized bitmap?</p>
0debug
void do_pci_device_hot_remove(Monitor *mon, const QDict *qdict) { pci_device_hot_remove(mon, qdict_get_str(qdict, "pci_addr")); }
1threat
How to ignore dependenies of a specific package with a pipenv : <p>Is there any possibility to install a python package without dependencies with <code>pipenv</code> package manager? I'm looking for an analogue of <code>pip install package_name --no-dependencies</code> for the <code>Pipfile</code>. I already tried to specify with a marker but it raises an exception. </p> <pre><code>[packages] "psycopg2-binary" = "*" "aiopg"={version = "*", markers="--no-dependencies"} </code></pre>
0debug
static int vpc_open(BlockDriverState *bs, int flags) { BDRVVPCState *s = bs->opaque; int i; struct vhd_footer* footer; struct vhd_dyndisk_header* dyndisk_header; uint8_t buf[HEADER_SIZE]; uint32_t checksum; int err = -1; int disk_type = VHD_DYNAMIC; if (bdrv_pread(bs->file, 0, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) goto fail; footer = (struct vhd_footer*) s->footer_buf; if (strncmp(footer->creator, "conectix", 8)) { int64_t offset = bdrv_getlength(bs->file); if (offset < HEADER_SIZE) { goto fail; } if (bdrv_pread(bs->file, offset-HEADER_SIZE, s->footer_buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } if (strncmp(footer->creator, "conectix", 8)) { goto fail; } disk_type = VHD_FIXED; } checksum = be32_to_cpu(footer->checksum); footer->checksum = 0; if (vpc_checksum(s->footer_buf, HEADER_SIZE) != checksum) fprintf(stderr, "block-vpc: The header checksum of '%s' is " "incorrect.\n", bs->filename); footer->checksum = be32_to_cpu(checksum); bs->total_sectors = (int64_t) be16_to_cpu(footer->cyls) * footer->heads * footer->secs_per_cyl; if (bs->total_sectors >= 65535 * 16 * 255) { err = -EFBIG; goto fail; } if (disk_type == VHD_DYNAMIC) { if (bdrv_pread(bs->file, be64_to_cpu(footer->data_offset), buf, HEADER_SIZE) != HEADER_SIZE) { goto fail; } dyndisk_header = (struct vhd_dyndisk_header *) buf; if (strncmp(dyndisk_header->magic, "cxsparse", 8)) { goto fail; } s->block_size = be32_to_cpu(dyndisk_header->block_size); s->bitmap_size = ((s->block_size / (8 * 512)) + 511) & ~511; s->max_table_entries = be32_to_cpu(dyndisk_header->max_table_entries); s->pagetable = g_malloc(s->max_table_entries * 4); s->bat_offset = be64_to_cpu(dyndisk_header->table_offset); if (bdrv_pread(bs->file, s->bat_offset, s->pagetable, s->max_table_entries * 4) != s->max_table_entries * 4) { goto fail; } s->free_data_block_offset = (s->bat_offset + (s->max_table_entries * 4) + 511) & ~511; for (i = 0; i < s->max_table_entries; i++) { be32_to_cpus(&s->pagetable[i]); if (s->pagetable[i] != 0xFFFFFFFF) { int64_t next = (512 * (int64_t) s->pagetable[i]) + s->bitmap_size + s->block_size; if (next > s->free_data_block_offset) { s->free_data_block_offset = next; } } } s->last_bitmap_offset = (int64_t) -1; #ifdef CACHE s->pageentry_u8 = g_malloc(512); s->pageentry_u32 = s->pageentry_u8; s->pageentry_u16 = s->pageentry_u8; s->last_pagetable = -1; #endif } qemu_co_mutex_init(&s->lock); error_set(&s->migration_blocker, QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED, "vpc", bs->device_name, "live migration"); migrate_add_blocker(s->migration_blocker); return 0; fail: return err; }
1threat