problem
stringlengths
26
131k
labels
class label
2 classes
static void close_htab_fd(sPAPRMachineState *spapr) { if (spapr->htab_fd >= 0) { close(spapr->htab_fd); } spapr->htab_fd = -1; }
1threat
static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int size) { DiracContext *s = avctx->priv_data; DiracFrame *pic = NULL; int ret, i, parse_code = buf[4]; unsigned tmp; if (size < DATA_UNIT_HEADER_SIZE) return -1; init_get_bits(&s->gb, &buf[13], 8*(size - DATA_UNIT_HEADER_SIZE)); if (parse_code == pc_seq_header) { if (s->seen_sequence_header) return 0; if (avpriv_dirac_parse_sequence_header(avctx, &s->gb, &s->source)) return -1; avcodec_get_chroma_sub_sample(avctx->pix_fmt, &s->chroma_x_shift, &s->chroma_y_shift); if (alloc_sequence_buffers(s)) return -1; s->seen_sequence_header = 1; } else if (parse_code == pc_eos) { free_sequence_buffers(s); s->seen_sequence_header = 0; } else if (parse_code == pc_aux_data) { if (buf[13] == 1) { int ver[3]; if (sscanf(buf+14, "Schroedinger %d.%d.%d", ver, ver+1, ver+2) == 3) if (ver[0] == 1 && ver[1] == 0 && ver[2] <= 7) s->old_delta_quant = 1; } } else if (parse_code & 0x8) { if (!s->seen_sequence_header) { av_log(avctx, AV_LOG_DEBUG, "Dropping frame without sequence header\n"); return -1; } for (i = 0; i < MAX_FRAMES; i++) if (s->all_frames[i].avframe->data[0] == NULL) pic = &s->all_frames[i]; if (!pic) { av_log(avctx, AV_LOG_ERROR, "framelist full\n"); return -1; } av_frame_unref(pic->avframe); tmp = parse_code & 0x03; if (tmp > 2) { av_log(avctx, AV_LOG_ERROR, "num_refs of 3\n"); return -1; } s->num_refs = tmp; s->is_arith = (parse_code & 0x48) == 0x08; s->low_delay = (parse_code & 0x88) == 0x88; pic->avframe->reference = (parse_code & 0x0C) == 0x0C; pic->avframe->key_frame = s->num_refs == 0; pic->avframe->pict_type = s->num_refs + 1; if ((ret = get_buffer_with_edge(avctx, pic->avframe, (parse_code & 0x0C) == 0x0C ? AV_GET_BUFFER_FLAG_REF : 0)) < 0) return ret; s->current_picture = pic; s->plane[0].stride = pic->avframe->linesize[0]; s->plane[1].stride = pic->avframe->linesize[1]; s->plane[2].stride = pic->avframe->linesize[2]; if (alloc_buffers(s, FFMAX3(FFABS(s->plane[0].stride), FFABS(s->plane[1].stride), FFABS(s->plane[2].stride))) < 0) return AVERROR(ENOMEM); if (dirac_decode_picture_header(s)) return -1; if (dirac_decode_frame_internal(s)) return -1; } return 0; }
1threat
Creating a text file with the current date and time as the file name in Java : <p>I am trying to create a text file and add some details into it using Java when a button is clicked in my GUI application, the name of the text file has to be the current date and time and the location of the text file has to be relative. Here is the code snippet I used to do this.</p> <pre><code> public void actionPerformed(ActionEvent e){ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd_HH:mm:ss"); Date date = new Date(); String fileName = dateFormat.format(date) + ".txt"; File file = new File(fileName); PrintWriter pw; try{ if(file.createNewFile()){ pw = new PrintWriter(file); //Write Details To Created Text File Here JOptionPane.showMessageDialog(null, "The Statistics have successfully been saved to the file: " + fileName); }else{ JOptionPane.showMessageDialog(null, "The save file " + fileName + " already exists, please try again in a while."); } }catch(IOException exception){ JOptionPane.showMessageDialog(null, exception + ", file name:- " + fileName); }catch(Exception exception){ JOptionPane.showMessageDialog(null, exception); } } </code></pre> <p>Unfortunately when I run the above code I get the following error:</p> <p><a href="https://i.stack.imgur.com/F49SV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/F49SV.png" alt="enter image description here"></a></p> <p>I cannot find the problem, please tell me what I am doing wrong.</p>
0debug
How to convert from &[u8] to Vec<u8>? : <p>I'm attempting to simply convert a slice to a vector. The following code:</p> <pre><code>let a = &amp;[0u8]; let b: Vec&lt;u8&gt; = a.iter().collect(); </code></pre> <p>fails with the following error message: </p> <pre><code>3 | let b: Vec&lt;u8&gt; = a.iter().collect(); | ^^^^^^^ a collection of type `std::vec::Vec&lt;u8&gt;` cannot be built from an iterator over elements of type `&amp;u8` </code></pre> <p>What am I missing?</p>
0debug
Does Realm models actually require getters and setters? : <p>I cannot find it clearly documented anywhere if getters and setters are actually required for fields in a Realm Model. For example, the documentation at <a href="https://realm.io/docs/java/latest/api/io/realm/RealmObject.html" rel="noreferrer">https://realm.io/docs/java/latest/api/io/realm/RealmObject.html</a> says</p> <blockquote> <p>The only restriction a RealmObject has is that fields are not allowed to be final, transient' or volatile. Any method as well as public fields are allowed. When providing custom constructors, a public constructor with no arguments must be declared and be empty.</p> <p>Fields annotated with Ignore don't have these restrictions and don't require either a getter or setter.</p> </blockquote> <p>Which seems to hint that it is required with getters and setters for non-ignored fields. Yet, the documentation at <a href="https://realm.io/docs/java/latest/#customizing-objects" rel="noreferrer">https://realm.io/docs/java/latest/#customizing-objects</a> says</p> <blockquote> <p>It is possible to use RealmObjects almost like POJOs. Extending from RealmObject, you can let the fields be public, and use simple assignments instead of setters and getter.</p> </blockquote> <p>and then show the code for a Realm Model that does not have any getters and setters and instead have public fields we should use. Really? I thought Realm didn't even store any values in the actual fields, so reading and writing from them is probably a bad idea? I mean their debugging docs <a href="https://realm.io/docs/java/latest/#debugging" rel="noreferrer">https://realm.io/docs/java/latest/#debugging</a> state:</p> <blockquote> <p>Unfortunately these values are wrong because the field values are not used. Realm creates a proxy object behind the scenes and overrides the getters and setters in order to access the persisted data in the Realm</p> </blockquote> <p>So could someone please enlighten me? Can I skip getters and setters and just stick with public fields? Is there any thorough docs on this?</p>
0debug
static unsigned int dec_movs_r(DisasContext *dc) { TCGv t0; int size = memsize_z(dc); DIS(fprintf (logfile, "movs.%c $r%u, $r%u\n", memsize_char(size), dc->op1, dc->op2)); cris_cc_mask(dc, CC_MASK_NZ); t0 = tcg_temp_new(TCG_TYPE_TL); t_gen_sext(t0, cpu_R[dc->op1], size); cris_alu(dc, CC_OP_MOVE, cpu_R[dc->op2], cpu_R[dc->op1], t0, 4); tcg_temp_free(t0); return 2; }
1threat
Matplotlib canvas as numpy array artefacts : <p>I want to convert a matplotlib figure into a numpy array. I have been able to do this by accessing the contents of the renderer directly. However, when I call imshow on the numpy array it has what looks like aliasing artefacts along the edges which aren't present in the original figure.</p> <p>I've tried playing around with various parameters but can't figure out how to fix the artefacts from imshow. The differences in the images remain if I save the figures to an image file.</p> <p>Note that what I want to achieve is a way to confirm that the content of the array is the same as the figure I viewed before. I think probably these artefacts are not present in the numpy array but are created during the imshow call. Perhaps approriate configuration of imshow can resolve the problem.</p> <pre><code>import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Rectangle import math fig = plt.figure(frameon=False) ax = plt.gca() ax.add_patch(Rectangle((0,0), 1, 1, angle=45, color="red")) ax.set_xlim(-2,2) ax.set_ylim(-2,2) ax.set_aspect(1) plt.axis("off") fig.canvas.draw() plt.savefig("rec1.png") plt.show() X = np.array(fig.canvas.renderer._renderer) fig = plt.figure(frameon=False) ax = plt.gca() plt.axis("off") plt.imshow(X) plt.savefig("rec2.png") plt.show() </code></pre> <p><a href="https://i.stack.imgur.com/NkMV6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/NkMV6.png" alt="enter image description here"></a></p>
0debug
How to scroll to next div using Javascript? : <p>So I'm making a website with a lot of Divs that take 100% height. And I want to make a button so when it's clicked to smoothly scroll to next div. I've coded something so when its clicked, it scrolls to specific div.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(".next").click(function() { $('html,body').animate({ scrollTop: $(".p2").offset().top}, 'slow'); });</code></pre> <pre class="snippet-code-css lang-css prettyprint-override"><code>body{ margin: 0; height: 100%; } .p1{ height: 100vh; width: 70%; background-color: #2196F3; } .p2{ height: 100vh; width: 70%; background-color: #E91E63; } .p3{ height: 100vh; width: 70%; background-color: #01579B; } .admin{ background-color: #B71C1C; height: 100vh; position: fixed; right: 0%; top: 0%; width: 30%; float: left; }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt; &lt;div class="p1"&gt; &lt;/div&gt; &lt;div class="p2"&gt; &lt;/div&gt; &lt;div class="p3"&gt; &lt;/div&gt; &lt;div class="admin"&gt; &lt;button class="next"&gt;NEXT&lt;/button&gt; &lt;/div&gt;</code></pre> </div> </div> </p>
0debug
void cpu_exit(CPUState *cpu) { cpu->exit_request = 1; smp_wmb(); cpu->tcg_exit_req = 1; }
1threat
Symfony 4 | Custom configuration file : I have been searching for a little while but I cannot find anything useful (or at least I think so). My goal is to add to a new symfony 4.4 project an extra config file to define some behavior of the system, it could be anything, like, pancakes.yaml: ```yaml pancakes: enablePancakes: false ``` I wish to know how can I load that config file, find a way to read its parameters and values to change some custom behavior the system might have but honestly I think I'm not smart enough to undestand what the documentation says. For now it could be anything, like printing the config file values, idk, for now I only need to know how to load it. Any tip or help would be a great help for me, I'm kinda lost here
0debug
static int au_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (!enc->codec_tag) return AVERROR(EINVAL); ffio_wfourcc(pb, ".snd"); avio_wb32(pb, AU_HEADER_SIZE); avio_wb32(pb, AU_UNKNOWN_SIZE); avio_wb32(pb, enc->codec_tag); avio_wb32(pb, enc->sample_rate); avio_wb32(pb, enc->channels); avio_wb64(pb, 0); avio_flush(pb); return 0; }
1threat
I am using angular 4 for my project,writing code for range slider : While compiling i am getting below error,Can you help on this, Argument of type '{ selector: string; templateUrl: string; directives: typeof SlideAbleDirective[]; changeDetection...' is not assignable to parameter of type 'Component'. Object literal may only specify known properties, and 'directives' does not exist in type 'Component'.
0debug
C# program runs but than terminates? : I'm using visual studios 2012 and I'm creating a program that prompts the user to enter the number of wheels their car has, the color of their car, the mileage etc.. and will display 'the starting point of the car, the mileage, and the color of the car once the user inputs their values. But, once I start the program and I enter the number of wheels, the program terminates and doesn't go to the next step. ' public class Car { private int NumbofWheels; private int Mileage; private String Color; private double point; private double newPoint; private String owner; static void Main(string[] args) { Console.WriteLine("****************************************"); Console.WriteLine("* WELCOME TO CAR MANAGER *"); Console.WriteLine(); Console.WriteLine("* BY: MOHAMED SHIRE *"); Console.WriteLine("* *"); Console.WriteLine("* *"); Console.WriteLine("* **************************************"); Console.Write("ENTER THE # OF WHEELS OF A CAR: "); Console.ReadKey(); } public Car() { Mileage = 0; NumbofWheels = 4; point = 1000000; } public Car(int mile) { Mileage = mile; } public Car(int n, String c) { Mileage = 0; NumbofWheels = n; Color = c; point = 1000000; } public void setPoint( int p) { point = p; } public double getPoint() { return point; } public void setMileage(int m) { Mileage = m; } public int getMileage() { return Mileage; } public void setWheels(int w) { NumbofWheels = w; } public int getWheels() { return NumbofWheels; } public void setColor(String c) { Color = c; } public String getColor() { return Color; } public void setOwner(String o) { owner = o; } public String getOwner() { return owner; } public void calPoint() { newPoint = point - Mileage * 0.5; } public double getnPoint() { return newPoint; } } } '
0debug
How to properly capture user's keystrokes in C#, i.e. respecting SHIFT key and differentiating between upper/lower-case characters? : I have written the following C# program to capture the user's keystrokes. It works perfectly, except that all keys are logged as lower-case without taking the SHIFT key into account (see below). I have read all of the Win32 API's documentation. Still I much be missing something. How can I correct this program to log keystrokes properly? If I enter `HelloWorld!!!`, the following keys are output in log.txt: h e l l o w o r l d 1 1 1 I.e., it does not consider SHIFT, which is the purpose of `GetKeyboardState()`? The program: using System; using System.IO; using System.Diagnostics; using System.Runtime.InteropServices; using System.Windows.Forms; using System.Text; namespace CSharpKeyLogger { public static class Program { [DllImport("user32.dll")] private static extern IntPtr SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hMod, uint dwThreadId); [DllImport("user32.dll")] private static extern bool UnhookWindowsHookEx(IntPtr hhk); [DllImport("user32.dll")] private static extern IntPtr CallNextHookEx(IntPtr hhk, int nCode, IntPtr wParam, IntPtr lParam); [DllImport("kernel32.dll")] private static extern IntPtr GetModuleHandle(string lpModuleName); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int GetKeyboardState(byte[] keystate); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int MapVirtualKey(uint uCode, int uMapType); [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern int ToUnicode(uint wVirtKey, uint wScanCode, byte[] lpkeystate, System.Text.StringBuilder pwszBuff, int cchBuff, uint wFlags); private const int WH_KEYBOARD_LL = 13; private const int WM_KEYDOWN = 0x0100; private const int MAPVK_VK_TO_VSC = 0; private const int BUFF_SZ = 4; private const string logFileName = "log.txt"; private static StreamWriter logFile; private static HookProc hookProc = HookCallback; private static IntPtr hookId = IntPtr.Zero; public static void Main() { logFile = File.AppendText(logFileName); logFile.AutoFlush = true; hookId = SetHook(hookProc); Application.Run(); UnhookWindowsHookEx(hookId); } private static IntPtr SetHook(HookProc hookProc) { IntPtr moduleHandle = GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName); return SetWindowsHookEx(WH_KEYBOARD_LL, hookProc, moduleHandle, 0); } private delegate IntPtr HookProc(int nCode, IntPtr wParam, IntPtr lParam); private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { uint vkCode = (uint)Marshal.ReadInt32(lParam); byte[] kb = new byte[256]; GetKeyboardState(kb); StringBuilder buf = new StringBuilder(BUFF_SZ + 1); switch(ToUnicode(vkCode, (uint)MapVirtualKey(vkCode, MAPVK_VK_TO_VSC), kb, buf, BUFF_SZ, 0)) { case -1: break; case 0: break; case 1: case 2: case 3: case 4: logFile.WriteLine(buf.ToString()); break; } } return CallNextHookEx(hookId, nCode, wParam, lParam); } } }
0debug
static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* format) { AVCodecContext *avctx = opaque; CuvidContext *ctx = avctx->priv_data; AVHWFramesContext *hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data; CUVIDDECODECREATEINFO cuinfo; int surface_fmt; enum AVPixelFormat pix_fmts[3] = { AV_PIX_FMT_CUDA, AV_PIX_FMT_NONE, AV_PIX_FMT_NONE }; av_log(avctx, AV_LOG_TRACE, "pfnSequenceCallback, progressive_sequence=%d\n", format->progressive_sequence); ctx->internal_error = 0; switch (format->bit_depth_luma_minus8) { case 0: pix_fmts[1] = AV_PIX_FMT_NV12; break; case 2: pix_fmts[1] = AV_PIX_FMT_P010; break; case 4: pix_fmts[1] = AV_PIX_FMT_P016; break; default: av_log(avctx, AV_LOG_ERROR, "unsupported bit depth: %d\n", format->bit_depth_luma_minus8 + 8); ctx->internal_error = AVERROR(EINVAL); return 0; } surface_fmt = ff_get_format(avctx, pix_fmts); if (surface_fmt < 0) { av_log(avctx, AV_LOG_ERROR, "ff_get_format failed: %d\n", surface_fmt); ctx->internal_error = AVERROR(EINVAL); return 0; } av_log(avctx, AV_LOG_VERBOSE, "Formats: Original: %s | HW: %s | SW: %s\n", av_get_pix_fmt_name(avctx->pix_fmt), av_get_pix_fmt_name(surface_fmt), av_get_pix_fmt_name(avctx->sw_pix_fmt)); avctx->pix_fmt = surface_fmt; if (avctx->hw_frames_ctx) { av_buffer_unref(&ctx->hwframe); ctx->hwframe = av_buffer_ref(avctx->hw_frames_ctx); if (!ctx->hwframe) { ctx->internal_error = AVERROR(ENOMEM); return 0; } hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data; } avctx->width = format->display_area.right; avctx->height = format->display_area.bottom; ff_set_sar(avctx, av_div_q( (AVRational){ format->display_aspect_ratio.x, format->display_aspect_ratio.y }, (AVRational){ avctx->width, avctx->height })); if (!format->progressive_sequence && ctx->deint_mode == cudaVideoDeinterlaceMode_Weave) avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT; else avctx->flags &= ~AV_CODEC_FLAG_INTERLACED_DCT; if (format->video_signal_description.video_full_range_flag) avctx->color_range = AVCOL_RANGE_JPEG; else avctx->color_range = AVCOL_RANGE_MPEG; avctx->color_primaries = format->video_signal_description.color_primaries; avctx->color_trc = format->video_signal_description.transfer_characteristics; avctx->colorspace = format->video_signal_description.matrix_coefficients; if (format->bitrate) avctx->bit_rate = format->bitrate; if (format->frame_rate.numerator && format->frame_rate.denominator) { avctx->framerate.num = format->frame_rate.numerator; avctx->framerate.den = format->frame_rate.denominator; } if (ctx->cudecoder && avctx->coded_width == format->coded_width && avctx->coded_height == format->coded_height && ctx->chroma_format == format->chroma_format && ctx->codec_type == format->codec) return 1; if (ctx->cudecoder) { av_log(avctx, AV_LOG_TRACE, "Re-initializing decoder\n"); ctx->internal_error = CHECK_CU(ctx->cvdl->cuvidDestroyDecoder(ctx->cudecoder)); if (ctx->internal_error < 0) return 0; ctx->cudecoder = NULL; } if (hwframe_ctx->pool && ( hwframe_ctx->width < avctx->width || hwframe_ctx->height < avctx->height || hwframe_ctx->format != AV_PIX_FMT_CUDA || hwframe_ctx->sw_format != avctx->sw_pix_fmt)) { av_log(avctx, AV_LOG_ERROR, "AVHWFramesContext is already initialized with incompatible parameters\n"); ctx->internal_error = AVERROR(EINVAL); return 0; } if (format->chroma_format != cudaVideoChromaFormat_420) { av_log(avctx, AV_LOG_ERROR, "Chroma formats other than 420 are not supported\n"); ctx->internal_error = AVERROR(EINVAL); return 0; } avctx->coded_width = format->coded_width; avctx->coded_height = format->coded_height; ctx->chroma_format = format->chroma_format; memset(&cuinfo, 0, sizeof(cuinfo)); cuinfo.CodecType = ctx->codec_type = format->codec; cuinfo.ChromaFormat = format->chroma_format; switch (avctx->sw_pix_fmt) { case AV_PIX_FMT_NV12: cuinfo.OutputFormat = cudaVideoSurfaceFormat_NV12; break; case AV_PIX_FMT_P010: case AV_PIX_FMT_P016: cuinfo.OutputFormat = cudaVideoSurfaceFormat_P016; break; default: av_log(avctx, AV_LOG_ERROR, "Output formats other than NV12, P010 or P016 are not supported\n"); ctx->internal_error = AVERROR(EINVAL); return 0; } cuinfo.ulWidth = avctx->coded_width; cuinfo.ulHeight = avctx->coded_height; cuinfo.ulTargetWidth = cuinfo.ulWidth; cuinfo.ulTargetHeight = cuinfo.ulHeight; cuinfo.target_rect.left = 0; cuinfo.target_rect.top = 0; cuinfo.target_rect.right = cuinfo.ulWidth; cuinfo.target_rect.bottom = cuinfo.ulHeight; cuinfo.ulNumDecodeSurfaces = ctx->nb_surfaces; cuinfo.ulNumOutputSurfaces = 1; cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID; cuinfo.bitDepthMinus8 = format->bit_depth_luma_minus8; if (format->progressive_sequence) { ctx->deint_mode = cuinfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave; } else { cuinfo.DeinterlaceMode = ctx->deint_mode; } if (ctx->deint_mode != cudaVideoDeinterlaceMode_Weave) avctx->framerate = av_mul_q(avctx->framerate, (AVRational){2, 1}); ctx->internal_error = CHECK_CU(ctx->cvdl->cuvidCreateDecoder(&ctx->cudecoder, &cuinfo)); if (ctx->internal_error < 0) return 0; if (!hwframe_ctx->pool) { hwframe_ctx->format = AV_PIX_FMT_CUDA; hwframe_ctx->sw_format = avctx->sw_pix_fmt; hwframe_ctx->width = avctx->width; hwframe_ctx->height = avctx->height; if ((ctx->internal_error = av_hwframe_ctx_init(ctx->hwframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "av_hwframe_ctx_init failed\n"); return 0; } } return 1; }
1threat
static void coroutine_fn bdrv_aio_flush_co_entry(void *opaque) { BlockAIOCBCoroutine *acb = opaque; BlockDriverState *bs = acb->common.bs; acb->req.error = bdrv_co_flush(bs); acb->bh = aio_bh_new(bdrv_get_aio_context(bs), bdrv_co_em_bh, acb); qemu_bh_schedule(acb->bh); }
1threat
i have problem in htaccess in my localhost not redirecting correctly : my htaccess file contains RewriteEngine On RewriteRule ^projects/company/([^/]*)$ projects.php?companyid=$1 it was working fine but suddenly this section not working in my website this should redirect to "projects.php?companyid=$firstvariable" but acttually i don't know why. i tried restarting my pc and delete temp and restart wamp
0debug
Cant access value returned from PHP script : My PHP script returns response like {"message":"","response":{"key1":"value1","key2":"value2"}} How can I access/print the value of key1/key2 in Swift 2.2?
0debug
How to check the connection and presence of virtual internet android studio : <p>How to check the connection and presence of virtual internet android studio How to check the connection and presence of virtual internet android studio</p>
0debug
static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) { int i; unsigned int enc = 0; vnc_zlib_init(vs); vs->features = 0; vs->vnc_encoding = -1; vs->tight_compression = 9; vs->tight_quality = 9; vs->absolute = -1; for (i = n_encodings - 1; i >= 0; i--) { enc = encodings[i]; switch (enc) { case VNC_ENCODING_RAW: if (vs->vnc_encoding != -1) { vs->vnc_encoding = enc; } break; case VNC_ENCODING_COPYRECT: vs->features |= VNC_FEATURE_COPYRECT_MASK; break; case VNC_ENCODING_HEXTILE: vs->features |= VNC_FEATURE_HEXTILE_MASK; if (vs->vnc_encoding != -1) { vs->vnc_encoding = enc; } break; case VNC_ENCODING_ZLIB: vs->features |= VNC_FEATURE_ZLIB_MASK; if (vs->vnc_encoding != -1) { vs->vnc_encoding = enc; } break; case VNC_ENCODING_DESKTOPRESIZE: vs->features |= VNC_FEATURE_RESIZE_MASK; break; case VNC_ENCODING_POINTER_TYPE_CHANGE: vs->features |= VNC_FEATURE_POINTER_TYPE_CHANGE_MASK; break; case VNC_ENCODING_RICH_CURSOR: vs->features |= VNC_FEATURE_RICH_CURSOR_MASK; break; case VNC_ENCODING_EXT_KEY_EVENT: send_ext_key_event_ack(vs); break; case VNC_ENCODING_AUDIO: send_ext_audio_ack(vs); break; case VNC_ENCODING_WMVi: vs->features |= VNC_FEATURE_WMVI_MASK; break; case VNC_ENCODING_COMPRESSLEVEL0 ... VNC_ENCODING_COMPRESSLEVEL0 + 9: vs->tight_compression = (enc & 0x0F); break; case VNC_ENCODING_QUALITYLEVEL0 ... VNC_ENCODING_QUALITYLEVEL0 + 9: vs->tight_quality = (enc & 0x0F); break; default: VNC_DEBUG("Unknown encoding: %d (0x%.8x): %d\n", i, enc, enc); break; } } check_pointer_type_change(&vs->mouse_mode_notifier); }
1threat
update data from DialogFragment which show data in ReyclerView to another ReycyclerView from dialog starts See details in Picture : [description in this image][1] i want to update name and email onClick holder in RecylerView1. on click a Dialog open with list of name & Email in another RecylerView2 on click holder of RecyclerView2 update the holder of RecyclerView1 I implemented all thing except Updating back data to RecylerView1 form ReyclerView2 [1]: https://i.stack.imgur.com/jsndh.png
0debug
The number of registers in CUDA CC 5.0? : I have a GeForce GTX 745 (CC 5.0). The deviceQuery command shows that the total number of registers available per block is 65536 (65536 * 4 / 1024 = 256KB) I wrote a kernel that uses an array of size 10K and the kernel is invoked as following. I tried two ways to allocated the array: // using registers fun1() { short *arr = new short[100*100]; // 100*100*sizeof(short)=256K / per thread .... delete[] arr; } fun1<<<4, 64>>>(); // using global memory fun2(short *d_arr) { ... } fun2<<<4, 64>>>(d_arr); I can get the correct result in both manner. The first one which uses registers runs much faster. But when invoking the kernel using 6 blocks i got the wrong answer. fun1<<<6, 64>>>(); Now i'm wondering actually how many of registers can i use? And how is it related to the number of blocks ?
0debug
Is there an API to make use of the Windows Speech Recognition's MouseGrid feature? : <p>I'm hoping to use Microsoft's built in Mouse Grid feature. The feature is typically used via the Windows Speech Recognition feature to systematically narrow down where to click the screen via your voice. </p> <p>Does anyone know if the MouseGrid feature is exposed in any of Microsoft's APIs?</p> <p>This is how the feature looks during use:</p> <p><a href="https://i.stack.imgur.com/GsLIJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GsLIJ.png" alt="enter image description here"></a></p>
0debug
Why Button click event works in all version but not works in Android latest pie? : Recently Just know that all app works fine in android but testing in Emulator with android Pie stuck and first page not able to click and showing on email field "Unverified Post" i don't know what it means so can anybody know what updated in PIE? Checked code but not getting where's problem ! and what is Unverified Post that shows on email Textview ? ```java [enter image description here][1] findViewById(R.id.submit_btn).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { findViewById(R.id.submit_btn).setEnabled(false); register(); } }); ``` [1]: https://i.stack.imgur.com/H4uIh.png
0debug
hey i want to get list of top 250 movies of imdb but i'm unable it give me only this "{}" not whole list : I have added libraries properly there is no one error but it is not showing result as my desire...i have got the return type string and and saved it to a variable and then set it text view.. i have stuck here..please help me.. public String TableToJson() throws JSONException { int i=0; String s="http://www.imdb.com/chart/top"; Document doc = Jsoup.parse(s); JSONObject jsonParentObject = new JSONObject(); //JSONArray list = new JSONArray(); for (Element table : doc.select("table")) { for (Element row : table.select("tr")) { JSONObject jsonObject = new JSONObject(); Elements tds = row.select("td"); i++; String no = Integer.toString(i); String Name = tds.get(1).text(); String rating = tds.get(2).text(); jsonObject.put("Ranking", no); jsonObject.put("Title", Name); jsonObject.put("Rating", rating); jsonParentObject.put(Name, jsonObject); } } return jsonParentObject.toString(); } and output is only {}
0debug
static int ppc_fixup_cpu(PowerPCCPU *cpu) { CPUPPCState *env = &cpu->env; if ((env->insns_flags & ~PPC_TCG_INSNS) || (env->insns_flags2 & ~PPC_TCG_INSNS2)) { fprintf(stderr, "Warning: Disabling some instructions which are not " "emulated by TCG (0x%" PRIx64 ", 0x%" PRIx64 ")\n", env->insns_flags & ~PPC_TCG_INSNS, env->insns_flags2 & ~PPC_TCG_INSNS2); } env->insns_flags &= PPC_TCG_INSNS; env->insns_flags2 &= PPC_TCG_INSNS2; return 0; }
1threat
Browser Form Behavior : Normally I use JSON API and SPA for when I make web apps, but I am trying to learn how to use the more simple method server-side template-ing and default form behavior. Right now I am doing something very similar to what is seen [here][1]. The only difference is that i changed the `action` to `"/"` in the form for simplicity and handle the GET and POST from the same Handler (filtering by method type). The initial web page renders fine, the data gets sent correctly in a POST, I answer the POST with a just a 200 but then my webpage goes blank. How do i tell the browser to keep or rerender the original page? Do i need to send an HTML response to the POST? Something other than a 200? [1]: https://astaxie.gitbooks.io/build-web-application-with-golang/en/04.1.html
0debug
static bool gen_rsr_ccount(DisasContext *dc, TCGv_i32 d, uint32_t sr) { if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_helper_update_ccount(cpu_env); tcg_gen_mov_i32(d, cpu_SR[sr]); if (dc->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); return true; } return false; }
1threat
can't understand a specific example in python : i am seating here and playing around with python and wondered why this works: def fir(word): for x in word: print word[3] break fir('alex') and this is not: def fir(word): for x in word: print x[3] break fir('alex') tnx
0debug
core java concept, method overloading programme : package arunjava; public class sample3 { public static void main(String[] args) { Box25 b1=new Box25(); Box25 b2=new Box25(); b1.Dimension(25, 32, 65); b2.Dimension(25, 45, 62); System.out.println("volume is"+b1.volume()); System.out.println("volume is"+b2.volume()); b1.Dimension(4, 6, 8); b2.Dimension(6, 8, 4); System.out.println("volume is"+b1.vol()); System.out.println("volume is"+b2.vol()); } } class Box25 { double height,width,depth; int height1,width1,depth1; public void Dimension(double height, double width, double depth) { this.height=height; this.width=width; this.depth=depth; } public void Dimension(int height1, int width1, int depth1) { this.height1=height1; this.width1=width1; this.depth1=depth1; } double volume() { return height*depth*width; } int vol() { return height1*depth1*width1; } } Hey guys I had created the following programme in my java tutorial. The problem is that i am not able to compute the volume of the box which has the double datatype. The programme result shows the following: volume is0.0 volume is0.0 volume is192 volume is192 Secondly i have a doubt in the java concept Method overloading, as i know that in method overloading we can use the same method name with different parameters but as i created the volume method, i had to modify the name of the methods(volume,vol) so as to overload the volume method and get the answer. why is it like that Eagerly waiting for your reply guys as i am just new to the java programming language. i would a;so request you to paste the corrected code while answering.
0debug
how to change query to entity frame : i want to change this sql query to entity frame query SELECT dbo.ClassTiming.StartTime, dbo.ClassTiming.EndTime, dbo.Employee.StaffName, dbo.Department.DepartmentName, dbo.Class.ClassName, dbo.Section.SectionName, dbo.WeekDay.DayName FROM dbo.Timetable INNER JOIN dbo.ClassTiming ON dbo.Timetable.ClassTimingId = dbo.ClassTiming.Id INNER JOIN dbo.Employee ON dbo.Timetable.StaffId = dbo.Employee.StaffID INNER JOIN dbo.Department ON dbo.Timetable.DepartmentId = dbo.Department.id INNER JOIN dbo.Section ON dbo.Timetable.SectionID = dbo.Section.ID INNER JOIN dbo.Class ON dbo.Timetable.ClassID = dbo.Class.ID INNER JOIN dbo.WeekDay ON dbo.Timetable.WeekDayId = dbo.WeekDay.Id
0debug
Need help please. Jupyter Notebook : For one of my classes we are using Juypter to make graphs and all that good stuff. Coding is not my thing, and I usually try to follow my instuctor, but I don't think he's got Juypter down. We are trying to add letters to a chart. Here's the command we were given (I did add the numbers to the cell above): plt.scatter(spectralClass, apparentMagnitude) plt.title('H-R Diagram Cluster A') plt.xlabel('Spectral Class') plt.xticks( (0, 1, 2, 3, 4, 5, 6), ('B', 'A', 'F', 'G', 'K', 'M', '') ) plt.ylabel('Apparent Magnitude') plt.gca().invert_yaxis() plt.rcParams['figure.figsize'] = (10,10) plt.show() **I keep getting this error: NameError Traceback (most recent call last) <ipython-input-67-385bd2daa1cd> in <module>() ----> 1 plt.scatter(spectralClass, apparentMagnitude) 2 plt.title('H-R Diagram Cluster A') 3 plt.xlabel('Spectral Class') 4 plt.xticks( (0, 1, 2, 3, 4, 5, 6), ('B', 'A', 'F', 'G', 'K', 'M', '') ) 5 plt.ylabel('Apparent Magnitude') NameError: name 'apparentMagnitude' is not defined[enter image description here][1] [1]: https://i.stack.imgur.com/5sGXB.png
0debug
regarding keep rows where one column value satisfy certain constraints : <p>There has a dataframe, one column, e.g., 'cost', have some zero/empty entries, I would like to keep the rows whose 'cost' column are not zero/empty. How to do it in Pandas?</p>
0debug
SVGs in C#, draw multiple complex rectangles. : I'm creating a gannt chart to show hundreds of calendars for individual instances of orders, currently using an algorthim to draw lines and rectangles to create a grid, the problem is I'm the bitmaps are becoming far to large to draw, taking up ram, I've tried multiple different methods including drawing the bitmaps at half size and scaling them up (comes out horribly fuzzy) and still to large. I want to be able to draw SVGs as I figure for something that draws large simple shapes should reduce the size dramatically compared to bitmaps. the problem is I cant find anything on msdn that includes any sort of c# library for drawing svgs and I dont want to use external code. Do I need to create It in XAML or is there a library similar to how bitmaps are drawn ? [current bitmap version, either going out of bounds on the max size or just freezing because system is out of memeory][1] [1]: http://i.stack.imgur.com/SWZJ8.png
0debug
static void avc_wgt_4x4multiple_msa(uint8_t *data, int32_t stride, int32_t height, int32_t log2_denom, int32_t src_weight, int32_t offset_in) { uint8_t cnt; uint32_t data0, data1, data2, data3; v16u8 zero = { 0 }; v16u8 src0, src1, src2, src3; v8u16 temp0, temp1, temp2, temp3; v8i16 wgt, denom, offset; offset_in <<= (log2_denom); if (log2_denom) { offset_in += (1 << (log2_denom - 1)); } wgt = __msa_fill_h(src_weight); offset = __msa_fill_h(offset_in); denom = __msa_fill_h(log2_denom); for (cnt = height / 4; cnt--;) { LOAD_4WORDS_WITH_STRIDE(data, stride, data0, data1, data2, data3); src0 = (v16u8) __msa_fill_w(data0); src1 = (v16u8) __msa_fill_w(data1); src2 = (v16u8) __msa_fill_w(data2); src3 = (v16u8) __msa_fill_w(data3); ILVR_B_4VECS_UH(src0, src1, src2, src3, zero, zero, zero, zero, temp0, temp1, temp2, temp3); temp0 *= wgt; temp1 *= wgt; temp2 *= wgt; temp3 *= wgt; ADDS_S_H_4VECS_UH(temp0, offset, temp1, offset, temp2, offset, temp3, offset, temp0, temp1, temp2, temp3); MAXI_S_H_4VECS_UH(temp0, temp1, temp2, temp3, 0); SRL_H_4VECS_UH(temp0, temp1, temp2, temp3, temp0, temp1, temp2, temp3, denom); SAT_U_H_4VECS_UH(temp0, temp1, temp2, temp3, 7); PCKEV_B_STORE_4_BYTES_4(temp0, temp1, temp2, temp3, data, stride); data += (4 * stride); } }
1threat
How do you create custom notifications in Swift 3? : <p>In Objective-C, a custom notification is just a plain NSString, but it's not obvious in the WWDC version of Swift 3 just what it should be.</p>
0debug
Angular 2 http service. Get detailed error information : <p>Executing Angular2 http call to the offline server doesn't provide much info in it's "error response" object I'm getting in the Observable's .catch(error) operator or subscription error delegate (they are both share the same info actually). But as you can see on the screen shot of the console there's actual error was displayed by zone.js somehow. So, how can I get this specific error info (net::ERR_CONNECTION_REFUSED)?</p> <p>Thanks.<a href="https://i.stack.imgur.com/tLrA0.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/tLrA0.jpg" alt="enter image description here"></a></p>
0debug
int64_t ff_ape_parse_tag(AVFormatContext *s) { AVIOContext *pb = s->pb; int file_size = avio_size(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; int64_t tag_start; int i; if (file_size < APE_TAG_FOOTER_BYTES) return 0; avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); avio_read(pb, buf, 8); if (strncmp(buf, "APETAGEX", 8)) { return 0; } val = avio_rl32(pb); if (val > APE_TAG_VERSION) { av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return 0; } tag_bytes = avio_rl32(pb); if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); return 0; } tag_start = file_size - tag_bytes - APE_TAG_FOOTER_BYTES; if (tag_start < 0) { av_log(s, AV_LOG_ERROR, "Invalid tag size %u.\n", tag_bytes); return 0; } fields = avio_rl32(pb); if (fields > 65536) { av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return 0; } val = avio_rl32(pb); if (val & APE_TAG_FLAG_IS_HEADER) { av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); return 0; } avio_seek(pb, file_size - tag_bytes, SEEK_SET); for (i=0; i<fields; i++) if (ape_tag_read_field(s) < 0) break; return tag_start; }
1threat
What is wrong with this DB Diagram? : <p>Can someone tell me what is wrong with this database diagram?</p> <p><a href="https://i.stack.imgur.com/xJoOu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xJoOu.png" alt="DB Diagram"></a></p>
0debug
yuv2rgba64_2_c_template(SwsContext *c, const int32_t *buf[2], const int32_t *ubuf[2], const int32_t *vbuf[2], const int32_t *abuf[2], uint16_t *dest, int dstW, int yalpha, int uvalpha, int y, enum AVPixelFormat target, int hasAlpha) { const int32_t *buf0 = buf[0], *buf1 = buf[1], *ubuf0 = ubuf[0], *ubuf1 = ubuf[1], *vbuf0 = vbuf[0], *vbuf1 = vbuf[1], *abuf0 = hasAlpha ? abuf[0] : NULL, *abuf1 = hasAlpha ? abuf[1] : NULL; int yalpha1 = 4096 - yalpha; int uvalpha1 = 4096 - uvalpha; int i; for (i = 0; i < ((dstW + 1) >> 1); i++) { int Y1 = (buf0[i * 2] * yalpha1 + buf1[i * 2] * yalpha) >> 14; int Y2 = (buf0[i * 2 + 1] * yalpha1 + buf1[i * 2 + 1] * yalpha) >> 14; int U = (ubuf0[i] * uvalpha1 + ubuf1[i] * uvalpha + (-128 << 23)) >> 14; int V = (vbuf0[i] * uvalpha1 + vbuf1[i] * uvalpha + (-128 << 23)) >> 14; int A1, A2; int R, G, B; Y1 -= c->yuv2rgb_y_offset; Y2 -= c->yuv2rgb_y_offset; Y1 *= c->yuv2rgb_y_coeff; Y2 *= c->yuv2rgb_y_coeff; Y1 += 1 << 13; Y2 += 1 << 13; R = V * c->yuv2rgb_v2r_coeff; G = V * c->yuv2rgb_v2g_coeff + U * c->yuv2rgb_u2g_coeff; B = U * c->yuv2rgb_u2b_coeff; if (hasAlpha) { A1 = (abuf0[i * 2 ] * yalpha1 + abuf1[i * 2 ] * yalpha) >> 1; A2 = (abuf0[i * 2 + 1] * yalpha1 + abuf1[i * 2 + 1] * yalpha) >> 1; A1 += 1 << 13; A2 += 1 << 13; } output_pixel(&dest[0], av_clip_uintp2(B_R + Y1, 30) >> 14); output_pixel(&dest[1], av_clip_uintp2( G + Y1, 30) >> 14); output_pixel(&dest[2], av_clip_uintp2(R_B + Y1, 30) >> 14); output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14); output_pixel(&dest[4], av_clip_uintp2(B_R + Y2, 30) >> 14); output_pixel(&dest[5], av_clip_uintp2( G + Y2, 30) >> 14); output_pixel(&dest[6], av_clip_uintp2(R_B + Y2, 30) >> 14); output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14); dest += 8; } }
1threat
Python: how to rewrite a list in a different style? : I am generating most common items from a list using this code: content_count = [item for item in content_S if item[:1].isupper()] content_E = Counter(content_count) E = content_E.most_common(3) the code generate a list like this: E = [('item1', 8), ('item2', 6), ('item3', 5)] Is there a way to convert the list E into something like this: S = ['item1', 'item2', 'item3'] Searched for an answer here but no luck. Thanks in advance
0debug
static void mpeg4_decode_sprite_trajectory(MpegEncContext * s, GetBitContext *gb) { int i; int a= 2<<s->sprite_warping_accuracy; int rho= 3-s->sprite_warping_accuracy; int r=16/a; const int vop_ref[4][2]= {{0,0}, {s->width,0}, {0, s->height}, {s->width, s->height}}; int d[4][2]={{0,0}, {0,0}, {0,0}, {0,0}}; int sprite_ref[4][2]; int virtual_ref[2][2]; int w2, h2, w3, h3; int alpha=0, beta=0; int w= s->width; int h= s->height; int min_ab; for(i=0; i<s->num_sprite_warping_points; i++){ int length; int x=0, y=0; length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ x= get_xbits(gb, length); } if(!(s->divx_version==500 && s->divx_build==413)) skip_bits1(gb); length= get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); if(length){ y=get_xbits(gb, length); } skip_bits1(gb); s->sprite_traj[i][0]= d[i][0]= x; s->sprite_traj[i][1]= d[i][1]= y; } for(; i<4; i++) s->sprite_traj[i][0]= s->sprite_traj[i][1]= 0; while((1<<alpha)<w) alpha++; while((1<<beta )<h) beta++; w2= 1<<alpha; h2= 1<<beta; if(s->divx_version==500 && s->divx_build==413){ sprite_ref[0][0]= a*vop_ref[0][0] + d[0][0]; sprite_ref[0][1]= a*vop_ref[0][1] + d[0][1]; sprite_ref[1][0]= a*vop_ref[1][0] + d[0][0] + d[1][0]; sprite_ref[1][1]= a*vop_ref[1][1] + d[0][1] + d[1][1]; sprite_ref[2][0]= a*vop_ref[2][0] + d[0][0] + d[2][0]; sprite_ref[2][1]= a*vop_ref[2][1] + d[0][1] + d[2][1]; } else { sprite_ref[0][0]= (a>>1)*(2*vop_ref[0][0] + d[0][0]); sprite_ref[0][1]= (a>>1)*(2*vop_ref[0][1] + d[0][1]); sprite_ref[1][0]= (a>>1)*(2*vop_ref[1][0] + d[0][0] + d[1][0]); sprite_ref[1][1]= (a>>1)*(2*vop_ref[1][1] + d[0][1] + d[1][1]); sprite_ref[2][0]= (a>>1)*(2*vop_ref[2][0] + d[0][0] + d[2][0]); sprite_ref[2][1]= (a>>1)*(2*vop_ref[2][1] + d[0][1] + d[2][1]); } virtual_ref[0][0]= 16*(vop_ref[0][0] + w2) + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + w2*(r*sprite_ref[1][0] - 16*vop_ref[1][0])),w); virtual_ref[0][1]= 16*vop_ref[0][1] + ROUNDED_DIV(((w - w2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + w2*(r*sprite_ref[1][1] - 16*vop_ref[1][1])),w); virtual_ref[1][0]= 16*vop_ref[0][0] + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][0] - 16*vop_ref[0][0]) + h2*(r*sprite_ref[2][0] - 16*vop_ref[2][0])),h); virtual_ref[1][1]= 16*(vop_ref[0][1] + h2) + ROUNDED_DIV(((h - h2)*(r*sprite_ref[0][1] - 16*vop_ref[0][1]) + h2*(r*sprite_ref[2][1] - 16*vop_ref[2][1])),h); switch(s->num_sprite_warping_points) { case 0: s->sprite_offset[0][0]= 0; s->sprite_offset[0][1]= 0; s->sprite_offset[1][0]= 0; s->sprite_offset[1][1]= 0; s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; break; case 1: s->sprite_offset[0][0]= sprite_ref[0][0] - a*vop_ref[0][0]; s->sprite_offset[0][1]= sprite_ref[0][1] - a*vop_ref[0][1]; s->sprite_offset[1][0]= ((sprite_ref[0][0]>>1)|(sprite_ref[0][0]&1)) - a*(vop_ref[0][0]/2); s->sprite_offset[1][1]= ((sprite_ref[0][1]>>1)|(sprite_ref[0][1]&1)) - a*(vop_ref[0][1]/2); s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; break; case 2: s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+rho)) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][0]) + ( r*sprite_ref[0][1] - virtual_ref[0][1])*(-vop_ref[0][1]) + (1<<(alpha+rho-1)); s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+rho)) + (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-vop_ref[0][0]) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-vop_ref[0][1]) + (1<<(alpha+rho-1)); s->sprite_offset[1][0]= ( (-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][0] + 1) +( r*sprite_ref[0][1] - virtual_ref[0][1])*(-2*vop_ref[0][1] + 1) +2*w2*r*sprite_ref[0][0] - 16*w2 + (1<<(alpha+rho+1))); s->sprite_offset[1][1]= ( (-r*sprite_ref[0][1] + virtual_ref[0][1])*(-2*vop_ref[0][0] + 1) +(-r*sprite_ref[0][0] + virtual_ref[0][0])*(-2*vop_ref[0][1] + 1) +2*w2*r*sprite_ref[0][1] - 16*w2 + (1<<(alpha+rho+1))); s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0]); s->sprite_delta[0][1]= (+r*sprite_ref[0][1] - virtual_ref[0][1]); s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1]); s->sprite_delta[1][1]= (-r*sprite_ref[0][0] + virtual_ref[0][0]); s->sprite_shift[0]= alpha+rho; s->sprite_shift[1]= alpha+rho+2; break; case 3: min_ab= FFMIN(alpha, beta); w3= w2>>min_ab; h3= h2>>min_ab; s->sprite_offset[0][0]= (sprite_ref[0][0]<<(alpha+beta+rho-min_ab)) + (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-vop_ref[0][0]) + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-vop_ref[0][1]) + (1<<(alpha+beta+rho-min_ab-1)); s->sprite_offset[0][1]= (sprite_ref[0][1]<<(alpha+beta+rho-min_ab)) + (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-vop_ref[0][0]) + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-vop_ref[0][1]) + (1<<(alpha+beta+rho-min_ab-1)); s->sprite_offset[1][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3*(-2*vop_ref[0][0] + 1) + (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3*(-2*vop_ref[0][1] + 1) + 2*w2*h3*r*sprite_ref[0][0] - 16*w2*h3 + (1<<(alpha+beta+rho-min_ab+1)); s->sprite_offset[1][1]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3*(-2*vop_ref[0][0] + 1) + (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3*(-2*vop_ref[0][1] + 1) + 2*w2*h3*r*sprite_ref[0][1] - 16*w2*h3 + (1<<(alpha+beta+rho-min_ab+1)); s->sprite_delta[0][0]= (-r*sprite_ref[0][0] + virtual_ref[0][0])*h3; s->sprite_delta[0][1]= (-r*sprite_ref[0][0] + virtual_ref[1][0])*w3; s->sprite_delta[1][0]= (-r*sprite_ref[0][1] + virtual_ref[0][1])*h3; s->sprite_delta[1][1]= (-r*sprite_ref[0][1] + virtual_ref[1][1])*w3; s->sprite_shift[0]= alpha + beta + rho - min_ab; s->sprite_shift[1]= alpha + beta + rho - min_ab + 2; break; } if( s->sprite_delta[0][0] == a<<s->sprite_shift[0] && s->sprite_delta[0][1] == 0 && s->sprite_delta[1][0] == 0 && s->sprite_delta[1][1] == a<<s->sprite_shift[0]) { s->sprite_offset[0][0]>>=s->sprite_shift[0]; s->sprite_offset[0][1]>>=s->sprite_shift[0]; s->sprite_offset[1][0]>>=s->sprite_shift[1]; s->sprite_offset[1][1]>>=s->sprite_shift[1]; s->sprite_delta[0][0]= a; s->sprite_delta[0][1]= 0; s->sprite_delta[1][0]= 0; s->sprite_delta[1][1]= a; s->sprite_shift[0]= 0; s->sprite_shift[1]= 0; s->real_sprite_warping_points=1; } else{ int shift_y= 16 - s->sprite_shift[0]; int shift_c= 16 - s->sprite_shift[1]; for(i=0; i<2; i++){ s->sprite_offset[0][i]<<= shift_y; s->sprite_offset[1][i]<<= shift_c; s->sprite_delta[0][i]<<= shift_y; s->sprite_delta[1][i]<<= shift_y; s->sprite_shift[i]= 16; } s->real_sprite_warping_points= s->num_sprite_warping_points; } }
1threat
Is it possible to create product keys for my electron application? : <p>I want to build a desktop application and be able to publish product keys or serial numbers.Before the user can use the application he will be requested to enter the product key/serial number.</p> <p>Similar to Microsoft Office when they provide keys like XXXX-XXXX-XXXX-XXXX</p> <p>The idea I have is to sell the app based on licenses and providing product key for every device seems more professional than accounts (usernames and passwords).</p> <p>so my questions are:</p> <p>1) Is it possible to accomplish this with <code>electron</code>?</p> <p>2) Can you advice me wether I should go for serial numbers (if it is doable) or accounts? or are there better options?</p> <p>3) if you answered the second question. Please state why?</p>
0debug
void ioinst_handle_xsch(S390CPU *cpu, uint64_t reg1) { int cssid, ssid, schid, m; SubchDev *sch; int ret = -ENODEV; int cc; if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) { program_interrupt(&cpu->env, PGM_OPERAND, 2); return; } trace_ioinst_sch_id("xsch", cssid, ssid, schid); sch = css_find_subch(m, cssid, ssid, schid); if (sch && css_subch_visible(sch)) { ret = css_do_xsch(sch); } switch (ret) { case -ENODEV: cc = 3; break; case -EBUSY: cc = 2; break; case 0: cc = 0; break; default: cc = 1; break; } setcc(cpu, cc); }
1threat
Java: I have implemented 3 Search Algorithms. How I store these algorithms in a list (as method calls) and iterate over them in main? : **Briefing:** I have implemented three search algorithms to break a lock. A lock can be broken by the actions shaking, pulling, pulling, or poking. These are 4 methods can be applied to the given lock. This lock has a length anywhere from 1 to 16, meaning that if the length was 16, 16 back to back actions in the correct order will need to be done. For example, a length two lock that can be unlocked by pulling and then poking will need to be pulled and then poked. The data structure devised to solve this is a tree where each parent has 4 children that correspond to actions. These search algorithms climb the tree in many ways to find the correct solution to break a given lock. **Set-up of Solution & Problem:** I have one class called *Tree* that has 3 Search algorithms: Breadth-First, Depth-Limited, and Iterative-Deepening Search. In this same class, I have 2 helper methods to help each algorithm break a lock combination (check, which checks if the sequence of actions up to the child being viewed is a solution, and depth, which determines the depth of a given child). I also have a Node class that is used by Tree to create the root and subsequent children. **Now,** I want to store each algorithm in an array, so that I can iterate over each algorithm, and collect data for each algorithm from a main function. I have looked a little into the *Command Pattern regarding Polymorphism*. It seems that it might work, but I am confused on how I would have to organize my current solution to adapt. Perhaps there is a better solution than the Command Pattern. I can create a main in the Tree and simply call each algorithm there, but that seems a bit "sloppy" to me. Any suggestions?
0debug
How can I store looped data into an array in java : Firstly I am a beginner in java script. I want to store all the looped data into the Course_Code and Grade arrays. everything works except that only the last entered value is store. what must i do to save all the data in the array. <script> const MIN = 999; const MAX = 10000; const minLet = 64; const maxLet = 91; const GRADE_VALUE = 'parseInt(7)%parseInt(6)%parseInt(5)%parseInt(4)%parseInt(3)%parseFloat(1.5)'; var i; var j; var Grade = new Array(); var Course_Code = new Array(); while (willingnes != false) { var willingnes = confirm('Do you want to enter new Course Code? Click OK to continue or Cancel to stop?'); if(willingnes == true) { Course_Code = prompt('Enter your Course Code','AAA1000'); var Digits = parseInt(Course_Code.slice(-4)); // extract the last four digits from course code while(Course_Code.charCodeAt(0)<minLet || Course_Code.charCodeAt(0)>maxLet || Course_Code.charCodeAt(1)<minLet || Course_Code.charCodeAt(1)>maxLet ||Course_Code.charCodeAt(2)<minLet || Course_Code.charCodeAt(2)>maxLet || isNaN(Digits) || Digits<MIN || Digits>MAX) { alert('Your input was invalid'); Course_Code = prompt('Enter your Course Code','AAA1000'); } Grade = prompt('Input a valid Course grade:'); while(GRADE_VALUE.indexOf(Grade)<0){ alert('Invalid Course value.'); Grade = prompt('Re-enter valid course grade:'); } } } alert(Course_Code); alert(Grade); </script>
0debug
line brake i #each#command : I have a html file that gets data from an .js file with #each command like this: {{#each ssarr ../Maxss this}} <td>{{this}}</td> {{/each}} that output the data in a long line. Is it in some way possible to make a linebrake after 10 values so the row does not be so long?
0debug
void ff_mpeg4_encode_mb(MpegEncContext *s, int16_t block[6][64], int motion_x, int motion_y) { int cbpc, cbpy, pred_x, pred_y; PutBitContext *const pb2 = s->data_partitioning ? &s->pb2 : &s->pb; PutBitContext *const tex_pb = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_B ? &s->tex_pb : &s->pb; PutBitContext *const dc_pb = s->data_partitioning && s->pict_type != AV_PICTURE_TYPE_I ? &s->pb2 : &s->pb; const int interleaved_stats = (s->flags & CODEC_FLAG_PASS1) && !s->data_partitioning ? 1 : 0; if (!s->mb_intra) { int i, cbp; if (s->pict_type == AV_PICTURE_TYPE_B) { static const int mb_type_table[8] = { -1, 3, 2, 1, -1, -1, -1, 0 }; int mb_type = mb_type_table[s->mv_dir]; if (s->mb_x == 0) { for (i = 0; i < 2; i++) s->last_mv[i][0][0] = s->last_mv[i][0][1] = s->last_mv[i][1][0] = s->last_mv[i][1][1] = 0; } assert(s->dquant >= -2 && s->dquant <= 2); assert((s->dquant & 1) == 0); assert(mb_type >= 0); if (s->next_picture.mbskip_table[s->mb_y * s->mb_stride + s->mb_x]) { s->skip_count++; s->mv[0][0][0] = s->mv[0][0][1] = s->mv[1][0][0] = s->mv[1][0][1] = 0; s->mv_dir = MV_DIR_FORWARD; s->qscale -= s->dquant; return; } cbp = get_b_cbp(s, block, motion_x, motion_y, mb_type); if ((cbp | motion_x | motion_y | mb_type) == 0) { assert(s->dquant == 0); put_bits(&s->pb, 1, 1); if (interleaved_stats) { s->misc_bits++; s->last_bits++; } s->skip_count++; return; } put_bits(&s->pb, 1, 0); put_bits(&s->pb, 1, cbp ? 0 : 1); put_bits(&s->pb, mb_type + 1, 1); if (cbp) put_bits(&s->pb, 6, cbp); if (cbp && mb_type) { if (s->dquant) put_bits(&s->pb, 2, (s->dquant >> 2) + 3); else put_bits(&s->pb, 1, 0); } else s->qscale -= s->dquant; if (!s->progressive_sequence) { if (cbp) put_bits(&s->pb, 1, s->interlaced_dct); if (mb_type) put_bits(&s->pb, 1, s->mv_type == MV_TYPE_FIELD); } if (interleaved_stats) s->misc_bits += get_bits_diff(s); if (!mb_type) { assert(s->mv_dir & MV_DIRECT); ff_h263_encode_motion_vector(s, motion_x, motion_y, 1); s->b_count++; s->f_count++; } else { assert(mb_type > 0 && mb_type < 4); if (s->mv_type != MV_TYPE_FIELD) { if (s->mv_dir & MV_DIR_FORWARD) { ff_h263_encode_motion_vector(s, s->mv[0][0][0] - s->last_mv[0][0][0], s->mv[0][0][1] - s->last_mv[0][0][1], s->f_code); s->last_mv[0][0][0] = s->last_mv[0][1][0] = s->mv[0][0][0]; s->last_mv[0][0][1] = s->last_mv[0][1][1] = s->mv[0][0][1]; s->f_count++; } if (s->mv_dir & MV_DIR_BACKWARD) { ff_h263_encode_motion_vector(s, s->mv[1][0][0] - s->last_mv[1][0][0], s->mv[1][0][1] - s->last_mv[1][0][1], s->b_code); s->last_mv[1][0][0] = s->last_mv[1][1][0] = s->mv[1][0][0]; s->last_mv[1][0][1] = s->last_mv[1][1][1] = s->mv[1][0][1]; s->b_count++; } } else { if (s->mv_dir & MV_DIR_FORWARD) { put_bits(&s->pb, 1, s->field_select[0][0]); put_bits(&s->pb, 1, s->field_select[0][1]); } if (s->mv_dir & MV_DIR_BACKWARD) { put_bits(&s->pb, 1, s->field_select[1][0]); put_bits(&s->pb, 1, s->field_select[1][1]); } if (s->mv_dir & MV_DIR_FORWARD) { for (i = 0; i < 2; i++) { ff_h263_encode_motion_vector(s, s->mv[0][i][0] - s->last_mv[0][i][0], s->mv[0][i][1] - s->last_mv[0][i][1] / 2, s->f_code); s->last_mv[0][i][0] = s->mv[0][i][0]; s->last_mv[0][i][1] = s->mv[0][i][1] * 2; } s->f_count++; } if (s->mv_dir & MV_DIR_BACKWARD) { for (i = 0; i < 2; i++) { ff_h263_encode_motion_vector(s, s->mv[1][i][0] - s->last_mv[1][i][0], s->mv[1][i][1] - s->last_mv[1][i][1] / 2, s->b_code); s->last_mv[1][i][0] = s->mv[1][i][0]; s->last_mv[1][i][1] = s->mv[1][i][1] * 2; } s->b_count++; } } } if (interleaved_stats) s->mv_bits += get_bits_diff(s); mpeg4_encode_blocks(s, block, NULL, NULL, NULL, &s->pb); if (interleaved_stats) s->p_tex_bits += get_bits_diff(s); } else { cbp = get_p_cbp(s, block, motion_x, motion_y); if ((cbp | motion_x | motion_y | s->dquant) == 0 && s->mv_type == MV_TYPE_16X16) { if (s->max_b_frames > 0) { int i; int x, y, offset; uint8_t *p_pic; x = s->mb_x * 16; y = s->mb_y * 16; if (x + 16 > s->width) x = s->width - 16; if (y + 16 > s->height) y = s->height - 16; offset = x + y * s->linesize; p_pic = s->new_picture.f.data[0] + offset; s->mb_skipped = 1; for (i = 0; i < s->max_b_frames; i++) { uint8_t *b_pic; int diff; Picture *pic = s->reordered_input_picture[i + 1]; if (!pic || pic->f.pict_type != AV_PICTURE_TYPE_B) break; b_pic = pic->f.data[0] + offset; if (!pic->shared) b_pic += INPLACE_OFFSET; diff = s->dsp.sad[0](NULL, p_pic, b_pic, s->linesize, 16); if (diff > s->qscale * 70) { s->mb_skipped = 0; break; } } } else s->mb_skipped = 1; if (s->mb_skipped == 1) { put_bits(&s->pb, 1, 1); if (interleaved_stats) { s->misc_bits++; s->last_bits++; } s->skip_count++; return; } } put_bits(&s->pb, 1, 0); cbpc = cbp & 3; cbpy = cbp >> 2; cbpy ^= 0xf; if (s->mv_type == MV_TYPE_16X16) { if (s->dquant) cbpc += 8; put_bits(&s->pb, ff_h263_inter_MCBPC_bits[cbpc], ff_h263_inter_MCBPC_code[cbpc]); put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]); if (s->dquant) put_bits(pb2, 2, dquant_code[s->dquant + 2]); if (!s->progressive_sequence) { if (cbp) put_bits(pb2, 1, s->interlaced_dct); put_bits(pb2, 1, 0); } if (interleaved_stats) s->misc_bits += get_bits_diff(s); ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); ff_h263_encode_motion_vector(s, motion_x - pred_x, motion_y - pred_y, s->f_code); } else if (s->mv_type == MV_TYPE_FIELD) { if (s->dquant) cbpc += 8; put_bits(&s->pb, ff_h263_inter_MCBPC_bits[cbpc], ff_h263_inter_MCBPC_code[cbpc]); put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]); if (s->dquant) put_bits(pb2, 2, dquant_code[s->dquant + 2]); assert(!s->progressive_sequence); if (cbp) put_bits(pb2, 1, s->interlaced_dct); put_bits(pb2, 1, 1); if (interleaved_stats) s->misc_bits += get_bits_diff(s); ff_h263_pred_motion(s, 0, 0, &pred_x, &pred_y); pred_y /= 2; put_bits(&s->pb, 1, s->field_select[0][0]); put_bits(&s->pb, 1, s->field_select[0][1]); ff_h263_encode_motion_vector(s, s->mv[0][0][0] - pred_x, s->mv[0][0][1] - pred_y, s->f_code); ff_h263_encode_motion_vector(s, s->mv[0][1][0] - pred_x, s->mv[0][1][1] - pred_y, s->f_code); } else { assert(s->mv_type == MV_TYPE_8X8); put_bits(&s->pb, ff_h263_inter_MCBPC_bits[cbpc + 16], ff_h263_inter_MCBPC_code[cbpc + 16]); put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]); if (!s->progressive_sequence && cbp) put_bits(pb2, 1, s->interlaced_dct); if (interleaved_stats) s->misc_bits += get_bits_diff(s); for (i = 0; i < 4; i++) { ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); ff_h263_encode_motion_vector(s, s->current_picture.motion_val[0][s->block_index[i]][0] - pred_x, s->current_picture.motion_val[0][s->block_index[i]][1] - pred_y, s->f_code); } } if (interleaved_stats) s->mv_bits += get_bits_diff(s); mpeg4_encode_blocks(s, block, NULL, NULL, NULL, tex_pb); if (interleaved_stats) s->p_tex_bits += get_bits_diff(s); s->f_count++; } } else { int cbp; int dc_diff[6]; int dir[6]; int zigzag_last_index[6]; uint8_t *scan_table[6]; int i; for (i = 0; i < 6; i++) dc_diff[i] = ff_mpeg4_pred_dc(s, i, block[i][0], &dir[i], 1); if (s->flags & CODEC_FLAG_AC_PRED) { s->ac_pred = decide_ac_pred(s, block, dir, scan_table, zigzag_last_index); } else { for (i = 0; i < 6; i++) scan_table[i] = s->intra_scantable.permutated; } cbp = 0; for (i = 0; i < 6; i++) if (s->block_last_index[i] >= 1) cbp |= 1 << (5 - i); cbpc = cbp & 3; if (s->pict_type == AV_PICTURE_TYPE_I) { if (s->dquant) cbpc += 4; put_bits(&s->pb, ff_h263_intra_MCBPC_bits[cbpc], ff_h263_intra_MCBPC_code[cbpc]); } else { if (s->dquant) cbpc += 8; put_bits(&s->pb, 1, 0); put_bits(&s->pb, ff_h263_inter_MCBPC_bits[cbpc + 4], ff_h263_inter_MCBPC_code[cbpc + 4]); } put_bits(pb2, 1, s->ac_pred); cbpy = cbp >> 2; put_bits(pb2, ff_h263_cbpy_tab[cbpy][1], ff_h263_cbpy_tab[cbpy][0]); if (s->dquant) put_bits(dc_pb, 2, dquant_code[s->dquant + 2]); if (!s->progressive_sequence) put_bits(dc_pb, 1, s->interlaced_dct); if (interleaved_stats) s->misc_bits += get_bits_diff(s); mpeg4_encode_blocks(s, block, dc_diff, scan_table, dc_pb, tex_pb); if (interleaved_stats) s->i_tex_bits += get_bits_diff(s); s->i_count++; if (s->ac_pred) restore_ac_coeffs(s, block, dir, scan_table, zigzag_last_index); } }
1threat
Couldn't understand this SWIFT Fucntion : <p>Hope you are doing well. Would anyone please explain this code to me? I am still not getting how we got 120 here. When the parameters were passed to the function, where was it saved? How did it determine max and min before calculating? </p> <p>Would be really appreciated if anyone could explain it for me please..</p> <p><a href="https://i.stack.imgur.com/eGNB1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eGNB1.png" alt="Function"></a></p>
0debug
How to test component callback invoked by child component callback in React with Enzyme? : <p>Say I have the following application:</p> <pre><code>class Child extends React.Component { render() { return &lt;button onClick={this.handleChildOnClick}&gt;{this.props.children}&lt;/button&gt;; } handleChildOnClick() { this.props.onChildClick('foo'); } } class Parent extends React.Component { render() { return &lt;Child onChildClick={this.handleParentOnClick}&gt;click me&lt;/Child&gt;; } handleParentOnClick(text) { this.props.onParentClick(12345); } } class App extends React.Component { render() { return &lt;Parent onParentClick={(num) =&gt; console.log(num)} /&gt;; } } </code></pre> <p>I'm having a hard time figuring out the proper way to test the <code>Parent</code> component. The <code>Child</code> and <code>App</code> one are not a problem, but the <code>Parent</code>...</p> <p>I mean, how do I test that a click on the <code>Child</code> component is going to invoke the <code>Parent</code> click callback without:</p> <ol> <li>...rendering <code>Child</code>. <code>Parent</code> should be tested in isolation as a shallow render. <code>Child</code> will also be tested in isolation and if I do a mount render, I'm basically testing the click callback on the <code>Child</code> twice.</li> <li>...directly invoking <code>handleParentOnClick</code> on the <code>Parent</code> instance. I shouldn't depend on the exact implementation of <code>Parent</code> for this. If I change the name of the callback function, the test will break and it could very well be a false positive.</li> </ol> <p>Is there a third option?</p>
0debug
def check_Validity(a,b,c): if (a + b <= c) or (a + c <= b) or (b + c <= a) : return False else: return True
0debug
Is it possible to alias an import? : <p>In c# when pulling in a library that has a lot of name collisions with existing code, there's a way to alias the import so you don't need to fully clarify the namespace for each use. eg:</p> <pre><code>using MyCompany.MyLibrary.Model as MMM </code></pre> <p>then you could do</p> <pre><code>MMM.MyObject </code></pre> <p>instead of</p> <pre><code>MyCompany.MyLibrary.Model.MyObject </code></pre> <p>With the recent update to swift 3.0, I've found some of my model objects are now colliding with the <code>Foundation</code> types, and I've been forced to prefix things that used to have an <code>NS</code> prefix in the class name with <code>Foundation.classname</code>. It would be great if I could type alias the import of my model library much like the c# example given above. Is this possible in swift 3.0? If not is there another strategy to avoid name collisions that would result in having to write the framework name in front of each type? I'm considering going back to prefixing my class names like we did in obj-c, but I'm trying to explore my options before I do that.</p>
0debug
How to reference two times to a single footnote in rmarkdown? : <p>I try to reference to a single footnote in a few places in the text. However, with the code below, I've got two footnotes with the same content.</p> <pre><code>--- title: "My document" output: html_document --- One part of the text [^1]. Two pages later [^1]. [^1]: My footnote </code></pre> <p><a href="https://i.stack.imgur.com/xaJzZ.png" rel="noreferrer"><img src="https://i.stack.imgur.com/xaJzZ.png" alt="enter image description here"></a></p> <p>Is it possible to reference more than once to a specific footnote using <code>rmarkdown</code>?</p>
0debug
Flutter - Position list view below another widget : <p>I'm starting with Flutter, and I came across a layout with which I'm having trouble building, below a visual example:</p> <p><a href="https://i.stack.imgur.com/yRUPZ.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/yRUPZ.jpg" alt="enter image description here"></a></p> <p>I already tried something like:</p> <pre><code> class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Welcome to Flutter', home: new Scaffold( appBar: new AppBar( title: new Text('App'), ), body: new Column( children: &lt;Widget&gt;[ new Text('LISTA', style: new TextStyle( fontSize: 15.2, fontWeight: FontWeight.bold, ) ), new Container( height: 200.0, child: new ListView( children: &lt;Widget&gt;[ new RaisedButton( onPressed: null, child: new Text("text button"), ), new Padding(padding: new EdgeInsets.all(5.00)), new RaisedButton( onPressed: null, child: new Text("text button 2"), ) ], ), ) ] ) ), ); } } </code></pre> <p>But for Container it needs a height, and I need it to take up the rest of the screen.</p>
0debug
Get clang format to put closing parenthesis of multiline function calls on separate lines? : <p>I've been using clang format to help keep my code clean. For multiline function calls, is there any way to get clang to put the cloning parenthesis on it's own line?</p> <p><strong>Example:</strong></p> <p>What it's doing now:</p> <pre><code>increment_and_call_on_match( clique_colors, 0, max_clique_color, [&amp;](int clique_color) { comms.emplace_back(context.split_by_color(clique_color)); }, [&amp;](int) { context.split_by_color(); }); </code></pre> <p>What I want: </p> <pre><code>increment_and_call_on_match( clique_colors, 0, max_clique_color, [&amp;](int clique_color) { comms.emplace_back(context.split_by_color(clique_color)); }, [&amp;](int) { context.split_by_color(); } ); //Closing paren on new line </code></pre>
0debug
Android testing: Waited for the root of the view hierarchy to have window focus : <p>In Android Ui testing, I want to click on a spinner item in a dialog, but it pop up with this error: </p> <pre><code>va.lang.RuntimeException: Waited for the root of the view hierarchy to have window focus and not be requesting layout for over 10 seconds. If you specified a non default root matcher, it may be picking a root that never takes focus. Otherwise, something is seriously wrong. Selected Root: Root{application-window-token=android.view.ViewRootImpl$W@2dac97c7, window-token=android.view.ViewRootImpl$W@2dac97c7, has-window-focus=false, layout-params-type=1, layout-params-string=WM.LayoutParams{(0,0)(fillxfill) sim=#10 ty=1 fl=#81810100 pfl=0x8 wanim=0x1030461 surfaceInsets=Rect(0, 0 - 0, 0) mwfl=0x0}, decor-view-string=MultiPhoneDecorView{id=-1, visibility=VISIBLE, width=1600, height=2560, has-focus=true, has-focusable=true, has-window-focus=false, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}} . All Roots: Root{application-window-token=android.view.ViewRootImpl$W@3c913e1, window-token=android.view.ViewRootImpl$W@21b23506, has-window-focus=true, layout-params-type=1002, layout-params-string=WM.LayoutParams{(310,600)(722x480) gr=#10000033 sim=#1 ty=1002 fl=#1860200 fmt=-3 wanim=0x10302db surfaceInsets=Rect(0, 0 - 0, 0) mwfl=0x0}, decor-view-string=PopupViewContainer{id=-1, visibility=VISIBLE, width=722, height=480, has-focus=true, has-focusable=true, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}} Root{application-window-token=android.view.ViewRootImpl$W@3c913e1, window-token=android.view.ViewRootImpl$W@3c913e1, has-window-focus=false, layout-params-type=2, layout-params-string=WM.LayoutParams{(0,0)(wrapxwrap) gr=#11 sim=#20 ty=2 fl=#1800002 pfl=0x8 fmt=-3 wanim=0x1030462 surfaceInsets=Rect(0, 0 - 0, 0) mwfl=0x10}, decor-view-string=DecorView{id=-1, visibility=VISIBLE, width=1136, height=1058, has-focus=true, has-focusable=true, has-window-focus=false, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}} Root{application-window-token=android.view.ViewRootImpl$W@2dac97c7, window-token=android.view.ViewRootImpl$W@2dac97c7, has-window-focus=false, layout-params-type=1, layout-params-string=WM.LayoutParams{(0,0)(fillxfill) sim=#10 ty=1 fl=#81810100 pfl=0x8 wanim=0x1030461 surfaceInsets=Rect(0, 0 - 0, 0) mwfl=0x0}, decor-view-string=MultiPhoneDecorView{id=-1, visibility=VISIBLE, width=1600, height=2560, has-focus=true, has-focusable=true, has-window-focus=false, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, root-is-layout-requested=false, has-input-connection=false, x=0.0, y=0.0, child-count=1}} at android.support.test.espresso.base.RootViewPicker.get(RootViewPicker.java:99) at android.support.test.espresso.ViewInteractionModule.provideRootView(ViewInteractionModule.java:69) at android.support.test.espresso.ViewInteractionModule_ProvideRootViewFactory.get(ViewInteractionModule_ProvideRootViewFactory.java:23) at android.support.test.espresso.ViewInteractionModule_ProvideRootViewFactory.get(ViewInteractionModule_ProvideRootViewFactory.java:9) at android.support.test.espresso.base.ViewFinderImpl.getView(ViewFinderImpl.java:68) at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:120) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:145) at android.app.ActivityThread.main(ActivityThread.java:6117) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) </code></pre> <p>I have tried </p> <pre><code>onData(allOf(is(instanceOf(String.class)),containsString("A4"))).inRoot(isPlatformPopup()).perform(click()); </code></pre> <p>and</p> <pre><code>onView(withText(containsString("A4"))).inRoot(isFocusable()).check(matches(isDisplayed())); </code></pre> <p>and</p> <pre><code>onView(withText(containsString("A4"))).inRoot(withDecorView(not(getActivity().getWindow().getDecorView()))).check(matches(isDisplayed())); </code></pre> <p>but none of them works... Can anyone tell me how to get the ralavant root please?</p>
0debug
'n' variable in rust loop undeclared? : I don't understand where this 'n' variable in the below code comes from or what exactly it is, the author says it reads 20 bytes at a time bytes at a time, where is this coming from? My real problem is figuring out how to read from a rust TcpStream, but I think I understand that part and would just like to know where 'n' comes from. I am trying to implement an HTTP client (sorta) in Rust as my one of my first projects and I'm trying to follow this code: ```rust fn handle_client(mut stream: TcpStream) { // read 20 bytes at a time from stream echoing back to stream loop { let mut read = [0; 1028]; match stream.read(&mut read) { Ok(n) => { if n == 0 { // connection was closed break; } stream.write(&read[0..n]).unwrap(); } Err(err) => { panic!(err); } } } } ``` I haven't really tried anything yet because I want to understand before I do.
0debug
Observe LiveData from foreground service : <p>I have a repository which holds the LiveData object and is used by both activity and a foreground service through a ViewModel. When I start observing from the activity everything works as expected. However observing from the service doesn't trigger the Observe. This is the code I use</p> <pre><code>class MyService: LifecycleService() { lateinit var viewModel: PlayerServiceViewModel override fun onCreate() { viewModel = MyViewModel(applicationContext as Application) } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { viewModel.getLiveData().observe(this, Observer { data -&gt; // Do something with the data }) } } </code></pre> <p>Any ideas why it doesn't work and I don't receive the data?</p>
0debug
Vimeo video stops playing on Android 6 devices : <p>I'm trying to play video's from Vimeo in my app. The problem is that on Android 6 devices the video stops playing after a certain time. On devices with a lower API everything plays fine.</p> <ul> <li>The time depends on the quality. For the video of the provided url's below plays a certain minutes (1 to 3). How lower the video quality how longer it keeps playing.</li> <li>After 1 to 3 minutes the mediaplayer throws an ProtocolException. The app does not crash on this but the video freezes when the buffered video piece is played. <code>[MediaHTTPConnection] readAt 25182208 / 32768 =&gt; java.net.ProtocolException: unexpected end of stream and shows this in de log</code></li> <li>After the exception the video plays 30 seconds (buffered), then the application outputs this <code>[MediaPlayer] error (1, -1004)</code></li> </ul> <p>We're emailing for weeks now with Vimeo Support but they can't provide a solution or a possible cause. Now after weeks of mailing the support desk says that they're not supporting Android, but we've tried their suggestions:</p> <ul> <li>Use the redirected and unredirected url's</li> </ul> <p><a href="http://player.vimeo.com/external/185069251.hd.mp4?s=fd7b4178a59166b3f636f2e48f1d49b99db66ed2&amp;profile_id=174" rel="noreferrer">http://player.vimeo.com/external/185069251.hd.mp4?s=fd7b4178a59166b3f636f2e48f1d49b99db66ed2&amp;profile_id=174</a> [Redirected URL]</p> <p><a href="https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/01/2013/7/185069251/610514667.mp4?token=586a9287_0xbb25f73405c612b30e0c64dc4c3a169e30137f84" rel="noreferrer">https://fpdl.vimeocdn.com/vimeo-prod-skyfire-std-us/01/2013/7/185069251/610514667.mp4?token=586a9287_0xbb25f73405c612b30e0c64dc4c3a169e30137f84</a> [Not redirected URL]</p> <ul> <li><p>Use a video view instead of a mediaplayer </p></li> <li><p>We've tried a native Android and a Xamarin Android implementation</p></li> <li><p>Try to download the file => this works but we want to stream because some video's are longer then 30 minutes (>100mb). Uncomment the code in the onCreate in the DownLoadActivity to test downloading.</p></li> </ul> <p>In the browser everything works fine. </p> <p>I've placed a testproject on We-Transfer where you can see the problem <a href="https://bazookas.wetransfer.com/downloads/40dadcc8a01f7ebf025345cdf88b731220170102160508/21970a" rel="noreferrer">https://bazookas.wetransfer.com/downloads/40dadcc8a01f7ebf025345cdf88b731220170102160508/21970a</a></p>
0debug
static void qemu_laio_completion_cb(void *opaque) { struct qemu_laio_state *s = opaque; while (1) { struct io_event events[MAX_EVENTS]; uint64_t val; ssize_t ret; struct timespec ts = { 0 }; int nevents, i; do { ret = read(s->efd, &val, sizeof(val)); } while (ret == 1 && errno == EINTR); if (ret == -1 && errno == EAGAIN) break; if (ret != 8) break; do { nevents = io_getevents(s->ctx, val, MAX_EVENTS, events, &ts); } while (nevents == -EINTR); for (i = 0; i < nevents; i++) { struct iocb *iocb = events[i].obj; struct qemu_laiocb *laiocb = container_of(iocb, struct qemu_laiocb, iocb); laiocb->ret = io_event_ret(&events[i]); qemu_laio_enqueue_completed(s, laiocb); } } }
1threat
How run python with html or php? : <p>2 file is in the root: index.html or index.php , script.py I want to run the python program by clicking on the button on the Html(or php) page. is it possible? if yes, please guide me. if no, what solution you recommend?</p>
0debug
Perl array manipulation : I have a huge array with a bunch of subarrays and values, and I need to simply extract just the emails for each subarray. The entire array is a collection of entities in our database and the subarrays themselves represent contacts within each entity and all of their contact values. Here is an example of what the beginning of the array looks like: $VAR1 = [ { 'total' => '2', 'results' => [ { 'contact_type_name' => 'Primary Technical Contact', 'street' => undef, 'state_id' => undef, 'state_name' => undef, 'last_name' => 'Barb', 'entities' => [ { 'entity_name' => 'XXXXX', 'entity_id' => 'XXXXX' } ], 'state_abbr_name' => undef, 'city' => undef, 'country_id' => undef, 'latitude' => undef, 'contact_id' => 'XXXXXX', 'contact_type_id' => '1', 'roles' => [], 'contact_methods' => [ { 'entity_name' => undef, 'contact_method_value' => 'XXXXXXX', 'contact_method_type_id' => '4', 'contact_method_id' => '24041', 'entity_id' => undef, 'contact_method_type_name' => 'Cell Phone' }, { 'entity_name' => undef, 'contact_method_value' => 'XXXXXX', 'contact_method_type_id' => '2', 'contact_method_id' => '24051', 'entity_id' => undef, 'contact_method_type_name' => 'Office Phone' }, { 'entity_name' => undef, 'contact_method_value' => 'EMAIL', 'contact_method_type_id' => '1', 'contact_method_id' => '24061', 'entity_id' => undef, 'contact_method_type_name' => 'Email' } ], 'country_name' => undef, 'longitude' => undef, 'country_abbr_name' => undef, 'full_name' => 'NAME', 'networks' => [ { 'network_name' => 'NET', 'network_id' => 'X' } ], 'timezone_id' => undef, 'zip' => undef, 'timezone_name' => undef, 'title' => 'MAC/Network Specialist', 'first_name' => 'Terri' }, { 'contact_type_name' => 'Primary Technical Contact', 'street' => 'STREET', 'state_id' => undef, 'state_name' => undef, 'last_name' => 'NAME', 'entities' => [ { 'entity_name' => 'NAME', 'entity_id' => '2679' } ], 'state_abbr_name' => undef, 'city' => 'CITY', 'country_id' => undef, 'latitude' => undef, 'contact_id' => '7896', 'contact_type_id' => '1', 'roles' => [], 'contact_methods' => [ { 'entity_name' => undef, 'contact_method_value' => 'EMAIL', 'contact_method_type_id' => '1', 'contact_method_id' => '16796', 'entity_id' => undef, 'contact_method_type_name' => 'Email' }, { 'entity_name' => undef, 'contact_method_value' => 'number', 'contact_method_type_id' => '2', 'contact_method_id' => '16797', 'entity_id' => undef, 'contact_method_type_name' => 'Office Phone' } ], 'country_name' => undef, 'longitude' => undef, 'country_abbr_name' => undef, 'full_name' => 'NAME', 'networks' => [ { 'network_name' => 'net', 'network_id' => '17' } ], 'timezone_id' => undef, 'zip' => 'zip', 'timezone_name' => undef, 'title' => 'Infrastructure Manager', 'first_name' => 'name' } ], 'offset' => '0' }, { 'total' => '2', 'results' => [ NEXT SET.......... I need to figure out an efficient way to extract just the emails from this messy set of data. Thank you for any help.
0debug
Filling a progressbar via a variable : <p>I am using four ProgressBars in my AndroidApp. First of all I want them all to be empty, and when I update a Variable, I want one of the ProgressBars to get filled a bit. But only up to a "goal" that I want to set in beforehand. For example as soon as the Variable hits 1000, the ProgressBar should be filled and a message should pop up or something like that, when the variable is 500, it should be halfway filled and so on.</p> <p>These are my problems, I think they might all be solved by knowing how to bind a ProgressBar to a variable? If so, please tell me how I can achieve that, else, please tell me how I can still get my plan done. THANK YOU!</p>
0debug
Why is self a required parameter for a method? : <p>Let's say that I have a tiny code like this:</p> <pre><code>#!/usr/bin/env python3 class Dog(): def __init__(self, name, age): self.name = name self.age = age def sit(self): print(self.name + " is now sitting.") my_dog = Dog('willie',6) my_dog.sit() </code></pre> <p>As I understand, the line <code>my_dog = Dog('willie',6)</code> creates an instance named <code>my_dog</code>. It calls the <code>__init__</code> function, converts it internally to <code>Dog.__init__(my_dog, willie, 6)</code> and sets the <code>my_dog.name</code> and <code>my_dog.age</code> variables to <code>willie</code> and <code>6</code>? Now when the <code>my_dog.sit()</code> is executed, then why does the method <code>sit()</code> require a <code>self</code> as a parameter? Is it because if there is another instance of the same class(for example, <code>your_dog</code>), then it knows to use <code>your_dog.name</code> instead of <code>my_dog.name</code>?</p>
0debug
Call metatable methods inside metatable itself : <p>Is there a way to call metatable methods inside the metatable itself? For example</p> <pre><code>local t = {} local mt = { __index = { dog = function() print("bark") end, sound = function() t:dog() end } } setmetatable(t,mt) t:Sound() </code></pre> <p>raises this error:</p> <p><em>attempt to call method 'Sound' (a nil value)</em></p>
0debug
Xcode Swift run app in background forever : I am testing my app and this will never be submitted to the iOS store. What is the best way to get the app to run forever in the background? I have set the Required Background Modes item 0 to voip but it still closes after sometime. Any help is greatly appreciated.
0debug
void vnc_client_error(VncState *vs) { vnc_client_io_error(vs, -1, EINVAL); }
1threat
Overload the + operator to add an object with int : <p>I have just learned operator overloading and I am having trouble overloading the '+' operator to add an object with int. I am also not sure with how to overload the '&lt;&lt;' to output an object. </p> <p>Any advice or help would be greatly appreciated.</p> <pre><code>#include&lt;iostream&gt; #include &lt;cstdlib&gt; #include &lt;ctime&gt; using namespace std; class CLOCK { public: int h, m, s; CLOCK() { h = 0; m = 0; s = 0; } CLOCK(int hour, int minute, int second) { hour = h; minute = m; second = s; } CLOCK operator+(int time) { CLOCK c(*this); c.m += time; return c; } CLOCK operator++(int) { CLOCK c(h,m,s); h++; return c; } friend ostream &amp;operator&lt;&lt;(ostream &amp;output, const CLOCK &amp;c) { output &lt;&lt; c.h &lt;&lt; c.m &lt;&lt; c.s &lt;&lt; endl; return output; } }; int main() { CLOCK c(10, 10, 10); cout &lt;&lt; c &lt;&lt; endl; // should display 101010 c = c + 10; // should display 10 minutes to my clock cout &lt;&lt; c.hour &lt;&lt; c.minute &lt;&lt; c.second &lt;&lt; endl; // should display 102010 c++; // this should increment hours, time now is 012010 system("pause"); } </code></pre>
0debug
Android signature verification : <p>I have got lot of doubts to be cleared in the case of Android signature verification and its vulnerability. </p> <p>Once we generate apk for an application we can unpack the apk and edit resource files using apktool. As we repack the edited apk back it loses its signature. I can resign the unsigned apk using the jarsigner with my own private key that i used while generating the apk. I found an application named zipsigner in playstore which can be used to sign such kind of unsigned apk. </p> <p>So when this zipsigner signs the unsigned apk, whether the apk is signed with my same private key or with a different key? Because my META-INF folder still holds the XXX.SF and XXX.RSA files which holds the information of my private key. If it is with my same private key then the new apk will be an upgrade for my application or if it is a different key i will be having two different applications with same name. </p> <p>From the above situations there are possibilities that malware could be included in my apk while repacking. There seems to be a loophole in Android's signature verification mechanism where the message digest of the files inside the META-INF folder are not included in the MANIFEST.MF as well as in the XXX.SF file. This creates a possibility for anyone to include malware codes inside these folders, repack the apk and resign it with the zipsigner application. </p> <p>I was searching for a solution where i can prevent files being added into the META-INF folder and i found one from the below blog. But I'm unable to get the point of the solution. This looks like more of a research topic so there is not much information available in the internet. Can someone try and figure out the solution specified in the blog. The blog link is specified below the question. </p> <p><a href="http://blog.trustlook.com/2015/09/09/android-signature-verification-vulnerability-and-exploitation/">http://blog.trustlook.com/2015/09/09/android-signature-verification-vulnerability-and-exploitation/</a></p>
0debug
static int vdi_check(BlockDriverState *bs, BdrvCheckResult *res) { BDRVVdiState *s = (BDRVVdiState *)bs->opaque; uint32_t blocks_allocated = 0; uint32_t block; uint32_t *bmap; logout("\n"); bmap = g_malloc(s->header.blocks_in_image * sizeof(uint32_t)); memset(bmap, 0xff, s->header.blocks_in_image * sizeof(uint32_t)); for (block = 0; block < s->header.blocks_in_image; block++) { uint32_t bmap_entry = le32_to_cpu(s->bmap[block]); if (VDI_IS_ALLOCATED(bmap_entry)) { if (bmap_entry < s->header.blocks_in_image) { blocks_allocated++; if (!VDI_IS_ALLOCATED(bmap[bmap_entry])) { bmap[bmap_entry] = bmap_entry; } else { fprintf(stderr, "ERROR: block index %" PRIu32 " also used by %" PRIu32 "\n", bmap[bmap_entry], bmap_entry); res->corruptions++; } } else { fprintf(stderr, "ERROR: block index %" PRIu32 " too large, is %" PRIu32 "\n", block, bmap_entry); res->corruptions++; } } } if (blocks_allocated != s->header.blocks_allocated) { fprintf(stderr, "ERROR: allocated blocks mismatch, is %" PRIu32 ", should be %" PRIu32 "\n", blocks_allocated, s->header.blocks_allocated); res->corruptions++; } g_free(bmap); return 0; }
1threat
Why is adding methods to a type different than adding a sub or an operator in perl6? : <p>Making subs/procedures available for reuse is one core function of modules, and I would argue that it is the fundamental way how a language can be composable and therefore efficient with programmer time: </p> <p>if you create a type in your module, I can create my own module that adds a sub that operates on your type. I do not have to extend your module to do that.</p> <pre><code># your module class Foo { has $.id; has $.name; } # my module sub foo-str(Foo:D $f) is export { return "[{$f.id}-{$f.name}]" } # someone else using yours and mine together for profit my $f = Foo.new(:id(1234), :name("brclge")); say foo-str($f); </code></pre> <p>As seen in <a href="https://stackoverflow.com/questions/55814075/overloading-operators-for-a-class">Overloading operators for a class</a> this composability of modules works equally well for operators, which to me makes sense since operators are just some kinda syntactic sugar for subs anyway (in my head at least). Note that the definition of such an operator does not cause any surprising change of behavior of existing code, you need to import it into your code explicitly to get access to it, just like the sub above.</p> <p>Given this, I find it very odd that we do not have a similar mechanism for methods, see e.g. the discussion at <a href="https://stackoverflow.com/questions/34504849/how-do-you-add-a-method-to-an-existing-class-in-perl-6">How do you add a method to an existing class in Perl 6?</a>, especially since perl6 is such a method-happy language. If I want to extend the usage of an existing type, I would want to do that in the same style as the original module was written in. If there is a .is-prime on Int, it must be possible for me to add a .is-semi-prime as well, right?</p> <p>I read the discussion at the link above, but don't quite buy the "action at a distance" argument: how is that different from me exporting another multi sub from a module? for example the rust way of making this a lexical change (Trait + impl ... for) seems quite hygienic to me, and would be very much in line with the operator approach above.</p> <p>More interesting (to me at least) than the technicalities is the question if language design: isn't the ability to provide new verbs (subs, operators, methods) for existing nouns (types) a core design goal for a language like perl6? If it is, why would it treat methods differently? And if it does treat them differently for a good reason, does that not mean we are using way to many non-composable methods as nouns where we should be using subs instead?</p>
0debug
Is it possible to spread a list inside a list in Kotlin? : <p>It is possible to do argument unpacking in Kotlin similar to how it is done in Python? E.g.</p> <pre><code>&gt;&gt;&gt; a = [1,2,3] &gt;&gt;&gt; b = [*a,4,5,6] &gt;&gt;&gt; b [1, 2, 3, 4, 5, 6] </code></pre> <p>I know that it is possible in Kotlin as follows:</p> <pre><code>&gt;&gt;&gt; listOf(1, 2, 3, *listOf(4,5,6).toTypedArray()) [1, 2, 3, 4, 5, 6] </code></pre> <p>Feels like there is an easier way in Kotlin. Any ideas?</p>
0debug
Progress bar while loading image using Glide : <p>Can I load a spinner in placeholder with rotating animation until the image is loaded using Glide?</p> <p>I am trying to do that using .placeholder(R.Drawable.spinner) no animation is coming up?</p> <p>It would be great if somebody could help me out?</p> <p>Thanks!</p>
0debug
static int vdi_co_read(BlockDriverState *bs, int64_t sector_num, uint8_t *buf, int nb_sectors) { BDRVVdiState *s = bs->opaque; uint32_t bmap_entry; uint32_t block_index; uint32_t sector_in_block; uint32_t n_sectors; int ret; logout("\n"); restart: block_index = sector_num / s->block_sectors; sector_in_block = sector_num % s->block_sectors; n_sectors = s->block_sectors - sector_in_block; if (n_sectors > nb_sectors) { n_sectors = nb_sectors; } logout("will read %u sectors starting at sector %" PRIu64 "\n", n_sectors, sector_num); bmap_entry = le32_to_cpu(s->bmap[block_index]); if (!VDI_IS_ALLOCATED(bmap_entry)) { memset(buf, 0, n_sectors * SECTOR_SIZE); ret = 0; } else { uint64_t offset = s->header.offset_data / SECTOR_SIZE + (uint64_t)bmap_entry * s->block_sectors + sector_in_block; ret = bdrv_read(bs->file, offset, buf, n_sectors); } logout("%u sectors read\n", n_sectors); nb_sectors -= n_sectors; sector_num += n_sectors; buf += n_sectors * SECTOR_SIZE; if (ret >= 0 && nb_sectors > 0) { goto restart; } return ret; }
1threat
How do I sort this JSON Object by price in Javascript? : <p>I have a JSON object that I'd like to sort by price from least to greatest.</p> <pre><code>{ "BEY": { "1": { "price": 2280, "airline": "QR", }, "2": { "price": 2108, "airline": "UA", } }, "BKK": { "1": { "price": 2956, "airline": "QR", }, "2": { "price": 1718, "airline": "WS", } } } </code></pre> <p>I'd like to re-format it so that the key is the price of the airplane ticket. For example:</p> <pre><code>{ 1718: { "airline" : "WS", "IATA_Code" : "BKK" }, 2108: { "airline" : "UA", "IATA_Code" : "BEY" }, 2280: { "airline" : "QR", "IATA_Code" : "BEY" }, 2956: { "airline" : "QR", "IATA_Code" : "BKK" } } </code></pre>
0debug
How do I get the uri from a CloseableHttpResponse : When I get a CloseableHttpResponse object for the response to a web request, and the request was successful, how do I get the URI of the response?
0debug
What's the function of `<T>` in `fn foo<T>() = default`? : In `fn foo<T>() = default;` what does the `<T>` actually do and refer to? Can I omit it when my Event doesn't include for example `AccountId`? This is referring to http://shawntabrizi.com/substrate-collectables-workshop/#/2/creating-an-event?id=depositing-an-event.
0debug
Perfomance Effect of Laravel Framework : <p>I'm wondering about the performance implications of using the laravel framework. Mainly the disk seeks, if it's scalable and if I can somehow cache the files in RAM.</p> <p>Thanks!</p>
0debug
Order multidimensional array according to a second array : <p>I would like to order <code>$ArrayToOrder</code> according to column <code>SecondArrayField2</code> in <code>$SecondArray</code>, where the link between the two arrays are <code>Field_3</code> (in $ArrayToOrder) and <code>SecondArrayField1</code> in $SecondArray.</p> <pre><code>$ArrayToOrder=Array ( [0] =&gt; Array ( [Field_1] =&gt; 13 [Field_2] =&gt; 15 [Field_3] =&gt; 3 ) [1] =&gt; Array ( [Field_1] =&gt; 25 [Field_2] =&gt; 17 [Field_3] =&gt; 2 ) [2] =&gt; Array ( [Field_1] =&gt; 121 [Field_2] =&gt; 20 [Field_3] =&gt; 11 ) ) $SecondArray=Array ( [0] =&gt; Array ( [SecondArrayField1] =&gt; 11 [SecondArrayField2] =&gt; Bruce ) [1] =&gt; Array ( [SecondArrayField1] =&gt; 3 [SecondArrayField2] =&gt; Arthur ) [2] =&gt; Array ( [SecondArrayField1] =&gt; 2 [SecondArrayField2] =&gt; Mary ) ) </code></pre> <p>Desired result as follows:</p> <pre><code>$ArrayToOrder=Array ( [0] =&gt; Array ( [Field_1] =&gt; 13 [Field_2] =&gt; 15 [Field_3] =&gt; 3 //(Arthur) ) [1] =&gt; Array ( [Field_1] =&gt; 121 [Field_2] =&gt; 20 [Field_3] =&gt; 11 //(Bruce) ) [2] =&gt; Array ( [Field_1] =&gt; 25 [Field_2] =&gt; 17 [Field_3] =&gt; 2 //(Mary) ) ) </code></pre>
0debug
static void unassigned_mem_write(void *opaque, target_phys_addr_t addr, uint64_t val, unsigned size) { #ifdef DEBUG_UNASSIGNED printf("Unassigned mem write " TARGET_FMT_plx " = 0x%"PRIx64"\n", addr, val); #endif #if defined(TARGET_ALPHA) || defined(TARGET_SPARC) || defined(TARGET_MICROBLAZE) cpu_unassigned_access(cpu_single_env, addr, 1, 0, 0, size); #endif }
1threat
static void filter_line_c(uint8_t *dst, uint8_t *prev, uint8_t *cur, uint8_t *next, int w, int prefs, int mrefs, int parity, int mode) { int x; uint8_t *prev2 = parity ? prev : cur ; uint8_t *next2 = parity ? cur : next; for (x = 0; x < w; x++) { int c = cur[mrefs]; int d = (prev2[0] + next2[0])>>1; int e = cur[prefs]; int temporal_diff0 = FFABS(prev2[0] - next2[0]); int temporal_diff1 =(FFABS(prev[mrefs] - c) + FFABS(prev[prefs] - e) )>>1; int temporal_diff2 =(FFABS(next[mrefs] - c) + FFABS(next[prefs] - e) )>>1; int diff = FFMAX3(temporal_diff0>>1, temporal_diff1, temporal_diff2); int spatial_pred = (c+e)>>1; int spatial_score = FFABS(cur[mrefs-1] - cur[prefs-1]) + FFABS(c-e) + FFABS(cur[mrefs+1] - cur[prefs+1]) - 1; #define CHECK(j)\ { int score = FFABS(cur[mrefs-1+j] - cur[prefs-1-j])\ + FFABS(cur[mrefs +j] - cur[prefs -j])\ + FFABS(cur[mrefs+1+j] - cur[prefs+1-j]);\ if (score < spatial_score) {\ spatial_score= score;\ spatial_pred= (cur[mrefs +j] + cur[prefs -j])>>1;\ CHECK(-1) CHECK(-2) }} }}
1threat
Blackjack game error? : <p>This is my blackjack game, and every time I run it, I get this error:</p> <pre><code>Traceback (most recent call last): File "...", line 42, in &lt;module&gt; mydeck = deck() File "...", line 9, in deck deck.append(suit+rank) TypeError: Can't convert 'int' object to str implicitly </code></pre> <p>(I took out the location and name of the file)</p> <p>I'm not sure why this is happening. Can someone please help? Thanks!</p> <pre><code># Blackjack Game import random def deck(): deck = [] for suit in ['H','S','D','C']: for rank in ['A',2,3,4,5,6,7,8,9,10,'J','Q','K']: deck.append(suit+rank) random.shuffle(deck) return deck def pCount(cards): count = 0 aceCount = 0 for i in cards: if(i[1] == 'J' or i[1] == 'Q' or i[1] == 'K' or i[1] == 10): count += 10 elif (i[1] != 'A'): count += int(i[1]) else: aceCount += 1 if aceCount == 1 and count &gt;= 10: count += 11 elif aceCount != 0: count += 1 return count def playingHands(deck): dealerhand = [] playerhand = [] dealerhand.append(deck.pop()) dealerhand.append(deck.pop()) playerhand.append(deck.pop()) playerhand.append(deck.pop()) while pCount(dealerhand) &lt;= 16: dealerhand.append(deck.pop()) return [dealerhand, playerhand] game = "" mydeck = deck() hands = playingHands(dck) dealer = hands[0] player = hands[1] while game != 'exit': dealerCount = pCount(dealer) playerCount = pCount(player) print ('Dealer has: ') print (dealer) print ('Player, you have: ') print (player) if playerCount == 21: print ('Blackjack! Player wins!') break elif playerCount &gt; 21: print ('Player busts! With '+playerCount+' points. Dealer wins!') break elif dealerCount &gt; 21: print ('Dealer busts! With '+dealerCount+' points. Player wins!') break game = input('What would you like to do? H: hit, S: stand? ') if game == 'H': player.append(deck.pop()) elif playerCount &gt; dealerCount: print ('Player wins with ' + playerCount + ' points') print ('Dealer has ' + dealer + ' or ' +dealerCount + ' points') break else: print ('Dealer wins!') print ('Dealer has ' + dealer + ' or ' +dealerCount + ' points') </code></pre> <p>. . . . . . . . . .. . . . . . . .</p> <p>.. . . . . . . .</p>
0debug
"İ".toLowerCase() != "i" : <p>In Turkish, there's a letter <code>İ</code> which is the uppercase form of <code>i</code>. When I convert it to lowercase, I get a weird result. For example:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var string_tr = "İ".toLowerCase(); var string_en = "i"; console.log( string_tr == string_en ); // false console.log( string_tr.split("") ); // ["i", "̇"] console.log( string_tr.charCodeAt(1) ); // 775 console.log( string_en.charCodeAt(0) ); // 105</code></pre> </div> </div> </p> <p><code>"İ".toLowerCase()</code> returns an extra character, and if I'm not mistaken, it's <a href="http://www.fileformat.info/info/unicode/char/0307/index.htm" rel="noreferrer">COMBINING DOT ABOVE (U+0307)</a>.</p> <p>How do I get rid of this character?</p> <p>I could just filter the string:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var string_tr = "İ".toLowerCase(); string_tr = string_tr.split("").filter(function (item) { if (item.charCodeAt(0) != 775) { return true; } }).join(""); console.log(string_tr.split(""));</code></pre> </div> </div> </p> <p>but am I handing this correctly? Is there a more preferable way? Furthermore, why does this extra character appear in the first place?</p> <p>There's some inconsistency. For example, in Turkish, there a lowercase form of <code>I</code>: <code>ı</code>. How come the following comparison returns true</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log( "ı".toUpperCase() == "i".toUpperCase() ) // true</code></pre> </div> </div> </p> <p>while </p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log( "İ".toLowerCase() == "i" ) // false</code></pre> </div> </div> </p> <p>returns false?</p>
0debug
static inline void t_gen_add_flag(TCGv d, int flag) { TCGv c; c = tcg_temp_new(TCG_TYPE_TL); t_gen_mov_TN_preg(c, PR_CCS); tcg_gen_andi_tl(c, c, 1 << flag); if (flag) tcg_gen_shri_tl(c, c, flag); tcg_gen_add_tl(d, d, c); tcg_temp_free(c); }
1threat
Blazor in Internet Explorer : <p>I am trying to run blazor application in Internet Explorer. On blazor page is written there is a fallback into asm.js for browsers without webassembly support. But when I load page in IE (with blazor.pollyfil.js script linked), I just get error "Browser does'n support WebAssembly".</p> <p>I am able to run application in server mode (SignalR connection to rendering server), but it is solution for all browsers and the main benefit (WebAssembly) disappears.</p> <p>Is there really way how to correctly fall back to asm.js mode in (only) Internet Explorer?</p>
0debug
Postman GET Request works but not Ajax CORS : I am trying to make an AJAX request to get information of a restAPI. If I test it with POSTMAN, it works and with Putty too with this code selecting RAW, but not with AJAX due to CORS issues. This is the code that works on Putty (it returns JSON data): GET /api/slot/0/io/do HTTP/1.1\r\n Host: 172.25.0.208\r\n Content-Type: application/json\r\n Accept: vdn.dac.v1\r\n \r\n This is the JQuery AJAX code: //Build GET Request URL var url = "//" + ipDevice + "/api/slot/" + slot + "/io/do"; jQuery.support.cors = true; //GET Request with HTTP header info $.ajax({ "url": url, "method": "GET", "headers": { "Accept": "vdn.dac.v1", "Content-type": "application/json" }, "success": function (response) { getPowerStatusSuccess(response); }, "error": function (response) { getPowerStatusFail(response); } }); The error I got on browser console (firefox) is: https://imgur.com/a/RPQOH Please, can you help me? Thank you very much.
0debug
testing with a session data to display a photo in a blade page : i want to test "sexe" to display a photo. I use the session but nothing happens that's the controller: public function store () { request()->validate([ 'username'=>['required'], 'sexe'=>['required'] , 'role'=>['required'] , ]); $enfant= new enfant(); $enfant->username=request('username'); $enfant->role=request('role'); $enfant->sexe=request('sexe'); $enfant->parent_id=Auth::user()->id; $enfant->save(); $sexe = session()->get( 'sexe' ); return redirect ('/themes', compact('enfants'))->with([ 'sexe' => $sexe ]); } and that's the view {{ session()->get( 'sexe' ) }} @if ( 'sexe'=='f' ) <img src="images/avatarF.png" class="profile" style="width: 160px ; height: 160px;"> @endif @if ( 'sexe'=='h' ) <img src="images/avatarG.png" class="profile" style="width: 1600px ; height: 160px; margin-top: 0px;"> @endif
0debug
static TranslationBlock *tb_find_physical(CPUState *cpu, target_ulong pc, target_ulong cs_base, uint32_t flags) { CPUArchState *env = (CPUArchState *)cpu->env_ptr; TranslationBlock *tb, **tb_hash_head, **ptb1; unsigned int h; tb_page_addr_t phys_pc, phys_page1; tcg_ctx.tb_ctx.tb_invalidated_flag = 0; phys_pc = get_page_addr_code(env, pc); phys_page1 = phys_pc & TARGET_PAGE_MASK; h = tb_phys_hash_func(phys_pc); ptb1 = tb_hash_head = &tcg_ctx.tb_ctx.tb_phys_hash[h]; tb = *ptb1; while (tb) { if (tb->pc == pc && tb->page_addr[0] == phys_page1 && tb->cs_base == cs_base && tb->flags == flags) { if (tb->page_addr[1] == -1) { break; } else { target_ulong virt_page2 = (pc & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE; tb_page_addr_t phys_page2 = get_page_addr_code(env, virt_page2); if (tb->page_addr[1] == phys_page2) { break; } } } ptb1 = &tb->phys_hash_next; tb = *ptb1; } if (tb) { *ptb1 = tb->phys_hash_next; tb->phys_hash_next = *tb_hash_head; *tb_hash_head = tb; } return tb; }
1threat
Is there a frontend open library dynamic insert cell into table? : <p>I am a backend developer,not to skillful on javascript. My webpage need dynamic insert cell into a table, and the table belong a form. Is there a open javascript library can do it? <a href="https://i.stack.imgur.com/JYcWD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JYcWD.png" alt="enter image description here"></a></p>
0debug
Inline editing in the Angular Material data table : <p>Consider an example below. Is it possible to make the angular material data table with inline editing feature? Or making cells under specific columns as editable on load itself (see the image below where Email column fields are editable). If so could you share the sample code?</p> <p><a href="https://stackoverflow.com/questions/49774579/angular-material-data-table-with-dynamic-rows">Angular Material data Table with dynamic rows</a></p> <p><a href="https://i.stack.imgur.com/GJkVk.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/GJkVk.jpg" alt="enter image description here"></a></p>
0debug
Is storing an OAuth token in cookies bad practise? : <p>Is storing an OAuth 2 token in cookies bad practise? If so, what are alternatives for a web app?</p>
0debug
What wrong in the SELECT CODE? : <p>Im trying to pull out only "completed" orders whats the problem in this select code?</p> <pre><code>('SELECT * FROM orders WHERE OrderUserID = :OrderUserID AND WHERE OrderStatus='Completed'); </code></pre>
0debug
adding a function in href using JQuery : <p>I've just added this piece of code in my JSP</p> <pre><code>&lt;script type="text/javascript"&gt; $('a').click( function(e) { e.preventDefault(); alert ('hello'); return false; } ); &lt;/script&gt; </code></pre> <p>but nothing happens when I click to a
0debug
static int g2m_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; G2MContext *c = avctx->priv_data; AVFrame *pic = data; GetByteContext bc, tbc; int magic; int got_header = 0; uint32_t chunk_size, r_mask, g_mask, b_mask; int chunk_type, chunk_start; int i; int ret; if (buf_size < 12) { av_log(avctx, AV_LOG_ERROR, "Frame should have at least 12 bytes, got %d instead\n", buf_size); return AVERROR_INVALIDDATA; } bytestream2_init(&bc, buf, buf_size); magic = bytestream2_get_be32(&bc); if ((magic & ~0xF) != MKBETAG('G', '2', 'M', '0') || (magic & 0xF) < 2 || (magic & 0xF) > 5) { av_log(avctx, AV_LOG_ERROR, "Wrong magic %08X\n", magic); return AVERROR_INVALIDDATA; } c->swapuv = magic == MKBETAG('G', '2', 'M', '2'); while (bytestream2_get_bytes_left(&bc) > 5) { chunk_size = bytestream2_get_le32(&bc) - 1; chunk_type = bytestream2_get_byte(&bc); chunk_start = bytestream2_tell(&bc); if (chunk_size > bytestream2_get_bytes_left(&bc)) { av_log(avctx, AV_LOG_ERROR, "Invalid chunk size %"PRIu32" type %02X\n", chunk_size, chunk_type); break; } switch (chunk_type) { case DISPLAY_INFO: got_header = c->got_header = 0; if (chunk_size < 21) { av_log(avctx, AV_LOG_ERROR, "Invalid display info size %"PRIu32"\n", chunk_size); break; } c->width = bytestream2_get_be32(&bc); c->height = bytestream2_get_be32(&bc); if (c->width < 16 || c->width > c->orig_width || c->height < 16 || c->height > c->orig_height) { av_log(avctx, AV_LOG_ERROR, "Invalid frame dimensions %dx%d\n", c->width, c->height); ret = AVERROR_INVALIDDATA; goto header_fail; } if (c->width != avctx->width || c->height != avctx->height) { ret = ff_set_dimensions(avctx, c->width, c->height); if (ret < 0) goto header_fail; } c->compression = bytestream2_get_be32(&bc); if (c->compression != 2 && c->compression != 3) { av_log(avctx, AV_LOG_ERROR, "Unknown compression method %d\n", c->compression); ret = AVERROR_PATCHWELCOME; goto header_fail; } c->tile_width = bytestream2_get_be32(&bc); c->tile_height = bytestream2_get_be32(&bc); if (c->tile_width <= 0 || c->tile_height <= 0 || ((c->tile_width | c->tile_height) & 0xF) || c->tile_width * 4LL * c->tile_height >= INT_MAX ) { av_log(avctx, AV_LOG_ERROR, "Invalid tile dimensions %dx%d\n", c->tile_width, c->tile_height); ret = AVERROR_INVALIDDATA; goto header_fail; } c->tiles_x = (c->width + c->tile_width - 1) / c->tile_width; c->tiles_y = (c->height + c->tile_height - 1) / c->tile_height; c->bpp = bytestream2_get_byte(&bc); if (c->bpp == 32) { if (bytestream2_get_bytes_left(&bc) < 16 || (chunk_size - 21) < 16) { av_log(avctx, AV_LOG_ERROR, "Display info: missing bitmasks!\n"); ret = AVERROR_INVALIDDATA; goto header_fail; } r_mask = bytestream2_get_be32(&bc); g_mask = bytestream2_get_be32(&bc); b_mask = bytestream2_get_be32(&bc); if (r_mask != 0xFF0000 || g_mask != 0xFF00 || b_mask != 0xFF) { av_log(avctx, AV_LOG_ERROR, "Invalid or unsupported bitmasks: R=%"PRIX32", G=%"PRIX32", B=%"PRIX32"\n", r_mask, g_mask, b_mask); ret = AVERROR_PATCHWELCOME; goto header_fail; } } else { avpriv_request_sample(avctx, "bpp=%d", c->bpp); ret = AVERROR_PATCHWELCOME; goto header_fail; } if (g2m_init_buffers(c)) { ret = AVERROR(ENOMEM); goto header_fail; } got_header = 1; break; case TILE_DATA: if (!c->tiles_x || !c->tiles_y) { av_log(avctx, AV_LOG_WARNING, "No display info - skipping tile\n"); break; } if (chunk_size < 2) { av_log(avctx, AV_LOG_ERROR, "Invalid tile data size %"PRIu32"\n", chunk_size); break; } c->tile_x = bytestream2_get_byte(&bc); c->tile_y = bytestream2_get_byte(&bc); if (c->tile_x >= c->tiles_x || c->tile_y >= c->tiles_y) { av_log(avctx, AV_LOG_ERROR, "Invalid tile pos %d,%d (in %dx%d grid)\n", c->tile_x, c->tile_y, c->tiles_x, c->tiles_y); break; } ret = 0; switch (c->compression) { case COMPR_EPIC_J_B: ret = epic_jb_decode_tile(c, c->tile_x, c->tile_y, buf + bytestream2_tell(&bc), chunk_size - 2, avctx); break; case COMPR_KEMPF_J_B: ret = kempf_decode_tile(c, c->tile_x, c->tile_y, buf + bytestream2_tell(&bc), chunk_size - 2); break; } if (ret && c->framebuf) av_log(avctx, AV_LOG_ERROR, "Error decoding tile %d,%d\n", c->tile_x, c->tile_y); break; case CURSOR_POS: if (chunk_size < 5) { av_log(avctx, AV_LOG_ERROR, "Invalid cursor pos size %"PRIu32"\n", chunk_size); break; } c->cursor_x = bytestream2_get_be16(&bc); c->cursor_y = bytestream2_get_be16(&bc); break; case CURSOR_SHAPE: if (chunk_size < 8) { av_log(avctx, AV_LOG_ERROR, "Invalid cursor data size %"PRIu32"\n", chunk_size); break; } bytestream2_init(&tbc, buf + bytestream2_tell(&bc), chunk_size - 4); g2m_load_cursor(avctx, c, &tbc); break; case CHUNK_CC: case CHUNK_CD: break; default: av_log(avctx, AV_LOG_WARNING, "Skipping chunk type %02d\n", chunk_type); } bytestream2_skip(&bc, chunk_start + chunk_size - bytestream2_tell(&bc)); } if (got_header) c->got_header = 1; if (c->width && c->height && c->framebuf) { if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; pic->key_frame = got_header; pic->pict_type = got_header ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; for (i = 0; i < avctx->height; i++) memcpy(pic->data[0] + i * pic->linesize[0], c->framebuf + i * c->framebuf_stride, c->width * 3); g2m_paint_cursor(c, pic->data[0], pic->linesize[0]); *got_picture_ptr = 1; } return buf_size; header_fail: c->width = c->height = 0; c->tiles_x = c->tiles_y = 0; return ret; }
1threat
How to replace page title dynamically by popup box title? : <p>My index page contains popup box. I want to replace index page title by popup box title if popup box clicked. </p> <p>For example</p> <pre><code>&lt;title&gt;&lt;?php echo $title?&gt;&lt;/title&gt; </code></pre> <p>I want to display as following: </p> <pre><code>&lt;?php if(condition){ (-&gt;*such as #model2 is clicked*) $title="Model2 Section"; } else{ $title="Home" } ?&gt; </code></pre> <p>I have used popup box as following:-> <strong>(link for popup box)</strong></p> <pre><code>&lt;article&gt; &lt;a href="#modal2" class="dsnbutton ybank" id="pop_button"&gt;Model 2&lt;/a&gt; &lt;/article&gt; </code></pre> <p><strong>popup box</strong></p> <pre><code>&lt;div class="remodal" data-remodal-id="modal2" role="dialog" aria-labelledby="modal2Title" aria-describedby="modal2Desc"&gt; </code></pre> <p><strong>How to change title ?</strong> Any Idea.</p>
0debug
white space control in jekyll - why does {%- ... -%} a la liquid not work? : <p>The <a href="https://help.shopify.com/themes/liquid/basics/whitespace" rel="noreferrer">liquid documentation</a> states that </p> <blockquote> <p>By including hyphens in your assign tag, you can strip the generated whitespace from the rendered template ... if you don't want any of your tags to output whitespace, as a general rule you can add hyphens to both sides of all your tags ({%- and -%}):</p> </blockquote> <p>When I try in jekyll</p> <pre><code>{%- case key -%} </code></pre> <p>I get the error</p> <pre><code>Error: Liquid syntax error (line 139): Tag '{%- case key -%}' was not properly terminated with regexp: /\%\}/ </code></pre> <p>There are many posts about excessive whitespace in the jekyll generated html, for example <a href="https://www.sylvaindurand.org/compressing-liquid-generated-html/" rel="noreferrer">Compressing Liquid generated code</a>.</p> <p>They all complain about dilute HTML output and discuss plug-ins as solution. My simple questions are:</p> <ol> <li>Why does <code>{%- ... -%}</code> not work in jekyll ?</li> <li>Why behaves jekyll differently than the liquid documentation suggests</li> </ol>
0debug
Trim Part of a string in php : <p>I have a string in a variable like this:</p> <pre><code>$var = "This is a banana (fruit)"; </code></pre> <p>How do I trim / get the part 'fruit' only? (i.e., data inside braces whatever it is).</p>
0debug
How true caller access the incoming call detail? Like incoming number and Name in iPhone's? : Currently we are getting error during access incoming calling number information in iOS/Xcode . Please suggest answer using Objective C.. How we detect incoming calling number in our iOS app?
0debug
want to pass image from one activity to another : <p>I have to transfer the image from one activity to another. In first activity there are two buttons (take photo) and (View Image).User can take photo by pressing (take photo) button and that photo will be transfer to another activity class which can be view by (View Image) button. Help required.</p>
0debug
Requires Plugin for Test : <p>Hey guys i am looking for an wordpress plugin in which two user can take part in a quiz the quiz questions be decided by the admin and two user can take part in this test and after that they can check the compatibility between two is this kind of plugin available in wordpress?</p>
0debug