problem
stringlengths 26
131k
| labels
class label 2
classes |
|---|---|
Custom User model fields (AbstractUser) not showing in django admin : <p>I have extended User model for django, using AbstractUser method. The problem is, my custom fields do not show in django admin panel.</p>
<p>My models.py:</p>
<pre><code>from django.contrib.auth.models import AbstractUser
class User(AbstractUser):
is_bot_flag = models.BooleanField(default=False)
</code></pre>
<p>My admin.py:</p>
<pre><code>from django.contrib.auth.admin import UserAdmin
from .models import User
admin.site.register(User, UserAdmin)
</code></pre>
<p>Thanks</p>
| 0debug
|
Django models across multiple projects/microservices. How to? : <p>I'm wondering how to solve sharing of the model structure between multiple (separated) django projects/microservices. Eg:</p>
<ol>
<li>Project: API</li>
<li>Project: Users dashboard</li>
<li>Project: Admin dashboard</li>
<li>Project: Statistics</li>
</ol>
<p>Each of that projects uses the same django models. Is there a one, proper way to solve that?</p>
| 0debug
|
can an object pointer in php be given a variable `$valuess->$loopFetch['fetch']` : Hello Iam a newbie need help.
Hello I want to know if a php object like `$valuess->$loopFetch['fetch']` can be donw in php
| 0debug
|
Java if statement to change a varible value : I've just stated Java, roughly done 5-6 hours but I have no idea how to approuch this task.
I'm doing a tax system for a hotel.
A standard rate of tax is used (20%).
However, the program askes the user if they want to change this rate by asking the user to input "Yes" or "No", if yes, proceed to enter the new value of the Tax Varible, if no, it keeps the standard rate of (20%).
There's a lot more to the task. However, this is the only issue I'm struggling with.
Can anyone tell me how to write such an if statement? I have absolutely no idea how to do it with such specific user input.
Any sort of help or suggestions would be appreciate so I can play around with it.
| 0debug
|
Is it possible, in a conceptual level, to realize distribute computing in an assembly/compiled code level? : <p>The goal of this question is to ask if it is possible to have some compiled code (think in terms of an ordinary program, not necessarily written in any special way [e.g multi-threaded] or in any particular paradigm/language) being sent through the network to be somehow processed in a cpu located in another machine.</p>
<p>Ok, so this involves a lot of concepts, and i am not particularly familiar with neither distributed computing nor kernel/OS concepts, so pardon me if this question seems too broad or too unfocused; i will do my best to stay on track.</p>
<p>Let's say we have assembly code (instructions) for a function in our code. It's a simple function that takes x and outputs y by adding 1 to x. I know that at the execution level, the CPU needs to fetch the value of x, move it into a CPU register, perform the addition and then perform a RET instruction at the end.</p>
<p><strong>Would it be possible, conceptually, to pass along through the network the instructions alongside any contextual information needed for execution? If so, what would be the necessary information? The initial state of the CPU registers and instructions, or even more information?</strong></p>
<p>I guess the kernel would be deeply involved in the coordination of such process, but what i am mostly struggling to realize is what would be the minimum 'package' of information i would need to assemble into a message so a computer in the other end of the network would be able to perform the simple calculation OR if this just simply makes no sense given the restrictions of PC architectures.</p>
<p>There is a lot of information about distributed computing out there, but it mostly takes for granted that the code is designed in a specific way. I am interested in a similar solution for any already existant code.</p>
| 0debug
|
Should I learn Unity C# for PC before learning Unity for Android? : <p>I want to start learning Unity, I'm a web developer and I have a decent level in C# but I've never touched Unity before.</p>
<p>I mainly want to create games for Android (maybe iOS in the future), there are many courses on the internet but I'm wodering if I need to have a good understanding of Unity PC/Mac.. before trying to learn Unity for Android.</p>
<p>I found this course : <a href="https://www.udemy.com/course/unitycourse/" rel="nofollow noreferrer">https://www.udemy.com/course/unitycourse/</a>, It seems like a it's a complete and detailed one, but it has nothing to do with Android. Should I learn something like this first?</p>
<p>I'll appreciate any advices, thank you.</p>
| 0debug
|
static inline int get16(const uint8_t **pp, const uint8_t *p_end)
{
const uint8_t *p;
int c;
p = *pp;
if ((p + 1) >= p_end)
return AVERROR_INVALIDDATA;
c = AV_RB16(p);
p += 2;
*pp = p;
return c;
}
| 1threat
|
one Primary Key Value in many tables : This may seem like a simple question, but I am stumped:
I have created a database about cars (in Oracle SQL developer). I have amongst other tables a table called: *Manufacturer* and a table called *Parentcompany*.
Since some manufacturers are owned by bigger corporations, I will also show them in my database.
The *parentcompany* table is the "parent table" and the *Manufacturer* table the "child table".
for both I have created columns, each having their own Primary Key.
For some reason, when I inserted the values for my columns, I was able to use the same value for the primary key of *Manufacturer* and *Parentcompany*
The column: **ManufacturerID** is primary Key of *Manufacturer*. The value for this is: 'MBE'
The column: **ParentcompanyID** is primary key of *Parentcompany*. The value for this is 'MBE'
Both have the same value. Do I have a problem with the thinking logic?
Or do I just not understand how primary keys work?
Does a primary key only need to be unique in a table, and not the database?
I would appreciate it if someone shed light on the situation.
Donovan
| 0debug
|
void avcodec_register_all(void)
{
static int initialized;
if (initialized)
return;
initialized = 1;
REGISTER_HWACCEL(H263_CUVID, h263_cuvid);
REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);
REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
REGISTER_HWACCEL(H264_CUVID, h264_cuvid);
REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);
REGISTER_HWACCEL(H264_MMAL, h264_mmal);
REGISTER_HWACCEL(H264_QSV, h264_qsv);
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
REGISTER_HWACCEL(H264_VDA, h264_vda);
REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old);
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);
REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);
REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);
REGISTER_HWACCEL(HEVC_QSV, hevc_qsv);
REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi);
REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
REGISTER_HWACCEL(MPEG1_VIDEOTOOLBOX, mpeg1_videotoolbox);
REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal);
REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);
REGISTER_HWACCEL(MPEG4_VAAPI, mpeg4_vaapi);
REGISTER_HWACCEL(MPEG4_VDPAU, mpeg4_vdpau);
REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid);
REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va);
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
REGISTER_HWACCEL(VC1_MMAL, vc1_mmal);
REGISTER_HWACCEL(VC1_QSV, vc1_qsv);
REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);
REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);
REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va);
REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);
REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);
REGISTER_ENCODER(A64MULTI, a64multi);
REGISTER_ENCODER(A64MULTI5, a64multi5);
REGISTER_DECODER(AASC, aasc);
REGISTER_DECODER(AIC, aic);
REGISTER_ENCDEC (ALIAS_PIX, alias_pix);
REGISTER_ENCDEC (AMV, amv);
REGISTER_DECODER(ANM, anm);
REGISTER_DECODER(ANSI, ansi);
REGISTER_ENCDEC (APNG, apng);
REGISTER_ENCDEC (ASV1, asv1);
REGISTER_ENCDEC (ASV2, asv2);
REGISTER_DECODER(AURA, aura);
REGISTER_DECODER(AURA2, aura2);
REGISTER_ENCDEC (AVRP, avrp);
REGISTER_DECODER(AVRN, avrn);
REGISTER_DECODER(AVS, avs);
REGISTER_ENCDEC (AVUI, avui);
REGISTER_ENCDEC (AYUV, ayuv);
REGISTER_DECODER(BETHSOFTVID, bethsoftvid);
REGISTER_DECODER(BFI, bfi);
REGISTER_DECODER(BINK, bink);
REGISTER_ENCDEC (BMP, bmp);
REGISTER_DECODER(BMV_VIDEO, bmv_video);
REGISTER_DECODER(BRENDER_PIX, brender_pix);
REGISTER_DECODER(C93, c93);
REGISTER_DECODER(CAVS, cavs);
REGISTER_DECODER(CDGRAPHICS, cdgraphics);
REGISTER_DECODER(CDXL, cdxl);
REGISTER_DECODER(CFHD, cfhd);
REGISTER_ENCDEC (CINEPAK, cinepak);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER(CLLC, cllc);
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
REGISTER_DECODER(CPIA, cpia);
REGISTER_DECODER(CSCD, cscd);
REGISTER_DECODER(CYUV, cyuv);
REGISTER_DECODER(DDS, dds);
REGISTER_DECODER(DFA, dfa);
REGISTER_DECODER(DIRAC, dirac);
REGISTER_ENCDEC (DNXHD, dnxhd);
REGISTER_ENCDEC (DPX, dpx);
REGISTER_DECODER(DSICINVIDEO, dsicinvideo);
REGISTER_DECODER(DVAUDIO, dvaudio);
REGISTER_ENCDEC (DVVIDEO, dvvideo);
REGISTER_DECODER(DXA, dxa);
REGISTER_DECODER(DXTORY, dxtory);
REGISTER_DECODER(DXV, dxv);
REGISTER_DECODER(EACMV, eacmv);
REGISTER_DECODER(EAMAD, eamad);
REGISTER_DECODER(EATGQ, eatgq);
REGISTER_DECODER(EATGV, eatgv);
REGISTER_DECODER(EATQI, eatqi);
REGISTER_DECODER(EIGHTBPS, eightbps);
REGISTER_DECODER(EIGHTSVX_EXP, eightsvx_exp);
REGISTER_DECODER(EIGHTSVX_FIB, eightsvx_fib);
REGISTER_DECODER(ESCAPE124, escape124);
REGISTER_DECODER(ESCAPE130, escape130);
REGISTER_DECODER(EXR, exr);
REGISTER_ENCDEC (FFV1, ffv1);
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
REGISTER_DECODER(FIC, fic);
REGISTER_ENCDEC (FLASHSV, flashsv);
REGISTER_ENCDEC (FLASHSV2, flashsv2);
REGISTER_DECODER(FLIC, flic);
REGISTER_ENCDEC (FLV, flv);
REGISTER_DECODER(FOURXM, fourxm);
REGISTER_DECODER(FRAPS, fraps);
REGISTER_DECODER(FRWU, frwu);
REGISTER_DECODER(G2M, g2m);
REGISTER_ENCDEC (GIF, gif);
REGISTER_ENCDEC (H261, h261);
REGISTER_ENCDEC (H263, h263);
REGISTER_DECODER(H263I, h263i);
REGISTER_ENCDEC (H263P, h263p);
REGISTER_DECODER(H264, h264);
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec);
REGISTER_DECODER(H264_MMAL, h264_mmal);
REGISTER_DECODER(H264_QSV, h264_qsv);
REGISTER_DECODER(H264_VDA, h264_vda);
#if FF_API_VDPAU
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
#endif
REGISTER_ENCDEC (HAP, hap);
REGISTER_DECODER(HEVC, hevc);
REGISTER_DECODER(HEVC_QSV, hevc_qsv);
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
REGISTER_DECODER(HQ_HQA, hq_hqa);
REGISTER_DECODER(HQX, hqx);
REGISTER_ENCDEC (HUFFYUV, huffyuv);
REGISTER_DECODER(IDCIN, idcin);
REGISTER_DECODER(IFF_ILBM, iff_ilbm);
REGISTER_DECODER(INDEO2, indeo2);
REGISTER_DECODER(INDEO3, indeo3);
REGISTER_DECODER(INDEO4, indeo4);
REGISTER_DECODER(INDEO5, indeo5);
REGISTER_DECODER(INTERPLAY_VIDEO, interplay_video);
REGISTER_ENCDEC (JPEG2000, jpeg2000);
REGISTER_ENCDEC (JPEGLS, jpegls);
REGISTER_DECODER(JV, jv);
REGISTER_DECODER(KGV1, kgv1);
REGISTER_DECODER(KMVC, kmvc);
REGISTER_DECODER(LAGARITH, lagarith);
REGISTER_ENCODER(LJPEG, ljpeg);
REGISTER_DECODER(LOCO, loco);
REGISTER_DECODER(M101, m101);
REGISTER_DECODER(MAGICYUV, magicyuv);
REGISTER_DECODER(MDEC, mdec);
REGISTER_DECODER(MIMIC, mimic);
REGISTER_ENCDEC (MJPEG, mjpeg);
REGISTER_DECODER(MJPEGB, mjpegb);
REGISTER_DECODER(MMVIDEO, mmvideo);
REGISTER_DECODER(MOTIONPIXELS, motionpixels);
#if FF_API_XVMC
REGISTER_DECODER(MPEG_XVMC, mpeg_xvmc);
#endif
REGISTER_ENCDEC (MPEG1VIDEO, mpeg1video);
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4);
REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd);
REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau);
#endif
REGISTER_DECODER(MPEGVIDEO, mpegvideo);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau);
REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau);
#endif
REGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal);
REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd);
REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MSA1, msa1);
REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
REGISTER_DECODER(MSRLE, msrle);
REGISTER_DECODER(MSS1, mss1);
REGISTER_DECODER(MSS2, mss2);
REGISTER_ENCDEC (MSVIDEO1, msvideo1);
REGISTER_DECODER(MSZH, mszh);
REGISTER_DECODER(MTS2, mts2);
REGISTER_DECODER(MVC1, mvc1);
REGISTER_DECODER(MVC2, mvc2);
REGISTER_DECODER(MXPEG, mxpeg);
REGISTER_DECODER(NUV, nuv);
REGISTER_DECODER(PAF_VIDEO, paf_video);
REGISTER_ENCDEC (PAM, pam);
REGISTER_ENCDEC (PBM, pbm);
REGISTER_ENCDEC (PCX, pcx);
REGISTER_ENCDEC (PGM, pgm);
REGISTER_ENCDEC (PGMYUV, pgmyuv);
REGISTER_DECODER(PICTOR, pictor);
REGISTER_ENCDEC (PNG, png);
REGISTER_ENCDEC (PPM, ppm);
REGISTER_ENCDEC (PRORES, prores);
REGISTER_ENCODER(PRORES_AW, prores_aw);
REGISTER_ENCODER(PRORES_KS, prores_ks);
REGISTER_DECODER(PRORES_LGPL, prores_lgpl);
REGISTER_DECODER(PTX, ptx);
REGISTER_DECODER(QDRAW, qdraw);
REGISTER_DECODER(QPEG, qpeg);
REGISTER_ENCDEC (QTRLE, qtrle);
REGISTER_ENCDEC (R10K, r10k);
REGISTER_ENCDEC (R210, r210);
REGISTER_ENCDEC (RAWVIDEO, rawvideo);
REGISTER_DECODER(RL2, rl2);
REGISTER_ENCDEC (ROQ, roq);
REGISTER_DECODER(RPZA, rpza);
REGISTER_DECODER(RSCC, rscc);
REGISTER_ENCDEC (RV10, rv10);
REGISTER_ENCDEC (RV20, rv20);
REGISTER_DECODER(RV30, rv30);
REGISTER_DECODER(RV40, rv40);
REGISTER_ENCDEC (S302M, s302m);
REGISTER_DECODER(SANM, sanm);
REGISTER_DECODER(SCREENPRESSO, screenpresso);
REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm);
REGISTER_ENCDEC (SGI, sgi);
REGISTER_DECODER(SGIRLE, sgirle);
REGISTER_DECODER(SHEERVIDEO, sheervideo);
REGISTER_DECODER(SMACKER, smacker);
REGISTER_DECODER(SMC, smc);
REGISTER_DECODER(SMVJPEG, smvjpeg);
REGISTER_ENCDEC (SNOW, snow);
REGISTER_DECODER(SP5X, sp5x);
REGISTER_ENCDEC (SUNRAST, sunrast);
REGISTER_ENCDEC (SVQ1, svq1);
REGISTER_DECODER(SVQ3, svq3);
REGISTER_ENCDEC (TARGA, targa);
REGISTER_DECODER(TARGA_Y216, targa_y216);
REGISTER_DECODER(TDSC, tdsc);
REGISTER_DECODER(THEORA, theora);
REGISTER_DECODER(THP, thp);
REGISTER_DECODER(TIERTEXSEQVIDEO, tiertexseqvideo);
REGISTER_ENCDEC (TIFF, tiff);
REGISTER_DECODER(TMV, tmv);
REGISTER_DECODER(TRUEMOTION1, truemotion1);
REGISTER_DECODER(TRUEMOTION2, truemotion2);
REGISTER_DECODER(TRUEMOTION2RT, truemotion2rt);
REGISTER_DECODER(TSCC, tscc);
REGISTER_DECODER(TSCC2, tscc2);
REGISTER_DECODER(TXD, txd);
REGISTER_DECODER(ULTI, ulti);
REGISTER_ENCDEC (UTVIDEO, utvideo);
REGISTER_ENCDEC (V210, v210);
REGISTER_DECODER(V210X, v210x);
REGISTER_ENCDEC (V308, v308);
REGISTER_ENCDEC (V408, v408);
REGISTER_ENCDEC (V410, v410);
REGISTER_DECODER(VB, vb);
REGISTER_DECODER(VBLE, vble);
REGISTER_DECODER(VC1, vc1);
REGISTER_DECODER(VC1_CRYSTALHD, vc1_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(VC1_VDPAU, vc1_vdpau);
#endif
REGISTER_DECODER(VC1IMAGE, vc1image);
REGISTER_DECODER(VC1_MMAL, vc1_mmal);
REGISTER_DECODER(VC1_QSV, vc1_qsv);
REGISTER_ENCODER(VC2, vc2);
REGISTER_DECODER(VCR1, vcr1);
REGISTER_DECODER(VMDVIDEO, vmdvideo);
REGISTER_DECODER(VMNC, vmnc);
REGISTER_DECODER(VP3, vp3);
REGISTER_DECODER(VP5, vp5);
REGISTER_DECODER(VP6, vp6);
REGISTER_DECODER(VP6A, vp6a);
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP7, vp7);
REGISTER_DECODER(VP8, vp8);
REGISTER_DECODER(VP9, vp9);
REGISTER_DECODER(VQA, vqa);
REGISTER_DECODER(WEBP, webp);
REGISTER_ENCODER(WRAPPED_AVFRAME, wrapped_avframe);
REGISTER_ENCDEC (WMV1, wmv1);
REGISTER_ENCDEC (WMV2, wmv2);
REGISTER_DECODER(WMV3, wmv3);
REGISTER_DECODER(WMV3_CRYSTALHD, wmv3_crystalhd);
#if FF_API_VDPAU
REGISTER_DECODER(WMV3_VDPAU, wmv3_vdpau);
#endif
REGISTER_DECODER(WMV3IMAGE, wmv3image);
REGISTER_DECODER(WNV1, wnv1);
REGISTER_DECODER(XAN_WC3, xan_wc3);
REGISTER_DECODER(XAN_WC4, xan_wc4);
REGISTER_ENCDEC (XBM, xbm);
REGISTER_ENCDEC (XFACE, xface);
REGISTER_DECODER(XL, xl);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
REGISTER_DECODER(YLC, ylc);
REGISTER_DECODER(YOP, yop);
REGISTER_ENCDEC (YUV4, yuv4);
REGISTER_DECODER(ZERO12V, zero12v);
REGISTER_DECODER(ZEROCODEC, zerocodec);
REGISTER_ENCDEC (ZLIB, zlib);
REGISTER_ENCDEC (ZMBV, zmbv);
REGISTER_ENCDEC (AAC, aac);
REGISTER_DECODER(AAC_FIXED, aac_fixed);
REGISTER_DECODER(AAC_LATM, aac_latm);
REGISTER_ENCDEC (AC3, ac3);
REGISTER_ENCDEC (AC3_FIXED, ac3_fixed);
REGISTER_ENCDEC (ALAC, alac);
REGISTER_DECODER(ALS, als);
REGISTER_DECODER(AMRNB, amrnb);
REGISTER_DECODER(AMRWB, amrwb);
REGISTER_DECODER(APE, ape);
REGISTER_DECODER(ATRAC1, atrac1);
REGISTER_DECODER(ATRAC3, atrac3);
REGISTER_DECODER(ATRAC3P, atrac3p);
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
REGISTER_DECODER(COOK, cook);
REGISTER_ENCDEC (DCA, dca);
REGISTER_DECODER(DSD_LSBF, dsd_lsbf);
REGISTER_DECODER(DSD_MSBF, dsd_msbf);
REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar);
REGISTER_DECODER(DSD_MSBF_PLANAR, dsd_msbf_planar);
REGISTER_DECODER(DSICINAUDIO, dsicinaudio);
REGISTER_DECODER(DSS_SP, dss_sp);
REGISTER_DECODER(DST, dst);
REGISTER_ENCDEC (EAC3, eac3);
REGISTER_DECODER(EVRC, evrc);
REGISTER_DECODER(FFWAVESYNTH, ffwavesynth);
REGISTER_ENCDEC (FLAC, flac);
REGISTER_ENCDEC (G723_1, g723_1);
REGISTER_DECODER(G729, g729);
REGISTER_DECODER(GSM, gsm);
REGISTER_DECODER(GSM_MS, gsm_ms);
REGISTER_DECODER(IAC, iac);
REGISTER_DECODER(IMC, imc);
REGISTER_DECODER(INTERPLAY_ACM, interplay_acm);
REGISTER_DECODER(MACE3, mace3);
REGISTER_DECODER(MACE6, mace6);
REGISTER_DECODER(METASOUND, metasound);
REGISTER_DECODER(MLP, mlp);
REGISTER_DECODER(MP1, mp1);
REGISTER_DECODER(MP1FLOAT, mp1float);
REGISTER_ENCDEC (MP2, mp2);
REGISTER_DECODER(MP2FLOAT, mp2float);
REGISTER_ENCODER(MP2FIXED, mp2fixed);
REGISTER_DECODER(MP3, mp3);
REGISTER_DECODER(MP3FLOAT, mp3float);
REGISTER_DECODER(MP3ADU, mp3adu);
REGISTER_DECODER(MP3ADUFLOAT, mp3adufloat);
REGISTER_DECODER(MP3ON4, mp3on4);
REGISTER_DECODER(MP3ON4FLOAT, mp3on4float);
REGISTER_DECODER(MPC7, mpc7);
REGISTER_DECODER(MPC8, mpc8);
REGISTER_ENCDEC (NELLYMOSER, nellymoser);
REGISTER_DECODER(ON2AVC, on2avc);
REGISTER_DECODER(OPUS, opus);
REGISTER_DECODER(PAF_AUDIO, paf_audio);
REGISTER_DECODER(QCELP, qcelp);
REGISTER_DECODER(QDM2, qdm2);
REGISTER_ENCDEC (RA_144, ra_144);
REGISTER_DECODER(RA_288, ra_288);
REGISTER_DECODER(RALF, ralf);
REGISTER_DECODER(SHORTEN, shorten);
REGISTER_DECODER(SIPR, sipr);
REGISTER_DECODER(SMACKAUD, smackaud);
REGISTER_ENCDEC (SONIC, sonic);
REGISTER_ENCODER(SONIC_LS, sonic_ls);
REGISTER_DECODER(TAK, tak);
REGISTER_DECODER(TRUEHD, truehd);
REGISTER_DECODER(TRUESPEECH, truespeech);
REGISTER_ENCDEC (TTA, tta);
REGISTER_DECODER(TWINVQ, twinvq);
REGISTER_DECODER(VMDAUDIO, vmdaudio);
REGISTER_ENCDEC (VORBIS, vorbis);
REGISTER_ENCDEC (WAVPACK, wavpack);
REGISTER_DECODER(WMALOSSLESS, wmalossless);
REGISTER_DECODER(WMAPRO, wmapro);
REGISTER_ENCDEC (WMAV1, wmav1);
REGISTER_ENCDEC (WMAV2, wmav2);
REGISTER_DECODER(WMAVOICE, wmavoice);
REGISTER_DECODER(WS_SND1, ws_snd1);
REGISTER_DECODER(XMA1, xma1);
REGISTER_DECODER(XMA2, xma2);
REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
REGISTER_DECODER(PCM_BLURAY, pcm_bluray);
REGISTER_DECODER(PCM_DVD, pcm_dvd);
REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
REGISTER_ENCDEC (PCM_F64LE, pcm_f64le);
REGISTER_DECODER(PCM_LXF, pcm_lxf);
REGISTER_ENCDEC (PCM_MULAW, pcm_mulaw);
REGISTER_ENCDEC (PCM_S8, pcm_s8);
REGISTER_ENCDEC (PCM_S8_PLANAR, pcm_s8_planar);
REGISTER_ENCDEC (PCM_S16BE, pcm_s16be);
REGISTER_ENCDEC (PCM_S16BE_PLANAR, pcm_s16be_planar);
REGISTER_ENCDEC (PCM_S16LE, pcm_s16le);
REGISTER_ENCDEC (PCM_S16LE_PLANAR, pcm_s16le_planar);
REGISTER_ENCDEC (PCM_S24BE, pcm_s24be);
REGISTER_ENCDEC (PCM_S24DAUD, pcm_s24daud);
REGISTER_ENCDEC (PCM_S24LE, pcm_s24le);
REGISTER_ENCDEC (PCM_S24LE_PLANAR, pcm_s24le_planar);
REGISTER_ENCDEC (PCM_S32BE, pcm_s32be);
REGISTER_ENCDEC (PCM_S32LE, pcm_s32le);
REGISTER_ENCDEC (PCM_S32LE_PLANAR, pcm_s32le_planar);
REGISTER_ENCDEC (PCM_S64BE, pcm_s64be);
REGISTER_ENCDEC (PCM_S64LE, pcm_s64le);
REGISTER_ENCDEC (PCM_U8, pcm_u8);
REGISTER_ENCDEC (PCM_U16BE, pcm_u16be);
REGISTER_ENCDEC (PCM_U16LE, pcm_u16le);
REGISTER_ENCDEC (PCM_U24BE, pcm_u24be);
REGISTER_ENCDEC (PCM_U24LE, pcm_u24le);
REGISTER_ENCDEC (PCM_U32BE, pcm_u32be);
REGISTER_ENCDEC (PCM_U32LE, pcm_u32le);
REGISTER_DECODER(PCM_ZORK, pcm_zork);
REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
REGISTER_DECODER(SOL_DPCM, sol_dpcm);
REGISTER_DECODER(XAN_DPCM, xan_dpcm);
REGISTER_DECODER(ADPCM_4XM, adpcm_4xm);
REGISTER_ENCDEC (ADPCM_ADX, adpcm_adx);
REGISTER_DECODER(ADPCM_AFC, adpcm_afc);
REGISTER_DECODER(ADPCM_AICA, adpcm_aica);
REGISTER_DECODER(ADPCM_CT, adpcm_ct);
REGISTER_DECODER(ADPCM_DTK, adpcm_dtk);
REGISTER_DECODER(ADPCM_EA, adpcm_ea);
REGISTER_DECODER(ADPCM_EA_MAXIS_XA, adpcm_ea_maxis_xa);
REGISTER_DECODER(ADPCM_EA_R1, adpcm_ea_r1);
REGISTER_DECODER(ADPCM_EA_R2, adpcm_ea_r2);
REGISTER_DECODER(ADPCM_EA_R3, adpcm_ea_r3);
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le);
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4);
REGISTER_DECODER(ADPCM_IMA_DK3, adpcm_ima_dk3);
REGISTER_DECODER(ADPCM_IMA_DK4, adpcm_ima_dk4);
REGISTER_DECODER(ADPCM_IMA_EA_EACS, adpcm_ima_ea_eacs);
REGISTER_DECODER(ADPCM_IMA_EA_SEAD, adpcm_ima_ea_sead);
REGISTER_DECODER(ADPCM_IMA_ISS, adpcm_ima_iss);
REGISTER_DECODER(ADPCM_IMA_OKI, adpcm_ima_oki);
REGISTER_ENCDEC (ADPCM_IMA_QT, adpcm_ima_qt);
REGISTER_DECODER(ADPCM_IMA_RAD, adpcm_ima_rad);
REGISTER_DECODER(ADPCM_IMA_SMJPEG, adpcm_ima_smjpeg);
REGISTER_ENCDEC (ADPCM_IMA_WAV, adpcm_ima_wav);
REGISTER_DECODER(ADPCM_IMA_WS, adpcm_ima_ws);
REGISTER_ENCDEC (ADPCM_MS, adpcm_ms);
REGISTER_DECODER(ADPCM_MTAF, adpcm_mtaf);
REGISTER_DECODER(ADPCM_PSX, adpcm_psx);
REGISTER_DECODER(ADPCM_SBPRO_2, adpcm_sbpro_2);
REGISTER_DECODER(ADPCM_SBPRO_3, adpcm_sbpro_3);
REGISTER_DECODER(ADPCM_SBPRO_4, adpcm_sbpro_4);
REGISTER_ENCDEC (ADPCM_SWF, adpcm_swf);
REGISTER_DECODER(ADPCM_THP, adpcm_thp);
REGISTER_DECODER(ADPCM_THP_LE, adpcm_thp_le);
REGISTER_DECODER(ADPCM_VIMA, adpcm_vima);
REGISTER_DECODER(ADPCM_XA, adpcm_xa);
REGISTER_ENCDEC (ADPCM_YAMAHA, adpcm_yamaha);
REGISTER_ENCDEC (SSA, ssa);
REGISTER_ENCDEC (ASS, ass);
REGISTER_DECODER(CCAPTION, ccaption);
REGISTER_ENCDEC (DVBSUB, dvbsub);
REGISTER_ENCDEC (DVDSUB, dvdsub);
REGISTER_DECODER(JACOSUB, jacosub);
REGISTER_DECODER(MICRODVD, microdvd);
REGISTER_ENCDEC (MOVTEXT, movtext);
REGISTER_DECODER(MPL2, mpl2);
REGISTER_DECODER(PGSSUB, pgssub);
REGISTER_DECODER(PJS, pjs);
REGISTER_DECODER(REALTEXT, realtext);
REGISTER_DECODER(SAMI, sami);
REGISTER_ENCDEC (SRT, srt);
REGISTER_DECODER(STL, stl);
REGISTER_ENCDEC (SUBRIP, subrip);
REGISTER_DECODER(SUBVIEWER, subviewer);
REGISTER_DECODER(SUBVIEWER1, subviewer1);
REGISTER_ENCDEC (TEXT, text);
REGISTER_DECODER(VPLAYER, vplayer);
REGISTER_ENCDEC (WEBVTT, webvtt);
REGISTER_ENCDEC (XSUB, xsub);
REGISTER_ENCDEC (AAC_AT, aac_at);
REGISTER_DECODER(AC3_AT, ac3_at);
REGISTER_DECODER(ADPCM_IMA_QT_AT, adpcm_ima_qt_at);
REGISTER_ENCDEC (ALAC_AT, alac_at);
REGISTER_DECODER(AMR_NB_AT, amr_nb_at);
REGISTER_DECODER(EAC3_AT, eac3_at);
REGISTER_DECODER(GSM_MS_AT, gsm_ms_at);
REGISTER_ENCDEC (ILBC_AT, ilbc_at);
REGISTER_DECODER(MP1_AT, mp1_at);
REGISTER_DECODER(MP2_AT, mp2_at);
REGISTER_DECODER(MP3_AT, mp3_at);
REGISTER_ENCDEC (PCM_ALAW_AT, pcm_alaw_at);
REGISTER_ENCDEC (PCM_MULAW_AT, pcm_mulaw_at);
REGISTER_DECODER(QDMC_AT, qdmc_at);
REGISTER_DECODER(QDM2_AT, qdm2_at);
REGISTER_DECODER(LIBCELT, libcelt);
REGISTER_ENCODER(LIBFAAC, libfaac);
REGISTER_ENCDEC (LIBFDK_AAC, libfdk_aac);
REGISTER_ENCDEC (LIBGSM, libgsm);
REGISTER_ENCDEC (LIBGSM_MS, libgsm_ms);
REGISTER_ENCDEC (LIBILBC, libilbc);
REGISTER_ENCODER(LIBMP3LAME, libmp3lame);
REGISTER_ENCDEC (LIBOPENCORE_AMRNB, libopencore_amrnb);
REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_ENCDEC (LIBOPUS, libopus);
REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
REGISTER_ENCODER(LIBSHINE, libshine);
REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_ENCODER(LIBTHEORA, libtheora);
REGISTER_ENCODER(LIBTWOLAME, libtwolame);
REGISTER_ENCODER(LIBVO_AMRWBENC, libvo_amrwbenc);
REGISTER_ENCDEC (LIBVORBIS, libvorbis);
REGISTER_ENCDEC (LIBVPX_VP8, libvpx_vp8);
REGISTER_ENCDEC (LIBVPX_VP9, libvpx_vp9);
REGISTER_ENCODER(LIBWAVPACK, libwavpack);
REGISTER_ENCODER(LIBWEBP_ANIM, libwebp_anim);
REGISTER_ENCODER(LIBWEBP, libwebp);
REGISTER_ENCODER(LIBX262, libx262);
REGISTER_ENCODER(LIBX264, libx264);
REGISTER_ENCODER(LIBX264RGB, libx264rgb);
REGISTER_ENCODER(LIBX265, libx265);
REGISTER_ENCODER(LIBXAVS, libxavs);
REGISTER_ENCODER(LIBXVID, libxvid);
REGISTER_DECODER(LIBZVBI_TELETEXT, libzvbi_teletext);
REGISTER_DECODER(BINTEXT, bintext);
REGISTER_DECODER(XBIN, xbin);
REGISTER_DECODER(IDF, idf);
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
REGISTER_DECODER(H263_CUVID, h263_cuvid);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(H264_QSV, h264_qsv);
REGISTER_ENCODER(H264_VAAPI, h264_vaapi);
REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
#if FF_API_NVENC_OLD_NAME
REGISTER_ENCODER(NVENC, nvenc);
REGISTER_ENCODER(NVENC_H264, nvenc_h264);
REGISTER_ENCODER(NVENC_HEVC, nvenc_hevc);
#endif
REGISTER_DECODER(HEVC_CUVID, hevc_cuvid);
REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);
REGISTER_ENCODER(HEVC_QSV, hevc_qsv);
REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);
REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);
REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_ENCODER(MJPEG_VAAPI, mjpeg_vaapi);
REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
REGISTER_DECODER(VP9_CUVID, vp9_cuvid);
REGISTER_PARSER(AAC, aac);
REGISTER_PARSER(AAC_LATM, aac_latm);
REGISTER_PARSER(AC3, ac3);
REGISTER_PARSER(ADX, adx);
REGISTER_PARSER(BMP, bmp);
REGISTER_PARSER(CAVSVIDEO, cavsvideo);
REGISTER_PARSER(COOK, cook);
REGISTER_PARSER(DCA, dca);
REGISTER_PARSER(DIRAC, dirac);
REGISTER_PARSER(DNXHD, dnxhd);
REGISTER_PARSER(DPX, dpx);
REGISTER_PARSER(DVAUDIO, dvaudio);
REGISTER_PARSER(DVBSUB, dvbsub);
REGISTER_PARSER(DVDSUB, dvdsub);
REGISTER_PARSER(DVD_NAV, dvd_nav);
REGISTER_PARSER(FLAC, flac);
REGISTER_PARSER(G729, g729);
REGISTER_PARSER(GSM, gsm);
REGISTER_PARSER(H261, h261);
REGISTER_PARSER(H263, h263);
REGISTER_PARSER(H264, h264);
REGISTER_PARSER(HEVC, hevc);
REGISTER_PARSER(MJPEG, mjpeg);
REGISTER_PARSER(MLP, mlp);
REGISTER_PARSER(MPEG4VIDEO, mpeg4video);
REGISTER_PARSER(MPEGAUDIO, mpegaudio);
REGISTER_PARSER(MPEGVIDEO, mpegvideo);
REGISTER_PARSER(OPUS, opus);
REGISTER_PARSER(PNG, png);
REGISTER_PARSER(PNM, pnm);
REGISTER_PARSER(RV30, rv30);
REGISTER_PARSER(RV40, rv40);
REGISTER_PARSER(TAK, tak);
REGISTER_PARSER(VC1, vc1);
REGISTER_PARSER(VORBIS, vorbis);
REGISTER_PARSER(VP3, vp3);
REGISTER_PARSER(VP8, vp8);
REGISTER_PARSER(VP9, vp9);
}
| 1threat
|
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
{
char tmp_filename[PATH_MAX + 1];
int64_t total_size;
BlockDriver *bdrv_qcow2;
QEMUOptionParameter *create_options;
QDict *snapshot_options;
BlockDriverState *bs_snapshot;
Error *local_err;
int ret;
total_size = bdrv_getlength(bs);
if (total_size < 0) {
error_setg_errno(errp, -total_size, "Could not get image size");
return;
}
total_size &= BDRV_SECTOR_MASK;
ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not get temporary filename");
return;
}
bdrv_qcow2 = bdrv_find_format("qcow2");
create_options = parse_option_parameters("", bdrv_qcow2->create_options,
NULL);
set_option_parameter_int(create_options, BLOCK_OPT_SIZE, total_size);
ret = bdrv_create(bdrv_qcow2, tmp_filename, create_options, &local_err);
free_option_parameters(create_options);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not create temporary overlay "
"'%s': %s", tmp_filename,
error_get_pretty(local_err));
error_free(local_err);
return;
}
snapshot_options = qdict_new();
qdict_put(snapshot_options, "file.driver",
qstring_from_str("file"));
qdict_put(snapshot_options, "file.filename",
qstring_from_str(tmp_filename));
bs_snapshot = bdrv_new("");
bs_snapshot->is_temporary = 1;
ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options,
bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
return;
}
bdrv_append(bs_snapshot, bs);
}
| 1threat
|
How to embed GoogleMaps into mobile application for real-time navigation? : <p>Take Uber as an example. How can I get that real-time navigation functionality?</p>
<p><strong>Thoughts</strong></p>
<ol>
<li><p>Get list of latitude/longitude waypoints from WayPoints API: <a href="https://developers.google.com/maps/documentation/directions/intro#Waypoints" rel="nofollow">https://developers.google.com/maps/documentation/directions/intro#Waypoints</a> </p></li>
<li><p>Use the coordinates from step #1 to draw a polyline: <a href="https://developers.google.com/maps/documentation/android-api/shapes#code_samples" rel="nofollow">https://developers.google.com/maps/documentation/android-api/shapes#code_samples</a></p></li>
</ol>
<p>However, this would be essentially re-implementing the GoogleMaps app. I would have to adjust the polyline if the user left the path, etc. </p>
<p>Is it possible to just embed real-time directions? </p>
| 0debug
|
How to convert a huge scientific notation number to float or double? : <p>I a string “2.1360000028538e+22“, and I want to put it in decimal form. It should be 21,360.000028537997.</p>
<p>How can I convert this in PHP? I believe the scientific notation is too big, but is there any workarounds or libraries I can use to do this?</p>
| 0debug
|
static void usb_net_handle_dataout(USBNetState *s, USBPacket *p)
{
int sz = sizeof(s->out_buf) - s->out_ptr;
struct rndis_packet_msg_type *msg =
(struct rndis_packet_msg_type *) s->out_buf;
uint32_t len;
#ifdef TRAFFIC_DEBUG
fprintf(stderr, "usbnet: data out len %zu\n", p->iov.size);
iov_hexdump(p->iov.iov, p->iov.niov, stderr, "usbnet", p->iov.size);
#endif
if (sz > p->iov.size) {
sz = p->iov.size;
}
usb_packet_copy(p, &s->out_buf[s->out_ptr], sz);
s->out_ptr += sz;
if (!is_rndis(s)) {
if (p->iov.size < 64) {
qemu_send_packet(qemu_get_queue(s->nic), s->out_buf, s->out_ptr);
s->out_ptr = 0;
}
return;
}
len = le32_to_cpu(msg->MessageLength);
if (s->out_ptr < 8 || s->out_ptr < len) {
return;
}
if (le32_to_cpu(msg->MessageType) == RNDIS_PACKET_MSG) {
uint32_t offs = 8 + le32_to_cpu(msg->DataOffset);
uint32_t size = le32_to_cpu(msg->DataLength);
if (offs + size <= len)
qemu_send_packet(qemu_get_queue(s->nic), s->out_buf + offs, size);
}
s->out_ptr -= len;
memmove(s->out_buf, &s->out_buf[len], s->out_ptr);
}
| 1threat
|
How to get the TextField value in flutter : <p>Hi I have created sign up screen in the flutter. I want to get the email and password in the <code>onPressed</code> of the <code>FlatButton</code>.</p>
<p>Does anyone know how to do this in flutter ? </p>
<pre><code> Widget SignupPage() {
return new Scaffold(body: Container(
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
color: Colors.white,
image: DecorationImage(
colorFilter: new ColorFilter.mode(
Colors.black.withOpacity(0.05), BlendMode.dstATop),
image: AssetImage('assets/images/mountains.jpg'),
fit: BoxFit.cover,
),
),
child: new Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(100.0),
child: Center(
child: Icon(
Icons.headset_mic,
color: Colors.redAccent,
size: 50.0,
),
),
),
new Row(
children: <Widget>[
new Expanded(
child: new Padding(
padding: const EdgeInsets.only(left: 40.0),
child: new Text(
"EMAIL",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.redAccent,
fontSize: 15.0,
),
),
),
),
],
),
new Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.only(left: 40.0, right: 40.0, top: 10.0),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.redAccent,
width: 0.5,
style: BorderStyle.solid),
),
),
padding: const EdgeInsets.only(left: 0.0, right: 10.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
new Expanded(
child: TextField(
obscureText: true,
textAlign: TextAlign.left,
decoration: InputDecoration(
border: InputBorder.none,
hintText: 'PLEASE ENTER YOUR EMAIL',
hintStyle: TextStyle(color: Colors.grey),
),
),
),
],
),
),
Divider(
height: 24.0,
),
new Row(
children: <Widget>[
new Expanded(
child: new Padding(
padding: const EdgeInsets.only(left: 40.0),
child: new Text(
"PASSWORD",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.redAccent,
fontSize: 15.0,
),
),
),
),
],
),
new Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.only(left: 40.0, right: 40.0, top: 10.0),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.redAccent,
width: 0.5,
style: BorderStyle.solid),
),
),
padding: const EdgeInsets.only(left: 0.0, right: 10.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
new Expanded(
child: TextField(
obscureText: true,
textAlign: TextAlign.left,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '*********',
hintStyle: TextStyle(color: Colors.grey),
),
),
),
],
),
),
Divider(
height: 24.0,
),
new Row(
children: <Widget>[
new Expanded(
child: new Padding(
padding: const EdgeInsets.only(left: 40.0),
child: new Text(
"CONFIRM PASSWORD",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.redAccent,
fontSize: 15.0,
),
),
),
),
],
),
new Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.only(left: 40.0, right: 40.0, top: 10.0),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.redAccent,
width: 0.5,
style: BorderStyle.solid),
),
),
padding: const EdgeInsets.only(left: 0.0, right: 10.0),
child: new Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
new Expanded(
child: TextField(
obscureText: true,
textAlign: TextAlign.left,
decoration: InputDecoration(
border: InputBorder.none,
hintText: '*********',
hintStyle: TextStyle(color: Colors.grey),
),
),
),
],
),
),
Divider(
height: 24.0,
),
new Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(right: 20.0),
child: new FlatButton(
child: new Text(
"Already have an account?",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.redAccent,
fontSize: 15.0,
),
textAlign: TextAlign.end,
),
onPressed: () => {},
),
),
],
),
new Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.only(left: 30.0, right: 30.0, top: 50.0),
alignment: Alignment.center,
child: new Row(
children: <Widget>[
new Expanded(
child: new FlatButton(
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(30.0),
),
color: Colors.redAccent,
onPressed: () => authHandler.handleSignInEmail(emailController.text, passwordController.text)
.then((FirebaseUser user) {
Navigator.push(context, new MaterialPageRoute(builder: (context) => HomePage()));
}).catchError((e) => print(e)),
child: new Container(
padding: const EdgeInsets.symmetric(
vertical: 20.0,
horizontal: 20.0,
),
child: new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new Expanded(
child: Text(
"SIGN UP",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold),
),
),
],
),
),
),
),
],
),
),
],
),
));
}
</code></pre>
| 0debug
|
REGEX replace by template words list (NPP) : <p>I have a text in file like:</p>
<pre><code>"Complete Storage Facility within 1:05 on Easy difficulty or harder without any marines dying."
"Complete Storage Facility within 1:05 on Normal difficulty or harder without any marines dying."
</code></pre>
<p>How to replace it to</p>
<pre><code>"Пройдите Storage Facility за 1:05 на лёгком или более высоком уровне сложности без потерь в отряде."
"Пройдите Storage Facility за 1:05 на среднем или более высоком уровне сложности без потерь в отряде."
</code></pre>
<p>PS: <code>лёгком</code> mean <code>Easy</code>, <code>среднем</code> mean <code>Normal</code>, <code>1:05</code> and <code>Storage Facility</code> is dynamic values.</p>
| 0debug
|
Exit insert mode in the JupyterLab using vim keybindings : <p>I am using both the console and text editor within JupyterLab, and I set the text editor keymap to 'vim' and i can edit text just fine when in insert mode. But when trying to exit insert mode using the 'esc' key I just get toggled out of the current window. Is this not the way to exit insert mode?</p>
| 0debug
|
static CharDriverState *qemu_chr_open_tty_fd(int fd,
ChardevCommon *backend,
Error **errp)
{
CharDriverState *chr;
tty_serial_init(fd, 115200, 'N', 8, 1);
chr = qemu_chr_open_fd(fd, fd, backend, errp);
chr->chr_ioctl = tty_serial_ioctl;
chr->chr_close = qemu_chr_close_tty;
return chr;
| 1threat
|
How to List all 32(2^5) combination of binary in C# : <p>How generate all binary combination from 00000 -> 11111 using C# with the easiest way, Thank you.</p>
| 0debug
|
SQL Conditional statements PLEASE HELP!! Thanks : Im working on a BIRT Reporting. What i need to do is, If Column1 value is Approved, Copy Column 2 value to Column 3 else null
| 0debug
|
Find the end of the month Pandas DataFrame Series : <p>I have a series within a DataFrame that I read in initially as an object, and then need to convert it to a date in the form of yyyy-mm-dd where dd is the end of the month.</p>
<p>As an example, I have DataFrame df with a column Date as an object:</p>
<pre><code>... Date ...
... 200104 ...
... 200508 ...
</code></pre>
<p>What I want when this is all said and done is a date object:</p>
<pre><code>... Date ...
... 2001-04-30 ...
... 2005-08-31 ...
</code></pre>
<p>such that df['Date'].item() returns</p>
<pre><code>datetime.date(2001, 04, 30)
</code></pre>
<p>I've used the following code to get almost there, but all my dates are at the beginning of the month, not the end. Please advise.</p>
<pre><code>df['Date'] = pd.to_datetime(df['Date'], format="%Y%m").dt.date
</code></pre>
<p>Note: I've already imported Pandas ad pd, and datetime as dt</p>
| 0debug
|
static int load_refcount_block(BlockDriverState *bs,
int64_t refcount_block_offset)
{
BDRVQcowState *s = bs->opaque;
int ret;
if (cache_refcount_updates) {
ret = write_refcount_block(bs);
if (ret < 0) {
return ret;
}
}
BLKDBG_EVENT(bs->file, BLKDBG_REFBLOCK_LOAD);
ret = bdrv_pread(bs->file, refcount_block_offset, s->refcount_block_cache,
s->cluster_size);
if (ret < 0) {
return ret;
}
s->refcount_block_cache_offset = refcount_block_offset;
return 0;
}
| 1threat
|
Does _finddata_t structure returns the local time in UTC timestamp? : I am referring the documentation of `_filefirst()` and `_findnext()` APIs [here][1]
These APIs return file information in a _finddata_t structure. I need to access file modification time from `time_write` element. Though documentation says that
time is stored in UTC format (It is a times stamp). Documentation doesn't clarify if this time represents local time or UTC time. It seems to me that `time_write` doesn't return the UTC timestamp instead its value is influenced by the system time zone settings.
My Question is - Does `time_write` returns local time represented in the UTC timestamps ?
[1]: https://msdn.microsoft.com/en-us/library/kda16keh.aspx
| 0debug
|
iPhone Onboarding screen in Swift : <p>In the official Human Interface Guidelines Apple is reference the topic onboarding - a neat interface which only pops up when you open the app for the first time.
I‘ve seen this in many apps, yet I can‘t find information on how to implement it. It seems like a standardized interface. Check it out here: <a href="https://developer.apple.com/ios/human-interface-guidelines/app-architecture/onboarding/" rel="nofollow noreferrer">https://developer.apple.com/ios/human-interface-guidelines/app-architecture/onboarding/</a></p>
<p>Can anybody provide some information?</p>
| 0debug
|
Set background color of unchecked checkbox Android : <p>It has to be like this:</p>
<p><a href="https://i.stack.imgur.com/wfPa6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/wfPa6.png" alt="enter image description here"></a></p>
<p>Currently it looks like this:</p>
<p><a href="https://i.stack.imgur.com/3gQVn.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3gQVn.png" alt="enter image description here"></a></p>
<p><strong>The rounded rectangle is not that important.</strong> But the unchecked state has to be black. This is my code:</p>
<pre><code><CheckBox
android:id="@+id/checkbox"
android:buttonTint="@color/orange"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</code></pre>
<p>This is the theme I'm using:</p>
<pre><code> "Theme.AppCompat.Light.NoActionBar"
</code></pre>
<p>I've tried this as well:</p>
<pre><code><style name="checkbox_style" parent="Bijenkorf">
<item name="material_grey_600">@color/black</item>
</style>
</code></pre>
<p>Because the default unchecked has the color <strong>#757575</strong>. And I looked this up in the Theme and it was "material_grey_600". But this doesn't compile. Any ideas?</p>
| 0debug
|
Is it better to change a background image on a responsive site with javascript or css with media queries : <p>Working within the confines of our very large scale cms we have come across several instances where we need to set the background images of certain divs from within a content item for maintenance purposes. What this means is we can not put the background-image elements into the main css. There are 2 versions of every background image - mobile and desktop. The solutions we can do are either to write a block into the page and put the css there using @media queries, or to add the background image paths into data-background-sm/ data-background-lg attributes and use javascript to swap them at breakpoints.</p>
<p>What are peoples opinion on which is faster/better/more 'acceptable'?</p>
| 0debug
|
This is only the beginning : Im new to python and I wanted to practice doing loops cause I’ve been having the most trouble with it. So I decided to make a game where the user will pick a number from 0-100 to see if they can win against the computer.
Now what I have going right now is only the beginning. The code isn’t finished. But trying out the code I got a Syntax error where the arrow pointed at the colon on the elif function.
How do I fix this? What can I do?
I accept any other additional comments on my code to make it better.
Here’s my code:
import random
min = 0
max = 100
roll_again = "yes"
quit = "no"
players_choice = input()
computer = random.randint
while roll_again == "yes":
print("Pick a number between 1-100: ")
print(players_choice)
if players_choice >= 0:
print("Your number of choice was: ")
print(players_choice)
print("Your number is high.")
if computer >= 0:
print("Computers number is: ")
print(computer)
print("Computers number is high.")
if computer >= players_choice:
print("Computer wins.")
print("You lose.")
print("Would you like to play again? ", +roll_again)
elif:
print(quit)
end
| 0debug
|
Easier way to transform FormData into query string : <p>I’m sending a POST request via <code>XMLHttpRequest</code> with data entered into an HTML form. The form without interference of JavaScript would submit its data encoded as <code>application/x-www-form-urlencoded</code>.</p>
<p>With the XMLHttpRequest, I wanted to send the data with via the <code>FormData</code> API which does not work since it treats the data as if it were encoded as <code>multipart/form-data</code>. Therefor I need to write the data as a query string, properly escaped, into the send method of the <code>XMLHttpRequest</code>.</p>
<pre><code>addEntryForm.addEventListener('submit', function(event) {
// Gather form data
var formData = new FormData(this);
// Array to store the stringified and encoded key-value-pairs.
var parameters = []
for (var pair of formData.entries()) {
parameters.push(
encodeURIComponent(pair[0]) + '=' +
encodeURIComponent(pair[1])
);
}
var httpRequest = new XMLHttpRequest();
httpRequest.open(form.method, form.action);
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
httpRequest.onreadystatechange = function() {
if (httpRequest.readyState === XMLHttpRequest.DONE) {
if (httpRequest.status === 200) {
console.log('Successfully submitted the request');
} else {
console.log('Error while submitting the request');
}
}
};
httpRequest.send(parameters.join('&'));
// Prevent submitting the form via regular request
event.preventDefault();
});
</code></pre>
<p>Now this whole thing with the <code>for ... of</code> loop, etc. seems a bit convoluted. Is there a simpler way to transform <code>FormData</code> into a query string? Or can I somehow send FormData with a different encoding?</p>
| 0debug
|
Animate animals running accross the screen in Javascript : <p>I have a few thousand JPEGs of different animals. I want to show them moving from the left end of the screen to the right in a web browser. At any point of time there may be a few animals or a few hundred on the screen. How can I do this in Javascript?</p>
| 0debug
|
method object is not subscriptable Python : <p>Running into a <code>TypeError: 'method' object is not subscriptable</code></p>
<pre><code>import csv
import requests
import json
req = requests.get(url="https://www.draftkings.com/lobby/getcontests?sport=NHL")
req.raise_for_status()
data = req.json()
for i, contest in enumerate(data['DraftGroups']):
draftgroupid = contest['DraftGroupId']
req2 = requests.get(url="https://api.draftkings.com/draftgroups/v1/draftgroups/" + str(draftgroupid) + "/draftables?format=json")
data2 = req2.json
for i, player_info in enumerate(data2['draftables'][0]):
date = player_info['competition']['startTime']
print(date)
</code></pre>
<p>The draftgroupid's Output: </p>
<pre><code>16901
16905
16902
16903
</code></pre>
<p>I'm wondering if its possibly the second while loop?</p>
| 0debug
|
how to pass parameters in named route in laravel : I want to pass the parameters in the url in my blade template, url is:
href="/finance/invoices/download/{{ $invoice->file_path }}
and in web.php the route is defined as:
Route::get('invoices/download/{year}/{month}/{file}','InvoiceController@download')->name('download');
and the file is stored in the database as :
2018/07/invoiceberry_invoice_template_1.docx
how do I do that?
| 0debug
|
import a function twice in Python : I would like to import a function twice in a Python script. I have a class defined in models.py and I want to use the function get_item() in that class as a class method
import get_functions
class Shopping_list():
...
def get():
return get_functions.get_item()
but I also want to use the function get_item() outside the class as an independent function so that my main code has the following imports
import models
import get_functions
this does not seem to be allowed, since I get an error. I could define the function twice, but I would like to avoid that. Is there a way to use the functions in get_functions() twice?
| 0debug
|
Jack compiling taking forever : <p>After upgrading my project to enable Jack and Java8 features, my 16gb macbook can't seem to build my project anymore.
I see the memory usage getting higher and higher but the process gets stuck at the same point always.</p>
<p>My Gradle console:</p>
<pre><code>Executing tasks: [:app:assembleDebug]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2421Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72421Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72421Library UP-TO-DATE
:app:prepareComAndroidSupportCustomtabs2340Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2421Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUi2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportCoreUtils2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportFragment2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportMediaCompat2421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42421Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2421Library UP-TO-DATE
:app:prepareComBluelinelabsConductor203Library UP-TO-DATE
:app:prepareComFacebookAndroidFacebookAndroidSdk4160Library UP-TO-DATE
:app:prepareComGithubJkwiecienEasyImage130Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuthBase940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement940Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesTasks940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalytics940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAnalyticsImpl940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuth940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthCommon940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseAuthModule940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCommon940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseCore940Library UP-TO-DATE
:app:prepareComGoogleFirebaseFirebaseIid940Library UP-TO-DATE
:app:prepareComHannesdorfmannMosbyMvp201Library UP-TO-DATE
:app:prepareComHannesdorfmannMosbyMvpConductor082Library UP-TO-DATE
:app:prepareComHannesdorfmannMosbyViewstate201Library UP-TO-DATE
:app:prepareComHannesdorfmannMosbyViewstateConductor082Library UP-TO-DATE
:app:prepareComJakewhartonButterknife840Library UP-TO-DATE
:app:prepareComJakewhartonRxbindingRxbinding040Library UP-TO-DATE
:app:prepareComJakewhartonRxbindingRxbindingAppcompatV7040Library UP-TO-DATE
:app:prepareComJakewhartonRxbindingRxbindingDesign040Library UP-TO-DATE
:app:prepareComJakewhartonRxbindingRxbindingRecyclerviewV7040Library UP-TO-DATE
:app:prepareComJakewhartonRxbindingRxbindingSupportV4040Library UP-TO-DATE
:app:prepareComJakewhartonTimberTimber431Library UP-TO-DATE
:app:prepareComKelvinappsRxfirebase0015Library UP-TO-DATE
:app:prepareComSquareupLeakcanaryLeakcanaryAndroid14Library UP-TO-DATE
:app:prepareIoReactivexRxandroid121Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
Parsing json file: /Users/leonardo/AndroidStudioProjects/Kluster/app/google-services.json
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources
:app:generateDebugSources
:app:unzipJacocoAgent
:app:transformClassesWithPreJackPackagedLibrariesForDebug
:app:transformClassesWithPreJackRuntimeLibrariesForDebug
</code></pre>
<p>My build:</p>
<pre><code>apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.3"
dexOptions {
maxProcessCount 2
javaMaxHeapSize "2g"
}
defaultConfig {
jackOptions {
enabled = true
}
applicationId "com.kluster"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.facebook.stetho:stetho:1.3.1'
compile rootProject.ext.supportV4
compile rootProject.ext.supportDesign
compile rootProject.ext.supportAnnotations
compile rootProject.ext.supportAppCompat
compile rootProject.ext.supportRecyclerView
compile rootProject.ext.supportCardview
compile(rootProject.ext.butterknife)
{
exclude group: "com.android.support"
}
compile rootProject.ext.conductor
compile(rootProject.ext.easyImage) {
exclude group: "com.android.support"
}
compile rootProject.ext.glide
compile rootProject.ext.dagger
compile rootProject.ext.rxJava
compile rootProject.ext.rxAndroid
compile rootProject.ext.mosby
compile rootProject.ext.mosbyViewState
compile rootProject.ext.mosbyConductor
compile rootProject.ext.mosbyViewStateConductor
compile rootProject.ext.rxBinding
compile rootProject.ext.rxBindingV4
compile rootProject.ext.rxBindingV7
compile rootProject.ext.rxBindingDesign
compile rootProject.ext.rxBindingRecyclerView
debugCompile rootProject.ext.leakCanary
compile rootProject.ext.timber
compile rootProject.ext.firebaseAuth;
compile rootProject.ext.googleAuth
compile rootProject.ext.rxFirebase
compile rootProject.ext.facebook
provided rootProject.ext.butterknifeCompiler
provided rootProject.ext.daggerCompiler
provided rootProject.ext.javaxAnnotation
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:24.2.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
</code></pre>
<p>gradle.properties:</p>
<pre><code># Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
</code></pre>
<p>Before using Jack the compiler would build in less than 20s or so, what might be wrong ??
Thanks </p>
| 0debug
|
Google Not Showing React-Helmet Title And Description : <p>I'm using react-helmet to give each of my pages a unique title and description for my React application. The title is rendering correctly in the browser tab and the title and description are rendering correctly when I inspect the page using Dev Tools. However, Google isn't showing either the title or description in their search results. What am I doing wrong? </p>
<p>I've looked into using prerender.io but as my site doesn't have a backend (it's just a marketing site for the moment) I'm not sure it's a good solution. I've removed some elements, but this is essentially how my code looks...</p>
<pre><code>import React, {Component} from 'react';
import {Helmet} from "react-helmet";
class Home extends Component {
render() {
return (
<div>
<Helmet>
<title> My title </title>
<meta name="description" content="My description"/>
</Helmet>
</div>
)
}
}
export default Home;
</code></pre>
| 0debug
|
static int cirrus_bitblt_cputovideo(CirrusVGAState * s)
{
int w;
if (blit_is_unsafe(s, true)) {
return 0;
}
s->cirrus_blt_mode &= ~CIRRUS_BLTMODE_MEMSYSSRC;
s->cirrus_srcptr = &s->cirrus_bltbuf[0];
s->cirrus_srcptr_end = &s->cirrus_bltbuf[0];
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_PATTERNCOPY) {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
s->cirrus_blt_srcpitch = 8;
} else {
s->cirrus_blt_srcpitch = 8 * 8 * s->cirrus_blt_pixelwidth;
}
s->cirrus_srccounter = s->cirrus_blt_srcpitch;
} else {
if (s->cirrus_blt_mode & CIRRUS_BLTMODE_COLOREXPAND) {
w = s->cirrus_blt_width / s->cirrus_blt_pixelwidth;
if (s->cirrus_blt_modeext & CIRRUS_BLTMODEEXT_DWORDGRANULARITY)
s->cirrus_blt_srcpitch = ((w + 31) >> 5);
else
s->cirrus_blt_srcpitch = ((w + 7) >> 3);
} else {
s->cirrus_blt_srcpitch = (s->cirrus_blt_width + 3) & ~3;
}
s->cirrus_srccounter = s->cirrus_blt_srcpitch * s->cirrus_blt_height;
}
s->cirrus_srcptr = s->cirrus_bltbuf;
s->cirrus_srcptr_end = s->cirrus_bltbuf + s->cirrus_blt_srcpitch;
cirrus_update_memory_access(s);
return 1;
}
| 1threat
|
static void qvirtio_pci_foreach_callback(
QPCIDevice *dev, int devfn, void *data)
{
QVirtioPCIForeachData *d = data;
QVirtioPCIDevice *vpcidev = qpcidevice_to_qvirtiodevice(dev);
if (vpcidev->vdev.device_type == d->device_type &&
(!d->has_slot || vpcidev->pdev->devfn == d->slot << 3)) {
d->func(&vpcidev->vdev, d->user_data);
} else {
g_free(vpcidev);
}
}
| 1threat
|
Dynamic routerLink value from ngFor item giving error "Got interpolation ({{}}) where expression was expected" : <p>I'm trying to set the <code>routerLink</code> value in a directive based on a dynamic set of items from the component. But an error is being thrown from Angular2:</p>
<pre><code>EXCEPTION: Template parse errors:
Parser Error: Got interpolation ({{}}) where expression was expected at column 1 in [ {{item.routerLink}} ] in AppHeader@5:40 ("
<a *ngFor="let item of headerItems" [ERROR ->][routerLink]=" {{item.routerLink}} ">
{{item.text}}
</a>
"): Header@5:40
</code></pre>
<p><strong>header.component.ts</strong></p>
<pre><code>import {Component} from '@angular/core';
import {ROUTER_DIRECTIVES} from '@angular/router-deprecated';
@Component({
selector: 'app-header',
templateUrl: './app/components/header/header.component.html',
directives: [ROUTER_DIRECTIVES]
})
export class AppHeader {
headerItems: Object[] = [];
constructor() {
this.headerItems.push(
{ classes: 'navLink', routerLink: ['/Home'], text: 'Home' }
);
}
}
</code></pre>
<p><strong>header.component.html</strong></p>
<pre><code><div id="HeaderRegion">
<nav class="nav">
<a *ngFor="let item of headerItems" [routerLink]=" {{item.routerLink}} ">
{{item.text}}
</a>
</nav>
</div>
</code></pre>
| 0debug
|
Using promise function inside Javascript Array map : <p>Having an array of objects [obj1, obj2]</p>
<p>I want to use Map function to make a DB query (that uses promises) about all of them and attach the results of the query to each object.</p>
<pre><code>[obj1, obj2].map(function(obj){
db.query('obj1.id').then(function(results){
obj1.rows = results
return obj1
})
})
</code></pre>
<p>Of course this doesn't work and the output array is [undefined, undefined]</p>
<p>What's the best way of solving a problem like this? I don't mind using other libraries like async</p>
| 0debug
|
ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp)
{
if (ret <= 0) {
if (ret == 0) {
VNC_DEBUG("Closing down client sock: EOF\n");
} else if (ret != QIO_CHANNEL_ERR_BLOCK) {
VNC_DEBUG("Closing down client sock: ret %zd (%s)\n",
ret, errp ? error_get_pretty(*errp) : "Unknown");
}
vnc_disconnect_start(vs);
if (errp) {
error_free(*errp);
*errp = NULL;
}
return 0;
}
return ret;
}
| 1threat
|
how to reduce complexity of this method? : PS: CONST*-* =>constants
i need to reduce complexity of this method with Java 7 syntax
`public void myMethod(){
if(condition1){
menu.addItem(CONSTA-1);
}
if(condition2){
menu.addItem(CONSTB-1);
}
if(condition3){
menu.addItem(CONSTC-1);
menu.addItem(CONSTC-2);
}
if(condition4){
menu.addItem(CONSTD-1);
}
if(condition5){
menu.addItem(CONSTE-1);
}
}
`
| 0debug
|
Golang C bindings type design : <pre><code>type Foobar C.struct_foobar
</code></pre>
<p>vs.</p>
<pre><code>type Foobar struct {
foobar C.struct_foobar
}
</code></pre>
<p>Which one has which (dis)advantages for writing Golang bindings for a C lib?</p>
| 0debug
|
Insert image into row within column in mysql table rather than as an individual column? : I am incredibly new to PHP and mySql but am trying to learn for a project. Right now I have followed this tutorial http://www.formget.com/ajax-image-upload-php/ to be able to upload images as columns in a blob table in a mysql database with rows such as image size, id, etc.
I have a separate data table where I create columns for individual user accounts (each account has a row for username, password, etc). I have created a row in these columns to store a blob.
I do not need all the rows that the tutorial created for their images (image_type, size, etc) but really just need the image source (the image row). I need to insert this image into the ROW for images in my accounts column (depending on which account is signed in), NOT have new columns be created for each image. I do not know how to go about this with the code I have. Here my javascript for my HTML forms:
$(document).ready(function (e) {
//To transfer clicks to divs
$(".upload-button").on('click', function() {
$("#file").click();
});
$(".save").on('click', function() {
$(".submit").click();
});
$("#uploadimage").on('submit',(function(e) {
e.preventDefault();
$.ajax({
url: "upload.php", // Url to which the request is send
type: "POST", // Type of request to be send, called as method
data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values)
contentType: false, // The content type used when sending data to the server.
cache: false, // To unable request pages to be cached
processData:false, // To send DOMDocument or non processed data file it is set to false
success: function(data) // A function to be called if request succeeds
{
}
});
}));
// Function to preview image after validation
$(function() {
$("#file").change(function() {
// To remove the previous error message
var file = this.files[0];
var imagefile = file.type;
var match= ["image/jpeg","image/png","image/jpg"];
if(!((imagefile==match[0]) || (imagefile==match[1]) || (imagefile==match[2])))
{
$('.userimg').attr('src','noimage.png');
return false;
}
else
{
var reader = new FileReader();
reader.onload = imageIsLoaded;
reader.readAsDataURL(this.files[0]);
}
});
});
function imageIsLoaded(e) {
$("#file").css("color","green");
$('#image_preview').css("display", "block");
$('.userimg').attr('src', e.target.result);
$('.userimg').attr('width', '250px');
$('.userimg').attr('height', '230px');
};
});
Which then references upload.php, which is where changes need to be made:
<?php
if(isset($_FILES["file"]["type"]))
{
$validextensions = array("jpeg", "jpg", "png");
$maxsize = 99999999;
$temporary = explode(".", $_FILES["file"]["name"]);
$file_extension = end($temporary);
if ((($_FILES["file"]["type"] == "image/png") || ($_FILES["file"]["type"] == "image/jpg") || ($_FILES["file"]["type"] == "image/jpeg")
) && ($_FILES["file"]["size"] < $maxsize)//Approx. 100kb files can be uploaded.
&& in_array($file_extension, $validextensions)) {
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br/><br/>";
}
else
{
if (file_exists("images/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " <span id='invalid'><b>already exists.</b></span> ";
}
else
{
$sourcePath = $_FILES['file']['tmp_name']; // Storing source path of the file in a variable
$targetPath = "images/".$_FILES['file']['name']; // Target path where file is to be stored
$size = getimagesize($_FILES['file']['tmp_name']);
/*** assign our variables ***/
$type = $size['mime'];
$imgfp = fopen($_FILES['file']['tmp_name'], 'rb');
$size = $size[3];
$name = $_FILES['file']['name'];
/*** check the file is less than the maximum file size ***/
if($_FILES['file']['size'] < $maxsize )
{
/*** connect to db ***/
$dbh = new PDO("mysql:host=localhost;dbname=sqlserver", 'username', 'password');
/*** set the error mode ***/
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/*** our sql query ***/
$stmt = $dbh->prepare("INSERT INTO imageblob (image_type ,image, image_size, image_name) VALUES (? ,?, ?, ?)");
/*** bind the params ***/
$stmt->bindParam(1, $type);
$stmt->bindParam(2, $imgfp, PDO::PARAM_LOB);
$stmt->bindParam(3, $size);
$stmt->bindParam(4, $name);
/*** execute the query ***/
$stmt->execute();
$lastid = $dbh->lastInsertId();
//Move uploaded File
move_uploaded_file($sourcePath,$targetPath) ; // Moving Uploaded file
if(isset($lastid))
{
/*** assign the image id ***/
$image_id = $lastid;
try {
/*** connect to the database ***/
/*** set the PDO error mode to exception ***/
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/*** The sql statement ***/
$sql = "SELECT image, image_type FROM imageblob WHERE image_id=$image_id";
/*** prepare the sql ***/
$stmt = $dbh->prepare($sql);
/*** exceute the query ***/
$stmt->execute();
/*** set the fetch mode to associative array ***/
$stmt->setFetchMode(PDO::FETCH_ASSOC);
/*** set the header for the image ***/
$array = $stmt->fetch();
/*** check we have a single image and type ***/
if(sizeof($array) == 2)
{
//To Display Image File from Database
echo '<img src="data:image/jpeg;base64,'.base64_encode( $array['image'] ).'"/>';
}
else
{
throw new Exception("Out of bounds Error");
}
}
catch(PDOException $e)
{
echo $e->getMessage();
}
catch(Exception $e)
{
echo $e->getMessage();
}
}
else
{
echo 'Please input correct Image ID';
}
}
else
{
/*** throw an exception is image is not of type ***/
throw new Exception("File Size Error");
}
}
}
}
else
{
echo "<span id='invalid'>***Invalid file Size or Type***<span>";
}
}
?>
I have tried trying to cut out references to image size, type, etc as I feel these are unnecessary, however this created errors. I have poured over other SO posts but can't understand how to simply insert an image into a row within an EXISTING column in mysql data base. On a deadline here and can only create new columns for images.
How can I accomplish this?
| 0debug
|
Hard Copy vs Shallow copy javascript : <p>This may be an old question but I'm really curious about the nature of copying objects by reference as an assignment in javascript. </p>
<p>Meaning that if </p>
<pre><code>var a = {};
var b = a;
a.name = "Renato";
console.log(b);
Object {name: "renato"}
</code></pre>
<p>I'm kind of new to javascript and this really caught my attention to have a shallow copy as a default for Object assignment. I searched that in order to create a hard copy, you have to create a mixin. I was wondering why was this chosen as the default since it's transformation seems to be very implicit. Thanks!</p>
| 0debug
|
uint16_t cpu_inw(CPUState *env, pio_addr_t addr)
{
uint16_t val;
val = ioport_read(1, addr);
LOG_IOPORT("inw : %04"FMT_pioaddr" %04"PRIx16"\n", addr, val);
#ifdef CONFIG_KQEMU
if (env)
env->last_io_time = cpu_get_time_fast();
#endif
return val;
}
| 1threat
|
Android protect Manifest.xml and layout From Reverse engineering : I have been doing lot of research on how to prevent from accessing Manifest and layout files.
i know `proguard` is used for obfuscating code. but than it works only on Java code not on `res` folder.
I have been though some answers like download content at run time instead keeping them in assets and all that.But for now my concern is not to protect asset files. In my case it is Manifest and res folder i need to take care of. i have many types of keys stored in here like example analytics xml file `app_tracker.xml`.
This is not only questions of secret keys i have in xml files. But also logic of layout designing is being on risk.
this are the threads i found while i was doing research on. but nothing was of any help to me.
1) http://stackoverflow.com/q/13854425/3479012
2) http://stackoverflow.com/q/7045613/3479012
I know reverse engineer cannot be avoided. but is there any way i can protect my manifest from being readable from hackers.
| 0debug
|
static void term_show_prompt(void)
{
term_show_prompt2();
term_cmd_buf_index = 0;
term_cmd_buf_size = 0;
}
| 1threat
|
Linux - Check if a file has multiple lines : <p>Is there a command or bash function to check if a file has multiple lines?
Lets say i have these two files:</p>
<p><strong>foo.txt</strong></p>
<pre><code>Hello World
</code></pre>
<p><strong>bar.txt</strong></p>
<pre><code>Hello
World
</code></pre>
| 0debug
|
im creating windows form application, how can i ask user to enter name in block letters? : i have started windows form application. i want that when a registration form runs, it should ask user to enter name in block letters, any text box should not be left NULL, and how to create a text which should alpha numeric? please help soon.
| 0debug
|
Permute lists of lists : <p>Given n arrays of random sizes, I need to permute them like this:</p>
<pre><code>[a1, a2, a3]
[b1, b2]
[c1, c2]
[a1, b1, c1]
[a1, b1, c2]
[a1, b2, c1]
[a1, b2, c2]
[a2, b1, c1]
[a2, b1, c2]
[a2, b2, c1]
[a2, b2, c2]
[a3, b1, c1]
[a3, b1, c2]
[a3, b2, c1]
[a3, b2, c2]
</code></pre>
<p><strong>The columns order matters, lines dont.</strong></p>
<p>What is good way to achieve this. If possible, using this method contract:</p>
<pre class="lang-java prettyprint-override"><code><T> List<List<T>> permute(List<T>... lists)
</code></pre>
| 0debug
|
How can I choose Swift compiler version : <p>I'm using Xcode 7.3 but my project is in Swift 2.1. I don't want to update my codes right now. So how can I choose or download older version of Swift compiler? Many thanks in advance!</p>
| 0debug
|
static void test_validate_union_flat(TestInputVisitorData *data,
const void *unused)
{
UserDefFlatUnion *tmp = NULL;
Visitor *v;
Error *errp = NULL;
v = validate_test_init(data,
"{ 'enum1': 'value1', "
"'string': 'str', "
"'boolean': true }");
visit_type_UserDefFlatUnion(v, &tmp, NULL, &errp);
g_assert(!error_is_set(&errp));
qapi_free_UserDefFlatUnion(tmp);
}
| 1threat
|
Using Pattern in java : <p>I'm practicing with Pattern class in java, and, for example, given a String:</p>
<pre><code>String text = "1234bbbbAAAAb2222 /*1231232132131221*/ [11] }";
</code></pre>
<p>The output should be:</p>
<pre><code>Number: 1234
String: bbbbAAAAb
Number: 2222
Commment: /*1231232132131221*/
Symbol: [
Number: 11
Symbol: ]
Symbol: }
</code></pre>
<p>How could I do this with Pattern using regex, so everything is printed according to the order in the original text ?</p>
<p>My output is not doing in order:</p>
<pre><code>Number: 1234
Number: 2222
Number: 11
String: bbbbAAAAb
Commment: /*1231232132131221*/
Symbol: [
Symbol: ]
Symbol: }
</code></pre>
| 0debug
|
opening directory without know its name : Linux shell : Im writting a script in which user inputs the directory in which he wants to find a specific string inside .txt files, but I dont know how to open every directorys inside the given directory withot knowing their names.
For example this is a directory which user specifies:
Project/
AX/include/
ax.txt
bx.txt
AX/src/
ax.txt
bx.txt
BY/include/
ay.txt
by.txt
BY/src/
ay.txt
by.txt
| 0debug
|
static void ne2000_receive(void *opaque, const uint8_t *buf, size_t size)
{
NE2000State *s = opaque;
uint8_t *p;
unsigned int total_len, next, avail, len, index, mcast_idx;
uint8_t buf1[60];
static const uint8_t broadcast_macaddr[6] =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
#if defined(DEBUG_NE2000)
printf("NE2000: received len=%d\n", size);
#endif
if (s->cmd & E8390_STOP || ne2000_buffer_full(s))
return;
if (s->rxcr & 0x10) {
} else {
if (!memcmp(buf, broadcast_macaddr, 6)) {
if (!(s->rxcr & 0x04))
return;
} else if (buf[0] & 0x01) {
if (!(s->rxcr & 0x08))
return;
mcast_idx = compute_mcast_idx(buf);
if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7))))
return;
} else if (s->mem[0] == buf[0] &&
s->mem[2] == buf[1] &&
s->mem[4] == buf[2] &&
s->mem[6] == buf[3] &&
s->mem[8] == buf[4] &&
s->mem[10] == buf[5]) {
} else {
return;
}
}
if (size < MIN_BUF_SIZE) {
memcpy(buf1, buf, size);
memset(buf1 + size, 0, MIN_BUF_SIZE - size);
buf = buf1;
size = MIN_BUF_SIZE;
}
index = s->curpag << 8;
total_len = size + 4;
next = index + ((total_len + 4 + 255) & ~0xff);
if (next >= s->stop)
next -= (s->stop - s->start);
p = s->mem + index;
s->rsr = ENRSR_RXOK;
if (buf[0] & 0x01)
s->rsr |= ENRSR_PHY;
p[0] = s->rsr;
p[1] = next >> 8;
p[2] = total_len;
p[3] = total_len >> 8;
index += 4;
while (size > 0) {
if (index <= s->stop)
avail = s->stop - index;
else
avail = 0;
len = size;
if (len > avail)
len = avail;
memcpy(s->mem + index, buf, len);
buf += len;
index += len;
if (index == s->stop)
index = s->start;
size -= len;
}
s->curpag = next >> 8;
s->isr |= ENISR_RX;
ne2000_update_irq(s);
}
| 1threat
|
What is limited power bi ? How to solution power bi? : **I want to 500gb import dataset power bi. But power bi limit 1 gb. How to show power bi ? and How much limit power bi ?**
Thanks.
| 0debug
|
Switch statement is NOT converting char input to string output. : char carInsuranceCode;
string getCarInsuranceCode;
string CarInsuranceInformation::getCarInsuranceCode(char carInsuranceCode)
{
switch(carInsuranceCode)
{
case '1': cout << "AllState";
case '2': cout << "Geico";
case '3': cout << "StateFarm";
case '4': cout << "E-Insureance";
default: cout << "Other";
break;
}
}
void CarInsuranceInformation::printCarInsuranceInformation(void)
{
cout << "- - - - CAR INSURANCE INFORMATION - - - " << endl;
cout << "Insurance Code: "<< getCarInsuranceCode() << endl;}
This is being done in a header file and will not cout into the printCarInsuranceInformation. The char is said to not want to convert to a string in the switch statement. The assignment is mandatory to convert the char input into the specified out of the string.
Thank You.
| 0debug
|
Reference cycles with value types? : <p>Reference cycles in Swift occur when properties of reference types have strong ownership of each other (or with closures). </p>
<p>Is there, however, a possibility of having reference cycles with value types <em>only</em>? </p>
<hr>
<p>I tried this in playground without succes (<strong>Error: Recursive value type 'A' is not allowed</strong>).</p>
<pre><code>struct A {
var otherA: A? = nil
init() {
otherA = A()
}
}
</code></pre>
| 0debug
|
Get Value Without OnClick Js : i am finding solution for last 1 week but still no sucess so finally came here please help me out,
i want whatsapp share button for my android app , all is set only problem is i can get text area value but when i click ob button
<button onclick="GetValue ();">Get the velue of the textarea!</button>
i want to GetValue(); without onclick
this is my whatsapp code
<a href="whatsapp://send" data-text="GetValue ();" data-href="" class="wa_btn wa_btn_s" style="display:none">Share</a>
I want textArea Value in data-text and i am using it like above but it dont work.
this is my textarea
<textarea id="input_output" style="width:95%;" rows="10" wrap="soft">Enter Text Here..
</textarea>
please is there any way to get value without clicking button ?
| 0debug
|
e1000e_init_msix(E1000EState *s)
{
PCIDevice *d = PCI_DEVICE(s);
int res = msix_init(PCI_DEVICE(s), E1000E_MSIX_VEC_NUM,
&s->msix,
E1000E_MSIX_IDX, E1000E_MSIX_TABLE,
&s->msix,
E1000E_MSIX_IDX, E1000E_MSIX_PBA,
0xA0);
if (res < 0) {
trace_e1000e_msix_init_fail(res);
} else {
if (!e1000e_use_msix_vectors(s, E1000E_MSIX_VEC_NUM)) {
msix_uninit(d, &s->msix, &s->msix);
}
}
}
| 1threat
|
how to delete a pointer in c++ : <p>I have been editing and compiling my program for two weeks now, but it keeps on stopped working whenever I try to delete a pointer. Please help me identify the problem when deleting a pointer that contains the employee ID entered. I am new to c++ and this makes me crazy.</p>
<pre><code>#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
struct nameType
{
string first, middle, last;
};
struct addressType
{
string add1, add2, city, state;
int zip;
};
struct dateType
{
int month, day, year;
};
struct contactType
{
int phone, cellphone, fax, pager;
string email;
};
struct employeeType
{
nameType name;
string empID;
addressType address;
dateType hireDate;
dateType quitDate;
contactType contact;
string deptID;
double salary;
struct employeeType *pnext, *prev;
};
employeeType *pc, *del, *head;
char choice;
void AddEmp()
{
pc = new employeeType;
del -> pnext = pc;
pc -> prev = del;
del = pc;
pc -> pnext = NULL;
cout << "\t\n\nNAME "<<endl;
cout<< "First: ";
cin >> pc -> name.first;
cout<< "Middle: ";
cin >> pc -> name.middle;
cout << "Last: ";
cin >> pc -> name.last;
cout <<"\nEmployee ID: ";
cin >> pc -> empID;
cout<<"\t\nEnter choice: [A] ADD, [D] DISPLAY, [X] DELETE, [E], EXIT: ";
cin >> choice;
system ("cls");
}
void dispEntry()
{
pc = head -> pnext;
do
{
cout <<"\t\t\t\t\t\n\nEMPLOYEE'S CONTACT DETAILS"<<endl<<endl;
cout <<"["<<pc<<"]";
cout <<"\t\t\t\nNAME"<<endl;
cout << "\nName: " << pc -> name.first << "\nMiddle: " << pc ->
name.middle << "\nLast: "<< pc -> name.last<< endl<<endl;
cout << "Employee ID: "<<pc -> empID<<endl;
pc = pc ->pnext;
}while (pc !=NULL);
cout<<"\t\nEnter choice: [A] ADD, [D] DISPLAY, [X] DELETE, [E], EXIT: ";
cin >> choice;
}
</code></pre>
<p>HERE is the code to delete a pointer, but it is not working.</p>
<pre><code>void delEntry ()
{
string dataDel;
system ("cls");
cout <<" DELETE DATA"<< endl;
cout<<"Enter Employee ID:";
cin >> dataDel;
while (dataDel != pc -> empID )
{
pc = pc -> pnext;
}
del = pc;
if(pc -> pnext = NULL)
{
pc = del -> prev;
pc ->pnext = NULL;
delete del;
del = pc;
}
else
{
pc = del -> prev;
pc -> pnext = del -> pnext;
del -> pnext -> prev = pc;
delete del;
del = pc;
}
}
int main()
{
char entryChoice;
pc = new employeeType;
head = pc;
del = pc;
pc -> prev = pc -> pnext = NULL;
cout << "\t\t\t\t\nTHIS IS A PROGRAM TO ENTER EMPLOYEE'S CONTACT
DETAILS."<<endl<<endl;
cout << "\t\t\t\t\nEnter choice: [A] ADD, [D] DISPLAY, [X] DELETE, [E],
EXIT "<<endl<<endl;
cout << "\t\t\tEnter choice :";
cin >> choice;
system ("cls");
while (choice == 'A', 'D', 'X', 'E')
{
switch(choice)
{
case 'A':
AddEmp();
break;
case 'D':
dispEntry();
break;
case 'X':
delEntry ();
dispEntry();
break;
}
}
}
</code></pre>
| 0debug
|
bool memory_region_present(MemoryRegion *container, hwaddr addr)
{
MemoryRegion *mr = memory_region_find(container, addr, 1).mr;
if (!mr || (mr == container)) {
return false;
}
memory_region_unref(mr);
return true;
}
| 1threat
|
3 images to change the form : I´ve got 3 images in the screen. Each image should display a different form in the SAME POSITION in the screen and turn invisible the other 2 forms.
Image1 : mouse click show form1 and turns invisible form2 and form 3
Image2 : mouse click show form2 and turns invisible form1 and form 3
Image3 : mouse click show form3 and turns invisible form1 and form 2
Forms should be shown at the same position. I see a solution just pointing one form bellow the other...
Hi, I´m using html5, bootstrap and javascript - any suggestion using any of these languages would be perfect
| 0debug
|
Custom Styling on <ng-content> in angular2 not working ? : <p>I am trying to style <code><ng-content></code> using inline css but seems style does't work on ng-content, i have to do something else for styling ? </p>
<pre><code><ng-content class="red"></ng-content> <p class="red">hello</p>
</code></pre>
<p>here class red works on <code>p</code> but not on </p>
<p><kbd><a href="https://plnkr.co/edit/srE5pcQS3nJIKJFSxto4?p=preview" rel="noreferrer">Working Example</a></kbd></p>
| 0debug
|
How to make one hyperlink give different pages? : <p>I'm trying to set up a hyperlink that will randomly open a different webpage per click from a list of URLs. Does anyone know what would be a good function to start with to achieve this?</p>
| 0debug
|
Customize module search path (PYTHONPATH) via pipenv : <p>I have a Python project consisting of a Jupyter notebook, several scripts in a <code>bin</code> directory and modules in a <code>src</code> directory, with dependencies in a <code>Pipfile</code>:</p>
<pre><code>myproject
├── myproject.ipynb
├── Pipfile
├── Pipfile.lock
├── bin
│ ├── bar.py
│ └── foo.py
└── src
├── baz.py
└── qux.py
</code></pre>
<p>The scripts <code>foo.py</code> and <code>bar.py</code> use the standard shebang</p>
<pre><code>#!/usr/bin/env python
</code></pre>
<p>and can be run with <code>pipenv shell</code>:</p>
<pre><code>mymachine:myproject myname$ pipenv shell
(myproject-U308romt) bash-3.2$ bin/foo.py
foo
</code></pre>
<p>However, I can't easily access the modules in <code>src</code> from the scripts. If I add</p>
<pre><code>import src.baz as baz
</code></pre>
<p>to <code>foo.py</code>, I get:</p>
<pre><code>ModuleNotFoundError: No module named 'src'
</code></pre>
<p>One solution I tried is to add a <code>.env</code> file under <code>myproject</code>:</p>
<pre><code>PYTHONPATH=${PYTHONPATH}:${PWD}
</code></pre>
<p>This works thanks to <code>pipenv</code>'s <a href="https://github.com/pypa/pipenv/blob/master/docs/advanced.rst#-automatic-loading-of-env" rel="noreferrer">automatic loading of <code>.env</code></a>, but checking the <code>.env</code> file into the git distribution of the project would collide with the traditional use of <code>.env</code> to store secrets such as passwords -- in fact, my default <code>.gitignore</code> for Python projects already excludes <code>.env</code> for just this reason.</p>
<pre><code>$ git add .env
The following paths are ignored by one of your .gitignore files:
.env
Use -f if you really want to add them.
</code></pre>
<p>Alternatively, I could move <code>src</code> under <code>bin</code>, but then the Jupyter notebook would have to reference the modules as <code>bin.src.baz</code> etc., which is also a hassle.</p>
<p>My current workaround is just to add a symlink:</p>
<pre><code>myproject
├── Pipfile
├── Pipfile.lock
├── bin
│ ├── bar.py
│ ├── foo.py
│ └── src -> ../src
└── src
├── baz.py
└── qux.py
</code></pre>
<p>This works, and I suppose has the benefit of being transparent, but it seems like there should be some way to leverage <code>pipenv</code> to solve the same problem.</p>
<p>Is there a portable, distributable way to put these modules on the search path?</p>
| 0debug
|
static void exynos4210_fimd_update(void *opaque)
{
Exynos4210fimdState *s = (Exynos4210fimdState *)opaque;
Exynos4210fimdWindow *w;
int i, line;
target_phys_addr_t fb_line_addr, inc_size;
int scrn_height;
int first_line = -1, last_line = -1, scrn_width;
bool blend = false;
uint8_t *host_fb_addr;
bool is_dirty = false;
const int global_width = (s->vidtcon[2] & FIMD_VIDTCON2_SIZE_MASK) + 1;
const int global_height = ((s->vidtcon[2] >> FIMD_VIDTCON2_VER_SHIFT) &
FIMD_VIDTCON2_SIZE_MASK) + 1;
if (!s || !s->console || !ds_get_bits_per_pixel(s->console) ||
!s->enabled) {
return;
}
exynos4210_update_resolution(s);
for (i = 0; i < NUM_OF_WINDOWS; i++) {
w = &s->window[i];
if ((w->wincon & FIMD_WINCON_ENWIN) && w->host_fb_addr) {
scrn_height = w->rightbot_y - w->lefttop_y + 1;
scrn_width = w->virtpage_width;
inc_size = scrn_width + w->virtpage_offsize;
memory_region_sync_dirty_bitmap(w->mem_section.mr);
host_fb_addr = w->host_fb_addr;
fb_line_addr = w->mem_section.offset_within_region;
for (line = 0; line < scrn_height; line++) {
is_dirty = memory_region_get_dirty(w->mem_section.mr,
fb_line_addr, scrn_width, DIRTY_MEMORY_VGA);
if (s->invalidate || is_dirty) {
if (first_line == -1) {
first_line = line;
}
last_line = line;
w->draw_line(w, host_fb_addr, s->ifb +
w->lefttop_x * RGBA_SIZE + (w->lefttop_y + line) *
global_width * RGBA_SIZE, blend);
}
host_fb_addr += inc_size;
fb_line_addr += inc_size;
is_dirty = false;
}
memory_region_reset_dirty(w->mem_section.mr,
w->mem_section.offset_within_region,
w->fb_len, DIRTY_MEMORY_VGA);
blend = true;
}
}
if (first_line >= 0) {
uint8_t *d;
int bpp;
bpp = ds_get_bits_per_pixel(s->console);
fimd_update_putpix_qemu(bpp);
bpp = (bpp + 1) >> 3;
d = ds_get_data(s->console);
for (line = first_line; line <= last_line; line++) {
fimd_copy_line_toqemu(global_width, s->ifb + global_width * line *
RGBA_SIZE, d + global_width * line * bpp);
}
dpy_update(s->console, 0, 0, global_width, global_height);
}
s->invalidate = false;
s->vidintcon[1] |= FIMD_VIDINT_INTFRMPEND;
if ((s->vidcon[0] & FIMD_VIDCON0_ENVID_F) == 0) {
exynos4210_fimd_enable(s, false);
}
exynos4210_fimd_update_irq(s);
}
| 1threat
|
int av_aes_init(AVAES *a, const uint8_t *key, int key_bits, int decrypt) {
int i, j, t, rconpointer = 0;
uint8_t tk[8][4];
int KC= key_bits>>5;
int rounds= KC + 6;
uint8_t log8[256];
uint8_t alog8[512];
if(!enc_multbl[4][1023]){
j=1;
for(i=0; i<255; i++){
alog8[i]=
alog8[i+255]= j;
log8[j]= i;
j^= j+j;
if(j>255) j^= 0x11B;
}
for(i=0; i<256; i++){
j= i ? alog8[255-log8[i]] : 0;
j ^= (j<<1) ^ (j<<2) ^ (j<<3) ^ (j<<4);
j = (j ^ (j>>8) ^ 99) & 255;
inv_sbox[j]= i;
sbox [i]= j;
}
init_multbl2(dec_multbl[0], (int[4]){0xe, 0x9, 0xd, 0xb}, log8, alog8, inv_sbox);
init_multbl2(enc_multbl[0], (int[4]){0x2, 0x1, 0x1, 0x3}, log8, alog8, sbox);
}
if(key_bits!=128 && key_bits!=192 && key_bits!=256)
return -1;
a->rounds= rounds;
memcpy(tk, key, KC*4);
for(t= 0; t < (rounds+1)*16;) {
memcpy(a->round_key[0][0]+t, tk, KC*4);
t+= KC*4;
for(i = 0; i < 4; i++)
tk[0][i] ^= sbox[tk[KC-1][(i+1)&3]];
tk[0][0] ^= rcon[rconpointer++];
for(j = 1; j < KC; j++){
if(KC != 8 || j != KC>>1)
for(i = 0; i < 4; i++) tk[j][i] ^= tk[j-1][i];
else
for(i = 0; i < 4; i++) tk[j][i] ^= sbox[tk[j-1][i]];
}
}
if(decrypt){
for(i=1; i<rounds; i++){
uint8_t tmp[3][16];
memcpy(tmp[2], a->round_key[i][0], 16);
subshift(tmp[1], 0, sbox);
mix(tmp, dec_multbl, 1, 3);
memcpy(a->round_key[i][0], tmp[0], 16);
}
}else{
for(i=0; i<(rounds+1)>>1; i++){
for(j=0; j<16; j++)
FFSWAP(int, a->round_key[i][0][j], a->round_key[rounds-i][0][j]);
}
}
return 0;
}
| 1threat
|
static int parse_int32(DeviceState *dev, Property *prop, const char *str)
{
int32_t *ptr = qdev_get_prop_ptr(dev, prop);
char *end;
*ptr = strtol(str, &end, 10);
if ((*end != '\0') || (end == str)) {
return -EINVAL;
}
return 0;
}
| 1threat
|
Merge map of arrays with duplicate keys : <p>I have two maps of arrays. </p>
<pre><code>Map<String, List<String>> map1 = new HashMap<>();
Map<String, List<String>> map2 = new HashMap<>();
</code></pre>
<p>I want to merge them in one new map.<br>
If a key exists in both maps, in that case, I should merge arrays. </p>
<p>For example:</p>
<pre><code>map1.put("k1", Arrays.asList("a0", "a1"));
map1.put("k2", Arrays.asList("b0", "b1"));
map2.put("k2", Arrays.asList("z1", "z2"));
// Expected output is
Map 3: {k1=[a0, a1], k2=[b0, b1, z1, z2]}
</code></pre>
<p>I tried to do that with streams </p>
<pre><code>Map<String, List<String>> map3 = Stream.of(map1, map2)
.flatMap(map -> map.entrySet().stream())
.collect(Collectors.toMap(
Map.Entry::getKey,
e -> e.getValue().stream().collect(Collectors.toList())
));
</code></pre>
<p>This work if there are no the same keys in maps. Otherwise, I get the exception </p>
<pre><code>Exception in thread "main" java.lang.IllegalStateException: Duplicate key k2 (attempted merging values [b0, b1] and [z1, z2])
at java.base/java.util.stream.Collectors.duplicateKeyException(Collectors.java:133)
at java.base/java.util.stream.Collectors.lambda$uniqKeysMapAccumulator$1(Collectors.java:180)
at java.base/java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.base/java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1751)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
at im.djm.Test.main(Test.java:25)
</code></pre>
<p>Is there a way to accomplish this task with streams?<br>
Or I have to iterate throug maps? </p>
| 0debug
|
sql bulk insert : I am having 1 million of data in a file, I want to insert all the records into the mssql server. While inserting I am doing some comparison with existing data on the server, if the comparison satisfied I will update the existing records in the server or else I will insert the record from the file. I'm currently doing this by looping from c#, which consume more than 3 hours to complete the work. Can anyone suggest idea to improve the performance.
Thanks,
Xavier.
| 0debug
|
H14 error in heroku - "no web processes running" : <p>error H14 happen while deploying to heroku
this is my procfile:</p>
<pre><code>web: gunicorn -w 4 -b 0.0.0.0:$PORT -k gevent main:app
</code></pre>
<p>log on heroku:</p>
<pre><code>2017-01-23T10:42:58.904480+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=meetcapstone.herokuapp.com request_id=df88efb5-a81a-4ac0-86dc-4e03d71266bb fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
2017-01-23T10:42:59.009135+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=meetcapstone.herokuapp.com request_id=21cea981-36b0-4410-891f-548bbc29f0ee fwd="81.218.117.137" dyno= connect= service= status=503 bytes=
</code></pre>
<p>requirements:</p>
<pre><code>Flask==0.11.1
passlib==1.7.0
SQLAlchemy==1.1.5
Werkzeug==0.11.15
gunicorn==19.0.0
gevent==1.2.1
</code></pre>
| 0debug
|
hdfs dfs -mkdir, No such file or directory : <p>Hi I am new to hadoop and trying to create directory in hdfs called twitter_data.
I have set up my vm on softlayer, installed & started hadoop successfully. </p>
<p>This is the commend I am trying to run:</p>
<blockquote>
<p>hdfs dfs -mkdir hdfs://localhost:9000/user/Hadoop/twitter_data</p>
</blockquote>
<p>And it keeps returning this error message: </p>
<pre><code> /usr/local/hadoop/etc/hadoop/hadoop-env.sh: line 2: ./hadoop-env.sh: Permission denied
16/10/19 19:07:03 WARN util.NativeCodeLoader: Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
mkdir: `hdfs://localhost:9000/user/Hadoop/twitter_data': No such file or directory
</code></pre>
<p>Why does it say there is no such file and directory? I am ordering it to make directory, shouldn't it just create one? I am guessing it must be the permission issue, but I cant resolve it. Please help me hdfs experts. I have been spending too much time on what seems to be a simple matter.</p>
<p>Thanks in advance. </p>
| 0debug
|
Please tell me the V.B code to change the b.g color of cells based on same values in another sheet : I am trying to change the background colour of certain cells in sheet 1 based on the same set of values in the sheet 2.
I want it to search the values in sheet 2 to sheet 1, if the values are same then the colour should change.
I have used conditional formatting but things are not working. Please help
| 0debug
|
Passing values from one HTML page to another : <p>I'm currently working on a online catalogue and need help with a specific feature. I have a page manageCards.xhtml which contains a table, which displays card information (this has been hard-coded). There is a button at the bottom of this page which takes them to a new page addNewCards.xhtml where they can fill in the relevant fields to register a new card.</p>
<p>My question is, is there a way I can transfer the values between these pages and populate a new instance of the same table back on the manageCards.xhtml page, but for the newly registered card? I'm relatively new to both JavaScript and jQuery but I'm sure there's a way I'm not familiar with yet.</p>
<p>Any help would be greatly appreciated</p>
<p>Many thanks</p>
| 0debug
|
How can I verify the minimum coverage with some excluded classes and with the jacoco plugin? : <p>I need to check the minimum coverage with the new jacoco task</p>
<p><strong>jacocoTestCoverageVerification</strong></p>
<p>This task is available with in the 3.4.1 gradle release and with the jacoco plugin >= 0.6.3</p>
<p>I could run another task that generates an html report with the branch coverage but now I want to use that number to make the build fail.</p>
<p>This is my code</p>
<pre><code>buildscript {
ext {
....
}
repositories {
mavenCentral()
maven {
....
}
}
dependencies {
.....
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'jacoco'
jar {
baseName = "coverage-test"
}
dependencies {
// my dependencies
}
eclipse {
classpath {
containers.remove('org.eclipse.jdt.launching.JRE_CONTAINER')
containers 'org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8'
}
}
wrapper {
gradleVersion = '3.4.1'
}
jacoco {
toolVersion = '0.7.9'
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
}
group = "Reporting"
description = "Generate Jacoco coverage reports after running tests."
additionalSourceDirs = files(sourceSets.main.allJava.srcDirs)
afterEvaluate {
classDirectories = files(classDirectories.files.collect {
fileTree(
dir: it,
excludes:
[
'com/jacoco/dto/**',
'com/jacoco/configs/**',
//and others
])
})
}
}
jacocoTestCoverageVerification {
//I tried this and it didn't work
// classDirectories = files(classDirectories.files.collect {
// fileTree(
// dir: it,
// excludes:
// [
// 'com/jacoco/dto/**',
// 'com/jacoco/configs/**',
// //and others
// ])
// })
violationRules {
rule {
//Also tried this and it didn't work
// excludes = ['com/jacoco/dto/**', ...]
limit {
counter = 'BRANCH'
minimum = 0.8
}
}
}
}
check.dependsOn jacocoTestCoverageVerification
</code></pre>
<p>With <strong>classDirectories</strong> I get the following error <em>Cannot get property 'files' on null object</em>. And with the second option (only <strong>excludes</strong>), the build run smoothly but It doesn't exclude any class.</p>
| 0debug
|
static void help(void)
{
printf("qemu-img version " QEMU_VERSION ", Copyright (c) 2004-2008 Fabrice Bellard\n"
"usage: qemu-img command [command options]\n"
"QEMU disk image utility\n"
"\n"
"Command syntax:\n"
" check [-f fmt] filename\n"
" create [-F fmt] [-b base_image] [-f fmt] [-o options] filename [size]\n"
" commit [-f fmt] filename\n"
" convert [-c] [-f fmt] [-O output_fmt] [-o options] [-B output_base_image] filename [filename2 [...]] output_filename\n"
" info [-f fmt] filename\n"
" snapshot [-l | -a snapshot | -c snapshot | -d snapshot] filename\n"
"\n"
"Command parameters:\n"
" 'filename' is a disk image filename\n"
" 'base_image' is the read-only disk image which is used as base for a copy on\n"
" write image; the copy on write image only stores the modified data\n"
" 'output_base_image' forces the output image to be created as a copy on write\n"
" image of the specified base image; 'output_base_image' should have the same\n"
" content as the input's base image, however the path, image format, etc may\n"
" differ\n"
" 'fmt' is the disk image format. It is guessed automatically in most cases\n"
" 'size' is the disk image size in kilobytes. Optional suffixes\n"
" 'M' (megabyte, 1024 * 1024) and 'G' (gigabyte, 1024 * 1024 * 1024) are\n"
" supported any 'k' or 'K' is ignored\n"
" 'output_filename' is the destination disk image filename\n"
" 'output_fmt' is the destination format\n"
" 'options' is a comma separated list of format specific options in a\n"
" name=value format. Use -o ? for an overview of the options supported by the\n"
" used format\n"
" '-c' indicates that target image must be compressed (qcow format only)\n"
" '-h' with or without a command shows this help and lists the supported formats\n"
"\n"
"Parameters to snapshot subcommand:\n"
" 'snapshot' is the name of the snapshot to create, apply or delete\n"
" '-a' applies a snapshot (revert disk to saved state)\n"
" '-c' creates a snapshot\n"
" '-d' deletes a snapshot\n"
" '-l' lists all snapshots in the given image\n"
);
printf("\nSupported formats:");
bdrv_iterate_format(format_print, NULL);
printf("\n");
exit(1);
}
| 1threat
|
Cannot assign value of type '[asd]?' to type 'asd' : I've some variable in this class
class qwerty: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource {
var userData = clsReqData()
var arrayMissingLI [String] = []
var arrayInLI [String] = []
var arrayLN [String] = []
override func viewDidLoad() {
reqSpinnerCIN()
}
func reqSpinnerCIN(){
NetworkingService.shared.reqSpinnerCIN(phone_number: user.phone_number!) {spinnerResponse in
if (spinnerResponse == nil){
self.view.makeToast("Technical problem, please try again...")
} else {
if (spinnerResponse?.success == Const.ResponseKey.Success){
print(spinnerResponse ?? "")
self.userData = spinnerResponse?.data!
//error "Cannot assign value of type '[clsSpinnerNominalCashin]?' to type 'clsSpinnerNominalCashin'"
} else if (spinnerResponse?.success == Const.ResponseKey.SessionEnd) {
self.sessionEnd()
} else {
let popup = PopupDialog(title: "Failed to get data", message: spinnerResponse?.error)
let buttonOK = DefaultButton(title: "OK"){
}
popup.addButton(buttonOK)
self.present(popup,animated: true,completion: nil)
}
}
}
}
}
Let's say `spinnerResponse` is class `clsReqDataResponseFromServer` that i use in escape handling Alamofire to getting the response from server. And the variable inside this class is :
class clsReqDataResponseFromServer: Mappable {
var tag: String?
var success: String?
var error: String?
var data: [clsReqData]?
required init? (map: Map) {
}
init () {
}
func mapping(map: Map) {
tag <- map ["tag"]
success <- map ["success"]
error <- map ["error"]
data <- map ["data"]
}
}
And variable inside class `clsReqData` is :
class clsReqData: Mappable {
var Type: String?
var ListId: String?
var ListName: String?
required init? (map: Map) {
}
init () {
}
func mapping(map: Map) {
Type <- map ["type"]
ListId <- map ["list_i"]
ListName <- map ["list_name"]
}
}
in this case, `spinnerResponse.data` is the `clsReqData` but it declared as `array` and i use it for getting the response from server. Because of that, i can't put this response into `userData`
inside `spinnerResponse.data`, it have some variable like `T, LI,` and `LN`
I want to put those data from `spinnerResponse.data` into `userData` because i want to filter the data inside `spinnerResponse.data`
For example
if the response that i get from `clsReqData` is
//T = Type
//LI = ListId
//LN = ListName
T = In
LI = 001
LN = CG1
T = Out
LI = 001
LN = CG2
T = Missing
LI = 001
LN = CG3
T = Out
LI = 002
LN = CG4
T = In
LI = 002
LN = CG5
If the `T` is `Missing`, i want to put variable `LI` into `arrayMissingLI` and `LN` into `arrayLN` and use it in the Pickerview.
And here's i think :
if userData.type == "Missing" {
//put all data from "LI" that variable "Type / T" is "Missing" that i got from `spinnerResponse?.data` and save it into arrayMissingLI
//put all data from "LN" that variable "Type / T" is "Missing" that i got from `spinnerResponse?.data` and save it into arrayMissingLN
}
if i use `self.userData = spinnerResponse?.data!`, it'll show `Cannot assign value of type '[clsReqData]?' to type 'clsReqData'` error.
How can i solve this problem so i can filter those array and use it in the `PickerView` for showing the data if i choose `Missing, Out,` and `In`
| 0debug
|
static void menelaus_save(QEMUFile *f, void *opaque)
{
MenelausState *s = (MenelausState *) opaque;
qemu_put_be32(f, s->firstbyte);
qemu_put_8s(f, &s->reg);
qemu_put_8s(f, &s->vcore[0]);
qemu_put_8s(f, &s->vcore[1]);
qemu_put_8s(f, &s->vcore[2]);
qemu_put_8s(f, &s->vcore[3]);
qemu_put_8s(f, &s->vcore[4]);
qemu_put_8s(f, &s->dcdc[0]);
qemu_put_8s(f, &s->dcdc[1]);
qemu_put_8s(f, &s->dcdc[2]);
qemu_put_8s(f, &s->ldo[0]);
qemu_put_8s(f, &s->ldo[1]);
qemu_put_8s(f, &s->ldo[2]);
qemu_put_8s(f, &s->ldo[3]);
qemu_put_8s(f, &s->ldo[4]);
qemu_put_8s(f, &s->ldo[5]);
qemu_put_8s(f, &s->ldo[6]);
qemu_put_8s(f, &s->ldo[7]);
qemu_put_8s(f, &s->sleep[0]);
qemu_put_8s(f, &s->sleep[1]);
qemu_put_8s(f, &s->osc);
qemu_put_8s(f, &s->detect);
qemu_put_be16s(f, &s->mask);
qemu_put_be16s(f, &s->status);
qemu_put_8s(f, &s->dir);
qemu_put_8s(f, &s->inputs);
qemu_put_8s(f, &s->outputs);
qemu_put_8s(f, &s->bbsms);
qemu_put_8s(f, &s->pull[0]);
qemu_put_8s(f, &s->pull[1]);
qemu_put_8s(f, &s->pull[2]);
qemu_put_8s(f, &s->pull[3]);
qemu_put_8s(f, &s->mmc_ctrl[0]);
qemu_put_8s(f, &s->mmc_ctrl[1]);
qemu_put_8s(f, &s->mmc_ctrl[2]);
qemu_put_8s(f, &s->mmc_debounce);
qemu_put_8s(f, &s->rtc.ctrl);
qemu_put_be16s(f, &s->rtc.comp);
qemu_put_be16(f, s->rtc.next - qemu_get_clock(rt_clock));
tm_put(f, &s->rtc.new);
tm_put(f, &s->rtc.alm);
qemu_put_byte(f, s->pwrbtn_state);
i2c_slave_save(f, &s->i2c);
}
| 1threat
|
static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
{
int i, tmp, partition, method_type, rice_order;
int rice_bits, rice_esc;
int samples;
method_type = get_bits(&s->gb, 2);
if (method_type > 1) {
av_log(s->avctx, AV_LOG_ERROR, "illegal residual coding method %d\n",
method_type);
rice_order = get_bits(&s->gb, 4);
samples= s->blocksize >> rice_order;
if (pred_order > samples) {
av_log(s->avctx, AV_LOG_ERROR, "invalid predictor order: %i > %i\n",
pred_order, samples);
rice_bits = 4 + method_type;
rice_esc = (1 << rice_bits) - 1;
decoded += pred_order;
i= pred_order;
for (partition = 0; partition < (1 << rice_order); partition++) {
tmp = get_bits(&s->gb, rice_bits);
if (tmp == rice_esc) {
tmp = get_bits(&s->gb, 5);
for (; i < samples; i++)
*decoded++ = get_sbits_long(&s->gb, tmp);
} else {
for (; i < samples; i++) {
*decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
i= 0;
return 0;
| 1threat
|
Laravel eloquent multiple WHERE with OR AND OR and LIKE? : <p>I have ( or am trying to make ) this query in Laravel</p>
<p>The problem I have is with the <code>$orThose</code><br>
I want to query <code>LIKE</code>. </p>
<p>The data in that field can be many things, but there will always be a key work like "L3" or "ICU" in the field.</p>
<p>Can you do a <code>LIKE</code> query in this case</p>
<pre><code>$matchThese = ['link.hos_id' => $hos_id, 'outcome.otc_otrdischargedate' => $td];
$orThose = ['outcome.otc_outcome' => '@ICU@', 'outcome.otc_outcome' => '@I.C.U@'];
$todaysReferrals = DB::table('link')
->join('daily_link', 'link.lnk_id', '=', 'daily_link.dlk_lnkid')
->join('demographic', 'link.lnk_dmgid', '=', 'demographic.dmg_id')
->join('admission', 'link.lnk_admid', '=', 'admission.adm_id')
->join('or_call', 'admission.adm_calid', '=', 'or_call.cal_id')
->join('admission_score', 'admission.adm_scoreid', '=', 'admission_score.ascore_id')
->join('diagnosis', 'link.lnk_dgnid', '=', 'diagnosis.dgn_id')
->join('outcome', 'link.lnk_otcid', '=', 'outcome.otc_id')
->where($matchThese)
->orWhere($orThose)
->get();
</code></pre>
| 0debug
|
How to save final model using keras? : <p>I use KerasClassifier to train the classifier.</p>
<p>The code is below:</p>
<pre><code>import numpy
from pandas import read_csv
from keras.models import Sequential
from keras.layers import Dense
from keras.wrappers.scikit_learn import KerasClassifier
from keras.utils import np_utils
from sklearn.model_selection import cross_val_score
from sklearn.model_selection import KFold
from sklearn.preprocessing import LabelEncoder
from sklearn.pipeline import Pipeline
# fix random seed for reproducibility
seed = 7
numpy.random.seed(seed)
# load dataset
dataframe = read_csv("iris.csv", header=None)
dataset = dataframe.values
X = dataset[:,0:4].astype(float)
Y = dataset[:,4]
# encode class values as integers
encoder = LabelEncoder()
encoder.fit(Y)
encoded_Y = encoder.transform(Y)
#print("encoded_Y")
#print(encoded_Y)
# convert integers to dummy variables (i.e. one hot encoded)
dummy_y = np_utils.to_categorical(encoded_Y)
#print("dummy_y")
#print(dummy_y)
# define baseline model
def baseline_model():
# create model
model = Sequential()
model.add(Dense(4, input_dim=4, init='normal', activation='relu'))
#model.add(Dense(4, init='normal', activation='relu'))
model.add(Dense(3, init='normal', activation='softmax'))
# Compile model
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
return model
estimator = KerasClassifier(build_fn=baseline_model, nb_epoch=200, batch_size=5, verbose=0)
#global_model = baseline_model()
kfold = KFold(n_splits=10, shuffle=True, random_state=seed)
results = cross_val_score(estimator, X, dummy_y, cv=kfold)
print("Accuracy: %.2f%% (%.2f%%)" % (results.mean()*100, results.std()*100))
</code></pre>
<p>But How to save the final model for future prediction?</p>
<p>I usually use below code to save model:</p>
<pre><code># serialize model to JSON
model_json = model.to_json()
with open("model.json", "w") as json_file:
json_file.write(model_json)
# serialize weights to HDF5
model.save_weights("model.h5")
print("Saved model to disk")
</code></pre>
<p>But I don't know how to insert the saving model's code into KerasClassifier's code.</p>
<p>Thank you.</p>
| 0debug
|
int bdrv_pdiscard(BlockDriverState *bs, int64_t offset, int count)
{
Coroutine *co;
DiscardCo rwco = {
.bs = bs,
.offset = offset,
.count = count,
.ret = NOT_DONE,
};
if (qemu_in_coroutine()) {
bdrv_pdiscard_co_entry(&rwco);
} else {
co = qemu_coroutine_create(bdrv_pdiscard_co_entry, &rwco);
qemu_coroutine_enter(co);
BDRV_POLL_WHILE(bs, rwco.ret == NOT_DONE);
}
return rwco.ret;
}
| 1threat
|
how to remove lines from a text using regex? : <p>I have scraped some data but when i wanna import it into wordpres theres always a like space</p>
<p>i want to import it like this:</p>
<p><a href="https://i.stack.imgur.com/7Q0Dd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7Q0Dd.png" alt="enter image description here"></a></p>
<p>any solutions. please keep in mine im an absolute noobie just wanna know if theres a simple way to remove these lines</p>
| 0debug
|
How can I clean (reset cache) of React Native using Expo. Not sure if it is cache issue : <p>I am building a simple React Native app with create-react-native-app using only react-navigation and base-64(base 64 encode/decode) as dependencies. Over time starting the app became slower and now sometimes it is getting stuck(waiting for about 30min) on "Starting packager..." after running NPM start.</p>
<p>I've tried starting it with "npm start -- --reset-cache" but nothing changed</p>
<p>Once it is up and running I don't get any error or warning in DevTools or terminal. Also there are no issues with the performance of the app</p>
<p>What can I do to make NPM start smooth and quickly as before? Are there any general steps I can take to troubleshoot this issue?</p>
<p>Here is my package.json</p>
<pre><code>{
"name": "test",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "~27.0.0",
"react-devtools": "^3.2.3",
"react-native-scripts": "1.14.0",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"base-64": "^0.1.0",
"expo": "^27.0.1",
"react": "16.3.1",
"react-native": "~0.55.2",
"react-navigation": "^2.11.2"
}
}
</code></pre>
| 0debug
|
Translate java widget to kotlin : <p>Can anybody help me with translating from java to kotlin?
I'm trying to make android widget that basically updates itself when the button is pushed.</p>
<pre><code>public class NewAppWidget extends AppWidgetProvider {
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
for (int appWidgetId : appWidgetIds) {
Intent intent1 = new Intent(context, NewAppWidget.class);
intent1.setAction(AppWidgetManager.ACTION_APPWIDGET_UPDATE);
intent1.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetIds);
PendingIntent pendingIntent1 = PendingIntent.getBroadcast(context,0, intent1, 0);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(),R.layout.new_app_widget);
remoteViews.setOnClickPendingIntent(R.id.buttonId, pendingIntent1);
//there will come my action
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}
}
}
</code></pre>
<p>Can anybody translate this for me?</p>
| 0debug
|
Angular js 2 'node_modules/rxjs/Observable"' has no exported member 'Observable'. import Observable : <p>I am Getting below Error in Auth.d.ts file in Node_Modules Package.</p>
<p>[ts] Module 'node_modules/rxjs/Observable"' has no exported member 'Observable'.
import Observable</p>
<p>Find the below code for Auth.d.ts file :</p>
<pre><code>import * as firebase from 'firebase/app';
import 'firebase/auth';
import { Observable } from 'rxjs/Observable';
import { FirebaseApp } from '../app/index';
export declare class AngularFireAuth {
app: FirebaseApp;
auth: firebase.auth.Auth;
authState: Observable<firebase.User>;
idToken: Observable<firebase.User>;
constructor(app: FirebaseApp);
}
export declare function FirebaseAuthStateObservable(app: FirebaseApp): Observable<firebase.User>;
export declare function FirebaseIdTokenObservable(app: FirebaseApp): Observable<firebase.User>;
</code></pre>
<p>I installed "npm install @reactivex/rxjs" this package also even then I am getting above error</p>
| 0debug
|
static QEMUClock *qemu_new_clock(int type)
{
QEMUClock *clock;
clock = g_malloc0(sizeof(QEMUClock));
clock->type = type;
clock->enabled = true;
clock->last = INT64_MIN;
notifier_list_init(&clock->reset_notifiers);
return clock;
}
| 1threat
|
How to read image file from S3 bucket directly into memory? : <p>I have the following code</p>
<pre><code>import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import boto3
s3 = boto3.resource('s3', region_name='us-east-2')
bucket = s3.Bucket('sentinel-s2-l1c')
object = bucket.Object('tiles/10/S/DG/2015/12/7/0/B01.jp2')
object.download_file('B01.jp2')
img=mpimg.imread('B01.jp2')
imgplot = plt.imshow(img)
plt.show(imgplot)
</code></pre>
<p>and it works. But the problem it downloads file into current directory first. Is it possible to read file and decode it as image directly in RAM?</p>
| 0debug
|
Regex matching for optional characters including question mark : <p>My string looks like this: "<a href="https://google.com/bar/foobar?count=1" rel="nofollow noreferrer">https://google.com/bar/foobar?count=1</a>" or it could be "<a href="https://google.com/bar/foobar" rel="nofollow noreferrer">https://google.com/bar/foobar</a>"</p>
<p>I want to extract the value <code>foobar</code> - it appears after <code>/bar</code> and has an optional <code>?</code></p>
<p>My regex looks like this:
<code>m = re.match(r'(.*)/bar/(.*)((\?)(.*))?', data)</code></p>
<p>When I use this regex over example 2: <code>"https://google.com/bar/foobar"</code> I get two groups
<code>('https://google.com', 'foobar', None, None, None)</code></p>
<p>When I use this regex on the first example: <code>"https://google.com/bar/foobar?count=1"</code> I get</p>
<p><code>('https://google.com', 'foobar?count=3', None, None, None)</code></p>
<p>But I would like the second group to just be <code>foobar</code> without the <code>?count=3</code>
How would I achieve that?</p>
<p>My understanding so far is</p>
<p><code>(.*)/bar/(.*)((\?)(.*))?</code> is as follows:
<code>(.*)</code> matches the first part of the string. <code>\?</code> matches the <code>?</code> and <code>((\?)(.*))</code> matches <code>?count=3</code> and this is enclosed in <code>?</code> because it is supposed to be optional.</p>
| 0debug
|
Solution For getting Mobile Number in Android : <p>Using Telephony Manager returns null value for Mobile number, I want to get Mobile Number directly in to the app without asking user.</p>
| 0debug
|
static int do_sd_create(char *filename, int64_t vdi_size,
uint32_t base_vid, uint32_t *vdi_id, int snapshot,
const char *addr, const char *port)
{
SheepdogVdiReq hdr;
SheepdogVdiRsp *rsp = (SheepdogVdiRsp *)&hdr;
int fd, ret;
unsigned int wlen, rlen = 0;
char buf[SD_MAX_VDI_LEN];
fd = connect_to_sdog(addr, port);
if (fd < 0) {
return fd;
}
memset(buf, 0, sizeof(buf));
strncpy(buf, filename, SD_MAX_VDI_LEN);
memset(&hdr, 0, sizeof(hdr));
hdr.opcode = SD_OP_NEW_VDI;
hdr.base_vdi_id = base_vid;
wlen = SD_MAX_VDI_LEN;
hdr.flags = SD_FLAG_CMD_WRITE;
hdr.snapid = snapshot;
hdr.data_length = wlen;
hdr.vdi_size = vdi_size;
ret = do_req(fd, (SheepdogReq *)&hdr, buf, &wlen, &rlen);
closesocket(fd);
if (ret) {
return ret;
}
if (rsp->result != SD_RES_SUCCESS) {
error_report("%s, %s", sd_strerror(rsp->result), filename);
return -EIO;
}
if (vdi_id) {
*vdi_id = rsp->vdi_id;
}
return 0;
}
| 1threat
|
Unable to contact local DTServiceHub to bless simulator connection : <p>When I run my basic Xcode project in simulator, I got the below issue:-</p>
<blockquote>
<p>Failed to initiate service connection to simulator. </p>
<p>Unable to contact local DTServiceHub to bless simulator connection</p>
</blockquote>
<p>Xcode 8.0</p>
<p>OS 10.11.6</p>
<p>SWIFT 3</p>
<p><a href="https://i.stack.imgur.com/N0nIp.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N0nIp.png" alt="enter image description here"></a></p>
| 0debug
|
static void blockdev_backup_prepare(BlkTransactionState *common, Error **errp)
{
BlockdevBackupState *state = DO_UPCAST(BlockdevBackupState, common, common);
BlockdevBackup *backup;
BlockBackend *blk, *target;
Error *local_err = NULL;
assert(common->action->kind == TRANSACTION_ACTION_KIND_BLOCKDEV_BACKUP);
backup = common->action->blockdev_backup;
blk = blk_by_name(backup->device);
if (!blk) {
error_setg(errp, "Device '%s' not found", backup->device);
return;
}
if (!blk_is_available(blk)) {
error_setg(errp, QERR_DEVICE_HAS_NO_MEDIUM, backup->device);
return;
}
target = blk_by_name(backup->target);
if (!target) {
error_setg(errp, "Device '%s' not found", backup->target);
return;
}
state->aio_context = blk_get_aio_context(blk);
if (state->aio_context != blk_get_aio_context(target)) {
state->aio_context = NULL;
error_setg(errp, "Backup between two IO threads is not implemented");
return;
}
aio_context_acquire(state->aio_context);
state->bs = blk_bs(blk);
bdrv_drained_begin(state->bs);
qmp_blockdev_backup(backup->device, backup->target,
backup->sync,
backup->has_speed, backup->speed,
backup->has_on_source_error, backup->on_source_error,
backup->has_on_target_error, backup->on_target_error,
&local_err);
if (local_err) {
error_propagate(errp, local_err);
return;
}
state->job = state->bs->job;
}
| 1threat
|
static void qxl_enter_vga_mode(PCIQXLDevice *d)
{
if (d->mode == QXL_MODE_VGA) {
return;
}
trace_qxl_enter_vga_mode(d->id);
#if SPICE_SERVER_VERSION >= 0x000c03
spice_qxl_driver_unload(&d->ssd.qxl);
#endif
graphic_console_set_hwops(d->ssd.dcl.con, d->vga.hw_ops, &d->vga);
update_displaychangelistener(&d->ssd.dcl, GUI_REFRESH_INTERVAL_DEFAULT);
qemu_spice_create_host_primary(&d->ssd);
d->mode = QXL_MODE_VGA;
vga_dirty_log_start(&d->vga);
graphic_hw_update(d->vga.con);
}
| 1threat
|
static bool vfio_prereg_listener_skipped_section(MemoryRegionSection *section)
{
if (memory_region_is_iommu(section->mr)) {
hw_error("Cannot possibly preregister IOMMU memory");
}
return !memory_region_is_ram(section->mr) ||
memory_region_is_skip_dump(section->mr);
}
| 1threat
|
Why i have problem when i train my model, pytorch? : im new with pytorch and ai but i have some trouble when i try to train my model.
I just create my Dataset and my Dataloader
train_dataset = TensorDataset(tensor_train,tensor_label)
train_dataloader = DataLoader(train_dataset,batch_size=32,shuffle=True)
And after this my criterion and optimiser
criterion = nn.CrossEntropyLoss()
optimiser=optim.Adam(net.parameters(),lr=0.2)
And i try to train him with
for epoch in range(10):
for data in train_dataloader:
inputs,labels = data
output = net(torch.Tensor(inputs))
loss = criterion(output,labels.to(device))
optimiser.zero_grad()
loss.backward()
optimiser.step()
But i got this error
d:\py\lib\site-packages\torch\nn\modules\module.py in <lambda>(t)
321 Module: self
322 """
--> 323 return self._apply(lambda t: t.type(dst_type))
324
325 def float(self):
TypeError: dtype must be a type, str, or dtype object
I will be happy if someone find the problem, thanks.
| 0debug
|
Property `_statusBarTintColorLockingControllers` at `UIApplication` keeping ViewController in memory : <p>Using Xcode 8 new memory debugger I found out there was a ViewController in memory that shouldn't be there and the strong reference that was pointing to it was coming from this mysterious <code>_statusBarTintColorLockingControllers</code> array in UIApplication. Does anybody know where it comes from? And more importantly, how to take my VC out of it?</p>
<p><a href="https://i.stack.imgur.com/iiF5S.png" rel="noreferrer"><img src="https://i.stack.imgur.com/iiF5S.png" alt="memory debugger"></a></p>
| 0debug
|
static ssize_t virtio_net_receive(VLANClientState *vc, const uint8_t *buf, size_t size)
{
VirtIONet *n = vc->opaque;
struct virtio_net_hdr_mrg_rxbuf *mhdr = NULL;
size_t hdr_len, offset, i;
if (!do_virtio_net_can_receive(n, size))
return 0;
if (!receive_filter(n, buf, size))
return size;
hdr_len = n->mergeable_rx_bufs ?
sizeof(struct virtio_net_hdr_mrg_rxbuf) : sizeof(struct virtio_net_hdr);
offset = i = 0;
while (offset < size) {
VirtQueueElement elem;
int len, total;
struct iovec sg[VIRTQUEUE_MAX_SIZE];
len = total = 0;
if ((i != 0 && !n->mergeable_rx_bufs) ||
virtqueue_pop(n->rx_vq, &elem) == 0) {
if (i == 0)
return -1;
fprintf(stderr, "virtio-net truncating packet\n");
exit(1);
}
if (elem.in_num < 1) {
fprintf(stderr, "virtio-net receive queue contains no in buffers\n");
exit(1);
}
if (!n->mergeable_rx_bufs && elem.in_sg[0].iov_len != hdr_len) {
fprintf(stderr, "virtio-net header not in first element\n");
exit(1);
}
memcpy(&sg, &elem.in_sg[0], sizeof(sg[0]) * elem.in_num);
if (i == 0) {
if (n->mergeable_rx_bufs)
mhdr = (struct virtio_net_hdr_mrg_rxbuf *)sg[0].iov_base;
offset += receive_header(n, sg, elem.in_num,
buf + offset, size - offset, hdr_len);
total += hdr_len;
}
len = iov_fill(sg, elem.in_num,
buf + offset, size - offset);
total += len;
virtqueue_fill(n->rx_vq, &elem, total, i++);
offset += len;
}
if (mhdr)
mhdr->num_buffers = i;
virtqueue_flush(n->rx_vq, i);
virtio_notify(&n->vdev, n->rx_vq);
return size;
}
| 1threat
|
static av_cold int X264_init(AVCodecContext *avctx)
{
X264Context *x4 = avctx->priv_data;
AVCPBProperties *cpb_props;
#if CONFIG_LIBX262_ENCODER
if (avctx->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
x4->params.b_mpeg2 = 1;
x264_param_default_mpeg2(&x4->params);
} else
#else
x264_param_default(&x4->params);
#endif
x4->params.b_deblocking_filter = avctx->flags & AV_CODEC_FLAG_LOOP_FILTER;
if (x4->preset || x4->tune)
if (x264_param_default_preset(&x4->params, x4->preset, x4->tune) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error setting preset/tune %s/%s.\n", x4->preset, x4->tune);
return AVERROR(EINVAL);
}
if (avctx->level > 0)
x4->params.i_level_idc = avctx->level;
x4->params.pf_log = X264_log;
x4->params.p_log_private = avctx;
x4->params.i_log_level = X264_LOG_DEBUG;
x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt);
if (avctx->bit_rate) {
x4->params.rc.i_bitrate = avctx->bit_rate / 1000;
x4->params.rc.i_rc_method = X264_RC_ABR;
}
x4->params.rc.i_vbv_buffer_size = avctx->rc_buffer_size / 1000;
x4->params.rc.i_vbv_max_bitrate = avctx->rc_max_rate / 1000;
x4->params.rc.b_stat_write = avctx->flags & AV_CODEC_FLAG_PASS1;
if (avctx->flags & AV_CODEC_FLAG_PASS2) {
x4->params.rc.b_stat_read = 1;
} else {
if (x4->crf >= 0) {
x4->params.rc.i_rc_method = X264_RC_CRF;
x4->params.rc.f_rf_constant = x4->crf;
} else if (x4->cqp >= 0) {
x4->params.rc.i_rc_method = X264_RC_CQP;
x4->params.rc.i_qp_constant = x4->cqp;
}
if (x4->crf_max >= 0)
x4->params.rc.f_rf_constant_max = x4->crf_max;
}
if (avctx->rc_buffer_size && avctx->rc_initial_buffer_occupancy > 0 &&
(avctx->rc_initial_buffer_occupancy <= avctx->rc_buffer_size)) {
x4->params.rc.f_vbv_buffer_init =
(float)avctx->rc_initial_buffer_occupancy / avctx->rc_buffer_size;
}
if (avctx->i_quant_factor > 0)
x4->params.rc.f_ip_factor = 1 / fabs(avctx->i_quant_factor);
x4->params.rc.f_pb_factor = avctx->b_quant_factor;
x4->params.analyse.i_chroma_qp_offset = avctx->chromaoffset;
if (avctx->gop_size >= 0)
x4->params.i_keyint_max = avctx->gop_size;
if (avctx->max_b_frames >= 0)
x4->params.i_bframe = avctx->max_b_frames;
if (avctx->scenechange_threshold >= 0)
x4->params.i_scenecut_threshold = avctx->scenechange_threshold;
if (avctx->qmin >= 0)
x4->params.rc.i_qp_min = avctx->qmin;
if (avctx->qmax >= 0)
x4->params.rc.i_qp_max = avctx->qmax;
if (avctx->max_qdiff >= 0)
x4->params.rc.i_qp_step = avctx->max_qdiff;
if (avctx->qblur >= 0)
x4->params.rc.f_qblur = avctx->qblur;
if (avctx->qcompress >= 0)
x4->params.rc.f_qcompress = avctx->qcompress;
if (avctx->refs >= 0)
x4->params.i_frame_reference = avctx->refs;
if (avctx->trellis >= 0)
x4->params.analyse.i_trellis = avctx->trellis;
if (avctx->me_range >= 0)
x4->params.analyse.i_me_range = avctx->me_range;
if (avctx->noise_reduction >= 0)
x4->params.analyse.i_noise_reduction = avctx->noise_reduction;
if (avctx->me_subpel_quality >= 0)
x4->params.analyse.i_subpel_refine = avctx->me_subpel_quality;
if (avctx->b_frame_strategy >= 0)
x4->params.i_bframe_adaptive = avctx->b_frame_strategy;
if (avctx->keyint_min >= 0)
x4->params.i_keyint_min = avctx->keyint_min;
#if FF_API_CODER_TYPE
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->coder_type >= 0)
x4->coder = avctx->coder_type == FF_CODER_TYPE_AC;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (avctx->me_cmp >= 0)
x4->params.analyse.b_chroma_me = avctx->me_cmp & FF_CMP_CHROMA;
if (x4->aq_mode >= 0)
x4->params.rc.i_aq_mode = x4->aq_mode;
if (x4->aq_strength >= 0)
x4->params.rc.f_aq_strength = x4->aq_strength;
PARSE_X264_OPT("psy-rd", psy_rd);
PARSE_X264_OPT("deblock", deblock);
PARSE_X264_OPT("partitions", partitions);
PARSE_X264_OPT("stats", stats);
if (x4->psy >= 0)
x4->params.analyse.b_psy = x4->psy;
if (x4->rc_lookahead >= 0)
x4->params.rc.i_lookahead = x4->rc_lookahead;
if (x4->weightp >= 0)
x4->params.analyse.i_weighted_pred = x4->weightp;
if (x4->weightb >= 0)
x4->params.analyse.b_weighted_bipred = x4->weightb;
if (x4->cplxblur >= 0)
x4->params.rc.f_complexity_blur = x4->cplxblur;
if (x4->ssim >= 0)
x4->params.analyse.b_ssim = x4->ssim;
if (x4->intra_refresh >= 0)
x4->params.b_intra_refresh = x4->intra_refresh;
if (x4->bluray_compat >= 0) {
x4->params.b_bluray_compat = x4->bluray_compat;
x4->params.b_vfr_input = 0;
}
if (x4->b_bias != INT_MIN)
x4->params.i_bframe_bias = x4->b_bias;
if (x4->b_pyramid >= 0)
x4->params.i_bframe_pyramid = x4->b_pyramid;
if (x4->mixed_refs >= 0)
x4->params.analyse.b_mixed_references = x4->mixed_refs;
if (x4->dct8x8 >= 0)
x4->params.analyse.b_transform_8x8 = x4->dct8x8;
if (x4->fast_pskip >= 0)
x4->params.analyse.b_fast_pskip = x4->fast_pskip;
if (x4->aud >= 0)
x4->params.b_aud = x4->aud;
if (x4->mbtree >= 0)
x4->params.rc.b_mb_tree = x4->mbtree;
if (x4->direct_pred >= 0)
x4->params.analyse.i_direct_mv_pred = x4->direct_pred;
if (x4->slice_max_size >= 0)
x4->params.i_slice_max_size = x4->slice_max_size;
if (x4->fastfirstpass)
x264_param_apply_fastfirstpass(&x4->params);
if (x4->nal_hrd >= 0)
x4->params.i_nal_hrd = x4->nal_hrd;
if (x4->motion_est >= 0) {
x4->params.analyse.i_me_method = x4->motion_est;
#if FF_API_MOTION_EST
FF_DISABLE_DEPRECATION_WARNINGS
} else {
if (avctx->me_method == ME_EPZS)
x4->params.analyse.i_me_method = X264_ME_DIA;
else if (avctx->me_method == ME_HEX)
x4->params.analyse.i_me_method = X264_ME_HEX;
else if (avctx->me_method == ME_UMH)
x4->params.analyse.i_me_method = X264_ME_UMH;
else if (avctx->me_method == ME_FULL)
x4->params.analyse.i_me_method = X264_ME_ESA;
else if (avctx->me_method == ME_TESA)
x4->params.analyse.i_me_method = X264_ME_TESA;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
if (x4->coder >= 0)
x4->params.b_cabac = x4->coder;
if (x4->profile)
if (x264_param_apply_profile(&x4->params, x4->profile) < 0) {
av_log(avctx, AV_LOG_ERROR, "Error setting profile %s.\n", x4->profile);
return AVERROR(EINVAL);
}
x4->params.i_width = avctx->width;
x4->params.i_height = avctx->height;
x4->params.vui.i_sar_width = avctx->sample_aspect_ratio.num;
x4->params.vui.i_sar_height = avctx->sample_aspect_ratio.den;
x4->params.i_fps_num = x4->params.i_timebase_den = avctx->time_base.den;
x4->params.i_fps_den = x4->params.i_timebase_num = avctx->time_base.num;
x4->params.analyse.b_psnr = avctx->flags & AV_CODEC_FLAG_PSNR;
x4->params.i_threads = avctx->thread_count;
if (avctx->thread_type)
x4->params.b_sliced_threads = avctx->thread_type == FF_THREAD_SLICE;
x4->params.b_interlaced = avctx->flags & AV_CODEC_FLAG_INTERLACED_DCT;
x4->params.b_open_gop = !(avctx->flags & AV_CODEC_FLAG_CLOSED_GOP);
x4->params.i_slice_count = avctx->slices;
x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
avctx->pix_fmt == AV_PIX_FMT_YUVJ444P ||
avctx->color_range == AVCOL_RANGE_JPEG;
x4->params.vui.i_colorprim = avctx->color_primaries;
x4->params.vui.i_transfer = avctx->color_trc;
x4->params.vui.i_colmatrix = avctx->colorspace;
if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)
x4->params.b_repeat_headers = 0;
if (x4->x264_params) {
AVDictionary *dict = NULL;
AVDictionaryEntry *en = NULL;
if (!av_dict_parse_string(&dict, x4->x264_params, "=", ":", 0)) {
while ((en = av_dict_get(dict, "", en, AV_DICT_IGNORE_SUFFIX))) {
if (x264_param_parse(&x4->params, en->key, en->value) < 0)
av_log(avctx, AV_LOG_WARNING,
"Error parsing option '%s = %s'.\n",
en->key, en->value);
}
av_dict_free(&dict);
}
}
avctx->has_b_frames = x4->params.i_bframe ?
x4->params.i_bframe_pyramid ? 2 : 1 : 0;
if (avctx->max_b_frames < 0)
avctx->max_b_frames = 0;
avctx->bit_rate = x4->params.rc.i_bitrate*1000;
x4->enc = x264_encoder_open(&x4->params);
if (!x4->enc)
return AVERROR_UNKNOWN;
if (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) {
x264_nal_t *nal;
uint8_t *p;
int nnal, s, i;
s = x264_encoder_headers(x4->enc, &nal, &nnal);
avctx->extradata = p = av_mallocz(s + AV_INPUT_BUFFER_PADDING_SIZE);
if (!p)
return AVERROR(ENOMEM);
for (i = 0; i < nnal; i++) {
if (nal[i].i_type == NAL_SEI) {
av_log(avctx, AV_LOG_INFO, "%s\n", nal[i].p_payload+25);
x4->sei_size = nal[i].i_payload;
x4->sei = av_malloc(x4->sei_size);
if (!x4->sei)
return AVERROR(ENOMEM);
memcpy(x4->sei, nal[i].p_payload, nal[i].i_payload);
continue;
}
memcpy(p, nal[i].p_payload, nal[i].i_payload);
p += nal[i].i_payload;
}
avctx->extradata_size = p - avctx->extradata;
}
cpb_props = ff_add_cpb_side_data(avctx);
if (!cpb_props)
return AVERROR(ENOMEM);
cpb_props->buffer_size = x4->params.rc.i_vbv_buffer_size * 1000;
cpb_props->max_bitrate = x4->params.rc.i_vbv_max_bitrate * 1000;
cpb_props->avg_bitrate = x4->params.rc.i_bitrate * 1000;
return 0;
}
| 1threat
|
void qvirtqueue_pci_msix_setup(QVirtioPCIDevice *d, QVirtQueuePCI *vqpci,
QGuestAllocator *alloc, uint16_t entry)
{
uint16_t vector;
uint32_t control;
void *addr;
g_assert(d->pdev->msix_enabled);
addr = d->pdev->msix_table + (entry * 16);
g_assert_cmpint(entry, >=, 0);
g_assert_cmpint(entry, <, qpci_msix_table_size(d->pdev));
vqpci->msix_entry = entry;
vqpci->msix_addr = guest_alloc(alloc, 4);
qpci_io_writel(d->pdev, addr + PCI_MSIX_ENTRY_LOWER_ADDR,
vqpci->msix_addr & ~0UL);
qpci_io_writel(d->pdev, addr + PCI_MSIX_ENTRY_UPPER_ADDR,
(vqpci->msix_addr >> 32) & ~0UL);
qpci_io_writel(d->pdev, addr + PCI_MSIX_ENTRY_DATA, vqpci->msix_data);
control = qpci_io_readl(d->pdev, addr + PCI_MSIX_ENTRY_VECTOR_CTRL);
qpci_io_writel(d->pdev, addr + PCI_MSIX_ENTRY_VECTOR_CTRL,
control & ~PCI_MSIX_ENTRY_CTRL_MASKBIT);
qvirtio_pci_queue_select(&d->vdev, vqpci->vq.index);
qpci_io_writew(d->pdev, d->addr + VIRTIO_MSI_QUEUE_VECTOR, entry);
vector = qpci_io_readw(d->pdev, d->addr + VIRTIO_MSI_QUEUE_VECTOR);
g_assert_cmphex(vector, !=, VIRTIO_MSI_NO_VECTOR);
}
| 1threat
|
Regex or any string method : <p>Hi I am trying to validate a string e.g. AA2016MY and I want to validate that the string position from 3 to 6 is a numeric value.</p>
<p>How to do this is simple java way.</p>
| 0debug
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.