problem
stringlengths
26
131k
labels
class label
2 classes
Angular 2 - PrimeNg style not working : <p>I've followed the instruction to install primeng by running <code>npm install primeng --save</code> then importing what I need in the <code>app.module.ts</code> file, for example:</p> <pre><code>import {CheckboxModule} from 'primeng/primeng'; ... imports: [ CheckboxModule, ],... </code></pre> <p>I then add the style sheets to the index.html file:</p> <pre><code>&lt;head&gt; ... &lt;link rel="stylesheet" type="text/css" href="../node_modules/primeng/resources/themes/omega/theme.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="../node_modules/primeng/resources/primeng.min.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="../node_modules/font-awesome/css/font-awesome.min.css" /&gt; &lt;/head&gt; </code></pre> <p>My IDE can find the file location (by holding ctrl and clicking on the href value) but it is not found by the browser (404 error).</p> <p>I've copied the checkbox example (<a href="http://www.primefaces.org/primeng/#/checkbox" rel="noreferrer">http://www.primefaces.org/primeng/#/checkbox</a>) and added it to one of my components but the style is the same as a normal checkbox.</p> <p>Also, no other errors are thrown.</p> <p>Should the styles be added to another file? I'm not sure why it's not working.</p>
0debug
Slider in Python with String Increments? : I’m trying to make a vertical slider with Tkinter that has words as the intervals. For example, a slider that has “maximum” “median” and “minimum” in text as the intervals. Is it possible?
0debug
static int local_set_mapped_file_attrat(int dirfd, const char *name, FsCred *credp) { FILE *fp; int ret; char buf[ATTR_MAX]; int uid = -1, gid = -1, mode = -1, rdev = -1; int map_dirfd; ret = mkdirat(dirfd, VIRTFS_META_DIR, 0700); if (ret < 0 && errno != EEXIST) { return -1; } map_dirfd = openat_dir(dirfd, VIRTFS_META_DIR); if (map_dirfd == -1) { return -1; } fp = local_fopenat(map_dirfd, name, "r"); if (!fp) { if (errno == ENOENT) { goto update_map_file; } else { close_preserve_errno(map_dirfd); return -1; } } memset(buf, 0, ATTR_MAX); while (fgets(buf, ATTR_MAX, fp)) { if (!strncmp(buf, "virtfs.uid", 10)) { uid = atoi(buf + 11); } else if (!strncmp(buf, "virtfs.gid", 10)) { gid = atoi(buf + 11); } else if (!strncmp(buf, "virtfs.mode", 11)) { mode = atoi(buf + 12); } else if (!strncmp(buf, "virtfs.rdev", 11)) { rdev = atoi(buf + 12); } memset(buf, 0, ATTR_MAX); } fclose(fp); update_map_file: fp = local_fopenat(map_dirfd, name, "w"); close_preserve_errno(map_dirfd); if (!fp) { return -1; } if (credp->fc_uid != -1) { uid = credp->fc_uid; } if (credp->fc_gid != -1) { gid = credp->fc_gid; } if (credp->fc_mode != -1) { mode = credp->fc_mode; } if (credp->fc_rdev != -1) { rdev = credp->fc_rdev; } if (uid != -1) { fprintf(fp, "virtfs.uid=%d\n", uid); } if (gid != -1) { fprintf(fp, "virtfs.gid=%d\n", gid); } if (mode != -1) { fprintf(fp, "virtfs.mode=%d\n", mode); } if (rdev != -1) { fprintf(fp, "virtfs.rdev=%d\n", rdev); } fclose(fp); return 0; }
1threat
How to move first element if second is over it : Sorry for my bad english :) 1) Sidebar moves to the right (Start Left position = -270, End position = 0); 2) Header contains logo <div class="head-logo"></div> with position:absolute How to to move logo div to left if sidebar above the logo? [What I need][1] [1]: http://i.stack.imgur.com/t0rJl.png
0debug
Python Unique DF in loop : <p>I am currently writing web scraping code to scrape the PGA Tour website. I have provided a sample of a loop I am using. I would like to create a unique dataframe for every iteration through j. In the end I will have several hundred dataframes. I would like the dataframes to be listed as df1, df2, df3,...</p> <p>I would then like to export all of the dataframes as a csv.</p> <p>Thanks!</p> <pre><code>for j in range(0, 500): for k in range(1,9): try: print(j) df1 = url_base_1 + str(j) + url_base_2 df2 = make_dataframe(df1.format(year), int(k)) print(k) except: pass </code></pre>
0debug
PHP Fatal error, Uncaught Error Exception : <p>This is the error i am getting when i run any script in localhost.My connection is right and in another laptop all the scripts are executing perfectly in localhost.How to solve this error..?</p> <p><a href="http://i.stack.imgur.com/4jZXR.png" rel="nofollow">IMAGE</a></p>
0debug
Does anybody know how to run parallel a Python application? : <p>I would like to use Python for my project but I need to distribute the computation on a set of resources.</p>
0debug
I am trying to make a app which will display my location in app with marker : I am new in android and created a predefined Map project from android studio. This is my code.. public void onMapReady(GoogleMap googleMap) { mMap = googleMap; // Add a marker in Sydney and move the camera LatLng sydney = new LatLng(-34, 151); mMap.getMyLocation(); mMap.addMarker(new MarkerOptions().position(sydney).title("Marker in Sydney")); mMap.moveCamera(CameraUpdateFactory.newLatLng(sydney)); } } I want that instead of sydney my current location to be displayed with that red marker. Please be bit easy as i am completely new. Thanks
0debug
Calculate a calculate column in detail table : How to calculate sum of calcoulated column in detail table Ex. In employee view add column as "calculate column type" his name is "avragesal" it calculate salary*20% How can calculate sum "avragesal"for each department For more explain In employee view Dep_id. Name. Salary. avragesal 100. Jone. 1000. 200 100. XXX. 3000. 600 100. Zzz. 2000. 400 200. Ttt. 500. 100 200. Hhh. 700. 140 200. Ooo. 1200. 240 Iwana in department view Dep_id. Sumavragesal 100 1200 200 480
0debug
Breakpoints set but not yet bound in Visual Studio : <p>Running Visual Studio Community 2017. Created a WebAPI project, have a controller class in there, with some basic stuff, but when I go to run in debug mode, I get the following error on my breakpoints, and I haven't the foggiest idea why.</p> <p><code>The breakpoint will not currently be hit. Breakpoints set but not yet bound.</code></p> <p>I've seen a few answers here and there, but they don't help, or they're about Visual Studio Code, which I am definitely not using. </p> <p>I found <a href="https://docs.microsoft.com/en-us/visualstudio/extensibility/debugger/binding-breakpoints" rel="noreferrer">this</a>, but it doesn't tell me what to do about my problem. How do I fix this issue?</p>
0debug
How to print gagged array elements on a file as matrix or grid : I tried to define the x and y positions for the diagonal edges for each cell in the following picture : [here][1] ... I do not know if my way to obtain these positions is right or not so I need to print the output gagged array on txt file as matrix to check that, I wrote the following code : using System; using System.IO; using System.Text; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Threading; using AUV_Topology; using System.Collections.Generic; namespace AUVtopology { public partial class Form1 : Form { static int[] cellsCenters; static int[] columnsXs; static int[][] rowsXs; public int[][] calculateCellsCenters(int intialPoint,int lastPoint, int numOfcellsEachRow) { FileStream fs = new FileStream("C:/Users/Welcome/Desktop/testPositions.txt", FileMode.Append, FileAccess.Write); int d = lastPoint - intialPoint; int cellSide = d / numOfcellsEachRow; int intialCell = intialPoint - cellSide; columnsXs[0] = intialCell; for (int i = intialPoint; i < lastPoint + cellSide; i += cellSide) { rowsXs[i] = new int[numOfcellsEachRow+1]; } for (int k = intialPoint; k < lastPoint + cellSide; k += cellSide) { for (int j = 0; j < numOfcellsEachRow+1; j++) { columnsXs[j] = columnsXs[j] + cellSide; using (StreamWriter sw = new StreamWriter(fs)) { sw.WriteLine(columnsXs[j]); } } rowsXs[k] = columnsXs; } return rowsXs; } private void selectedPath_Click(object sender, EventArgs e) { calculateCellsCenters(200, 325, 5); } } } I got the following error in the following picture when I pressed the button that call the method which is responsible to make these calculations and print the gagged array : [here][2] ... The details of this error : See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at AUVtopology.Form1.calculateCellsCenters(Int32 intialPoint, Int32 lastPoint, Int32 numOfcellsEachRow) in C:\Users\Welcome\Desktop\project\GAAPS\AUV_Topology\Form1.cs:line 935 at AUVtopology.Form1.selectedPath_Click(Object sender, EventArgs e) in C:\Users\Welcome\Desktop\project\GAAPS\AUV_Topology\Form1.cs:line 975 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 4.0.0.0 Win32 Version: 4.6.1637.0 built by: NETFXREL3STAGE CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll ---------------------------------------- AUV_Topology Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///C:/Users/Welcome/Desktop/project/GAAPS/AUV_Topology/bin/Release/AUV_Topology.exe ---------------------------------------- System.Windows.Forms Assembly Version: 4.0.0.0 Win32 Version: 4.6.1586.0 built by: NETFXREL2 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System Assembly Version: 4.0.0.0 Win32 Version: 4.6.1637.0 built by: NETFXREL3STAGE CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Drawing Assembly Version: 4.0.0.0 Win32 Version: 4.6.1586.0 built by: NETFXREL2 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- Microsoft.VisualBasic.PowerPacks.Vs Assembly Version: 10.0.0.0 Win32 Version: 10.0.30319.1 CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic.PowerPacks.Vs/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.PowerPacks.Vs.dll ---------------------------------------- Microsoft.VisualBasic Assembly Version: 10.0.0.0 Win32 Version: 14.6.1586.0 built by: NETFXREL2 CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll ---------------------------------------- System.Core Assembly Version: 4.0.0.0 Win32 Version: 4.6.1638.0 built by: NETFXREL3STAGE CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll ---------------------------------------- ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration> <system.windows.forms jitDebugging="true" /> </configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box. **Also**, is my code right in which to get the right positions as I mentioned before ?? [1]: https://www.dropbox.com/s/qpwaid5tf2uxie7/grid.png?dl=0 [2]: https://www.dropbox.com/s/4bwwkjvulpkwpfq/ffffff.png?dl=0
0debug
static void pci_ivshmem_exit(PCIDevice *dev) { IVShmemState *s = IVSHMEM(dev); int i; fifo8_destroy(&s->incoming_fifo); if (s->migration_blocker) { migrate_del_blocker(s->migration_blocker); error_free(s->migration_blocker); } if (s->shm_fd >= 0) { void *addr = memory_region_get_ram_ptr(&s->ivshmem); vmstate_unregister_ram(&s->ivshmem, DEVICE(dev)); memory_region_del_subregion(&s->bar, &s->ivshmem); if (munmap(addr, s->ivshmem_size) == -1) { error_report("Failed to munmap shared memory %s", strerror(errno)); } } if (s->eventfd_chr) { for (i = 0; i < s->vectors; i++) { if (s->eventfd_chr[i]) { qemu_chr_free(s->eventfd_chr[i]); } } g_free(s->eventfd_chr); } if (s->peers) { for (i = 0; i < s->nb_peers; i++) { close_peer_eventfds(s, i); } g_free(s->peers); } if (ivshmem_has_feature(s, IVSHMEM_MSI)) { msix_uninit_exclusive_bar(dev); } g_free(s->eventfd_table); }
1threat
static int aac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AACContext *ac = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; int buf_consumed; int buf_offset; int err; int new_extradata_size; const uint8_t *new_extradata = av_packet_get_side_data(avpkt, AV_PKT_DATA_NEW_EXTRADATA, &new_extradata_size); if (new_extradata) { av_free(avctx->extradata); avctx->extradata = av_mallocz(new_extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!avctx->extradata) return AVERROR(ENOMEM); avctx->extradata_size = new_extradata_size; memcpy(avctx->extradata, new_extradata, new_extradata_size); push_output_configuration(ac); if (decode_audio_specific_config(ac, ac->avctx, &ac->oc[1].m4ac, avctx->extradata, avctx->extradata_size*8, 1) < 0) { pop_output_configuration(ac); return AVERROR_INVALIDDATA; } } init_get_bits(&gb, buf, buf_size * 8); if ((err = aac_decode_frame_int(avctx, data, got_frame_ptr, &gb)) < 0) return err; buf_consumed = (get_bits_count(&gb) + 7) >> 3; for (buf_offset = buf_consumed; buf_offset < buf_size; buf_offset++) if (buf[buf_offset]) break; return buf_size > buf_offset ? buf_consumed : buf_size; }
1threat
Why is my code crashing? : <p>I've got a pretty basic question, why is my code crashing? I'm learning to use pointers and I really don't know why the code crashes after I enter the values of x1,x2,y1 and y2 (this happens in case 3 of the second switch). I've looked everywhere and I can't find a reason. I need to send the values entered in function menuLR, case 3 to the function DistDosPuntos, an then return the values to menuLR,case 3. </p> <p>Here's my code.</p> <p>Some of the code is in spanish, however it's not relevant to know how the code is working. In advance thanks for your help and patience, I know this is quite dumb, but I've tried several methods and haven't been able to either solve or understand the problem</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;math.h&gt; void menu1(); void menuLR(); void DistDosPuntos(); void menu1() { int a; float m,x1,x2,y1,y2,k,v,d; printf("MENU PRINCIPAL\n"); printf("1.- La línea Recta \n"); printf("2.- La circunferencia \n"); printf("3.- Coordenaas Polares \n"); printf("4.- Salir\n"); scanf("%d",&amp;a); switch(a) { case 1: menuLR(&amp;m,&amp;x1,&amp;x2,&amp;y1,&amp;y2,&amp;k,&amp;v,&amp;d); break; case 2 : // ; break; case 3 : //; break; case 4 : break ; } } void menuLR (float *m,float*x1,float *x2,float *y1,float*y2,float*k,float *v,float *d) { int b; printf("LA LINEA RECTA\n"); printf("1.- Ecuación de la recta dada su puendiente y un punto de la misma \n"); printf("2.- Ecuación de la recta que pasa por dos puntos\n"); printf("3.- Distancia entre dos puntos del plano \n"); printf("4.- Punto medio entre dos puntos del plano\n"); printf("5.- Perímetro y área de un triángulo en un plano\n"); printf("6.- Regresar al menú principal\n"); scanf("%d",&amp;b); switch (b) { case 1 : printf("Introduzca la pendiente de la recta m y el punto P1(x1,y1)\n"); printf("Introduzca m\n"); scanf("%f",m); printf("Introduzca x1\n"); scanf("%f",x1); printf("Introduzca y1\n"); scanf("%f",y1); printf("La ecuación de la recta es:\n"); printf("y-y1 = m(x-x1)\n"); printf("Sustituyendo valores:\n"); printf("y-%f = %f (x-%f) \n" ,*y1,*m,*x1); printf("Desarrollando y despejando:\n"); *k = ((*m)*(*x1)); printf("y-%f = %fx-%f)\n",*y1,*m,*k); *v= -*k+*y1; printf("y=%fx+(%f)\n",*m,*v); printf("La ecuación de la recta en la forma general 'y=mx+b' es:\n"); printf("y=%fx+(%f)\n",*m,*v); break; case 2 : break; case 3 : printf("Introduzca el punto en el plano P1(X1,Y1)\n"); printf("x1:"); scanf("%f",x1); printf("y1:"); scanf("%f",y1); printf("Introduzca el punto en el plano P2(X2,Y2)\n"); printf("X2:\n"); scanf("%f",x2); printf("Y2:\n"); scanf("%f",y2); DistDosPuntos(&amp;x1,&amp;x2,&amp;y1,&amp;y2,&amp;d); printf("La distancia entre los puntos P1 y P2 es:\n %f",*d); break; case 4 : // exit ; break ; } } void DistDosPuntos(float *x1,float *x2, float *y1, float *y2,float *d) { *d = sqrt(pow((*x2-*x1),2) + pow((*y2-*y1),2)); } int main() { int a,b; float m,x1,y1,k,v,d,y2,x2; menu1(&amp;b,&amp;x1,&amp;y1,&amp;x2,&amp;y2,&amp;m,&amp;k,&amp;v,&amp;d); DistDosPuntos(&amp;x1,&amp;x2,&amp;y1,&amp;y2,&amp;d); return 0; } </code></pre>
0debug
void ff_mdct_calc_c(FFTContext *s, FFTSample *out, const FFTSample *input) { int i, j, n, n8, n4, n2, n3; FFTDouble re, im; const uint16_t *revtab = s->revtab; const FFTSample *tcos = s->tcos; const FFTSample *tsin = s->tsin; FFTComplex *x = (FFTComplex *)out; n = 1 << s->mdct_bits; n2 = n >> 1; n4 = n >> 2; n8 = n >> 3; n3 = 3 * n4; for(i=0;i<n8;i++) { re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]); im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]); j = revtab[i]; CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]); re = RSCALE( input[2*i] - input[n2-1-2*i]); im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]); j = revtab[n8 + i]; CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]); } s->fft_calc(s, x); for(i=0;i<n8;i++) { FFTSample r0, i0, r1, i1; CMUL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]); CMUL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]); x[n8-i-1].re = r0; x[n8-i-1].im = i0; x[n8+i ].re = r1; x[n8+i ].im = i1; } }
1threat
Show Assistant Editor missing in Xcode 11? : <p>In Xcode 10, the toolbar had an inter-locking ring icon which showed the assistant editor, it's missing in Xcode 11. </p> <p><a href="https://i.stack.imgur.com/Qi19p.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Qi19p.png" alt="Xcode 10"></a></p> <p><a href="https://i.stack.imgur.com/T6ZBX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/T6ZBX.png" alt="Xcode 11"></a></p>
0debug
Getting data with Jsoup : my android project is having problems with Jsoup. I have a method that gets the data and then puts that data in the gui. Problem i have had is it doesnt wait for the data to be retrieved. I put it in a AsyncTask with the background method using the get data method and on post method using that data. The return on the background method is a arraylist of objects that have the information from the jsoup method.
0debug
How can be solved java.lang.NoClassDefFoundError: javax/annotation/Generated? : <p>I`ve changed jdk to a 9 version in my project and then collided with an error :</p> <pre><code>Error:java: java.lang.NoClassDefFoundError: javax/annotation/Generated </code></pre> <p>I try to solve it by the adding following to pom.com but it wasn`t work for me: </p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt; &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt; &lt;version&gt;${version.compiler.plugin}&lt;/version&gt; &lt;configuration&gt; &lt;!-- fork is needed so compiler args can be used --&gt; &lt;fork&gt;true&lt;/fork&gt; &lt;compilerArgs&gt; &lt;arg&gt;-J--add-modules&lt;/arg&gt; &lt;arg&gt;-Jjava.annotations.common&lt;/arg&gt; &lt;/compilerArgs&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre> <p>Does it have other way to solve? </p>
0debug
PHP - How to concatenation 2 php var for create a new php var? : <p>PHP - How to concatenation 2 php var for create a new php var?</p> <p>I want to concatenation <code>$test</code> with <code>$i</code> for create a new php var.</p> <p>like this but not work, how can i do ?</p> <pre><code>&lt;?PHP $i = "5"; $test_$i = "WELCOME"; echo $test_5; ?&gt; </code></pre>
0debug
What is the most efficient way to use database? : <p>I'm new to using a database, specifically MySQL. I'm creating a web application for class in which you can look up the name of a book and it'll display the summary of the book. My question is should I send a query to the database that collects all of the books' data on initialization and put them into a HashMap inside a manager class for lookup or should I use a query each time to lookup a specific book information?</p>
0debug
static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_index) { if (s->correct_ts_overflow && st->pts_wrap_bits < 63 && st->pts_wrap_reference == AV_NOPTS_VALUE && st->first_dts != AV_NOPTS_VALUE) { int i; int64_t pts_wrap_reference = st->first_dts - av_rescale(60, st->time_base.den, st->time_base.num); int pts_wrap_behavior = (st->first_dts < (1LL<<st->pts_wrap_bits) - (1LL<<st->pts_wrap_bits-3)) || (st->first_dts < (1LL<<st->pts_wrap_bits) - av_rescale(60, st->time_base.den, st->time_base.num)) ? AV_PTS_WRAP_ADD_OFFSET : AV_PTS_WRAP_SUB_OFFSET; AVProgram *first_program = av_find_program_from_stream(s, NULL, stream_index); if (!first_program) { int default_stream_index = av_find_default_stream_index(s); if (s->streams[default_stream_index]->pts_wrap_reference == AV_NOPTS_VALUE) { for (i=0; i<s->nb_streams; i++) { s->streams[i]->pts_wrap_reference = pts_wrap_reference; s->streams[i]->pts_wrap_behavior = pts_wrap_behavior; } } else { st->pts_wrap_reference = s->streams[default_stream_index]->pts_wrap_reference; st->pts_wrap_behavior = s->streams[default_stream_index]->pts_wrap_behavior; } } else { AVProgram *program = first_program; while (program) { if (program->pts_wrap_reference != AV_NOPTS_VALUE) { pts_wrap_reference = program->pts_wrap_reference; pts_wrap_behavior = program->pts_wrap_behavior; break; } program = av_find_program_from_stream(s, program, stream_index); } program = first_program; while(program) { if (program->pts_wrap_reference != pts_wrap_reference) { for (i=0; i<program->nb_stream_indexes; i++) { s->streams[program->stream_index[i]]->pts_wrap_reference = pts_wrap_reference; s->streams[program->stream_index[i]]->pts_wrap_behavior = pts_wrap_behavior; } program->pts_wrap_reference = pts_wrap_reference; program->pts_wrap_behavior = pts_wrap_behavior; } program = av_find_program_from_stream(s, program, stream_index); } } return 1; } return 0; }
1threat
format Exception Error it appears when i try to send convert whats in TextBox1 in first form(into) : the program suppose to take +ve number from textbox1 in info form and send it to HR form to use it as array size(handled Error with try catch) but when i run the program it gives Error however i tried to send string then convert it in HR form instead of send it as shown in pic it gives Error in converting line //first form(info) ` HR frm=new HR(textBox1.Text); frm.show(); this.close();` //2nd form(HR) ` static int size=0; public HR(string emplyee_num) { InitializeComponent(); size =Convert.ToInt16(emplyee_num);//Error appear her instead } ` so how can i fix that Error and whats the reason [Error in original code][1] [1]: https://i.stack.imgur.com/hUWWm.png
0debug
the adapter does work? : **i get the input from the user and set them in a list view but when i click in the button does work NO Errors just open the layout and close direct but when a try with "arrayAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,m_list);" is work perfect can you please tell me where im wrong thank you im New in Android** public class HomeChat extends AppCompatActivity { ListView listView; EditText writeSms; ArrayAdapter<String> arrayAdapter; ArrayList<String> m_list = new ArrayList<String>(); String emriUser; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_chat); writeSms = (EditText) findViewById(R.id.shkrunSms); listView = (ListView) findViewById(R.id.listView); emriUser = getIntent().getExtras().getString("emri"); arrayAdapter = new ArrayAdapter<String>(this,R.layout.list_chat,m_list); listView.setAdapter(arrayAdapter); } public void sentSmsButton(View view) { String mesazhet = emriUser + ": " + writeSms.getText().toString(); if (writeSms != null && writeSms.length() > 0) { m_list.add(mesazhet); arrayAdapter.notifyDataSetChanged(); writeSms.setText(""); }else { Toast.makeText(getApplicationContext(),"Something Wrong",Toast.LENGTH_LONG).show(); } } } **and this is the list chat layout** <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/test123" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#000" android:background="#cccccc" android:paddingTop="5dp" android:paddingBottom="5dp" android:paddingLeft="5dp" android:paddingRight="5dp" /> </LinearLayout>
0debug
ZREMRANGEBYRANK difference between ZREMRANGEBYSCORE redis sorted set? : Whats to know what the differnce between the two 127.0.0.1:6379> ZRANGEBYSCORE my 1 10 WITHSCORES 1) "b" 2) "1" 3) "a" 4) "4" For above input
0debug
static void opt_frame_pad_right(const char *arg) { frame_padright = atoi(arg); if (frame_padright < 0) { fprintf(stderr, "Incorrect right pad size\n"); av_exit(1); } }
1threat
I'm trying to create a program that creates anagrams from a string of words : <p>I'm new to python - so from a list of predetermined words jumble the letters and return the jumbled letters.</p>
0debug
void OPPROTO op_jz_T0_label(void) { if (!T0) GOTO_LABEL_PARAM(1); FORCE_RET(); }
1threat
why pt font is smaller than px font in JTextPane when using the same number? : public static void main(String[] args) { JFrame frame = new JFrame("Test"); JTextPane pane = new JTextPane(); pane.setContentType("text/html"); pane.setText("<html>" + "<head>" + "<title> New Document </title>" + "</head>" + "<body>" + "<div style=\"font-size:20pt\">bbbbbbbb-20pt</div>" + "<div style=\"font-size:20px\">bbbbbbbb-20px</div>" + "</body>" + "</html>"); frame.add(pane, BorderLayout.CENTER); frame.setSize(500, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } the frame show: [enter image description here][1] but the same content of html show in browser are different: [enter image description here][2] [1]: https://i.stack.imgur.com/XNaVF.jpg [2]: https://i.stack.imgur.com/kNta6.jpg
0debug
Filtration of multilevel json array in javascript : i am trying to duplicate value only one time as well as unique from my json array. i have tried the following code. return_data = {}; return_data.planner = [{ "date": "2019-08-30T12:10:08.000Z", "event": [{ "name": "Event 1", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" }] }, { "date": "2019-09-30T10:10:08.000Z", "event": [{ "name": "Event 5", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" }, { "name": "Event 4", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" }, { "name": "Event 3", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" } ] }, { "date": "2019-09-30T10:10:08.000Z", "event": [{ "name": "Event 5", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" }, { "name": "Event 4", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" }, { "name": "Event 3", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" } ] }, { "date": "2019-09-30T10:10:08.000Z", "event": [{ "name": "Event 5", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" }, { "name": "Event 4", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" }, { "name": "Event 3", "desc": "Lorem Ipsum is simply dummy text of the printing and typesetting standard dummy text ever since the 1500s", "color": "#ccccc" } ] } ] res.header('Content-Type', 'application/json'); res.send(JSON.stringify(return_data)); // using above json array. var u_array = []; var tem = JSON.parse(JSON.stringify(return_data.response.planner)); for (var i = 0; i < tem.length; i++) { console.log(tem[i].date); var status = true; for (var j = 0; j < u_array.length; j++) { if (u_array[j].date == tem[i].date) { status = false; break; } } if (status) { u_array.push(tem[i]); } }; return_data.response.planner = u_array; i expect the duplicate value only one time with unique values.
0debug
static GenericList *qmp_output_next_list(Visitor *v, GenericList *tail, size_t size) { return tail->next; }
1threat
Using Tensorflow Huber loss in Keras : <p>I am trying to use huber loss in a keras model (writing DQN), but I am getting bad result, I think I am something doing wrong. My is code is below.</p> <pre><code>model = Sequential() model.add(Dense(output_dim=64, activation='relu', input_dim=state_dim)) model.add(Dense(output_dim=number_of_actions, activation='linear')) loss = tf.losses.huber_loss(delta=1.0) model.compile(loss=loss, opt='sgd') return model </code></pre>
0debug
db.execute('SELECT * FROM employees WHERE id = ' + user_input)
1threat
tell typescript to compile json files : <p>The typescript compiler works fine when I import a json file using</p> <pre><code>const tasks = require('./tasks.json') </code></pre> <p>However, when I run <code>tsc</code>, the output directory does not contain no <code>tasks.json</code> file, causing a runtime error.</p> <p>Is there a way to tell the compiler that it should copy all json files, or should I manually copy/paste all my json files into the <code>dist</code> directory ?</p> <p>my tsc compilerOptions currently reads</p> <pre><code> "compilerOptions": { "target": "es6", "module": "commonjs", "sourceMap": true, "noImplicitAny": true, "removeComments": false, "outDir": "./dist/", "sourceMap": true, "pretty": true, "noImplicitThis": true, "strictNullChecks": true, "sourceMap": true }, </code></pre> <p>Thanks !</p>
0debug
static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, QDict *options, int flags, BlockDriver *drv, Error **errp) { int ret, open_flags; const char *filename; const char *node_name = NULL; Error *local_err = NULL; assert(drv != NULL); assert(bs->file == NULL); assert(options != NULL && bs->options != options); if (file != NULL) { filename = file->filename; } else { filename = qdict_get_try_str(options, "filename"); if (drv->bdrv_needs_filename && !filename) { error_setg(errp, "The '%s' block driver requires a file name", drv->format_name); return -EINVAL; trace_bdrv_open_common(bs, filename ?: "", flags, drv->format_name); node_name = qdict_get_try_str(options, "node-name"); bdrv_assign_node_name(bs, node_name, &local_err); if (local_err) { error_propagate(errp, local_err); return -EINVAL; qdict_del(options, "node-name"); if (file != NULL && drv->bdrv_file_open) { bdrv_swap(file, bs); return 0; bs->open_flags = flags; bs->guest_block_size = 512; bs->request_alignment = 512; bs->zero_beyond_eof = true; open_flags = bdrv_open_flags(bs, flags); bs->read_only = !(open_flags & BDRV_O_RDWR); if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) { error_setg(errp, !bs->read_only && bdrv_is_whitelisted(drv, true) ? "Driver '%s' can only be used for read-only devices" : "Driver '%s' is not whitelisted", drv->format_name); return -ENOTSUP; assert(bs->copy_on_read == 0); if (flags & BDRV_O_COPY_ON_READ) { if (!bs->read_only) { bdrv_enable_copy_on_read(bs); } else { error_setg(errp, "Can't use copy-on-read on read-only device"); return -EINVAL; if (filename != NULL) { pstrcpy(bs->filename, sizeof(bs->filename), filename); } else { bs->filename[0] = '\0'; pstrcpy(bs->exact_filename, sizeof(bs->exact_filename), bs->filename); bs->drv = drv; bs->opaque = g_malloc0(drv->instance_size); bs->enable_write_cache = !!(flags & BDRV_O_CACHE_WB); if (drv->bdrv_file_open) { assert(file == NULL); assert(!drv->bdrv_needs_filename || filename != NULL); ret = drv->bdrv_file_open(bs, options, open_flags, &local_err); } else { if (file == NULL) { error_setg(errp, "Can't use '%s' as a block driver for the " "protocol level", drv->format_name); ret = -EINVAL; goto free_and_fail; bs->file = file; ret = drv->bdrv_open(bs, options, open_flags, &local_err); if (ret < 0) { if (local_err) { error_propagate(errp, local_err); } else if (bs->filename[0]) { error_setg_errno(errp, -ret, "Could not open '%s'", bs->filename); } else { error_setg_errno(errp, -ret, "Could not open image"); goto free_and_fail; ret = refresh_total_sectors(bs, bs->total_sectors); if (ret < 0) { error_setg_errno(errp, -ret, "Could not refresh total sector count"); goto free_and_fail; bdrv_refresh_limits(bs, &local_err); if (local_err) { error_propagate(errp, local_err); ret = -EINVAL; goto free_and_fail; assert(bdrv_opt_mem_align(bs) != 0); assert((bs->request_alignment != 0) || bs->sg); return 0; free_and_fail: bs->file = NULL; g_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret;
1threat
static BOOTPClient *get_new_addr(struct in_addr *paddr) { BOOTPClient *bc; int i; for(i = 0; i < NB_ADDR; i++) { if (!bootp_clients[i].allocated) goto found; } return NULL; found: bc = &bootp_clients[i]; bc->allocated = 1; paddr->s_addr = htonl(ntohl(special_addr.s_addr) | (i + START_ADDR)); return bc; }
1threat
void net_rx_pkt_dump(struct NetRxPkt *pkt) { #ifdef NET_RX_PKT_DEBUG assert(pkt); printf("RX PKT: tot_len: %d, vlan_stripped: %d, vlan_tag: %d\n", pkt->tot_len, pkt->vlan_stripped, pkt->tci); #endif }
1threat
3 Arguments - Calculating BMI - Phython : So basically Im trying to create a program which should do the following in phython: A Program that contains a function called calculate_bmi which when it is called, has three arguments - the first argument is an integer variable containing the height in feet, the second argument is an integer variable containing the height in inches, the third argument is the person's weight in pounds. The main program asks the user to enter feet, then inches, then pounds. These variables are then sent to the function. The function calculates and prints the BMI value. This is my code below im trying to do but no luck, i cannot seem to convert the height to feet as well. any help would really be appreciated. def calculate_bmi(): height_feet = int(input("Please enter height in feet")) height_inches = int(input("Please enter height in inches")) weight_pounds = int(input("Please enter weight in pounds")) calculate_bmi(height_feet,height_inches,weight_pounds) bmi = (weight_pounds / height_inches) * 703 print (bmi)
0debug
Angular-cli : Using ng lint : <p>I'm aware the angular-cli uses codelyzer which uses lint.js</p> <p>When using the command: <code>ng lint</code></p> <p>Can it automatically fix formatting? or will it only notify of formatting errors?</p> <p><code>ng lint --help</code> outputs all help commands for the angular-cli.</p>
0debug
Gradle cannot resolve the most recent Firebase libraries , i.e, versions of 9.4.0 : <p>I am trying to upgrade my Firebase libraries to the new 9.4.0 version; however, I get the "can't resolve" error in Gradle upon syncing. Here's the error: </p> <pre><code>Error:(38, 13) Failed to resolve: com.google.firebase:firebase-core:9.4.0 Error:(40, 13) Failed to resolve: com.google.firebase:firebase-auth:9.4.0 Error:(40, 13) Failed to resolve: com.google.firebase:firebase-storage:9.4.0 </code></pre> <p>Tried with and without firebase-core, no difference. </p> <p>Here's my Gradle for both app and project level: project level:</p> <pre><code> buildscript { repositories { jcenter() mavenLocal() } dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() mavenLocal() } } task clean(type: Delete) { delete rootProject.buildDir } </code></pre> <p>and for the module:app level: apply plugin: 'com.android.application'</p> <pre><code> android { compileSdkVersion 24 buildToolsVersion "24.0.0" defaultConfig { applicationId "com.example.main.projectone" minSdkVersion 18 targetSdkVersion 24 versionCode 1 versionName "1.0" multiDexEnabled true } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) testCompile 'junit:junit:4.12' // compile 'com.google.android.gms:play-services-gcm:9.2.0' // compile 'com.google.android.gms:play-services:9.2.1' compile('com.facebook.android:facebook-android-sdk:4.7.0') { exclude module: 'bolts-android' } // compile 'com.fasterxml.jackson.core:jackson-core:2.8.1' // compile 'com.fasterxml.jackson.core:jackson-databind:2.8.1' compile 'com.android.support:appcompat-v7:24.0.0' compile 'com.google.firebase:firebase-core:9.4.0' compile 'com.google.firebase:firebase-auth:9.4.0' compile 'com.google.firebase:firebase-storage:9.4.0' compile 'com.android.support:design:24.0.0' compile 'com.parse:parse-android:1.13.0' compile 'com.github.bumptech.glide:glide:3.7.0' compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar' compile 'com.squareup.okhttp3:okhttp:3.3.1' compile 'com.android.support:cardview-v7:24.0.0' compile 'com.android.support:support-v4:24.0.0' compile 'com.google.android.gms:play-services:9.2.1' compile 'com.android.support:multidex:1.0.1' compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.1' compile 'de.hdodenhof:circleimageview:2.1.0' compile 'com.android.support:recyclerview-v7:24.0.0' } apply plugin: 'com.google.gms.google-services' </code></pre> <p>Any idea why Gradle cannot resolve the libraries? Here's Firebase website addressing them <a href="https://firebase.google.com/docs/android/setup" rel="noreferrer">Firebase Newest Libs</a>. Appreciate your help. </p>
0debug
static void v9fs_lcreate(void *opaque) { int32_t dfid, flags, mode; gid_t gid; ssize_t err = 0; ssize_t offset = 7; V9fsString name; V9fsFidState *fidp; struct stat stbuf; V9fsQID qid; int32_t iounit; V9fsPDU *pdu = opaque; pdu_unmarshal(pdu, offset, "dsddd", &dfid, &name, &flags, &mode, &gid); trace_v9fs_lcreate(pdu->tag, pdu->id, dfid, flags, mode, gid); fidp = get_fid(pdu, dfid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } flags = get_dotl_openflags(pdu->s, flags); err = v9fs_co_open2(pdu, fidp, &name, gid, flags | O_CREAT, mode, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = flags; if (flags & O_EXCL) { fidp->flags |= FID_NON_RECLAIMABLE; } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); offset += pdu_marshal(pdu, offset, "Qd", &qid, iounit); err = offset; trace_v9fs_lcreate_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit); out: put_fid(pdu, fidp); out_nofid: complete_pdu(pdu->s, pdu, err); v9fs_string_free(&name); }
1threat
void qmp_nbd_server_start(SocketAddressLegacy *addr, bool has_tls_creds, const char *tls_creds, Error **errp) { if (nbd_server) { error_setg(errp, "NBD server already running"); return; } nbd_server = g_new0(NBDServerData, 1); nbd_server->watch = -1; nbd_server->listen_ioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(nbd_server->listen_ioc), "nbd-listener"); if (qio_channel_socket_listen_sync( nbd_server->listen_ioc, addr, errp) < 0) { goto error; } if (has_tls_creds) { nbd_server->tlscreds = nbd_get_tls_creds(tls_creds, errp); if (!nbd_server->tlscreds) { goto error; } if (addr->type != SOCKET_ADDRESS_LEGACY_KIND_INET) { error_setg(errp, "TLS is only supported with IPv4/IPv6"); goto error; } } nbd_server->watch = qio_channel_add_watch( QIO_CHANNEL(nbd_server->listen_ioc), G_IO_IN, nbd_accept, NULL, NULL); return; error: nbd_server_free(nbd_server); nbd_server = NULL; }
1threat
static void pty_chr_close(struct CharDriverState *chr) { PtyCharDriver *s = chr->opaque; int fd; remove_fd_in_watch(chr); fd = g_io_channel_unix_get_fd(s->fd); g_io_channel_unref(s->fd); close(fd); if (s->timer_tag) { g_source_remove(s->timer_tag); s->timer_tag = 0; } g_free(s); qemu_chr_be_event(chr, CHR_EVENT_CLOSED); }
1threat
static uint64_t vmxnet3_get_command_status(VMXNET3State *s) { uint64_t ret; switch (s->last_command) { case VMXNET3_CMD_ACTIVATE_DEV: ret = (s->device_active) ? 0 : -1; VMW_CFPRN("Device active: %" PRIx64, ret); break; case VMXNET3_CMD_RESET_DEV: case VMXNET3_CMD_QUIESCE_DEV: case VMXNET3_CMD_GET_QUEUE_STATUS: ret = 0; break; case VMXNET3_CMD_GET_LINK: ret = s->link_status_and_speed; VMW_CFPRN("Link and speed: %" PRIx64, ret); break; case VMXNET3_CMD_GET_PERM_MAC_LO: ret = vmxnet3_get_mac_low(&s->perm_mac); break; case VMXNET3_CMD_GET_PERM_MAC_HI: ret = vmxnet3_get_mac_high(&s->perm_mac); break; case VMXNET3_CMD_GET_CONF_INTR: ret = vmxnet3_get_interrupt_config(s); break; case VMXNET3_CMD_GET_ADAPTIVE_RING_INFO: ret = VMXNET3_DISABLE_ADAPTIVE_RING; break; default: VMW_WRPRN("Received request for unknown command: %x", s->last_command); ret = -1; break; } return ret; }
1threat
How to create quintile of variable in R : <p>Is it possible to bin a variable in to quintile (1/5th) using R. And select only the variables that fall in the 5th bin.</p> <ul> <li>As of now I am using the closest option which is quartile (.75) as there is not a function to do quintile. </li> </ul> <p>Any suggestions please. </p>
0debug
How to run python program in IOS Swift app : <p>I’m an amateur coder working on a project right now, and I was wondering if you could help me.</p> <p>Basically, I’ve been doing a lot of research on a particular algorithm that I find runs much faster using Python. The goal is to get this Python code to run in my IOS application. What I’ve found is that the Python interpreter has to be embedded with the Swift application in order to do this. However, I haven’t found much useful documentation or other sources on how to do this. Do you have any suggestions or advice? </p>
0debug
static inline void code_gen_alloc(size_t tb_size) { code_gen_buffer_size = size_code_gen_buffer(tb_size); code_gen_buffer = alloc_code_gen_buffer(); if (code_gen_buffer == NULL) { fprintf(stderr, "Could not allocate dynamic translator buffer\n"); exit(1); } map_exec(code_gen_prologue, sizeof(code_gen_prologue)); code_gen_buffer_max_size = code_gen_buffer_size - (TCG_MAX_OP_SIZE * OPC_BUF_SIZE); code_gen_max_blocks = code_gen_buffer_size / CODE_GEN_AVG_BLOCK_SIZE; tbs = g_malloc(code_gen_max_blocks * sizeof(TranslationBlock)); }
1threat
missing logout page in view/users in cakephp : i am working on cakephp and while clicking on logout button url goes to some other address http://demo4sbc.com.Because there is no logout.ctp present in view/users, so can any one can tell me the coding for logout.ctp page.
0debug
static void reschedule_dma(void *opaque) { DMAAIOCB *dbs = (DMAAIOCB *)opaque; qemu_bh_delete(dbs->bh); dbs->bh = NULL; dma_bdrv_cb(opaque, 0); }
1threat
static void tb_invalidate_phys_page(tb_page_addr_t addr, uintptr_t pc, void *puc) { TranslationBlock *tb; PageDesc *p; int n; #ifdef TARGET_HAS_PRECISE_SMC TranslationBlock *current_tb = NULL; CPUState *cpu = current_cpu; CPUArchState *env = NULL; int current_tb_modified = 0; target_ulong current_pc = 0; target_ulong current_cs_base = 0; int current_flags = 0; #endif addr &= TARGET_PAGE_MASK; p = page_find(addr >> TARGET_PAGE_BITS); if (!p) { return; } tb = p->first_tb; #ifdef TARGET_HAS_PRECISE_SMC if (tb && pc != 0) { current_tb = tb_find_pc(pc); } if (cpu != NULL) { env = cpu->env_ptr; } #endif while (tb != NULL) { n = (uintptr_t)tb & 3; tb = (TranslationBlock *)((uintptr_t)tb & ~3); #ifdef TARGET_HAS_PRECISE_SMC if (current_tb == tb && (current_tb->cflags & CF_COUNT_MASK) != 1) { current_tb_modified = 1; cpu_restore_state_from_tb(current_tb, env, pc); cpu_get_tb_cpu_state(env, &current_pc, &current_cs_base, &current_flags); } #endif tb_phys_invalidate(tb, addr); tb = tb->page_next[n]; } p->first_tb = NULL; #ifdef TARGET_HAS_PRECISE_SMC if (current_tb_modified) { cpu->current_tb = NULL; tb_gen_code(env, current_pc, current_cs_base, current_flags, 1); cpu_resume_from_signal(env, puc); } #endif }
1threat
Transpose in R grouping by row and column : <p>How do I transpose the data-frame with the following condition in R? The normal transpose doesn't work in this case. </p> <p><a href="http://i.stack.imgur.com/WITFm.jpg" rel="nofollow">Current data</a></p> <p><a href="http://i.stack.imgur.com/4mVJO.jpg" rel="nofollow">Expected output</a></p> <p>Thanks!</p>
0debug
Cause: error=2, No such file or directory : When the gradle is build I am receiving an Error (Cause: error=2, No such file or directory) and the application is not installed, I using android studio 3.1 and ubuntu 16.04.
0debug
static size_t write_to_port(VirtIOSerialPort *port, const uint8_t *buf, size_t size) { VirtQueueElement elem; VirtQueue *vq; size_t offset = 0; size_t len = 0; vq = port->ivq; if (!virtio_queue_ready(vq)) { return 0; } if (!size) { return 0; } while (offset < size) { int i; if (!virtqueue_pop(vq, &elem)) { break; } for (i = 0; offset < size && i < elem.in_num; i++) { len = MIN(elem.in_sg[i].iov_len, size - offset); memcpy(elem.in_sg[i].iov_base, buf + offset, len); offset += len; } virtqueue_push(vq, &elem, len); } virtio_notify(&port->vser->vdev, vq); return offset; }
1threat
Python 3.6 conversion : How would you convert Python 2.7 to Python 3.6.5? Here, I am trying to query a set of NTP time servers and determine which one is the outlier. It is probably a few simple changes but I am unsure.. from contextlib import closing from socket import socket, AF_INET, SOCK_DGRAM import sys import struct import time NTP_PACKET_FORMAT = "!12I" NTP_DELTA = 2208988800L # 1970-01-01 00:00:00 NTP_QUERY = '\x1b' + 47 * '\0' def ntp_time(host="pool.ntp.org", port=123): with closing(socket( AF_INET, SOCK_DGRAM)) as s: s.sendto(NTP_QUERY, (host, port)) msg, address = s.recvfrom(1024) unpacked = struct.unpack(NTP_PACKET_FORMAT, msg[0:struct.calcsize(NTP_PACKET_FORMAT)]) return unpacked[10] + float(unpacked[11]) / 2**32 - NTP_DELTA if __name__ == "__main__": print time.ctime(ntp_time()).replace(" "," ")
0debug
A database schema vs a database tablespace? : <p>Doing my databases reading when I read...</p> <p>Schema: Is a container for objects</p> <p>Tablespace: A logical storage unit for objects</p> <p>Can anyone explain the difference between these?</p>
0debug
def camel_to_snake(text): import re str1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', text) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', str1).lower()
0debug
static void strongarm_gpio_handler_update(StrongARMGPIOInfo *s) { uint32_t level, diff; int bit; level = s->olevel & s->dir; for (diff = s->prev_level ^ level; diff; diff ^= 1 << bit) { bit = ffs(diff) - 1; qemu_set_irq(s->handler[bit], (level >> bit) & 1); } s->prev_level = level; }
1threat
How to write a "bash script.sh argument " : <p>hi can someone help me with this.</p> <p>How to Write a script that takes in as argument a filename and displays its modification date and time in this way exactly :</p> <pre><code>[user@localhost...]$ bash script.sh temp.txt the file temp.txt was modified on May 1 20:20 </code></pre> <p>And then modify that script in such a way that it lists the modification dates for directories whose names contain a given pattern in this way exactly :</p> <pre><code>[user@local....]$ bash script.sh testRegex Pub the file testRegex was modified on May 1 20:22 the directory /home/user/Public was modified on Dec 26 08:00 the directory /home/user/Pubs. was modified on May 2 20:00 </code></pre> <p>please help I need to answer this fast</p> <p>Thanks</p>
0debug
static void vhost_dev_sync_region(struct vhost_dev *dev, uint64_t mfirst, uint64_t mlast, uint64_t rfirst, uint64_t rlast) { uint64_t start = MAX(mfirst, rfirst); uint64_t end = MIN(mlast, rlast); vhost_log_chunk_t *from = dev->log + start / VHOST_LOG_CHUNK; vhost_log_chunk_t *to = dev->log + end / VHOST_LOG_CHUNK + 1; uint64_t addr = (start / VHOST_LOG_CHUNK) * VHOST_LOG_CHUNK; assert(end / VHOST_LOG_CHUNK < dev->log_size); assert(start / VHOST_LOG_CHUNK < dev->log_size); if (end < start) { return; } for (;from < to; ++from) { vhost_log_chunk_t log; int bit; if (!*from) { addr += VHOST_LOG_CHUNK; continue; } log = __sync_fetch_and_and(from, 0); while ((bit = sizeof(log) > sizeof(int) ? ffsll(log) : ffs(log))) { bit -= 1; cpu_physical_memory_set_dirty(addr + bit * VHOST_LOG_PAGE); log &= ~(0x1ull << bit); } addr += VHOST_LOG_CHUNK; } }
1threat
static int xvag_read_header(AVFormatContext *s) { unsigned offset, big_endian, codec; AVStream *st; avio_skip(s->pb, 4); st = avformat_new_stream(s, NULL); if (!st) return AVERROR(ENOMEM); st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; offset = avio_rl32(s->pb); big_endian = offset > av_bswap32(offset); if (big_endian) { offset = av_bswap32(offset); avio_skip(s->pb, 28); codec = avio_rb32(s->pb); st->codecpar->channels = avio_rb32(s->pb); avio_skip(s->pb, 4); st->duration = avio_rb32(s->pb); avio_skip(s->pb, 8); st->codecpar->sample_rate = avio_rb32(s->pb); } else { avio_skip(s->pb, 28); codec = avio_rl32(s->pb); st->codecpar->channels = avio_rl32(s->pb); avio_skip(s->pb, 4); st->duration = avio_rl32(s->pb); avio_skip(s->pb, 8); st->codecpar->sample_rate = avio_rl32(s->pb); } if (st->codecpar->sample_rate <= 0) return AVERROR_INVALIDDATA; if (st->codecpar->channels <= 0) return AVERROR_INVALIDDATA; switch (codec) { case 0x1c: st->codecpar->codec_id = AV_CODEC_ID_ADPCM_PSX; st->codecpar->block_align = 16 * st->codecpar->channels; break; default: avpriv_request_sample(s, "codec %X", codec); return AVERROR_PATCHWELCOME; }; avio_skip(s->pb, offset - avio_tell(s->pb)); if (avio_rb16(s->pb) == 0xFFFB) { st->codecpar->codec_id = AV_CODEC_ID_MP3; st->codecpar->block_align = 0x1000; st->need_parsing = AVSTREAM_PARSE_FULL_RAW; } avio_skip(s->pb, -2); avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate); return 0; }
1threat
static int apply_color_indexing_transform(WebPContext *s) { ImageContext *img; ImageContext *pal; int i, x, y; uint8_t *p, *pi; img = &s->image[IMAGE_ROLE_ARGB]; pal = &s->image[IMAGE_ROLE_COLOR_INDEXING]; if (pal->size_reduction > 0) { GetBitContext gb_g; uint8_t *line; int pixel_bits = 8 >> pal->size_reduction; line = av_malloc(img->frame->linesize[0]); if (!line) return AVERROR(ENOMEM); for (y = 0; y < img->frame->height; y++) { p = GET_PIXEL(img->frame, 0, y); memcpy(line, p, img->frame->linesize[0]); init_get_bits(&gb_g, line, img->frame->linesize[0] * 8); skip_bits(&gb_g, 16); i = 0; for (x = 0; x < img->frame->width; x++) { p = GET_PIXEL(img->frame, x, y); p[2] = get_bits(&gb_g, pixel_bits); i++; if (i == 1 << pal->size_reduction) { skip_bits(&gb_g, 24); i = 0; } } } av_free(line); } for (y = 0; y < img->frame->height; y++) { for (x = 0; x < img->frame->width; x++) { p = GET_PIXEL(img->frame, x, y); i = p[2]; if (i >= pal->frame->width) { av_log(s->avctx, AV_LOG_ERROR, "invalid palette index %d\n", i); return AVERROR_INVALIDDATA; } pi = GET_PIXEL(pal->frame, i, 0); AV_COPY32(p, pi); } } return 0; }
1threat
static void h261_h_loop_filter_c(uint8_t *dest,uint8_t *src, int stride){ int i,j,xy,yz; int res; for(i=1; i<7; i++){ for(j=0; j<8; j++){ xy = j * stride + i; yz = j * 8 + i; res = (int)src[yz-1] + ((int)(src[yz]) *2) + (int)src[yz+1]; res+=2; res>>=2; dest[xy] = (uint8_t)res; } } }
1threat
How to remove html effect from a string using php? : <p>I am trying to display short description without any <strong>markup</strong> in read-more section. I want to display small portion of content. </p> <p>Content Looks like:</p> <blockquote> <p><strong>This is my car.</strong> <em>This may be a</em> <strike>funny</strike> <em>content</em>. This is a demo text. This is a demo text. </p> <p>This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text. This is a demo text.</p> </blockquote> <p>Readmore Looks Like:</p> <blockquote> <p>This is my car. This may be a funny content.</p> </blockquote> <p>My question is how to remove the effect of html and display a normal string.</p>
0debug
UINaviagationBar ignoring background color settings : <p>ios 13, objective-c, can't get the navigation bar background color set.</p> <p>I've tried setting the color via the UI in interface builder, and several examples off the web (and here).</p> <pre><code>UINavigationBarAppearance* navBarAppearance = [self.navigationController.navigationBar standardAppearance]; navBarAppearance.backgroundColor = [UIColor colorWithRed:172.0f green:193.0f blue:197.0f alpha:1.0f]; </code></pre> <p>I would expect the above code to set the background color, but it's still white.</p>
0debug
Does Java rearrange? : Suppose I have a priority queue class Node{ public int id; public int dist = Integer.MAX_VALUE; public Node(int id) { this.id = id; } } Queue<Node> q = new PriorityQueue<>((a, b) -> Integer.compare(a.dist, b.dist)); Then if I did (suppose one/two are nodes objects) one.dist = 1; two.dist = 2; q.offer(one); q.offer(two); two.dist = -1; What will be the behavior of the queue? Will `two` appear before now? Thanks!
0debug
How do I run specific tests using dotnet test? : <p>I have a large test suite in a .NET Core project. I can use the Test Explorer window to select a few tests to run.</p> <p>I can also run the <strong>whole</strong> test suite on the command line with <code>dotnet test</code>. Is there a way to run only one (or a few) tests on the command line?</p>
0debug
Using environment variables / parameterizing config.xml : <p>I am building an ionic/cordova project using the cordova-plugin-facebook4 plugin for Facebook authentication access. In <code>config.xml</code> this looks like:</p> <pre><code>&lt;plugin name="cordova-plugin-facebook4" spec="~1.7.1"&gt; &lt;variable name="APP_ID" value="1234567890123456"/&gt; &lt;variable name="APP_NAME" value="My_Appy_App"/&gt; &lt;/plugin&gt; </code></pre> <p>This works okay, but the <code>APP_ID</code> we are using is for the dev app and we have a separate facebook app for other environments such as QA.</p> <p>Is there any way to parameterize these variables in <code>config.xml</code> and have them be replaced as part of a build step? Something like:</p> <pre><code>&lt;plugin name="foo" spec="~0.0.0"&gt; &lt;variable name="bar" value="${env.APP_ID}"/&gt; &lt;/plugin&gt; </code></pre> <p>... and then run <code>APP_ID=baz ionic build android</code> or something like that.</p> <p>I don't see anything in the cordova documentation that allows you to do this.</p>
0debug
How do I add 'if' commands inside a 'why' loop : <p>So I have some code, like this:</p> <pre><code>while loopCode == 1: userCommand = raw_input('Type a command (type \'help\' for syntax): ') if userCommand == help: print 'flight: this command will be used to list a flight' print 'restaurant: you will be prompted to type the name of the restaurant, and how much you will spend there' </code></pre> <p>As you see, there is an <code>if</code> conditional inside the <code>while</code> loop. But when I get prompted to input text, I'm supposed to type 'help' for the conditional to activate. But when I do that, the <code>while</code> loop ignores the conditional. Why is that?</p>
0debug
static int do_pcie_aer_inject_error(Monitor *mon, const QDict *qdict, QObject **ret_data) { const char *id = qdict_get_str(qdict, "id"); const char *error_name; uint32_t error_status; bool correctable; PCIDevice *dev; PCIEAERErr err; int ret; ret = pci_qdev_find_device(id, &dev); if (ret < 0) { monitor_printf(mon, "id or pci device path is invalid or device not " "found. %s\n", id); return ret; } if (!pci_is_express(dev)) { monitor_printf(mon, "the device doesn't support pci express. %s\n", id); return -ENOSYS; } error_name = qdict_get_str(qdict, "error_status"); if (pcie_aer_parse_error_string(error_name, &error_status, &correctable)) { char *e = NULL; error_status = strtoul(error_name, &e, 0); correctable = qdict_get_try_bool(qdict, "correctable", false); if (!e || *e != '\0') { monitor_printf(mon, "invalid error status value. \"%s\"", error_name); return -EINVAL; } } err.status = error_status; err.source_id = pci_requester_id(dev); err.flags = 0; if (correctable) { err.flags |= PCIE_AER_ERR_IS_CORRECTABLE; } if (qdict_get_try_bool(qdict, "advisory_non_fatal", false)) { err.flags |= PCIE_AER_ERR_MAYBE_ADVISORY; } if (qdict_haskey(qdict, "header0")) { err.flags |= PCIE_AER_ERR_HEADER_VALID; } if (qdict_haskey(qdict, "prefix0")) { err.flags |= PCIE_AER_ERR_TLP_PREFIX_PRESENT; } err.header[0] = qdict_get_try_int(qdict, "header0", 0); err.header[1] = qdict_get_try_int(qdict, "header1", 0); err.header[2] = qdict_get_try_int(qdict, "header2", 0); err.header[3] = qdict_get_try_int(qdict, "header3", 0); err.prefix[0] = qdict_get_try_int(qdict, "prefix0", 0); err.prefix[1] = qdict_get_try_int(qdict, "prefix1", 0); err.prefix[2] = qdict_get_try_int(qdict, "prefix2", 0); err.prefix[3] = qdict_get_try_int(qdict, "prefix3", 0); ret = pcie_aer_inject_error(dev, &err); *ret_data = qobject_from_jsonf("{'id': %s, " "'root_bus': %s, 'bus': %d, 'devfn': %d, " "'ret': %d}", id, pci_root_bus_path(dev), pci_bus_num(dev->bus), dev->devfn, ret); assert(*ret_data); return 0; }
1threat
Array out of text in PHP : <p>So let's say I have a String that looks like this: <code>"apple, banana, orange"</code>. How do i split the text to get a Array that looks like this <code>"apple", "banana", "orange"</code>. Thanks in advance.</p>
0debug
What's the simplest way to subtract all elements of one list from another list in python : Given list1 = [1,2,2,3], list2 = [1,2], what's the simplest way to subtract all element of list2 from list1 to get list list3 = [2,3]. It seems sum work well for two lists but subtraction doesn't. >>> [1,2,2,3]+[1,2,3] [1, 2, 2, 3, 1, 2, 3] >>> [1,2,2,3]-[1,2] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for -: 'list' and 'list'
0debug
Mediawiki 1.72.0 changePassword.php Parse error : I am trying to use the `changePassword.php` command in MediaWiki 1.27.0 in order to change a user password. Unfortunately I get the following error message: <br /> <b>Parse error</b>: syntax error, unexpected '[', expecting ')' in <b>/wiki/maintenance/changePassword.php</b> on line <b>56</b><br /> Details of the system: - MediaWiki 1.27.0 - PHP 5.6.27 (cgi-cgi) - MySQL 5.6.32-78.1-log - ICU 4.2.1
0debug
return penultimate value : <p>Is it possible to return the penultimate record of a field? I want to do a select that would return me 2 ... Always the second but last record of the field</p> <p>I use</p> <pre><code>select top(1) u_lastdado from (select top 2 u_lastdado from cl order by u_lastdado desc ) t order by u_lastdado asc </code></pre> <p>but doesn't work. He continues to give me the present value and not the old</p> <p>Example</p> <pre><code>select u_lastdado from cl where u_lastdado&lt;&gt; '' </code></pre> <blockquote> <p>u_lastdado</p> <p>243237000<br> 213968131</p> </blockquote> <pre><code>update cl set u_lastdado=213968126 where nome ='Eira e Beira, lda' </code></pre> <blockquote> <p>u_lastdado</p> <p>243237000<br> 213968126</p> </blockquote> <p>I need to know how to go get the '213968131' that was formerly I use SQL SERVER 2012</p>
0debug
Calling PHP file from javascript : <p>I have an HTML form that calls a PHP function as:</p> <pre><code>&lt;form action="test.php" method "get"&gt; user data.. user data &lt;/form&gt; </code></pre> <p>Now I want to change the functionality as:</p> <pre><code> User enters 'yes' : Goto test1.php User enters 'no' : Goto test2.php </code></pre> <p>As this I could not find a way to directly achieve this via HTML. I called javascript from HTML as:</p> <blockquote> <p>&lt;\input type ="button" onclick="myfunction()" value="submit"/></p> </blockquote> <p>In the <code>myfunction()</code> call, I take inputs of the form using </p> <blockquote> <p>var = document.getElementById('data').value</p> </blockquote> <p>Now Once user input is parsed. I want to take take all the form data and pass it to a PHP file like:</p> <pre><code>if var==yes: action="test1.php" method="get" if var==no: action="test2.php" method="get" </code></pre> <p>I have browsed through other answers which suggest Ajax calls. Can it be done without Ajax calls ?</p>
0debug
Difference between Calendar.HOUR and Calendar.HOUR_OF_DAY? : <p>What is the difference between <code>Calendar.HOUR</code> and <code>Calendar.HOUR_OF_DAY</code> ? When to use <code>Calendar.HOUR</code> and <code>Calendar.HOUR_OF_DAY</code> ? I am confused sometime <code>Calendar.HOUR</code> this works fine and othertime <code>Calendar.HOUR_OF_DAY</code> this works fine. What they return in the form of int? I have read <a href="http://developer.android.com/reference/java/util/Calendar.html">this</a> documentation but not understood the difference. Any suggestions Thanks.</p>
0debug
Fragments giving Unexpected token error in React 16.2 : <p>I have the following component that renders a series of components. However, I downloaded React 16.2 and tried to use fragments instead of divs, but I get the following error:</p> <pre><code>Error in ./src/containers/answers.js Syntax error: Unexpected token (24:5) 22 | 23 | return ( &gt; 24 | &lt;&gt; | ^ 25 | {AnswersCard} 26 | &lt;/&gt; 27 | ) </code></pre> <p>Why am I getting this error when fragments are supposed to be able to replace divs in React 16.2?</p> <pre><code> question ? AnswersCard = ( question.answers.sort(function(a,b) { return (a.count &lt; b.count) ? 1 : ((b.count &gt; a.count) ? -1 : 0)} ).map(answer =&gt; &lt;Answer key={answer.id} answer={answer} questionId={question.id} /&gt; )) : AnswersCard = ( &lt;p&gt;Loading...&lt;/p&gt; ) return ( &lt;&gt; {AnswersCard} &lt;/&gt; ) } } </code></pre>
0debug
CSV file to list in C# : <p>I have a CSV file with the following format: first name, last name, date of birth, date of death. How can i get all the datas from my CSV file and convert them into an object list?</p> <p>I was thinking about implementing the following class</p> <pre><code>public class Person { private string f_name; private string l_name; private int dob; private int dod; public Person(string first, string second, int dob, int dod) { this.f_name = first; this.l_name = second; this.dob = dob; this.dod = dod; } } </code></pre>
0debug
.NET MVC ABOUT REMOVING SPECIAL CHARACTERS : string regExp = "[\\\"]"; string tmp = Regex.Replace(str, regExp," "); string[] strArray = tmp.Split(','); obj.amcid = db.Execute("select MAX(amcid)+1 from sca_amcmaster"); foreach (string i in strArray) { // int myInts = int.Parse(i); db.Execute(";EXEC insertitems1 @0,@1", i, obj.invoiceno); } I HAVE ONE PROBLEM IN THIS CODE.i WANT TO REMOVE ALL SPECIAL CHARACTERS BUT SQUARE BRACKETS NOT REMOVING ,
0debug
static SocketAddressLegacy *sd_socket_address(const char *path, const char *host, const char *port) { SocketAddressLegacy *addr = g_new0(SocketAddressLegacy, 1); if (path) { addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX; addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); addr->u.q_unix.data->path = g_strdup(path); } else { addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET; addr->u.inet.data = g_new0(InetSocketAddress, 1); addr->u.inet.data->host = g_strdup(host ?: SD_DEFAULT_ADDR); addr->u.inet.data->port = g_strdup(port ?: stringify(SD_DEFAULT_PORT)); } return addr; }
1threat
static int mov_read_trun(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { MOVFragment *frag = &c->fragment; AVStream *st = c->fc->streams[frag->track_id-1]; MOVStreamContext *sc = st->priv_data; uint64_t offset; int64_t dts; int data_offset = 0; unsigned entries, first_sample_flags = frag->flags; int flags, distance, i; if (sc->pseudo_stream_id+1 != frag->stsd_id) return 0; if (!st->nb_index_entries) return -1; get_byte(pb); flags = get_be24(pb); entries = get_be32(pb); dprintf(c->fc, "flags 0x%x entries %d\n", flags, entries); if (flags & 0x001) data_offset = get_be32(pb); if (flags & 0x004) first_sample_flags = get_be32(pb); if (flags & 0x800) { if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data)) return -1; sc->ctts_data = av_realloc(sc->ctts_data, (entries+sc->ctts_count)*sizeof(*sc->ctts_data)); if (!sc->ctts_data) return AVERROR(ENOMEM); } dts = st->duration; offset = frag->base_data_offset + data_offset; distance = 0; dprintf(c->fc, "first sample flags 0x%x\n", first_sample_flags); for (i = 0; i < entries; i++) { unsigned sample_size = frag->size; int sample_flags = i ? frag->flags : first_sample_flags; unsigned sample_duration = frag->duration; int keyframe; if (flags & 0x100) sample_duration = get_be32(pb); if (flags & 0x200) sample_size = get_be32(pb); if (flags & 0x400) sample_flags = get_be32(pb); if (flags & 0x800) { sc->ctts_data[sc->ctts_count].count = 1; sc->ctts_data[sc->ctts_count].duration = get_be32(pb); sc->ctts_count++; } if ((keyframe = st->codec->codec_type == CODEC_TYPE_AUDIO || (flags & 0x004 && !i && !sample_flags) || sample_flags & 0x2000000)) distance = 0; av_add_index_entry(st, offset, dts, sample_size, distance, keyframe ? AVINDEX_KEYFRAME : 0); dprintf(c->fc, "AVIndex stream %d, sample %d, offset %"PRIx64", dts %"PRId64", " "size %d, distance %d, keyframe %d\n", st->index, sc->sample_count+i, offset, dts, sample_size, distance, keyframe); distance++; assert(sample_duration % sc->time_rate == 0); dts += sample_duration / sc->time_rate; offset += sample_size; } frag->moof_offset = offset; sc->sample_count = st->nb_index_entries; st->duration = dts; return 0; }
1threat
Assigning element values in an array without knowing the size of the array : <p>During my high school c++ course we were assigned an assignment to write a program that allows the user to input values that would be stored in an array without prompting the user for the array size. So if the user decides to enter 1,2,3 the array size would go from being unknown to three.</p>
0debug
Azure DevOps pipeline build locally with YAML : <p>how can I simulate the build process of Azure Devops pipeline on the local machine before pushing it to branch to test the possible errors. </p> <p>the solution gets build locally correct with no errors and warnings. also from the VS command line <code>MSBuild</code> builds the solution with no errors but on some push tries the pipeline build throws many errors mostly related to <code>preprocessor defenition</code> and <code>precompiled header</code>. </p> <p>I wanted to know how can test the same process locally on my machine without pushing to repo.</p> <pre><code>azure-pipelines.yml ------------------- pool: vmImage: 'vs2017-win2016' steps: - task: MSBuild@1 displayName: 'Build solution' inputs: platform: 'Win32' configuration: 'release' solution: 'mysolution.sln' - task: VSTest@2 displayName: 'Run Test' inputs: platform: 'Win32' Configuration: 'release' testAssemblyVer2: | **\*.Test.dll !**\*TestAdapter.dll !**\obj\** runSettingsFile: project.Test/test.runsettings codeCoverageEnabled: true </code></pre>
0debug
static bool get_vt_profile_level(AVCodecContext *avctx, CFStringRef *profile_level_val) { VTEncContext *vtctx = avctx->priv_data; int64_t profile = vtctx->profile; if (profile == H264_PROF_AUTO && vtctx->level) { profile = vtctx->has_b_frames ? H264_PROF_MAIN : H264_PROF_BASELINE; } *profile_level_val = NULL; switch (profile) { case H264_PROF_AUTO: return true; case H264_PROF_BASELINE: switch (vtctx->level) { case 0: *profile_level_val = kVTProfileLevel_H264_Baseline_AutoLevel; break; case 13: *profile_level_val = kVTProfileLevel_H264_Baseline_1_3; break; case 30: *profile_level_val = kVTProfileLevel_H264_Baseline_3_0; break; case 31: *profile_level_val = kVTProfileLevel_H264_Baseline_3_1; break; case 32: *profile_level_val = kVTProfileLevel_H264_Baseline_3_2; break; case 40: *profile_level_val = kVTProfileLevel_H264_Baseline_4_0; break; case 41: *profile_level_val = kVTProfileLevel_H264_Baseline_4_1; break; case 42: *profile_level_val = kVTProfileLevel_H264_Baseline_4_2; break; case 50: *profile_level_val = kVTProfileLevel_H264_Baseline_5_0; break; case 51: *profile_level_val = kVTProfileLevel_H264_Baseline_5_1; break; case 52: *profile_level_val = kVTProfileLevel_H264_Baseline_5_2; break; } break; case H264_PROF_MAIN: switch (vtctx->level) { case 0: *profile_level_val = kVTProfileLevel_H264_Main_AutoLevel; break; case 30: *profile_level_val = kVTProfileLevel_H264_Main_3_0; break; case 31: *profile_level_val = kVTProfileLevel_H264_Main_3_1; break; case 32: *profile_level_val = kVTProfileLevel_H264_Main_3_2; break; case 40: *profile_level_val = kVTProfileLevel_H264_Main_4_0; break; case 41: *profile_level_val = kVTProfileLevel_H264_Main_4_1; break; case 42: *profile_level_val = kVTProfileLevel_H264_Main_4_2; break; case 50: *profile_level_val = kVTProfileLevel_H264_Main_5_0; break; case 51: *profile_level_val = kVTProfileLevel_H264_Main_5_1; break; case 52: *profile_level_val = kVTProfileLevel_H264_Main_5_2; break; } break; case H264_PROF_HIGH: switch (vtctx->level) { case 0: *profile_level_val = kVTProfileLevel_H264_High_AutoLevel; break; case 30: *profile_level_val = kVTProfileLevel_H264_High_3_0; break; case 31: *profile_level_val = kVTProfileLevel_H264_High_3_1; break; case 32: *profile_level_val = kVTProfileLevel_H264_High_3_2; break; case 40: *profile_level_val = kVTProfileLevel_H264_High_4_0; break; case 41: *profile_level_val = kVTProfileLevel_H264_High_4_1; break; case 42: *profile_level_val = kVTProfileLevel_H264_High_4_2; break; case 50: *profile_level_val = kVTProfileLevel_H264_High_5_0; break; case 51: *profile_level_val = kVTProfileLevel_H264_High_5_1; break; case 52: *profile_level_val = kVTProfileLevel_H264_High_5_2; break; } break; } if (!*profile_level_val) { av_log(avctx, AV_LOG_ERROR, "Invalid Profile/Level.\n"); return false; } return true; }
1threat
void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN]) { const uint32_t broadcast_addr = ~slirp->vnetwork_mask.s_addr | slirp->vnetwork_addr.s_addr; ArpTable *arptbl = &slirp->arp_table; int i; DEBUG_CALL("arp_table_add"); DEBUG_ARG("ip = 0x%x", ip_addr); DEBUG_ARGS((dfd, " hw addr = %02x:%02x:%02x:%02x:%02x:%02x\n", ethaddr[0], ethaddr[1], ethaddr[2], ethaddr[3], ethaddr[4], ethaddr[5])); assert((ip_addr & htonl(~(0xf << 28))) != 0); if (ip_addr == 0xffffffff || ip_addr == broadcast_addr) { return; } for (i = 0; i < ARP_TABLE_SIZE; i++) { if (arptbl->table[i].ar_sip == ip_addr) { memcpy(arptbl->table[i].ar_sha, ethaddr, ETH_ALEN); return; } } arptbl->table[arptbl->next_victim].ar_sip = ip_addr; memcpy(arptbl->table[arptbl->next_victim].ar_sha, ethaddr, ETH_ALEN); arptbl->next_victim = (arptbl->next_victim + 1) % ARP_TABLE_SIZE; }
1threat
Entity Framework: The context is being used in Code First mode with code that was generated from an EDMX file : <p>I am developing an WPF application with EF 6 database first approach, I am have 1 project in my solutions, if i run my project this error always appear.</p> <p><em>The context is being used in Code First mode with code that was generated from an EDMX file for either Database First or Model First development. This will not work correctly. To fix this problem do not remove the line of code that throws this exception. If you wish to use Database First or Model First, then make sure that the Entity Framework connection string is included in the app.config or web.config of the start-up project. If you are creating your own DbConnection, then make sure that it is an EntityConnection and not some other type of DbConnection, and that you pass it to one of the base DbContext constructors that take a DbConnection. To learn more about Code First, Database First, and Model First see the Entity Framework documentation here: <a href="http://go.microsoft.com/fwlink/?LinkId=394715" rel="noreferrer">http://go.microsoft.com/fwlink/?LinkId=394715</a></em></p>
0debug
Want to Transform a map image like this to Javascript or HTML5 graphics? : <p>Just want to draw <a href="https://i.stack.imgur.com/cnNd6.jpg" rel="nofollow noreferrer">this</a> map with the same shape and colors, with a little transformation and graphics to it.</p>
0debug
Change webview find on page result style using css? : <p>In an Electron webview using <code>findInPage</code>, can you use css to change the result colors?</p> <p><a href="https://i.stack.imgur.com/V9uwi.png" rel="noreferrer"><img src="https://i.stack.imgur.com/V9uwi.png" alt="enter image description here"></a></p> <p>In the above image, the current find result is highlighted in orange while additional results are highlighted with yellow. I'd like to tweak the styling of both of these</p>
0debug
getting extra single quotes in output : I'm Solving a simple code in python to print randomly generated ticket number. But when I'm printing list of ticket number it is giving extra single quotes. Please refer to **below code**.:- #PF-Exer-22 import random def generate_ticket(airline,source,destination,no_of_passengers): ticket_number_list=[] src = source[0:3] dest = destination[0:3] listof_passonger = [] random_number_list = [] random_number = 0 random_number = 102 for loop in range(0, no_of_passengers): #if(random_number in random_number_list): #random_number = random.randint(101,500) #else: #random_number_list.append(random_number_list) random_number = random_number + 1 ticket_number = airline + ":" + src + ":" + dest + ":" + str(random_number) ticket_number_list.append(ticket_number) return ticket_number_list print(generate_ticket("AI","Bangalore","London",7)) while executing above code my **output** is :- ['AI:Ban:Lon:103', 'AI:Ban:Lon:104', 'AI:Ban:Lon:105', 'AI:Ban:Lon:106', 'AI:Ban:Lon:107', 'AI:Ban:Lon:108', 'AI:Ban:Lon:109'] but my **expected output** is :- [AI:Ban:Lon:103,AI:Ban:Lon:104,AI:Ban:Lon:105,AI:Ban:Lon:106,AI:Ban:Lon:107] As you can see tere is no single code is expected output. Please help me with that And please don't vote down for no reason.
0debug
Ubuntu + scala REPL, Commands not typed on console : <p>I am using Ubuntu 18.04 + Scala 2.11.12 (OpenJDK 64-Bit Server VM, Java 1.8.0_162).</p> <p>Once I open the scala shell, I am not able to see anything that I type. It gets typed though. </p> <p>Below is how it is happening when I type <strong><code>println("Hello, world!")</code></strong> at console:</p> <pre><code>$ scala Welcome to Scala 2.11.12 (OpenJDK 64-Bit Server VM, Java 1.8.0_162). Type in expressions for evaluation. Or try :help. scala&gt; Hello, world! scala&gt; </code></pre> <p>Any ideas on how we can get through?</p>
0debug
Git: How do you checkout all deleted files? : <p>In git I am familiar with how to checkout individual files that have been deleted using the <code>git checkout -- [&lt;paths&gt;...]</code> syntax (which is recommended when you do <code>git status</code>.</p> <p>To get all the files you could create a list and give the list as the argument to the above command.</p> <p>However when you just want all the files that have been deleted (i.e. rm -rf in your cwd and then you want to restore all files) generating that list is inelegant.</p> <p><strong>How do you checkout all deleted files?</strong></p>
0debug
trying to handle webtable in POM using pagefactory but error is thrown : <p><strong>strong text</strong>I was trying to handle webtable in POM using pagefactory but its throwing error </p> <p>if i try nto paste xpath directly but otherwise its not working</p> <pre><code> @FindBy (xpath = "//table[@id='userTable']/tbody/tr[") WebElement before_xpath; @FindBy (xpath = "]/td[2]") WebElement after_xpath; @FindBy (xpath = "//table[@id='userTable']/tbody/tr") List&lt;WebElement&gt; namelist; //Intialising PageObjects public users_page() { PageFactory.initElements(driver, this); } //Actions public void userlist(String nm, String un, String pw, String cpw, String hub) { List&lt;WebElement&gt; row =namelist; int row_count = row.size(); System.out.println("Total no of rows " +row_count); for(int i=1;i&lt;row_count;i++) { WebElement actual_xpath = before_xpath +i +actual_xpath; System.out.println("Total " +actual_xpath); } }} </code></pre> <p>It is throwing error on WebElement actual_xpath = before_xpath +i +actual_xpath;.</p> <p>its showing The operator + is undefined for the argument type(s) WebElement, int</p> <p>so hw i can handle this </p>
0debug
static int nuv_header(AVFormatContext *s) { NUVContext *ctx = s->priv_data; AVIOContext *pb = s->pb; char id_string[12]; double aspect, fps; int is_mythtv, width, height, v_packs, a_packs; AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); avio_skip(pb, 5); avio_skip(pb, 3); width = avio_rl32(pb); height = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); avio_r8(pb); avio_skip(pb, 3); aspect = av_int2double(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; fps = av_int2double(avio_rl64(pb)); v_packs = avio_rl32(pb); a_packs = avio_rl32(pb); avio_rl32(pb); avio_rl32(pb); if (v_packs) { vst = avformat_new_stream(s, NULL); if (!vst) return AVERROR(ENOMEM); ctx->v_id = vst->index; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; vst->codec->codec_id = AV_CODEC_ID_NUV; vst->codec->width = width; vst->codec->height = height; vst->codec->bits_per_coded_sample = 10; vst->sample_aspect_ratio = av_d2q(aspect * height / width, 10000); #if FF_API_R_FRAME_RATE vst->r_frame_rate = #endif vst->avg_frame_rate = av_d2q(fps, 60000); avpriv_set_pts_info(vst, 32, 1, 1000); } else ctx->v_id = -1; if (a_packs) { ast = avformat_new_stream(s, NULL); if (!ast) return AVERROR(ENOMEM); ctx->a_id = ast->index; ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; ast->codec->codec_id = AV_CODEC_ID_PCM_S16LE; ast->codec->channels = 2; ast->codec->channel_layout = AV_CH_LAYOUT_STEREO; ast->codec->sample_rate = 44100; ast->codec->bit_rate = 2 * 2 * 44100 * 8; ast->codec->block_align = 2 * 2; ast->codec->bits_per_coded_sample = 16; avpriv_set_pts_info(ast, 32, 1, 1000); } else ctx->a_id = -1; get_codec_data(pb, vst, ast, is_mythtv); ctx->rtjpg_video = vst && vst->codec->codec_id == AV_CODEC_ID_NUV; return 0; }
1threat
How can send mail in java, nonlogin process : <p>I have a requirement of sending the email with the attachment of a file. I found few online java code but that is through gmail/yahoo with login credentials. But I want to send it as anonymous instead of logging in.</p> <p>Similar to what is available in oracle plsql UTIL_SMTP</p> <p>Any body can help here! Thanks inadvance</p>
0debug
static void omap_lpg_update(struct omap_lpg_s *s) { int64_t on, period = 1, ticks = 1000; static const int per[8] = { 1, 2, 4, 8, 12, 16, 20, 24 }; if (~s->control & (1 << 6)) on = 0; else if (s->control & (1 << 7)) on = period; else { period = muldiv64(ticks, per[s->control & 7], 256 / 32); on = (s->clk && s->power) ? muldiv64(ticks, per[(s->control >> 3) & 7], 256) : 0; } timer_del(s->tm); if (on == period && s->on < s->period) printf("%s: LED is on\n", __FUNCTION__); else if (on == 0 && s->on) printf("%s: LED is off\n", __FUNCTION__); else if (on && (on != s->on || period != s->period)) { s->cycle = 0; s->on = on; s->period = period; omap_lpg_tick(s); return; } s->on = on; s->period = period; }
1threat
sendBeacon request stuck as "(pending)" when attached to unload event : <p>When I call navigator.sendBeacon directly in the console, I immediately see the request in the Chrome dev tools Network pane complete successfully.</p> <p>When I use code like what's below to attach sendBeacon to the beforeunload event and then navigate away from the page, I see a row added to the Network pane but its status stays stuck at "(pending)" and never sends.</p> <p>What am I doing wrong?</p> <pre><code> window.addEventListener('beforeunload', function() { navigator.sendBeacon( 'https://www.example.com/sendBeacon-data-collector', 'Sent by a beacon!'); }, false); </code></pre>
0debug
TypeScript Compile Options: module vs target : <p>Trying to have some basic understanding about module and target. </p> <p>I would like to know the difference between module and target compile options in a typical tsconfig.json</p> <pre> { "compilerOptions": { "module": "es6", "sourceMap": true, "target": "es6" } } </pre> <p>What happens if I provide the following options:</p> <p>module: commonjs, target: es6</p> <p>module: es6, target: commonjs</p> <p>module: commonjs, target: commonjs</p>
0debug
static ExitStatus trans_fop_wew_0e(DisasContext *ctx, uint32_t insn, const DisasInsn *di) { unsigned rt = assemble_rt64(insn); unsigned ra = assemble_ra64(insn); return do_fop_wew(ctx, rt, ra, di->f_wew); }
1threat
convert datatable into an array in C# : I want to convert DataTable in an 2-D array form in C#. Below is the example for clear understanding. DataTable in C#: code Price ---------- ---------- 1146441600000 34 1146528000000 5 1146614400000 10 1146700800000 7 1146787200000 12 1147046400000 8 1147132800000 9 Output required in js: [[1146441600000,34], [1146528000000,5], [1146614400000,10], [1146700800000,7], [1146787200000,12], [1147046400000,8], [1147132800000,9]] I am using razor engine for front end rendering.
0debug
static void gt64120_pci_mapping(GT64120State *s) { if ((s->regs[GT_PCI0IOLD] & 0x7f) <= s->regs[GT_PCI0IOHD]) { if (s->PCI0IO_length) { memory_region_del_subregion(get_system_memory(), &s->PCI0IO_mem); memory_region_destroy(&s->PCI0IO_mem); } s->PCI0IO_start = s->regs[GT_PCI0IOLD] << 21; s->PCI0IO_length = ((s->regs[GT_PCI0IOHD] + 1) - (s->regs[GT_PCI0IOLD] & 0x7f)) << 21; isa_mem_base = s->PCI0IO_start; isa_mmio_init(s->PCI0IO_start, s->PCI0IO_length); } }
1threat
How do I run background job in Flask without threading or task-queue : <p>I am building REST API with Flask-restplus. One of my endpoints takes a file uploaded from client and run some analysis. The job uses up to 30 seconds. I don't want the job to block the main process. So the endpoint will return a response with 200 or 201 right away, the job can still be running. Results will be saved to database which will be retrieved later.</p> <p>It seems I have two options for long-running jobs. </p> <ol> <li>Threading</li> <li>Task-queue</li> </ol> <p>Threading is relatively simpler. But problem is, there is a limit of thread numbers for Flask app. In a standalone Python app, I could use a queue for the threads. But this is REST api, each request call is independent. I don't know if there is a way to maintain a global queue for that. So if the requests exceed the thread limit, it won't be able to take more requests.</p> <p>Task-queue with Celery and Redis is probably better option. But this is just a proof of concept thing, and time line is kind of tight. Setting up Celery, Redis with Flask is not easy, I am having lots of trouble on my dev machine which is a Windows. It will be deployed on AWS which is kind of complex. </p> <p>I wonder if there is a third option for this case?</p>
0debug
static void ffm_seek1(AVFormatContext *s, int64_t pos1) { FFMContext *ffm = s->priv_data; AVIOContext *pb = s->pb; int64_t pos; pos = FFMIN(pos1, ffm->file_size - FFM_PACKET_SIZE); pos = FFMAX(pos, FFM_PACKET_SIZE); av_dlog(s, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); avio_seek(pb, pos, SEEK_SET); }
1threat